diff --git a/.gitignore b/.gitignore index fb1d307b5..60376ad15 100644 --- a/.gitignore +++ b/.gitignore @@ -24,9 +24,13 @@ src/translations/*.qm src/grammar/sqlite3TokenTypes.txt libs/*/Makefile* +libs/*/*/Makefile* libs/*/debug/ +libs/*/*/debug/ libs/*/release/ +libs/*/*/release/ libs/*/*.a +libs/*/*/*.a # Ignore .DS_Store files on OSX .DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt index 6dfdeb132..8a5efa1f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,10 +24,12 @@ endif() set(ANTLR_DIR libs/antlr-2.7.7) set(QHEXEDIT_DIR libs/qhexedit) set(QCUSTOMPLOT_DIR libs/qcustomplot-source) +set(QSCINTILLA_DIR libs/qscintilla/Qt4Qt5) add_subdirectory(${ANTLR_DIR}) add_subdirectory(${QHEXEDIT_DIR}) add_subdirectory(${QCUSTOMPLOT_DIR}) +add_subdirectory(${QSCINTILLA_DIR}) if(USE_QT5) find_package(Qt5Widgets REQUIRED) @@ -62,7 +64,6 @@ set(SQLB_MOC_HDR src/ImportCsvDialog.h src/MainWindow.h src/PreferencesDialog.h - src/SQLiteSyntaxHighlighter.h src/SqlExecutionArea.h src/VacuumDialog.h src/sqlitetablemodel.h @@ -71,6 +72,7 @@ set(SQLB_MOC_HDR src/Application.h src/CipherDialog.h src/ExportSqlDialog.h + src/SqlUiLexer.h ) set(SQLB_SRC @@ -84,7 +86,6 @@ set(SQLB_SRC src/ImportCsvDialog.cpp src/MainWindow.cpp src/PreferencesDialog.cpp - src/SQLiteSyntaxHighlighter.cpp src/SqlExecutionArea.cpp src/VacuumDialog.cpp src/sqlitedb.cpp @@ -99,6 +100,7 @@ set(SQLB_SRC src/Application.cpp src/CipherDialog.cpp src/ExportSqlDialog.cpp + src/SqlUiLexer.cpp ) set(SQLB_FORMS @@ -208,6 +210,7 @@ include_directories( ${ANTLR_DIR} ${QHEXEDIT_DIR} ${QCUSTOMPLOT_DIR} + ${QSCINTILLA_DIR} ${ADDITIONAL_INCLUDE_PATHS} src) @@ -224,17 +227,19 @@ if(USE_QT5) qt5_use_modules(${PROJECT_NAME} Gui Widgets Network Test PrintSupport) set(QT_LIBRARIES "") endif() -add_dependencies(${PROJECT_NAME} antlr qhexedit qcustomplot) +add_dependencies(${PROJECT_NAME} antlr qhexedit qcustomplot qscintilla2) link_directories( "${CMAKE_CURRENT_BINARY_DIR}/${ANTLR_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${QHEXEDIT_DIR}" - "${CMAKE_CURRENT_BINARY_DIR}/${QCUSTOMPLOT_DIR}") + "${CMAKE_CURRENT_BINARY_DIR}/${QCUSTOMPLOT_DIR}" + "${CMAKE_CURRENT_BINARY_DIR}/${QSCINTILLA_DIR}") target_link_libraries(${PROJECT_NAME} antlr qhexedit qcustomplot + qscintilla2 ${QT_LIBRARIES} ${WIN32_STATIC_LINK} ${LIBSQLITE} diff --git a/libs/qscintilla/ChangeLog b/libs/qscintilla/ChangeLog new file mode 100644 index 000000000..823e537a7 --- /dev/null +++ b/libs/qscintilla/ChangeLog @@ -0,0 +1,5016 @@ +2015-04-20 Phil Thompson + + * .hgtags: + Added tag 2.9 for changeset 41ee8162fa81 + [9817b0a7a4f7] [tip] + + * NEWS: + Released as v2.9. + [41ee8162fa81] [2.9] + +2015-04-14 Phil Thompson + + * qt/qsciscintillabase.cpp: + Fixed a problem notifying when focus is lost to another application + widget. + [41734678234e] + +2015-04-06 Phil Thompson + + * qt/qsciscintillabase.cpp: + Fixed a crash when deleting an instance. + [eb936ad1f826] + +2015-04-05 Phil Thompson + + * qt/qsciscintilla.cpp: + Fixed a problem applying a lexer's styles that manifested itself by + the wrong style being applied to line numbers when using a custom + lexer. + [c91009909b8e] + +2015-04-04 Phil Thompson + + * qt/qscintilla_es.qm, qt/qscintilla_es.ts: + Updated Spanish translations from Jaime. + [d94218e7d47d] + + * qt/ScintillaQt.h: + Fixed some header file dependencies. + [f246e863957f] + + * qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_de.ts, + qt/qscintilla_es.qm, qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm: + Updated German translations from Detlev. + [01f3be277e14] + +2015-04-03 Phil Thompson + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts: + Updated the .ts translation files. + [659fb035d1c4] + +2015-04-02 Phil Thompson + + * qt/qsciapis.cpp: + Fixed a problem displaying call-tips when auto-completion is + enabled. + [82ec45421a3d] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.h, + qt/qsciscintillabase.h: + Exposed the remaining new features. + [6e84b61268c5] + +2015-04-01 Phil Thompson + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Exposing new Scintilla functionality. + [e0965dc46693] + +2015-03-31 Phil Thompson + + * qt/qscilexerverilog.cpp, qt/qscilexerverilog.h: + Enabled the new styling features of QsciLexerVerilog. + [5be65189b15f] + + * NEWS, Python/sip/qscilexercpp.sip, qt/qscilexercpp.cpp, + qt/qscilexercpp.h: + Completed the updates to QsciLexerCPP. + [a8e24b727d82] + + * NEWS, Python/sip/qscilexercpp.sip, Python/sip/qscilexersql.sip, + Python/sip/qscilexerverilog.sip, Python/sip/qscilexervhdl.sip, + Python/sip/qsciscintillabase.sip, qt/qscilexercpp.cpp, + qt/qscilexercpp.h, qt/qscilexersql.cpp, qt/qscilexersql.h, + qt/qscilexerverilog.cpp, qt/qscilexerverilog.h, + qt/qscilexervhdl.cpp, qt/qscilexervhdl.h, qt/qsciscintillabase.h: + Updated existing lexers with new styles. + [768f8ff280e1] + +2015-03-30 Phil Thompson + + * qt/qsciapis.cpp: + Make sure call tips don't include image types. + [d0830816cda4] + + * qt/ScintillaQt.cpp, qt/ScintillaQt.h: + Fixed the horizontal scrollbar issues, particularly with long lines. + [db8501c0803f] + +2015-03-29 Phil Thompson + + * qt/ScintillaQt.cpp: + Updated the paste support. + [42ad3657d52e] + + * qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qsciscintillabase.cpp: + Added support for idle processing. + [ff277e910df7] + +2015-03-27 Phil Thompson + + * NEWS: + Updated the NEWS file. + [64766fb4c800] + + * qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Add support for fine tickers. + [3e9b89430dc0] + +2015-03-26 Phil Thompson + + * Makefile, Python/sip/qsciabstractapis.sip, Python/sip/qsciapis.sip, + Python/sip/qscicommandset.sip, Python/sip/qscilexer.sip, + Python/sip/qscilexeravs.sip, Python/sip/qscilexerbash.sip, + Python/sip/qscilexerbatch.sip, Python/sip/qscilexercmake.sip, + Python/sip/qscilexercoffeescript.sip, Python/sip/qscilexercpp.sip, + Python/sip/qscilexercsharp.sip, Python/sip/qscilexercss.sip, + Python/sip/qscilexercustom.sip, Python/sip/qscilexerd.sip, + Python/sip/qscilexerdiff.sip, Python/sip/qscilexerfortran.sip, + Python/sip/qscilexerfortran77.sip, Python/sip/qscilexerhtml.sip, + Python/sip/qscilexeridl.sip, Python/sip/qscilexerjava.sip, + Python/sip/qscilexerjavascript.sip, Python/sip/qscilexerlua.sip, + Python/sip/qscilexermakefile.sip, Python/sip/qscilexermatlab.sip, + Python/sip/qscilexeroctave.sip, Python/sip/qscilexerpascal.sip, + Python/sip/qscilexerperl.sip, Python/sip/qscilexerpo.sip, + Python/sip/qscilexerpostscript.sip, Python/sip/qscilexerpov.sip, + Python/sip/qscilexerproperties.sip, Python/sip/qscilexerpython.sip, + Python/sip/qscilexerruby.sip, Python/sip/qscilexerspice.sip, + Python/sip/qscilexersql.sip, Python/sip/qscilexertcl.sip, + Python/sip/qscilexertex.sip, Python/sip/qscilexerverilog.sip, + Python/sip/qscilexervhdl.sip, Python/sip/qscilexerxml.sip, + Python/sip/qscilexeryaml.sip, Python/sip/qscimacro.sip, + Python/sip/qscimod3.sip, Python/sip/qscimod4.sip, + Python/sip/qscimod5.sip, Python/sip/qscimodcommon.sip, + Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, + build.py, designer-Qt3/designer.pro, designer- + Qt3/qscintillaplugin.cpp, example-Qt3/application.cpp, example- + Qt3/application.h, example-Qt3/application.pro, example- + Qt3/fileopen.xpm, example-Qt3/fileprint.xpm, example- + Qt3/filesave.xpm, example-Qt3/main.cpp, lib/README, lib/README.doc, + lib/qscintilla.dxy, qt/InputMethod.cpp, qt/ListBoxQt.cpp, + qt/PlatQt.cpp, qt/SciClasses.cpp, qt/SciClasses.h, + qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qsciabstractapis.cpp, + qt/qsciabstractapis.h, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qscicommandset.cpp, qt/qscicommandset.h, qt/qscilexer.cpp, + qt/qscilexer.h, qt/qscilexeravs.cpp, qt/qscilexeravs.h, + qt/qscilexerbash.cpp, qt/qscilexerbash.h, qt/qscilexerbatch.cpp, + qt/qscilexerbatch.h, qt/qscilexercmake.cpp, qt/qscilexercmake.h, + qt/qscilexercoffeescript.cpp, qt/qscilexercoffeescript.h, + qt/qscilexercpp.cpp, qt/qscilexercpp.h, qt/qscilexercsharp.cpp, + qt/qscilexercsharp.h, qt/qscilexercss.cpp, qt/qscilexercss.h, + qt/qscilexercustom.cpp, qt/qscilexercustom.h, qt/qscilexerd.cpp, + qt/qscilexerd.h, qt/qscilexerdiff.cpp, qt/qscilexerdiff.h, + qt/qscilexerfortran.cpp, qt/qscilexerfortran.h, + qt/qscilexerfortran77.cpp, qt/qscilexerfortran77.h, + qt/qscilexerhtml.cpp, qt/qscilexerhtml.h, qt/qscilexeridl.cpp, + qt/qscilexeridl.h, qt/qscilexerjava.cpp, qt/qscilexerjava.h, + qt/qscilexerjavascript.cpp, qt/qscilexerjavascript.h, + qt/qscilexerlua.cpp, qt/qscilexerlua.h, qt/qscilexermakefile.cpp, + qt/qscilexermakefile.h, qt/qscilexermatlab.cpp, + qt/qscilexermatlab.h, qt/qscilexeroctave.cpp, qt/qscilexeroctave.h, + qt/qscilexerpascal.cpp, qt/qscilexerpascal.h, qt/qscilexerperl.cpp, + qt/qscilexerperl.h, qt/qscilexerpo.cpp, qt/qscilexerpo.h, + qt/qscilexerpostscript.cpp, qt/qscilexerpostscript.h, + qt/qscilexerpov.cpp, qt/qscilexerpov.h, qt/qscilexerproperties.cpp, + qt/qscilexerproperties.h, qt/qscilexerpython.cpp, + qt/qscilexerpython.h, qt/qscilexerruby.cpp, qt/qscilexerruby.h, + qt/qscilexerspice.cpp, qt/qscilexerspice.h, qt/qscilexersql.cpp, + qt/qscilexersql.h, qt/qscilexertcl.cpp, qt/qscilexertcl.h, + qt/qscilexertex.cpp, qt/qscilexertex.h, qt/qscilexerverilog.cpp, + qt/qscilexerverilog.h, qt/qscilexervhdl.cpp, qt/qscilexervhdl.h, + qt/qscilexerxml.cpp, qt/qscilexerxml.h, qt/qscilexeryaml.cpp, + qt/qscilexeryaml.h, qt/qscimacro.cpp, qt/qscimacro.h, + qt/qsciprinter.cpp, qt/qsciscintilla.cpp, qt/qsciscintilla.h, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h, qt/qscistyle.cpp, + qt/qscistyledtext.h: + Removed all support for Qt3 and PyQt3. + [b33b2f06716e] + + * Python/configure-old.py, Python/configure.py, designer- + Qt4Qt5/designer.pro, example-Qt4Qt5/application.pro, + qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qscintilla.pro: + The updated code now compiles. + [35d05076c62f] + + * cocoa/InfoBar.h, cocoa/InfoBar.mm, cocoa/InfoBarCommunicator.h, + cocoa/PlatCocoa.h, cocoa/PlatCocoa.mm, cocoa/QuartzTextLayout.h, + cocoa/QuartzTextStyle.h, cocoa/ScintillaCocoa.h, + cocoa/ScintillaCocoa.mm, cocoa/ScintillaFramework/ScintillaFramework + .xcodeproj/project.pbxproj, cocoa/ScintillaTest/AppController.h, + cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj, + cocoa/ScintillaView.h, cocoa/ScintillaView.mm, + cocoa/checkbuildosx.sh, cppcheck.suppress, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/index.html, gtk/Converter.h, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, gtk/deps.mak, gtk/makefile, + include/Platform.h, include/SciLexer.h, include/Scintilla.h, + include/Scintilla.iface, lexers/LexAbaqus.cxx, lexers/LexAsm.cxx, + lexers/LexBash.cxx, lexers/LexBasic.cxx, lexers/LexBibTeX.cxx, + lexers/LexCPP.cxx, lexers/LexCmake.cxx, lexers/LexCoffeeScript.cxx, + lexers/LexDMAP.cxx, lexers/LexDMIS.cxx, lexers/LexECL.cxx, + lexers/LexEScript.cxx, lexers/LexForth.cxx, lexers/LexFortran.cxx, + lexers/LexGui4Cli.cxx, lexers/LexHTML.cxx, lexers/LexHaskell.cxx, + lexers/LexHex.cxx, lexers/LexKix.cxx, lexers/LexLua.cxx, + lexers/LexMarkdown.cxx, lexers/LexMatlab.cxx, lexers/LexModula.cxx, + lexers/LexMySQL.cxx, lexers/LexOthers.cxx, lexers/LexPS.cxx, + lexers/LexPerl.cxx, lexers/LexRegistry.cxx, lexers/LexRuby.cxx, + lexers/LexRust.cxx, lexers/LexSQL.cxx, lexers/LexScriptol.cxx, + lexers/LexSpecman.cxx, lexers/LexTCL.cxx, lexers/LexTCMD.cxx, + lexers/LexTxt2tags.cxx, lexers/LexVHDL.cxx, lexers/LexVerilog.cxx, + lexers/LexVisualProlog.cxx, lexlib/Accessor.cxx, lexlib/Accessor.h, + lexlib/CharacterCategory.cxx, lexlib/CharacterSet.cxx, + lexlib/LexAccessor.h, lexlib/LexerBase.cxx, lexlib/LexerModule.cxx, + lexlib/LexerModule.h, lexlib/LexerNoExceptions.cxx, + lexlib/LexerSimple.cxx, lexlib/LexerSimple.h, + lexlib/PropSetSimple.cxx, lexlib/SparseState.h, lexlib/StringCopy.h, + lexlib/StyleContext.cxx, lexlib/StyleContext.h, lexlib/SubStyles.h, + lexlib/WordList.cxx, lexlib/WordList.h, lib/README.doc, + qt/qscintilla.pro, scripts/GenerateCaseConvert.py, + scripts/GenerateCharacterCategory.py, scripts/HFacer.py, + scripts/HeaderOrder.txt, scripts/LexGen.py, + scripts/ScintillaData.py, src/AutoComplete.cxx, src/AutoComplete.h, + src/CallTip.cxx, src/CaseConvert.cxx, src/CaseFolder.cxx, + src/Catalogue.cxx, src/CellBuffer.cxx, src/CellBuffer.h, + src/CharClassify.cxx, src/ContractionState.cxx, + src/ContractionState.h, src/Decoration.cxx, src/Decoration.h, + src/Document.cxx, src/Document.h, src/EditModel.cxx, + src/EditModel.h, src/EditView.cxx, src/EditView.h, src/Editor.cxx, + src/Editor.h, src/ExternalLexer.cxx, src/ExternalLexer.h, + src/FontQuality.h, src/Indicator.cxx, src/Indicator.h, + src/KeyMap.cxx, src/KeyMap.h, src/LineMarker.cxx, src/LineMarker.h, + src/MarginView.cxx, src/MarginView.h, src/Partitioning.h, + src/PerLine.cxx, src/PerLine.h, src/PositionCache.cxx, + src/PositionCache.h, src/RESearch.cxx, src/RESearch.h, + src/ScintillaBase.cxx, src/ScintillaBase.h, src/Selection.cxx, + src/Selection.h, src/SplitVector.h, src/Style.cxx, src/Style.h, + src/UniConversion.cxx, src/UniConversion.h, src/ViewStyle.cxx, + src/ViewStyle.h, src/XPM.cxx, src/XPM.h, test/XiteQt.py, + test/XiteWin.py, test/lexTests.py, test/simpleTests.py, + test/unit/LICENSE_1_0.txt, test/unit/README, + test/unit/SciTE.properties, test/unit/catch.hpp, test/unit/makefile, + test/unit/test.mak, test/unit/testCellBuffer.cxx, + test/unit/testCharClassify.cxx, test/unit/testContractionState.cxx, + test/unit/testDecoration.cxx, test/unit/testPartitioning.cxx, + test/unit/testRunStyles.cxx, test/unit/testSparseState.cxx, + test/unit/testSplitVector.cxx, test/unit/testUnicodeFromUTF8.cxx, + test/unit/unitTest.cxx, version.txt, win32/HanjaDic.cxx, + win32/HanjaDic.h, win32/PlatWin.cxx, win32/PlatWin.h, + win32/SciLexer.vcxproj, win32/ScintRes.rc, win32/ScintillaWin.cxx, + win32/deps.mak, win32/makefile, win32/scintilla.mak: + Added the initial import of Scintilla v3.5.4. + [025db9484942] + + * lib/GPL_EXCEPTION.TXT, lib/GPL_EXCEPTION_ADDENDUM.TXT, + lib/LICENSE.GPL2, lib/LICENSE.GPL3, lib/OPENSOURCE-NOTICE.TXT, + qt/qscintilla_ru.qm, qt/qscintilla_ru.ts: + Merged the 2.8-maint branch into the default. + [efe1067a091a] + +2015-03-19 Phil Thompson + + * qt/qsciscintilla.cpp: + Fixed QsciScintilla::clearMarginText(). + [885b972e38df] <2.8-maint> + +2015-02-14 Phil Thompson + + * Makefile, Python/configure.py: + Installing into a virtual env should now work. The internal build + system supports sip5. + [62d128cc92de] <2.8-maint> + +2015-02-08 Phil Thompson + + * Python/configure.py: + Use sip5 if available. + [6f5e4b0dae8f] <2.8-maint> + +2015-01-02 Phil Thompson + + * Python/configure.py, lib/LICENSE.commercial.short, lib/LICENSE.gpl, + lib/LICENSE.gpl.short, qt/InputMethod.cpp: + Updated the copyright notices. + [50b9b459dc48] <2.8-maint> + + * Python/configure-old.py: + Fixed configure-old.py for previews. + [7ff9140391e4] <2.8-maint> + +2014-12-22 Phil Thompson + + * build.py, lib/LICENSE.GPL3, lib/LICENSE.commercial.short, + lib/LICENSE.gpl, lib/LICENSE.gpl.short: + More license tweaks. + [f3e84d697877] <2.8-maint> + + * build.py, lib/GPL_EXCEPTION.TXT, lib/GPL_EXCEPTION_ADDENDUM.TXT, + lib/LICENSE.GPL2, lib/LICENSE.gpl.short, lib/OPENSOURCE-NOTICE.TXT, + lib/README.doc: + Aligned the GPL licensing with Qt. + [aa58ba575cac] <2.8-maint> + +2014-12-21 Phil Thompson + + * lib/LICENSE.commercial: + Updated the commercial license to v4.0. + [fd91beaa78dd] <2.8-maint> + +2014-11-16 Phil Thompson + + * build.py: + A source package now includes a full ChangeLog. + [ba92c1d5c839] <2.8-maint> + +2014-09-11 Phil Thompson + + * .hgtags: + Added tag 2.8.4 for changeset e18756e8cf86 + [e7f7a594518d] <2.8-maint> + + * .hgignore, NEWS: + Released as v2.8.4. + [e18756e8cf86] [2.8.4] <2.8-maint> + +2014-09-04 Phil Thompson + + * NEWS: + Updated the NEWS file. + [e4e3562b54cb] <2.8-maint> + +2014-09-03 Phil Thompson + + * Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, + qt/qscintilla.pro, qt/qsciscintilla.cpp, qt/qsciscintilla.h, + qt/qsciscintillabase.h: + Added the missing SCI_SETHOTSPOTSINGLELINE to QsciScintillaBase. + Added resetHotspotForegroundColor(), resetHotspotBackgroundColor(), + setHotspotForegroundColor(), setHotspotBackgroundColor(), + setHotspotUnderline() and setHotspotWrap() to QsciScintilla. + [2da018f7e48c] <2.8-maint> + +2014-07-31 Phil Thompson + + * qt/qsciscintilla.cpp: + Attempted to improve the auto-indentation behaviour so that the + indentation of a line is maintained if a new line has been inserted + above by pressing enter at the start of the line. + [aafc4a7247fb] <2.8-maint> + +2014-07-11 Phil Thompson + + * Python/configure.py: + Fixed the installation of the .api file. + [aae8494847ff] <2.8-maint> + +2014-07-10 Phil Thompson + + * Python/configure.py, designer-Qt4Qt5/designer.pro, + qt/qscintilla.pro: + Fixes to work around QTBUG-39300. Fix when building with a + configuration file. + [1051e8c260fd] <2.8-maint> + +2014-07-03 Phil Thompson + + * .hgtags: + Added tag 2.8.3 for changeset e9cb8530f97f + [bb531051c8f3] <2.8-maint> + + * NEWS: + Released as v2.8.3. + [e9cb8530f97f] [2.8.3] <2.8-maint> + +2014-07-01 Phil Thompson + + * Python/configure.py: + Fixed a cut-and-paste bug in configure.py. + [5f7c4c6c9a29] <2.8-maint> + + * Python/configure.py: + Updated to the latest build system boilerplate. + [ee0b9a647e7a] <2.8-maint> + +2014-06-30 Phil Thompson + + * Makefile, Python/configure.py: + Updates to the build system and the latest boilerplate configure.py. + [8485111172c7] <2.8-maint> + +2014-06-19 Phil Thompson + + * qt/qscilexercoffeescript.cpp, qt/qscintilla.pro, + qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_de.ts, + qt/qscintilla_es.qm, qt/qscintilla_es.ts, qt/qscintilla_fr.qm, + qt/qscintilla_pt_br.qm, qt/qscintilla_ru.qm, qt/qscintilla_ru.ts: + Updated CoffeeScript keywords and German translations from Detlev. + Updated Spanish translations from Jaime. Removed the Russian + translations as none were current. + [978fe16935c4] <2.8-maint> + +2014-06-15 Phil Thompson + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the translation source files. + [440ab56f1863] <2.8-maint> + +2014-06-09 Phil Thompson + + * Python/sip/qscilexercoffeescript.sip, Python/sip/qscimodcommon.sip, + Python/sip/qsciscintillabase.sip: + Added QsciLexerCoffeeScript to the Python bindings. + [36a6e2123a69] <2.8-maint> + + * qt/qscilexercoffeescript.h: + QsciLexerCoffeeScript property setters are no longer virtual slots. + [eef97550eb16] <2.8-maint> + + * qt/qscilexercoffeescript.cpp, qt/qscilexercoffeescript.h, + qt/qscintilla.pro: + Added the QsciLexerCoffeeScript class. + [0cf56e9cd32a] <2.8-maint> + +2014-06-03 Phil Thompson + + * Python/configure.py: + Fixes for Python v2.6. + [9b7b5393f228] <2.8-maint> + +2014-06-01 Phil Thompson + + * Python/configure.py: + Fixed a regression in configure.py when using the -n or -o options. + [f7b1c9821894] <2.8-maint> + +2014-05-29 Phil Thompson + + * qt/PlatQt.cpp, qt/qsciscintillabase.cpp: + Fixes for Qt3. + [4d0a54024b52] <2.8-maint> + + * qt/PlatQt.cpp, qt/qscilexer.cpp, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qscistyle.cpp: + Font sizes are now handled as floating point values rather than + integers. + [ea017cc2b198] <2.8-maint> + +2014-05-26 Phil Thompson + + * .hgtags: + Added tag 2.8.2 for changeset 5aab3ae01e0e + [6cc6eec7c440] <2.8-maint> + + * NEWS: + Released as v2.8.2. + [5aab3ae01e0e] [2.8.2] <2.8-maint> + + * Python/sip/qsciscintillabase.sip: + Updated the sub-class converter code. + [9b276dae576d] <2.8-maint> + + * Makefile: + Internal build system fixes. + [b29b24829b0b] <2.8-maint> + +2014-05-24 Phil Thompson + + * Makefile, Python/configure.py: + Fixed some build regressions with PyQt4. + [175b657ad031] <2.8-maint> + +2014-05-18 Phil Thompson + + * Makefile: + Updates to the top-level Makefile for the latest Android tools. + [405fb3eb5473] <2.8-maint> + +2014-05-17 Phil Thompson + + * Makefile: + Added the PyQt4 against Qt5 on the iPhone simulator build target. + [c31ae5795eec] <2.8-maint> + +2014-05-16 Phil Thompson + + * Makefile, Python/configure.py: + Use the PyQt .sip files in sysroot when cross-compiling. + [5d8e8b8ddfe5] <2.8-maint> + + * Makefile, Python/configure.py: + Replaced pyqt_sip_flags with pyqt_disabled_features in the + configuration file. + [f209403c183b] <2.8-maint> + +2014-05-15 Phil Thompson + + * Makefile, Python/sip/qscimod5.sip: + The PyQt5 bindings now run on the iOS simulator. + [056871b18335] <2.8-maint> + + * Makefile, Python/configure.py: + Building the Python bindings for the iOS simulator now works. + [9dfcea4447b8] <2.8-maint> + + * Makefile: + Updated the main Makefile for the Qt v5.2 iOS support. + [a619fd411878] <2.8-maint> + +2014-05-14 Phil Thompson + + * Python/configure.py: + Don't create the .api file if it isn't going to be installed. + [79db1145e882] <2.8-maint> + +2014-05-12 Phil Thompson + + * Python/configure.py: + Added the --sysroot, --no-sip-files and --no-qsci-api options to + configure.py. + [10642d7deba9] <2.8-maint> + +2014-05-05 Phil Thompson + + * Makefile: + Updated the internal build system for the combined iOS/Android Qt + installation. + [9097d3096b70] <2.8-maint> + +2014-05-04 Phil Thompson + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Updated German translations from Detlev. + [d4f631ee3aaf] <2.8-maint> + + * qt/qscintilla_es.qm, qt/qscintilla_es.ts: + Updated Spanish translations from Jaime Seuma. + [51350008c8a4] <2.8-maint> + +2014-04-30 Phil Thompson + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the .ts files. + [4c5f88b22952] <2.8-maint> + +2014-04-29 Phil Thompson + + * Python/sip/qscilexerpo.sip, Python/sip/qscimodcommon.sip, + qt/qscilexerpo.cpp, qt/qscilexerpo.h, qt/qscintilla.pro: + Added the QsciLexerPO class. + [d42e44550d80] <2.8-maint> + + * Python/sip/qscilexeravs.sip, Python/sip/qscimodcommon.sip, + qt/qscilexeravs.cpp, qt/qscilexeravs.h, qt/qscintilla.pro: + Added the QsciLexerAVS class. + [ed6edb6ec205] <2.8-maint> + +2014-04-27 Phil Thompson + + * Python/configure.py: + Fixes for the refactored configure.py. + [21b9fa66338e] <2.8-maint> + + * Python/configure.py: + Initial refactoring of configure.py so that it is implemented as + configurable (and reusable) boilerplate. + [615d75a88db9] <2.8-maint> + +2014-04-24 Phil Thompson + + * Python/sip/qsciscintilla.sip, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + setEnabled() now implements the expected visual effects. + [3e4254394b08] <2.8-maint> + +2014-03-22 Phil Thompson + + * Python/configure.py: + Fixed the handling of the --pyqt-sip-flags option. Restored the + specification of the Python library directory for Windows. + [3ea496d62b9f] <2.8-maint> + + * Python/configure.py, qt/features/qscintilla2.prf, qt/qscintilla.pro: + Added the --pyqt-sip-flags to configure.py to avoid having to + introspect PyQt. Fixed the .prf file for OS/X. Tweaks to + configure.py so that a configuration file will use the same names as + PyQt5. + [77ff3a21d00a] <2.8-maint> + +2014-03-21 Phil Thompson + + * Makefile, lib/README.doc, qt/qscintilla.pro: + Changes to the .pro file to build a static library without having to + edit it. + [f82637449276] <2.8-maint> + +2014-03-17 Phil Thompson + + * qt/PlatQt.cpp, qt/qsciscintillabase.cpp: + Fixed building against Qt v5.0.x. + [d68e28068b67] <2.8-maint> + +2014-03-14 Phil Thompson + + * .hgtags: + Added tag 2.8.1 for changeset 6bb7ab27c958 + [dfd473e8336b] <2.8-maint> + + * NEWS: + Released as v2.8.1. + [6bb7ab27c958] [2.8.1] <2.8-maint> + + * qt/SciClasses.cpp: + Fixed the display of UTF-8 call tips. + [3f0ca7ba60a0] <2.8-maint> + +2014-03-12 Phil Thompson + + * qsci/api/python/Python-3.4.api: + Added the .api file for Python v3.4. + [3db067b6dcec] <2.8-maint> + +2014-03-05 Phil Thompson + + * qt/PlatQt.cpp: + Revised attempt at the outline of alpha rectangles in case Qt ignore + the alpha of the pen. + [86ab8898503e] <2.8-maint> + + * qt/PlatQt.cpp: + Fixed the setting of the pen when drawing alpha rectangles. + [3f4ff2e8aca3] <2.8-maint> + +2014-02-09 Phil Thompson + + * Python/configure.py: + The Python module now has the correct install name on OS/X. + [eec8c704418a] <2.8-maint> + +2014-02-04 Phil Thompson + + * qt/qscicommand.cpp, qt/qscicommand.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Fixed a problem entering non-ASCII characters that clashed with + Scintilla's SCK_* values. Key_Enter, Key_Backtab, Key_Super_L, + Key_Super_R and Key_Menu are now valid QsciCommand keys. + [94aec4f075df] <2.8-maint> + +2014-01-31 Phil Thompson + + * qt/qsciscintilla.cpp: + Make sure the editor is active after a selection of a user list + entry. + [e0f2106777d0] <2.8-maint> + +2014-01-23 Phil Thompson + + * qt/SciClasses.cpp: + On Linux, single clicking on an item in an auto-completion list now + just selects the itemm (rather than inserting the item) to be + consistent with other platforms. + [d916bbbf6517] <2.8-maint> + + * qt/qsciscintillabase.cpp: + Fix the handling of the auto-completion list when losing focus. + [a67b51ac8611] <2.8-maint> + +2014-01-22 Phil Thompson + + * qt/InputMethod.cpp, qt/qsciscintillabase.cpp: + Fixed building against Qt4. + [bf0a5f984fc1] <2.8-maint> + +2014-01-19 Phil Thompson + + * NEWS: + Updated the NEWS file. + [da2a76da712e] <2.8-maint> + +2014-01-18 Phil Thompson + + * qt/InputMethod.cpp: + Another attempt to fix input events on losing focus. + [6de3ab62fade] <2.8-maint> + + * lib/README.doc: + Added the qmake integration section to the docs. + [2918e4760c36] <2.8-maint> + +2014-01-07 Phil Thompson + + * Makefile: + Added Android to the internal build system. + [3be74b3e89e9] <2.8-maint> + +2014-01-06 Phil Thompson + + * qt/InputMethod.cpp, qt/qsciscintillabase.cpp: + Newlines can now be entered on iOS. + [8d23447dbd4d] <2.8-maint> + +2014-01-05 Phil Thompson + + * qt/InputMethod.cpp: + See if we can detect a input methdo event generated when losing + focus and not to clear the selection. + [8e4216289efe] <2.8-maint> + +2014-01-04 Phil Thompson + + * Python/sip/qsciprinter.sip: + The Python bindings now respect the PyQt_Printer feature. + [c3106f715803] <2.8-maint> + +2014-01-03 Phil Thompson + + * qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Added support for software input panels with Qt v5. + [d4499b61ff04] <2.8-maint> + + * qt/qsciscintilla.cpp: + Disable input methods when read-only (rather than non-UTF8) to be + consistent with Qt. + [f8817d4a47e3] <2.8-maint> + + * qt/qscintilla.pro, qt/qsciprinter.h: + Fixed the .pro file so that QT_NO_PRINTER is set properly and + removed the workaround. + [b5a6709d814a] <2.8-maint> + +2014-01-02 Phil Thompson + + * qt/PlatQt.cpp: + Finally fixed buffered drawing on retina displays. + [f8d23103df70] <2.8-maint> + + * qt/PlatQt.cpp, qt/qsciscintillabase.cpp: + Fixes for buffered drawing on retina displays. (Not yet correct, but + close.) + [a3b36be44112] <2.8-maint> + + * Makefile: + Changed the build system for the example on the iOS simulator so + that qmake is only used to generate the .xcodeproj file. + [179dbf5ba385] <2.8-maint> + + * Makefile: + Added the building of the example to the main Makefile. + [aec2ac3ac591] <2.8-maint> + + * Makefile: + Added iOS simulator targets to the build system. + [72af8241b261] <2.8-maint> + + * Makefile, build.py, lib/LICENSE.GPL2, lib/LICENSE.GPL3, + lib/LICENSE.commercial.short, lib/LICENSE.gpl.short, + qt/InputMethod.cpp: + Updated copyright notices. + [f21e016499fe] <2.8-maint> + + * qt/MacPasteboardMime.cpp, qt/qsciprinter.cpp, qt/qsciprinter.h, + qt/qsciscintillabase.cpp: + Fixes for building for iOS. + [46d25e648b4a] <2.8-maint> + +2013-12-31 Phil Thompson + + * Python/configure.py, build.py, designer-Qt4Qt5/designer.pro, + example-Qt4Qt5/application.pro, lib/README.doc, + qt/features/qscintilla2.prf, qt/qscintilla.pro: + Implemented the qscintilla2.prf feature file and updated everything + to use it. + [c3bfef1a55ad] <2.8-maint> + +2013-12-29 Phil Thompson + + * qt/ScintillaQt.h: + Added some additional header file dependencies. + [7ec67eced9de] <2.8-maint> + +2013-12-21 Phil Thompson + + * qt/MacPasteboardMime.cpp, qt/ScintillaQt.cpp: + Fixes for building against Qt3. + [f25cbda736fd] <2.8-maint> + +2013-12-16 Phil Thompson + + * designer-Qt4Qt5/designer.pro, example-Qt4Qt5/application.pro: + Updated the plugin and example .pro files to work around the qmake + incompatibilities introduced in Qt v5.2.0. + [a14729b2702d] <2.8-maint> + +2013-12-15 Phil Thompson + + * qt/qsciscintillabase.cpp: + Fixed the previous fix. + [6c322fa1b20f] <2.8-maint> + +2013-12-14 Phil Thompson + + * qt/PlatQt.cpp, qt/qsciscintillabase.cpp: + Backed out the attempted fix for retina displays at it needs more + work. As a workaround buffered writes are disabled if a retina + display is detected. + [a1f648d1025e] <2.8-maint> + +2013-12-13 Phil Thompson + + * qt/qscintilla.pro: + Enabled exceptions in the .pro file. + [6e07131f6741] <2.8-maint> + +2013-12-12 Phil Thompson + + * qt/PlatQt.cpp: + Create pixmaps for buffered drawing using the same pixel ratio as + the actual device. + [f4f706006071] <2.8-maint> + +2013-12-09 Phil Thompson + + * qt/qscilexeroctave.cpp: + Updated the keywords defined for the Octave lexer. + [9ccf1c74f266] <2.8-maint> + +2013-12-06 Phil Thompson + + * qt/ScintillaQt.cpp: + More scrollbar fixes. + [194a2142c9b6] <2.8-maint> + +2013-12-05 Phil Thompson + + * qt/ScintillaQt.cpp, qt/qscintilla.pro: + Fixes to the scrollbar visibility handling. + [5e8a96258ab0] <2.8-maint> + +2013-12-04 Phil Thompson + + * qt/PlatQt.cpp: + Fixed the implementation of SurfaceImpl::LogPixelsY() (even though + it is never called). + [9ef0387cfc08] <2.8-maint> + +2013-11-08 Phil Thompson + + * .hgtags: + Added tag 2.8 for changeset 562785a5f685 + [fc52bfaa75c4] + + * NEWS: + Released as v2.8. + [562785a5f685] [2.8] + +2013-11-05 Phil Thompson + + * qt/qscintilla_es.qm, qt/qscintilla_es.ts: + Updated Spanish translations from Jaime Seuma. + [e7a128a28157] + +2013-11-04 Phil Thompson + + * NEWS, Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/qscilexerpascal.cpp, qt/qsciscintillabase.h: + Added support for the new v3.3.6 features to the low-level API. + [e553c1263387] + + * Makefile, NEWS, cocoa/Framework.mk, cocoa/InfoBar.mm, + cocoa/PlatCocoa.mm, cocoa/SciTest.mk, cocoa/ScintillaCocoa.h, + cocoa/ScintillaCocoa.mm, cocoa/ScintillaFramework/ScintillaFramework + .xcodeproj/project.pbxproj, cocoa/ScintillaView.h, + cocoa/ScintillaView.mm, cocoa/checkbuildosx.sh, cocoa/common.mk, + doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/index.html, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, gtk/makefile, include/ILexer.h, + include/Platform.h, include/SciLexer.h, include/Scintilla.h, + include/Scintilla.iface, lexers/LexCPP.cxx, + lexers/LexCoffeeScript.cxx, lexers/LexOthers.cxx, + lexers/LexPascal.cxx, lexers/LexPerl.cxx, lexers/LexRust.cxx, + lexers/LexSQL.cxx, lexers/LexVisualProlog.cxx, + lexlib/StyleContext.h, lexlib/SubStyles.h, lexlib/WordList.cxx, + lib/README.doc, qt/qscintilla.pro, src/Catalogue.cxx, + src/Document.cxx, src/Editor.cxx, src/ScintillaBase.cxx, + src/ScintillaBase.h, src/ViewStyle.cxx, src/ViewStyle.h, + test/XiteQt.py, test/simpleTests.py, version.txt, win32/PlatWin.cxx, + win32/ScintRes.rc, win32/ScintillaWin.cxx, win32/makefile, + win32/scintilla.mak: + Merged Scintilla v3.3.6. + [ada0941dec52] + +2013-10-07 Phil Thompson + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Updated German translations from Detlev. + [6c0af6af651c] + + * Makefile, build.py, qt/MacPasteboardMime.cpp, qt/qscintilla.pro, + qt/qsciscintillabase.cpp: + Reinstated support for rectangular selections on OS/X for Qt v5.2 + and later. + [dbfdf7be4793] + +2013-10-04 Phil Thompson + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the translation source files. + [7ed4bf7ed4e7] + + * qt/qscilexercpp.cpp: + Added missing descriptions to the C++ lexer settings. + [55d7627bb129] + +2013-10-01 Phil Thompson + + * designer-Qt4Qt5/designer.pro, example-Qt4Qt5/application.pro: + Fixed the building of the Designer plugin and the example for OS/X. + [a67f71b06d3c] + + * NEWS, Python/sip/qsciscintillabase.sip, qt/InputMethod.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added the remaining non-provisional Scintilla v3.3.5 features to the + low-level API. + [4e8d0b46ebc0] + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the translation source files. + [4beefc0d95ec] + + * NEWS, Python/sip/qscilexercpp.sip, Python/sip/qsciscintillabase.sip, + qt/qscilexercpp.cpp, qt/qscilexercpp.h, qt/qsciscintillabase.h: + Updated the lexers for Scintilla v3.3.5. + [fc901a2a491f] + +2013-09-30 Phil Thompson + + * Python/configure-old.py, Python/configure.py, README, + cocoa/InfoBar.mm, cocoa/PlatCocoa.mm, cocoa/ScintillaCocoa.h, + cocoa/ScintillaCocoa.mm, cocoa/ScintillaFramework/ScintillaFramework + .xcodeproj/project.pbxproj, cocoa/ScintillaTest/AppController.mm, + cocoa/ScintillaTest/English.lproj/MainMenu.xib, + cocoa/ScintillaView.h, cocoa/ScintillaView.mm, cppcheck.suppress, + delbin.bat, designer-Qt4Qt5/designer.pro, doc/Lexer.txt, + doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/ScintillaToDo.html, doc/index.html, example- + Qt4Qt5/application.pro, gtk/Converter.h, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, gtk/deps.mak, gtk/makefile, include/Face.py, + include/HFacer.py, include/ILexer.h, include/Platform.h, + include/SciLexer.h, include/Scintilla.h, include/Scintilla.iface, + lexers/LexA68k.cxx, lexers/LexAU3.cxx, lexers/LexAVE.cxx, + lexers/LexAda.cxx, lexers/LexAsm.cxx, lexers/LexAsn1.cxx, + lexers/LexBash.cxx, lexers/LexBullant.cxx, lexers/LexCOBOL.cxx, + lexers/LexCPP.cxx, lexers/LexCoffeeScript.cxx, lexers/LexConf.cxx, + lexers/LexCrontab.cxx, lexers/LexCsound.cxx, lexers/LexD.cxx, + lexers/LexECL.cxx, lexers/LexForth.cxx, lexers/LexGAP.cxx, + lexers/LexGui4Cli.cxx, lexers/LexHTML.cxx, lexers/LexHaskell.cxx, + lexers/LexInno.cxx, lexers/LexKVIrc.cxx, lexers/LexLaTeX.cxx, + lexers/LexLisp.cxx, lexers/LexLout.cxx, lexers/LexLua.cxx, + lexers/LexMMIXAL.cxx, lexers/LexMPT.cxx, lexers/LexMSSQL.cxx, + lexers/LexMatlab.cxx, lexers/LexModula.cxx, lexers/LexMySQL.cxx, + lexers/LexNsis.cxx, lexers/LexOpal.cxx, lexers/LexOthers.cxx, + lexers/LexPO.cxx, lexers/LexPerl.cxx, lexers/LexPowerShell.cxx, + lexers/LexPython.cxx, lexers/LexR.cxx, lexers/LexRuby.cxx, + lexers/LexSTTXT.cxx, lexers/LexScriptol.cxx, lexers/LexSpice.cxx, + lexers/LexTCMD.cxx, lexers/LexYAML.cxx, lexlib/Accessor.cxx, + lexlib/Accessor.h, lexlib/CharacterCategory.cxx, + lexlib/CharacterCategory.h, lexlib/CharacterSet.cxx, + lexlib/LexAccessor.h, lexlib/LexerBase.cxx, lexlib/LexerModule.cxx, + lexlib/LexerNoExceptions.cxx, lexlib/LexerNoExceptions.h, + lexlib/LexerSimple.cxx, lexlib/OptionSet.h, + lexlib/PropSetSimple.cxx, lexlib/PropSetSimple.h, + lexlib/StyleContext.cxx, lexlib/StyleContext.h, lexlib/SubStyles.h, + lexlib/WordList.cxx, lexlib/WordList.h, lib/README.doc, + qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qscintilla.pro, + qt/qsciscintillabase.cpp, scripts/Face.py, scripts/FileGenerator.py, + scripts/GenerateCaseConvert.py, + scripts/GenerateCharacterCategory.py, scripts/HFacer.py, + scripts/LexGen.py, scripts/ScintillaData.py, src/AutoComplete.cxx, + src/AutoComplete.h, src/CallTip.cxx, src/CallTip.h, + src/CaseConvert.cxx, src/CaseConvert.h, src/CaseFolder.cxx, + src/CaseFolder.h, src/Catalogue.cxx, src/CellBuffer.cxx, + src/CellBuffer.h, src/ContractionState.cxx, src/Decoration.cxx, + src/Decoration.h, src/Document.cxx, src/Document.h, src/Editor.cxx, + src/Editor.h, src/ExternalLexer.cxx, src/FontQuality.h, + src/Indicator.cxx, src/KeyMap.cxx, src/KeyMap.h, src/LexGen.py, + src/LineMarker.cxx, src/LineMarker.h, src/Partitioning.h, + src/PerLine.cxx, src/PerLine.h, src/PositionCache.cxx, + src/PositionCache.h, src/RESearch.cxx, src/RESearch.h, + src/RunStyles.cxx, src/RunStyles.h, src/SVector.h, + src/ScintillaBase.cxx, src/ScintillaBase.h, src/Selection.cxx, + src/SplitVector.h, src/Style.cxx, src/Style.h, + src/UniConversion.cxx, src/UniConversion.h, src/UnicodeFromUTF8.h, + src/ViewStyle.cxx, src/ViewStyle.h, src/XPM.cxx, src/XPM.h, + test/README, test/ScintillaCallable.py, test/XiteQt.py, + test/XiteWin.py, test/examples/x.lua, test/examples/x.lua.styled, + test/examples/x.pl, test/examples/x.pl.styled, test/examples/x.rb, + test/examples/x.rb.styled, test/lexTests.py, + test/performanceTests.py, test/simpleTests.py, + test/unit/testCharClassify.cxx, test/unit/testContractionState.cxx, + test/unit/testPartitioning.cxx, test/unit/testRunStyles.cxx, + test/unit/testSplitVector.cxx, version.txt, win32/PlatWin.cxx, + win32/PlatWin.h, win32/ScintRes.rc, win32/ScintillaWin.cxx, + win32/deps.mak, win32/makefile, win32/scintilla.mak, + win32/scintilla_vc6.mak: + Initial merge of Scintilla v3.3.5. + [40933b62f5ed] + +2013-09-14 Phil Thompson + + * Python/configure-ng.py, Python/configure.py, designer- + Qt4/designer.pro, designer-Qt4/qscintillaplugin.cpp, designer- + Qt4/qscintillaplugin.h: + Merged the 2.7-maint branch with the trunk. + [7288d97c54b0] + +2013-08-17 Phil Thompson + + * Python/sip/qsciscintillabase.sip: + Fixed a missing const in the .sip files. + [8b0425b87953] <2.7-maint> + +2013-06-27 Phil Thompson + + * NEWS, Python/configure-old.py, Python/configure.py, + Python/sip/qsciscintillabase.sip, designer-Qt4Qt5/designer.pro, + example-Qt4Qt5/application.pro, qt/InputMethod.cpp, + qt/qscintilla.pro, qt/qsciscintilla.cpp, qt/qsciscintilla.h, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Added support for input methods. + [b97af619044b] <2.7-maint> + +2013-06-16 Phil Thompson + + * .hgtags: + Added tag 2.7.2 for changeset 9ecd14550589 + [2b1f187f29c6] <2.7-maint> + + * NEWS: + Released as v2.7.2. + [9ecd14550589] [2.7.2] <2.7-maint> + +2013-06-12 Phil Thompson + + * Python/configure.py: + Fixed a configure.py bug. + [cb062c6f9189] <2.7-maint> + +2013-05-07 Phil Thompson + + * Makefile, Python/configure.py: + Fixes for the PyQt5 support. + [0714ef531ead] <2.7-maint> + + * Makefile, NEWS, Python/configure.py, Python/sip/qscimod5.sip, + lib/README.doc: + Added support for building against PyQt5. + [c982ff1b86f7] <2.7-maint> + +2013-05-05 Phil Thompson + + * build.py: + Changed the format of the name of a snapshot to match other + packages. + [d1f87bbc8377] <2.7-maint> + +2013-05-04 Phil Thompson + + * qt/PlatQt.cpp: + Significantly improved the performance of measuring the width of + text so that very long lines (100,000 characters) can be handled. + [5c88dc344f69] <2.7-maint> + +2013-04-08 Phil Thompson + + * Python/configure.py: + configure.py now issues a more explicit error message if QtCore + cannot be imported. + [4d0097b1ff05] <2.7-maint> + + * Python/configure.py: + Fixed a qmake warning message from configure.py. + [2363c96edeb0] <2.7-maint> + +2013-04-02 Phil Thompson + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + The default EOL mode on OS/X is now EolUnix. Clarified the + documentation for EolMode. + [a436460d0300] <2.7-maint> + +2013-03-15 Phil Thompson + + * Python/configure.py: + Further fixes for configure.py. + [78fa6fef2c76] <2.7-maint> + +2013-03-13 Phil Thompson + + * qt/qscilexer.h: + Clarified the description of QSciLexer::description(). + [688b482379e3] <2.7-maint> + + * Python/configure.py: + Fixed the last (trivial) change. + [0a3494ba669a] <2.7-maint> + +2013-03-12 Phil Thompson + + * Python/configure.py: + configure.py now gives the user more information about the copy of + sip being used. + [5c3be581d62b] <2.7-maint> + +2013-03-07 Phil Thompson + + * Python/configure.py: + On OS/X configure.py will explicitly set the qmake spec to macx-g++ + (Qt4) or macx-clang (Qt5) if the default might be macx-xcode. Added + the --spec option to configure.py. + [36a9bf2fbebd] <2.7-maint> + +2013-03-05 Phil Thompson + + * Python/configure.py: + Minor cosmetic tweaks to configure.py. + [296cd10747b7] <2.7-maint> + + * qt/PlatQt.cpp, qt/SciClasses.cpp, qt/qscicommandset.cpp, + qt/qscintilla.pro, qt/qsciscintillabase.cpp: + Removed the remaining uses of Q_WS_* for Qt v5. + [7fafd5c09eea] <2.7-maint> + +2013-03-01 Phil Thompson + + * .hgtags: + Added tag 2.7.1 for changeset 2583dc3dbc8d + [0674c291eab4] <2.7-maint> + + * NEWS: + Released as v2.7.1. + [2583dc3dbc8d] [2.7.1] <2.7-maint> + +2013-02-28 Phil Thompson + + * lexlib/CharacterSet.h: + Re-applied a fix to the underlying code thay got lost when Scintilla + v3.23 was merged. + [ee9eeec7d796] <2.7-maint> + +2013-02-26 Phil Thompson + + * qt/qsciapis.cpp: + A fix for the regression introduced with the previous fix. + [154428cebb5e] <2.7-maint> + +2013-02-19 Phil Thompson + + * NEWS, qt/qsciapis.cpp, qt/qscintilla.pro: + Fixed an autocompletion bug where there are entries Foo.* and + FooBar. + [620d72d86980] <2.7-maint> + +2013-02-06 Phil Thompson + + * Python/configure.py: + configure.py fixes for Linux. + [031b5b767926] <2.7-maint> + + * Python/configure.py: + Added the --sip-incdir and --pyqt-sipdir options to configure.py and + other fixes for building on Windows. + [517a3d0243fd] <2.7-maint> + + * Makefile, NEWS: + Updated the NEWS file. + [eb00e08e1950] <2.7-maint> + + * Makefile, Python/configure.py: + Fixed configure.py for Qt5. + [7ddb5bf2030c] <2.7-maint> + + * Python/configure-ng.py, Python/configure-old.py, + Python/configure.py, build.py, lib/README.doc: + Completed configure-ng.py and renamed it configure.py. The old + configure.py is now called configure-old.py. + [8d58b2899080] <2.7-maint> + +2013-02-05 Phil Thompson + + * Python/configure-ng.py: + configure-ng.py now uses -fno-exceptions on Linux and OS/X. + configure-ng.py now hides unneeded symbols on Linux. + [391e4f56b009] <2.7-maint> + + * Python/configure-ng.py: + configure-ng.py will now install the .sip and .api files. + [e228d58a670c] <2.7-maint> + + * Python/configure-ng.py: + configure-ng.py will now create a Makefile that will build the + Python module. + [cb47ace62a70] <2.7-maint> + +2013-02-02 Phil Thompson + + * qt/qsciglobal.h: + Use Q_OS_WIN for compatibility for Qt5. + [da752cf4510a] <2.7-maint> + +2013-01-29 Phil Thompson + + * designer-Qt4Qt5/designer.pro, example-Qt4Qt5/application.pro: + Use macx rather than mac in the .pro files. + [ee818a367df7] <2.7-maint> + +2012-12-21 Phil Thompson + + * Python/configure-ng.py, Python/configure.py, designer- + Qt4Qt5/designer.pro, example-Qt4Qt5/application.pro, lib/README.doc, + qt/qscintilla.pro: + Various OS/X fixes so that setting DYLD_LIBRARY_PATH isn't + necessary. + [e7854b8b01e3] <2.7-maint> + +2012-12-19 Phil Thompson + + * build.py, designer-Qt4/designer.pro, designer- + Qt4/qscintillaplugin.cpp, designer-Qt4/qscintillaplugin.h, designer- + Qt4Qt5/designer.pro, designer-Qt4Qt5/qscintillaplugin.cpp, designer- + Qt4Qt5/qscintillaplugin.h, lib/README.doc: + Updated the Designer plugin for Qt5. + [77f575c87ebb] <2.7-maint> + +2012-12-08 Phil Thompson + + * .hgtags: + Added tag 2.7 for changeset 9bab1e7b02e3 + [5600138109ce] + + * NEWS: + Released as v2.7. + [9bab1e7b02e3] [2.7] + +2012-12-07 Phil Thompson + + * qt/qscintilla_es.qm, qt/qscintilla_es.ts: + Updated Spanish translations from Jaime. + [b188c942422c] + + * NEWS: + Updated the NEWS file regarding Qt v5-rc1. + [be9e6b928921] + +2012-12-02 Phil Thompson + + * qt/qsciscintilla.cpp: + A final(?) fix for scroll bars and annotations. + [378f28e5b4b2] + + * Python/configure-ng.py: + More build system changes. + [f53fc8743ff1] + +2012-11-29 Phil Thompson + + * Python/configure-ng.py: + More configure script changes. + [434c9b3185a5] + + * Python/configure-ng.py: + More work on the new configure script. + [3a044732b799] + + * qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_de.ts, + qt/qscintilla_es.qm, qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm, + qt/qscintilla_ru.qm: + Updated German translations from Detlev. + [9dab221845ca] + +2012-11-28 Phil Thompson + + * Python/configure-ng.py, build.py: + Added the start of the SIP v5 compatible build script. + [781d2af60cfc] + +2012-11-27 Phil Thompson + + * Python/configure.py: + Fixed the handling of the 'linux' platform in the Python bindings. + [835d5e3be69e] + +2012-11-26 Phil Thompson + + * qt/qsciscintilla.cpp, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Worked around Scintilla bugs related to scroll bars and annotations. + [edc190ecc6fc] + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the translation files. + [ec754f87a735] + + * NEWS, Python/sip/qscilexercss.sip, qt/qscilexercss.cpp, + qt/qscilexercss.h: + Updated the CSS lexer for Scintilla v3.23. + [011fba6d668d] + + * qt/qscilexercpp.h: + Fixed a couple of documentation typos. + [7c2d04c76bd6] + + * NEWS, Python/sip/qscilexercpp.sip, qt/qscilexercpp.cpp, + qt/qscilexercpp.h: + Updated the C++ lexer for Scintilla v3.23. + [ad93ee355639] + +2012-11-24 Phil Thompson + + * Python/sip/qscilexercpp.sip, qt/qscilexercpp.cpp, qt/qscilexercpp.h: + Updated the styles for the C++ lexer. + [153429503998] + +2012-11-23 Phil Thompson + + * NEWS, Python/sip/qsciscintilla.sip, qt/PlatQt.cpp, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added CallTipsPosition, callTipsPosition() and + setCallTipsPosition(). + [7e5602869fee] + + * NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.h: + Added SquigglePixmapIndicator to QsciScintilla::IndicatorStyle. + [ad98a5396151] + + * NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added WrapFlagInMargin to QsciScintilla::WrapVisualFlag. + [a38c75c45fb3] + + * NEWS, qt/PlatQt.cpp, qt/qsciscintilla.cpp, qt/qscistyle.cpp: + Created a back door to pass the Qt weight of a font avoiding lossy + conversions between Qt weights and Scintilla weights. The default + behaviour is now SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE which is a + change but reflects what people really expect. + [78ce86e97ad3] + +2012-11-21 Phil Thompson + + * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Updated the constants from Scintilla v3.23. + [a3a0768af999] + + * NEWS, Python/configure.py, include/Platform.h, lib/README.doc, + qt/ListBoxQt.cpp, qt/ListBoxQt.h, qt/PlatQt.cpp, qt/SciClasses.cpp, + qt/ScintillaQt.cpp, qt/qscintilla.pro, src/ExternalLexer.h, + src/XPM.cxx, src/XPM.h: + Updated the platform support so that it compiles (but untested). + [abae8e56a6ea] + +2012-11-20 Phil Thompson + + * cocoa/InfoBar.h, cocoa/InfoBar.mm, cocoa/PlatCocoa.h, + cocoa/PlatCocoa.mm, cocoa/QuartzTextStyle.h, + cocoa/QuartzTextStyleAttribute.h, cocoa/ScintillaCocoa.h, + cocoa/ScintillaCocoa.mm, + cocoa/ScintillaFramework/English.lproj/InfoPlist.strings, cocoa/Scin + tillaFramework/ScintillaFramework.xcodeproj/project.pbxproj, + cocoa/ScintillaTest/AppController.mm, + cocoa/ScintillaTest/English.lproj/InfoPlist.strings, + cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj, + cocoa/ScintillaView.h, cocoa/ScintillaView.mm, + cocoa/checkbuildosx.sh, delbin.bat, delcvs.bat, + doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/ScintillaToDo.html, doc/annotations.png, doc/index.html, + doc/styledmargin.png, gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, + gtk/makefile, include/Face.py, include/ILexer.h, include/Platform.h, + include/SciLexer.h, include/Scintilla.h, include/Scintilla.iface, + include/ScintillaWidget.h, lexers/LexAVS.cxx, lexers/LexAda.cxx, + lexers/LexAsm.cxx, lexers/LexBash.cxx, lexers/LexBasic.cxx, + lexers/LexCPP.cxx, lexers/LexCSS.cxx, lexers/LexCoffeeScript.cxx, + lexers/LexD.cxx, lexers/LexECL.cxx, lexers/LexFortran.cxx, + lexers/LexHTML.cxx, lexers/LexLua.cxx, lexers/LexMMIXAL.cxx, + lexers/LexMPT.cxx, lexers/LexNsis.cxx, lexers/LexOScript.cxx, + lexers/LexOthers.cxx, lexers/LexPO.cxx, lexers/LexPascal.cxx, + lexers/LexPerl.cxx, lexers/LexRuby.cxx, lexers/LexSQL.cxx, + lexers/LexScriptol.cxx, lexers/LexSpice.cxx, lexers/LexTADS3.cxx, + lexers/LexTCL.cxx, lexers/LexTCMD.cxx, lexers/LexVHDL.cxx, + lexers/LexVisualProlog.cxx, lexers/LexYAML.cxx, + lexlib/CharacterSet.h, lexlib/LexAccessor.h, + lexlib/PropSetSimple.cxx, macosx/ExtInput.cxx, macosx/ExtInput.h, + macosx/PlatMacOSX.cxx, macosx/PlatMacOSX.h, + macosx/QuartzTextLayout.h, macosx/QuartzTextStyle.h, + macosx/QuartzTextStyleAttribute.h, + macosx/SciTest/English.lproj/InfoPlist.strings, + macosx/SciTest/English.lproj/main.xib, macosx/SciTest/Info.plist, + macosx/SciTest/SciTest.xcode/project.pbxproj, + macosx/SciTest/SciTest_Prefix.pch, macosx/SciTest/main.cpp, + macosx/SciTest/version.plist, macosx/ScintillaCallTip.cxx, + macosx/ScintillaCallTip.h, macosx/ScintillaListBox.cxx, + macosx/ScintillaListBox.h, macosx/ScintillaMacOSX.cxx, + macosx/ScintillaMacOSX.h, macosx/TCarbonEvent.cxx, + macosx/TCarbonEvent.h, macosx/TRect.h, macosx/TView.cxx, + macosx/TView.h, macosx/deps.mak, macosx/makefile, + src/AutoComplete.cxx, src/AutoComplete.h, src/CallTip.cxx, + src/CallTip.h, src/Catalogue.cxx, src/CellBuffer.cxx, + src/CellBuffer.h, src/CharClassify.cxx, src/CharClassify.h, + src/Decoration.cxx, src/Document.cxx, src/Document.h, + src/Editor.cxx, src/Editor.h, src/ExternalLexer.h, + src/FontQuality.h, src/Indicator.cxx, src/Indicator.h, + src/LexGen.py, src/LineMarker.cxx, src/LineMarker.h, + src/PerLine.cxx, src/PerLine.h, src/PositionCache.cxx, + src/PositionCache.h, src/RESearch.cxx, src/RunStyles.cxx, + src/SciTE.properties, src/ScintillaBase.cxx, src/ScintillaBase.h, + src/SplitVector.h, src/Style.cxx, src/Style.h, + src/UniConversion.cxx, src/UniConversion.h, src/ViewStyle.cxx, + src/ViewStyle.h, src/XPM.cxx, src/XPM.h, test/README, + test/examples/x.cxx, test/examples/x.cxx.styled, test/lexTests.py, + test/simpleTests.py, test/unit/makefile, + test/unit/testCharClassify.cxx, test/unit/testRunStyles.cxx, tgzsrc, + version.txt, win32/CheckD2D.cxx, win32/PlatWin.cxx, win32/PlatWin.h, + win32/ScintRes.rc, win32/ScintillaWin.cxx, win32/makefile, + win32/scintilla.mak, win32/scintilla_vc6.mak, zipsrc.bat: + Initial merge of Scintilla v3.23. + [b116f361ac01] + + * example-Qt4/application.pro, example-Qt4/application.qrc, example- + Qt4/images/copy.png, example-Qt4/images/cut.png, example- + Qt4/images/new.png, example-Qt4/images/open.png, example- + Qt4/images/paste.png, example-Qt4/images/save.png, example- + Qt4/main.cpp, example-Qt4/mainwindow.cpp, example-Qt4/mainwindow.h: + Merged the 2.6 maintenance branch with the trunk. + [0bf4f7453c68] + +2012-11-14 Phil Thompson + + * Makefile, example-Qt4Qt5/application.pro, qt/qsciscintillabase.cpp: + Fixed the linking of the example on OS/X. + [e1d1f43fae71] <2.6-maint> + +2012-11-12 Phil Thompson + + * Makefile, qt/PlatQt.cpp, qt/qscimacro.cpp, qt/qsciscintilla.cpp, + qt/qscistyle.cpp: + Removed all calls that are deprecated in Qt5. The build system now + supports cross-compilation to the Raspberry Pi. + [afef9d2b3ab1] <2.6-maint> + +2012-11-02 Phil Thompson + + * qt/qscilexersql.h: + Added comments to the QsciLexerSQL documentation stating that + additional keywords must be defined using lower case. + [79a9274b77c3] <2.6-maint> + +2012-10-09 Phil Thompson + + * NEWS, lib/ed.py, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added a replace option to the test editor's find commands. Finished + implementing findFirstInSelection(). + [80df6cc89bae] <2.6-maint> + + * lib/ed.py: + Added the Find, Find in Selection and Find Next actions to the test + editor. + [4aad56aedbea] <2.6-maint> + +2012-10-03 Phil Thompson + + * lib/ed.py: + Added an internal copy of the hackable Python test editor. + [a67a6fe99937] <2.6-maint> + +2012-09-27 Phil Thompson + + * lib/gen_python3_api.py, qsci/api/python/Python-3.3.api: + Fixed the gen_python3_api.py script to be able to exclude module + hierachies. Added the API file for Python v3.3. + [06bbb2d1c227] <2.6-maint> + +2012-09-22 Phil Thompson + + * qt/ListBoxQt.cpp: + Fixed a problem building against versions of Qt4 prior to v4.7. + [7bf93d60a50b] <2.6-maint> + +2012-09-18 Phil Thompson + + * NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added setOverwriteMode() and overwriteMode() to QsciScintilla. + [1affc53d2d88] <2.6-maint> + +2012-09-14 Phil Thompson + + * qt/qsciscintillabase.cpp: + Disable the use of QMacPasteboardMime for Qt v5-beta1. + [a6625d5928c6] <2.6-maint> + +2012-08-24 Phil Thompson + + * qt/qscilexerperl.cpp, qt/qscilexerperl.h: + Fixed auto-indentation for Perl. + [5eb1d97f95d6] <2.6-maint> + +2012-08-13 Phil Thompson + + * lexlib/CharacterSet.h: + Removed an incorrect assert() in the main Scintilla code. + [1aaf5e09d4b2] <2.6-maint> + +2012-08-09 Phil Thompson + + * NEWS, Python/sip/qsciscintilla.sip, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added QsciScintilla::wordAtLineIndex(). + [0c5d77aef4f7] <2.6-maint> + +2012-07-19 Phil Thompson + + * qt/qscintilla.pro, qt/qsciscintillabase.cpp: + Fixed key handling on Linux with US international layout which + generates non-ASCII sequences for quote characters. + [061ab2c5bea3] <2.6-maint> + +2012-06-20 Phil Thompson + + * .hgtags: + Added tag 2.6.2 for changeset f9d3d982c20f + [a5bb033cd9e0] <2.6-maint> + + * NEWS: + Released as v2.6.2. + [f9d3d982c20f] [2.6.2] <2.6-maint> + +2012-06-19 Phil Thompson + + * qt/qsciscintillabase.cpp: + Fixed pasting of text in UTF8 mode (and hopefully Latin1 mode as + well). + [6df653daef18] <2.6-maint> + + * qt/qsciscintillabase.cpp: + Rectangular selections are now always encoded as plain/text with an + explicit, and separate, marker to indicate that it is rectangular. + [012a0b2ca89f] <2.6-maint> + +2012-06-09 Phil Thompson + + * qt/qsciscintillabase.cpp: + Used the Mac method of marking rectangular selections as the '\0' + Scintilla hack just doesn't work with Qt. + [75020a35b5eb] <2.6-maint> + + * qt/qscintilla.pro: + Bumped the library version number. + [12f21729e254] <2.6-maint> + +2012-06-07 Phil Thompson + + * qt/qsciscintillabase.cpp: + Improved the support for rectangular selections and the + interoperability with other Scintilla based editors. + [a42942b57fb7] <2.6-maint> + + * qt/qsciscintillabase.cpp: + Fixed the middle button pasting of rectangular selections. + [db58aa6c6d7d] <2.6-maint> + + * qt/qscidocument.cpp: + Fixed a bug that seemed to mean the initial EOL mode was always + UNIX. + [88561cd29a60] <2.6-maint> + + * qt/qsciscintillabase.cpp: + Line endings are properly translated when dropping text. + [d21994584e87] <2.6-maint> + +2012-06-04 Phil Thompson + + * Makefile, qt/qsciprinter.h: + The Python bindings now build against Qt5. + [ff2a74e5aec2] <2.6-maint> + +2012-04-04 Phil Thompson + + * Makefile, NEWS, build.py, example-Qt4/application.pro, example- + Qt4/application.qrc, example-Qt4/images/copy.png, example- + Qt4/images/cut.png, example-Qt4/images/new.png, example- + Qt4/images/open.png, example-Qt4/images/paste.png, example- + Qt4/images/save.png, example-Qt4/main.cpp, example- + Qt4/mainwindow.cpp, example-Qt4/mainwindow.h, example- + Qt4Qt5/application.pro, example-Qt4Qt5/application.qrc, example- + Qt4Qt5/images/copy.png, example-Qt4Qt5/images/cut.png, example- + Qt4Qt5/images/new.png, example-Qt4Qt5/images/open.png, example- + Qt4Qt5/images/paste.png, example-Qt4Qt5/images/save.png, example- + Qt4Qt5/main.cpp, example-Qt4Qt5/mainwindow.cpp, example- + Qt4Qt5/mainwindow.h, lib/LICENSE.GPL2, lib/LICENSE.GPL3, + lib/LICENSE.commercial.short, lib/LICENSE.gpl.short, lib/README, + lib/README.doc, lib/qscintilla.dxy, qt/PlatQt.cpp, + qt/qscintilla.pro: + Ported to Qt v5. + [ff3710487c3e] <2.6-maint> + +2012-04-02 Phil Thompson + + * qt/qsciapis.cpp: + Worked around an obscure Qt (or compiler) bug when handling call + tips. + [e6c7edcfdfb9] <2.6-maint> + +2012-03-04 Phil Thompson + + * Python/sip/qscilexer.sip, Python/sip/qscilexerbash.sip, + Python/sip/qscilexerbatch.sip, Python/sip/qscilexercpp.sip, + Python/sip/qscilexercss.sip, Python/sip/qscilexerd.sip, + Python/sip/qscilexerdiff.sip, Python/sip/qscilexerhtml.sip, + Python/sip/qscilexermakefile.sip, Python/sip/qscilexerperl.sip, + Python/sip/qscilexerpov.sip, Python/sip/qscilexerproperties.sip, + Python/sip/qscilexertex.sip, Python/sip/qscilexerverilog.sip, + qt/qscilexer.h, qt/qscilexerbash.h, qt/qscilexerbatch.h, + qt/qscilexercpp.h, qt/qscilexercss.h, qt/qscilexerd.h, + qt/qscilexerdiff.h, qt/qscilexerhtml.h, qt/qscilexermakefile.h, + qt/qscilexerperl.h, qt/qscilexerpov.h, qt/qscilexerproperties.h, + qt/qscilexertex.h, qt/qscilexerverilog.h: + QSciLexer::wordCharacters() is now part of the public API. + [933ef6a11ee6] <2.6-maint> + +2012-02-23 Phil Thompson + + * qt/qscilexercpp.h: + Updated the documentation for QsciLexerCpp::keywords() so that it + describes which sets are supported. + [4e0cb0250dad] <2.6-maint> + +2012-02-21 Phil Thompson + + * qt/qscintilla.pro, src/Document.cxx: + Some Scintilla fixes for the SCI_NAMESPACE support. + [611ffd016585] <2.6-maint> + +2012-02-10 Phil Thompson + + * .hgtags: + Added tag 2.6.1 for changeset 47d8fdf44946 + [aa843f471972] <2.6-maint> + + * NEWS: + Updated the NEWS file. Released as v2.6.1. + [47d8fdf44946] [2.6.1] <2.6-maint> + +2012-01-26 Phil Thompson + + * qt/qsciscintilla.cpp: + Don't implement shortcut overrides for the standard context menu + shortcuts. Instead leave it to the check against bound keys. + [e8ccaf398640] <2.6-maint> + +2012-01-19 Phil Thompson + + * qt/qsciapis.cpp: + APIs now allow for whitespace between the end of a word and the + opening parenthesis of the argument list. + [b09b25f38411] <2.6-maint> + +2012-01-11 Phil Thompson + + * qt/SciClasses.cpp: + Fixed the handling of auto-completion lists on Windows. + [131138b43c85] <2.6-maint> + +2011-12-07 Phil Thompson + + * Python/sip/qscicommandset.sip, qt/qscicommandset.cpp, + qt/qscicommandset.h, qt/qscintilla.pro: + Improved the Qt v3 port so that the signatures don't need to be + changed. Bumped the .so version number. + [3171bb05b1d8] <2.6-maint> + +2011-12-06 Phil Thompson + + * Makefile, NEWS, Python/sip/qscicommandset.sip, include/Platform.h, + qt/ListBoxQt.cpp, qt/qscicommandset.cpp, qt/qscicommandset.h, + qt/qsciscintilla.cpp, qt/qsciscintilla.h, src/XPM.cxx: + Fixed building against Qt v3. + [74df75a62f5c] <2.6-maint> + +2011-11-21 Phil Thompson + + * NEWS, include/Platform.h, qt/ListBoxQt.cpp, qt/ListBoxQt.h, + qt/PlatQt.cpp, qt/SciClasses.cpp, qt/SciClasses.h, + qt/SciNamespace.h, qt/ScintillaQt.cpp, qt/ScintillaQt.h, + qt/qscintilla.pro, qt/qsciscintilla.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Added support for SCI_NAMESPACE to allow all internal Scintilla + classes to be placed in the Scintilla namespace. + [ab7857131e35] <2.6-maint> + +2011-11-11 Phil Thompson + + * .hgtags: + Added tag 2.6 for changeset 8b119c4f69d0 + [1a5dd31e773e] + + * NEWS, lib/README.doc: + Updated the NEWS file. Updated the introductory documentation. + Released as v2.6. + [8b119c4f69d0] [2.6] + +2011-11-07 Phil Thompson + + * NEWS, Python/sip/qscicommandset.sip, Python/sip/qsciscintilla.sip, + qt/qscicommandset.cpp, qt/qscicommandset.h, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added QsciCommandSet::boundTo(). Ordinary keys and those bound to + commands now override any shortcuts. + [ba98bc555aca] + +2011-10-28 Phil Thompson + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts: + More updated German translations from Detlev. + [9ff20df1997b] + +2011-10-27 Phil Thompson + + * qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_de.ts, + qt/qscintilla_es.qm, qt/qscintilla_es.ts, qt/qscintilla_fr.qm, + qt/qscintilla_pt_br.qm, qt/qscintilla_ru.qm: + Updated Spanish translations from Jaime. Updated German translations + from Detlev. + [4903315d96b1] + +2011-10-23 Phil Thompson + + * Python/sip/qscicommand.sip: + Fixed SelectAll in the Python bindings. + [b6f0a46e0eac] + + * qt/ScintillaQt.cpp, qt/qsciscintillabase.cpp: + Fixed drag and drop (specifically so that copying works on OS/X + again). + [6ab90cb63b2b] + +2011-10-22 Phil Thompson + + * qt/PlatQt.cpp: + Fixed a display bug with kerned fonts. + [a746e319d9cd] + + * qt/qsciscintilla.cpp: + The foreground and background colours of selected text are now taken + from the application palette. + [7f6c34ad8d27] + + * NEWS: + Updated the NEWS file. + [1717c6d59b12] + + * Python/sip/qsciscintilla.sip, qt/qscicommand.h, + qt/qscicommandset.cpp, qt/qscintilla_cs.ts, qt/qscintilla_de.ts, + qt/qscintilla_es.ts, qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, + qt/qscintilla_ru.ts, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Renamed QsciCommand::SelectDocument to SelectAll. Added + QsciScintilla::createStandardContextMenu(). + [c42fa7e83b07] + +2011-10-21 Phil Thompson + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the .ts files. + [92d0b6ddf371] + + * qt/qscicommandset.cpp: + Completed the OS/X specific key bindings. + [964fa889b807] + +2011-10-20 Phil Thompson + + * qt/qscicommandset.cpp, qt/qsciscintillabase.cpp: + Fixed the support for SCMOD_META. Started to add the correct OS/X + key bindings as the default. + [0073fa86a5a0] + + * Python/sip/qscicommand.sip, qt/qscicommand.h, qt/qscicommandset.cpp: + All available commands are now defined in the standard command set. + [7c7b81b55f0e] + + * Python/sip/qscicommand.sip, qt/qscicommand.h: + Completed the QsciCommand::Command documentation. Added the members + to QsciCommand.Command in the Python bindings. + [0ca6ff576c21] + +2011-10-18 Phil Thompson + + * NEWS, Python/sip/qscicommandset.sip, qt/qscicommand.h, + qt/qscicommandset.cpp, qt/qscicommandset.h: + Added QsciCommandSet::find(). + [e75565018b90] + + * NEWS, Python/sip/qscicommand.sip, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qscicommand.cpp, + qt/qscicommand.h, qt/qscicommandset.cpp, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added Command, command() and execute() to QsciCommand. Backed out + the high level support for moving the selection up and down. + [4852ee57353e] + +2011-10-17 Phil Thompson + + * qt/qscilexersql.cpp: + Fix for the changed fold at else property in the SQL lexer. + [e65a458cd9d8] + + * NEWS, Python/sip/qscilexerpython.sip, qt/qscilexerpython.cpp, + qt/qscilexerpython.h: + Added highlightSubidentifiers() and setHighlightSubidentifiers() to + the Python lexer. + [b397695bc2ab] + + * NEWS, Python/sip/qscilexercpp.sip, qt/qscilexercpp.cpp, + qt/qscilexercpp.h: + Added support for triple quoted strings to the C++ lexer. + [687d04948c5d] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added low level support for identifiers, scrolling to the start and + end. Added low and hight level support for moving the selection up + and down. + [3ac1ccfad039] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added low and high level support for margin options. + [f3cd3244cecd] + +2011-10-14 Phil Thompson + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Updated the brace matching support to handle indicators. + [7e4a4d3529a8] + + * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added SCI_SETEMPTYSELECTION. + [879b97c676a4] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Updated the support for indicators. + [b3643569a827] + + * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added SCI_MARKERSETBACKSELECTED and SCI_MARKERENABLEHIGHLIGHT. + [7127ee82d128] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Added low and high-level support for RGBA images (ie. QImage). + [7707052913ef] + +2011-10-13 Phil Thompson + + * NEWS, Python/sip/qscilexerlua.sip, qt/qscilexerlua.cpp, + qt/qscilexerlua.h: + Updated the Lua lexer. + [710e50d5692c] + + * NEWS, Python/sip/qscilexerperl.sip, qt/qscilexerperl.cpp, + qt/qscilexerperl.h: + Updated the Perl lexer. + [6d16e2e9354b] + +2011-10-11 Phil Thompson + + * Python/configure.py, cocoa/ScintillaCallTip.h, + cocoa/ScintillaCallTip.mm, cocoa/ScintillaListBox.h, + cocoa/ScintillaListBox.mm, cocoa/res/info_bar_bg.png, + cocoa/res/mac_cursor_busy.png, cocoa/res/mac_cursor_flipped.png, + macosx/SciTest/English.lproj/InfoPlist.strings, + macosx/SciTest/English.lproj/main.nib/classes.nib, + macosx/SciTest/English.lproj/main.nib/info.nib, + macosx/SciTest/English.lproj/main.nib/objects.xib, + macosx/SciTest/English.lproj/main.xib, qt/ListBoxQt.cpp, + qt/ListBoxQt.h, qt/PlatQt.cpp, qt/qscintilla.pro, src/XPM.cxx, + src/XPM.h: + Some fixes left over from the merge of v2.29. Added support for RGBA + images so that the merged version compiles. + [16c6831c337f] + + * cocoa/InfoBar.mm, cocoa/PlatCocoa.h, cocoa/PlatCocoa.mm, + cocoa/QuartzTextLayout.h, cocoa/QuartzTextStyle.h, + cocoa/QuartzTextStyleAttribute.h, cocoa/ScintillaCocoa.h, + cocoa/ScintillaCocoa.mm, cocoa/ScintillaFramework/ScintillaFramework + .xcodeproj/project.pbxproj, cocoa/ScintillaTest/AppController.mm, + cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj, + cocoa/ScintillaView.h, cocoa/ScintillaView.mm, doc/SciCoding.html, + doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/ScintillaToDo.html, doc/index.html, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, gtk/makefile, include/Platform.h, + include/SciLexer.h, include/Scintilla.h, include/Scintilla.iface, + lexers/LexAU3.cxx, lexers/LexCOBOL.cxx, lexers/LexCPP.cxx, + lexers/LexConf.cxx, lexers/LexHTML.cxx, lexers/LexInno.cxx, + lexers/LexLua.cxx, lexers/LexMagik.cxx, lexers/LexMarkdown.cxx, + lexers/LexMatlab.cxx, lexers/LexModula.cxx, lexers/LexOthers.cxx, + lexers/LexPerl.cxx, lexers/LexPowerPro.cxx, lexers/LexPython.cxx, + lexers/LexSQL.cxx, lexers/LexTeX.cxx, lexers/LexVHDL.cxx, + lexers/LexVerilog.cxx, lexlib/Accessor.cxx, lexlib/CharacterSet.h, + lexlib/PropSetSimple.cxx, lexlib/SparseState.h, + lexlib/StyleContext.h, lexlib/WordList.cxx, macosx/PlatMacOSX.cxx, + macosx/PlatMacOSX.h, macosx/SciTest/SciTest.xcode/project.pbxproj, + macosx/ScintillaMacOSX.h, macosx/makefile, src/CallTip.cxx, + src/ContractionState.cxx, src/ContractionState.h, + src/Decoration.cxx, src/Document.cxx, src/Document.h, + src/Editor.cxx, src/Editor.h, src/Indicator.cxx, src/Indicator.h, + src/KeyMap.cxx, src/KeyMap.h, src/LexGen.py, src/LineMarker.cxx, + src/LineMarker.h, src/PerLine.cxx, src/PositionCache.cxx, + src/PositionCache.h, src/RESearch.cxx, src/RunStyles.cxx, + src/RunStyles.h, src/ScintillaBase.cxx, src/Style.cxx, src/Style.h, + src/ViewStyle.cxx, src/ViewStyle.h, src/XPM.cxx, src/XPM.h, + test/XiteMenu.py, test/XiteWin.py, test/examples/x.html, + test/examples/x.html.styled, test/performanceTests.py, + test/simpleTests.py, test/unit/testContractionState.cxx, + test/unit/testRunStyles.cxx, version.txt, win32/PlatWin.cxx, + win32/ScintRes.rc, win32/ScintillaWin.cxx, win32/scintilla.mak: + Merged Scintilla v2.29. + [750c2c3cef72] + + * Merged the v2.5 maintenance branch back into the trunk. + [eab39863675f] + +2011-06-24 Phil Thompson + + * qt/qscilexer.cpp, qt/qscilexerbash.cpp, qt/qscilexerbatch.cpp, + qt/qscilexercmake.cpp, qt/qscilexercpp.cpp, qt/qscilexercsharp.cpp, + qt/qscilexercss.cpp, qt/qscilexerd.cpp, qt/qscilexerfortran77.cpp, + qt/qscilexerhtml.cpp, qt/qscilexerjavascript.cpp, + qt/qscilexerlua.cpp, qt/qscilexermakefile.cpp, + qt/qscilexermatlab.cpp, qt/qscilexerpascal.cpp, + qt/qscilexerperl.cpp, qt/qscilexerpostscript.cpp, + qt/qscilexerpov.cpp, qt/qscilexerproperties.cpp, + qt/qscilexerpython.cpp, qt/qscilexerruby.cpp, qt/qscilexerspice.cpp, + qt/qscilexersql.cpp, qt/qscilexertcl.cpp, qt/qscilexerverilog.cpp, + qt/qscilexervhdl.cpp, qt/qscilexerxml.cpp, qt/qscilexeryaml.cpp: + Changed the default fonts for MacOS so that they are larger and + similar to the Windows defaults. + [9c37c180ba8d] <2.5-maint> + + * build.py: + Fixed the build system for MacOS as the development platform. + [3352479980c5] <2.5-maint> + +2011-05-13 Phil Thompson + + * lib/README.doc: + Updated the licensing information in the main documentation. + [d31c561e0b7c] <2.5-maint> + + * lib/LICENSE.GPL2, lib/LICENSE.GPL3, lib/LICENSE.gpl.short: + Removed some out of date links from the license information. Updated + the dates of some copyright notices. + [a84451464396] <2.5-maint> + +2011-05-10 Phil Thompson + + * Makefile, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added the optional posix flag to QsciScintilla::findFirst(). + [ad6064227d06] <2.5-maint> + +2011-04-29 Phil Thompson + + * Python/configure.py, qt/qscintilla.pro, qt/qsciscintilla.cpp, + qt/qscistyle.cpp, qt/qscistyle.h, qt/qscistyledtext.cpp, + qt/qscistyledtext.h: + Fixed problems with QsciStyle and QsciStyledText when used with more + than one QsciScintilla instance. + [8bac389fb7ae] <2.5-maint> + +2011-04-22 Phil Thompson + + * qt/qsciglobal.h: + Changed the handling of QT_BEGIN_NAMESPACE etc. as it isn't defined + in early versions of Qt v4. + [595c8c6cdfd2] <2.5-maint> + +2011-04-17 Phil Thompson + + * .hgtags: + Added tag 2.5.1 for changeset c8648c2c0c7f + [298153b3d40e] <2.5-maint> + + * NEWS: + Released as v2.5.1. + [c8648c2c0c7f] [2.5.1] <2.5-maint> + +2011-04-16 Phil Thompson + + * qt/qscintilla_de.ts, qt/qscintilla_es.ts: + Updated translations from Detlev and Jaime. + [9436bea546c9] <2.5-maint> + +2011-04-14 Phil Thompson + + * qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_es.qm, + qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm, qt/qscintilla_ru.qm: + Updated the compiled translation files. + [c5d39aca8f51] <2.5-maint> + +2011-04-13 Phil Thompson + + * Python/sip/qscilexermatlab.sip, Python/sip/qscilexeroctave.sip, + Python/sip/qscimodcommon.sip: + Added Python bindings for QsciLexerMatlab abd QsciLexerOctave. + [22d0ed0fab2a] <2.5-maint> + + * NEWS, qt/qscilexermatlab.cpp, qt/qscilexermatlab.h, + qt/qscilexeroctave.cpp, qt/qscilexeroctave.h, qt/qscintilla.pro, + qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Added QsciLexerMatlab and QsciLexerOctave. + [40d3053334de] <2.5-maint> + +2011-04-09 Phil Thompson + + * Merged the font strategy fix from the trunk. + [d270e1b107d2] <2.5-maint> + + * NEWS: + Updated the NEWS file. + [8f32ff4cdd1f] <2.5-maint> + +2011-04-07 Phil Thompson + + * qt/PlatQt.cpp, qt/qscintilla.pro: + Fixed the handling of the font quality setting so that the default + behavior (particularly on Windows) is the same as earlier versions. + [87ae98d2674b] + +2011-03-29 Phil Thompson + + * .hgtags: + Added tag 2.5 for changeset 9d94a76f783e + [e4807fd91f6c] + + * NEWS: + Released as v2.5. + [9d94a76f783e] [2.5] + +2011-03-28 Phil Thompson + + * NEWS, Python/configure.py: + Added support for the protected-is-public hack to configure.py. + [beee52b8e10a] + +2011-03-27 Phil Thompson + + * qt/PlatQt.cpp: + Fixed an OS/X build problem. + [ac7f1d3c9abe] + +2011-03-26 Phil Thompson + + * NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added replaceSelectedText() to QsciScintilla. + [3c00a19d6571] + +2011-03-25 Phil Thompson + + * Python/configure.py, Python/sip/qsciapis.sip, + Python/sip/qscilexer.sip, Python/sip/qscilexercustom.sip, + Python/sip/qscimod4.sip, Python/sip/qsciprinter.sip, + Python/sip/qsciscintilla.sip, Python/sip/qscistyle.sip, + qt/qsciapis.cpp, qt/qsciapis.h, qt/qscilexercustom.cpp, + qt/qscilexercustom.h, qt/qsciscintilla.cpp, qt/qsciscintilla.h, + qt/qscistyle.cpp, qt/qscistyle.h: + Went through the API making sure all optional arguments had + consistent and meaningful names. Enabled keyword support in the + Python bindings. + [d60fa45e40b7] + +2011-03-23 Phil Thompson + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts, qt/qscintilla_es.qm, + qt/qscintilla_es.ts: + Updated German translations from Detlev. Updated Spanish + translations from Jaime. + [f64c97749375] + +2011-03-21 Phil Thompson + + * lexers/LexModula.cxx, lexlib/SparseState.h, qt/qscintilla_cs.ts, + qt/qscintilla_de.ts, qt/qscintilla_es.ts, qt/qscintilla_fr.ts, + qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts, + test/unit/testSparseState.cxx, vcbuild/SciLexer.dsp: + Updated the translation files. Updated the repository for the new + and removed Scintilla v2.25 files. + [6eb77ba7c57c] + + * NEWS, Python/sip/qscilexercpp.sip, Python/sip/qsciscintillabase.sip, + qt/qscilexercpp.cpp, qt/qscilexercpp.h, qt/qscintilla.pro, + qt/qsciscintillabase.h: + Added support for raw string to the C++ lexer. + [f83112ced877] + + * NEWS, cocoa/Framework.mk, cocoa/PlatCocoa.mm, + cocoa/ScintillaCocoa.mm, cocoa/ScintillaFramework/ScintillaFramework + .xcodeproj/project.pbxproj, cocoa/ScintillaTest/AppController.mm, + cocoa/ScintillaView.h, cocoa/ScintillaView.mm, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/ScintillaRelated.html, doc/index.html, gtk/PlatGTK.cxx, + gtk/makefile, include/Platform.h, include/SciLexer.h, + include/Scintilla.iface, lexers/LexAsm.cxx, lexers/LexBasic.cxx, + lexers/LexCPP.cxx, lexers/LexD.cxx, lexers/LexFortran.cxx, + lexers/LexOthers.cxx, lexlib/CharacterSet.h, lib/README.doc, + macosx/SciTest/main.cpp, src/AutoComplete.cxx, src/Catalogue.cxx, + src/Document.cxx, src/Editor.cxx, src/LexGen.py, test/unit/makefile, + version.txt, win32/PlatWin.cxx, win32/ScintRes.rc, + win32/scintilla.mak, win32/scintilla_vc6.mak: + Merged Scintilla v2.25. + [e01dec109182] + +2011-03-14 Phil Thompson + + * qt/qscintilla_es.qm, qt/qscintilla_es.ts: + Updated Spanish translations from Jaime Seuma. + [b83a3ca4f3e6] + +2011-03-12 Phil Thompson + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Updated German translations from Detlev. + [e5729134a47b] + +2011-03-11 Phil Thompson + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the translation source files. + [51e8ee8b1ba9] + + * NEWS, Python/sip/qscilexercpp.sip, qt/qscilexercpp.cpp, + qt/qscilexercpp.h: + Added support for the inactive styles of QsciLexerCPP. + [59b566d322af] + + * qt/qscilexercpp.cpp, qt/qscilexercpp.h: + Inlined all existing property getters in QsciLexerCPP. + [1117e5105e5e] + +2011-03-10 Phil Thompson + + * qt/qsciscintilla.cpp: + Fixed QsciScintilla::setContractedFolds() so that it actually + updates the display to show the new state. + [5079f59a0103] + + * NEWS, Python/sip/qscilexerhtml.sip, qt/qscilexerhtml.cpp, + qt/qscilexerhtml.h: + Updated QsciLexerHTML. + [0707f4bc7855] + + * NEWS, Python/sip/qscilexerproperties.sip, + qt/qscilexerproperties.cpp, qt/qscilexerproperties.h: + Updated QsciLexerProperties. + [1dfe5e2d4913] + + * NEWS, Python/sip/qscilexerpython.sip, Python/sip/qscilexerruby.sip, + Python/sip/qscilexersql.sip, Python/sip/qscilexertcl.sip, + Python/sip/qscilexertex.sip, qt/qscilexerpython.cpp, + qt/qscilexerpython.h, qt/qscilexerruby.h, qt/qscilexersql.h, + qt/qscilexertcl.h, qt/qscilexertex.cpp, qt/qscilexertex.h: + Updated QsciLexerPython. + [bc96868a1a6f] + + * NEWS, Python/sip/qscilexerruby.sip, Python/sip/qscilexersql.sip, + Python/sip/qscilexertcl.sip, Python/sip/qscilexertex.sip, + qt/qscilexerruby.cpp, qt/qscilexerruby.h, qt/qscilexersql.h, + qt/qscilexertcl.h, qt/qscilexertex.h: + The new lexer property setters are no longer virtual slots. + [c3e88383e8d3] + + * qt/qscilexersql.cpp, qt/qscilexersql.h: + Restored the default behaviour of setFoldCompact() for QsciLexerSQL. + [c74aef0f7eb4] + + * NEWS, Python/sip/qscilexertcl.sip, qt/qscilexersql.h, + qt/qscilexertcl.cpp, qt/qscilexertcl.h: + Updated QsciLexerTCL. + [43a150bb40d5] + + * NEWS, Python/sip/qscilexertex.sip, qt/qscilexertex.cpp, + qt/qscilexertex.h: + Updated QsciLexerTeX. + [1457935cee44] + + * qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_de.ts, + qt/qscintilla_es.qm, qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm, + qt/qscintilla_ru.qm: + Updated German translations from Detlev. + [ad4a4bd4855b] + +2011-03-08 Phil Thompson + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the .ts translation files. + [8d70033d07e2] + + * NEWS, Python/sip/qscilexersql.sip, qt/qscilexersql.cpp, + qt/qscilexersql.h: + Updated QsciLexerSQL. + [8bc79d109c88] + + * NEWS, Python/sip/qscilexercss.sip, qt/qscilexercss.cpp, + qt/qscilexercss.h: + Updated QsciLexerCSS. + [f3adcb31b1a9] + + * NEWS, Python/sip/qscilexerd.sip, qt/qscilexerd.cpp, qt/qscilexerd.h: + Updated QsciLexerD. + [82d8a6561943] + + * Python/sip/qscilexerlua.sip, qt/qscilexerlua.cpp, qt/qscilexerlua.h: + Updated QsciLexerLua. + [103f5881c642] + + * NEWS, Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/qsciscintillabase.h: + Added support for the QsciScintillaBase::SCN_HOTSPOTRELEASECLICK() + signal. + [1edd56e105cd] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for SCLEX_MARKDOWN, SCLEX_TXT2TAGS and + SCLEX_A68K. + [de92a613cea7] + + * Python/sip/qsciscintillabase.sip, qt/qscicommand.cpp, + qt/qsciscintilla.cpp, qt/qsciscintillabase.h: + Added support for SCMOD_SUPER as the Qt Meta key modifier. + [24e745cddeea] + + * NEWS, Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.h: + Updated the QsciScintillaBase::SCN_UPDATEUI() signal. Added low- + level support for SC_MOD_LEXERSTATE. + [0a341fcb0545] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for the updated property functions. + [f33d9c271992] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for SCI_GETLEXERLANGUAGE and + SCI_PRIVATELEXERCALL. + [ac69f8c2ef3b] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for the new stick caret options. + [693ac6c68e6f] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for SCI_AUTOCGETCURRENTTEXT. + [2634827cdb4e] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for SC_SEL_THIN. + [4225a944dc14] + + * qt/qsciscintilla.cpp: + Folding now works again. + [3972053c646e] + +2011-03-07 Phil Thompson + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for SCI_VERTICALCENTRECARET. + [92d5ecb154d1] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added setContractedFolds() and contractedFolds() to QsciScintilla. + [46eb254c6200] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for SCI_CHANGELEXERSTATE. + [edd899d77aa7] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintilla.h, + qt/qsciscintillabase.h: + Added low-level support for SCI_CHARPOSITIONFROMPOINT and + SCI_CHARPOSITIONFROMPOINTCLOSE. + [5a000cf4bfba] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added low-level support for multiple selections. + [dedda8cbf413] + + * Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: + Added SCI_GETTAG. + [775d0058f00e] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added QsciScintilla::setFirstVisibleLine(). + [8b662ffe3fb6] + + * Python/sip/qsciscintillabase.sip, qt/PlatQt.cpp, + qt/qsciscintillabase.h: + Added low-level support for setting the font quality. + [933e8b01eda6] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added high-level support for line wrap indentation modes. + [1faa3b2fa31e] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added high-level support for extra ascent and descent space. Added + high-level support for whitespace size, foreground and background. + [537c551a79ef] + + * Python/sip/qsciscintillabase.sip, qt/PlatQt.cpp, + qt/qsciscintillabase.h: + Updated the low level support for cursors. + [2ce685a89697] + + * NEWS, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, qt/qsciscintilla.h, + qt/qsciscintillabase.h: + Updated the support for markers and added FullRectangle, + LeftRectangle and Underline to the MarkerSymbol enum. + [4c626f8189bf] + +2011-03-06 Phil Thompson + + * NEWS, Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/ScintillaQt.h, qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Rectangular selections are now fully supported. The signatures of + toMimeData() and fromMimeData() have changed. + [397948f42b2e] + + * NEWS: + Updated the NEWS file. + [bc75b98210f2] + + * .hgignore: + Added the .hgignore file. + [77312a36220e] + + * qt/qsciscintilla.cpp: + Removed the workaround for the broken annotations in Scintilla + v1.78. + [70ab4c4b7c66] + + * qt/ListBoxQt.cpp: + Fixed a regression when displaying an auto-completion list. + [c38d4b97a1ca] + +2011-03-04 Phil Thompson + + * qt/ListBoxQt.cpp, qt/PlatQt.cpp, qt/ScintillaQt.cpp, + qt/ScintillaQt.h, qt/qsciscintillabase.cpp: + Completed the merge of Scintilla v2.24. + [6890939e2da6] + + * build.py, qt/qscintilla.pro: + More build system changes. + [3e9deec76c02] + + * qt/qscintilla.pro, qt/qsciscintilla.cpp: + Updated the .pro file for the changed files and directory structure + in v2.24. + [274cb7017857] + + * License.txt, README, bin/empty.txt, cocoa/Framework.mk, + cocoa/InfoBar.h, cocoa/InfoBar.mm, cocoa/InfoBarCommunicator.h, + cocoa/PlatCocoa.h, cocoa/PlatCocoa.mm, cocoa/QuartzTextLayout.h, + cocoa/QuartzTextStyle.h, cocoa/QuartzTextStyleAttribute.h, + cocoa/SciTest.mk, cocoa/ScintillaCallTip.h, + cocoa/ScintillaCallTip.mm, cocoa/ScintillaCocoa.h, + cocoa/ScintillaCocoa.mm, cocoa/ScintillaFramework/Info.plist, cocoa/ + ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj, + cocoa/ScintillaFramework/Scintilla_Prefix.pch, + cocoa/ScintillaListBox.h, cocoa/ScintillaListBox.mm, + cocoa/ScintillaTest/AppController.h, + cocoa/ScintillaTest/AppController.mm, + cocoa/ScintillaTest/English.lproj/MainMenu.xib, + cocoa/ScintillaTest/Info.plist, cocoa/ScintillaTest/Scintilla- + Info.plist, + cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj, + cocoa/ScintillaTest/ScintillaTest_Prefix.pch, + cocoa/ScintillaTest/TestData.sql, cocoa/ScintillaTest/main.m, + cocoa/ScintillaView.h, cocoa/ScintillaView.mm, cocoa/common.mk, + delbin.bat, delcvs.bat, doc/Design.html, doc/Lexer.txt, + doc/SciBreak.jpg, doc/SciCoding.html, doc/SciRest.jpg, + doc/SciTEIco.png, doc/SciWord.jpg, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/ScintillaRelated.html, doc/ScintillaToDo.html, + doc/ScintillaUsage.html, doc/Steps.html, doc/index.html, + gtk/Converter.h, gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, + gtk/deps.mak, gtk/makefile, gtk/scintilla-marshal.c, gtk/scintilla- + marshal.h, gtk/scintilla-marshal.list, gtk/scintilla.mak, + include/Accessor.h, include/Face.py, include/HFacer.py, + include/ILexer.h, include/KeyWords.h, include/Platform.h, + include/PropSet.h, include/SString.h, include/SciLexer.h, + include/Scintilla.h, include/Scintilla.iface, + include/ScintillaWidget.h, include/WindowAccessor.h, + lexers/LexA68k.cxx, lexers/LexAPDL.cxx, lexers/LexASY.cxx, + lexers/LexAU3.cxx, lexers/LexAVE.cxx, lexers/LexAbaqus.cxx, + lexers/LexAda.cxx, lexers/LexAsm.cxx, lexers/LexAsn1.cxx, + lexers/LexBaan.cxx, lexers/LexBash.cxx, lexers/LexBasic.cxx, + lexers/LexBullant.cxx, lexers/LexCLW.cxx, lexers/LexCOBOL.cxx, + lexers/LexCPP.cxx, lexers/LexCSS.cxx, lexers/LexCaml.cxx, + lexers/LexCmake.cxx, lexers/LexConf.cxx, lexers/LexCrontab.cxx, + lexers/LexCsound.cxx, lexers/LexD.cxx, lexers/LexEScript.cxx, + lexers/LexEiffel.cxx, lexers/LexErlang.cxx, lexers/LexFlagship.cxx, + lexers/LexForth.cxx, lexers/LexFortran.cxx, lexers/LexGAP.cxx, + lexers/LexGui4Cli.cxx, lexers/LexHTML.cxx, lexers/LexHaskell.cxx, + lexers/LexInno.cxx, lexers/LexKix.cxx, lexers/LexLisp.cxx, + lexers/LexLout.cxx, lexers/LexLua.cxx, lexers/LexMMIXAL.cxx, + lexers/LexMPT.cxx, lexers/LexMSSQL.cxx, lexers/LexMagik.cxx, + lexers/LexMarkdown.cxx, lexers/LexMatlab.cxx, + lexers/LexMetapost.cxx, lexers/LexMySQL.cxx, lexers/LexNimrod.cxx, + lexers/LexNsis.cxx, lexers/LexOpal.cxx, lexers/LexOthers.cxx, + lexers/LexPB.cxx, lexers/LexPLM.cxx, lexers/LexPOV.cxx, + lexers/LexPS.cxx, lexers/LexPascal.cxx, lexers/LexPerl.cxx, + lexers/LexPowerPro.cxx, lexers/LexPowerShell.cxx, + lexers/LexProgress.cxx, lexers/LexPython.cxx, lexers/LexR.cxx, + lexers/LexRebol.cxx, lexers/LexRuby.cxx, lexers/LexSML.cxx, + lexers/LexSQL.cxx, lexers/LexScriptol.cxx, lexers/LexSmalltalk.cxx, + lexers/LexSorcus.cxx, lexers/LexSpecman.cxx, lexers/LexSpice.cxx, + lexers/LexTACL.cxx, lexers/LexTADS3.cxx, lexers/LexTAL.cxx, + lexers/LexTCL.cxx, lexers/LexTeX.cxx, lexers/LexTxt2tags.cxx, + lexers/LexVB.cxx, lexers/LexVHDL.cxx, lexers/LexVerilog.cxx, + lexers/LexYAML.cxx, lexlib/Accessor.cxx, lexlib/Accessor.h, + lexlib/CharacterSet.cxx, lexlib/CharacterSet.h, + lexlib/LexAccessor.h, lexlib/LexerBase.cxx, lexlib/LexerBase.h, + lexlib/LexerModule.cxx, lexlib/LexerModule.h, + lexlib/LexerNoExceptions.cxx, lexlib/LexerNoExceptions.h, + lexlib/LexerSimple.cxx, lexlib/LexerSimple.h, lexlib/OptionSet.h, + lexlib/PropSetSimple.cxx, lexlib/PropSetSimple.h, + lexlib/StyleContext.cxx, lexlib/StyleContext.h, lexlib/WordList.cxx, + lexlib/WordList.h, lib/README.doc, macosx/PlatMacOSX.cxx, + macosx/SciTest/SciTest.xcode/project.pbxproj, + macosx/ScintillaMacOSX.cxx, macosx/ScintillaMacOSX.h, + macosx/deps.mak, macosx/makefile, src/AutoComplete.cxx, + src/AutoComplete.h, src/CallTip.cxx, src/CallTip.h, + src/Catalogue.cxx, src/Catalogue.h, src/CellBuffer.cxx, + src/CellBuffer.h, src/CharClassify.cxx, src/CharClassify.h, + src/CharacterSet.h, src/ContractionState.cxx, + src/ContractionState.h, src/Decoration.h, src/Document.cxx, + src/Document.h, src/DocumentAccessor.cxx, src/DocumentAccessor.h, + src/Editor.cxx, src/Editor.h, src/ExternalLexer.cxx, + src/ExternalLexer.h, src/FontQuality.h, src/Indicator.cxx, + src/Indicator.h, src/KeyMap.cxx, src/KeyMap.h, src/KeyWords.cxx, + src/LexAPDL.cxx, src/LexASY.cxx, src/LexAU3.cxx, src/LexAVE.cxx, + src/LexAbaqus.cxx, src/LexAda.cxx, src/LexAsm.cxx, src/LexAsn1.cxx, + src/LexBaan.cxx, src/LexBash.cxx, src/LexBasic.cxx, + src/LexBullant.cxx, src/LexCLW.cxx, src/LexCOBOL.cxx, + src/LexCPP.cxx, src/LexCSS.cxx, src/LexCaml.cxx, src/LexCmake.cxx, + src/LexConf.cxx, src/LexCrontab.cxx, src/LexCsound.cxx, + src/LexD.cxx, src/LexEScript.cxx, src/LexEiffel.cxx, + src/LexErlang.cxx, src/LexFlagship.cxx, src/LexForth.cxx, + src/LexFortran.cxx, src/LexGAP.cxx, src/LexGen.py, + src/LexGui4Cli.cxx, src/LexHTML.cxx, src/LexHaskell.cxx, + src/LexInno.cxx, src/LexKix.cxx, src/LexLisp.cxx, src/LexLout.cxx, + src/LexLua.cxx, src/LexMMIXAL.cxx, src/LexMPT.cxx, src/LexMSSQL.cxx, + src/LexMagik.cxx, src/LexMatlab.cxx, src/LexMetapost.cxx, + src/LexMySQL.cxx, src/LexNimrod.cxx, src/LexNsis.cxx, + src/LexOpal.cxx, src/LexOthers.cxx, src/LexPB.cxx, src/LexPLM.cxx, + src/LexPOV.cxx, src/LexPS.cxx, src/LexPascal.cxx, src/LexPerl.cxx, + src/LexPowerPro.cxx, src/LexPowerShell.cxx, src/LexProgress.cxx, + src/LexPython.cxx, src/LexR.cxx, src/LexRebol.cxx, src/LexRuby.cxx, + src/LexSML.cxx, src/LexSQL.cxx, src/LexScriptol.cxx, + src/LexSmalltalk.cxx, src/LexSorcus.cxx, src/LexSpecman.cxx, + src/LexSpice.cxx, src/LexTACL.cxx, src/LexTADS3.cxx, src/LexTAL.cxx, + src/LexTCL.cxx, src/LexTeX.cxx, src/LexVB.cxx, src/LexVHDL.cxx, + src/LexVerilog.cxx, src/LexYAML.cxx, src/LineMarker.cxx, + src/LineMarker.h, src/Partitioning.h, src/PerLine.cxx, + src/PerLine.h, src/PositionCache.cxx, src/PositionCache.h, + src/PropSet.cxx, src/RESearch.cxx, src/RESearch.h, + src/RunStyles.cxx, src/SVector.h, src/SciTE.properties, + src/ScintillaBase.cxx, src/ScintillaBase.h, src/Selection.cxx, + src/Selection.h, src/SplitVector.h, src/Style.cxx, src/Style.h, + src/StyleContext.cxx, src/StyleContext.h, src/UniConversion.cxx, + src/UniConversion.h, src/ViewStyle.cxx, src/ViewStyle.h, + src/WindowAccessor.cxx, src/XPM.cxx, src/XPM.h, + test/MessageNumbers.py, test/README, test/XiteMenu.py, + test/XiteWin.py, test/examples/x.asp, test/examples/x.asp.styled, + test/examples/x.cxx, test/examples/x.cxx.styled, test/examples/x.d, + test/examples/x.d.styled, test/examples/x.html, + test/examples/x.html.styled, test/examples/x.php, + test/examples/x.php.styled, test/examples/x.py, + test/examples/x.py.styled, test/examples/x.vb, + test/examples/x.vb.styled, test/lexTests.py, + test/performanceTests.py, test/simpleTests.py, test/unit/README, + test/unit/SciTE.properties, test/unit/makefile, + test/unit/testContractionState.cxx, test/unit/testPartitioning.cxx, + test/unit/testRunStyles.cxx, test/unit/testSplitVector.cxx, + test/unit/unitTest.cxx, test/xite.py, vcbuild/SciLexer.dsp, + version.txt, win32/Margin.cur, win32/PlatWin.cxx, + win32/PlatformRes.h, win32/SciTE.properties, win32/ScintRes.rc, + win32/Scintilla.def, win32/ScintillaWin.cxx, win32/deps.mak, + win32/makefile, win32/scintilla.mak, win32/scintilla_vc6.mak, + zipsrc.bat: + Merged Scintilla v2.24. + [59ca27407fd9] + +2011-03-03 Phil Thompson + + * Python/configure.py, qt/qscintilla.pro: + Updated the .so version number to 6.0.0. + [8ebe3f1fccd4] + + * Makefile: + Switched the build system to Qt v4.7.2. + [47f653394ef0] + + * .hgtags, lib/README.svn: + Merged the v2.4 maintenance branch. + [d00b7d9115d1] + + * qsci/api/python/Python-3.2.api: + Added an API file for Python v3.2. + [8cc94408b710] <2.4-maint> + +2011-02-23 Phil Thompson + + * qt/qsciscintillabase.cpp: + On X11 the control modifier is now used (instead of alt) to trigger + a rectangular selection. + [4bea3b8b8271] <2.4-maint> + +2011-02-22 Phil Thompson + + * qt/qscimacro.cpp: + Fixed a bug with Qt4 when loading a macro that meant that a macro + may not have a terminating '\0'. + [bbec6ef96cd2] <2.4-maint> + +2011-02-06 Phil Thompson + + * lib/LICENSE.commercial.short, lib/LICENSE.gpl.short: + Updated the copyright notices. + [f386964f3853] <2.4-maint> + + * Python/sip/qsciscintilla.sip, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Deprecated setAutoCompletionShowSingle(), added + setAutoCompletionUseSingle(). Deprecated autoCompletionShowSingle(), + added autoCompletionUseSingle(). + [7dae1a33b74b] <2.4-maint> + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + QsciScintilla::setAutoCompletionCaseSensitivity() is no longer + ignored if a lexer has been set. + [92d3c5f7b825] <2.4-maint> + + * qt/qscintilla.pro, qt/qsciscintillabase.cpp: + Translate Key_Backtab to Shift-Key_Tab before passing to Scintilla. + [fc2d75b26ef8] <2.4-maint> + +2011-01-06 Phil Thompson + + * qt/qscintilla_es.ts: + Updated Spanish translations from Jaime Seuma. + [8921e85723a1] <2.4-maint> + +2010-12-24 Phil Thompson + + * qt/qsciscintilla.h: + Fixed a documentation typo. + [1b951cf8838a] <2.4-maint> + +2010-12-23 Phil Thompson + + * .hgtags: + Added tag 2.4.6 for changeset 1884d76f35b0 + [696037b84e26] <2.4-maint> + + * NEWS: + Released as v2.4.6. + [1884d76f35b0] [2.4.6] <2.4-maint> + +2010-12-21 Phil Thompson + + * qt/qsciscintilla.cpp: + Auto-completion words from documents are now ignored if they are + already included from APIs. + [db48fbf19e7c] <2.4-maint> + + * qt/SciClasses.cpp: + Make sure call tips are redrawn afer being clicked on. + [497ad4605ae3] <2.4-maint> + +2010-11-23 Phil Thompson + + * NEWS, Python/sip/qsciscintilla.sip, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added support for indicators to the high-level API. See the NEWS + file for the details. + [8673b7890874] <2.4-maint> + +2010-11-15 Phil Thompson + + * Python/configure.py: + Added the --no-timestamp option to configure.py. + [61d1b5d28e21] <2.4-maint> + + * qsci/api/python/Python-2.7.api: + Added the API file for Python v2.7. + [5b2c77e7150a] <2.4-maint> + +2010-11-09 Phil Thompson + + * Makefile, qt/PlatQt.cpp: + Applied a fix for calculating character widths under OS/X. Switched + the build system to Qt v4.7.1. + [47a4eff86efa] <2.4-maint> + +2010-11-08 Phil Thompson + + * qt/qscilexercpp.h: + Fixed a bug in the documentation of QsciLexerCPP.GlobalClass. + [3cada289b329] <2.4-maint> + +2010-10-24 Phil Thompson + + * qt/SciClasses.h, qt/ScintillaQt.h, qt/qscicommandset.h, + qt/qsciglobal.h, qt/qscilexer.h, qt/qsciprinter.h, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Added support for QT_BEGIN_NAMESPACE and QT_END_NAMESPACE. + [a80f0df49f6c] <2.4-maint> + +2010-10-23 Phil Thompson + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Updated German translations from Detlev. + [693d3adf3c3f] <2.4-maint> + +2010-10-21 Phil Thompson + + * Makefile, Python/sip/qscilexerproperties.sip, + qt/qscilexerproperties.cpp, qt/qscilexerproperties.h, + qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Added support for the Key style to QsciLexerProperties. + [0b2e86015862] <2.4-maint> + +2010-08-31 Phil Thompson + + * .hgtags: + Added tag 2.4.5 for changeset f3f3936e5b86 + [84bb1b0d0674] <2.4-maint> + + * NEWS: + Released as v2.4.5. + [f3f3936e5b86] [2.4.5] <2.4-maint> + +2010-08-21 Phil Thompson + + * NEWS: + Updated the NEWS file. + [80afe6b1504a] <2.4-maint> + +2010-08-20 Phil Thompson + + * Python/sip/qsciscintillabase.sip: + With Python v3, the QsciScintillaBase.SendScintilla() overloads that + take char * arguments now require them to be bytes objects and no + longer allow them to be str objects. + [afa9ac3c487d] <2.4-maint> + +2010-08-14 Phil Thompson + + * Python/sip/qsciscintillabase.sip: + Reverted the addition of the /Encoding/ annotations to + SendScintilla() as it is (probably) not the right solution. + [4cb625284e4f] <2.4-maint> + + * qt/qsciscintilla.cpp: + The entries in user and auto-completion lists should now support + UTF-8. + [112d71cec57a] <2.4-maint> + + * Python/sip/qsciscintillabase.sip: + The QsciScintillaBase.SendScintilla() Python overloads will now + accept unicode strings that can be encoded to UTF-8. + [2f21b97985f2] <2.4-maint> + +2010-07-22 Phil Thompson + + * qt/qscilexerhtml.cpp, qt/qscilexerhtml.h: + Implemented QsciLexerHTML::autoCompletionFillups() to change the + fillups to "/>". + [8d9c1aad1349] <2.4-maint> + + * qt/qsciscintilla.cpp: + Fixed a regression, and the original bug, in + QsciScintilla::clearAnnotations(). + [fd8746ae2198] <2.4-maint> + + * qt/qscistyle.cpp: + QsciStyle now auto-allocates style numbers from 63 rather than + STYLE_MAX because Scintilla only initially creates enough storage + for that number of styles. + [7c69b0a4ee5b] <2.4-maint> + +2010-07-15 Phil Thompson + + * qt/qscilexerverilog.cpp, qt/qscintilla.pro: + Fixed a bug in QsciLexerVerilog that meant that the Keyword style + was being completely ignored. + [09e28404476a] <2.4-maint> + +2010-07-12 Phil Thompson + + * .hgtags: + Added tag 2.4.4 for changeset c61a49005995 + [4c98368d9bea] <2.4-maint> + + * NEWS: + Released as v2.4.4. + [c61a49005995] [2.4.4] <2.4-maint> + +2010-06-08 Phil Thompson + + * Makefile, qt/qsciscintillabase.cpp: + Pop-lists now get removed when the main widget loses focus. + [169fa07f52ab] <2.4-maint> + +2010-06-05 Phil Thompson + + * qt/ScintillaQt.cpp: + Changed SCN_MODIFIED to deal with text being NULL. + [68148fa857ab] <2.4-maint> + +2010-06-03 Phil Thompson + + * qt/ScintillaQt.cpp: + The SCN_MODIFIED signal now tries to make sure that the text passed + is valid. + [90e3461f410f] <2.4-maint> + +2010-04-22 Phil Thompson + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + QsciScintilla::markerDefine() now allows existing markers to be + redefined if an explicit marker number is given. + [63f1a7a1d8e2] <2.4-maint> + + * qt/ScintillaQt.cpp, qt/qsciscintilla.cpp, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Fixed the drag and drop behaviour so that a move automatically turns + into a copy when the mouse leaves the widget. + [4dab09799716] <2.4-maint> + +2010-04-21 Phil Thompson + + * qt/PlatQt.cpp, qt/ScintillaQt.cpp: + Fixed build problems against Qt v3. + [71168072ac9b] <2.4-maint> + + * Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Added QsciScintillaBase::fromMimeData(). + [b86a15672079] <2.4-maint> + + * Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Renamed QsciScintillaBase::createMimeData() to toMimeData(). + [6f5837334dde] <2.4-maint> + +2010-04-20 Phil Thompson + + * Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Added QsciScintillaBase::canInsertFromMimeData(). + [bbba2c1799ef] <2.4-maint> + + * Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, + qt/qscintilla.pro, qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Added QsciScintillaBase::createMimeData(). + [b2c3e3a9b43d] <2.4-maint> + +2010-03-17 Phil Thompson + + * .hgtags: + Added tag 2.4.3 for changeset 786429e0227d + [1931843aec48] <2.4-maint> + + * NEWS, build.py: + Fixed the generation of the change log after tagging a release. + Updated the NEWS file. Released as v2.4.3. + [786429e0227d] [2.4.3] <2.4-maint> + +2010-02-23 Phil Thompson + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Reverted the setting of the alpha component in + setMarkerForegroundColor() (at least until SC_MARK_UNDERLINE is + supported). + [111da2e01c5e] <2.4-maint> + + * qt/PlatQt.cpp, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Fixed the very broken support for the alpha component with Qt4. + [b1d73c7f447b] <2.4-maint> + + * Python/sip/qsciscintilla.sip, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added QsciScintilla::clearFolds() to clear all current folds + (typically prior to disabling folding). + [4f4266da1962] <2.4-maint> + +2010-02-15 Phil Thompson + + * Makefile: + Switched the build system to Qt v4.6.2. + [f023013b79e4] <2.4-maint> + +2010-02-07 Phil Thompson + + * qt/qscidocument.cpp: + Fixed a bug in the handling of multiple views of a document. + [8b4aa000df1c] <2.4-maint> + +2010-01-31 Phil Thompson + + * Makefile, build.py: + Minor tidy ups for the internal build system. + [c3a41d195b8a] <2.4-maint> + +2010-01-30 Phil Thompson + + * Makefile, Python/configure.py, build.py, lib/README.doc, + lib/README.svn, lib/qscintilla.dxy, qt/qsciglobal.h: + Changes to the internal build system required by the migration to + Mercurial. + [607e474dfd28] <2.4-maint> + +2010-01-29 phil + + * .hgtags: + Import from SVN. + [49d5a0d80211] + +2008-08-31 phil + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Updated German translations from Detlev. + [d2a7db9cb3f6] <2.2-maint> + +2008-08-17 phil + + * Python/sip/qscilexeryaml.sip, Python/sip/qscimodcommon.sip, + qt/qscilexeryaml.cpp, qt/qscilexeryaml.h, qt/qscintilla.pro: + Added the QsciLexerYAML class. + [87f48847405d] <2.2-maint> + + * Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + The fold margin can now be specified by an extra argument to + QsciScintilla::setFolding(). + [ae43393149f0] <2.2-maint> + + * qt/qscilexerlua.cpp, qt/qscilexerlua.h, qt/qscilexerperl.cpp, + qt/qscilexerperl.h: + Implemented autoCompletionWordSeparators() for QsciLexerPerl and + QsciLexerLua. + [1bfc2fc0fa36] <2.2-maint> + + * qt/ListBoxQt.cpp, qt/ListBoxQt.h, qt/qscintilla_de.qm, + qt/qscintilla_de.ts, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + User lists can now handle entries with embedded spaces. Updated + German translations from Detlev. + [b5e413c95aff] <2.2-maint> + +2008-08-16 phil + + * Python/sip/qscilexerxml.sip, Python/sip/qscimodcommon.sip, + qt/qscilexerhtml.cpp, qt/qscilexerxml.cpp, qt/qscilexerxml.h, + qt/qscintilla.pro: + Added the QsciLexerXML class. + [643a3e847646] <2.2-maint> + + * Python/sip/qscilexerpostscript.sip, Python/sip/qscimodcommon.sip, + qt/qscilexerpostscript.cpp, qt/qscilexerpostscript.h, + qt/qscintilla.pro, qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Added the QsciLexerPostScript class. Updated German translations + from Detlev. + [3e4695d615b0] <2.2-maint> + +2008-08-10 phil + + * Python/sip/qscilexerpascal.sip, Python/sip/qscimodcommon.sip, + qt/qscilexerpascal.cpp, qt/qscilexerpascal.h, qt/qscintilla.pro: + Added the QsciLexerPascal class. + [2712538aa17c] <2.2-maint> + + * Makefile, Python/sip/qscilexerfortran.sip, + Python/sip/qscilexerfortran77.sip, Python/sip/qscimodcommon.sip, + qt/qscilexerfortran.cpp, qt/qscilexerfortran.h, + qt/qscilexerfortran77.cpp, qt/qscilexerfortran77.h, + qt/qscintilla.pro: + Added the QsciLexerFortran77 and QsciLexerFortran classes. + [e72f0ce049ab] <2.2-maint> + +2008-07-03 phil + + * lib/README.doc, qt/qscintilla.pro: + Updated the Windows installation instructions for Qt3. Backed out + the use of version numbers on Windows because it breaks + compatibility with Qt3. (It may go back for Qt4 if that proves not + to be a problem.) + [82b976c98cf9] <2.2-maint> + +2008-06-19 phil + + * build.py, qt/qscintilla.pro: + Added the DLL metadata for Windows. + [0f65670eeb66] <2.2-maint> + +2008-06-16 phil + + * Python/sip/qsciscintillabase.sip, qt/qscintilla.pro, + qt/qsciscintillabase.h: + Added support for the new Scintilla 1.76 features and lexers. + [fff8c7e1940e] <2.2-maint> + + * doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/index.html, gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, gtk/makefile, + gtk/scintilla.mak, include/Platform.h, include/SciLexer.h, + include/Scintilla.h, include/Scintilla.iface, macosx/ExtInput.cxx, + macosx/ExtInput.h, macosx/PlatMacOSX.cxx, macosx/PlatMacOSX.h, + macosx/QuartzTextLayout.h, macosx/QuartzTextStyle.h, + macosx/QuartzTextStyleAttribute.h, macosx/ScintillaMacOSX.cxx, + macosx/ScintillaMacOSX.h, macosx/TView.cxx, macosx/makefile, + src/CellBuffer.cxx, src/Editor.cxx, src/Editor.h, src/KeyWords.cxx, + src/LexCPP.cxx, src/LexGen.py, src/LexMagik.cxx, src/LexMatlab.cxx, + src/LexPerl.cxx, src/LexPowerShell.cxx, src/LineMarker.cxx, + src/RunStyles.cxx, src/RunStyles.h, vcbuild/SciLexer.dsp, + version.txt, win32/PlatWin.cxx, win32/ScintRes.rc, + win32/ScintillaWin.cxx, win32/makefile, win32/scintilla.mak, + win32/scintilla_vc6.mak: + Merged Scintilla v1.76. + [a3a5181efbb0] <2.2-maint> + +2008-06-10 phil + + * Python/configure.py: + Fixed a configuration problem with the Python bindings when building + against a Windows DLL of QScintilla. + [7d9af6e97d2c] <2.2-maint> + +2008-06-07 phil + + * Makefile, lib/LICENSE.commercial, lib/README.doc, qt/qscimacro.cpp, + qt/qscimacro.h: + Fixed a regression in macro recording. + [3a2c8add1382] <2.2-maint> + +2008-03-09 phil + + * lib/qscintilla.dxy: + Fixed the doxygen configuration file for Qt4. + [2d3ab16b71cb] <2.2-maint> + +2008-03-06 phil + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Updated German translations from Detlev. + [478c96e64584] <2.2-maint> + + * include/Platform.h: + By default build with (possibly over-aggressive) assertions + disabled. + [a07535b643ef] <2.2-maint> + +2008-03-05 phil + + * lib/qscintilla.dxy: + Updated the doxygen configuration to remove some warnings. + [bf028c1824c3] <2.2-maint> + +2008-03-04 phil + + * Python/sip/qscilexertcl.sip, Python/sip/qscimodcommon.sip, + qt/qscilexertcl.cpp, qt/qscilexertcl.h, qt/qscintilla.pro: + Added the QsciLexerTCL class. + [a008135167cf] <2.2-maint> + +2008-11-17 phil + + * NEWS: + Released as v2.3.2. + [6ae4c306fcf1] [2.3.2] <2.3-maint> + +2008-11-16 phil + + * qt/qsciscintilla.cpp, qt/qsciscintillabase.h: + The default lexer is now SCLEX_CONTAINER rather than SCLEX_NULL. + [abffc574bda0] <2.3-maint> + +2008-11-14 phil + + * qt/qscilexerpython.cpp, qt/qscilexerxml.cpp, qt/qscintilla.pro: + The XML lexer now styles embedded scripts properly. (An API call to + disable this will be added in a future version.) + [be4308ba5fc9] <2.3-maint> + + * UTF-8-demo.txt, qt/PlatQt.cpp: + Fixed a regression in measuring character widths introduced when + fixing the problem with kerned fonts. + [835cbce25ae2] <2.3-maint> + +2008-11-08 phil + + * NEWS: + Released as v2.3.1. + [91ec01d1c22c] [2.3.1] <2.3-maint> + + * NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added QsciScintilla::wordAtPoint() based on a patch from Andrea + Battisti. + [072c84e5baa7] <2.3-maint> + +2008-11-07 phil + + * qt/qsciscintilla.cpp: + Changing the current lexer while text is displayed should now be + handled properly. (However the XML lexer seems buggy in this + regard.) + [ef0fcd30ff99] <2.3-maint> + + * qt/PlatQt.cpp: + Fixed a bug in the calculation of character positions when kerning + was in effect. This cause the caret to be displayed too far to the + right. + [225bf588aeeb] <2.3-maint> + +2008-11-01 phil + + * NEWS: + Updated the NEWS file. + [3f777fbcaa87] <2.3-maint> + +2008-10-21 phil + + * qt/qscintilla_de.ts: + Updated German translations from Detlev. + [055862970575] <2.3-maint> + +2008-10-20 phil + + * Python/configure.py, Python/sip/qscilexercss.sip, + Python/sip/qscilexerdiff.sip, Python/sip/qsciscintillabase.sip, + qt/ScintillaQt.cpp, qt/qscilexercss.cpp, qt/qscilexercss.h, + qt/qscilexerdiff.cpp, qt/qscilexerdiff.h, qt/qscintilla.pro, + qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_fr.ts, + qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts, qt/qsciscintilla.cpp, + qt/qsciscintillabase.h: + Updated the QScintilla API to accomodate changes in Scintilla v1.77. + [9876dd8de8a4] <2.3-maint> + + * README, doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/ScintillaToDo.html, doc/index.html, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, gtk/makefile, gtk/scintilla.mak, + include/SciLexer.h, include/Scintilla.h, include/Scintilla.iface, + macosx/makefile, src/CellBuffer.cxx, src/CellBuffer.h, + src/Document.cxx, src/Document.h, src/Editor.cxx, + src/ExternalLexer.cxx, src/KeyWords.cxx, src/LexAbaqus.cxx, + src/LexAsm.cxx, src/LexBash.cxx, src/LexCPP.cxx, src/LexCSS.cxx, + src/LexFortran.cxx, src/LexGen.py, src/LexHTML.cxx, + src/LexHaskell.cxx, src/LexInno.cxx, src/LexLua.cxx, + src/LexMySQL.cxx, src/LexNsis.cxx, src/LexOthers.cxx, + src/LexPerl.cxx, src/LexProgress.cxx, src/LexRuby.cxx, + src/LexTeX.cxx, src/LexVerilog.cxx, src/LexYAML.cxx, + src/RESearch.cxx, src/RESearch.h, src/RunStyles.h, + src/ScintillaBase.cxx, src/SplitVector.h, vcbuild/SciLexer.dsp, + version.txt, win32/PlatWin.cxx, win32/ScintRes.rc, + win32/ScintillaWin.cxx, win32/makefile, win32/scintilla.mak, + win32/scintilla_vc6.mak: + Initial merge of Scintilla 1.77. + [39acb5c4e434] <2.3-maint> + +2008-10-12 phil + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Applied a patch from Detlev that fixes issues with the document + modification notification and setting different fold margins. + [3af8eefae9f9] <2.3-maint> + + * Python/sip/qscicommand.sip, Python/sip/qscicommandset.sip, + Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added the read() and write() methods to QsciScintilla in + anticipation of PyQt dropping support for QStrings. This will allow + file to be read and written while keeping the number of conversions + to the minimum. + [85e0d79e204f] <2.3-maint> + + * Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + QsciScintilla::setSelection() is now implemented using SCI_SETSEL so + that the carat can be left at either the start or the end of the + selection. Exposed QsciScintilla::positionFromLineIndex() and + QsciScintilla::lineIndexFromPosition(). + [acdba5c2e772] <2.3-maint> + +2008-10-04 phil + + * qt/qscidocument.cpp, qt/qscidocument.h, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + The modified status of a document is now maintained on a per + document basis rather than a per editor basis. + [744886134592] <2.3-maint> + +2008-10-02 phil + + * qt/qscilexerpython.cpp: + Added 'with' to the list of keywords in the Python lexer for Python + v2.6. + [e33bbbc426ab] <2.3-maint> + +2010-01-20 phil + + * Makefile, NEWS: + Updated the build system to Qt v4.6.1. Released as v2.4.2. + [73732e5bae08] [2.4.2] <2.4-maint> + +2010-01-18 phil + + * qt/qscintilla_es.qm, qt/qscintilla_es.ts: + Updated Spanish translations from Jaime Seuma. + [3b911e69696d] <2.4-maint> + +2010-01-15 phil + + * Python/configure.py: + The Python bindings now check for SIP v4.10. + [8d5f4957a07c] <2.4-maint> + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the .ts files. + [15c647ac0c42] <2.4-maint> + + * NEWS, build.py: + Fixed the build system for Qt v3 and v4 prior to v4.5. + [1b5bea85a3bf] <2.4-maint> + +2010-01-14 phil + + * NEWS, lib/LICENSE.commercial.short, lib/LICENSE.gpl.short: + Released as v2.4.1. + [a04b69746aa6] [2.4.1] <2.4-maint> + +2009-12-22 phil + + * lib/gen_python3_api.py, qsci/api/python/Python-3.1.api: + Added the API file for Python v3.1. + [116c24ab58b2] <2.4-maint> + + * NEWS, Python/configure.py: + Added support for automatically generated docstrings. + [3d316b4f222b] <2.4-maint> + +2009-12-11 phil + + * Makefile, qt/PlatQt.cpp: + Fixed a performance problem when displaying very long lines. + [d3fe67ad2eb5] <2.4-maint> + +2009-11-01 phil + + * qt/qsciapis.cpp: + Fixed a possible crash in the handling of call tips. + [6248caa24fec] <2.4-maint> + + * qt/SciClasses.cpp: + Applied the workaround for the autocomplete focus bug under Gnome's + window manager which (appears) to work with current versions of Qt + across all platforms. + [f709f1518e70] <2.4-maint> + + * Makefile, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Make sure a lexer is fully detached when a QScintilla instance is + destroyed. + [db47764231d2] <2.4-maint> + +2009-08-19 phil + + * lib/LICENSE.gpl.short, qt/qscintilla_de.qm, qt/qscintilla_de.ts: + Updated German translations from Detlev. + [458b60ec031e] <2.4-maint> + +2009-08-09 phil + + * Python/sip/qscilexerverilog.sip, Python/sip/qscimodcommon.sip, + qt/qscilexerverilog.cpp, qt/qscilexerverilog.h, qt/qscintilla.pro: + Added the QsciLexerVerilog class. + [86b2aceac88c] <2.4-maint> + + * Makefile, Python/sip/qscilexerspice.sip, + Python/sip/qscimodcommon.sip, lib/LICENSE.commercial, lib + /OPENSOURCE-NOTICE.TXT, lib/README.doc, qt/qscilexerspice.cpp, + qt/qscilexerspice.h, qt/qscintilla.pro: + Added the QsciLexerSpice class. + [56532ec00839] <2.4-maint> + +2009-06-05 phil + + * NEWS, lib/LICENSE.commercial: + Released as v2.4. + [612b1bcb8223] [2.4] + +2009-06-03 phil + + * NEWS, qt/qscistyledtext.h: + Fixed a bug building on Qt v3. + [88ebc67fdff4] + +2009-05-30 phil + + * qt/ScintillaQt.cpp: + Applied a fix for copying UTF-8 text to the X clipboard from Lars + Reichelt. + [e59fa72c2e2d] + +2009-05-27 phil + + * qt/qscilexercustom.h: + Fixed a missing forward declaration in qscilexercustom.h. + [0018449ee6aa] + +2009-05-25 phil + + * qt/qscilexercustom.cpp: + Don't ask the custom lexer to style zero characters. + [6ae021232f4f] + +2009-05-19 phil + + * NEWS, qt/qscintilla.pro, qt/qscintilla_cs.qm, qt/qscintilla_es.qm, + qt/qscintilla_es.ts, qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm, + qt/qscintilla_ru.qm: + Added Spanish translations from Jaime Seuma. + [0cdbee8db9af] + + * qt/qsciscintilla.cpp: + A minor fix for ancient C++ compilers. + [0523c3a0e0aa] + +2009-05-18 phil + + * NEWS, Python/sip/qscilexer.sip, Python/sip/qscilexercustom.sip, + Python/sip/qscimodcommon.sip, Python/sip/qsciscintilla.sip, + qt/qscilexer.cpp, qt/qscilexer.h, qt/qscilexercustom.cpp, + qt/qscilexercustom.h, qt/qscintilla.pro, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added QsciScintilla::annotation(). Added QsciLexerCustom (completely + untested) and supporting changes to QsciLexer. + [382d5b86f600] + +2009-05-17 phil + + * qt/qscintilla_cs.ts, qt/qscintilla_de.qm, qt/qscintilla_de.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated translations from Detlev. + [0b8c8438e464] + +2009-05-09 phil + + * NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added support for text margins. + [be9db7d41b50] + + * qt/PlatQt.cpp, qt/qsciscintilla.cpp, qt/qsciscintilla.h, + qt/qscistyledtext.cpp, qt/qscistyledtext.h: + Debugged the support for annotations. Tidied up the QString to + Scintilla string conversions. + [573199665222] + +2009-05-08 phil + + * NEWS, Python/sip/qscimodcommon.sip, Python/sip/qsciscintilla.sip, + Python/sip/qscistyle.sip, Python/sip/qscistyledtext.sip, + qt/qscicommand.h, qt/qscimacro.h, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qscistyle.cpp, + qt/qscistyle.h, qt/qscistyledtext.cpp, qt/qscistyledtext.h: + Implemented the rest of the annotation API - still needs debugging. + [7f23400d2416] + +2009-05-07 phil + + * NEWS, qt/qscintilla.pro, qt/qscistyle.cpp, qt/qscistyle.h: + Added the QsciStyle class. + [bf8e3e02071e] + +2009-05-06 phil + + * qt/qsciscintillabase.cpp: + Fixed the key event handling when the text() is empty and the key() + should be used - only seems to happen with OS/X. + [868a146b019f] + +2009-05-03 phil + + * Makefile, NEWS, Python/configure.py, Python/sip/qscicommand.sip, + Python/sip/qscicommandset.sip, Python/sip/qscilexer.sip, + Python/sip/qscilexercpp.sip, Python/sip/qscilexercss.sip, + Python/sip/qscilexerdiff.sip, Python/sip/qscilexerhtml.sip, + Python/sip/qscilexerpascal.sip, Python/sip/qscilexerperl.sip, + Python/sip/qscilexerpython.sip, Python/sip/qscilexerxml.sip, + Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, + README, UTF-8-demo.txt, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/ScintillaRelated.html, doc/ScintillaToDo.html, + doc/annotations.png, doc/index.html, doc/styledmargin.png, + gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, gtk/deps.mak, gtk/makefile, + gtk/scintilla.mak, include/Face.py, include/HFacer.py, + include/SciLexer.h, include/Scintilla.h, include/Scintilla.iface, + include/ScintillaWidget.h, lib/LICENSE.commercial, + macosx/PlatMacOSX.cxx, macosx/makefile, qt/PlatQt.cpp, + qt/ScintillaQt.cpp, qt/qsciapis.cpp, qt/qscidocument.cpp, + qt/qscidocument.h, qt/qscilexer.cpp, qt/qscilexer.h, + qt/qscilexercpp.cpp, qt/qscilexercpp.h, qt/qscilexercss.cpp, + qt/qscilexercss.h, qt/qscilexerdiff.cpp, qt/qscilexerdiff.h, + qt/qscilexerhtml.cpp, qt/qscilexerhtml.h, qt/qscilexerpascal.cpp, + qt/qscilexerpascal.h, qt/qscilexerperl.cpp, qt/qscilexerperl.h, + qt/qscilexerpython.cpp, qt/qscilexerpython.h, qt/qscilexerxml.cpp, + qt/qscilexerxml.h, qt/qscintilla.pro, qt/qscintilla_cs.ts, + qt/qscintilla_de.ts, qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, + qt/qscintilla_ru.ts, qt/qsciscintilla.cpp, qt/qsciscintilla.h, + qt/qsciscintillabase.h, src/CellBuffer.cxx, src/CellBuffer.h, + src/Document.cxx, src/Document.h, src/Editor.cxx, src/Editor.h, + src/ExternalLexer.cxx, src/Indicator.cxx, src/Indicator.h, + src/KeyWords.cxx, src/LexAU3.cxx, src/LexAbaqus.cxx, src/LexAsm.cxx, + src/LexBash.cxx, src/LexCOBOL.cxx, src/LexCPP.cxx, src/LexCSS.cxx, + src/LexD.cxx, src/LexFortran.cxx, src/LexGen.py, src/LexHTML.cxx, + src/LexHaskell.cxx, src/LexInno.cxx, src/LexLua.cxx, + src/LexMySQL.cxx, src/LexNimrod.cxx, src/LexNsis.cxx, + src/LexOthers.cxx, src/LexPascal.cxx, src/LexPerl.cxx, + src/LexPowerPro.cxx, src/LexProgress.cxx, src/LexPython.cxx, + src/LexRuby.cxx, src/LexSML.cxx, src/LexSQL.cxx, src/LexSorcus.cxx, + src/LexTACL.cxx, src/LexTADS3.cxx, src/LexTAL.cxx, src/LexTeX.cxx, + src/LexVerilog.cxx, src/LexYAML.cxx, src/PerLine.cxx, src/PerLine.h, + src/PositionCache.cxx, src/RESearch.cxx, src/RESearch.h, + src/RunStyles.h, src/SciTE.properties, src/ScintillaBase.cxx, + src/SplitVector.h, src/UniConversion.cxx, src/ViewStyle.cxx, + src/ViewStyle.h, vcbuild/SciLexer.dsp, version.txt, + win32/PlatWin.cxx, win32/ScintRes.rc, win32/ScintillaWin.cxx, + win32/makefile, win32/scintilla.mak, win32/scintilla_vc6.mak: + Merged the v2.3 branch onto the trunk. + [1bb3d2b01123] + +2008-09-20 phil + + * Makefile, NEWS, lib/README.doc: + Released as v2.3. + [8fd73a9a9d66] [2.3] + +2008-09-17 phil + + * NEWS, Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added QsciScintilla::apiContext() for further open up the auto- + completion and call tips support. + [a6291ea6dd37] + +2008-09-16 phil + + * Python/configure.py, lib/gen_python_api.py, + qsci/api/python/Python-2.6.api, qt/qsciapis.h: + Added the API file for Python v2.6rc1. Fixed a typo in the help for + the Python bindings configure.py. + [ac10be3cc7fb] + +2008-09-03 phil + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_fr.ts, + qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the i18n .ts files. + [b73beac06e0f] + +2008-09-01 phil + + * lib/README.doc: + Updated the Windows installation notes to cover the need to manually + install the DLL when using Qt3. + [17019ebfab36] + + * lib/README.doc, qt/qsciscintilla.cpp: + Fixed a regression in the highlighting of call tip arguments. + Updated the Windows installation notes to say that any header files + installed from a previous build should first be removed. + [cb3f27b93323] + +2008-08-31 phil + + * NEWS, Python/configure.py, Python/sip/qsciabstractapis.sip, + Python/sip/qsciapis.sip, Python/sip/qscilexer.sip, + Python/sip/qscimodcommon.sip, Python/sip/qsciscintillabase.sip, + qt/qsciabstractapis.cpp, qt/qsciabstractapis.h, qt/qsciapis.cpp, + qt/qsciapis.h, qt/qscilexer.cpp, qt/qscilexer.h, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added the QsciAbstractAPIs class to allow applications to provide + their own implementation of APIs. + [eb5a8a602e5d] + + * Makefile, Python/configure.py, Python/sip/qscilexerfortran.sip, + Python/sip/qscilexerfortran77.sip, Python/sip/qscilexerpascal.sip, + Python/sip/qscilexerpostscript.sip, Python/sip/qscilexertcl.sip, + Python/sip/qscilexerxml.sip, Python/sip/qscilexeryaml.sip, + Python/sip/qscimodcommon.sip, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase.sip, build.py, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/ScintillaRelated.html, doc/index.html, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, gtk/makefile, gtk/scintilla.mak, + include/Platform.h, include/SciLexer.h, include/Scintilla.h, + include/Scintilla.iface, lib/LICENSE.commercial, lib/README.doc, + lib/qscintilla.dxy, macosx/ExtInput.cxx, macosx/ExtInput.h, + macosx/PlatMacOSX.cxx, macosx/PlatMacOSX.h, + macosx/QuartzTextLayout.h, macosx/QuartzTextStyle.h, + macosx/QuartzTextStyleAttribute.h, macosx/ScintillaMacOSX.cxx, + macosx/ScintillaMacOSX.h, macosx/TView.cxx, macosx/makefile, + qt/ListBoxQt.cpp, qt/ListBoxQt.h, qt/qscilexerfortran.cpp, + qt/qscilexerfortran.h, qt/qscilexerfortran77.cpp, + qt/qscilexerfortran77.h, qt/qscilexerhtml.cpp, qt/qscilexerlua.cpp, + qt/qscilexerlua.h, qt/qscilexerpascal.cpp, qt/qscilexerpascal.h, + qt/qscilexerperl.cpp, qt/qscilexerperl.h, + qt/qscilexerpostscript.cpp, qt/qscilexerpostscript.h, + qt/qscilexertcl.cpp, qt/qscilexertcl.h, qt/qscilexerxml.cpp, + qt/qscilexerxml.h, qt/qscilexeryaml.cpp, qt/qscilexeryaml.h, + qt/qscimacro.cpp, qt/qscimacro.h, qt/qscintilla.pro, + qt/qscintilla_de.qm, qt/qscintilla_de.ts, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.h, src/CellBuffer.cxx, + src/Editor.cxx, src/Editor.h, src/KeyWords.cxx, src/LexCPP.cxx, + src/LexGen.py, src/LexMagik.cxx, src/LexMatlab.cxx, src/LexPerl.cxx, + src/LexPowerShell.cxx, src/LineMarker.cxx, src/RunStyles.cxx, + src/RunStyles.h, vcbuild/SciLexer.dsp, version.txt, + win32/PlatWin.cxx, win32/ScintRes.rc, win32/ScintillaWin.cxx, + win32/makefile, win32/scintilla.mak, win32/scintilla_vc6.mak: + Merged the v2.2 maintenance branch. + [cd784c60bcc7] + +2008-02-27 phil + + * NEWS, build.py, lib/GPL_EXCEPTION.TXT, lib/LICENSE.GPL2, + lib/LICENSE.GPL3, lib/LICENSE.commercial, + lib/LICENSE.commercial.short, lib/LICENSE.gpl, + lib/LICENSE.gpl.short, lib/OPENSOURCE-NOTICE.TXT: + Updated the licenses to be in line with the the current Qt licenses, + including GPL v3. Released as v2.2. + [a039ca791129] [2.2] + +2008-02-23 phil + + * Makefile, qt/PlatQt.cpp: + Switched to Qt v4.3.4. Further tweaks for Windows64 support. + [3ae9686f38e6] + +2008-02-22 phil + + * Makefile, NEWS, Python/sip/qsciscintillabase.sip, qt/PlatQt.cpp, + qt/ScintillaQt.cpp, qt/qscidocument.cpp, qt/qscimacro.cpp, + qt/qscintilla.pro, qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Several fixes for Windows64 support based on a patch from Randall + Frank. + [2c753ee01c42] + +2008-02-09 phil + + * Python/configure.py, lib/README.doc, qt/qscintilla.pro: + It's no longer necessary to set DYLD_LIBRARY_PATH when using the + Python bindings. + [d1098424aed1] + +2008-02-03 phil + + * Python/sip/qscilexerruby.sip: + Added the missing QsciLexerRuby.Error to the Python bindings. + [0b4f06a30251] + +2008-01-20 phil + + * designer-Qt4/qscintillaplugin.cpp, designer-Qt4/qscintillaplugin.h: + Fixed a problem with the Qt4 Designer plugin on Leopard. + [5450a1bc62df] + +2008-01-11 phil + + * qt/SciClasses.cpp, qt/qsciscintillabase.cpp: + Hopefully fixed shortcuts and accelerators when the autocompletion + list is displayed. + [8304a1f4e36b] + +2008-01-06 phil + + * qt/SciClasses.cpp: + Hopefully fixed a bug stopping normal typing when the autocompletion + list is being displayed. + [2db0cc8fa158] + +2008-01-03 phil + + * lib/LICENSE.commercial.short, lib/LICENSE.gpl, + lib/LICENSE.gpl.short, lib/README.doc, qt/qsciscintillabase.cpp: + Fixed a Qt3 compilation bug. Updated the copyright notices. + [cf238f41fb54] + +2007-12-30 phil + + * qt/SciClasses.cpp, qt/SciClasses.h, qt/qsciscintillabase.cpp: + Hopefully fixed the problems with the auto-completion popup on all + platforms (not tested on Mac). + [585aa7e4e59f] + +2007-12-29 phil + + * qt/SciClasses.cpp: + Remove the use of the internal Tooltip widget flag so that the X11 + auto-completion list now has the same problems as the Windows + version. (Prior to fixing the problem properly.) + [93d584d099db] + +2007-12-23 phil + + * qt/ScintillaQt.cpp: + Fixed DND problems with Qt4. + [23f8c1a7c4c7] + + * qt/qsciscintilla.cpp: + Fix from Detlev for an infinite loop caused by calling + getCursorPosition() when Scintilla reports a position past the end + of the text. + [dd99ade93fa6] + +2007-12-05 phil + + * qt/qscilexerperl.cpp, qt/qscintilla_cs.ts, qt/qscintilla_de.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Fixed a silly typo in the updated Perl lexer. + [0e290eb71572] + + * qt/qscintilla_de.qm: + Updated German translations from Detlev. + [e820d3c167f5] + + * Makefile: + Switched the internal build system to Qt v4.3.3. + [df2d877e2422] + +2007-12-04 phil + + * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_fr.ts, + qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the translation source files. + [1fb11f16d750] + + * Python/sip/qscilexerperl.sip, Python/sip/qsciscintillabase.sip, + doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/index.html, gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, gtk/makefile, + gtk/scintilla.mak, include/Platform.h, include/PropSet.h, + include/SciLexer.h, include/Scintilla.h, include/Scintilla.iface, + lib/README.svn, macosx/PlatMacOSX.cxx, macosx/ScintillaMacOSX.h, + macosx/makefile, qt/PlatQt.cpp, qt/qscilexer.cpp, qt/qscilexer.h, + qt/qscilexerperl.cpp, qt/qscilexerperl.h, qt/qscilexerpython.cpp, + qt/qscilexerpython.h, qt/qscintilla.pro, qt/qsciscintilla.cpp, + qt/qsciscintillabase.h, src/CellBuffer.cxx, src/CellBuffer.h, + src/ContractionState.cxx, src/ContractionState.h, src/Document.cxx, + src/Document.h, src/DocumentAccessor.cxx, src/Editor.cxx, + src/Editor.h, src/KeyWords.cxx, src/LexAPDL.cxx, src/LexASY.cxx, + src/LexAU3.cxx, src/LexAbaqus.cxx, src/LexBash.cxx, src/LexCPP.cxx, + src/LexGen.py, src/LexHTML.cxx, src/LexHaskell.cxx, + src/LexMetapost.cxx, src/LexOthers.cxx, src/LexPerl.cxx, + src/LexPython.cxx, src/LexR.cxx, src/LexSQL.cxx, src/LexTeX.cxx, + src/LexYAML.cxx, src/Partitioning.h, src/PositionCache.cxx, + src/PositionCache.h, src/PropSet.cxx, src/RunStyles.cxx, + src/RunStyles.h, src/ScintillaBase.cxx, src/SplitVector.h, + src/ViewStyle.cxx, src/ViewStyle.h, vcbuild/SciLexer.dsp, + version.txt, win32/PlatWin.cxx, win32/ScintRes.rc, + win32/ScintillaWin.cxx, win32/makefile, win32/scintilla.mak, + win32/scintilla_vc6.mak: + Merged Scintilla v1.75. + [8009a4d7275a] + +2007-11-17 phil + + * qt/SciClasses.cpp, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Bug fixes for selectAll() and getCursorPosition() from Baz Walter. + [80eecca239b4] + +2007-10-24 phil + + * qt/qsciscintilla.cpp: + Fixed folding for HTML. + [bb6fb6065e30] + +2007-10-14 phil + + * build.py, lib/GPL_EXCEPTION.TXT, lib/GPL_EXCEPTION_ADDENDUM.TXT, + lib/LICENSE.gpl, lib/OPENSOURCE-NOTICE.TXT, qt/qscicommandset.cpp: + Control characters that are not bound to commands (or shortcuts) now + default to doing nothing (rather than inserting the character into + the text). Aligned the GPL license with Trolltech's exceptions. + [148432c68762] + +2007-10-12 phil + + * src/LexHTML.cxx: + Fixed the Scintilla HTML lexer's handling of characters >= 0x80. + [c4e271ce8e96] + +2007-10-05 phil + + * qt/qsciscintillabase.cpp: + Used NoSystemBackground rather than OpaquePaintEvent to eliminate + flicker. + [01a22c66304d] + +2007-10-04 phil + + * Makefile, qt/qsciscintillabase.cpp: + Fixed a flashing effect visible with a non-standard background. + Switched to Qt v4.3.2. + [781c58fcba96] + +2007-09-23 phil + + * qt/qsciapis.h, qt/qscicommand.h, qt/qscicommandset.h, + qt/qscidocument.h, qt/qsciglobal.h, qt/qscilexer.h, + qt/qscilexerbash.h, qt/qscilexerbatch.h, qt/qscilexercmake.h, + qt/qscilexercpp.h, qt/qscilexercsharp.h, qt/qscilexercss.h, + qt/qscilexerd.h, qt/qscilexerdiff.h, qt/qscilexerhtml.h, + qt/qscilexeridl.h, qt/qscilexerjava.h, qt/qscilexerjavascript.h, + qt/qscilexerlua.h, qt/qscilexermakefile.h, qt/qscilexerperl.h, + qt/qscilexerpov.h, qt/qscilexerproperties.h, qt/qscilexerpython.h, + qt/qscilexerruby.h, qt/qscilexersql.h, qt/qscilexertex.h, + qt/qscilexervhdl.h, qt/qscimacro.h, qt/qsciprinter.h, + qt/qsciscintilla.h, qt/qsciscintillabase.h: + Made the recent portabilty changes Mac specific as AIX has a problem + with them. + [0de605d4079f] + +2007-09-16 phil + + * qt/qscilexer.cpp: + A lexer's default colour, paper and font are now written to and read + from the settings. + [45277fc76ace] + +2007-09-15 phil + + * lib/README.doc, qt/qsciapis.h, qt/qscicommand.h, + qt/qscicommandset.h, qt/qscidocument.h, qt/qsciglobal.h, + qt/qscilexer.h, qt/qscilexerbash.h, qt/qscilexerbatch.h, + qt/qscilexercmake.h, qt/qscilexercpp.h, qt/qscilexercsharp.h, + qt/qscilexercss.h, qt/qscilexerd.h, qt/qscilexerdiff.h, + qt/qscilexerhtml.h, qt/qscilexeridl.h, qt/qscilexerjava.h, + qt/qscilexerjavascript.h, qt/qscilexerlua.h, qt/qscilexermakefile.h, + qt/qscilexerperl.h, qt/qscilexerpov.h, qt/qscilexerproperties.h, + qt/qscilexerpython.h, qt/qscilexerruby.h, qt/qscilexersql.h, + qt/qscilexertex.h, qt/qscilexervhdl.h, qt/qscimacro.h, + qt/qsciprinter.h, qt/qsciscintilla.h, qt/qsciscintillabase.h: + Fixed the MacOS build problems when using the binary installer + version of Qt. + [e059a923a447] + + * lib/LICENSE.commercial.short, qt/PlatQt.cpp: + Added the missing WaitMouseMoved() implementation on MacOS. + [78d1c8fc37c0] + +2007-09-10 phil + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + QsciScintilla::setFont() now calls QWidget::setFont() so that font() + returns the expected value. + [fd4f577c60ea] + +2007-09-02 phil + + * qt/qsciscintilla.cpp: + Fixed problems which the font size of STYLE_DEFAULT not being + updated when the font of style 0 was changed. Hopefully this fixes + the problems with edge columns and indentation guides. + [ddeccb6f64a0] + +2007-08-12 phil + + * Makefile, lib/LICENSE.commercial.short, lib/LICENSE.gpl.short, + qt/qscintilla.pro: + Applied .pro file fix from Dirk Mueller to add a proper install + rule. + [a3a2e49f1042] + +2007-07-22 phil + + * qt/qscilexer.cpp: + Made sure that the backgound colour of areas of the widget with no + text is updated when QsciLexer.setDefaultPaper() is called. + [065558d2430b] + +2007-07-09 phil + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Explicitly set the style for STYLE_DEFAULT when setting a lexer. + [a95fc3357771] + +2007-06-30 phil + + * Python/sip/qsciscintillabase.sip, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/ScintillaRelated.html, doc/index.html, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, gtk/deps.mak, gtk/makefile, gtk/scintilla.mak, + include/Accessor.h, include/HFacer.py, include/KeyWords.h, + include/Platform.h, include/PropSet.h, include/SString.h, + include/SciLexer.h, include/Scintilla.h, include/Scintilla.iface, + include/WindowAccessor.h, macosx/PlatMacOSX.cxx, + macosx/PlatMacOSX.h, macosx/QuartzTextLayout.h, + macosx/QuartzTextStyle.h, macosx/QuartzTextStyleAttribute.h, + macosx/SciTest/English.lproj/InfoPlist.strings, + macosx/SciTest/English.lproj/main.nib/classes.nib, + macosx/SciTest/English.lproj/main.nib/info.nib, + macosx/SciTest/English.lproj/main.nib/objects.xib, + macosx/SciTest/Info.plist, + macosx/SciTest/SciTest.xcode/project.pbxproj, + macosx/SciTest/SciTest_Prefix.pch, macosx/SciTest/main.cpp, + macosx/SciTest/version.plist, macosx/ScintillaCallTip.cxx, + macosx/ScintillaCallTip.h, macosx/ScintillaListBox.cxx, + macosx/ScintillaListBox.h, macosx/ScintillaMacOSX.cxx, + macosx/ScintillaMacOSX.h, macosx/TCarbonEvent.cxx, + macosx/TCarbonEvent.h, macosx/TRect.h, macosx/TView.cxx, + macosx/TView.h, macosx/deps.mak, macosx/makefile, + qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qscintilla.pro, + qt/qsciscintillabase.h, src/AutoComplete.cxx, src/AutoComplete.h, + src/CallTip.cxx, src/CallTip.h, src/CellBuffer.cxx, + src/CellBuffer.h, src/CharacterSet.h, src/ContractionState.cxx, + src/ContractionState.h, src/Decoration.cxx, src/Decoration.h, + src/Document.cxx, src/Document.h, src/DocumentAccessor.cxx, + src/DocumentAccessor.h, src/Editor.cxx, src/Editor.h, + src/ExternalLexer.cxx, src/ExternalLexer.h, src/Indicator.cxx, + src/Indicator.h, src/KeyMap.cxx, src/KeyMap.h, src/KeyWords.cxx, + src/LexAPDL.cxx, src/LexAU3.cxx, src/LexAVE.cxx, src/LexAda.cxx, + src/LexAsm.cxx, src/LexAsn1.cxx, src/LexBaan.cxx, src/LexBash.cxx, + src/LexBasic.cxx, src/LexBullant.cxx, src/LexCLW.cxx, + src/LexCPP.cxx, src/LexCSS.cxx, src/LexCaml.cxx, src/LexCmake.cxx, + src/LexConf.cxx, src/LexCrontab.cxx, src/LexCsound.cxx, + src/LexD.cxx, src/LexEScript.cxx, src/LexEiffel.cxx, + src/LexErlang.cxx, src/LexFlagship.cxx, src/LexForth.cxx, + src/LexFortran.cxx, src/LexGAP.cxx, src/LexGen.py, + src/LexGui4Cli.cxx, src/LexHTML.cxx, src/LexHaskell.cxx, + src/LexInno.cxx, src/LexKix.cxx, src/LexLisp.cxx, src/LexLout.cxx, + src/LexLua.cxx, src/LexMMIXAL.cxx, src/LexMPT.cxx, src/LexMSSQL.cxx, + src/LexMatlab.cxx, src/LexMetapost.cxx, src/LexNsis.cxx, + src/LexOpal.cxx, src/LexOthers.cxx, src/LexPB.cxx, src/LexPLM.cxx, + src/LexPOV.cxx, src/LexPS.cxx, src/LexPascal.cxx, src/LexPerl.cxx, + src/LexProgress.cxx, src/LexPython.cxx, src/LexRebol.cxx, + src/LexRuby.cxx, src/LexSQL.cxx, src/LexScriptol.cxx, + src/LexSmalltalk.cxx, src/LexSpecman.cxx, src/LexSpice.cxx, + src/LexTADS3.cxx, src/LexTCL.cxx, src/LexTeX.cxx, src/LexVB.cxx, + src/LexVHDL.cxx, src/LexVerilog.cxx, src/LexYAML.cxx, + src/LineMarker.cxx, src/LineMarker.h, src/Partitioning.h, + src/PositionCache.cxx, src/PositionCache.h, src/PropSet.cxx, + src/RESearch.cxx, src/RESearch.h, src/RunStyles.cxx, + src/RunStyles.h, src/SVector.h, src/ScintillaBase.cxx, + src/ScintillaBase.h, src/SplitVector.h, src/Style.cxx, src/Style.h, + src/StyleContext.cxx, src/StyleContext.h, src/UniConversion.cxx, + src/UniConversion.h, src/ViewStyle.cxx, src/ViewStyle.h, + src/WindowAccessor.cxx, src/XPM.cxx, src/XPM.h, + vcbuild/SciLexer.dsp, version.txt, win32/PlatWin.cxx, + win32/ScintRes.rc, win32/ScintillaWin.cxx, win32/deps.mak, + win32/makefile, win32/scintilla.mak, win32/scintilla_vc6.mak, + zipsrc.bat: + Merged Scintilla v1.74. + [04dee9c2424f] + + * Python/sip/qscilexerpython.sip, build.py, qt/qscilexer.cpp, + qt/qscilexerbash.cpp, qt/qscilexerpython.cpp, qt/qscilexerpython.h, + qt/qscintilla.pro: + Fixed comment folding in the Bash lexer. A style is properly + restored when read from QSettings. Removed ./Qsci from the qmake + INCLUDEPATH. Removed the Scintilla version number from generated + filenames. Used fully qualified enum names in the Python lexer so + that the QMetaObject is correct. + [6b27a5b211e0] + +2007-06-01 phil + + * NEWS: + Released as v2.1. + [9976edafc5c1] [2.1] + +2007-05-30 phil + + * Makefile: + Switched the internal build system to Qt v4.3.0. + [49284aa376ef] + + * NEWS, Python/configure.py, Python/sip/qscilexer.sip, + Python/sip/qscilexerbash.sip, Python/sip/qscilexerbatch.sip, + Python/sip/qscilexercmake.sip, Python/sip/qscilexercpp.sip, + Python/sip/qscilexercsharp.sip, Python/sip/qscilexercss.sip, + Python/sip/qscilexerd.sip, Python/sip/qscilexerdiff.sip, + Python/sip/qscilexerhtml.sip, Python/sip/qscilexeridl.sip, + Python/sip/qscilexerjavascript.sip, Python/sip/qscilexerlua.sip, + Python/sip/qscilexermakefile.sip, Python/sip/qscilexerperl.sip, + Python/sip/qscilexerpov.sip, Python/sip/qscilexerproperties.sip, + Python/sip/qscilexerpython.sip, Python/sip/qscilexerruby.sip, + Python/sip/qscilexersql.sip, Python/sip/qscilexertex.sip, + Python/sip/qscilexervhdl.sip, Python/sip/qscimodcommon.sip, + build.py, qt/qscilexer.cpp, qt/qscilexer.h, qt/qscilexerbash.cpp, + qt/qscilexerbash.h, qt/qscilexerbatch.cpp, qt/qscilexerbatch.h, + qt/qscilexercmake.cpp, qt/qscilexercmake.h, qt/qscilexercpp.cpp, + qt/qscilexercpp.h, qt/qscilexercsharp.cpp, qt/qscilexercsharp.h, + qt/qscilexercss.cpp, qt/qscilexercss.h, qt/qscilexerd.cpp, + qt/qscilexerd.h, qt/qscilexerdiff.cpp, qt/qscilexerdiff.h, + qt/qscilexerhtml.cpp, qt/qscilexerhtml.h, qt/qscilexeridl.cpp, + qt/qscilexeridl.h, qt/qscilexerjavascript.cpp, + qt/qscilexerjavascript.h, qt/qscilexerlua.cpp, qt/qscilexerlua.h, + qt/qscilexermakefile.cpp, qt/qscilexermakefile.h, + qt/qscilexerperl.cpp, qt/qscilexerperl.h, qt/qscilexerpov.cpp, + qt/qscilexerpov.h, qt/qscilexerproperties.cpp, + qt/qscilexerproperties.h, qt/qscilexerpython.cpp, + qt/qscilexerpython.h, qt/qscilexerruby.cpp, qt/qscilexerruby.h, + qt/qscilexersql.cpp, qt/qscilexersql.h, qt/qscilexertex.cpp, + qt/qscilexertex.h, qt/qscilexervhdl.cpp, qt/qscilexervhdl.h, + qt/qscintilla.pro: + Lexers now remember their style settings. A lexer no longer has to + be the current lexer when changing a style's color, end-of-line + fill, font or paper. The color(), eolFill(), font() and paper() + methods of QsciLexer now return the current values for a style + rather than the default values. The setDefaultColor(), + setDefaultFont() and setDefaultPaper() methods of QsciLexer are no + longer slots and no longer virtual. The defaultColor(), + defaultFont() and defaultPaper() methods of QsciLexer are no longer + virtual. The color(), eolFill(), font() and paper() methods of all + QsciLexer derived classes (except for QsciLexer itself) have been + renamed defaultColor(), defaultEolFill(), defaultFont() and + defaultPaper() respectively. + [38aeee2a5a36] + +2007-05-28 phil + + * qt/qsciscintilla.cpp: + Set the number of style bits after we've set the lexer. + [84cda9af5b00] + + * Python/configure.py: + Fixed the handling of the %Timeline in the Python bindings. + [4b3146d1a236] + +2007-05-27 phil + + * Python/sip/qsciscintillabase.sip: + Updated the sub-class convertor code in the Python bindings for the + Cmake and VHDL lexers. + [6ab6570728a2] + +2007-05-26 phil + + * NEWS: + Updated the NEWS file. Released as v2.0. + [eec9914d8211] [2.0] + +2007-05-19 phil + + * Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Added basic input method support for Qt4 so that accented characters + now work. (Although there is still a font problem - at least a text + colour problem.) + [6b41f3694999] + + * qt/qsciapis.cpp, qt/qsciapis.h, qt/qsciscintillabase.cpp: + Fixed building against Qt v3. + [9e9ba05de0fb] + +2007-05-17 phil + + * qt/qsciscintilla.cpp: + Fixed an autocompletion problem where an empty list was being + displayed. + [c7214274017c] + +2007-05-16 phil + + * qt/qsciscintilla.cpp: + Fixed a bug where autocompleting from the document was looking for + preceeding non-word characters as well. + [3ee6fd746d49] + + * qt/qsciscintilla.cpp: + Fixed silly typo that broke call tips. + [05213a8933c2] + +2007-05-09 phil + + * qt/qsciscintilla.cpp: + Fiex an autocompletion bug for words that only had preceding + whitespace. + [a8f3339e02c6] + + * Python/configure.py, lib/gen_python_api.py, + qsci/api/python/Python-2.4.api, qsci/api/python/Python-2.5.api, + qt/qsciapis.cpp, qt/qsciapis.h: + Call tips shouldn't now get confused with commas in the text after + the argument list. The included API files for Python should now be + complete and properly exclude anything beginning with an underscore. + The Python bindings configure.py can now install the API file in a + user supplied directory. + [c7e93dc918de] + + * qt/qscintilla_cs.qm, qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm, + qt/qscintilla_ru.qm: + Ran lrelease on the project. + [c3ce60078221] + + * Makefile, qt/qscintilla_cs.ts, qt/qscintilla_de.ts, + qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts: + Updated the internal build system to Qt v4.3.0rc1. Ran lupdate on + the project. + [6a86e71a4e26] + +2007-05-08 phil + + * Python/sip/qsciscintilla.sip, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Call tips will now show all the tips for a function (in all scopes) + if the current context/scope isn't known. + [cbebccc205c7] + + * Python/sip/qsciscintilla.sip, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added callTipsStyle() and setCallTipsStyle() to QsciScintilla. + [59d453b5da8c] + +2007-05-07 phil + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Autocompletion from documents should now work the same as QScintilla + v1. The only difference is that the list does not contain the + preceding context so it is consistent with autocompletion from APIs. + [46de719d325e] + + * qt/qscintilla.pro, qt/qscintilla_cs.qm, qt/qscintilla_cs.ts: + Added the Czech translations from Zdenek Bohm. + [139fd9aee405] + +2007-04-30 phil + + * Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added QsciScintilla::wordCharacters(). + [d6e56986a031] + +2007-04-29 phil + + * Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, + qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Added lots of consts to QsciScintilla getter methods. + [4aaffa8611ba] + + * Python/configure.py, Python/sip/qsciscintilla.sip, + qt/qscintilla_de.qm, qt/qscintilla_de.ts, qt/qscintilla_fr.ts, + qt/qscintilla_pt_br.ts, qt/qscintilla_ru.ts, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added caseSensitive() and isWordCharacter() to QsciScintilla. + Updated translations from Detlev. + [64223bf97266] + +2007-04-10 phil + + * Python/sip/qscilexercmake.sip, Python/sip/qscilexervhdl.sip, + Python/sip/qscimodcommon.sip, qt/qscilexercmake.cpp, + qt/qscilexercmake.h, qt/qscilexervhdl.cpp, qt/qscilexervhdl.h, + qt/qscintilla.pro: + Added the QsciLexerVHDL class. + [10029339786f] + + * Python/sip/qscilexercmake.sip, Python/sip/qscimodcommon.sip, + qt/qscilexercmake.cpp, qt/qscilexercmake.h, qt/qscintilla.pro: + Added the QsciLexerCmake class. + [c1c911246f75] + +2007-04-09 phil + + * qt/qsciapis.cpp, qt/qsciapis.h, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Finished call tip support. + [b8c717297392] + +2007-04-07 phil + + * qt/qsciapis.cpp, qt/qsciapis.h, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Some refactoring in preparation for getting call tips working. + [6cb925653a80] + +2007-04-06 phil + + * qt/qsciscintilla.cpp: + Fixed autoindenting. + [8d7b93ee4d9e] + +2007-04-05 phil + + * qt/qsciapis.cpp, qt/qsciapis.h, qt/qsciscintilla.cpp: + Fixed autocompletion so that it works with lexers that don't define + word separators, and lexers that are case insensitive. + [66634cf13685] + +2007-04-04 phil + + * qt/ScintillaQt.cpp, qt/qsciscintilla.cpp: + Fixed the horizontal scrollbar when word wrapping. + [021ea1fe8468] + +2007-04-03 phil + + * Python/configure.py, Python/sip/qsciscintillabase.sip, delcvs.bat, + doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/index.html, gtk/makefile, gtk/scintilla.mak, include/SciLexer.h, + include/Scintilla.h, include/Scintilla.iface, qt/ScintillaQt.cpp, + qt/qscintilla.pro, qt/qsciscintillabase.h, src/Document.cxx, + src/Document.h, src/DocumentAccessor.cxx, src/Editor.cxx, + src/Editor.h, src/ExternalLexer.h, src/KeyWords.cxx, src/LexAU3.cxx, + src/LexBash.cxx, src/LexCmake.cxx, src/LexHTML.cxx, src/LexLua.cxx, + src/LexMSSQL.cxx, src/LexOthers.cxx, src/LexTADS3.cxx, + src/PropSet.cxx, src/RESearch.cxx, src/RESearch.h, + src/SplitVector.h, vcbuild/SciLexer.dsp, version.txt, + win32/PlatWin.cxx, win32/ScintRes.rc, win32/ScintillaWin.cxx, + win32/makefile, win32/scintilla.mak, win32/scintilla_vc6.mak: + Merged Scintilla v1.73. + [2936af6fc62d] + +2007-03-18 phil + + * Makefile, Python/sip/qscilexerd.sip, Python/sip/qscimodcommon.sip, + Python/sip/qsciscintillabase.sip, qt/qscilexerd.cpp, + qt/qscilexerd.h, qt/qscintilla.pro, qt/qscintilla_de.qm, + qt/qscintilla_de.ts, qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts, + qt/qscintilla_ru.ts: + Switched the internal build system to Qt v4.2.3. Added the D lexer + support from Detlev. + [667e9b81ab4f] + +2007-03-04 phil + + * Makefile, example-Qt4/mainwindow.cpp, qt/PlatQt.cpp, + qt/qsciscintilla.cpp: + Fixed a bug in default font handling. Removed use of QIODevice::Text + in the example as it is unnecessary and a performance hog. Moved the + internal Qt3 build system to Qt v3.3.8. Auto-indentation should now + work (as badly) as it did with QScintilla v1. + [4d3ad4d1f295] + +2007-01-17 phil + + * Python/sip/qsciapis.sip, qt/qsciapis.cpp, qt/qsciapis.h: + Added defaultPreparedName() to QsciAPIs. + [2a3c872122dd] + + * designer-Qt4/qscintillaplugin.cpp: + Fixed the Qt4 Designer plugin include file value. + [ea7cb8634ad2] + +2007-01-16 phil + + * Python/sip/qsciapis.sip, qt/qsciapis.cpp, qt/qsciapis.h: + Added cancelPreparation() and apiPreparationCancelled() to QsciAPIs. + [2d7dd00e3bc0] + + * Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, + build.py, lib/LICENSE.commercial.short, lib/LICENSE.gpl.short, + qt/qscintilla.pro, qt/qsciscintilla.cpp, qt/qsciscintilla.h, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Updated the copyright notices. Added selectionToEol() and + setSelectionToEol() to QsciScintilla. Added the other 1.72 changes + to the low level API. + [ddcf2d43cf31] + + * doc/SciBreak.jpg, doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/ScintillaRelated.html, + doc/index.html, gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, gtk/makefile, + gtk/scintilla.mak, include/SciLexer.h, include/Scintilla.h, + include/Scintilla.iface, qt/ScintillaQt.h, src/CellBuffer.cxx, + src/CellBuffer.h, src/ContractionState.cxx, src/Document.cxx, + src/Document.h, src/DocumentAccessor.cxx, src/Editor.cxx, + src/Editor.h, src/KeyWords.cxx, src/LexCPP.cxx, src/LexD.cxx, + src/LexGen.py, src/LexHTML.cxx, src/LexInno.cxx, src/LexLua.cxx, + src/LexMatlab.cxx, src/LexNsis.cxx, src/LexOthers.cxx, + src/LexRuby.cxx, src/LexTADS3.cxx, src/Partitioning.h, + src/ScintillaBase.cxx, src/SplitVector.h, src/StyleContext.h, + src/ViewStyle.cxx, src/ViewStyle.h, vcbuild/SciLexer.dsp, + version.txt, win32/ScintRes.rc, win32/ScintillaWin.cxx, + win32/makefile, win32/scintilla.mak, win32/scintilla_vc6.mak: + Merged Scintilla v1.72, but any new features are not yet exploited. + [dcdfde9050a2] + +2007-01-09 phil + + * Python/configure.py: + Fixed bug in configure.py when the -p flag wasn't specified. + [50dc69f2b20d] + +2007-01-04 phil + + * Python/configure.py, Python/sip/qscilexer.sip, qt/qsciapis.cpp, + qt/qsciapis.h, qt/qsciscintilla.cpp: + Backported to Qt v3. Note that this will probably break again in the + future when call tips are redone. + [3bcc4826fc73] + +2007-01-02 phil + + * Python/configure.py, lib/gen_python_api.py, + qsci/api/python/Python-2.4.api, qsci/api/python/Python-2.5.api, + qt/qsciapis.cpp: + Added the Python v2.4 and v2.5 API files. Added the generation of + the QScintilla2.api file. + [49beb92ca721] + +2007-01-01 phil + + * Python/sip/qsciscintilla.sip, qt/qscilexer.h, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added autoCompletionFillupsEnabled() and + setAutoCompletionFillupsEnabled() to QsciScintilla. Updated the + Python bindings. + [7aa946010e9d] + + * Python/sip/qsciapis.sip, qt/qsciapis.cpp, qt/qsciapis.h: + Implemented loadPrepared() and savePrepared() in QsciAPIs. Added + isPrepared() to QsciAPIs. Updated the Python bindings. + [4c5e3d80fec7] + + * Python/sip/qsciapis.sip, qt/qsciapis.cpp, qt/qsciapis.h: + Added installAPIFiles() and stubs for loadPrepared() and + savePrepared() to QsciAPIs. + [93f4dd7222a1] + + * Python/sip/qsciapis.sip: + Added the missing qsciapis.sip file. + [064b524acc93] + + * Python/sip/qscilexer.sip, Python/sip/qscimodcommon.sip, + lib/qscintilla.dxy, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qscilexer.cpp, qt/qscilexer.h: + Fixed the generation of the API documentation. Added apis() and + setAPIs() to QsciLexer. Removed apiAdd(), apiClear(), apiLoad(), + apiRemove(), apiProcessingStarted() and apiProcessingFinished() from + QsciLexer. Added apiPreparationStarted() and + apiPreparationFinished() to QsciAPIs. Made QsciAPIs part of the API + again. Updated the Python bindings. + [851d133b12ff] + +2006-12-20 phil + + * Makefile, qt/qsciapis.cpp, qt/qsciapis.h: + Updated the internal build system to Qt v4.2.2. More work on auto- + completion. + [d4542220e7a2] + +2006-11-26 phil + + * qt/ListBoxQt.cpp, qt/ListBoxQt.h, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + More work on the auto-completion code. + [37b2d0d2b154] + +2006-11-22 phil + + * qt/qsciapis.cpp, qt/qsciapis.h, qt/qscilexer.cpp, qt/qscilexer.h, + qt/qscilexerbatch.cpp, qt/qscilexerbatch.h, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Changed the handling of case sensitivity in auto-completion lists. + Lexers now say if they are case sensitive. + [b1932fba61ec] + +2006-11-17 phil + + * Makefile, Python/configure.py, Python/sip/qscicommand.sip, + Python/sip/qscicommandset.sip, Python/sip/qscidocument.sip, + Python/sip/qscilexer.sip, Python/sip/qscilexerbash.sip, + Python/sip/qscilexerbatch.sip, Python/sip/qscilexercpp.sip, + Python/sip/qscilexercsharp.sip, Python/sip/qscilexercss.sip, + Python/sip/qscilexerdiff.sip, Python/sip/qscilexerhtml.sip, + Python/sip/qscilexeridl.sip, Python/sip/qscilexerjava.sip, + Python/sip/qscilexerjavascript.sip, Python/sip/qscilexerlua.sip, + Python/sip/qscilexermakefile.sip, Python/sip/qscilexerperl.sip, + Python/sip/qscilexerpov.sip, Python/sip/qscilexerproperties.sip, + Python/sip/qscilexerpython.sip, Python/sip/qscilexerruby.sip, + Python/sip/qscilexersql.sip, Python/sip/qscilexertex.sip, + Python/sip/qscimacro.sip, Python/sip/qsciprinter.sip, + Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, + TODO, build.py, designer-Qt3/qscintillaplugin.cpp, designer- + Qt4/qscintillaplugin.cpp, example-Qt3/application.cpp, example- + Qt4/mainwindow.cpp, qt/PlatQt.cpp, qt/ScintillaQt.cpp, + qt/qsciapis.cpp, qt/qsciapis.h, qt/qscicommand.cpp, + qt/qscicommand.h, qt/qscicommandset.cpp, qt/qscicommandset.h, + qt/qscidocument.cpp, qt/qscidocument.h, qt/qscilexer.cpp, + qt/qscilexer.h, qt/qscilexerbash.cpp, qt/qscilexerbash.h, + qt/qscilexerbatch.cpp, qt/qscilexerbatch.h, qt/qscilexercpp.cpp, + qt/qscilexercpp.h, qt/qscilexercsharp.cpp, qt/qscilexercsharp.h, + qt/qscilexercss.cpp, qt/qscilexercss.h, qt/qscilexerdiff.cpp, + qt/qscilexerdiff.h, qt/qscilexerhtml.cpp, qt/qscilexerhtml.h, + qt/qscilexeridl.cpp, qt/qscilexeridl.h, qt/qscilexerjava.cpp, + qt/qscilexerjava.h, qt/qscilexerjavascript.cpp, + qt/qscilexerjavascript.h, qt/qscilexerlua.cpp, qt/qscilexerlua.h, + qt/qscilexermakefile.cpp, qt/qscilexermakefile.h, + qt/qscilexerperl.cpp, qt/qscilexerperl.h, qt/qscilexerpov.cpp, + qt/qscilexerpov.h, qt/qscilexerproperties.cpp, + qt/qscilexerproperties.h, qt/qscilexerpython.cpp, + qt/qscilexerpython.h, qt/qscilexerruby.cpp, qt/qscilexerruby.h, + qt/qscilexersql.cpp, qt/qscilexersql.h, qt/qscilexertex.cpp, + qt/qscilexertex.h, qt/qscimacro.cpp, qt/qscimacro.h, + qt/qscintilla.pro, qt/qsciprinter.cpp, qt/qsciprinter.h, + qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h: + Fixed the name of the generated source packages. Reorganised so that + the header files are in a separate sub-directory. Updated the + designer plugins and examples for the changing in header file + structure. More work on autocompletion. Basic functionality is + there, but no support for the "current context" yet. + [312e74140bb8] + +2006-11-04 phil + + * designer-Qt4/qscintillaplugin.cpp: + Designer plugin fixes for Qt4 from DavidB. + [920f7af8bec6] + +2006-11-03 phil + + * qt/qscilexer.cpp: + Fixed QsciLexer::setPaper() so that it also sets the background + colour of the default style. + [fcab00732d97] + +2006-10-21 phil + + * Makefile, qt/qsciapis.cpp, qt/qsciapis.h, qt/qsciscintilla.cpp: + Switched the internal build system to Qt v3.3.7 and v4.2.1. + Portability fixes for Qt3. + [512b57958ea4] + +2006-10-20 phil + + * Makefile, build.py, include/Platform.h, lib/README.doc, + qt/PlatQt.cpp, qt/qscimacro.cpp, qt/qscintilla.pro, + qt/qsciscintilla.cpp: + Renamed the base package QScintilla2. Platform portability fixes + from Ulli. The qsci data directory is now installed (where API files + will be kept). + [2a61d65842fb] + +2006-10-13 phil + + * Python/sip/qsciscintilla.sip, qt/qscintilla.pro, + qt/qscintilla_pt_br.qm, qt/qscintilla_pt_br.ts, + qt/qscintilla_ptbr.qm, qt/qscintilla_ptbr.ts, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added QsciScintilla::linesChanged() from Detlev. Removed + QsciScintilla::markerChanged(). Renamed the Brazilian Portugese + translation files. + [5b23de72e063] + + * Makefile, Python/sip/qscilexer.sip, qt/ListBoxQt.cpp, + qt/ListBoxQt.h, qt/ScintillaQt.cpp, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qscilexer.cpp, qt/qscilexer.h, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + Added apiRemove(), apiProcessingStarted() and + apiProcessingFinished() to QsciLexer. + [ef2cb95b868a] + +2006-10-08 phil + + * qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Reset the text and paper colours and font when removing a lexer. + [08ac85b34d80] + + * qt/qsciscintilla.cpp: + Fixed Qt3 specific problem with most recent changes. + [e4ba06e01a1e] + +2006-10-06 phil + + * Python/sip/qsciapis.sip, Python/sip/qscilexer.sip, + Python/sip/qscimodcommon.sip, Python/sip/qsciscintilla.sip, + qt/ListBoxQt.cpp, qt/SciClasses.cpp, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qscilexer.cpp, qt/qscilexer.h, qt/qscilexerbash.cpp, + qt/qscilexerbash.h, qt/qscilexerbatch.cpp, qt/qscilexerbatch.h, + qt/qscilexercpp.cpp, qt/qscilexercpp.h, qt/qscilexercsharp.h, + qt/qscilexercss.cpp, qt/qscilexercss.h, qt/qscilexerdiff.cpp, + qt/qscilexerdiff.h, qt/qscilexerhtml.cpp, qt/qscilexerhtml.h, + qt/qscilexeridl.h, qt/qscilexerjavascript.h, qt/qscilexerlua.cpp, + qt/qscilexerlua.h, qt/qscilexermakefile.cpp, qt/qscilexermakefile.h, + qt/qscilexerperl.cpp, qt/qscilexerperl.h, qt/qscilexerpov.cpp, + qt/qscilexerpov.h, qt/qscilexerproperties.cpp, + qt/qscilexerproperties.h, qt/qscilexerpython.cpp, + qt/qscilexerpython.h, qt/qscilexerruby.cpp, qt/qscilexerruby.h, + qt/qscilexersql.cpp, qt/qscilexersql.h, qt/qscilexertex.cpp, + qt/qscilexertex.h, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Made QsciAPIs an internal class and instead added apiAdd(), + apiClear() and apiLoad() to QsciLexer. Replaced + setAutoCompletionStartCharacters() with + setAutoCompletionWordSeparators() in QsciScintilla. Removed + autoCompletionFillupsEnabled(), setAutoCompletionFillupsEnabled(), + setAutoCompletionAPIs() and setCallTipsAPIs() from QsciScintilla. + Added AcsNone to QsciScintilla::AutoCompletionSource. Horizontal + scrollbars are displayed as needed in autocompletion lists. Added + QsciScintilla::lexer(). Fixed setFont(), setColor(), setEolFill() + and setPaper() in QsciLexer so that they handle all styles as + documented. Removed all occurences of QString::null. Fixed the + problem with indentation guides not changing when the size of a + space changed. Added the QsciScintilla::markerChanged() signal. + Updated the Python bindings. + [9ae22e152365] + +2006-10-01 phil + + * qt/PlatQt.cpp: + Fixed a silly line drawing bug. + [0f9f5c22421a] + +2006-09-30 phil + + * qt/qscintilla.pro: + Fixes for building on Windows and MacOS/X. + [c16bc6aeba20] + +2006-09-29 phil + + * example-Qt4/application.pro, qt/PlatQt.cpp, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.cpp: + Fixed the documentation bug in QsciScintilla::insert(). Fixed the + mouse shape changing properly. Fixed the drawing of fold markers. + [08af64d93094] + +2006-09-23 phil + + * lib/README: + Improved the README for the pedants amongst us. + [683bdb9a84fc] + + * designer-Qt4/designer.pro, designer-Qt4/qscintillaplugin.cpp, + designer-Qt4/qscintillaplugin.h: + The Qt4 Designer plugin now loads - thanks to DavidB. + [feb5a3618df6] + +2006-09-16 phil + + * build.py, designer-Qt3/designer.pro, designer- + Qt3/qscintillaplugin.cpp, designer-Qt4/designer.pro, designer- + Qt4/qscintillaplugin.cpp, designer/designer.pro, + designer/qscintillaplugin.cpp, lib/README.doc, qt/qsciscintilla.h: + Fixed the Qt3 designer plugin. Added the Qt4 designer plugin based + on Andrius Ozelis's work. (But it doesn't load for me - does anybody + else have a problem?) + [3a0873ed5ff0] + +2006-09-09 phil + + * Python/sip/qsciscintilla.sip, qt/qsciscintilla.cpp, + qt/qsciscintilla.h: + QsciScintilla's setFont(), setColor() and setPaper() now work as + expected when there is no lexer (and have no effect if there is a + lexer). + [65cc713d9ecb] + +2006-08-28 phil + + * qt/ListBoxQt.cpp, qt/PlatQt.cpp: + Fixed a crash when double-clicking on an auto-completion list entry. + [d8eecfc59ca2] + +2006-08-27 phil + + * Python/sip/qsciscintillabase.sip, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/index.html, gtk/Converter.h, gtk/PlatGTK.cxx, + gtk/ScintillaGTK.cxx, qt/ScintillaQt.cpp, qt/qsciscintillabase.h, + src/Editor.cxx, src/LexCPP.cxx, src/LexPerl.cxx, src/LexVB.cxx, + src/StyleContext.h, version.txt, win32/ScintRes.rc, + win32/ScintillaWin.cxx: + Merged Scintilla v1.71. The SCN_DOUBLECLICK() signal now passes the + line and position of the click. + [81c852fed943] + +2006-08-17 phil + + * Python/sip/qsciscintilla.sip, qt/ScintillaQt.cpp: + Fixed pasting when Unicode mode is set. + [9d4a7ccef6f4] + + * build.py: + Fixed the internal build system leaving SVN remnants around. + [96c36a0e94ac] + +2006-07-30 phil + + * NEWS, Python/sip/qsciscintilla.sip, qt/qscicommand.h, + qt/qscicommandset.h, qt/qsciscintilla.cpp, qt/qsciscintilla.h: + Added autoCompletionFillupsEnabled() and + setAutoCompletionFillupsEnabled() to QsciScintilla. Don't auto- + complete numbers. Removed QsciCommandList. + [e9886e5da7c3] + +2006-07-29 phil + + * lib/README.doc, qt/PlatQt.cpp: + Debugged the Qt3 backport - all seems to work. + [1e743e050599] + + * Python/configure.py, Python/sip/qscimod3.sip, + Python/sip/qsciscintillabase.sip, Python/sip/qsciscintillabase4.sip, + build.py, lib/README, lib/README.doc, lib/qscintilla.dxy, + qt/qsciscintillabase.h: + The PyQt3 bindings now work. Updated the documentation and build + system for both Qt3 and Qt4. + [f4fa8a9a35c0] + +2006-07-28 phil + + * Python/sip/qscimodcommon.sip, Python/sip/qsciscintillabase4.sip, + Python/sip/qscitypes.sip, example-Qt3/application.cpp, example- + Qt3/application.h, example-Qt3/application.pro, qt/qscicommand.cpp, + qt/qscicommandset.cpp, qt/qscidocument.cpp, qt/qscimacro.cpp, + qt/qscintilla.pro, qt/qsciprinter.cpp, qt/qsciscintilla.cpp, + qt/qsciscintilla.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h, qt/qscitypes.h: + Backed out the QscoTypes namespace now that the Qt3/4 source code + has been consolidated. + [372c37fa8b9c] + + * qt/qscintilla_de.ts, qt/qscintilla_fr.ts, qt/qscintilla_ptbr.ts, + qt/qscintilla_ru.ts, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h, qt/qsciscintillabase3.cpp, + qt/qsciscintillabase3.h, qt/qsciscintillabase4.cpp, + qt/qsciscintillabase4.h: + Integated the Qt3 and Qt4 source files. + [4ee1fcf04cd9] + + * Makefile, build.py, lib/README.doc, lib/qscintilla.dxy, + qt/qscintilla.pro, qt/qsciscintillabase.h, + qt/qsciscintillabase3.cpp, qt/qsciscintillabase3.h, + qt/qsciscintillabase4.cpp, qt/qsciscintillabase4.h: + The Qt3 port now compiles, but otherwise untested. + [da227e07e729] + + * Python/sip/qscimacro.sip, lib/README.doc, lib/qscintilla.dxy, + qt/PlatQt.cpp, qt/qscilexermakefile.cpp, qt/qscimacro.cpp, + qt/qscimacro.h, qt/qscintilla.pro, qt/qsciscintillabase.h, + qt/qsciscintillabase3.cpp, qt/qsciscintillabase3.h, + qt/qsciscintillabase4.cpp, qt/qsciscintillabase4.h: + Changes to QsciMacro so that it has a more consistent API across Qt3 + and Qt4. Backported to Qt3 - doesn't yet build because Qt3 qmake + doesn't understand the preprocessor. + [910b415ec4a8] + +2006-07-27 phil + + * build.py, designer/qscintillaplugin.cpp, example-Qt3/README, + example-Qt4/README, lib/README, lib/README.doc, lib/qscintilla.dxy, + qt/qscintilla.pro: + Updated the documentation. + [7774f3e87003] + +2006-07-26 phil + + * Makefile, Python/configure.py, Python/qsciapis.sip, + Python/qscicommand.sip, Python/qscicommandset.sip, + Python/qscidocument.sip, Python/qscilexer.sip, + Python/qscilexerbash.sip, Python/qscilexerbatch.sip, + Python/qscilexercpp.sip, Python/qscilexercsharp.sip, + Python/qscilexercss.sip, Python/qscilexerdiff.sip, + Python/qscilexerhtml.sip, Python/qscilexeridl.sip, + Python/qscilexerjava.sip, Python/qscilexerjavascript.sip, + Python/qscilexerlua.sip, Python/qscilexermakefile.sip, + Python/qscilexerperl.sip, Python/qscilexerpov.sip, + Python/qscilexerproperties.sip, Python/qscilexerpython.sip, + Python/qscilexerruby.sip, Python/qscilexersql.sip, + Python/qscilexertex.sip, Python/qscimacro.sip, Python/qscimod4.sip, + Python/qscimodcommon.sip, Python/qsciprinter.sip, + Python/qsciscintilla.sip, Python/qsciscintillabase4.sip, + Python/qscitypes.sip, Python/sip/qsciapis.sip, + Python/sip/qscicommand.sip, Python/sip/qscicommandset.sip, + Python/sip/qscidocument.sip, Python/sip/qscilexer.sip, + Python/sip/qscilexerbash.sip, Python/sip/qscilexerbatch.sip, + Python/sip/qscilexercpp.sip, Python/sip/qscilexercsharp.sip, + Python/sip/qscilexercss.sip, Python/sip/qscilexerdiff.sip, + Python/sip/qscilexerhtml.sip, Python/sip/qscilexeridl.sip, + Python/sip/qscilexerjava.sip, Python/sip/qscilexerjavascript.sip, + Python/sip/qscilexerlua.sip, Python/sip/qscilexermakefile.sip, + Python/sip/qscilexerperl.sip, Python/sip/qscilexerpov.sip, + Python/sip/qscilexerproperties.sip, Python/sip/qscilexerpython.sip, + Python/sip/qscilexerruby.sip, Python/sip/qscilexersql.sip, + Python/sip/qscilexertex.sip, Python/sip/qscimacro.sip, + Python/sip/qscimod4.sip, Python/sip/qscimodcommon.sip, + Python/sip/qsciprinter.sip, Python/sip/qsciscintilla.sip, + Python/sip/qsciscintillabase4.sip, Python/sip/qscitypes.sip, + build.py, lib/LICENSE.edu, lib/LICENSE.edu.short, lib/README.MacOS: + Changed the build system to add the Python bindings. + [8a56c38c418b] + + * Python/configure.py, Python/qscicommandset.sip, + Python/qscilexerruby.sip, Python/qscilexertex.sip, + Python/qscimod4.sip, Python/qsciscintilla.sip, + Python/qsciscintillabase4.sip, Python/qscitypes.sip: + Debugged the Python bindings - not yet part of the snapshots. + [8e348d9c7d38] + +2006-07-25 phil + + * Python/qsciapis.sip, Python/qscicommand.sip, + Python/qscicommandset.sip, Python/qscidocument.sip, + Python/qscilexer.sip, Python/qscilexerbash.sip, + Python/qscilexerbatch.sip, Python/qscilexercpp.sip, + Python/qscilexercsharp.sip, Python/qscilexercss.sip, + Python/qscilexerdiff.sip, Python/qscilexerhtml.sip, + Python/qscilexeridl.sip, Python/qscilexerjava.sip, + Python/qscilexerjavascript.sip, Python/qscilexerlua.sip, + Python/qscilexermakefile.sip, Python/qscilexerperl.sip, + Python/qscilexerpov.sip, Python/qscilexerproperties.sip, + Python/qscilexerpython.sip, Python/qscilexerruby.sip, + Python/qscilexersql.sip, Python/qscilexertex.sip, + Python/qscimacro.sip, Python/qscimod4.sip, Python/qscimodcommon.sip, + Python/qsciprinter.sip, Python/qsciscintilla.sip, + Python/qsciscintillabase4.sip, Python/qscitypes.sip, qt/qsciapis.h, + qt/qsciglobal.h, qt/qscilexer.h, qt/qscilexerbash.h, + qt/qscilexercpp.h, qt/qscilexerperl.h, qt/qscilexerpython.h, + qt/qscilexersql.h, qt/qsciprinter.h, qt/qsciscintilla.h: + Ported the .sip files from v1. (Not yet part of the snapshot.) + [c03807f9fbab] + + * Makefile, qt/qscintilla-Qt4.pro, qt/qscintilla.pro: + The .pro file should now work with both Qt v3 and v4. + [c99aec4ce73d] + + * Makefile, qt/qscintilla-Qt4.pro, qt/qscintilla.pro, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h, + qt/qsciscintillabase4.cpp, qt/qsciscintillabase4.h: + Some file reorganisation for when the backport to Qt3 is done. + [c97fb1bdc0e5] + + * qt/qscicommand.cpp, qt/qscicommandset.cpp, qt/qscidocument.cpp, + qt/qscimacro.cpp, qt/qscintilla.pro, qt/qsciprinter.cpp, + qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.cpp, + qt/qsciscintillabase.h, qt/qscitypes.h: + Moved the Scintilla API enums out of QsciScintillaBase and into the + new QsciTypes namespace. + [6de0ac19e4df] + + * qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Triple clicking now works. + [8ef632d89147] + +2006-07-23 phil + + * qt/qsciscintillabase.cpp: + Fixed incorrect selection after dropping text. + [4c62275c39f4] + + * qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qsciscintillabase.cpp: + Dropping text seems (mostly) to work. + [7acc97948229] + +2006-07-22 phil + + * qt/PlatQt.cpp, qt/ScintillaQt.cpp, qt/ScintillaQt.h, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Scrollbars now work. The context menu now works. The clipboard and + mouse selection now works. Dragging to external windows now works + (but not dropping). + [73995ec258cd] + +2006-07-18 phil + + * example-Qt4/mainwindow.cpp, example-Qt4/mainwindow.h, qt/PlatQt.cpp, + qt/qextscintillalexerbash.cxx, qt/qextscintillalexerbash.h, + qt/qextscintillalexerbatch.cxx, qt/qextscintillalexerbatch.h, + qt/qextscintillalexercpp.cxx, qt/qextscintillalexercpp.h, + qt/qextscintillalexercsharp.cxx, qt/qextscintillalexercsharp.h, + qt/qextscintillalexercss.cxx, qt/qextscintillalexercss.h, + qt/qextscintillalexerdiff.cxx, qt/qextscintillalexerdiff.h, + qt/qextscintillalexerhtml.cxx, qt/qextscintillalexerhtml.h, + qt/qextscintillalexeridl.cxx, qt/qextscintillalexeridl.h, + qt/qextscintillalexerjava.cxx, qt/qextscintillalexerjava.h, + qt/qextscintillalexerjavascript.cxx, + qt/qextscintillalexerjavascript.h, qt/qextscintillalexerlua.cxx, + qt/qextscintillalexerlua.h, qt/qextscintillalexermakefile.cxx, + qt/qextscintillalexermakefile.h, qt/qextscintillalexerperl.cxx, + qt/qextscintillalexerperl.h, qt/qextscintillalexerpov.cxx, + qt/qextscintillalexerpov.h, qt/qextscintillalexerproperties.cxx, + qt/qextscintillalexerproperties.h, qt/qextscintillalexerpython.cxx, + qt/qextscintillalexerpython.h, qt/qextscintillalexerruby.cxx, + qt/qextscintillalexerruby.h, qt/qextscintillalexersql.cxx, + qt/qextscintillalexersql.h, qt/qextscintillalexertex.cxx, + qt/qextscintillalexertex.h, qt/qextscintillamacro.cxx, + qt/qextscintillamacro.h, qt/qextscintillaprinter.cxx, + qt/qextscintillaprinter.h, qt/qsciapis.h, qt/qscicommand.h, + qt/qscilexer.h, qt/qscilexerbash.cpp, qt/qscilexerbash.h, + qt/qscilexerbatch.cpp, qt/qscilexerbatch.h, qt/qscilexercpp.cpp, + qt/qscilexercpp.h, qt/qscilexercsharp.cpp, qt/qscilexercsharp.h, + qt/qscilexercss.cpp, qt/qscilexercss.h, qt/qscilexerdiff.cpp, + qt/qscilexerdiff.h, qt/qscilexerhtml.cpp, qt/qscilexerhtml.h, + qt/qscilexeridl.cpp, qt/qscilexeridl.h, qt/qscilexerjava.cpp, + qt/qscilexerjava.h, qt/qscilexerjavascript.cpp, + qt/qscilexerjavascript.h, qt/qscilexerlua.cpp, qt/qscilexerlua.h, + qt/qscilexermakefile.cpp, qt/qscilexermakefile.h, + qt/qscilexerperl.cpp, qt/qscilexerperl.h, qt/qscilexerpov.cpp, + qt/qscilexerpov.h, qt/qscilexerproperties.cpp, + qt/qscilexerproperties.h, qt/qscilexerpython.cpp, + qt/qscilexerpython.h, qt/qscilexerruby.cpp, qt/qscilexerruby.h, + qt/qscilexersql.cpp, qt/qscilexersql.h, qt/qscilexertex.cpp, + qt/qscilexertex.h, qt/qscimacro.cpp, qt/qscimacro.h, + qt/qscintilla.pro, qt/qsciprinter.cpp, qt/qsciprinter.h, + qt/qsciscintilla.h: + Ported the rest of the API to Qt4. Finished porting the example to + Qt4. + [de0ede6bbcf5] + +2006-07-17 phil + + * qt/qextscintilla.cxx, qt/qextscintilla.h, qt/qextscintillaapis.cxx, + qt/qextscintillaapis.h, qt/qextscintillacommand.cxx, + qt/qextscintillacommand.h, qt/qextscintillacommandset.cxx, + qt/qextscintillacommandset.h, qt/qextscintilladocument.cxx, + qt/qextscintilladocument.h, qt/qextscintillalexer.cxx, + qt/qextscintillalexer.h, qt/qsciapis.cpp, qt/qsciapis.h, + qt/qscicommand.cpp, qt/qscicommand.h, qt/qscicommandset.cpp, + qt/qscicommandset.h, qt/qscidocument.cpp, qt/qscidocument.h, + qt/qscilexer.cpp, qt/qscilexer.h, qt/qscintilla.pro, + qt/qsciscintilla.cpp, qt/qsciscintilla.h: + More porting to Qt4 - just the lexers remaining. + [07158797bcf2] + + * qt/ListBoxQt.cpp, qt/PlatQt.cpp, qt/SciClasses.cpp, + qt/ScintillaQt.cpp, qt/qscintilla.pro, qt/qsciscintillabase.cpp: + Further Qt4 changes so that Q3Support is no longer needed. + [cb3ca2aee49e] + + * qt/ListBoxQt.cpp, qt/ListBoxQt.h, qt/PlatQt.cpp, qt/SciClasses.cpp, + qt/SciClasses.h, qt/SciListBox.cxx, qt/SciListBox.h, + qt/ScintillaQt.cpp, qt/ScintillaQt.h, qt/qscintilla.pro, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Ported the auto-completion list implementation to Qt4. + [1d0d07f7ba3b] + +2006-07-16 phil + + * qt/PlatQt.cpp, qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Drawing now seems Ok. Keyboard support now seems Ok. Start of the + mouse support. + [20a223c3f57e] + +2006-07-12 phil + + * include/Platform.h, qt/PlatQt.cpp, qt/ScintillaQt.cpp: + Painting now seems to happen only within paint events - but + incorrectly. + [a60a10298391] + + * qt/PlatQt.cpp, qt/PlatQt.cxx, qt/ScintillaQt.cpp, + qt/ScintillaQt.cxx, qt/ScintillaQt.h, qt/qscintilla.pro: + Recoded the implementation of surfaces so that painters are only + active during paint events. Not yet debugged. + [d0d91ae8e514] + + * build.py, qt/PlatQt.cxx, qt/ScintillaQt.cxx, qt/ScintillaQt.h, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Recoded the handling of key presses so that it doesn't use any Qt3 + specific features and should be backported to QScintilla v1. It also + should work better in Unicode mode. + [c2b96d686ee6] + +2006-07-11 phil + + * Makefile, build.py, example-Qt3/README, example-Qt3/application.cpp, + example-Qt3/application.h, example-Qt3/application.pro, example- + Qt3/fileopen.xpm, example-Qt3/fileprint.xpm, example- + Qt3/filesave.xpm, example-Qt3/main.cpp, example-Qt4/README, example- + Qt4/application.pro, example-Qt4/application.qrc, example- + Qt4/images/copy.png, example-Qt4/images/cut.png, example- + Qt4/images/new.png, example-Qt4/images/open.png, example- + Qt4/images/paste.png, example-Qt4/images/save.png, example- + Qt4/main.cpp, example-Qt4/mainwindow.cpp, example-Qt4/mainwindow.h, + example/README, example/application.cpp, example/application.h, + example/application.pro, example/fileopen.xpm, + example/fileprint.xpm, example/filesave.xpm, example/main.cpp, + qt/PlatQt.cxx, qt/SciListBox.cxx, qt/SciListBox.h, + qt/ScintillaQt.cxx, qt/ScintillaQt.h, qt/qextscintilla.cxx, + qt/qextscintillabase.cxx, qt/qextscintillabase.h, + qt/qextscintillaglobal.h, qt/qsciglobal.h, qt/qscintilla.pro, + qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: + Whole raft of changes starting QScintilla2. + [7f0bd20f2f83] + +2006-07-09 phil + + * qt/qscintilla_de.qm, qt/qscintilla_de.ts, qt/qscintilla_fr.ts, + qt/qscintilla_ptbr.ts, qt/qscintilla_ru.ts: + Updated translations from Detlev. + [c04c167d802e] + +2006-07-08 phil + + * NEWS, qt/qextscintilla.cxx, qt/qextscintilla.h: + Added QextScintilla::isCallTipActive(). + [1f7dcb40db25] + + * lib/LICENSE.commercial.short, lib/LICENSE.edu.short, + lib/LICENSE.gpl.short, qt/qextscintilla.cxx: + Changed the autoindentation to be slightly cleverer when handling + Python. If a lexer does not define block end words then a block + start word is ignored unless it is the last significant word in a + line. + [d5813c13f5da] + +2006-07-02 phil + + * qt/PlatQt.cxx: + Possibly fixed a possible problem with double clicking under + Windows. + [271141bb2b43] + + * NEWS, qt/ScintillaQt.cxx, qt/qextscintilla.cxx, qt/qextscintilla.h: + Added setWrapVisualFlags(), WrapMode::WrapCharacter, WrapVisualFlag + to QextScintilla. The layout cache is now set according to the wrap + mode. Setting a wrap mode now disables the horizontal scrollbar. + [a498b86e7999] + +2006-07-01 phil + + * NEWS, qt/qextscintilla.cxx, qt/qextscintilla.h: + Added cancelList(), firstVisibleLine(), isListActive(), + showUserList(), textHeight() and userListActivated() to + QextScintilla. + [058c7be4bdfe] + + * qt/qextscintilla.cxx: + Auto-completion changed so that subsequent start characters cause + the list to be re-created (containing a subset of the previous one). + [5b534658e638] + +2006-06-28 phil + + * NEWS, qt/SciListBox.cxx, qt/qextscintilla.cxx, qt/qextscintilla.h, + qt/qextscintillaapis.cxx, qt/qextscintillaapis.h, + qt/qextscintillalexer.cxx, qt/qextscintillalexer.h, + qt/qextscintillalexerpython.cxx, qt/qextscintillalexerpython.h: + Handle Key_Enter the same as Key_Return. QextScintilla::foldAll() + can now optionally fold all child fold points. Added + autoCompleteFromAll() and setAutoCompletionStartCharacters() to + QextScintilla. Vastly improved the way auto-completion and call tips + work. + [8b0472aaed61] + +2006-06-25 phil + + * qt/qextscintilla.cxx, qt/qextscintillabase.cxx, + qt/qextscintillalexer.cxx: + The default fore and background colours now default to the + application palette rather than being hardcoded to black and white. + [6cb6b5bef5fc] + + * NEWS, qt/qextscintilla.cxx, qt/qextscintilla.h, + qt/qextscintillalexer.cxx, qt/qextscintillalexer.h: + Added defaultColor() and setDefaultColor() to QextScintillaLexer. + Added color() and setColor() to QextScintilla. Renamed eraseColor() + and setEraseColor() to paper() and setPaper() in QextScintilla. + [c1fbfc192235] + + * NEWS, qt/SciListBox.cxx, qt/qextscintilla.cxx, qt/qextscintilla.h, + qt/qextscintillaapis.cxx, qt/qextscintillaapis.h, + qt/qextscintillabase.h, qt/qextscintillalexer.cxx, + qt/qextscintillalexer.h: + Added a couple of extra SendScintilla overloads. One is needed for + PyQt because of the change in SIP's handling of unsigned values. The + other is needed to solve C++ problems caused by the first. + Autocompletion list entries from APIs may now contain spaces. Added + defaultPaper() and setDefaultPaper() to QextScintillaLexer. Added + eraseColor() and setEraseColor() to QextScintilla. + [34f527ca0f99] + +2006-06-21 phil + + * qt/qextscintilla.cxx, qt/qextscintillalexer.cxx, + qt/qextscintillalexer.h, qt/qextscintillalexerhtml.cxx, + qt/qextscintillalexerhtml.h: + Removed QextScintillaLexer::styleBits() now that + SCI_GETSTYLEBITSNEEDED is available. + [1c6837500560] + + * NEWS, qt/PlatQt.cxx, qt/qextscintilla.cxx, qt/qextscintilla.h: + QextScintilla::setSelectionBackgroundColor(), + QextScintilla::setMarkerBackgroundColor() and + QextScintilla::setCaretLineBackgroundColor() now respect the alpha + component. + [48bae1fffe85] + +2006-06-20 phil + + * NEWS, doc/ScintillaDoc.html, doc/ScintillaDownload.html, + doc/ScintillaHistory.html, doc/index.html, gtk/Converter.h, + gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, include/Scintilla.h, + include/Scintilla.iface, qt/qextscintillabase.h, + qt/qextscintillalexerpython.h, src/Editor.cxx, src/Editor.h, + src/ViewStyle.cxx, src/ViewStyle.h, version.txt, win32/ScintRes.rc, + win32/ScintillaWin.cxx: + Merged Scintilla v1.70. + [03ac3edd5dd2] + +2006-06-19 phil + + * qt/qextscintillabase.h, qt/qextscintillalexerlua.h, + qt/qextscintillalexerruby.cxx, qt/qextscintillalexerruby.h, + qt/qextscintillalexersql.h: + Significant, and incompatible, updates to the QextScintillaLexerRuby + class. + [0484fe132d0c] + + * src/PropSet.cxx: + Fix for qsort helpers linkage from Ulli. (Patch sent upstream.) + [2307adf67045] + +2006-06-18 phil + + * qt/qextscintillalexerpython.cxx, qt/qextscintillalexerpython.h: + Ctrl-D is now duplicate selection rather than duplicate line. + Updated the Python lexer to add support for hightlighted identifiers + and decorators. + [52ca24a722ac] + + * qt/qextscintillabase.h, qt/qextscintillacommandset.cxx, + qt/qextscintillalexer.h, qt/qextscintillalexerbash.h, + qt/qextscintillalexerbatch.h, qt/qextscintillalexercpp.h, + qt/qextscintillalexercsharp.h, qt/qextscintillalexercss.h, + qt/qextscintillalexerhtml.h, qt/qextscintillalexeridl.h, + qt/qextscintillalexerjava.h, qt/qextscintillalexerjavascript.h, + qt/qextscintillalexerlua.h, qt/qextscintillalexerperl.h, + qt/qextscintillalexerpov.h, qt/qextscintillalexerpython.h, + qt/qextscintillalexerruby.h, qt/qextscintillalexersql.h, + qt/qextscintillalexertex.h, qt/qscintilla.pro: + Added the Scintilla 1.69 extensions to the low level API. + [e89b98aaaa33] + + * .repoman, build.py, doc/Icons.html, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/ScintillaRelated.html, doc/ScintillaToDo.html, doc/index.html, + gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, gtk/deps.mak, gtk/makefile, + gtk/scintilla.mak, include/HFacer.py, include/KeyWords.h, + include/Platform.h, include/PropSet.h, include/SciLexer.h, + include/Scintilla.h, include/Scintilla.iface, + include/ScintillaWidget.h, qt/PlatQt.cxx, qt/ScintillaQt.h, + qt/qscintilla.pro, src/CallTip.cxx, src/CallTip.h, + src/CellBuffer.cxx, src/CellBuffer.h, src/CharClassify.cxx, + src/CharClassify.h, src/ContractionState.cxx, src/Document.cxx, + src/Document.h, src/DocumentAccessor.cxx, src/Editor.cxx, + src/Editor.h, src/ExternalLexer.cxx, src/Indicator.cxx, + src/KeyMap.cxx, src/KeyWords.cxx, src/LexAU3.cxx, src/LexBash.cxx, + src/LexBasic.cxx, src/LexCPP.cxx, src/LexCaml.cxx, + src/LexCsound.cxx, src/LexEiffel.cxx, src/LexGen.py, + src/LexGui4Cli.cxx, src/LexHTML.cxx, src/LexInno.cxx, + src/LexLua.cxx, src/LexMSSQL.cxx, src/LexOpal.cxx, + src/LexOthers.cxx, src/LexPOV.cxx, src/LexPython.cxx, + src/LexRuby.cxx, src/LexSQL.cxx, src/LexSpice.cxx, src/LexTCL.cxx, + src/LexVB.cxx, src/LineMarker.h, src/PropSet.cxx, src/RESearch.cxx, + src/RESearch.h, src/ScintillaBase.cxx, src/StyleContext.h, + src/ViewStyle.cxx, src/ViewStyle.h, src/XPM.cxx, + vcbuild/SciLexer.dsp, version.txt, win32/PlatWin.cxx, + win32/ScintRes.rc, win32/ScintillaWin.cxx, win32/deps.mak, + win32/makefile, win32/scintilla.mak, win32/scintilla_vc6.mak: + Removed the redundant .repoman file. Synced with Scintilla v1.69 + with only the minimal changes needed to compile it. + [6774f137c5a1] + +2006-06-17 phil + + * .repoman, License.txt, Makefile, NEWS, README, TODO, bin/empty.txt, + build.py, delbin.bat, delcvs.bat, designer/designer.pro, + designer/qscintillaplugin.cpp, doc/Design.html, doc/Lexer.txt, + doc/SciBreak.jpg, doc/SciCoding.html, doc/SciRest.jpg, + doc/SciTEIco.png, doc/SciWord.jpg, doc/ScintillaDoc.html, + doc/ScintillaDownload.html, doc/ScintillaHistory.html, + doc/ScintillaRelated.html, doc/ScintillaToDo.html, + doc/ScintillaUsage.html, doc/Steps.html, doc/index.html, + example/README, example/application.cpp, example/application.h, + example/application.pro, example/fileopen.xpm, + example/fileprint.xpm, example/filesave.xpm, example/main.cpp, + gtk/Converter.h, gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, + gtk/deps.mak, gtk/makefile, gtk/scintilla-marshal.c, gtk/scintilla- + marshal.h, gtk/scintilla-marshal.list, gtk/scintilla.mak, + include/Accessor.h, include/Face.py, include/HFacer.py, + include/KeyWords.h, include/Platform.h, include/PropSet.h, + include/SString.h, include/SciLexer.h, include/Scintilla.h, + include/Scintilla.iface, include/ScintillaWidget.h, + include/WindowAccessor.h, lib/LICENSE.commercial, + lib/LICENSE.commercial.short, lib/LICENSE.edu, + lib/LICENSE.edu.short, lib/LICENSE.gpl, lib/LICENSE.gpl.short, + lib/README, lib/README.MacOS, lib/qscintilla.dxy, qt/PlatQt.cxx, + qt/SciListBox.cxx, qt/SciListBox.h, qt/ScintillaQt.cxx, + qt/ScintillaQt.h, qt/qextscintilla.cxx, qt/qextscintilla.h, + qt/qextscintillaapis.cxx, qt/qextscintillaapis.h, + qt/qextscintillabase.cxx, qt/qextscintillabase.h, + qt/qextscintillacommand.cxx, qt/qextscintillacommand.h, + qt/qextscintillacommandset.cxx, qt/qextscintillacommandset.h, + qt/qextscintilladocument.cxx, qt/qextscintilladocument.h, + qt/qextscintillaglobal.h, qt/qextscintillalexer.cxx, + qt/qextscintillalexer.h, qt/qextscintillalexerbash.cxx, + qt/qextscintillalexerbash.h, qt/qextscintillalexerbatch.cxx, + qt/qextscintillalexerbatch.h, qt/qextscintillalexercpp.cxx, + qt/qextscintillalexercpp.h, qt/qextscintillalexercsharp.cxx, + qt/qextscintillalexercsharp.h, qt/qextscintillalexercss.cxx, + qt/qextscintillalexercss.h, qt/qextscintillalexerdiff.cxx, + qt/qextscintillalexerdiff.h, qt/qextscintillalexerhtml.cxx, + qt/qextscintillalexerhtml.h, qt/qextscintillalexeridl.cxx, + qt/qextscintillalexeridl.h, qt/qextscintillalexerjava.cxx, + qt/qextscintillalexerjava.h, qt/qextscintillalexerjavascript.cxx, + qt/qextscintillalexerjavascript.h, qt/qextscintillalexerlua.cxx, + qt/qextscintillalexerlua.h, qt/qextscintillalexermakefile.cxx, + qt/qextscintillalexermakefile.h, qt/qextscintillalexerperl.cxx, + qt/qextscintillalexerperl.h, qt/qextscintillalexerpov.cxx, + qt/qextscintillalexerpov.h, qt/qextscintillalexerproperties.cxx, + qt/qextscintillalexerproperties.h, qt/qextscintillalexerpython.cxx, + qt/qextscintillalexerpython.h, qt/qextscintillalexerruby.cxx, + qt/qextscintillalexerruby.h, qt/qextscintillalexersql.cxx, + qt/qextscintillalexersql.h, qt/qextscintillalexertex.cxx, + qt/qextscintillalexertex.h, qt/qextscintillamacro.cxx, + qt/qextscintillamacro.h, qt/qextscintillaprinter.cxx, + qt/qextscintillaprinter.h, qt/qscintilla.pro, qt/qscintilla_de.qm, + qt/qscintilla_de.ts, qt/qscintilla_fr.qm, qt/qscintilla_fr.ts, + qt/qscintilla_ptbr.qm, qt/qscintilla_ptbr.ts, qt/qscintilla_ru.qm, + qt/qscintilla_ru.ts, src/AutoComplete.cxx, src/AutoComplete.h, + src/CallTip.cxx, src/CallTip.h, src/CellBuffer.cxx, + src/CellBuffer.h, src/ContractionState.cxx, src/ContractionState.h, + src/Document.cxx, src/Document.h, src/DocumentAccessor.cxx, + src/DocumentAccessor.h, src/Editor.cxx, src/Editor.h, + src/ExternalLexer.cxx, src/ExternalLexer.h, src/Indicator.cxx, + src/Indicator.h, src/KeyMap.cxx, src/KeyMap.h, src/KeyWords.cxx, + src/LexAPDL.cxx, src/LexAU3.cxx, src/LexAVE.cxx, src/LexAda.cxx, + src/LexAsm.cxx, src/LexAsn1.cxx, src/LexBaan.cxx, src/LexBash.cxx, + src/LexBasic.cxx, src/LexBullant.cxx, src/LexCLW.cxx, + src/LexCPP.cxx, src/LexCSS.cxx, src/LexCaml.cxx, src/LexConf.cxx, + src/LexCrontab.cxx, src/LexCsound.cxx, src/LexEScript.cxx, + src/LexEiffel.cxx, src/LexErlang.cxx, src/LexFlagship.cxx, + src/LexForth.cxx, src/LexFortran.cxx, src/LexGen.py, + src/LexGui4Cli.cxx, src/LexHTML.cxx, src/LexHaskell.cxx, + src/LexKix.cxx, src/LexLisp.cxx, src/LexLout.cxx, src/LexLua.cxx, + src/LexMMIXAL.cxx, src/LexMPT.cxx, src/LexMSSQL.cxx, + src/LexMatlab.cxx, src/LexMetapost.cxx, src/LexNsis.cxx, + src/LexOthers.cxx, src/LexPB.cxx, src/LexPOV.cxx, src/LexPS.cxx, + src/LexPascal.cxx, src/LexPerl.cxx, src/LexPython.cxx, + src/LexRebol.cxx, src/LexRuby.cxx, src/LexSQL.cxx, + src/LexScriptol.cxx, src/LexSmalltalk.cxx, src/LexSpecman.cxx, + src/LexTADS3.cxx, src/LexTeX.cxx, src/LexVB.cxx, src/LexVHDL.cxx, + src/LexVerilog.cxx, src/LexYAML.cxx, src/LineMarker.cxx, + src/LineMarker.h, src/PropSet.cxx, src/RESearch.cxx, src/RESearch.h, + src/SVector.h, src/SciTE.properties, src/ScintillaBase.cxx, + src/ScintillaBase.h, src/Style.cxx, src/Style.h, + src/StyleContext.cxx, src/StyleContext.h, src/UniConversion.cxx, + src/UniConversion.h, src/ViewStyle.cxx, src/ViewStyle.h, + src/WindowAccessor.cxx, src/XPM.cxx, src/XPM.h, tgzsrc, + vcbuild/SciLexer.dsp, version.txt, win32/Margin.cur, + win32/PlatWin.cxx, win32/PlatformRes.h, win32/SciTE.properties, + win32/ScintRes.rc, win32/Scintilla.def, win32/ScintillaWin.cxx, + win32/deps.mak, win32/makefile, win32/scintilla.mak, + win32/scintilla_vc6.mak, zipsrc.bat: + First import of QScintilla + [0521804cd44a] + diff --git a/libs/qscintilla/LICENSE b/libs/qscintilla/LICENSE new file mode 100644 index 000000000..a7502ef0f --- /dev/null +++ b/libs/qscintilla/LICENSE @@ -0,0 +1,685 @@ + + QScintilla is Copyright (C) 2015 Riverbank Computing Limited + + + You may use, distribute and copy QScintilla under the terms of GNU + General Public License version 3, which is displayed below. + +------------------------------------------------------------------------- + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + +------------------------------------------------------------------------- diff --git a/libs/qscintilla/NEWS b/libs/qscintilla/NEWS new file mode 100644 index 000000000..52142310e --- /dev/null +++ b/libs/qscintilla/NEWS @@ -0,0 +1,384 @@ +v2.9 20th April 2015 + - Based on Scintilla v3.5.4. + - Added UserLiteral, InactiveUserLiteral, TaskMarker, InactiveTaskMarker, + EscapeSequence, InactiveEscapeSequence, setHighlightBackQuotedStrings(), + highlightBackQuotedStrings(), setHighlightEscapeSequences(), + highlightEscapeSequences(), setVerbatimStringEscapeSequencesAllowed() and + verbatimStringEscapeSequencesAllowed() to QsciLexerCPP. + - Added CommentKeyword, DeclareInputPort, DeclareOutputPort, + DeclareInputOutputPort, PortConnection and the inactive versions of all + styles to QsciLexerVerilog. + - Added CommentBlock to QsciLexerVHDL. + - Added AnnotationIndented to QsciScintilla::AnnotationDisplay. + - Added FullBoxIndicator, ThickCompositionIndicator, ThinCompositionIndicator + and TextColorIndicator to QsciScintilla::IndicatorStyle. + - Added setIndicatorHoverForegroundColor() and setIndicatorHoverStyle() to + QsciScintilla. + - Added Bookmark to QsciScintilla::MarkerSymbol. + - Added WrapWhitespace to QsciScintilla::WrapMode. + - Added SCLEX_AS, SCLEX_BIBTEX, SCLEX_DMAP, SCLEX_DMIS, SCLEX_IHEX, + SCLEX_REGISTRY, SCLEX_SREC and SCLEX_TEHEX to QsciScintillaBase. + - Added SCI_CHANGEINSERTION to QsciScintillaBase. + - Added SCI_CLEARTABSTOPS, SCI_ADDTABSTOP and SCI_GETNEXTTABSTOP to + QsciScintillaBase. + - Added SCI_GETIMEINTERACTION, SCI_SETIMEINTERACTION, SC_IME_WINDOWED and + SC_IME_INLINE to QsciScintillaBase. + - Added SC_MARK_BOOKMARK to QsciScintillaBase. + - Added INDIC_COMPOSITIONTHIN, INDIC_FULLBOX, INDIC_TEXTFORE, INDIC_IME, + INDIC_IME_MAX, SC_INDICVALUEBIT, SC_INDICVALUEMASK, + SC_INDICFLAG_VALUEBEFORE, SCI_INDICSETHOVERSTYLE, SCI_INDICGETHOVERSTYLE, + SCI_INDICSETHOVERFORE, SCI_INDICGETHOVERFORE, SCI_INDICSETFLAGS and + SCI_INDICGETFLAGS to QsciScintillaBase. + - Added SCI_SETTARGETRANGE and SCI_GETTARGETRANGE to QsciScintillaBase. + - Added SCFIND_CXX11REGEX to QsciScintillaBase. + - Added SCI_CALLTIPSETPOSSTART to QsciScintillaBase. + - Added SC_FOLDFLAG_LINESTATE to QsciScintillaBase. + - Added SC_WRAP_WHITESPACE to QsciScintillaBase. + - Added SC_PHASES_ONE, SC_PHASES_TWO, SC_PHASES_MULTIPLE, SCI_GETPHASESDRAW + and SCI_SETPHASESDRAW to QsciScintillaBase. + - Added SC_STATUS_OK, SC_STATUS_FAILURE, SC_STATUS_BADALLOC, + SC_STATUS_WARN_START and SC_STATUS_WARNREGEX to QsciScintillaBase. + - Added SC_MULTIAUTOC_ONCE, SC_MULTIAUTOC_EACH, SCI_AUTOCSETMULTI and + SCI_AUTOCGETMULTI to QsciScintillaBase. + - Added ANNOTATION_INDENTED to QsciScintillaBase. + - Added SCI_DROPSELECTIONN to QsciScintillaBase. + - Added SC_TECHNOLOGY_DIRECTWRITERETAIN and SC_TECHNOLOGY_DIRECTWRITEDC to + QsciScintillaBase. + - Added SC_LINE_END_TYPE_DEFAULT, SC_LINE_END_TYPE_UNICODE, + SCI_GETLINEENDTYPESSUPPORTED, SCI_SETLINEENDTYPESALLOWED, + SCI_GETLINEENDTYPESALLOWED and SCI_GETLINEENDTYPESACTIVE to + QsciScintillaBase. + - Added SCI_ALLOCATESUBSTYLES, SCI_GETSUBSTYLESSTART, SCI_GETSUBSTYLESLENGTH, + SCI_GETSTYLEFROMSUBSTYLE, SCI_GETPRIMARYSTYLEFROMSTYLE, SCI_FREESUBSTYLES, + SCI_SETIDENTIFIERS, SCI_DISTANCETOSECONDARYSTYLES and SCI_GETSUBSTYLEBASES + to QsciScintillaBase. + - Added SC_MOD_INSERTCHECK and SC_MOD_CHANGETABSTOPS to QsciScintillaBase. + - Qt v3 and PyQt v3 are no longer supported. + +v2.8.4 11th September 2014 + - Added setHotspotForegroundColor(), resetHotspotForegroundColor(), + setHotspotBackgroundColor(), resetHotspotBackgroundColor(), + setHotspotUnderline() and setHotspotWrap() to QsciScintilla. + - Added SCI_SETHOTSPOTSINGLELINE to QsciScintillaBase. + - Bug fixes. + +v2.8.3 3rd July 2014 + - Added the QsciLexerCoffeeScript class. + - Font sizes are now handled as floating point values rather than integers. + - Bug fixes. + +v2.8.2 26th May 2014 + - Added the QsciLexerAVS class. + - Added the QsciLexerPO class. + - Added the --sysroot, --no-sip-files and --no-qsci-api options to the Python + bindings' configure.py. + - Cross-compilation (specifically to iOS and Android) is now supported. + - configure.py has been refactored and relicensed so that it can be used as a + template for wrapping other bindings. + - Bug fixes. + +v2.8.1 14th March 2014 + - Added support for iOS and Android. + - Added support for retina displays. + - A qscintilla2.prf file is installed so that application .pro files only + need to add CONFIG += qscintilla2. + - Updated the keywords recognised by the Octave lexer. + - Bug fixes. + +v2.8 9th November 2013 + - Based on Scintilla v3.3.6. + - Added the SCN_FOCUSIN() and SCN_FOCUSOUT() signals to QsciScintillaBase. + - Added PreProcessorCommentLineDoc and InactivePreProcessorCommentLineDoc to + QsciLexerCPP. + - Added SCLEX_LITERATEHASKELL, SCLEX_KVIRC, SCLEX_RUST and SCLEX_STTXT to + QsciScintillaBase. + - Added ThickCompositionIndicator to QsciScintilla::IndicatorStyle. + - Added INDIC_COMPOSITIONTHICK to QsciScintillaBase. + - Added SC_FOLDACTION_CONTRACT, SC_FOLDACTION_EXPAND and SC_FOLDACTION_TOGGLE + to QsciScintillaBase. + - Added SCI_FOLDLINE, SCI_FOLDCHILDREN, SCI_EXPANDCHILDREN and SCI_FOLDALL to + QsciScintillaBase. + - Added SC_AUTOMATICFOLD_SHOW, SC_AUTOMATICFOLD_CLICK and + SC_AUTOMATICFOLD_CHANGE to QsciScintillaBase. + - Added SCI_SETAUTOMATICFOLD and SCI_GETAUTOMATICFOLD to QsciScintillaBase. + - Added SC_ORDER_PRESORTED, SC_ORDER_PERFORMSORT and SC_ORDER_CUSTOM to + QsciScintillaBase. + - Added SCI_AUTOCSETORDER and SCI_AUTOCGETORDER to QsciScintillaBase. + - Added SCI_POSITIONRELATIVE to QsciScintillaBase. + - Added SCI_RELEASEALLEXTENDEDSTYLES and SCI_ALLOCATEEXTENDEDSTYLES to + QsciScintillaBase. + - Added SCI_SCROLLRANGE to QsciScintillaBase. + - Added SCI_SETCARETLINEVISIBLEALWAYS and SCI_GETCARETLINEVISIBLEALWAYS to + QsciScintillaBase. + - Added SCI_SETMOUSESELECTIONRECTANGULARSWITCH and + SCI_GETMOUSESELECTIONRECTANGULARSWITCH to QsciScintillaBase. + - Added SCI_SETREPRESENTATION, SCI_GETREPRESENTATION and + SCI_CLEARREPRESENTATION to QsciScintillaBase. + - Input methods are now properly supported. + +v2.7.2 16th June 2013 + - The build script for the Python bindings now has a --pyqt argument for + specifying PyQt4 or PyQt5. + - The default EOL mode on OS/X is now EolUnix. + - Bug fixes. + +v2.7.1 1st March 2013 + - Added support for the final release of Qt v5. + - The build script for the Python bindings should now work with SIP v5. + - Bug fixes. + +v2.7 8th December 2012 + - Based on Scintilla v3.2.3. + - Added support for Qt v5-rc1. + - Added HashQuotedString, InactiveHashQuotedString, PreProcessorComment, + InactivePreProcessorComment, setHighlightHashQuotedStrings() and + highlightHashQuotedStrings() to QsciLexerCpp. + - Added Variable, setHSSLanguage(), HSSLanguage(), setLessLanguage(), + LessLanguage(), setSCCSLanguage() and SCCSLanguage() to QsciLexerCSS. + - Added setOverwriteMode() and overwriteMode() to QsciScintilla. + - Added wordAtLineIndex() to QsciScintilla. + - Added findFirstInSelection() to QsciScintilla. + - Added CallTipsPosition, callTipsPosition() and setCallTipsPosition() to + QsciScintilla. + - Added WrapFlagInMargin to QsciScintilla::WrapVisualFlag. + - Added SquigglePixmapIndicator to QsciScintilla::IndicatorStyle. + - The weight of a font (rather than whether it is just bold or not) is now + respected. + - Added SCLEX_AVS, SCLEX_COFFEESCRIPT, SCLEX_ECL, SCLEX_OSCRIPT, + SCLEX_TCMD and SCLEX_VISUALPROLOG to QsciScintillaBase. + - Added SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE and + SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE to QsciScintillaBase. + - Added SC_FONT_SIZE_MULTIPLIER to QsciScintillaBase. + - Added SC_WEIGHT_NORMAL, SC_WEIGHT_SEMIBOLD and SC_WEIGHT_BOLD to + QsciScintillaBase. + - Added SC_WRAPVISUALFLAG_MARGIN to QsciScintillaBase. + - Added INDIC_SQUIGGLEPIXMAP to QsciScintillaBase. + - Added SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, + SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR, SCI_CALLTIPSETPOSITION, + SCI_COUNTCHARACTERS, SCI_CREATELOADER, SCI_DELETERANGE, + SCI_FINDINDICATORFLASH, SCI_FINDINDICATORHIDE, SCI_FINDINDICATORSHOW, + SCI_GETALLLINESVISIBLE, SCI_GETGAPPOSITION, SCI_GETPUNCTUATIONCHARS, + SCI_GETRANGEPOINTER, SCI_GETSELECTIONEMPTY, SCI_GETTECHNOLOGY, + SCI_GETWHITESPACECHARS, SCI_GETWORDCHARS, SCI_RGBAIMAGESETSCALE, + SCI_SETPUNCTUATIONCHARS, SCI_SETTECHNOLOGY, SCI_STYLESETSIZEFRACTIONAL, + SCI_STYLEGETSIZEFRACTIONAL, SCI_STYLESETWEIGHT and SCI_STYLEGETWEIGHT to + QsciScintillaBase. + - Removed SCI_GETUSEPALETTE and SCI_SETUSEPALETTE from QsciScintillaBase. + - Bug fixes. + +v2.6.2 20th June 2012 + - Added support for Qt v5-alpha. + - QsciLexer::wordCharacters() is now part of the public API. + - Bug fixes. + +v2.6.1 10th February 2012 + - Support SCI_NAMESPACE to enable all internal Scintilla classes to be put + into the Scintilla namespace. + - APIs now allow for spaces between the end of a word and the opening + parenthesis. + - Building against Qt v3 is fixed. + +v2.6 11th November 2011 + - Based on Scintilla v2.29. + - Added Command, command() and execute() to QsciCommand. + - Added boundTo() and find() to QsciCommandSet. + - Added createStandardContextMenu() to QsciScintilla. + - Added StraightBoxIndicator, DashesIndicator, DotsIndicator, + SquiggleLowIndicator and DotBoxIndicator to QsciScintilla::IndicatorStyle. + - Added markerDefine() to QsciScintilla. + - Added MoNone, MoSublineSelect, marginOptions() and setMarginOptions() to + QsciScintilla. + - Added registerImage() to QsciScintilla. + - Added setIndicatorOutlineColor() to QsciScintilla. + - Added setMatchedBraceIndicator(), resetMatchedBraceIndicator(), + setUnmatchedBraceIndicator() and resetUnmatchedBraceIndicator() to + QsciScintilla. + - Added highlightTripleQuotedStrings() and setHighlightTripleQuotedStrings() + to QsciLexerCpp. + - Added Label to QsciLexerLua. + - Added DoubleQuotedStringVar, Translation, RegexVar, SubstitutionVar, + BackticksVar, DoubleQuotedHereDocumentVar, BacktickHereDocumentVar, + QuotedStringQQVar, QuotedStringQXVar, QuotedStringQRVar, setFoldAtElse() + and foldAtElse() to QsciLexerPerl. + - Added highlightSubidentifiers() and setHighlightSubidentifiers() to + QsciLexerPython. + - Added INDIC_STRAIGHTBOX, INDIC_DASH, INDIC_DOTS, INDIC_SQUIGGLELOW and + INDIC_DOTBOX to QsciScintillaBase. + - Added SC_MARGINOPTION_NONE and SC_MARGINOPTION_SUBLINESELECT to + QsciScintillaBase. + - Added SC_MARK_RGBAIMAGE to QsciScintillaBase. + - Added SCI_BRACEBADLIGHTINDICATOR, SCI_BRACEHIGHLIGHTINDICATOR, + SCI_GETIDENTIFIER, SCI_GETMARGINOPTIONS, SCI_INDICGETOUTLINEALPHA, + SCI_INDICSETOUTLINEALPHA, SCI_MARKERDEFINERGBAIMAGE, + SCI_MARKERENABLEHIGHLIGHT, SCI_MARKERSETBACKSELECTED, + SCI_MOVESELECTEDLINESDOWN, SCI_MOVESELECTEDLINESUP, SCI_REGISTERRGBAIMAGE, + SCI_RGBAIMAGESETHEIGHT, SCI_RGBAIMAGESETWIDTH, SCI_SCROLLTOEND, + SCI_SCROLLTOSTART, SCI_SETEMPTYSELECTION, SCI_SETIDENTIFIER and + SCI_SETMARGINOPTIONS to QsciScintillaBase. + +v2.5.1 17th April 2011 + - Added QsciLexerMatlab and QsciLexerOctave. + +v2.5 29th March 2011 + - Based on Scintilla v2.25. + - Rectangular selections are now fully supported and compatible with SciTE. + - The signature of the fromMimeData() and toMimeData() methods of + QsciScintillaBase have changed incompatibly in order to support rectangular + selections. + - Added QsciScintilla::setAutoCompletionUseSingle() to replace the now + deprecated setAutoCompletionShowSingle(). + - Added QsciScintilla::autoCompletionUseSingle() to replace the now + deprecated autoCompletionShowSingle(). + - QsciScintilla::setAutoCompletionCaseSensitivity() is no longer ignored if a + lexer has been set. + - Added FullRectangle, LeftRectangle and Underline to the + QsciScintilla::MarkerSymbol enum. + - Added setExtraAscent(), extraAscent(), setExtraDescent() and extraDescent() + to QsciScintilla. + - Added setWhitespaceSize() and whitespaceSize() to QsciScintilla. + - Added replaceSelectedText() to QsciScintilla. + - Added setWhitespaceBackgroundColor() and setWhitespaceForegroundColor() to + QsciScintilla. + - Added setWrapIndentMode() and wrapIndentMode() to QsciScintilla. + - Added setFirstVisibleLine() to QsciScintilla. + - Added setContractedFolds() and contractedFolds() to QsciScintilla. + - Added the SCN_HOTSPOTRELEASECLICK() signal to QsciScintillaBase. + - The signature of the QsciScintillaBase::SCN_UPDATEUI() signal has changed. + - Added the RawString and inactive styles to QsciLexerCPP. + - Added MediaRule to QsciLexerCSS. + - Added BackquoteString, RawString, KeywordSet5, KeywordSet6 and KeywordSet7 + to QsciLexerD. + - Added setDjangoTemplates(), djangoTemplates(), setMakoTemplates() and + makoTemplates() to QsciLexerHTML. + - Added KeywordSet5, KeywordSet6, KeywordSet7 and KeywordSet8 to + QsciLexerLua. + - Added setInitialSpaces() and initialSpaces() to QsciLexerProperties. + - Added setFoldCompact(), foldCompact(), setStringsOverNewlineAllowed() and + stringsOverNewlineAllowed() to QsciLexerPython. + - Added setFoldComments(), foldComments(), setFoldCompact() and foldCompact() + to QsciLexerRuby. + - Added setFoldComments() and foldComments(), and removed setFoldCompact() + and foldCompact() from QsciLexerTCL. + - Added setFoldComments(), foldComments(), setFoldCompact(), foldCompact(), + setProcessComments(), processComments(), setProcessIf(), and processIf() to + QsciLexerTeX. + - Added QuotedIdentifier, setDottedWords(), dottedWords(), setFoldAtElse(), + foldAtElse(), setFoldOnlyBegin(), foldOnlyBegin(), setHashComments(), + hashComments(), setQuotedIdentifiers() and quotedIdentifiers() to + QsciLexerSQL. + - The Python bindings now allow optional arguments to be specified as keyword + arguments. + - The Python bindings will now build using the protected-is-public hack if + possible. + +v2.4.6 23rd December 2010 + - Added support for indicators to the high-level API, i.e. added the + IndicatorStyle enum, the clearIndicatorRange(), fillIndicatorRange(), + indicatorDefine(), indicatorDrawUnder(), setIndicatorDrawUnder() and + setIndicatorForegroundColor methods, and the indicatorClicked() and + indicatorReleased() signals to QsciScintilla. + - Added support for the Key style in QsciLexerProperties. + - Added an API file for Python v2.7. + - Added the --no-timestamp command line option to the Python bindings' + configure.py. + +v2.4.5 31st August 2010 + - A bug fix release. + +v2.4.4 12th July 2010 + - Added the canInsertFromMimeData(), fromMimeData() and toMimeData() methods + to QsciScintillaBase. + - QsciScintilla::markerDefine() now allows existing markers to be redefined. + +v2.4.3 17th March 2010 + - Added clearFolds() to QsciScintilla. + +v2.4.2 20th January 2010 + - Updated Spanish translations from Jaime Seuma. + - Fixed compilation problems with Qt v3 and Qt v4 prior to v4.5. + +v2.4.1 14th January 2010 + - Added the QsciLexerSpice and QsciLexerVerilog classes. + - Significant performance improvements when handling long lines. + - The Python bindings include automatically generated docstrings by default. + - Added an API file for Python v3. + +v2.4 5th June 2009 + - Based on Scintilla v1.78. + - Added the QsciLexerCustom, QsciStyle and QsciStyledText classes. + - Added annotate(), annotation(), clearAnnotations(), setAnnotationDisplay() + and annotationDisplay() to QsciScintilla. + - Added setMarginText(), clearMarginText(), setMarginType() and marginType() + to QsciScintilla. + - Added QsciLexer::lexerId() so that container lexers can be implemented. + - Added editor() and styleBitsNeeded() to QsciLexer. + - Added setDollarsAllowed() and dollarsAllowed() to QsciLexerCPP. + - Added setFoldScriptComments(), foldScriptComments(), + setFoldScriptHeredocs() and foldScriptHeredocs() to QsciLexerHTML. + - Added setSmartHighlighting() and smartHighlighting() to QsciLexerPascal. + (Note that the Scintilla Pascal lexer has changed so that any saved colour + and font settings will not be properly restored.) + - Added setFoldPackages(), foldPackages(), setFoldPODBlocks() and + foldPODBlocks() to QsciLexerPerl. + - Added setV2UnicodeAllowed(), v2UnicodeAllowed(), setV3BinaryOctalAllowed(), + v3BinaryOctalAllowed(), setV3BytesAllowed and v3BytesAllowed() to + QsciLexerPython. + - Added setScriptsStyled() and scriptsStyled() to QsciLexerXML. + - Added Spanish translations from Jaime Seuma. + +v2.3.2 17th November 2008 + - A bug fix release. + +v2.3.1 6th November 2008 + - Based on Scintilla v1.77. + - Added the read() and write() methods to QsciScintilla to allow a file to be + read and written while minimising the conversions. + - Added the positionFromLineIndex() and lineIndexFromPosition() methods to + QsciScintilla to convert between a Scintilla character address and a + QScintilla character address. + - Added QsciScintilla::wordAtPoint() to return the word at the given screen + coordinates. + - QSciScintilla::setSelection() now allows the carat to be left at either the + start or the end of the selection. + - 'with' is now treated as a keyword by the Python lexer. + +v2.3 20th September 2008 + - Based on Scintilla v1.76. + - The new QsciAbstractAPIs class allows applications to replace the default + implementation of the language APIs used for auto-completion lists and call + tips. + - Added QsciScintilla::apiContext() to allow applications to determine the + context used for auto-completion and call tips. + - Added the QsciLexerFortran, QsciLexerFortran77, QsciLexerPascal, + QsciLexerPostScript, QsciLexerTCL, QsciLexerXML and QsciLexerYAML classes. + - QsciScintilla::setFolding() will now accept an optional margin number. + +v2.2 27th February 2008 + - Based on Scintilla v1.75. + - A lexer's default colour, paper and font are now written to and read from + the settings. + - Windows64 is now supported. + - The signature of the QsciScintillaBase::SCN_MACRORECORD() signal has + changed slightly. + - Changed the licensing to match the current Qt licenses, including GPL v3. + +v2.1 1st June 2007 + - A slightly revised API, incompatible with QScintilla v2.0. + - Lexers now remember their style settings. A lexer no longer has to be the + current lexer when changing a style's color, end-of-line fill, font or + paper. + - The color(), eolFill(), font() and paper() methods of QsciLexer now return + the current values for a style rather than the default values. + - The setDefaultColor(), setDefaultFont() and setDefaultPaper() methods of + QsciLexer are no longer slots and no longer virtual. + - The defaultColor(), defaultFont() and defaultPaper() methods of QsciLexer + are no longer virtual. + - The color(), eolFill(), font() and paper() methods of all QsciLexer derived + classes (except for QsciLexer itself) have been renamed defaultColor(), + defaultEolFill(), defaultFont() and defaultPaper() respectively. + +v2.0 26th May 2007 + - A revised API, incompatible with QScintilla v1. + - Hugely improved autocompletion and call tips support. + - Supports both Qt v3 and Qt v4. + - Includes Python bindings. diff --git a/libs/qscintilla/Qt4Qt5/CMakeLists.txt b/libs/qscintilla/Qt4Qt5/CMakeLists.txt new file mode 100644 index 000000000..1114a88e1 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/CMakeLists.txt @@ -0,0 +1,158 @@ +cmake_minimum_required(VERSION 2.8.7) + +if(USE_QT5) + set(CMAKE_AUTOMOC ON) + set(CMAKE_INCLUDE_CURRENT_DIR ON) + find_package(Qt5Widgets REQUIRED) +else() + find_package(Qt4 COMPONENTS QtCore QtGui REQUIRED) + include("${QT_USE_FILE}") + add_definitions(${QT_DEFINITIONS}) +endif() + +add_definitions(-DSCINTILLA_QT) +add_definitions(-DSCI_LEXER) + +set(QSCINTILLA_SRC + qsciscintilla.cpp + qsciscintillabase.cpp + qsciabstractapis.cpp + qsciapis.cpp + qscicommand.cpp + qscicommandset.cpp + qscidocument.cpp + qscilexer.cpp + qscilexersql.cpp + qscimacro.cpp + qsciprinter.cpp + qscistyle.cpp + qscistyledtext.cpp + MacPasteboardMime.cpp + InputMethod.cpp + SciClasses.cpp + ListBoxQt.cpp + PlatQt.cpp + ScintillaQt.cpp + ../lexers/LexSQL.cpp + ../lexlib/Accessor.cpp + ../lexlib/CharacterCategory.cpp + ../lexlib/CharacterSet.cpp + ../lexlib/LexerBase.cpp + ../lexlib/LexerModule.cpp + ../lexlib/LexerNoExceptions.cpp + ../lexlib/LexerSimple.cpp + ../lexlib/PropSetSimple.cpp + ../lexlib/StyleContext.cpp + ../lexlib/WordList.cpp + ../src/AutoComplete.cpp + ../src/CallTip.cpp + ../src/CaseConvert.cpp + ../src/CaseFolder.cpp + ../src/Catalogue.cpp + ../src/CellBuffer.cpp + ../src/CharClassify.cpp + ../src/ContractionState.cpp + ../src/Decoration.cpp + ../src/Document.cpp + ../src/Editor.cpp + ../src/EditModel.cpp + ../src/EditView.cpp + ../src/ExternalLexer.cpp + ../src/Indicator.cpp + ../src/KeyMap.cpp + ../src/LineMarker.cpp + ../src/MarginView.cpp + ../src/PerLine.cpp + ../src/PositionCache.cpp + ../src/RESearch.cpp + ../src/RunStyles.cpp + ../src/ScintillaBase.cpp + ../src/Selection.cpp + ../src/Style.cpp + ../src/UniConversion.cpp + ../src/ViewStyle.cpp + ../src/XPM.cpp +) + +set(QSCINTILLA_HDR +) + +set(QSCINTILLA_MOC_HDR + ./Qsci/qsciglobal.h + ./Qsci/qsciscintilla.h + ./Qsci/qsciscintillabase.h + ./Qsci/qsciabstractapis.h + ./Qsci/qsciapis.h + ./Qsci/qscicommand.h + ./Qsci/qscicommandset.h + ./Qsci/qscidocument.h + ./Qsci/qscilexer.h + ./Qsci/qscilexersql.h + ./Qsci/qscimacro.h + ./Qsci/qsciprinter.h + ./Qsci/qscistyle.h + ./Qsci/qscistyledtext.h + ListBoxQt.h + SciClasses.h + SciNamespace.h + ScintillaQt.h + ../include/ILexer.h + ../include/Platform.h + ../include/SciLexer.h + ../include/Scintilla.h + ../include/ScintillaWidget.h + ../lexlib/Accessor.h + ../lexlib/CharacterCategory.h + ../lexlib/CharacterSet.h + ../lexlib/LexAccessor.h + ../lexlib/LexerBase.h + ../lexlib/LexerModule.h + ../lexlib/LexerNoExceptions.h + ../lexlib/LexerSimple.h + ../lexlib/OptionSet.h + ../lexlib/PropSetSimple.h + ../lexlib/StyleContext.h + ../lexlib/SubStyles.h + ../lexlib/WordList.h + ../src/AutoComplete.h + ../src/CallTip.h + ../src/CaseConvert.h + ../src/CaseFolder.h + ../src/Catalogue.h + ../src/CellBuffer.h + ../src/CharClassify.h + ../src/ContractionState.h + ../src/Decoration.h + ../src/Document.h + ../src/Editor.h + ../src/ExternalLexer.h + ../src/FontQuality.h + ../src/Indicator.h + ../src/KeyMap.h + ../src/LineMarker.h + ../src/Partitioning.h + ../src/PerLine.h + ../src/PositionCache.h + ../src/RESearch.h + ../src/RunStyles.h + ../src/ScintillaBase.h + ../src/Selection.h + ../src/SplitVector.h + ../src/Style.h + ../src/UnicodeFromUTF8.h + ../src/UniConversion.h + ../src/ViewStyle.h + ../src/XPM.h +) + +if(NOT USE_QT5) + QT4_WRAP_CPP(QSCINTILLA_MOC ${QSCINTILLA_MOC_HDR}) +endif() + +include_directories(. ../include ../lexlib ../src) + +add_library(qscintilla2 ${QSCINTILLA_SRC} ${QSCINTILLA_HDR} ${QSCINTILLA_MOC_HDR} ${QSCINTILLA_MOC}) + +if(USE_QT5) + qt5_use_modules(qscintilla2 Widgets PrintSupport) +endif() diff --git a/libs/qscintilla/Qt4Qt5/InputMethod.cpp b/libs/qscintilla/Qt4Qt5/InputMethod.cpp new file mode 100644 index 000000000..c6da96737 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/InputMethod.cpp @@ -0,0 +1,182 @@ +// Copyright (c) 2015 Riverbank Computing Limited +// Copyright (c) 2011 Archaeopteryx Software, Inc. +// Copyright (c) 1990-2011, Scientific Toolworks, Inc. +// +// The License.txt file describes the conditions under which this software may +// be distributed. + + +#include + +#include "Qsci/qsciscintillabase.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ScintillaQt.h" + + +#define INDIC_INPUTMETHOD 24 + + +void QsciScintillaBase::inputMethodEvent(QInputMethodEvent *event) +{ + // Do nothing if it appears to be a non-event. This can sometimes happen + // (but why?) on losing focus. + if (event->commitString().isEmpty() && event->preeditString().isEmpty() && event->replacementLength() == 0) + return; + + ScintillaBytes bytes; + + // Clear the current selection. + sci->ClearSelection(); + if (preeditPos >= 0) + sci->SetSelection(preeditPos, preeditPos); + + // Insert the commit string. + if (!event->commitString().isEmpty() || event->replacementLength()) { + // Select the text to be removed. + int commitPos = SendScintilla(SCI_GETCURRENTPOS); + int start = commitPos + event->replacementStart(); + int end = start + event->replacementLength(); + sci->SetSelection(start, end); + + // Replace the selection with the commit string. + bytes = textAsBytes(event->commitString()); + sci->AddCharUTF(bytes.data(), bytes.length()); + } + + // Select the previous preedit string. + int pos = SendScintilla(SCI_GETCURRENTPOS); + sci->SetSelection(pos, pos + preeditNrBytes); + + // Replace the selection with the new preedit string. + bool recording = sci->recordingMacro; + sci->recordingMacro = false; + SendScintilla(SCI_SETUNDOCOLLECTION, false); + bytes = textAsBytes(event->preeditString()); + sci->AddCharUTF(bytes.data(), bytes.length()); + SendScintilla(SCI_SETUNDOCOLLECTION, true); + sci->recordingMacro = recording; + sci->SetSelection(pos, pos); + + // Store the state of the current preedit string. + preeditString = event->preeditString(); + preeditNrBytes = bytes.length(); + preeditPos = preeditNrBytes ? SendScintilla(SCI_GETCURRENTPOS) : -1; + + if (preeditNrBytes) { + // Apply attributes to the preedit string. + int indicNum = 0; + sci->ShowCaretAtCurrentPosition(); + foreach (QInputMethodEvent::Attribute a, event->attributes()) { + QString prefix = preeditString.left(a.start); + int prefixLength = textAsBytes(prefix).length(); + int caretPos = preeditPos + prefixLength; + + if (a.type == QInputMethodEvent::Cursor) { + sci->SetSelection(caretPos, caretPos); + if (!a.length) + sci->DropCaret(); + + } else if (a.type == QInputMethodEvent::TextFormat) { + Q_ASSERT(a.value.canConvert(QVariant::TextFormat)); + QTextFormat format = a.value.value(); + Q_ASSERT(format.isCharFormat()); + QTextCharFormat charFormat = format.toCharFormat(); + + if (charFormat.underlineStyle() != QTextCharFormat::NoUnderline) { + QString sub = preeditString.mid(a.start, a.length); + int subLength = textAsBytes(sub).length(); + + // Set temporary indicator for underline style. + QColor uc = charFormat.underlineColor(); + int style = INDIC_COMPOSITIONTHICK; + if (charFormat.underlineStyle() == QTextCharFormat::DashUnderline) + style = INDIC_DASH; + + SendScintilla(SCI_INDICSETSTYLE, INDIC_INPUTMETHOD + indicNum, style); + SendScintilla(SCI_INDICSETFORE, INDIC_INPUTMETHOD + indicNum, uc.rgb()); + SendScintilla(SCI_SETINDICATORCURRENT, INDIC_INPUTMETHOD + indicNum); + SendScintilla(SCI_INDICATORFILLRANGE, caretPos, subLength); + indicNum++; + } + } + } + } +} + +QVariant QsciScintillaBase::inputMethodQuery(Qt::InputMethodQuery query) const +{ + int pos = SendScintilla(SCI_GETCURRENTPOS); + int line = SendScintilla(SCI_LINEFROMPOSITION, pos); + + switch (query) { +#if QT_VERSION >= 0x050000 + case Qt::ImHints: + return QWidget::inputMethodQuery(query); +#endif + + case Qt::ImMicroFocus: + { + int startPos = (preeditPos >= 0) ? preeditPos : pos; + Point pt = sci->LocationFromPosition(startPos); + int width = SendScintilla(SCI_GETCARETWIDTH); + int height = SendScintilla(SCI_TEXTHEIGHT, line); + return QRect(pt.x, pt.y, width, height); + } + + case Qt::ImFont: + { + char fontName[64]; + int style = SendScintilla(SCI_GETSTYLEAT, pos); + int len = SendScintilla(SCI_STYLEGETFONT, style, (sptr_t)fontName); + int size = SendScintilla(SCI_STYLEGETSIZE, style); + bool italic = SendScintilla(SCI_STYLEGETITALIC, style); + int weight = SendScintilla(SCI_STYLEGETBOLD, style) ? QFont::Bold : -1; + return QFont(QString::fromUtf8(fontName, len), size, weight, italic); + } + + case Qt::ImCursorPosition: + { + int paraStart = sci->pdoc->ParaUp(pos); + return pos - paraStart; + } + + case Qt::ImSurroundingText: + { + int paraStart = sci->pdoc->ParaUp(pos); + int paraEnd = sci->pdoc->ParaDown(pos); + QVarLengthArray buffer(paraEnd - paraStart + 1); + + Sci_CharacterRange charRange; + charRange.cpMin = paraStart; + charRange.cpMax = paraEnd; + + Sci_TextRange textRange; + textRange.chrg = charRange; + textRange.lpstrText = buffer.data(); + + SendScintilla(SCI_GETTEXTRANGE, 0, (sptr_t)&textRange); + + return bytesAsText(buffer.constData()); + } + + case Qt::ImCurrentSelection: + { + QVarLengthArray buffer(SendScintilla(SCI_GETSELTEXT)); + SendScintilla(SCI_GETSELTEXT, 0, (sptr_t)buffer.data()); + + return bytesAsText(buffer.constData()); + } + + default: + return QVariant(); + } +} diff --git a/libs/qscintilla/Qt4Qt5/ListBoxQt.cpp b/libs/qscintilla/Qt4Qt5/ListBoxQt.cpp new file mode 100644 index 000000000..e057ef370 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/ListBoxQt.cpp @@ -0,0 +1,328 @@ +// This module implements the specialisation of QListBox that handles the +// Scintilla double-click callback. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "ListBoxQt.h" + +#include + +#include "SciClasses.h" +#include "Qsci/qsciscintilla.h" + + +QsciListBoxQt::QsciListBoxQt() + : cb_action(0), cb_data(0), slb(0), visible_rows(5), utf8(false) +{ +} + + +void QsciListBoxQt::SetFont(QSCI_SCI_NAMESPACE(Font) &font) +{ + QFont *f = reinterpret_cast(font.GetID()); + + if (f) + slb->setFont(*f); +} + + +void QsciListBoxQt::Create(QSCI_SCI_NAMESPACE(Window) &parent, int, + QSCI_SCI_NAMESPACE(Point), int, bool unicodeMode, int) +{ + utf8 = unicodeMode; + + // The parent we want is the QsciScintillaBase, not the text area. + wid = slb = new QsciSciListBox(reinterpret_cast(parent.GetID())->parentWidget(), this); +} + + +void QsciListBoxQt::SetAverageCharWidth(int) +{ + // We rely on sizeHint() for the size of the list box rather than make + // calculations based on the average character width and the number of + // visible rows. +} + + +void QsciListBoxQt::SetVisibleRows(int vrows) +{ + // We only pretend to implement this. + visible_rows = vrows; +} + + +int QsciListBoxQt::GetVisibleRows() const +{ + return visible_rows; +} + + +QSCI_SCI_NAMESPACE(PRectangle) QsciListBoxQt::GetDesiredRect() +{ + QSCI_SCI_NAMESPACE(PRectangle) rc(0, 0, 100, 100); + + if (slb) + { + QSize sh = slb->sizeHint(); + + rc.right = sh.width(); + rc.bottom = sh.height(); + } + + return rc; +} + + +int QsciListBoxQt::CaretFromEdge() +{ + int dist = 0; + + // Find the width of the biggest image. + for (xpmMap::const_iterator it = xset.begin(); it != xset.end(); ++it) + { + int w = it.value().width(); + + if (dist < w) + dist = w; + } + + if (slb) + dist += slb->frameWidth(); + + // Fudge factor - adjust if required. + dist += 3; + + return dist; +} + + +void QsciListBoxQt::Clear() +{ + Q_ASSERT(slb); + + slb->clear(); +} + + +void QsciListBoxQt::Append(char *s, int type) +{ + Q_ASSERT(slb); + + QString qs; + + if (utf8) + qs = QString::fromUtf8(s); + else + qs = QString::fromLatin1(s); + + xpmMap::const_iterator it; + + if (type < 0 || (it = xset.find(type)) == xset.end()) + slb->addItem(qs); + else + slb->addItemPixmap(it.value(), qs); +} + + +int QsciListBoxQt::Length() +{ + Q_ASSERT(slb); + + return slb->count(); +} + + +void QsciListBoxQt::Select(int n) +{ + Q_ASSERT(slb); + + slb->setCurrentRow(n); +} + + +int QsciListBoxQt::GetSelection() +{ + Q_ASSERT(slb); + + return slb->currentRow(); +} + + +int QsciListBoxQt::Find(const char *prefix) +{ + Q_ASSERT(slb); + + return slb->find(prefix); +} + + +void QsciListBoxQt::GetValue(int n, char *value, int len) +{ + Q_ASSERT(slb); + + QString selection = slb->text(n); + + bool trim_selection = false; + QObject *sci_obj = slb->parent(); + + if (sci_obj->inherits("QsciScintilla")) + { + QsciScintilla *sci = static_cast(sci_obj); + + if (sci->isAutoCompletionList()) + { + // Save the full selection and trim the value we return. + sci->acSelection = selection; + trim_selection = true; + } + } + + if (selection.isEmpty() || len <= 0) + value[0] = '\0'; + else + { + const char *s; + int slen; + + QByteArray bytes; + + if (utf8) + bytes = selection.toUtf8(); + else + bytes = selection.toLatin1(); + + s = bytes.data(); + slen = bytes.length(); + + while (slen-- && len--) + { + if (trim_selection && *s == ' ') + break; + + *value++ = *s++; + } + + *value = '\0'; + } +} + + +void QsciListBoxQt::Sort() +{ + Q_ASSERT(slb); + + slb->sortItems(); +} + + +void QsciListBoxQt::RegisterImage(int type, const char *xpm_data) +{ + xset.insert(type, *reinterpret_cast(xpm_data)); +} + + +void QsciListBoxQt::RegisterRGBAImage(int type, int, int, + const unsigned char *pixelsImage) +{ + QPixmap pm; + +#if QT_VERSION >= 0x040700 + pm.convertFromImage(*reinterpret_cast(pixelsImage)); +#else + pm = QPixmap::fromImage(*reinterpret_cast(pixelsImage)); +#endif + + xset.insert(type, pm); +} + + +void QsciListBoxQt::ClearRegisteredImages() +{ + xset.clear(); +} + + +void QsciListBoxQt::SetDoubleClickAction( + QSCI_SCI_NAMESPACE(CallBackAction) action, void *data) +{ + cb_action = action; + cb_data = data; +} + + +void QsciListBoxQt::SetList(const char *list, char separator, char typesep) +{ + char *words; + + Clear(); + + if ((words = qstrdup(list)) != NULL) + { + char *startword = words; + char *numword = NULL; + + for (int i = 0; words[i] != '\0'; 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; + } +} + + +// The ListBox methods that need to be implemented explicitly. + +QSCI_SCI_NAMESPACE(ListBox)::ListBox() +{ +} + + +QSCI_SCI_NAMESPACE(ListBox)::~ListBox() +{ +} + + +QSCI_SCI_NAMESPACE(ListBox) *QSCI_SCI_NAMESPACE(ListBox)::Allocate() +{ + return new QsciListBoxQt(); +} diff --git a/libs/qscintilla/Qt4Qt5/ListBoxQt.h b/libs/qscintilla/Qt4Qt5/ListBoxQt.h new file mode 100644 index 000000000..b8a90d08c --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/ListBoxQt.h @@ -0,0 +1,76 @@ +// This defines the specialisation of QListBox that handles the Scintilla +// double-click callback. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include +#include +#include + +#include "SciNamespace.h" + +#include "Platform.h" + + +class QsciSciListBox; + + +// This is an internal class but it is referenced by a public class so it has +// to have a Qsci prefix rather than being put in the Scintilla namespace +// which would mean exposing the SCI_NAMESPACE mechanism). +class QsciListBoxQt : public QSCI_SCI_NAMESPACE(ListBox) +{ +public: + QsciListBoxQt(); + + QSCI_SCI_NAMESPACE(CallBackAction) cb_action; + void *cb_data; + + virtual void SetFont(QSCI_SCI_NAMESPACE(Font) &font); + virtual void Create(QSCI_SCI_NAMESPACE(Window) &parent, int, + QSCI_SCI_NAMESPACE(Point), int, bool unicodeMode, int); + virtual void SetAverageCharWidth(int); + virtual void SetVisibleRows(int); + virtual int GetVisibleRows() const; + virtual QSCI_SCI_NAMESPACE(PRectangle) GetDesiredRect(); + virtual int CaretFromEdge(); + virtual void Clear(); + virtual void Append(char *s, int type = -1); + virtual int Length(); + virtual void Select(int n); + virtual int GetSelection(); + virtual int Find(const char *prefix); + virtual void GetValue(int n, char *value, int len); + virtual void Sort(); + virtual void RegisterImage(int type, const char *xpm_data); + virtual void RegisterRGBAImage(int type, int width, int height, + const unsigned char *pixelsImage); + virtual void ClearRegisteredImages(); + virtual void SetDoubleClickAction( + QSCI_SCI_NAMESPACE(CallBackAction) action, void *data); + virtual void SetList(const char *list, char separator, char typesep); + +private: + QsciSciListBox *slb; + int visible_rows; + bool utf8; + + typedef QMap xpmMap; + xpmMap xset; +}; diff --git a/libs/qscintilla/Qt4Qt5/MacPasteboardMime.cpp b/libs/qscintilla/Qt4Qt5/MacPasteboardMime.cpp new file mode 100644 index 000000000..0d2c1a498 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/MacPasteboardMime.cpp @@ -0,0 +1,111 @@ +// This module implements part of the support for rectangular selections on +// OS/X. It is a separate file to avoid clashes between OS/X and Scintilla +// data types. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#if (QT_VERSION >= 0x040200 && QT_VERSION < 0x050000 && defined(Q_OS_MAC)) || (QT_VERSION >= 0x050200 && defined(Q_OS_OSX)) + +#include +#include +#include +#include +#include +#include + +#include + + +static const QLatin1String mimeRectangular("text/x-qscintilla-rectangular"); +static const QLatin1String utiRectangularMac("com.scintilla.utf16-plain-text.rectangular"); + + +class RectangularPasteboardMime : public QMacPasteboardMime +{ +public: + RectangularPasteboardMime() : QMacPasteboardMime(MIME_ALL) + { + } + + bool canConvert(const QString &mime, QString flav) + { + return mime == mimeRectangular && flav == utiRectangularMac; + } + + QList convertFromMime(const QString &, QVariant data, QString) + { + QList converted; + + converted.append(data.toByteArray()); + + return converted; + } + + QVariant convertToMime(const QString &, QList data, QString) + { + QByteArray converted; + + foreach (QByteArray i, data) + { + converted += i; + } + + return QVariant(converted); + } + + QString convertorName() + { + return QString("QScintillaRectangular"); + } + + QString flavorFor(const QString &mime) + { + if (mime == mimeRectangular) + return QString(utiRectangularMac); + + return QString(); + } + + QString mimeFor(QString flav) + { + if (flav == utiRectangularMac) + return QString(mimeRectangular); + + return QString(); + } +}; + + +// Initialise the singleton instance. +void initialiseRectangularPasteboardMime() +{ + static RectangularPasteboardMime *instance = 0; + + if (!instance) + { + instance = new RectangularPasteboardMime(); + + qRegisterDraggedTypes(QStringList(utiRectangularMac)); + } +} + + +#endif diff --git a/libs/qscintilla/Qt4Qt5/PlatQt.cpp b/libs/qscintilla/Qt4Qt5/PlatQt.cpp new file mode 100644 index 000000000..9a561c96a --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/PlatQt.cpp @@ -0,0 +1,1097 @@ +// This module implements the portability layer for the Qt port of Scintilla. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SciNamespace.h" + +#include "Platform.h" +#include "XPM.h" + +#include "Qsci/qsciscintillabase.h" +#include "SciClasses.h" + +#include "FontQuality.h" + + +QSCI_BEGIN_SCI_NAMESPACE + +// Type convertors. +static QFont *PFont(FontID fid) +{ + return reinterpret_cast(fid); +} + +static QWidget *PWindow(WindowID wid) +{ + return reinterpret_cast(wid); +} + +static QsciSciPopup *PMenu(MenuID mid) +{ + return reinterpret_cast(mid); +} + + +// Create a Point instance from a long value. +Point Point::FromLong(long lpoint) +{ + return Point(Platform::LowShortFromLong(lpoint), + Platform::HighShortFromLong(lpoint)); +} + + +// Font management. +Font::Font() : fid(0) +{ +} + +Font::~Font() +{ +} + +void Font::Create(const FontParameters &fp) +{ + Release(); + + QFont *f = new QFont(); + + QFont::StyleStrategy strategy; + + switch (fp.extraFontFlag & SC_EFF_QUALITY_MASK) + { + case SC_EFF_QUALITY_NON_ANTIALIASED: + strategy = QFont::NoAntialias; + break; + + case SC_EFF_QUALITY_ANTIALIASED: + strategy = QFont::PreferAntialias; + break; + + default: + strategy = QFont::PreferDefault; + } + +#if defined(Q_OS_MAC) +#if QT_VERSION >= 0x040700 + strategy = static_cast(strategy | QFont::ForceIntegerMetrics); +#else +#warning "Correct handling of QFont metrics requires Qt v4.7.0 or later" +#endif +#endif + + f->setStyleStrategy(strategy); + + // If name of the font begins with a '-', assume, that it is an XLFD. + if (fp.faceName[0] == '-') + { + f->setRawName(fp.faceName); + } + else + { + f->setFamily(fp.faceName); + f->setPointSizeF(fp.size); + + // See if the Qt weight has been passed via the back door. Otherwise + // map Scintilla weights to Qt weights ensuring that the SC_WEIGHT_* + // values get mapped to the correct QFont::Weight values. + int qt_weight; + + if (fp.weight < 0) + qt_weight = -fp.weight; + else if (fp.weight <= 200) + qt_weight = QFont::Light; + else if (fp.weight <= QsciScintillaBase::SC_WEIGHT_NORMAL) + qt_weight = QFont::Normal; + else if (fp.weight <= 600) + qt_weight = QFont::DemiBold; + else if (fp.weight <= 850) + qt_weight = QFont::Bold; + else + qt_weight = QFont::Black; + + f->setWeight(qt_weight); + + f->setItalic(fp.italic); + } + + fid = f; +} + +void Font::Release() +{ + if (fid) + { + delete PFont(fid); + fid = 0; + } +} + + +// A surface abstracts a place to draw. +class SurfaceImpl : public Surface +{ +public: + SurfaceImpl(); + virtual ~SurfaceImpl(); + + void Init(WindowID wid); + void Init(SurfaceID sid, WindowID); + void Init(QPainter *p); + void InitPixMap(int width, int height, Surface *, WindowID wid); + + void Release(); + bool Initialised() {return painter;} + void PenColour(ColourDesired fore); + int LogPixelsY() {return pd->logicalDpiY();} + int DeviceHeightFont(int points) {return points;} + void MoveTo(int x_,int y_); + void LineTo(int x_,int y_); + void Polygon(Point *pts, int npts, ColourDesired fore, + ColourDesired back); + void RectangleDraw(PRectangle rc, ColourDesired fore, + ColourDesired back); + void FillRectangle(PRectangle rc, ColourDesired back); + void FillRectangle(PRectangle rc, Surface &surfacePattern); + void RoundedRectangle(PRectangle rc, ColourDesired fore, + ColourDesired back); + void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, + int alphaFill, ColourDesired outline, int alphaOutline, + int flags); + void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); + void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); + void Copy(PRectangle rc, Point from, Surface &surfaceSource); + + void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, + const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, + const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, + const char *s, int len, ColourDesired fore); + void MeasureWidths(Font &font_, const char *s, int len, + XYPOSITION *positions); + XYPOSITION WidthText(Font &font_, const char *s, int len); + XYPOSITION WidthChar(Font &font_, char ch); + XYPOSITION Ascent(Font &font_); + XYPOSITION Descent(Font &font_); + XYPOSITION InternalLeading(Font &font_) {return 0;} + XYPOSITION ExternalLeading(Font &font_); + XYPOSITION Height(Font &font_); + XYPOSITION AverageCharWidth(Font &font_); + + void SetClip(PRectangle rc); + void FlushCachedState(); + + void SetUnicodeMode(bool unicodeMode_) {unicodeMode = unicodeMode_;} + void SetDBCSMode(int codePage) {} + + void DrawXPM(PRectangle rc, const XPM *xpm); + +private: + void drawRect(const PRectangle &rc); + void drawText(const PRectangle &rc, Font &font_, XYPOSITION ybase, + const char *s, int len, ColourDesired fore); + static QFont convertQFont(Font &font); + QFontMetricsF metrics(Font &font_); + QString convertText(const char *s, int len); + static QColor convertQColor(const ColourDesired &col, + unsigned alpha = 255); + + bool unicodeMode; + QPaintDevice *pd; + QPainter *painter; + bool my_resources; + int pen_x, pen_y; +}; + +Surface *Surface::Allocate(int) +{ + return new SurfaceImpl; +} + +SurfaceImpl::SurfaceImpl() + : unicodeMode(false), pd(0), painter(0), my_resources(false), pen_x(0), + pen_y(0) +{ +} + +SurfaceImpl::~SurfaceImpl() +{ + Release(); +} + +void SurfaceImpl::Init(WindowID wid) +{ + Release(); + + pd = reinterpret_cast(wid); +} + +void SurfaceImpl::Init(SurfaceID sid, WindowID) +{ + Release(); + + // This method, and the SurfaceID type, is only used when printing. As it + // is actually a void * we pass (when using SCI_FORMATRANGE) a pointer to a + // QPainter rather than a pointer to a SurfaceImpl as might be expected. + QPainter *p = reinterpret_cast(sid); + + pd = p->device(); + painter = p; +} + +void SurfaceImpl::Init(QPainter *p) +{ + Release(); + + pd = p->device(); + painter = p; +} + +void SurfaceImpl::InitPixMap(int width, int height, Surface *, WindowID wid) +{ + Release(); + +#if QT_VERSION >= 0x050100 + int dpr = PWindow(wid)->devicePixelRatio(); + QPixmap *pixmap = new QPixmap(width * dpr, height * dpr); + pixmap->setDevicePixelRatio(dpr); +#else + QPixmap *pixmap = new QPixmap(width, height); + Q_UNUSED(wid); +#endif + + pd = pixmap; + + painter = new QPainter(pd); + my_resources = true; +} + +void SurfaceImpl::Release() +{ + if (my_resources) + { + if (painter) + delete painter; + + if (pd) + delete pd; + + my_resources = false; + } + + painter = 0; + pd = 0; +} + +void SurfaceImpl::MoveTo(int x_, int y_) +{ + Q_ASSERT(painter); + + pen_x = x_; + pen_y = y_; +} + +void SurfaceImpl::LineTo(int x_, int y_) +{ + Q_ASSERT(painter); + + painter->drawLine(pen_x, pen_y, x_, y_); + + pen_x = x_; + pen_y = y_; +} + +void SurfaceImpl::PenColour(ColourDesired fore) +{ + Q_ASSERT(painter); + + painter->setPen(convertQColor(fore)); +} + +void SurfaceImpl::Polygon(Point *pts, int npts, ColourDesired fore, + ColourDesired back) +{ + Q_ASSERT(painter); + + QPolygonF qpts(npts); + + for (int i = 0; i < npts; ++i) + qpts[i] = QPointF(pts[i].x, pts[i].y); + + painter->setPen(convertQColor(fore)); + painter->setBrush(convertQColor(back)); + painter->drawPolygon(qpts); +} + +void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, + ColourDesired back) +{ + Q_ASSERT(painter); + + painter->setPen(convertQColor(fore)); + painter->setBrush(convertQColor(back)); + drawRect(rc); +} + +void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) +{ + Q_ASSERT(painter); + + painter->setPen(Qt::NoPen); + painter->setBrush(convertQColor(back)); + drawRect(rc); +} + +void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) +{ + Q_ASSERT(painter); + + SurfaceImpl &si = static_cast(surfacePattern); + QPixmap *pm = static_cast(si.pd); + + if (pm) + { + QBrush brsh(Qt::black, *pm); + + painter->setPen(Qt::NoPen); + painter->setBrush(brsh); + drawRect(rc); + } + else + { + FillRectangle(rc, ColourDesired(0)); + } +} + +void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, + ColourDesired back) +{ + Q_ASSERT(painter); + + painter->setPen(convertQColor(fore)); + painter->setBrush(convertQColor(back)); + painter->drawRoundRect( + QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top)); +} + +void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, + ColourDesired fill, int alphaFill, ColourDesired outline, + int alphaOutline, int) +{ + Q_ASSERT(painter); + + QColor outline_colour = convertQColor(outline, alphaOutline); + QColor fill_colour = convertQColor(fill, alphaFill); + + // There was a report of Qt seeming to ignore the alpha value of the pen so + // so we disable the pen if the outline and fill colours are the same. + if (outline_colour == fill_colour) + painter->setPen(Qt::NoPen); + else + painter->setPen(outline_colour); + + painter->setBrush(fill_colour); + + const int radius = (cornerSize ? 25 : 0); + + painter->drawRoundRect( + QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top), + radius, radius); +} + +void SurfaceImpl::drawRect(const PRectangle &rc) +{ + painter->drawRect( + QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top)); +} + +void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, + ColourDesired back) +{ + Q_ASSERT(painter); + + painter->setPen(convertQColor(fore)); + painter->setBrush(convertQColor(back)); + painter->drawEllipse( + QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top)); +} + +void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) +{ + Q_ASSERT(painter); + + SurfaceImpl &si = static_cast(surfaceSource); + + if (si.pd) + { + QPixmap *pm = static_cast(si.pd); + qreal x = from.x; + qreal y = from.y; + qreal width = rc.right - rc.left; + qreal height = rc.bottom - rc.top; + +#if QT_VERSION >= 0x050100 + qreal dpr = pm->devicePixelRatio(); + + x *= dpr; + y *= dpr; + width *= dpr; + height *= dpr; +#endif + + painter->drawPixmap(QPointF(rc.left, rc.top), *pm, + QRectF(x, y, width, height)); + } +} + +void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, + const char *s, int len, ColourDesired fore, ColourDesired back) +{ + Q_ASSERT(painter); + + FillRectangle(rc, back); + drawText(rc, font_, ybase, s, len, fore); +} + +void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, + const char *s, int len, ColourDesired fore, ColourDesired back) +{ + Q_ASSERT(painter); + + SetClip(rc); + DrawTextNoClip(rc, font_, ybase, s, len, fore, back); + painter->setClipping(false); +} + +void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, + XYPOSITION ybase, const char *s, int len, ColourDesired fore) +{ + // Only draw if there is a non-space. + for (int i = 0; i < len; ++i) + if (s[i] != ' ') + { + drawText(rc, font_, ybase, s, len, fore); + return; + } +} + +void SurfaceImpl::drawText(const PRectangle &rc, Font &font_, XYPOSITION ybase, + const char *s, int len, ColourDesired fore) +{ + QString qs = convertText(s, len); + + QFont *f = PFont(font_.GetID()); + + if (f) + painter->setFont(*f); + + painter->setPen(convertQColor(fore)); + painter->drawText(QPointF(rc.left, ybase), qs); +} + +void SurfaceImpl::DrawXPM(PRectangle rc, const XPM *xpm) +{ + Q_ASSERT(painter); + + XYPOSITION x, y; + const QPixmap &qpm = xpm->Pixmap(); + + x = rc.left + (rc.Width() - qpm.width()) / 2.0; + y = rc.top + (rc.Height() - qpm.height()) / 2.0; + + painter->drawPixmap(QPointF(x, y), qpm); +} + +void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, + const unsigned char *pixelsImage) +{ + Q_ASSERT(painter); + + const QImage *qim = reinterpret_cast(pixelsImage); + + painter->drawImage(QPointF(rc.left, rc.top), *qim); +} + +void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, + XYPOSITION *positions) +{ + QString qs = convertText(s, len); + QTextLayout text_layout(qs, convertQFont(font_), pd); + + text_layout.beginLayout(); + QTextLine text_line = text_layout.createLine(); + text_layout.endLayout(); + + if (unicodeMode) + { + int i_char = 0, i_byte = 0;; + + while (i_char < qs.size()) + { + unsigned char byte = s[i_byte]; + int nbytes, code_units; + + // Work out character sizes by looking at the byte stream. + if (byte >= 0xf0) + { + nbytes = 4; + code_units = 2; + } + else + { + if (byte >= 0xe0) + nbytes = 3; + else if (byte >= 0x80) + nbytes = 2; + else + nbytes = 1; + + code_units = 1; + } + + XYPOSITION position = text_line.cursorToX(i_char + code_units); + + // Set the same position for each byte of the character. + for (int i = 0; i < nbytes && i_byte < len; ++i) + positions[i_byte++] = position; + + i_char += code_units; + } + + // This shouldn't be necessary... + XYPOSITION last_position = ((i_byte > 0) ? positions[i_byte - 1] : 0); + + while (i_byte < len) + positions[i_byte++] = last_position; + } + else + { + for (int i = 0; i < len; ++i) + positions[i] = text_line.cursorToX(i + 1); + } +} + +XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len) +{ + return metrics(font_).width(convertText(s, len)); + +} + +XYPOSITION SurfaceImpl::WidthChar(Font &font_, char ch) +{ + return metrics(font_).width(ch); +} + +XYPOSITION SurfaceImpl::Ascent(Font &font_) +{ + return metrics(font_).ascent(); +} + +XYPOSITION SurfaceImpl::Descent(Font &font_) +{ + // Qt doesn't include the baseline in the descent, so add it. Note that + // a descent from Qt4 always seems to be 2 pixels larger (irrespective of + // font or size) than the same descent from Qt3. This means that text is a + // little more spaced out with Qt4 - and will be more noticeable with + // smaller fonts. + return metrics(font_).descent() + 1; +} + +XYPOSITION SurfaceImpl::ExternalLeading(Font &font_) +{ + // Scintilla doesn't use this at the moment, which is good because Qt4 can + // return a negative value. + return metrics(font_).leading(); +} + +XYPOSITION SurfaceImpl::Height(Font &font_) +{ + return metrics(font_).height(); +} + +XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) +{ +#if QT_VERSION >= 0x040200 + return metrics(font_).averageCharWidth(); +#else + return WidthChar(font_, 'n'); +#endif +} + +void SurfaceImpl::SetClip(PRectangle rc) +{ + Q_ASSERT(painter); + + painter->setClipRect( + QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top)); +} + +void SurfaceImpl::FlushCachedState() +{ +} + +// Return the QFont for a Font. +QFont SurfaceImpl::convertQFont(Font &font) +{ + QFont *f = PFont(font.GetID()); + + if (f) + return *f; + + return QApplication::font(); +} + +// Get the metrics for a font. +QFontMetricsF SurfaceImpl::metrics(Font &font_) +{ + QFont fnt = convertQFont(font_); + + return QFontMetricsF(fnt, pd); +} + +// Convert a Scintilla string to a Qt Unicode string. +QString SurfaceImpl::convertText(const char *s, int len) +{ + if (unicodeMode) + return QString::fromUtf8(s, len); + + return QString::fromLatin1(s, len); +} + + +// Convert a Scintilla colour, and alpha component, to a Qt QColor. +QColor SurfaceImpl::convertQColor(const ColourDesired &col, unsigned alpha) +{ + long c = col.AsLong(); + + unsigned r = c & 0xff; + unsigned g = (c >> 8) & 0xff; + unsigned b = (c >> 16) & 0xff; + + return QColor(r, g, b, alpha); +} + + +// Window (widget) management. +Window::~Window() +{ +} + +void Window::Destroy() +{ + QWidget *w = PWindow(wid); + + if (w) + { + // Delete the widget next time round the event loop rather than + // straight away. This gets round a problem when auto-completion lists + // are cancelled after an entry has been double-clicked, ie. the list's + // dtor is called from one of the list's slots. There are other ways + // around the problem but this is the simplest and doesn't seem to + // cause problems of its own. + w->deleteLater(); + wid = 0; + } +} + +bool Window::HasFocus() +{ + return PWindow(wid)->hasFocus(); +} + +PRectangle Window::GetPosition() +{ + QWidget *w = PWindow(wid); + + // Before any size allocated pretend its big enough not to be scrolled. + PRectangle rc(0,0,5000,5000); + + if (w) + { + const QRect &r = w->geometry(); + + rc.right = r.right() - r.left() + 1; + rc.bottom = r.bottom() - r.top() + 1; + } + + return rc; +} + +void Window::SetPosition(PRectangle rc) +{ + PWindow(wid)->setGeometry(rc.left, rc.top, rc.right - rc.left, + rc.bottom - rc.top); +} + +void Window::SetPositionRelative(PRectangle rc, Window relativeTo) +{ + QWidget *rel = PWindow(relativeTo.wid); + QPoint pos = rel->mapToGlobal(rel->pos()); + + int x = pos.x() + rc.left; + int y = pos.y() + rc.top; + + PWindow(wid)->setGeometry(x, y, rc.right - rc.left, rc.bottom - rc.top); +} + +PRectangle Window::GetClientPosition() +{ + return GetPosition(); +} + +void Window::Show(bool show) +{ + QWidget *w = PWindow(wid); + + if (show) + w->show(); + else + w->hide(); +} + +void Window::InvalidateAll() +{ + QWidget *w = PWindow(wid); + + if (w) + w->update(); +} + +void Window::InvalidateRectangle(PRectangle rc) +{ + QWidget *w = PWindow(wid); + + if (w) + w->update(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top); +} + +void Window::SetFont(Font &font) +{ + PWindow(wid)->setFont(*PFont(font.GetID())); +} + +void Window::SetCursor(Cursor curs) +{ + Qt::CursorShape qc; + + switch (curs) + { + case cursorText: + qc = Qt::IBeamCursor; + break; + + case cursorUp: + qc = Qt::UpArrowCursor; + break; + + case cursorWait: + qc = Qt::WaitCursor; + break; + + case cursorHoriz: + qc = Qt::SizeHorCursor; + break; + + case cursorVert: + qc = Qt::SizeVerCursor; + break; + + case cursorHand: + qc = Qt::PointingHandCursor; + break; + + default: + // Note that Qt doesn't have a standard cursor that could be used to + // implement cursorReverseArrow. + qc = Qt::ArrowCursor; + } + + PWindow(wid)->setCursor(qc); +} + +void Window::SetTitle(const char *s) +{ + PWindow(wid)->setWindowTitle(s); +} + +PRectangle Window::GetMonitorRect(Point pt) +{ + QPoint qpt = PWindow(wid)->mapToGlobal(QPoint(pt.x, pt.y)); + QRect qr = QApplication::desktop()->availableGeometry(qpt); + qpt = PWindow(wid)->mapFromGlobal(qr.topLeft()); + + return PRectangle(qpt.x(), qpt.y(), qpt.x() + qr.width(), qpt.y() + qr.height()); +} + + +// Menu management. +Menu::Menu() : mid(0) +{ +} + +void Menu::CreatePopUp() +{ + Destroy(); + mid = new QsciSciPopup(); +} + +void Menu::Destroy() +{ + QsciSciPopup *m = PMenu(mid); + + if (m) + { + delete m; + mid = 0; + } +} + +void Menu::Show(Point pt, Window &) +{ + PMenu(mid)->popup(QPoint(pt.x, pt.y)); +} + + +class DynamicLibraryImpl : public DynamicLibrary +{ +public: + DynamicLibraryImpl(const char *modulePath) + { + m = new QLibrary(modulePath); + m->load(); + } + + virtual ~DynamicLibraryImpl() + { + if (m) + delete m; + } + + virtual Function FindFunction(const char *name) + { + if (m) + return (Function)m->resolve(name); + + return 0; + } + + virtual bool IsValid() + { + return m && m->isLoaded(); + } + +private: + QLibrary* m; +}; + +DynamicLibrary *DynamicLibrary::Load(const char *modulePath) +{ + return new DynamicLibraryImpl(modulePath); +} + + +// Elapsed time. This implementation assumes that the maximum elapsed time is +// less than 48 hours. +ElapsedTime::ElapsedTime() +{ + QTime now = QTime::currentTime(); + + bigBit = now.hour() * 60 * 60 + now.minute() * 60 + now.second(); + littleBit = now.msec(); +} + +double ElapsedTime::Duration(bool reset) +{ + long endBigBit, endLittleBit; + QTime now = QTime::currentTime(); + + endBigBit = now.hour() * 60 * 60 + now.minute() * 60 + now.second(); + endLittleBit = now.msec(); + + double duration = endBigBit - bigBit; + + if (duration < 0 || (duration == 0 && endLittleBit < littleBit)) + duration += 24 * 60 * 60; + + duration += (endLittleBit - littleBit) / 1000.0; + + if (reset) + { + bigBit = endBigBit; + littleBit = endLittleBit; + } + + return duration; +} + + +// Manage system wide parameters. +ColourDesired Platform::Chrome() +{ + return ColourDesired(0xe0,0xe0,0xe0); +} + +ColourDesired Platform::ChromeHighlight() +{ + return ColourDesired(0xff,0xff,0xff); +} + +const char *Platform::DefaultFont() +{ + static QByteArray def_font; + + def_font = QApplication::font().family().toLatin1(); + + return def_font.constData(); +} + +int Platform::DefaultFontSize() +{ + return QApplication::font().pointSize(); +} + +unsigned int Platform::DoubleClickTime() +{ + return QApplication::doubleClickInterval(); +} + +bool Platform::MouseButtonBounce() +{ + return true; +} + +void Platform::DebugDisplay(const char *s) +{ + qDebug("%s", s); +} + +bool Platform::IsKeyDown(int) +{ + return false; +} + +long Platform::SendScintilla(WindowID w, unsigned int msg, + unsigned long wParam, long lParam) +{ + // This is never called. + return 0; +} + +long Platform::SendScintillaPointer(WindowID w, unsigned int msg, + unsigned long wParam, void *lParam) +{ + // This is never called. + return 0; +} + +bool Platform::IsDBCSLeadByte(int, char) +{ + // We don't support DBCS. + return false; +} + +int Platform::DBCSCharLength(int, const char *) +{ + // We don't support DBCS. + return 1; +} + +int Platform::DBCSCharMaxLength() +{ + // We don't support DBCS. + return 2; +} + +int Platform::Minimum(int a, int b) +{ + return (a < b) ? a : b; +} + +int Platform::Maximum(int a, int b) +{ + return (a > b) ? a : b; +} + +int Platform::Clamp(int val, int minVal, int maxVal) +{ + if (val > maxVal) + val = maxVal; + + if (val < minVal) + val = minVal; + + return val; +} + + +//#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); + + DebugDisplay(buffer); +} +#else +void Platform::DebugPrintf(const char *, ...) +{ +} +#endif + +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) +{ + qFatal("Assertion [%s] failed at %s %d\n", c, file, line); +} + +QSCI_END_SCI_NAMESPACE diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qsciabstractapis.h b/libs/qscintilla/Qt4Qt5/Qsci/qsciabstractapis.h new file mode 100644 index 000000000..1a6673af5 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qsciabstractapis.h @@ -0,0 +1,98 @@ +// This module defines interface to the QsciAbstractAPIs class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCIABSTRACTAPIS_H +#define QSCIABSTRACTAPIS_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include +#include +#include + +#include +#include + + +class QsciLexer; + + +//! \brief The QsciAbstractAPIs class represents the interface to the textual +//! API information used in call tips and for auto-completion. A sub-class +//! will provide the actual implementation of the interface. +//! +//! API information is specific to a particular language lexer but can be +//! shared by multiple instances of the lexer. +class QSCINTILLA_EXPORT QsciAbstractAPIs : public QObject +{ + Q_OBJECT + +public: + //! Constructs a QsciAbstractAPIs instance attached to lexer \a lexer. \a + //! lexer becomes the instance's parent object although the instance can + //! also be subsequently attached to other lexers. + QsciAbstractAPIs(QsciLexer *lexer); + + //! Destroy the QsciAbstractAPIs instance. + virtual ~QsciAbstractAPIs(); + + //! Return the lexer that the instance is attached to. + QsciLexer *lexer() const; + + //! Update the list \a list with API entries derived from \a context. \a + //! context is the list of words in the text preceding the cursor position. + //! The characters that make up a word and the characters that separate + //! words are defined by the lexer. The last word is a partial word and + //! may be empty if the user has just entered a word separator. + virtual void updateAutoCompletionList(const QStringList &context, + QStringList &list) = 0; + + //! This is called when the user selects the entry \a selection from the + //! auto-completion list. A sub-class can use this as a hint to provide + //! more specific API entries in future calls to + //! updateAutoCompletionList(). The default implementation does nothing. + virtual void autoCompletionSelected(const QString &selection); + + //! Return the call tips valid for the context \a context. (Note that the + //! last word of the context will always be empty.) \a commas is the number + //! of commas the user has typed after the context and before the cursor + //! position. The exact position of the list of call tips can be adjusted + //! by specifying a corresponding left character shift in \a shifts. This + //! is normally done to correct for any displayed context according to \a + //! style. + //! + //! \sa updateAutoCompletionList() + virtual QStringList callTips(const QStringList &context, int commas, + QsciScintilla::CallTipsStyle style, QList &shifts) = 0; + +private: + QsciLexer *lex; + + QsciAbstractAPIs(const QsciAbstractAPIs &); + QsciAbstractAPIs &operator=(const QsciAbstractAPIs &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qsciapis.h b/libs/qscintilla/Qt4Qt5/Qsci/qsciapis.h new file mode 100644 index 000000000..bc5d6bf99 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qsciapis.h @@ -0,0 +1,221 @@ +// This module defines interface to the QsciAPIs class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCIAPIS_H +#define QSCIAPIS_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include +#include +#include +#include + +#include +#include +#include + + +class QsciAPIsPrepared; +class QsciAPIsWorker; +class QsciLexer; + + +//! \brief The QsciAPIs class provies an implementation of the textual API +//! information used in call tips and for auto-completion. +//! +//! Raw API information is read from one or more files. Each API function is +//! described by a single line of text comprising the function's name, followed +//! by the function's optional comma separated parameters enclosed in +//! parenthesis, and finally followed by optional explanatory text. +//! +//! A function name may be followed by a `?' and a number. The number is used +//! by auto-completion to display a registered QPixmap with the function name. +//! +//! All function names are used by auto-completion, but only those that include +//! function parameters are used in call tips. +//! +//! QScintilla only deals with prepared API information and not the raw +//! information described above. This is done so that large APIs can be +//! handled while still being responsive to user input. The conversion of raw +//! information to prepared information is time consuming (think tens of +//! seconds) and implemented in a separate thread. Prepared information can +//! be quickly saved to and loaded from files. Such files are portable between +//! different architectures. +//! +//! QScintilla based applications that want to support large APIs would +//! normally provide the user with the ability to specify a set of, possibly +//! project specific, raw API files and convert them to prepared files that are +//! loaded quickly when the application is invoked. +class QSCINTILLA_EXPORT QsciAPIs : public QsciAbstractAPIs +{ + Q_OBJECT + +public: + //! Constructs a QsciAPIs instance attached to lexer \a lexer. \a lexer + //! becomes the instance's parent object although the instance can also be + //! subsequently attached to other lexers. + QsciAPIs(QsciLexer *lexer); + + //! Destroy the QsciAPIs instance. + virtual ~QsciAPIs(); + + //! Add the single raw API entry \a entry to the current set. + //! + //! \sa clear(), load(), remove() + void add(const QString &entry); + + //! Deletes all raw API information. + //! + //! \sa add(), load(), remove() + void clear(); + + //! Load the API information from the file named \a filename, adding it to + //! the current set. Returns true if successful, otherwise false. + bool load(const QString &filename); + + //! Remove the single raw API entry \a entry from the current set. + //! + //! \sa add(), clear(), load() + void remove(const QString &entry); + + //! Convert the current raw API information to prepared API information. + //! This is implemented by a separate thread. + //! + //! \sa cancelPreparation() + void prepare(); + + //! Cancel the conversion of the current raw API information to prepared + //! API information. + //! + //! \sa prepare() + void cancelPreparation(); + + //! Return the default name of the prepared API information file. It is + //! based on the name of the associated lexer and in the directory defined + //! by the QSCIDIR environment variable. If the environment variable isn't + //! set then $HOME/.qsci is used. + QString defaultPreparedName() const; + + //! Check to see is a prepared API information file named \a filename + //! exists. If \a filename is empty then the value returned by + //! defaultPreparedName() is used. Returns true if successful, otherwise + //! false. + //! + //! \sa defaultPreparedName() + bool isPrepared(const QString &filename = QString()) const; + + //! Load the prepared API information from the file named \a filename. If + //! \a filename is empty then a name is constructed based on the name of + //! the associated lexer and saved in the directory defined by the QSCIDIR + //! environment variable. If the environment variable isn't set then + //! $HOME/.qsci is used. Returns true if successful, otherwise false. + bool loadPrepared(const QString &filename = QString()); + + //! Save the prepared API information to the file named \a filename. If + //! \a filename is empty then a name is constructed based on the name of + //! the associated lexer and saved in the directory defined by the QSCIDIR + //! environment variable. If the environment variable isn't set then + //! $HOME/.qsci is used. Returns true if successful, otherwise false. + bool savePrepared(const QString &filename = QString()) const; + + //! \reimp + virtual void updateAutoCompletionList(const QStringList &context, + QStringList &list); + + //! \reimp + virtual void autoCompletionSelected(const QString &sel); + + //! \reimp + virtual QStringList callTips(const QStringList &context, int commas, + QsciScintilla::CallTipsStyle style, QList &shifts); + + //! \internal Reimplemented to receive termination events from the worker + //! thread. + virtual bool event(QEvent *e); + + //! Return a list of the installed raw API file names for the associated + //! lexer. + QStringList installedAPIFiles() const; + +signals: + //! This signal is emitted when the conversion of raw API information to + //! prepared API information has been cancelled. + //! + //! \sa apiPreparationFinished(), apiPreparationStarted() + void apiPreparationCancelled(); + + //! This signal is emitted when the conversion of raw API information to + //! prepared API information starts and can be used to give some visual + //! feedback to the user. + //! + //! \sa apiPreparationCancelled(), apiPreparationFinished() + void apiPreparationStarted(); + + //! This signal is emitted when the conversion of raw API information to + //! prepared API information has finished. + //! + //! \sa apiPreparationCancelled(), apiPreparationStarted() + void apiPreparationFinished(); + +private: + friend class QsciAPIsPrepared; + friend class QsciAPIsWorker; + + // This indexes a word in a set of raw APIs. The first part indexes the + // entry in the set, the second part indexes the word within the entry. + typedef QPair WordIndex; + + // This is a list of word indexes. + typedef QList WordIndexList; + + QsciAPIsWorker *worker; + QStringList old_context; + QStringList::const_iterator origin; + int origin_len; + QString unambiguous_context; + QStringList apis; + QsciAPIsPrepared *prep; + + static bool enoughCommas(const QString &s, int commas); + + QStringList positionOrigin(const QStringList &context, QString &path); + bool originStartsWith(const QString &path, const QString &wsep); + const WordIndexList *wordIndexOf(const QString &word) const; + void lastCompleteWord(const QString &word, QStringList &with_context, + bool &unambig); + void lastPartialWord(const QString &word, QStringList &with_context, + bool &unambig); + void addAPIEntries(const WordIndexList &wl, bool complete, + QStringList &with_context, bool &unambig); + QString prepName(const QString &filename, bool mkpath = false) const; + void deleteWorker(); + + QsciAPIs(const QsciAPIs &); + QsciAPIs &operator=(const QsciAPIs &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscicommand.h b/libs/qscintilla/Qt4Qt5/Qsci/qscicommand.h new file mode 100644 index 000000000..7ec46e389 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscicommand.h @@ -0,0 +1,413 @@ +// This defines the interface to the QsciCommand class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCICOMMAND_H +#define QSCICOMMAND_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include + +#include +#include + + +class QsciScintilla; + + +//! \brief The QsciCommand class represents an internal editor command that may +//! have one or two keys bound to it. +//! +//! Methods are provided to change the keys bound to the command and to remove +//! a key binding. Each command has a user friendly description of the command +//! for use in key mapping dialogs. +class QSCINTILLA_EXPORT QsciCommand +{ +public: + //! This enum defines the different commands that can be assigned to a key. + enum Command { + //! Move down one line. + LineDown = QsciScintillaBase::SCI_LINEDOWN, + + //! Extend the selection down one line. + LineDownExtend = QsciScintillaBase::SCI_LINEDOWNEXTEND, + + //! Extend the rectangular selection down one line. + LineDownRectExtend = QsciScintillaBase::SCI_LINEDOWNRECTEXTEND, + + //! Scroll the view down one line. + LineScrollDown = QsciScintillaBase::SCI_LINESCROLLDOWN, + + //! Move up one line. + LineUp = QsciScintillaBase::SCI_LINEUP, + + //! Extend the selection up one line. + LineUpExtend = QsciScintillaBase::SCI_LINEUPEXTEND, + + //! Extend the rectangular selection up one line. + LineUpRectExtend = QsciScintillaBase::SCI_LINEUPRECTEXTEND, + + //! Scroll the view up one line. + LineScrollUp = QsciScintillaBase::SCI_LINESCROLLUP, + + //! Scroll to the start of the document. + ScrollToStart = QsciScintillaBase::SCI_SCROLLTOSTART, + + //! Scroll to the end of the document. + ScrollToEnd = QsciScintillaBase::SCI_SCROLLTOEND, + + //! Scroll vertically to centre the current line. + VerticalCentreCaret = QsciScintillaBase::SCI_VERTICALCENTRECARET, + + //! Move down one paragraph. + ParaDown = QsciScintillaBase::SCI_PARADOWN, + + //! Extend the selection down one paragraph. + ParaDownExtend = QsciScintillaBase::SCI_PARADOWNEXTEND, + + //! Move up one paragraph. + ParaUp = QsciScintillaBase::SCI_PARAUP, + + //! Extend the selection up one paragraph. + ParaUpExtend = QsciScintillaBase::SCI_PARAUPEXTEND, + + //! Move left one character. + CharLeft = QsciScintillaBase::SCI_CHARLEFT, + + //! Extend the selection left one character. + CharLeftExtend = QsciScintillaBase::SCI_CHARLEFTEXTEND, + + //! Extend the rectangular selection left one character. + CharLeftRectExtend = QsciScintillaBase::SCI_CHARLEFTRECTEXTEND, + + //! Move right one character. + CharRight = QsciScintillaBase::SCI_CHARRIGHT, + + //! Extend the selection right one character. + CharRightExtend = QsciScintillaBase::SCI_CHARRIGHTEXTEND, + + //! Extend the rectangular selection right one character. + CharRightRectExtend = QsciScintillaBase::SCI_CHARRIGHTRECTEXTEND, + + //! Move left one word. + WordLeft = QsciScintillaBase::SCI_WORDLEFT, + + //! Extend the selection left one word. + WordLeftExtend = QsciScintillaBase::SCI_WORDLEFTEXTEND, + + //! Move right one word. + WordRight = QsciScintillaBase::SCI_WORDRIGHT, + + //! Extend the selection right one word. + WordRightExtend = QsciScintillaBase::SCI_WORDRIGHTEXTEND, + + //! Move to the end of the previous word. + WordLeftEnd = QsciScintillaBase::SCI_WORDLEFTEND, + + //! Extend the selection to the end of the previous word. + WordLeftEndExtend = QsciScintillaBase::SCI_WORDLEFTENDEXTEND, + + //! Move to the end of the next word. + WordRightEnd = QsciScintillaBase::SCI_WORDRIGHTEND, + + //! Extend the selection to the end of the next word. + WordRightEndExtend = QsciScintillaBase::SCI_WORDRIGHTENDEXTEND, + + //! Move left one word part. + WordPartLeft = QsciScintillaBase::SCI_WORDPARTLEFT, + + //! Extend the selection left one word part. + WordPartLeftExtend = QsciScintillaBase::SCI_WORDPARTLEFTEXTEND, + + //! Move right one word part. + WordPartRight = QsciScintillaBase::SCI_WORDPARTRIGHT, + + //! Extend the selection right one word part. + WordPartRightExtend = QsciScintillaBase::SCI_WORDPARTRIGHTEXTEND, + + //! Move to the start of the document line. + Home = QsciScintillaBase::SCI_HOME, + + //! Extend the selection to the start of the document line. + HomeExtend = QsciScintillaBase::SCI_HOMEEXTEND, + + //! Extend the rectangular selection to the start of the document line. + HomeRectExtend = QsciScintillaBase::SCI_HOMERECTEXTEND, + + //! Move to the start of the displayed line. + HomeDisplay = QsciScintillaBase::SCI_HOMEDISPLAY, + + //! Extend the selection to the start of the displayed line. + HomeDisplayExtend = QsciScintillaBase::SCI_HOMEDISPLAYEXTEND, + + //! Move to the start of the displayed or document line. + HomeWrap = QsciScintillaBase::SCI_HOMEWRAP, + + //! Extend the selection to the start of the displayed or document + //! line. + HomeWrapExtend = QsciScintillaBase::SCI_HOMEWRAPEXTEND, + + //! Move to the first visible character in the document line. + VCHome = QsciScintillaBase::SCI_VCHOME, + + //! Extend the selection to the first visible character in the document + //! line. + VCHomeExtend = QsciScintillaBase::SCI_VCHOMEEXTEND, + + //! Extend the rectangular selection to the first visible character in + //! the document line. + VCHomeRectExtend = QsciScintillaBase::SCI_VCHOMERECTEXTEND, + + //! Move to the first visible character of the displayed or document + //! line. + VCHomeWrap = QsciScintillaBase::SCI_VCHOMEWRAP, + + //! Extend the selection to the first visible character of the + //! displayed or document line. + VCHomeWrapExtend = QsciScintillaBase::SCI_VCHOMEWRAPEXTEND, + + //! Move to the end of the document line. + LineEnd = QsciScintillaBase::SCI_LINEEND, + + //! Extend the selection to the end of the document line. + LineEndExtend = QsciScintillaBase::SCI_LINEENDEXTEND, + + //! Extend the rectangular selection to the end of the document line. + LineEndRectExtend = QsciScintillaBase::SCI_LINEENDRECTEXTEND, + + //! Move to the end of the displayed line. + LineEndDisplay = QsciScintillaBase::SCI_LINEENDDISPLAY, + + //! Extend the selection to the end of the displayed line. + LineEndDisplayExtend = QsciScintillaBase::SCI_LINEENDDISPLAYEXTEND, + + //! Move to the end of the displayed or document line. + LineEndWrap = QsciScintillaBase::SCI_LINEENDWRAP, + + //! Extend the selection to the end of the displayed or document line. + LineEndWrapExtend = QsciScintillaBase::SCI_LINEENDWRAPEXTEND, + + //! Move to the start of the document. + DocumentStart = QsciScintillaBase::SCI_DOCUMENTSTART, + + //! Extend the selection to the start of the document. + DocumentStartExtend = QsciScintillaBase::SCI_DOCUMENTSTARTEXTEND, + + //! Move to the end of the document. + DocumentEnd = QsciScintillaBase::SCI_DOCUMENTEND, + + //! Extend the selection to the end of the document. + DocumentEndExtend = QsciScintillaBase::SCI_DOCUMENTENDEXTEND, + + //! Move up one page. + PageUp = QsciScintillaBase::SCI_PAGEUP, + + //! Extend the selection up one page. + PageUpExtend = QsciScintillaBase::SCI_PAGEUPEXTEND, + + //! Extend the rectangular selection up one page. + PageUpRectExtend = QsciScintillaBase::SCI_PAGEUPRECTEXTEND, + + //! Move down one page. + PageDown = QsciScintillaBase::SCI_PAGEDOWN, + + //! Extend the selection down one page. + PageDownExtend = QsciScintillaBase::SCI_PAGEDOWNEXTEND, + + //! Extend the rectangular selection down one page. + PageDownRectExtend = QsciScintillaBase::SCI_PAGEDOWNRECTEXTEND, + + //! Stuttered move up one page. + StutteredPageUp = QsciScintillaBase::SCI_STUTTEREDPAGEUP, + + //! Stuttered extend the selection up one page. + StutteredPageUpExtend = QsciScintillaBase::SCI_STUTTEREDPAGEUPEXTEND, + + //! Stuttered move down one page. + StutteredPageDown = QsciScintillaBase::SCI_STUTTEREDPAGEDOWN, + + //! Stuttered extend the selection down one page. + StutteredPageDownExtend = QsciScintillaBase::SCI_STUTTEREDPAGEDOWNEXTEND, + + //! Delete the current character. + Delete = QsciScintillaBase::SCI_CLEAR, + + //! Delete the previous character. + DeleteBack = QsciScintillaBase::SCI_DELETEBACK, + + //! Delete the previous character if not at start of line. + DeleteBackNotLine = QsciScintillaBase::SCI_DELETEBACKNOTLINE, + + //! Delete the word to the left. + DeleteWordLeft = QsciScintillaBase::SCI_DELWORDLEFT, + + //! Delete the word to the right. + DeleteWordRight = QsciScintillaBase::SCI_DELWORDRIGHT, + + //! Delete right to the end of the next word. + DeleteWordRightEnd = QsciScintillaBase::SCI_DELWORDRIGHTEND, + + //! Delete the line to the left. + DeleteLineLeft = QsciScintillaBase::SCI_DELLINELEFT, + + //! Delete the line to the right. + DeleteLineRight = QsciScintillaBase::SCI_DELLINERIGHT, + + //! Delete the current line. + LineDelete = QsciScintillaBase::SCI_LINEDELETE, + + //! Cut the current line to the clipboard. + LineCut = QsciScintillaBase::SCI_LINECUT, + + //! Copy the current line to the clipboard. + LineCopy = QsciScintillaBase::SCI_LINECOPY, + + //! Transpose the current and previous lines. + LineTranspose = QsciScintillaBase::SCI_LINETRANSPOSE, + + //! Duplicate the current line. + LineDuplicate = QsciScintillaBase::SCI_LINEDUPLICATE, + + //! Select the whole document. + SelectAll = QsciScintillaBase::SCI_SELECTALL, + + //! Move the selected lines up one line. + MoveSelectedLinesUp = QsciScintillaBase::SCI_MOVESELECTEDLINESUP, + + //! Move the selected lines down one line. + MoveSelectedLinesDown = QsciScintillaBase::SCI_MOVESELECTEDLINESDOWN, + + //! Duplicate the selection. + SelectionDuplicate = QsciScintillaBase::SCI_SELECTIONDUPLICATE, + + //! Convert the selection to lower case. + SelectionLowerCase = QsciScintillaBase::SCI_LOWERCASE, + + //! Convert the selection to upper case. + SelectionUpperCase = QsciScintillaBase::SCI_UPPERCASE, + + //! Cut the selection to the clipboard. + SelectionCut = QsciScintillaBase::SCI_CUT, + + //! Copy the selection to the clipboard. + SelectionCopy = QsciScintillaBase::SCI_COPY, + + //! Paste from the clipboard. + Paste = QsciScintillaBase::SCI_PASTE, + + //! Toggle insert/overtype. + EditToggleOvertype = QsciScintillaBase::SCI_EDITTOGGLEOVERTYPE, + + //! Insert a platform dependent newline. + Newline = QsciScintillaBase::SCI_NEWLINE, + + //! Insert a formfeed. + Formfeed = QsciScintillaBase::SCI_FORMFEED, + + //! Indent one level. + Tab = QsciScintillaBase::SCI_TAB, + + //! De-indent one level. + Backtab = QsciScintillaBase::SCI_BACKTAB, + + //! Cancel any current operation. + Cancel = QsciScintillaBase::SCI_CANCEL, + + //! Undo the last command. + Undo = QsciScintillaBase::SCI_UNDO, + + //! Redo the last command. + Redo = QsciScintillaBase::SCI_REDO, + + //! Zoom in. + ZoomIn = QsciScintillaBase::SCI_ZOOMIN, + + //! Zoom out. + ZoomOut = QsciScintillaBase::SCI_ZOOMOUT, + }; + + //! Return the command that will be executed by this instance. + Command command() const {return scicmd;} + + //! Execute the command. + void execute(); + + //! Binds the key \a key to the command. If \a key is 0 then the key + //! binding is removed. If \a key is invalid then the key binding is + //! unchanged. Valid keys are any visible or control character or any + //! of \c Qt::Key_Down, \c Qt::Key_Up, \c Qt::Key_Left, \c Qt::Key_Right, + //! \c Qt::Key_Home, \c Qt::Key_End, \c Qt::Key_PageUp, + //! \c Qt::Key_PageDown, \c Qt::Key_Delete, \c Qt::Key_Insert, + //! \c Qt::Key_Escape, \c Qt::Key_Backspace, \c Qt::Key_Tab, + //! \c Qt::Key_Backtab, \c Qt::Key_Return, \c Qt::Key_Enter, + //! \c Qt::Key_Super_L, \c Qt::Key_Super_R or \c Qt::Key_Menu. Keys may be + //! modified with any combination of \c Qt::ShiftModifier, + //! \c Qt::ControlModifier, \c Qt::AltModifier and \c Qt::MetaModifier. + //! + //! \sa key(), setAlternateKey(), validKey() + void setKey(int key); + + //! Binds the alternate key \a altkey to the command. If \a key is 0 + //! then the alternate key binding is removed. + //! + //! \sa alternateKey(), setKey(), validKey() + void setAlternateKey(int altkey); + + //! The key that is currently bound to the command is returned. + //! + //! \sa setKey(), alternateKey() + int key() const {return qkey;} + + //! The alternate key that is currently bound to the command is + //! returned. + //! + //! \sa setAlternateKey(), key() + int alternateKey() const {return qaltkey;} + + //! If the key \a key is valid then true is returned. + static bool validKey(int key); + + //! The user friendly description of the command is returned. + QString description() const; + +private: + friend class QsciCommandSet; + + QsciCommand(QsciScintilla *qs, Command cmd, int key, int altkey, + const char *desc); + + void bindKey(int key,int &qk,int &scik); + + QsciScintilla *qsCmd; + Command scicmd; + int qkey, scikey, qaltkey, scialtkey; + const char *descCmd; + + QsciCommand(const QsciCommand &); + QsciCommand &operator=(const QsciCommand &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscicommandset.h b/libs/qscintilla/Qt4Qt5/Qsci/qscicommandset.h new file mode 100644 index 000000000..8a0812f98 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscicommandset.h @@ -0,0 +1,97 @@ +// This defines the interface to the QsciCommandSet class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCICOMMANDSET_H +#define QSCICOMMANDSET_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include + +#include + +#include +#include + + +QT_BEGIN_NAMESPACE +class QSettings; +QT_END_NAMESPACE + +class QsciScintilla; + + +//! \brief The QsciCommandSet class represents the set of all internal editor +//! commands that may have keys bound. +//! +//! Methods are provided to access the individual commands and to read and +//! write the current bindings from and to settings files. +class QSCINTILLA_EXPORT QsciCommandSet +{ +public: + //! The key bindings for each command in the set are read from the + //! settings \a qs. \a prefix is prepended to the key of each entry. + //! true is returned if there was no error. + //! + //! \sa writeSettings() + bool readSettings(QSettings &qs, const char *prefix = "/Scintilla"); + + //! The key bindings for each command in the set are written to the + //! settings \a qs. \a prefix is prepended to the key of each entry. + //! true is returned if there was no error. + //! + //! \sa readSettings() + bool writeSettings(QSettings &qs, const char *prefix = "/Scintilla"); + + //! The commands in the set are returned as a list. + QList &commands() {return cmds;} + + //! The primary keys bindings for all commands are removed. + void clearKeys(); + + //! The alternate keys bindings for all commands are removed. + void clearAlternateKeys(); + + // Find the command that is bound to \a key. + QsciCommand *boundTo(int key) const; + + // Find a specific command \a command. + QsciCommand *find(QsciCommand::Command command) const; + +private: + friend class QsciScintilla; + + QsciCommandSet(QsciScintilla *qs); + ~QsciCommandSet(); + + QsciScintilla *qsci; + QList cmds; + + QsciCommandSet(const QsciCommandSet &); + QsciCommandSet &operator=(const QsciCommandSet &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscidocument.h b/libs/qscintilla/Qt4Qt5/Qsci/qscidocument.h new file mode 100644 index 000000000..21f0fce01 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscidocument.h @@ -0,0 +1,69 @@ +// This defines the interface to the QsciDocument class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCIDOCUMENT_H +#define QSCIDOCUMENT_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include + + +class QsciScintillaBase; +class QsciDocumentP; + + +//! \brief The QsciDocument class represents a document to be edited. +//! +//! It is an opaque class that can be attached to multiple instances of +//! QsciScintilla to create different simultaneous views of the same document. +//! QsciDocument uses implicit sharing so that copying class instances is a +//! cheap operation. +class QSCINTILLA_EXPORT QsciDocument +{ +public: + //! Create a new unattached document. + QsciDocument(); + virtual ~QsciDocument(); + + QsciDocument(const QsciDocument &); + QsciDocument &operator=(const QsciDocument &); + +private: + friend class QsciScintilla; + + void attach(const QsciDocument &that); + void detach(); + void display(QsciScintillaBase *qsb, const QsciDocument *from); + void undisplay(QsciScintillaBase *qsb); + + bool isModified() const; + void setModified(bool m); + + QsciDocumentP *pdoc; +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qsciglobal.h b/libs/qscintilla/Qt4Qt5/Qsci/qsciglobal.h new file mode 100644 index 000000000..84cc8d3aa --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qsciglobal.h @@ -0,0 +1,62 @@ +// This module defines various things common to all of the Scintilla Qt port. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCIGLOBAL_H +#define QSCIGLOBAL_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include + + +#define QSCINTILLA_VERSION 0x020900 +#define QSCINTILLA_VERSION_STR "2.9" + + +// Under Windows, define QSCINTILLA_MAKE_DLL to create a Scintilla DLL, or +// define QSCINTILLA_DLL to link against a Scintilla DLL, or define neither +// to either build or link against a static Scintilla library. +#if defined(Q_OS_WIN) + +#if defined(QSCINTILLA_DLL) +#define QSCINTILLA_EXPORT __declspec(dllimport) +#elif defined(QSCINTILLA_MAKE_DLL) +#define QSCINTILLA_EXPORT __declspec(dllexport) +#endif + +#endif + +#if !defined(QSCINTILLA_EXPORT) +#define QSCINTILLA_EXPORT +#endif + + +#if !defined(QT_BEGIN_NAMESPACE) +#define QT_BEGIN_NAMESPACE +#define QT_END_NAMESPACE +#endif + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscilexer.h b/libs/qscintilla/Qt4Qt5/Qsci/qscilexer.h new file mode 100644 index 000000000..013e286c4 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscilexer.h @@ -0,0 +1,358 @@ +// This defines the interface to the QsciLexer class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCILEXER_H +#define QSCILEXER_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include +#include +#include +#include +#include + +#include + + +QT_BEGIN_NAMESPACE +class QSettings; +QT_END_NAMESPACE + +class QsciAbstractAPIs; +class QsciScintilla; + + +//! \brief The QsciLexer class is an abstract class used as a base for language +//! lexers. +//! +//! A lexer scans the text breaking it up into separate language objects, e.g. +//! keywords, strings, operators. The lexer then uses a different style to +//! draw each object. A style is identified by a style number and has a number +//! of attributes, including colour and font. A specific language lexer will +//! implement appropriate default styles which can be overriden by an +//! application by further sub-classing the specific language lexer. +//! +//! A lexer may provide one or more sets of words to be recognised as keywords. +//! Most lexers only provide one set, but some may support languages embedded +//! in other languages and provide several sets. +//! +//! QsciLexer provides convenience methods for saving and restoring user +//! preferences for fonts and colours. +//! +//! If you want to write a lexer for a new language then you can add it to the +//! underlying Scintilla code and implement a corresponding QsciLexer sub-class +//! to manage the different styles used. Alternatively you can implement a +//! sub-class of QsciLexerCustom. +class QSCINTILLA_EXPORT QsciLexer : public QObject +{ + Q_OBJECT + +public: + //! Construct a QsciLexer with parent \a parent. \a parent is typically + //! the QsciScintilla instance. + QsciLexer(QObject *parent = 0); + + //! Destroy the QSciLexer. + virtual ~QsciLexer(); + + //! Returns the name of the language. It must be re-implemented by a + //! sub-class. + virtual const char *language() const = 0; + + //! Returns the name of the lexer. If 0 is returned then the lexer's + //! numeric identifier is used. The default implementation returns 0. + //! + //! \sa lexerId() + virtual const char *lexer() const; + + //! Returns the identifier (i.e. a QsciScintillaBase::SCLEX_* value) of the + //! lexer. This is only used if lexer() returns 0. The default + //! implementation returns QsciScintillaBase::SCLEX_CONTAINER. + //! + //! \sa lexer() + virtual int lexerId() const; + + //! Returns the current API set or 0 if there isn't one. + //! + //! \sa setAPIs() + QsciAbstractAPIs *apis() const; + + //! \internal Returns the characters that can fill up auto-completion. + virtual const char *autoCompletionFillups() const; + + //! \internal Returns the list of character sequences that can separate + //! auto-completion words. The first in the list is assumed to be the + //! sequence used to separate words in the lexer's API files. + virtual QStringList autoCompletionWordSeparators() const; + + //! Returns the auto-indentation style. The default is 0 if the + //! language is block structured, or QsciScintilla::AiMaintain if not. + //! + //! \sa setAutoIndentStyle(), QsciScintilla::AiMaintain, + //! QsciScintilla::AiOpening, QsciScintilla::AiClosing + int autoIndentStyle(); + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the end of a block for + //! auto-indentation. The style is returned via \a style. + virtual const char *blockEnd(int *style = 0) const; + + //! \internal Returns the number of lines prior to the current one when + //! determining the scope of a block when auto-indenting. + virtual int blockLookback() const; + + //! \internal Returns a space separated list of words or characters in + //! a particular style that define the start of a block for + //! auto-indentation. The style is returned via \a style. + virtual const char *blockStart(int *style = 0) const; + + //! \internal Returns a space separated list of keywords in a + //! particular style that define the start of a block for + //! auto-indentation. The style is returned via \a style. + virtual const char *blockStartKeyword(int *style = 0) const; + + //! \internal Returns the style used for braces for brace matching. + virtual int braceStyle() const; + + //! \internal Returns true if the language is case sensitive. The default + //! is true. + virtual bool caseSensitive() const; + + //! Returns the foreground colour of the text for style number \a style. + //! The default colour is that returned by defaultColor(). + //! + //! \sa defaultColor(), paper() + virtual QColor color(int style) const; + + //! Returns the end-of-line for style number \a style. The default is + //! false. + virtual bool eolFill(int style) const; + + //! Returns the font for style number \a style. The default font is + //! that returned by defaultFont(). + //! + //! \sa defaultFont() + virtual QFont font(int style) const; + + //! \internal Returns the view used for indentation guides. + virtual int indentationGuideView() const; + + //! Returns the set of keywords for the keyword set \a set recognised + //! by the lexer as a space separated string. 0 is returned if there + //! is no such set. + virtual const char *keywords(int set) const; + + //! \internal Returns the number of the style used for whitespace. The + //! default implementation returns 0 which is the convention adopted by + //! most lexers. + virtual int defaultStyle() const; + + //! Returns the descriptive name for style number \a style. For a valid + //! style number for this language a non-empty QString must be returned. + //! If the style number is invalid then an empty QString must be returned. + //! This is intended to be used in user preference dialogs. + virtual QString description(int style) const = 0; + + //! Returns the background colour of the text for style number + //! \a style. + //! + //! \sa defaultPaper(), color() + virtual QColor paper(int style) const; + + //! Returns the default text colour. + //! + //! \sa setDefaultColor() + QColor defaultColor() const; + + //! Returns the default text colour for style number \a style. + virtual QColor defaultColor(int style) const; + + //! Returns the default end-of-line for style number \a style. The default + //! is false. + virtual bool defaultEolFill(int style) const; + + //! Returns the default font. + //! + //! \sa setDefaultFont() + QFont defaultFont() const; + + //! Returns the default font for style number \a style. + virtual QFont defaultFont(int style) const; + + //! Returns the default paper colour. + //! + //! \sa setDefaultPaper() + QColor defaultPaper() const; + + //! Returns the default paper colour for style number \a style. + virtual QColor defaultPaper(int style) const; + + //! Returns the QsciScintilla instance that the lexer is currently attached + //! to or 0 if it is unattached. + QsciScintilla *editor() const {return attached_editor;} + + //! The current set of APIs is set to \a apis. If \a apis is 0 then any + //! existing APIs for this lexer are removed. + //! + //! \sa apis() + void setAPIs(QsciAbstractAPIs *apis); + + //! The default text colour is set to \a c. + //! + //! \sa defaultColor(), color() + void setDefaultColor(const QColor &c); + + //! The default font is set to \a f. + //! + //! \sa defaultFont(), font() + void setDefaultFont(const QFont &f); + + //! The default paper colour is set to \a c. + //! + //! \sa defaultPaper(), paper() + void setDefaultPaper(const QColor &c); + + //! \internal Set the QsciScintilla instance that the lexer is attached to. + virtual void setEditor(QsciScintilla *editor); + + //! The colour, paper, font and end-of-line for each style number, and + //! all lexer specific properties are read from the settings \a qs. + //! \a prefix is prepended to the key of each entry. true is returned + //! if there was no error. + //! + //! \sa writeSettings(), QsciScintilla::setLexer() + bool readSettings(QSettings &qs,const char *prefix = "/Scintilla"); + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + virtual void refreshProperties(); + + //! Returns the number of style bits needed by the lexer. Normally this + //! should only be re-implemented by custom lexers. + virtual int styleBitsNeeded() const; + + //! Returns the string of characters that comprise a word. The default is + //! 0 which implies the upper and lower case alphabetic characters and + //! underscore. + virtual const char *wordCharacters() const; + + //! The colour, paper, font and end-of-line for each style number, and + //! all lexer specific properties are written to the settings \a qs. + //! \a prefix is prepended to the key of each entry. true is returned + //! if there was no error. + //! + //! \sa readSettings() + bool writeSettings(QSettings &qs, + const char *prefix = "/Scintilla") const; + +public slots: + //! The auto-indentation style is set to \a autoindentstyle. + //! + //! \sa autoIndentStyle(), QsciScintilla::AiMaintain, + //! QsciScintilla::AiOpening, QsciScintilla::AiClosing + virtual void setAutoIndentStyle(int autoindentstyle); + + //! The foreground colour for style number \a style is set to \a c. If + //! \a style is -1 then the colour is set for all styles. + virtual void setColor(const QColor &c,int style = -1); + + //! The end-of-line fill for style number \a style is set to + //! \a eoffill. If \a style is -1 then the fill is set for all styles. + virtual void setEolFill(bool eoffill,int style = -1); + + //! The font for style number \a style is set to \a f. If \a style is + //! -1 then the font is set for all styles. + virtual void setFont(const QFont &f,int style = -1); + + //! The background colour for style number \a style is set to \a c. If + //! \a style is -1 then the colour is set for all styles. + virtual void setPaper(const QColor &c,int style = -1); + +signals: + //! This signal is emitted when the foreground colour of style number + //! \a style has changed. The new colour is \a c. + void colorChanged(const QColor &c,int style); + + //! This signal is emitted when the end-of-file fill of style number + //! \a style has changed. The new fill is \a eolfilled. + void eolFillChanged(bool eolfilled,int style); + + //! This signal is emitted when the font of style number \a style has + //! changed. The new font is \a f. + void fontChanged(const QFont &f,int style); + + //! This signal is emitted when the background colour of style number + //! \a style has changed. The new colour is \a c. + void paperChanged(const QColor &c,int style); + + //! This signal is emitted when the value of the lexer property \a prop + //! needs to be changed. The new value is \a val. + void propertyChanged(const char *prop, const char *val); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. true is returned if there is no error. + //! + virtual bool readProperties(QSettings &qs,const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. true is returned if there is no error. + //! + virtual bool writeProperties(QSettings &qs,const QString &prefix) const; + +private: + struct StyleData { + QFont font; + QColor color; + QColor paper; + bool eol_fill; + }; + + struct StyleDataMap { + bool style_data_set; + QMap style_data; + }; + + StyleDataMap *style_map; + + int autoIndStyle; + QFont defFont; + QColor defColor; + QColor defPaper; + QsciAbstractAPIs *apiSet; + QsciScintilla *attached_editor; + + void setStyleDefaults() const; + StyleData &styleData(int style) const; + + QsciLexer(const QsciLexer &); + QsciLexer &operator=(const QsciLexer &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscilexersql.h b/libs/qscintilla/Qt4Qt5/Qsci/qscilexersql.h new file mode 100644 index 000000000..50e8d5eb0 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscilexersql.h @@ -0,0 +1,294 @@ +// This defines the interface to the QsciLexerSQL class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCILEXERSQL_H +#define QSCILEXERSQL_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include + +#include +#include + + +//! \brief The QsciLexerSQL class encapsulates the Scintilla SQL lexer. +class QSCINTILLA_EXPORT QsciLexerSQL : public QsciLexer +{ + Q_OBJECT + +public: + //! This enum defines the meanings of the different styles used by the + //! SQL lexer. + enum { + //! The default. + Default = 0, + + //! A comment. + Comment = 1, + + //! A line comment. + CommentLine = 2, + + //! A JavaDoc/Doxygen style comment. + CommentDoc = 3, + + //! A number. + Number = 4, + + //! A keyword. + Keyword = 5, + + //! A double-quoted string. + DoubleQuotedString = 6, + + //! A single-quoted string. + SingleQuotedString = 7, + + //! An SQL*Plus keyword. + PlusKeyword = 8, + + //! An SQL*Plus prompt. + PlusPrompt = 9, + + //! An operator. + Operator = 10, + + //! An identifier + Identifier = 11, + + //! An SQL*Plus comment. + PlusComment = 13, + + //! A '#' line comment. + CommentLineHash = 15, + + //! A JavaDoc/Doxygen keyword. + CommentDocKeyword = 17, + + //! A JavaDoc/Doxygen keyword error. + CommentDocKeywordError = 18, + + //! A keyword defined in keyword set number 5. The class must be + //! sub-classed and re-implement keywords() to make use of this style. + //! Note that keywords must be defined using lower case. + KeywordSet5 = 19, + + //! A keyword defined in keyword set number 6. The class must be + //! sub-classed and re-implement keywords() to make use of this style. + //! Note that keywords must be defined using lower case. + KeywordSet6 = 20, + + //! A keyword defined in keyword set number 7. The class must be + //! sub-classed and re-implement keywords() to make use of this style. + //! Note that keywords must be defined using lower case. + KeywordSet7 = 21, + + //! A keyword defined in keyword set number 8. The class must be + //! sub-classed and re-implement keywords() to make use of this style. + //! Note that keywords must be defined using lower case. + KeywordSet8 = 22, + + //! A quoted identifier. + QuotedIdentifier = 23, + + //! A quoted operator. + QuotedOperator = 24, + }; + + //! Construct a QsciLexerSQL with parent \a parent. \a parent is typically + //! the QsciScintilla instance. + QsciLexerSQL(QObject *parent = 0); + + //! Destroys the QsciLexerSQL instance. + virtual ~QsciLexerSQL(); + + //! Returns the name of the language. + const char *language() const; + + //! Returns the name of the lexer. Some lexers support a number of + //! languages. + const char *lexer() const; + + //! \internal Returns the style used for braces for brace matching. + int braceStyle() const; + + //! Returns the foreground colour of the text for style number \a style. + //! + //! \sa defaultPaper() + QColor defaultColor(int style) const; + + //! Returns the end-of-line fill for style number \a style. + bool defaultEolFill(int style) const; + + //! Returns the font for style number \a style. + QFont defaultFont(int style) const; + + //! Returns the background colour of the text for style number \a style. + //! + //! \sa defaultColor() + QColor defaultPaper(int style) const; + + //! Returns the set of keywords for the keyword set \a set recognised by + //! the lexer as a space separated string. + const char *keywords(int set) const; + + //! Returns the descriptive name for style number \a style. If the style + //! is invalid for this language then an empty QString is returned. This + //! is intended to be used in user preference dialogs. + QString description(int style) const; + + //! Causes all properties to be refreshed by emitting the + //! propertyChanged() signal as required. + void refreshProperties(); + + //! Returns true if backslash escapes are enabled. + //! + //! \sa setBackslashEscapes() + bool backslashEscapes() const {return backslash_escapes;} + + //! If \a enable is true then words may contain dots (i.e. periods or full + //! stops). The default is false. + //! + //! \sa dottedWords() + void setDottedWords(bool enable); + + //! Returns true if words may contain dots (i.e. periods or full stops). + //! + //! \sa setDottedWords() + bool dottedWords() const {return allow_dotted_word;} + + //! If \a fold is true then ELSE blocks can be folded. The default is + //! false. + //! + //! \sa foldAtElse() + void setFoldAtElse(bool fold); + + //! Returns true if ELSE blocks can be folded. + //! + //! \sa setFoldAtElse() + bool foldAtElse() const {return at_else;} + + //! Returns true if multi-line comment blocks can be folded. + //! + //! \sa setFoldComments() + bool foldComments() const {return fold_comments;} + + //! Returns true if trailing blank lines are included in a fold block. + //! + //! \sa setFoldCompact() + bool foldCompact() const {return fold_compact;} + + //! If \a fold is true then only BEGIN blocks can be folded. The default + //! is false. + //! + //! \sa foldOnlyBegin() + void setFoldOnlyBegin(bool fold); + + //! Returns true if BEGIN blocks only can be folded. + //! + //! \sa setFoldOnlyBegin() + bool foldOnlyBegin() const {return only_begin;} + + //! If \a enable is true then '#' is used as a comment character. It is + //! typically enabled for MySQL and disabled for Oracle. The default is + //! false. + //! + //! \sa hashComments() + void setHashComments(bool enable); + + //! Returns true if '#' is used as a comment character. + //! + //! \sa setHashComments() + bool hashComments() const {return numbersign_comment;} + + //! If \a enable is true then quoted identifiers are enabled. The default + //! is false. + //! + //! \sa quotedIdentifiers() + void setQuotedIdentifiers(bool enable); + + //! Returns true if quoted identifiers are enabled. + //! + //! \sa setQuotedIdentifiers() + bool quotedIdentifiers() const {return backticks_identifier;} + +public slots: + //! If \a enable is true then backslash escapes are enabled. The + //! default is false. + //! + //! \sa backslashEscapes() + virtual void setBackslashEscapes(bool enable); + + //! If \a fold is true then multi-line comment blocks can be folded. The + //! default is false. + //! + //! \sa foldComments() + virtual void setFoldComments(bool fold); + + //! If \a fold is true then trailing blank lines are included in a fold + //! block. The default is true. + //! + //! \sa foldCompact() + virtual void setFoldCompact(bool fold); + +protected: + //! The lexer's properties are read from the settings \a qs. \a prefix + //! (which has a trailing '/') should be used as a prefix to the key of + //! each setting. true is returned if there is no error. + //! + bool readProperties(QSettings &qs, const QString &prefix); + + //! The lexer's properties are written to the settings \a qs. + //! \a prefix (which has a trailing '/') should be used as a prefix to + //! the key of each setting. true is returned if there is no error. + //! + bool writeProperties(QSettings &qs, const QString &prefix) const; + +private: + void setAtElseProp(); + void setCommentProp(); + void setCompactProp(); + void setOnlyBeginProp(); + void setBackticksIdentifierProp(); + void setNumbersignCommentProp(); + void setBackslashEscapesProp(); + void setAllowDottedWordProp(); + + bool at_else; + bool fold_comments; + bool fold_compact; + bool only_begin; + bool backticks_identifier; + bool numbersign_comment; + bool backslash_escapes; + bool allow_dotted_word; + + QsciLexerSQL(const QsciLexerSQL &); + QsciLexerSQL &operator=(const QsciLexerSQL &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscimacro.h b/libs/qscintilla/Qt4Qt5/Qsci/qscimacro.h new file mode 100644 index 000000000..067217fac --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscimacro.h @@ -0,0 +1,106 @@ +// This defines the interface to the QsciMacro class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCIMACRO_H +#define QSCIMACRO_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include +#include +#include + +#include + + +class QsciScintilla; + + +//! \brief The QsciMacro class represents a sequence of recordable editor +//! commands. +//! +//! Methods are provided to convert convert a macro to and from a textual +//! representation so that they can be easily written to and read from +//! permanent storage. +class QSCINTILLA_EXPORT QsciMacro : public QObject +{ + Q_OBJECT + +public: + //! Construct a QsciMacro with parent \a parent. + QsciMacro(QsciScintilla *parent); + + //! Construct a QsciMacro from the printable ASCII representation \a asc, + //! with parent \a parent. + QsciMacro(const QString &asc, QsciScintilla *parent); + + //! Destroy the QsciMacro instance. + virtual ~QsciMacro(); + + //! Clear the contents of the macro. + void clear(); + + //! Load the macro from the printable ASCII representation \a asc. Returns + //! true if there was no error. + //! + //! \sa save() + bool load(const QString &asc); + + //! Return a printable ASCII representation of the macro. It is guaranteed + //! that only printable ASCII characters are used and that double quote + //! characters will not be used. + //! + //! \sa load() + QString save() const; + +public slots: + //! Play the macro. + virtual void play(); + + //! Start recording user commands and add them to the macro. + virtual void startRecording(); + + //! Stop recording user commands. + virtual void endRecording(); + +private slots: + void record(unsigned int msg, unsigned long wParam, void *lParam); + +private: + struct Macro { + unsigned int msg; + unsigned long wParam; + QByteArray text; + }; + + QsciScintilla *qsci; + QList macro; + + QsciMacro(const QsciMacro &); + QsciMacro &operator=(const QsciMacro &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qsciprinter.h b/libs/qscintilla/Qt4Qt5/Qsci/qsciprinter.h new file mode 100644 index 000000000..ba91c8afe --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qsciprinter.h @@ -0,0 +1,120 @@ +// This module defines interface to the QsciPrinter class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCIPRINTER_H +#define QSCIPRINTER_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +// This is needed for Qt v5.0.0-alpha. +#if defined(B0) +#undef B0 +#endif + +#include + +#if !defined(QT_NO_PRINTER) + +#include +#include + + +QT_BEGIN_NAMESPACE +class QRect; +class QPainter; +QT_END_NAMESPACE + +class QsciScintillaBase; + + +//! \brief The QsciPrinter class is a sub-class of the Qt QPrinter class that +//! is able to print the text of a Scintilla document. +//! +//! The class can be further sub-classed to alter to layout of the text, adding +//! headers and footers for example. +class QSCINTILLA_EXPORT QsciPrinter : public QPrinter +{ +public: + //! Constructs a printer paint device with mode \a mode. + QsciPrinter(PrinterMode mode = ScreenResolution); + + //! Destroys the QsciPrinter instance. + virtual ~QsciPrinter(); + + //! Format a page, by adding headers and footers for example, before the + //! document text is drawn on it. \a painter is the painter to be used to + //! add customised text and graphics. \a drawing is true if the page is + //! actually being drawn rather than being sized. \a painter drawing + //! methods must only be called when \a drawing is true. \a area is the + //! area of the page that will be used to draw the text. This should be + //! modified if it is necessary to reserve space for any customised text or + //! graphics. By default the area is relative to the printable area of the + //! page. Use QPrinter::setFullPage() because calling printRange() if you + //! want to try and print over the whole page. \a pagenr is the number of + //! the page. The first page is numbered 1. + virtual void formatPage(QPainter &painter, bool drawing, QRect &area, + int pagenr); + + //! Return the number of points to add to each font when printing. + //! + //! \sa setMagnification() + int magnification() const {return mag;} + + //! Sets the number of points to add to each font when printing to \a + //! magnification. + //! + //! \sa magnification() + virtual void setMagnification(int magnification); + + //! Print a range of lines from the Scintilla instance \a qsb. \a from is + //! the first line to print and a negative value signifies the first line + //! of text. \a to is the last line to print and a negative value + //! signifies the last line of text. true is returned if there was no + //! error. + virtual int printRange(QsciScintillaBase *qsb, int from = -1, int to = -1); + + //! Return the line wrap mode used when printing. The default is + //! QsciScintilla::WrapWord. + //! + //! \sa setWrapMode() + QsciScintilla::WrapMode wrapMode() const {return wrap;} + + //! Sets the line wrap mode used when printing to \a wmode. + //! + //! \sa wrapMode() + virtual void setWrapMode(QsciScintilla::WrapMode wmode); + +private: + int mag; + QsciScintilla::WrapMode wrap; + + QsciPrinter(const QsciPrinter &); + QsciPrinter &operator=(const QsciPrinter &); +}; + +#endif + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h b/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h new file mode 100644 index 000000000..c0faa9b6f --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h @@ -0,0 +1,2164 @@ +// This module defines the "official" high-level API of the Qt port of +// Scintilla. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCISCINTILLA_H +#define QSCISCINTILLA_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + + +QT_BEGIN_NAMESPACE +class QAction; +class QImage; +class QIODevice; +class QMenu; +class QPoint; +QT_END_NAMESPACE + +class QsciCommandSet; +class QsciLexer; +class QsciStyle; +class QsciStyledText; +class QsciListBoxQt; + + +//! \brief The QsciScintilla class implements a higher level, more Qt-like, +//! API to the Scintilla editor widget. +//! +//! QsciScintilla implements methods, signals and slots similar to those found +//! in other Qt editor classes. It also provides a higher level interface to +//! features specific to Scintilla such as syntax styling, call tips, +//! auto-indenting and auto-completion than that provided by QsciScintillaBase. +class QSCINTILLA_EXPORT QsciScintilla : public QsciScintillaBase +{ + Q_OBJECT + +public: + //! This enum defines the different auto-indentation styles. + enum { + //! A line is automatically indented to match the previous line. + AiMaintain = 0x01, + + //! If the language supported by the current lexer has a specific start + //! of block character (e.g. { in C++), then a line that begins with + //! that character is indented as well as the lines that make up the + //! block. It may be logically ored with AiClosing. + AiOpening = 0x02, + + //! If the language supported by the current lexer has a specific end + //! of block character (e.g. } in C++), then a line that begins with + //! that character is indented as well as the lines that make up the + //! block. It may be logically ored with AiOpening. + AiClosing = 0x04 + }; + + //! This enum defines the different annotation display styles. + enum AnnotationDisplay { + //! Annotations are not displayed. + AnnotationHidden = ANNOTATION_HIDDEN, + + //! Annotations are drawn left justified with no adornment. + AnnotationStandard = ANNOTATION_STANDARD, + + //! Annotations are surrounded by a box. + AnnotationBoxed = ANNOTATION_BOXED, + + //! Annotations are indented to match the text. + AnnotationIndented = ANNOTATION_INDENTED, + }; + + //! This enum defines the behavior if an auto-completion list contains a + //! single entry. + enum AutoCompletionUseSingle { + //! The single entry is not used automatically and the auto-completion + //! list is displayed. + AcusNever, + + //! The single entry is used automatically when auto-completion is + //! explicitly requested (using autoCompleteFromAPIs() or + //! autoCompleteFromDocument()) but not when auto-completion is + //! triggered as the user types. + AcusExplicit, + + //! The single entry is used automatically and the auto-completion list + //! is not displayed. + AcusAlways + }; + + //! This enum defines the different sources for auto-completion lists. + enum AutoCompletionSource { + //! No sources are used, ie. automatic auto-completion is disabled. + AcsNone, + + //! The source is all available sources. + AcsAll, + + //! The source is the current document. + AcsDocument, + + //! The source is any installed APIs. + AcsAPIs + }; + + //! This enum defines the different brace matching modes. The character + //! pairs {}, [] and () are treated as braces. The Python lexer will also + //! match a : with the end of the corresponding indented block. + enum BraceMatch { + //! Brace matching is disabled. + NoBraceMatch, + + //! Brace matching is enabled for a brace immediately before the + //! current position. + StrictBraceMatch, + + //! Brace matching is enabled for a brace immediately before or after + //! the current position. + SloppyBraceMatch + }; + + //! This enum defines the different call tip positions. + enum CallTipsPosition { + //! Call tips are placed below the text. + CallTipsBelowText, + + //! Call tips are placed above the text. + CallTipsAboveText, + }; + + //! This enum defines the different call tip styles. + enum CallTipsStyle { + //! Call tips are disabled. + CallTipsNone, + + //! Call tips are displayed without a context. A context is any scope + //! (e.g. a C++ namespace or a Python module) prior to the function + //! name. + CallTipsNoContext, + + //! Call tips are displayed with a context only if the user hasn't + //! already implicitly identified the context using autocompletion. + //! Note that this style may not always be able to align the call tip + //! with the text being entered. + CallTipsNoAutoCompletionContext, + + //! Call tips are displayed with a context. Note that this style + //! may not always be able to align the call tip with the text being + //! entered. + CallTipsContext + }; + + //! This enum defines the different edge modes for long lines. + enum EdgeMode { + //! Long lines are not marked. + EdgeNone = EDGE_NONE, + + //! A vertical line is drawn at the column set by setEdgeColumn(). + //! This is recommended for monospace fonts. + EdgeLine = EDGE_LINE, + + //! The background color of characters after the column limit is + //! changed to the color set by setEdgeColor(). This is recommended + //! for proportional fonts. + EdgeBackground = EDGE_BACKGROUND + }; + + //! This enum defines the different end-of-line modes. + enum EolMode { + //! A carriage return/line feed as used on Windows systems. + EolWindows = SC_EOL_CRLF, + + //! A line feed as used on Unix systems, including OS/X. + EolUnix = SC_EOL_LF, + + //! A carriage return as used on Mac systems prior to OS/X. + EolMac = SC_EOL_CR + }; + + //! This enum defines the different styles for the folding margin. + enum FoldStyle { + //! Folding is disabled. + NoFoldStyle, + + //! Plain folding style using plus and minus symbols. + PlainFoldStyle, + + //! Circled folding style using circled plus and minus symbols. + CircledFoldStyle, + + //! Boxed folding style using boxed plus and minus symbols. + BoxedFoldStyle, + + //! Circled tree style using a flattened tree with circled plus and + //! minus symbols and rounded corners. + CircledTreeFoldStyle, + + //! Boxed tree style using a flattened tree with boxed plus and minus + //! symbols and right-angled corners. + BoxedTreeFoldStyle + }; + + //! This enum defines the different indicator styles. + enum IndicatorStyle { + //! A single straight underline. + PlainIndicator = INDIC_PLAIN, + + //! A squiggly underline that requires 3 pixels of descender space. + SquiggleIndicator = INDIC_SQUIGGLE, + + //! A line of small T shapes. + TTIndicator = INDIC_TT, + + //! Diagonal hatching. + DiagonalIndicator = INDIC_DIAGONAL, + + //! Strike out. + StrikeIndicator = INDIC_STRIKE, + + //! An indicator with no visual appearence. + HiddenIndicator = INDIC_HIDDEN, + + //! A rectangle around the text. + BoxIndicator = INDIC_BOX, + + //! A rectangle with rounded corners around the text with the interior + //! usually more transparent than the border. + RoundBoxIndicator = INDIC_ROUNDBOX, + + //! A rectangle around the text with the interior usually more + //! transparent than the border. It does not colour the top pixel of + //! the line so that indicators on contiguous lines are visually + //! distinct and disconnected. + StraightBoxIndicator = INDIC_STRAIGHTBOX, + + //! A rectangle around the text with the interior usually more + //! transparent than the border. Unlike StraightBoxIndicator it covers + //! the entire character area. + FullBoxIndicator = INDIC_FULLBOX, + + //! A dashed underline. + DashesIndicator = INDIC_DASH, + + //! A dotted underline. + DotsIndicator = INDIC_DOTS, + + //! A squiggly underline that requires 2 pixels of descender space and + //! so will fit under smaller fonts. + SquiggleLowIndicator = INDIC_SQUIGGLELOW, + + //! A dotted rectangle around the text with the interior usually more + //! transparent than the border. + DotBoxIndicator = INDIC_DOTBOX, + + //! A version of SquiggleIndicator that uses a pixmap. This is quicker + //! but may be of lower quality. + SquigglePixmapIndicator = INDIC_SQUIGGLEPIXMAP, + + //! A thick underline typically used for the target during Asian + //! language input composition. + ThickCompositionIndicator = INDIC_COMPOSITIONTHICK, + + //! A thin underline typically used for non-target ranges during Asian + //! language input composition. + ThinCompositionIndicator = INDIC_COMPOSITIONTHIN, + + //! The color of the text is set to the color of the indicator's + //! foreground. + TextColorIndicator = INDIC_TEXTFORE, + }; + + //! This enum defines the different margin options. + enum { + //! Reset all margin options. + MoNone = SC_MARGINOPTION_NONE, + + //! If this is set then only the first sub-line of a wrapped line will + //! be selected when clicking on a margin. + MoSublineSelect = SC_MARGINOPTION_SUBLINESELECT + }; + + //! This enum defines the different margin types. + enum MarginType { + //! The margin contains symbols, including those used for folding. + SymbolMargin = SC_MARGIN_SYMBOL, + + //! The margin contains symbols and uses the default foreground color + //! as its background color. + SymbolMarginDefaultForegroundColor = SC_MARGIN_FORE, + + //! The margin contains symbols and uses the default background color + //! as its background color. + SymbolMarginDefaultBackgroundColor = SC_MARGIN_BACK, + + //! The margin contains line numbers. + NumberMargin = SC_MARGIN_NUMBER, + + //! The margin contains styled text. + TextMargin = SC_MARGIN_TEXT, + + //! The margin contains right justified styled text. + TextMarginRightJustified = SC_MARGIN_RTEXT + }; + + //! This enum defines the different pre-defined marker symbols. + enum MarkerSymbol { + //! A circle. + Circle = SC_MARK_CIRCLE, + + //! A rectangle. + Rectangle = SC_MARK_ROUNDRECT, + + //! A triangle pointing to the right. + RightTriangle = SC_MARK_ARROW, + + //! A smaller rectangle. + SmallRectangle = SC_MARK_SMALLRECT, + + //! An arrow pointing to the right. + RightArrow = SC_MARK_SHORTARROW, + + //! An invisible marker that allows code to track the movement + //! of lines. + Invisible = SC_MARK_EMPTY, + + //! A triangle pointing down. + DownTriangle = SC_MARK_ARROWDOWN, + + //! A drawn minus sign. + Minus = SC_MARK_MINUS, + + //! A drawn plus sign. + Plus = SC_MARK_PLUS, + + //! A vertical line drawn in the background colour. + VerticalLine = SC_MARK_VLINE, + + //! A bottom left corner drawn in the background colour. + BottomLeftCorner = SC_MARK_LCORNER, + + //! A vertical line with a centre right horizontal line drawn + //! in the background colour. + LeftSideSplitter = SC_MARK_TCORNER, + + //! A drawn plus sign in a box. + BoxedPlus = SC_MARK_BOXPLUS, + + //! A drawn plus sign in a connected box. + BoxedPlusConnected = SC_MARK_BOXPLUSCONNECTED, + + //! A drawn minus sign in a box. + BoxedMinus = SC_MARK_BOXMINUS, + + //! A drawn minus sign in a connected box. + BoxedMinusConnected = SC_MARK_BOXMINUSCONNECTED, + + //! A rounded bottom left corner drawn in the background + //! colour. + RoundedBottomLeftCorner = SC_MARK_LCORNERCURVE, + + //! A vertical line with a centre right curved line drawn in the + //! background colour. + LeftSideRoundedSplitter = SC_MARK_TCORNERCURVE, + + //! A drawn plus sign in a circle. + CircledPlus = SC_MARK_CIRCLEPLUS, + + //! A drawn plus sign in a connected box. + CircledPlusConnected = SC_MARK_CIRCLEPLUSCONNECTED, + + //! A drawn minus sign in a circle. + CircledMinus = SC_MARK_CIRCLEMINUS, + + //! A drawn minus sign in a connected circle. + CircledMinusConnected = SC_MARK_CIRCLEMINUSCONNECTED, + + //! No symbol is drawn but the line is drawn with the same background + //! color as the marker's. + Background = SC_MARK_BACKGROUND, + + //! Three drawn dots. + ThreeDots = SC_MARK_DOTDOTDOT, + + //! Three drawn arrows pointing right. + ThreeRightArrows = SC_MARK_ARROWS, + + //! A full rectangle (ie. the margin background) using the marker's + //! background color. + FullRectangle = SC_MARK_FULLRECT, + + //! A left rectangle (ie. the left part of the margin background) using + //! the marker's background color. + LeftRectangle = SC_MARK_LEFTRECT, + + //! No symbol is drawn but the line is drawn underlined using the + //! marker's background color. + Underline = SC_MARK_UNDERLINE, + + //! A bookmark. + Bookmark = SC_MARK_BOOKMARK, + }; + + //! This enum defines the different whitespace visibility modes. When + //! whitespace is visible spaces are displayed as small centred dots and + //! tabs are displayed as light arrows pointing to the right. + enum WhitespaceVisibility { + //! Whitespace is invisible. + WsInvisible = SCWS_INVISIBLE, + + //! Whitespace is always visible. + WsVisible = SCWS_VISIBLEALWAYS, + + //! Whitespace is visible after the whitespace used for indentation. + WsVisibleAfterIndent = SCWS_VISIBLEAFTERINDENT + }; + + //! This enum defines the different line wrap modes. + enum WrapMode { + //! Lines are not wrapped. + WrapNone = SC_WRAP_NONE, + + //! Lines are wrapped at word boundaries. + WrapWord = SC_WRAP_WORD, + + //! Lines are wrapped at character boundaries. + WrapCharacter = SC_WRAP_CHAR, + + //! Lines are wrapped at whitespace boundaries. + WrapWhitespace = SC_WRAP_WHITESPACE, + }; + + //! This enum defines the different line wrap visual flags. + enum WrapVisualFlag { + //! No wrap flag is displayed. + WrapFlagNone, + + //! A wrap flag is displayed by the text. + WrapFlagByText, + + //! A wrap flag is displayed by the border. + WrapFlagByBorder, + + //! A wrap flag is displayed in the line number margin. + WrapFlagInMargin + }; + + //! This enum defines the different line wrap indentation modes. + enum WrapIndentMode { + //! Wrapped sub-lines are indented by the amount set by + //! setWrapVisualFlags(). + WrapIndentFixed = SC_WRAPINDENT_FIXED, + + //! Wrapped sub-lines are indented by the same amount as the first + //! sub-line. + WrapIndentSame = SC_WRAPINDENT_SAME, + + //! Wrapped sub-lines are indented by the same amount as the first + //! sub-line plus one more level of indentation. + WrapIndentIndented = SC_WRAPINDENT_INDENT + }; + + //! Construct an empty QsciScintilla with parent \a parent. + QsciScintilla(QWidget *parent = 0); + + //! Destroys the QsciScintilla instance. + virtual ~QsciScintilla(); + + //! Returns the API context, which is a list of words, before the position + //! \a pos in the document. The context can be used by auto-completion and + //! call tips to help to identify which API call the user is referring to. + //! In the default implementation the current lexer determines what + //! characters make up a word, and what characters determine the boundaries + //! of words (ie. the start characters). If there is no current lexer then + //! the context will consist of a single word. On return \a context_start + //! will contain the position in the document of the start of the context + //! and \a last_word_start will contain the position in the document of the + //! start of the last word of the context. + virtual QStringList apiContext(int pos, int &context_start, + int &last_word_start); + + //! Annotate the line \a line with the text \a text using the style number + //! \a style. + void annotate(int line, const QString &text, int style); + + //! Annotate the line \a line with the text \a text using the style \a + //! style. + void annotate(int line, const QString &text, const QsciStyle &style); + + //! Annotate the line \a line with the styled text \a text. + void annotate(int line, const QsciStyledText &text); + + //! Annotate the line \a line with the list of styled text \a text. + void annotate(int line, const QList &text); + + //! Returns the annotation on line \a line, if any. + QString annotation(int line) const; + + //! Returns the display style for annotations. + //! + //! \sa setAnnotationDisplay() + AnnotationDisplay annotationDisplay() const; + + //! The annotations on line \a line are removed. If \a line is negative + //! then all annotations are removed. + void clearAnnotations(int line = -1); + + //! Returns true if auto-completion lists are case sensitive. + //! + //! \sa setAutoCompletionCaseSensitivity() + bool autoCompletionCaseSensitivity() const; + + //! Returns true if auto-completion fill-up characters are enabled. + //! + //! \sa setAutoCompletionFillups(), setAutoCompletionFillupsEnabled() + bool autoCompletionFillupsEnabled() const; + + //! Returns true if the rest of the word to the right of the current cursor + //! is removed when an item from an auto-completion list is selected. + //! + //! \sa setAutoCompletionReplaceWord() + bool autoCompletionReplaceWord() const; + + //! Returns true if the only item in an auto-completion list with a single + //! entry is automatically used and the list not displayed. Note that this + //! is deprecated and autoCompletionUseSingle() should be used instead. + //! + //! \sa setAutoCompletionShowSingle() + bool autoCompletionShowSingle() const; + + //! Returns the current source for the auto-completion list when it is + //! being displayed automatically as the user types. + //! + //! \sa setAutoCompletionSource() + AutoCompletionSource autoCompletionSource() const {return acSource;} + + //! Returns the current threshold for the automatic display of the + //! auto-completion list as the user types. + //! + //! \sa setAutoCompletionThreshold() + int autoCompletionThreshold() const {return acThresh;} + + //! Returns the current behavior when an auto-completion list contains a + //! single entry. + //! + //! \sa setAutoCompletionUseSingle() + AutoCompletionUseSingle autoCompletionUseSingle() const; + + //! Returns true if auto-indentation is enabled. + //! + //! \sa setAutoIndent() + bool autoIndent() const {return autoInd;} + + //! Returns true if the backspace key unindents a line instead of deleting + //! a character. The default is false. + //! + //! \sa setBackspaceUnindents(), tabIndents(), setTabIndents() + bool backspaceUnindents() const; + + //! Mark the beginning of a sequence of actions that can be undone by a + //! single call to undo(). + //! + //! \sa endUndoAction(), undo() + void beginUndoAction(); + + //! Returns the brace matching mode. + //! + //! \sa setBraceMatching() + BraceMatch braceMatching() const {return braceMode;} + + //! Returns the current call tip position. + //! + //! \sa setCallTipsPosition() + CallTipsPosition callTipsPosition() const {return call_tips_position;} + + //! Returns the current call tip style. + //! + //! \sa setCallTipsStyle() + CallTipsStyle callTipsStyle() const {return call_tips_style;} + + //! Returns the maximum number of call tips that are displayed. + //! + //! \sa setCallTipsVisible() + int callTipsVisible() const {return maxCallTips;} + + //! Cancel any current auto-completion or user defined list. + void cancelList(); + + //! Returns true if the current language lexer is case sensitive. If there + //! is no current lexer then true is returned. + bool caseSensitive() const; + + //! Clear all current folds, i.e. ensure that all lines are displayed + //! unfolded. + //! + //! \sa setFolding() + void clearFolds(); + + //! Clears the range of text with indicator \a indicatorNumber starting at + //! position \a indexFrom in line \a lineFrom and finishing at position + //! \a indexTo in line \a lineTo. + //! + //! \sa fillIndicatorRange() + void clearIndicatorRange(int lineFrom, int indexFrom, int lineTo, + int indexTo, int indicatorNumber); + + //! Clear all registered images. + //! + //! \sa registerImage() + void clearRegisteredImages(); + + //! Returns the widget's text (ie. foreground) colour. + //! + //! \sa setColor() + QColor color() const; + + //! Returns a list of the line numbers that have contracted folds. This is + //! typically used to save the fold state of a document. + //! + //! \sa setContractedFolds() + QList contractedFolds() const; + + //! All the lines of the text have their end-of-lines converted to mode + //! \a mode. + //! + //! \sa eolMode(), setEolMode() + void convertEols(EolMode mode); + + //! Create the standard context menu which is shown when the user clicks + //! with the right mouse button. It is called from contextMenuEvent(). + //! The menu's ownership is transferred to the caller. + QMenu *createStandardContextMenu(); + + //! Returns the attached document. + //! + //! \sa setDocument() + QsciDocument document() const {return doc;} + + //! Mark the end of a sequence of actions that can be undone by a single + //! call to undo(). + //! + //! \sa beginUndoAction(), undo() + void endUndoAction(); + + //! Returns the color of the marker used to show that a line has exceeded + //! the length set by setEdgeColumn(). + //! + //! \sa setEdgeColor(), \sa setEdgeColumn + QColor edgeColor() const; + + //! Returns the number of the column after which lines are considered to be + //! long. + //! + //! \sa setEdgeColumn() + int edgeColumn() const; + + //! Returns the edge mode which determines how long lines are marked. + //! + //! \sa setEdgeMode() + EdgeMode edgeMode() const; + + //! Set the default font. This has no effect if a language lexer has been + //! set. + void setFont(const QFont &f); + + //! Returns the end-of-line mode. + //! + //! \sa setEolMode() + EolMode eolMode() const; + + //! Returns the visibility of end-of-lines. + //! + //! \sa setEolVisibility() + bool eolVisibility() const; + + //! Returns the extra space added to the height of a line above the + //! baseline of the text. + //! + //! \sa setExtraAscent(), extraDescent() + int extraAscent() const; + + //! Returns the extra space added to the height of a line below the + //! baseline of the text. + //! + //! \sa setExtraDescent(), extraAscent() + int extraDescent() const; + + //! Fills the range of text with indicator \a indicatorNumber starting at + //! position \a indexFrom in line \a lineFrom and finishing at position + //! \a indexTo in line \a lineTo. + //! + //! \sa clearIndicatorRange() + void fillIndicatorRange(int lineFrom, int indexFrom, int lineTo, + int indexTo, int indicatorNumber); + + //! Find the first occurrence of the string \a expr and return true if + //! \a expr was found, otherwise returns false. If \a expr is found it + //! becomes the current selection. + //! + //! If \a re is true then \a expr is interpreted as a regular expression + //! rather than a simple string. + //! + //! If \a cs is true then the search is case sensitive. + //! + //! If \a wo is true then the search looks for whole word matches only, + //! otherwise it searches for any matching text. + //! + //! If \a wrap is true then the search wraps around the end of the text. + //! + //! If \a forward is true (the default) then the search is forward from the + //! starting position to the end of the text, otherwise it is backwards to + //! the beginning of the text. + //! + //! If either \a line or \a index are negative (the default) then the + //! search begins from the current cursor position. Otherwise the search + //! begins at position \a index of line \a line. + //! + //! If \a show is true (the default) then any text found is made visible + //! (ie. it is unfolded). + //! + //! If \a posix is true then a regular expression is treated in a more + //! POSIX compatible manner by interpreting bare ( and ) as tagged sections + //! rather than \( and \). + //! + //! \sa findFirstInSelection(), findNext(), replace() + virtual bool findFirst(const QString &expr, bool re, bool cs, bool wo, + bool wrap, bool forward = true, int line = -1, int index = -1, + bool show = true, bool posix = false); + + //! Find the first occurrence of the string \a expr in the current + //! selection and return true if \a expr was found, otherwise returns + //! false. If \a expr is found it becomes the current selection. The + //! original selection is restored when a subsequent call to findNext() + //! returns false. + //! + //! If \a re is true then \a expr is interpreted as a regular expression + //! rather than a simple string. + //! + //! If \a cs is true then the search is case sensitive. + //! + //! If \a wo is true then the search looks for whole word matches only, + //! otherwise it searches for any matching text. + //! + //! If \a forward is true (the default) then the search is forward from the + //! start to the end of the selection, otherwise it is backwards from the + //! end to the start of the selection. + //! + //! If \a show is true (the default) then any text found is made visible + //! (ie. it is unfolded). + //! + //! If \a posix is true then a regular expression is treated in a more + //! POSIX compatible manner by interpreting bare ( and ) as tagged sections + //! rather than \( and \). + //! + //! \sa findFirstInSelection(), findNext(), replace() + virtual bool findFirstInSelection(const QString &expr, bool re, bool cs, + bool wo, bool forward = true, bool show = true, + bool posix = false); + + //! Find the next occurence of the string found using findFirst() or + //! findFirstInSelection(). + //! + //! \sa findFirst(), findFirstInSelection(), replace() + virtual bool findNext(); + + //! Returns the number of the first visible line. + //! + //! \sa setFirstVisibleLine() + int firstVisibleLine() const; + + //! Returns the current folding style. + //! + //! \sa setFolding() + FoldStyle folding() const {return fold;} + + //! Sets \a *line and \a *index to the line and index of the cursor. + //! + //! \sa setCursorPosition() + void getCursorPosition(int *line, int *index) const; + + //! If there is a selection, \a *lineFrom is set to the line number in + //! which the selection begins and \a *lineTo is set to the line number in + //! which the selection ends. (They could be the same.) \a *indexFrom is + //! set to the index at which the selection begins within \a *lineFrom, and + //! \a *indexTo is set to the index at which the selection ends within + //! \a *lineTo. If there is no selection, \a *lineFrom, \a *indexFrom, + //! \a *lineTo and \a *indexTo are all set to -1. + //! + //! \sa setSelection() + void getSelection(int *lineFrom, int *indexFrom, int *lineTo, + int *indexTo) const; + + //! Returns true if some text is selected. + //! + //! \sa selectedText() + bool hasSelectedText() const {return selText;} + + //! Returns the number of characters that line \a line is indented by. + //! + //! \sa setIndentation() + int indentation(int line) const; + + //! Returns true if the display of indentation guides is enabled. + //! + //! \sa setIndentationGuides() + bool indentationGuides() const; + + //! Returns true if indentations are created using tabs and spaces, rather + //! than just spaces. The default is true. + //! + //! \sa setIndentationsUseTabs() + bool indentationsUseTabs() const; + + //! Returns the indentation width in characters. The default is 0 which + //! means that the value returned by tabWidth() is actually used. + //! + //! \sa setIndentationWidth(), tabWidth() + int indentationWidth() const; + + //! Define a type of indicator using the style \a style with the indicator + //! number \a indicatorNumber. If \a indicatorNumber is -1 then the + //! indicator number is automatically allocated. The indicator number is + //! returned or -1 if too many types of indicator have been defined. + //! + //! Indicators are used to display additional information over the top of + //! styling. They can be used to show, for example, syntax errors, + //! deprecated names and bad indentation by drawing lines under text or + //! boxes around text. + //! + //! There may be up to 32 types of indicator defined at a time. The first + //! 8 are normally used by lexers. By default indicator number 0 is a + //! dark green SquiggleIndicator, 1 is a blue TTIndicator, and 2 is a red + //! PlainIndicator. + int indicatorDefine(IndicatorStyle style, int indicatorNumber = -1); + + //! Returns true if the indicator \a indicatorNumber is drawn under the + //! text (i.e. in the background). The default is false. + //! + //! \sa setIndicatorDrawUnder() + bool indicatorDrawUnder(int indicatorNumber) const; + + //! Returns true if a call tip is currently active. + bool isCallTipActive() const; + + //! Returns true if an auto-completion or user defined list is currently + //! active. + bool isListActive() const; + + //! Returns true if the text has been modified. + //! + //! \sa setModified(), modificationChanged() + bool isModified() const; + + //! Returns true if the text edit is read-only. + //! + //! \sa setReadOnly() + bool isReadOnly() const; + + //! Returns true if there is something that can be redone. + //! + //! \sa redo() + bool isRedoAvailable() const; + + //! Returns true if there is something that can be undone. + //! + //! \sa undo() + bool isUndoAvailable() const; + + //! Returns true if text is interpreted as being UTF8 encoded. The default + //! is to interpret the text as Latin1 encoded. + //! + //! \sa setUtf8() + bool isUtf8() const; + + //! Returns true if character \a ch is a valid word character. + //! + //! \sa wordCharacters() + bool isWordCharacter(char ch) const; + + //! Returns the line which is at \a point pixel coordinates or -1 if there + //! is no line at that point. + int lineAt(const QPoint &point) const; + + //! QScintilla uses the combination of a line number and a character index + //! from the start of that line to specify the position of a character + //! within the text. The underlying Scintilla instead uses a byte index + //! from the start of the text. This will convert the \a position byte + //! index to the \a *line line number and \a *index character index. + //! + //! \sa positionFromLineIndex() + void lineIndexFromPosition(int position, int *line, int *index) const; + + //! Returns the length of line \a line int bytes or -1 if there is no such + //! line. In order to get the length in characters use text(line).length(). + int lineLength(int line) const; + + //! Returns the number of lines of text. + int lines() const; + + //! Returns the length of the text edit's text in bytes. In order to get + //! the length in characters use text().length(). + int length() const; + + //! Returns the current language lexer used to style text. If it is 0 then + //! syntax styling is disabled. + //! + //! \sa setLexer() + QsciLexer *lexer() const; + + //! Returns true if line numbers are enabled for margin \a margin. + //! + //! \sa setMarginLineNumbers(), marginType(), SCI_GETMARGINTYPEN + bool marginLineNumbers(int margin) const; + + //! Returns the marker mask of margin \a margin. + //! + //! \sa setMarginMask(), QsciMarker, SCI_GETMARGINMASKN + int marginMarkerMask(int margin) const; + + //! Returns the margin options. The default is MoNone. + //! + //! \sa setMarginOptions(), MoNone, MoSublineSelect. + int marginOptions() const; + + //! Returns true if margin \a margin is sensitive to mouse clicks. + //! + //! \sa setMarginSensitivity(), marginClicked(), SCI_GETMARGINTYPEN + bool marginSensitivity(int margin) const; + + //! Returns the type of margin \a margin. + //! + //! \sa setMarginType(), SCI_GETMARGINTYPEN + MarginType marginType(int margin) const; + + //! Returns the width in pixels of margin \a margin. + //! + //! \sa setMarginWidth(), SCI_GETMARGINWIDTHN + int marginWidth(int margin) const; + + //! Define a type of marker using the symbol \a sym with the marker number + //! \a markerNumber. If \a markerNumber is -1 then the marker number is + //! automatically allocated. The marker number is returned or -1 if too + //! many types of marker have been defined. + //! + //! Markers are small geometric symbols and characters used, for example, + //! to indicate the current line or, in debuggers, to indicate breakpoints. + //! If a margin has a width of 0 then its markers are not drawn, but their + //! background colours affect the background colour of the corresponding + //! line of text. + //! + //! There may be up to 32 types of marker defined at a time and each line + //! of text has a set of marker instances associated with it. Markers are + //! drawn according to their numerical identifier. Markers try to move + //! with their text by tracking where the start of their line moves to. + //! For example, when a line is deleted its markers are added to previous + //! line's markers. + //! + //! Each marker type is identified by a marker number. Each instance of a + //! marker is identified by a marker handle. + int markerDefine(MarkerSymbol sym, int markerNumber = -1); + + //! Define a marker using the character \a ch with the marker number + //! \a markerNumber. If \a markerNumber is -1 then the marker number is + //! automatically allocated. The marker number is returned or -1 if too + //! many markers have been defined. + int markerDefine(char ch, int markerNumber = -1); + + //! Define a marker using a copy of the pixmap \a pm with the marker number + //! \a markerNumber. If \a markerNumber is -1 then the marker number is + //! automatically allocated. The marker number is returned or -1 if too + //! many markers have been defined. + int markerDefine(const QPixmap &pm, int markerNumber = -1); + + //! Define a marker using a copy of the image \a im with the marker number + //! \a markerNumber. If \a markerNumber is -1 then the marker number is + //! automatically allocated. The marker number is returned or -1 if too + //! many markers have been defined. + int markerDefine(const QImage &im, int markerNumber = -1); + + //! Add an instance of marker number \a markerNumber to line number + //! \a linenr. A handle for the marker is returned which can be used to + //! track the marker's position, or -1 if the \a markerNumber was invalid. + //! + //! \sa markerDelete(), markerDeleteAll(), markerDeleteHandle() + int markerAdd(int linenr, int markerNumber); + + //! Returns the 32 bit mask of marker numbers at line number \a linenr. + //! + //! \sa markerAdd() + unsigned markersAtLine(int linenr) const; + + //! Delete all markers with the marker number \a markerNumber in the line + //! \a linenr. If \a markerNumber is -1 then delete all markers from line + //! \a linenr. + //! + //! \sa markerAdd(), markerDeleteAll(), markerDeleteHandle() + void markerDelete(int linenr, int markerNumber = -1); + + //! Delete the all markers with the marker number \a markerNumber. If + //! \a markerNumber is -1 then delete all markers. + //! + //! \sa markerAdd(), markerDelete(), markerDeleteHandle() + void markerDeleteAll(int markerNumber = -1); + + //! Delete the the marker instance with the marker handle \a mhandle. + //! + //! \sa markerAdd(), markerDelete(), markerDeleteAll() + void markerDeleteHandle(int mhandle); + + //! Return the line number that contains the marker instance with the + //! marker handle \a mhandle. + int markerLine(int mhandle) const; + + //! Return the number of the next line to contain at least one marker from + //! a 32 bit mask of markers. \a linenr is the line number to start the + //! search from. \a mask is the mask of markers to search for. + //! + //! \sa markerFindPrevious() + int markerFindNext(int linenr, unsigned mask) const; + + //! Return the number of the previous line to contain at least one marker + //! from a 32 bit mask of markers. \a linenr is the line number to start + //! the search from. \a mask is the mask of markers to search for. + //! + //! \sa markerFindNext() + int markerFindPrevious(int linenr, unsigned mask) const; + + //! Returns true if text entered by the user will overwrite existing text. + //! + //! \sa setOverwriteMode() + bool overwriteMode() const; + + //! Returns the widget's paper (ie. background) colour. + //! + //! \sa setPaper() + QColor paper() const; + + //! QScintilla uses the combination of a line number and a character index + //! from the start of that line to specify the position of a character + //! within the text. The underlying Scintilla instead uses a byte index + //! from the start of the text. This will return the byte index + //! corresponding to the \a line line number and \a index character index. + //! + //! \sa lineIndexFromPosition() + int positionFromLineIndex(int line, int index) const; + + //! Reads the current document from the \a io device and returns true if + //! there was no error. + //! + //! \sa write() + bool read(QIODevice *io); + + //! Recolours the document between the \a start and \a end positions. + //! \a start defaults to the start of the document and \a end defaults to + //! the end of the document. + virtual void recolor(int start = 0, int end = -1); + + //! Register an image \a pm with ID \a id. Registered images can be + //! displayed in auto-completion lists. + //! + //! \sa clearRegisteredImages(), QsciLexer::apiLoad() + void registerImage(int id, const QPixmap &pm); + + //! Register an image \a im with ID \a id. Registered images can be + //! displayed in auto-completion lists. + //! + //! \sa clearRegisteredImages(), QsciLexer::apiLoad() + void registerImage(int id, const QImage &im); + + //! Replace the current selection, set by a previous call to findFirst(), + //! findFirstInSelection() or findNext(), with \a replaceStr. + //! + //! \sa findFirst(), findFirstInSelection(), findNext() + virtual void replace(const QString &replaceStr); + + //! Reset the fold margin colours to their defaults. + //! + //! \sa setFoldMarginColors() + void resetFoldMarginColors(); + + //! Resets the background colour of an active hotspot area to the default. + //! + //! \sa setHotspotBackgroundColor(), resetHotspotForegroundColor() + void resetHotspotBackgroundColor(); + + //! Resets the foreground colour of an active hotspot area to the default. + //! + //! \sa setHotspotForegroundColor(), resetHotspotBackgroundColor() + void resetHotspotForegroundColor(); + + //! The fold margin may be drawn as a one pixel sized checkerboard pattern + //! of two colours, \a fore and \a back. + //! + //! \sa resetFoldMarginColors() + void setFoldMarginColors(const QColor &fore, const QColor &back); + + //! Set the display style for annotations. The default is + //! AnnotationStandard. + //! + //! \sa annotationDisplay() + void setAnnotationDisplay(AnnotationDisplay display); + + //! Enable the use of fill-up characters, either those explicitly set or + //! those set by a lexer. By default, fill-up characters are disabled. + //! + //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillups() + void setAutoCompletionFillupsEnabled(bool enabled); + + //! A fill-up character is one that, when entered while an auto-completion + //! list is being displayed, causes the currently selected item from the + //! list to be added to the text followed by the fill-up character. + //! \a fillups is the set of fill-up characters. If a language lexer has + //! been set then this is ignored and the lexer defines the fill-up + //! characters. The default is that no fill-up characters are set. + //! + //! \sa autoCompletionFillupsEnabled(), setAutoCompletionFillupsEnabled() + void setAutoCompletionFillups(const char *fillups); + + //! A word separator is a sequence of characters that, when entered, causes + //! the auto-completion list to be displayed. If a language lexer has been + //! set then this is ignored and the lexer defines the word separators. + //! The default is that no word separators are set. + //! + //! \sa setAutoCompletionThreshold() + void setAutoCompletionWordSeparators(const QStringList &separators); + + //! Set the background colour of call tips to \a col. The default is + //! white. + void setCallTipsBackgroundColor(const QColor &col); + + //! Set the foreground colour of call tips to \a col. The default is + //! mid-gray. + void setCallTipsForegroundColor(const QColor &col); + + //! Set the highlighted colour of call tip text to \a col. The default is + //! dark blue. + void setCallTipsHighlightColor(const QColor &col); + + //! Set the current call tip position. The default is CallTipsBelowText. + //! + //! \sa callTipsPosition() + void setCallTipsPosition(CallTipsPosition position); + + //! Set the current call tip style. The default is CallTipsNoContext. + //! + //! \sa callTipsStyle() + void setCallTipsStyle(CallTipsStyle style); + + //! Set the maximum number of call tips that are displayed to \a nr. If + //! the maximum number is 0 then all applicable call tips are displayed. + //! If the maximum number is -1 then one call tip will be displayed with up + //! and down arrows that allow the use to scroll through the full list. + //! The default is -1. + //! + //! \sa callTipsVisible() + void setCallTipsVisible(int nr); + + //! Sets each line in the \a folds list of line numbers to be a contracted + //! fold. This is typically used to restore the fold state of a document. + //! + //! \sa contractedFolds() + void setContractedFolds(const QList &folds); + + //! Attach the document \a document, replacing the currently attached + //! document. + //! + //! \sa document() + void setDocument(const QsciDocument &document); + + //! Set the color of the marker used to show that a line has exceeded the + //! length set by setEdgeColumn(). + //! + //! \sa edgeColor(), \sa setEdgeColumn + void setEdgeColor(const QColor &col); + + //! Set the number of the column after which lines are considered to be + //! long. + //! + //! \sa edgeColumn() + void setEdgeColumn(int colnr); + + //! Set the edge mode which determines how long lines are marked. + //! + //! \sa edgeMode() + void setEdgeMode(EdgeMode mode); + + //! Set the number of the first visible line to \a linenr. + //! + //! \sa firstVisibleLine() + void setFirstVisibleLine(int linenr); + + //! Enables or disables, according to \a under, if the indicator + //! \a indicatorNumber is drawn under or over the text (i.e. in the + //! background or foreground). If \a indicatorNumber is -1 then the state + //! of all indicators is set. + //! + //! \sa indicatorDrawUnder() + void setIndicatorDrawUnder(bool under, int indicatorNumber = -1); + + //! Set the foreground colour of indicator \a indicatorNumber to \a col. + //! If \a indicatorNumber is -1 then the colour of all indicators is set. + void setIndicatorForegroundColor(const QColor &col, int indicatorNumber = -1); + + //! Set the foreground colour of indicator \a indicatorNumber to \a col + //! when the mouse is over it or the caret moved into it. If + //! \a indicatorNumber is -1 then the colour of all indicators is set. + void setIndicatorHoverForegroundColor(const QColor &col, int indicatorNumber = -1); + + //! Set the style of indicator \a indicatorNumber to \a style when the + //! mouse is over it or the caret moved into it. If \a indicatorNumber is + //! -1 then the style of all indicators is set. + void setIndicatorHoverStyle(IndicatorStyle style, int indicatorNumber = -1); + + //! Set the outline colour of indicator \a indicatorNumber to \a col. + //! If \a indicatorNumber is -1 then the colour of all indicators is set. + //! At the moment only the alpha value of the colour has any affect. + void setIndicatorOutlineColor(const QColor &col, int indicatorNumber = -1); + + //! Set the margin options to \a options. + //! + //! \sa marginOptions(), MoNone, MoSublineSelect. + void setMarginOptions(int options); + + //! Set the margin text of line \a line with the text \a text using the + //! style number \a style. + void setMarginText(int line, const QString &text, int style); + + //! Set the margin text of line \a line with the text \a text using the + //! style \a style. + void setMarginText(int line, const QString &text, const QsciStyle &style); + + //! Set the margin text of line \a line with the styled text \a text. + void setMarginText(int line, const QsciStyledText &text); + + //! Set the margin text of line \a line with the list of styled text \a + //! text. + void setMarginText(int line, const QList &text); + + //! Set the type of margin \a margin to type \a type. + //! + //! \sa marginType(), SCI_SETMARGINTYPEN + void setMarginType(int margin, MarginType type); + + //! The margin text on line \a line is removed. If \a line is negative + //! then all margin text is removed. + void clearMarginText(int line = -1); + + //! Set the background colour, including the alpha component, of marker + //! \a markerNumber to \a col. If \a markerNumber is -1 then the colour of + //! all markers is set. The default is white. + //! + //! \sa setMarkerForegroundColor() + void setMarkerBackgroundColor(const QColor &col, int markerNumber = -1); + + //! Set the foreground colour of marker \a markerNumber to \a col. If + //! \a markerNumber is -1 then the colour of all markers is set. The + //! default is black. + //! + //! \sa setMarkerBackgroundColor() + void setMarkerForegroundColor(const QColor &col, int markerNumber = -1); + + //! Set the background colour used to display matched braces to \a col. It + //! is ignored if an indicator is being used. The default is white. + //! + //! \sa setMatchedBraceForegroundColor(), setMatchedBraceIndicator() + void setMatchedBraceBackgroundColor(const QColor &col); + + //! Set the foreground colour used to display matched braces to \a col. It + //! is ignored if an indicator is being used. The default is red. + //! + //! \sa setMatchedBraceBackgroundColor(), setMatchedBraceIndicator() + void setMatchedBraceForegroundColor(const QColor &col); + + //! Set the indicator used to display matched braces to \a indicatorNumber. + //! The default is not to use an indicator. + //! + //! \sa resetMatchedBraceIndicator(), setMatchedBraceBackgroundColor() + void setMatchedBraceIndicator(int indicatorNumber); + + //! Stop using an indicator to display matched braces. + //! + //! \sa setMatchedBraceIndicator() + void resetMatchedBraceIndicator(); + + //! Set the background colour used to display unmatched braces to \a col. + //! It is ignored if an indicator is being used. The default is white. + //! + //! \sa setUnmatchedBraceForegroundColor(), setUnmatchedBraceIndicator() + void setUnmatchedBraceBackgroundColor(const QColor &col); + + //! Set the foreground colour used to display unmatched braces to \a col. + //! It is ignored if an indicator is being used. The default is blue. + //! + //! \sa setUnmatchedBraceBackgroundColor(), setUnmatchedBraceIndicator() + void setUnmatchedBraceForegroundColor(const QColor &col); + + //! Set the indicator used to display unmatched braces to + //! \a indicatorNumber. The default is not to use an indicator. + //! + //! \sa resetUnmatchedBraceIndicator(), setUnmatchedBraceBackgroundColor() + void setUnmatchedBraceIndicator(int indicatorNumber); + + //! Stop using an indicator to display unmatched braces. + //! + //! \sa setUnmatchedBraceIndicator() + void resetUnmatchedBraceIndicator(); + + //! Set the visual flags displayed when a line is wrapped. \a endFlag + //! determines if and where the flag at the end of a line is displayed. + //! \a startFlag determines if and where the flag at the start of a line is + //! displayed. \a indent is the number of characters a wrapped line is + //! indented by. By default no visual flags are displayed. + void setWrapVisualFlags(WrapVisualFlag endFlag, + WrapVisualFlag startFlag = WrapFlagNone, int indent = 0); + + //! Returns the selected text or an empty string if there is no currently + //! selected text. + //! + //! \sa hasSelectedText() + QString selectedText() const; + + //! Returns whether or not the selection is drawn up to the right hand + //! border. + //! + //! \sa setSelectionToEol() + bool selectionToEol() const; + + //! Sets the background colour of an active hotspot area to \a col. + //! + //! \sa resetHotspotBackgroundColor(), setHotspotForegroundColor() + void setHotspotBackgroundColor(const QColor &col); + + //! Sets the foreground colour of an active hotspot area to \a col. + //! + //! \sa resetHotspotForegroundColor(), setHotspotBackgroundColor() + void setHotspotForegroundColor(const QColor &col); + + //! Enables or disables, according to \a enable, the underlining of an + //! active hotspot area. The default is false. + void setHotspotUnderline(bool enable); + + //! Enables or disables, according to \a enable, the wrapping of a hotspot + //! area to following lines. The default is true. + void setHotspotWrap(bool enable); + + //! Sets whether or not the selection is drawn up to the right hand border. + //! \a filled is set if the selection is drawn to the border. + //! + //! \sa selectionToEol() + void setSelectionToEol(bool filled); + + //! Sets the extra space added to the height of a line above the baseline + //! of the text to \a extra. + //! + //! \sa extraAscent(), setExtraDescent() + void setExtraAscent(int extra); + + //! Sets the extra space added to the height of a line below the baseline + //! of the text to \a extra. + //! + //! \sa extraDescent(), setExtraAscent() + void setExtraDescent(int extra); + + //! Text entered by the user will overwrite existing text if \a overwrite + //! is true. + //! + //! \sa overwriteMode() + void setOverwriteMode(bool overwrite); + + //! Sets the background colour of visible whitespace to \a col. If \a col + //! is an invalid color (the default) then the color specified by the + //! current lexer is used. + void setWhitespaceBackgroundColor(const QColor &col); + + //! Sets the foreground colour of visible whitespace to \a col. If \a col + //! is an invalid color (the default) then the color specified by the + //! current lexer is used. + void setWhitespaceForegroundColor(const QColor &col); + + //! Sets the size of the dots used to represent visible whitespace. + //! + //! \sa whitespaceSize() + void setWhitespaceSize(int size); + + //! Sets the line wrap indentation mode to \a mode. The default is + //! WrapIndentFixed. + //! + //! \sa wrapIndentMode() + void setWrapIndentMode(WrapIndentMode mode); + + //! Displays a user defined list which can be interacted with like an + //! auto-completion list. \a id is an identifier for the list which is + //! passed as an argument to the userListActivated() signal and must be at + //! least 1. \a list is the text with which the list is populated. + //! + //! \sa cancelList(), isListActive(), userListActivated() + void showUserList(int id, const QStringList &list); + + //! The standard command set is returned. + QsciCommandSet *standardCommands() const {return stdCmds;} + + //! Returns true if the tab key indents a line instead of inserting a tab + //! character. The default is true. + //! + //! \sa setTabIndents(), backspaceUnindents(), setBackspaceUnindents() + bool tabIndents() const; + + //! Returns the tab width in characters. The default is 8. + //! + //! \sa setTabWidth() + int tabWidth() const; + + //! Returns the text of the current document. + //! + //! \sa setText() + QString text() const; + + //! \overload + //! + //! Returns the text of line \a line. + //! + //! \sa setText() + QString text(int line) const; + + //! Returns the height in pixels of the text in line number \a linenr. + int textHeight(int linenr) const; + + //! Returns the size of the dots used to represent visible whitespace. + //! + //! \sa setWhitespaceSize() + int whitespaceSize() const; + + //! Returns the visibility of whitespace. + //! + //! \sa setWhitespaceVisibility() + WhitespaceVisibility whitespaceVisibility() const; + + //! Returns the word at the \a line line number and \a index character + //! index. + QString wordAtLineIndex(int line, int index) const; + + //! Returns the word at the \a point pixel coordinates. + QString wordAtPoint(const QPoint &point) const; + + //! Returns the set of valid word character as defined by the current + //! language lexer. If there is no current lexer then the set contains an + //! an underscore, numbers and all upper and lower case alphabetic + //! characters. + //! + //! \sa isWordCharacter() + const char *wordCharacters() const; + + //! Returns the line wrap mode. + //! + //! \sa setWrapMode() + WrapMode wrapMode() const; + + //! Returns the line wrap indentation mode. + //! + //! \sa setWrapIndentMode() + WrapIndentMode wrapIndentMode() const; + + //! Writes the current document to the \a io device and returns true if + //! there was no error. + //! + //! \sa read() + bool write(QIODevice *io) const; + +public slots: + //! Appends the text \a text to the end of the text edit. Note that the + //! undo/redo history is cleared by this function. + virtual void append(const QString &text); + + //! Display an auto-completion list based on any installed APIs, the + //! current contents of the document and the characters immediately to the + //! left of the cursor. + //! + //! \sa autoCompleteFromAPIs(), autoCompleteFromDocument() + virtual void autoCompleteFromAll(); + + //! Display an auto-completion list based on any installed APIs and the + //! characters immediately to the left of the cursor. + //! + //! \sa autoCompleteFromAll(), autoCompleteFromDocument(), + //! setAutoCompletionAPIs() + virtual void autoCompleteFromAPIs(); + + //! Display an auto-completion list based on the current contents of the + //! document and the characters immediately to the left of the cursor. + //! + //! \sa autoCompleteFromAll(), autoCompleteFromAPIs() + virtual void autoCompleteFromDocument(); + + //! Display a call tip based on the the characters immediately to the left + //! of the cursor. + virtual void callTip(); + + //! Deletes all the text in the text edit. + virtual void clear(); + + //! Copies any selected text to the clipboard. + //! + //! \sa copyAvailable(), cut(), paste() + virtual void copy(); + + //! Copies any selected text to the clipboard and then deletes the text. + //! + //! \sa copy(), paste() + virtual void cut(); + + //! Ensures that the cursor is visible. + virtual void ensureCursorVisible(); + + //! Ensures that the line number \a line is visible. + virtual void ensureLineVisible(int line); + + //! If any lines are currently folded then they are all unfolded. + //! Otherwise all lines are folded. This has the same effect as clicking + //! in the fold margin with the shift and control keys pressed. If + //! \a children is not set (the default) then only the top level fold + //! points are affected, otherwise the state of all fold points are + //! changed. + virtual void foldAll(bool children = false); + + //! If the line \a line is folded then it is unfolded. Otherwise it is + //! folded. This has the same effect as clicking in the fold margin. + virtual void foldLine(int line); + + //! Increases the indentation of line \a line by an indentation width. + //! + //! \sa unindent() + virtual void indent(int line); + + //! Insert the text \a text at the current position. + virtual void insert(const QString &text); + + //! Insert the text \a text in the line \a line at the position + //! \a index. + virtual void insertAt(const QString &text, int line, int index); + + //! If the cursor is either side of a brace character then move it to the + //! position of the corresponding brace. + virtual void moveToMatchingBrace(); + + //! Pastes any text from the clipboard into the text edit at the current + //! cursor position. + //! + //! \sa copy(), cut() + virtual void paste(); + + //! Redo the last change or sequence of changes. + //! + //! \sa isRedoAvailable() + virtual void redo(); + + //! Removes any selected text. + //! + //! \sa replaceSelectedText() + virtual void removeSelectedText(); + + //! Replaces any selected text with \a text. + //! + //! \sa removeSelectedText() + virtual void replaceSelectedText(const QString &text); + + //! Resets the background colour of selected text to the default. + //! + //! \sa setSelectionBackgroundColor(), resetSelectionForegroundColor() + virtual void resetSelectionBackgroundColor(); + + //! Resets the foreground colour of selected text to the default. + //! + //! \sa setSelectionForegroundColor(), resetSelectionBackgroundColor() + virtual void resetSelectionForegroundColor(); + + //! If \a select is true (the default) then all the text is selected. If + //! \a select is false then any currently selected text is deselected. + virtual void selectAll(bool select = true); + + //! If the cursor is either side of a brace character then move it to the + //! position of the corresponding brace and select the text between the + //! braces. + virtual void selectToMatchingBrace(); + + //! If \a cs is true then auto-completion lists are case sensitive. The + //! default is true. Note that setting a lexer may change the case + //! sensitivity. + //! + //! \sa autoCompletionCaseSensitivity() + virtual void setAutoCompletionCaseSensitivity(bool cs); + + //! If \a replace is true then when an item from an auto-completion list is + //! selected, the rest of the word to the right of the current cursor is + //! removed. The default is false. + //! + //! \sa autoCompletionReplaceWord() + virtual void setAutoCompletionReplaceWord(bool replace); + + //! If \a single is true then when there is only a single entry in an + //! auto-completion list it is automatically used and the list is not + //! displayed. This only has an effect when auto-completion is explicitly + //! requested (using autoCompleteFromAPIs() and autoCompleteFromDocument()) + //! and has no effect when auto-completion is triggered as the user types. + //! The default is false. Note that this is deprecated and + //! setAutoCompletionUseSingle() should be used instead. + //! + //! \sa autoCompletionShowSingle() + virtual void setAutoCompletionShowSingle(bool single); + + //! Sets the source for the auto-completion list when it is being displayed + //! automatically as the user types to \a source. The default is AcsNone, + //! ie. it is disabled. + //! + //! \sa autoCompletionSource() + virtual void setAutoCompletionSource(AutoCompletionSource source); + + //! Sets the threshold for the automatic display of the auto-completion + //! list as the user types to \a thresh. The threshold is the number of + //! characters that the user must type before the list is displayed. If + //! the threshold is less than or equal to 0 then the list is disabled. + //! The default is -1. + //! + //! \sa autoCompletionThreshold(), setAutoCompletionWordSeparators() + virtual void setAutoCompletionThreshold(int thresh); + + //! Sets the behavior of the auto-completion list when it has a single + //! entry. The default is AcusNever. + //! + //! \sa autoCompletionUseSingle() + virtual void setAutoCompletionUseSingle(AutoCompletionUseSingle single); + + //! If \a autoindent is true then auto-indentation is enabled. The default + //! is false. + //! + //! \sa autoIndent() + virtual void setAutoIndent(bool autoindent); + + //! Sets the brace matching mode to \a bm. The default is NoBraceMatching. + //! + //! \sa braceMatching() + virtual void setBraceMatching(BraceMatch bm); + + //! If \a deindent is true then the backspace key will unindent a line + //! rather then delete a character. + //! + //! \sa backspaceUnindents(), tabIndents(), setTabIndents() + virtual void setBackspaceUnindents(bool unindent); + + //! Sets the foreground colour of the caret to \a col. + virtual void setCaretForegroundColor(const QColor &col); + + //! Sets the background colour, including the alpha component, of the line + //! containing the caret to \a col. + //! + //! \sa setCaretLineVisible() + virtual void setCaretLineBackgroundColor(const QColor &col); + + //! Enables or disables, according to \a enable, the background color of + //! the line containing the caret. + //! + //! \sa setCaretLineBackgroundColor() + virtual void setCaretLineVisible(bool enable); + + //! Sets the width of the caret to \a width pixels. A \a width of 0 makes + //! the caret invisible. + virtual void setCaretWidth(int width); + + //! The widget's text (ie. foreground) colour is set to \a c. This has no + //! effect if a language lexer has been set. + //! + //! \sa color() + virtual void setColor(const QColor &c); + + //! Sets the cursor to the line \a line at the position \a index. + //! + //! \sa getCursorPosition() + virtual void setCursorPosition(int line, int index); + + //! Sets the end-of-line mode to \a mode. The default is the platform's + //! natural mode. + //! + //! \sa eolMode() + virtual void setEolMode(EolMode mode); + + //! If \a visible is true then end-of-lines are made visible. The default + //! is that they are invisible. + //! + //! \sa eolVisibility() + virtual void setEolVisibility(bool visible); + + //! Sets the folding style for margin \a margin to \a fold. The default + //! style is NoFoldStyle (ie. folding is disabled) and the default margin + //! is 2. + //! + //! \sa folding() + virtual void setFolding(FoldStyle fold, int margin = 2); + + //! Sets the indentation of line \a line to \a indentation characters. + //! + //! \sa indentation() + virtual void setIndentation(int line, int indentation); + + //! Enables or disables, according to \a enable, this display of + //! indentation guides. + //! + //! \sa indentationGuides() + virtual void setIndentationGuides(bool enable); + + //! Set the background colour of indentation guides to \a col. + //! + //! \sa setIndentationGuidesForegroundColor() + virtual void setIndentationGuidesBackgroundColor(const QColor &col); + + //! Set the foreground colour of indentation guides to \a col. + //! + //! \sa setIndentationGuidesBackgroundColor() + virtual void setIndentationGuidesForegroundColor(const QColor &col); + + //! If \a tabs is true then indentations are created using tabs and spaces, + //! rather than just spaces. + //! + //! \sa indentationsUseTabs() + virtual void setIndentationsUseTabs(bool tabs); + + //! Sets the indentation width to \a width characters. If \a width is 0 + //! then the value returned by tabWidth() is used. + //! + //! \sa indentationWidth(), tabWidth() + virtual void setIndentationWidth(int width); + + //! Sets the specific language lexer used to style text to \a lex. If + //! \a lex is 0 then syntax styling is disabled. + //! + //! \sa lexer() + virtual void setLexer(QsciLexer *lexer = 0); + + //! Set the background colour of all margins to \a col. The default is a + //! gray. + //! + //! \sa setMarginsForegroundColor() + virtual void setMarginsBackgroundColor(const QColor &col); + + //! Set the font used in all margins to \a f. + virtual void setMarginsFont(const QFont &f); + + //! Set the foreground colour of all margins to \a col. The default is + //! black. + //! + //! \sa setMarginsBackgroundColor() + virtual void setMarginsForegroundColor(const QColor &col); + + //! Enables or disables, according to \a lnrs, the display of line numbers + //! in margin \a margin. + //! + //! \sa marginLineNumbers(), setMarginType(), SCI_SETMARGINTYPEN + virtual void setMarginLineNumbers(int margin, bool lnrs); + + //! Sets the marker mask of margin \a margin to \a mask. Only those + //! markers whose bit is set in the mask are displayed in the margin. + //! + //! \sa marginMarkerMask(), QsciMarker, SCI_SETMARGINMASKN + virtual void setMarginMarkerMask(int margin, int mask); + + //! Enables or disables, according to \a sens, the sensitivity of margin + //! \a margin to mouse clicks. If the user clicks in a sensitive margin + //! the marginClicked() signal is emitted. + //! + //! \sa marginSensitivity(), marginClicked(), SCI_SETMARGINSENSITIVEN + virtual void setMarginSensitivity(int margin, bool sens); + + //! Sets the width of margin \a margin to \a width pixels. If the width of + //! a margin is 0 then it is not displayed. + //! + //! \sa marginWidth(), SCI_SETMARGINWIDTHN + virtual void setMarginWidth(int margin, int width); + + //! Sets the width of margin \a margin so that it is wide enough to display + //! \a s in the current margin font. + //! + //! \sa marginWidth(), SCI_SETMARGINWIDTHN + virtual void setMarginWidth(int margin, const QString &s); + + //! Sets the modified state of the text edit to \a m. Note that it is only + //! possible to clear the modified state (where \a m is false). Attempts + //! to set the modified state (where \a m is true) are ignored. + //! + //! \sa isModified(), modificationChanged() + virtual void setModified(bool m); + + //! The widget's paper (ie. background) colour is set to \a c. This has no + //! effect if a language lexer has been set. + //! + //! \sa paper() + virtual void setPaper(const QColor &c); + + //! Sets the read-only state of the text edit to \a ro. + //! + //! \sa isReadOnly() + virtual void setReadOnly(bool ro); + + //! Sets the selection which starts at position \a indexFrom in line + //! \a lineFrom and ends at position \a indexTo in line \a lineTo. The + //! cursor is moved to position \a indexTo in \a lineTo. + //! + //! \sa getSelection() + virtual void setSelection(int lineFrom, int indexFrom, int lineTo, + int indexTo); + + //! Sets the background colour, including the alpha component, of selected + //! text to \a col. + //! + //! \sa resetSelectionBackgroundColor(), setSelectionForegroundColor() + virtual void setSelectionBackgroundColor(const QColor &col); + + //! Sets the foreground colour of selected text to \a col. + //! + //! \sa resetSelectionForegroundColor(), setSelectionBackgroundColor() + virtual void setSelectionForegroundColor(const QColor &col); + + //! If \a indent is true then the tab key will indent a line rather than + //! insert a tab character. + //! + //! \sa tabIndents(), backspaceUnindents(), setBackspaceUnindents() + virtual void setTabIndents(bool indent); + + //! Sets the tab width to \a width characters. + //! + //! \sa tabWidth() + virtual void setTabWidth(int width); + + //! Replaces all of the current text with \a text. Note that the + //! undo/redo history is cleared by this function. + //! + //! \sa text() + virtual void setText(const QString &text); + + //! Sets the current text encoding. If \a cp is true then UTF8 is used, + //! otherwise Latin1 is used. + //! + //! \sa isUtf8() + virtual void setUtf8(bool cp); + + //! Sets the visibility of whitespace to mode \a mode. The default is that + //! whitespace is invisible. + //! + //! \sa whitespaceVisibility() + virtual void setWhitespaceVisibility(WhitespaceVisibility mode); + + //! Sets the line wrap mode to \a mode. The default is that lines are not + //! wrapped. + //! + //! \sa wrapMode() + virtual void setWrapMode(WrapMode mode); + + //! Undo the last change or sequence of changes. + //! + //! Scintilla has multiple level undo and redo. It will continue to record + //! undoable actions until memory runs out. Sequences of typing or + //! deleting are compressed into single actions to make it easier to undo + //! and redo at a sensible level of detail. Sequences of actions can be + //! combined into actions that are undone as a unit. These sequences occur + //! between calls to beginUndoAction() and endUndoAction(). These + //! sequences can be nested and only the top level sequences are undone as + //! units. + //! + //! \sa beginUndoAction(), endUndoAction(), isUndoAvailable() + virtual void undo(); + + //! Decreases the indentation of line \a line by an indentation width. + //! + //! \sa indent() + virtual void unindent(int line); + + //! Zooms in on the text by by making the base font size \a range points + //! larger and recalculating all font sizes. + //! + //! \sa zoomOut(), zoomTo() + virtual void zoomIn(int range); + + //! \overload + //! + //! Zooms in on the text by by making the base font size one point larger + //! and recalculating all font sizes. + virtual void zoomIn(); + + //! Zooms out on the text by by making the base font size \a range points + //! smaller and recalculating all font sizes. + //! + //! \sa zoomIn(), zoomTo() + virtual void zoomOut(int range); + + //! \overload + //! + //! Zooms out on the text by by making the base font size one point larger + //! and recalculating all font sizes. + virtual void zoomOut(); + + //! Zooms the text by making the base font size \a size points and + //! recalculating all font sizes. + //! + //! \sa zoomIn(), zoomOut() + virtual void zoomTo(int size); + +signals: + //! This signal is emitted whenever the cursor position changes. \a line + //! contains the line number and \a index contains the character index + //! within the line. + void cursorPositionChanged(int line, int index); + + //! This signal is emitted whenever text is selected or de-selected. + //! \a yes is true if text has been selected and false if text has been + //! deselected. If \a yes is true then copy() can be used to copy the + //! selection to the clipboard. If \a yes is false then copy() does + //! nothing. + //! + //! \sa copy(), selectionChanged() + void copyAvailable(bool yes); + + //! This signal is emitted whenever the user clicks on an indicator. \a + //! line is the number of the line where the user clicked. \a index is the + //! character index within the line. \a state is the state of the modifier + //! keys (Qt::ShiftModifier, Qt::ControlModifier, Qt::AltModifer and + //! Qt::MetaModifier) when the user clicked. + //! + //! \sa indicatorReleased() + void indicatorClicked(int line, int index, Qt::KeyboardModifiers state); + + //! This signal is emitted whenever the user releases the mouse on an + //! indicator. \a line is the number of the line where the user clicked. + //! \a index is the character index within the line. \a state is the state + //! of the modifier keys (Qt::ShiftModifier, Qt::ControlModifier, + //! Qt::AltModifer and Qt::MetaModifier) when the user released the mouse. + //! + //! \sa indicatorClicked() + void indicatorReleased(int line, int index, Qt::KeyboardModifiers state); + + //! This signal is emitted whenever the number of lines of text changes. + void linesChanged(); + + //! This signal is emitted whenever the user clicks on a sensitive margin. + //! \a margin is the margin. \a line is the number of the line where the + //! user clicked. \a state is the state of the modifier keys + //! (Qt::ShiftModifier, Qt::ControlModifier, Qt::AltModifer and + //! Qt::MetaModifier) when the user clicked. + //! + //! \sa marginSensitivity(), setMarginSensitivity() + void marginClicked(int margin, int line, Qt::KeyboardModifiers state); + + //! This signal is emitted whenever the user attempts to modify read-only + //! text. + //! + //! \sa isReadOnly(), setReadOnly() + void modificationAttempted(); + + //! This signal is emitted whenever the modification state of the text + //! changes. \a m is true if the text has been modified. + //! + //! \sa isModified(), setModified() + void modificationChanged(bool m); + + //! This signal is emitted whenever the selection changes. + //! + //! \sa copyAvailable() + void selectionChanged(); + + //! This signal is emitted whenever the text in the text edit changes. + void textChanged(); + + //! This signal is emitted when an item in a user defined list is activated + //! (selected). \a id is the list identifier. \a string is the text of + //! the item. + //! + //! \sa showUserList() + void userListActivated(int id, const QString &string); + +protected: + //! \reimp + virtual bool event(QEvent *e); + + //! \reimp + virtual void changeEvent(QEvent *e); + + //! \reimp + virtual void contextMenuEvent(QContextMenuEvent *e); + +private slots: + void handleCallTipClick(int dir); + void handleCharAdded(int charadded); + void handleIndicatorClick(int pos, int modifiers); + void handleIndicatorRelease(int pos, int modifiers); + void handleMarginClick(int pos, int margin, int modifiers); + void handleModified(int pos, int mtype, const char *text, int len, + int added, int line, int foldNow, int foldPrev, int token, + int annotationLinesAdded); + void handlePropertyChange(const char *prop, const char *val); + void handleSavePointReached(); + void handleSavePointLeft(); + void handleSelectionChanged(bool yes); + void handleAutoCompletionSelection(); + void handleUserListSelection(const char *text, int id); + + void handleStyleColorChange(const QColor &c, int style); + void handleStyleEolFillChange(bool eolfill, int style); + void handleStyleFontChange(const QFont &f, int style); + void handleStylePaperChange(const QColor &c, int style); + + void handleUpdateUI(int updated); + + void delete_selection(); + +private: + void detachLexer(); + + enum IndentState { + isNone, + isKeywordStart, + isBlockStart, + isBlockEnd + }; + + void maintainIndentation(char ch, long pos); + void autoIndentation(char ch, long pos); + void autoIndentLine(long pos, int line, int indent); + int blockIndent(int line); + IndentState getIndentState(int line); + bool rangeIsWhitespace(long spos, long epos); + int findStyledWord(const char *text, int style, const char *words); + + void checkMarker(int &markerNumber); + void checkIndicator(int &indicatorNumber); + static void allocateId(int &id, unsigned &allocated, int min, int max); + int currentIndent() const; + int indentWidth() const; + bool doFind(); + int simpleFind(); + void foldClick(int lineClick, int bstate); + void foldChanged(int line, int levelNow, int levelPrev); + void foldExpand(int &line, bool doExpand, bool force = false, + int visLevels = 0, int level = -1); + void setFoldMarker(int marknr, int mark = SC_MARK_EMPTY); + void setLexerStyle(int style); + void setStylesFont(const QFont &f, int style); + void setEnabledColors(int style, QColor &fore, QColor &back); + + void braceMatch(); + bool findMatchingBrace(long &brace, long &other, BraceMatch mode); + long checkBrace(long pos, int brace_style, bool &colonMode); + void gotoMatchingBrace(bool select); + + void startAutoCompletion(AutoCompletionSource acs, bool checkThresh, + bool choose_single); + + int adjustedCallTipPosition(int ctshift) const; + bool getSeparator(int &pos) const; + QString getWord(int &pos) const; + char getCharacter(int &pos) const; + bool isStartChar(char ch) const; + + bool ensureRW(); + void insertAtPos(const QString &text, int pos); + static int mapModifiers(int modifiers); + + QString wordAtPosition(int position) const; + + ScintillaBytes styleText(const QList &styled_text, + char **styles, int style_offset = 0); + + struct FindState + { + enum Status + { + Finding, + FindingInSelection, + Idle + }; + + FindState() : status(Idle) {} + + Status status; + QString expr; + bool wrap; + bool forward; + int flags; + long startpos, startpos_orig; + long endpos, endpos_orig; + bool show; + }; + + FindState findState; + + unsigned allocatedMarkers; + unsigned allocatedIndicators; + int oldPos; + int ctPos; + bool selText; + FoldStyle fold; + int foldmargin; + bool autoInd; + BraceMatch braceMode; + AutoCompletionSource acSource; + int acThresh; + QStringList wseps; + const char *wchars; + CallTipsPosition call_tips_position; + CallTipsStyle call_tips_style; + int maxCallTips; + QStringList ct_entries; + int ct_cursor; + QList ct_shifts; + AutoCompletionUseSingle use_single; + QPointer lex; + QsciCommandSet *stdCmds; + QsciDocument doc; + QColor nl_text_colour; + QColor nl_paper_colour; + QByteArray explicit_fillups; + bool fillups_enabled; + + // The following allow QsciListBoxQt to distinguish between an + // auto-completion list and a user list, and to return the full selection + // of an auto-completion list. + friend class QsciListBoxQt; + + QString acSelection; + bool isAutoCompletionList() const; + + void set_shortcut(QAction *action, QsciCommand::Command cmd_id) const; + + QsciScintilla(const QsciScintilla &); + QsciScintilla &operator=(const QsciScintilla &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qsciscintillabase.h b/libs/qscintilla/Qt4Qt5/Qsci/qsciscintillabase.h new file mode 100644 index 000000000..f0f165987 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qsciscintillabase.h @@ -0,0 +1,3621 @@ +// This class defines the "official" low-level API. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCISCINTILLABASE_H +#define QSCISCINTILLABASE_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include + +#include +#include +#include +#include + +#include + + +QT_BEGIN_NAMESPACE +class QColor; +class QImage; +class QMimeData; +class QPainter; +class QPixmap; +QT_END_NAMESPACE + +class QsciScintillaQt; + + +//! \brief The QsciScintillaBase class implements the Scintilla editor widget +//! and its low-level API. +//! +//! Scintilla (http://www.scintilla.org) is a powerful C++ editor class that +//! supports many features including syntax styling, error indicators, code +//! completion and call tips. It is particularly useful as a programmer's +//! editor. +//! +//! QsciScintillaBase is a port to Qt of Scintilla. It implements the standard +//! Scintilla API which consists of a number of messages each taking up to +//! two arguments. +//! +//! See QsciScintilla for the implementation of a higher level API that is more +//! consistent with the rest of the Qt toolkit. +class QSCINTILLA_EXPORT QsciScintillaBase : public QAbstractScrollArea +{ + Q_OBJECT + +public: + //! The low-level Scintilla API is implemented as a set of messages each of + //! which takes up to two parameters (\a wParam and \a lParam) and + //! optionally return a value. This enum defines all the possible messages. + enum + { + //! + SCI_START = 2000, + + //! + SCI_OPTIONAL_START = 3000, + + //! + SCI_LEXER_START = 4000, + + //! This message appends some text to the end of the document. + //! \a wParam is the length of the text. + //! \a lParam is the text to be appended. + SCI_ADDTEXT = 2001, + + //! + SCI_ADDSTYLEDTEXT = 2002, + + //! + SCI_INSERTTEXT = 2003, + + //! + SCI_CLEARALL = 2004, + + //! + SCI_CLEARDOCUMENTSTYLE = 2005, + + //! + SCI_GETLENGTH = 2006, + + //! + SCI_GETCHARAT = 2007, + + //! This message returns the current position. + //! + //! \sa SCI_SETCURRENTPOS + SCI_GETCURRENTPOS = 2008, + + //! This message returns the anchor. + //! + //! \sa SCI_SETANCHOR + SCI_GETANCHOR = 2009, + + //! + SCI_GETSTYLEAT = 2010, + + //! + SCI_REDO = 2011, + + //! + SCI_SETUNDOCOLLECTION = 2012, + + //! + SCI_SELECTALL = 2013, + + //! This message marks the current state of the text as the the save + //! point. This is usually done when the text is saved or loaded. + //! + //! \sa SCN_SAVEPOINTREACHED(), SCN_SAVEPOINTLEFT() + SCI_SETSAVEPOINT = 2014, + + //! + SCI_GETSTYLEDTEXT = 2015, + + //! + SCI_CANREDO = 2016, + + //! This message returns the line that contains a particular instance + //! of a marker. + //! \a wParam is the handle of the marker. + //! + //! \sa SCI_MARKERADD + SCI_MARKERLINEFROMHANDLE = 2017, + + //! This message removes a particular instance of a marker. + //! \a wParam is the handle of the marker. + //! + //! \sa SCI_MARKERADD + SCI_MARKERDELETEHANDLE = 2018, + + //! + SCI_GETUNDOCOLLECTION = 2019, + + //! + SCI_GETVIEWWS = 2020, + + //! + SCI_SETVIEWWS = 2021, + + //! + SCI_POSITIONFROMPOINT = 2022, + + //! + SCI_POSITIONFROMPOINTCLOSE = 2023, + + //! + SCI_GOTOLINE = 2024, + + //! This message clears the current selection and sets the current + //! position. + //! \a wParam is the new current position. + //! + //! \sa SCI_SETCURRENTPOS + SCI_GOTOPOS = 2025, + + //! This message sets the anchor. + //! \a wParam is the new anchor. + //! + //! \sa SCI_GETANCHOR + SCI_SETANCHOR = 2026, + + //! + SCI_GETCURLINE = 2027, + + //! This message returns the character position of the start of the + //! text that needs to be syntax styled. + //! + //! \sa SCN_STYLENEEDED() + SCI_GETENDSTYLED = 2028, + + //! + SCI_CONVERTEOLS = 2029, + + //! + SCI_GETEOLMODE = 2030, + + //! + SCI_SETEOLMODE = 2031, + + //! + SCI_STARTSTYLING = 2032, + + //! + SCI_SETSTYLING = 2033, + + //! + SCI_GETBUFFEREDDRAW = 2034, + + //! + SCI_SETBUFFEREDDRAW = 2035, + + //! + SCI_SETTABWIDTH = 2036, + + //! + SCI_GETTABWIDTH = 2121, + + //! + SCI_SETCODEPAGE = 2037, + + //! This message sets the symbol used to draw one of 32 markers. Some + //! markers have pre-defined uses, see the SC_MARKNUM_* values. + //! \a wParam is the number of the marker. + //! \a lParam is the marker symbol and is one of the SC_MARK_* values. + //! + //! \sa SCI_MARKERADD, SCI_MARKERDEFINEPIXMAP, + //! SCI_MARKERDEFINERGBAIMAGE + SCI_MARKERDEFINE = 2040, + + //! This message sets the foreground colour used to draw a marker. A + //! colour is represented as a 24 bit value. The 8 least significant + //! bits correspond to red, the middle 8 bits correspond to green, and + //! the 8 most significant bits correspond to blue. The default value + //! is 0x000000. + //! \a wParam is the number of the marker. + //! \a lParam is the colour. + //! + //! \sa SCI_MARKERSETBACK + SCI_MARKERSETFORE = 2041, + + //! This message sets the background colour used to draw a marker. A + //! colour is represented as a 24 bit value. The 8 least significant + //! bits correspond to red, the middle 8 bits correspond to green, and + //! the 8 most significant bits correspond to blue. The default value + //! is 0xffffff. + //! \a wParam is the number of the marker. + //! \a lParam is the colour. + //! + //! \sa SCI_MARKERSETFORE + SCI_MARKERSETBACK = 2042, + + //! This message adds a marker to a line. A handle for the marker is + //! returned which can be used to track the marker's position. + //! \a wParam is the line number. + //! \a lParam is the number of the marker. + //! + //! \sa SCI_MARKERDELETE, SCI_MARKERDELETEALL, + //! SCI_MARKERDELETEHANDLE + SCI_MARKERADD = 2043, + + //! This message deletes a marker from a line. + //! \a wParam is the line number. + //! \a lParam is the number of the marker. + //! + //! \sa SCI_MARKERADD, SCI_MARKERDELETEALL + SCI_MARKERDELETE = 2044, + + //! This message deletes all occurences of a marker. + //! \a wParam is the number of the marker. If \a wParam is -1 then all + //! markers are removed. + //! + //! \sa SCI_MARKERADD, SCI_MARKERDELETE + SCI_MARKERDELETEALL = 2045, + + //! This message returns the 32 bit mask of markers at a line. + //! \a wParam is the line number. + SCI_MARKERGET = 2046, + + //! This message looks for the next line to contain at least one marker + //! contained in a 32 bit mask of markers and returns the line number. + //! \a wParam is the line number to start the search from. + //! \a lParam is the mask of markers to search for. + //! + //! \sa SCI_MARKERPREVIOUS + SCI_MARKERNEXT = 2047, + + //! This message looks for the previous line to contain at least one + //! marker contained in a 32 bit mask of markers and returns the line + //! number. + //! \a wParam is the line number to start the search from. + //! \a lParam is the mask of markers to search for. + //! + //! \sa SCI_MARKERNEXT + SCI_MARKERPREVIOUS = 2048, + + //! This message sets the symbol used to draw one of the 32 markers to + //! a pixmap. Pixmaps use the SC_MARK_PIXMAP marker symbol. + //! \a wParam is the number of the marker. + //! \a lParam is a pointer to a QPixmap instance. Note that in other + //! ports of Scintilla this is a pointer to either raw or textual XPM + //! image data. + //! + //! \sa SCI_MARKERDEFINE, SCI_MARKERDEFINERGBAIMAGE + SCI_MARKERDEFINEPIXMAP = 2049, + + //! This message sets what can be displayed in a margin. + //! \a wParam is the number of the margin. + //! \a lParam is the logical or of the SC_MARGIN_* values. + //! + //! \sa SCI_GETMARGINTYPEN + SCI_SETMARGINTYPEN = 2240, + + //! This message returns what can be displayed in a margin. + //! \a wParam is the number of the margin. + //! + //! \sa SCI_SETMARGINTYPEN + SCI_GETMARGINTYPEN = 2241, + + //! This message sets the width of a margin in pixels. + //! \a wParam is the number of the margin. + //! \a lParam is the new margin width. + //! + //! \sa SCI_GETMARGINWIDTHN + SCI_SETMARGINWIDTHN = 2242, + + //! This message returns the width of a margin in pixels. + //! \a wParam is the number of the margin. + //! + //! \sa SCI_SETMARGINWIDTHN + SCI_GETMARGINWIDTHN = 2243, + + //! This message sets the mask of a margin. The mask is a 32 value + //! with one bit for each possible marker. If a bit is set then the + //! corresponding marker is displayed. By default, all markers are + //! displayed. + //! \a wParam is the number of the margin. + //! \a lParam is the new margin mask. + //! + //! \sa SCI_GETMARGINMASKN, SCI_MARKERDEFINE + SCI_SETMARGINMASKN = 2244, + + //! This message returns the mask of a margin. + //! \a wParam is the number of the margin. + //! + //! \sa SCI_SETMARGINMASKN + SCI_GETMARGINMASKN = 2245, + + //! This message sets the sensitivity of a margin to mouse clicks. + //! \a wParam is the number of the margin. + //! \a lParam is non-zero to make the margin sensitive to mouse clicks. + //! When the mouse is clicked the SCN_MARGINCLICK() signal is emitted. + //! + //! \sa SCI_GETMARGINSENSITIVEN, SCN_MARGINCLICK() + SCI_SETMARGINSENSITIVEN = 2246, + + //! This message returns the sensitivity of a margin to mouse clicks. + //! \a wParam is the number of the margin. + //! + //! \sa SCI_SETMARGINSENSITIVEN, SCN_MARGINCLICK() + SCI_GETMARGINSENSITIVEN = 2247, + + //! This message sets the cursor shape displayed over a margin. + //! \a wParam is the number of the margin. + //! \a lParam is the cursor shape, normally either SC_CURSORARROW or + //! SC_CURSORREVERSEARROW. Note that, currently, QScintilla implements + //! both of these as Qt::ArrowCursor. + //! + //! \sa SCI_GETMARGINCURSORN + SCI_SETMARGINCURSORN = 2248, + + //! This message returns the cursor shape displayed over a margin. + //! \a wParam is the number of the margin. + //! + //! \sa SCI_SETMARGINCURSORN + SCI_GETMARGINCURSORN = 2249, + + //! + SCI_STYLECLEARALL = 2050, + + //! + SCI_STYLESETFORE = 2051, + + //! + SCI_STYLESETBACK = 2052, + + //! + SCI_STYLESETBOLD = 2053, + + //! + SCI_STYLESETITALIC = 2054, + + //! + SCI_STYLESETSIZE = 2055, + + //! + SCI_STYLESETFONT = 2056, + + //! + SCI_STYLESETEOLFILLED = 2057, + + //! + SCI_STYLERESETDEFAULT = 2058, + + //! + SCI_STYLESETUNDERLINE = 2059, + + //! + SCI_STYLESETCASE = 2060, + + //! + SCI_STYLESETSIZEFRACTIONAL = 2061, + + //! + SCI_STYLEGETSIZEFRACTIONAL = 2062, + + //! + SCI_STYLESETWEIGHT = 2063, + + //! + SCI_STYLEGETWEIGHT = 2064, + + //! + SCI_STYLESETCHARACTERSET = 2066, + + //! + SCI_SETSELFORE = 2067, + + //! + SCI_SETSELBACK = 2068, + + //! + SCI_SETCARETFORE = 2069, + + //! + SCI_ASSIGNCMDKEY = 2070, + + //! + SCI_CLEARCMDKEY = 2071, + + //! + SCI_CLEARALLCMDKEYS = 2072, + + //! + SCI_SETSTYLINGEX = 2073, + + //! + SCI_STYLESETVISIBLE = 2074, + + //! + SCI_GETCARETPERIOD = 2075, + + //! + SCI_SETCARETPERIOD = 2076, + + //! + SCI_SETWORDCHARS = 2077, + + //! + SCI_BEGINUNDOACTION = 2078, + + //! + SCI_ENDUNDOACTION = 2079, + + //! + SCI_INDICSETSTYLE = 2080, + + //! + SCI_INDICGETSTYLE = 2081, + + //! + SCI_INDICSETFORE = 2082, + + //! + SCI_INDICGETFORE = 2083, + + //! + SCI_SETWHITESPACEFORE = 2084, + + //! + SCI_SETWHITESPACEBACK = 2085, + + //! + SCI_SETWHITESPACESIZE = 2086, + + //! + SCI_GETWHITESPACESIZE = 2087, + + //! + SCI_SETSTYLEBITS = 2090, + + //! + SCI_GETSTYLEBITS = 2091, + + //! + SCI_SETLINESTATE = 2092, + + //! + SCI_GETLINESTATE = 2093, + + //! + SCI_GETMAXLINESTATE = 2094, + + //! + SCI_GETCARETLINEVISIBLE = 2095, + + //! + SCI_SETCARETLINEVISIBLE = 2096, + + //! + SCI_GETCARETLINEBACK = 2097, + + //! + SCI_SETCARETLINEBACK = 2098, + + //! + SCI_STYLESETCHANGEABLE = 2099, + + //! + SCI_AUTOCSHOW = 2100, + + //! + SCI_AUTOCCANCEL = 2101, + + //! + SCI_AUTOCACTIVE = 2102, + + //! + SCI_AUTOCPOSSTART = 2103, + + //! + SCI_AUTOCCOMPLETE = 2104, + + //! + SCI_AUTOCSTOPS = 2105, + + //! + SCI_AUTOCSETSEPARATOR = 2106, + + //! + SCI_AUTOCGETSEPARATOR = 2107, + + //! + SCI_AUTOCSELECT = 2108, + + //! + SCI_AUTOCSETCANCELATSTART = 2110, + + //! + SCI_AUTOCGETCANCELATSTART = 2111, + + //! + SCI_AUTOCSETFILLUPS = 2112, + + //! + SCI_AUTOCSETCHOOSESINGLE = 2113, + + //! + SCI_AUTOCGETCHOOSESINGLE = 2114, + + //! + SCI_AUTOCSETIGNORECASE = 2115, + + //! + SCI_AUTOCGETIGNORECASE = 2116, + + //! + SCI_USERLISTSHOW = 2117, + + //! + SCI_AUTOCSETAUTOHIDE = 2118, + + //! + SCI_AUTOCGETAUTOHIDE = 2119, + + //! + SCI_AUTOCSETDROPRESTOFWORD = 2270, + + //! + SCI_AUTOCGETDROPRESTOFWORD = 2271, + + //! + SCI_SETINDENT = 2122, + + //! + SCI_GETINDENT = 2123, + + //! + SCI_SETUSETABS = 2124, + + //! + SCI_GETUSETABS = 2125, + + //! + SCI_SETLINEINDENTATION = 2126, + + //! + SCI_GETLINEINDENTATION = 2127, + + //! + SCI_GETLINEINDENTPOSITION = 2128, + + //! + SCI_GETCOLUMN = 2129, + + //! + SCI_SETHSCROLLBAR = 2130, + + //! + SCI_GETHSCROLLBAR = 2131, + + //! + SCI_SETINDENTATIONGUIDES = 2132, + + //! + SCI_GETINDENTATIONGUIDES = 2133, + + //! + SCI_SETHIGHLIGHTGUIDE = 2134, + + //! + SCI_GETHIGHLIGHTGUIDE = 2135, + + //! + SCI_GETLINEENDPOSITION = 2136, + + //! + SCI_GETCODEPAGE = 2137, + + //! + SCI_GETCARETFORE = 2138, + + //! This message returns a non-zero value if the document is read-only. + //! + //! \sa SCI_SETREADONLY + SCI_GETREADONLY = 2140, + + //! This message sets the current position. + //! \a wParam is the new current position. + //! + //! \sa SCI_GETCURRENTPOS + SCI_SETCURRENTPOS = 2141, + + //! + SCI_SETSELECTIONSTART = 2142, + + //! + SCI_GETSELECTIONSTART = 2143, + + //! + SCI_SETSELECTIONEND = 2144, + + //! + SCI_GETSELECTIONEND = 2145, + + //! + SCI_SETPRINTMAGNIFICATION = 2146, + + //! + SCI_GETPRINTMAGNIFICATION = 2147, + + //! + SCI_SETPRINTCOLOURMODE = 2148, + + //! + SCI_GETPRINTCOLOURMODE = 2149, + + //! + SCI_FINDTEXT = 2150, + + //! + SCI_FORMATRANGE = 2151, + + //! + SCI_GETFIRSTVISIBLELINE = 2152, + + //! + SCI_GETLINE = 2153, + + //! + SCI_GETLINECOUNT = 2154, + + //! + SCI_SETMARGINLEFT = 2155, + + //! + SCI_GETMARGINLEFT = 2156, + + //! + SCI_SETMARGINRIGHT = 2157, + + //! + SCI_GETMARGINRIGHT = 2158, + + //! This message returns a non-zero value if the document has been + //! modified. + SCI_GETMODIFY = 2159, + + //! + SCI_SETSEL = 2160, + + //! + SCI_GETSELTEXT = 2161, + + //! + SCI_GETTEXTRANGE = 2162, + + //! + SCI_HIDESELECTION = 2163, + + //! + SCI_POINTXFROMPOSITION = 2164, + + //! + SCI_POINTYFROMPOSITION = 2165, + + //! + SCI_LINEFROMPOSITION = 2166, + + //! + SCI_POSITIONFROMLINE = 2167, + + //! + SCI_LINESCROLL = 2168, + + //! + SCI_SCROLLCARET = 2169, + + //! + SCI_REPLACESEL = 2170, + + //! This message sets the read-only state of the document. + //! \a wParam is the new read-only state of the document. + //! + //! \sa SCI_GETREADONLY + SCI_SETREADONLY = 2171, + + //! + SCI_NULL = 2172, + + //! + SCI_CANPASTE = 2173, + + //! + SCI_CANUNDO = 2174, + + //! This message empties the undo buffer. + SCI_EMPTYUNDOBUFFER = 2175, + + //! + SCI_UNDO = 2176, + + //! + SCI_CUT = 2177, + + //! + SCI_COPY = 2178, + + //! + SCI_PASTE = 2179, + + //! + SCI_CLEAR = 2180, + + //! This message sets the text of the document. + //! \a wParam is unused. + //! \a lParam is the new text of the document. + //! + //! \sa SCI_GETTEXT + SCI_SETTEXT = 2181, + + //! This message gets the text of the document. + //! \a wParam is size of the buffer that the text is copied to. + //! \a lParam is the address of the buffer that the text is copied to. + //! + //! \sa SCI_SETTEXT + SCI_GETTEXT = 2182, + + //! This message returns the length of the document. + SCI_GETTEXTLENGTH = 2183, + + //! + SCI_GETDIRECTFUNCTION = 2184, + + //! + SCI_GETDIRECTPOINTER = 2185, + + //! + SCI_SETOVERTYPE = 2186, + + //! + SCI_GETOVERTYPE = 2187, + + //! + SCI_SETCARETWIDTH = 2188, + + //! + SCI_GETCARETWIDTH = 2189, + + //! + SCI_SETTARGETSTART = 2190, + + //! + SCI_GETTARGETSTART = 2191, + + //! + SCI_SETTARGETEND = 2192, + + //! + SCI_GETTARGETEND = 2193, + + //! + SCI_REPLACETARGET = 2194, + + //! + SCI_REPLACETARGETRE = 2195, + + //! + SCI_SEARCHINTARGET = 2197, + + //! + SCI_SETSEARCHFLAGS = 2198, + + //! + SCI_GETSEARCHFLAGS = 2199, + + //! + SCI_CALLTIPSHOW = 2200, + + //! + SCI_CALLTIPCANCEL = 2201, + + //! + SCI_CALLTIPACTIVE = 2202, + + //! + SCI_CALLTIPPOSSTART = 2203, + + //! + SCI_CALLTIPSETHLT = 2204, + + //! + SCI_CALLTIPSETBACK = 2205, + + //! + SCI_CALLTIPSETFORE = 2206, + + //! + SCI_CALLTIPSETFOREHLT = 2207, + + //! + SCI_AUTOCSETMAXWIDTH = 2208, + + //! + SCI_AUTOCGETMAXWIDTH = 2209, + + //! This message is not implemented. + SCI_AUTOCSETMAXHEIGHT = 2210, + + //! + SCI_AUTOCGETMAXHEIGHT = 2211, + + //! + SCI_CALLTIPUSESTYLE = 2212, + + //! + SCI_CALLTIPSETPOSITION = 2213, + + //! + SCI_CALLTIPSETPOSSTART = 2214, + + //! + SCI_VISIBLEFROMDOCLINE = 2220, + + //! + SCI_DOCLINEFROMVISIBLE = 2221, + + //! + SCI_SETFOLDLEVEL = 2222, + + //! + SCI_GETFOLDLEVEL = 2223, + + //! + SCI_GETLASTCHILD = 2224, + + //! + SCI_GETFOLDPARENT = 2225, + + //! + SCI_SHOWLINES = 2226, + + //! + SCI_HIDELINES = 2227, + + //! + SCI_GETLINEVISIBLE = 2228, + + //! + SCI_SETFOLDEXPANDED = 2229, + + //! + SCI_GETFOLDEXPANDED = 2230, + + //! + SCI_TOGGLEFOLD = 2231, + + //! + SCI_ENSUREVISIBLE = 2232, + + //! + SCI_SETFOLDFLAGS = 2233, + + //! + SCI_ENSUREVISIBLEENFORCEPOLICY = 2234, + + //! + SCI_WRAPCOUNT = 2235, + + //! + SCI_GETALLLINESVISIBLE = 2236, + + //! + SCI_FOLDLINE = 2237, + + //! + SCI_FOLDCHILDREN = 2238, + + //! + SCI_EXPANDCHILDREN = 2239, + + //! + SCI_SETTABINDENTS = 2260, + + //! + SCI_GETTABINDENTS = 2261, + + //! + SCI_SETBACKSPACEUNINDENTS = 2262, + + //! + SCI_GETBACKSPACEUNINDENTS = 2263, + + //! + SCI_SETMOUSEDWELLTIME = 2264, + + //! + SCI_GETMOUSEDWELLTIME = 2265, + + //! + SCI_WORDSTARTPOSITION = 2266, + + //! + SCI_WORDENDPOSITION = 2267, + + //! + SCI_SETWRAPMODE = 2268, + + //! + SCI_GETWRAPMODE = 2269, + + //! + SCI_SETLAYOUTCACHE = 2272, + + //! + SCI_GETLAYOUTCACHE = 2273, + + //! + SCI_SETSCROLLWIDTH = 2274, + + //! + SCI_GETSCROLLWIDTH = 2275, + + //! This message returns the width of some text when rendered in a + //! particular style. + //! \a wParam is the style number and is one of the STYLE_* values or + //! one of the styles defined by a lexer. + //! \a lParam is a pointer to the text. + SCI_TEXTWIDTH = 2276, + + //! + SCI_SETENDATLASTLINE = 2277, + + //! + SCI_GETENDATLASTLINE = 2278, + + //! + SCI_TEXTHEIGHT = 2279, + + //! + SCI_SETVSCROLLBAR = 2280, + + //! + SCI_GETVSCROLLBAR = 2281, + + //! + SCI_APPENDTEXT = 2282, + + //! + SCI_GETTWOPHASEDRAW = 2283, + + //! + SCI_SETTWOPHASEDRAW = 2284, + + //! + SCI_AUTOCGETTYPESEPARATOR = 2285, + + //! + SCI_AUTOCSETTYPESEPARATOR = 2286, + + //! + SCI_TARGETFROMSELECTION = 2287, + + //! + SCI_LINESJOIN = 2288, + + //! + SCI_LINESSPLIT = 2289, + + //! + SCI_SETFOLDMARGINCOLOUR = 2290, + + //! + SCI_SETFOLDMARGINHICOLOUR = 2291, + + //! + SCI_MARKERSETBACKSELECTED = 2292, + + //! + SCI_MARKERENABLEHIGHLIGHT = 2293, + + //! + SCI_LINEDOWN = 2300, + + //! + SCI_LINEDOWNEXTEND = 2301, + + //! + SCI_LINEUP = 2302, + + //! + SCI_LINEUPEXTEND = 2303, + + //! + SCI_CHARLEFT = 2304, + + //! + SCI_CHARLEFTEXTEND = 2305, + + //! + SCI_CHARRIGHT = 2306, + + //! + SCI_CHARRIGHTEXTEND = 2307, + + //! + SCI_WORDLEFT = 2308, + + //! + SCI_WORDLEFTEXTEND = 2309, + + //! + SCI_WORDRIGHT = 2310, + + //! + SCI_WORDRIGHTEXTEND = 2311, + + //! + SCI_HOME = 2312, + + //! + SCI_HOMEEXTEND = 2313, + + //! + SCI_LINEEND = 2314, + + //! + SCI_LINEENDEXTEND = 2315, + + //! + SCI_DOCUMENTSTART = 2316, + + //! + SCI_DOCUMENTSTARTEXTEND = 2317, + + //! + SCI_DOCUMENTEND = 2318, + + //! + SCI_DOCUMENTENDEXTEND = 2319, + + //! + SCI_PAGEUP = 2320, + + //! + SCI_PAGEUPEXTEND = 2321, + + //! + SCI_PAGEDOWN = 2322, + + //! + SCI_PAGEDOWNEXTEND = 2323, + + //! + SCI_EDITTOGGLEOVERTYPE = 2324, + + //! + SCI_CANCEL = 2325, + + //! + SCI_DELETEBACK = 2326, + + //! + SCI_TAB = 2327, + + //! + SCI_BACKTAB = 2328, + + //! + SCI_NEWLINE = 2329, + + //! + SCI_FORMFEED = 2330, + + //! + SCI_VCHOME = 2331, + + //! + SCI_VCHOMEEXTEND = 2332, + + //! + SCI_ZOOMIN = 2333, + + //! + SCI_ZOOMOUT = 2334, + + //! + SCI_DELWORDLEFT = 2335, + + //! + SCI_DELWORDRIGHT = 2336, + + //! + SCI_LINECUT = 2337, + + //! + SCI_LINEDELETE = 2338, + + //! + SCI_LINETRANSPOSE = 2339, + + //! + SCI_LOWERCASE = 2340, + + //! + SCI_UPPERCASE = 2341, + + //! + SCI_LINESCROLLDOWN = 2342, + + //! + SCI_LINESCROLLUP = 2343, + + //! + SCI_DELETEBACKNOTLINE = 2344, + + //! + SCI_HOMEDISPLAY = 2345, + + //! + SCI_HOMEDISPLAYEXTEND = 2346, + + //! + SCI_LINEENDDISPLAY = 2347, + + //! + SCI_LINEENDDISPLAYEXTEND = 2348, + + //! + SCI_MOVECARETINSIDEVIEW = 2401, + + //! + SCI_LINELENGTH = 2350, + + //! + SCI_BRACEHIGHLIGHT = 2351, + + //! + SCI_BRACEBADLIGHT = 2352, + + //! + SCI_BRACEMATCH = 2353, + + //! + SCI_GETVIEWEOL = 2355, + + //! + SCI_SETVIEWEOL = 2356, + + //! + SCI_GETDOCPOINTER = 2357, + + //! + SCI_SETDOCPOINTER = 2358, + + //! + SCI_SETMODEVENTMASK = 2359, + + //! + SCI_GETEDGECOLUMN = 2360, + + //! + SCI_SETEDGECOLUMN = 2361, + + //! + SCI_GETEDGEMODE = 2362, + + //! + SCI_SETEDGEMODE = 2363, + + //! + SCI_GETEDGECOLOUR = 2364, + + //! + SCI_SETEDGECOLOUR = 2365, + + //! + SCI_SEARCHANCHOR = 2366, + + //! + SCI_SEARCHNEXT = 2367, + + //! + SCI_SEARCHPREV = 2368, + + //! + SCI_LINESONSCREEN = 2370, + + //! + SCI_USEPOPUP = 2371, + + //! + SCI_SELECTIONISRECTANGLE = 2372, + + //! + SCI_SETZOOM = 2373, + + //! + SCI_GETZOOM = 2374, + + //! + SCI_CREATEDOCUMENT = 2375, + + //! + SCI_ADDREFDOCUMENT = 2376, + + //! + SCI_RELEASEDOCUMENT = 2377, + + //! + SCI_GETMODEVENTMASK = 2378, + + //! + SCI_SETFOCUS = 2380, + + //! + SCI_GETFOCUS = 2381, + + //! + SCI_SETSTATUS = 2382, + + //! + SCI_GETSTATUS = 2383, + + //! + SCI_SETMOUSEDOWNCAPTURES = 2384, + + //! + SCI_GETMOUSEDOWNCAPTURES = 2385, + + //! + SCI_SETCURSOR = 2386, + + //! + SCI_GETCURSOR = 2387, + + //! + SCI_SETCONTROLCHARSYMBOL = 2388, + + //! + SCI_GETCONTROLCHARSYMBOL = 2389, + + //! + SCI_WORDPARTLEFT = 2390, + + //! + SCI_WORDPARTLEFTEXTEND = 2391, + + //! + SCI_WORDPARTRIGHT = 2392, + + //! + SCI_WORDPARTRIGHTEXTEND = 2393, + + //! + SCI_SETVISIBLEPOLICY = 2394, + + //! + SCI_DELLINELEFT = 2395, + + //! + SCI_DELLINERIGHT = 2396, + + //! + SCI_SETXOFFSET = 2397, + + //! + SCI_GETXOFFSET = 2398, + + //! + SCI_CHOOSECARETX = 2399, + + //! + SCI_GRABFOCUS = 2400, + + //! + SCI_SETXCARETPOLICY = 2402, + + //! + SCI_SETYCARETPOLICY = 2403, + + //! + SCI_LINEDUPLICATE = 2404, + + //! This message takes a copy of an image and registers it so that it + //! can be refered to by a unique integer identifier. + //! \a wParam is the image's identifier. + //! \a lParam is a pointer to a QPixmap instance. Note that in other + //! ports of Scintilla this is a pointer to either raw or textual XPM + //! image data. + //! + //! \sa SCI_CLEARREGISTEREDIMAGES, SCI_REGISTERRGBAIMAGE + SCI_REGISTERIMAGE = 2405, + + //! + SCI_SETPRINTWRAPMODE = 2406, + + //! + SCI_GETPRINTWRAPMODE = 2407, + + //! This message de-registers all currently registered images. + //! + //! \sa SCI_REGISTERIMAGE, SCI_REGISTERRGBAIMAGE + SCI_CLEARREGISTEREDIMAGES = 2408, + + //! + SCI_STYLESETHOTSPOT = 2409, + + //! + SCI_SETHOTSPOTACTIVEFORE = 2410, + + //! + SCI_SETHOTSPOTACTIVEBACK = 2411, + + //! + SCI_SETHOTSPOTACTIVEUNDERLINE = 2412, + + //! + SCI_PARADOWN = 2413, + + //! + SCI_PARADOWNEXTEND = 2414, + + //! + SCI_PARAUP = 2415, + + //! + SCI_PARAUPEXTEND = 2416, + + //! + SCI_POSITIONBEFORE = 2417, + + //! + SCI_POSITIONAFTER = 2418, + + //! + SCI_COPYRANGE = 2419, + + //! + SCI_COPYTEXT = 2420, + + //! + SCI_SETHOTSPOTSINGLELINE = 2421, + + //! + SCI_SETSELECTIONMODE = 2422, + + //! + SCI_GETSELECTIONMODE = 2423, + + //! + SCI_GETLINESELSTARTPOSITION = 2424, + + //! + SCI_GETLINESELENDPOSITION = 2425, + + //! + SCI_LINEDOWNRECTEXTEND = 2426, + + //! + SCI_LINEUPRECTEXTEND = 2427, + + //! + SCI_CHARLEFTRECTEXTEND = 2428, + + //! + SCI_CHARRIGHTRECTEXTEND = 2429, + + //! + SCI_HOMERECTEXTEND = 2430, + + //! + SCI_VCHOMERECTEXTEND = 2431, + + //! + SCI_LINEENDRECTEXTEND = 2432, + + //! + SCI_PAGEUPRECTEXTEND = 2433, + + //! + SCI_PAGEDOWNRECTEXTEND = 2434, + + //! + SCI_STUTTEREDPAGEUP = 2435, + + //! + SCI_STUTTEREDPAGEUPEXTEND = 2436, + + //! + SCI_STUTTEREDPAGEDOWN = 2437, + + //! + SCI_STUTTEREDPAGEDOWNEXTEND = 2438, + + //! + SCI_WORDLEFTEND = 2439, + + //! + SCI_WORDLEFTENDEXTEND = 2440, + + //! + SCI_WORDRIGHTEND = 2441, + + //! + SCI_WORDRIGHTENDEXTEND = 2442, + + //! + SCI_SETWHITESPACECHARS = 2443, + + //! + SCI_SETCHARSDEFAULT = 2444, + + //! + SCI_AUTOCGETCURRENT = 2445, + + //! + SCI_ALLOCATE = 2446, + + //! + SCI_HOMEWRAP = 2349, + + //! + SCI_HOMEWRAPEXTEND = 2450, + + //! + SCI_LINEENDWRAP = 2451, + + //! + SCI_LINEENDWRAPEXTEND = 2452, + + //! + SCI_VCHOMEWRAP = 2453, + + //! + SCI_VCHOMEWRAPEXTEND = 2454, + + //! + SCI_LINECOPY = 2455, + + //! + SCI_FINDCOLUMN = 2456, + + //! + SCI_GETCARETSTICKY = 2457, + + //! + SCI_SETCARETSTICKY = 2458, + + //! + SCI_TOGGLECARETSTICKY = 2459, + + //! + SCI_SETWRAPVISUALFLAGS = 2460, + + //! + SCI_GETWRAPVISUALFLAGS = 2461, + + //! + SCI_SETWRAPVISUALFLAGSLOCATION = 2462, + + //! + SCI_GETWRAPVISUALFLAGSLOCATION = 2463, + + //! + SCI_SETWRAPSTARTINDENT = 2464, + + //! + SCI_GETWRAPSTARTINDENT = 2465, + + //! + SCI_MARKERADDSET = 2466, + + //! + SCI_SETPASTECONVERTENDINGS = 2467, + + //! + SCI_GETPASTECONVERTENDINGS = 2468, + + //! + SCI_SELECTIONDUPLICATE = 2469, + + //! + SCI_SETCARETLINEBACKALPHA = 2470, + + //! + SCI_GETCARETLINEBACKALPHA = 2471, + + //! + SCI_SETWRAPINDENTMODE = 2472, + + //! + SCI_GETWRAPINDENTMODE = 2473, + + //! + SCI_MARKERSETALPHA = 2476, + + //! + SCI_GETSELALPHA = 2477, + + //! + SCI_SETSELALPHA = 2478, + + //! + SCI_GETSELEOLFILLED = 2479, + + //! + SCI_SETSELEOLFILLED = 2480, + + //! + SCI_STYLEGETFORE = 2481, + + //! + SCI_STYLEGETBACK = 2482, + + //! + SCI_STYLEGETBOLD = 2483, + + //! + SCI_STYLEGETITALIC = 2484, + + //! + SCI_STYLEGETSIZE = 2485, + + //! + SCI_STYLEGETFONT = 2486, + + //! + SCI_STYLEGETEOLFILLED = 2487, + + //! + SCI_STYLEGETUNDERLINE = 2488, + + //! + SCI_STYLEGETCASE = 2489, + + //! + SCI_STYLEGETCHARACTERSET = 2490, + + //! + SCI_STYLEGETVISIBLE = 2491, + + //! + SCI_STYLEGETCHANGEABLE = 2492, + + //! + SCI_STYLEGETHOTSPOT = 2493, + + //! + SCI_GETHOTSPOTACTIVEFORE = 2494, + + //! + SCI_GETHOTSPOTACTIVEBACK = 2495, + + //! + SCI_GETHOTSPOTACTIVEUNDERLINE = 2496, + + //! + SCI_GETHOTSPOTSINGLELINE = 2497, + + //! + SCI_BRACEHIGHLIGHTINDICATOR = 2498, + + //! + SCI_BRACEBADLIGHTINDICATOR = 2499, + + //! + SCI_SETINDICATORCURRENT = 2500, + + //! + SCI_GETINDICATORCURRENT = 2501, + + //! + SCI_SETINDICATORVALUE = 2502, + + //! + SCI_GETINDICATORVALUE = 2503, + + //! + SCI_INDICATORFILLRANGE = 2504, + + //! + SCI_INDICATORCLEARRANGE = 2505, + + //! + SCI_INDICATORALLONFOR = 2506, + + //! + SCI_INDICATORVALUEAT = 2507, + + //! + SCI_INDICATORSTART = 2508, + + //! + SCI_INDICATOREND = 2509, + + //! + SCI_INDICSETUNDER = 2510, + + //! + SCI_INDICGETUNDER = 2511, + + //! + SCI_SETCARETSTYLE = 2512, + + //! + SCI_GETCARETSTYLE = 2513, + + //! + SCI_SETPOSITIONCACHE = 2514, + + //! + SCI_GETPOSITIONCACHE = 2515, + + //! + SCI_SETSCROLLWIDTHTRACKING = 2516, + + //! + SCI_GETSCROLLWIDTHTRACKING = 2517, + + //! + SCI_DELWORDRIGHTEND = 2518, + + //! This message copies the selection. If the selection is empty then + //! copy the line with the caret. + SCI_COPYALLOWLINE = 2519, + + //! This message returns a pointer to the document text. Any + //! subsequent message will invalidate the pointer. + SCI_GETCHARACTERPOINTER = 2520, + + //! + SCI_SETKEYSUNICODE = 2521, + + //! + SCI_GETKEYSUNICODE = 2522, + + //! + SCI_INDICSETALPHA = 2523, + + //! + SCI_INDICGETALPHA = 2524, + + //! + SCI_SETEXTRAASCENT = 2525, + + //! + SCI_GETEXTRAASCENT = 2526, + + //! + SCI_SETEXTRADESCENT = 2527, + + //! + SCI_GETEXTRADESCENT = 2528, + + //! + SCI_MARKERSYMBOLDEFINED = 2529, + + //! + SCI_MARGINSETTEXT = 2530, + + //! + SCI_MARGINGETTEXT = 2531, + + //! + SCI_MARGINSETSTYLE = 2532, + + //! + SCI_MARGINGETSTYLE = 2533, + + //! + SCI_MARGINSETSTYLES = 2534, + + //! + SCI_MARGINGETSTYLES = 2535, + + //! + SCI_MARGINTEXTCLEARALL = 2536, + + //! + SCI_MARGINSETSTYLEOFFSET = 2537, + + //! + SCI_MARGINGETSTYLEOFFSET = 2538, + + //! + SCI_SETMARGINOPTIONS = 2539, + + //! + SCI_ANNOTATIONSETTEXT = 2540, + + //! + SCI_ANNOTATIONGETTEXT = 2541, + + //! + SCI_ANNOTATIONSETSTYLE = 2542, + + //! + SCI_ANNOTATIONGETSTYLE = 2543, + + //! + SCI_ANNOTATIONSETSTYLES = 2544, + + //! + SCI_ANNOTATIONGETSTYLES = 2545, + + //! + SCI_ANNOTATIONGETLINES = 2546, + + //! + SCI_ANNOTATIONCLEARALL = 2547, + + //! + SCI_ANNOTATIONSETVISIBLE = 2548, + + //! + SCI_ANNOTATIONGETVISIBLE = 2549, + + //! + SCI_ANNOTATIONSETSTYLEOFFSET = 2550, + + //! + SCI_ANNOTATIONGETSTYLEOFFSET = 2551, + + //! + SCI_RELEASEALLEXTENDEDSTYLES = 2552, + + //! + SCI_ALLOCATEEXTENDEDSTYLES = 2553, + + //! + SCI_SETEMPTYSELECTION = 2556, + + //! + SCI_GETMARGINOPTIONS = 2557, + + //! + SCI_INDICSETOUTLINEALPHA = 2558, + + //! + SCI_INDICGETOUTLINEALPHA = 2559, + + //! + SCI_ADDUNDOACTION = 2560, + + //! + SCI_CHARPOSITIONFROMPOINT = 2561, + + //! + SCI_CHARPOSITIONFROMPOINTCLOSE = 2562, + + //! + SCI_SETMULTIPLESELECTION = 2563, + + //! + SCI_GETMULTIPLESELECTION = 2564, + + //! + SCI_SETADDITIONALSELECTIONTYPING = 2565, + + //! + SCI_GETADDITIONALSELECTIONTYPING = 2566, + + //! + SCI_SETADDITIONALCARETSBLINK = 2567, + + //! + SCI_GETADDITIONALCARETSBLINK = 2568, + + //! + SCI_SCROLLRANGE = 2569, + + //! + SCI_GETSELECTIONS = 2570, + + //! + SCI_CLEARSELECTIONS = 2571, + + //! + SCI_SETSELECTION = 2572, + + //! + SCI_ADDSELECTION = 2573, + + //! + SCI_SETMAINSELECTION = 2574, + + //! + SCI_GETMAINSELECTION = 2575, + + //! + SCI_SETSELECTIONNCARET = 2576, + + //! + SCI_GETSELECTIONNCARET = 2577, + + //! + SCI_SETSELECTIONNANCHOR = 2578, + + //! + SCI_GETSELECTIONNANCHOR = 2579, + + //! + SCI_SETSELECTIONNCARETVIRTUALSPACE = 2580, + + //! + SCI_GETSELECTIONNCARETVIRTUALSPACE = 2581, + + //! + SCI_SETSELECTIONNANCHORVIRTUALSPACE = 2582, + + //! + SCI_GETSELECTIONNANCHORVIRTUALSPACE = 2583, + + //! + SCI_SETSELECTIONNSTART = 2584, + + //! + SCI_GETSELECTIONNSTART = 2585, + + //! + SCI_SETSELECTIONNEND = 2586, + + //! + SCI_GETSELECTIONNEND = 2587, + + //! + SCI_SETRECTANGULARSELECTIONCARET = 2588, + + //! + SCI_GETRECTANGULARSELECTIONCARET = 2589, + + //! + SCI_SETRECTANGULARSELECTIONANCHOR = 2590, + + //! + SCI_GETRECTANGULARSELECTIONANCHOR = 2591, + + //! + SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2592, + + //! + SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE = 2593, + + //! + SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2594, + + //! + SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE = 2595, + + //! + SCI_SETVIRTUALSPACEOPTIONS = 2596, + + //! + SCI_GETVIRTUALSPACEOPTIONS = 2597, + + //! + SCI_SETRECTANGULARSELECTIONMODIFIER = 2598, + + //! + SCI_GETRECTANGULARSELECTIONMODIFIER = 2599, + + //! + SCI_SETADDITIONALSELFORE = 2600, + + //! + SCI_SETADDITIONALSELBACK = 2601, + + //! + SCI_SETADDITIONALSELALPHA = 2602, + + //! + SCI_GETADDITIONALSELALPHA = 2603, + + //! + SCI_SETADDITIONALCARETFORE = 2604, + + //! + SCI_GETADDITIONALCARETFORE = 2605, + + //! + SCI_ROTATESELECTION = 2606, + + //! + SCI_SWAPMAINANCHORCARET = 2607, + + //! + SCI_SETADDITIONALCARETSVISIBLE = 2608, + + //! + SCI_GETADDITIONALCARETSVISIBLE = 2609, + + //! + SCI_AUTOCGETCURRENTTEXT = 2610, + + //! + SCI_SETFONTQUALITY = 2611, + + //! + SCI_GETFONTQUALITY = 2612, + + //! + SCI_SETFIRSTVISIBLELINE = 2613, + + //! + SCI_SETMULTIPASTE = 2614, + + //! + SCI_GETMULTIPASTE = 2615, + + //! + SCI_GETTAG = 2616, + + //! + SCI_CHANGELEXERSTATE = 2617, + + //! + SCI_CONTRACTEDFOLDNEXT = 2618, + + //! + SCI_VERTICALCENTRECARET = 2619, + + //! + SCI_MOVESELECTEDLINESUP = 2620, + + //! + SCI_MOVESELECTEDLINESDOWN = 2621, + + //! + SCI_SETIDENTIFIER = 2622, + + //! + SCI_GETIDENTIFIER = 2623, + + //! This message sets the width of an RGBA image specified by a future + //! call to SCI_MARKERDEFINERGBAIMAGE or SCI_REGISTERRGBAIMAGE. + //! + //! \sa SCI_RGBAIMAGESETHEIGHT, SCI_MARKERDEFINERGBAIMAGE, + //! SCI_REGISTERRGBAIMAGE. + SCI_RGBAIMAGESETWIDTH = 2624, + + //! This message sets the height of an RGBA image specified by a future + //! call to SCI_MARKERDEFINERGBAIMAGE or SCI_REGISTERRGBAIMAGE. + //! + //! \sa SCI_RGBAIMAGESETWIDTH, SCI_MARKERDEFINERGBAIMAGE, + //! SCI_REGISTERRGBAIMAGE. + SCI_RGBAIMAGESETHEIGHT = 2625, + + //! This message sets the symbol used to draw one of the 32 markers to + //! an RGBA image. RGBA images use the SC_MARK_RGBAIMAGE marker + //! symbol. + //! \a wParam is the number of the marker. + //! \a lParam is a pointer to a QImage instance. Note that in other + //! ports of Scintilla this is a pointer to raw RGBA image data. + //! + //! \sa SCI_MARKERDEFINE, SCI_MARKERDEFINEPIXMAP + SCI_MARKERDEFINERGBAIMAGE = 2626, + + //! This message takes a copy of an image and registers it so that it + //! can be refered to by a unique integer identifier. + //! \a wParam is the image's identifier. + //! \a lParam is a pointer to a QImage instance. Note that in other + //! ports of Scintilla this is a pointer to raw RGBA image data. + //! + //! \sa SCI_CLEARREGISTEREDIMAGES, SCI_REGISTERIMAGE + SCI_REGISTERRGBAIMAGE = 2627, + + //! + SCI_SCROLLTOSTART = 2628, + + //! + SCI_SCROLLTOEND = 2629, + + //! + SCI_SETTECHNOLOGY = 2630, + + //! + SCI_GETTECHNOLOGY = 2631, + + //! + SCI_CREATELOADER = 2632, + + //! + SCI_COUNTCHARACTERS = 2633, + + //! + SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR = 2634, + + //! + SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR = 2635, + + //! + SCI_AUTOCSETMULTI = 2636, + + //! + SCI_AUTOCGETMULTI = 2637, + + //! + SCI_FINDINDICATORSHOW = 2640, + + //! + SCI_FINDINDICATORFLASH = 2641, + + //! + SCI_FINDINDICATORHIDE = 2642, + + //! + SCI_GETRANGEPOINTER = 2643, + + //! + SCI_GETGAPPOSITION = 2644, + + //! + SCI_DELETERANGE = 2645, + + //! + SCI_GETWORDCHARS = 2646, + + //! + SCI_GETWHITESPACECHARS = 2647, + + //! + SCI_SETPUNCTUATIONCHARS = 2648, + + //! + SCI_GETPUNCTUATIONCHARS = 2649, + + //! + SCI_GETSELECTIONEMPTY = 2650, + + //! + SCI_RGBAIMAGESETSCALE = 2651, + + //! + SCI_VCHOMEDISPLAY = 2652, + + //! + SCI_VCHOMEDISPLAYEXTEND = 2653, + + //! + SCI_GETCARETLINEVISIBLEALWAYS = 2654, + + //! + SCI_SETCARETLINEVISIBLEALWAYS = 2655, + + //! + SCI_SETLINEENDTYPESALLOWED = 2656, + + //! + SCI_GETLINEENDTYPESALLOWED = 2657, + + //! + SCI_GETLINEENDTYPESACTIVE = 2658, + + //! + SCI_AUTOCSETORDER = 2660, + + //! + SCI_AUTOCGETORDER = 2661, + + //! + SCI_FOLDALL = 2662, + + //! + SCI_SETAUTOMATICFOLD = 2663, + + //! + SCI_GETAUTOMATICFOLD = 2664, + + //! + SCI_SETREPRESENTATION = 2665, + + //! + SCI_GETREPRESENTATION = 2666, + + //! + SCI_CLEARREPRESENTATION = 2667, + + //! + SCI_SETMOUSESELECTIONRECTANGULARSWITCH = 2668, + + //! + SCI_GETMOUSESELECTIONRECTANGULARSWITCH = 2669, + + //! + SCI_POSITIONRELATIVE = 2670, + + //! + SCI_DROPSELECTIONN = 2671, + + //! + SCI_CHANGEINSERTION = 2672, + + //! + SCI_GETPHASESDRAW = 2673, + + //! + SCI_SETPHASESDRAW = 2674, + + //! + SCI_CLEARTABSTOPS = 2675, + + //! + SCI_ADDTABSTOP = 2676, + + //! + SCI_GETNEXTTABSTOP = 2677, + + //! + SCI_GETIMEINTERACTION = 2678, + + //! + SCI_SETIMEINTERACTION = 2679, + + //! + SCI_INDICSETHOVERSTYLE = 2680, + + //! + SCI_INDICGETHOVERSTYLE = 2681, + + //! + SCI_INDICSETHOVERFORE = 2682, + + //! + SCI_INDICGETHOVERFORE = 2683, + + //! + SCI_INDICSETFLAGS = 2684, + + //! + SCI_INDICGETFLAGS = 2685, + + //! + SCI_SETTARGETRANGE = 2686, + + //! + SCI_GETTARGETRANGE = 2687, + + //! + SCI_STARTRECORD = 3001, + + //! + SCI_STOPRECORD = 3002, + + //! This message sets the number of the lexer to use for syntax + //! styling. + //! \a wParam is the number of the lexer and is one of the SCLEX_* + //! values. + SCI_SETLEXER = 4001, + + //! This message returns the number of the lexer being used for syntax + //! styling. + SCI_GETLEXER = 4002, + + //! + SCI_COLOURISE = 4003, + + //! + SCI_SETPROPERTY = 4004, + + //! + SCI_SETKEYWORDS = 4005, + + //! This message sets the name of the lexer to use for syntax styling. + //! \a wParam is unused. + //! \a lParam is the name of the lexer. + SCI_SETLEXERLANGUAGE = 4006, + + //! + SCI_LOADLEXERLIBRARY = 4007, + + //! + SCI_GETPROPERTY = 4008, + + //! + SCI_GETPROPERTYEXPANDED = 4009, + + //! + SCI_GETPROPERTYINT = 4010, + + //! + SCI_GETSTYLEBITSNEEDED = 4011, + + //! + SCI_GETLEXERLANGUAGE = 4012, + + //! + SCI_PRIVATELEXERCALL = 4013, + + //! + SCI_PROPERTYNAMES = 4014, + + //! + SCI_PROPERTYTYPE = 4015, + + //! + SCI_DESCRIBEPROPERTY = 4016, + + //! + SCI_DESCRIBEKEYWORDSETS = 4017, + + //! + SCI_GETLINEENDTYPESSUPPORTED = 4018, + + //! + SCI_ALLOCATESUBSTYLES = 4020, + + //! + SCI_GETSUBSTYLESSTART = 4021, + + //! + SCI_GETSUBSTYLESLENGTH = 4022, + + //! + SCI_GETSTYLEFROMSUBSTYLE = 4027, + + //! + SCI_GETPRIMARYSTYLEFROMSTYLE = 4028, + + //! + SCI_FREESUBSTYLES = 4023, + + //! + SCI_SETIDENTIFIERS = 4024, + + //! + SCI_DISTANCETOSECONDARYSTYLES = 4025, + + //! + SCI_GETSUBSTYLEBASES = 4026, + }; + + enum + { + SC_ALPHA_TRANSPARENT = 0, + SC_ALPHA_OPAQUE = 255, + SC_ALPHA_NOALPHA = 256 + }; + + enum + { + SC_CARETSTICKY_OFF = 0, + SC_CARETSTICKY_ON = 1, + SC_CARETSTICKY_WHITESPACE = 2 + }; + + enum + { + SC_EFF_QUALITY_MASK = 0x0f, + SC_EFF_QUALITY_DEFAULT = 0, + SC_EFF_QUALITY_NON_ANTIALIASED = 1, + SC_EFF_QUALITY_ANTIALIASED = 2, + SC_EFF_QUALITY_LCD_OPTIMIZED = 3 + }; + + enum + { + SC_IME_WINDOWED = 0, + SC_IME_INLINE = 1, + }; + + enum + { + SC_MARGINOPTION_NONE = 0x00, + SC_MARGINOPTION_SUBLINESELECT = 0x01 + }; + + enum + { + SC_MULTIAUTOC_ONCE = 0, + SC_MULTIAUTOC_EACH = 1 + }; + + enum + { + SC_MULTIPASTE_ONCE = 0, + SC_MULTIPASTE_EACH = 1 + }; + + //! This enum defines the different selection modes. + //! + //! \sa SCI_GETSELECTIONMODE, SCI_SETSELECTIONMODE + enum + { + SC_SEL_STREAM = 0, + SC_SEL_RECTANGLE = 1, + SC_SEL_LINES = 2, + SC_SEL_THIN = 3 + }; + + enum + { + SC_STATUS_OK = 0, + SC_STATUS_FAILURE = 1, + SC_STATUS_BADALLOC = 2, + SC_STATUS_WARN_START = 1000, + SC_STATUS_WARNREGEX = 1001, + }; + + enum + { + SC_TYPE_BOOLEAN = 0, + SC_TYPE_INTEGER = 1, + SC_TYPE_STRING = 2 + }; + + enum + { + SC_UPDATE_CONTENT = 0x01, + SC_UPDATE_SELECTION = 0x02, + SC_UPDATE_V_SCROLL = 0x04, + SC_UPDATE_H_SCROLL = 0x08 + }; + + enum + { + SC_WRAPVISUALFLAG_NONE = 0x0000, + SC_WRAPVISUALFLAG_END = 0x0001, + SC_WRAPVISUALFLAG_START = 0x0002, + SC_WRAPVISUALFLAG_MARGIN = 0x0004 + }; + + enum + { + SC_WRAPVISUALFLAGLOC_DEFAULT = 0x0000, + SC_WRAPVISUALFLAGLOC_END_BY_TEXT = 0x0001, + SC_WRAPVISUALFLAGLOC_START_BY_TEXT = 0x0002 + }; + + enum + { + SCVS_NONE = 0, + SCVS_RECTANGULARSELECTION = 1, + SCVS_USERACCESSIBLE = 2 + }; + + enum + { + SCWS_INVISIBLE = 0, + SCWS_VISIBLEALWAYS = 1, + SCWS_VISIBLEAFTERINDENT = 2 + }; + + enum + { + SC_EOL_CRLF = 0, + SC_EOL_CR = 1, + SC_EOL_LF = 2 + }; + + enum + { + SC_CP_DBCS = 1, + SC_CP_UTF8 = 65001 + }; + + //! This enum defines the different marker symbols. + //! + //! \sa SCI_MARKERDEFINE + enum + { + //! A circle. + SC_MARK_CIRCLE = 0, + + //! A rectangle. + SC_MARK_ROUNDRECT = 1, + + //! A triangle pointing to the right. + SC_MARK_ARROW = 2, + + //! A smaller rectangle. + SC_MARK_SMALLRECT = 3, + + //! An arrow pointing to the right. + SC_MARK_SHORTARROW = 4, + + //! An invisible marker that allows code to track the movement + //! of lines. + SC_MARK_EMPTY = 5, + + //! A triangle pointing down. + SC_MARK_ARROWDOWN = 6, + + //! A drawn minus sign. + SC_MARK_MINUS = 7, + + //! A drawn plus sign. + SC_MARK_PLUS = 8, + + //! A vertical line drawn in the background colour. + SC_MARK_VLINE = 9, + + //! A bottom left corner drawn in the background colour. + SC_MARK_LCORNER = 10, + + //! A vertical line with a centre right horizontal line drawn + //! in the background colour. + SC_MARK_TCORNER = 11, + + //! A drawn plus sign in a box. + SC_MARK_BOXPLUS = 12, + + //! A drawn plus sign in a connected box. + SC_MARK_BOXPLUSCONNECTED = 13, + + //! A drawn minus sign in a box. + SC_MARK_BOXMINUS = 14, + + //! A drawn minus sign in a connected box. + SC_MARK_BOXMINUSCONNECTED = 15, + + //! A rounded bottom left corner drawn in the background + //! colour. + SC_MARK_LCORNERCURVE = 16, + + //! A vertical line with a centre right curved line drawn in + //! the background colour. + SC_MARK_TCORNERCURVE = 17, + + //! A drawn plus sign in a circle. + SC_MARK_CIRCLEPLUS = 18, + + //! A drawn plus sign in a connected box. + SC_MARK_CIRCLEPLUSCONNECTED = 19, + + //! A drawn minus sign in a circle. + SC_MARK_CIRCLEMINUS = 20, + + //! A drawn minus sign in a connected circle. + SC_MARK_CIRCLEMINUSCONNECTED = 21, + + //! No symbol is drawn but the line is drawn with the same background + //! color as the marker's. + SC_MARK_BACKGROUND = 22, + + //! Three drawn dots. + SC_MARK_DOTDOTDOT = 23, + + //! Three drawn arrows pointing right. + SC_MARK_ARROWS = 24, + + //! An XPM format pixmap. + SC_MARK_PIXMAP = 25, + + //! A full rectangle (ie. the margin background) using the marker's + //! background color. + SC_MARK_FULLRECT = 26, + + //! A left rectangle (ie. the left part of the margin background) using + //! the marker's background color. + SC_MARK_LEFTRECT = 27, + + //! The value is available for plugins to use. + SC_MARK_AVAILABLE = 28, + + //! The line is underlined using the marker's background color. + SC_MARK_UNDERLINE = 29, + + //! A RGBA format image. + SC_MARK_RGBAIMAGE = 30, + + //! A bookmark. + SC_MARK_BOOKMARK = 31, + + //! Characters can be used as symbols by adding this to the ASCII value + //! of the character. + SC_MARK_CHARACTER = 10000 + }; + + enum + { + SC_MARKNUM_FOLDEREND = 25, + SC_MARKNUM_FOLDEROPENMID = 26, + SC_MARKNUM_FOLDERMIDTAIL = 27, + SC_MARKNUM_FOLDERTAIL = 28, + SC_MARKNUM_FOLDERSUB = 29, + SC_MARKNUM_FOLDER = 30, + SC_MARKNUM_FOLDEROPEN = 31, + SC_MASK_FOLDERS = 0xfe000000 + }; + + //! This enum defines what can be displayed in a margin. + //! + //! \sa SCI_GETMARGINTYPEN, SCI_SETMARGINTYPEN + enum + { + //! The margin can display symbols. Note that all margins can display + //! symbols. + SC_MARGIN_SYMBOL = 0, + + //! The margin will display line numbers. + SC_MARGIN_NUMBER = 1, + + //! The margin's background color will be set to the default background + //! color. + SC_MARGIN_BACK = 2, + + //! The margin's background color will be set to the default foreground + //! color. + SC_MARGIN_FORE = 3, + + //! The margin will display text. + SC_MARGIN_TEXT = 4, + + //! The margin will display right justified text. + SC_MARGIN_RTEXT = 5 + }; + + enum + { + STYLE_DEFAULT = 32, + STYLE_LINENUMBER = 33, + STYLE_BRACELIGHT = 34, + STYLE_BRACEBAD = 35, + STYLE_CONTROLCHAR = 36, + STYLE_INDENTGUIDE = 37, + STYLE_CALLTIP = 38, + STYLE_LASTPREDEFINED = 39, + STYLE_MAX = 255 + }; + + enum + { + SC_CHARSET_ANSI = 0, + SC_CHARSET_DEFAULT = 1, + SC_CHARSET_BALTIC = 186, + SC_CHARSET_CHINESEBIG5 = 136, + SC_CHARSET_EASTEUROPE = 238, + SC_CHARSET_GB2312 = 134, + SC_CHARSET_GREEK = 161, + SC_CHARSET_HANGUL = 129, + SC_CHARSET_MAC = 77, + SC_CHARSET_OEM = 255, + SC_CHARSET_RUSSIAN = 204, + SC_CHARSET_SHIFTJIS = 128, + SC_CHARSET_SYMBOL = 2, + SC_CHARSET_TURKISH = 162, + SC_CHARSET_JOHAB = 130, + SC_CHARSET_HEBREW = 177, + SC_CHARSET_ARABIC = 178, + SC_CHARSET_VIETNAMESE = 163, + SC_CHARSET_THAI = 222, + SC_CHARSET_8859_15 = 1000 + }; + + enum + { + SC_CASE_MIXED = 0, + SC_CASE_UPPER = 1, + SC_CASE_LOWER = 2 + }; + + //! This enum defines the different indentation guide views. + //! + //! \sa SCI_GETINDENTATIONGUIDES, SCI_SETINDENTATIONGUIDES + enum + { + //! No indentation guides are shown. + SC_IV_NONE = 0, + + //! Indentation guides are shown inside real indentation white space. + SC_IV_REAL = 1, + + //! Indentation guides are shown beyond the actual indentation up to + //! the level of the next non-empty line. If the previous non-empty + //! line was a fold header then indentation guides are shown for one + //! more level of indent than that line. This setting is good for + //! Python. + SC_IV_LOOKFORWARD = 2, + + //! Indentation guides are shown beyond the actual indentation up to + //! the level of the next non-empty line or previous non-empty line + //! whichever is the greater. This setting is good for most languages. + SC_IV_LOOKBOTH = 3 + }; + + enum + { + INDIC_PLAIN = 0, + INDIC_SQUIGGLE = 1, + INDIC_TT = 2, + INDIC_DIAGONAL = 3, + INDIC_STRIKE = 4, + INDIC_HIDDEN = 5, + INDIC_BOX = 6, + INDIC_ROUNDBOX = 7, + INDIC_STRAIGHTBOX = 8, + INDIC_DASH = 9, + INDIC_DOTS = 10, + INDIC_SQUIGGLELOW = 11, + INDIC_DOTBOX = 12, + INDIC_SQUIGGLEPIXMAP = 13, + INDIC_COMPOSITIONTHICK = 14, + INDIC_COMPOSITIONTHIN = 15, + INDIC_FULLBOX = 16, + INDIC_TEXTFORE = 17, + + INDIC_IME = 32, + INDIC_IME_MAX = 35, + + INDIC_CONTAINER = 8, + INDIC_MAX = 35, + INDIC0_MASK = 0x20, + INDIC1_MASK = 0x40, + INDIC2_MASK = 0x80, + INDICS_MASK = 0xe0, + + SC_INDICVALUEBIT = 0x01000000, + SC_INDICVALUEMASK = 0x00ffffff, + SC_INDICFLAG_VALUEBEFORE = 1, + }; + + enum + { + SC_PRINT_NORMAL = 0, + SC_PRINT_INVERTLIGHT = 1, + SC_PRINT_BLACKONWHITE = 2, + SC_PRINT_COLOURONWHITE = 3, + SC_PRINT_COLOURONWHITEDEFAULTBG = 4 + }; + + enum + { + SCFIND_WHOLEWORD = 2, + SCFIND_MATCHCASE = 4, + SCFIND_WORDSTART = 0x00100000, + SCFIND_REGEXP = 0x00200000, + SCFIND_POSIX = 0x00400000, + SCFIND_CXX11REGEX = 0x00800000, + }; + + enum + { + SC_FOLDLEVELBASE = 0x00400, + SC_FOLDLEVELWHITEFLAG = 0x01000, + SC_FOLDLEVELHEADERFLAG = 0x02000, + SC_FOLDLEVELNUMBERMASK = 0x00fff + }; + + enum + { + SC_FOLDFLAG_LINEBEFORE_EXPANDED = 0x0002, + SC_FOLDFLAG_LINEBEFORE_CONTRACTED = 0x0004, + SC_FOLDFLAG_LINEAFTER_EXPANDED = 0x0008, + SC_FOLDFLAG_LINEAFTER_CONTRACTED = 0x0010, + SC_FOLDFLAG_LEVELNUMBERS = 0x0040, + SC_FOLDFLAG_LINESTATE = 0x0080, + }; + + enum + { + SC_LINE_END_TYPE_DEFAULT = 0, + SC_LINE_END_TYPE_UNICODE = 1, + }; + + enum + { + SC_TIME_FOREVER = 10000000 + }; + + enum + { + SC_WRAP_NONE = 0, + SC_WRAP_WORD = 1, + SC_WRAP_CHAR = 2, + SC_WRAP_WHITESPACE = 3, + }; + + enum + { + SC_WRAPINDENT_FIXED = 0, + SC_WRAPINDENT_SAME = 1, + SC_WRAPINDENT_INDENT = 2 + }; + + enum + { + SC_CACHE_NONE = 0, + SC_CACHE_CARET = 1, + SC_CACHE_PAGE = 2, + SC_CACHE_DOCUMENT = 3 + }; + + enum + { + SC_PHASES_ONE = 0, + SC_PHASES_TWO = 1, + SC_PHASES_MULTIPLE = 2, + }; + + enum + { + ANNOTATION_HIDDEN = 0, + ANNOTATION_STANDARD = 1, + ANNOTATION_BOXED = 2, + ANNOTATION_INDENTED = 3, + }; + + enum + { + EDGE_NONE = 0, + EDGE_LINE = 1, + EDGE_BACKGROUND = 2 + }; + + enum + { + SC_CURSORNORMAL = -1, + SC_CURSORARROW = 2, + SC_CURSORWAIT = 4, + SC_CURSORREVERSEARROW = 7 + }; + + enum + { + UNDO_MAY_COALESCE = 1 + }; + + enum + { + VISIBLE_SLOP = 0x01, + VISIBLE_STRICT = 0x04 + }; + + enum + { + CARET_SLOP = 0x01, + CARET_STRICT = 0x04, + CARET_JUMPS = 0x10, + CARET_EVEN = 0x08 + }; + + enum + { + CARETSTYLE_INVISIBLE = 0, + CARETSTYLE_LINE = 1, + CARETSTYLE_BLOCK = 2 + }; + + enum + { + SC_MOD_INSERTTEXT = 0x1, + SC_MOD_DELETETEXT = 0x2, + SC_MOD_CHANGESTYLE = 0x4, + SC_MOD_CHANGEFOLD = 0x8, + SC_PERFORMED_USER = 0x10, + SC_PERFORMED_UNDO = 0x20, + SC_PERFORMED_REDO = 0x40, + SC_MULTISTEPUNDOREDO = 0x80, + SC_LASTSTEPINUNDOREDO = 0x100, + SC_MOD_CHANGEMARKER = 0x200, + SC_MOD_BEFOREINSERT = 0x400, + SC_MOD_BEFOREDELETE = 0x800, + SC_MULTILINEUNDOREDO = 0x1000, + SC_STARTACTION = 0x2000, + SC_MOD_CHANGEINDICATOR = 0x4000, + SC_MOD_CHANGELINESTATE = 0x8000, + SC_MOD_CHANGEMARGIN = 0x10000, + SC_MOD_CHANGEANNOTATION = 0x20000, + SC_MOD_CONTAINER = 0x40000, + SC_MOD_LEXERSTATE = 0x80000, + SC_MOD_INSERTCHECK = 0x100000, + SC_MOD_CHANGETABSTOPS = 0x200000, + SC_MODEVENTMASKALL = 0x3fffff + }; + + enum + { + SCK_DOWN = 300, + SCK_UP = 301, + SCK_LEFT = 302, + SCK_RIGHT = 303, + SCK_HOME = 304, + SCK_END = 305, + SCK_PRIOR = 306, + SCK_NEXT = 307, + SCK_DELETE = 308, + SCK_INSERT = 309, + SCK_ESCAPE = 7, + SCK_BACK = 8, + SCK_TAB = 9, + SCK_RETURN = 13, + SCK_ADD = 310, + SCK_SUBTRACT = 311, + SCK_DIVIDE = 312, + SCK_WIN = 313, + SCK_RWIN = 314, + SCK_MENU = 315 + }; + + //! This enum defines the different modifier keys. + enum + { + //! No modifier key. + SCMOD_NORM = 0, + + //! Shift key. + SCMOD_SHIFT = 1, + + //! Control key (the Command key on OS/X, the Ctrl key on other + //! platforms). + SCMOD_CTRL = 2, + + //! Alt key. + SCMOD_ALT = 4, + + //! This is the same as SCMOD_META on all platforms. + SCMOD_SUPER = 8, + + //! Meta key (the Ctrl key on OS/X, the Windows key on other + //! platforms). + SCMOD_META = 16 + }; + + //! This enum defines the different language lexers. + //! + //! \sa SCI_GETLEXER, SCI_SETLEXER + enum + { + //! No lexer is selected and the SCN_STYLENEEDED signal is emitted so + //! that the application can style the text as needed. This is the + //! default. + SCLEX_CONTAINER = 0, + + //! Select the null lexer that does no syntax styling. + SCLEX_NULL = 1, + + //! Select the Python lexer. + SCLEX_PYTHON = 2, + + //! Select the C++ lexer. + SCLEX_CPP = 3, + + //! Select the HTML lexer. + SCLEX_HTML = 4, + + //! Select the XML lexer. + SCLEX_XML = 5, + + //! Select the Perl lexer. + SCLEX_PERL = 6, + + //! Select the SQL lexer. + SCLEX_SQL = 7, + + //! Select the Visual Basic lexer. + SCLEX_VB = 8, + + //! Select the lexer for properties style files. + SCLEX_PROPERTIES = 9, + + //! Select the lexer for error list style files. + SCLEX_ERRORLIST = 10, + + //! Select the Makefile lexer. + SCLEX_MAKEFILE = 11, + + //! Select the Windows batch file lexer. + SCLEX_BATCH = 12, + + //! Select the LaTex lexer. + SCLEX_LATEX = 14, + + //! Select the Lua lexer. + SCLEX_LUA = 15, + + //! Select the lexer for diff output. + SCLEX_DIFF = 16, + + //! Select the lexer for Apache configuration files. + SCLEX_CONF = 17, + + //! Select the Pascal lexer. + SCLEX_PASCAL = 18, + + //! Select the Avenue lexer. + SCLEX_AVE = 19, + + //! Select the Ada lexer. + SCLEX_ADA = 20, + + //! Select the Lisp lexer. + SCLEX_LISP = 21, + + //! Select the Ruby lexer. + SCLEX_RUBY = 22, + + //! Select the Eiffel lexer. + SCLEX_EIFFEL = 23, + + //! Select the Eiffel lexer folding at keywords. + SCLEX_EIFFELKW = 24, + + //! Select the Tcl lexer. + SCLEX_TCL = 25, + + //! Select the lexer for nnCron files. + SCLEX_NNCRONTAB = 26, + + //! Select the Bullant lexer. + SCLEX_BULLANT = 27, + + //! Select the VBScript lexer. + SCLEX_VBSCRIPT = 28, + + //! Select the ASP lexer. + SCLEX_ASP = SCLEX_HTML, + + //! Select the PHP lexer. + SCLEX_PHP = SCLEX_HTML, + + //! Select the Baan lexer. + SCLEX_BAAN = 31, + + //! Select the Matlab lexer. + SCLEX_MATLAB = 32, + + //! Select the Scriptol lexer. + SCLEX_SCRIPTOL = 33, + + //! Select the assembler lexer (';' comment character). + SCLEX_ASM = 34, + + //! Select the C++ lexer with case insensitive keywords. + SCLEX_CPPNOCASE = 35, + + //! Select the FORTRAN lexer. + SCLEX_FORTRAN = 36, + + //! Select the FORTRAN77 lexer. + SCLEX_F77 = 37, + + //! Select the CSS lexer. + SCLEX_CSS = 38, + + //! Select the POV lexer. + SCLEX_POV = 39, + + //! Select the Basser Lout typesetting language lexer. + SCLEX_LOUT = 40, + + //! Select the EScript lexer. + SCLEX_ESCRIPT = 41, + + //! Select the PostScript lexer. + SCLEX_PS = 42, + + //! Select the NSIS lexer. + SCLEX_NSIS = 43, + + //! Select the MMIX assembly language lexer. + SCLEX_MMIXAL = 44, + + //! Select the Clarion lexer. + SCLEX_CLW = 45, + + //! Select the Clarion lexer with case insensitive keywords. + SCLEX_CLWNOCASE = 46, + + //! Select the MPT text log file lexer. + SCLEX_LOT = 47, + + //! Select the YAML lexer. + SCLEX_YAML = 48, + + //! Select the TeX lexer. + SCLEX_TEX = 49, + + //! Select the Metapost lexer. + SCLEX_METAPOST = 50, + + //! Select the PowerBASIC lexer. + SCLEX_POWERBASIC = 51, + + //! Select the Forth lexer. + SCLEX_FORTH = 52, + + //! Select the Erlang lexer. + SCLEX_ERLANG = 53, + + //! Select the Octave lexer. + SCLEX_OCTAVE = 54, + + //! Select the MS SQL lexer. + SCLEX_MSSQL = 55, + + //! Select the Verilog lexer. + SCLEX_VERILOG = 56, + + //! Select the KIX-Scripts lexer. + SCLEX_KIX = 57, + + //! Select the Gui4Cli lexer. + SCLEX_GUI4CLI = 58, + + //! Select the Specman E lexer. + SCLEX_SPECMAN = 59, + + //! Select the AutoIt3 lexer. + SCLEX_AU3 = 60, + + //! Select the APDL lexer. + SCLEX_APDL = 61, + + //! Select the Bash lexer. + SCLEX_BASH = 62, + + //! Select the ASN.1 lexer. + SCLEX_ASN1 = 63, + + //! Select the VHDL lexer. + SCLEX_VHDL = 64, + + //! Select the Caml lexer. + SCLEX_CAML = 65, + + //! Select the BlitzBasic lexer. + SCLEX_BLITZBASIC = 66, + + //! Select the PureBasic lexer. + SCLEX_PUREBASIC = 67, + + //! Select the Haskell lexer. + SCLEX_HASKELL = 68, + + //! Select the PHPScript lexer. + SCLEX_PHPSCRIPT = 69, + + //! Select the TADS3 lexer. + SCLEX_TADS3 = 70, + + //! Select the REBOL lexer. + SCLEX_REBOL = 71, + + //! Select the Smalltalk lexer. + SCLEX_SMALLTALK = 72, + + //! Select the FlagShip lexer. + SCLEX_FLAGSHIP = 73, + + //! Select the Csound lexer. + SCLEX_CSOUND = 74, + + //! Select the FreeBasic lexer. + SCLEX_FREEBASIC = 75, + + //! Select the InnoSetup lexer. + SCLEX_INNOSETUP = 76, + + //! Select the Opal lexer. + SCLEX_OPAL = 77, + + //! Select the Spice lexer. + SCLEX_SPICE = 78, + + //! Select the D lexer. + SCLEX_D = 79, + + //! Select the CMake lexer. + SCLEX_CMAKE = 80, + + //! Select the GAP lexer. + SCLEX_GAP = 81, + + //! Select the PLM lexer. + SCLEX_PLM = 82, + + //! Select the Progress lexer. + SCLEX_PROGRESS = 83, + + //! Select the Abaqus lexer. + SCLEX_ABAQUS = 84, + + //! Select the Asymptote lexer. + SCLEX_ASYMPTOTE = 85, + + //! Select the R lexer. + SCLEX_R = 86, + + //! Select the MagikSF lexer. + SCLEX_MAGIK = 87, + + //! Select the PowerShell lexer. + SCLEX_POWERSHELL = 88, + + //! Select the MySQL lexer. + SCLEX_MYSQL = 89, + + //! Select the gettext .po file lexer. + SCLEX_PO = 90, + + //! Select the TAL lexer. + SCLEX_TAL = 91, + + //! Select the COBOL lexer. + SCLEX_COBOL = 92, + + //! Select the TACL lexer. + SCLEX_TACL = 93, + + //! Select the Sorcus lexer. + SCLEX_SORCUS = 94, + + //! Select the PowerPro lexer. + SCLEX_POWERPRO = 95, + + //! Select the Nimrod lexer. + SCLEX_NIMROD = 96, + + //! Select the SML lexer. + SCLEX_SML = 97, + + //! Select the Markdown lexer. + SCLEX_MARKDOWN = 98, + + //! Select the txt2tags lexer. + SCLEX_TXT2TAGS = 99, + + //! Select the 68000 assembler lexer. + SCLEX_A68K = 100, + + //! Select the Modula 3 lexer. + SCLEX_MODULA = 101, + + //! Select the CoffeeScript lexer. + SCLEX_COFFEESCRIPT = 102, + + //! Select the Take Command lexer. + SCLEX_TCMD = 103, + + //! Select the AviSynth lexer. + SCLEX_AVS = 104, + + //! Select the ECL lexer. + SCLEX_ECL = 105, + + //! Select the OScript lexer. + SCLEX_OSCRIPT = 106, + + //! Select the Visual Prolog lexer. + SCLEX_VISUALPROLOG = 107, + + //! Select the Literal Haskell lexer. + SCLEX_LITERATEHASKELL = 108, + + //! Select the Structured Text lexer. + SCLEX_STTXT = 109, + + //! Select the KVIrc lexer. + SCLEX_KVIRC = 110, + + //! Select the Rust lexer. + SCLEX_RUST = 111, + + //! Select the MSC Nastran DMAP lexer. + SCLEX_DMAP = 112, + + //! Select the assembler lexer ('#' comment character). + SCLEX_AS = 113, + + //! Select the DMIS lexer. + SCLEX_DMIS = 114, + + //! Select the lexer for Windows registry files. + SCLEX_REGISTRY = 115, + + //! Select the BibTex lexer. + SCLEX_BIBTEX = 116, + + //! Select the Motorola S-Record hex lexer. + SCLEX_SREC = 117, + + //! Select the Intel hex lexer. + SCLEX_IHEX = 118, + + //! Select the Tektronix extended hex lexer. + SCLEX_TEHEX = 119, + }; + + enum + { + SC_WEIGHT_NORMAL = 400, + SC_WEIGHT_SEMIBOLD = 600, + SC_WEIGHT_BOLD = 700, + }; + + enum + { + SC_TECHNOLOGY_DEFAULT = 0, + SC_TECHNOLOGY_DIRECTWRITE = 1, + SC_TECHNOLOGY_DIRECTWRITERETAIN = 2, + SC_TECHNOLOGY_DIRECTWRITEDC = 3, + }; + + enum + { + SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE = 0, + SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE = 1, + }; + + enum + { + SC_FONT_SIZE_MULTIPLIER = 100, + }; + + enum + { + SC_FOLDACTION_CONTRACT = 0, + SC_FOLDACTION_EXPAND = 1, + SC_FOLDACTION_TOGGLE = 2, + }; + + enum + { + SC_AUTOMATICFOLD_SHOW = 0x0001, + SC_AUTOMATICFOLD_CLICK = 0x0002, + SC_AUTOMATICFOLD_CHANGE = 0x0004, + }; + + enum + { + SC_ORDER_PRESORTED = 0, + SC_ORDER_PERFORMSORT = 1, + SC_ORDER_CUSTOM = 2, + }; + + //! Construct an empty QsciScintillaBase with parent \a parent. + explicit QsciScintillaBase(QWidget *parent = 0); + + //! Destroys the QsciScintillaBase instance. + virtual ~QsciScintillaBase(); + + //! Returns a pointer to a QsciScintillaBase instance, or 0 if there isn't + //! one. This can be used by the higher level API to send messages that + //! aren't associated with a particular instance. + static QsciScintillaBase *pool(); + + //! Send the Scintilla message \a msg with the optional parameters \a + //! wParam and \a lParam. + long SendScintilla(unsigned int msg, unsigned long wParam = 0, + long lParam = 0) const; + + //! \overload + long SendScintilla(unsigned int msg, unsigned long wParam, + void *lParam) const; + + //! \overload + long SendScintilla(unsigned int msg, unsigned long wParam, + const char *lParam) const; + + //! \overload + long SendScintilla(unsigned int msg, const char *lParam) const; + + //! \overload + long SendScintilla(unsigned int msg, const char *wParam, + const char *lParam) const; + + //! \overload + long SendScintilla(unsigned int msg, long wParam) const; + + //! \overload + long SendScintilla(unsigned int msg, int wParam) const; + + //! \overload + long SendScintilla(unsigned int msg, long cpMin, long cpMax, + char *lpstrText) const; + + //! \overload + long SendScintilla(unsigned int msg, unsigned long wParam, + const QColor &col) const; + + //! \overload + long SendScintilla(unsigned int msg, const QColor &col) const; + + //! \overload + long SendScintilla(unsigned int msg, unsigned long wParam, QPainter *hdc, + const QRect &rc, long cpMin, long cpMax) const; + + //! \overload + long SendScintilla(unsigned int msg, unsigned long wParam, + const QPixmap &lParam) const; + + //! \overload + long SendScintilla(unsigned int msg, unsigned long wParam, + const QImage &lParam) const; + + //! Send the Scintilla message \a msg and return a pointer result. + void *SendScintillaPtrResult(unsigned int msg) const; + + //! \internal + static int commandKey(int qt_key, int &modifiers); + +signals: + //! This signal is emitted when text is selected or de-selected. + //! \a yes is true if text has been selected and false if text has been + //! deselected. + void QSCN_SELCHANGED(bool yes); + + //! This signal is emitted when the user cancels an auto-completion list. + //! + //! \sa SCN_AUTOCSELECTION() + void SCN_AUTOCCANCELLED(); + + //! This signal is emitted when the user deletes a character when an + //! auto-completion list is active. + void SCN_AUTOCCHARDELETED(); + + //! This signal is emitted when the user selects an item in an + //! auto-completion list. It is emitted before the selection is inserted. + //! The insertion can be cancelled by sending an SCI_AUTOCANCEL message + //! from a connected slot. + //! \a selection is the text of the selection. + //! \a position is the start position of the word being completed. + //! + //! \sa SCN_AUTOCCANCELLED() + void SCN_AUTOCSELECTION(const char *selection, int position); + + //! This signal is emitted when the document has changed for any reason. + void SCEN_CHANGE(); + + //! This signal ir emitted when the user clicks on a calltip. + //! \a direction is 1 if the user clicked on the up arrow, 2 if the user + //! clicked on the down arrow, and 0 if the user clicked elsewhere. + void SCN_CALLTIPCLICK(int direction); + + //! This signal is emitted whenever the user enters an ordinary character + //! into the text. + //! \a charadded is the character. It can be used to decide to display a + //! call tip or an auto-completion list. + void SCN_CHARADDED(int charadded); + + //! This signal is emitted when the user double clicks. + //! \a position is the position in the text where the click occured. + //! \a line is the number of the line in the text where the click occured. + //! \a modifiers is the logical or of the modifier keys that were pressed + //! when the user double clicked. + void SCN_DOUBLECLICK(int position, int line, int modifiers); + + //! + void SCN_DWELLEND(int, int, int); + + //! + void SCN_DWELLSTART(int, int, int); + + //! This signal is emitted when focus is received. + void SCN_FOCUSIN(); + + //! This signal is emitted when focus is lost. + void SCN_FOCUSOUT(); + + //! This signal is emitted when the user clicks on text in a style with the + //! hotspot attribute set. + //! \a position is the position in the text where the click occured. + //! \a modifiers is the logical or of the modifier keys that were pressed + //! when the user clicked. + void SCN_HOTSPOTCLICK(int position, int modifiers); + + //! This signal is emitted when the user double clicks on text in a style + //! with the hotspot attribute set. + //! \a position is the position in the text where the double click occured. + //! \a modifiers is the logical or of the modifier keys that were pressed + //! when the user double clicked. + void SCN_HOTSPOTDOUBLECLICK(int position, int modifiers); + + //! This signal is emitted when the user releases the mouse button on text + //! in a style with the hotspot attribute set. + //! \a position is the position in the text where the release occured. + //! \a modifiers is the logical or of the modifier keys that were pressed + //! when the user released the button. + void SCN_HOTSPOTRELEASECLICK(int position, int modifiers); + + //! This signal is emitted when the user clicks on text that has an + //! indicator. + //! \a position is the position in the text where the click occured. + //! \a modifiers is the logical or of the modifier keys that were pressed + //! when the user clicked. + void SCN_INDICATORCLICK(int position, int modifiers); + + //! This signal is emitted when the user releases the mouse button on text + //! that has an indicator. + //! \a position is the position in the text where the release occured. + //! \a modifiers is the logical or of the modifier keys that were pressed + //! when the user released. + void SCN_INDICATORRELEASE(int position, int modifiers); + + //! This signal is emitted when a recordable editor command has been + //! executed. + void SCN_MACRORECORD(unsigned int, unsigned long, void *); + + //! This signal is emitted when the user clicks on a sensitive margin. + //! \a position is the position of the start of the line against which the + //! user clicked. + //! \a modifiers is the logical or of the modifier keys that were pressed + //! when the user clicked. + //! \a margin is the number of the margin the user clicked in: 0, 1 or 2. + //! + //! \sa SCI_GETMARGINSENSITIVEN, SCI_SETMARGINSENSITIVEN + void SCN_MARGINCLICK(int position, int modifiers, int margin); + + //! + void SCN_MODIFIED(int, int, const char *, int, int, int, int, int, int, int); + + //! This signal is emitted when the user attempts to modify read-only + //! text. + void SCN_MODIFYATTEMPTRO(); + + //! + void SCN_NEEDSHOWN(int, int); + + //! This signal is emitted when painting has been completed. It is useful + //! to trigger some other change but to have the paint be done first to + //! appear more reponsive to the user. + void SCN_PAINTED(); + + //! This signal is emitted when the current state of the text no longer + //! corresponds to the state of the text at the save point. + //! + //! \sa SCI_SETSAVEPOINT, SCN_SAVEPOINTREACHED() + void SCN_SAVEPOINTLEFT(); + + //! This signal is emitted when the current state of the text corresponds + //! to the state of the text at the save point. This allows feedback to be + //! given to the user as to whether the text has been modified since it was + //! last saved. + //! + //! \sa SCI_SETSAVEPOINT, SCN_SAVEPOINTLEFT() + void SCN_SAVEPOINTREACHED(); + + //! This signal is emitted when a range of text needs to be syntax styled. + //! The range is from the value returned by the SCI_GETENDSTYLED message + //! and \a position. It is only emitted if the currently selected lexer is + //! SCLEX_CONTAINER. + //! + //! \sa SCI_COLOURISE, SCI_GETENDSTYLED + void SCN_STYLENEEDED(int position); + + //! This signal is emitted when either the text or styling of the text has + //! changed or the selection range or scroll position has changed. + //! \a updated contains the set of SC_UPDATE_* flags describing the changes + //! since the signal was last emitted. + void SCN_UPDATEUI(int updated); + + //! + void SCN_USERLISTSELECTION(const char *, int); + + //! + void SCN_ZOOM(); + +protected: + //! Returns true if the contents of a MIME data object can be decoded and + //! inserted into the document. It is called during drag and paste + //! operations. + //! \a source is the MIME data object. + //! + //! \sa fromMimeData(), toMimeData() + virtual bool canInsertFromMimeData(const QMimeData *source) const; + + //! Returns the text of a MIME data object. It is called when a drag and + //! drop is completed and when text is pasted from the clipboard. + //! \a source is the MIME data object. On return \a rectangular is set if + //! the text corresponds to a rectangular selection. + //! + //! \sa canInsertFromMimeData(), toMimeData() + virtual QByteArray fromMimeData(const QMimeData *source, bool &rectangular) const; + + //! Returns a new MIME data object containing some text and whether it + //! corresponds to a rectangular selection. It is called when a drag and + //! drop is started and when the selection is copied to the clipboard. + //! Ownership of the object is passed to the caller. \a text is the text. + //! \a rectangular is set if the text corresponds to a rectangular + //! selection. + //! + //! \sa canInsertFromMimeData(), fromMimeData() + virtual QMimeData *toMimeData(const QByteArray &text, bool rectangular) const; + + //! Re-implemented to handle the context menu. + virtual void contextMenuEvent(QContextMenuEvent *e); + + //! Re-implemented to handle drag enters. + virtual void dragEnterEvent(QDragEnterEvent *e); + + //! Re-implemented to handle drag leaves. + virtual void dragLeaveEvent(QDragLeaveEvent *e); + + //! Re-implemented to handle drag moves. + virtual void dragMoveEvent(QDragMoveEvent *e); + + //! Re-implemented to handle drops. + virtual void dropEvent(QDropEvent *e); + + //! Re-implemented to tell Scintilla it has the focus. + virtual void focusInEvent(QFocusEvent *e); + + //! Re-implemented to tell Scintilla it has lost the focus. + virtual void focusOutEvent(QFocusEvent *e); + + //! Re-implemented to allow tabs to be entered as text. + virtual bool focusNextPrevChild(bool next); + + //! Re-implemented to handle key presses. + virtual void keyPressEvent(QKeyEvent *e); + + //! Re-implemented to handle composed characters. + virtual void inputMethodEvent(QInputMethodEvent *event); + virtual QVariant inputMethodQuery(Qt::InputMethodQuery query) const; + + //! Re-implemented to handle mouse double-clicks. + virtual void mouseDoubleClickEvent(QMouseEvent *e); + + //! Re-implemented to handle mouse moves. + virtual void mouseMoveEvent(QMouseEvent *e); + + //! Re-implemented to handle mouse presses. + virtual void mousePressEvent(QMouseEvent *e); + + //! Re-implemented to handle mouse releases. + virtual void mouseReleaseEvent(QMouseEvent *e); + + //! Re-implemented to paint the viewport. + virtual void paintEvent(QPaintEvent *e); + + //! Re-implemented to handle resizes. + virtual void resizeEvent(QResizeEvent *e); + + //! \internal Re-implemented to handle scrolling. + virtual void scrollContentsBy(int dx, int dy); + + //! \internal This helps to work around some Scintilla bugs. + void setScrollBars(); + + //! \internal Qt4, Qt5 portability. + typedef QByteArray ScintillaBytes; + +#define ScintillaBytesConstData(b) (b).constData() + + //! \internal Convert a QString to encoded bytes. + ScintillaBytes textAsBytes(const QString &text) const; + + //! \internal Convert encoded bytes to a QString. + QString bytesAsText(const char *bytes) const; + +private slots: + void handleVSb(int value); + void handleHSb(int value); + void handleSelection(); + +private: + // This is needed to allow QsciScintillaQt to emit this class's signals. + friend class QsciScintillaQt; + + QsciScintillaQt *sci; + QPoint triple_click_at; + QTimer triple_click; + int preeditPos; + int preeditNrBytes; + QString preeditString; +#if QT_VERSION >= 0x050000 + bool clickCausedFocus; +#endif + + void acceptAction(QDropEvent *e); + + QsciScintillaBase(const QsciScintillaBase &); + QsciScintillaBase &operator=(const QsciScintillaBase &); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscistyle.h b/libs/qscintilla/Qt4Qt5/Qsci/qscistyle.h new file mode 100644 index 000000000..1b22782c6 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscistyle.h @@ -0,0 +1,197 @@ +// This module defines interface to the QsciStyle class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCISTYLE_H +#define QSCISTYLE_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include +#include +#include + +#include + + +class QsciScintillaBase; + + +//! \brief The QsciStyle class encapsulates all the attributes of a style. +//! +//! Each character of a document has an associated style which determines how +//! the character is displayed, e.g. its font and color. A style is identified +//! by a number. Lexers define styles for each of the language's features so +//! that they are displayed differently. Some style numbers have hard-coded +//! meanings, e.g. the style used for call tips. +class QSCINTILLA_EXPORT QsciStyle +{ +public: + //! This enum defines the different ways the displayed case of the text can + //! be changed. + enum TextCase { + //! The text is displayed as its original case. + OriginalCase = 0, + + //! The text is displayed as upper case. + UpperCase = 1, + + //! The text is displayed as lower case. + LowerCase = 2 + }; + + //! Constructs a QsciStyle instance for style number \a style. If \a style + //! is negative then a new style number is automatically allocated. + QsciStyle(int style = -1); + + //! Constructs a QsciStyle instance for style number \a style. If \a style + //! is negative then a new style number is automatically allocated. The + //! styles description, color, paper color, font and end-of-line fill are + //! set to \a description, \a color, \a paper, \a font and \a eolFill + //! respectively. + QsciStyle(int style, const QString &description, const QColor &color, + const QColor &paper, const QFont &font, bool eolFill = false); + + //! \internal Apply the style to a particular editor. + void apply(QsciScintillaBase *sci) const; + + //! Returns the number of the style. + int style() const {return style_nr;} + + //! The style's description is set to \a description. + //! + //! \sa description() + void setDescription(const QString &description) {style_description = description;} + + //! Returns the style's description. + //! + //! \sa setDescription() + QString description() const {return style_description;} + + //! The style's foreground color is set to \a color. The default is taken + //! from the application's default palette. + //! + //! \sa color() + void setColor(const QColor &color); + + //! Returns the style's foreground color. + //! + //! \sa setColor() + QColor color() const {return style_color;} + + //! The style's background color is set to \a paper. The default is taken + //! from the application's default palette. + //! + //! \sa paper() + void setPaper(const QColor &paper); + + //! Returns the style's background color. + //! + //! \sa setPaper() + QColor paper() const {return style_paper;} + + //! The style's font is set to \a font. The default is the application's + //! default font. + //! + //! \sa font() + void setFont(const QFont &font); + + //! Returns the style's font. + //! + //! \sa setFont() + QFont font() const {return style_font;} + + //! The style's end-of-line fill is set to \a fill. The default is false. + //! + //! \sa eolFill() + void setEolFill(bool fill); + + //! Returns the style's end-of-line fill. + //! + //! \sa setEolFill() + bool eolFill() const {return style_eol_fill;} + + //! The style's text case is set to \a text_case. The default is + //! OriginalCase. + //! + //! \sa textCase() + void setTextCase(TextCase text_case); + + //! Returns the style's text case. + //! + //! \sa setTextCase() + TextCase textCase() const {return style_case;} + + //! The style's visibility is set to \a visible. The default is true. + //! + //! \sa visible() + void setVisible(bool visible); + + //! Returns the style's visibility. + //! + //! \sa setVisible() + bool visible() const {return style_visible;} + + //! The style's changeability is set to \a changeable. The default is + //! true. + //! + //! \sa changeable() + void setChangeable(bool changeable); + + //! Returns the style's changeability. + //! + //! \sa setChangeable() + bool changeable() const {return style_changeable;} + + //! The style's sensitivity to mouse clicks is set to \a hotspot. The + //! default is false. + //! + //! \sa hotspot() + void setHotspot(bool hotspot); + + //! Returns the style's sensitivity to mouse clicks. + //! + //! \sa setHotspot() + bool hotspot() const {return style_hotspot;} + + //! Refresh the style settings. + void refresh(); + +private: + int style_nr; + QString style_description; + QColor style_color; + QColor style_paper; + QFont style_font; + bool style_eol_fill; + TextCase style_case; + bool style_visible; + bool style_changeable; + bool style_hotspot; + + void init(int style); +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qscistyledtext.h b/libs/qscintilla/Qt4Qt5/Qsci/qscistyledtext.h new file mode 100644 index 000000000..66da82561 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/Qsci/qscistyledtext.h @@ -0,0 +1,69 @@ +// This module defines interface to the QsciStyledText class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef QSCISTYLEDTEXT_H +#define QSCISTYLEDTEXT_H + +#ifdef __APPLE__ +extern "C++" { +#endif + +#include + +#include + + +class QsciScintillaBase; +class QsciStyle; + + +//! \brief The QsciStyledText class is a container for a piece of text and the +//! style used to display the text. +class QSCINTILLA_EXPORT QsciStyledText +{ +public: + //! Constructs a QsciStyledText instance for text \a text and style number + //! \a style. + QsciStyledText(const QString &text, int style); + + //! Constructs a QsciStyledText instance for text \a text and style \a + //! style. + QsciStyledText(const QString &text, const QsciStyle &style); + + //! \internal Apply the style to a particular editor. + void apply(QsciScintillaBase *sci) const; + + //! Returns a reference to the text. + const QString &text() const {return styled_text;} + + //! Returns the number of the style. + int style() const; + +private: + QString styled_text; + int style_nr; + const QsciStyle *explicit_style; +}; + +#ifdef __APPLE__ +} +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/SciClasses.cpp b/libs/qscintilla/Qt4Qt5/SciClasses.cpp new file mode 100644 index 000000000..3822cbfe1 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/SciClasses.cpp @@ -0,0 +1,209 @@ +// The implementation of various Qt version independent classes used by the +// rest of the port. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "SciNamespace.h" +#include "SciClasses.h" + +#include +#include +#include +#include +#include +#include + +#include "ScintillaQt.h" +#include "ListBoxQt.h" + + +// Create a call tip. +QsciSciCallTip::QsciSciCallTip(QWidget *parent, QsciScintillaQt *sci_) + : QWidget(parent, Qt::WindowFlags(Qt::Popup|Qt::FramelessWindowHint|Qt::WA_StaticContents)), + sci(sci_) +{ + // Ensure that the main window keeps the focus (and the caret flashing) + // when this is displayed. + setFocusProxy(parent); +} + + +// Destroy a call tip. +QsciSciCallTip::~QsciSciCallTip() +{ + // Ensure that the main window doesn't receive a focus out event when + // this is destroyed. + setFocusProxy(0); +} + + +// Paint a call tip. +void QsciSciCallTip::paintEvent(QPaintEvent *) +{ + QSCI_SCI_NAMESPACE(Surface) *surfaceWindow = QSCI_SCI_NAMESPACE(Surface)::Allocate(SC_TECHNOLOGY_DEFAULT); + + if (!surfaceWindow) + return; + + QPainter p(this); + + surfaceWindow->Init(&p); + surfaceWindow->SetUnicodeMode(sci->CodePage() == SC_CP_UTF8); + sci->ct.PaintCT(surfaceWindow); + + delete surfaceWindow; +} + + +// Handle a mouse press in a call tip. +void QsciSciCallTip::mousePressEvent(QMouseEvent *e) +{ + QSCI_SCI_NAMESPACE(Point) pt; + + pt.x = e->x(); + pt.y = e->y(); + + sci->ct.MouseClick(pt); + sci->CallTipClick(); + + update(); +} + + +// Create the popup instance. +QsciSciPopup::QsciSciPopup() +{ + // Set up the mapper. + connect(&mapper, SIGNAL(mapped(int)), this, SLOT(on_triggered(int))); +} + + +// Add an item and associated command to the popup and enable it if required. +void QsciSciPopup::addItem(const QString &label, int cmd, bool enabled, + QsciScintillaQt *sci_) +{ + QAction *act = addAction(label, &mapper, SLOT(map())); + mapper.setMapping(act, cmd); + act->setEnabled(enabled); + sci = sci_; +} + + +// A slot to handle a menu action being triggered. +void QsciSciPopup::on_triggered(int cmd) +{ + sci->Command(cmd); +} + + +QsciSciListBox::QsciSciListBox(QWidget *parent, QsciListBoxQt *lbx_) + : QListWidget(parent), lbx(lbx_) +{ + setAttribute(Qt::WA_StaticContents); + +#if defined(Q_OS_WIN) + setWindowFlags(Qt::Tool|Qt::FramelessWindowHint); + + // This stops the main widget losing focus when the user clicks on this one + // (which prevents this one being destroyed). + setFocusPolicy(Qt::NoFocus); +#else + // This is the root of the focus problems under Gnome's window manager. We + // have tried many flag combinations in the past. The consensus now seems + // to be that the following works. However it might now work because of a + // change in Qt so we only enable it for recent versions in order to + // reduce the risk of breaking something that works with earlier versions. +#if QT_VERSION >= 0x040500 + setWindowFlags(Qt::ToolTip|Qt::WindowStaysOnTopHint); +#else + setWindowFlags(Qt::Tool|Qt::FramelessWindowHint); +#endif + + // This may not be needed. + setFocusProxy(parent); +#endif + + setFrameShape(StyledPanel); + setFrameShadow(Plain); + + connect(this, SIGNAL(itemDoubleClicked(QListWidgetItem *)), + SLOT(handleSelection())); +} + + +void QsciSciListBox::addItemPixmap(const QPixmap &pm, const QString &txt) +{ + new QListWidgetItem(pm, txt, this); +} + + +int QsciSciListBox::find(const QString &prefix) +{ + QList itms = findItems(prefix, + Qt::MatchStartsWith|Qt::MatchCaseSensitive); + + if (itms.size() == 0) + return -1; + + return row(itms[0]); +} + + +QString QsciSciListBox::text(int n) +{ + QListWidgetItem *itm = item(n); + + if (!itm) + return QString(); + + return itm->text(); +} + + +// Reimplemented to close the list when the user presses Escape. +void QsciSciListBox::keyPressEvent(QKeyEvent *e) +{ + if (e->key() == Qt::Key_Escape) + { + e->accept(); + close(); + } + else + { + QListWidget::keyPressEvent(e); + + if (!e->isAccepted()) + QCoreApplication::sendEvent(parent(), e); + } +} + + +QsciSciListBox::~QsciSciListBox() +{ + // Ensure that the main widget doesn't get a focus out event when this is + // destroyed. + setFocusProxy(0); +} + + +void QsciSciListBox::handleSelection() +{ + if (lbx && lbx->cb_action) + lbx->cb_action(lbx->cb_data); +} diff --git a/libs/qscintilla/Qt4Qt5/SciClasses.h b/libs/qscintilla/Qt4Qt5/SciClasses.h new file mode 100644 index 000000000..7b5f5da58 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/SciClasses.h @@ -0,0 +1,105 @@ +// The definition of various Qt version independent classes used by the rest of +// the port. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _SCICLASSES_H +#define _SCICLASSES_H + +#include +#include +#include +#include + +#include + + +class QsciScintillaQt; +class QsciListBoxQt; + + +// A simple QWidget sub-class to implement a call tip. This is not put into +// the Scintilla namespace because of moc's problems with preprocessor macros. +class QsciSciCallTip : public QWidget +{ + Q_OBJECT + +public: + QsciSciCallTip(QWidget *parent, QsciScintillaQt *sci_); + ~QsciSciCallTip(); + +protected: + void paintEvent(QPaintEvent *e); + void mousePressEvent(QMouseEvent *e); + +private: + QsciScintillaQt *sci; +}; + + +// A popup menu where options correspond to a numeric command. This is not put +// into the Scintilla namespace because of moc's problems with preprocessor +// macros. +class QsciSciPopup : public QMenu +{ + Q_OBJECT + +public: + QsciSciPopup(); + + void addItem(const QString &label, int cmd, bool enabled, + QsciScintillaQt *sci_); + +private slots: + void on_triggered(int cmd); + +private: + QsciScintillaQt *sci; + QSignalMapper mapper; +}; + + +// This sub-class of QListBox is needed to provide slots from which we can call +// QsciListBox's double-click callback (and you thought this was a C++ +// program). This is not put into the Scintilla namespace because of moc's +// problems with preprocessor macros. +class QsciSciListBox : public QListWidget +{ + Q_OBJECT + +public: + QsciSciListBox(QWidget *parent, QsciListBoxQt *lbx_); + virtual ~QsciSciListBox(); + + void addItemPixmap(const QPixmap &pm, const QString &txt); + + int find(const QString &prefix); + QString text(int n); + +protected: + void keyPressEvent(QKeyEvent *e); + +private slots: + void handleSelection(); + +private: + QsciListBoxQt *lbx; +}; + +#endif diff --git a/libs/qscintilla/Qt4Qt5/SciNamespace.h b/libs/qscintilla/Qt4Qt5/SciNamespace.h new file mode 100644 index 000000000..5c4e3a11c --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/SciNamespace.h @@ -0,0 +1,35 @@ +// Support for building the Scintilla code in the Scintilla namespace using the +// -DSCI_NAMESPACE compiler flag. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef _SCINAMESPACE_H +#define _SCINAMESPACE_H + +#ifdef SCI_NAMESPACE +#define QSCI_SCI_NAMESPACE(name) Scintilla::name +#define QSCI_BEGIN_SCI_NAMESPACE namespace Scintilla { +#define QSCI_END_SCI_NAMESPACE }; +#else +#define QSCI_SCI_NAMESPACE(name) name +#define QSCI_BEGIN_SCI_NAMESPACE +#define QSCI_END_SCI_NAMESPACE +#endif + +#endif diff --git a/libs/qscintilla/Qt4Qt5/ScintillaQt.cpp b/libs/qscintilla/Qt4Qt5/ScintillaQt.cpp new file mode 100644 index 000000000..5cfc7eec4 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/ScintillaQt.cpp @@ -0,0 +1,694 @@ +// The implementation of the Qt specific subclass of ScintillaBase. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Qsci/qsciscintillabase.h" +#include "ScintillaQt.h" +#include "SciClasses.h" + + +// We want to use the Scintilla notification names as Qt signal names. +#undef SCEN_CHANGE +#undef SCN_AUTOCCANCELLED +#undef SCN_AUTOCCHARDELETED +#undef SCN_AUTOCSELECTION +#undef SCN_CALLTIPCLICK +#undef SCN_CHARADDED +#undef SCN_DOUBLECLICK +#undef SCN_DWELLEND +#undef SCN_DWELLSTART +#undef SCN_FOCUSIN +#undef SCN_FOCUSOUT +#undef SCN_HOTSPOTCLICK +#undef SCN_HOTSPOTDOUBLECLICK +#undef SCN_HOTSPOTRELEASECLICK +#undef SCN_INDICATORCLICK +#undef SCN_INDICATORRELEASE +#undef SCN_MACRORECORD +#undef SCN_MARGINCLICK +#undef SCN_MODIFIED +#undef SCN_MODIFYATTEMPTRO +#undef SCN_NEEDSHOWN +#undef SCN_PAINTED +#undef SCN_SAVEPOINTLEFT +#undef SCN_SAVEPOINTREACHED +#undef SCN_STYLENEEDED +#undef SCN_UPDATEUI +#undef SCN_USERLISTSELECTION +#undef SCN_ZOOM + +enum +{ + SCEN_CHANGE = 768, + SCN_AUTOCCANCELLED = 2025, + SCN_AUTOCCHARDELETED = 2026, + SCN_AUTOCSELECTION = 2022, + SCN_CALLTIPCLICK = 2021, + SCN_CHARADDED = 2001, + SCN_DOUBLECLICK = 2006, + SCN_DWELLEND = 2017, + SCN_DWELLSTART = 2016, + SCN_FOCUSIN = 2028, + SCN_FOCUSOUT = 2029, + SCN_HOTSPOTCLICK = 2019, + SCN_HOTSPOTDOUBLECLICK = 2020, + SCN_HOTSPOTRELEASECLICK = 2027, + SCN_INDICATORCLICK = 2023, + SCN_INDICATORRELEASE = 2024, + SCN_MACRORECORD = 2009, + SCN_MARGINCLICK = 2010, + SCN_MODIFIED = 2008, + SCN_MODIFYATTEMPTRO = 2004, + SCN_NEEDSHOWN = 2011, + SCN_PAINTED = 2013, + SCN_SAVEPOINTLEFT = 2003, + SCN_SAVEPOINTREACHED = 2002, + SCN_STYLENEEDED = 2000, + SCN_UPDATEUI = 2007, + SCN_USERLISTSELECTION = 2014, + SCN_ZOOM = 2018 +}; + + +// The ctor. +QsciScintillaQt::QsciScintillaQt(QsciScintillaBase *qsb_) + : vMax(0), hMax(0), vPage(0), hPage(0), capturedMouse(false), qsb(qsb_) +{ + wMain = qsb->viewport(); + + // This is ignored. + imeInteraction = imeInline; + + for (int i = 0; i <= static_cast(tickPlatform); ++i) + timers[i] = 0; + + Initialise(); +} + + +// The dtor. +QsciScintillaQt::~QsciScintillaQt() +{ + Finalise(); +} + + +// Initialise the instance. +void QsciScintillaQt::Initialise() +{ +} + + +// Tidy up the instance. +void QsciScintillaQt::Finalise() +{ + for (int i = 0; i <= static_cast(tickPlatform); ++i) + FineTickerCancel(static_cast(i)); + + ScintillaBase::Finalise(); +} + + +// Start a drag. +void QsciScintillaQt::StartDrag() +{ + inDragDrop = ddDragging; + + QDrag *qdrag = new QDrag(qsb); + qdrag->setMimeData(mimeSelection(drag)); + +#if QT_VERSION >= 0x040300 + Qt::DropAction action = qdrag->exec(Qt::MoveAction | Qt::CopyAction, Qt::MoveAction); +#else + Qt::DropAction action = qdrag->start(Qt::MoveAction); +#endif + + // Remove the dragged text if it was a move to another widget or + // application. + if (action == Qt::MoveAction && qdrag->target() != qsb->viewport()) + ClearSelection(); + + SetDragPosition(QSCI_SCI_NAMESPACE(SelectionPosition)()); + inDragDrop = ddNone; +} + + +// Re-implement to trap certain messages. +sptr_t QsciScintillaQt::WndProc(unsigned int iMessage, uptr_t wParam, + sptr_t lParam) +{ + switch (iMessage) + { + case SCI_GETDIRECTFUNCTION: + return reinterpret_cast(DirectFunction); + + case SCI_GETDIRECTPOINTER: + return reinterpret_cast(this); + } + + return ScintillaBase::WndProc(iMessage, wParam, lParam); +} + + +// Windows nonsense. +sptr_t QsciScintillaQt::DefWndProc(unsigned int, uptr_t, sptr_t) +{ + return 0; +} + + +// Grab or release the mouse (and keyboard). +void QsciScintillaQt::SetMouseCapture(bool on) +{ + if (mouseDownCaptures) + if (on) + qsb->viewport()->grabMouse(); + else + qsb->viewport()->releaseMouse(); + + capturedMouse = on; +} + + +// Return true if the mouse/keyboard are currently grabbed. +bool QsciScintillaQt::HaveMouseCapture() +{ + return capturedMouse; +} + + +// Set the position of the vertical scrollbar. +void QsciScintillaQt::SetVerticalScrollPos() +{ + QScrollBar *sb = qsb->verticalScrollBar(); + bool was_blocked = sb->blockSignals(true); + + sb->setValue(topLine); + + sb->blockSignals(was_blocked); +} + + +// Set the position of the horizontal scrollbar. +void QsciScintillaQt::SetHorizontalScrollPos() +{ + QScrollBar *sb = qsb->horizontalScrollBar(); + bool was_blocked = sb->blockSignals(true); + + sb->setValue(xOffset); + + sb->blockSignals(was_blocked); +} + + +// Set the extent of the vertical and horizontal scrollbars and return true if +// the view needs re-drawing. +bool QsciScintillaQt::ModifyScrollBars(int nMax,int nPage) +{ + bool modified = false; + QScrollBar *sb; + + int vNewPage = nPage; + int vNewMax = nMax - vNewPage + 1; + + if (vMax != vNewMax || vPage != vNewPage) + { + vMax = vNewMax; + vPage = vNewPage; + modified = true; + + sb = qsb->verticalScrollBar(); + sb->setMaximum(vMax); + sb->setPageStep(vPage); + } + + int hNewPage = GetTextRectangle().Width(); + int hNewMax = (scrollWidth > hNewPage) ? scrollWidth - hNewPage : 0; + int charWidth = vs.styles[STYLE_DEFAULT].aveCharWidth; + + sb = qsb->horizontalScrollBar(); + + if (hMax != hNewMax || hPage != hNewPage || sb->singleStep() != charWidth) + { + hMax = hNewMax; + hPage = hNewPage; + modified = true; + + sb->setMaximum(hMax); + sb->setPageStep(hPage); + sb->setSingleStep(charWidth); + } + + return modified; +} + + +// Called after SCI_SETWRAPMODE and SCI_SETHSCROLLBAR. +void QsciScintillaQt::ReconfigureScrollBars() +{ + // Hide or show the scrollbars if needed. + bool hsb = (horizontalScrollBarVisible && !Wrapping()); + + qsb->setHorizontalScrollBarPolicy(hsb ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff); + qsb->setVerticalScrollBarPolicy(verticalScrollBarVisible ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff); +} + + +// Notify interested parties of any change in the document. +void QsciScintillaQt::NotifyChange() +{ + emit qsb->SCEN_CHANGE(); +} + + +// Notify interested parties of various events. This is the main mapping +// between Scintilla notifications and Qt signals. +void QsciScintillaQt::NotifyParent(QSCI_SCI_NAMESPACE(SCNotification) scn) +{ + switch (scn.nmhdr.code) + { + case SCN_CALLTIPCLICK: + emit qsb->SCN_CALLTIPCLICK(scn.position); + break; + + case SCN_AUTOCCANCELLED: + emit qsb->SCN_AUTOCCANCELLED(); + break; + + case SCN_AUTOCCHARDELETED: + emit qsb->SCN_AUTOCCHARDELETED(); + break; + + case SCN_AUTOCSELECTION: + emit qsb->SCN_AUTOCSELECTION(scn.text, scn.lParam); + break; + + case SCN_CHARADDED: + emit qsb->SCN_CHARADDED(scn.ch); + break; + + case SCN_DOUBLECLICK: + emit qsb->SCN_DOUBLECLICK(scn.position, scn.line, scn.modifiers); + break; + + case SCN_DWELLEND: + emit qsb->SCN_DWELLEND(scn.position, scn.x, scn.y); + break; + + case SCN_DWELLSTART: + emit qsb->SCN_DWELLSTART(scn.position, scn.x, scn.y); + break; + + case SCN_FOCUSIN: + emit qsb->SCN_FOCUSIN(); + break; + + case SCN_FOCUSOUT: + emit qsb->SCN_FOCUSOUT(); + break; + + case SCN_HOTSPOTCLICK: + emit qsb->SCN_HOTSPOTCLICK(scn.position, scn.modifiers); + break; + + case SCN_HOTSPOTDOUBLECLICK: + emit qsb->SCN_HOTSPOTDOUBLECLICK(scn.position, scn.modifiers); + break; + + case SCN_HOTSPOTRELEASECLICK: + emit qsb->SCN_HOTSPOTRELEASECLICK(scn.position, scn.modifiers); + break; + + case SCN_INDICATORCLICK: + emit qsb->SCN_INDICATORCLICK(scn.position, scn.modifiers); + break; + + case SCN_INDICATORRELEASE: + emit qsb->SCN_INDICATORRELEASE(scn.position, scn.modifiers); + break; + + case SCN_MACRORECORD: + emit qsb->SCN_MACRORECORD(scn.message, scn.wParam, + reinterpret_cast(scn.lParam)); + break; + + case SCN_MARGINCLICK: + emit qsb->SCN_MARGINCLICK(scn.position, scn.modifiers, scn.margin); + break; + + case SCN_MODIFIED: + { + char *text; + + // Give some protection to the Python bindings. + if (scn.text && (scn.modificationType & (SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT) != 0)) + { + text = new char[scn.length + 1]; + memcpy(text, scn.text, scn.length); + text[scn.length] = '\0'; + } + else + { + text = 0; + } + + emit qsb->SCN_MODIFIED(scn.position, scn.modificationType, text, + scn.length, scn.linesAdded, scn.line, scn.foldLevelNow, + scn.foldLevelPrev, scn.token, scn.annotationLinesAdded); + + if (text) + delete[] text; + + break; + } + + case SCN_MODIFYATTEMPTRO: + emit qsb->SCN_MODIFYATTEMPTRO(); + break; + + case SCN_NEEDSHOWN: + emit qsb->SCN_NEEDSHOWN(scn.position, scn.length); + break; + + case SCN_PAINTED: + emit qsb->SCN_PAINTED(); + break; + + case SCN_SAVEPOINTLEFT: + emit qsb->SCN_SAVEPOINTLEFT(); + break; + + case SCN_SAVEPOINTREACHED: + emit qsb->SCN_SAVEPOINTREACHED(); + break; + + case SCN_STYLENEEDED: + emit qsb->SCN_STYLENEEDED(scn.position); + break; + + case SCN_UPDATEUI: + emit qsb->SCN_UPDATEUI(scn.updated); + break; + + case SCN_USERLISTSELECTION: + emit qsb->SCN_USERLISTSELECTION(scn.text, scn.wParam); + break; + + case SCN_ZOOM: + emit qsb->SCN_ZOOM(); + break; + + default: + qWarning("Unknown notification: %u", scn.nmhdr.code); + } +} + + +// Convert a selection to mime data. +QMimeData *QsciScintillaQt::mimeSelection( + const QSCI_SCI_NAMESPACE(SelectionText) &text) const +{ + return qsb->toMimeData(QByteArray(text.Data()), text.rectangular); +} + + +// Copy the selected text to the clipboard. +void QsciScintillaQt::CopyToClipboard( + const QSCI_SCI_NAMESPACE(SelectionText) &selectedText) +{ + QApplication::clipboard()->setMimeData(mimeSelection(selectedText)); +} + + +// Implement copy. +void QsciScintillaQt::Copy() +{ + if (!sel.Empty()) + { + QSCI_SCI_NAMESPACE(SelectionText) text; + + CopySelectionRange(&text); + CopyToClipboard(text); + } +} + + +// Implement pasting text. +void QsciScintillaQt::Paste() +{ + pasteFromClipboard(QClipboard::Clipboard); +} + + +// Paste text from either the clipboard or selection. +void QsciScintillaQt::pasteFromClipboard(QClipboard::Mode mode) +{ + int len; + const char *s; + bool rectangular; + + const QMimeData *source = QApplication::clipboard()->mimeData(mode); + + if (!source || !qsb->canInsertFromMimeData(source)) + return; + + QByteArray text = qsb->fromMimeData(source, rectangular); + len = text.length(); + s = text.data(); + + std::string dest = QSCI_SCI_NAMESPACE(Document)::TransformLineEnds(s, len, + pdoc->eolMode); + + QSCI_SCI_NAMESPACE(SelectionText) selText; + selText.Copy(dest, (IsUnicodeMode() ? SC_CP_UTF8 : 0), + vs.styles[STYLE_DEFAULT].characterSet, rectangular, false); + + QSCI_SCI_NAMESPACE(UndoGroup) ug(pdoc); + + ClearSelection(); + InsertPasteShape(selText.Data(), selText.Length(), + selText.rectangular ? pasteRectangular : pasteStream); + EnsureCaretVisible(); +} + + +// Create a call tip window. +void QsciScintillaQt::CreateCallTipWindow(QSCI_SCI_NAMESPACE(PRectangle) rc) +{ + if (!ct.wCallTip.Created()) + ct.wCallTip = ct.wDraw = new QsciSciCallTip(qsb, this); + + QsciSciCallTip *w = reinterpret_cast(ct.wCallTip.GetID()); + + w->resize(rc.right - rc.left, rc.bottom - rc.top); + ct.wCallTip.Show(); +} + + +// Add an item to the right button menu. +void QsciScintillaQt::AddToPopUp(const char *label, int cmd, bool enabled) +{ + QsciSciPopup *pm = static_cast(popup.GetID()); + + if (*label) + pm->addItem(qApp->translate("ContextMenu", label), cmd, enabled, this); + else + pm->addSeparator(); +} + + +// Claim the selection. +void QsciScintillaQt::ClaimSelection() +{ + bool isSel = !sel.Empty(); + + if (isSel) + { + QClipboard *cb = QApplication::clipboard(); + + // If we support X11 style selection then make it available now. + if (cb->supportsSelection()) + { + QSCI_SCI_NAMESPACE(SelectionText) text; + + CopySelectionRange(&text); + + if (text.Data()) + cb->setMimeData(mimeSelection(text), QClipboard::Selection); + } + + primarySelection = true; + } + else + primarySelection = false; + + emit qsb->QSCN_SELCHANGED(isSel); +} + + +// Unclaim the selection. +void QsciScintillaQt::UnclaimSelection() +{ + if (primarySelection) + { + primarySelection = false; + qsb->viewport()->update(); + } +} + + +// Implemented to provide compatibility with the Windows version. +sptr_t QsciScintillaQt::DirectFunction(QsciScintillaQt *sciThis, unsigned int iMessage, + uptr_t wParam, sptr_t lParam) +{ + return sciThis->WndProc(iMessage,wParam,lParam); +} + + +// Draw the contents of the widget. +void QsciScintillaQt::paintEvent(QPaintEvent *e) +{ + QSCI_SCI_NAMESPACE(Surface) *sw = QSCI_SCI_NAMESPACE(Surface)::Allocate(SC_TECHNOLOGY_DEFAULT); + + if (!sw) + return; + + paintState = painting; + + const QRect &qr = e->rect(); + + rcPaint.left = qr.left(); + rcPaint.top = qr.top(); + rcPaint.right = qr.right() + 1; + rcPaint.bottom = qr.bottom() + 1; + + QSCI_SCI_NAMESPACE(PRectangle) rcText = GetTextRectangle(); + paintingAllText = rcPaint.Contains(rcText); + + QPainter painter(qsb->viewport()); + + sw->Init(&painter); + sw->SetUnicodeMode(CodePage() == SC_CP_UTF8); + Paint(sw, rcPaint); + + delete sw; + + // If the painting area was insufficient to cover the new style or brace + // highlight positions then repaint the whole thing. + if (paintState == paintAbandoned) + qsb->viewport()->update(); + + paintState = notPainting; +} + + +// Re-implemented to drive the tickers. +void QsciScintillaQt::timerEvent(QTimerEvent *e) +{ + for (int i = 0; i <= static_cast(tickPlatform); ++i) + if (timers[i] == e->timerId()) + TickFor(static_cast(i)); +} + + +// Re-implemented to say we support fine tickers. +bool QsciScintillaQt::FineTickerAvailable() +{ + return true; +} + + +// Re-implemented to stop a ticker. +void QsciScintillaQt::FineTickerCancel(TickReason reason) +{ + int &ticker = timers[static_cast(reason)]; + + if (ticker != 0) + { + killTimer(ticker); + ticker = 0; + } +} + + +// Re-implemented to check if a particular ticker is running. +bool QsciScintillaQt::FineTickerRunning(TickReason reason) +{ + return (timers[static_cast(reason)] != 0); +} + + +// Re-implemented to start a ticker. +void QsciScintillaQt::FineTickerStart(TickReason reason, int ms, int) +{ + int &ticker = timers[static_cast(reason)]; + + if (ticker != 0) + killTimer(ticker); + + ticker = startTimer(ms); +} + + +// Re-implemented to support idle processing. +bool QsciScintillaQt::SetIdle(bool on) +{ + if (on) + { + if (!idler.state) + { + QTimer *timer = reinterpret_cast(idler.idlerID); + + if (!timer) + { + idler.idlerID = timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(onIdle())); + } + + timer->start(0); + idler.state = true; + } + } + else if (idler.state) + { + reinterpret_cast(idler.idlerID)->stop(); + idler.state = false; + } + + return true; +} + + +// Invoked to trigger any idle processing. +void QsciScintillaQt::onIdle() +{ + if (!Idle()) + SetIdle(false); +} diff --git a/libs/qscintilla/Qt4Qt5/ScintillaQt.h b/libs/qscintilla/Qt4Qt5/ScintillaQt.h new file mode 100644 index 000000000..cb8892233 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/ScintillaQt.h @@ -0,0 +1,150 @@ +// The definition of the Qt specific subclass of ScintillaBase. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#ifndef SCINTILLAQT_H +#define SCINTILLAQT_H + + +#include +#include + +#include + +#include "SciNamespace.h" + +// These are needed because Scintilla class header files don't manage their own +// dependencies properly. +#include +#include +#include +#include +#include +#include +#include +#include +#include "ILexer.h" +#include "Platform.h" +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "CellBuffer.h" +#include "CharClassify.h" +#include "RunStyles.h" +#include "CaseFolder.h" +#include "Decoration.h" +#include "Document.h" +#include "Style.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Indicator.h" +#include "ViewStyle.h" +#include "KeyMap.h" +#include "ContractionState.h" +#include "Selection.h" +#include "PositionCache.h" +#include "EditModel.h" +#include "MarginView.h" +#include "EditView.h" +#include "Editor.h" +#include "AutoComplete.h" +#include "CallTip.h" +#include "LexAccessor.h" +#include "Accessor.h" + +#include "ScintillaBase.h" + + +QT_BEGIN_NAMESPACE +class QMimeData; +class QPaintEvent; +QT_END_NAMESPACE + +class QsciScintillaBase; +class QsciSciCallTip; +class QsciSciPopup; + + +// This is an internal class but it is referenced by a public class so it has +// to have a Qsci prefix rather than being put in the Scintilla namespace +// which would mean exposing the SCI_NAMESPACE mechanism). +class QsciScintillaQt : public QObject, public QSCI_SCI_NAMESPACE(ScintillaBase) +{ + Q_OBJECT + + friend class QsciScintillaBase; + friend class QsciSciCallTip; + friend class QsciSciPopup; + +public: + QsciScintillaQt(QsciScintillaBase *qsb_); + virtual ~QsciScintillaQt(); + + virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, + sptr_t lParam); + +protected: + void timerEvent(QTimerEvent *e); + +private slots: + void onIdle(); + +private: + void Initialise(); + void Finalise(); + bool SetIdle(bool on); + void StartDrag(); + sptr_t DefWndProc(unsigned int, uptr_t, sptr_t); + void SetMouseCapture(bool on); + bool HaveMouseCapture(); + void SetVerticalScrollPos(); + void SetHorizontalScrollPos(); + bool ModifyScrollBars(int nMax, int nPage); + void ReconfigureScrollBars(); + void NotifyChange(); + void NotifyParent(QSCI_SCI_NAMESPACE(SCNotification) scn); + void CopyToClipboard( + const QSCI_SCI_NAMESPACE(SelectionText) &selectedText); + void Copy(); + void Paste(); + void CreateCallTipWindow(QSCI_SCI_NAMESPACE(PRectangle) rc); + void AddToPopUp(const char *label, int cmd = 0, bool enabled = true); + void ClaimSelection(); + void UnclaimSelection(); + static sptr_t DirectFunction(QsciScintillaQt *sci, unsigned int iMessage, + uptr_t wParam,sptr_t lParam); + + QMimeData *mimeSelection( + const QSCI_SCI_NAMESPACE(SelectionText) &text) const; + void paintEvent(QPaintEvent *e); + void pasteFromClipboard(QClipboard::Mode mode); + + // tickPlatform is the last of the TickReason members. + int timers[tickPlatform + 1]; + bool FineTickerAvailable(); + void FineTickerCancel(TickReason reason); + bool FineTickerRunning(TickReason reason); + void FineTickerStart(TickReason reason, int ms, int tolerance); + + int vMax, hMax, vPage, hPage; + bool capturedMouse; + QsciScintillaBase *qsb; +}; + +#endif diff --git a/libs/qscintilla/Qt4Qt5/features/qscintilla2.prf b/libs/qscintilla/Qt4Qt5/features/qscintilla2.prf new file mode 100644 index 000000000..e91e3beb5 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/features/qscintilla2.prf @@ -0,0 +1,25 @@ +greaterThan(QT_MAJOR_VERSION, 4) { + QT += widgets printsupport + + greaterThan(QT_MINOR_VERSION, 1) { + macx:QT += macextras + } +} + +INCLUDEPATH += $$[QT_INSTALL_HEADERS] + +LIBS += -L$$[QT_INSTALL_LIBS] + +CONFIG(debug, debug|release) { + mac: { + LIBS += -lqscintilla2_debug + } else { + win32: { + LIBS += -lqscintilla2d + } else { + LIBS += -lqscintilla2 + } + } +} else { + LIBS += -lqscintilla2 +} diff --git a/libs/qscintilla/Qt4Qt5/qsciabstractapis.cpp b/libs/qscintilla/Qt4Qt5/qsciabstractapis.cpp new file mode 100644 index 000000000..430b0cfe6 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qsciabstractapis.cpp @@ -0,0 +1,50 @@ +// This module implements the QsciAbstractAPIs class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qsciabstractapis.h" + +#include "Qsci/qscilexer.h" + + +// The ctor. +QsciAbstractAPIs::QsciAbstractAPIs(QsciLexer *lexer) + : QObject(lexer), lex(lexer) +{ + lexer->setAPIs(this); +} + + +// The dtor. +QsciAbstractAPIs::~QsciAbstractAPIs() +{ +} + + +// Return the lexer. +QsciLexer *QsciAbstractAPIs::lexer() const +{ + return lex; +} + + +// Called when the user has made a selection from the auto-completion list. +void QsciAbstractAPIs::autoCompletionSelected(const QString &selection) +{ +} diff --git a/libs/qscintilla/Qt4Qt5/qsciapis.cpp b/libs/qscintilla/Qt4Qt5/qsciapis.cpp new file mode 100644 index 000000000..c54caa796 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qsciapis.cpp @@ -0,0 +1,968 @@ +// This module implements the QsciAPIs class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include + +#include "Qsci/qsciapis.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Qsci/qscilexer.h" + + + +// The version number of the prepared API information format. +const unsigned char PreparedDataFormatVersion = 0; + + +// This class contains prepared API information. +struct QsciAPIsPrepared +{ + // The word dictionary is a map of individual words and a list of positions + // each occurs in the sorted list of APIs. A position is a tuple of the + // index into the list of APIs and the index into the particular API. + QMap wdict; + + // The case dictionary maps the case insensitive words to the form in which + // they are to be used. It is only used if the language is case + // insensitive. + QMap cdict; + + // The raw API information. + QStringList raw_apis; + + QStringList apiWords(int api_idx, const QStringList &wseps, + bool strip_image) const; + static QString apiBaseName(const QString &api); +}; + + +// Return a particular API entry as a list of words. +QStringList QsciAPIsPrepared::apiWords(int api_idx, const QStringList &wseps, + bool strip_image) const +{ + QString base = apiBaseName(raw_apis[api_idx]); + + // Remove any embedded image reference if necessary. + if (strip_image) + { + int tail = base.indexOf('?'); + + if (tail >= 0) + base.truncate(tail); + } + + if (wseps.isEmpty()) + return QStringList(base); + + return base.split(wseps.first()); +} + + +// Return the name of an API function, ie. without the arguments. +QString QsciAPIsPrepared::apiBaseName(const QString &api) +{ + QString base = api; + int tail = base.indexOf('('); + + if (tail >= 0) + base.truncate(tail); + + return base.simplified(); +} + + +// The user event type that signals that the worker thread has started. +const QEvent::Type WorkerStarted = static_cast(QEvent::User + 1012); + + +// The user event type that signals that the worker thread has finished. +const QEvent::Type WorkerFinished = static_cast(QEvent::User + 1013); + + +// The user event type that signals that the worker thread has aborted. +const QEvent::Type WorkerAborted = static_cast(QEvent::User + 1014); + + +// This class is the worker thread that post-processes the API set. +class QsciAPIsWorker : public QThread +{ +public: + QsciAPIsWorker(QsciAPIs *apis); + virtual ~QsciAPIsWorker(); + + virtual void run(); + + QsciAPIsPrepared *prepared; + +private: + QsciAPIs *proxy; + bool abort; +}; + + +// The worker thread ctor. +QsciAPIsWorker::QsciAPIsWorker(QsciAPIs *apis) + : proxy(apis), prepared(0), abort(false) +{ +} + + +// The worker thread dtor. +QsciAPIsWorker::~QsciAPIsWorker() +{ + // Tell the thread to stop. There is no need to bother with a mutex. + abort = true; + + // Wait for it to do so and hit it if it doesn't. + if (!wait(500)) + terminate(); + + if (prepared) + delete prepared; +} + + +// The worker thread entry point. +void QsciAPIsWorker::run() +{ + // Sanity check. + if (!prepared) + return; + + // Tell the main thread we have started. + QApplication::postEvent(proxy, new QEvent(WorkerStarted)); + + // Sort the full list. + prepared->raw_apis.sort(); + + QStringList wseps = proxy->lexer()->autoCompletionWordSeparators(); + bool cs = proxy->lexer()->caseSensitive(); + + // Split each entry into separate words but ignoring any arguments. + for (int a = 0; a < prepared->raw_apis.count(); ++a) + { + // Check to see if we should stop. + if (abort) + break; + + QStringList words = prepared->apiWords(a, wseps, true); + + for (int w = 0; w < words.count(); ++w) + { + const QString &word = words[w]; + + // Add the word's position to any existing list for this word. + QsciAPIs::WordIndexList wil = prepared->wdict[word]; + + // If the language is case insensitive and we haven't seen this + // word before then save it in the case dictionary. + if (!cs && wil.count() == 0) + prepared->cdict[word.toUpper()] = word; + + wil.append(QsciAPIs::WordIndex(a, w)); + prepared->wdict[word] = wil; + } + } + + // Tell the main thread we have finished. + QApplication::postEvent(proxy, new QEvent(abort ? WorkerAborted : WorkerFinished)); +} + + +// The ctor. +QsciAPIs::QsciAPIs(QsciLexer *lexer) + : QsciAbstractAPIs(lexer), worker(0), origin_len(0) +{ + prep = new QsciAPIsPrepared; +} + + +// The dtor. +QsciAPIs::~QsciAPIs() +{ + deleteWorker(); + delete prep; +} + + +// Delete the worker thread if there is one. +void QsciAPIs::deleteWorker() +{ + if (worker) + { + delete worker; + worker = 0; + } +} + + +//! Handle termination events from the worker thread. +bool QsciAPIs::event(QEvent *e) +{ + switch (e->type()) + { + case WorkerStarted: + emit apiPreparationStarted(); + return true; + + case WorkerAborted: + deleteWorker(); + emit apiPreparationCancelled(); + return true; + + case WorkerFinished: + delete prep; + old_context.clear(); + + prep = worker->prepared; + worker->prepared = 0; + deleteWorker(); + + // Allow the raw API information to be modified. + apis = prep->raw_apis; + + emit apiPreparationFinished(); + + return true; + } + + return QObject::event(e); +} + + +// Clear the current raw API entries. +void QsciAPIs::clear() +{ + apis.clear(); +} + + +// Clear out all API information. +bool QsciAPIs::load(const QString &filename) +{ + QFile f(filename); + + if (!f.open(QIODevice::ReadOnly)) + return false; + + QTextStream ts(&f); + + for (;;) + { + QString line = ts.readLine(); + + if (line.isEmpty()) + break; + + apis.append(line); + } + + return true; +} + + +// Add a single API entry. +void QsciAPIs::add(const QString &entry) +{ + apis.append(entry); +} + + +// Remove a single API entry. +void QsciAPIs::remove(const QString &entry) +{ + int idx = apis.indexOf(entry); + + if (idx >= 0) + apis.removeAt(idx); +} + + +// Position the "origin" cursor into the API entries according to the user +// supplied context. +QStringList QsciAPIs::positionOrigin(const QStringList &context, QString &path) +{ + // Get the list of words and see if the context is the same as last time we + // were called. + QStringList new_context; + bool same_context = (old_context.count() > 0 && old_context.count() < context.count()); + + for (int i = 0; i < context.count(); ++i) + { + QString word = context[i]; + + if (!lexer()->caseSensitive()) + word = word.toUpper(); + + if (i < old_context.count() && old_context[i] != word) + same_context = false; + + new_context << word; + } + + // If the context has changed then reset the origin. + if (!same_context) + origin_len = 0; + + // If we have a current origin (ie. the user made a specific selection in + // the current context) then adjust the origin to include the last complete + // word as the user may have entered more parts of the name without using + // auto-completion. + if (origin_len > 0) + { + const QString wsep = lexer()->autoCompletionWordSeparators().first(); + + int start_new = old_context.count(); + int end_new = new_context.count() - 1; + + if (start_new == end_new) + { + path = old_context.join(wsep); + origin_len = path.length(); + } + else + { + QString fixed = *origin; + fixed.truncate(origin_len); + + path = fixed; + + while (start_new < end_new) + { + // Add this word to the current path. + path.append(wsep); + path.append(new_context[start_new]); + origin_len = path.length(); + + // Skip entries in the current origin that don't match the + // path. + while (origin != prep->raw_apis.end()) + { + // See if the current origin has come to an end. + if (!originStartsWith(fixed, wsep)) + origin = prep->raw_apis.end(); + else if (originStartsWith(path, wsep)) + break; + else + ++origin; + } + + if (origin == prep->raw_apis.end()) + break; + + ++start_new; + } + } + + // Terminate the path. + path.append(wsep); + + // If the new text wasn't recognised then reset the origin. + if (origin == prep->raw_apis.end()) + origin_len = 0; + } + + if (origin_len == 0) + path.truncate(0); + + // Save the "committed" context for next time. + old_context = new_context; + old_context.removeLast(); + + return new_context; +} + + +// Return true if the origin starts with the given path. +bool QsciAPIs::originStartsWith(const QString &path, const QString &wsep) +{ + const QString &orig = *origin; + + if (!orig.startsWith(path)) + return false; + + // Check that the path corresponds to the end of a word, ie. that what + // follows in the origin is either a word separator or a (. + QString tail = orig.mid(path.length()); + + return (!tail.isEmpty() && (tail.startsWith(wsep) || tail.at(0) == '(')); +} + + +// Add auto-completion words to an existing list. +void QsciAPIs::updateAutoCompletionList(const QStringList &context, + QStringList &list) +{ + QString path; + QStringList new_context = positionOrigin(context, path); + + if (origin_len > 0) + { + const QString wsep = lexer()->autoCompletionWordSeparators().first(); + QStringList::const_iterator it = origin; + + unambiguous_context = path; + + while (it != prep->raw_apis.end()) + { + QString base = QsciAPIsPrepared::apiBaseName(*it); + + if (!base.startsWith(path)) + break; + + // Make sure we have something after the path. + if (base != path) + { + // Get the word we are interested in (ie. the one after the + // current origin in path). + QString w = base.mid(origin_len + wsep.length()).split(wsep).first(); + + // Append the space, we know the origin is unambiguous. + w.append(' '); + + if (!list.contains(w)) + list << w; + } + + ++it; + } + } + else + { + // At the moment we assume we will add words from multiple contexts. + unambiguous_context.truncate(0); + + bool unambig = true; + QStringList with_context; + + if (new_context.last().isEmpty()) + lastCompleteWord(new_context[new_context.count() - 2], with_context, unambig); + else + lastPartialWord(new_context.last(), with_context, unambig); + + for (int i = 0; i < with_context.count(); ++i) + { + // Remove any unambigious context. + QString noc = with_context[i]; + + if (unambig) + { + int op = noc.indexOf('('); + + if (op >= 0) + noc.truncate(op); + } + + list << noc; + } + } +} + + +// Get the index list for a particular word if there is one. +const QsciAPIs::WordIndexList *QsciAPIs::wordIndexOf(const QString &word) const +{ + QString csword; + + // Indirect through the case dictionary if the language isn't case + // sensitive. + if (lexer()->caseSensitive()) + csword = word; + else + { + csword = prep->cdict[word]; + + if (csword.isEmpty()) + return 0; + } + + // Get the possible API entries if any. + const WordIndexList *wl = &prep->wdict[csword]; + + if (wl->isEmpty()) + return 0; + + return wl; +} + + +// Add auto-completion words based on the last complete word entered. +void QsciAPIs::lastCompleteWord(const QString &word, QStringList &with_context, bool &unambig) +{ + // Get the possible API entries if any. + const WordIndexList *wl = wordIndexOf(word); + + if (wl) + addAPIEntries(*wl, true, with_context, unambig); +} + + +// Add auto-completion words based on the last partial word entered. +void QsciAPIs::lastPartialWord(const QString &word, QStringList &with_context, bool &unambig) +{ + if (lexer()->caseSensitive()) + { + QMap::const_iterator it = prep->wdict.lowerBound(word); + + while (it != prep->wdict.end()) + { + if (!it.key().startsWith(word)) + break; + + addAPIEntries(it.value(), false, with_context, unambig); + + ++it; + } + } + else + { + QMap::const_iterator it = prep->cdict.lowerBound(word); + + while (it != prep->cdict.end()) + { + if (!it.key().startsWith(word)) + break; + + addAPIEntries(prep->wdict[it.value()], false, with_context, unambig); + + ++it; + } + } +} + + +// Handle the selection of an entry in the auto-completion list. +void QsciAPIs::autoCompletionSelected(const QString &selection) +{ + // If the selection is an API (ie. it has a space separating the selected + // word and the optional origin) then remember the origin. + QStringList lst = selection.split(' '); + + if (lst.count() != 2) + { + origin_len = 0; + return; + } + + const QString &path = lst[1]; + QString owords; + + if (path.isEmpty()) + owords = unambiguous_context; + else + { + // Check the parenthesis. + if (!path.startsWith("(") || !path.endsWith(")")) + { + origin_len = 0; + return; + } + + // Remove the parenthesis. + owords = path.mid(1, path.length() - 2); + } + + origin = qLowerBound(prep->raw_apis, owords); + /* + * There is a bug somewhere, either in qLowerBound() or QList (or in GCC as + * it seems to be Linux specific and the Qt code is the same on all + * platforms) that the following line seems to fix. Note that it is + * actually the call to detach() within begin() that is the important bit. + */ + prep->raw_apis.begin(); + origin_len = owords.length(); +} + + +// Add auto-completion words for a particular word (defined by where it appears +// in the APIs) and depending on whether the word was complete (when it's +// actually the next word in the API entry that is of interest) or not. +void QsciAPIs::addAPIEntries(const WordIndexList &wl, bool complete, + QStringList &with_context, bool &unambig) +{ + QStringList wseps = lexer()->autoCompletionWordSeparators(); + + for (int w = 0; w < wl.count(); ++w) + { + const WordIndex &wi = wl[w]; + + QStringList api_words = prep->apiWords(wi.first, wseps, false); + + int idx = wi.second; + + if (complete) + { + // Skip if this is the last word. + if (++idx >= api_words.count()) + continue; + } + + QString api_word; + + if (idx == 0) + api_word = api_words[0] + ' '; + else + { + QStringList orgl = api_words.mid(0, idx); + QString org = orgl.join(wseps.first()); + + api_word = QString("%1 (%2)").arg(api_words[idx]).arg(org); + + // See if the origin has been used before. + if (unambig) + if (unambiguous_context.isEmpty()) + unambiguous_context = org; + else if (unambiguous_context != org) + { + unambiguous_context.truncate(0); + unambig = false; + } + } + + if (!with_context.contains(api_word)) + with_context.append(api_word); + } +} + + +// Return the call tip for a function. +QStringList QsciAPIs::callTips(const QStringList &context, int commas, + QsciScintilla::CallTipsStyle style, QList &shifts) +{ + QString path; + QStringList new_context = positionOrigin(context, path); + QStringList wseps = lexer()->autoCompletionWordSeparators(); + QStringList cts; + + if (origin_len > 0) + { + // The path should have a trailing word separator. + const QString &wsep = wseps.first(); + path.chop(wsep.length()); + + QStringList::const_iterator it = origin; + QString prev; + + // Work out the length of the context. + QStringList strip = path.split(wsep); + strip.removeLast(); + int ctstart = strip.join(wsep).length(); + + if (ctstart) + ctstart += wsep.length(); + + int shift; + + if (style == QsciScintilla::CallTipsContext) + { + shift = ctstart; + ctstart = 0; + } + else + shift = 0; + + // Make sure we only look at the functions we are interested in. + path.append('('); + + while (it != prep->raw_apis.end() && (*it).startsWith(path)) + { + QString w = (*it).mid(ctstart); + + if (w != prev && enoughCommas(w, commas)) + { + shifts << shift; + cts << w; + prev = w; + } + + ++it; + } + } + else + { + const QString &fname = new_context[new_context.count() - 2]; + + // Find everywhere the function name appears in the APIs. + const WordIndexList *wil = wordIndexOf(fname); + + if (wil) + for (int i = 0; i < wil->count(); ++i) + { + const WordIndex &wi = (*wil)[i]; + QStringList awords = prep->apiWords(wi.first, wseps, true); + + // Check the word is the function name and not part of any + // context. + if (wi.second != awords.count() - 1) + continue; + + const QString &api = prep->raw_apis[wi.first]; + + int tail = api.indexOf('('); + + if (tail < 0) + continue; + + if (!enoughCommas(api, commas)) + continue; + + if (style == QsciScintilla::CallTipsNoContext) + { + shifts << 0; + cts << (fname + api.mid(tail)); + } + else + { + shifts << tail - fname.length(); + + // Remove any image type. + int im_type = api.indexOf('?'); + + if (im_type <= 0) + cts << api; + else + cts << (api.left(im_type - 1) + api.mid(tail)); + } + } + } + + return cts; +} + + +// Return true if a string has enough commas in the argument list. +bool QsciAPIs::enoughCommas(const QString &s, int commas) +{ + int end = s.indexOf(')'); + + if (end < 0) + return false; + + QString w = s.left(end); + + return (w.count(',') >= commas); +} + + +// Ensure the list is ready. +void QsciAPIs::prepare() +{ + // Handle the trivial case. + if (worker) + return; + + QsciAPIsPrepared *new_apis = new QsciAPIsPrepared; + new_apis->raw_apis = apis; + + worker = new QsciAPIsWorker(this); + worker->prepared = new_apis; + worker->start(); +} + + +// Cancel any current preparation. +void QsciAPIs::cancelPreparation() +{ + deleteWorker(); +} + + +// Check that a prepared API file exists. +bool QsciAPIs::isPrepared(const QString &filename) const +{ + QString pname = prepName(filename); + + if (pname.isEmpty()) + return false; + + QFileInfo fi(pname); + + return fi.exists(); +} + + +// Load the prepared API information. +bool QsciAPIs::loadPrepared(const QString &filename) +{ + QString pname = prepName(filename); + + if (pname.isEmpty()) + return false; + + // Read the prepared data and decompress it. + QFile pf(pname); + + if (!pf.open(QIODevice::ReadOnly)) + return false; + + QByteArray cpdata = pf.readAll(); + + pf.close(); + + if (cpdata.count() == 0) + return false; + + QByteArray pdata = qUncompress(cpdata); + + // Extract the data. + QDataStream pds(pdata); + + unsigned char vers; + pds >> vers; + + if (vers > PreparedDataFormatVersion) + return false; + + char *lex_name; + pds >> lex_name; + + if (qstrcmp(lex_name, lexer()->lexer()) != 0) + { + delete[] lex_name; + return false; + } + + delete[] lex_name; + + prep->wdict.clear(); + pds >> prep->wdict; + + if (!lexer()->caseSensitive()) + { + // Build up the case dictionary. + prep->cdict.clear(); + + QMap::const_iterator it = prep->wdict.begin(); + + while (it != prep->wdict.end()) + { + prep->cdict[it.key().toUpper()] = it.key(); + ++it; + } + } + + prep->raw_apis.clear(); + pds >> prep->raw_apis; + + // Allow the raw API information to be modified. + apis = prep->raw_apis; + + return true; +} + + +// Save the prepared API information. +bool QsciAPIs::savePrepared(const QString &filename) const +{ + QString pname = prepName(filename, true); + + if (pname.isEmpty()) + return false; + + // Write the prepared data to a memory buffer. + QByteArray pdata; + QDataStream pds(&pdata, QIODevice::WriteOnly); + + // Use a serialisation format supported by Qt v3.0 and later. + pds.setVersion(QDataStream::Qt_3_0); + pds << PreparedDataFormatVersion; + pds << lexer()->lexer(); + pds << prep->wdict; + pds << prep->raw_apis; + + // Compress the data and write it. + QFile pf(pname); + + if (!pf.open(QIODevice::WriteOnly|QIODevice::Truncate)) + return false; + + if (pf.write(qCompress(pdata)) < 0) + { + pf.close(); + return false; + } + + pf.close(); + return true; +} + + +// Return the name of the default prepared API file. +QString QsciAPIs::defaultPreparedName() const +{ + return prepName(QString()); +} + + +// Return the name of a prepared API file. +QString QsciAPIs::prepName(const QString &filename, bool mkpath) const +{ + // Handle the tivial case. + if (!filename.isEmpty()) + return filename; + + QString pdname; + char *qsci = getenv("QSCIDIR"); + + if (qsci) + pdname = qsci; + else + { + static const char *qsci_dir = ".qsci"; + + QDir pd = QDir::home(); + + if (mkpath && !pd.exists(qsci_dir) && !pd.mkdir(qsci_dir)) + return QString(); + + pdname = pd.filePath(qsci_dir); + } + + return QString("%1/%2.pap").arg(pdname).arg(lexer()->lexer()); +} + + +// Return installed API files. +QStringList QsciAPIs::installedAPIFiles() const +{ + QString qtdir = QLibraryInfo::location(QLibraryInfo::DataPath); + + QDir apidir = QDir(QString("%1/qsci/api/%2").arg(qtdir).arg(lexer()->lexer())); + QStringList filenames; + + QStringList filters; + filters << "*.api"; + + QFileInfoList flist = apidir.entryInfoList(filters, QDir::Files, QDir::IgnoreCase); + + foreach (QFileInfo fi, flist) + filenames << fi.absoluteFilePath(); + + return filenames; +} diff --git a/libs/qscintilla/Qt4Qt5/qscicommand.cpp b/libs/qscintilla/Qt4Qt5/qscicommand.cpp new file mode 100644 index 000000000..07445e3b9 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscicommand.cpp @@ -0,0 +1,143 @@ +// This module implements the QsciCommand class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscicommand.h" + +#include +#include + +#include "Qsci/qsciscintilla.h" +#include "Qsci/qsciscintillabase.h" + + +static int convert(int key); + + +// The ctor. +QsciCommand::QsciCommand(QsciScintilla *qs, QsciCommand::Command cmd, int key, + int altkey, const char *desc) + : qsCmd(qs), scicmd(cmd), qkey(key), qaltkey(altkey), descCmd(desc) +{ + scikey = convert(qkey); + + if (scikey) + qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scikey, + scicmd); + + scialtkey = convert(qaltkey); + + if (scialtkey) + qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scialtkey, + scicmd); +} + + +// Execute the command. +void QsciCommand::execute() +{ + qsCmd->SendScintilla(scicmd); +} + + +// Bind a key to a command. +void QsciCommand::setKey(int key) +{ + bindKey(key,qkey,scikey); +} + + +// Bind an alternate key to a command. +void QsciCommand::setAlternateKey(int altkey) +{ + bindKey(altkey,qaltkey,scialtkey); +} + + +// Do the hard work of binding a key. +void QsciCommand::bindKey(int key,int &qk,int &scik) +{ + int new_scikey; + + // Ignore if it is invalid, allowing for the fact that we might be + // unbinding it. + if (key) + { + new_scikey = convert(key); + + if (!new_scikey) + return; + } + else + new_scikey = 0; + + if (scik) + qsCmd->SendScintilla(QsciScintillaBase::SCI_CLEARCMDKEY, scik); + + qk = key; + scik = new_scikey; + + if (scik) + qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scik, scicmd); +} + + +// See if a key is valid. +bool QsciCommand::validKey(int key) +{ + return convert(key); +} + + +// Convert a Qt character to the Scintilla equivalent. Return zero if it is +// invalid. +static int convert(int key) +{ + // Convert the modifiers. + int sci_mod = 0; + + if (key & Qt::SHIFT) + sci_mod |= QsciScintillaBase::SCMOD_SHIFT; + + if (key & Qt::CTRL) + sci_mod |= QsciScintillaBase::SCMOD_CTRL; + + if (key & Qt::ALT) + sci_mod |= QsciScintillaBase::SCMOD_ALT; + + if (key & Qt::META) + sci_mod |= QsciScintillaBase::SCMOD_META; + + key &= ~Qt::MODIFIER_MASK; + + // Convert the key. + int sci_key = QsciScintillaBase::commandKey(key, sci_mod); + + if (sci_key) + sci_key |= (sci_mod << 16); + + return sci_key; +} + + +// Return the translated user friendly description. +QString QsciCommand::description() const +{ + return qApp->translate("QsciCommand", descCmd); +} diff --git a/libs/qscintilla/Qt4Qt5/qscicommandset.cpp b/libs/qscintilla/Qt4Qt5/qscicommandset.cpp new file mode 100644 index 000000000..1e2928dbd --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscicommandset.cpp @@ -0,0 +1,991 @@ +// This module implements the QsciCommandSet class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscicommandset.h" + +#include + +#include "Qsci/qscicommand.h" +#include "Qsci/qsciscintilla.h" +#include "Qsci/qsciscintillabase.h" + + +// Starting with QScintilla v2.7 the standard OS/X keyboard shortcuts are used +// where possible. In order to restore the behaviour of earlier versions then +// #define DONT_USE_OSX_KEYS here or add it to the qmake project (.pro) file. +#if defined(Q_OS_MAC) && !defined(DONT_USE_OSX_KEYS) +#define USING_OSX_KEYS +#else +#undef USING_OSX_KEYS +#endif + + +// The ctor. +QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs) +{ + struct sci_cmd { + QsciCommand::Command cmd; + int key; + int altkey; + const char *desc; + }; + + static struct sci_cmd cmd_table[] = { + { + QsciCommand::LineDown, + Qt::Key_Down, +#if defined(USING_OSX_KEYS) + Qt::Key_N | Qt::META, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Move down one line") + }, + { + QsciCommand::LineDownExtend, + Qt::Key_Down | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_N | Qt::META | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Extend selection down one line") + }, + { + QsciCommand::LineDownRectExtend, + Qt::Key_Down | Qt::ALT | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_N | Qt::META | Qt::ALT | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection down one line") + }, + { + QsciCommand::LineScrollDown, + Qt::Key_Down | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Scroll view down one line") + }, + { + QsciCommand::LineUp, + Qt::Key_Up, +#if defined(USING_OSX_KEYS) + Qt::Key_P | Qt::META, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Move up one line") + }, + { + QsciCommand::LineUpExtend, + Qt::Key_Up | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_P | Qt::META | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Extend selection up one line") + }, + { + QsciCommand::LineUpRectExtend, + Qt::Key_Up | Qt::ALT | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_P | Qt::META | Qt::ALT | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection up one line") + }, + { + QsciCommand::LineScrollUp, + Qt::Key_Up | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Scroll view up one line") + }, + { + QsciCommand::ScrollToStart, +#if defined(USING_OSX_KEYS) + Qt::Key_Home, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Scroll to start of document") + }, + { + QsciCommand::ScrollToEnd, +#if defined(USING_OSX_KEYS) + Qt::Key_End, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Scroll to end of document") + }, + { + QsciCommand::VerticalCentreCaret, +#if defined(USING_OSX_KEYS) + Qt::Key_L | Qt::META, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Scroll vertically to centre current line") + }, + { + QsciCommand::ParaDown, + Qt::Key_BracketRight | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move down one paragraph") + }, + { + QsciCommand::ParaDownExtend, + Qt::Key_BracketRight | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection down one paragraph") + }, + { + QsciCommand::ParaUp, + Qt::Key_BracketLeft | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move up one paragraph") + }, + { + QsciCommand::ParaUpExtend, + Qt::Key_BracketLeft | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection up one paragraph") + }, + { + QsciCommand::CharLeft, + Qt::Key_Left, +#if defined(USING_OSX_KEYS) + Qt::Key_B | Qt::META, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Move left one character") + }, + { + QsciCommand::CharLeftExtend, + Qt::Key_Left | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_B | Qt::META | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection left one character") + }, + { + QsciCommand::CharLeftRectExtend, + Qt::Key_Left | Qt::ALT | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_B | Qt::META | Qt::ALT | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection left one character") + }, + { + QsciCommand::CharRight, + Qt::Key_Right, +#if defined(USING_OSX_KEYS) + Qt::Key_F | Qt::META, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Move right one character") + }, + { + QsciCommand::CharRightExtend, + Qt::Key_Right | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_F | Qt::META | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection right one character") + }, + { + QsciCommand::CharRightRectExtend, + Qt::Key_Right | Qt::ALT | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_F | Qt::META | Qt::ALT | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection right one character") + }, + { + QsciCommand::WordLeft, +#if defined(USING_OSX_KEYS) + Qt::Key_Left | Qt::ALT, +#else + Qt::Key_Left | Qt::CTRL, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move left one word") + }, + { + QsciCommand::WordLeftExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_Left | Qt::ALT | Qt::SHIFT, +#else + Qt::Key_Left | Qt::CTRL | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Extend selection left one word") + }, + { + QsciCommand::WordRight, +#if defined(USING_OSX_KEYS) + 0, +#else + Qt::Key_Right | Qt::CTRL, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move right one word") + }, + { + QsciCommand::WordRightExtend, + Qt::Key_Right | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Extend selection right one word") + }, + { + QsciCommand::WordLeftEnd, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to end of previous word") + }, + { + QsciCommand::WordLeftEndExtend, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to end of previous word") + }, + { + QsciCommand::WordRightEnd, +#if defined(USING_OSX_KEYS) + Qt::Key_Right | Qt::ALT, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to end of next word") + }, + { + QsciCommand::WordRightEndExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_Right | Qt::ALT | Qt::SHIFT, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to end of next word") + }, + { + QsciCommand::WordPartLeft, + Qt::Key_Slash | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move left one word part") + }, + { + QsciCommand::WordPartLeftExtend, + Qt::Key_Slash | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection left one word part") + }, + { + QsciCommand::WordPartRight, + Qt::Key_Backslash | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move right one word part") + }, + { + QsciCommand::WordPartRightExtend, + Qt::Key_Backslash | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection right one word part") + }, + { + QsciCommand::Home, +#if defined(USING_OSX_KEYS) + Qt::Key_A | Qt::META, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to start of document line") + }, + { + QsciCommand::HomeExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_A | Qt::META | Qt::SHIFT, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to start of document line") + }, + { + QsciCommand::HomeRectExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_A | Qt::META | Qt::ALT | Qt::SHIFT, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection to start of document line") + }, + { + QsciCommand::HomeDisplay, +#if defined(USING_OSX_KEYS) + Qt::Key_Left | Qt::CTRL, +#else + Qt::Key_Home | Qt::ALT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to start of display line") + }, + { + QsciCommand::HomeDisplayExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_Left | Qt::CTRL | Qt::SHIFT, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to start of display line") + }, + { + QsciCommand::HomeWrap, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Move to start of display or document line") + }, + { + QsciCommand::HomeWrapExtend, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to start of display or document line") + }, + { + QsciCommand::VCHome, +#if defined(USING_OSX_KEYS) + 0, +#else + Qt::Key_Home, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Move to first visible character in document line") + }, + { + QsciCommand::VCHomeExtend, +#if defined(USING_OSX_KEYS) + 0, +#else + Qt::Key_Home | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to first visible character in document line") + }, + { + QsciCommand::VCHomeRectExtend, +#if defined(USING_OSX_KEYS) + 0, +#else + Qt::Key_Home | Qt::ALT | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection to first visible character in document line") + }, + { + QsciCommand::VCHomeWrap, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Move to first visible character of display in document line") + }, + { + QsciCommand::VCHomeWrapExtend, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to first visible character in display or document line") + }, + { + QsciCommand::LineEnd, +#if defined(USING_OSX_KEYS) + Qt::Key_E | Qt::META, +#else + Qt::Key_End, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to end of document line") + }, + { + QsciCommand::LineEndExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_E | Qt::META | Qt::SHIFT, +#else + Qt::Key_End | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to end of document line") + }, + { + QsciCommand::LineEndRectExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_E | Qt::META | Qt::ALT | Qt::SHIFT, +#else + Qt::Key_End | Qt::ALT | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection to end of document line") + }, + { + QsciCommand::LineEndDisplay, +#if defined(USING_OSX_KEYS) + Qt::Key_Right | Qt::CTRL, +#else + Qt::Key_End | Qt::ALT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to end of display line") + }, + { + QsciCommand::LineEndDisplayExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_Right | Qt::CTRL | Qt::SHIFT, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to end of display line") + }, + { + QsciCommand::LineEndWrap, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Move to end of display or document line") + }, + { + QsciCommand::LineEndWrapExtend, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to end of display or document line") + }, + { + QsciCommand::DocumentStart, +#if defined(USING_OSX_KEYS) + Qt::Key_Up | Qt::CTRL, +#else + Qt::Key_Home | Qt::CTRL, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to start of document") + }, + { + QsciCommand::DocumentStartExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_Up | Qt::CTRL | Qt::SHIFT, +#else + Qt::Key_Home | Qt::CTRL | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to start of document") + }, + { + QsciCommand::DocumentEnd, +#if defined(USING_OSX_KEYS) + Qt::Key_Down | Qt::CTRL, +#else + Qt::Key_End | Qt::CTRL, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move to end of document") + }, + { + QsciCommand::DocumentEndExtend, +#if defined(USING_OSX_KEYS) + Qt::Key_Down | Qt::CTRL | Qt::SHIFT, +#else + Qt::Key_End | Qt::CTRL | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend selection to end of document") + }, + { + QsciCommand::PageUp, + Qt::Key_PageUp, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move up one page") + }, + { + QsciCommand::PageUpExtend, + Qt::Key_PageUp | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Extend selection up one page") + }, + { + QsciCommand::PageUpRectExtend, + Qt::Key_PageUp | Qt::ALT | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection up one page") + }, + { + QsciCommand::PageDown, + Qt::Key_PageDown, +#if defined(USING_OSX_KEYS) + Qt::Key_V | Qt::META, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Move down one page") + }, + { + QsciCommand::PageDownExtend, + Qt::Key_PageDown | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_V | Qt::META | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Extend selection down one page") + }, + { + QsciCommand::PageDownRectExtend, + Qt::Key_PageDown | Qt::ALT | Qt::SHIFT, +#if defined(USING_OSX_KEYS) + Qt::Key_V | Qt::META | Qt::ALT | Qt::SHIFT, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", + "Extend rectangular selection down one page") + }, + { + QsciCommand::StutteredPageUp, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Stuttered move up one page") + }, + { + QsciCommand::StutteredPageUpExtend, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Stuttered extend selection up one page") + }, + { + QsciCommand::StutteredPageDown, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Stuttered move down one page") + }, + { + QsciCommand::StutteredPageDownExtend, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Stuttered extend selection down one page") + }, + { + QsciCommand::Delete, + Qt::Key_Delete, +#if defined(USING_OSX_KEYS) + Qt::Key_D | Qt::META, +#else + 0, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Delete current character") + }, + { + QsciCommand::DeleteBack, + Qt::Key_Backspace, +#if defined(USING_OSX_KEYS) + Qt::Key_H | Qt::META, +#else + Qt::Key_Backspace | Qt::SHIFT, +#endif + QT_TRANSLATE_NOOP("QsciCommand", "Delete previous character") + }, + { + QsciCommand::DeleteBackNotLine, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Delete previous character if not at start of line") + }, + { + QsciCommand::DeleteWordLeft, + Qt::Key_Backspace | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Delete word to left") + }, + { + QsciCommand::DeleteWordRight, + Qt::Key_Delete | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Delete word to right") + }, + { + QsciCommand::DeleteWordRightEnd, +#if defined(USING_OSX_KEYS) + Qt::Key_Delete | Qt::ALT, +#else + 0, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Delete right to end of next word") + }, + { + QsciCommand::DeleteLineLeft, + Qt::Key_Backspace | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Delete line to left") + }, + { + QsciCommand::DeleteLineRight, +#if defined(USING_OSX_KEYS) + Qt::Key_K | Qt::META, +#else + Qt::Key_Delete | Qt::CTRL | Qt::SHIFT, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Delete line to right") + }, + { + QsciCommand::LineDelete, + Qt::Key_L | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Delete current line") + }, + { + QsciCommand::LineCut, + Qt::Key_L | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Cut current line") + }, + { + QsciCommand::LineCopy, + Qt::Key_T | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Copy current line") + }, + { + QsciCommand::LineTranspose, + Qt::Key_T | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Transpose current and previous lines") + }, + { + QsciCommand::LineDuplicate, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Duplicate the current line") + }, + { + QsciCommand::SelectAll, + Qt::Key_A | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Select all") + }, + { + QsciCommand::MoveSelectedLinesUp, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Move selected lines up one line") + }, + { + QsciCommand::MoveSelectedLinesDown, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", + "Move selected lines down one line") + }, + { + QsciCommand::SelectionDuplicate, + Qt::Key_D | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Duplicate selection") + }, + { + QsciCommand::SelectionLowerCase, + Qt::Key_U | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Convert selection to lower case") + }, + { + QsciCommand::SelectionUpperCase, + Qt::Key_U | Qt::CTRL | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Convert selection to upper case") + }, + { + QsciCommand::SelectionCut, + Qt::Key_X | Qt::CTRL, + Qt::Key_Delete | Qt::SHIFT, + QT_TRANSLATE_NOOP("QsciCommand", "Cut selection") + }, + { + QsciCommand::SelectionCopy, + Qt::Key_C | Qt::CTRL, + Qt::Key_Insert | Qt::CTRL, + QT_TRANSLATE_NOOP("QsciCommand", "Copy selection") + }, + { + QsciCommand::Paste, + Qt::Key_V | Qt::CTRL, + Qt::Key_Insert | Qt::SHIFT, + QT_TRANSLATE_NOOP("QsciCommand", "Paste") + }, + { + QsciCommand::EditToggleOvertype, + Qt::Key_Insert, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Toggle insert/overtype") + }, + { + QsciCommand::Newline, + Qt::Key_Return, + Qt::Key_Return | Qt::SHIFT, + QT_TRANSLATE_NOOP("QsciCommand", "Insert newline") + }, + { + QsciCommand::Formfeed, + 0, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Formfeed") + }, + { + QsciCommand::Tab, + Qt::Key_Tab, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Indent one level") + }, + { + QsciCommand::Backtab, + Qt::Key_Tab | Qt::SHIFT, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "De-indent one level") + }, + { + QsciCommand::Cancel, + Qt::Key_Escape, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Cancel") + }, + { + QsciCommand::Undo, + Qt::Key_Z | Qt::CTRL, + Qt::Key_Backspace | Qt::ALT, + QT_TRANSLATE_NOOP("QsciCommand", "Undo last command") + }, + { + QsciCommand::Redo, +#if defined(USING_OSX_KEYS) + Qt::Key_Z | Qt::CTRL | Qt::SHIFT, +#else + Qt::Key_Y | Qt::CTRL, +#endif + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Redo last command") + }, + { + QsciCommand::ZoomIn, + Qt::Key_Plus | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Zoom in") + }, + { + QsciCommand::ZoomOut, + Qt::Key_Minus | Qt::CTRL, + 0, + QT_TRANSLATE_NOOP("QsciCommand", "Zoom out") + }, + }; + + // Clear the default map. + qsci->SendScintilla(QsciScintillaBase::SCI_CLEARALLCMDKEYS); + + // By default control characters don't do anything (rather than insert the + // control character into the text). + for (int k = 'A'; k <= 'Z'; ++k) + qsci->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, + k + (QsciScintillaBase::SCMOD_CTRL << 16), + QsciScintillaBase::SCI_NULL); + + for (int i = 0; i < sizeof (cmd_table) / sizeof (cmd_table[0]); ++i) + cmds.append( + new QsciCommand(qsci, cmd_table[i].cmd, cmd_table[i].key, + cmd_table[i].altkey, cmd_table[i].desc)); +} + + +// The dtor. +QsciCommandSet::~QsciCommandSet() +{ + for (int i = 0; i < cmds.count(); ++i) + delete cmds.at(i); +} + + +// Read the command set from settings. +bool QsciCommandSet::readSettings(QSettings &qs, const char *prefix) +{ + bool rc = true; + QString skey; + + for (int i = 0; i < cmds.count(); ++i) + { + QsciCommand *cmd = cmds.at(i); + + skey.sprintf("%s/keymap/c%d/", prefix, + static_cast(cmd->command())); + + int key; + bool ok; + + // Read the key. + ok = qs.contains(skey + "key"); + key = qs.value(skey + "key", 0).toInt(); + + if (ok) + cmd->setKey(key); + else + rc = false; + + // Read the alternate key. + ok = qs.contains(skey + "alt"); + key = qs.value(skey + "alt", 0).toInt(); + + if (ok) + cmd->setAlternateKey(key); + else + rc = false; + } + + return rc; +} + + +// Write the command set to settings. +bool QsciCommandSet::writeSettings(QSettings &qs, const char *prefix) +{ + bool rc = true; + QString skey; + + for (int i = 0; i < cmds.count(); ++i) + { + QsciCommand *cmd = cmds.at(i); + + skey.sprintf("%s/keymap/c%d/", prefix, + static_cast(cmd->command())); + + // Write the key. + qs.setValue(skey + "key", cmd->key()); + + // Write the alternate key. + qs.setValue(skey + "alt", cmd->key()); + } + + return rc; +} + + +// Clear the key bindings. +void QsciCommandSet::clearKeys() +{ + for (int i = 0; i < cmds.count(); ++i) + cmds.at(i)->setKey(0); +} + + +// Clear the alternate key bindings. +void QsciCommandSet::clearAlternateKeys() +{ + for (int i = 0; i < cmds.count(); ++i) + cmds.at(i)->setAlternateKey(0); +} + + +// Find the command bound to a key. +QsciCommand *QsciCommandSet::boundTo(int key) const +{ + for (int i = 0; i < cmds.count(); ++i) + { + QsciCommand *cmd = cmds.at(i); + + if (cmd->key() == key || cmd->alternateKey() == key) + return cmd; + } + + return 0; +} + + +// Find a command. +QsciCommand *QsciCommandSet::find(QsciCommand::Command command) const +{ + for (int i = 0; i < cmds.count(); ++i) + { + QsciCommand *cmd = cmds.at(i); + + if (cmd->command() == command) + return cmd; + } + + // This should never happen. + return 0; +} diff --git a/libs/qscintilla/Qt4Qt5/qscidocument.cpp b/libs/qscintilla/Qt4Qt5/qscidocument.cpp new file mode 100644 index 000000000..5d5c355e1 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscidocument.cpp @@ -0,0 +1,151 @@ +// This module implements the QsciDocument class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscidocument.h" +#include "Qsci/qsciscintillabase.h" + + +// This internal class encapsulates the underlying document and is shared by +// QsciDocument instances. +class QsciDocumentP +{ +public: + QsciDocumentP() : doc(0), nr_displays(0), nr_attaches(1), modified(false) {} + + void *doc; // The Scintilla document. + int nr_displays; // The number of displays. + int nr_attaches; // The number of attaches. + bool modified; // Set if not at a save point. +}; + + +// The ctor. +QsciDocument::QsciDocument() +{ + pdoc = new QsciDocumentP(); +} + + +// The dtor. +QsciDocument::~QsciDocument() +{ + detach(); +} + + +// The copy ctor. +QsciDocument::QsciDocument(const QsciDocument &that) +{ + attach(that); +} + + +// The assignment operator. +QsciDocument &QsciDocument::operator=(const QsciDocument &that) +{ + if (pdoc != that.pdoc) + { + detach(); + attach(that); + } + + return *this; +} + + +// Attach an existing document to this one. +void QsciDocument::attach(const QsciDocument &that) +{ + ++that.pdoc->nr_attaches; + pdoc = that.pdoc; +} + + +// Detach the underlying document. +void QsciDocument::detach() +{ + if (!pdoc) + return; + + if (--pdoc->nr_attaches == 0) + { + if (pdoc->doc && pdoc->nr_displays == 0) + { + QsciScintillaBase *qsb = QsciScintillaBase::pool(); + + // Release the explicit reference to the document. If the pool is + // empty then we just accept the memory leak. + if (qsb) + qsb->SendScintilla(QsciScintillaBase::SCI_RELEASEDOCUMENT, 0, + pdoc->doc); + } + + delete pdoc; + } + + pdoc = 0; +} + + +// Undisplay and detach the underlying document. +void QsciDocument::undisplay(QsciScintillaBase *qsb) +{ + if (--pdoc->nr_attaches == 0) + delete pdoc; + else if (--pdoc->nr_displays == 0) + { + // Create an explicit reference to the document to keep it alive. + qsb->SendScintilla(QsciScintillaBase::SCI_ADDREFDOCUMENT, 0, pdoc->doc); + } + + pdoc = 0; +} + + +// Display the underlying document. +void QsciDocument::display(QsciScintillaBase *qsb, const QsciDocument *from) +{ + void *ndoc = (from ? from->pdoc->doc : 0); + + // SCI_SETDOCPOINTER appears to reset the EOL mode so save and restore it. + int eol_mode = qsb->SendScintilla(QsciScintillaBase::SCI_GETEOLMODE); + + qsb->SendScintilla(QsciScintillaBase::SCI_SETDOCPOINTER, 0, ndoc); + ndoc = qsb->SendScintillaPtrResult(QsciScintillaBase::SCI_GETDOCPOINTER); + + qsb->SendScintilla(QsciScintillaBase::SCI_SETEOLMODE, eol_mode); + + pdoc->doc = ndoc; + ++pdoc->nr_displays; +} + + +// Return the modified state of the document. +bool QsciDocument::isModified() const +{ + return pdoc->modified; +} + + +// Set the modified state of the document. +void QsciDocument::setModified(bool m) +{ + pdoc->modified = m; +} diff --git a/libs/qscintilla/Qt4Qt5/qscilexer.cpp b/libs/qscintilla/Qt4Qt5/qscilexer.cpp new file mode 100644 index 000000000..380bb325b --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscilexer.cpp @@ -0,0 +1,740 @@ +// This module implements the QsciLexer class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscilexer.h" + +#include +#include +#include +#include + +#include "Qsci/qsciapis.h" +#include "Qsci/qsciscintilla.h" +#include "Qsci/qsciscintillabase.h" + + +// The ctor. +QsciLexer::QsciLexer(QObject *parent) + : QObject(parent), + autoIndStyle(-1), apiSet(0), attached_editor(0) +{ +#if defined(Q_OS_WIN) + defFont = QFont("Verdana",10); +#elif defined(Q_OS_MAC) + defFont = QFont("Verdana", 12); +#else + defFont = QFont("Bitstream Vera Sans",9); +#endif + + // Set the default fore and background colours. + QPalette pal = QApplication::palette(); + defColor = pal.text().color(); + defPaper = pal.base().color(); + + // Putting this on the heap means we can keep the style getters const. + style_map = new StyleDataMap; + style_map->style_data_set = false; +} + + +// The dtor. +QsciLexer::~QsciLexer() +{ + delete style_map; +} + + +// Set the attached editor. +void QsciLexer::setEditor(QsciScintilla *editor) +{ + attached_editor = editor; + + if (attached_editor) + { + attached_editor->SendScintilla(QsciScintillaBase::SCI_SETSTYLEBITS, + styleBitsNeeded()); + } +} + + +// Return the lexer name. +const char *QsciLexer::lexer() const +{ + return 0; +} + + +// Return the lexer identifier. +int QsciLexer::lexerId() const +{ + return QsciScintillaBase::SCLEX_CONTAINER; +} + + +// Return the number of style bits needed by the lexer. +int QsciLexer::styleBitsNeeded() const +{ + if (!attached_editor) + return 5; + + return attached_editor->SendScintilla(QsciScintillaBase::SCI_GETSTYLEBITSNEEDED); +} + + +// Make sure the style defaults have been set. +void QsciLexer::setStyleDefaults() const +{ + if (!style_map->style_data_set) + { + for (int i = 0; i < 128; ++i) + if (!description(i).isEmpty()) + styleData(i); + + style_map->style_data_set = true; + } +} + + +// Return a reference to a style's data, setting up the defaults if needed. +QsciLexer::StyleData &QsciLexer::styleData(int style) const +{ + StyleData &sd = style_map->style_data[style]; + + // See if this is a new style by checking if the colour is valid. + if (!sd.color.isValid()) + { + sd.color = defaultColor(style); + sd.paper = defaultPaper(style); + sd.font = defaultFont(style); + sd.eol_fill = defaultEolFill(style); + } + + return sd; +} + + +// Set the APIs associated with the lexer. +void QsciLexer::setAPIs(QsciAbstractAPIs *apis) +{ + apiSet = apis; +} + + +// Return a pointer to the current APIs if there are any. +QsciAbstractAPIs *QsciLexer::apis() const +{ + return apiSet; +} + + +// Default implementation to return the set of fill up characters that can end +// auto-completion. +const char *QsciLexer::autoCompletionFillups() const +{ + return "("; +} + + +// Default implementation to return the view used for indentation guides. +int QsciLexer::indentationGuideView() const +{ + return QsciScintillaBase::SC_IV_LOOKBOTH; +} + + +// Default implementation to return the list of character sequences that can +// separate auto-completion words. +QStringList QsciLexer::autoCompletionWordSeparators() const +{ + return QStringList(); +} + + +// Default implementation to return the list of keywords that can start a +// block. +const char *QsciLexer::blockStartKeyword(int *) const +{ + return 0; +} + + +// Default implementation to return the list of characters that can start a +// block. +const char *QsciLexer::blockStart(int *) const +{ + return 0; +} + + +// Default implementation to return the list of characters that can end a +// block. +const char *QsciLexer::blockEnd(int *) const +{ + return 0; +} + + +// Default implementation to return the style used for braces. +int QsciLexer::braceStyle() const +{ + return -1; +} + + +// Default implementation to return the number of lines to look back when +// auto-indenting. +int QsciLexer::blockLookback() const +{ + return 20; +} + + +// Default implementation to return the case sensitivity of the language. +bool QsciLexer::caseSensitive() const +{ + return true; +} + + +// Default implementation to return the characters that make up a word. +const char *QsciLexer::wordCharacters() const +{ + return 0; +} + + +// Default implementation to return the style used for whitespace. +int QsciLexer::defaultStyle() const +{ + return 0; +} + + +// Returns the foreground colour of the text for a style. +QColor QsciLexer::color(int style) const +{ + return styleData(style).color; +} + + +// Returns the background colour of the text for a style. +QColor QsciLexer::paper(int style) const +{ + return styleData(style).paper; +} + + +// Returns the font for a style. +QFont QsciLexer::font(int style) const +{ + return styleData(style).font; +} + + +// Returns the end-of-line fill for a style. +bool QsciLexer::eolFill(int style) const +{ + return styleData(style).eol_fill; +} + + +// Returns the set of keywords. +const char *QsciLexer::keywords(int) const +{ + return 0; +} + + +// Returns the default EOL fill for a style. +bool QsciLexer::defaultEolFill(int) const +{ + return false; +} + + +// Returns the default font for a style. +QFont QsciLexer::defaultFont(int) const +{ + return defaultFont(); +} + + +// Returns the default font. +QFont QsciLexer::defaultFont() const +{ + return defFont; +} + + +// Sets the default font. +void QsciLexer::setDefaultFont(const QFont &f) +{ + defFont = f; +} + + +// Returns the default text colour for a style. +QColor QsciLexer::defaultColor(int) const +{ + return defaultColor(); +} + + +// Returns the default text colour. +QColor QsciLexer::defaultColor() const +{ + return defColor; +} + + +// Sets the default text colour. +void QsciLexer::setDefaultColor(const QColor &c) +{ + defColor = c; +} + + +// Returns the default paper colour for a styles. +QColor QsciLexer::defaultPaper(int) const +{ + return defaultPaper(); +} + + +// Returns the default paper colour. +QColor QsciLexer::defaultPaper() const +{ + return defPaper; +} + + +// Sets the default paper colour. +void QsciLexer::setDefaultPaper(const QColor &c) +{ + defPaper = c; + + // Normally the default values are only intended to provide defaults when a + // lexer is first setup because once a style has been referenced then a + // copy of the default is made. However the default paper is a special + // case because there is no other way to set the background colour used + // where there is no text. Therefore we also actively set it. + setPaper(c, QsciScintillaBase::STYLE_DEFAULT); +} + + +// Read properties from the settings. +bool QsciLexer::readProperties(QSettings &,const QString &) +{ + return true; +} + + +// Refresh all properties. +void QsciLexer::refreshProperties() +{ +} + + +// Write properties to the settings. +bool QsciLexer::writeProperties(QSettings &,const QString &) const +{ + return true; +} + + +// Restore the user settings. +bool QsciLexer::readSettings(QSettings &qs,const char *prefix) +{ + bool ok, flag, rc = true; + int num; + QString key, full_key; + QStringList fdesc; + + setStyleDefaults(); + + // Read the styles. + for (int i = 0; i < 128; ++i) + { + // Ignore invalid styles. + if (description(i).isEmpty()) + continue; + + key.sprintf("%s/%s/style%d/",prefix,language(),i); + + // Read the foreground colour. + full_key = key + "color"; + + ok = qs.contains(full_key); + num = qs.value(full_key).toInt(); + + if (ok) + setColor(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i); + else + rc = false; + + // Read the end-of-line fill. + full_key = key + "eolfill"; + + ok = qs.contains(full_key); + flag = qs.value(full_key, false).toBool(); + + if (ok) + setEolFill(flag, i); + else + rc = false; + + // Read the font. First try the deprecated format that uses an integer + // point size. + full_key = key + "font"; + + ok = qs.contains(full_key); + fdesc = qs.value(full_key).toStringList(); + + if (ok && fdesc.count() == 5) + { + QFont f; + + f.setFamily(fdesc[0]); + f.setPointSize(fdesc[1].toInt()); + f.setBold(fdesc[2].toInt()); + f.setItalic(fdesc[3].toInt()); + f.setUnderline(fdesc[4].toInt()); + + setFont(f, i); + } + else + rc = false; + + // Now try the newer font format that uses a floating point point size. + // It is not an error if it doesn't exist. + full_key = key + "font2"; + + ok = qs.contains(full_key); + fdesc = qs.value(full_key).toStringList(); + + if (ok) + { + // Allow for future versions with more fields. + if (fdesc.count() >= 5) + { + QFont f; + + f.setFamily(fdesc[0]); + f.setPointSizeF(fdesc[1].toDouble()); + f.setBold(fdesc[2].toInt()); + f.setItalic(fdesc[3].toInt()); + f.setUnderline(fdesc[4].toInt()); + + setFont(f, i); + } + else + { + rc = false; + } + } + + // Read the background colour. + full_key = key + "paper"; + + ok = qs.contains(full_key); + num = qs.value(full_key).toInt(); + + if (ok) + setPaper(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i); + else + rc = false; + } + + // Read the properties. + key.sprintf("%s/%s/properties/",prefix,language()); + + if (!readProperties(qs,key)) + rc = false; + + refreshProperties(); + + // Read the rest. + key.sprintf("%s/%s/",prefix,language()); + + // Read the default foreground colour. + full_key = key + "defaultcolor"; + + ok = qs.contains(full_key); + num = qs.value(full_key).toInt(); + + if (ok) + setDefaultColor(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff)); + else + rc = false; + + // Read the default background colour. + full_key = key + "defaultpaper"; + + ok = qs.contains(full_key); + num = qs.value(full_key).toInt(); + + if (ok) + setDefaultPaper(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff)); + else + rc = false; + + // Read the default font. First try the deprecated format that uses an + // integer point size. + full_key = key + "defaultfont"; + + ok = qs.contains(full_key); + fdesc = qs.value(full_key).toStringList(); + + if (ok && fdesc.count() == 5) + { + QFont f; + + f.setFamily(fdesc[0]); + f.setPointSize(fdesc[1].toInt()); + f.setBold(fdesc[2].toInt()); + f.setItalic(fdesc[3].toInt()); + f.setUnderline(fdesc[4].toInt()); + + setDefaultFont(f); + } + else + rc = false; + + // Now try the newer font format that uses a floating point point size. It + // is not an error if it doesn't exist. + full_key = key + "defaultfont2"; + + ok = qs.contains(full_key); + fdesc = qs.value(full_key).toStringList(); + + if (ok) + { + // Allow for future versions with more fields. + if (fdesc.count() >= 5) + { + QFont f; + + f.setFamily(fdesc[0]); + f.setPointSizeF(fdesc[1].toDouble()); + f.setBold(fdesc[2].toInt()); + f.setItalic(fdesc[3].toInt()); + f.setUnderline(fdesc[4].toInt()); + + setDefaultFont(f); + } + else + { + rc = false; + } + } + + full_key = key + "autoindentstyle"; + + ok = qs.contains(full_key); + num = qs.value(full_key).toInt(); + + if (ok) + setAutoIndentStyle(num); + else + rc = false; + + return rc; +} + + +// Save the user settings. +bool QsciLexer::writeSettings(QSettings &qs,const char *prefix) const +{ + bool rc = true; + QString key, fmt("%1"); + int num; + QStringList fdesc; + + setStyleDefaults(); + + // Write the styles. + for (int i = 0; i < 128; ++i) + { + // Ignore invalid styles. + if (description(i).isEmpty()) + continue; + + QColor c; + + key.sprintf("%s/%s/style%d/",prefix,language(),i); + + // Write the foreground colour. + c = color(i); + num = (c.red() << 16) | (c.green() << 8) | c.blue(); + + qs.setValue(key + "color", num); + + // Write the end-of-line fill. + qs.setValue(key + "eolfill", eolFill(i)); + + // Write the font using the deprecated format. + QFont f = font(i); + + fdesc.clear(); + fdesc += f.family(); + fdesc += fmt.arg(f.pointSize()); + + // The casts are for Borland. + fdesc += fmt.arg((int)f.bold()); + fdesc += fmt.arg((int)f.italic()); + fdesc += fmt.arg((int)f.underline()); + + qs.setValue(key + "font", fdesc); + + // Write the font using the newer format. + fdesc[1] = fmt.arg(f.pointSizeF()); + + qs.setValue(key + "font2", fdesc); + + // Write the background colour. + c = paper(i); + num = (c.red() << 16) | (c.green() << 8) | c.blue(); + + qs.setValue(key + "paper", num); + } + + // Write the properties. + key.sprintf("%s/%s/properties/",prefix,language()); + + if (!writeProperties(qs,key)) + rc = false; + + // Write the rest. + key.sprintf("%s/%s/",prefix,language()); + + // Write the default foreground colour. + num = (defColor.red() << 16) | (defColor.green() << 8) | defColor.blue(); + + qs.setValue(key + "defaultcolor", num); + + // Write the default background colour. + num = (defPaper.red() << 16) | (defPaper.green() << 8) | defPaper.blue(); + + qs.setValue(key + "defaultpaper", num); + + // Write the default font using the deprecated format. + fdesc.clear(); + fdesc += defFont.family(); + fdesc += fmt.arg(defFont.pointSize()); + + // The casts are for Borland. + fdesc += fmt.arg((int)defFont.bold()); + fdesc += fmt.arg((int)defFont.italic()); + fdesc += fmt.arg((int)defFont.underline()); + + qs.setValue(key + "defaultfont", fdesc); + + // Write the font using the newer format. + fdesc[1] = fmt.arg(defFont.pointSizeF()); + + qs.setValue(key + "defaultfont2", fdesc); + + qs.setValue(key + "autoindentstyle", autoIndStyle); + + return rc; +} + + +// Return the auto-indentation style. +int QsciLexer::autoIndentStyle() +{ + // We can't do this in the ctor because we want the virtuals to work. + if (autoIndStyle < 0) + autoIndStyle = (blockStartKeyword() || blockStart() || blockEnd()) ? + 0 : QsciScintilla::AiMaintain; + + return autoIndStyle; +} + + +// Set the auto-indentation style. +void QsciLexer::setAutoIndentStyle(int autoindentstyle) +{ + autoIndStyle = autoindentstyle; +} + + +// Set the foreground colour for a style. +void QsciLexer::setColor(const QColor &c, int style) +{ + if (style >= 0) + { + styleData(style).color = c; + emit colorChanged(c, style); + } + else + for (int i = 0; i < 128; ++i) + if (!description(i).isEmpty()) + setColor(c, i); +} + + +// Set the end-of-line fill for a style. +void QsciLexer::setEolFill(bool eolfill, int style) +{ + if (style >= 0) + { + styleData(style).eol_fill = eolfill; + emit eolFillChanged(eolfill, style); + } + else + for (int i = 0; i < 128; ++i) + if (!description(i).isEmpty()) + setEolFill(eolfill, i); +} + + +// Set the font for a style. +void QsciLexer::setFont(const QFont &f, int style) +{ + if (style >= 0) + { + styleData(style).font = f; + emit fontChanged(f, style); + } + else + for (int i = 0; i < 128; ++i) + if (!description(i).isEmpty()) + setFont(f, i); +} + + +// Set the background colour for a style. +void QsciLexer::setPaper(const QColor &c, int style) +{ + if (style >= 0) + { + styleData(style).paper = c; + emit paperChanged(c, style); + } + else + { + for (int i = 0; i < 128; ++i) + if (!description(i).isEmpty()) + setPaper(c, i); + + emit paperChanged(c, QsciScintillaBase::STYLE_DEFAULT); + } +} diff --git a/libs/qscintilla/Qt4Qt5/qscilexersql.cpp b/libs/qscintilla/Qt4Qt5/qscilexersql.cpp new file mode 100644 index 000000000..ba10810f6 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscilexersql.cpp @@ -0,0 +1,521 @@ +// This module implements the QsciLexerSQL class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscilexersql.h" + +#include +#include +#include + + +// The ctor. +QsciLexerSQL::QsciLexerSQL(QObject *parent) + : QsciLexer(parent), + at_else(false), fold_comments(false), fold_compact(true), + only_begin(false), backticks_identifier(false), + numbersign_comment(false), backslash_escapes(false), + allow_dotted_word(false) +{ +} + + +// The dtor. +QsciLexerSQL::~QsciLexerSQL() +{ +} + + +// Returns the language name. +const char *QsciLexerSQL::language() const +{ + return "SQL"; +} + + +// Returns the lexer name. +const char *QsciLexerSQL::lexer() const +{ + return "sql"; +} + + +// Return the style used for braces. +int QsciLexerSQL::braceStyle() const +{ + return Operator; +} + + +// Returns the foreground colour of the text for a style. +QColor QsciLexerSQL::defaultColor(int style) const +{ + switch (style) + { + case Default: + return QColor(0x80,0x80,0x80); + + case Comment: + case CommentLine: + case PlusPrompt: + case PlusComment: + case CommentLineHash: + return QColor(0x00,0x7f,0x00); + + case CommentDoc: + return QColor(0x7f,0x7f,0x7f); + + case Number: + return QColor(0x00,0x7f,0x7f); + + case Keyword: + return QColor(0x00,0x00,0x7f); + + case DoubleQuotedString: + case SingleQuotedString: + return QColor(0x7f,0x00,0x7f); + + case PlusKeyword: + return QColor(0x7f,0x7f,0x00); + + case Operator: + case Identifier: + break; + + case CommentDocKeyword: + return QColor(0x30,0x60,0xa0); + + case CommentDocKeywordError: + return QColor(0x80,0x40,0x20); + + case KeywordSet5: + return QColor(0x4b,0x00,0x82); + + case KeywordSet6: + return QColor(0xb0,0x00,0x40); + + case KeywordSet7: + return QColor(0x8b,0x00,0x00); + + case KeywordSet8: + return QColor(0x80,0x00,0x80); + } + + return QsciLexer::defaultColor(style); +} + + +// Returns the end-of-line fill for a style. +bool QsciLexerSQL::defaultEolFill(int style) const +{ + if (style == PlusPrompt) + return true; + + return QsciLexer::defaultEolFill(style); +} + + +// Returns the font of the text for a style. +QFont QsciLexerSQL::defaultFont(int style) const +{ + QFont f; + + switch (style) + { + case Comment: + case CommentLine: + case PlusComment: + case CommentLineHash: + case CommentDocKeyword: + case CommentDocKeywordError: +#if defined(Q_OS_WIN) + f = QFont("Comic Sans MS",9); +#elif defined(Q_OS_MAC) + f = QFont("Comic Sans MS", 12); +#else + f = QFont("Bitstream Vera Serif",9); +#endif + break; + + case Keyword: + case Operator: + f = QsciLexer::defaultFont(style); + f.setBold(true); + break; + + case DoubleQuotedString: + case SingleQuotedString: + case PlusPrompt: +#if defined(Q_OS_WIN) + f = QFont("Courier New",10); +#elif defined(Q_OS_MAC) + f = QFont("Courier", 12); +#else + f = QFont("Bitstream Vera Sans Mono",9); +#endif + break; + + default: + f = QsciLexer::defaultFont(style); + } + + return f; +} + + +// Returns the set of keywords. +const char *QsciLexerSQL::keywords(int set) const +{ + if (set == 1) + return + "absolute action add admin after aggregate alias all " + "allocate alter and any are array as asc assertion " + "at authorization before begin binary bit blob " + "boolean both breadth by call cascade cascaded case " + "cast catalog char character check class clob close " + "collate collation column commit completion connect " + "connection constraint constraints constructor " + "continue corresponding create cross cube current " + "current_date current_path current_role current_time " + "current_timestamp current_user cursor cycle data " + "date day deallocate dec decimal declare default " + "deferrable deferred delete depth deref desc " + "describe descriptor destroy destructor " + "deterministic dictionary diagnostics disconnect " + "distinct domain double drop dynamic each else end " + "end-exec equals escape every except exception exec " + "execute external false fetch first float for " + "foreign found from free full function general get " + "global go goto grant group grouping having host " + "hour identity if ignore immediate in indicator " + "initialize initially inner inout input insert int " + "integer intersect interval into is isolation " + "iterate join key language large last lateral " + "leading left less level like limit local localtime " + "localtimestamp locator map match minute modifies " + "modify module month names national natural nchar " + "nclob new next no none not null numeric object of " + "off old on only open operation option or order " + "ordinality out outer output pad parameter " + "parameters partial path postfix precision prefix " + "preorder prepare preserve primary prior privileges " + "procedure public read reads real recursive ref " + "references referencing relative restrict result " + "return returns revoke right role rollback rollup " + "routine row rows savepoint schema scroll scope " + "search second section select sequence session " + "session_user set sets size smallint some| space " + "specific specifictype sql sqlexception sqlstate " + "sqlwarning start state statement static structure " + "system_user table temporary terminate than then " + "time timestamp timezone_hour timezone_minute to " + "trailing transaction translation treat trigger " + "true under union unique unknown unnest update usage " + "user using value values varchar variable varying " + "view when whenever where with without work write " + "year zone"; + + if (set == 3) + return + "param author since return see deprecated todo"; + + if (set == 4) + return + "acc~ept a~ppend archive log attribute bre~ak " + "bti~tle c~hange cl~ear col~umn comp~ute conn~ect " + "copy def~ine del desc~ribe disc~onnect e~dit " + "exec~ute exit get help ho~st i~nput l~ist passw~ord " + "pau~se pri~nt pro~mpt quit recover rem~ark " + "repf~ooter reph~eader r~un sav~e set sho~w shutdown " + "spo~ol sta~rt startup store timi~ng tti~tle " + "undef~ine var~iable whenever oserror whenever " + "sqlerror"; + + if (set == 5) + return + "dbms_output.disable dbms_output.enable dbms_output.get_line " + "dbms_output.get_lines dbms_output.new_line dbms_output.put " + "dbms_output.put_line"; + + return 0; +} + + +// Returns the user name of a style. +QString QsciLexerSQL::description(int style) const +{ + switch (style) + { + case Default: + return tr("Default"); + + case Comment: + return tr("Comment"); + + case CommentLine: + return tr("Comment line"); + + case CommentDoc: + return tr("JavaDoc style comment"); + + case Number: + return tr("Number"); + + case Keyword: + return tr("Keyword"); + + case DoubleQuotedString: + return tr("Double-quoted string"); + + case SingleQuotedString: + return tr("Single-quoted string"); + + case PlusKeyword: + return tr("SQL*Plus keyword"); + + case PlusPrompt: + return tr("SQL*Plus prompt"); + + case Operator: + return tr("Operator"); + + case Identifier: + return tr("Identifier"); + + case PlusComment: + return tr("SQL*Plus comment"); + + case CommentLineHash: + return tr("# comment line"); + + case CommentDocKeyword: + return tr("JavaDoc keyword"); + + case CommentDocKeywordError: + return tr("JavaDoc keyword error"); + + case KeywordSet5: + return tr("User defined 1"); + + case KeywordSet6: + return tr("User defined 2"); + + case KeywordSet7: + return tr("User defined 3"); + + case KeywordSet8: + return tr("User defined 4"); + + case QuotedIdentifier: + return tr("Quoted identifier"); + + case QuotedOperator: + return tr("Quoted operator"); + } + + return QString(); +} + + +// Returns the background colour of the text for a style. +QColor QsciLexerSQL::defaultPaper(int style) const +{ + if (style == PlusPrompt) + return QColor(0xe0,0xff,0xe0); + + return QsciLexer::defaultPaper(style); +} + + +// Refresh all properties. +void QsciLexerSQL::refreshProperties() +{ + setAtElseProp(); + setCommentProp(); + setCompactProp(); + setOnlyBeginProp(); + setBackticksIdentifierProp(); + setNumbersignCommentProp(); + setBackslashEscapesProp(); + setAllowDottedWordProp(); +} + + +// Read properties from the settings. +bool QsciLexerSQL::readProperties(QSettings &qs, const QString &prefix) +{ + int rc = true; + + at_else = qs.value(prefix + "atelse", false).toBool(); + fold_comments = qs.value(prefix + "foldcomments", false).toBool(); + fold_compact = qs.value(prefix + "foldcompact", true).toBool(); + only_begin = qs.value(prefix + "onlybegin", false).toBool(); + backticks_identifier = qs.value(prefix + "backticksidentifier", false).toBool(); + numbersign_comment = qs.value(prefix + "numbersigncomment", false).toBool(); + backslash_escapes = qs.value(prefix + "backslashescapes", false).toBool(); + allow_dotted_word = qs.value(prefix + "allowdottedword", false).toBool(); + + return rc; +} + + +// Write properties to the settings. +bool QsciLexerSQL::writeProperties(QSettings &qs, const QString &prefix) const +{ + int rc = true; + + qs.value(prefix + "atelse", at_else); + qs.value(prefix + "foldcomments", fold_comments); + qs.value(prefix + "foldcompact", fold_compact); + qs.value(prefix + "onlybegin", only_begin); + qs.value(prefix + "backticksidentifier", backticks_identifier); + qs.value(prefix + "numbersigncomment", numbersign_comment); + qs.value(prefix + "backslashescapes", backslash_escapes); + qs.value(prefix + "allowdottedword", allow_dotted_word); + + return rc; +} + + +// Set if ELSE blocks can be folded. +void QsciLexerSQL::setFoldAtElse(bool fold) +{ + at_else = fold; + + setAtElseProp(); +} + + +// Set the "fold.sql.at.else" property. +void QsciLexerSQL::setAtElseProp() +{ + emit propertyChanged("fold.sql.at.else", (at_else ? "1" : "0")); +} + + +// Set if comments can be folded. +void QsciLexerSQL::setFoldComments(bool fold) +{ + fold_comments = fold; + + setCommentProp(); +} + + +// Set the "fold.comment" property. +void QsciLexerSQL::setCommentProp() +{ + emit propertyChanged("fold.comment", (fold_comments ? "1" : "0")); +} + + +// Set if folds are compact +void QsciLexerSQL::setFoldCompact(bool fold) +{ + fold_compact = fold; + + setCompactProp(); +} + + +// Set the "fold.compact" property. +void QsciLexerSQL::setCompactProp() +{ + emit propertyChanged("fold.compact", (fold_compact ? "1" : "0")); +} + + +// Set if BEGIN blocks only can be folded. +void QsciLexerSQL::setFoldOnlyBegin(bool fold) +{ + only_begin = fold; + + setOnlyBeginProp(); +} + + +// Set the "fold.sql.only.begin" property. +void QsciLexerSQL::setOnlyBeginProp() +{ + emit propertyChanged("fold.sql.only.begin", (only_begin ? "1" : "0")); +} + + +// Enable quoted identifiers. +void QsciLexerSQL::setQuotedIdentifiers(bool enable) +{ + backticks_identifier = enable; + + setBackticksIdentifierProp(); +} + + +// Set the "lexer.sql.backticks.identifier" property. +void QsciLexerSQL::setBackticksIdentifierProp() +{ + emit propertyChanged("lexer.sql.backticks.identifier", (backticks_identifier ? "1" : "0")); +} + + +// Enable '#' as a comment character. +void QsciLexerSQL::setHashComments(bool enable) +{ + numbersign_comment = enable; + + setNumbersignCommentProp(); +} + + +// Set the "lexer.sql.numbersign.comment" property. +void QsciLexerSQL::setNumbersignCommentProp() +{ + emit propertyChanged("lexer.sql.numbersign.comment", (numbersign_comment ? "1" : "0")); +} + + +// Enable/disable backslash escapes. +void QsciLexerSQL::setBackslashEscapes(bool enable) +{ + backslash_escapes = enable; + + setBackslashEscapesProp(); +} + + +// Set the "sql.backslash.escapes" property. +void QsciLexerSQL::setBackslashEscapesProp() +{ + emit propertyChanged("sql.backslash.escapes", (backslash_escapes ? "1" : "0")); +} + + +// Enable dotted words. +void QsciLexerSQL::setDottedWords(bool enable) +{ + allow_dotted_word = enable; + + setAllowDottedWordProp(); +} + + +// Set the "lexer.sql.allow.dotted.word" property. +void QsciLexerSQL::setAllowDottedWordProp() +{ + emit propertyChanged("lexer.sql.allow.dotted.word", (allow_dotted_word ? "1" : "0")); +} diff --git a/libs/qscintilla/Qt4Qt5/qscimacro.cpp b/libs/qscintilla/Qt4Qt5/qscimacro.cpp new file mode 100644 index 000000000..ed790ae89 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscimacro.cpp @@ -0,0 +1,316 @@ +// This module implements the QsciMacro class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscimacro.h" + +#include + +#include "Qsci/qsciscintilla.h" + + +static int fromHex(unsigned char ch); + + +// The ctor. +QsciMacro::QsciMacro(QsciScintilla *parent) + : QObject(parent), qsci(parent) +{ +} + + +// The ctor that initialises the macro. +QsciMacro::QsciMacro(const QString &asc, QsciScintilla *parent) + : QObject(parent), qsci(parent) +{ + load(asc); +} + + +// The dtor. +QsciMacro::~QsciMacro() +{ +} + + +// Clear the contents of the macro. +void QsciMacro::clear() +{ + macro.clear(); +} + + +// Read a macro from a string. +bool QsciMacro::load(const QString &asc) +{ + bool ok = true; + + macro.clear(); + + QStringList fields = asc.split(' '); + + int f = 0; + + while (f < fields.size()) + { + Macro cmd; + unsigned len; + + // Extract the 3 fixed fields. + if (f + 3 > fields.size()) + { + ok = false; + break; + } + + cmd.msg = fields[f++].toUInt(&ok); + + if (!ok) + break; + + cmd.wParam = fields[f++].toULong(&ok); + + if (!ok) + break; + + len = fields[f++].toUInt(&ok); + + if (!ok) + break; + + // Extract any text. + if (len) + { + if (f + 1 > fields.size()) + { + ok = false; + break; + } + + QByteArray ba = fields[f++].toLatin1(); + const char *sp = ba.data(); + + if (!sp) + { + ok = false; + break; + } + + // Because of historical bugs the length field is unreliable. + bool embedded_null = false; + unsigned char ch; + + while ((ch = *sp++) != '\0') + { + if (ch == '"' || ch <= ' ' || ch >= 0x7f) + { + ok = false; + break; + } + + if (ch == '\\') + { + int b1, b2; + + if ((b1 = fromHex(*sp++)) < 0 || + (b2 = fromHex(*sp++)) < 0) + { + ok = false; + break; + } + + ch = (b1 << 4) + b2; + } + + if (ch == '\0') + { + // Don't add it now as it may be the terminating '\0'. + embedded_null = true; + } + else + { + if (embedded_null) + { + // Add the pending embedded '\0'. + cmd.text += '\0'; + embedded_null = false; + } + + cmd.text += ch; + } + } + + if (!ok) + break; + } + + macro.append(cmd); + } + + if (!ok) + macro.clear(); + + return ok; +} + + +// Write a macro to a string. +QString QsciMacro::save() const +{ + QString ms; + + QList::const_iterator it; + + for (it = macro.begin(); it != macro.end(); ++it) + { + if (!ms.isEmpty()) + ms += ' '; + + unsigned len = (*it).text.size(); + QString m; + + ms += m.sprintf("%u %lu %u", (*it).msg, (*it).wParam, len); + + if (len) + { + // In Qt v3, if the length is greater than zero then it also + // includes the '\0', so we need to make sure that Qt v4 writes the + // '\0'. That the '\0' is written at all is a bug because + // QCString::size() is used instead of QCString::length(). We + // don't fix this so as not to break old macros. However this is + // still broken because we have already written the unadjusted + // length. So, in summary, the length field should be interpreted + // as a zero/non-zero value, and the end of the data is either at + // the next space or the very end of the data. + ++len; + + ms += ' '; + + const char *cp = (*it).text.data(); + + while (len--) + { + unsigned char ch = *cp++; + + if (ch == '\\' || ch == '"' || ch <= ' ' || ch >= 0x7f) + { + QString buf; + + ms += buf.sprintf("\\%02x", ch); + } + else + ms += ch; + } + } + } + + return ms; +} + + +// Play the macro. +void QsciMacro::play() +{ + if (!qsci) + return; + + QList::const_iterator it; + + for (it = macro.begin(); it != macro.end(); ++it) + qsci->SendScintilla((*it).msg, (*it).wParam, (*it).text.data()); +} + + +// Start recording. +void QsciMacro::startRecording() +{ + if (!qsci) + return; + + macro.clear(); + + connect(qsci, SIGNAL(SCN_MACRORECORD(unsigned int, unsigned long, void *)), + SLOT(record(unsigned int, unsigned long, void *))); + + qsci->SendScintilla(QsciScintillaBase::SCI_STARTRECORD); +} + + +// End recording. +void QsciMacro::endRecording() +{ + if (!qsci) + return; + + qsci->SendScintilla(QsciScintillaBase::SCI_STOPRECORD); + qsci->disconnect(this); +} + + +// Record a command. +void QsciMacro::record(unsigned int msg, unsigned long wParam, void *lParam) +{ + Macro m; + + m.msg = msg; + m.wParam = wParam; + + // Determine commands which need special handling of the parameters. + switch (msg) + { + case QsciScintillaBase::SCI_ADDTEXT: + m.text = QByteArray(reinterpret_cast(lParam), wParam); + break; + + case QsciScintillaBase::SCI_REPLACESEL: + if (!macro.isEmpty() && macro.last().msg == QsciScintillaBase::SCI_REPLACESEL) + { + // This is the command used for ordinary user input so it's a + // significant space reduction to append it to the previous + // command. + + macro.last().text.append(reinterpret_cast(lParam)); + return; + } + + /* Drop through. */ + + case QsciScintillaBase::SCI_INSERTTEXT: + case QsciScintillaBase::SCI_APPENDTEXT: + case QsciScintillaBase::SCI_SEARCHNEXT: + case QsciScintillaBase::SCI_SEARCHPREV: + m.text.append(reinterpret_cast(lParam)); + break; + } + + macro.append(m); +} + + +// Return the given hex character as a binary. +static int fromHex(unsigned char ch) +{ + if (ch >= '0' && ch <= '9') + return ch - '0'; + + if (ch >= 'a' && ch <= 'f') + return ch - 'a' + 10; + + return -1; +} diff --git a/libs/qscintilla/Qt4Qt5/qscintilla.pro b/libs/qscintilla/Qt4Qt5/qscintilla.pro new file mode 100644 index 000000000..bc1dab160 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscintilla.pro @@ -0,0 +1,222 @@ +# The project file for the QScintilla library. +# +# Copyright (c) 2014 Riverbank Computing Limited +# +# This file is part of QScintilla. +# +# This file may be used under the terms of the GNU General Public +# License versions 2.0 or 3.0 as published by the Free Software +# Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Alternatively you may (at +# your option) use any later version of the GNU General Public +# License if such license has been publicly approved by Riverbank +# Computing Limited (or its successors, if any) and the KDE Free Qt +# Foundation. In addition, as a special exception, Riverbank gives you +# certain additional rights. These rights are described in the Riverbank +# GPL Exception version 1.1, which can be found in the file +# GPL_EXCEPTION.txt in this package. +# +# If you are unsure which license is appropriate for your use, please +# contact the sales department at sales@riverbankcomputing.com. +# +# This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +# WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +# This must be kept in sync with Python/configure.py, Python/configure-old.py, +# example-Qt4Qt5/application.pro and designer-Qt4Qt5/designer.pro. +!win32:VERSION = 11.3.0 + +TEMPLATE = lib +TARGET = qscintilla2 +CONFIG += qt warn_off release thread exceptions staticlib debug_and_release +INCLUDEPATH += . ../include ../lexlib ../src + +DEFINES += QSCINTILLA_MAKE_DLL SCINTILLA_QT SCI_LEXER +greaterThan(QT_MAJOR_VERSION, 3) { + CONFIG(staticlib) { + DEFINES -= QSCINTILLA_MAKE_DLL + } +} + +greaterThan(QT_MAJOR_VERSION, 4) { + QT += widgets printsupport + + greaterThan(QT_MINOR_VERSION, 1) { + macx:QT += macextras + } + + # Work around QTBUG-39300. + CONFIG -= android_install +} + +# Comment this in if you want the internal Scintilla classes to be placed in a +# Scintilla namespace rather than pollute the global namespace. +#DEFINES += SCI_NAMESPACE + +# Handle both Qt v4 and v3. +target.path = $$[QT_INSTALL_LIBS] +isEmpty(target.path) { + target.path = $(QTDIR)/lib +} + +header.path = $$[QT_INSTALL_HEADERS] +header.files = Qsci +isEmpty(header.path) { + header.path = $(QTDIR)/include/Qsci + header.files = Qsci/qsci*.h +} + +trans.path = $$[QT_INSTALL_TRANSLATIONS] +trans.files = qscintilla_*.qm +isEmpty(trans.path) { + trans.path = $(QTDIR)/translations +} + +qsci.path = $$[QT_INSTALL_DATA] +qsci.files = ../qsci +isEmpty(qsci.path) { + qsci.path = $(QTDIR) +} + +INSTALLS += header trans qsci target + +greaterThan(QT_MAJOR_VERSION, 3) { + features.path = $$[QT_INSTALL_DATA]/mkspecs/features + features.files = $$PWD/features/qscintilla2.prf + INSTALLS += features +} + +HEADERS = \ + ./Qsci/qsciglobal.h \ + ./Qsci/qsciscintilla.h \ + ./Qsci/qsciscintillabase.h \ + ./Qsci/qsciabstractapis.h \ + ./Qsci/qsciapis.h \ + ./Qsci/qscicommand.h \ + ./Qsci/qscicommandset.h \ + ./Qsci/qscidocument.h \ + ./Qsci/qscilexer.h \ + ./Qsci/qscilexersql.h \ + ./Qsci/qscimacro.h \ + ./Qsci/qsciprinter.h \ + ./Qsci/qscistyle.h \ + ./Qsci/qscistyledtext.h \ + ListBoxQt.h \ + SciClasses.h \ + SciNamespace.h \ + ScintillaQt.h \ + ../include/ILexer.h \ + ../include/Platform.h \ + ../include/SciLexer.h \ + ../include/Scintilla.h \ + ../include/ScintillaWidget.h \ + ../lexlib/Accessor.h \ + ../lexlib/CharacterCategory.h \ + ../lexlib/CharacterSet.h \ + ../lexlib/LexAccessor.h \ + ../lexlib/LexerBase.h \ + ../lexlib/LexerModule.h \ + ../lexlib/LexerNoExceptions.h \ + ../lexlib/LexerSimple.h \ + ../lexlib/OptionSet.h \ + ../lexlib/PropSetSimple.h \ + ../lexlib/StyleContext.h \ + ../lexlib/SubStyles.h \ + ../lexlib/WordList.h \ + ../src/AutoComplete.h \ + ../src/CallTip.h \ + ../src/CaseConvert.h \ + ../src/CaseFolder.h \ + ../src/Catalogue.h \ + ../src/CellBuffer.h \ + ../src/CharClassify.h \ + ../src/ContractionState.h \ + ../src/Decoration.h \ + ../src/Document.h \ + ../src/Editor.h \ + ../src/ExternalLexer.h \ + ../src/FontQuality.h \ + ../src/Indicator.h \ + ../src/KeyMap.h \ + ../src/LineMarker.h \ + ../src/Partitioning.h \ + ../src/PerLine.h \ + ../src/PositionCache.h \ + ../src/RESearch.h \ + ../src/RunStyles.h \ + ../src/ScintillaBase.h \ + ../src/Selection.h \ + ../src/SplitVector.h \ + ../src/Style.h \ + ../src/UnicodeFromUTF8.h \ + ../src/UniConversion.h \ + ../src/ViewStyle.h \ + ../src/XPM.h + +SOURCES = \ + qsciscintilla.cpp \ + qsciscintillabase.cpp \ + qsciabstractapis.cpp \ + qsciapis.cpp \ + qscicommand.cpp \ + qscicommandset.cpp \ + qscidocument.cpp \ + qscilexer.cpp \ + qscilexersql.cpp \ + qscimacro.cpp \ + qsciprinter.cpp \ + qscistyle.cpp \ + qscistyledtext.cpp \ + MacPasteboardMime.cpp \ + InputMethod.cpp \ + SciClasses.cpp \ + ListBoxQt.cpp \ + PlatQt.cpp \ + ScintillaQt.cpp \ + ../lexers/LexSQL.cpp \ + ../lexlib/Accessor.cpp \ + ../lexlib/CharacterCategory.cpp \ + ../lexlib/CharacterSet.cpp \ + ../lexlib/LexerBase.cpp \ + ../lexlib/LexerModule.cpp \ + ../lexlib/LexerNoExceptions.cpp \ + ../lexlib/LexerSimple.cpp \ + ../lexlib/PropSetSimple.cpp \ + ../lexlib/StyleContext.cpp \ + ../lexlib/WordList.cpp \ + ../src/AutoComplete.cpp \ + ../src/CallTip.cpp \ + ../src/CaseConvert.cpp \ + ../src/CaseFolder.cpp \ + ../src/Catalogue.cpp \ + ../src/CellBuffer.cpp \ + ../src/CharClassify.cpp \ + ../src/ContractionState.cpp \ + ../src/Decoration.cpp \ + ../src/Document.cpp \ + ../src/Editor.cpp \ + ../src/EditModel.cpp \ + ../src/EditView.cpp \ + ../src/ExternalLexer.cpp \ + ../src/Indicator.cpp \ + ../src/KeyMap.cpp \ + ../src/LineMarker.cpp \ + ../src/MarginView.cpp \ + ../src/PerLine.cpp \ + ../src/PositionCache.cpp \ + ../src/RESearch.cpp \ + ../src/RunStyles.cpp \ + ../src/ScintillaBase.cpp \ + ../src/Selection.cpp \ + ../src/Style.cpp \ + ../src/UniConversion.cpp \ + ../src/ViewStyle.cpp \ + ../src/XPM.cpp + +TRANSLATIONS = \ + qscintilla_cs.ts \ + qscintilla_de.ts \ + qscintilla_es.ts \ + qscintilla_fr.ts \ + qscintilla_pt_br.ts diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_cs.qm b/libs/qscintilla/Qt4Qt5/qscintilla_cs.qm new file mode 100644 index 000000000..4a6ed6502 Binary files /dev/null and b/libs/qscintilla/Qt4Qt5/qscintilla_cs.qm differ diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_cs.ts b/libs/qscintilla/Qt4Qt5/qscintilla_cs.ts new file mode 100644 index 000000000..9b9231096 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscintilla_cs.ts @@ -0,0 +1,3702 @@ + + + + + QsciCommand + + + Move down one line + Posun o jednu řádku dolů + + + + Extend selection down one line + Rozšířit výběr o jednu řádku dolů + + + + Scroll view down one line + Rolovat pohled o jednu řádku dolů + + + + Extend rectangular selection down one line + Rozšířit obdélníkový výběr o jednu řádku dolů + + + + Move up one line + Posun o jednu řádku nahoru + + + + Extend selection up one line + Rozšířit výběr o jednu řádku nahoru + + + + Scroll view up one line + Rolovat pohled o jednu řádku nahoru + + + + Extend rectangular selection up one line + Rozšířit obdélníkový výběr o jednu řádku nahoru + + + + Move up one paragraph + Posun o jeden odstavec nahoru + + + + Extend selection up one paragraph + Rozšířit výběr o jeden odstavec nahoru + + + + Move down one paragraph + Posun o jeden odstavec dolů + + + + Scroll to start of document + + + + + Scroll to end of document + + + + + Scroll vertically to centre current line + + + + + Extend selection down one paragraph + Rozšířit výběr o jeden odstavec dolů + + + + Move left one character + Posun o jedno písmeno doleva + + + + Extend selection left one character + Rozšířit výběr o jedno písmeno doleva + + + + Move left one word + Posun o jedno slovo vlevo + + + + Extend selection left one word + Rozšířit výběr o jedno slovo doleva + + + + Extend rectangular selection left one character + Rozšířit obdélníkový výběr o jedno písmeno doleva + + + + Move right one character + Posun o jedno písmeno doprava + + + + Extend selection right one character + Rozšířit výběr o jedno písmeno doprava + + + + Move right one word + Posun o jedno slovo doprava + + + + Extend selection right one word + Rozšířit výběr o jedno slovo doprava + + + + Extend rectangular selection right one character + Rozšířit obdélníkový výběr o jedno písmeno doprava + + + + Move to end of previous word + + + + + Extend selection to end of previous word + + + + + Move to end of next word + + + + + Extend selection to end of next word + + + + + Move left one word part + Posun o část slova doleva + + + + Extend selection left one word part + Rozšířit výběr o část slova doleva + + + + Move right one word part + Posun o část slova doprava + + + + Extend selection right one word part + Rozšířit výběr o část slova doprava + + + + Move up one page + Posun na předchozí stranu + + + + Extend selection up one page + Rozšířit výběr na předchozí stranu + + + + Extend rectangular selection up one page + Rozšířit obdélníkový výběr na předchozí stranu + + + + Move down one page + Posun na další stranu + + + + Extend selection down one page + Rozšířit výběr na další stranu + + + + Extend rectangular selection down one page + Rozšířit obdélníkový výběr na další stranu + + + + Delete current character + Smazat aktuální znak + + + + Cut selection + Vyjmout výběr + + + + Delete word to right + Smazat slovo doprava + + + + Move to start of document line + + + + + Extend selection to start of document line + + + + + Extend rectangular selection to start of document line + + + + + Move to start of display line + + + + + Extend selection to start of display line + + + + + Move to start of display or document line + + + + + Extend selection to start of display or document line + + + + + Move to first visible character in document line + + + + + Extend selection to first visible character in document line + + + + + Extend rectangular selection to first visible character in document line + + + + + Move to first visible character of display in document line + + + + + Extend selection to first visible character in display or document line + + + + + Move to end of document line + + + + + Extend selection to end of document line + + + + + Extend rectangular selection to end of document line + + + + + Move to end of display line + + + + + Extend selection to end of display line + + + + + Move to end of display or document line + + + + + Extend selection to end of display or document line + + + + + Move to start of document + + + + + Extend selection to start of document + + + + + Move to end of document + + + + + Extend selection to end of document + + + + + Stuttered move up one page + + + + + Stuttered extend selection up one page + + + + + Stuttered move down one page + + + + + Stuttered extend selection down one page + + + + + Delete previous character if not at start of line + + + + + Delete right to end of next word + + + + + Delete line to right + Smazat řádku doprava + + + + Transpose current and previous lines + + + + + Duplicate the current line + + + + + Select all + Select document + + + + + Move selected lines up one line + + + + + Move selected lines down one line + + + + + Toggle insert/overtype + Přepnout vkládání/přepisování + + + + Paste + Vložit + + + + Copy selection + Kopírovat výběr + + + + Insert newline + + + + + De-indent one level + + + + + Cancel + Zrušit + + + + Delete previous character + Smazat předchozí znak + + + + Delete word to left + Smazat slovo doleva + + + + Delete line to left + Smazat řádku doleva + + + + Undo last command + + + + + Redo last command + Znovu použít poslední příkaz + + + + Indent one level + Odsadit o jednu úroveň + + + + Zoom in + Zvětšit + + + + Zoom out + Zmenšit + + + + Formfeed + Vysunout + + + + Cut current line + Vyjmout aktuální řádku + + + + Delete current line + Smazat aktuální řádku + + + + Copy current line + Kopírovat aktuální řádku + + + + Convert selection to lower case + Vybraný text převést na malá písmena + + + + Convert selection to upper case + Vybraný text převést na velká písmena + + + + Duplicate selection + Duplikovat výběr + + + + QsciLexerAVS + + + Default + Default + + + + Block comment + + + + + Nested block comment + + + + + Line comment + Jednořádkový komentář + + + + Number + Číslo + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Triple double-quoted string + String ve třech dvojitých uvozovkách + + + + Keyword + Klíčové slovo + + + + Filter + + + + + Plugin + + + + + Function + + + + + Clip property + + + + + User defined + + + + + QsciLexerBash + + + Default + Default + + + + Error + Chyba + + + + Comment + Komentář + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Scalar + Skalár + + + + Parameter expansion + Rozklad parametru + + + + Backticks + Zpětný chod + + + + Here document delimiter + Zde je oddělovač dokumentu + + + + Single-quoted here document + Jednoduché uvozovky zde v dokumentu + + + + QsciLexerBatch + + + Default + Default + + + + Comment + Komentář + + + + Keyword + Klíčové slovo + + + + Label + Nadpis + + + + Hide command character + Skrýt písmeno příkazu + + + + External command + Externí příkaz + + + + Variable + Proměnná + + + + Operator + Operátor + + + + QsciLexerCMake + + + Default + Default + + + + Comment + Komentář + + + + String + + + + + Left quoted string + + + + + Right quoted string + + + + + Function + + + + + Variable + Proměnná + + + + Label + Nadpis + + + + User defined + + + + + WHILE block + + + + + FOREACH block + + + + + IF block + + + + + MACRO block + + + + + Variable within a string + + + + + Number + Číslo + + + + QsciLexerCPP + + + Default + Default + + + + Inactive default + + + + + C comment + C komentář + + + + Inactive C comment + + + + + C++ comment + C++ komentář + + + + Inactive C++ comment + + + + + JavaDoc style C comment + JavaDoc styl C komentáře + + + + Inactive JavaDoc style C comment + + + + + Number + Číslo + + + + Inactive number + + + + + Keyword + Klíčové slovo + + + + Inactive keyword + + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Inactive double-quoted string + + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Inactive single-quoted string + + + + + IDL UUID + + + + + Inactive IDL UUID + + + + + Pre-processor block + Pre-procesor blok + + + + Inactive pre-processor block + + + + + Operator + Operátor + + + + Inactive operator + + + + + Identifier + Identifikátor + + + + Inactive identifier + + + + + Unclosed string + Neuzavřený string + + + + Inactive unclosed string + + + + + C# verbatim string + + + + + Inactive C# verbatim string + + + + + JavaScript regular expression + JavaSript regulární výraz + + + + Inactive JavaScript regular expression + + + + + JavaDoc style C++ comment + JavaDoc styl C++ komentáře + + + + Inactive JavaDoc style C++ comment + + + + + Secondary keywords and identifiers + Sekundární klíčová slova a identifikátory + + + + Inactive secondary keywords and identifiers + + + + + JavaDoc keyword + JavaDoc klíčové slovo + + + + Inactive JavaDoc keyword + + + + + JavaDoc keyword error + JavaDoc klíčové slovo chyby + + + + Inactive JavaDoc keyword error + + + + + Global classes and typedefs + Globální třídy a definice typů + + + + Inactive global classes and typedefs + + + + + C++ raw string + + + + + Inactive C++ raw string + + + + + Vala triple-quoted verbatim string + + + + + Inactive Vala triple-quoted verbatim string + + + + + Pike hash-quoted string + + + + + Inactive Pike hash-quoted string + + + + + Pre-processor C comment + + + + + Inactive pre-processor C comment + + + + + JavaDoc style pre-processor comment + + + + + Inactive JavaDoc style pre-processor comment + + + + + User-defined literal + + + + + Inactive user-defined literal + + + + + Task marker + + + + + Inactive task marker + + + + + Escape sequence + + + + + Inactive escape sequence + + + + + QsciLexerCSS + + + Default + Default + + + + Tag + Tag + + + + Class selector + Selektor třídy + + + + Pseudo-class + Pseudotřída + + + + Unknown pseudo-class + Nedefinovaná pseudotřída + + + + Operator + Operátor + + + + CSS1 property + CSS1 vlastnost + + + + Unknown property + Nedefinovaná vlastnost + + + + Value + Hodnota + + + + ID selector + ID selektor + + + + Important + Important + + + + @-rule + @-pravidlo + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + CSS2 property + CSS2 vlastnost + + + + Attribute + Atribut + + + + CSS3 property + CSS2 vlastnost {3 ?} + + + + Pseudo-element + + + + + Extended CSS property + + + + + Extended pseudo-class + + + + + Extended pseudo-element + + + + + Media rule + + + + + Variable + Proměnná + + + + QsciLexerCSharp + + + Verbatim string + + + + + QsciLexerCoffeeScript + + + Default + Default + + + + C-style comment + + + + + C++-style comment + + + + + JavaDoc C-style comment + + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + IDL UUID + + + + + Pre-processor block + Pre-procesor blok + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Unclosed string + Neuzavřený string + + + + C# verbatim string + + + + + Regular expression + Regulární výraz + + + + JavaDoc C++-style comment + + + + + Secondary keywords and identifiers + Sekundární klíčová slova a identifikátory + + + + JavaDoc keyword + JavaDoc klíčové slovo + + + + JavaDoc keyword error + JavaDoc klíčové slovo chyby + + + + Global classes + + + + + Block comment + + + + + Block regular expression + + + + + Block regular expression comment + + + + + QsciLexerD + + + Default + Default + + + + Block comment + + + + + Line comment + Jednořádkový komentář + + + + DDoc style block comment + + + + + Nesting comment + + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + Secondary keyword + + + + + Documentation keyword + + + + + Type definition + + + + + String + + + + + Unclosed string + Neuzavřený string + + + + Character + Znak + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + DDoc style line comment + + + + + DDoc keyword + + + + + DDoc keyword error + + + + + Backquoted string + + + + + Raw string + + + + + User defined 1 + Definováno uživatelem 1 + + + + User defined 2 + Definováno uživatelem 2 + + + + User defined 3 + Definováno uživatelem 3 + + + + QsciLexerDiff + + + Default + Default + + + + Comment + Komentář + + + + Command + Příkaz + + + + Header + Hlavička + + + + Position + Pozice + + + + Removed line + Odebraná řádka + + + + Added line + Přidaná řádka + + + + Changed line + + + + + QsciLexerFortran77 + + + Default + Default + + + + Comment + Komentář + + + + Number + Číslo + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Unclosed string + Neuzavřený string + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Keyword + Klíčové slovo + + + + Intrinsic function + + + + + Extended function + + + + + Pre-processor block + Pre-procesor blok + + + + Dotted operator + + + + + Label + Nadpis + + + + Continuation + + + + + QsciLexerHTML + + + HTML default + + + + + Tag + + + + + Unknown tag + Nedefinovaný tag + + + + Attribute + Atribut + + + + Unknown attribute + Nedefinovaný atribut + + + + HTML number + HTML číslo + + + + HTML double-quoted string + HTML string ve dojtých uvozovkách + + + + HTML single-quoted string + HTML string v jednoduchých uvozovkách + + + + Other text in a tag + Další text v tagu + + + + HTML comment + HTML komentář + + + + Entity + Entita + + + + End of a tag + Konec tagu + + + + Start of an XML fragment + Začátek XML části + + + + End of an XML fragment + Konec XML části + + + + Script tag + Tag skriptu + + + + Start of an ASP fragment with @ + Začátek ASP kódu s @ + + + + Start of an ASP fragment + Začátek ASP kódu + + + + CDATA + + + + + Start of a PHP fragment + Začátek PHP kódu + + + + Unquoted HTML value + HTML hodnota bez uvozovek + + + + ASP X-Code comment + ASP X-Code komentář + + + + SGML default + + + + + SGML command + SGML příkaz + + + + First parameter of an SGML command + První parametr v SGML příkazu + + + + SGML double-quoted string + SGML string ve dvojitých uvozovkách + + + + SGML single-quoted string + SGML string v jednoduchých uvozovkách + + + + SGML error + SGML chyba + + + + SGML special entity + SGML speciální entita + + + + SGML comment + SGML komentář + + + + First parameter comment of an SGML command + Komentář prvního parametru SGML příkazu + + + + SGML block default + SGML defaultní blok + + + + Start of a JavaScript fragment + Začátek JavaScript kódu + + + + JavaScript default + + + + + JavaScript comment + JavaScript komentář + + + + JavaScript line comment + JavaScript jednořádkový komentář + + + + JavaDoc style JavaScript comment + JavaDoc styl JavaScript komentáře + + + + JavaScript number + JavaScript číslo + + + + JavaScript word + JavaSript slovo + + + + JavaScript keyword + JavaSript klíčové slovo + + + + JavaScript double-quoted string + JavaSript string ve dvojitých uvozovkách + + + + JavaScript single-quoted string + JavaSript string v jednoduchých uvozovkách + + + + JavaScript symbol + + + + + JavaScript unclosed string + JavaSript neuzavřený string + + + + JavaScript regular expression + JavaSript regulární výraz + + + + Start of an ASP JavaScript fragment + Začátek ASP JavaScript kódu + + + + ASP JavaScript default + + + + + ASP JavaScript comment + ASP JavaScript komentář + + + + ASP JavaScript line comment + ASP JavaScript jednořádkový komenář + + + + JavaDoc style ASP JavaScript comment + JavaDoc styl ASP JavaScript komentář + + + + ASP JavaScript number + ASP JavaScript číslo + + + + ASP JavaScript word + ASP JavaScript slovo + + + + ASP JavaScript keyword + ASP JavaScript klíčové slovo + + + + ASP JavaScript double-quoted string + ASP JavaScript string ve dvojitých uvozovkách + + + + ASP JavaScript single-quoted string + ASP JavaScript v jednoduchých uvozovkách + + + + ASP JavaScript symbol + + + + + ASP JavaScript unclosed string + ASP JavaScript neuzavřený string + + + + ASP JavaScript regular expression + ASP JavaScript regulární výraz + + + + Start of a VBScript fragment + Začátek VBScript kódu + + + + VBScript default + + + + + VBScript comment + VBScript komentář + + + + VBScript number + VBScript číslo + + + + VBScript keyword + VBScript klíčové slovo + + + + VBScript string + + + + + VBScript identifier + VBScript identifikátor + + + + VBScript unclosed string + VBScript neuzavřený string + + + + Start of an ASP VBScript fragment + Začátek ASP VBScript kódu + + + + ASP VBScript default + + + + + ASP VBScript comment + ASP VBScript komentář + + + + ASP VBScript number + ASP VBScript číslo + + + + ASP VBScript keyword + ASP VBScript klíčové slovo + + + + ASP VBScript string + + + + + ASP VBScript identifier + ASP VBScript identifikátor + + + + ASP VBScript unclosed string + ASP VBScript neuzavřený string + + + + Start of a Python fragment + Začátek Python kódu + + + + Python default + + + + + Python comment + Python komentář + + + + Python number + Python číslo + + + + Python double-quoted string + Python string ve dojtých uvozovkách + + + + Python single-quoted string + Python string v jednoduchých uvozovkách + + + + Python keyword + Python klíčové slovo + + + + Python triple double-quoted string + Python string ve třech dvojitých uvozovkách + + + + Python triple single-quoted string + Python ve třech jednoduchých uvozovkách + + + + Python class name + Python jméno třídy + + + + Python function or method name + Python jméno funkce nebo metody + + + + Python operator + Python operátor + + + + Python identifier + Python identifikátor + + + + Start of an ASP Python fragment + Začátek ASP Python kódu + + + + ASP Python default + + + + + ASP Python comment + ASP Python komentář + + + + ASP Python number + ASP Python číslo + + + + ASP Python double-quoted string + ASP Python string ve dvojitých uvozovkách + + + + ASP Python single-quoted string + ASP Python v jednoduchých uvozovkách + + + + ASP Python keyword + ASP Python klíčové slovo + + + + ASP Python triple double-quoted string + ASP Python ve třech dvojitých uvozovkách + + + + ASP Python triple single-quoted string + ASP Python ve třech jednoduchých uvozovkách + + + + ASP Python class name + ASP Python jméno třídy + + + + ASP Python function or method name + ASP Python jméno funkce nebo metody + + + + ASP Python operator + ASP Python operátor + + + + ASP Python identifier + ASP Python identifikátor + + + + PHP default + + + + + PHP double-quoted string + PHP string ve dvojitých uvozovkách + + + + PHP single-quoted string + PHP v jednoduchých uvozovkách + + + + PHP keyword + PHP klíčové slovo + + + + PHP number + PHP číslo + + + + PHP variable + PHP proměnná + + + + PHP comment + PHP komentář + + + + PHP line comment + PHP jednořádkový komentář + + + + PHP double-quoted variable + PHP proměnná ve dvojitých uvozovkách + + + + PHP operator + PHP operátor + + + + QsciLexerIDL + + + UUID + + + + + QsciLexerJavaScript + + + Regular expression + Regulární výraz + + + + QsciLexerLua + + + Default + + + + + Comment + Komentář + + + + Line comment + Jednořádkový komentář + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + String + + + + + Character + Znak + + + + Literal string + + + + + Preprocessor + + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Unclosed string + Neuzavřený string + + + + Basic functions + Základní funkce + + + + String, table and maths functions + String, tabulka a matematické funkce + + + + Coroutines, i/o and system facilities + + + + + User defined 1 + Definováno uživatelem 1 + + + + User defined 2 + Definováno uživatelem 2 + + + + User defined 3 + Definováno uživatelem 3 + + + + User defined 4 + Definováno uživatelem 4 + + + + Label + Nadpis + + + + QsciLexerMakefile + + + Default + + + + + Comment + Komentář + + + + Preprocessor + + + + + Variable + Proměnná + + + + Operator + Operátor + + + + Target + Cíl + + + + Error + Chyba + + + + QsciLexerMatlab + + + Default + Default + + + + Comment + Komentář + + + + Command + Příkaz + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + QsciLexerPO + + + Default + Default + + + + Comment + Komentář + + + + Message identifier + + + + + Message identifier text + + + + + Message string + + + + + Message string text + + + + + Message context + + + + + Message context text + + + + + Fuzzy flag + + + + + Programmer comment + + + + + Reference + + + + + Flags + + + + + Message identifier text end-of-line + + + + + Message string text end-of-line + + + + + Message context text end-of-line + + + + + QsciLexerPOV + + + Default + + + + + Comment + Komentář + + + + Comment line + Jednořádkový komentář + + + + Number + Číslo + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + String + + + + + Unclosed string + Neuzavřený string + + + + Directive + Direktiva + + + + Bad directive + + + + + Objects, CSG and appearance + + + + + Types, modifiers and items + + + + + Predefined identifiers + + + + + Predefined functions + + + + + User defined 1 + + + + + User defined 2 + + + + + User defined 3 + + + + + QsciLexerPascal + + + Default + Default + + + + Line comment + Jednořádkový komentář + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + '{ ... }' style comment + + + + + '(* ... *)' style comment + + + + + '{$ ... }' style pre-processor block + + + + + '(*$ ... *)' style pre-processor block + + + + + Hexadecimal number + + + + + Unclosed string + Neuzavřený string + + + + Character + Znak + + + + Inline asm + + + + + QsciLexerPerl + + + Default + + + + + Error + Chyba + + + + Comment + Komentář + + + + POD + + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Scalar + Skalár + + + + Array + Pole + + + + Hash + + + + + Symbol table + + + + + Regular expression + Regulární výraz + + + + Substitution + + + + + Backticks + + + + + Data section + + + + + Here document delimiter + Zde je oddělovač dokumentu + + + + Single-quoted here document + Zde je dokument v jednoduchých uvozovkách + + + + Double-quoted here document + Zde je dokument ve dvojitých uvozovkách + + + + Backtick here document + + + + + Quoted string (q) + + + + + Quoted string (qq) + + + + + Quoted string (qx) + + + + + Quoted string (qr) + + + + + Quoted string (qw) + + + + + POD verbatim + + + + + Subroutine prototype + + + + + Format identifier + + + + + Format body + + + + + Double-quoted string (interpolated variable) + + + + + Translation + + + + + Regular expression (interpolated variable) + + + + + Substitution (interpolated variable) + + + + + Backticks (interpolated variable) + + + + + Double-quoted here document (interpolated variable) + + + + + Backtick here document (interpolated variable) + + + + + Quoted string (qq, interpolated variable) + + + + + Quoted string (qx, interpolated variable) + + + + + Quoted string (qr, interpolated variable) + + + + + QsciLexerPostScript + + + Default + Default + + + + Comment + Komentář + + + + DSC comment + + + + + DSC comment value + + + + + Number + Číslo + + + + Name + + + + + Keyword + Klíčové slovo + + + + Literal + + + + + Immediately evaluated literal + + + + + Array parenthesis + + + + + Dictionary parenthesis + + + + + Procedure parenthesis + + + + + Text + + + + + Hexadecimal string + + + + + Base85 string + + + + + Bad string character + + + + + QsciLexerProperties + + + Default + + + + + Comment + + + + + Section + + + + + Assignment + + + + + Default value + + + + + Key + + + + + QsciLexerPython + + + Default + + + + + Comment + Komentář + + + + Number + Číslo + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Keyword + Klíčové slovo + + + + Triple single-quoted string + String ve třech jednoduchých uvozovkách + + + + Triple double-quoted string + String ve třech dvojitých uvozovkách + + + + Class name + Jméno třídy + + + + Function or method name + Jméno funkce nebo metody + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Comment block + Blok komentáře + + + + Unclosed string + Neuzavřený string + + + + Highlighted identifier + Zvýrazněný identifikátor + + + + Decorator + Dekorátor + + + + QsciLexerRuby + + + Default + + + + + Comment + Komentář + + + + Number + Číslo + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Keyword + Klíčové slovo + + + + Class name + Jméno třídy + + + + Function or method name + Jméno funkce nebo metody + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Error + Chyba + + + + POD + POD + + + + Regular expression + Regulární výraz + + + + Global + + + + + Symbol + + + + + Module name + Jméno modulu + + + + Instance variable + Proměnná instance + + + + Class variable + Proměnná třídy + + + + Backticks + + + + + Data section + Datová sekce + + + + Here document delimiter + Zde je oddělovač dokumentu + + + + Here document + Zde je dokument + + + + %q string + + + + + %Q string + + + + + %x string + + + + + %r string + + + + + %w string + + + + + Demoted keyword + + + + + stdin + + + + + stdout + + + + + stderr + + + + + QsciLexerSQL + + + Default + + + + + Comment + Komentář + + + + Number + Číslo + + + + Keyword + Klíčové slovo + + + + Single-quoted string + String v jednoduchých uvozovkách + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Comment line + Jednořádkový komentář + + + + JavaDoc style comment + JavaDoc styl komentář + + + + Double-quoted string + String ve dvojitých uvozovkách + + + + SQL*Plus keyword + SQL*Plus klíčové slovo + + + + SQL*Plus prompt + + + + + SQL*Plus comment + SQL*Plus komentář + + + + # comment line + # jednořádkový komentář + + + + JavaDoc keyword + JavaDoc klíčové slovo + + + + JavaDoc keyword error + JavaDoc klíčové slovo chyby + + + + User defined 1 + Definováno uživatelem 1 + + + + User defined 2 + Definováno uživatelem 2 + + + + User defined 3 + Definováno uživatelem 3 + + + + User defined 4 + Definováno uživatelem 4 + + + + Quoted identifier + + + + + Quoted operator + + + + + QsciLexerSpice + + + Default + Default + + + + Identifier + Identifikátor + + + + Command + Příkaz + + + + Function + + + + + Parameter + + + + + Number + Číslo + + + + Delimiter + + + + + Value + Hodnota + + + + Comment + Komentář + + + + QsciLexerTCL + + + Default + Default + + + + Comment + Komentář + + + + Comment line + Jednořádkový komentář + + + + Number + Číslo + + + + Quoted keyword + + + + + Quoted string + + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Substitution + + + + + Brace substitution + + + + + Modifier + + + + + Expand keyword + + + + + TCL keyword + + + + + Tk keyword + + + + + iTCL keyword + + + + + Tk command + + + + + User defined 1 + Definováno uživatelem 1 + + + + User defined 2 + Definováno uživatelem 2 + + + + User defined 3 + Definováno uživatelem 3 + + + + User defined 4 + Definováno uživatelem 4 + + + + Comment box + + + + + Comment block + Blok komentáře + + + + QsciLexerTeX + + + Default + + + + + Special + + + + + Group + Skupina + + + + Symbol + + + + + Command + Příkaz + + + + Text + + + + + QsciLexerVHDL + + + Default + Default + + + + Comment + Komentář + + + + Comment line + Jednořádkový komentář + + + + Number + Číslo + + + + String + + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Unclosed string + Neuzavřený string + + + + Keyword + Klíčové slovo + + + + Standard operator + + + + + Attribute + Atribut + + + + Standard function + + + + + Standard package + + + + + Standard type + + + + + User defined + + + + + Comment block + Blok komentáře + + + + QsciLexerVerilog + + + Default + Default + + + + Comment + Komentář + + + + Line comment + Jednořádkový komentář + + + + Bang comment + + + + + Number + Číslo + + + + Primary keywords and identifiers + + + + + String + + + + + Secondary keywords and identifiers + Sekundární klíčová slova a identifikátory + + + + System task + + + + + Preprocessor block + + + + + Operator + Operátor + + + + Identifier + Identifikátor + + + + Unclosed string + Neuzavřený string + + + + User defined tasks and identifiers + + + + + Keyword comment + + + + + Inactive keyword comment + + + + + Input port declaration + + + + + Inactive input port declaration + + + + + Output port declaration + + + + + Inactive output port declaration + + + + + Input/output port declaration + + + + + Inactive input/output port declaration + + + + + Port connection + + + + + Inactive port connection + + + + + QsciLexerYAML + + + Default + Default + + + + Comment + Komentář + + + + Identifier + Identifikátor + + + + Keyword + Klíčové slovo + + + + Number + Číslo + + + + Reference + + + + + Document delimiter + + + + + Text block marker + + + + + Syntax error marker + + + + + Operator + Operátor + + + + QsciScintilla + + + &Undo + + + + + &Redo + + + + + Cu&t + + + + + &Copy + + + + + &Paste + + + + + Delete + + + + + Select All + + + + diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_de.qm b/libs/qscintilla/Qt4Qt5/qscintilla_de.qm new file mode 100644 index 000000000..78cfcf1bf Binary files /dev/null and b/libs/qscintilla/Qt4Qt5/qscintilla_de.qm differ diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_de.ts b/libs/qscintilla/Qt4Qt5/qscintilla_de.ts new file mode 100644 index 000000000..752e39422 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscintilla_de.ts @@ -0,0 +1,3702 @@ + + + + + QsciCommand + + + Move left one character + Ein Zeichen nach links + + + + Move right one character + Ein Zeichen nach rechts + + + + Move up one line + Eine Zeile nach oben + + + + Move down one line + Eine Zeile nach unten + + + + Move left one word part + Ein Wortteil nach links + + + + Move right one word part + Ein Wortteil nach rechts + + + + Move left one word + Ein Wort nach links + + + + Move right one word + Ein Wort nach rechts + + + + Scroll view down one line + Eine Zeile nach unten rollen + + + + Scroll view up one line + Eine Zeile nach oben rollen + + + + Move up one page + Eine Seite hoch + + + + Move down one page + Eine Seite nach unten + + + + Indent one level + Eine Ebene einrücken + + + + Extend selection left one character + Auswahl um ein Zeichen nach links erweitern + + + + Extend selection right one character + Auswahl um ein Zeichen nach rechts erweitern + + + + Extend selection up one line + Auswahl um eine Zeile nach oben erweitern + + + + Extend selection down one line + Auswahl um eine Zeile nach unten erweitern + + + + Extend selection left one word part + Auswahl um einen Wortteil nach links erweitern + + + + Extend selection right one word part + Auswahl um einen Wortteil nach rechts erweitern + + + + Extend selection left one word + Auswahl um ein Wort nach links erweitern + + + + Extend selection right one word + Auswahl um ein Wort nach rechts erweitern + + + + Extend selection up one page + Auswahl um eine Seite nach oben erweitern + + + + Extend selection down one page + Auswahl um eine Seite nach unten erweitern + + + + Delete previous character + Zeichen links löschen + + + + Delete current character + Aktuelles Zeichen löschen + + + + Delete word to left + Wort links löschen + + + + Delete word to right + Wort rechts löschen + + + + Delete line to left + Zeile links löschen + + + + Delete line to right + Zeile rechts löschen + + + + Delete current line + Aktuelle Zeile löschen + + + + Cut current line + Aktuelle Zeile ausschneiden + + + + Cut selection + Auswahl ausschneiden + + + + Copy selection + Auswahl kopieren + + + + Paste + Einfügen + + + + Redo last command + Letzten Befehl wiederholen + + + + Cancel + Abbrechen + + + + Toggle insert/overtype + Einfügen/Überschreiben umschalten + + + + Scroll to start of document + Zum Dokumentenanfang rollen + + + + Scroll to end of document + Zum Dokumentenende rollen + + + + Scroll vertically to centre current line + Vertical rollen, um aktuelle Zeile zu zentrieren + + + + Move to end of previous word + Zum Ende des vorigen Wortes springen + + + + Extend selection to end of previous word + Auswahl bis zum Ende des vorigen Wortes erweitern + + + + Move to end of next word + Zum Ende des nächsten Wortes springen + + + + Extend selection to end of next word + Auswahl bis zum Ende des nächsten Wortes erweitern + + + + Move to start of document line + Zum Beginn der Dokumentenzeile springen + + + + Extend selection to start of document line + Auswahl zum Beginn der Dokumentenzeile erweitern + + + + Extend rectangular selection to start of document line + Rechteckige Auswahl zum Beginn der Dokumentenzeile erweitern + + + + Move to start of display line + Zum Beginn der Anzeigezeile springen + + + + Extend selection to start of display line + Auswahl zum Beginn der Anzeigezeile erweitern + + + + Move to start of display or document line + Zum Beginn der Dokumenten- oder Anzeigezeile springen + + + + Extend selection to start of display or document line + Rechteckige Auswahl zum Beginn der Dokumenten- oder Anzeigezeile erweitern + + + + Move to first visible character in document line + Zum ersten sichtbaren Zeichen der Dokumentzeile springen + + + + Extend selection to first visible character in document line + Auswahl zum ersten sichtbaren Zeichen der Dokumentzeile erweitern + + + + Extend rectangular selection to first visible character in document line + Rechteckige Auswahl zum ersten sichtbaren Zeichen der Dokumentzeile erweitern + + + + Move to first visible character of display in document line + Zum ersten angezeigten Zeichen der Dokumentzeile springen + + + + Extend selection to first visible character in display or document line + Auswahl zum ersten sichtbaren Zeichen der Dokument- oder Anzeigezeile erweitern + + + + Move to end of document line + Zum Ende der Dokumentzeile springen + + + + Extend selection to end of document line + Auswahl zum Ende der Dokumentenzeile erweitern + + + + Extend rectangular selection to end of document line + Rechteckige Auswahl zum Ende der Dokumentenzeile erweitern + + + + Move to end of display line + Zum Ende der Anzeigezeile springen + + + + Extend selection to end of display line + Auswahl zum Ende der Anzeigezeile erweitern + + + + Move to end of display or document line + Zum Ende der Dokumenten- oder Anzeigezeile springen + + + + Extend selection to end of display or document line + Rechteckige Auswahl zum Ende der Dokumenten- oder Anzeigezeile erweitern + + + + Move to start of document + Zum Dokumentenanfang springen + + + + Extend selection to start of document + Auswahl zum Dokumentenanfang erweitern + + + + Move to end of document + Zum Dokumentenende springen + + + + Extend selection to end of document + Auswahl zum Dokumentenende erweitern + + + + Stuttered move up one page + "Stotternd" um eine Seite nach oben + + + + Stuttered extend selection up one page + Auswahl "stotternd" um eine Seite nach oben erweitern + + + + Stuttered move down one page + "Stotternd" um eine Seite nach unten + + + + Stuttered extend selection down one page + Auswahl "stotternd" um eine Seite nach unten erweitern + + + + Delete previous character if not at start of line + Zeichen links löschen, wenn nicht am Zeilenanfang + + + + Delete right to end of next word + Rechts bis zum Ende des nächsten Wortes löschen + + + + Transpose current and previous lines + Aktuelle und vorherige Zeile tauschen + + + + Duplicate the current line + Aktuelle Zeile duplizieren + + + + Select all + Select document + Alle auswählen + + + + Move selected lines up one line + Ausgewählte Zeilen um eine Zeile nach oben + + + + Move selected lines down one line + Ausgewählte Zeilen um eine Zeile nach unten + + + + Convert selection to lower case + Auswahl in Kleinbuchstaben umwandeln + + + + Convert selection to upper case + Auswahl in Großbuchstaben umwandeln + + + + Insert newline + Neue Zeile einfügen + + + + De-indent one level + Eine Ebene ausrücken + + + + Undo last command + Letzten Befehl rückgängig machen + + + + Zoom in + Vergrößern + + + + Zoom out + Verkleinern + + + + Move up one paragraph + Einen Absatz nach oben + + + + Move down one paragraph + Einen Absatz nach unten + + + + Extend selection up one paragraph + Auswahl um einen Absatz nach oben erweitern + + + + Extend selection down one paragraph + Auswahl um einen Absatz nach unten erweitern + + + + Copy current line + Aktuelle Zeile kopieren + + + + Extend rectangular selection down one line + Rechteckige Auswahl um eine Zeile nach unten erweitern + + + + Extend rectangular selection up one line + Rechteckige Auswahl um eine Zeile nach oben erweitern + + + + Extend rectangular selection left one character + Rechteckige Auswahl um ein Zeichen nach links erweitern + + + + Extend rectangular selection right one character + Rechteckige Auswahl um ein Zeichen nach rechts erweitern + + + + Extend rectangular selection up one page + Rechteckige Auswahl um eine Seite nach oben erweitern + + + + Extend rectangular selection down one page + Rechteckige Auswahl um eine Seite nach unten erweitern + + + + Formfeed + Seitenumbruch + + + + Duplicate selection + Auswahl duplizieren + + + + QsciLexerAVS + + + Default + Standard + + + + Block comment + Blockkommentar + + + + Nested block comment + Verschachtelter Blockkommentar + + + + Line comment + Zeilenkommentar + + + + Number + Zahl + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Triple double-quoted string + Zeichenkette in dreifachen Anführungszeichen + + + + Keyword + Schlüsselwort + + + + Filter + Filter + + + + Plugin + Plugin + + + + Function + Funktion + + + + Clip property + Clip Eigenschaft + + + + User defined + Nutzer definiert + + + + QsciLexerBash + + + Default + Standard + + + + Error + Fehler + + + + Comment + Kommentar + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Scalar + Skalar + + + + Parameter expansion + Parametererweiterung + + + + Backticks + Backticks + + + + Here document delimiter + Here Dokument-Begrenzer + + + + Single-quoted here document + Here Dokument in Hochkommata + + + + QsciLexerBatch + + + Default + Standard + + + + Comment + Kommentar + + + + Keyword + Schlüsselwort + + + + Label + Marke + + + + Variable + Variable + + + + Operator + Operator + + + + Hide command character + "Befehl verbergen" Zeichen + + + + External command + Externer Befehl + + + + QsciLexerCMake + + + Default + Standard + + + + Comment + Kommentar + + + + String + Zeichenkette + + + + Left quoted string + Links quotierte Zeichenkette + + + + Right quoted string + Rechts quotierte Zeichenkette + + + + Function + Funktion + + + + Variable + Variable + + + + Label + Marke + + + + User defined + Nutzer definiert + + + + WHILE block + WHILE Block + + + + FOREACH block + FOREACH Block + + + + IF block + IF Block + + + + MACRO block + MACRO Block + + + + Variable within a string + Variable in einer Zeichenkette + + + + Number + Zahl + + + + QsciLexerCPP + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + IDL UUID + IDL UUID + + + + Pre-processor block + Präprozessorblock + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Unclosed string + Unbeendete Zeichenkette + + + + Default + Standard + + + + Inactive default + Inaktiver Standard + + + + C comment + C Kommentar + + + + Inactive C comment + Inaktiver C Kommentar + + + + C++ comment + C++ Kommentar + + + + Inactive C++ comment + Inaktiver C++ Kommentar + + + + JavaDoc style C comment + JavaDoc C Kommentar + + + + Inactive JavaDoc style C comment + Inaktiver JavaDoc C Kommentar + + + + Inactive number + Inaktive Zahl + + + + Inactive keyword + Inaktives Schlüsselwort + + + + Inactive double-quoted string + Inaktive Zeichenkette in Anführungszeichen + + + + Inactive single-quoted string + Inaktive Zeichenkette in Hochkommata + + + + Inactive IDL UUID + Inaktive IDL UUID + + + + Inactive pre-processor block + Inaktiver Präprozessorblock + + + + Inactive operator + Inaktiver Operator + + + + Inactive identifier + Inaktiver Bezeichner + + + + Inactive unclosed string + Inaktive unbeendete Zeichenkette + + + + C# verbatim string + Uninterpretierte C# Zeichenkette + + + + Inactive C# verbatim string + Inaktive, Uninterpretierte C# Zeichenkette + + + + JavaScript regular expression + JavaScript Regulärer Ausdruck + + + + Inactive JavaScript regular expression + JavaScript Inaktiver Regulärer Ausdruck + + + + JavaDoc style C++ comment + JavaDoc C++ Kommentar + + + + Inactive JavaDoc style C++ comment + Inaktiver JavaDoc C++ Kommentar + + + + Inactive secondary keywords and identifiers + Inaktive sekundäre Schlusselwörter und Bezeichner + + + + JavaDoc keyword + JavaDoc Schlüsselwort + + + + Inactive JavaDoc keyword + Inaktives JavaDoc Schlüsselwort + + + + JavaDoc keyword error + JavaDoc Schlüsselwortfehler + + + + Inactive global classes and typedefs + Inaktive globale Klassen und Typdefinitionen + + + + C++ raw string + Rohe C++ Zeichenkette + + + + Inactive C++ raw string + Inaktive rohe C++ Zeichenkette + + + + Vala triple-quoted verbatim string + Vala Zeichenkette in dreifachen Hochkommata + + + + Inactive Vala triple-quoted verbatim string + Inaktive Vala Zeichenkette in dreifachen Hochkommata + + + + Pike hash-quoted string + Pike Zeichenkette in '#-Anführungszeichen' + + + + Inactive Pike hash-quoted string + Inaktive Pike Zeichenkette in '#-Anführungszeichen' + + + + Pre-processor C comment + C Präprozessorkommentar + + + + Inactive pre-processor C comment + Inaktiver C Präprozessorkommentar + + + + JavaDoc style pre-processor comment + JavaDoc Präprozessorkommentar + + + + Inactive JavaDoc style pre-processor comment + Inaktiver JavaDoc Präprozessorkommentar + + + + User-defined literal + Nutzer definiertes Literal + + + + Inactive user-defined literal + Inaktives Nutzer definiertes Literal + + + + Task marker + Aufgabenmarkierung + + + + Inactive task marker + Inaktive Aufgabenmarkierung + + + + Escape sequence + Escape-Sequenz + + + + Inactive escape sequence + Inaktive Escape-Sequenz + + + + Secondary keywords and identifiers + Sekundäre Schlusselwörter und Bezeichner + + + + Inactive JavaDoc keyword error + Inaktiver JavaDoc Schlüsselwortfehler + + + + Global classes and typedefs + Globale Klassen und Typdefinitionen + + + + QsciLexerCSS + + + Default + Standard + + + + Tag + Tag + + + + Class selector + Klassenselektor + + + + Pseudo-class + Pseudoklasse + + + + Unknown pseudo-class + Unbekannte Pseudoklasse + + + + Operator + Operator + + + + CSS1 property + CSS1 Eigenschaft + + + + Unknown property + Unbekannte Eigenschaft + + + + Value + Wert + + + + ID selector + ID-Selektor + + + + Important + Wichtig + + + + @-rule + @-Regel + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + CSS2 property + CSS2 Eigenschaft + + + + Attribute + Attribut + + + + CSS3 property + CSS3 Eigenschaft + + + + Pseudo-element + Pseudoelement + + + + Extended CSS property + Erweiterte CSS Eigenschaft + + + + Extended pseudo-class + Erweiterte Pseudoklasse + + + + Extended pseudo-element + Erweitertes Pseudoelement + + + + Media rule + Medienregel + + + + Variable + Variable + + + + QsciLexerCSharp + + + Verbatim string + Uninterpretierte Zeichenkette + + + + QsciLexerCoffeeScript + + + Default + Standard + + + + C-style comment + C Kommentar + + + + C++-style comment + C++ Kommentar + + + + JavaDoc C-style comment + JavaDoc C Kommentar + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + IDL UUID + IDL UUID + + + + Pre-processor block + Präprozessorblock + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Unclosed string + Unbeendete Zeichenkette + + + + C# verbatim string + Uninterpretierte C# Zeichenkette + + + + Regular expression + Regulärer Ausdruck + + + + JavaDoc C++-style comment + JavaDoc C++ Kommentar + + + + Secondary keywords and identifiers + Sekundäre Schlusselwörter und Bezeichner + + + + JavaDoc keyword + JavaDoc Schlüsselwort + + + + JavaDoc keyword error + JavaDoc Schlüsselwortfehler + + + + Global classes + Globale Klassen + + + + Block comment + Blockkommentar + + + + Block regular expression + Regulärer Ausdrucksblock + + + + Block regular expression comment + Regulärer Ausdrucksblockkommentar + + + + QsciLexerD + + + Default + Standard + + + + Block comment + Blockkommentar + + + + Line comment + Zeilenkommentar + + + + DDoc style block comment + DDoc Blockkommentar + + + + Nesting comment + schachtelbarer Kommentar + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Secondary keyword + Sekundäres Schlüsselwort + + + + Documentation keyword + Dokumentationsschlüsselwort + + + + Type definition + Typdefinition + + + + String + Zeichenkette + + + + Unclosed string + Unbeendete Zeichenkette + + + + Character + Zeichen + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + DDoc style line comment + DDoc Zeilenkommentar + + + + DDoc keyword + DDoc Schlüsselwort + + + + DDoc keyword error + DDoc Schlüsselwortfehler + + + + Backquoted string + Zeichenkette in Rückwärtsstrichen + + + + Raw string + Rohe Zeichenkette + + + + User defined 1 + Nutzer definiert 1 + + + + User defined 2 + Nutzer definiert 2 + + + + User defined 3 + Nutzer definiert 3 + + + + QsciLexerDiff + + + Default + Standard + + + + Comment + Kommentar + + + + Command + Befehl + + + + Header + Kopfzeilen + + + + Position + Position + + + + Removed line + Entfernte Zeile + + + + Added line + Hinzugefügte Zeile + + + + Changed line + Geänderte Zeile + + + + QsciLexerFortran77 + + + Default + Standard + + + + Comment + Kommentar + + + + Number + Zahl + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Unclosed string + Unbeendete Zeichenkette + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Keyword + Schlüsselwort + + + + Intrinsic function + Intrinsic-Funktion + + + + Extended function + Erweiterte Funktion + + + + Pre-processor block + Präprozessorblock + + + + Dotted operator + Dotted Operator + + + + Label + Marke + + + + Continuation + Fortsetzung + + + + QsciLexerHTML + + + HTML default + HTML Standard + + + + Tag + Tag + + + + Unknown tag + Unbekanntes Tag + + + + Attribute + Attribut + + + + Unknown attribute + Unbekanntes Attribut + + + + HTML number + HTML Zahl + + + + HTML double-quoted string + HTML Zeichenkette in Anführungszeichen + + + + HTML single-quoted string + HTML Zeichenkette in Hochkommata + + + + Other text in a tag + Anderer Text in einem Tag + + + + HTML comment + HTML Kommentar + + + + Entity + Entität + + + + End of a tag + Tagende + + + + Start of an XML fragment + Beginn eines XML Fragmentes + + + + End of an XML fragment + Ende eines XML Fragmentes + + + + Script tag + Skript Tag + + + + Start of an ASP fragment with @ + Beginn eines ASP Fragmentes mit @ + + + + Start of an ASP fragment + Beginn eines ASP Fragmentes + + + + CDATA + CDATA + + + + Start of a PHP fragment + Beginn eines PHP Fragmentes + + + + Unquoted HTML value + HTML Wert ohne Anführungszeichen + + + + ASP X-Code comment + ASP X-Code Kommentar + + + + SGML default + SGML Standard + + + + SGML command + SGML Befehl + + + + First parameter of an SGML command + Erster Parameter eines SGML Befehls + + + + SGML double-quoted string + SGML Zeichenkette in Anführungszeichen + + + + SGML single-quoted string + SGML Zeichenkette in Hochkommata + + + + SGML error + SGML Fehler + + + + SGML special entity + SGML Spezielle Entität + + + + SGML comment + SGML Kommentar + + + + First parameter comment of an SGML command + Kommentar des ersten Parameters eines SGML Befehls + + + + SGML block default + SGML Standardblock + + + + Start of a JavaScript fragment + Beginn eines JavaScript Fragmentes + + + + JavaScript default + JavaScript Standard + + + + JavaScript comment + JavaScript Kommentar + + + + JavaScript line comment + JavaScript Zeilenkommentar + + + + JavaDoc style JavaScript comment + JavaDoc JavaScript Kommentar + + + + JavaScript number + JavaScript Zahl + + + + JavaScript word + JavaScript Wort + + + + JavaScript keyword + JavaScript Schlüsselwort + + + + JavaScript double-quoted string + JavaScript Zeichenkette in Anführungszeichen + + + + JavaScript single-quoted string + JavaScript Zeichenkette in Hochkommata + + + + JavaScript symbol + JavaScript Symbol + + + + JavaScript unclosed string + JavaScript Unbeendete Zeichenkette + + + + JavaScript regular expression + JavaScript Regulärer Ausdruck + + + + Start of an ASP JavaScript fragment + Beginn eines ASP JavaScript Fragmentes + + + + ASP JavaScript default + ASP JavaScript Standard + + + + ASP JavaScript comment + ASP JavaScript Kommentar + + + + ASP JavaScript line comment + ASP JavaScript Zeilenkommentar + + + + JavaDoc style ASP JavaScript comment + JavaDoc ASP JavaScript Kommentar + + + + ASP JavaScript number + ASP JavaScript Zahl + + + + ASP JavaScript word + ASP JavaScript Wort + + + + ASP JavaScript keyword + ASP JavaScript Schlüsselwort + + + + ASP JavaScript double-quoted string + ASP JavaScript Zeichenkette in Anführungszeichen + + + + ASP JavaScript single-quoted string + ASP JavaScript Zeichenkette in Hochkommata + + + + ASP JavaScript symbol + ASP JavaScript Symbol + + + + ASP JavaScript unclosed string + ASP JavaScript Unbeendete Zeichenkette + + + + ASP JavaScript regular expression + ASP JavaScript Regulärer Ausdruck + + + + Start of a VBScript fragment + Beginn eines VBScript Fragmentes + + + + VBScript default + VBScript Standard + + + + VBScript comment + VBScript Kommentar + + + + VBScript number + VBScript Zahl + + + + VBScript keyword + VBScript Schlüsselwort + + + + VBScript string + VBScript Zeichenkette + + + + VBScript identifier + VBScript Bezeichner + + + + VBScript unclosed string + VBScript Unbeendete Zeichenkette + + + + Start of an ASP VBScript fragment + Beginn eines ASP VBScript Fragmentes + + + + ASP VBScript default + ASP VBScript Standard + + + + ASP VBScript comment + ASP VBScript Kommentar + + + + ASP VBScript number + ASP VBScript Zahl + + + + ASP VBScript keyword + ASP VBScript Schlüsselwort + + + + ASP VBScript string + ASP VBScript Zeichenkette + + + + ASP VBScript identifier + ASP VBScript Bezeichner + + + + ASP VBScript unclosed string + ASP VBScript Unbeendete Zeichenkette + + + + Start of a Python fragment + Beginn eines Python Fragmentes + + + + Python default + Python Standard + + + + Python comment + Python Kommentar + + + + Python number + Python Zahl + + + + Python double-quoted string + Python Zeichenkette in Anführungszeichen + + + + Python single-quoted string + Python Zeichenkette in Hochkommata + + + + Python keyword + Python Schlüsselwort + + + + Python triple double-quoted string + Python Zeichenkette in dreifachen Anführungszeichen + + + + Python triple single-quoted string + Python Zeichenkette in dreifachen Hochkommata + + + + Python class name + Python Klassenname + + + + Python function or method name + Python Funktions- oder Methodenname + + + + Python operator + Python Operator + + + + Python identifier + Python Bezeichner + + + + Start of an ASP Python fragment + Beginn eines ASP Python Fragmentes + + + + ASP Python default + ASP Python Standard + + + + ASP Python comment + ASP Python Kommentar + + + + ASP Python number + ASP Python Zahl + + + + ASP Python double-quoted string + ASP Python Zeichenkette in Anführungszeichen + + + + ASP Python single-quoted string + ASP Python Zeichenkette in Hochkommata + + + + ASP Python keyword + ASP Python Schlüsselwort + + + + ASP Python triple double-quoted string + ASP Python Zeichenkette in dreifachen Anführungszeichen + + + + ASP Python triple single-quoted string + ASP Python Zeichenkette in dreifachen Hochkommata + + + + ASP Python class name + ASP Python Klassenname + + + + ASP Python function or method name + ASP Python Funktions- oder Methodenname + + + + ASP Python operator + ASP Python Operator + + + + ASP Python identifier + ASP Python Bezeichner + + + + PHP default + PHP Standard + + + + PHP double-quoted string + PHP Zeichenkette in Anführungszeichen + + + + PHP single-quoted string + PHP Zeichenkette in Hochkommata + + + + PHP keyword + PHP Schlüsselwort + + + + PHP number + PHP Zahl + + + + PHP comment + PHP Kommentar + + + + PHP line comment + PHP Zeilenkommentar + + + + PHP double-quoted variable + PHP Variable in Anführungszeichen + + + + PHP operator + PHP Operator + + + + PHP variable + PHP Variable + + + + QsciLexerIDL + + + UUID + UUID + + + + QsciLexerJavaScript + + + Regular expression + Regulärer Ausdruck + + + + QsciLexerLua + + + Default + Standard + + + + Comment + Kommentar + + + + Line comment + Zeilenkommentar + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + String + Zeichenkette + + + + Character + Zeichen + + + + Literal string + Uninterpretierte Zeichenkette + + + + Preprocessor + Präprozessor + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Unclosed string + Unbeendete Zeichenkette + + + + Basic functions + Basisfunktionen + + + + String, table and maths functions + Zeichenketten-, Tabelle- und mathematische Funktionen + + + + Coroutines, i/o and system facilities + Koroutinen, I/O- und Systemfunktionen + + + + User defined 1 + Nutzer definiert 1 + + + + User defined 2 + Nutzer definiert 2 + + + + User defined 3 + Nutzer definiert 3 + + + + User defined 4 + Nutzer definiert 4 + + + + Label + Marke + + + + QsciLexerMakefile + + + Default + Standard + + + + Comment + Kommentar + + + + Preprocessor + Präprozessor + + + + Variable + Variable + + + + Operator + Operator + + + + Target + Ziel + + + + Error + Fehler + + + + QsciLexerMatlab + + + Default + Standard + + + + Comment + Kommentar + + + + Command + Befehl + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + QsciLexerPO + + + Default + Standard + + + + Comment + Kommentar + + + + Message identifier + Meldungsbezeichner + + + + Message identifier text + Meldungsbezeichnertext + + + + Message string + Meldungszeichenkette + + + + Message string text + Meldungszeichenkettentext + + + + Message context + Meldungskontext + + + + Message context text + Meldungskontexttext + + + + Fuzzy flag + Unschrfmarkierung + + + + Programmer comment + Programmiererkommentar + + + + Reference + Referenz + + + + Flags + Markierung + + + + Message identifier text end-of-line + Meldungsbezeichnertext Zeilenende + + + + Message string text end-of-line + Meldungszeichenkettentext Zeilenende + + + + Message context text end-of-line + Meldungskontexttext Zeilenende + + + + QsciLexerPOV + + + Default + Standard + + + + Comment + Kommentar + + + + Comment line + Kommentarzeile + + + + Number + Zahl + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + String + Zeichenkette + + + + Unclosed string + Unbeendete Zeichenkette + + + + Directive + Direktive + + + + Bad directive + Ungültige Direktive + + + + Objects, CSG and appearance + Objekte, CSG und Erscheinung + + + + Types, modifiers and items + Typen, Modifizierer und Items + + + + Predefined identifiers + Vordefinierter Bezeichner + + + + Predefined functions + Vordefinierte Funktion + + + + User defined 1 + Nutzer definiert 1 + + + + User defined 2 + Nutzer definiert 2 + + + + User defined 3 + Nutzer definiert 3 + + + + QsciLexerPascal + + + Default + Standard + + + + Line comment + Zeilenkommentar + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + '{ ... }' style comment + '{ ... }' Kommentar + + + + '(* ... *)' style comment + '(* ... *)' Kommentar + + + + '{$ ... }' style pre-processor block + '{$ ... }' Präprozessorblock + + + + '(*$ ... *)' style pre-processor block + '(*$ ... *)' Präprozessorblock + + + + Hexadecimal number + Hexadezimale Zahl + + + + Unclosed string + Unbeendete Zeichenkette + + + + Character + Zeichen + + + + Inline asm + Inline Assembler + + + + QsciLexerPerl + + + Default + Standard + + + + Error + Fehler + + + + Comment + Kommentar + + + + POD + POD + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Scalar + Skalar + + + + Array + Feld + + + + Hash + Hash + + + + Symbol table + Symboltabelle + + + + Regular expression + Regulärer Ausdruck + + + + Substitution + Ersetzung + + + + Backticks + Backticks + + + + Data section + Datensektion + + + + Here document delimiter + Here Dokument-Begrenzer + + + + Single-quoted here document + Here Dokument in Hochkommata + + + + Double-quoted here document + Here Dokument in Anführungszeichen + + + + Backtick here document + Here Dokument in Backticks + + + + Quoted string (q) + Zeichenkette (q) + + + + Quoted string (qq) + Zeichenkette (qq) + + + + Quoted string (qx) + Zeichenkette (qx) + + + + Quoted string (qr) + Zeichenkette (qr) + + + + Quoted string (qw) + Zeichenkette (qw) + + + + POD verbatim + POD wörtlich + + + + Subroutine prototype + Subroutinen Prototyp + + + + Format identifier + Formatidentifikator + + + + Format body + Formatzweig + + + + Double-quoted string (interpolated variable) + Zeichenkette in Anführungszeichen (interpolierte Variable) + + + + Translation + Übersetzung + + + + Regular expression (interpolated variable) + Regulärer Ausdruck (interpolierte Variable) + + + + Substitution (interpolated variable) + Ersetzung (interpolierte Variable) + + + + Backticks (interpolated variable) + Backticks (interpolierte Variable) + + + + Double-quoted here document (interpolated variable) + Here Dokument in Anführungszeichen (interpolierte Variable) + + + + Backtick here document (interpolated variable) + Here Dokument in Backticks (interpolierte Variable) + + + + Quoted string (qq, interpolated variable) + Zeichenkette (qq, interpolierte Variable) + + + + Quoted string (qx, interpolated variable) + Zeichenkette (qx, interpolierte Variable) + + + + Quoted string (qr, interpolated variable) + Zeichenkette (qr, interpolierte Variable) + + + + QsciLexerPostScript + + + Default + Standard + + + + Comment + Kommentar + + + + DSC comment + DSC Kommentar + + + + DSC comment value + DSC Kommentarwert + + + + Number + Zahl + + + + Name + Name + + + + Keyword + Schlüsselwort + + + + Literal + Literal + + + + Immediately evaluated literal + Direkt ausgeführtes Literal + + + + Array parenthesis + Feldklammern + + + + Dictionary parenthesis + Dictionary-Klammern + + + + Procedure parenthesis + Prozedurklammern + + + + Text + Text + + + + Hexadecimal string + Hexadezimale Zeichenkette + + + + Base85 string + Base85 Zeichenkette + + + + Bad string character + Ungültiges Zeichen für Zeichenkette + + + + QsciLexerProperties + + + Default + Standard + + + + Comment + Kommentar + + + + Section + Abschnitt + + + + Assignment + Zuweisung + + + + Default value + Standardwert + + + + Key + Schlüssel + + + + QsciLexerPython + + + Comment + Kommentar + + + + Number + Zahl + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Keyword + Schlüsselwort + + + + Triple single-quoted string + Zeichenkette in dreifachen Hochkommata + + + + Triple double-quoted string + Zeichenkette in dreifachen Anführungszeichen + + + + Class name + Klassenname + + + + Function or method name + Funktions- oder Methodenname + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Comment block + Kommentarblock + + + + Unclosed string + Unbeendete Zeichenkette + + + + Default + Standard + + + + Highlighted identifier + Hervorgehobener Bezeichner + + + + Decorator + Dekorator + + + + QsciLexerRuby + + + Default + Standard + + + + Comment + Kommentar + + + + Number + Zahl + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Keyword + Schlüsselwort + + + + Class name + Klassenname + + + + Function or method name + Funktions- oder Methodenname + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Error + Fehler + + + + POD + POD + + + + Regular expression + Regulärer Ausdruck + + + + Global + Global + + + + Symbol + Symbol + + + + Module name + Modulname + + + + Instance variable + Instanzvariable + + + + Class variable + Klassenvariable + + + + Backticks + Backticks + + + + Data section + Datensektion + + + + Here document delimiter + Here Dokument-Begrenzer + + + + Here document + Here Dokument + + + + %q string + %q Zeichenkette + + + + %Q string + %Q Zeichenkette + + + + %x string + %x Zeichenkette + + + + %r string + %r Zeichenkette + + + + %w string + %w Zeichenkette + + + + Demoted keyword + zurückgestuftes Schlüsselwort + + + + stdin + Stdin + + + + stdout + Stdout + + + + stderr + Stderr + + + + QsciLexerSQL + + + Default + Standard + + + + Comment + Kommentar + + + + Number + Zahl + + + + Keyword + Schlüsselwort + + + + Single-quoted string + Zeichenkette in Hochkommata + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Comment line + Kommentarzeile + + + + JavaDoc style comment + JavaDoc Kommentar + + + + Double-quoted string + Zeichenkette in Anführungszeichen + + + + SQL*Plus keyword + SQL*Plus Schlüsselwort + + + + SQL*Plus prompt + SQL*Plus Eingabe + + + + SQL*Plus comment + SQL*Plus Kommentar + + + + # comment line + # Kommentarzeile + + + + JavaDoc keyword + JavaDoc Schlüsselwort + + + + JavaDoc keyword error + JavaDoc Schlüsselwortfehler + + + + User defined 1 + Nutzer definiert 1 + + + + User defined 2 + Nutzer definiert 2 + + + + User defined 3 + Nutzer definiert 3 + + + + User defined 4 + Nutzer definiert 4 + + + + Quoted identifier + Bezeichner in Anführungszeichen + + + + Quoted operator + Operator in Anführungszeichen + + + + QsciLexerSpice + + + Default + Standard + + + + Identifier + Bezeichner + + + + Command + Befehl + + + + Function + Funktion + + + + Parameter + Parameter + + + + Number + Zahl + + + + Delimiter + Delimiter + + + + Value + Wert + + + + Comment + Kommentar + + + + QsciLexerTCL + + + Default + Standard + + + + Comment + Kommentar + + + + Comment line + Kommentarzeile + + + + Number + Zahl + + + + Quoted keyword + angeführtes Schlüsselwort + + + + Quoted string + Zeichenkette + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Substitution + Ersetzung + + + + Brace substitution + Klammerersetzung + + + + Modifier + Modifizierer + + + + Expand keyword + Erweiterungsschlüsselwort + + + + TCL keyword + TCL Schlüsselwort + + + + Tk keyword + Tk Schlüsselwort + + + + iTCL keyword + iTCL Schlüsselwort + + + + Tk command + Tk Befehl + + + + User defined 1 + Nutzer definiert 1 + + + + User defined 2 + Nutzer definiert 2 + + + + User defined 3 + Nutzer definiert 3 + + + + User defined 4 + Nutzer definiert 4 + + + + Comment box + Kommentarbox + + + + Comment block + Kommentarblock + + + + QsciLexerTeX + + + Default + Standard + + + + Special + Spezial + + + + Group + Gruppe + + + + Symbol + Symbol + + + + Command + Befehl + + + + Text + Text + + + + QsciLexerVHDL + + + Default + Standard + + + + Comment + Kommentar + + + + Comment line + Kommentarzeile + + + + Number + Zahl + + + + String + Zeichenkette + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Unclosed string + Unbeendete Zeichenkette + + + + Keyword + Schlüsselwort + + + + Standard operator + Standardoperator + + + + Attribute + Attribut + + + + Standard function + Standardfunktion + + + + Standard package + Standardpaket + + + + Standard type + Standardtyp + + + + User defined + Nutzer definiert + + + + Comment block + Kommentarblock + + + + QsciLexerVerilog + + + Default + Standard + + + + Comment + Kommentar + + + + Line comment + Zeilenkommentar + + + + Bang comment + Bang Kommentar + + + + Number + Zahl + + + + Primary keywords and identifiers + Primäre Schlusselwörter und Bezeichner + + + + String + Zeichenkette + + + + Secondary keywords and identifiers + Sekundäre Schlusselwörter und Bezeichner + + + + System task + Systemtask + + + + Preprocessor block + Präprozessorblock + + + + Operator + Operator + + + + Identifier + Bezeichner + + + + Unclosed string + Unbeendete Zeichenkette + + + + User defined tasks and identifiers + Nutzerdefinierte Tasks und Bezeichner + + + + Keyword comment + Schlüsselwortkommentar + + + + Inactive keyword comment + Inaktiver Schlüsselwortkommentar + + + + Input port declaration + Eingabeportdefinition + + + + Inactive input port declaration + Inaktive Eingabeportdefinition + + + + Output port declaration + Ausgabeportdefinition + + + + Inactive output port declaration + Inaktive Ausgabeportdefinition + + + + Input/output port declaration + Ein-/Ausgabeportdefinition + + + + Inactive input/output port declaration + Inaktive Ein-/Ausgabeportdefinition + + + + Port connection + Portverbindung + + + + Inactive port connection + Inaktive Portverbindung + + + + QsciLexerYAML + + + Default + Standard + + + + Comment + Kommentar + + + + Identifier + Bezeichner + + + + Keyword + Schlüsselwort + + + + Number + Zahl + + + + Reference + Referenz + + + + Document delimiter + Dokumentbegrenzer + + + + Text block marker + Textblock Markierung + + + + Syntax error marker + Syntaxfehler Markierung + + + + Operator + Operator + + + + QsciScintilla + + + &Undo + &Rückgängig + + + + &Redo + Wieder&herstellen + + + + Cu&t + &Ausschneiden + + + + &Copy + &Kopieren + + + + &Paste + Ein&fügen + + + + Delete + Löschen + + + + Select All + Alle auswählen + + + diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_es.qm b/libs/qscintilla/Qt4Qt5/qscintilla_es.qm new file mode 100644 index 000000000..cfa20f6e8 Binary files /dev/null and b/libs/qscintilla/Qt4Qt5/qscintilla_es.qm differ diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_es.ts b/libs/qscintilla/Qt4Qt5/qscintilla_es.ts new file mode 100644 index 000000000..6c282beff --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscintilla_es.ts @@ -0,0 +1,3702 @@ + + + + + QsciCommand + + + Move down one line + Desplazar una línea hacia abajo + + + + Extend selection down one line + Extender la selección una línea hacia abajo + + + + Scroll view down one line + Desplazar la vista una línea hacia abajo + + + + Extend rectangular selection down one line + Extender la selección rectangular una línea hacia abajo + + + + Move up one line + Desplazar una línea hacia arriba + + + + Extend selection up one line + Extender la selección una línea hacia arriba + + + + Scroll view up one line + Desplazar la vista una línea hacia arriba + + + + Extend rectangular selection up one line + Extender la selección rectangular una línea hacia arriba + + + + Move up one paragraph + Desplazar un párrafo hacia arriba + + + + Extend selection up one paragraph + Extender la selección un párrafo hacia arriba + + + + Move down one paragraph + Desplazar un párrafo hacia abajo + + + + Scroll to start of document + Desplazar al principio del documento + + + + Scroll to end of document + Desplazar al final del documento + + + + Scroll vertically to centre current line + Desplazar verticalmente al centro de la línea actual + + + + Extend selection down one paragraph + Extender la selección un párrafo hacia abajo + + + + Move left one character + Mover un carácter hacia la izquierda + + + + Extend selection left one character + Extender la selección un carácter hacia la izquierda + + + + Move left one word + Mover una palabra hacia la izquierda + + + + Extend selection left one word + Extender la selección una palabra a la izquierda + + + + Extend rectangular selection left one character + Extender la selección rectangular un carácter hacia la izquierda + + + + Move right one character + Mover un carácter hacia la derecha + + + + Extend selection right one character + Extender la selección un carácter hacia la derecha + + + + Move right one word + Mover una palabra hacia la derecha + + + + Extend selection right one word + Extender la selección una palabra a la derecha + + + + Extend rectangular selection right one character + Extender la selección rectangular un carácter hacia la derecha + + + + Move to end of previous word + Mover al final de palabra anterior + + + + Extend selection to end of previous word + Extender selección al final de la palabra anterior + + + + Move to end of next word + Mover al final de la palabra siguiente + + + + Extend selection to end of next word + Extender la selección hasta el final de la palabra siguiente + + + + Move left one word part + Mover parte de una palabra hacia la izquierda + + + + Extend selection left one word part + Extender la selección parte de una palabra a la izquierda + + + + Move right one word part + Mover parte de una palabra hacia la derecha + + + + Extend selection right one word part + Extender la selección parte de una palabra a la derecha + + + + Move up one page + Mover hacia arriba una página + + + + Extend selection up one page + Extender la selección hacia arriba una página + + + + Extend rectangular selection up one page + Extender la selección rectangular hacia arriba una página + + + + Move down one page + Mover hacia abajo una página + + + + Extend selection down one page + Extender la selección hacia abajo una página + + + + Extend rectangular selection down one page + Extender la selección rectangular una página hacia abajo + + + + Delete current character + Borrar el carácter actual + + + + Cut selection + Cortar selección + + + + Delete word to right + Borrar palabra hacia la derecha + + + + Move to start of document line + Mover al principio de la línea del documento + + + + Extend selection to start of document line + Extender selección al principio de la línea del documento + + + + Extend rectangular selection to start of document line + Extender selección rectangular al principio de la línea del documento + + + + Move to start of display line + Mover al principio de la línea visualizada + + + + Extend selection to start of display line + Extender selección al principio de la línea visualizada + + + + Move to start of display or document line + Mover al principio de la línea visualizada o del documento + + + + Extend selection to start of display or document line + Extender selección al principio de la línea visualizada o del documento + + + + Move to first visible character in document line + Mover al primer carácter visible en la línea del documento + + + + Extend selection to first visible character in document line + Extender selección al primer carácter visible en la línea del documento + + + + Extend rectangular selection to first visible character in document line + Extender selección rectangular al primer carácter visible en la línea del documento + + + + Move to first visible character of display in document line + Extender selección al primer carácter visualizado en la línea del documento + + + + Extend selection to first visible character in display or document line + Extender selección al primer carácter de línea visualizada o del documento + + + + Move to end of document line + Mover al final de la línea del documento + + + + Extend selection to end of document line + Extender selección al final de la línea del documento + + + + Extend rectangular selection to end of document line + Extender selección rectangular al final de la línea del documento + + + + Move to end of display line + Mover al final de la línea visualizada + + + + Extend selection to end of display line + Extender selección al final de la línea visualizada + + + + Move to end of display or document line + Mover al final de la línea visualizada o del documento + + + + Extend selection to end of display or document line + Extender selección al final de la línea visualizada o del documento + + + + Move to start of document + Mover al principio del documento + + + + Extend selection to start of document + Extender selección al principio del documento + + + + Move to end of document + Mover al final del documento + + + + Extend selection to end of document + Extender selección al final del documento + + + + Stuttered move up one page + Mover progresivamente una página hacia arriba + + + + Stuttered extend selection up one page + Extender progresivamente selección hacia arriba una página + + + + Stuttered move down one page + Mover progresivamente una página hacia abajo + + + + Stuttered extend selection down one page + Extender progresivamente selección hacia abajo una página + + + + Delete previous character if not at start of line + Borrar carácter anterior si no está al principio de una línea + + + + Delete right to end of next word + Borrar a la derecha hasta el final de la siguiente palabra + + + + Delete line to right + Borrar línea hacia la derecha + + + + Transpose current and previous lines + Transponer líneas actual y anterior + + + + Duplicate the current line + Duplicar línea actual + + + + Select all + Select document + Seleccionar todo + + + + Move selected lines up one line + Mover las líneas seleccionadas una línea hacia arriba + + + + Move selected lines down one line + Mover las líneas seleccionadas una línea hacia abajo + + + + Toggle insert/overtype + Conmutar insertar/sobreescribir + + + + Paste + Pegar + + + + Copy selection + Copiar selección + + + + Insert newline + Insertar carácter de nueva línea + + + + De-indent one level + Deshacer un nivel de indentado + + + + Cancel + Cancelar + + + + Delete previous character + Borrar carácter anterior + + + + Delete word to left + Borrar palabra hacia la izquierda + + + + Delete line to left + Borrar línea hacia la izquierda + + + + Undo last command + Deshacer último comando + + + + Redo last command + Rehacer último comando + + + + Indent one level + Indentar un nivel + + + + Zoom in + Aumentar zoom + + + + Zoom out + Disminuir zoom + + + + Formfeed + Carga de la página + + + + Cut current line + Cortar línea actual + + + + Delete current line + Borrar línea actual + + + + Copy current line + Copiar línea actual + + + + Convert selection to lower case + Convertir selección a minúsculas + + + + Convert selection to upper case + Convertir selección a mayúsculas + + + + Duplicate selection + Duplicar selección + + + + QsciLexerAVS + + + Default + Por defecto + + + + Block comment + Comentario de bloque + + + + Nested block comment + Comentario de bloque anidado + + + + Line comment + Comentario de línea + + + + Number + Número + + + + Operator + Operador + + + + Identifier + Identificador + + + + Double-quoted string + Cadena con comillas dobles + + + + Triple double-quoted string + Cadena con triple comilla doble + + + + Keyword + Palabra clave + + + + Filter + Filtro + + + + Plugin + Plugin + + + + Function + Función + + + + Clip property + Propiedad de recorte + + + + User defined + Definido por el usuario + + + + QsciLexerBash + + + Default + Por defecto + + + + Error + Error + + + + Comment + Comentario + + + + Number + Número + + + + Keyword + Palabra clave + + + + Double-quoted string + Cadena con comillas dobles + + + + Single-quoted string + Cadena con comillas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Scalar + Escalar + + + + Parameter expansion + Expansión de parámetros + + + + Backticks + Comilla inversa + + + + Here document delimiter + Delimitador de documento integrado (here document) + + + + Single-quoted here document + Documento integrado (here document) con comilla simple + + + + QsciLexerBatch + + + Default + Por defecto + + + + Comment + Comentario + + + + Keyword + Palabra clave + + + + Label + Etiqueta + + + + Hide command character + Ocultar caracteres de comando + + + + External command + Comando externo + + + + Variable + Variable + + + + Operator + Operador + + + + QsciLexerCMake + + + Default + Por defecto + + + + Comment + Comentario + + + + String + Cadena de caracteres + + + + Left quoted string + Cadena con comillas a la izquierda + + + + Right quoted string + Cadena con comillas a la derecha + + + + Function + Función + + + + Variable + Variable + + + + Label + Etiqueta + + + + User defined + Definido por el usuario + + + + WHILE block + Bloque WHILE + + + + FOREACH block + Bloque FOREACH + + + + IF block + Bloque IF + + + + MACRO block + Bloque MACRO + + + + Variable within a string + Variable en una cadena + + + + Number + Número + + + + QsciLexerCPP + + + Default + Por defecto + + + + Inactive default + Por defecto inactivo + + + + C comment + Comentario C + + + + Inactive C comment + Comentario C inactivo + + + + C++ comment + Comentario C++ + + + + Inactive C++ comment + Comentario C++ inactivo + + + + JavaDoc style C comment + Comentario C de estilo JavaDoc + + + + Inactive JavaDoc style C comment + Comentario C estilo JavaDoc inactivo + + + + Number + Número + + + + Inactive number + Número inactivo + + + + Keyword + Palabra clave + + + + Inactive keyword + Palabra clave inactiva + + + + Double-quoted string + Cadena con comillas dobles + + + + Inactive double-quoted string + Cadena con doble comilla inactiva + + + + Single-quoted string + Cadena con comillas simples + + + + Inactive single-quoted string + Cadena con comilla simple inactiva + + + + IDL UUID + IDL UUID + + + + Inactive IDL UUID + IDL UUID inactivo + + + + Pre-processor block + Bloque de preprocesador + + + + Inactive pre-processor block + Bloque de preprocesador inactivo + + + + Operator + Operador + + + + Inactive operator + Operador inactivo + + + + Identifier + Identificador + + + + Inactive identifier + Identificador inactivo + + + + Unclosed string + Cadena sin cerrar + + + + Inactive unclosed string + Cadena sin cerrar inactiva + + + + C# verbatim string + Cadena C# textual + + + + Inactive C# verbatim string + Cadena C# textual inactiva + + + + JavaScript regular expression + Expresión regular JavaScript + + + + Inactive JavaScript regular expression + Expresión regular JavaScript inactiva + + + + JavaDoc style C++ comment + Comentario C++ de estilo JavaDoc + + + + Inactive JavaDoc style C++ comment + Comentario C++ estilo JavaDoc inactivo + + + + Secondary keywords and identifiers + Identificadores y palabras clave secundarios + + + + Inactive secondary keywords and identifiers + Identificadores y palabras clave secundarios inactivos + + + + JavaDoc keyword + Palabra clave de Javadoc + + + + Inactive JavaDoc keyword + Palabra clave de JavaDoc inactiva + + + + JavaDoc keyword error + Error en palabra clave de Javadoc + + + + Inactive JavaDoc keyword error + Error en palabra clave de Javadoc inactivo + + + + Global classes and typedefs + Clases globales y typedefs + + + + Inactive global classes and typedefs + Clases globales y typedefs inactivos + + + + C++ raw string + Cadena en bruto C++ + + + + Inactive C++ raw string + Cadena inactiva C++ + + + + Vala triple-quoted verbatim string + Cadena Vala con triple comilla textual + + + + Inactive Vala triple-quoted verbatim string + Cadena Vala con triple comilla textual inactiva + + + + Pike hash-quoted string + Cadena Pike con hash entrecomillado + + + + Inactive Pike hash-quoted string + Cadena Pike con hash entrecomillado inactiva + + + + Pre-processor C comment + Comentario C de preprocesador + + + + Inactive pre-processor C comment + Comentario C de preprocesador inactivo + + + + JavaDoc style pre-processor comment + Comentario de preprocesador estilo JavaDoc + + + + Inactive JavaDoc style pre-processor comment + Comentario de preprocesador estilo JavaDoc inactivo + + + + User-defined literal + Literal definido por el usuario + + + + Inactive user-defined literal + Literal inactivo definido por el usuario + + + + Task marker + Marcador de tarea + + + + Inactive task marker + Marcador de tarea inactivo + + + + Escape sequence + Secuencia de escape + + + + Inactive escape sequence + Secuencia de escape inactiva + + + + QsciLexerCSS + + + Default + Por defecto + + + + Tag + Etiqueta + + + + Class selector + Selector de clase + + + + Pseudo-class + Pseudoclase + + + + Unknown pseudo-class + Pseudoclase desconocida + + + + Operator + Operador + + + + CSS1 property + Propiedad CSS1 + + + + Unknown property + Propiedad desconocida + + + + Value + Valor + + + + ID selector + Selector de ID + + + + Important + Importante + + + + @-rule + Regla-@ + + + + Double-quoted string + Cadena con comillas dobles + + + + Single-quoted string + Cadena con comillas simples + + + + CSS2 property + Propiedad CSS2 + + + + Attribute + Atributo + + + + CSS3 property + Propiedad CSS3 + + + + Pseudo-element + Pseudoelemento + + + + Extended CSS property + Propiedad CSS extendida + + + + Extended pseudo-class + Pseudoclase extendida + + + + Extended pseudo-element + Pseudoelemento extendido + + + + Media rule + Regla de '@media' + + + + Variable + Variable + + + + QsciLexerCSharp + + + Verbatim string + Cadena textual + + + + QsciLexerCoffeeScript + + + Default + Por defecto + + + + C-style comment + Comentario de estilo C + + + + C++-style comment + Comentario de estilo C++ + + + + JavaDoc C-style comment + Comentario de estilo JavaDoc C + + + + Number + Número + + + + Keyword + Palabra clave + + + + Double-quoted string + Cadena con comillas dobles + + + + Single-quoted string + Cadena con comilla simple + + + + IDL UUID + IDL UUID + + + + Pre-processor block + Bloque de preprocesador + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadena sin cerrar + + + + C# verbatim string + Cadena C# textual + + + + Regular expression + Expresión regular + + + + JavaDoc C++-style comment + Comentario de estilo JavaDoc C++ + + + + Secondary keywords and identifiers + Identificadores y palabras clave secundarios + + + + JavaDoc keyword + Palabra clave de JavaDoc + + + + JavaDoc keyword error + Error en palabra clave de JavaDoc + + + + Global classes + Clases globales + + + + Block comment + Comentario de bloque + + + + Block regular expression + Expresión regular de bloque + + + + Block regular expression comment + Comentario de expresión regular de bloque + + + + QsciLexerD + + + Default + Por defecto + + + + Block comment + Comentario de bloque + + + + Line comment + Comentario de línea + + + + DDoc style block comment + Comentario de bloque estilo DDoc + + + + Nesting comment + Comentario anidado + + + + Number + Número + + + + Keyword + Palabra clave + + + + Secondary keyword + Palabra clave secundaria + + + + Documentation keyword + Palabra clave de documentación + + + + Type definition + Definición de tipo + + + + String + Cadena de caracteres + + + + Unclosed string + Cadena sin cerrar + + + + Character + Carácter + + + + Operator + Operador + + + + Identifier + Identificador + + + + DDoc style line comment + Comentario de línea estilo DDoc + + + + DDoc keyword + Palabra clave DDoc + + + + DDoc keyword error + Error en palabra clave DDOC + + + + Backquoted string + Cadena con comillas hacia atrás + + + + Raw string + Cadena en bruto + + + + User defined 1 + Definido por el usuario 1 + + + + User defined 2 + Definido por el usuario 2 + + + + User defined 3 + Definido por el usuario 3 + + + + QsciLexerDiff + + + Default + Por defecto + + + + Comment + Comentario + + + + Command + Comando + + + + Header + Encabezado + + + + Position + Posición + + + + Removed line + Línea eliminada + + + + Added line + Línea añadida + + + + Changed line + Línea modificada + + + + QsciLexerFortran77 + + + Default + Por defecto + + + + Comment + Comentario + + + + Number + Número + + + + Single-quoted string + Cadena con comillas simples + + + + Double-quoted string + Cadena con comillas dobles + + + + Unclosed string + Cadena sin cerrar + + + + Operator + Operador + + + + Identifier + Identificador + + + + Keyword + Palabra clave + + + + Intrinsic function + Función intrínseca + + + + Extended function + Función extendida + + + + Pre-processor block + Bloque de preprocesador + + + + Dotted operator + Operador punteado + + + + Label + Etiqueta + + + + Continuation + Continuación + + + + QsciLexerHTML + + + HTML default + HTML por defecto + + + + Tag + Etiqueta + + + + Unknown tag + Etiqueta desconocida + + + + Attribute + Atributo + + + + Unknown attribute + Atributo desconocido + + + + HTML number + Número HTML + + + + HTML double-quoted string + Cadena HTML con comillas dobles + + + + HTML single-quoted string + Cadena HTML con comillas simples + + + + Other text in a tag + Otro texto en una etiqueta + + + + HTML comment + Comentario HTML + + + + Entity + Entidad + + + + End of a tag + Final de una etiqueta + + + + Start of an XML fragment + Inicio de un fragmento XML + + + + End of an XML fragment + Fin de un fragmento XML + + + + Script tag + Etiqueta de script + + + + Start of an ASP fragment with @ + Inicio de un fragmento ASP con @ + + + + Start of an ASP fragment + Inicio de un fragmento ASP + + + + CDATA + CDATA + + + + Start of a PHP fragment + Inicio de un fragmento PHP + + + + Unquoted HTML value + Valor HTML sin comillas + + + + ASP X-Code comment + Comentario ASP X-Code + + + + SGML default + SGML por defecto + + + + SGML command + Comando SGML + + + + First parameter of an SGML command + Primer parametro de un comando SGML + + + + SGML double-quoted string + Cadena SGML con comillas dobles + + + + SGML single-quoted string + Cadena SGML con comillas simples + + + + SGML error + Error SGML + + + + SGML special entity + Entidad SGML especial + + + + SGML comment + Comentario SGML + + + + First parameter comment of an SGML command + Comentario de primer parametro de un comando SGML + + + + SGML block default + Bloque SGML por defecto + + + + Start of a JavaScript fragment + Inicio de un fragmento JavaScript + + + + JavaScript default + JavaScript por defecto + + + + JavaScript comment + Comentario JavaScript + + + + JavaScript line comment + Comentario de línea de JavaScript + + + + JavaDoc style JavaScript comment + Comentario JavaScript de estilo JavaDoc + + + + JavaScript number + Número JavaScript + + + + JavaScript word + Palabra JavaScript + + + + JavaScript keyword + Palabra clave JavaScript + + + + JavaScript double-quoted string + Cadena JavaScript con comillas dobles + + + + JavaScript single-quoted string + Cadena JavaScript con comillas simples + + + + JavaScript symbol + Símbolo JavaScript + + + + JavaScript unclosed string + Cadena JavaScript sin cerrar + + + + JavaScript regular expression + Expresión regular JavaScript + + + + Start of an ASP JavaScript fragment + Inicio de un fragmento de ASP JavaScript + + + + ASP JavaScript default + ASP JavaScript por defecto + + + + ASP JavaScript comment + Comentario de ASP JavaScript + + + + ASP JavaScript line comment + Comentario de línea de ASP JavaScript + + + + JavaDoc style ASP JavaScript comment + Comentario ASP JavaScript de estilo JavaDoc + + + + ASP JavaScript number + Número ASP JavaScript + + + + ASP JavaScript word + Palabra ASP JavaScript + + + + ASP JavaScript keyword + Palabra clave ASP JavaScript + + + + ASP JavaScript double-quoted string + Cadena ASP JavaScript con comillas dobles + + + + ASP JavaScript single-quoted string + Cadena ASP JavaScript con comillas simples + + + + ASP JavaScript symbol + Símbolo ASP JavaScript + + + + ASP JavaScript unclosed string + Cadena ASP JavaScript sin cerrar + + + + ASP JavaScript regular expression + Expresión regular ASP JavaScript + + + + Start of a VBScript fragment + Inicio de un fragmento VBScript + + + + VBScript default + VBScript por defecto + + + + VBScript comment + Comentario VBScript + + + + VBScript number + Número VBScript + + + + VBScript keyword + Palabra clave VBScript + + + + VBScript string + Cadena de caracteres VBScript + + + + VBScript identifier + Identificador VBScript + + + + VBScript unclosed string + Cadena VBScript sin cerrar + + + + Start of an ASP VBScript fragment + Inicio de un fragmento de ASP VBScript + + + + ASP VBScript default + ASP VBScript por defecto + + + + ASP VBScript comment + Comentario de ASP VBScript + + + + ASP VBScript number + Número ASP VBScript + + + + ASP VBScript keyword + Palabra clave ASP VBScript + + + + ASP VBScript string + Cadena de caracteres ASP VBScript + + + + ASP VBScript identifier + Identificador ASP VBScript + + + + ASP VBScript unclosed string + Cadena ASP VBScript sin cerrar + + + + Start of a Python fragment + Inicio de un fragmento Python + + + + Python default + Python por defecto + + + + Python comment + Comentario Python + + + + Python number + Número Python + + + + Python double-quoted string + Cadena Python con comillas dobles + + + + Python single-quoted string + Cadena Python con comillas simples + + + + Python keyword + Palabra clave de Python + + + + Python triple double-quoted string + Cadena Python con triple comilla doble + + + + Python triple single-quoted string + Cadena Python con triple comilla simple + + + + Python class name + Nombre de clase Python + + + + Python function or method name + Nombre de método o función Python + + + + Python operator + Operador Python + + + + Python identifier + Identificador Python + + + + Start of an ASP Python fragment + Inicio de un fragmento ASP Python + + + + ASP Python default + ASP Python por defecto + + + + ASP Python comment + Comentario ASP Python + + + + ASP Python number + Número ASP Python + + + + ASP Python double-quoted string + Cadena ASP Python con comillas dobles + + + + ASP Python single-quoted string + Cadena ASP Python con comillas simples + + + + ASP Python keyword + Palabra clave de ASP Python + + + + ASP Python triple double-quoted string + Cadena ASP Python con triple comilla doble + + + + ASP Python triple single-quoted string + Cadena ASP Python con triple comilla simple + + + + ASP Python class name + Nombre de clase ASP Python + + + + ASP Python function or method name + Nombre de método o función ASP Python + + + + ASP Python operator + Operador ASP Python + + + + ASP Python identifier + Identificador ASP Python + + + + PHP default + PHP por defecto + + + + PHP double-quoted string + Cadena PHP con comillas dobles + + + + PHP single-quoted string + Cadena PHP con comillas simples + + + + PHP keyword + Palabra clave PHP + + + + PHP number + Número PHP + + + + PHP variable + Variable PHP + + + + PHP comment + Comentario PHP + + + + PHP line comment + Comentario de línea PHP + + + + PHP double-quoted variable + Variable PHP con comillas dobles + + + + PHP operator + Operador PHP + + + + QsciLexerIDL + + + UUID + UUID + + + + QsciLexerJavaScript + + + Regular expression + Expresión regular + + + + QsciLexerLua + + + Default + Por defecto + + + + Comment + Comentario + + + + Line comment + Comentario de línea + + + + Number + Número + + + + Keyword + Palabra clave + + + + String + Cadena de caracteres + + + + Character + Carácter + + + + Literal string + Cadena literal + + + + Preprocessor + Preprocesador + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadena sin cerrar + + + + Basic functions + Funciones basicas + + + + String, table and maths functions + Funcines de cadena, tabla y matemáticas + + + + Coroutines, i/o and system facilities + Co-rutinas, e/s y funciones del sistema + + + + User defined 1 + Definido por el usuario 1 + + + + User defined 2 + Definido por el usuario 2 + + + + User defined 3 + Definido por el usuario 3 + + + + User defined 4 + Definido por el usuario 4 + + + + Label + Etiqueta + + + + QsciLexerMakefile + + + Default + Por defecto + + + + Comment + Comentario + + + + Preprocessor + Preprocesador + + + + Variable + Variable + + + + Operator + Operador + + + + Target + Objetivo + + + + Error + Error + + + + QsciLexerMatlab + + + Default + Por defecto + + + + Comment + Comentario + + + + Command + Comando + + + + Number + Número + + + + Keyword + Palabra clave + + + + Single-quoted string + Cadena con comillas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Double-quoted string + Cadena con comillas dobles + + + + QsciLexerPO + + + Default + Por defecto + + + + Comment + Comentario + + + + Message identifier + Identificador de mensaje + + + + Message identifier text + Texto identificador de mensaje + + + + Message string + Cadena de mensaje + + + + Message string text + Texto de cadena de mensaje + + + + Message context + Contexto de mensaje + + + + Message context text + Texto de contexto de mensaje + + + + Fuzzy flag + Señalador difuso + + + + Programmer comment + Comentario de programador + + + + Reference + Referencia + + + + Flags + Señaladores + + + + Message identifier text end-of-line + Fin de línea de texto identificador de mensaje + + + + Message string text end-of-line + Fin de línea de texto de cadena de mensaje + + + + Message context text end-of-line + Fin de línea de texto de contexto de mensaje + + + + QsciLexerPOV + + + Default + Por defecto + + + + Comment + Comentario + + + + Comment line + Línea de comentario + + + + Number + Número + + + + Operator + Operador + + + + Identifier + Identificador + + + + String + Cadena de caracteres + + + + Unclosed string + Cadena sin cerrar + + + + Directive + Directiva + + + + Bad directive + Mala directiva + + + + Objects, CSG and appearance + Objetos, CSG y apariencia + + + + Types, modifiers and items + Tipos, modificadores y elementos + + + + Predefined identifiers + Identificadores predefinidos + + + + Predefined functions + Funciones predefinidas + + + + User defined 1 + Definido por el usuario 1 + + + + User defined 2 + Definido por el usuario 2 + + + + User defined 3 + Definido por el usuario 3 + + + + QsciLexerPascal + + + Default + Por defecto + + + + Line comment + Comentario de línea + + + + Number + Número + + + + Keyword + Palabra clave + + + + Single-quoted string + Cadena con comillas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + '{ ... }' style comment + Comentario de estilo '{ ... }' + + + + '(* ... *)' style comment + Comentario de estilo '(* ... *)' + + + + '{$ ... }' style pre-processor block + Bloque de preprocesador de estilo '{$ ... }' + + + + '(*$ ... *)' style pre-processor block + Bloque de preprocesador de estilo '(*$ ... *)' + + + + Hexadecimal number + Número hexadecimal + + + + Unclosed string + Cadena sin cerrar + + + + Character + Carácter + + + + Inline asm + asm inline + + + + QsciLexerPerl + + + Default + Por defecto + + + + Error + Error + + + + Comment + Comentario + + + + POD + POD + + + + Number + Número + + + + Keyword + Palabra clave + + + + Double-quoted string + Cadena con comillas dobles + + + + Single-quoted string + Cadena con comillas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Scalar + Escalar + + + + Array + Array + + + + Hash + Hash + + + + Symbol table + Tabla de símbolos + + + + Regular expression + Expresión regular + + + + Substitution + Sustitución + + + + Backticks + Comilla inversa + + + + Data section + Sección de datos + + + + Here document delimiter + Delimitador de documento integrado (here document) + + + + Single-quoted here document + Documento integrado (here document) con comilla simple + + + + Double-quoted here document + Documento integrado (here document) con comilla doble + + + + Backtick here document + Documento integrado (here document) con comilla inversa + + + + Quoted string (q) + Cadena con comillas (q) + + + + Quoted string (qq) + Cadena con comillas (qq) + + + + Quoted string (qx) + Cadena con comillas (qx) + + + + Quoted string (qr) + Cadena con comillas (qr) + + + + Quoted string (qw) + Cadena con comillas (qw) + + + + POD verbatim + POD textual + + + + Subroutine prototype + Prototipo de subrutina + + + + Format identifier + Identificador de formato + + + + Format body + Cuerpo de formato + + + + Double-quoted string (interpolated variable) + Cadena con doble comilla (variable interpolada) + + + + Translation + Traducción + + + + Regular expression (interpolated variable) + Expresión regular (variable interpolada) + + + + Substitution (interpolated variable) + Substitución (variable interpolada) + + + + Backticks (interpolated variable) + Comilla hacia atrás (variable interpolada) + + + + Double-quoted here document (interpolated variable) + Here document con comilla doble (variable interpolada) + + + + Backtick here document (interpolated variable) + Here document con comilla hacia atrás (variable interpolada) + + + + Quoted string (qq, interpolated variable) + Cadena entrecomillada (qq, variable interpolada) + + + + Quoted string (qx, interpolated variable) + Cadena entrecomillada (qx, variable interpolada) + + + + Quoted string (qr, interpolated variable) + Cadena entrecomillada (qr, variable interpolada) + + + + QsciLexerPostScript + + + Default + Por defecto + + + + Comment + Comentario + + + + DSC comment + Comentario DSC + + + + DSC comment value + Valor de comentario DSC + + + + Number + Número + + + + Name + Nombre + + + + Keyword + Palabra clave + + + + Literal + Literal + + + + Immediately evaluated literal + Literal de evaluación inmediata + + + + Array parenthesis + Paréntesis de array + + + + Dictionary parenthesis + Paréntesis de diccionario + + + + Procedure parenthesis + Paréntesis de procedimiento + + + + Text + Texto + + + + Hexadecimal string + Cadena hexadecimal + + + + Base85 string + Cadena Base85 + + + + Bad string character + Carácter de cadena mala + + + + QsciLexerProperties + + + Default + Por defecto + + + + Comment + Comentario + + + + Section + Sección + + + + Assignment + Asignación + + + + Default value + Valor por defecto + + + + Key + Clave + + + + QsciLexerPython + + + Default + Por defecto + + + + Comment + Comentario + + + + Number + Número + + + + Double-quoted string + Cadena con comillas dobles + + + + Single-quoted string + Cadena con comillas simples + + + + Keyword + Palabra clave + + + + Triple single-quoted string + Cadena con triple comilla simple + + + + Triple double-quoted string + Cadena con triple comilla doble + + + + Class name + Nombre de clase + + + + Function or method name + Nombre de método o función + + + + Operator + Operador + + + + Identifier + Identificador + + + + Comment block + Bloque de comentario + + + + Unclosed string + Cadena sin cerrar + + + + Highlighted identifier + Identificador resaltado + + + + Decorator + Decorador + + + + QsciLexerRuby + + + Default + Por defecto + + + + Comment + Comentario + + + + Number + Número + + + + Double-quoted string + Cadena con comillas dobles + + + + Single-quoted string + Cadena con comillas simples + + + + Keyword + Palabra clave + + + + Class name + Nombre de clase + + + + Function or method name + Nombre de método o función + + + + Operator + Operador + + + + Identifier + Identificador + + + + Error + Error + + + + POD + POD + + + + Regular expression + Expresión regular + + + + Global + Global + + + + Symbol + Símbolo + + + + Module name + Nombre de módulo + + + + Instance variable + Variable de instancia + + + + Class variable + Variable de clase + + + + Backticks + Comilla inversa + + + + Data section + Sección de datos + + + + Here document delimiter + Delimitador de documento integrado (here document) + + + + Here document + Documento integrado (here document) + + + + %q string + Cadena %q + + + + %Q string + Cadena %Q + + + + %x string + Cadena %x + + + + %r string + Cadena %r + + + + %w string + Cadena %w + + + + Demoted keyword + Palabra clave degradada + + + + stdin + stdin + + + + stdout + stdout + + + + stderr + stderr + + + + QsciLexerSQL + + + Default + Por defecto + + + + Comment + Comentario + + + + Number + Número + + + + Keyword + Palabra clave + + + + Single-quoted string + Cadena con comillas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Comment line + Línea de comentario + + + + JavaDoc style comment + Comentario de estilo JavaDoc + + + + Double-quoted string + Cadena con comillas dobles + + + + SQL*Plus keyword + Palabra clave SQL*Plus + + + + SQL*Plus prompt + Prompt SQL*Plus + + + + SQL*Plus comment + Comentario SQL*Plus + + + + # comment line + # línea de comentario + + + + JavaDoc keyword + Palabra clave de Javadoc + + + + JavaDoc keyword error + Error en palabra clave de Javadoc + + + + User defined 1 + Definido por el usuario 1 + + + + User defined 2 + Definido por el usuario 2 + + + + User defined 3 + Definido por el usuario 3 + + + + User defined 4 + Definido por el usuario 4 + + + + Quoted identifier + Identificador entrecomillado + + + + Quoted operator + Operador entrecomillado + + + + QsciLexerSpice + + + Default + Por defecto + + + + Identifier + Identificador + + + + Command + Comando + + + + Function + Función + + + + Parameter + Parámetro + + + + Number + Número + + + + Delimiter + Delimitador + + + + Value + Valor + + + + Comment + Comentario + + + + QsciLexerTCL + + + Default + Por defecto + + + + Comment + Comentario + + + + Comment line + Línea de comentario + + + + Number + Número + + + + Quoted keyword + Palabra clave entrecomillada + + + + Quoted string + Cadena entrecomillada + + + + Operator + Operador + + + + Identifier + Identificador + + + + Substitution + Sustitución + + + + Brace substitution + Sustitución de corchetes + + + + Modifier + Modificador + + + + Expand keyword + Expandir palabra clave + + + + TCL keyword + Palabra clave TCL + + + + Tk keyword + Palabra clave Tk + + + + iTCL keyword + Palabra clave iTCL + + + + Tk command + Comando Tk + + + + User defined 1 + Definido por el usuario 1 + + + + User defined 2 + Definido por el usuario 2 + + + + User defined 3 + Definido por el usuario 3 + + + + User defined 4 + Definido por el usuario 4 + + + + Comment box + Caja de comentario + + + + Comment block + Bloque de comentario + + + + QsciLexerTeX + + + Default + Por defecto + + + + Special + Especial + + + + Group + Grupo + + + + Symbol + Símbolo + + + + Command + Comando + + + + Text + Texto + + + + QsciLexerVHDL + + + Default + Por defecto + + + + Comment + Comentario + + + + Comment line + Línea de comentario + + + + Number + Número + + + + String + Cadena de caracteres + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadena sin cerrar + + + + Keyword + Palabra clave + + + + Standard operator + Operador estándar + + + + Attribute + Atributo + + + + Standard function + Función estándar + + + + Standard package + Paquete estándar + + + + Standard type + Tipo estándar + + + + User defined + Definido por el usuario + + + + Comment block + Bloque de comentario + + + + QsciLexerVerilog + + + Default + Por defecto + + + + Comment + Comentario + + + + Line comment + Comentario de línea + + + + Bang comment + Comentario'Bang + + + + Number + + + + + Primary keywords and identifiers + Identificadores y palabras clave primarios + + + + String + Cadena + + + + Secondary keywords and identifiers + Palabras clave e identificadores secundarios + + + + System task + Tarea de sistema + + + + Preprocessor block + Bloque de preprocesador + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadena sin cerrar + + + + User defined tasks and identifiers + Tareas definidas por el usuario e identificadores + + + + Keyword comment + Comentario de palabra clave + + + + Inactive keyword comment + Comentario de palabra clave inactiva + + + + Input port declaration + Declaración de puerto de input + + + + Inactive input port declaration + Declaración de puerto de input inactivo + + + + Output port declaration + Declaración de puerto de output + + + + Inactive output port declaration + Declaración de puerto de output inactivo + + + + Input/output port declaration + Declaración de puerto de input/output inactivo + + + + Inactive input/output port declaration + Declaración de puerto de input/output inactivo + + + + Port connection + Conexión de puerto + + + + Inactive port connection + Conexión inactiva de puerto + + + + QsciLexerYAML + + + Default + Por defecto + + + + Comment + Comentario + + + + Identifier + Identificador + + + + Keyword + Palabra clave + + + + Number + Número + + + + Reference + Referencia + + + + Document delimiter + Delimitador de documento + + + + Text block marker + Marcador de bloque de texto + + + + Syntax error marker + Marcador de error de sintaxis + + + + Operator + Operador + + + + QsciScintilla + + + &Undo + &Deshacer + + + + &Redo + &Rehacer + + + + Cu&t + Cor&tar + + + + &Copy + &Copiar + + + + &Paste + &Pegar + + + + Delete + Borrar + + + + Select All + Seleccionar todo + + + diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_fr.qm b/libs/qscintilla/Qt4Qt5/qscintilla_fr.qm new file mode 100644 index 000000000..6f4d10493 Binary files /dev/null and b/libs/qscintilla/Qt4Qt5/qscintilla_fr.qm differ diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_fr.ts b/libs/qscintilla/Qt4Qt5/qscintilla_fr.ts new file mode 100644 index 000000000..9b5fbb0ee --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscintilla_fr.ts @@ -0,0 +1,3702 @@ + + + + + QsciCommand + + + Move down one line + Déplacement d'une ligne vers le bas + + + + Extend selection down one line + Extension de la sélection d'une ligne vers le bas + + + + Scroll view down one line + Decendre la vue d'une ligne + + + + Extend rectangular selection down one line + Extension de la sélection rectangulaire d'une ligne vers le bas + + + + Move up one line + Déplacement d'une ligne vers le haut + + + + Extend selection up one line + Extension de la sélection d'une ligne vers le haut + + + + Scroll view up one line + Remonter la vue d'une ligne + + + + Extend rectangular selection up one line + Extension de la sélection rectangulaire d'une ligne vers le haut + + + + Move up one paragraph + Déplacement d'un paragraphe vers le haut + + + + Extend selection up one paragraph + Extension de la sélection d'un paragraphe vers le haut + + + + Move down one paragraph + Déplacement d'un paragraphe vers le bas + + + + Scroll to start of document + + + + + Scroll to end of document + + + + + Scroll vertically to centre current line + + + + + Extend selection down one paragraph + Extension de la sélection d'un paragraphe vers le bas + + + + Move left one character + Déplacement d'un caractère vers la gauche + + + + Extend selection left one character + Extension de la sélection d'un caractère vers la gauche + + + + Move left one word + Déplacement d'un mot vers la gauche + + + + Extend selection left one word + Extension de la sélection d'un mot vers la gauche + + + + Extend rectangular selection left one character + Extension de la sélection rectangulaire d'un caractère vers la gauche + + + + Move right one character + Déplacement d'un caractère vers la droite + + + + Extend selection right one character + Extension de la sélection d'un caractère vers la droite + + + + Move right one word + Déplacement d'un mot vers la droite + + + + Extend selection right one word + Extension de la sélection d'un mot vers la droite + + + + Extend rectangular selection right one character + Extension de la sélection rectangulaire d'un caractère vers la droite + + + + Move to end of previous word + + + + + Extend selection to end of previous word + + + + + Move to end of next word + + + + + Extend selection to end of next word + + + + + Move left one word part + Déplacement d'une part de mot vers la gauche + + + + Extend selection left one word part + Extension de la sélection d'une part de mot vers la gauche + + + + Move right one word part + Déplacement d'une part de mot vers la droite + + + + Extend selection right one word part + Extension de la sélection d'une part de mot vers la droite + + + + Move up one page + Déplacement d'une page vers le haut + + + + Extend selection up one page + Extension de la sélection d'une page vers le haut + + + + Extend rectangular selection up one page + Extension de la sélection rectangulaire d'une page vers le haut + + + + Move down one page + Déplacement d'une page vers le bas + + + + Extend selection down one page + Extension de la sélection d'une page vers le bas + + + + Extend rectangular selection down one page + Extension de la sélection rectangulaire d'une page vers le bas + + + + Delete current character + Effacement du caractère courant + + + + Cut selection + Couper la sélection + + + + Delete word to right + Suppression du mot de droite + + + + Move to start of document line + + + + + Extend selection to start of document line + + + + + Extend rectangular selection to start of document line + + + + + Move to start of display line + + + + + Extend selection to start of display line + + + + + Move to start of display or document line + + + + + Extend selection to start of display or document line + + + + + Move to first visible character in document line + + + + + Extend selection to first visible character in document line + + + + + Extend rectangular selection to first visible character in document line + + + + + Move to first visible character of display in document line + + + + + Extend selection to first visible character in display or document line + + + + + Move to end of document line + + + + + Extend selection to end of document line + + + + + Extend rectangular selection to end of document line + + + + + Move to end of display line + + + + + Extend selection to end of display line + + + + + Move to end of display or document line + + + + + Extend selection to end of display or document line + + + + + Move to start of document + + + + + Extend selection to start of document + + + + + Move to end of document + + + + + Extend selection to end of document + + + + + Stuttered move up one page + + + + + Stuttered extend selection up one page + + + + + Stuttered move down one page + + + + + Stuttered extend selection down one page + + + + + Delete previous character if not at start of line + + + + + Delete right to end of next word + + + + + Delete line to right + Suppression de la partie droite de la ligne + + + + Transpose current and previous lines + + + + + Duplicate the current line + + + + + Select all + Select document + + + + + Move selected lines up one line + + + + + Move selected lines down one line + + + + + Toggle insert/overtype + Basculement Insertion /Ecrasement + + + + Paste + Coller + + + + Copy selection + Copier la sélection + + + + Insert newline + + + + + De-indent one level + + + + + Cancel + Annuler + + + + Delete previous character + Suppression du dernier caractère + + + + Delete word to left + Suppression du mot de gauche + + + + Delete line to left + Effacer la partie gauche de la ligne + + + + Undo last command + + + + + Redo last command + Refaire la dernière commande + + + + Indent one level + Indentation d'un niveau + + + + Zoom in + Zoom avant + + + + Zoom out + Zoom arrière + + + + Formfeed + Chargement de la page + + + + Cut current line + Couper la ligne courante + + + + Delete current line + Suppression de la ligne courante + + + + Copy current line + Copier la ligne courante + + + + Convert selection to lower case + Conversion de la ligne courante en minuscules + + + + Convert selection to upper case + Conversion de la ligne courante en majuscules + + + + Duplicate selection + + + + + QsciLexerAVS + + + Default + Par défaut + + + + Block comment + + + + + Nested block comment + + + + + Line comment + Commentaire de ligne + + + + Number + Nombre + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Triple double-quoted string + Chaine de caractères HTML (guillemets simples) + + + + Keyword + Mot-clé + + + + Filter + + + + + Plugin + + + + + Function + + + + + Clip property + + + + + User defined + + + + + QsciLexerBash + + + Default + Par défaut + + + + Error + Erreur + + + + Comment + Commentaire + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Scalar + Scalaire + + + + Parameter expansion + Extension de paramètre + + + + Backticks + Quotes inverses + + + + Here document delimiter + Délimiteur de texte intégré (cat <<EOF....EOF) + + + + Single-quoted here document + Document intégré guillemets simples + + + + QsciLexerBatch + + + Default + Par défaut + + + + Comment + Commentaire + + + + Keyword + Mot-clé + + + + Label + Titre + + + + Hide command character + Cacher le caratère de commande + + + + External command + Commande externe + + + + Variable + Variable + + + + Operator + Opérateur + + + + QsciLexerCMake + + + Default + Par défaut + + + + Comment + Commentaire + + + + String + Chaîne de caractères + + + + Left quoted string + + + + + Right quoted string + + + + + Function + + + + + Variable + Variable + + + + Label + Titre + + + + User defined + + + + + WHILE block + + + + + FOREACH block + + + + + IF block + + + + + MACRO block + + + + + Variable within a string + + + + + Number + Nombre + + + + QsciLexerCPP + + + Default + Par défaut + + + + Inactive default + + + + + C comment + Commentaire C + + + + Inactive C comment + + + + + C++ comment + Commentaire C++ + + + + Inactive C++ comment + + + + + JavaDoc style C comment + Commentaire C de style JavaDoc + + + + Inactive JavaDoc style C comment + + + + + Number + Nombre + + + + Inactive number + + + + + Keyword + Mot-clé + + + + Inactive keyword + + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Inactive double-quoted string + + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Inactive single-quoted string + + + + + IDL UUID + + + + + Inactive IDL UUID + + + + + Pre-processor block + Instructions de pré-processing + + + + Inactive pre-processor block + + + + + Operator + Opérateur + + + + Inactive operator + + + + + Identifier + Identificateur + + + + Inactive identifier + + + + + Unclosed string + Chaine de caractères non refermée + + + + Inactive unclosed string + + + + + C# verbatim string + + + + + Inactive C# verbatim string + + + + + JavaScript regular expression + Expression régulière JavaScript + + + + Inactive JavaScript regular expression + + + + + JavaDoc style C++ comment + Commentaire C++ de style JavaDoc + + + + Inactive JavaDoc style C++ comment + + + + + Secondary keywords and identifiers + Seconds mots-clés et identificateurs + + + + Inactive secondary keywords and identifiers + + + + + JavaDoc keyword + Mot-clé JavaDoc + + + + Inactive JavaDoc keyword + + + + + JavaDoc keyword error + Erreur de mot-clé JavaDoc + + + + Inactive JavaDoc keyword error + + + + + Global classes and typedefs + Classes globales et définitions de types + + + + Inactive global classes and typedefs + + + + + C++ raw string + + + + + Inactive C++ raw string + + + + + Vala triple-quoted verbatim string + + + + + Inactive Vala triple-quoted verbatim string + + + + + Pike hash-quoted string + + + + + Inactive Pike hash-quoted string + + + + + Pre-processor C comment + + + + + Inactive pre-processor C comment + + + + + JavaDoc style pre-processor comment + + + + + Inactive JavaDoc style pre-processor comment + + + + + User-defined literal + + + + + Inactive user-defined literal + + + + + Task marker + + + + + Inactive task marker + + + + + Escape sequence + + + + + Inactive escape sequence + + + + + QsciLexerCSS + + + Default + Par défaut + + + + Tag + Balise + + + + Class selector + Classe + + + + Pseudo-class + Pseudo-classe + + + + Unknown pseudo-class + Peudo-classe inconnue + + + + Operator + Opérateur + + + + CSS1 property + Propriété CSS1 + + + + Unknown property + Propriété inconnue + + + + Value + Valeur + + + + ID selector + ID + + + + Important + Important + + + + @-rule + règle-@ + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + CSS2 property + Propriété CSS2 + + + + Attribute + Attribut + + + + CSS3 property + Propriété CSS2 {3 ?} + + + + Pseudo-element + + + + + Extended CSS property + + + + + Extended pseudo-class + + + + + Extended pseudo-element + + + + + Media rule + + + + + Variable + Variable + + + + QsciLexerCSharp + + + Verbatim string + Chaine verbatim + + + + QsciLexerCoffeeScript + + + Default + Par défaut + + + + C-style comment + + + + + C++-style comment + + + + + JavaDoc C-style comment + + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + IDL UUID + + + + + Pre-processor block + Instructions de pré-processing + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Unclosed string + Chaine de caractères non refermée + + + + C# verbatim string + + + + + Regular expression + Expression régulière + + + + JavaDoc C++-style comment + + + + + Secondary keywords and identifiers + Seconds mots-clés et identificateurs + + + + JavaDoc keyword + Mot-clé JavaDoc + + + + JavaDoc keyword error + Erreur de mot-clé JavaDoc + + + + Global classes + + + + + Block comment + + + + + Block regular expression + + + + + Block regular expression comment + + + + + QsciLexerD + + + Default + Par défaut + + + + Block comment + + + + + Line comment + Commentaire de ligne + + + + DDoc style block comment + + + + + Nesting comment + + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + Secondary keyword + + + + + Documentation keyword + + + + + Type definition + + + + + String + Chaîne de caractères + + + + Unclosed string + Chaine de caractères non refermée + + + + Character + Caractère + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + DDoc style line comment + + + + + DDoc keyword + Mot-clé JavaDoc + + + + DDoc keyword error + Erreur de mot-clé JavaDoc + + + + Backquoted string + + + + + Raw string + + + + + User defined 1 + Définition utilisateur 1 + + + + User defined 2 + Définition utilisateur 2 + + + + User defined 3 + Définition utilisateur 3 + + + + QsciLexerDiff + + + Default + Par défaut + + + + Comment + Commentaire + + + + Command + Commande + + + + Header + En-tête + + + + Position + Position + + + + Removed line + Ligne supprimée + + + + Added line + Ligne ajoutée + + + + Changed line + + + + + QsciLexerFortran77 + + + Default + Par défaut + + + + Comment + Commentaire + + + + Number + Nombre + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Unclosed string + Chaine de caractères non refermée + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Keyword + Mot-clé + + + + Intrinsic function + + + + + Extended function + + + + + Pre-processor block + Instructions de pré-processing + + + + Dotted operator + + + + + Label + Titre + + + + Continuation + + + + + QsciLexerHTML + + + HTML default + HTML par défaut + + + + Tag + Balise + + + + Unknown tag + Balise inconnue + + + + Attribute + Attribut + + + + Unknown attribute + Attribut inconnu + + + + HTML number + Nombre HTML + + + + HTML double-quoted string + Chaine de caractères HTML (guillemets doubles) + + + + HTML single-quoted string + Chaine de caractères HTML (guillemets simples) + + + + Other text in a tag + Autre texte dans les balises + + + + HTML comment + Commentaire HTML + + + + Entity + Entité + + + + End of a tag + Balise fermante + + + + Start of an XML fragment + Début de block XML + + + + End of an XML fragment + Fin de block XML + + + + Script tag + Balise de script + + + + Start of an ASP fragment with @ + Début de block ASP avec @ + + + + Start of an ASP fragment + Début de block ASP + + + + CDATA + CDATA + + + + Start of a PHP fragment + Début de block PHP + + + + Unquoted HTML value + Valeur HTML sans guillemets + + + + ASP X-Code comment + Commentaire X-Code ASP + + + + SGML default + SGML par défaut + + + + SGML command + Commande SGML + + + + First parameter of an SGML command + Premier paramètre de commande SGML + + + + SGML double-quoted string + Chaine de caractères SGML (guillemets doubles) + + + + SGML single-quoted string + Chaine de caractères SGML (guillemets simples) + + + + SGML error + Erreur SGML + + + + SGML special entity + Entité SGML spéciale + + + + SGML comment + Commentaire SGML + + + + First parameter comment of an SGML command + Premier paramètre de commentaire de commande SGML + + + + SGML block default + Block SGML par défaut + + + + Start of a JavaScript fragment + Début de block JavaScript + + + + JavaScript default + JavaScript par défaut + + + + JavaScript comment + Commentaire JavaScript + + + + JavaScript line comment + Commentaire de ligne JavaScript + + + + JavaDoc style JavaScript comment + Commentaire JavaScript de style JavaDoc + + + + JavaScript number + Nombre JavaScript + + + + JavaScript word + Mot JavaScript + + + + JavaScript keyword + Mot-clé JavaScript + + + + JavaScript double-quoted string + Chaine de caractères JavaScript (guillemets doubles) + + + + JavaScript single-quoted string + Chaine de caractères JavaScript (guillemets simples) + + + + JavaScript symbol + Symbole JavaScript + + + + JavaScript unclosed string + Chaine de caractères JavaScript non refermée + + + + JavaScript regular expression + Expression régulière JavaScript + + + + Start of an ASP JavaScript fragment + Début de block JavaScript ASP + + + + ASP JavaScript default + JavaScript ASP par défaut + + + + ASP JavaScript comment + Commentaire JavaScript ASP + + + + ASP JavaScript line comment + Commentaire de ligne JavaScript ASP + + + + JavaDoc style ASP JavaScript comment + Commentaire JavaScript ASP de style JavaDoc + + + + ASP JavaScript number + Nombre JavaScript ASP + + + + ASP JavaScript word + Mot JavaScript ASP + + + + ASP JavaScript keyword + Mot-clé JavaScript ASP + + + + ASP JavaScript double-quoted string + Chaine de caractères JavaScript ASP (guillemets doubles) + + + + ASP JavaScript single-quoted string + Chaine de caractères JavaScript ASP (guillemets simples) + + + + ASP JavaScript symbol + Symbole JavaScript ASP + + + + ASP JavaScript unclosed string + Chaine de caractères JavaScript ASP non refermée + + + + ASP JavaScript regular expression + Expression régulière JavaScript ASP + + + + Start of a VBScript fragment + Début de block VBScript + + + + VBScript default + VBScript par défaut + + + + VBScript comment + Commentaire VBScript + + + + VBScript number + Nombre VBScript + + + + VBScript keyword + Mot-clé VBScript + + + + VBScript string + Chaine de caractères VBScript + + + + VBScript identifier + Identificateur VBScript + + + + VBScript unclosed string + Chaine de caractères VBScript non refermée + + + + Start of an ASP VBScript fragment + Début de block VBScript ASP + + + + ASP VBScript default + VBScript ASP par défaut + + + + ASP VBScript comment + Commentaire VBScript ASP + + + + ASP VBScript number + Nombre VBScript ASP + + + + ASP VBScript keyword + Mot-clé VBScript ASP + + + + ASP VBScript string + Chaine de caractères VBScript ASP + + + + ASP VBScript identifier + Identificateur VBScript ASP + + + + ASP VBScript unclosed string + Chaine de caractères VBScript ASP non refermée + + + + Start of a Python fragment + Début de block Python + + + + Python default + Python par défaut + + + + Python comment + Commentaire Python + + + + Python number + Nombre Python + + + + Python double-quoted string + Chaine de caractères Python (guillemets doubles) + + + + Python single-quoted string + Chaine de caractères Python (guillemets simples) + + + + Python keyword + Mot-clé Python + + + + Python triple double-quoted string + Chaine de caractères Python (triples guillemets doubles) + + + + Python triple single-quoted string + Chaine de caractères Python (triples guillemets simples) + + + + Python class name + Nom de classe Python + + + + Python function or method name + Méthode ou fonction Python + + + + Python operator + Opérateur Python + + + + Python identifier + Identificateur Python + + + + Start of an ASP Python fragment + Début de block Python ASP + + + + ASP Python default + Python ASP par défaut + + + + ASP Python comment + Commentaire Python ASP + + + + ASP Python number + Nombre Python ASP + + + + ASP Python double-quoted string + Chaine de caractères Python ASP (guillemets doubles) + + + + ASP Python single-quoted string + Chaine de caractères Python ASP (guillemets simples) + + + + ASP Python keyword + Mot-clé Python ASP + + + + ASP Python triple double-quoted string + Chaine de caractères Python ASP (triples guillemets doubles) + + + + ASP Python triple single-quoted string + Chaine de caractères Python ASP (triples guillemets simples) + + + + ASP Python class name + Nom de classe Python ASP + + + + ASP Python function or method name + Méthode ou fonction Python ASP + + + + ASP Python operator + Opérateur Python ASP + + + + ASP Python identifier + Identificateur Python ASP + + + + PHP default + PHP par défaut + + + + PHP double-quoted string + Chaine de caractères PHP (guillemets doubles) + + + + PHP single-quoted string + Chaine de caractères PHP (guillemets simples) + + + + PHP keyword + Mot-clé PHP + + + + PHP number + Nombre PHP + + + + PHP variable + Variable PHP + + + + PHP comment + Commentaire PHP + + + + PHP line comment + Commentaire de ligne PHP + + + + PHP double-quoted variable + Variable PHP (guillemets doubles) + + + + PHP operator + Opérateur PHP + + + + QsciLexerIDL + + + UUID + UUID + + + + QsciLexerJavaScript + + + Regular expression + Expression régulière + + + + QsciLexerLua + + + Default + Par défaut + + + + Comment + Commentaire + + + + Line comment + Commentaire de ligne + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + String + Chaîne de caractères + + + + Character + Caractère + + + + Literal string + Chaîne littérale + + + + Preprocessor + Préprocessing + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Unclosed string + Chaine de caractères non refermée + + + + Basic functions + Fonctions de base + + + + String, table and maths functions + Fonctions sur les chaines, tables et fonctions math + + + + Coroutines, i/o and system facilities + Coroutines, i/o et fonctions système + + + + User defined 1 + Définition utilisateur 1 + + + + User defined 2 + Définition utilisateur 2 + + + + User defined 3 + Définition utilisateur 3 + + + + User defined 4 + Définition utilisateur 4 + + + + Label + Titre + + + + QsciLexerMakefile + + + Default + Par défaut + + + + Comment + Commentaire + + + + Preprocessor + Préprocessing + + + + Variable + Variable + + + + Operator + Opérateur + + + + Target + Cible + + + + Error + Erreur + + + + QsciLexerMatlab + + + Default + Par défaut + + + + Comment + Commentaire + + + + Command + Commande + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + QsciLexerPO + + + Default + Par défaut + + + + Comment + Commentaire + + + + Message identifier + + + + + Message identifier text + + + + + Message string + + + + + Message string text + + + + + Message context + + + + + Message context text + + + + + Fuzzy flag + + + + + Programmer comment + + + + + Reference + + + + + Flags + + + + + Message identifier text end-of-line + + + + + Message string text end-of-line + + + + + Message context text end-of-line + + + + + QsciLexerPOV + + + Default + Par défaut + + + + Comment + Commentaire + + + + Comment line + Ligne commentée + + + + Number + Nombre + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + String + Chaîne de caractères + + + + Unclosed string + Chaine de caractères non refermée + + + + Directive + Directive + + + + Bad directive + Mauvaise directive + + + + Objects, CSG and appearance + Objets, CSG et apparence + + + + Types, modifiers and items + Types, modifieurs et éléments + + + + Predefined identifiers + Identifiants prédéfinis + + + + Predefined functions + Fonctions prédéfinies + + + + User defined 1 + Définition utilisateur 1 + + + + User defined 2 + Définition utilisateur 2 + + + + User defined 3 + Définition utilisateur 3 + + + + QsciLexerPascal + + + Default + Par défaut + + + + Line comment + Commentaire de ligne + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + '{ ... }' style comment + + + + + '(* ... *)' style comment + + + + + '{$ ... }' style pre-processor block + + + + + '(*$ ... *)' style pre-processor block + + + + + Hexadecimal number + + + + + Unclosed string + Chaine de caractères non refermée + + + + Character + Caractère + + + + Inline asm + + + + + QsciLexerPerl + + + Default + Par défaut + + + + Error + Erreur + + + + Comment + Commentaire + + + + POD + POD + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Scalar + Scalaire + + + + Array + Tableau + + + + Hash + Hashage + + + + Symbol table + Table de symboles + + + + Regular expression + Expression régulière + + + + Substitution + Substitution + + + + Backticks + Quotes inverses + + + + Data section + Section de données + + + + Here document delimiter + Délimiteur de texte intégré (cat <<EOF....EOF) + + + + Single-quoted here document + Document intégré guillemets simples + + + + Double-quoted here document + Document intégré guillemets doubles + + + + Backtick here document + Document intégré quotes inverses + + + + Quoted string (q) + Chaine quotée (q) + + + + Quoted string (qq) + Chaine quotée (qq) + + + + Quoted string (qx) + Chaine quotée (qx) + + + + Quoted string (qr) + Chaine quotée (qr) + + + + Quoted string (qw) + Chaine quotée (qw) + + + + POD verbatim + POD verbatim + + + + Subroutine prototype + + + + + Format identifier + + + + + Format body + + + + + Double-quoted string (interpolated variable) + + + + + Translation + + + + + Regular expression (interpolated variable) + + + + + Substitution (interpolated variable) + + + + + Backticks (interpolated variable) + + + + + Double-quoted here document (interpolated variable) + + + + + Backtick here document (interpolated variable) + + + + + Quoted string (qq, interpolated variable) + + + + + Quoted string (qx, interpolated variable) + + + + + Quoted string (qr, interpolated variable) + + + + + QsciLexerPostScript + + + Default + Par défaut + + + + Comment + Commentaire + + + + DSC comment + + + + + DSC comment value + + + + + Number + Nombre + + + + Name + + + + + Keyword + Mot-clé + + + + Literal + + + + + Immediately evaluated literal + + + + + Array parenthesis + + + + + Dictionary parenthesis + + + + + Procedure parenthesis + + + + + Text + Texte + + + + Hexadecimal string + + + + + Base85 string + + + + + Bad string character + + + + + QsciLexerProperties + + + Default + Par défaut + + + + Comment + Commentaire + + + + Section + Section + + + + Assignment + Affectation + + + + Default value + Valeur par défaut + + + + Key + + + + + QsciLexerPython + + + Default + Par défaut + + + + Comment + Commentaire + + + + Number + Nombre + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Keyword + Mot-clé + + + + Triple single-quoted string + Chaine de caractères HTML (guillemets simples) + + + + Triple double-quoted string + Chaine de caractères HTML (guillemets simples) + + + + Class name + Nom de classe + + + + Function or method name + Nom de méthode ou de fonction + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Comment block + Block de commentaires + + + + Unclosed string + Chaine de caractères non refermée + + + + Highlighted identifier + + + + + Decorator + + + + + QsciLexerRuby + + + Default + Par défaut + + + + Comment + Commentaire + + + + Number + Nombre + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Keyword + Mot-clé + + + + Class name + Nom de classe + + + + Function or method name + Nom de méthode ou de fonction + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Error + Erreur + + + + POD + POD + + + + Regular expression + Expression régulière + + + + Global + + + + + Symbol + Symbole + + + + Module name + + + + + Instance variable + + + + + Class variable + + + + + Backticks + Quotes inverses + + + + Data section + Section de données + + + + Here document delimiter + Délimiteur de texte intégré (cat <<EOF....EOF) + + + + Here document + + + + + %q string + + + + + %Q string + + + + + %x string + + + + + %r string + + + + + %w string + + + + + Demoted keyword + + + + + stdin + + + + + stdout + + + + + stderr + + + + + QsciLexerSQL + + + Default + Par défaut + + + + Comment + Commentaire + + + + Number + Nombre + + + + Keyword + Mot-clé + + + + Single-quoted string + Chaine de caractères (guillemets simples) + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Comment line + Ligne commentée + + + + JavaDoc style comment + Commentaire style JavaDoc + + + + Double-quoted string + Chaine de caractères (guillemets doubles) + + + + SQL*Plus keyword + Mot-clé SQL*Plus + + + + SQL*Plus prompt + Prompt SQL*Plus + + + + SQL*Plus comment + Commentaire SQL*Plus + + + + # comment line + # Ligne commentée + + + + JavaDoc keyword + Mot-clé JavaDoc + + + + JavaDoc keyword error + Erreur de mot-clé JavaDoc + + + + User defined 1 + Définition utilisateur 1 + + + + User defined 2 + Définition utilisateur 2 + + + + User defined 3 + Définition utilisateur 3 + + + + User defined 4 + Définition utilisateur 4 + + + + Quoted identifier + + + + + Quoted operator + + + + + QsciLexerSpice + + + Default + Par défaut + + + + Identifier + Identificateur + + + + Command + Commande + + + + Function + + + + + Parameter + + + + + Number + Nombre + + + + Delimiter + + + + + Value + Valeur + + + + Comment + Commentaire + + + + QsciLexerTCL + + + Default + Par défaut + + + + Comment + Commentaire + + + + Comment line + Ligne commentée + + + + Number + Nombre + + + + Quoted keyword + + + + + Quoted string + + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Substitution + Substitution + + + + Brace substitution + + + + + Modifier + + + + + Expand keyword + + + + + TCL keyword + + + + + Tk keyword + + + + + iTCL keyword + + + + + Tk command + + + + + User defined 1 + Définition utilisateur 1 + + + + User defined 2 + Définition utilisateur 2 + + + + User defined 3 + Définition utilisateur 3 + + + + User defined 4 + Définition utilisateur 4 + + + + Comment box + + + + + Comment block + Block de commentaires + + + + QsciLexerTeX + + + Default + Par défaut + + + + Special + Spécial + + + + Group + Groupe + + + + Symbol + Symbole + + + + Command + Commande + + + + Text + Texte + + + + QsciLexerVHDL + + + Default + Par défaut + + + + Comment + Commentaire + + + + Comment line + Ligne commentée + + + + Number + Nombre + + + + String + Chaîne de caractères + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Unclosed string + Chaine de caractères non refermée + + + + Keyword + Mot-clé + + + + Standard operator + + + + + Attribute + Attribut + + + + Standard function + + + + + Standard package + + + + + Standard type + + + + + User defined + + + + + Comment block + Block de commentaires + + + + QsciLexerVerilog + + + Default + Par défaut + + + + Comment + Commentaire + + + + Line comment + Commentaire de ligne + + + + Bang comment + + + + + Number + Nombre + + + + Primary keywords and identifiers + + + + + String + Chaîne de caractères + + + + Secondary keywords and identifiers + Seconds mots-clés et identificateurs + + + + System task + + + + + Preprocessor block + + + + + Operator + Opérateur + + + + Identifier + Identificateur + + + + Unclosed string + Chaine de caractères non refermée + + + + User defined tasks and identifiers + + + + + Keyword comment + + + + + Inactive keyword comment + + + + + Input port declaration + + + + + Inactive input port declaration + + + + + Output port declaration + + + + + Inactive output port declaration + + + + + Input/output port declaration + + + + + Inactive input/output port declaration + + + + + Port connection + + + + + Inactive port connection + + + + + QsciLexerYAML + + + Default + Par défaut + + + + Comment + Commentaire + + + + Identifier + Identificateur + + + + Keyword + Mot-clé + + + + Number + Nombre + + + + Reference + + + + + Document delimiter + + + + + Text block marker + + + + + Syntax error marker + + + + + Operator + Opérateur + + + + QsciScintilla + + + &Undo + + + + + &Redo + + + + + Cu&t + + + + + &Copy + + + + + &Paste + + + + + Delete + + + + + Select All + + + + diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.qm b/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.qm new file mode 100644 index 000000000..5e3e517e6 Binary files /dev/null and b/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.qm differ diff --git a/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.ts b/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.ts new file mode 100644 index 000000000..dc1cd87d2 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.ts @@ -0,0 +1,3702 @@ + + + + + QsciCommand + + + Move down one line + Mover uma linha para baixo + + + + Extend selection down one line + Extender a seleção uma linha para baixo + + + + Scroll view down one line + Descer a visão uma linha para baixo + + + + Extend rectangular selection down one line + Extender a seleção retangular uma linha para baixo + + + + Move up one line + Mover uma linha para cima + + + + Extend selection up one line + Extender a seleção uma linha para cima + + + + Scroll view up one line + Subir a visão uma linha para cima + + + + Extend rectangular selection up one line + Extender a seleção retangular uma linha para cima + + + + Move up one paragraph + Mover um paragrafo para cima + + + + Extend selection up one paragraph + Extender a seleção um paragrafo para cima + + + + Move down one paragraph + Mover um paragrafo para baixo + + + + Scroll to start of document + + + + + Scroll to end of document + + + + + Scroll vertically to centre current line + + + + + Extend selection down one paragraph + Extender a seleção um paragrafo para baixo + + + + Move left one character + Mover um caractere para a esquerda + + + + Extend selection left one character + Extender a seleção um caractere para esquerda + + + + Move left one word + Mover uma palavra para esquerda + + + + Extend selection left one word + Extender a seleção uma palavra para esquerda + + + + Extend rectangular selection left one character + Extender a seleção retangular um caractere para esquerda + + + + Move right one character + Mover um caractere para direita + + + + Extend selection right one character + Extender a seleção um caractere para direita + + + + Move right one word + Mover uma palavra para direita + + + + Extend selection right one word + Extender a seleção uma palavra para direita + + + + Extend rectangular selection right one character + Extender a seleção retangular um caractere para direita + + + + Move to end of previous word + + + + + Extend selection to end of previous word + + + + + Move to end of next word + + + + + Extend selection to end of next word + + + + + Move left one word part + Mover uma parte da palavra para esquerda + + + + Extend selection left one word part + Extender a seleção uma parte de palavra para esquerda + + + + Move right one word part + Mover uma parte da palavra para direita + + + + Extend selection right one word part + Extender a seleção uma parte de palavra para direita + + + + Move up one page + Mover uma página para cima + + + + Extend selection up one page + Extender a seleção uma página para cima + + + + Extend rectangular selection up one page + Extender a seleção retangular uma página para cima + + + + Move down one page + Mover uma página para baixo + + + + Extend selection down one page + Extender a seleção uma página para baixo + + + + Extend rectangular selection down one page + Extender a seleção retangular uma página para baixo + + + + Delete current character + Excluir caractere atual + + + + Cut selection + Recortar seleção + + + + Delete word to right + Excluir palavra para direita + + + + Move to start of document line + + + + + Extend selection to start of document line + + + + + Extend rectangular selection to start of document line + + + + + Move to start of display line + + + + + Extend selection to start of display line + + + + + Move to start of display or document line + + + + + Extend selection to start of display or document line + + + + + Move to first visible character in document line + + + + + Extend selection to first visible character in document line + + + + + Extend rectangular selection to first visible character in document line + + + + + Move to first visible character of display in document line + + + + + Extend selection to first visible character in display or document line + + + + + Move to end of document line + + + + + Extend selection to end of document line + + + + + Extend rectangular selection to end of document line + + + + + Move to end of display line + + + + + Extend selection to end of display line + + + + + Move to end of display or document line + + + + + Extend selection to end of display or document line + + + + + Move to start of document + + + + + Extend selection to start of document + + + + + Move to end of document + + + + + Extend selection to end of document + + + + + Stuttered move up one page + + + + + Stuttered extend selection up one page + + + + + Stuttered move down one page + + + + + Stuttered extend selection down one page + + + + + Delete previous character if not at start of line + + + + + Delete right to end of next word + + + + + Delete line to right + Excluir linha para direita + + + + Transpose current and previous lines + + + + + Duplicate the current line + + + + + Select all + Select document + + + + + Move selected lines up one line + + + + + Move selected lines down one line + + + + + Toggle insert/overtype + Alternar entre modo de inserir/sobreescrever + + + + Paste + Copiar + + + + Copy selection + Copiar seleção + + + + Insert newline + + + + + De-indent one level + + + + + Cancel + Cancelar + + + + Delete previous character + Excluir caractere anterior + + + + Delete word to left + Excluir palavra a esquerda + + + + Delete line to left + Excluir linha a esquerda + + + + Undo last command + + + + + Redo last command + Refazer último comando + + + + Indent one level + Indentar um nível + + + + Zoom in + Aumentar zoom + + + + Zoom out + Diminuir zoom + + + + Formfeed + Alimentação da Página + + + + Cut current line + Configurar linha atual + + + + Delete current line + Excluir linha atual + + + + Copy current line + Copiar linha atual + + + + Convert selection to lower case + Converter a seleção para minúscula + + + + Convert selection to upper case + Converter a seleção para maiúscula + + + + Duplicate selection + + + + + QsciLexerAVS + + + Default + Padrão + + + + Block comment + + + + + Nested block comment + + + + + Line comment + Comentar Linha + + + + Number + Número + + + + Operator + Operador + + + + Identifier + Identificador + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Triple double-quoted string + Cadeia de caracteres envolvida por três aspas duplas + + + + Keyword + Palavra Chave + + + + Filter + + + + + Plugin + + + + + Function + + + + + Clip property + + + + + User defined + + + + + QsciLexerBash + + + Default + Padrão + + + + Error + Número + + + + Comment + Comentário + + + + Number + Número + + + + Keyword + Palavra Chave + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Scalar + Escalar + + + + Parameter expansion + Parâmetro de Expansão + + + + Backticks + Aspas Invertidas + + + + Here document delimiter + Delimitador de "here documents" + + + + Single-quoted here document + "here document" envolvido por aspas simples + + + + QsciLexerBatch + + + Default + Padrão + + + + Comment + Comentário + + + + Keyword + Palavra Chave + + + + Label + Rótulo + + + + Hide command character + Esconder caractere de comando + + + + External command + Comando externo + + + + Variable + Variável + + + + Operator + Operador + + + + QsciLexerCMake + + + Default + Padrão + + + + Comment + Comentário + + + + String + Cadeia de Caracteres + + + + Left quoted string + + + + + Right quoted string + + + + + Function + + + + + Variable + Variável + + + + Label + Rótulo + + + + User defined + + + + + WHILE block + + + + + FOREACH block + + + + + IF block + + + + + MACRO block + + + + + Variable within a string + + + + + Number + Número + + + + QsciLexerCPP + + + Default + Padrão + + + + Inactive default + + + + + C comment + Comentário C + + + + Inactive C comment + + + + + C++ comment + Comentário C++ + + + + Inactive C++ comment + + + + + JavaDoc style C comment + Comentário JavaDoc estilo C + + + + Inactive JavaDoc style C comment + + + + + Number + Número + + + + Inactive number + + + + + Keyword + Palavra Chave + + + + Inactive keyword + + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Inactive double-quoted string + + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Inactive single-quoted string + + + + + IDL UUID + + + + + Inactive IDL UUID + + + + + Pre-processor block + Instruções de pré-processamento + + + + Inactive pre-processor block + + + + + Operator + Operador + + + + Inactive operator + + + + + Identifier + Identificador + + + + Inactive identifier + + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Inactive unclosed string + + + + + C# verbatim string + + + + + Inactive C# verbatim string + + + + + JavaScript regular expression + Expressão regular JavaScript + + + + Inactive JavaScript regular expression + + + + + JavaDoc style C++ comment + Comentário JavaDoc estilo C++ + + + + Inactive JavaDoc style C++ comment + + + + + Secondary keywords and identifiers + Identificadores e palavras chave secundárias + + + + Inactive secondary keywords and identifiers + + + + + JavaDoc keyword + Palavra chave JavaDoc + + + + Inactive JavaDoc keyword + + + + + JavaDoc keyword error + Erro de palavra chave do JavaDoc + + + + Inactive JavaDoc keyword error + + + + + Global classes and typedefs + Classes e definições de tipo globais + + + + Inactive global classes and typedefs + + + + + C++ raw string + + + + + Inactive C++ raw string + + + + + Vala triple-quoted verbatim string + + + + + Inactive Vala triple-quoted verbatim string + + + + + Pike hash-quoted string + + + + + Inactive Pike hash-quoted string + + + + + Pre-processor C comment + + + + + Inactive pre-processor C comment + + + + + JavaDoc style pre-processor comment + + + + + Inactive JavaDoc style pre-processor comment + + + + + User-defined literal + + + + + Inactive user-defined literal + + + + + Task marker + + + + + Inactive task marker + + + + + Escape sequence + + + + + Inactive escape sequence + + + + + QsciLexerCSS + + + Default + Padrão + + + + Tag + Marcador + + + + Class selector + Seletor de classe + + + + Pseudo-class + Pseudo-classe + + + + Unknown pseudo-class + Pseudo-classe desconhecida + + + + Operator + Operador + + + + CSS1 property + Propriedade CSS1 + + + + Unknown property + Propriedade desconhecida + + + + Value + Valor + + + + ID selector + Seletor de ID + + + + Important + Importante + + + + @-rule + regra-@ + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + CSS2 property + Propriedade CSS2 + + + + Attribute + Atributo + + + + CSS3 property + Propriedade CSS2 {3 ?} + + + + Pseudo-element + + + + + Extended CSS property + + + + + Extended pseudo-class + + + + + Extended pseudo-element + + + + + Media rule + + + + + Variable + Variável + + + + QsciLexerCSharp + + + Verbatim string + Cadeia de caracteres no formato verbatim + + + + QsciLexerCoffeeScript + + + Default + Padrão + + + + C-style comment + + + + + C++-style comment + + + + + JavaDoc C-style comment + + + + + Number + Número + + + + Keyword + Palavra Chave + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + IDL UUID + + + + + Pre-processor block + Instruções de pré-processamento + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadeia de caracteres não fechada + + + + C# verbatim string + + + + + Regular expression + Expressão Regular + + + + JavaDoc C++-style comment + + + + + Secondary keywords and identifiers + Identificadores e palavras chave secundárias + + + + JavaDoc keyword + Palavra chave JavaDoc + + + + JavaDoc keyword error + Erro de palavra chave do JavaDoc + + + + Global classes + + + + + Block comment + + + + + Block regular expression + + + + + Block regular expression comment + + + + + QsciLexerD + + + Default + Padrão + + + + Block comment + + + + + Line comment + Comentar Linha + + + + DDoc style block comment + + + + + Nesting comment + + + + + Number + Número + + + + Keyword + Palavra Chave + + + + Secondary keyword + + + + + Documentation keyword + + + + + Type definition + + + + + String + Cadeia de Caracteres + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Character + Caractere + + + + Operator + Operador + + + + Identifier + Identificador + + + + DDoc style line comment + + + + + DDoc keyword + Palavra chave JavaDoc + + + + DDoc keyword error + Erro de palavra chave do JavaDoc + + + + Backquoted string + + + + + Raw string + + + + + User defined 1 + Definição de usuário 1 + + + + User defined 2 + Definição de usuário 2 + + + + User defined 3 + Definição de usuário 3 + + + + QsciLexerDiff + + + Default + Padrão + + + + Comment + Comentário + + + + Command + Comando + + + + Header + Cabeçalho + + + + Position + Posição + + + + Removed line + Linha Removida + + + + Added line + Linha Adicionada + + + + Changed line + + + + + QsciLexerFortran77 + + + Default + Padrão + + + + Comment + Comentário + + + + Number + Número + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Operator + Operador + + + + Identifier + Identificador + + + + Keyword + Palavra Chave + + + + Intrinsic function + + + + + Extended function + + + + + Pre-processor block + Instruções de pré-processamento + + + + Dotted operator + + + + + Label + Rótulo + + + + Continuation + + + + + QsciLexerHTML + + + HTML default + HTML por padrão + + + + Tag + Marcador + + + + Unknown tag + Marcador desconhecido + + + + Attribute + Atributo + + + + Unknown attribute + Atributo desconhecido + + + + HTML number + Número HTML + + + + HTML double-quoted string + Cadeia de caracteres HTML envolvida por aspas duplas + + + + HTML single-quoted string + Cadeia de caracteres HTML envolvida por aspas simples + + + + Other text in a tag + Outro texto em um marcador + + + + HTML comment + Comentário HTML + + + + Entity + Entidade + + + + End of a tag + Final de um marcador + + + + Start of an XML fragment + Início de um bloco XML + + + + End of an XML fragment + Final de um bloco XML + + + + Script tag + Marcador de script + + + + Start of an ASP fragment with @ + Início de um bloco ASP com @ + + + + Start of an ASP fragment + Início de um bloco ASP + + + + CDATA + CDATA + + + + Start of a PHP fragment + Início de um bloco PHP + + + + Unquoted HTML value + Valor HTML não envolvido por aspas + + + + ASP X-Code comment + Comentário ASP X-Code + + + + SGML default + SGML por padrão + + + + SGML command + Comando SGML + + + + First parameter of an SGML command + Primeiro parâmetro em um comando SGML + + + + SGML double-quoted string + Cadeia de caracteres SGML envolvida por aspas duplas + + + + SGML single-quoted string + Cadeia de caracteres SGML envolvida por aspas simples + + + + SGML error + Erro SGML + + + + SGML special entity + Entidade especial SGML + + + + SGML comment + Comando SGML + + + + First parameter comment of an SGML command + Primeiro comentário de parâmetro de uma comando SGML + + + + SGML block default + Bloco SGML por padrão + + + + Start of a JavaScript fragment + Início de um bloco Javascript + + + + JavaScript default + JavaScript por padrão + + + + JavaScript comment + Comentário JavaScript + + + + JavaScript line comment + Comentário de linha JavaScript + + + + JavaDoc style JavaScript comment + Comentário JavaScript no estilo JavaDoc + + + + JavaScript number + Número JavaScript + + + + JavaScript word + Palavra JavaScript + + + + JavaScript keyword + Palavra chave JavaScript + + + + JavaScript double-quoted string + Cadeia de caracteres JavaScript envolvida por aspas duplas + + + + JavaScript single-quoted string + Cadeia de caracteres JavaScript envolvida por aspas simples + + + + JavaScript symbol + Símbolo JavaScript + + + + JavaScript unclosed string + Cadeia de caracteres JavaScript não fechada + + + + JavaScript regular expression + Expressão regular JavaScript + + + + Start of an ASP JavaScript fragment + Início de um bloco Javascript ASP + + + + ASP JavaScript default + JavaScript ASP por padrão + + + + ASP JavaScript comment + Comentário JavaScript ASP + + + + ASP JavaScript line comment + Comentário de linha JavaScript ASP + + + + JavaDoc style ASP JavaScript comment + Comentário JavaScript ASP no estilo JavaDoc + + + + ASP JavaScript number + Número JavaScript ASP + + + + ASP JavaScript word + Palavra chave JavaScript ASP + + + + ASP JavaScript keyword + Palavra chave JavaScript ASP + + + + ASP JavaScript double-quoted string + Cadeia de caracteres JavaScript ASP envolvida por aspas duplas + + + + ASP JavaScript single-quoted string + Cadeia de caracteres JavaScript ASP envolvida por aspas simples + + + + ASP JavaScript symbol + Símbolo JavaScript ASP + + + + ASP JavaScript unclosed string + Cadeia de caracteres JavaScript ASP não fechada + + + + ASP JavaScript regular expression + Expressão regular JavaScript ASP + + + + Start of a VBScript fragment + Início de um bloco VBScript + + + + VBScript default + VBScript por padrão + + + + VBScript comment + Comentário VBScript + + + + VBScript number + Número VBScript + + + + VBScript keyword + Palavra chave VBScript + + + + VBScript string + Cadeia de caracteres VBScript + + + + VBScript identifier + Identificador VBScript + + + + VBScript unclosed string + Cadeia de caracteres VBScript não fechada + + + + Start of an ASP VBScript fragment + Início de um bloco VBScript ASP + + + + ASP VBScript default + VBScript ASP por padrão + + + + ASP VBScript comment + Comentário VBScript ASP + + + + ASP VBScript number + Número VBScript ASP + + + + ASP VBScript keyword + Palavra chave VBScript ASP + + + + ASP VBScript string + Cadeia de caracteres VBScript ASP + + + + ASP VBScript identifier + Identificador VBScript ASP + + + + ASP VBScript unclosed string + Cadeia de caracteres VBScript ASP não fechada + + + + Start of a Python fragment + Início de um bloco Python + + + + Python default + Python por padrão + + + + Python comment + Comentário Python + + + + Python number + Número Python + + + + Python double-quoted string + Cadeia de caracteres Python envolvida por aspas duplas + + + + Python single-quoted string + Cadeia de caracteres Python envolvida por aspas simples + + + + Python keyword + Palavra chave Python + + + + Python triple double-quoted string + Cadeia de caracteres Python envolvida por aspas triplas duplas + + + + Python triple single-quoted string + Cadeia de caracteres Python envolvida por aspas triplas simples + + + + Python class name + Nome de classe Python + + + + Python function or method name + Nome de método ou função Python + + + + Python operator + Operador Python + + + + Python identifier + Identificador Python + + + + Start of an ASP Python fragment + Início de um bloco Python ASP + + + + ASP Python default + Python ASP por padrão + + + + ASP Python comment + Comentário Python ASP + + + + ASP Python number + Número Python ASP + + + + ASP Python double-quoted string + Cadeia de caracteres Python ASP envolvida por aspas duplas + + + + ASP Python single-quoted string + Cadeia de caracteres Python ASP envolvida por aspas simples + + + + ASP Python keyword + Palavra chave Python ASP + + + + ASP Python triple double-quoted string + Cadeia de caracteres Python ASP envolvida por aspas triplas duplas + + + + ASP Python triple single-quoted string + Cadeia de caracteres Python ASP envolvida por aspas triplas simples + + + + ASP Python class name + Nome de classe Python ASP + + + + ASP Python function or method name + Nome de método ou função Python ASP + + + + ASP Python operator + Operador Python ASP + + + + ASP Python identifier + Identificador Python ASP + + + + PHP default + PHP por padrão + + + + PHP double-quoted string + Cadeia de caracteres PHP envolvida por aspas duplas + + + + PHP single-quoted string + Cadeia de caracteres PHP envolvida por aspas simples + + + + PHP keyword + Palavra chave PHP + + + + PHP number + Número PHP + + + + PHP variable + Variável PHP + + + + PHP comment + Comentário PHP + + + + PHP line comment + Comentário de linha PHP + + + + PHP double-quoted variable + Variável PHP envolvida por aspas duplas + + + + PHP operator + Operador PHP + + + + QsciLexerIDL + + + UUID + UUID + + + + QsciLexerJavaScript + + + Regular expression + Expressão Regular + + + + QsciLexerLua + + + Default + Padrão + + + + Comment + Comentário + + + + Line comment + Comentar Linha + + + + Number + Número + + + + Keyword + Palavra Chave + + + + String + Cadeia de Caracteres + + + + Character + Caractere + + + + Literal string + Cadeia de caracteres literal + + + + Preprocessor + Preprocessador + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Basic functions + Funções básicas + + + + String, table and maths functions + Funções de cadeia de caracteres e de tabelas matemáticas + + + + Coroutines, i/o and system facilities + Funções auxiiares, e/s e funções de sistema + + + + User defined 1 + Definição de usuário 1 + + + + User defined 2 + Definição de usuário 2 + + + + User defined 3 + Definição de usuário 3 + + + + User defined 4 + Definição de usuário 4 + + + + Label + Rótulo + + + + QsciLexerMakefile + + + Default + Padrão + + + + Comment + Comentário + + + + Preprocessor + Preprocessador + + + + Variable + Variável + + + + Operator + Operador + + + + Target + Destino + + + + Error + Erro + + + + QsciLexerMatlab + + + Default + Padrão + + + + Comment + Comentário + + + + Command + Comando + + + + Number + Número + + + + Keyword + Palavra Chave + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + QsciLexerPO + + + Default + Padrão + + + + Comment + Comentário + + + + Message identifier + + + + + Message identifier text + + + + + Message string + + + + + Message string text + + + + + Message context + + + + + Message context text + + + + + Fuzzy flag + + + + + Programmer comment + + + + + Reference + + + + + Flags + + + + + Message identifier text end-of-line + + + + + Message string text end-of-line + + + + + Message context text end-of-line + + + + + QsciLexerPOV + + + Default + Padrão + + + + Comment + Comentário + + + + Comment line + Comentar Linha + + + + Number + Número + + + + Operator + Operador + + + + Identifier + Identificador + + + + String + Cadeia de Caracteres + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Directive + Diretiva + + + + Bad directive + Diretiva ruim + + + + Objects, CSG and appearance + Objetos, CSG e aparência + + + + Types, modifiers and items + Tipos, modificadores e itens + + + + Predefined identifiers + Identificadores predefinidos + + + + Predefined functions + Funções predefinidas + + + + User defined 1 + Definição de usuário 1 + + + + User defined 2 + Definição de usuário 2 + + + + User defined 3 + Definição de usuário 3 + + + + QsciLexerPascal + + + Default + Padrão + + + + Line comment + Comentar Linha + + + + Number + Número + + + + Keyword + Palavra Chave + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + '{ ... }' style comment + + + + + '(* ... *)' style comment + + + + + '{$ ... }' style pre-processor block + + + + + '(*$ ... *)' style pre-processor block + + + + + Hexadecimal number + + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Character + Caractere + + + + Inline asm + + + + + QsciLexerPerl + + + Default + Padrão + + + + Error + Erro + + + + Comment + Comentário + + + + POD + POD + + + + Number + Número + + + + Keyword + Palavra Chave + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Scalar + Escalar + + + + Array + Vetor + + + + Hash + Hash + + + + Symbol table + Tabela de Símbolos + + + + Regular expression + Expressão Regular + + + + Substitution + Substituição + + + + Backticks + Aspas Invertidas + + + + Data section + Seção de dados + + + + Here document delimiter + Delimitador de documentos criados através de redicionadores (>> e >) + + + + Single-quoted here document + "here document" envolvido por aspas simples + + + + Double-quoted here document + "here document" envolvido por aspas duplas + + + + Backtick here document + "here document" envolvido por aspas invertidas + + + + Quoted string (q) + Cadeia de caracteres envolvida por aspas (q) + + + + Quoted string (qq) + Cadeia de caracteres envolvida por aspas (qq) + + + + Quoted string (qx) + Cadeia de caracteres envolvida por aspas (qx) + + + + Quoted string (qr) + Cadeia de caracteres envolvida por aspas (qr) + + + + Quoted string (qw) + Cadeia de caracteres envolvida por aspas (qw) + + + + POD verbatim + POD em formato verbatim + + + + Subroutine prototype + + + + + Format identifier + + + + + Format body + + + + + Double-quoted string (interpolated variable) + + + + + Translation + + + + + Regular expression (interpolated variable) + + + + + Substitution (interpolated variable) + + + + + Backticks (interpolated variable) + + + + + Double-quoted here document (interpolated variable) + + + + + Backtick here document (interpolated variable) + + + + + Quoted string (qq, interpolated variable) + + + + + Quoted string (qx, interpolated variable) + + + + + Quoted string (qr, interpolated variable) + + + + + QsciLexerPostScript + + + Default + Padrão + + + + Comment + Comentário + + + + DSC comment + + + + + DSC comment value + + + + + Number + Número + + + + Name + + + + + Keyword + Palavra Chave + + + + Literal + + + + + Immediately evaluated literal + + + + + Array parenthesis + + + + + Dictionary parenthesis + + + + + Procedure parenthesis + + + + + Text + Texto + + + + Hexadecimal string + + + + + Base85 string + + + + + Bad string character + + + + + QsciLexerProperties + + + Default + Padrão + + + + Comment + Comentário + + + + Section + Seção + + + + Assignment + Atribuição + + + + Default value + Valor Padrão + + + + Key + + + + + QsciLexerPython + + + Default + Padrão + + + + Comment + Comentário + + + + Number + Número + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Keyword + Palavra Chave + + + + Triple single-quoted string + Cadeia de caracteres envolvida por três aspas simples + + + + Triple double-quoted string + Cadeia de caracteres envolvida por três aspas duplas + + + + Class name + Nome da classe + + + + Function or method name + Nome da função ou método + + + + Operator + Operador + + + + Identifier + Identificador + + + + Comment block + Bloco de comentários + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Highlighted identifier + + + + + Decorator + + + + + QsciLexerRuby + + + Default + Padrão + + + + Comment + Comentário + + + + Number + Número + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Keyword + Palavra Chave + + + + Class name + Nome da classe + + + + Function or method name + Nome da função ou método + + + + Operator + Operador + + + + Identifier + Identificador + + + + Error + + + + + POD + POD + + + + Regular expression + Expressão Regular + + + + Global + + + + + Symbol + Símbolo + + + + Module name + + + + + Instance variable + + + + + Class variable + + + + + Backticks + Aspas Invertidas + + + + Data section + Seção de dados + + + + Here document delimiter + + + + + Here document + + + + + %q string + + + + + %Q string + + + + + %x string + + + + + %r string + + + + + %w string + + + + + Demoted keyword + + + + + stdin + + + + + stdout + + + + + stderr + + + + + QsciLexerSQL + + + Default + Padrão + + + + Comment + Comentário + + + + Number + Número + + + + Keyword + Palavra Chave + + + + Single-quoted string + Cadeia de caracteres envolvida por aspas simples + + + + Operator + Operador + + + + Identifier + Identificador + + + + Comment line + Comentário de Linha + + + + JavaDoc style comment + Comentário estilo JavaDoc + + + + Double-quoted string + Cadeia de caracteres envolvida por aspas duplas + + + + SQL*Plus keyword + Palavra chave do SQL*Plus + + + + SQL*Plus prompt + Prompt do SQL*Plus + + + + SQL*Plus comment + Comentário do SQL*Plus + + + + # comment line + Comentário de linha usando # + + + + JavaDoc keyword + Palavra chave JavaDoc + + + + JavaDoc keyword error + Erro de palavra chave do JavaDoc + + + + User defined 1 + Definição de usuário 1 + + + + User defined 2 + Definição de usuário 2 + + + + User defined 3 + Definição de usuário 3 + + + + User defined 4 + Definição de usuário 4 + + + + Quoted identifier + + + + + Quoted operator + + + + + QsciLexerSpice + + + Default + Padrão + + + + Identifier + Identificador + + + + Command + Comando + + + + Function + + + + + Parameter + + + + + Number + Número + + + + Delimiter + + + + + Value + Valor + + + + Comment + Comentário + + + + QsciLexerTCL + + + Default + Padrão + + + + Comment + Comentário + + + + Comment line + + + + + Number + Número + + + + Quoted keyword + + + + + Quoted string + + + + + Operator + Operador + + + + Identifier + Identificador + + + + Substitution + Substituição + + + + Brace substitution + + + + + Modifier + + + + + Expand keyword + + + + + TCL keyword + + + + + Tk keyword + + + + + iTCL keyword + + + + + Tk command + + + + + User defined 1 + Definição de usuário 1 + + + + User defined 2 + Definição de usuário 2 + + + + User defined 3 + Definição de usuário 3 + + + + User defined 4 + Definição de usuário 4 + + + + Comment box + + + + + Comment block + Bloco de comentários + + + + QsciLexerTeX + + + Default + Padrão + + + + Special + Especial + + + + Group + Grupo + + + + Symbol + Símbolo + + + + Command + Comando + + + + Text + Texto + + + + QsciLexerVHDL + + + Default + Padrão + + + + Comment + Comentário + + + + Comment line + + + + + Number + Número + + + + String + Cadeia de Caracteres + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadeia de caracteres não fechada + + + + Keyword + Palavra Chave + + + + Standard operator + + + + + Attribute + Atributo + + + + Standard function + + + + + Standard package + + + + + Standard type + + + + + User defined + + + + + Comment block + Bloco de comentários + + + + QsciLexerVerilog + + + Default + Padrão + + + + Comment + Comentário + + + + Line comment + Comentar Linha + + + + Bang comment + + + + + Number + Número + + + + Primary keywords and identifiers + + + + + String + Cadeia de Caracteres + + + + Secondary keywords and identifiers + Identificadores e palavras chave secundárias + + + + System task + + + + + Preprocessor block + + + + + Operator + Operador + + + + Identifier + Identificador + + + + Unclosed string + Cadeia de caracteres não fechada + + + + User defined tasks and identifiers + + + + + Keyword comment + + + + + Inactive keyword comment + + + + + Input port declaration + + + + + Inactive input port declaration + + + + + Output port declaration + + + + + Inactive output port declaration + + + + + Input/output port declaration + + + + + Inactive input/output port declaration + + + + + Port connection + + + + + Inactive port connection + + + + + QsciLexerYAML + + + Default + Padrão + + + + Comment + Comentário + + + + Identifier + Identificador + + + + Keyword + Palavra Chave + + + + Number + Número + + + + Reference + + + + + Document delimiter + + + + + Text block marker + + + + + Syntax error marker + + + + + Operator + Operador + + + + QsciScintilla + + + &Undo + + + + + &Redo + + + + + Cu&t + + + + + &Copy + + + + + &Paste + + + + + Delete + + + + + Select All + + + + diff --git a/libs/qscintilla/Qt4Qt5/qsciprinter.cpp b/libs/qscintilla/Qt4Qt5/qsciprinter.cpp new file mode 100644 index 000000000..061aca8df --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qsciprinter.cpp @@ -0,0 +1,186 @@ +// This module implements the QsciPrinter class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qsciprinter.h" + +#if !defined(QT_NO_PRINTER) + +#include +#include +#include + +#include "Qsci/qsciscintillabase.h" + + +// The ctor. +QsciPrinter::QsciPrinter(QPrinter::PrinterMode mode) + : QPrinter(mode), mag(0), wrap(QsciScintilla::WrapWord) +{ +} + + +// The dtor. +QsciPrinter::~QsciPrinter() +{ +} + + +// Format the page before the document text is drawn. +void QsciPrinter::formatPage(QPainter &, bool, QRect &, int) +{ +} + + +// Print a range of lines to a printer. +int QsciPrinter::printRange(QsciScintillaBase *qsb, int from, int to) +{ + // Sanity check. + if (!qsb) + return false; + + // Setup the printing area. + QRect def_area; + + def_area.setX(0); + def_area.setY(0); + def_area.setWidth(width()); + def_area.setHeight(height()); + + // Get the page range. + int pgFrom, pgTo; + + pgFrom = fromPage(); + pgTo = toPage(); + + // Find the position range. + long startPos, endPos; + + endPos = qsb->SendScintilla(QsciScintillaBase::SCI_GETLENGTH); + + startPos = (from > 0 ? qsb -> SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE,from) : 0); + + if (to >= 0) + { + long toPos = qsb -> SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE,to + 1); + + if (endPos > toPos) + endPos = toPos; + } + + if (startPos >= endPos) + return false; + + QPainter painter(this); + bool reverse = (pageOrder() == LastPageFirst); + bool needNewPage = false; + + qsb -> SendScintilla(QsciScintillaBase::SCI_SETPRINTMAGNIFICATION,mag); + qsb -> SendScintilla(QsciScintillaBase::SCI_SETPRINTWRAPMODE,wrap); + + for (int i = 1; i <= numCopies(); ++i) + { + // If we are printing in reverse page order then remember the start + // position of each page. + QStack pageStarts; + + int currPage = 1; + long pos = startPos; + + while (pos < endPos) + { + // See if we have finished the requested page range. + if (pgTo > 0 && pgTo < currPage) + break; + + // See if we are going to render this page, or just see how much + // would fit onto it. + bool render = false; + + if (pgFrom == 0 || pgFrom <= currPage) + { + if (reverse) + pageStarts.push(pos); + else + { + render = true; + + if (needNewPage) + { + if (!newPage()) + return false; + } + else + needNewPage = true; + } + } + + QRect area = def_area; + + formatPage(painter,render,area,currPage); + pos = qsb -> SendScintilla(QsciScintillaBase::SCI_FORMATRANGE,render,&painter,area,pos,endPos); + + ++currPage; + } + + // All done if we are printing in normal page order. + if (!reverse) + continue; + + // Now go through each page on the stack and really print it. + while (!pageStarts.isEmpty()) + { + --currPage; + + long ePos = pos; + pos = pageStarts.pop(); + + if (needNewPage) + { + if (!newPage()) + return false; + } + else + needNewPage = true; + + QRect area = def_area; + + formatPage(painter,true,area,currPage); + qsb->SendScintilla(QsciScintillaBase::SCI_FORMATRANGE,true,&painter,area,pos,ePos); + } + } + + return true; +} + + +// Set the print magnification in points. +void QsciPrinter::setMagnification(int magnification) +{ + mag = magnification; +} + + +// Set the line wrap mode. +void QsciPrinter::setWrapMode(QsciScintilla::WrapMode wmode) +{ + wrap = wmode; +} + +#endif diff --git a/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp b/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp new file mode 100644 index 000000000..92ebb0cb6 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp @@ -0,0 +1,4384 @@ +// This module implements the "official" high-level API of the Qt port of +// Scintilla. It is modelled on QTextEdit - a method of the same name should +// behave in the same way. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qsciscintilla.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Qsci/qsciabstractapis.h" +#include "Qsci/qscicommandset.h" +#include "Qsci/qscilexer.h" +#include "Qsci/qscistyle.h" +#include "Qsci/qscistyledtext.h" + + +// Make sure these match the values in Scintilla.h. We don't #include that +// file because it just causes more clashes. +#define KEYWORDSET_MAX 8 +#define MARKER_MAX 31 + +// The list separators for auto-completion and user lists. +const char acSeparator = '\x03'; +const char userSeparator = '\x04'; + +// The default fold margin width. +static const int defaultFoldMarginWidth = 14; + +// The default set of characters that make up a word. +static const char *defaultWordChars = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + + +// The ctor. +QsciScintilla::QsciScintilla(QWidget *parent) + : QsciScintillaBase(parent), + allocatedMarkers(0), allocatedIndicators(7), oldPos(-1), selText(false), + fold(NoFoldStyle), foldmargin(2), autoInd(false), + braceMode(NoBraceMatch), acSource(AcsNone), acThresh(-1), + wchars(defaultWordChars), call_tips_position(CallTipsBelowText), + call_tips_style(CallTipsNoContext), maxCallTips(-1), + use_single(AcusNever), explicit_fillups(""), fillups_enabled(false) +{ + connect(this,SIGNAL(SCN_MODIFYATTEMPTRO()), + SIGNAL(modificationAttempted())); + + connect(this,SIGNAL(SCN_MODIFIED(int,int,const char *,int,int,int,int,int,int,int)), + SLOT(handleModified(int,int,const char *,int,int,int,int,int,int,int))); + connect(this,SIGNAL(SCN_CALLTIPCLICK(int)), + SLOT(handleCallTipClick(int))); + connect(this,SIGNAL(SCN_CHARADDED(int)), + SLOT(handleCharAdded(int))); + connect(this,SIGNAL(SCN_INDICATORCLICK(int,int)), + SLOT(handleIndicatorClick(int,int))); + connect(this,SIGNAL(SCN_INDICATORRELEASE(int,int)), + SLOT(handleIndicatorRelease(int,int))); + connect(this,SIGNAL(SCN_MARGINCLICK(int,int,int)), + SLOT(handleMarginClick(int,int,int))); + connect(this,SIGNAL(SCN_SAVEPOINTREACHED()), + SLOT(handleSavePointReached())); + connect(this,SIGNAL(SCN_SAVEPOINTLEFT()), + SLOT(handleSavePointLeft())); + connect(this,SIGNAL(SCN_UPDATEUI(int)), + SLOT(handleUpdateUI(int))); + connect(this,SIGNAL(QSCN_SELCHANGED(bool)), + SLOT(handleSelectionChanged(bool))); + connect(this,SIGNAL(SCN_AUTOCSELECTION(const char *,int)), + SLOT(handleAutoCompletionSelection())); + connect(this,SIGNAL(SCN_USERLISTSELECTION(const char *,int)), + SLOT(handleUserListSelection(const char *,int))); + + // Set the default font. + setFont(QApplication::font()); + + // Set the default fore and background colours. + QPalette pal = QApplication::palette(); + setColor(pal.text().color()); + setPaper(pal.base().color()); + setSelectionForegroundColor(pal.highlightedText().color()); + setSelectionBackgroundColor(pal.highlight().color()); + +#if defined(Q_OS_WIN) + setEolMode(EolWindows); +#else + // Note that EolMac is pre-OS/X. + setEolMode(EolUnix); +#endif + + // Capturing the mouse seems to cause problems on multi-head systems. Qt + // should do the right thing anyway. + SendScintilla(SCI_SETMOUSEDOWNCAPTURES, 0UL); + + setMatchedBraceForegroundColor(Qt::blue); + setUnmatchedBraceForegroundColor(Qt::red); + + setAnnotationDisplay(AnnotationStandard); + setLexer(); + + // Set the visible policy. These are the same as SciTE's defaults + // which, presumably, are sensible. + SendScintilla(SCI_SETVISIBLEPOLICY, VISIBLE_STRICT | VISIBLE_SLOP, 4); + + // The default behaviour is unexpected. + SendScintilla(SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR, + SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE); + + // Create the standard command set. + stdCmds = new QsciCommandSet(this); + + doc.display(this,0); +} + + +// The dtor. +QsciScintilla::~QsciScintilla() +{ + // Detach any current lexer. + detachLexer(); + + doc.undisplay(this); + delete stdCmds; +} + + +// Return the current text colour. +QColor QsciScintilla::color() const +{ + return nl_text_colour; +} + + +// Set the text colour. +void QsciScintilla::setColor(const QColor &c) +{ + if (lex.isNull()) + { + // Assume style 0 applies to everything so that we don't need to use + // SCI_STYLECLEARALL which clears everything. + SendScintilla(SCI_STYLESETFORE, 0, c); + nl_text_colour = c; + } +} + + +// Return the overwrite mode. +bool QsciScintilla::overwriteMode() const +{ + return SendScintilla(SCI_GETOVERTYPE); +} + + +// Set the overwrite mode. +void QsciScintilla::setOverwriteMode(bool overwrite) +{ + SendScintilla(SCI_SETOVERTYPE, overwrite); +} + + +// Return the current paper colour. +QColor QsciScintilla::paper() const +{ + return nl_paper_colour; +} + + +// Set the paper colour. +void QsciScintilla::setPaper(const QColor &c) +{ + if (lex.isNull()) + { + // Assume style 0 applies to everything so that we don't need to use + // SCI_STYLECLEARALL which clears everything. We still have to set the + // default style as well for the background without any text. + SendScintilla(SCI_STYLESETBACK, 0, c); + SendScintilla(SCI_STYLESETBACK, STYLE_DEFAULT, c); + nl_paper_colour = c; + } +} + + +// Set the default font. +void QsciScintilla::setFont(const QFont &f) +{ + if (lex.isNull()) + { + // Assume style 0 applies to everything so that we don't need to use + // SCI_STYLECLEARALL which clears everything. + setStylesFont(f, 0); + QWidget::setFont(f); + } +} + + +// Enable/disable auto-indent. +void QsciScintilla::setAutoIndent(bool autoindent) +{ + autoInd = autoindent; +} + + +// Set the brace matching mode. +void QsciScintilla::setBraceMatching(BraceMatch bm) +{ + braceMode = bm; +} + + +// Handle the addition of a character. +void QsciScintilla::handleCharAdded(int ch) +{ + // Ignore if there is a selection. + long pos = SendScintilla(SCI_GETSELECTIONSTART); + + if (pos != SendScintilla(SCI_GETSELECTIONEND) || pos == 0) + return; + + // If auto-completion is already active then see if this character is a + // start character. If it is then create a new list which will be a subset + // of the current one. The case where it isn't a start character seems to + // be handled correctly elsewhere. + if (isListActive()) + { + if (isStartChar(ch)) + { + cancelList(); + startAutoCompletion(acSource, false, use_single == AcusAlways); + } + + return; + } + + // Handle call tips. + if (call_tips_style != CallTipsNone && !lex.isNull() && strchr("(),", ch) != NULL) + callTip(); + + // Handle auto-indentation. + if (autoInd) + if (lex.isNull() || (lex->autoIndentStyle() & AiMaintain)) + maintainIndentation(ch, pos); + else + autoIndentation(ch, pos); + + // See if we might want to start auto-completion. + if (!isCallTipActive() && acSource != AcsNone) + if (isStartChar(ch)) + startAutoCompletion(acSource, false, use_single == AcusAlways); + else if (acThresh >= 1 && isWordCharacter(ch)) + startAutoCompletion(acSource, true, use_single == AcusAlways); +} + + +// See if a call tip is active. +bool QsciScintilla::isCallTipActive() const +{ + return SendScintilla(SCI_CALLTIPACTIVE); +} + + +// Handle a possible change to any current call tip. +void QsciScintilla::callTip() +{ + QsciAbstractAPIs *apis = lex->apis(); + + if (!apis) + return; + + int pos, commas = 0; + bool found = false; + char ch; + + pos = SendScintilla(SCI_GETCURRENTPOS); + + // Move backwards through the line looking for the start of the current + // call tip and working out which argument it is. + while ((ch = getCharacter(pos)) != '\0') + { + if (ch == ',') + ++commas; + else if (ch == ')') + { + int depth = 1; + + // Ignore everything back to the start of the corresponding + // parenthesis. + while ((ch = getCharacter(pos)) != '\0') + { + if (ch == ')') + ++depth; + else if (ch == '(' && --depth == 0) + break; + } + } + else if (ch == '(') + { + found = true; + break; + } + } + + // Cancel any existing call tip. + SendScintilla(SCI_CALLTIPCANCEL); + + // Done if there is no new call tip to set. + if (!found) + return; + + QStringList context = apiContext(pos, pos, ctPos); + + if (context.isEmpty()) + return; + + // The last word is complete, not partial. + context << QString(); + + ct_cursor = 0; + ct_shifts.clear(); + ct_entries = apis->callTips(context, commas, call_tips_style, ct_shifts); + + int nr_entries = ct_entries.count(); + + if (nr_entries == 0) + return; + + if (maxCallTips > 0 && maxCallTips < nr_entries) + { + ct_entries = ct_entries.mid(0, maxCallTips); + nr_entries = maxCallTips; + } + + int shift; + QString ct; + + int nr_shifts = ct_shifts.count(); + + if (maxCallTips < 0 && nr_entries > 1) + { + shift = (nr_shifts > 0 ? ct_shifts.first() : 0); + ct = ct_entries[0]; + ct.prepend('\002'); + } + else + { + if (nr_shifts > nr_entries) + nr_shifts = nr_entries; + + // Find the biggest shift. + shift = 0; + + for (int i = 0; i < nr_shifts; ++i) + { + int sh = ct_shifts[i]; + + if (shift < sh) + shift = sh; + } + + ct = ct_entries.join("\n"); + } + + QByteArray ct_ba = ct.toLatin1(); + const char *cts = ct_ba.data(); + + SendScintilla(SCI_CALLTIPSHOW, adjustedCallTipPosition(shift), cts); + + // Done if there is more than one call tip. + if (nr_entries > 1) + return; + + // Highlight the current argument. + const char *astart; + + if (commas == 0) + astart = strchr(cts, '('); + else + for (astart = strchr(cts, ','); astart && --commas > 0; astart = strchr(astart + 1, ',')) + ; + + if (!astart || !*++astart) + return; + + // The end is at the next comma or unmatched closing parenthesis. + const char *aend; + int depth = 0; + + for (aend = astart; *aend; ++aend) + { + char ch = *aend; + + if (ch == ',' && depth == 0) + break; + else if (ch == '(') + ++depth; + else if (ch == ')') + { + if (depth == 0) + break; + + --depth; + } + } + + if (astart != aend) + SendScintilla(SCI_CALLTIPSETHLT, astart - cts, aend - cts); +} + + +// Handle a call tip click. +void QsciScintilla::handleCallTipClick(int dir) +{ + int nr_entries = ct_entries.count(); + + // Move the cursor while bounds checking. + if (dir == 1) + { + if (ct_cursor - 1 < 0) + return; + + --ct_cursor; + } + else if (dir == 2) + { + if (ct_cursor + 1 >= nr_entries) + return; + + ++ct_cursor; + } + else + return; + + int shift = (ct_shifts.count() > ct_cursor ? ct_shifts[ct_cursor] : 0); + QString ct = ct_entries[ct_cursor]; + + // Add the arrows. + if (ct_cursor < nr_entries - 1) + ct.prepend('\002'); + + if (ct_cursor > 0) + ct.prepend('\001'); + + SendScintilla(SCI_CALLTIPSHOW, adjustedCallTipPosition(shift), ct.toLatin1().data()); +} + + +// Shift the position of the call tip (to take any context into account) but +// don't go before the start of the line. +int QsciScintilla::adjustedCallTipPosition(int ctshift) const +{ + int ct = ctPos; + + if (ctshift) + { + int ctmin = SendScintilla(SCI_POSITIONFROMLINE, SendScintilla(SCI_LINEFROMPOSITION, ct)); + + if (ct - ctshift < ctmin) + ct = ctmin; + } + + return ct; +} + + +// Return the list of words that make up the context preceding the given +// position. The list will only have more than one element if there is a lexer +// set and it defines start strings. If so, then the last element might be +// empty if a start string has just been typed. On return pos is at the start +// of the context. +QStringList QsciScintilla::apiContext(int pos, int &context_start, + int &last_word_start) +{ + enum { + Either, + Separator, + Word + }; + + QStringList words; + int good_pos = pos, expecting = Either; + + last_word_start = -1; + + while (pos > 0) + { + if (getSeparator(pos)) + { + if (expecting == Either) + words.prepend(QString()); + else if (expecting == Word) + break; + + good_pos = pos; + expecting = Word; + } + else + { + QString word = getWord(pos); + + if (word.isEmpty() || expecting == Separator) + break; + + words.prepend(word); + good_pos = pos; + expecting = Separator; + + // Return the position of the start of the last word if required. + if (last_word_start < 0) + last_word_start = pos; + } + + // Strip any preceding spaces (mainly around operators). + char ch; + + while ((ch = getCharacter(pos)) != '\0') + { + // This is the same definition of space that Scintilla uses. + if (ch != ' ' && (ch < 0x09 || ch > 0x0d)) + { + ++pos; + break; + } + } + } + + // A valid sequence always starts with a word and so should be expecting a + // separator. + if (expecting != Separator) + words.clear(); + + context_start = good_pos; + + return words; +} + + +// Try and get a lexer's word separator from the text before the current +// position. Return true if one was found and adjust the position accordingly. +bool QsciScintilla::getSeparator(int &pos) const +{ + int opos = pos; + + // Go through each separator. + for (int i = 0; i < wseps.count(); ++i) + { + const QString &ws = wseps[i]; + + // Work backwards. + uint l; + + for (l = ws.length(); l; --l) + { + char ch = getCharacter(pos); + + if (ch == '\0' || ws.at(l - 1) != ch) + break; + } + + if (!l) + return true; + + // Reset for the next separator. + pos = opos; + } + + return false; +} + + +// Try and get a word from the text before the current position. Return the +// word if one was found and adjust the position accordingly. +QString QsciScintilla::getWord(int &pos) const +{ + QString word; + bool numeric = true; + char ch; + + while ((ch = getCharacter(pos)) != '\0') + { + if (!isWordCharacter(ch)) + { + ++pos; + break; + } + + if (ch < '0' || ch > '9') + numeric = false; + + word.prepend(ch); + } + + // We don't auto-complete numbers. + if (numeric) + word.truncate(0); + + return word; +} + + +// Get the "next" character (ie. the one before the current position) in the +// current line. The character will be '\0' if there are no more. +char QsciScintilla::getCharacter(int &pos) const +{ + if (pos <= 0) + return '\0'; + + char ch = SendScintilla(SCI_GETCHARAT, --pos); + + // Don't go past the end of the previous line. + if (ch == '\n' || ch == '\r') + { + ++pos; + return '\0'; + } + + return ch; +} + + +// See if a character is an auto-completion start character, ie. the last +// character of a word separator. +bool QsciScintilla::isStartChar(char ch) const +{ + QString s = QChar(ch); + + for (int i = 0; i < wseps.count(); ++i) + if (wseps[i].endsWith(s)) + return true; + + return false; +} + + +// Possibly start auto-completion. +void QsciScintilla::startAutoCompletion(AutoCompletionSource acs, + bool checkThresh, bool choose_single) +{ + int start, ignore; + QStringList context = apiContext(SendScintilla(SCI_GETCURRENTPOS), start, + ignore); + + if (context.isEmpty()) + return; + + // Get the last word's raw data and length. + ScintillaBytes s = textAsBytes(context.last()); + const char *last_data = ScintillaBytesConstData(s); + int last_len = s.length(); + + if (checkThresh && last_len < acThresh) + return; + + // Generate the string representing the valid words to select from. + QStringList wlist; + + if ((acs == AcsAll || acs == AcsAPIs) && !lex.isNull()) + { + QsciAbstractAPIs *apis = lex->apis(); + + if (apis) + apis->updateAutoCompletionList(context, wlist); + } + + if (acs == AcsAll || acs == AcsDocument) + { + int sflags = SCFIND_WORDSTART; + + if (!SendScintilla(SCI_AUTOCGETIGNORECASE)) + sflags |= SCFIND_MATCHCASE; + + SendScintilla(SCI_SETSEARCHFLAGS, sflags); + + int pos = 0; + int dlen = SendScintilla(SCI_GETLENGTH); + int caret = SendScintilla(SCI_GETCURRENTPOS); + int clen = caret - start; + char *orig_context = new char[clen + 1]; + + SendScintilla(SCI_GETTEXTRANGE, start, caret, orig_context); + + for (;;) + { + int fstart; + + SendScintilla(SCI_SETTARGETSTART, pos); + SendScintilla(SCI_SETTARGETEND, dlen); + + if ((fstart = SendScintilla(SCI_SEARCHINTARGET, clen, orig_context)) < 0) + break; + + // Move past the root part. + pos = fstart + clen; + + // Skip if this is the context we are auto-completing. + if (pos == caret) + continue; + + // Get the rest of this word. + QString w = last_data; + + while (pos < dlen) + { + char ch = SendScintilla(SCI_GETCHARAT, pos); + + if (!isWordCharacter(ch)) + break; + + w += ch; + ++pos; + } + + // Add the word if it isn't already there. + if (!w.isEmpty()) + { + bool keep; + + // If there are APIs then check if the word is already present + // as an API word (i.e. with a trailing space). + if (acs == AcsAll) + { + QString api_w = w; + api_w.append(' '); + + keep = !wlist.contains(api_w); + } + else + { + keep = true; + } + + if (keep && !wlist.contains(w)) + wlist.append(w); + } + } + + delete []orig_context; + } + + if (wlist.isEmpty()) + return; + + wlist.sort(); + + SendScintilla(SCI_AUTOCSETCHOOSESINGLE, choose_single); + SendScintilla(SCI_AUTOCSETSEPARATOR, acSeparator); + + ScintillaBytes wlist_s = textAsBytes(wlist.join(QChar(acSeparator))); + SendScintilla(SCI_AUTOCSHOW, last_len, ScintillaBytesConstData(wlist_s)); +} + + +// Maintain the indentation of the previous line. +void QsciScintilla::maintainIndentation(char ch, long pos) +{ + if (ch != '\r' && ch != '\n') + return; + + int curr_line = SendScintilla(SCI_LINEFROMPOSITION, pos); + + // Get the indentation of the preceding non-zero length line. + int ind = 0; + + for (int line = curr_line - 1; line >= 0; --line) + { + if (SendScintilla(SCI_GETLINEENDPOSITION, line) > + SendScintilla(SCI_POSITIONFROMLINE, line)) + { + ind = indentation(line); + break; + } + } + + if (ind > 0) + autoIndentLine(pos, curr_line, ind); +} + + +// Implement auto-indentation. +void QsciScintilla::autoIndentation(char ch, long pos) +{ + int curr_line = SendScintilla(SCI_LINEFROMPOSITION, pos); + int ind_width = indentWidth(); + long curr_line_start = SendScintilla(SCI_POSITIONFROMLINE, curr_line); + + const char *block_start = lex->blockStart(); + bool start_single = (block_start && qstrlen(block_start) == 1); + + const char *block_end = lex->blockEnd(); + bool end_single = (block_end && qstrlen(block_end) == 1); + + if (end_single && block_end[0] == ch) + { + if (!(lex->autoIndentStyle() & AiClosing) && rangeIsWhitespace(curr_line_start, pos - 1)) + autoIndentLine(pos, curr_line, blockIndent(curr_line - 1) - ind_width); + } + else if (start_single && block_start[0] == ch) + { + // De-indent if we have already indented because the previous line was + // a start of block keyword. + if (!(lex->autoIndentStyle() & AiOpening) && curr_line > 0 && getIndentState(curr_line - 1) == isKeywordStart && rangeIsWhitespace(curr_line_start, pos - 1)) + autoIndentLine(pos, curr_line, blockIndent(curr_line - 1) - ind_width); + } + else if (ch == '\r' || ch == '\n') + { + // Don't auto-indent the line (ie. preserve its existing indentation) + // if we have inserted a new line above by pressing return at the start + // of this line - in other words, if the previous line is empty. + long prev_line_length = SendScintilla(SCI_GETLINEENDPOSITION, curr_line - 1) - SendScintilla(SCI_POSITIONFROMLINE, curr_line - 1); + + if (prev_line_length != 0) + autoIndentLine(pos, curr_line, blockIndent(curr_line - 1)); + } +} + + +// Set the indentation for a line. +void QsciScintilla::autoIndentLine(long pos, int line, int indent) +{ + if (indent < 0) + return; + + long pos_before = SendScintilla(SCI_GETLINEINDENTPOSITION, line); + SendScintilla(SCI_SETLINEINDENTATION, line, indent); + long pos_after = SendScintilla(SCI_GETLINEINDENTPOSITION, line); + long new_pos = -1; + + if (pos_after > pos_before) + new_pos = pos + (pos_after - pos_before); + else if (pos_after < pos_before && pos >= pos_after) + if (pos >= pos_before) + new_pos = pos + (pos_after - pos_before); + else + new_pos = pos_after; + + if (new_pos >= 0) + SendScintilla(SCI_SETSEL, new_pos, new_pos); +} + + +// Return the indentation of the block defined by the given line (or something +// significant before). +int QsciScintilla::blockIndent(int line) +{ + if (line < 0) + return 0; + + // Handle the trvial case. + if (!lex->blockStartKeyword() && !lex->blockStart() && !lex->blockEnd()) + return indentation(line); + + int line_limit = line - lex->blockLookback(); + + if (line_limit < 0) + line_limit = 0; + + for (int l = line; l >= line_limit; --l) + { + IndentState istate = getIndentState(l); + + if (istate != isNone) + { + int ind_width = indentWidth(); + int ind = indentation(l); + + if (istate == isBlockStart) + { + if (!(lex -> autoIndentStyle() & AiOpening)) + ind += ind_width; + } + else if (istate == isBlockEnd) + { + if (lex -> autoIndentStyle() & AiClosing) + ind -= ind_width; + + if (ind < 0) + ind = 0; + } + else if (line == l) + ind += ind_width; + + return ind; + } + } + + return indentation(line); +} + + +// Return true if all characters starting at spos up to, but not including +// epos, are spaces or tabs. +bool QsciScintilla::rangeIsWhitespace(long spos, long epos) +{ + while (spos < epos) + { + char ch = SendScintilla(SCI_GETCHARAT, spos); + + if (ch != ' ' && ch != '\t') + return false; + + ++spos; + } + + return true; +} + + +// Returns the indentation state of a line. +QsciScintilla::IndentState QsciScintilla::getIndentState(int line) +{ + IndentState istate; + + // Get the styled text. + long spos = SendScintilla(SCI_POSITIONFROMLINE, line); + long epos = SendScintilla(SCI_POSITIONFROMLINE, line + 1); + + char *text = new char[(epos - spos + 1) * 2]; + + SendScintilla(SCI_GETSTYLEDTEXT, spos, epos, text); + + int style, bstart_off, bend_off; + + // Block start/end takes precedence over keywords. + const char *bstart_words = lex->blockStart(&style); + bstart_off = findStyledWord(text, style, bstart_words); + + const char *bend_words = lex->blockEnd(&style); + bend_off = findStyledWord(text, style, bend_words); + + // If there is a block start but no block end characters then ignore it + // unless the block start is the last significant thing on the line, ie. + // assume Python-like blocking. + if (bstart_off >= 0 && !bend_words) + for (int i = bstart_off * 2; text[i] != '\0'; i += 2) + if (!QChar(text[i]).isSpace()) + return isNone; + + if (bstart_off > bend_off) + istate = isBlockStart; + else if (bend_off > bstart_off) + istate = isBlockEnd; + else + { + const char *words = lex->blockStartKeyword(&style); + + istate = (findStyledWord(text,style,words) >= 0) ? isKeywordStart : isNone; + } + + delete[] text; + + return istate; +} + + +// text is a pointer to some styled text (ie. a character byte followed by a +// style byte). style is a style number. words is a space separated list of +// words. Returns the position in the text immediately after the last one of +// the words with the style. The reason we are after the last, and not the +// first, occurance is that we are looking for words that start and end a block +// where the latest one is the most significant. +int QsciScintilla::findStyledWord(const char *text, int style, + const char *words) +{ + if (!words) + return -1; + + // Find the range of text with the style we are looking for. + const char *stext; + + for (stext = text; stext[1] != style; stext += 2) + if (stext[0] == '\0') + return -1; + + // Move to the last character. + const char *etext = stext; + + while (etext[2] != '\0') + etext += 2; + + // Backtrack until we find the style. There will be one. + while (etext[1] != style) + etext -= 2; + + // Look for each word in turn. + while (words[0] != '\0') + { + // Find the end of the word. + const char *eword = words; + + while (eword[1] != ' ' && eword[1] != '\0') + ++eword; + + // Now search the text backwards. + const char *wp = eword; + + for (const char *tp = etext; tp >= stext; tp -= 2) + { + if (tp[0] != wp[0] || tp[1] != style) + { + // Reset the search. + wp = eword; + continue; + } + + // See if all the word has matched. + if (wp-- == words) + return ((tp - text) / 2) + (eword - words) + 1; + } + + // Move to the start of the next word if there is one. + words = eword + 1; + + if (words[0] == ' ') + ++words; + } + + return -1; +} + + +// Return true if the code page is UTF8. +bool QsciScintilla::isUtf8() const +{ + return (SendScintilla(SCI_GETCODEPAGE) == SC_CP_UTF8); +} + + +// Set the code page. +void QsciScintilla::setUtf8(bool cp) +{ + SendScintilla(SCI_SETCODEPAGE, (cp ? SC_CP_UTF8 : 0)); +} + + +// Return the end-of-line mode. +QsciScintilla::EolMode QsciScintilla::eolMode() const +{ + return (EolMode)SendScintilla(SCI_GETEOLMODE); +} + + +// Set the end-of-line mode. +void QsciScintilla::setEolMode(EolMode mode) +{ + SendScintilla(SCI_SETEOLMODE, mode); +} + + +// Convert the end-of-lines to a particular mode. +void QsciScintilla::convertEols(EolMode mode) +{ + SendScintilla(SCI_CONVERTEOLS, mode); +} + + +// Return the edge colour. +QColor QsciScintilla::edgeColor() const +{ + long res = SendScintilla(SCI_GETEDGECOLOUR); + + return QColor((int)res, ((int)(res >> 8)) & 0x00ff, ((int)(res >> 16)) & 0x00ff); +} + + +// Set the edge colour. +void QsciScintilla::setEdgeColor(const QColor &col) +{ + SendScintilla(SCI_SETEDGECOLOUR, col); +} + + +// Return the edge column. +int QsciScintilla::edgeColumn() const +{ + return SendScintilla(SCI_GETEDGECOLUMN); +} + + +// Set the edge column. +void QsciScintilla::setEdgeColumn(int colnr) +{ + SendScintilla(SCI_SETEDGECOLUMN, colnr); +} + + +// Return the edge mode. +QsciScintilla::EdgeMode QsciScintilla::edgeMode() const +{ + return (EdgeMode)SendScintilla(SCI_GETEDGEMODE); +} + + +// Set the edge mode. +void QsciScintilla::setEdgeMode(EdgeMode mode) +{ + SendScintilla(SCI_SETEDGEMODE, mode); +} + + +// Return the end-of-line visibility. +bool QsciScintilla::eolVisibility() const +{ + return SendScintilla(SCI_GETVIEWEOL); +} + + +// Set the end-of-line visibility. +void QsciScintilla::setEolVisibility(bool visible) +{ + SendScintilla(SCI_SETVIEWEOL, visible); +} + + +// Return the extra ascent. +int QsciScintilla::extraAscent() const +{ + return SendScintilla(SCI_GETEXTRAASCENT); +} + + +// Set the extra ascent. +void QsciScintilla::setExtraAscent(int extra) +{ + SendScintilla(SCI_SETEXTRAASCENT, extra); +} + + +// Return the extra descent. +int QsciScintilla::extraDescent() const +{ + return SendScintilla(SCI_GETEXTRADESCENT); +} + + +// Set the extra descent. +void QsciScintilla::setExtraDescent(int extra) +{ + SendScintilla(SCI_SETEXTRADESCENT, extra); +} + + +// Return the whitespace size. +int QsciScintilla::whitespaceSize() const +{ + return SendScintilla(SCI_GETWHITESPACESIZE); +} + + +// Set the whitespace size. +void QsciScintilla::setWhitespaceSize(int size) +{ + SendScintilla(SCI_SETWHITESPACESIZE, size); +} + + +// Set the whitespace background colour. +void QsciScintilla::setWhitespaceBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_SETWHITESPACEBACK, col.isValid(), col); +} + + +// Set the whitespace foreground colour. +void QsciScintilla::setWhitespaceForegroundColor(const QColor &col) +{ + SendScintilla(SCI_SETWHITESPACEFORE, col.isValid(), col); +} + + +// Return the whitespace visibility. +QsciScintilla::WhitespaceVisibility QsciScintilla::whitespaceVisibility() const +{ + return (WhitespaceVisibility)SendScintilla(SCI_GETVIEWWS); +} + + +// Set the whitespace visibility. +void QsciScintilla::setWhitespaceVisibility(WhitespaceVisibility mode) +{ + SendScintilla(SCI_SETVIEWWS, mode); +} + + +// Return the line wrap mode. +QsciScintilla::WrapMode QsciScintilla::wrapMode() const +{ + return (WrapMode)SendScintilla(SCI_GETWRAPMODE); +} + + +// Set the line wrap mode. +void QsciScintilla::setWrapMode(WrapMode mode) +{ + SendScintilla(SCI_SETLAYOUTCACHE, + (mode == WrapNone ? SC_CACHE_CARET : SC_CACHE_DOCUMENT)); + SendScintilla(SCI_SETWRAPMODE, mode); +} + + +// Return the line wrap indent mode. +QsciScintilla::WrapIndentMode QsciScintilla::wrapIndentMode() const +{ + return (WrapIndentMode)SendScintilla(SCI_GETWRAPINDENTMODE); +} + + +// Set the line wrap indent mode. +void QsciScintilla::setWrapIndentMode(WrapIndentMode mode) +{ + SendScintilla(SCI_SETWRAPINDENTMODE, mode); +} + + +// Set the line wrap visual flags. +void QsciScintilla::setWrapVisualFlags(WrapVisualFlag endFlag, + WrapVisualFlag startFlag, int indent) +{ + int flags = SC_WRAPVISUALFLAG_NONE; + int loc = SC_WRAPVISUALFLAGLOC_DEFAULT; + + switch (endFlag) + { + case WrapFlagByText: + flags |= SC_WRAPVISUALFLAG_END; + loc |= SC_WRAPVISUALFLAGLOC_END_BY_TEXT; + break; + + case WrapFlagByBorder: + flags |= SC_WRAPVISUALFLAG_END; + break; + + case WrapFlagInMargin: + flags |= SC_WRAPVISUALFLAG_MARGIN; + break; + } + + switch (startFlag) + { + case WrapFlagByText: + flags |= SC_WRAPVISUALFLAG_START; + loc |= SC_WRAPVISUALFLAGLOC_START_BY_TEXT; + break; + + case WrapFlagByBorder: + flags |= SC_WRAPVISUALFLAG_START; + break; + + case WrapFlagInMargin: + flags |= SC_WRAPVISUALFLAG_MARGIN; + break; + } + + SendScintilla(SCI_SETWRAPVISUALFLAGS, flags); + SendScintilla(SCI_SETWRAPVISUALFLAGSLOCATION, loc); + SendScintilla(SCI_SETWRAPSTARTINDENT, indent); +} + + +// Set the folding style. +void QsciScintilla::setFolding(FoldStyle folding, int margin) +{ + fold = folding; + foldmargin = margin; + + if (folding == NoFoldStyle) + { + SendScintilla(SCI_SETMARGINWIDTHN, margin, 0L); + return; + } + + int mask = SendScintilla(SCI_GETMODEVENTMASK); + SendScintilla(SCI_SETMODEVENTMASK, mask | SC_MOD_CHANGEFOLD); + + SendScintilla(SCI_SETFOLDFLAGS, SC_FOLDFLAG_LINEAFTER_CONTRACTED); + + SendScintilla(SCI_SETMARGINTYPEN, margin, (long)SC_MARGIN_SYMBOL); + SendScintilla(SCI_SETMARGINMASKN, margin, SC_MASK_FOLDERS); + SendScintilla(SCI_SETMARGINSENSITIVEN, margin, 1); + + // Set the marker symbols to use. + switch (folding) + { + case PlainFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS); + setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB); + setFoldMarker(SC_MARKNUM_FOLDERTAIL); + setFoldMarker(SC_MARKNUM_FOLDEREND); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); + break; + + case CircledFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS); + setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB); + setFoldMarker(SC_MARKNUM_FOLDERTAIL); + setFoldMarker(SC_MARKNUM_FOLDEREND); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); + break; + + case BoxedFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS); + setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB); + setFoldMarker(SC_MARKNUM_FOLDERTAIL); + setFoldMarker(SC_MARKNUM_FOLDEREND); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL); + break; + + case CircledTreeFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_CIRCLEMINUS); + setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_CIRCLEPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); + setFoldMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNERCURVE); + setFoldMarker(SC_MARKNUM_FOLDEREND, SC_MARK_CIRCLEPLUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_CIRCLEMINUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNERCURVE); + break; + + case BoxedTreeFoldStyle: + setFoldMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_BOXMINUS); + setFoldMarker(SC_MARKNUM_FOLDER, SC_MARK_BOXPLUS); + setFoldMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_VLINE); + setFoldMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_LCORNER); + setFoldMarker(SC_MARKNUM_FOLDEREND, SC_MARK_BOXPLUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_BOXMINUSCONNECTED); + setFoldMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_TCORNER); + break; + } + + SendScintilla(SCI_SETMARGINWIDTHN, margin, defaultFoldMarginWidth); +} + + +// Clear all current folds. +void QsciScintilla::clearFolds() +{ + recolor(); + + int maxLine = SendScintilla(SCI_GETLINECOUNT); + + for (int line = 0; line < maxLine; line++) + { + int level = SendScintilla(SCI_GETFOLDLEVEL, line); + + if (level & SC_FOLDLEVELHEADERFLAG) + { + SendScintilla(SCI_SETFOLDEXPANDED, line, 1); + foldExpand(line, true, false, 0, level); + line--; + } + } +} + + +// Set up a folder marker. +void QsciScintilla::setFoldMarker(int marknr, int mark) +{ + SendScintilla(SCI_MARKERDEFINE, marknr, mark); + + if (mark != SC_MARK_EMPTY) + { + SendScintilla(SCI_MARKERSETFORE, marknr, QColor(Qt::white)); + SendScintilla(SCI_MARKERSETBACK, marknr, QColor(Qt::black)); + } +} + + +// Handle a click in the fold margin. This is mostly taken from SciTE. +void QsciScintilla::foldClick(int lineClick, int bstate) +{ + bool shift = bstate & Qt::ShiftModifier; + bool ctrl = bstate & Qt::ControlModifier; + + if (shift && ctrl) + { + foldAll(); + return; + } + + int levelClick = SendScintilla(SCI_GETFOLDLEVEL, lineClick); + + if (levelClick & SC_FOLDLEVELHEADERFLAG) + { + if (shift) + { + // Ensure all children are visible. + SendScintilla(SCI_SETFOLDEXPANDED, lineClick, 1); + foldExpand(lineClick, true, true, 100, levelClick); + } + else if (ctrl) + { + if (SendScintilla(SCI_GETFOLDEXPANDED, lineClick)) + { + // Contract this line and all its children. + SendScintilla(SCI_SETFOLDEXPANDED, lineClick, 0L); + foldExpand(lineClick, false, true, 0, levelClick); + } + else + { + // Expand this line and all its children. + SendScintilla(SCI_SETFOLDEXPANDED, lineClick, 1); + foldExpand(lineClick, true, true, 100, levelClick); + } + } + else + { + // Toggle this line. + SendScintilla(SCI_TOGGLEFOLD, lineClick); + } + } +} + + +// Do the hard work of hiding and showing lines. This is mostly taken from +// SciTE. +void QsciScintilla::foldExpand(int &line, bool doExpand, bool force, + int visLevels, int level) +{ + int lineMaxSubord = SendScintilla(SCI_GETLASTCHILD, line, + level & SC_FOLDLEVELNUMBERMASK); + + line++; + + while (line <= lineMaxSubord) + { + if (force) + { + if (visLevels > 0) + SendScintilla(SCI_SHOWLINES, line, line); + else + SendScintilla(SCI_HIDELINES, line, line); + } + else if (doExpand) + SendScintilla(SCI_SHOWLINES, line, line); + + int levelLine = level; + + if (levelLine == -1) + levelLine = SendScintilla(SCI_GETFOLDLEVEL, line); + + if (levelLine & SC_FOLDLEVELHEADERFLAG) + { + if (force) + { + if (visLevels > 1) + SendScintilla(SCI_SETFOLDEXPANDED, line, 1); + else + SendScintilla(SCI_SETFOLDEXPANDED, line, 0L); + + foldExpand(line, doExpand, force, visLevels - 1); + } + else if (doExpand) + { + if (!SendScintilla(SCI_GETFOLDEXPANDED, line)) + SendScintilla(SCI_SETFOLDEXPANDED, line, 1); + + foldExpand(line, true, force, visLevels - 1); + } + else + foldExpand(line, false, force, visLevels - 1); + } + else + line++; + } +} + + +// Fully expand (if there is any line currently folded) all text. Otherwise, +// fold all text. This is mostly taken from SciTE. +void QsciScintilla::foldAll(bool children) +{ + recolor(); + + int maxLine = SendScintilla(SCI_GETLINECOUNT); + bool expanding = true; + + for (int lineSeek = 0; lineSeek < maxLine; lineSeek++) + { + if (SendScintilla(SCI_GETFOLDLEVEL,lineSeek) & SC_FOLDLEVELHEADERFLAG) + { + expanding = !SendScintilla(SCI_GETFOLDEXPANDED, lineSeek); + break; + } + } + + for (int line = 0; line < maxLine; line++) + { + int level = SendScintilla(SCI_GETFOLDLEVEL, line); + + if (!(level & SC_FOLDLEVELHEADERFLAG)) + continue; + + if (children || + (SC_FOLDLEVELBASE == (level & SC_FOLDLEVELNUMBERMASK))) + { + if (expanding) + { + SendScintilla(SCI_SETFOLDEXPANDED, line, 1); + foldExpand(line, true, false, 0, level); + line--; + } + else + { + int lineMaxSubord = SendScintilla(SCI_GETLASTCHILD, line, -1); + + SendScintilla(SCI_SETFOLDEXPANDED, line, 0L); + + if (lineMaxSubord > line) + SendScintilla(SCI_HIDELINES, line + 1, lineMaxSubord); + } + } + } +} + + +// Handle a fold change. This is mostly taken from SciTE. +void QsciScintilla::foldChanged(int line,int levelNow,int levelPrev) +{ + if (levelNow & SC_FOLDLEVELHEADERFLAG) + { + if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) + SendScintilla(SCI_SETFOLDEXPANDED, line, 1); + } + else if (levelPrev & SC_FOLDLEVELHEADERFLAG) + { + if (!SendScintilla(SCI_GETFOLDEXPANDED, line)) + { + // Removing the fold from one that has been contracted so should + // expand. Otherwise lines are left invisible with no way to make + // them visible. + foldExpand(line, true, false, 0, levelPrev); + } + } +} + + +// Toggle the fold for a line if it contains a fold marker. +void QsciScintilla::foldLine(int line) +{ + SendScintilla(SCI_TOGGLEFOLD, line); +} + + +// Return the list of folded lines. +QList QsciScintilla::contractedFolds() const +{ + QList folds; + int linenr = 0, fold_line; + + while ((fold_line = SendScintilla(SCI_CONTRACTEDFOLDNEXT, linenr)) >= 0) + { + folds.append(fold_line); + linenr = fold_line + 1; + } + + return folds; +} + + +// Set the fold state from a list. +void QsciScintilla::setContractedFolds(const QList &folds) +{ + for (int i = 0; i < folds.count(); ++i) + { + int line = folds[i]; + int last_line = SendScintilla(SCI_GETLASTCHILD, line, -1); + + SendScintilla(SCI_SETFOLDEXPANDED, line, 0L); + SendScintilla(SCI_HIDELINES, line + 1, last_line); + } +} + + +// Handle the SCN_MODIFIED notification. +void QsciScintilla::handleModified(int pos, int mtype, const char *text, + int len, int added, int line, int foldNow, int foldPrev, int token, + int annotationLinesAdded) +{ + if (mtype & SC_MOD_CHANGEFOLD) + { + if (fold) + foldChanged(line, foldNow, foldPrev); + } + + if (mtype & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) + { + emit textChanged(); + + if (added != 0) + emit linesChanged(); + } +} + + +// Zoom in a number of points. +void QsciScintilla::zoomIn(int range) +{ + zoomTo(SendScintilla(SCI_GETZOOM) + range); +} + + +// Zoom in a single point. +void QsciScintilla::zoomIn() +{ + SendScintilla(SCI_ZOOMIN); +} + + +// Zoom out a number of points. +void QsciScintilla::zoomOut(int range) +{ + zoomTo(SendScintilla(SCI_GETZOOM) - range); +} + + +// Zoom out a single point. +void QsciScintilla::zoomOut() +{ + SendScintilla(SCI_ZOOMOUT); +} + + +// Set the zoom to a number of points. +void QsciScintilla::zoomTo(int size) +{ + if (size < -10) + size = -10; + else if (size > 20) + size = 20; + + SendScintilla(SCI_SETZOOM, size); +} + + +// Find the first occurrence of a string. +bool QsciScintilla::findFirst(const QString &expr, bool re, bool cs, bool wo, + bool wrap, bool forward, int line, int index, bool show, bool posix) +{ + if (expr.isEmpty()) + { + findState.status = FindState::Idle; + return false; + } + + findState.status = FindState::Finding; + findState.expr = expr; + findState.wrap = wrap; + findState.forward = forward; + + findState.flags = + (cs ? SCFIND_MATCHCASE : 0) | + (wo ? SCFIND_WHOLEWORD : 0) | + (re ? SCFIND_REGEXP : 0) | + (posix ? SCFIND_POSIX : 0); + + if (line < 0 || index < 0) + findState.startpos = SendScintilla(SCI_GETCURRENTPOS); + else + findState.startpos = positionFromLineIndex(line, index); + + if (forward) + findState.endpos = SendScintilla(SCI_GETLENGTH); + else + findState.endpos = 0; + + findState.show = show; + + return doFind(); +} + + +// Find the first occurrence of a string in the current selection. +bool QsciScintilla::findFirstInSelection(const QString &expr, bool re, bool cs, + bool wo, bool forward, bool show, bool posix) +{ + if (expr.isEmpty()) + { + findState.status = FindState::Idle; + return false; + } + + findState.status = FindState::FindingInSelection; + findState.expr = expr; + findState.wrap = false; + findState.forward = forward; + + findState.flags = + (cs ? SCFIND_MATCHCASE : 0) | + (wo ? SCFIND_WHOLEWORD : 0) | + (re ? SCFIND_REGEXP : 0) | + (posix ? SCFIND_POSIX : 0); + + findState.startpos_orig = SendScintilla(SCI_GETSELECTIONSTART); + findState.endpos_orig = SendScintilla(SCI_GETSELECTIONEND); + + if (forward) + { + findState.startpos = findState.startpos_orig; + findState.endpos = findState.endpos_orig; + } + else + { + findState.startpos = findState.endpos_orig; + findState.endpos = findState.startpos_orig; + } + + findState.show = show; + + return doFind(); +} + + +// Find the next occurrence of a string. +bool QsciScintilla::findNext() +{ + if (findState.status == FindState::Idle) + return false; + + return doFind(); +} + + +// Do the hard work of the find methods. +bool QsciScintilla::doFind() +{ + SendScintilla(SCI_SETSEARCHFLAGS, findState.flags); + + int pos = simpleFind(); + + // See if it was found. If not and wraparound is wanted, try again. + if (pos == -1 && findState.wrap) + { + if (findState.forward) + { + findState.startpos = 0; + findState.endpos = SendScintilla(SCI_GETLENGTH); + } + else + { + findState.startpos = SendScintilla(SCI_GETLENGTH); + findState.endpos = 0; + } + + pos = simpleFind(); + } + + if (pos == -1) + { + // Restore the original selection. + if (findState.status == FindState::FindingInSelection) + SendScintilla(SCI_SETSEL, findState.startpos_orig, + findState.endpos_orig); + + findState.status = FindState::Idle; + return false; + } + + // It was found. + long targstart = SendScintilla(SCI_GETTARGETSTART); + long targend = SendScintilla(SCI_GETTARGETEND); + + // Ensure the text found is visible if required. + if (findState.show) + { + int startLine = SendScintilla(SCI_LINEFROMPOSITION, targstart); + int endLine = SendScintilla(SCI_LINEFROMPOSITION, targend); + + for (int i = startLine; i <= endLine; ++i) + SendScintilla(SCI_ENSUREVISIBLEENFORCEPOLICY, i); + } + + // Now set the selection. + SendScintilla(SCI_SETSEL, targstart, targend); + + // Finally adjust the start position so that we don't find the same one + // again. + if (findState.forward) + findState.startpos = targend; + else if ((findState.startpos = targstart - 1) < 0) + findState.startpos = 0; + + return true; +} + + +// Do a simple find between the start and end positions. +int QsciScintilla::simpleFind() +{ + if (findState.startpos == findState.endpos) + return -1; + + SendScintilla(SCI_SETTARGETSTART, findState.startpos); + SendScintilla(SCI_SETTARGETEND, findState.endpos); + + ScintillaBytes s = textAsBytes(findState.expr); + + return SendScintilla(SCI_SEARCHINTARGET, s.length(), + ScintillaBytesConstData(s)); +} + + +// Replace the text found with the previous find method. +void QsciScintilla::replace(const QString &replaceStr) +{ + if (findState.status == FindState::Idle) + return; + + long start = SendScintilla(SCI_GETSELECTIONSTART); + long orig_len = SendScintilla(SCI_GETSELECTIONEND) - start; + + SendScintilla(SCI_TARGETFROMSELECTION); + + int cmd = (findState.flags & SCFIND_REGEXP) ? SCI_REPLACETARGETRE : SCI_REPLACETARGET; + + ScintillaBytes s = textAsBytes(replaceStr); + long len = SendScintilla(cmd, -1, ScintillaBytesConstData(s)); + + // Reset the selection. + SendScintilla(SCI_SETSELECTIONSTART, start); + SendScintilla(SCI_SETSELECTIONEND, start + len); + + // Fix the original selection. + findState.endpos_orig += (len - orig_len); + + if (findState.forward) + findState.startpos = start + len; +} + + +// Query the modified state. +bool QsciScintilla::isModified() const +{ + return doc.isModified(); +} + + +// Set the modified state. +void QsciScintilla::setModified(bool m) +{ + if (!m) + SendScintilla(SCI_SETSAVEPOINT); +} + + +// Handle the SCN_INDICATORCLICK notification. +void QsciScintilla::handleIndicatorClick(int pos, int modifiers) +{ + int state = mapModifiers(modifiers); + int line, index; + + lineIndexFromPosition(pos, &line, &index); + + emit indicatorClicked(line, index, Qt::KeyboardModifiers(state)); +} + + +// Handle the SCN_INDICATORRELEASE notification. +void QsciScintilla::handleIndicatorRelease(int pos, int modifiers) +{ + int state = mapModifiers(modifiers); + int line, index; + + lineIndexFromPosition(pos, &line, &index); + + emit indicatorReleased(line, index, Qt::KeyboardModifiers(state)); +} + + +// Handle the SCN_MARGINCLICK notification. +void QsciScintilla::handleMarginClick(int pos, int modifiers, int margin) +{ + int state = mapModifiers(modifiers); + int line = SendScintilla(SCI_LINEFROMPOSITION, pos); + + if (fold && margin == foldmargin) + foldClick(line, state); + else + emit marginClicked(margin, line, Qt::KeyboardModifiers(state)); +} + + +// Handle the SCN_SAVEPOINTREACHED notification. +void QsciScintilla::handleSavePointReached() +{ + doc.setModified(false); + emit modificationChanged(false); +} + + +// Handle the SCN_SAVEPOINTLEFT notification. +void QsciScintilla::handleSavePointLeft() +{ + doc.setModified(true); + emit modificationChanged(true); +} + + +// Handle the QSCN_SELCHANGED signal. +void QsciScintilla::handleSelectionChanged(bool yes) +{ + selText = yes; + + emit copyAvailable(yes); + emit selectionChanged(); +} + + +// Get the current selection. +void QsciScintilla::getSelection(int *lineFrom, int *indexFrom, int *lineTo, + int *indexTo) const +{ + if (selText) + { + lineIndexFromPosition(SendScintilla(SCI_GETSELECTIONSTART), lineFrom, + indexFrom); + lineIndexFromPosition(SendScintilla(SCI_GETSELECTIONEND), lineTo, + indexTo); + } + else + *lineFrom = *indexFrom = *lineTo = *indexTo = -1; +} + + +// Sets the current selection. +void QsciScintilla::setSelection(int lineFrom, int indexFrom, int lineTo, + int indexTo) +{ + SendScintilla(SCI_SETSEL, positionFromLineIndex(lineFrom, indexFrom), + positionFromLineIndex(lineTo, indexTo)); +} + + +// Set the background colour of selected text. +void QsciScintilla::setSelectionBackgroundColor(const QColor &col) +{ + int alpha = col.alpha(); + + if (alpha == 255) + alpha = SC_ALPHA_NOALPHA; + + SendScintilla(SCI_SETSELBACK, 1, col); + SendScintilla(SCI_SETSELALPHA, alpha); +} + + +// Set the foreground colour of selected text. +void QsciScintilla::setSelectionForegroundColor(const QColor &col) +{ + SendScintilla(SCI_SETSELFORE, 1, col); +} + + +// Reset the background colour of selected text to the default. +void QsciScintilla::resetSelectionBackgroundColor() +{ + SendScintilla(SCI_SETSELALPHA, SC_ALPHA_NOALPHA); + SendScintilla(SCI_SETSELBACK, 0UL); +} + + +// Reset the foreground colour of selected text to the default. +void QsciScintilla::resetSelectionForegroundColor() +{ + SendScintilla(SCI_SETSELFORE, 0UL); +} + + +// Set the fill to the end-of-line for the selection. +void QsciScintilla::setSelectionToEol(bool filled) +{ + SendScintilla(SCI_SETSELEOLFILLED, filled); +} + + +// Return the fill to the end-of-line for the selection. +bool QsciScintilla::selectionToEol() const +{ + return SendScintilla(SCI_GETSELEOLFILLED); +} + + +// Set the width of the caret. +void QsciScintilla::setCaretWidth(int width) +{ + SendScintilla(SCI_SETCARETWIDTH, width); +} + + +// Set the foreground colour of the caret. +void QsciScintilla::setCaretForegroundColor(const QColor &col) +{ + SendScintilla(SCI_SETCARETFORE, col); +} + + +// Set the background colour of the line containing the caret. +void QsciScintilla::setCaretLineBackgroundColor(const QColor &col) +{ + int alpha = col.alpha(); + + if (alpha == 255) + alpha = SC_ALPHA_NOALPHA; + + SendScintilla(SCI_SETCARETLINEBACK, col); + SendScintilla(SCI_SETCARETLINEBACKALPHA, alpha); +} + + +// Set the state of the background colour of the line containing the caret. +void QsciScintilla::setCaretLineVisible(bool enable) +{ + SendScintilla(SCI_SETCARETLINEVISIBLE, enable); +} + + +// Set the background colour of a hotspot area. +void QsciScintilla::setHotspotBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_SETSELBACK, 1, col); +} + + +// Set the foreground colour of a hotspot area. +void QsciScintilla::setHotspotForegroundColor(const QColor &col) +{ + SendScintilla(SCI_SETHOTSPOTACTIVEFORE, 1, col); +} + + +// Reset the background colour of a hotspot area to the default. +void QsciScintilla::resetHotspotBackgroundColor() +{ + SendScintilla(SCI_SETSELBACK, 0UL); +} + + +// Reset the foreground colour of a hotspot area to the default. +void QsciScintilla::resetHotspotForegroundColor() +{ + SendScintilla(SCI_SETHOTSPOTACTIVEFORE, 0UL); +} + + +// Set the underline of a hotspot area. +void QsciScintilla::setHotspotUnderline(bool enable) +{ + SendScintilla(SCI_SETHOTSPOTACTIVEUNDERLINE, enable); +} + + +// Set the wrapping of a hotspot area. +void QsciScintilla::setHotspotWrap(bool enable) +{ + SendScintilla(SCI_SETHOTSPOTSINGLELINE, !enable); +} + + +// Query the read-only state. +bool QsciScintilla::isReadOnly() const +{ + return SendScintilla(SCI_GETREADONLY); +} + + +// Set the read-only state. +void QsciScintilla::setReadOnly(bool ro) +{ + setAttribute(Qt::WA_InputMethodEnabled, !ro); + SendScintilla(SCI_SETREADONLY, ro); +} + + +// Append the given text. +void QsciScintilla::append(const QString &text) +{ + bool ro = ensureRW(); + + ScintillaBytes s = textAsBytes(text); + SendScintilla(SCI_APPENDTEXT, s.length(), ScintillaBytesConstData(s)); + + SendScintilla(SCI_EMPTYUNDOBUFFER); + + setReadOnly(ro); +} + + +// Insert the given text at the current position. +void QsciScintilla::insert(const QString &text) +{ + insertAtPos(text, -1); +} + + +// Insert the given text at the given line and offset. +void QsciScintilla::insertAt(const QString &text, int line, int index) +{ + insertAtPos(text, positionFromLineIndex(line, index)); +} + + +// Insert the given text at the given position. +void QsciScintilla::insertAtPos(const QString &text, int pos) +{ + bool ro = ensureRW(); + + SendScintilla(SCI_BEGINUNDOACTION); + SendScintilla(SCI_INSERTTEXT, pos, + ScintillaBytesConstData(textAsBytes(text))); + SendScintilla(SCI_ENDUNDOACTION); + + setReadOnly(ro); +} + + +// Begin a sequence of undoable actions. +void QsciScintilla::beginUndoAction() +{ + SendScintilla(SCI_BEGINUNDOACTION); +} + + +// End a sequence of undoable actions. +void QsciScintilla::endUndoAction() +{ + SendScintilla(SCI_ENDUNDOACTION); +} + + +// Redo a sequence of actions. +void QsciScintilla::redo() +{ + SendScintilla(SCI_REDO); +} + + +// Undo a sequence of actions. +void QsciScintilla::undo() +{ + SendScintilla(SCI_UNDO); +} + + +// See if there is something to redo. +bool QsciScintilla::isRedoAvailable() const +{ + return SendScintilla(SCI_CANREDO); +} + + +// See if there is something to undo. +bool QsciScintilla::isUndoAvailable() const +{ + return SendScintilla(SCI_CANUNDO); +} + + +// Return the number of lines. +int QsciScintilla::lines() const +{ + return SendScintilla(SCI_GETLINECOUNT); +} + + +// Return the line at a position. +int QsciScintilla::lineAt(const QPoint &pos) const +{ + long chpos = SendScintilla(SCI_POSITIONFROMPOINTCLOSE, pos.x(), pos.y()); + + if (chpos < 0) + return -1; + + return SendScintilla(SCI_LINEFROMPOSITION, chpos); +} + + +// Return the length of a line. +int QsciScintilla::lineLength(int line) const +{ + if (line < 0 || line >= SendScintilla(SCI_GETLINECOUNT)) + return -1; + + return SendScintilla(SCI_LINELENGTH, line); +} + + +// Return the length of the current text. +int QsciScintilla::length() const +{ + return SendScintilla(SCI_GETTEXTLENGTH); +} + + +// Remove any selected text. +void QsciScintilla::removeSelectedText() +{ + SendScintilla(SCI_REPLACESEL, ""); +} + + +// Replace any selected text. +void QsciScintilla::replaceSelectedText(const QString &text) +{ + SendScintilla(SCI_REPLACESEL, ScintillaBytesConstData(textAsBytes(text))); +} + + +// Return the current selected text. +QString QsciScintilla::selectedText() const +{ + if (!selText) + return QString(); + + char *buf = new char[SendScintilla(SCI_GETSELECTIONEND) - SendScintilla(SCI_GETSELECTIONSTART) + 1]; + + SendScintilla(SCI_GETSELTEXT, buf); + + QString qs = bytesAsText(buf); + delete[] buf; + + return qs; +} + + +// Return the current text. +QString QsciScintilla::text() const +{ + int buflen = length() + 1; + char *buf = new char[buflen]; + + SendScintilla(SCI_GETTEXT, buflen, buf); + + QString qs = bytesAsText(buf); + delete[] buf; + + return qs; +} + + +// Return the text of a line. +QString QsciScintilla::text(int line) const +{ + int line_len = lineLength(line); + + if (line_len < 1) + return QString(); + + char *buf = new char[line_len + 1]; + + SendScintilla(SCI_GETLINE, line, buf); + buf[line_len] = '\0'; + + QString qs = bytesAsText(buf); + delete[] buf; + + return qs; +} + + +// Set the given text. +void QsciScintilla::setText(const QString &text) +{ + bool ro = ensureRW(); + + SendScintilla(SCI_SETTEXT, ScintillaBytesConstData(textAsBytes(text))); + SendScintilla(SCI_EMPTYUNDOBUFFER); + + setReadOnly(ro); +} + + +// Get the cursor position +void QsciScintilla::getCursorPosition(int *line, int *index) const +{ + lineIndexFromPosition(SendScintilla(SCI_GETCURRENTPOS), line, index); +} + + +// Set the cursor position +void QsciScintilla::setCursorPosition(int line, int index) +{ + SendScintilla(SCI_GOTOPOS, positionFromLineIndex(line, index)); +} + + +// Ensure the cursor is visible. +void QsciScintilla::ensureCursorVisible() +{ + SendScintilla(SCI_SCROLLCARET); +} + + +// Ensure a line is visible. +void QsciScintilla::ensureLineVisible(int line) +{ + SendScintilla(SCI_ENSUREVISIBLEENFORCEPOLICY, line); +} + + +// Copy text to the clipboard. +void QsciScintilla::copy() +{ + SendScintilla(SCI_COPY); +} + + +// Cut text to the clipboard. +void QsciScintilla::cut() +{ + SendScintilla(SCI_CUT); +} + + +// Paste text from the clipboard. +void QsciScintilla::paste() +{ + SendScintilla(SCI_PASTE); +} + + +// Select all text, or deselect any selected text. +void QsciScintilla::selectAll(bool select) +{ + if (select) + SendScintilla(SCI_SELECTALL); + else + SendScintilla(SCI_SETANCHOR, SendScintilla(SCI_GETCURRENTPOS)); +} + + +// Delete all text. +void QsciScintilla::clear() +{ + bool ro = ensureRW(); + + SendScintilla(SCI_BEGINUNDOACTION); + SendScintilla(SCI_CLEARALL); + SendScintilla(SCI_ENDUNDOACTION); + + setReadOnly(ro); +} + + +// Return the indentation of a line. +int QsciScintilla::indentation(int line) const +{ + return SendScintilla(SCI_GETLINEINDENTATION, line); +} + + +// Set the indentation of a line. +void QsciScintilla::setIndentation(int line, int indentation) +{ + SendScintilla(SCI_BEGINUNDOACTION); + SendScintilla(SCI_SETLINEINDENTATION, line, indentation); + SendScintilla(SCI_ENDUNDOACTION); +} + + +// Indent a line. +void QsciScintilla::indent(int line) +{ + setIndentation(line, indentation(line) + indentWidth()); +} + + +// Unindent a line. +void QsciScintilla::unindent(int line) +{ + int newIndent = indentation(line) - indentWidth(); + + if (newIndent < 0) + newIndent = 0; + + setIndentation(line, newIndent); +} + + +// Return the indentation of the current line. +int QsciScintilla::currentIndent() const +{ + return indentation(SendScintilla(SCI_LINEFROMPOSITION, + SendScintilla(SCI_GETCURRENTPOS))); +} + + +// Return the current indentation width. +int QsciScintilla::indentWidth() const +{ + int w = indentationWidth(); + + if (w == 0) + w = tabWidth(); + + return w; +} + + +// Return the state of indentation guides. +bool QsciScintilla::indentationGuides() const +{ + return (SendScintilla(SCI_GETINDENTATIONGUIDES) != SC_IV_NONE); +} + + +// Enable and disable indentation guides. +void QsciScintilla::setIndentationGuides(bool enable) +{ + int iv; + + if (!enable) + iv = SC_IV_NONE; + else if (lex.isNull()) + iv = SC_IV_REAL; + else + iv = lex->indentationGuideView(); + + SendScintilla(SCI_SETINDENTATIONGUIDES, iv); +} + + +// Set the background colour of indentation guides. +void QsciScintilla::setIndentationGuidesBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETBACK, STYLE_INDENTGUIDE, col); +} + + +// Set the foreground colour of indentation guides. +void QsciScintilla::setIndentationGuidesForegroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETFORE, STYLE_INDENTGUIDE, col); +} + + +// Return the indentation width. +int QsciScintilla::indentationWidth() const +{ + return SendScintilla(SCI_GETINDENT); +} + + +// Set the indentation width. +void QsciScintilla::setIndentationWidth(int width) +{ + SendScintilla(SCI_SETINDENT, width); +} + + +// Return the tab width. +int QsciScintilla::tabWidth() const +{ + return SendScintilla(SCI_GETTABWIDTH); +} + + +// Set the tab width. +void QsciScintilla::setTabWidth(int width) +{ + SendScintilla(SCI_SETTABWIDTH, width); +} + + +// Return the effect of the backspace key. +bool QsciScintilla::backspaceUnindents() const +{ + return SendScintilla(SCI_GETBACKSPACEUNINDENTS); +} + + +// Set the effect of the backspace key. +void QsciScintilla::setBackspaceUnindents(bool unindents) +{ + SendScintilla(SCI_SETBACKSPACEUNINDENTS, unindents); +} + + +// Return the effect of the tab key. +bool QsciScintilla::tabIndents() const +{ + return SendScintilla(SCI_GETTABINDENTS); +} + + +// Set the effect of the tab key. +void QsciScintilla::setTabIndents(bool indents) +{ + SendScintilla(SCI_SETTABINDENTS, indents); +} + + +// Return the indentation use of tabs. +bool QsciScintilla::indentationsUseTabs() const +{ + return SendScintilla(SCI_GETUSETABS); +} + + +// Set the indentation use of tabs. +void QsciScintilla::setIndentationsUseTabs(bool tabs) +{ + SendScintilla(SCI_SETUSETABS, tabs); +} + + +// Return the margin options. +int QsciScintilla::marginOptions() const +{ + return SendScintilla(SCI_GETMARGINOPTIONS); +} + + +// Set the margin options. +void QsciScintilla::setMarginOptions(int options) +{ + SendScintilla(SCI_SETMARGINOPTIONS, options); +} + + +// Return the margin type. +QsciScintilla::MarginType QsciScintilla::marginType(int margin) const +{ + return (MarginType)SendScintilla(SCI_GETMARGINTYPEN, margin); +} + + +// Set the margin type. +void QsciScintilla::setMarginType(int margin, QsciScintilla::MarginType type) +{ + SendScintilla(SCI_SETMARGINTYPEN, margin, type); +} + + +// Clear margin text. +void QsciScintilla::clearMarginText(int line) +{ + if (line < 0) + SendScintilla(SCI_MARGINTEXTCLEARALL); + else + SendScintilla(SCI_MARGINSETTEXT, line, (const char *)0); +} + + +// Annotate a line. +void QsciScintilla::setMarginText(int line, const QString &text, int style) +{ + int style_offset = SendScintilla(SCI_MARGINGETSTYLEOFFSET); + + SendScintilla(SCI_MARGINSETTEXT, line, + ScintillaBytesConstData(textAsBytes(text))); + + SendScintilla(SCI_MARGINSETSTYLE, line, style - style_offset); +} + + +// Annotate a line. +void QsciScintilla::setMarginText(int line, const QString &text, const QsciStyle &style) +{ + style.apply(this); + + setMarginText(line, text, style.style()); +} + + +// Annotate a line. +void QsciScintilla::setMarginText(int line, const QsciStyledText &text) +{ + text.apply(this); + + setMarginText(line, text.text(), text.style()); +} + + +// Annotate a line. +void QsciScintilla::setMarginText(int line, const QList &text) +{ + char *styles; + ScintillaBytes styled_text = styleText(text, &styles, + SendScintilla(SCI_MARGINGETSTYLEOFFSET)); + + SendScintilla(SCI_MARGINSETTEXT, line, + ScintillaBytesConstData(styled_text)); + SendScintilla(SCI_MARGINSETSTYLES, line, styles); + + delete[] styles; +} + + +// Return the state of line numbers in a margin. +bool QsciScintilla::marginLineNumbers(int margin) const +{ + return SendScintilla(SCI_GETMARGINTYPEN, margin); +} + + +// Enable and disable line numbers in a margin. +void QsciScintilla::setMarginLineNumbers(int margin, bool lnrs) +{ + SendScintilla(SCI_SETMARGINTYPEN, margin, + lnrs ? SC_MARGIN_NUMBER : SC_MARGIN_SYMBOL); +} + + +// Return the marker mask of a margin. +int QsciScintilla::marginMarkerMask(int margin) const +{ + return SendScintilla(SCI_GETMARGINMASKN, margin); +} + + +// Set the marker mask of a margin. +void QsciScintilla::setMarginMarkerMask(int margin,int mask) +{ + SendScintilla(SCI_SETMARGINMASKN, margin, mask); +} + + +// Return the state of a margin's sensitivity. +bool QsciScintilla::marginSensitivity(int margin) const +{ + return SendScintilla(SCI_GETMARGINSENSITIVEN, margin); +} + + +// Enable and disable a margin's sensitivity. +void QsciScintilla::setMarginSensitivity(int margin,bool sens) +{ + SendScintilla(SCI_SETMARGINSENSITIVEN, margin, sens); +} + + +// Return the width of a margin. +int QsciScintilla::marginWidth(int margin) const +{ + return SendScintilla(SCI_GETMARGINWIDTHN, margin); +} + + +// Set the width of a margin. +void QsciScintilla::setMarginWidth(int margin, int width) +{ + SendScintilla(SCI_SETMARGINWIDTHN, margin, width); +} + + +// Set the width of a margin to the width of some text. +void QsciScintilla::setMarginWidth(int margin, const QString &s) +{ + int width = SendScintilla(SCI_TEXTWIDTH, STYLE_LINENUMBER, + ScintillaBytesConstData(textAsBytes(s))); + + setMarginWidth(margin, width); +} + + +// Set the background colour of all margins. +void QsciScintilla::setMarginsBackgroundColor(const QColor &col) +{ + handleStylePaperChange(col, STYLE_LINENUMBER); +} + + +// Set the foreground colour of all margins. +void QsciScintilla::setMarginsForegroundColor(const QColor &col) +{ + handleStyleColorChange(col, STYLE_LINENUMBER); +} + + +// Set the font of all margins. +void QsciScintilla::setMarginsFont(const QFont &f) +{ + setStylesFont(f, STYLE_LINENUMBER); +} + + +// Define an indicator. +int QsciScintilla::indicatorDefine(IndicatorStyle style, int indicatorNumber) +{ + checkIndicator(indicatorNumber); + + if (indicatorNumber >= 0) + SendScintilla(SCI_INDICSETSTYLE, indicatorNumber, + static_cast(style)); + + return indicatorNumber; +} + + +// Return the state of an indicator being drawn under the text. +bool QsciScintilla::indicatorDrawUnder(int indicatorNumber) const +{ + if (indicatorNumber < 0 || indicatorNumber >= INDIC_IME) + return false; + + return SendScintilla(SCI_INDICGETUNDER, indicatorNumber); +} + + +// Set the state of indicators being drawn under the text. +void QsciScintilla::setIndicatorDrawUnder(bool under, int indicatorNumber) +{ + if (indicatorNumber < INDIC_IME) + { + // We ignore allocatedIndicators to allow any indicators defined + // elsewhere (e.g. in lexers) to be set. + if (indicatorNumber < 0) + { + for (int i = 0; i < INDIC_IME; ++i) + SendScintilla(SCI_INDICSETUNDER, i, under); + } + else + { + SendScintilla(SCI_INDICSETUNDER, indicatorNumber, under); + } + } +} + + +// Set the indicator foreground colour. +void QsciScintilla::setIndicatorForegroundColor(const QColor &col, + int indicatorNumber) +{ + if (indicatorNumber < INDIC_IME) + { + int alpha = col.alpha(); + + // We ignore allocatedIndicators to allow any indicators defined + // elsewhere (e.g. in lexers) to be set. + if (indicatorNumber < 0) + { + for (int i = 0; i < INDIC_IME; ++i) + { + SendScintilla(SCI_INDICSETFORE, i, col); + SendScintilla(SCI_INDICSETALPHA, i, alpha); + } + } + else + { + SendScintilla(SCI_INDICSETFORE, indicatorNumber, col); + SendScintilla(SCI_INDICSETALPHA, indicatorNumber, alpha); + } + } +} + + +// Set the indicator hover foreground colour. +void QsciScintilla::setIndicatorHoverForegroundColor(const QColor &col, + int indicatorNumber) +{ + if (indicatorNumber < INDIC_IME) + { + // We ignore allocatedIndicators to allow any indicators defined + // elsewhere (e.g. in lexers) to be set. + if (indicatorNumber < 0) + { + for (int i = 0; i < INDIC_IME; ++i) + SendScintilla(SCI_INDICSETHOVERFORE, i, col); + } + else + { + SendScintilla(SCI_INDICSETHOVERFORE, indicatorNumber, col); + } + } +} + + +// Set the indicator hover style. +void QsciScintilla::setIndicatorHoverStyle(IndicatorStyle style, + int indicatorNumber) +{ + if (indicatorNumber < INDIC_IME) + { + // We ignore allocatedIndicators to allow any indicators defined + // elsewhere (e.g. in lexers) to be set. + if (indicatorNumber < 0) + { + for (int i = 0; i < INDIC_IME; ++i) + SendScintilla(SCI_INDICSETHOVERSTYLE, i, + static_cast(style)); + } + else + { + SendScintilla(SCI_INDICSETHOVERSTYLE, indicatorNumber, + static_cast(style)); + } + } +} + + +// Set the indicator outline colour. +void QsciScintilla::setIndicatorOutlineColor(const QColor &col, int indicatorNumber) +{ + if (indicatorNumber < INDIC_IME) + { + int alpha = col.alpha(); + + // We ignore allocatedIndicators to allow any indicators defined + // elsewhere (e.g. in lexers) to be set. + if (indicatorNumber < 0) + { + for (int i = 0; i < INDIC_IME; ++i) + SendScintilla(SCI_INDICSETOUTLINEALPHA, i, alpha); + } + else + { + SendScintilla(SCI_INDICSETOUTLINEALPHA, indicatorNumber, alpha); + } + } +} + + +// Fill a range with an indicator. +void QsciScintilla::fillIndicatorRange(int lineFrom, int indexFrom, + int lineTo, int indexTo, int indicatorNumber) +{ + if (indicatorNumber < INDIC_IME) + { + int start = positionFromLineIndex(lineFrom, indexFrom); + int finish = positionFromLineIndex(lineTo, indexTo); + + // We ignore allocatedIndicators to allow any indicators defined + // elsewhere (e.g. in lexers) to be set. + if (indicatorNumber < 0) + { + for (int i = 0; i < INDIC_IME; ++i) + { + SendScintilla(SCI_SETINDICATORCURRENT, i); + SendScintilla(SCI_INDICATORFILLRANGE, start, finish - start); + } + } + else + { + SendScintilla(SCI_SETINDICATORCURRENT, indicatorNumber); + SendScintilla(SCI_INDICATORFILLRANGE, start, finish - start); + } + } +} + + +// Clear a range with an indicator. +void QsciScintilla::clearIndicatorRange(int lineFrom, int indexFrom, + int lineTo, int indexTo, int indicatorNumber) +{ + if (indicatorNumber < INDIC_IME) + { + int start = positionFromLineIndex(lineFrom, indexFrom); + int finish = positionFromLineIndex(lineTo, indexTo); + + // We ignore allocatedIndicators to allow any indicators defined + // elsewhere (e.g. in lexers) to be set. + if (indicatorNumber < 0) + { + for (int i = 0; i < INDIC_IME; ++i) + { + SendScintilla(SCI_SETINDICATORCURRENT, i); + SendScintilla(SCI_INDICATORCLEARRANGE, start, finish - start); + } + } + else + { + SendScintilla(SCI_SETINDICATORCURRENT, indicatorNumber); + SendScintilla(SCI_INDICATORCLEARRANGE, start, finish - start); + } + } +} + + +// Define a marker based on a symbol. +int QsciScintilla::markerDefine(MarkerSymbol sym, int markerNumber) +{ + checkMarker(markerNumber); + + if (markerNumber >= 0) + SendScintilla(SCI_MARKERDEFINE, markerNumber, static_cast(sym)); + + return markerNumber; +} + + +// Define a marker based on a character. +int QsciScintilla::markerDefine(char ch, int markerNumber) +{ + checkMarker(markerNumber); + + if (markerNumber >= 0) + SendScintilla(SCI_MARKERDEFINE, markerNumber, + static_cast(SC_MARK_CHARACTER) + ch); + + return markerNumber; +} + + +// Define a marker based on a QPixmap. +int QsciScintilla::markerDefine(const QPixmap &pm, int markerNumber) +{ + checkMarker(markerNumber); + + if (markerNumber >= 0) + SendScintilla(SCI_MARKERDEFINEPIXMAP, markerNumber, pm); + + return markerNumber; +} + + +// Define a marker based on a QImage. +int QsciScintilla::markerDefine(const QImage &im, int markerNumber) +{ + checkMarker(markerNumber); + + if (markerNumber >= 0) + { + SendScintilla(SCI_RGBAIMAGESETHEIGHT, im.height()); + SendScintilla(SCI_RGBAIMAGESETWIDTH, im.width()); + SendScintilla(SCI_MARKERDEFINERGBAIMAGE, markerNumber, im); + } + + return markerNumber; +} + + +// Add a marker to a line. +int QsciScintilla::markerAdd(int linenr, int markerNumber) +{ + if (markerNumber < 0 || markerNumber > MARKER_MAX || (allocatedMarkers & (1 << markerNumber)) == 0) + return -1; + + return SendScintilla(SCI_MARKERADD, linenr, markerNumber); +} + + +// Get the marker mask for a line. +unsigned QsciScintilla::markersAtLine(int linenr) const +{ + return SendScintilla(SCI_MARKERGET, linenr); +} + + +// Delete a marker from a line. +void QsciScintilla::markerDelete(int linenr, int markerNumber) +{ + if (markerNumber <= MARKER_MAX) + { + if (markerNumber < 0) + { + unsigned am = allocatedMarkers; + + for (int m = 0; m <= MARKER_MAX; ++m) + { + if (am & 1) + SendScintilla(SCI_MARKERDELETE, linenr, m); + + am >>= 1; + } + } + else if (allocatedMarkers & (1 << markerNumber)) + SendScintilla(SCI_MARKERDELETE, linenr, markerNumber); + } +} + + +// Delete a marker from the text. +void QsciScintilla::markerDeleteAll(int markerNumber) +{ + if (markerNumber <= MARKER_MAX) + { + if (markerNumber < 0) + SendScintilla(SCI_MARKERDELETEALL, -1); + else if (allocatedMarkers & (1 << markerNumber)) + SendScintilla(SCI_MARKERDELETEALL, markerNumber); + } +} + + +// Delete a marker handle from the text. +void QsciScintilla::markerDeleteHandle(int mhandle) +{ + SendScintilla(SCI_MARKERDELETEHANDLE, mhandle); +} + + +// Return the line containing a marker instance. +int QsciScintilla::markerLine(int mhandle) const +{ + return SendScintilla(SCI_MARKERLINEFROMHANDLE, mhandle); +} + + +// Search forwards for a marker. +int QsciScintilla::markerFindNext(int linenr, unsigned mask) const +{ + return SendScintilla(SCI_MARKERNEXT, linenr, mask); +} + + +// Search backwards for a marker. +int QsciScintilla::markerFindPrevious(int linenr, unsigned mask) const +{ + return SendScintilla(SCI_MARKERPREVIOUS, linenr, mask); +} + + +// Set the marker background colour. +void QsciScintilla::setMarkerBackgroundColor(const QColor &col, int markerNumber) +{ + if (markerNumber <= MARKER_MAX) + { + int alpha = col.alpha(); + + // An opaque background would make the text invisible. + if (alpha == 255) + alpha = SC_ALPHA_NOALPHA; + + if (markerNumber < 0) + { + unsigned am = allocatedMarkers; + + for (int m = 0; m <= MARKER_MAX; ++m) + { + if (am & 1) + { + SendScintilla(SCI_MARKERSETBACK, m, col); + SendScintilla(SCI_MARKERSETALPHA, m, alpha); + } + + am >>= 1; + } + } + else if (allocatedMarkers & (1 << markerNumber)) + { + SendScintilla(SCI_MARKERSETBACK, markerNumber, col); + SendScintilla(SCI_MARKERSETALPHA, markerNumber, alpha); + } + } +} + + +// Set the marker foreground colour. +void QsciScintilla::setMarkerForegroundColor(const QColor &col, int markerNumber) +{ + if (markerNumber <= MARKER_MAX) + { + if (markerNumber < 0) + { + unsigned am = allocatedMarkers; + + for (int m = 0; m <= MARKER_MAX; ++m) + { + if (am & 1) + SendScintilla(SCI_MARKERSETFORE, m, col); + + am >>= 1; + } + } + else if (allocatedMarkers & (1 << markerNumber)) + { + SendScintilla(SCI_MARKERSETFORE, markerNumber, col); + } + } +} + + +// Check a marker, allocating a marker number if necessary. +void QsciScintilla::checkMarker(int &markerNumber) +{ + allocateId(markerNumber, allocatedMarkers, 0, MARKER_MAX); +} + + +// Check an indicator, allocating an indicator number if necessary. +void QsciScintilla::checkIndicator(int &indicatorNumber) +{ + allocateId(indicatorNumber, allocatedIndicators, INDIC_CONTAINER, + INDIC_IME - 1); +} + + +// Make sure an identifier is valid and allocate it if necessary. +void QsciScintilla::allocateId(int &id, unsigned &allocated, int min, int max) +{ + if (id >= 0) + { + // Note that we allow existing identifiers to be explicitly redefined. + if (id > max) + id = -1; + } + else + { + unsigned aids = allocated >> min; + + // Find the smallest unallocated identifier. + for (id = min; id <= max; ++id) + { + if ((aids & 1) == 0) + break; + + aids >>= 1; + } + } + + // Allocate the identifier if it is valid. + if (id >= 0) + allocated |= (1 << id); +} + + +// Reset the fold margin colours. +void QsciScintilla::resetFoldMarginColors() +{ + SendScintilla(SCI_SETFOLDMARGINHICOLOUR, 0, 0L); + SendScintilla(SCI_SETFOLDMARGINCOLOUR, 0, 0L); +} + + +// Set the fold margin colours. +void QsciScintilla::setFoldMarginColors(const QColor &fore, const QColor &back) +{ + SendScintilla(SCI_SETFOLDMARGINHICOLOUR, 1, fore); + SendScintilla(SCI_SETFOLDMARGINCOLOUR, 1, back); +} + + +// Set the call tips background colour. +void QsciScintilla::setCallTipsBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_CALLTIPSETBACK, col); +} + + +// Set the call tips foreground colour. +void QsciScintilla::setCallTipsForegroundColor(const QColor &col) +{ + SendScintilla(SCI_CALLTIPSETFORE, col); +} + + +// Set the call tips highlight colour. +void QsciScintilla::setCallTipsHighlightColor(const QColor &col) +{ + SendScintilla(SCI_CALLTIPSETFOREHLT, col); +} + + +// Set the matched brace background colour. +void QsciScintilla::setMatchedBraceBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETBACK, STYLE_BRACELIGHT, col); +} + + +// Set the matched brace foreground colour. +void QsciScintilla::setMatchedBraceForegroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETFORE, STYLE_BRACELIGHT, col); +} + + +// Set the matched brace indicator. +void QsciScintilla::setMatchedBraceIndicator(int indicatorNumber) +{ + SendScintilla(SCI_BRACEHIGHLIGHTINDICATOR, 1, indicatorNumber); +} + + +// Reset the matched brace indicator. +void QsciScintilla::resetMatchedBraceIndicator() +{ + SendScintilla(SCI_BRACEHIGHLIGHTINDICATOR, 0, 0L); +} + + +// Set the unmatched brace background colour. +void QsciScintilla::setUnmatchedBraceBackgroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETBACK, STYLE_BRACEBAD, col); +} + + +// Set the unmatched brace foreground colour. +void QsciScintilla::setUnmatchedBraceForegroundColor(const QColor &col) +{ + SendScintilla(SCI_STYLESETFORE, STYLE_BRACEBAD, col); +} + + +// Set the unmatched brace indicator. +void QsciScintilla::setUnmatchedBraceIndicator(int indicatorNumber) +{ + SendScintilla(SCI_BRACEBADLIGHTINDICATOR, 1, indicatorNumber); +} + + +// Reset the unmatched brace indicator. +void QsciScintilla::resetUnmatchedBraceIndicator() +{ + SendScintilla(SCI_BRACEBADLIGHTINDICATOR, 0, 0L); +} + + +// Detach any lexer. +void QsciScintilla::detachLexer() +{ + if (!lex.isNull()) + { + lex->setEditor(0); + lex->disconnect(this); + + SendScintilla(SCI_STYLERESETDEFAULT); + SendScintilla(SCI_STYLECLEARALL); + SendScintilla(SCI_CLEARDOCUMENTSTYLE); + } +} + + +// Set the lexer. +void QsciScintilla::setLexer(QsciLexer *lexer) +{ + // Detach any current lexer. + detachLexer(); + + // Connect up the new lexer. + lex = lexer; + + if (lex) + { + if (lex->lexer()) + SendScintilla(SCI_SETLEXERLANGUAGE, lex->lexer()); + else + SendScintilla(SCI_SETLEXER, lex->lexerId()); + + lex->setEditor(this); + + connect(lex,SIGNAL(colorChanged(const QColor &, int)), + SLOT(handleStyleColorChange(const QColor &, int))); + connect(lex,SIGNAL(eolFillChanged(bool, int)), + SLOT(handleStyleEolFillChange(bool, int))); + connect(lex,SIGNAL(fontChanged(const QFont &, int)), + SLOT(handleStyleFontChange(const QFont &, int))); + connect(lex,SIGNAL(paperChanged(const QColor &, int)), + SLOT(handleStylePaperChange(const QColor &, int))); + connect(lex,SIGNAL(propertyChanged(const char *, const char *)), + SLOT(handlePropertyChange(const char *, const char *))); + + SendScintilla(SCI_SETPROPERTY, "fold", "1"); + SendScintilla(SCI_SETPROPERTY, "fold.html", "1"); + + // Set the keywords. Scintilla allows for sets numbered 0 to + // KEYWORDSET_MAX (although the lexers only seem to exploit 0 to + // KEYWORDSET_MAX - 1). We number from 1 in line with SciTE's property + // files. + for (int k = 0; k <= KEYWORDSET_MAX; ++k) + { + const char *kw = lex -> keywords(k + 1); + + if (!kw) + kw = ""; + + SendScintilla(SCI_SETKEYWORDS, k, kw); + } + + // Initialise each style. Do the default first so its (possibly + // incorrect) font setting gets reset when style 0 is set. + setLexerStyle(STYLE_DEFAULT); + + int nrStyles = 1 << SendScintilla(SCI_GETSTYLEBITS); + + for (int s = 0; s < nrStyles; ++s) + if (!lex->description(s).isEmpty()) + setLexerStyle(s); + + // Initialise the properties. + lex->refreshProperties(); + + // Set the auto-completion fillups and word separators. + setAutoCompletionFillupsEnabled(fillups_enabled); + wseps = lex->autoCompletionWordSeparators(); + + wchars = lex->wordCharacters(); + + if (!wchars) + wchars = defaultWordChars; + + SendScintilla(SCI_AUTOCSETIGNORECASE, !lex->caseSensitive()); + + recolor(); + } + else + { + SendScintilla(SCI_SETLEXER, SCLEX_CONTAINER); + + setColor(nl_text_colour); + setPaper(nl_paper_colour); + + SendScintilla(SCI_AUTOCSETFILLUPS, ""); + SendScintilla(SCI_AUTOCSETIGNORECASE, false); + wseps.clear(); + wchars = defaultWordChars; + } +} + + +// Set a particular style of the current lexer. +void QsciScintilla::setLexerStyle(int style) +{ + handleStyleColorChange(lex->color(style), style); + handleStyleEolFillChange(lex->eolFill(style), style); + handleStyleFontChange(lex->font(style), style); + handleStylePaperChange(lex->paper(style), style); +} + + +// Get the current lexer. +QsciLexer *QsciScintilla::lexer() const +{ + return lex; +} + + +// Handle a change in lexer style foreground colour. +void QsciScintilla::handleStyleColorChange(const QColor &c, int style) +{ + SendScintilla(SCI_STYLESETFORE, style, c); +} + + +// Handle a change in lexer style end-of-line fill. +void QsciScintilla::handleStyleEolFillChange(bool eolfill, int style) +{ + SendScintilla(SCI_STYLESETEOLFILLED, style, eolfill); +} + + +// Handle a change in lexer style font. +void QsciScintilla::handleStyleFontChange(const QFont &f, int style) +{ + setStylesFont(f, style); + + if (style == lex->braceStyle()) + { + setStylesFont(f, STYLE_BRACELIGHT); + setStylesFont(f, STYLE_BRACEBAD); + } +} + + +// Set the font for a style. +void QsciScintilla::setStylesFont(const QFont &f, int style) +{ + SendScintilla(SCI_STYLESETFONT, style, f.family().toLatin1().data()); + SendScintilla(SCI_STYLESETSIZEFRACTIONAL, style, + long(f.pointSizeF() * SC_FONT_SIZE_MULTIPLIER)); + + // Pass the Qt weight via the back door. + SendScintilla(SCI_STYLESETWEIGHT, style, -f.weight()); + + SendScintilla(SCI_STYLESETITALIC, style, f.italic()); + SendScintilla(SCI_STYLESETUNDERLINE, style, f.underline()); + + // Tie the font settings of the default style to that of style 0 (the style + // conventionally used for whitespace by lexers). This is needed so that + // fold marks, indentations, edge columns etc are set properly. + if (style == 0) + setStylesFont(f, STYLE_DEFAULT); +} + + +// Handle a change in lexer style background colour. +void QsciScintilla::handleStylePaperChange(const QColor &c, int style) +{ + SendScintilla(SCI_STYLESETBACK, style, c); +} + + +// Handle a change in lexer property. +void QsciScintilla::handlePropertyChange(const char *prop, const char *val) +{ + SendScintilla(SCI_SETPROPERTY, prop, val); +} + + +// Handle a change to the user visible user interface. +void QsciScintilla::handleUpdateUI(int) +{ + int newPos = SendScintilla(SCI_GETCURRENTPOS); + + if (newPos != oldPos) + { + oldPos = newPos; + + int line = SendScintilla(SCI_LINEFROMPOSITION, newPos); + int col = SendScintilla(SCI_GETCOLUMN, newPos); + + emit cursorPositionChanged(line, col); + } + + if (braceMode != NoBraceMatch) + braceMatch(); +} + + +// Handle brace matching. +void QsciScintilla::braceMatch() +{ + long braceAtCaret, braceOpposite; + + findMatchingBrace(braceAtCaret, braceOpposite, braceMode); + + if (braceAtCaret >= 0 && braceOpposite < 0) + { + SendScintilla(SCI_BRACEBADLIGHT, braceAtCaret); + SendScintilla(SCI_SETHIGHLIGHTGUIDE, 0UL); + } + else + { + char chBrace = SendScintilla(SCI_GETCHARAT, braceAtCaret); + + SendScintilla(SCI_BRACEHIGHLIGHT, braceAtCaret, braceOpposite); + + long columnAtCaret = SendScintilla(SCI_GETCOLUMN, braceAtCaret); + long columnOpposite = SendScintilla(SCI_GETCOLUMN, braceOpposite); + + if (chBrace == ':') + { + long lineStart = SendScintilla(SCI_LINEFROMPOSITION, braceAtCaret); + long indentPos = SendScintilla(SCI_GETLINEINDENTPOSITION, + lineStart); + long indentPosNext = SendScintilla(SCI_GETLINEINDENTPOSITION, + lineStart + 1); + + columnAtCaret = SendScintilla(SCI_GETCOLUMN, indentPos); + + long columnAtCaretNext = SendScintilla(SCI_GETCOLUMN, + indentPosNext); + long indentSize = SendScintilla(SCI_GETINDENT); + + if (columnAtCaretNext - indentSize > 1) + columnAtCaret = columnAtCaretNext - indentSize; + + if (columnOpposite == 0) + columnOpposite = columnAtCaret; + } + + long column = columnAtCaret; + + if (column > columnOpposite) + column = columnOpposite; + + SendScintilla(SCI_SETHIGHLIGHTGUIDE, column); + } +} + + +// Check if the character at a position is a brace. +long QsciScintilla::checkBrace(long pos, int brace_style, bool &colonMode) +{ + long brace_pos = -1; + char ch = SendScintilla(SCI_GETCHARAT, pos); + + if (ch == ':') + { + // A bit of a hack, we should really use a virtual. + if (!lex.isNull() && qstrcmp(lex->lexer(), "python") == 0) + { + brace_pos = pos; + colonMode = true; + } + } + else if (ch && strchr("[](){}<>", ch)) + { + if (brace_style < 0) + brace_pos = pos; + else + { + int style = SendScintilla(SCI_GETSTYLEAT, pos) & 0x1f; + + if (style == brace_style) + brace_pos = pos; + } + } + + return brace_pos; +} + + +// Find a brace and it's match. Return true if the current position is inside +// a pair of braces. +bool QsciScintilla::findMatchingBrace(long &brace, long &other,BraceMatch mode) +{ + bool colonMode = false; + int brace_style = (lex.isNull() ? -1 : lex->braceStyle()); + + brace = -1; + other = -1; + + long caretPos = SendScintilla(SCI_GETCURRENTPOS); + + if (caretPos > 0) + brace = checkBrace(caretPos - 1, brace_style, colonMode); + + bool isInside = false; + + if (brace < 0 && mode == SloppyBraceMatch) + { + brace = checkBrace(caretPos, brace_style, colonMode); + + if (brace >= 0 && !colonMode) + isInside = true; + } + + if (brace >= 0) + { + if (colonMode) + { + // Find the end of the Python indented block. + long lineStart = SendScintilla(SCI_LINEFROMPOSITION, brace); + long lineMaxSubord = SendScintilla(SCI_GETLASTCHILD, lineStart, -1); + + other = SendScintilla(SCI_GETLINEENDPOSITION, lineMaxSubord); + } + else + other = SendScintilla(SCI_BRACEMATCH, brace); + + if (other > brace) + isInside = !isInside; + } + + return isInside; +} + + +// Move to the matching brace. +void QsciScintilla::moveToMatchingBrace() +{ + gotoMatchingBrace(false); +} + + +// Select to the matching brace. +void QsciScintilla::selectToMatchingBrace() +{ + gotoMatchingBrace(true); +} + + +// Move to the matching brace and optionally select the text. +void QsciScintilla::gotoMatchingBrace(bool select) +{ + long braceAtCaret; + long braceOpposite; + + bool isInside = findMatchingBrace(braceAtCaret, braceOpposite, + SloppyBraceMatch); + + if (braceOpposite >= 0) + { + // Convert the character positions into caret positions based on + // whether the caret position was inside or outside the braces. + if (isInside) + { + if (braceOpposite > braceAtCaret) + braceAtCaret++; + else + braceOpposite++; + } + else + { + if (braceOpposite > braceAtCaret) + braceOpposite++; + else + braceAtCaret++; + } + + ensureLineVisible(SendScintilla(SCI_LINEFROMPOSITION, braceOpposite)); + + if (select) + SendScintilla(SCI_SETSEL, braceAtCaret, braceOpposite); + else + SendScintilla(SCI_SETSEL, braceOpposite, braceOpposite); + } +} + + +// Return a position from a line number and an index within the line. +int QsciScintilla::positionFromLineIndex(int line, int index) const +{ + int pos = SendScintilla(SCI_POSITIONFROMLINE, line); + + // Allow for multi-byte characters. + for(int i = 0; i < index; i++) + pos = SendScintilla(SCI_POSITIONAFTER, pos); + + return pos; +} + + +// Return a line number and an index within the line from a position. +void QsciScintilla::lineIndexFromPosition(int position, int *line, int *index) const +{ + int lin = SendScintilla(SCI_LINEFROMPOSITION, position); + int linpos = SendScintilla(SCI_POSITIONFROMLINE, lin); + int indx = 0; + + // Allow for multi-byte characters. + while (linpos < position) + { + int new_linpos = SendScintilla(SCI_POSITIONAFTER, linpos); + + // If the position hasn't moved then we must be at the end of the text + // (which implies that the position passed was beyond the end of the + // text). + if (new_linpos == linpos) + break; + + linpos = new_linpos; + ++indx; + } + + *line = lin; + *index = indx; +} + + +// Set the source of the automatic auto-completion list. +void QsciScintilla::setAutoCompletionSource(AutoCompletionSource source) +{ + acSource = source; +} + + +// Set the threshold for automatic auto-completion. +void QsciScintilla::setAutoCompletionThreshold(int thresh) +{ + acThresh = thresh; +} + + +// Set the auto-completion word separators if there is no current lexer. +void QsciScintilla::setAutoCompletionWordSeparators(const QStringList &separators) +{ + if (lex.isNull()) + wseps = separators; +} + + +// Explicitly auto-complete from all sources. +void QsciScintilla::autoCompleteFromAll() +{ + startAutoCompletion(AcsAll, false, use_single != AcusNever); +} + + +// Explicitly auto-complete from the APIs. +void QsciScintilla::autoCompleteFromAPIs() +{ + startAutoCompletion(AcsAPIs, false, use_single != AcusNever); +} + + +// Explicitly auto-complete from the document. +void QsciScintilla::autoCompleteFromDocument() +{ + startAutoCompletion(AcsDocument, false, use_single != AcusNever); +} + + +// Check if a character can be in a word. +bool QsciScintilla::isWordCharacter(char ch) const +{ + return (strchr(wchars, ch) != NULL); +} + + +// Return the set of valid word characters. +const char *QsciScintilla::wordCharacters() const +{ + return wchars; +} + + +// Recolour the document. +void QsciScintilla::recolor(int start, int end) +{ + SendScintilla(SCI_COLOURISE, start, end); +} + + +// Registered a QPixmap image. +void QsciScintilla::registerImage(int id, const QPixmap &pm) +{ + SendScintilla(SCI_REGISTERIMAGE, id, pm); +} + + +// Registered a QImage image. +void QsciScintilla::registerImage(int id, const QImage &im) +{ + SendScintilla(SCI_RGBAIMAGESETHEIGHT, im.height()); + SendScintilla(SCI_RGBAIMAGESETWIDTH, im.width()); + SendScintilla(SCI_REGISTERRGBAIMAGE, id, im); +} + + +// Clear all registered images. +void QsciScintilla::clearRegisteredImages() +{ + SendScintilla(SCI_CLEARREGISTEREDIMAGES); +} + + +// Enable auto-completion fill-ups. +void QsciScintilla::setAutoCompletionFillupsEnabled(bool enable) +{ + const char *fillups; + + if (!enable) + fillups = ""; + else if (!lex.isNull()) + fillups = lex->autoCompletionFillups(); + else + fillups = explicit_fillups.data(); + + SendScintilla(SCI_AUTOCSETFILLUPS, fillups); + + fillups_enabled = enable; +} + + +// See if auto-completion fill-ups are enabled. +bool QsciScintilla::autoCompletionFillupsEnabled() const +{ + return fillups_enabled; +} + + +// Set the fill-up characters for auto-completion if there is no current lexer. +void QsciScintilla::setAutoCompletionFillups(const char *fillups) +{ + explicit_fillups = fillups; + setAutoCompletionFillupsEnabled(fillups_enabled); +} + + +// Set the case sensitivity for auto-completion. +void QsciScintilla::setAutoCompletionCaseSensitivity(bool cs) +{ + SendScintilla(SCI_AUTOCSETIGNORECASE, !cs); +} + + +// Return the case sensitivity for auto-completion. +bool QsciScintilla::autoCompletionCaseSensitivity() const +{ + return !SendScintilla(SCI_AUTOCGETIGNORECASE); +} + + +// Set the replace word mode for auto-completion. +void QsciScintilla::setAutoCompletionReplaceWord(bool replace) +{ + SendScintilla(SCI_AUTOCSETDROPRESTOFWORD, replace); +} + + +// Return the replace word mode for auto-completion. +bool QsciScintilla::autoCompletionReplaceWord() const +{ + return SendScintilla(SCI_AUTOCGETDROPRESTOFWORD); +} + + +// Set the single item mode for auto-completion. +void QsciScintilla::setAutoCompletionUseSingle(AutoCompletionUseSingle single) +{ + use_single = single; +} + + +// Return the single item mode for auto-completion. +QsciScintilla::AutoCompletionUseSingle QsciScintilla::autoCompletionUseSingle() const +{ + return use_single; +} + + +// Set the single item mode for auto-completion (deprecated). +void QsciScintilla::setAutoCompletionShowSingle(bool single) +{ + use_single = (single ? AcusExplicit : AcusNever); +} + + +// Return the single item mode for auto-completion (deprecated). +bool QsciScintilla::autoCompletionShowSingle() const +{ + return (use_single != AcusNever); +} + + +// Set current call tip position. +void QsciScintilla::setCallTipsPosition(CallTipsPosition position) +{ + SendScintilla(SCI_CALLTIPSETPOSITION, (position == CallTipsAboveText)); + call_tips_position = position; +} + + +// Set current call tip style. +void QsciScintilla::setCallTipsStyle(CallTipsStyle style) +{ + call_tips_style = style; +} + + +// Set maximum number of call tips displayed. +void QsciScintilla::setCallTipsVisible(int nr) +{ + maxCallTips = nr; +} + + +// Set the document to display. +void QsciScintilla::setDocument(const QsciDocument &document) +{ + if (doc.pdoc != document.pdoc) + { + doc.undisplay(this); + doc.attach(document); + doc.display(this,&document); + } +} + + +// Ensure the document is read-write and return true if was was read-only. +bool QsciScintilla::ensureRW() +{ + bool ro = isReadOnly(); + + if (ro) + setReadOnly(false); + + return ro; +} + + +// Return the number of the first visible line. +int QsciScintilla::firstVisibleLine() const +{ + return SendScintilla(SCI_GETFIRSTVISIBLELINE); +} + + +// Set the number of the first visible line. +void QsciScintilla::setFirstVisibleLine(int linenr) +{ + SendScintilla(SCI_SETFIRSTVISIBLELINE, linenr); +} + + +// Return the height in pixels of the text in a particular line. +int QsciScintilla::textHeight(int linenr) const +{ + return SendScintilla(SCI_TEXTHEIGHT, linenr); +} + + +// See if auto-completion or user list is active. +bool QsciScintilla::isListActive() const +{ + return SendScintilla(SCI_AUTOCACTIVE); +} + + +// Cancel any current auto-completion or user list. +void QsciScintilla::cancelList() +{ + SendScintilla(SCI_AUTOCCANCEL); +} + + +// Handle a selection from the auto-completion list. +void QsciScintilla::handleAutoCompletionSelection() +{ + if (!lex.isNull()) + { + QsciAbstractAPIs *apis = lex->apis(); + + if (apis) + apis->autoCompletionSelected(acSelection); + } +} + + +// Display a user list. +void QsciScintilla::showUserList(int id, const QStringList &list) +{ + // Sanity check to make sure auto-completion doesn't get confused. + if (id <= 0) + return; + + SendScintilla(SCI_AUTOCSETSEPARATOR, userSeparator); + + ScintillaBytes s = textAsBytes(list.join(QChar(userSeparator))); + SendScintilla(SCI_USERLISTSHOW, id, ScintillaBytesConstData(s)); +} + + +// Translate the SCN_USERLISTSELECTION notification into something more useful. +void QsciScintilla::handleUserListSelection(const char *text, int id) +{ + emit userListActivated(id, QString(text)); + + // Make sure the editor hasn't been deactivated as a side effect. + activateWindow(); +} + + +// Return the case sensitivity of any lexer. +bool QsciScintilla::caseSensitive() const +{ + return lex.isNull() ? true : lex->caseSensitive(); +} + + +// Return true if the current list is an auto-completion list rather than a +// user list. +bool QsciScintilla::isAutoCompletionList() const +{ + return (SendScintilla(SCI_AUTOCGETSEPARATOR) == acSeparator); +} + + +// Read the text from a QIODevice. +bool QsciScintilla::read(QIODevice *io) +{ + const int min_size = 1024 * 8; + + int buf_size = min_size; + char *buf = new char[buf_size]; + + int data_len = 0; + bool ok = true; + + qint64 part; + + // Read the whole lot in so we don't have to worry about character + // boundaries. + do + { + // Make sure there is a minimum amount of room. + if (buf_size - data_len < min_size) + { + buf_size *= 2; + char *new_buf = new char[buf_size * 2]; + + memcpy(new_buf, buf, data_len); + delete[] buf; + buf = new_buf; + } + + part = io->read(buf + data_len, buf_size - data_len - 1); + data_len += part; + } + while (part > 0); + + if (part < 0) + ok = false; + else + { + buf[data_len] = '\0'; + + bool ro = ensureRW(); + + SendScintilla(SCI_SETTEXT, buf); + SendScintilla(SCI_EMPTYUNDOBUFFER); + + setReadOnly(ro); + } + + delete[] buf; + + return ok; +} + + +// Write the text to a QIODevice. +bool QsciScintilla::write(QIODevice *io) const +{ + const char *buf = reinterpret_cast(SendScintillaPtrResult(SCI_GETCHARACTERPOINTER)); + + const char *bp = buf; + uint buflen = qstrlen(buf); + + while (buflen > 0) + { + qint64 part = io->write(bp, buflen); + + if (part < 0) + return false; + + bp += part; + buflen -= part; + } + + return true; +} + + +// Return the word at the given coordinates. +QString QsciScintilla::wordAtLineIndex(int line, int index) const +{ + return wordAtPosition(positionFromLineIndex(line, index)); +} + + +// Return the word at the given coordinates. +QString QsciScintilla::wordAtPoint(const QPoint &point) const +{ + long close_pos = SendScintilla(SCI_POSITIONFROMPOINTCLOSE, point.x(), + point.y()); + + return wordAtPosition(close_pos); +} + + +// Return the word at the given position. +QString QsciScintilla::wordAtPosition(int position) const +{ + if (position < 0) + return QString(); + + long start_pos = SendScintilla(SCI_WORDSTARTPOSITION, position, true); + long end_pos = SendScintilla(SCI_WORDENDPOSITION, position, true); + int word_len = end_pos - start_pos; + + if (word_len <= 0) + return QString(); + + char *buf = new char[word_len + 1]; + SendScintilla(SCI_GETTEXTRANGE, start_pos, end_pos, buf); + QString word = bytesAsText(buf); + delete[] buf; + + return word; +} + + +// Return the display style for annotations. +QsciScintilla::AnnotationDisplay QsciScintilla::annotationDisplay() const +{ + return (AnnotationDisplay)SendScintilla(SCI_ANNOTATIONGETVISIBLE); +} + + +// Set the display style for annotations. +void QsciScintilla::setAnnotationDisplay(QsciScintilla::AnnotationDisplay display) +{ + SendScintilla(SCI_ANNOTATIONSETVISIBLE, display); + setScrollBars(); +} + + +// Clear annotations. +void QsciScintilla::clearAnnotations(int line) +{ + if (line >= 0) + SendScintilla(SCI_ANNOTATIONSETTEXT, line, (const char *)0); + else + SendScintilla(SCI_ANNOTATIONCLEARALL); + + setScrollBars(); +} + + +// Annotate a line. +void QsciScintilla::annotate(int line, const QString &text, int style) +{ + int style_offset = SendScintilla(SCI_ANNOTATIONGETSTYLEOFFSET); + + ScintillaBytes s = textAsBytes(text); + + SendScintilla(SCI_ANNOTATIONSETTEXT, line, ScintillaBytesConstData(s)); + SendScintilla(SCI_ANNOTATIONSETSTYLE, line, style - style_offset); + + setScrollBars(); +} + + +// Annotate a line. +void QsciScintilla::annotate(int line, const QString &text, const QsciStyle &style) +{ + style.apply(this); + + annotate(line, text, style.style()); +} + + +// Annotate a line. +void QsciScintilla::annotate(int line, const QsciStyledText &text) +{ + text.apply(this); + + annotate(line, text.text(), text.style()); +} + + +// Annotate a line. +void QsciScintilla::annotate(int line, const QList &text) +{ + char *styles; + ScintillaBytes styled_text = styleText(text, &styles, + SendScintilla(SCI_ANNOTATIONGETSTYLEOFFSET)); + + SendScintilla(SCI_ANNOTATIONSETTEXT, line, + ScintillaBytesConstData(styled_text)); + SendScintilla(SCI_ANNOTATIONSETSTYLES, line, styles); + + delete[] styles; +} + + +// Get the annotation for a line, if any. +QString QsciScintilla::annotation(int line) const +{ + char *buf = new char[SendScintilla(SCI_ANNOTATIONGETTEXT, line, (const char *)0) + 1]; + + buf[SendScintilla(SCI_ANNOTATIONGETTEXT, line, buf)] = '\0'; + + QString qs = bytesAsText(buf); + delete[] buf; + + return qs; +} + + +// Convert a list of styled text to the low-level arrays. +QsciScintillaBase::ScintillaBytes QsciScintilla::styleText(const QList &styled_text, char **styles, int style_offset) +{ + QString text; + int i; + + // Build the full text. + for (i = 0; i < styled_text.count(); ++i) + { + const QsciStyledText &st = styled_text[i]; + + st.apply(this); + + text.append(st.text()); + } + + ScintillaBytes s = textAsBytes(text); + + // There is a style byte for every byte. + char *sp = *styles = new char[s.length()]; + + for (i = 0; i < styled_text.count(); ++i) + { + const QsciStyledText &st = styled_text[i]; + ScintillaBytes part = textAsBytes(st.text()); + int part_length = part.length(); + + for (int c = 0; c < part_length; ++c) + *sp++ = (char)(st.style() - style_offset); + } + + return s; +} + + +// Convert Scintilla modifiers to the Qt equivalent. +int QsciScintilla::mapModifiers(int modifiers) +{ + int state = 0; + + if (modifiers & SCMOD_SHIFT) + state |= Qt::ShiftModifier; + + if (modifiers & SCMOD_CTRL) + state |= Qt::ControlModifier; + + if (modifiers & SCMOD_ALT) + state |= Qt::AltModifier; + + if (modifiers & (SCMOD_SUPER | SCMOD_META)) + state |= Qt::MetaModifier; + + return state; +} + + +// Re-implemented to handle shortcut overrides. +bool QsciScintilla::event(QEvent *e) +{ + if (e->type() == QEvent::ShortcutOverride && !isReadOnly()) + { + QKeyEvent *ke = static_cast(e); + + if (ke->key()) + { + // We want ordinary characters. + if ((ke->modifiers() == Qt::NoModifier || ke->modifiers() == Qt::ShiftModifier || ke->modifiers() == Qt::KeypadModifier) && ke->key() < Qt::Key_Escape) + { + ke->accept(); + return true; + } + + // We want any key that is bound. + QsciCommand *cmd = stdCmds->boundTo(ke->key() | ke->modifiers()); + + if (cmd) + { + ke->accept(); + return true; + } + } + } + + return QsciScintillaBase::event(e); +} + + +// Re-implemented to handle chenges to the enabled state. +void QsciScintilla::changeEvent(QEvent *e) +{ + QsciScintillaBase::changeEvent(e); + + if (e->type() != QEvent::EnabledChange) + return; + + if (isEnabled()) + SendScintilla(SCI_SETCARETSTYLE, CARETSTYLE_LINE); + else + SendScintilla(SCI_SETCARETSTYLE, CARETSTYLE_INVISIBLE); + + QColor fore = palette().color(QPalette::Disabled, QPalette::Text); + QColor back = palette().color(QPalette::Disabled, QPalette::Base); + + if (lex.isNull()) + { + if (isEnabled()) + { + fore = nl_text_colour; + back = nl_paper_colour; + } + + SendScintilla(SCI_STYLESETFORE, 0, fore); + + // Assume style 0 applies to everything so that we don't need to use + // SCI_STYLECLEARALL which clears everything. We still have to set the + // default style as well for the background without any text. + SendScintilla(SCI_STYLESETBACK, 0, back); + SendScintilla(SCI_STYLESETBACK, STYLE_DEFAULT, back); + } + else + { + setEnabledColors(STYLE_DEFAULT, fore, back); + + int nrStyles = 1 << SendScintilla(SCI_GETSTYLEBITS); + + for (int s = 0; s < nrStyles; ++s) + if (!lex->description(s).isNull()) + setEnabledColors(s, fore, back); + } +} + + +// Set the foreground and background colours for a style. +void QsciScintilla::setEnabledColors(int style, QColor &fore, QColor &back) +{ + if (isEnabled()) + { + fore = lex->color(style); + back = lex->paper(style); + } + + handleStyleColorChange(fore, style); + handleStylePaperChange(back, style); +} + + +// Re-implemented to implement a more Qt-like context menu. +void QsciScintilla::contextMenuEvent(QContextMenuEvent *e) +{ + QMenu *menu = createStandardContextMenu(); + + if (menu) + { + menu->setAttribute(Qt::WA_DeleteOnClose); + menu->popup(e->globalPos()); + } +} + + +// Create an instance of the standard context menu. +QMenu *QsciScintilla::createStandardContextMenu() +{ + bool read_only = isReadOnly(); + bool has_selection = hasSelectedText(); + QMenu *menu = new QMenu(this); + QAction *action; + + if (!read_only) + { + action = menu->addAction(tr("&Undo"), this, SLOT(undo())); + set_shortcut(action, QsciCommand::Undo); + action->setEnabled(isUndoAvailable()); + + action = menu->addAction(tr("&Redo"), this, SLOT(redo())); + set_shortcut(action, QsciCommand::Redo); + action->setEnabled(isRedoAvailable()); + + menu->addSeparator(); + + action = menu->addAction(tr("Cu&t"), this, SLOT(cut())); + set_shortcut(action, QsciCommand::SelectionCut); + action->setEnabled(has_selection); + } + + action = menu->addAction(tr("&Copy"), this, SLOT(copy())); + set_shortcut(action, QsciCommand::SelectionCopy); + action->setEnabled(has_selection); + + if (!read_only) + { + action = menu->addAction(tr("&Paste"), this, SLOT(paste())); + set_shortcut(action, QsciCommand::Paste); + action->setEnabled(SendScintilla(SCI_CANPASTE)); + + action = menu->addAction(tr("Delete"), this, SLOT(delete_selection())); + action->setEnabled(has_selection); + } + + if (!menu->isEmpty()) + menu->addSeparator(); + + action = menu->addAction(tr("Select All"), this, SLOT(selectAll())); + set_shortcut(action, QsciCommand::SelectAll); + action->setEnabled(length() != 0); + + return menu; +} + + +// Set the shortcut for an action using any current key binding. +void QsciScintilla::set_shortcut(QAction *action, QsciCommand::Command cmd_id) const +{ + QsciCommand *cmd = stdCmds->find(cmd_id); + + if (cmd && cmd->key()) + action->setShortcut(QKeySequence(cmd->key())); +} + + +// Delete the current selection. +void QsciScintilla::delete_selection() +{ + SendScintilla(SCI_CLEAR); +} diff --git a/libs/qscintilla/Qt4Qt5/qsciscintillabase.cpp b/libs/qscintilla/Qt4Qt5/qsciscintillabase.cpp new file mode 100644 index 000000000..b1b3361b9 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qsciscintillabase.cpp @@ -0,0 +1,799 @@ +// This module implements the "official" low-level API. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qsciscintillabase.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ScintillaQt.h" + + +// The #defines in Scintilla.h and the enums in qsciscintillabase.h conflict +// (because we want to use the same names) so we have to undefine those we use +// in this file. +#undef SCI_SETCARETPERIOD +#undef SCK_DOWN +#undef SCK_UP +#undef SCK_LEFT +#undef SCK_RIGHT +#undef SCK_HOME +#undef SCK_END +#undef SCK_PRIOR +#undef SCK_NEXT +#undef SCK_DELETE +#undef SCK_INSERT +#undef SCK_ESCAPE +#undef SCK_BACK +#undef SCK_TAB +#undef SCK_RETURN +#undef SCK_ADD +#undef SCK_SUBTRACT +#undef SCK_DIVIDE +#undef SCK_WIN +#undef SCK_RWIN +#undef SCK_MENU + + +// Remember if we have linked the lexers. +static bool lexersLinked = false; + +// The list of instances. +static QList poolList; + +// Mime support. +static const QLatin1String mimeTextPlain("text/plain"); +static const QLatin1String mimeRectangularWin("MSDEVColumnSelect"); +static const QLatin1String mimeRectangular("text/x-qscintilla-rectangular"); + +#if (QT_VERSION >= 0x040200 && QT_VERSION < 0x050000 && defined(Q_OS_MAC)) || (QT_VERSION >= 0x050200 && defined(Q_OS_OSX)) +extern void initialiseRectangularPasteboardMime(); +#endif + +// The ctor. +QsciScintillaBase::QsciScintillaBase(QWidget *parent) + : QAbstractScrollArea(parent), preeditPos(-1), preeditNrBytes(0) +#if QT_VERSION >= 0x050000 + , clickCausedFocus(false) +#endif +{ + connect(verticalScrollBar(), SIGNAL(valueChanged(int)), + SLOT(handleVSb(int))); + + connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), + SLOT(handleHSb(int))); + + setAcceptDrops(true); + setFocusPolicy(Qt::WheelFocus); + setAttribute(Qt::WA_KeyCompression); + setAttribute(Qt::WA_InputMethodEnabled); +#if QT_VERSION >= 0x050100 + setInputMethodHints( + Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhMultiLine); +#elif QT_VERSION >= 0x040600 + setInputMethodHints(Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText); +#endif + + viewport()->setBackgroundRole(QPalette::Base); + viewport()->setMouseTracking(true); + viewport()->setAttribute(Qt::WA_NoSystemBackground); + + triple_click.setSingleShot(true); + +#if (QT_VERSION >= 0x040200 && QT_VERSION < 0x050000 && defined(Q_OS_MAC)) || (QT_VERSION >= 0x050200 && defined(Q_OS_OSX)) + initialiseRectangularPasteboardMime(); +#endif + + sci = new QsciScintillaQt(this); + + SendScintilla(SCI_SETCARETPERIOD, QApplication::cursorFlashTime() / 2); + + // Make sure the lexers are linked in. + if (!lexersLinked) + { + Scintilla_LinkLexers(); + lexersLinked = true; + } + + QClipboard *cb = QApplication::clipboard(); + + if (cb->supportsSelection()) + connect(cb, SIGNAL(selectionChanged()), SLOT(handleSelection())); + + // Add it to the pool. + poolList.append(this); +} + + +// The dtor. +QsciScintillaBase::~QsciScintillaBase() +{ + // The QsciScintillaQt object isn't a child so delete it explicitly. + delete sci; + + // Remove it from the pool. + poolList.removeAt(poolList.indexOf(this)); +} + + +// Return an instance from the pool. +QsciScintillaBase *QsciScintillaBase::pool() +{ + return poolList.first(); +} + + +// Tell Scintilla to update the scroll bars. Scintilla should be doing this +// itself. +void QsciScintillaBase::setScrollBars() +{ + sci->SetScrollBars(); +} + + +// Send a message to the real Scintilla widget using the low level Scintilla +// API. +long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, + long lParam) const +{ + return sci->WndProc(msg, wParam, lParam); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, + void *lParam) const +{ + return sci->WndProc(msg, wParam, reinterpret_cast(lParam)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, + const char *lParam) const +{ + return sci->WndProc(msg, wParam, reinterpret_cast(lParam)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, + const char *lParam) const +{ + return sci->WndProc(msg, static_cast(0), + reinterpret_cast(lParam)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, const char *wParam, + const char *lParam) const +{ + return sci->WndProc(msg, reinterpret_cast(wParam), + reinterpret_cast(lParam)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, long wParam) const +{ + return sci->WndProc(msg, static_cast(wParam), + static_cast(0)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, int wParam) const +{ + return sci->WndProc(msg, static_cast(wParam), + static_cast(0)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, long cpMin, long cpMax, + char *lpstrText) const +{ + QSCI_SCI_NAMESPACE(TextRange) tr; + + tr.chrg.cpMin = cpMin; + tr.chrg.cpMax = cpMax; + tr.lpstrText = lpstrText; + + return sci->WndProc(msg, static_cast(0), + reinterpret_cast(&tr)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, + const QColor &col) const +{ + sptr_t lParam = (col.blue() << 16) | (col.green() << 8) | col.red(); + + return sci->WndProc(msg, wParam, lParam); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, const QColor &col) const +{ + uptr_t wParam = (col.blue() << 16) | (col.green() << 8) | col.red(); + + return sci->WndProc(msg, wParam, static_cast(0)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, + QPainter *hdc, const QRect &rc, long cpMin, long cpMax) const +{ + QSCI_SCI_NAMESPACE(RangeToFormat) rf; + + rf.hdc = rf.hdcTarget = reinterpret_cast(hdc); + + rf.rc.left = rc.left(); + rf.rc.top = rc.top(); + rf.rc.right = rc.right() + 1; + rf.rc.bottom = rc.bottom() + 1; + + rf.chrg.cpMin = cpMin; + rf.chrg.cpMax = cpMax; + + return sci->WndProc(msg, wParam, reinterpret_cast(&rf)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, + const QPixmap &lParam) const +{ + return sci->WndProc(msg, wParam, reinterpret_cast(&lParam)); +} + + +// Overloaded message send. +long QsciScintillaBase::SendScintilla(unsigned int msg, unsigned long wParam, + const QImage &lParam) const +{ + return sci->WndProc(msg, wParam, reinterpret_cast(&lParam)); +} + + +// Send a message to the real Scintilla widget using the low level Scintilla +// API that returns a pointer result. +void *QsciScintillaBase::SendScintillaPtrResult(unsigned int msg) const +{ + return reinterpret_cast(sci->WndProc(msg, static_cast(0), + static_cast(0))); +} + + +// Re-implemented to handle the context menu. +void QsciScintillaBase::contextMenuEvent(QContextMenuEvent *e) +{ + sci->ContextMenu(QSCI_SCI_NAMESPACE(Point)(e->globalX(), e->globalY())); +} + + +// Re-implemented to tell the widget it has the focus. +void QsciScintillaBase::focusInEvent(QFocusEvent *e) +{ + sci->SetFocusState(true); + +#if QT_VERSION >= 0x050000 + clickCausedFocus = (e->reason() == Qt::MouseFocusReason); +#endif + + QAbstractScrollArea::focusInEvent(e); +} + + +// Re-implemented to tell the widget it has lost the focus. +void QsciScintillaBase::focusOutEvent(QFocusEvent *e) +{ + if (e->reason() == Qt::ActiveWindowFocusReason) + { + // Only tell Scintilla we have lost focus if the new active window + // isn't our auto-completion list. This is probably only an issue on + // Linux and there are still problems because subsequent focus out + // events don't always seem to get generated (at least with Qt5). + + QWidget *aw = QApplication::activeWindow(); + + if (!aw || aw->parent() != this || !aw->inherits("QsciSciListBox")) + sci->SetFocusState(false); + } + else + { + sci->SetFocusState(false); + } + + QAbstractScrollArea::focusOutEvent(e); +} + + +// Re-implemented to make sure tabs are passed to the editor. +bool QsciScintillaBase::focusNextPrevChild(bool next) +{ + if (!sci->pdoc->IsReadOnly()) + return false; + + return QAbstractScrollArea::focusNextPrevChild(next); +} + + +// Handle the selection changing. +void QsciScintillaBase::handleSelection() +{ + if (!QApplication::clipboard()->ownsSelection()) + sci->UnclaimSelection(); +} + + +// Handle key presses. +void QsciScintillaBase::keyPressEvent(QKeyEvent *e) +{ + int modifiers = 0; + + if (e->modifiers() & Qt::ShiftModifier) + modifiers |= SCMOD_SHIFT; + + if (e->modifiers() & Qt::ControlModifier) + modifiers |= SCMOD_CTRL; + + if (e->modifiers() & Qt::AltModifier) + modifiers |= SCMOD_ALT; + + if (e->modifiers() & Qt::MetaModifier) + modifiers |= SCMOD_META; + + int key = commandKey(e->key(), modifiers); + + if (key) + { + bool consumed = false; + + sci->KeyDownWithModifiers(key, modifiers, &consumed); + + if (consumed) + { + e->accept(); + return; + } + } + + QString text = e->text(); + + if (!text.isEmpty() && text[0].isPrint()) + { + ScintillaBytes bytes = textAsBytes(text); + sci->AddCharUTF(bytes.data(), bytes.length()); + e->accept(); + } + else + { + QAbstractScrollArea::keyPressEvent(e); + } +} + + +// Map a Qt key to a valid Scintilla command key, or 0 if none. +int QsciScintillaBase::commandKey(int qt_key, int &modifiers) +{ + int key; + + switch (qt_key) + { + case Qt::Key_Down: + key = SCK_DOWN; + break; + + case Qt::Key_Up: + key = SCK_UP; + break; + + case Qt::Key_Left: + key = SCK_LEFT; + break; + + case Qt::Key_Right: + key = SCK_RIGHT; + break; + + case Qt::Key_Home: + key = SCK_HOME; + break; + + case Qt::Key_End: + key = SCK_END; + break; + + case Qt::Key_PageUp: + key = SCK_PRIOR; + break; + + case Qt::Key_PageDown: + key = SCK_NEXT; + break; + + case Qt::Key_Delete: + key = SCK_DELETE; + break; + + case Qt::Key_Insert: + key = SCK_INSERT; + break; + + case Qt::Key_Escape: + key = SCK_ESCAPE; + break; + + case Qt::Key_Backspace: + key = SCK_BACK; + break; + + case Qt::Key_Tab: + key = SCK_TAB; + break; + + case Qt::Key_Backtab: + // Scintilla assumes a backtab is shift-tab. + key = SCK_TAB; + modifiers |= SCMOD_SHIFT; + break; + + case Qt::Key_Return: + case Qt::Key_Enter: + key = SCK_RETURN; + break; + + case Qt::Key_Super_L: + key = SCK_WIN; + break; + + case Qt::Key_Super_R: + key = SCK_RWIN; + break; + + case Qt::Key_Menu: + key = SCK_MENU; + break; + + default: + if ((key = qt_key) > 0x7f) + key = 0; + } + + return key; +} + + +// Encode a QString as bytes. +QsciScintillaBase::ScintillaBytes QsciScintillaBase::textAsBytes(const QString &text) const +{ + if (sci->IsUnicodeMode()) + return text.toUtf8(); + + return text.toLatin1(); +} + + +// Decode bytes as a QString. +QString QsciScintillaBase::bytesAsText(const char *bytes) const +{ + if (sci->IsUnicodeMode()) + return QString::fromUtf8(bytes); + + return QString::fromLatin1(bytes); +} + + +// Handle a mouse button double click. +void QsciScintillaBase::mouseDoubleClickEvent(QMouseEvent *e) +{ + if (e->button() != Qt::LeftButton) + { + e->ignore(); + return; + } + + setFocus(); + + // Make sure Scintilla will interpret this as a double-click. + unsigned clickTime = sci->lastClickTime + QSCI_SCI_NAMESPACE(Platform)::DoubleClickTime() - 1; + + bool shift = e->modifiers() & Qt::ShiftModifier; + bool ctrl = e->modifiers() & Qt::ControlModifier; + bool alt = e->modifiers() & Qt::AltModifier; + + sci->ButtonDown(QSCI_SCI_NAMESPACE(Point)(e->x(), e->y()), clickTime, + shift, ctrl, alt); + + // Remember the current position and time in case it turns into a triple + // click. + triple_click_at = e->globalPos(); + triple_click.start(QApplication::doubleClickInterval()); +} + + +// Handle a mouse move. +void QsciScintillaBase::mouseMoveEvent(QMouseEvent *e) +{ + sci->ButtonMove(QSCI_SCI_NAMESPACE(Point)(e->x(), e->y())); +} + + +// Handle a mouse button press. +void QsciScintillaBase::mousePressEvent(QMouseEvent *e) +{ + setFocus(); + + QSCI_SCI_NAMESPACE(Point) pt(e->x(), e->y()); + + if (e->button() == Qt::LeftButton) + { + unsigned clickTime; + + // It is a triple click if the timer is running and the mouse hasn't + // moved too much. + if (triple_click.isActive() && (e->globalPos() - triple_click_at).manhattanLength() < QApplication::startDragDistance()) + clickTime = sci->lastClickTime + QSCI_SCI_NAMESPACE(Platform)::DoubleClickTime() - 1; + else + clickTime = sci->lastClickTime + QSCI_SCI_NAMESPACE(Platform)::DoubleClickTime() + 1; + + triple_click.stop(); + + // Scintilla uses the Alt modifier to initiate rectangular selection. + // However the GTK port (under X11, not Windows) uses the Control + // modifier (by default, although it is configurable). It does this + // because most X11 window managers hijack Alt-drag to move the window. + // We do the same, except that (for the moment at least) we don't allow + // the modifier to be configured. + bool shift = e->modifiers() & Qt::ShiftModifier; + bool ctrl = e->modifiers() & Qt::ControlModifier; +#if defined(Q_OS_MAC) || defined(Q_OS_WIN) + bool alt = e->modifiers() & Qt::AltModifier; +#else + bool alt = ctrl; +#endif + + sci->ButtonDown(pt, clickTime, shift, ctrl, alt); + } + else if (e->button() == Qt::MidButton) + { + QClipboard *cb = QApplication::clipboard(); + + if (cb->supportsSelection()) + { + int pos = sci->PositionFromLocation(pt); + + sci->sel.Clear(); + sci->SetSelection(pos, pos); + + sci->pasteFromClipboard(QClipboard::Selection); + } + } +} + + +// Handle a mouse button releases. +void QsciScintillaBase::mouseReleaseEvent(QMouseEvent *e) +{ + if (e->button() != Qt::LeftButton) + return; + + QSCI_SCI_NAMESPACE(Point) pt(e->x(), e->y()); + + if (sci->HaveMouseCapture()) + { + bool ctrl = e->modifiers() & Qt::ControlModifier; + + sci->ButtonUp(pt, 0, ctrl); + } + +#if QT_VERSION >= 0x050000 + if (!sci->pdoc->IsReadOnly() && !sci->PointInSelMargin(pt) && qApp->autoSipEnabled()) + { + QStyle::RequestSoftwareInputPanel rsip = QStyle::RequestSoftwareInputPanel(style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + + if (!clickCausedFocus || rsip == QStyle::RSIP_OnMouseClick) + qApp->inputMethod()->show(); + } + + clickCausedFocus = false; +#endif +} + + +// Handle paint events. +void QsciScintillaBase::paintEvent(QPaintEvent *e) +{ + sci->paintEvent(e); +} + + +// Handle resize events. +void QsciScintillaBase::resizeEvent(QResizeEvent *) +{ + sci->ChangeSize(); +} + + +// Re-implemented to suppress the default behaviour as Scintilla works at a +// more fundamental level. +void QsciScintillaBase::scrollContentsBy(int, int) +{ +} + + +// Handle the vertical scrollbar. +void QsciScintillaBase::handleVSb(int value) +{ + sci->ScrollTo(value); +} + + +// Handle the horizontal scrollbar. +void QsciScintillaBase::handleHSb(int value) +{ + sci->HorizontalScrollTo(value); +} + + +// Handle drag enters. +void QsciScintillaBase::dragEnterEvent(QDragEnterEvent *e) +{ + QsciScintillaBase::dragMoveEvent(e); +} + + +// Handle drag leaves. +void QsciScintillaBase::dragLeaveEvent(QDragLeaveEvent *) +{ + sci->SetDragPosition(QSCI_SCI_NAMESPACE(SelectionPosition)()); +} + + +// Handle drag moves. +void QsciScintillaBase::dragMoveEvent(QDragMoveEvent *e) +{ + sci->SetDragPosition( + sci->SPositionFromLocation( + QSCI_SCI_NAMESPACE(Point)(e->pos().x(), e->pos().y()), + false, false, sci->UserVirtualSpace())); + + acceptAction(e); +} + + +// Handle drops. +void QsciScintillaBase::dropEvent(QDropEvent *e) +{ + bool moving; + int len; + const char *s; + bool rectangular; + + acceptAction(e); + + if (!e->isAccepted()) + return; + + moving = (e->dropAction() == Qt::MoveAction); + + QByteArray text = fromMimeData(e->mimeData(), rectangular); + len = text.length(); + s = text.data(); + + std::string dest = QSCI_SCI_NAMESPACE(Document)::TransformLineEnds(s, len, + sci->pdoc->eolMode); + + sci->DropAt(sci->posDrop, dest.c_str(), dest.length(), moving, + rectangular); + + sci->Redraw(); +} + + +void QsciScintillaBase::acceptAction(QDropEvent *e) +{ + if (sci->pdoc->IsReadOnly() || !canInsertFromMimeData(e->mimeData())) + e->ignore(); + else + e->acceptProposedAction(); +} + + +// See if a MIME data object can be decoded. +bool QsciScintillaBase::canInsertFromMimeData(const QMimeData *source) const +{ + return source->hasFormat(mimeTextPlain); +} + + +// Create text from a MIME data object. +QByteArray QsciScintillaBase::fromMimeData(const QMimeData *source, bool &rectangular) const +{ + // See if it is rectangular. We try all of the different formats that + // Scintilla supports in case we are working across different platforms. + if (source->hasFormat(mimeRectangularWin)) + rectangular = true; + else if (source->hasFormat(mimeRectangular)) + rectangular = true; + else + rectangular = false; + + // Note that we don't support Scintilla's hack of adding a '\0' as Qt + // strips it off under the covers when pasting from another process. + QString utf8 = source->text(); + QByteArray text; + + if (sci->IsUnicodeMode()) + text = utf8.toUtf8(); + else + text = utf8.toLatin1(); + + return text; +} + + +// Create a MIME data object for some text. +QMimeData *QsciScintillaBase::toMimeData(const QByteArray &text, bool rectangular) const +{ + QMimeData *mime = new QMimeData; + + QString utf8; + + if (sci->IsUnicodeMode()) + utf8 = QString::fromUtf8(text.constData(), text.size()); + else + utf8 = QString::fromLatin1(text.constData(), text.size()); + + mime->setText(utf8); + + if (rectangular) + { + // Use the platform specific "standard" for specifying a rectangular + // selection. +#if defined(Q_OS_WIN) + mime->setData(mimeRectangularWin, QByteArray()); +#else + mime->setData(mimeRectangular, QByteArray()); +#endif + } + + return mime; +} diff --git a/libs/qscintilla/Qt4Qt5/qscistyle.cpp b/libs/qscintilla/Qt4Qt5/qscistyle.cpp new file mode 100644 index 000000000..e954dc4a5 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscistyle.cpp @@ -0,0 +1,180 @@ +// This module implements the QsciStyle class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscistyle.h" + +#include + +#include "Qsci/qsciscintillabase.h" + + +// A ctor. +QsciStyle::QsciStyle(int style) +{ + init(style); + + QPalette pal = QApplication::palette(); + setColor(pal.text().color()); + setPaper(pal.base().color()); + + setFont(QApplication::font()); + setEolFill(false); +} + + +// A ctor. +QsciStyle::QsciStyle(int style, const QString &description, + const QColor &color, const QColor &paper, const QFont &font, + bool eolFill) +{ + init(style); + + setDescription(description); + + setColor(color); + setPaper(paper); + + setFont(font); + setEolFill(eolFill); +} + + +// Initialisation common to all ctors. +void QsciStyle::init(int style) +{ + // The next style number to allocate. The initial values corresponds to + // the amount of space that Scintilla initially creates for styles. + static int next_style_nr = 63; + + // See if a new style should be allocated. Note that we allow styles to be + // passed in that are bigger than STYLE_MAX because the styles used for + // annotations are allowed to be. + if (style < 0) + { + // Note that we don't deal with the situation where the newly allocated + // style number has already been used explicitly. + if (next_style_nr > QsciScintillaBase::STYLE_LASTPREDEFINED) + style = next_style_nr--; + } + + style_nr = style; + + // Initialise the minor attributes. + setTextCase(QsciStyle::OriginalCase); + setVisible(true); + setChangeable(true); + setHotspot(false); +} + + +// Apply the style to a particular editor. +void QsciStyle::apply(QsciScintillaBase *sci) const +{ + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETFORE, style_nr, + style_color); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETBACK, style_nr, + style_paper); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETFONT, style_nr, + style_font.family().toLatin1().data()); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETSIZEFRACTIONAL, style_nr, + long(style_font.pointSizeF() * QsciScintillaBase::SC_FONT_SIZE_MULTIPLIER)); + + // Pass the Qt weight via the back door. + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETWEIGHT, style_nr, + -style_font.weight()); + + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETITALIC, style_nr, + style_font.italic()); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETUNDERLINE, style_nr, + style_font.underline()); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETEOLFILLED, style_nr, + style_eol_fill); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETCASE, style_nr, + (long)style_case); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETVISIBLE, style_nr, + style_visible); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETCHANGEABLE, style_nr, + style_changeable); + sci->SendScintilla(QsciScintillaBase::SCI_STYLESETHOTSPOT, style_nr, + style_hotspot); +} + + +// Set the color attribute. +void QsciStyle::setColor(const QColor &color) +{ + style_color = color; +} + + +// Set the paper attribute. +void QsciStyle::setPaper(const QColor &paper) +{ + style_paper = paper; +} + + +// Set the font attribute. +void QsciStyle::setFont(const QFont &font) +{ + style_font = font; +} + + +// Set the eol fill attribute. +void QsciStyle::setEolFill(bool eolFill) +{ + style_eol_fill = eolFill; +} + + +// Set the text case attribute. +void QsciStyle::setTextCase(QsciStyle::TextCase text_case) +{ + style_case = text_case; +} + + +// Set the visible attribute. +void QsciStyle::setVisible(bool visible) +{ + style_visible = visible; +} + + +// Set the changeable attribute. +void QsciStyle::setChangeable(bool changeable) +{ + style_changeable = changeable; +} + + +// Set the hotspot attribute. +void QsciStyle::setHotspot(bool hotspot) +{ + style_hotspot = hotspot; +} + + +// Refresh the style. Note that since we had to add apply() then this can't do +// anything useful so we leave it as a no-op. +void QsciStyle::refresh() +{ +} diff --git a/libs/qscintilla/Qt4Qt5/qscistyledtext.cpp b/libs/qscintilla/Qt4Qt5/qscistyledtext.cpp new file mode 100644 index 000000000..b243784d3 --- /dev/null +++ b/libs/qscintilla/Qt4Qt5/qscistyledtext.cpp @@ -0,0 +1,54 @@ +// This module implements the QsciStyledText class. +// +// Copyright (c) 2015 Riverbank Computing Limited +// +// This file is part of QScintilla. +// +// This file may be used under the terms of the GNU General Public License +// version 3.0 as published by the Free Software Foundation and appearing in +// the file LICENSE included in the packaging of this file. Please review the +// following information to ensure the GNU General Public License version 3.0 +// requirements will be met: http://www.gnu.org/copyleft/gpl.html. +// +// If you do not wish to use this file under the terms of the GPL version 3.0 +// then you may purchase a commercial license. For more information contact +// info@riverbankcomputing.com. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + +#include "Qsci/qscistyledtext.h" + +#include "Qsci/qsciscintillabase.h" +#include "Qsci/qscistyle.h" + + +// A ctor. +QsciStyledText::QsciStyledText(const QString &text, int style) + : styled_text(text), style_nr(style), explicit_style(0) +{ +} + + +// A ctor. +QsciStyledText::QsciStyledText(const QString &text, const QsciStyle &style) + : styled_text(text), style_nr(-1) +{ + explicit_style = new QsciStyle(style); +} + + +// Return the number of the style. +int QsciStyledText::style() const +{ + return explicit_style ? explicit_style->style() : style_nr; +} + + +// Apply any explicit style to an editor. +void QsciStyledText::apply(QsciScintillaBase *sci) const +{ + if (explicit_style) + explicit_style->apply(sci); +} diff --git a/libs/qscintilla/README b/libs/qscintilla/README new file mode 100644 index 000000000..dc603f98e --- /dev/null +++ b/libs/qscintilla/README @@ -0,0 +1,2 @@ +All the documentation for QScintilla for Qt v4 and Qt v5 (including +installation instructions) can be found in doc/html-Qt4Qt5/index.html. diff --git a/libs/qscintilla/include/ILexer.h b/libs/qscintilla/include/ILexer.h new file mode 100644 index 000000000..b90092750 --- /dev/null +++ b/libs/qscintilla/include/ILexer.h @@ -0,0 +1,98 @@ +// 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, dvLineEnd=1 }; + +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; +}; + +class IDocumentWithLineEnd : public IDocument { +public: + virtual int SCI_METHOD LineEnd(int line) const = 0; + virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0; + virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0; +}; + +enum { lvOriginal=0, lvSubStyles=1 }; + +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; +}; + +class ILexerWithSubStyles : public ILexer { +public: + virtual int SCI_METHOD LineEndTypesSupported() = 0; + virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0; + virtual int SCI_METHOD SubStylesStart(int styleBase) = 0; + virtual int SCI_METHOD SubStylesLength(int styleBase) = 0; + virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0; + virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0; + virtual void SCI_METHOD FreeSubStyles() = 0; + virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0; + virtual int SCI_METHOD DistanceToSecondaryStyles() = 0; + virtual const char * SCI_METHOD GetSubStyleBases() = 0; +}; + +class ILoader { +public: + virtual int SCI_METHOD Release() = 0; + // Returns a status code from SC_STATUS_* + virtual int SCI_METHOD AddData(char *data, int length) = 0; + virtual void * SCI_METHOD ConvertToDocument() = 0; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/include/License.txt b/libs/qscintilla/include/License.txt new file mode 100644 index 000000000..cbe25b2fc --- /dev/null +++ b/libs/qscintilla/include/License.txt @@ -0,0 +1,20 @@ +License for Scintilla and SciTE + +Copyright 1998-2003 by Neil Hodgson + +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. + +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/libs/qscintilla/include/Platform.h b/libs/qscintilla/include/Platform.h new file mode 100644 index 000000000..839d7859f --- /dev/null +++ b/libs/qscintilla/include/Platform.h @@ -0,0 +1,555 @@ +// Scintilla source code edit control +/** @file Platform.h + ** 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-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PLATFORM_H +#define PLATFORM_H + +// PLAT_GTK = GTK+ on Linux or Win32 +// PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32 +// PLAT_WIN = Win32 API on Win32 OS +// PLAT_WX is wxWindows on any supported platform +// PLAT_TK = Tcl/TK on Linux or Win32 + +#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 +#define PLAT_QT 0 +#define PLAT_FOX 0 +#define PLAT_CURSES 0 +#define PLAT_TK 0 + +#if defined(FOX) +#undef PLAT_FOX +#define PLAT_FOX 1 + +#elif defined(__WX__) +#undef PLAT_WX +#define PLAT_WX 1 + +#elif defined(CURSES) +#undef PLAT_CURSES +#define PLAT_CURSES 1 + +#elif defined(SCINTILLA_QT) +#undef PLAT_QT +#define PLAT_QT 1 + +#include +QT_BEGIN_NAMESPACE +class QPainter; +QT_END_NAMESPACE + +// This is needed to work around an HP-UX bug with Qt4. +#include + +#elif defined(TK) +#undef PLAT_TK +#define PLAT_TK 1 + +#elif defined(GTK) +#undef PLAT_GTK +#define PLAT_GTK 1 + +#if defined(__WIN32__) || defined(_MSC_VER) +#undef PLAT_GTK_WIN32 +#define PLAT_GTK_WIN32 1 +#endif + +#if defined(__APPLE__) +#undef PLAT_GTK_MACOSX +#define PLAT_GTK_MACOSX 1 +#endif + +#elif defined(__APPLE__) + +#undef PLAT_MACOSX +#define PLAT_MACOSX 1 + +#else +#undef PLAT_WIN +#define PLAT_WIN 1 + +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +typedef float XYPOSITION; +typedef double XYACCUMULATOR; +inline int RoundXYPosition(XYPOSITION xyPos) { + return int(xyPos + 0.5); +} + +// Underlying the implementation of the platform classes are platform specific types. +// Sometimes these need to be passed around by client code so they are defined here + +typedef void *FontID; +typedef void *SurfaceID; +typedef void *WindowID; +typedef void *MenuID; +typedef void *TickerID; +typedef void *Function; +typedef void *IdlerID; + +/** + * A geometric point class. + * Point is similar to the Win32 POINT and GTK+ GdkPoint types. + */ +class Point { +public: + XYPOSITION x; + XYPOSITION y; + + explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) { + } + + static Point FromInts(int x_, int y_) { + return Point(static_cast(x_), static_cast(y_)); + } + + // Other automatically defined methods (assignment, copy constructor, destructor) are fine + + static Point FromLong(long lpoint); +}; + +/** + * A geometric rectangle class. + * PRectangle is similar to the Win32 RECT. + * PRectangles contain their top and left sides, but not their right and bottom sides. + */ +class PRectangle { +public: + XYPOSITION left; + XYPOSITION top; + XYPOSITION right; + XYPOSITION bottom; + + explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) : + left(left_), top(top_), right(right_), bottom(bottom_) { + } + + static PRectangle FromInts(int left_, int top_, int right_, int bottom_) { + return PRectangle(static_cast(left_), static_cast(top_), + static_cast(right_), static_cast(bottom_)); + } + + // Other automatically defined methods (assignment, copy constructor, destructor) are fine + + bool operator==(PRectangle &rc) const { + return (rc.left == left) && (rc.right == right) && + (rc.top == top) && (rc.bottom == bottom); + } + bool Contains(Point pt) const { + return (pt.x >= left) && (pt.x <= right) && + (pt.y >= top) && (pt.y <= bottom); + } + bool ContainsWholePixel(Point pt) const { + // Does the rectangle contain all of the pixel to left/below the point + return (pt.x >= left) && ((pt.x+1) <= right) && + (pt.y >= top) && ((pt.y+1) <= bottom); + } + bool Contains(PRectangle rc) const { + return (rc.left >= left) && (rc.right <= right) && + (rc.top >= top) && (rc.bottom <= bottom); + } + bool Intersects(PRectangle other) const { + return (right > other.left) && (left < other.right) && + (bottom > other.top) && (top < other.bottom); + } + void Move(XYPOSITION xDelta, XYPOSITION yDelta) { + left += xDelta; + top += yDelta; + right += xDelta; + bottom += yDelta; + } + XYPOSITION Width() const { return right - left; } + XYPOSITION Height() const { return bottom - top; } + bool Empty() const { + return (Height() <= 0) || (Width() <= 0); + } +}; + +/** + * Holds a desired RGB colour. + */ +class ColourDesired { + long co; +public: + ColourDesired(long lcol=0) { + co = lcol; + } + + ColourDesired(unsigned int red, unsigned int green, unsigned int blue) { + Set(red, green, blue); + } + + bool operator==(const ColourDesired &other) const { + return co == other.co; + } + + void Set(long lcol) { + co = lcol; + } + + void Set(unsigned int red, unsigned int green, unsigned int blue) { + co = red | (green << 8) | (blue << 16); + } + + static inline unsigned int ValueOfHex(const char ch) { + if (ch >= '0' && ch <= '9') + return ch - '0'; + else if (ch >= 'A' && ch <= 'F') + return ch - 'A' + 10; + else if (ch >= 'a' && ch <= 'f') + return ch - 'a' + 10; + else + return 0; + } + + void Set(const char *val) { + if (*val == '#') { + val++; + } + unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]); + unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]); + unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]); + Set(r, g, b); + } + + long AsLong() const { + return co; + } + + unsigned int GetRed() const { + return co & 0xff; + } + + unsigned int GetGreen() const { + return (co >> 8) & 0xff; + } + + unsigned int GetBlue() const { + return (co >> 16) & 0xff; + } +}; + +/** + * Font management. + */ + +struct FontParameters { + const char *faceName; + float size; + int weight; + bool italic; + int extraFontFlag; + int technology; + int characterSet; + + FontParameters( + const char *faceName_, + float size_=10, + int weight_=400, + bool italic_=false, + int extraFontFlag_=0, + int technology_=0, + int characterSet_=0) : + + faceName(faceName_), + size(size_), + weight(weight_), + italic(italic_), + extraFontFlag(extraFontFlag_), + technology(technology_), + characterSet(characterSet_) + { + } + +}; + +class Font { +protected: + FontID fid; +#if PLAT_WX + int ascent; +#endif + // Private so Font objects can not be copied + Font(const Font &); + Font &operator=(const Font &); +public: + Font(); + virtual ~Font(); + + virtual void Create(const FontParameters &fp); + virtual void Release(); + + FontID GetID() { return fid; } + // Alias another font - caller guarantees not to Release + void SetID(FontID fid_) { fid = fid_; } +#if PLAT_WX + void SetAscent(int ascent_) { ascent = ascent_; } +#endif + friend class Surface; + friend class SurfaceImpl; +}; + +/** + * A surface abstracts a place to draw. + */ +#if defined(PLAT_QT) +class XPM; +#endif +class Surface { +private: + // Private so Surface objects can not be copied + Surface(const Surface &) {} + Surface &operator=(const Surface &) { return *this; } +public: + Surface() {} + virtual ~Surface() {} + static Surface *Allocate(int technology); + + virtual void Init(WindowID wid)=0; + virtual void Init(SurfaceID sid, WindowID wid)=0; + virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0; + + virtual void Release()=0; + virtual bool Initialised()=0; + virtual void PenColour(ColourDesired fore)=0; + virtual int LogPixelsY()=0; + virtual int DeviceHeightFont(int points)=0; + virtual void MoveTo(int x_, int y_)=0; + virtual void LineTo(int x_, int y_)=0; + virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back)=0; + virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back)=0; + virtual void FillRectangle(PRectangle rc, ColourDesired back)=0; + virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0; + virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back)=0; + virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired 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, ColourDesired fore, ColourDesired back)=0; + virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; + + virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; + virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; + virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0; + virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0; + virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0; + virtual XYPOSITION WidthChar(Font &font_, char ch)=0; + virtual XYPOSITION Ascent(Font &font_)=0; + virtual XYPOSITION Descent(Font &font_)=0; + virtual XYPOSITION InternalLeading(Font &font_)=0; + virtual XYPOSITION ExternalLeading(Font &font_)=0; + virtual XYPOSITION Height(Font &font_)=0; + virtual XYPOSITION AverageCharWidth(Font &font_)=0; + + virtual void SetClip(PRectangle rc)=0; + virtual void FlushCachedState()=0; + + virtual void SetUnicodeMode(bool unicodeMode_)=0; + virtual void SetDBCSMode(int codePage)=0; + +#if defined(PLAT_QT) + virtual void Init(QPainter *p)=0; + virtual void DrawXPM(PRectangle rc, const XPM *xpm)=0; +#endif +}; + +/** + * A simple callback action passing one piece of untyped user data. + */ +typedef void (*CallBackAction)(void*); + +/** + * Class to hide the details of window manipulation. + * Does not own the window which will normally have a longer life than this object. + */ +class Window { +protected: + WindowID wid; +public: + Window() : wid(0), cursorLast(cursorInvalid) { + } + Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) { + } + virtual ~Window(); + Window &operator=(WindowID wid_) { + wid = wid_; + return *this; + } + WindowID GetID() const { return wid; } + bool Created() const { return wid != 0; } + void Destroy(); + bool HasFocus(); + PRectangle GetPosition(); + void SetPosition(PRectangle rc); + void SetPositionRelative(PRectangle rc, Window relativeTo); + PRectangle GetClientPosition(); + void Show(bool show=true); + void InvalidateAll(); + void InvalidateRectangle(PRectangle rc); + virtual void SetFont(Font &font); + enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; + void SetCursor(Cursor curs); + void SetTitle(const char *s); + PRectangle GetMonitorRect(Point pt); +private: + Cursor cursorLast; +}; + +/** + * Listbox management. + */ + +class ListBox : public Window { +public: + ListBox(); + virtual ~ListBox(); + static ListBox *Allocate(); + + virtual void SetFont(Font &font)=0; + virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_)=0; + virtual void SetAverageCharWidth(int width)=0; + virtual void SetVisibleRows(int rows)=0; + virtual int GetVisibleRows() const=0; + virtual PRectangle GetDesiredRect()=0; + virtual int CaretFromEdge()=0; + virtual void Clear()=0; + virtual void Append(char *s, int type = -1)=0; + virtual int Length()=0; + virtual void Select(int n)=0; + virtual int GetSelection()=0; + 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; +}; + +/** + * Menu management. + */ +class Menu { + MenuID mid; +public: + Menu(); + MenuID GetID() { return mid; } + void CreatePopUp(); + void Destroy(); + void Show(Point pt, Window &w); +}; + +class ElapsedTime { + long bigBit; + long littleBit; +public: + ElapsedTime(); + double Duration(bool reset=false); +}; + +/** + * Dynamic Library (DLL/SO/...) loading + */ +class DynamicLibrary { +public: + virtual ~DynamicLibrary() {} + + /// @return Pointer to function "name", or NULL on failure. + virtual Function FindFunction(const char *name) = 0; + + /// @return true if the library was loaded successfully. + virtual bool IsValid() = 0; + + /// @return An instance of a DynamicLibrary subclass with "modulePath" loaded. + static DynamicLibrary *Load(const char *modulePath); +}; + +#if defined(__clang__) +# if __has_feature(attribute_analyzer_noreturn) +# define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) +# else +# define CLANG_ANALYZER_NORETURN +# endif +#else +# define CLANG_ANALYZER_NORETURN +#endif + +/** + * Platform class used to retrieve system wide parameters such as double click speed + * and chrome colour. Not a creatable object, more of a module with several functions. + */ +class Platform { + // Private so Platform objects can not be copied + Platform(const Platform &) {} + Platform &operator=(const Platform &) { return *this; } +public: + // Should be private because no new Platforms are ever created + // but gcc warns about this + Platform() {} + ~Platform() {} + static ColourDesired Chrome(); + static ColourDesired ChromeHighlight(); + static const char *DefaultFont(); + static int DefaultFontSize(); + static unsigned int DoubleClickTime(); + static bool MouseButtonBounce(); + static void DebugDisplay(const char *s); + static bool IsKeyDown(int key); + static long SendScintilla( + WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0); + static long SendScintillaPointer( + WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0); + static bool IsDBCSLeadByte(int codePage, char ch); + static int DBCSCharLength(int codePage, const char *s); + static int DBCSCharMaxLength(); + + // These are utility functions not really tied to a platform + static int Minimum(int a, int b); + static int Maximum(int a, int b); + // Next three assume 16 bit shorts and 32 bit longs + static long LongFromTwoShorts(short a,short b) { + return (a) | ((b) << 16); + } + static short HighShortFromLong(long x) { + return static_cast(x >> 16); + } + static short LowShortFromLong(long x) { + return static_cast(x & 0xffff); + } + static void DebugPrintf(const char *format, ...); + static bool ShowAssertionPopUps(bool assertionPopUps_); + static void Assert(const char *c, const char *file, int line) CLANG_ANALYZER_NORETURN; + static int Clamp(int val, int minVal, int maxVal); +}; + +#ifdef NDEBUG +#define PLATFORM_ASSERT(c) ((void)0) +#else +#ifdef SCI_NAMESPACE +#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__)) +#else +#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__)) +#endif +#endif + +#ifdef SCI_NAMESPACE +} +#endif + +#if defined(__GNUC__) && defined(SCINTILLA_QT) +#pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#endif diff --git a/libs/qscintilla/include/SciLexer.h b/libs/qscintilla/include/SciLexer.h new file mode 100644 index 000000000..034060a4b --- /dev/null +++ b/libs/qscintilla/include/SciLexer.h @@ -0,0 +1,1773 @@ +/* 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. */ + +/* 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 */ + +/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ +#define SCLEX_CONTAINER 0 +#define SCLEX_NULL 1 +#define SCLEX_PYTHON 2 +#define SCLEX_CPP 3 +#define SCLEX_HTML 4 +#define SCLEX_XML 5 +#define SCLEX_PERL 6 +#define SCLEX_SQL 7 +#define SCLEX_VB 8 +#define SCLEX_PROPERTIES 9 +#define SCLEX_ERRORLIST 10 +#define SCLEX_MAKEFILE 11 +#define SCLEX_BATCH 12 +#define SCLEX_XCODE 13 +#define SCLEX_LATEX 14 +#define SCLEX_LUA 15 +#define SCLEX_DIFF 16 +#define SCLEX_CONF 17 +#define SCLEX_PASCAL 18 +#define SCLEX_AVE 19 +#define SCLEX_ADA 20 +#define SCLEX_LISP 21 +#define SCLEX_RUBY 22 +#define SCLEX_EIFFEL 23 +#define SCLEX_EIFFELKW 24 +#define SCLEX_TCL 25 +#define SCLEX_NNCRONTAB 26 +#define SCLEX_BULLANT 27 +#define SCLEX_VBSCRIPT 28 +#define SCLEX_BAAN 31 +#define SCLEX_MATLAB 32 +#define SCLEX_SCRIPTOL 33 +#define SCLEX_ASM 34 +#define SCLEX_CPPNOCASE 35 +#define SCLEX_FORTRAN 36 +#define SCLEX_F77 37 +#define SCLEX_CSS 38 +#define SCLEX_POV 39 +#define SCLEX_LOUT 40 +#define SCLEX_ESCRIPT 41 +#define SCLEX_PS 42 +#define SCLEX_NSIS 43 +#define SCLEX_MMIXAL 44 +#define SCLEX_CLW 45 +#define SCLEX_CLWNOCASE 46 +#define SCLEX_LOT 47 +#define SCLEX_YAML 48 +#define SCLEX_TEX 49 +#define SCLEX_METAPOST 50 +#define SCLEX_POWERBASIC 51 +#define SCLEX_FORTH 52 +#define SCLEX_ERLANG 53 +#define SCLEX_OCTAVE 54 +#define SCLEX_MSSQL 55 +#define SCLEX_VERILOG 56 +#define SCLEX_KIX 57 +#define SCLEX_GUI4CLI 58 +#define SCLEX_SPECMAN 59 +#define SCLEX_AU3 60 +#define SCLEX_APDL 61 +#define SCLEX_BASH 62 +#define SCLEX_ASN1 63 +#define SCLEX_VHDL 64 +#define SCLEX_CAML 65 +#define SCLEX_BLITZBASIC 66 +#define SCLEX_PUREBASIC 67 +#define SCLEX_HASKELL 68 +#define SCLEX_PHPSCRIPT 69 +#define SCLEX_TADS3 70 +#define SCLEX_REBOL 71 +#define SCLEX_SMALLTALK 72 +#define SCLEX_FLAGSHIP 73 +#define SCLEX_CSOUND 74 +#define SCLEX_FREEBASIC 75 +#define SCLEX_INNOSETUP 76 +#define SCLEX_OPAL 77 +#define SCLEX_SPICE 78 +#define SCLEX_D 79 +#define SCLEX_CMAKE 80 +#define SCLEX_GAP 81 +#define SCLEX_PLM 82 +#define SCLEX_PROGRESS 83 +#define SCLEX_ABAQUS 84 +#define SCLEX_ASYMPTOTE 85 +#define SCLEX_R 86 +#define SCLEX_MAGIK 87 +#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_COFFEESCRIPT 102 +#define SCLEX_TCMD 103 +#define SCLEX_AVS 104 +#define SCLEX_ECL 105 +#define SCLEX_OSCRIPT 106 +#define SCLEX_VISUALPROLOG 107 +#define SCLEX_LITERATEHASKELL 108 +#define SCLEX_STTXT 109 +#define SCLEX_KVIRC 110 +#define SCLEX_RUST 111 +#define SCLEX_DMAP 112 +#define SCLEX_AS 113 +#define SCLEX_DMIS 114 +#define SCLEX_REGISTRY 115 +#define SCLEX_BIBTEX 116 +#define SCLEX_SREC 117 +#define SCLEX_IHEX 118 +#define SCLEX_TEHEX 119 +#define SCLEX_AUTOMATIC 1000 +#define SCE_P_DEFAULT 0 +#define SCE_P_COMMENTLINE 1 +#define SCE_P_NUMBER 2 +#define SCE_P_STRING 3 +#define SCE_P_CHARACTER 4 +#define SCE_P_WORD 5 +#define SCE_P_TRIPLE 6 +#define SCE_P_TRIPLEDOUBLE 7 +#define SCE_P_CLASSNAME 8 +#define SCE_P_DEFNAME 9 +#define SCE_P_OPERATOR 10 +#define SCE_P_IDENTIFIER 11 +#define SCE_P_COMMENTBLOCK 12 +#define SCE_P_STRINGEOL 13 +#define SCE_P_WORD2 14 +#define SCE_P_DECORATOR 15 +#define SCE_C_DEFAULT 0 +#define SCE_C_COMMENT 1 +#define SCE_C_COMMENTLINE 2 +#define SCE_C_COMMENTDOC 3 +#define SCE_C_NUMBER 4 +#define SCE_C_WORD 5 +#define SCE_C_STRING 6 +#define SCE_C_CHARACTER 7 +#define SCE_C_UUID 8 +#define SCE_C_PREPROCESSOR 9 +#define SCE_C_OPERATOR 10 +#define SCE_C_IDENTIFIER 11 +#define SCE_C_STRINGEOL 12 +#define SCE_C_VERBATIM 13 +#define SCE_C_REGEX 14 +#define SCE_C_COMMENTLINEDOC 15 +#define SCE_C_WORD2 16 +#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_C_HASHQUOTEDSTRING 22 +#define SCE_C_PREPROCESSORCOMMENT 23 +#define SCE_C_PREPROCESSORCOMMENTDOC 24 +#define SCE_C_USERLITERAL 25 +#define SCE_C_TASKMARKER 26 +#define SCE_C_ESCAPESEQUENCE 27 +#define SCE_D_DEFAULT 0 +#define SCE_D_COMMENT 1 +#define SCE_D_COMMENTLINE 2 +#define SCE_D_COMMENTDOC 3 +#define SCE_D_COMMENTNESTED 4 +#define SCE_D_NUMBER 5 +#define SCE_D_WORD 6 +#define SCE_D_WORD2 7 +#define SCE_D_WORD3 8 +#define SCE_D_TYPEDEF 9 +#define SCE_D_STRING 10 +#define SCE_D_STRINGEOL 11 +#define SCE_D_CHARACTER 12 +#define SCE_D_OPERATOR 13 +#define SCE_D_IDENTIFIER 14 +#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 +#define SCE_TCL_NUMBER 3 +#define SCE_TCL_WORD_IN_QUOTE 4 +#define SCE_TCL_IN_QUOTE 5 +#define SCE_TCL_OPERATOR 6 +#define SCE_TCL_IDENTIFIER 7 +#define SCE_TCL_SUBSTITUTION 8 +#define SCE_TCL_SUB_BRACE 9 +#define SCE_TCL_MODIFIER 10 +#define SCE_TCL_EXPAND 11 +#define SCE_TCL_WORD 12 +#define SCE_TCL_WORD2 13 +#define SCE_TCL_WORD3 14 +#define SCE_TCL_WORD4 15 +#define SCE_TCL_WORD5 16 +#define SCE_TCL_WORD6 17 +#define SCE_TCL_WORD7 18 +#define SCE_TCL_WORD8 19 +#define SCE_TCL_COMMENT_BOX 20 +#define SCE_TCL_BLOCK_COMMENT 21 +#define SCE_H_DEFAULT 0 +#define SCE_H_TAG 1 +#define SCE_H_TAGUNKNOWN 2 +#define SCE_H_ATTRIBUTE 3 +#define SCE_H_ATTRIBUTEUNKNOWN 4 +#define SCE_H_NUMBER 5 +#define SCE_H_DOUBLESTRING 6 +#define SCE_H_SINGLESTRING 7 +#define SCE_H_OTHER 8 +#define SCE_H_COMMENT 9 +#define SCE_H_ENTITY 10 +#define SCE_H_TAGEND 11 +#define SCE_H_XMLSTART 12 +#define SCE_H_XMLEND 13 +#define SCE_H_SCRIPT 14 +#define SCE_H_ASP 15 +#define SCE_H_ASPAT 16 +#define SCE_H_CDATA 17 +#define SCE_H_QUESTION 18 +#define SCE_H_VALUE 19 +#define SCE_H_XCCOMMENT 20 +#define SCE_H_SGML_DEFAULT 21 +#define SCE_H_SGML_COMMAND 22 +#define SCE_H_SGML_1ST_PARAM 23 +#define SCE_H_SGML_DOUBLESTRING 24 +#define SCE_H_SGML_SIMPLESTRING 25 +#define SCE_H_SGML_ERROR 26 +#define SCE_H_SGML_SPECIAL 27 +#define SCE_H_SGML_ENTITY 28 +#define SCE_H_SGML_COMMENT 29 +#define SCE_H_SGML_1ST_PARAM_COMMENT 30 +#define SCE_H_SGML_BLOCK_DEFAULT 31 +#define SCE_HJ_START 40 +#define SCE_HJ_DEFAULT 41 +#define SCE_HJ_COMMENT 42 +#define SCE_HJ_COMMENTLINE 43 +#define SCE_HJ_COMMENTDOC 44 +#define SCE_HJ_NUMBER 45 +#define SCE_HJ_WORD 46 +#define SCE_HJ_KEYWORD 47 +#define SCE_HJ_DOUBLESTRING 48 +#define SCE_HJ_SINGLESTRING 49 +#define SCE_HJ_SYMBOLS 50 +#define SCE_HJ_STRINGEOL 51 +#define SCE_HJ_REGEX 52 +#define SCE_HJA_START 55 +#define SCE_HJA_DEFAULT 56 +#define SCE_HJA_COMMENT 57 +#define SCE_HJA_COMMENTLINE 58 +#define SCE_HJA_COMMENTDOC 59 +#define SCE_HJA_NUMBER 60 +#define SCE_HJA_WORD 61 +#define SCE_HJA_KEYWORD 62 +#define SCE_HJA_DOUBLESTRING 63 +#define SCE_HJA_SINGLESTRING 64 +#define SCE_HJA_SYMBOLS 65 +#define SCE_HJA_STRINGEOL 66 +#define SCE_HJA_REGEX 67 +#define SCE_HB_START 70 +#define SCE_HB_DEFAULT 71 +#define SCE_HB_COMMENTLINE 72 +#define SCE_HB_NUMBER 73 +#define SCE_HB_WORD 74 +#define SCE_HB_STRING 75 +#define SCE_HB_IDENTIFIER 76 +#define SCE_HB_STRINGEOL 77 +#define SCE_HBA_START 80 +#define SCE_HBA_DEFAULT 81 +#define SCE_HBA_COMMENTLINE 82 +#define SCE_HBA_NUMBER 83 +#define SCE_HBA_WORD 84 +#define SCE_HBA_STRING 85 +#define SCE_HBA_IDENTIFIER 86 +#define SCE_HBA_STRINGEOL 87 +#define SCE_HP_START 90 +#define SCE_HP_DEFAULT 91 +#define SCE_HP_COMMENTLINE 92 +#define SCE_HP_NUMBER 93 +#define SCE_HP_STRING 94 +#define SCE_HP_CHARACTER 95 +#define SCE_HP_WORD 96 +#define SCE_HP_TRIPLE 97 +#define SCE_HP_TRIPLEDOUBLE 98 +#define SCE_HP_CLASSNAME 99 +#define SCE_HP_DEFNAME 100 +#define SCE_HP_OPERATOR 101 +#define SCE_HP_IDENTIFIER 102 +#define SCE_HPHP_COMPLEX_VARIABLE 104 +#define SCE_HPA_START 105 +#define SCE_HPA_DEFAULT 106 +#define SCE_HPA_COMMENTLINE 107 +#define SCE_HPA_NUMBER 108 +#define SCE_HPA_STRING 109 +#define SCE_HPA_CHARACTER 110 +#define SCE_HPA_WORD 111 +#define SCE_HPA_TRIPLE 112 +#define SCE_HPA_TRIPLEDOUBLE 113 +#define SCE_HPA_CLASSNAME 114 +#define SCE_HPA_DEFNAME 115 +#define SCE_HPA_OPERATOR 116 +#define SCE_HPA_IDENTIFIER 117 +#define SCE_HPHP_DEFAULT 118 +#define SCE_HPHP_HSTRING 119 +#define SCE_HPHP_SIMPLESTRING 120 +#define SCE_HPHP_WORD 121 +#define SCE_HPHP_NUMBER 122 +#define SCE_HPHP_VARIABLE 123 +#define SCE_HPHP_COMMENT 124 +#define SCE_HPHP_COMMENTLINE 125 +#define SCE_HPHP_HSTRING_VARIABLE 126 +#define SCE_HPHP_OPERATOR 127 +#define SCE_PL_DEFAULT 0 +#define SCE_PL_ERROR 1 +#define SCE_PL_COMMENTLINE 2 +#define SCE_PL_POD 3 +#define SCE_PL_NUMBER 4 +#define SCE_PL_WORD 5 +#define SCE_PL_STRING 6 +#define SCE_PL_CHARACTER 7 +#define SCE_PL_PUNCTUATION 8 +#define SCE_PL_PREPROCESSOR 9 +#define SCE_PL_OPERATOR 10 +#define SCE_PL_IDENTIFIER 11 +#define SCE_PL_SCALAR 12 +#define SCE_PL_ARRAY 13 +#define SCE_PL_HASH 14 +#define SCE_PL_SYMBOLTABLE 15 +#define SCE_PL_VARIABLE_INDEXER 16 +#define SCE_PL_REGEX 17 +#define SCE_PL_REGSUBST 18 +#define SCE_PL_LONGQUOTE 19 +#define SCE_PL_BACKTICKS 20 +#define SCE_PL_DATASECTION 21 +#define SCE_PL_HERE_DELIM 22 +#define SCE_PL_HERE_Q 23 +#define SCE_PL_HERE_QQ 24 +#define SCE_PL_HERE_QX 25 +#define SCE_PL_STRING_Q 26 +#define SCE_PL_STRING_QQ 27 +#define SCE_PL_STRING_QX 28 +#define SCE_PL_STRING_QR 29 +#define SCE_PL_STRING_QW 30 +#define SCE_PL_POD_VERB 31 +#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 +#define SCE_RB_POD 3 +#define SCE_RB_NUMBER 4 +#define SCE_RB_WORD 5 +#define SCE_RB_STRING 6 +#define SCE_RB_CHARACTER 7 +#define SCE_RB_CLASSNAME 8 +#define SCE_RB_DEFNAME 9 +#define SCE_RB_OPERATOR 10 +#define SCE_RB_IDENTIFIER 11 +#define SCE_RB_REGEX 12 +#define SCE_RB_GLOBAL 13 +#define SCE_RB_SYMBOL 14 +#define SCE_RB_MODULE_NAME 15 +#define SCE_RB_INSTANCE_VAR 16 +#define SCE_RB_CLASS_VAR 17 +#define SCE_RB_BACKTICKS 18 +#define SCE_RB_DATASECTION 19 +#define SCE_RB_HERE_DELIM 20 +#define SCE_RB_HERE_Q 21 +#define SCE_RB_HERE_QQ 22 +#define SCE_RB_HERE_QX 23 +#define SCE_RB_STRING_Q 24 +#define SCE_RB_STRING_QQ 25 +#define SCE_RB_STRING_QX 26 +#define SCE_RB_STRING_QR 27 +#define SCE_RB_STRING_QW 28 +#define SCE_RB_WORD_DEMOTED 29 +#define SCE_RB_STDIN 30 +#define SCE_RB_STDOUT 31 +#define SCE_RB_STDERR 40 +#define SCE_RB_UPPER_BOUND 41 +#define SCE_B_DEFAULT 0 +#define SCE_B_COMMENT 1 +#define SCE_B_NUMBER 2 +#define SCE_B_KEYWORD 3 +#define SCE_B_STRING 4 +#define SCE_B_PREPROCESSOR 5 +#define SCE_B_OPERATOR 6 +#define SCE_B_IDENTIFIER 7 +#define SCE_B_DATE 8 +#define SCE_B_STRINGEOL 9 +#define SCE_B_KEYWORD2 10 +#define SCE_B_KEYWORD3 11 +#define SCE_B_KEYWORD4 12 +#define SCE_B_CONSTANT 13 +#define SCE_B_ASM 14 +#define SCE_B_LABEL 15 +#define SCE_B_ERROR 16 +#define SCE_B_HEXNUMBER 17 +#define SCE_B_BINNUMBER 18 +#define SCE_B_COMMENTBLOCK 19 +#define SCE_B_DOCLINE 20 +#define SCE_B_DOCBLOCK 21 +#define SCE_B_DOCKEYWORD 22 +#define SCE_PROPS_DEFAULT 0 +#define SCE_PROPS_COMMENT 1 +#define SCE_PROPS_SECTION 2 +#define SCE_PROPS_ASSIGNMENT 3 +#define SCE_PROPS_DEFVAL 4 +#define SCE_PROPS_KEY 5 +#define SCE_L_DEFAULT 0 +#define SCE_L_COMMAND 1 +#define SCE_L_TAG 2 +#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 +#define SCE_LUA_COMMENTDOC 3 +#define SCE_LUA_NUMBER 4 +#define SCE_LUA_WORD 5 +#define SCE_LUA_STRING 6 +#define SCE_LUA_CHARACTER 7 +#define SCE_LUA_LITERALSTRING 8 +#define SCE_LUA_PREPROCESSOR 9 +#define SCE_LUA_OPERATOR 10 +#define SCE_LUA_IDENTIFIER 11 +#define SCE_LUA_STRINGEOL 12 +#define SCE_LUA_WORD2 13 +#define SCE_LUA_WORD3 14 +#define SCE_LUA_WORD4 15 +#define SCE_LUA_WORD5 16 +#define SCE_LUA_WORD6 17 +#define SCE_LUA_WORD7 18 +#define SCE_LUA_WORD8 19 +#define SCE_LUA_LABEL 20 +#define SCE_ERR_DEFAULT 0 +#define SCE_ERR_PYTHON 1 +#define SCE_ERR_GCC 2 +#define SCE_ERR_MS 3 +#define SCE_ERR_CMD 4 +#define SCE_ERR_BORLAND 5 +#define SCE_ERR_PERL 6 +#define SCE_ERR_NET 7 +#define SCE_ERR_LUA 8 +#define SCE_ERR_CTAG 9 +#define SCE_ERR_DIFF_CHANGED 10 +#define SCE_ERR_DIFF_ADDITION 11 +#define SCE_ERR_DIFF_DELETION 12 +#define SCE_ERR_DIFF_MESSAGE 13 +#define SCE_ERR_PHP 14 +#define SCE_ERR_ELF 15 +#define SCE_ERR_IFC 16 +#define SCE_ERR_IFORT 17 +#define SCE_ERR_ABSF 18 +#define SCE_ERR_TIDY 19 +#define SCE_ERR_JAVA_STACK 20 +#define SCE_ERR_VALUE 21 +#define SCE_ERR_GCC_INCLUDED_FROM 22 +#define SCE_BAT_DEFAULT 0 +#define SCE_BAT_COMMENT 1 +#define SCE_BAT_WORD 2 +#define SCE_BAT_LABEL 3 +#define SCE_BAT_HIDE 4 +#define SCE_BAT_COMMAND 5 +#define SCE_BAT_IDENTIFIER 6 +#define SCE_BAT_OPERATOR 7 +#define SCE_TCMD_DEFAULT 0 +#define SCE_TCMD_COMMENT 1 +#define SCE_TCMD_WORD 2 +#define SCE_TCMD_LABEL 3 +#define SCE_TCMD_HIDE 4 +#define SCE_TCMD_COMMAND 5 +#define SCE_TCMD_IDENTIFIER 6 +#define SCE_TCMD_OPERATOR 7 +#define SCE_TCMD_ENVIRONMENT 8 +#define SCE_TCMD_EXPANSION 9 +#define SCE_TCMD_CLABEL 10 +#define SCE_MAKE_DEFAULT 0 +#define SCE_MAKE_COMMENT 1 +#define SCE_MAKE_PREPROCESSOR 2 +#define SCE_MAKE_IDENTIFIER 3 +#define SCE_MAKE_OPERATOR 4 +#define SCE_MAKE_TARGET 5 +#define SCE_MAKE_IDEOL 9 +#define SCE_DIFF_DEFAULT 0 +#define SCE_DIFF_COMMENT 1 +#define SCE_DIFF_COMMAND 2 +#define SCE_DIFF_HEADER 3 +#define SCE_DIFF_POSITION 4 +#define SCE_DIFF_DELETED 5 +#define SCE_DIFF_ADDED 6 +#define SCE_DIFF_CHANGED 7 +#define SCE_CONF_DEFAULT 0 +#define SCE_CONF_COMMENT 1 +#define SCE_CONF_NUMBER 2 +#define SCE_CONF_IDENTIFIER 3 +#define SCE_CONF_EXTENSION 4 +#define SCE_CONF_PARAMETER 5 +#define SCE_CONF_STRING 6 +#define SCE_CONF_OPERATOR 7 +#define SCE_CONF_IP 8 +#define SCE_CONF_DIRECTIVE 9 +#define SCE_AVE_DEFAULT 0 +#define SCE_AVE_COMMENT 1 +#define SCE_AVE_NUMBER 2 +#define SCE_AVE_WORD 3 +#define SCE_AVE_STRING 6 +#define SCE_AVE_ENUM 7 +#define SCE_AVE_STRINGEOL 8 +#define SCE_AVE_IDENTIFIER 9 +#define SCE_AVE_OPERATOR 10 +#define SCE_AVE_WORD1 11 +#define SCE_AVE_WORD2 12 +#define SCE_AVE_WORD3 13 +#define SCE_AVE_WORD4 14 +#define SCE_AVE_WORD5 15 +#define SCE_AVE_WORD6 16 +#define SCE_ADA_DEFAULT 0 +#define SCE_ADA_WORD 1 +#define SCE_ADA_IDENTIFIER 2 +#define SCE_ADA_NUMBER 3 +#define SCE_ADA_DELIMITER 4 +#define SCE_ADA_CHARACTER 5 +#define SCE_ADA_CHARACTEREOL 6 +#define SCE_ADA_STRING 7 +#define SCE_ADA_STRINGEOL 8 +#define SCE_ADA_LABEL 9 +#define SCE_ADA_COMMENTLINE 10 +#define SCE_ADA_ILLEGAL 11 +#define SCE_BAAN_DEFAULT 0 +#define SCE_BAAN_COMMENT 1 +#define SCE_BAAN_COMMENTDOC 2 +#define SCE_BAAN_NUMBER 3 +#define SCE_BAAN_WORD 4 +#define SCE_BAAN_STRING 5 +#define SCE_BAAN_PREPROCESSOR 6 +#define SCE_BAAN_OPERATOR 7 +#define SCE_BAAN_IDENTIFIER 8 +#define SCE_BAAN_STRINGEOL 9 +#define SCE_BAAN_WORD2 10 +#define SCE_LISP_DEFAULT 0 +#define SCE_LISP_COMMENT 1 +#define SCE_LISP_NUMBER 2 +#define SCE_LISP_KEYWORD 3 +#define SCE_LISP_KEYWORD_KW 4 +#define SCE_LISP_SYMBOL 5 +#define SCE_LISP_STRING 6 +#define SCE_LISP_STRINGEOL 8 +#define SCE_LISP_IDENTIFIER 9 +#define SCE_LISP_OPERATOR 10 +#define SCE_LISP_SPECIAL 11 +#define SCE_LISP_MULTI_COMMENT 12 +#define SCE_EIFFEL_DEFAULT 0 +#define SCE_EIFFEL_COMMENTLINE 1 +#define SCE_EIFFEL_NUMBER 2 +#define SCE_EIFFEL_WORD 3 +#define SCE_EIFFEL_STRING 4 +#define SCE_EIFFEL_CHARACTER 5 +#define SCE_EIFFEL_OPERATOR 6 +#define SCE_EIFFEL_IDENTIFIER 7 +#define SCE_EIFFEL_STRINGEOL 8 +#define SCE_NNCRONTAB_DEFAULT 0 +#define SCE_NNCRONTAB_COMMENT 1 +#define SCE_NNCRONTAB_TASK 2 +#define SCE_NNCRONTAB_SECTION 3 +#define SCE_NNCRONTAB_KEYWORD 4 +#define SCE_NNCRONTAB_MODIFIER 5 +#define SCE_NNCRONTAB_ASTERISK 6 +#define SCE_NNCRONTAB_NUMBER 7 +#define SCE_NNCRONTAB_STRING 8 +#define SCE_NNCRONTAB_ENVIRONMENT 9 +#define SCE_NNCRONTAB_IDENTIFIER 10 +#define SCE_FORTH_DEFAULT 0 +#define SCE_FORTH_COMMENT 1 +#define SCE_FORTH_COMMENT_ML 2 +#define SCE_FORTH_IDENTIFIER 3 +#define SCE_FORTH_CONTROL 4 +#define SCE_FORTH_KEYWORD 5 +#define SCE_FORTH_DEFWORD 6 +#define SCE_FORTH_PREWORD1 7 +#define SCE_FORTH_PREWORD2 8 +#define SCE_FORTH_NUMBER 9 +#define SCE_FORTH_STRING 10 +#define SCE_FORTH_LOCALE 11 +#define SCE_MATLAB_DEFAULT 0 +#define SCE_MATLAB_COMMENT 1 +#define SCE_MATLAB_COMMAND 2 +#define SCE_MATLAB_NUMBER 3 +#define SCE_MATLAB_KEYWORD 4 +#define SCE_MATLAB_STRING 5 +#define SCE_MATLAB_OPERATOR 6 +#define SCE_MATLAB_IDENTIFIER 7 +#define SCE_MATLAB_DOUBLEQUOTESTRING 8 +#define SCE_SCRIPTOL_DEFAULT 0 +#define SCE_SCRIPTOL_WHITE 1 +#define SCE_SCRIPTOL_COMMENTLINE 2 +#define SCE_SCRIPTOL_PERSISTENT 3 +#define SCE_SCRIPTOL_CSTYLE 4 +#define SCE_SCRIPTOL_COMMENTBLOCK 5 +#define SCE_SCRIPTOL_NUMBER 6 +#define SCE_SCRIPTOL_STRING 7 +#define SCE_SCRIPTOL_CHARACTER 8 +#define SCE_SCRIPTOL_STRINGEOL 9 +#define SCE_SCRIPTOL_KEYWORD 10 +#define SCE_SCRIPTOL_OPERATOR 11 +#define SCE_SCRIPTOL_IDENTIFIER 12 +#define SCE_SCRIPTOL_TRIPLE 13 +#define SCE_SCRIPTOL_CLASSNAME 14 +#define SCE_SCRIPTOL_PREPROCESSOR 15 +#define SCE_ASM_DEFAULT 0 +#define SCE_ASM_COMMENT 1 +#define SCE_ASM_NUMBER 2 +#define SCE_ASM_STRING 3 +#define SCE_ASM_OPERATOR 4 +#define SCE_ASM_IDENTIFIER 5 +#define SCE_ASM_CPUINSTRUCTION 6 +#define SCE_ASM_MATHINSTRUCTION 7 +#define SCE_ASM_REGISTER 8 +#define SCE_ASM_DIRECTIVE 9 +#define SCE_ASM_DIRECTIVEOPERAND 10 +#define SCE_ASM_COMMENTBLOCK 11 +#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 +#define SCE_F_STRING1 3 +#define SCE_F_STRING2 4 +#define SCE_F_STRINGEOL 5 +#define SCE_F_OPERATOR 6 +#define SCE_F_IDENTIFIER 7 +#define SCE_F_WORD 8 +#define SCE_F_WORD2 9 +#define SCE_F_WORD3 10 +#define SCE_F_PREPROCESSOR 11 +#define SCE_F_OPERATOR2 12 +#define SCE_F_LABEL 13 +#define SCE_F_CONTINUATION 14 +#define SCE_CSS_DEFAULT 0 +#define SCE_CSS_TAG 1 +#define SCE_CSS_CLASS 2 +#define SCE_CSS_PSEUDOCLASS 3 +#define SCE_CSS_UNKNOWN_PSEUDOCLASS 4 +#define SCE_CSS_OPERATOR 5 +#define SCE_CSS_IDENTIFIER 6 +#define SCE_CSS_UNKNOWN_IDENTIFIER 7 +#define SCE_CSS_VALUE 8 +#define SCE_CSS_COMMENT 9 +#define SCE_CSS_ID 10 +#define SCE_CSS_IMPORTANT 11 +#define SCE_CSS_DIRECTIVE 12 +#define SCE_CSS_DOUBLESTRING 13 +#define SCE_CSS_SINGLESTRING 14 +#define SCE_CSS_IDENTIFIER2 15 +#define SCE_CSS_ATTRIBUTE 16 +#define SCE_CSS_IDENTIFIER3 17 +#define SCE_CSS_PSEUDOELEMENT 18 +#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_CSS_VARIABLE 23 +#define SCE_POV_DEFAULT 0 +#define SCE_POV_COMMENT 1 +#define SCE_POV_COMMENTLINE 2 +#define SCE_POV_NUMBER 3 +#define SCE_POV_OPERATOR 4 +#define SCE_POV_IDENTIFIER 5 +#define SCE_POV_STRING 6 +#define SCE_POV_STRINGEOL 7 +#define SCE_POV_DIRECTIVE 8 +#define SCE_POV_BADDIRECTIVE 9 +#define SCE_POV_WORD2 10 +#define SCE_POV_WORD3 11 +#define SCE_POV_WORD4 12 +#define SCE_POV_WORD5 13 +#define SCE_POV_WORD6 14 +#define SCE_POV_WORD7 15 +#define SCE_POV_WORD8 16 +#define SCE_LOUT_DEFAULT 0 +#define SCE_LOUT_COMMENT 1 +#define SCE_LOUT_NUMBER 2 +#define SCE_LOUT_WORD 3 +#define SCE_LOUT_WORD2 4 +#define SCE_LOUT_WORD3 5 +#define SCE_LOUT_WORD4 6 +#define SCE_LOUT_STRING 7 +#define SCE_LOUT_OPERATOR 8 +#define SCE_LOUT_IDENTIFIER 9 +#define SCE_LOUT_STRINGEOL 10 +#define SCE_ESCRIPT_DEFAULT 0 +#define SCE_ESCRIPT_COMMENT 1 +#define SCE_ESCRIPT_COMMENTLINE 2 +#define SCE_ESCRIPT_COMMENTDOC 3 +#define SCE_ESCRIPT_NUMBER 4 +#define SCE_ESCRIPT_WORD 5 +#define SCE_ESCRIPT_STRING 6 +#define SCE_ESCRIPT_OPERATOR 7 +#define SCE_ESCRIPT_IDENTIFIER 8 +#define SCE_ESCRIPT_BRACE 9 +#define SCE_ESCRIPT_WORD2 10 +#define SCE_ESCRIPT_WORD3 11 +#define SCE_PS_DEFAULT 0 +#define SCE_PS_COMMENT 1 +#define SCE_PS_DSC_COMMENT 2 +#define SCE_PS_DSC_VALUE 3 +#define SCE_PS_NUMBER 4 +#define SCE_PS_NAME 5 +#define SCE_PS_KEYWORD 6 +#define SCE_PS_LITERAL 7 +#define SCE_PS_IMMEVAL 8 +#define SCE_PS_PAREN_ARRAY 9 +#define SCE_PS_PAREN_DICT 10 +#define SCE_PS_PAREN_PROC 11 +#define SCE_PS_TEXT 12 +#define SCE_PS_HEXSTRING 13 +#define SCE_PS_BASE85STRING 14 +#define SCE_PS_BADSTRINGCHAR 15 +#define SCE_NSIS_DEFAULT 0 +#define SCE_NSIS_COMMENT 1 +#define SCE_NSIS_STRINGDQ 2 +#define SCE_NSIS_STRINGLQ 3 +#define SCE_NSIS_STRINGRQ 4 +#define SCE_NSIS_FUNCTION 5 +#define SCE_NSIS_VARIABLE 6 +#define SCE_NSIS_LABEL 7 +#define SCE_NSIS_USERDEFINED 8 +#define SCE_NSIS_SECTIONDEF 9 +#define SCE_NSIS_SUBSECTIONDEF 10 +#define SCE_NSIS_IFDEFINEDEF 11 +#define SCE_NSIS_MACRODEF 12 +#define SCE_NSIS_STRINGVAR 13 +#define SCE_NSIS_NUMBER 14 +#define SCE_NSIS_SECTIONGROUP 15 +#define SCE_NSIS_PAGEEX 16 +#define SCE_NSIS_FUNCTIONDEF 17 +#define SCE_NSIS_COMMENTBOX 18 +#define SCE_MMIXAL_LEADWS 0 +#define SCE_MMIXAL_COMMENT 1 +#define SCE_MMIXAL_LABEL 2 +#define SCE_MMIXAL_OPCODE 3 +#define SCE_MMIXAL_OPCODE_PRE 4 +#define SCE_MMIXAL_OPCODE_VALID 5 +#define SCE_MMIXAL_OPCODE_UNKNOWN 6 +#define SCE_MMIXAL_OPCODE_POST 7 +#define SCE_MMIXAL_OPERANDS 8 +#define SCE_MMIXAL_NUMBER 9 +#define SCE_MMIXAL_REF 10 +#define SCE_MMIXAL_CHAR 11 +#define SCE_MMIXAL_STRING 12 +#define SCE_MMIXAL_REGISTER 13 +#define SCE_MMIXAL_HEX 14 +#define SCE_MMIXAL_OPERATOR 15 +#define SCE_MMIXAL_SYMBOL 16 +#define SCE_MMIXAL_INCLUDE 17 +#define SCE_CLW_DEFAULT 0 +#define SCE_CLW_LABEL 1 +#define SCE_CLW_COMMENT 2 +#define SCE_CLW_STRING 3 +#define SCE_CLW_USER_IDENTIFIER 4 +#define SCE_CLW_INTEGER_CONSTANT 5 +#define SCE_CLW_REAL_CONSTANT 6 +#define SCE_CLW_PICTURE_STRING 7 +#define SCE_CLW_KEYWORD 8 +#define SCE_CLW_COMPILER_DIRECTIVE 9 +#define SCE_CLW_RUNTIME_EXPRESSIONS 10 +#define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 11 +#define SCE_CLW_STRUCTURE_DATA_TYPE 12 +#define SCE_CLW_ATTRIBUTE 13 +#define SCE_CLW_STANDARD_EQUATE 14 +#define SCE_CLW_ERROR 15 +#define SCE_CLW_DEPRECATED 16 +#define SCE_LOT_DEFAULT 0 +#define SCE_LOT_HEADER 1 +#define SCE_LOT_BREAK 2 +#define SCE_LOT_SET 3 +#define SCE_LOT_PASS 4 +#define SCE_LOT_FAIL 5 +#define SCE_LOT_ABORT 6 +#define SCE_YAML_DEFAULT 0 +#define SCE_YAML_COMMENT 1 +#define SCE_YAML_IDENTIFIER 2 +#define SCE_YAML_KEYWORD 3 +#define SCE_YAML_NUMBER 4 +#define SCE_YAML_REFERENCE 5 +#define SCE_YAML_DOCUMENT 6 +#define SCE_YAML_TEXT 7 +#define SCE_YAML_ERROR 8 +#define SCE_YAML_OPERATOR 9 +#define SCE_TEX_DEFAULT 0 +#define SCE_TEX_SPECIAL 1 +#define SCE_TEX_GROUP 2 +#define SCE_TEX_SYMBOL 3 +#define SCE_TEX_COMMAND 4 +#define SCE_TEX_TEXT 5 +#define SCE_METAPOST_DEFAULT 0 +#define SCE_METAPOST_SPECIAL 1 +#define SCE_METAPOST_GROUP 2 +#define SCE_METAPOST_SYMBOL 3 +#define SCE_METAPOST_COMMAND 4 +#define SCE_METAPOST_TEXT 5 +#define SCE_METAPOST_EXTRA 6 +#define SCE_ERLANG_DEFAULT 0 +#define SCE_ERLANG_COMMENT 1 +#define SCE_ERLANG_VARIABLE 2 +#define SCE_ERLANG_NUMBER 3 +#define SCE_ERLANG_KEYWORD 4 +#define SCE_ERLANG_STRING 5 +#define SCE_ERLANG_OPERATOR 6 +#define SCE_ERLANG_ATOM 7 +#define SCE_ERLANG_FUNCTION_NAME 8 +#define SCE_ERLANG_CHARACTER 9 +#define SCE_ERLANG_MACRO 10 +#define SCE_ERLANG_RECORD 11 +#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 +#define SCE_MSSQL_LINE_COMMENT 2 +#define SCE_MSSQL_NUMBER 3 +#define SCE_MSSQL_STRING 4 +#define SCE_MSSQL_OPERATOR 5 +#define SCE_MSSQL_IDENTIFIER 6 +#define SCE_MSSQL_VARIABLE 7 +#define SCE_MSSQL_COLUMN_NAME 8 +#define SCE_MSSQL_STATEMENT 9 +#define SCE_MSSQL_DATATYPE 10 +#define SCE_MSSQL_SYSTABLE 11 +#define SCE_MSSQL_GLOBAL_VARIABLE 12 +#define SCE_MSSQL_FUNCTION 13 +#define SCE_MSSQL_STORED_PROCEDURE 14 +#define SCE_MSSQL_DEFAULT_PREF_DATATYPE 15 +#define SCE_MSSQL_COLUMN_NAME_2 16 +#define SCE_V_DEFAULT 0 +#define SCE_V_COMMENT 1 +#define SCE_V_COMMENTLINE 2 +#define SCE_V_COMMENTLINEBANG 3 +#define SCE_V_NUMBER 4 +#define SCE_V_WORD 5 +#define SCE_V_STRING 6 +#define SCE_V_WORD2 7 +#define SCE_V_WORD3 8 +#define SCE_V_PREPROCESSOR 9 +#define SCE_V_OPERATOR 10 +#define SCE_V_IDENTIFIER 11 +#define SCE_V_STRINGEOL 12 +#define SCE_V_USER 19 +#define SCE_V_COMMENT_WORD 20 +#define SCE_V_INPUT 21 +#define SCE_V_OUTPUT 22 +#define SCE_V_INOUT 23 +#define SCE_V_PORT_CONNECT 24 +#define SCE_KIX_DEFAULT 0 +#define SCE_KIX_COMMENT 1 +#define SCE_KIX_STRING1 2 +#define SCE_KIX_STRING2 3 +#define SCE_KIX_NUMBER 4 +#define SCE_KIX_VAR 5 +#define SCE_KIX_MACRO 6 +#define SCE_KIX_KEYWORD 7 +#define SCE_KIX_FUNCTIONS 8 +#define SCE_KIX_OPERATOR 9 +#define SCE_KIX_COMMENTSTREAM 10 +#define SCE_KIX_IDENTIFIER 31 +#define SCE_GC_DEFAULT 0 +#define SCE_GC_COMMENTLINE 1 +#define SCE_GC_COMMENTBLOCK 2 +#define SCE_GC_GLOBAL 3 +#define SCE_GC_EVENT 4 +#define SCE_GC_ATTRIBUTE 5 +#define SCE_GC_CONTROL 6 +#define SCE_GC_COMMAND 7 +#define SCE_GC_STRING 8 +#define SCE_GC_OPERATOR 9 +#define SCE_SN_DEFAULT 0 +#define SCE_SN_CODE 1 +#define SCE_SN_COMMENTLINE 2 +#define SCE_SN_COMMENTLINEBANG 3 +#define SCE_SN_NUMBER 4 +#define SCE_SN_WORD 5 +#define SCE_SN_STRING 6 +#define SCE_SN_WORD2 7 +#define SCE_SN_WORD3 8 +#define SCE_SN_PREPROCESSOR 9 +#define SCE_SN_OPERATOR 10 +#define SCE_SN_IDENTIFIER 11 +#define SCE_SN_STRINGEOL 12 +#define SCE_SN_REGEXTAG 13 +#define SCE_SN_SIGNAL 14 +#define SCE_SN_USER 19 +#define SCE_AU3_DEFAULT 0 +#define SCE_AU3_COMMENT 1 +#define SCE_AU3_COMMENTBLOCK 2 +#define SCE_AU3_NUMBER 3 +#define SCE_AU3_FUNCTION 4 +#define SCE_AU3_KEYWORD 5 +#define SCE_AU3_MACRO 6 +#define SCE_AU3_STRING 7 +#define SCE_AU3_OPERATOR 8 +#define SCE_AU3_VARIABLE 9 +#define SCE_AU3_SENT 10 +#define SCE_AU3_PREPROCESSOR 11 +#define SCE_AU3_SPECIAL 12 +#define SCE_AU3_EXPAND 13 +#define SCE_AU3_COMOBJ 14 +#define SCE_AU3_UDF 15 +#define SCE_APDL_DEFAULT 0 +#define SCE_APDL_COMMENT 1 +#define SCE_APDL_COMMENTBLOCK 2 +#define SCE_APDL_NUMBER 3 +#define SCE_APDL_STRING 4 +#define SCE_APDL_OPERATOR 5 +#define SCE_APDL_WORD 6 +#define SCE_APDL_PROCESSOR 7 +#define SCE_APDL_COMMAND 8 +#define SCE_APDL_SLASHCOMMAND 9 +#define SCE_APDL_STARCOMMAND 10 +#define SCE_APDL_ARGUMENT 11 +#define SCE_APDL_FUNCTION 12 +#define SCE_SH_DEFAULT 0 +#define SCE_SH_ERROR 1 +#define SCE_SH_COMMENTLINE 2 +#define SCE_SH_NUMBER 3 +#define SCE_SH_WORD 4 +#define SCE_SH_STRING 5 +#define SCE_SH_CHARACTER 6 +#define SCE_SH_OPERATOR 7 +#define SCE_SH_IDENTIFIER 8 +#define SCE_SH_SCALAR 9 +#define SCE_SH_PARAM 10 +#define SCE_SH_BACKTICKS 11 +#define SCE_SH_HERE_DELIM 12 +#define SCE_SH_HERE_Q 13 +#define SCE_ASN1_DEFAULT 0 +#define SCE_ASN1_COMMENT 1 +#define SCE_ASN1_IDENTIFIER 2 +#define SCE_ASN1_STRING 3 +#define SCE_ASN1_OID 4 +#define SCE_ASN1_SCALAR 5 +#define SCE_ASN1_KEYWORD 6 +#define SCE_ASN1_ATTRIBUTE 7 +#define SCE_ASN1_DESCRIPTOR 8 +#define SCE_ASN1_TYPE 9 +#define SCE_ASN1_OPERATOR 10 +#define SCE_VHDL_DEFAULT 0 +#define SCE_VHDL_COMMENT 1 +#define SCE_VHDL_COMMENTLINEBANG 2 +#define SCE_VHDL_NUMBER 3 +#define SCE_VHDL_STRING 4 +#define SCE_VHDL_OPERATOR 5 +#define SCE_VHDL_IDENTIFIER 6 +#define SCE_VHDL_STRINGEOL 7 +#define SCE_VHDL_KEYWORD 8 +#define SCE_VHDL_STDOPERATOR 9 +#define SCE_VHDL_ATTRIBUTE 10 +#define SCE_VHDL_STDFUNCTION 11 +#define SCE_VHDL_STDPACKAGE 12 +#define SCE_VHDL_STDTYPE 13 +#define SCE_VHDL_USERWORD 14 +#define SCE_VHDL_BLOCK_COMMENT 15 +#define SCE_CAML_DEFAULT 0 +#define SCE_CAML_IDENTIFIER 1 +#define SCE_CAML_TAGNAME 2 +#define SCE_CAML_KEYWORD 3 +#define SCE_CAML_KEYWORD2 4 +#define SCE_CAML_KEYWORD3 5 +#define SCE_CAML_LINENUM 6 +#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 +#define SCE_CAML_COMMENT2 14 +#define SCE_CAML_COMMENT3 15 +#define SCE_HA_DEFAULT 0 +#define SCE_HA_IDENTIFIER 1 +#define SCE_HA_KEYWORD 2 +#define SCE_HA_NUMBER 3 +#define SCE_HA_STRING 4 +#define SCE_HA_CHARACTER 5 +#define SCE_HA_CLASS 6 +#define SCE_HA_MODULE 7 +#define SCE_HA_CAPITAL 8 +#define SCE_HA_DATA 9 +#define SCE_HA_IMPORT 10 +#define SCE_HA_OPERATOR 11 +#define SCE_HA_INSTANCE 12 +#define SCE_HA_COMMENTLINE 13 +#define SCE_HA_COMMENTBLOCK 14 +#define SCE_HA_COMMENTBLOCK2 15 +#define SCE_HA_COMMENTBLOCK3 16 +#define SCE_HA_PRAGMA 17 +#define SCE_HA_PREPROCESSOR 18 +#define SCE_HA_STRINGEOL 19 +#define SCE_HA_RESERVED_OPERATOR 20 +#define SCE_HA_LITERATE_COMMENT 21 +#define SCE_HA_LITERATE_CODEDELIM 22 +#define SCE_T3_DEFAULT 0 +#define SCE_T3_X_DEFAULT 1 +#define SCE_T3_PREPROCESSOR 2 +#define SCE_T3_BLOCK_COMMENT 3 +#define SCE_T3_LINE_COMMENT 4 +#define SCE_T3_OPERATOR 5 +#define SCE_T3_KEYWORD 6 +#define SCE_T3_NUMBER 7 +#define SCE_T3_IDENTIFIER 8 +#define SCE_T3_S_STRING 9 +#define SCE_T3_D_STRING 10 +#define SCE_T3_X_STRING 11 +#define SCE_T3_LIB_DIRECTIVE 12 +#define SCE_T3_MSG_PARAM 13 +#define SCE_T3_HTML_TAG 14 +#define SCE_T3_HTML_DEFAULT 15 +#define SCE_T3_HTML_STRING 16 +#define SCE_T3_USER1 17 +#define SCE_T3_USER2 18 +#define SCE_T3_USER3 19 +#define SCE_T3_BRACE 20 +#define SCE_REBOL_DEFAULT 0 +#define SCE_REBOL_COMMENTLINE 1 +#define SCE_REBOL_COMMENTBLOCK 2 +#define SCE_REBOL_PREFACE 3 +#define SCE_REBOL_OPERATOR 4 +#define SCE_REBOL_CHARACTER 5 +#define SCE_REBOL_QUOTEDSTRING 6 +#define SCE_REBOL_BRACEDSTRING 7 +#define SCE_REBOL_NUMBER 8 +#define SCE_REBOL_PAIR 9 +#define SCE_REBOL_TUPLE 10 +#define SCE_REBOL_BINARY 11 +#define SCE_REBOL_MONEY 12 +#define SCE_REBOL_ISSUE 13 +#define SCE_REBOL_TAG 14 +#define SCE_REBOL_FILE 15 +#define SCE_REBOL_EMAIL 16 +#define SCE_REBOL_URL 17 +#define SCE_REBOL_DATE 18 +#define SCE_REBOL_TIME 19 +#define SCE_REBOL_IDENTIFIER 20 +#define SCE_REBOL_WORD 21 +#define SCE_REBOL_WORD2 22 +#define SCE_REBOL_WORD3 23 +#define SCE_REBOL_WORD4 24 +#define SCE_REBOL_WORD5 25 +#define SCE_REBOL_WORD6 26 +#define SCE_REBOL_WORD7 27 +#define SCE_REBOL_WORD8 28 +#define SCE_SQL_DEFAULT 0 +#define SCE_SQL_COMMENT 1 +#define SCE_SQL_COMMENTLINE 2 +#define SCE_SQL_COMMENTDOC 3 +#define SCE_SQL_NUMBER 4 +#define SCE_SQL_WORD 5 +#define SCE_SQL_STRING 6 +#define SCE_SQL_CHARACTER 7 +#define SCE_SQL_SQLPLUS 8 +#define SCE_SQL_SQLPLUS_PROMPT 9 +#define SCE_SQL_OPERATOR 10 +#define SCE_SQL_IDENTIFIER 11 +#define SCE_SQL_SQLPLUS_COMMENT 13 +#define SCE_SQL_COMMENTLINEDOC 15 +#define SCE_SQL_WORD2 16 +#define SCE_SQL_COMMENTDOCKEYWORD 17 +#define SCE_SQL_COMMENTDOCKEYWORDERROR 18 +#define SCE_SQL_USER1 19 +#define SCE_SQL_USER2 20 +#define SCE_SQL_USER3 21 +#define SCE_SQL_USER4 22 +#define SCE_SQL_QUOTEDIDENTIFIER 23 +#define SCE_SQL_QOPERATOR 24 +#define SCE_ST_DEFAULT 0 +#define SCE_ST_STRING 1 +#define SCE_ST_NUMBER 2 +#define SCE_ST_COMMENT 3 +#define SCE_ST_SYMBOL 4 +#define SCE_ST_BINARY 5 +#define SCE_ST_BOOL 6 +#define SCE_ST_SELF 7 +#define SCE_ST_SUPER 8 +#define SCE_ST_NIL 9 +#define SCE_ST_GLOBAL 10 +#define SCE_ST_RETURN 11 +#define SCE_ST_SPECIAL 12 +#define SCE_ST_KWSEND 13 +#define SCE_ST_ASSIGN 14 +#define SCE_ST_CHARACTER 15 +#define SCE_ST_SPEC_SEL 16 +#define SCE_FS_DEFAULT 0 +#define SCE_FS_COMMENT 1 +#define SCE_FS_COMMENTLINE 2 +#define SCE_FS_COMMENTDOC 3 +#define SCE_FS_COMMENTLINEDOC 4 +#define SCE_FS_COMMENTDOCKEYWORD 5 +#define SCE_FS_COMMENTDOCKEYWORDERROR 6 +#define SCE_FS_KEYWORD 7 +#define SCE_FS_KEYWORD2 8 +#define SCE_FS_KEYWORD3 9 +#define SCE_FS_KEYWORD4 10 +#define SCE_FS_NUMBER 11 +#define SCE_FS_STRING 12 +#define SCE_FS_PREPROCESSOR 13 +#define SCE_FS_OPERATOR 14 +#define SCE_FS_IDENTIFIER 15 +#define SCE_FS_DATE 16 +#define SCE_FS_STRINGEOL 17 +#define SCE_FS_CONSTANT 18 +#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 +#define SCE_CSOUND_OPERATOR 3 +#define SCE_CSOUND_INSTR 4 +#define SCE_CSOUND_IDENTIFIER 5 +#define SCE_CSOUND_OPCODE 6 +#define SCE_CSOUND_HEADERSTMT 7 +#define SCE_CSOUND_USERKEYWORD 8 +#define SCE_CSOUND_COMMENTBLOCK 9 +#define SCE_CSOUND_PARAM 10 +#define SCE_CSOUND_ARATE_VAR 11 +#define SCE_CSOUND_KRATE_VAR 12 +#define SCE_CSOUND_IRATE_VAR 13 +#define SCE_CSOUND_GLOBAL_VAR 14 +#define SCE_CSOUND_STRINGEOL 15 +#define SCE_INNO_DEFAULT 0 +#define SCE_INNO_COMMENT 1 +#define SCE_INNO_KEYWORD 2 +#define SCE_INNO_PARAMETER 3 +#define SCE_INNO_SECTION 4 +#define SCE_INNO_PREPROC 5 +#define SCE_INNO_INLINE_EXPANSION 6 +#define SCE_INNO_COMMENT_PASCAL 7 +#define SCE_INNO_KEYWORD_PASCAL 8 +#define SCE_INNO_KEYWORD_USER 9 +#define SCE_INNO_STRING_DOUBLE 10 +#define SCE_INNO_STRING_SINGLE 11 +#define SCE_INNO_IDENTIFIER 12 +#define SCE_OPAL_SPACE 0 +#define SCE_OPAL_COMMENT_BLOCK 1 +#define SCE_OPAL_COMMENT_LINE 2 +#define SCE_OPAL_INTEGER 3 +#define SCE_OPAL_KEYWORD 4 +#define SCE_OPAL_SORT 5 +#define SCE_OPAL_STRING 6 +#define SCE_OPAL_PAR 7 +#define SCE_OPAL_BOOL_CONST 8 +#define SCE_OPAL_DEFAULT 32 +#define SCE_SPICE_DEFAULT 0 +#define SCE_SPICE_IDENTIFIER 1 +#define SCE_SPICE_KEYWORD 2 +#define SCE_SPICE_KEYWORD2 3 +#define SCE_SPICE_KEYWORD3 4 +#define SCE_SPICE_NUMBER 5 +#define SCE_SPICE_DELIMITER 6 +#define SCE_SPICE_VALUE 7 +#define SCE_SPICE_COMMENTLINE 8 +#define SCE_CMAKE_DEFAULT 0 +#define SCE_CMAKE_COMMENT 1 +#define SCE_CMAKE_STRINGDQ 2 +#define SCE_CMAKE_STRINGLQ 3 +#define SCE_CMAKE_STRINGRQ 4 +#define SCE_CMAKE_COMMANDS 5 +#define SCE_CMAKE_PARAMETERS 6 +#define SCE_CMAKE_VARIABLE 7 +#define SCE_CMAKE_USERDEFINED 8 +#define SCE_CMAKE_WHILEDEF 9 +#define SCE_CMAKE_FOREACHDEF 10 +#define SCE_CMAKE_IFDEFINEDEF 11 +#define SCE_CMAKE_MACRODEF 12 +#define SCE_CMAKE_STRINGVAR 13 +#define SCE_CMAKE_NUMBER 14 +#define SCE_GAP_DEFAULT 0 +#define SCE_GAP_IDENTIFIER 1 +#define SCE_GAP_KEYWORD 2 +#define SCE_GAP_KEYWORD2 3 +#define SCE_GAP_KEYWORD3 4 +#define SCE_GAP_KEYWORD4 5 +#define SCE_GAP_STRING 6 +#define SCE_GAP_CHAR 7 +#define SCE_GAP_OPERATOR 8 +#define SCE_GAP_COMMENT 9 +#define SCE_GAP_NUMBER 10 +#define SCE_GAP_STRINGEOL 11 +#define SCE_PLM_DEFAULT 0 +#define SCE_PLM_COMMENT 1 +#define SCE_PLM_STRING 2 +#define SCE_PLM_NUMBER 3 +#define SCE_PLM_IDENTIFIER 4 +#define SCE_PLM_OPERATOR 5 +#define SCE_PLM_CONTROL 6 +#define SCE_PLM_KEYWORD 7 +#define SCE_4GL_DEFAULT 0 +#define SCE_4GL_NUMBER 1 +#define SCE_4GL_WORD 2 +#define SCE_4GL_STRING 3 +#define SCE_4GL_CHARACTER 4 +#define SCE_4GL_PREPROCESSOR 5 +#define SCE_4GL_OPERATOR 6 +#define SCE_4GL_IDENTIFIER 7 +#define SCE_4GL_BLOCK 8 +#define SCE_4GL_END 9 +#define SCE_4GL_COMMENT1 10 +#define SCE_4GL_COMMENT2 11 +#define SCE_4GL_COMMENT3 12 +#define SCE_4GL_COMMENT4 13 +#define SCE_4GL_COMMENT5 14 +#define SCE_4GL_COMMENT6 15 +#define SCE_4GL_DEFAULT_ 16 +#define SCE_4GL_NUMBER_ 17 +#define SCE_4GL_WORD_ 18 +#define SCE_4GL_STRING_ 19 +#define SCE_4GL_CHARACTER_ 20 +#define SCE_4GL_PREPROCESSOR_ 21 +#define SCE_4GL_OPERATOR_ 22 +#define SCE_4GL_IDENTIFIER_ 23 +#define SCE_4GL_BLOCK_ 24 +#define SCE_4GL_END_ 25 +#define SCE_4GL_COMMENT1_ 26 +#define SCE_4GL_COMMENT2_ 27 +#define SCE_4GL_COMMENT3_ 28 +#define SCE_4GL_COMMENT4_ 29 +#define SCE_4GL_COMMENT5_ 30 +#define SCE_4GL_COMMENT6_ 31 +#define SCE_ABAQUS_DEFAULT 0 +#define SCE_ABAQUS_COMMENT 1 +#define SCE_ABAQUS_COMMENTBLOCK 2 +#define SCE_ABAQUS_NUMBER 3 +#define SCE_ABAQUS_STRING 4 +#define SCE_ABAQUS_OPERATOR 5 +#define SCE_ABAQUS_WORD 6 +#define SCE_ABAQUS_PROCESSOR 7 +#define SCE_ABAQUS_COMMAND 8 +#define SCE_ABAQUS_SLASHCOMMAND 9 +#define SCE_ABAQUS_STARCOMMAND 10 +#define SCE_ABAQUS_ARGUMENT 11 +#define SCE_ABAQUS_FUNCTION 12 +#define SCE_ASY_DEFAULT 0 +#define SCE_ASY_COMMENT 1 +#define SCE_ASY_COMMENTLINE 2 +#define SCE_ASY_NUMBER 3 +#define SCE_ASY_WORD 4 +#define SCE_ASY_STRING 5 +#define SCE_ASY_CHARACTER 6 +#define SCE_ASY_OPERATOR 7 +#define SCE_ASY_IDENTIFIER 8 +#define SCE_ASY_STRINGEOL 9 +#define SCE_ASY_COMMENTLINEDOC 10 +#define SCE_ASY_WORD2 11 +#define SCE_R_DEFAULT 0 +#define SCE_R_COMMENT 1 +#define SCE_R_KWORD 2 +#define SCE_R_BASEKWORD 3 +#define SCE_R_OTHERKWORD 4 +#define SCE_R_NUMBER 5 +#define SCE_R_STRING 6 +#define SCE_R_STRING2 7 +#define SCE_R_OPERATOR 8 +#define SCE_R_IDENTIFIER 9 +#define SCE_R_INFIX 10 +#define SCE_R_INFIXEOL 11 +#define SCE_MAGIK_DEFAULT 0 +#define SCE_MAGIK_COMMENT 1 +#define SCE_MAGIK_HYPER_COMMENT 16 +#define SCE_MAGIK_STRING 2 +#define SCE_MAGIK_CHARACTER 3 +#define SCE_MAGIK_NUMBER 4 +#define SCE_MAGIK_IDENTIFIER 5 +#define SCE_MAGIK_OPERATOR 6 +#define SCE_MAGIK_FLOW 7 +#define SCE_MAGIK_CONTAINER 8 +#define SCE_MAGIK_BRACKET_BLOCK 9 +#define SCE_MAGIK_BRACE_BLOCK 10 +#define SCE_MAGIK_SQBRACKET_BLOCK 11 +#define SCE_MAGIK_UNKNOWN_KEYWORD 12 +#define SCE_MAGIK_KEYWORD 13 +#define SCE_MAGIK_PRAGMA 14 +#define SCE_MAGIK_SYMBOL 15 +#define SCE_POWERSHELL_DEFAULT 0 +#define SCE_POWERSHELL_COMMENT 1 +#define SCE_POWERSHELL_STRING 2 +#define SCE_POWERSHELL_CHARACTER 3 +#define SCE_POWERSHELL_NUMBER 4 +#define SCE_POWERSHELL_VARIABLE 5 +#define SCE_POWERSHELL_OPERATOR 6 +#define SCE_POWERSHELL_IDENTIFIER 7 +#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_POWERSHELL_HERE_STRING 14 +#define SCE_POWERSHELL_HERE_CHARACTER 15 +#define SCE_POWERSHELL_COMMENTDOCKEYWORD 16 +#define SCE_MYSQL_DEFAULT 0 +#define SCE_MYSQL_COMMENT 1 +#define SCE_MYSQL_COMMENTLINE 2 +#define SCE_MYSQL_VARIABLE 3 +#define SCE_MYSQL_SYSTEMVARIABLE 4 +#define SCE_MYSQL_KNOWNSYSTEMVARIABLE 5 +#define SCE_MYSQL_NUMBER 6 +#define SCE_MYSQL_MAJORKEYWORD 7 +#define SCE_MYSQL_KEYWORD 8 +#define SCE_MYSQL_DATABASEOBJECT 9 +#define SCE_MYSQL_PROCEDUREKEYWORD 10 +#define SCE_MYSQL_STRING 11 +#define SCE_MYSQL_SQSTRING 12 +#define SCE_MYSQL_DQSTRING 13 +#define SCE_MYSQL_OPERATOR 14 +#define SCE_MYSQL_FUNCTION 15 +#define SCE_MYSQL_IDENTIFIER 16 +#define SCE_MYSQL_QUOTEDIDENTIFIER 17 +#define SCE_MYSQL_USER1 18 +#define SCE_MYSQL_USER2 19 +#define SCE_MYSQL_USER3 20 +#define SCE_MYSQL_HIDDENCOMMAND 21 +#define SCE_MYSQL_PLACEHOLDER 22 +#define SCE_PO_DEFAULT 0 +#define SCE_PO_COMMENT 1 +#define SCE_PO_MSGID 2 +#define SCE_PO_MSGID_TEXT 3 +#define SCE_PO_MSGSTR 4 +#define SCE_PO_MSGSTR_TEXT 5 +#define SCE_PO_MSGCTXT 6 +#define SCE_PO_MSGCTXT_TEXT 7 +#define SCE_PO_FUZZY 8 +#define SCE_PO_PROGRAMMER_COMMENT 9 +#define SCE_PO_REFERENCE 10 +#define SCE_PO_FLAGS 11 +#define SCE_PO_MSGID_TEXT_EOL 12 +#define SCE_PO_MSGSTR_TEXT_EOL 13 +#define SCE_PO_MSGCTXT_TEXT_EOL 14 +#define SCE_PO_ERROR 15 +#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 +#define SCE_COFFEESCRIPT_DEFAULT 0 +#define SCE_COFFEESCRIPT_COMMENT 1 +#define SCE_COFFEESCRIPT_COMMENTLINE 2 +#define SCE_COFFEESCRIPT_COMMENTDOC 3 +#define SCE_COFFEESCRIPT_NUMBER 4 +#define SCE_COFFEESCRIPT_WORD 5 +#define SCE_COFFEESCRIPT_STRING 6 +#define SCE_COFFEESCRIPT_CHARACTER 7 +#define SCE_COFFEESCRIPT_UUID 8 +#define SCE_COFFEESCRIPT_PREPROCESSOR 9 +#define SCE_COFFEESCRIPT_OPERATOR 10 +#define SCE_COFFEESCRIPT_IDENTIFIER 11 +#define SCE_COFFEESCRIPT_STRINGEOL 12 +#define SCE_COFFEESCRIPT_VERBATIM 13 +#define SCE_COFFEESCRIPT_REGEX 14 +#define SCE_COFFEESCRIPT_COMMENTLINEDOC 15 +#define SCE_COFFEESCRIPT_WORD2 16 +#define SCE_COFFEESCRIPT_COMMENTDOCKEYWORD 17 +#define SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR 18 +#define SCE_COFFEESCRIPT_GLOBALCLASS 19 +#define SCE_COFFEESCRIPT_STRINGRAW 20 +#define SCE_COFFEESCRIPT_TRIPLEVERBATIM 21 +#define SCE_COFFEESCRIPT_COMMENTBLOCK 22 +#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23 +#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 +#define SCE_AVS_DEFAULT 0 +#define SCE_AVS_COMMENTBLOCK 1 +#define SCE_AVS_COMMENTBLOCKN 2 +#define SCE_AVS_COMMENTLINE 3 +#define SCE_AVS_NUMBER 4 +#define SCE_AVS_OPERATOR 5 +#define SCE_AVS_IDENTIFIER 6 +#define SCE_AVS_STRING 7 +#define SCE_AVS_TRIPLESTRING 8 +#define SCE_AVS_KEYWORD 9 +#define SCE_AVS_FILTER 10 +#define SCE_AVS_PLUGIN 11 +#define SCE_AVS_FUNCTION 12 +#define SCE_AVS_CLIPPROP 13 +#define SCE_AVS_USERDFN 14 +#define SCE_ECL_DEFAULT 0 +#define SCE_ECL_COMMENT 1 +#define SCE_ECL_COMMENTLINE 2 +#define SCE_ECL_NUMBER 3 +#define SCE_ECL_STRING 4 +#define SCE_ECL_WORD0 5 +#define SCE_ECL_OPERATOR 6 +#define SCE_ECL_CHARACTER 7 +#define SCE_ECL_UUID 8 +#define SCE_ECL_PREPROCESSOR 9 +#define SCE_ECL_UNKNOWN 10 +#define SCE_ECL_IDENTIFIER 11 +#define SCE_ECL_STRINGEOL 12 +#define SCE_ECL_VERBATIM 13 +#define SCE_ECL_REGEX 14 +#define SCE_ECL_COMMENTLINEDOC 15 +#define SCE_ECL_WORD1 16 +#define SCE_ECL_COMMENTDOCKEYWORD 17 +#define SCE_ECL_COMMENTDOCKEYWORDERROR 18 +#define SCE_ECL_WORD2 19 +#define SCE_ECL_WORD3 20 +#define SCE_ECL_WORD4 21 +#define SCE_ECL_WORD5 22 +#define SCE_ECL_COMMENTDOC 23 +#define SCE_ECL_ADDED 24 +#define SCE_ECL_DELETED 25 +#define SCE_ECL_CHANGED 26 +#define SCE_ECL_MOVED 27 +#define SCE_OSCRIPT_DEFAULT 0 +#define SCE_OSCRIPT_LINE_COMMENT 1 +#define SCE_OSCRIPT_BLOCK_COMMENT 2 +#define SCE_OSCRIPT_DOC_COMMENT 3 +#define SCE_OSCRIPT_PREPROCESSOR 4 +#define SCE_OSCRIPT_NUMBER 5 +#define SCE_OSCRIPT_SINGLEQUOTE_STRING 6 +#define SCE_OSCRIPT_DOUBLEQUOTE_STRING 7 +#define SCE_OSCRIPT_CONSTANT 8 +#define SCE_OSCRIPT_IDENTIFIER 9 +#define SCE_OSCRIPT_GLOBAL 10 +#define SCE_OSCRIPT_KEYWORD 11 +#define SCE_OSCRIPT_OPERATOR 12 +#define SCE_OSCRIPT_LABEL 13 +#define SCE_OSCRIPT_TYPE 14 +#define SCE_OSCRIPT_FUNCTION 15 +#define SCE_OSCRIPT_OBJECT 16 +#define SCE_OSCRIPT_PROPERTY 17 +#define SCE_OSCRIPT_METHOD 18 +#define SCE_VISUALPROLOG_DEFAULT 0 +#define SCE_VISUALPROLOG_KEY_MAJOR 1 +#define SCE_VISUALPROLOG_KEY_MINOR 2 +#define SCE_VISUALPROLOG_KEY_DIRECTIVE 3 +#define SCE_VISUALPROLOG_COMMENT_BLOCK 4 +#define SCE_VISUALPROLOG_COMMENT_LINE 5 +#define SCE_VISUALPROLOG_COMMENT_KEY 6 +#define SCE_VISUALPROLOG_COMMENT_KEY_ERROR 7 +#define SCE_VISUALPROLOG_IDENTIFIER 8 +#define SCE_VISUALPROLOG_VARIABLE 9 +#define SCE_VISUALPROLOG_ANONYMOUS 10 +#define SCE_VISUALPROLOG_NUMBER 11 +#define SCE_VISUALPROLOG_OPERATOR 12 +#define SCE_VISUALPROLOG_CHARACTER 13 +#define SCE_VISUALPROLOG_CHARACTER_TOO_MANY 14 +#define SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR 15 +#define SCE_VISUALPROLOG_STRING 16 +#define SCE_VISUALPROLOG_STRING_ESCAPE 17 +#define SCE_VISUALPROLOG_STRING_ESCAPE_ERROR 18 +#define SCE_VISUALPROLOG_STRING_EOL_OPEN 19 +#define SCE_VISUALPROLOG_STRING_VERBATIM 20 +#define SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21 +#define SCE_VISUALPROLOG_STRING_VERBATIM_EOL 22 +#define SCE_STTXT_DEFAULT 0 +#define SCE_STTXT_COMMENT 1 +#define SCE_STTXT_COMMENTLINE 2 +#define SCE_STTXT_KEYWORD 3 +#define SCE_STTXT_TYPE 4 +#define SCE_STTXT_FUNCTION 5 +#define SCE_STTXT_FB 6 +#define SCE_STTXT_NUMBER 7 +#define SCE_STTXT_HEXNUMBER 8 +#define SCE_STTXT_PRAGMA 9 +#define SCE_STTXT_OPERATOR 10 +#define SCE_STTXT_CHARACTER 11 +#define SCE_STTXT_STRING1 12 +#define SCE_STTXT_STRING2 13 +#define SCE_STTXT_STRINGEOL 14 +#define SCE_STTXT_IDENTIFIER 15 +#define SCE_STTXT_DATETIME 16 +#define SCE_STTXT_VARS 17 +#define SCE_STTXT_PRAGMAS 18 +#define SCE_KVIRC_DEFAULT 0 +#define SCE_KVIRC_COMMENT 1 +#define SCE_KVIRC_COMMENTBLOCK 2 +#define SCE_KVIRC_STRING 3 +#define SCE_KVIRC_WORD 4 +#define SCE_KVIRC_KEYWORD 5 +#define SCE_KVIRC_FUNCTION_KEYWORD 6 +#define SCE_KVIRC_FUNCTION 7 +#define SCE_KVIRC_VARIABLE 8 +#define SCE_KVIRC_NUMBER 9 +#define SCE_KVIRC_OPERATOR 10 +#define SCE_KVIRC_STRING_FUNCTION 11 +#define SCE_KVIRC_STRING_VARIABLE 12 +#define SCE_RUST_DEFAULT 0 +#define SCE_RUST_COMMENTBLOCK 1 +#define SCE_RUST_COMMENTLINE 2 +#define SCE_RUST_COMMENTBLOCKDOC 3 +#define SCE_RUST_COMMENTLINEDOC 4 +#define SCE_RUST_NUMBER 5 +#define SCE_RUST_WORD 6 +#define SCE_RUST_WORD2 7 +#define SCE_RUST_WORD3 8 +#define SCE_RUST_WORD4 9 +#define SCE_RUST_WORD5 10 +#define SCE_RUST_WORD6 11 +#define SCE_RUST_WORD7 12 +#define SCE_RUST_STRING 13 +#define SCE_RUST_STRINGR 14 +#define SCE_RUST_CHARACTER 15 +#define SCE_RUST_OPERATOR 16 +#define SCE_RUST_IDENTIFIER 17 +#define SCE_RUST_LIFETIME 18 +#define SCE_RUST_MACRO 19 +#define SCE_RUST_LEXERROR 20 +#define SCE_RUST_BYTESTRING 21 +#define SCE_RUST_BYTESTRINGR 22 +#define SCE_RUST_BYTECHARACTER 23 +#define SCE_DMAP_DEFAULT 0 +#define SCE_DMAP_COMMENT 1 +#define SCE_DMAP_NUMBER 2 +#define SCE_DMAP_STRING1 3 +#define SCE_DMAP_STRING2 4 +#define SCE_DMAP_STRINGEOL 5 +#define SCE_DMAP_OPERATOR 6 +#define SCE_DMAP_IDENTIFIER 7 +#define SCE_DMAP_WORD 8 +#define SCE_DMAP_WORD2 9 +#define SCE_DMAP_WORD3 10 +#define SCE_DMIS_DEFAULT 0 +#define SCE_DMIS_COMMENT 1 +#define SCE_DMIS_STRING 2 +#define SCE_DMIS_NUMBER 3 +#define SCE_DMIS_KEYWORD 4 +#define SCE_DMIS_MAJORWORD 5 +#define SCE_DMIS_MINORWORD 6 +#define SCE_DMIS_UNSUPPORTED_MAJOR 7 +#define SCE_DMIS_UNSUPPORTED_MINOR 8 +#define SCE_DMIS_LABEL 9 +#define SCE_REG_DEFAULT 0 +#define SCE_REG_COMMENT 1 +#define SCE_REG_VALUENAME 2 +#define SCE_REG_STRING 3 +#define SCE_REG_HEXDIGIT 4 +#define SCE_REG_VALUETYPE 5 +#define SCE_REG_ADDEDKEY 6 +#define SCE_REG_DELETEDKEY 7 +#define SCE_REG_ESCAPED 8 +#define SCE_REG_KEYPATH_GUID 9 +#define SCE_REG_STRING_GUID 10 +#define SCE_REG_PARAMETER 11 +#define SCE_REG_OPERATOR 12 +#define SCE_BIBTEX_DEFAULT 0 +#define SCE_BIBTEX_ENTRY 1 +#define SCE_BIBTEX_UNKNOWN_ENTRY 2 +#define SCE_BIBTEX_KEY 3 +#define SCE_BIBTEX_PARAMETER 4 +#define SCE_BIBTEX_VALUE 5 +#define SCE_BIBTEX_COMMENT 6 +#define SCE_HEX_DEFAULT 0 +#define SCE_HEX_RECSTART 1 +#define SCE_HEX_RECTYPE 2 +#define SCE_HEX_RECTYPE_UNKNOWN 3 +#define SCE_HEX_BYTECOUNT 4 +#define SCE_HEX_BYTECOUNT_WRONG 5 +#define SCE_HEX_NOADDRESS 6 +#define SCE_HEX_DATAADDRESS 7 +#define SCE_HEX_RECCOUNT 8 +#define SCE_HEX_STARTADDRESS 9 +#define SCE_HEX_ADDRESSFIELD_UNKNOWN 10 +#define SCE_HEX_EXTENDEDADDRESS 11 +#define SCE_HEX_DATA_ODD 12 +#define SCE_HEX_DATA_EVEN 13 +#define SCE_HEX_DATA_UNKNOWN 14 +#define SCE_HEX_DATA_EMPTY 15 +#define SCE_HEX_CHECKSUM 16 +#define SCE_HEX_CHECKSUM_WRONG 17 +#define SCE_HEX_GARBAGE 18 +/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ + +#endif diff --git a/libs/qscintilla/include/Scintilla.h b/libs/qscintilla/include/Scintilla.h new file mode 100644 index 000000000..e2e3297a5 --- /dev/null +++ b/libs/qscintilla/include/Scintilla.h @@ -0,0 +1,1163 @@ +/* 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. */ + +/* 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 + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_WIN32) +/* Return false on failure: */ +int Scintilla_RegisterClasses(void *hInstance); +int Scintilla_ReleaseResources(void); +#endif +int Scintilla_LinkLexers(void); + +#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; +typedef LONG_PTR sptr_t; +#else +typedef unsigned long uptr_t; +typedef long sptr_t; +#endif + +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 */ +#define INVALID_POSITION -1 +#define SCI_START 2000 +#define SCI_OPTIONAL_START 3000 +#define SCI_LEXER_START 4000 +#define SCI_ADDTEXT 2001 +#define SCI_ADDSTYLEDTEXT 2002 +#define SCI_INSERTTEXT 2003 +#define SCI_CHANGEINSERTION 2672 +#define SCI_CLEARALL 2004 +#define SCI_DELETERANGE 2645 +#define SCI_CLEARDOCUMENTSTYLE 2005 +#define SCI_GETLENGTH 2006 +#define SCI_GETCHARAT 2007 +#define SCI_GETCURRENTPOS 2008 +#define SCI_GETANCHOR 2009 +#define SCI_GETSTYLEAT 2010 +#define SCI_REDO 2011 +#define SCI_SETUNDOCOLLECTION 2012 +#define SCI_SELECTALL 2013 +#define SCI_SETSAVEPOINT 2014 +#define SCI_GETSTYLEDTEXT 2015 +#define SCI_CANREDO 2016 +#define SCI_MARKERLINEFROMHANDLE 2017 +#define SCI_MARKERDELETEHANDLE 2018 +#define SCI_GETUNDOCOLLECTION 2019 +#define SCWS_INVISIBLE 0 +#define SCWS_VISIBLEALWAYS 1 +#define SCWS_VISIBLEAFTERINDENT 2 +#define SCI_GETVIEWWS 2020 +#define SCI_SETVIEWWS 2021 +#define SCI_POSITIONFROMPOINT 2022 +#define SCI_POSITIONFROMPOINTCLOSE 2023 +#define SCI_GOTOLINE 2024 +#define SCI_GOTOPOS 2025 +#define SCI_SETANCHOR 2026 +#define SCI_GETCURLINE 2027 +#define SCI_GETENDSTYLED 2028 +#define SC_EOL_CRLF 0 +#define SC_EOL_CR 1 +#define SC_EOL_LF 2 +#define SCI_CONVERTEOLS 2029 +#define SCI_GETEOLMODE 2030 +#define SCI_SETEOLMODE 2031 +#define SCI_STARTSTYLING 2032 +#define SCI_SETSTYLING 2033 +#define SCI_GETBUFFEREDDRAW 2034 +#define SCI_SETBUFFEREDDRAW 2035 +#define SCI_SETTABWIDTH 2036 +#define SCI_GETTABWIDTH 2121 +#define SCI_CLEARTABSTOPS 2675 +#define SCI_ADDTABSTOP 2676 +#define SCI_GETNEXTTABSTOP 2677 +#define SC_CP_UTF8 65001 +#define SCI_SETCODEPAGE 2037 +#define SC_IME_WINDOWED 0 +#define SC_IME_INLINE 1 +#define SCI_GETIMEINTERACTION 2678 +#define SCI_SETIMEINTERACTION 2679 +#define MARKER_MAX 31 +#define SC_MARK_CIRCLE 0 +#define SC_MARK_ROUNDRECT 1 +#define SC_MARK_ARROW 2 +#define SC_MARK_SMALLRECT 3 +#define SC_MARK_SHORTARROW 4 +#define SC_MARK_EMPTY 5 +#define SC_MARK_ARROWDOWN 6 +#define SC_MARK_MINUS 7 +#define SC_MARK_PLUS 8 +#define SC_MARK_VLINE 9 +#define SC_MARK_LCORNER 10 +#define SC_MARK_TCORNER 11 +#define SC_MARK_BOXPLUS 12 +#define SC_MARK_BOXPLUSCONNECTED 13 +#define SC_MARK_BOXMINUS 14 +#define SC_MARK_BOXMINUSCONNECTED 15 +#define SC_MARK_LCORNERCURVE 16 +#define SC_MARK_TCORNERCURVE 17 +#define SC_MARK_CIRCLEPLUS 18 +#define SC_MARK_CIRCLEPLUSCONNECTED 19 +#define SC_MARK_CIRCLEMINUS 20 +#define SC_MARK_CIRCLEMINUSCONNECTED 21 +#define SC_MARK_BACKGROUND 22 +#define SC_MARK_DOTDOTDOT 23 +#define SC_MARK_ARROWS 24 +#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_BOOKMARK 31 +#define SC_MARK_CHARACTER 10000 +#define SC_MARKNUM_FOLDEREND 25 +#define SC_MARKNUM_FOLDEROPENMID 26 +#define SC_MARKNUM_FOLDERMIDTAIL 27 +#define SC_MARKNUM_FOLDERTAIL 28 +#define SC_MARKNUM_FOLDERSUB 29 +#define SC_MARKNUM_FOLDER 30 +#define SC_MARKNUM_FOLDEROPEN 31 +#define SC_MASK_FOLDERS 0xFE000000 +#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 +#define SCI_MARKERGET 2046 +#define SCI_MARKERNEXT 2047 +#define SCI_MARKERPREVIOUS 2048 +#define SCI_MARKERDEFINEPIXMAP 2049 +#define SCI_MARKERADDSET 2466 +#define SCI_MARKERSETALPHA 2476 +#define SC_MAX_MARGIN 4 +#define SC_MARGIN_SYMBOL 0 +#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 +#define SCI_GETMARGINWIDTHN 2243 +#define SCI_SETMARGINMASKN 2244 +#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 +#define STYLE_BRACEBAD 35 +#define STYLE_CONTROLCHAR 36 +#define STYLE_INDENTGUIDE 37 +#define STYLE_CALLTIP 38 +#define STYLE_LASTPREDEFINED 39 +#define STYLE_MAX 255 +#define SC_CHARSET_ANSI 0 +#define SC_CHARSET_DEFAULT 1 +#define SC_CHARSET_BALTIC 186 +#define SC_CHARSET_CHINESEBIG5 136 +#define SC_CHARSET_EASTEUROPE 238 +#define SC_CHARSET_GB2312 134 +#define SC_CHARSET_GREEK 161 +#define SC_CHARSET_HANGUL 129 +#define SC_CHARSET_MAC 77 +#define SC_CHARSET_OEM 255 +#define SC_CHARSET_RUSSIAN 204 +#define SC_CHARSET_CYRILLIC 1251 +#define SC_CHARSET_SHIFTJIS 128 +#define SC_CHARSET_SYMBOL 2 +#define SC_CHARSET_TURKISH 162 +#define SC_CHARSET_JOHAB 130 +#define SC_CHARSET_HEBREW 177 +#define SC_CHARSET_ARABIC 178 +#define SC_CHARSET_VIETNAMESE 163 +#define SC_CHARSET_THAI 222 +#define SC_CHARSET_8859_15 1000 +#define SCI_STYLECLEARALL 2050 +#define SCI_STYLESETFORE 2051 +#define SCI_STYLESETBACK 2052 +#define SCI_STYLESETBOLD 2053 +#define SCI_STYLESETITALIC 2054 +#define SCI_STYLESETSIZE 2055 +#define SCI_STYLESETFONT 2056 +#define SCI_STYLESETEOLFILLED 2057 +#define SCI_STYLERESETDEFAULT 2058 +#define SCI_STYLESETUNDERLINE 2059 +#define SC_CASE_MIXED 0 +#define SC_CASE_UPPER 1 +#define SC_CASE_LOWER 2 +#define SCI_STYLEGETFORE 2481 +#define SCI_STYLEGETBACK 2482 +#define SCI_STYLEGETBOLD 2483 +#define SCI_STYLEGETITALIC 2484 +#define SCI_STYLEGETSIZE 2485 +#define SCI_STYLEGETFONT 2486 +#define SCI_STYLEGETEOLFILLED 2487 +#define SCI_STYLEGETUNDERLINE 2488 +#define SCI_STYLEGETCASE 2489 +#define SCI_STYLEGETCHARACTERSET 2490 +#define SCI_STYLEGETVISIBLE 2491 +#define SCI_STYLEGETCHANGEABLE 2492 +#define SCI_STYLEGETHOTSPOT 2493 +#define SCI_STYLESETCASE 2060 +#define SC_FONT_SIZE_MULTIPLIER 100 +#define SCI_STYLESETSIZEFRACTIONAL 2061 +#define SCI_STYLEGETSIZEFRACTIONAL 2062 +#define SC_WEIGHT_NORMAL 400 +#define SC_WEIGHT_SEMIBOLD 600 +#define SC_WEIGHT_BOLD 700 +#define SCI_STYLESETWEIGHT 2063 +#define SCI_STYLEGETWEIGHT 2064 +#define SCI_STYLESETCHARACTERSET 2066 +#define SCI_STYLESETHOTSPOT 2409 +#define SCI_SETSELFORE 2067 +#define SCI_SETSELBACK 2068 +#define SCI_GETSELALPHA 2477 +#define SCI_SETSELALPHA 2478 +#define SCI_GETSELEOLFILLED 2479 +#define SCI_SETSELEOLFILLED 2480 +#define SCI_SETCARETFORE 2069 +#define SCI_ASSIGNCMDKEY 2070 +#define SCI_CLEARCMDKEY 2071 +#define SCI_CLEARALLCMDKEYS 2072 +#define SCI_SETSTYLINGEX 2073 +#define SCI_STYLESETVISIBLE 2074 +#define SCI_GETCARETPERIOD 2075 +#define SCI_SETCARETPERIOD 2076 +#define SCI_SETWORDCHARS 2077 +#define SCI_GETWORDCHARS 2646 +#define SCI_BEGINUNDOACTION 2078 +#define SCI_ENDUNDOACTION 2079 +#define INDIC_PLAIN 0 +#define INDIC_SQUIGGLE 1 +#define INDIC_TT 2 +#define INDIC_DIAGONAL 3 +#define INDIC_STRIKE 4 +#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_SQUIGGLEPIXMAP 13 +#define INDIC_COMPOSITIONTHICK 14 +#define INDIC_COMPOSITIONTHIN 15 +#define INDIC_FULLBOX 16 +#define INDIC_TEXTFORE 17 +#define INDIC_IME 32 +#define INDIC_IME_MAX 35 +#define INDIC_MAX 35 +#define INDIC_CONTAINER 8 +#define INDIC0_MASK 0x20 +#define INDIC1_MASK 0x40 +#define INDIC2_MASK 0x80 +#define INDICS_MASK 0xE0 +#define SCI_INDICSETSTYLE 2080 +#define SCI_INDICGETSTYLE 2081 +#define SCI_INDICSETFORE 2082 +#define SCI_INDICGETFORE 2083 +#define SCI_INDICSETUNDER 2510 +#define SCI_INDICGETUNDER 2511 +#define SCI_INDICSETHOVERSTYLE 2680 +#define SCI_INDICGETHOVERSTYLE 2681 +#define SCI_INDICSETHOVERFORE 2682 +#define SCI_INDICGETHOVERFORE 2683 +#define SC_INDICVALUEBIT 0x1000000 +#define SC_INDICVALUEMASK 0xFFFFFF +#define SC_INDICFLAG_VALUEFORE 1 +#define SCI_INDICSETFLAGS 2684 +#define SCI_INDICGETFLAGS 2685 +#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 +#define SCI_GETLINESTATE 2093 +#define SCI_GETMAXLINESTATE 2094 +#define SCI_GETCARETLINEVISIBLE 2095 +#define SCI_SETCARETLINEVISIBLE 2096 +#define SCI_GETCARETLINEBACK 2097 +#define SCI_SETCARETLINEBACK 2098 +#define SCI_STYLESETCHANGEABLE 2099 +#define SCI_AUTOCSHOW 2100 +#define SCI_AUTOCCANCEL 2101 +#define SCI_AUTOCACTIVE 2102 +#define SCI_AUTOCPOSSTART 2103 +#define SCI_AUTOCCOMPLETE 2104 +#define SCI_AUTOCSTOPS 2105 +#define SCI_AUTOCSETSEPARATOR 2106 +#define SCI_AUTOCGETSEPARATOR 2107 +#define SCI_AUTOCSELECT 2108 +#define SCI_AUTOCSETCANCELATSTART 2110 +#define SCI_AUTOCGETCANCELATSTART 2111 +#define SCI_AUTOCSETFILLUPS 2112 +#define SCI_AUTOCSETCHOOSESINGLE 2113 +#define SCI_AUTOCGETCHOOSESINGLE 2114 +#define SCI_AUTOCSETIGNORECASE 2115 +#define SCI_AUTOCGETIGNORECASE 2116 +#define SCI_USERLISTSHOW 2117 +#define SCI_AUTOCSETAUTOHIDE 2118 +#define SCI_AUTOCGETAUTOHIDE 2119 +#define SCI_AUTOCSETDROPRESTOFWORD 2270 +#define SCI_AUTOCGETDROPRESTOFWORD 2271 +#define SCI_REGISTERIMAGE 2405 +#define SCI_CLEARREGISTEREDIMAGES 2408 +#define SCI_AUTOCGETTYPESEPARATOR 2285 +#define SCI_AUTOCSETTYPESEPARATOR 2286 +#define SCI_AUTOCSETMAXWIDTH 2208 +#define SCI_AUTOCGETMAXWIDTH 2209 +#define SCI_AUTOCSETMAXHEIGHT 2210 +#define SCI_AUTOCGETMAXHEIGHT 2211 +#define SCI_SETINDENT 2122 +#define SCI_GETINDENT 2123 +#define SCI_SETUSETABS 2124 +#define SCI_GETUSETABS 2125 +#define SCI_SETLINEINDENTATION 2126 +#define SCI_GETLINEINDENTATION 2127 +#define SCI_GETLINEINDENTPOSITION 2128 +#define SCI_GETCOLUMN 2129 +#define SCI_COUNTCHARACTERS 2633 +#define SCI_SETHSCROLLBAR 2130 +#define SCI_GETHSCROLLBAR 2131 +#define SC_IV_NONE 0 +#define SC_IV_REAL 1 +#define SC_IV_LOOKFORWARD 2 +#define SC_IV_LOOKBOTH 3 +#define SCI_SETINDENTATIONGUIDES 2132 +#define SCI_GETINDENTATIONGUIDES 2133 +#define SCI_SETHIGHLIGHTGUIDE 2134 +#define SCI_GETHIGHLIGHTGUIDE 2135 +#define SCI_GETLINEENDPOSITION 2136 +#define SCI_GETCODEPAGE 2137 +#define SCI_GETCARETFORE 2138 +#define SCI_GETREADONLY 2140 +#define SCI_SETCURRENTPOS 2141 +#define SCI_SETSELECTIONSTART 2142 +#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 +#define SC_PRINT_INVERTLIGHT 1 +#define SC_PRINT_BLACKONWHITE 2 +#define SC_PRINT_COLOURONWHITE 3 +#define SC_PRINT_COLOURONWHITEDEFAULTBG 4 +#define SCI_SETPRINTCOLOURMODE 2148 +#define SCI_GETPRINTCOLOURMODE 2149 +#define SCFIND_WHOLEWORD 0x2 +#define SCFIND_MATCHCASE 0x4 +#define SCFIND_WORDSTART 0x00100000 +#define SCFIND_REGEXP 0x00200000 +#define SCFIND_POSIX 0x00400000 +#define SCFIND_CXX11REGEX 0x00800000 +#define SCI_FINDTEXT 2150 +#define SCI_FORMATRANGE 2151 +#define SCI_GETFIRSTVISIBLELINE 2152 +#define SCI_GETLINE 2153 +#define SCI_GETLINECOUNT 2154 +#define SCI_SETMARGINLEFT 2155 +#define SCI_GETMARGINLEFT 2156 +#define SCI_SETMARGINRIGHT 2157 +#define SCI_GETMARGINRIGHT 2158 +#define SCI_GETMODIFY 2159 +#define SCI_SETSEL 2160 +#define SCI_GETSELTEXT 2161 +#define SCI_GETTEXTRANGE 2162 +#define SCI_HIDESELECTION 2163 +#define SCI_POINTXFROMPOSITION 2164 +#define SCI_POINTYFROMPOSITION 2165 +#define SCI_LINEFROMPOSITION 2166 +#define SCI_POSITIONFROMLINE 2167 +#define SCI_LINESCROLL 2168 +#define SCI_SCROLLCARET 2169 +#define SCI_SCROLLRANGE 2569 +#define SCI_REPLACESEL 2170 +#define SCI_SETREADONLY 2171 +#define SCI_NULL 2172 +#define SCI_CANPASTE 2173 +#define SCI_CANUNDO 2174 +#define SCI_EMPTYUNDOBUFFER 2175 +#define SCI_UNDO 2176 +#define SCI_CUT 2177 +#define SCI_COPY 2178 +#define SCI_PASTE 2179 +#define SCI_CLEAR 2180 +#define SCI_SETTEXT 2181 +#define SCI_GETTEXT 2182 +#define SCI_GETTEXTLENGTH 2183 +#define SCI_GETDIRECTFUNCTION 2184 +#define SCI_GETDIRECTPOINTER 2185 +#define SCI_SETOVERTYPE 2186 +#define SCI_GETOVERTYPE 2187 +#define SCI_SETCARETWIDTH 2188 +#define SCI_GETCARETWIDTH 2189 +#define SCI_SETTARGETSTART 2190 +#define SCI_GETTARGETSTART 2191 +#define SCI_SETTARGETEND 2192 +#define SCI_GETTARGETEND 2193 +#define SCI_SETTARGETRANGE 2686 +#define SCI_GETTARGETTEXT 2687 +#define SCI_REPLACETARGET 2194 +#define SCI_REPLACETARGETRE 2195 +#define SCI_SEARCHINTARGET 2197 +#define SCI_SETSEARCHFLAGS 2198 +#define SCI_GETSEARCHFLAGS 2199 +#define SCI_CALLTIPSHOW 2200 +#define SCI_CALLTIPCANCEL 2201 +#define SCI_CALLTIPACTIVE 2202 +#define SCI_CALLTIPPOSSTART 2203 +#define SCI_CALLTIPSETPOSSTART 2214 +#define SCI_CALLTIPSETHLT 2204 +#define SCI_CALLTIPSETBACK 2205 +#define SCI_CALLTIPSETFORE 2206 +#define SCI_CALLTIPSETFOREHLT 2207 +#define SCI_CALLTIPUSESTYLE 2212 +#define SCI_CALLTIPSETPOSITION 2213 +#define SCI_VISIBLEFROMDOCLINE 2220 +#define SCI_DOCLINEFROMVISIBLE 2221 +#define SCI_WRAPCOUNT 2235 +#define SC_FOLDLEVELBASE 0x400 +#define SC_FOLDLEVELWHITEFLAG 0x1000 +#define SC_FOLDLEVELHEADERFLAG 0x2000 +#define SC_FOLDLEVELNUMBERMASK 0x0FFF +#define SCI_SETFOLDLEVEL 2222 +#define SCI_GETFOLDLEVEL 2223 +#define SCI_GETLASTCHILD 2224 +#define SCI_GETFOLDPARENT 2225 +#define SCI_SHOWLINES 2226 +#define SCI_HIDELINES 2227 +#define SCI_GETLINEVISIBLE 2228 +#define SCI_GETALLLINESVISIBLE 2236 +#define SCI_SETFOLDEXPANDED 2229 +#define SCI_GETFOLDEXPANDED 2230 +#define SCI_TOGGLEFOLD 2231 +#define SC_FOLDACTION_CONTRACT 0 +#define SC_FOLDACTION_EXPAND 1 +#define SC_FOLDACTION_TOGGLE 2 +#define SCI_FOLDLINE 2237 +#define SCI_FOLDCHILDREN 2238 +#define SCI_EXPANDCHILDREN 2239 +#define SCI_FOLDALL 2662 +#define SCI_ENSUREVISIBLE 2232 +#define SC_AUTOMATICFOLD_SHOW 0x0001 +#define SC_AUTOMATICFOLD_CLICK 0x0002 +#define SC_AUTOMATICFOLD_CHANGE 0x0004 +#define SCI_SETAUTOMATICFOLD 2663 +#define SCI_GETAUTOMATICFOLD 2664 +#define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 +#define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 +#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 +#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 +#define SC_FOLDFLAG_LEVELNUMBERS 0x0040 +#define SC_FOLDFLAG_LINESTATE 0x0080 +#define SCI_SETFOLDFLAGS 2233 +#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 +#define SCI_SETTABINDENTS 2260 +#define SCI_GETTABINDENTS 2261 +#define SCI_SETBACKSPACEUNINDENTS 2262 +#define SCI_GETBACKSPACEUNINDENTS 2263 +#define SC_TIME_FOREVER 10000000 +#define SCI_SETMOUSEDWELLTIME 2264 +#define SCI_GETMOUSEDWELLTIME 2265 +#define SCI_WORDSTARTPOSITION 2266 +#define SCI_WORDENDPOSITION 2267 +#define SC_WRAP_NONE 0 +#define SC_WRAP_WORD 1 +#define SC_WRAP_CHAR 2 +#define SC_WRAP_WHITESPACE 3 +#define SCI_SETWRAPMODE 2268 +#define SCI_GETWRAPMODE 2269 +#define SC_WRAPVISUALFLAG_NONE 0x0000 +#define SC_WRAPVISUALFLAG_END 0x0001 +#define SC_WRAPVISUALFLAG_START 0x0002 +#define SC_WRAPVISUALFLAG_MARGIN 0x0004 +#define SCI_SETWRAPVISUALFLAGS 2460 +#define SCI_GETWRAPVISUALFLAGS 2461 +#define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 +#define SC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 +#define SC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 +#define SCI_SETWRAPVISUALFLAGSLOCATION 2462 +#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 +#define SC_CACHE_DOCUMENT 3 +#define SCI_SETLAYOUTCACHE 2272 +#define SCI_GETLAYOUTCACHE 2273 +#define SCI_SETSCROLLWIDTH 2274 +#define SCI_GETSCROLLWIDTH 2275 +#define SCI_SETSCROLLWIDTHTRACKING 2516 +#define SCI_GETSCROLLWIDTHTRACKING 2517 +#define SCI_TEXTWIDTH 2276 +#define SCI_SETENDATLASTLINE 2277 +#define SCI_GETENDATLASTLINE 2278 +#define SCI_TEXTHEIGHT 2279 +#define SCI_SETVSCROLLBAR 2280 +#define SCI_GETVSCROLLBAR 2281 +#define SCI_APPENDTEXT 2282 +#define SCI_GETTWOPHASEDRAW 2283 +#define SCI_SETTWOPHASEDRAW 2284 +#define SC_PHASES_ONE 0 +#define SC_PHASES_TWO 1 +#define SC_PHASES_MULTIPLE 2 +#define SCI_GETPHASESDRAW 2673 +#define SCI_SETPHASESDRAW 2674 +#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 +#define SCI_SETFOLDMARGINCOLOUR 2290 +#define SCI_SETFOLDMARGINHICOLOUR 2291 +#define SCI_LINEDOWN 2300 +#define SCI_LINEDOWNEXTEND 2301 +#define SCI_LINEUP 2302 +#define SCI_LINEUPEXTEND 2303 +#define SCI_CHARLEFT 2304 +#define SCI_CHARLEFTEXTEND 2305 +#define SCI_CHARRIGHT 2306 +#define SCI_CHARRIGHTEXTEND 2307 +#define SCI_WORDLEFT 2308 +#define SCI_WORDLEFTEXTEND 2309 +#define SCI_WORDRIGHT 2310 +#define SCI_WORDRIGHTEXTEND 2311 +#define SCI_HOME 2312 +#define SCI_HOMEEXTEND 2313 +#define SCI_LINEEND 2314 +#define SCI_LINEENDEXTEND 2315 +#define SCI_DOCUMENTSTART 2316 +#define SCI_DOCUMENTSTARTEXTEND 2317 +#define SCI_DOCUMENTEND 2318 +#define SCI_DOCUMENTENDEXTEND 2319 +#define SCI_PAGEUP 2320 +#define SCI_PAGEUPEXTEND 2321 +#define SCI_PAGEDOWN 2322 +#define SCI_PAGEDOWNEXTEND 2323 +#define SCI_EDITTOGGLEOVERTYPE 2324 +#define SCI_CANCEL 2325 +#define SCI_DELETEBACK 2326 +#define SCI_TAB 2327 +#define SCI_BACKTAB 2328 +#define SCI_NEWLINE 2329 +#define SCI_FORMFEED 2330 +#define SCI_VCHOME 2331 +#define SCI_VCHOMEEXTEND 2332 +#define SCI_ZOOMIN 2333 +#define SCI_ZOOMOUT 2334 +#define SCI_DELWORDLEFT 2335 +#define SCI_DELWORDRIGHT 2336 +#define SCI_DELWORDRIGHTEND 2518 +#define SCI_LINECUT 2337 +#define SCI_LINEDELETE 2338 +#define SCI_LINETRANSPOSE 2339 +#define SCI_LINEDUPLICATE 2404 +#define SCI_LOWERCASE 2340 +#define SCI_UPPERCASE 2341 +#define SCI_LINESCROLLDOWN 2342 +#define SCI_LINESCROLLUP 2343 +#define SCI_DELETEBACKNOTLINE 2344 +#define SCI_HOMEDISPLAY 2345 +#define SCI_HOMEDISPLAYEXTEND 2346 +#define SCI_LINEENDDISPLAY 2347 +#define SCI_LINEENDDISPLAYEXTEND 2348 +#define SCI_HOMEWRAP 2349 +#define SCI_HOMEWRAPEXTEND 2450 +#define SCI_LINEENDWRAP 2451 +#define SCI_LINEENDWRAPEXTEND 2452 +#define SCI_VCHOMEWRAP 2453 +#define SCI_VCHOMEWRAPEXTEND 2454 +#define SCI_LINECOPY 2455 +#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 +#define SCI_GETDOCPOINTER 2357 +#define SCI_SETDOCPOINTER 2358 +#define SCI_SETMODEVENTMASK 2359 +#define EDGE_NONE 0 +#define EDGE_LINE 1 +#define EDGE_BACKGROUND 2 +#define SCI_GETEDGECOLUMN 2360 +#define SCI_SETEDGECOLUMN 2361 +#define SCI_GETEDGEMODE 2362 +#define SCI_SETEDGEMODE 2363 +#define SCI_GETEDGECOLOUR 2364 +#define SCI_SETEDGECOLOUR 2365 +#define SCI_SEARCHANCHOR 2366 +#define SCI_SEARCHNEXT 2367 +#define SCI_SEARCHPREV 2368 +#define SCI_LINESONSCREEN 2370 +#define SCI_USEPOPUP 2371 +#define SCI_SELECTIONISRECTANGLE 2372 +#define SCI_SETZOOM 2373 +#define SCI_GETZOOM 2374 +#define SCI_CREATEDOCUMENT 2375 +#define SCI_ADDREFDOCUMENT 2376 +#define SCI_RELEASEDOCUMENT 2377 +#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 SC_STATUS_WARN_START 1000 +#define SC_STATUS_WARN_REGEX 1001 +#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 +#define SCI_GETCONTROLCHARSYMBOL 2389 +#define SCI_WORDPARTLEFT 2390 +#define SCI_WORDPARTLEFTEXTEND 2391 +#define SCI_WORDPARTRIGHT 2392 +#define SCI_WORDPARTRIGHTEXTEND 2393 +#define VISIBLE_SLOP 0x01 +#define VISIBLE_STRICT 0x04 +#define SCI_SETVISIBLEPOLICY 2394 +#define SCI_DELLINELEFT 2395 +#define SCI_DELLINERIGHT 2396 +#define SCI_SETXOFFSET 2397 +#define SCI_GETXOFFSET 2398 +#define SCI_CHOOSECARETX 2399 +#define SCI_GRABFOCUS 2400 +#define CARET_SLOP 0x01 +#define CARET_STRICT 0x04 +#define CARET_JUMPS 0x10 +#define CARET_EVEN 0x08 +#define SCI_SETXCARETPOLICY 2402 +#define SCI_SETYCARETPOLICY 2403 +#define SCI_SETPRINTWRAPMODE 2406 +#define SCI_GETPRINTWRAPMODE 2407 +#define SCI_SETHOTSPOTACTIVEFORE 2410 +#define SCI_GETHOTSPOTACTIVEFORE 2494 +#define SCI_SETHOTSPOTACTIVEBACK 2411 +#define SCI_GETHOTSPOTACTIVEBACK 2495 +#define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 +#define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 +#define SCI_SETHOTSPOTSINGLELINE 2421 +#define SCI_GETHOTSPOTSINGLELINE 2497 +#define SCI_PARADOWN 2413 +#define SCI_PARADOWNEXTEND 2414 +#define SCI_PARAUP 2415 +#define SCI_PARAUPEXTEND 2416 +#define SCI_POSITIONBEFORE 2417 +#define SCI_POSITIONAFTER 2418 +#define SCI_POSITIONRELATIVE 2670 +#define SCI_COPYRANGE 2419 +#define SCI_COPYTEXT 2420 +#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 +#define SCI_GETLINESELENDPOSITION 2425 +#define SCI_LINEDOWNRECTEXTEND 2426 +#define SCI_LINEUPRECTEXTEND 2427 +#define SCI_CHARLEFTRECTEXTEND 2428 +#define SCI_CHARRIGHTRECTEXTEND 2429 +#define SCI_HOMERECTEXTEND 2430 +#define SCI_VCHOMERECTEXTEND 2431 +#define SCI_LINEENDRECTEXTEND 2432 +#define SCI_PAGEUPRECTEXTEND 2433 +#define SCI_PAGEDOWNRECTEXTEND 2434 +#define SCI_STUTTEREDPAGEUP 2435 +#define SCI_STUTTEREDPAGEUPEXTEND 2436 +#define SCI_STUTTEREDPAGEDOWN 2437 +#define SCI_STUTTEREDPAGEDOWNEXTEND 2438 +#define SCI_WORDLEFTEND 2439 +#define SCI_WORDLEFTENDEXTEND 2440 +#define SCI_WORDRIGHTEND 2441 +#define SCI_WORDRIGHTENDEXTEND 2442 +#define SCI_SETWHITESPACECHARS 2443 +#define SCI_GETWHITESPACECHARS 2647 +#define SCI_SETPUNCTUATIONCHARS 2648 +#define SCI_GETPUNCTUATIONCHARS 2649 +#define SCI_SETCHARSDEFAULT 2444 +#define SCI_AUTOCGETCURRENT 2445 +#define SCI_AUTOCGETCURRENTTEXT 2610 +#define SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0 +#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 +#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634 +#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635 +#define SC_MULTIAUTOC_ONCE 0 +#define SC_MULTIAUTOC_EACH 1 +#define SCI_AUTOCSETMULTI 2636 +#define SCI_AUTOCGETMULTI 2637 +#define SC_ORDER_PRESORTED 0 +#define SC_ORDER_PERFORMSORT 1 +#define SC_ORDER_CUSTOM 2 +#define SCI_AUTOCSETORDER 2660 +#define SCI_AUTOCGETORDER 2661 +#define SCI_ALLOCATE 2446 +#define SCI_TARGETASUTF8 2447 +#define SCI_SETLENGTHFORENCODE 2448 +#define SCI_ENCODEDFROMUTF8 2449 +#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 +#define SCI_SELECTIONDUPLICATE 2469 +#define SC_ALPHA_TRANSPARENT 0 +#define SC_ALPHA_OPAQUE 255 +#define SC_ALPHA_NOALPHA 256 +#define SCI_SETCARETLINEBACKALPHA 2470 +#define SCI_GETCARETLINEBACKALPHA 2471 +#define CARETSTYLE_INVISIBLE 0 +#define CARETSTYLE_LINE 1 +#define CARETSTYLE_BLOCK 2 +#define SCI_SETCARETSTYLE 2512 +#define SCI_GETCARETSTYLE 2513 +#define SCI_SETINDICATORCURRENT 2500 +#define SCI_GETINDICATORCURRENT 2501 +#define SCI_SETINDICATORVALUE 2502 +#define SCI_GETINDICATORVALUE 2503 +#define SCI_INDICATORFILLRANGE 2504 +#define SCI_INDICATORCLEARRANGE 2505 +#define SCI_INDICATORALLONFOR 2506 +#define SCI_INDICATORVALUEAT 2507 +#define SCI_INDICATORSTART 2508 +#define SCI_INDICATOREND 2509 +#define SCI_SETPOSITIONCACHE 2514 +#define SCI_GETPOSITIONCACHE 2515 +#define SCI_COPYALLOWLINE 2519 +#define SCI_GETCHARACTERPOINTER 2520 +#define SCI_GETRANGEPOINTER 2643 +#define SCI_GETGAPPOSITION 2644 +#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 ANNOTATION_INDENTED 3 +#define SCI_ANNOTATIONSETVISIBLE 2548 +#define SCI_ANNOTATIONGETVISIBLE 2549 +#define SCI_ANNOTATIONSETSTYLEOFFSET 2550 +#define SCI_ANNOTATIONGETSTYLEOFFSET 2551 +#define SCI_RELEASEALLEXTENDEDSTYLES 2552 +#define SCI_ALLOCATEEXTENDEDSTYLES 2553 +#define UNDO_MAY_COALESCE 1 +#define SCI_ADDUNDOACTION 2560 +#define SCI_CHARPOSITIONFROMPOINT 2561 +#define SCI_CHARPOSITIONFROMPOINTCLOSE 2562 +#define SCI_SETMOUSESELECTIONRECTANGULARSWITCH 2668 +#define SCI_GETMOUSESELECTIONRECTANGULARSWITCH 2669 +#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_GETSELECTIONEMPTY 2650 +#define SCI_CLEARSELECTIONS 2571 +#define SCI_SETSELECTION 2572 +#define SCI_ADDSELECTION 2573 +#define SCI_DROPSELECTIONN 2671 +#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_RGBAIMAGESETSCALE 2651 +#define SCI_MARKERDEFINERGBAIMAGE 2626 +#define SCI_REGISTERRGBAIMAGE 2627 +#define SCI_SCROLLTOSTART 2628 +#define SCI_SCROLLTOEND 2629 +#define SC_TECHNOLOGY_DEFAULT 0 +#define SC_TECHNOLOGY_DIRECTWRITE 1 +#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2 +#define SC_TECHNOLOGY_DIRECTWRITEDC 3 +#define SCI_SETTECHNOLOGY 2630 +#define SCI_GETTECHNOLOGY 2631 +#define SCI_CREATELOADER 2632 +#define SCI_FINDINDICATORSHOW 2640 +#define SCI_FINDINDICATORFLASH 2641 +#define SCI_FINDINDICATORHIDE 2642 +#define SCI_VCHOMEDISPLAY 2652 +#define SCI_VCHOMEDISPLAYEXTEND 2653 +#define SCI_GETCARETLINEVISIBLEALWAYS 2654 +#define SCI_SETCARETLINEVISIBLEALWAYS 2655 +#define SC_LINE_END_TYPE_DEFAULT 0 +#define SC_LINE_END_TYPE_UNICODE 1 +#define SCI_SETLINEENDTYPESALLOWED 2656 +#define SCI_GETLINEENDTYPESALLOWED 2657 +#define SCI_GETLINEENDTYPESACTIVE 2658 +#define SCI_SETREPRESENTATION 2665 +#define SCI_GETREPRESENTATION 2666 +#define SCI_CLEARREPRESENTATION 2667 +#define SCI_STARTRECORD 3001 +#define SCI_STOPRECORD 3002 +#define SCI_SETLEXER 4001 +#define SCI_GETLEXER 4002 +#define SCI_COLOURISE 4003 +#define SCI_SETPROPERTY 4004 +#define KEYWORDSET_MAX 8 +#define SCI_SETKEYWORDS 4005 +#define SCI_SETLEXERLANGUAGE 4006 +#define SCI_LOADLEXERLIBRARY 4007 +#define SCI_GETPROPERTY 4008 +#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 SCI_GETLINEENDTYPESSUPPORTED 4018 +#define SCI_ALLOCATESUBSTYLES 4020 +#define SCI_GETSUBSTYLESSTART 4021 +#define SCI_GETSUBSTYLESLENGTH 4022 +#define SCI_GETSTYLEFROMSUBSTYLE 4027 +#define SCI_GETPRIMARYSTYLEFROMSTYLE 4028 +#define SCI_FREESUBSTYLES 4023 +#define SCI_SETIDENTIFIERS 4024 +#define SCI_DISTANCETOSECONDARYSTYLES 4025 +#define SCI_GETSUBSTYLEBASES 4026 +#define SC_MOD_INSERTTEXT 0x1 +#define SC_MOD_DELETETEXT 0x2 +#define SC_MOD_CHANGESTYLE 0x4 +#define SC_MOD_CHANGEFOLD 0x8 +#define SC_PERFORMED_USER 0x10 +#define SC_PERFORMED_UNDO 0x20 +#define SC_PERFORMED_REDO 0x40 +#define SC_MULTISTEPUNDOREDO 0x80 +#define SC_LASTSTEPINUNDOREDO 0x100 +#define SC_MOD_CHANGEMARKER 0x200 +#define SC_MOD_BEFOREINSERT 0x400 +#define SC_MOD_BEFOREDELETE 0x800 +#define SC_MULTILINEUNDOREDO 0x1000 +#define SC_STARTACTION 0x2000 +#define SC_MOD_CHANGEINDICATOR 0x4000 +#define SC_MOD_CHANGELINESTATE 0x8000 +#define SC_MOD_CHANGEMARGIN 0x10000 +#define SC_MOD_CHANGEANNOTATION 0x20000 +#define SC_MOD_CONTAINER 0x40000 +#define SC_MOD_LEXERSTATE 0x80000 +#define SC_MOD_INSERTCHECK 0x100000 +#define SC_MOD_CHANGETABSTOPS 0x200000 +#define SC_MODEVENTMASKALL 0x3FFFFF +#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 +#define SCK_DOWN 300 +#define SCK_UP 301 +#define SCK_LEFT 302 +#define SCK_RIGHT 303 +#define SCK_HOME 304 +#define SCK_END 305 +#define SCK_PRIOR 306 +#define SCK_NEXT 307 +#define SCK_DELETE 308 +#define SCK_INSERT 309 +#define SCK_ESCAPE 7 +#define SCK_BACK 8 +#define SCK_TAB 9 +#define SCK_RETURN 13 +#define SCK_ADD 310 +#define SCK_SUBTRACT 311 +#define SCK_DIVIDE 312 +#define SCK_WIN 313 +#define SCK_RWIN 314 +#define SCK_MENU 315 +#define SCMOD_NORM 0 +#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 +#define SCN_SAVEPOINTLEFT 2003 +#define SCN_MODIFYATTEMPTRO 2004 +#define SCN_KEY 2005 +#define SCN_DOUBLECLICK 2006 +#define SCN_UPDATEUI 2007 +#define SCN_MODIFIED 2008 +#define SCN_MACRORECORD 2009 +#define SCN_MARGINCLICK 2010 +#define SCN_NEEDSHOWN 2011 +#define SCN_PAINTED 2013 +#define SCN_USERLISTSELECTION 2014 +#define SCN_URIDROPPED 2015 +#define SCN_DWELLSTART 2016 +#define SCN_DWELLEND 2017 +#define SCN_ZOOM 2018 +#define SCN_HOTSPOTCLICK 2019 +#define SCN_HOTSPOTDOUBLECLICK 2020 +#define SCN_CALLTIPCLICK 2021 +#define SCN_AUTOCSELECTION 2022 +#define SCN_INDICATORCLICK 2023 +#define SCN_INDICATORRELEASE 2024 +#define SCN_AUTOCCANCELLED 2025 +#define SCN_AUTOCCHARDELETED 2026 +#define SCN_HOTSPOTRELEASECLICK 2027 +#define SCN_FOCUSIN 2028 +#define SCN_FOCUSOUT 2029 +/* --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. */ + +#if defined(__cplusplus) && defined(SCI_NAMESPACE) +namespace Scintilla { +#endif + +struct Sci_CharacterRange { + long cpMin; + long cpMax; +}; + +struct Sci_TextRange { + struct Sci_CharacterRange chrg; + char *lpstrText; +}; + +struct Sci_TextToFind { + struct Sci_CharacterRange chrg; + const char *lpstrText; + struct Sci_CharacterRange chrgText; +}; + +#define CharacterRange Sci_CharacterRange +#define TextRange Sci_TextRange +#define TextToFind Sci_TextToFind + +typedef void *Sci_SurfaceID; + +struct Sci_Rectangle { + int left; + int top; + int right; + int bottom; +}; + +/* 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 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 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 */ +}; + +#if defined(__cplusplus) && defined(SCI_NAMESPACE) +} +#endif + +#ifdef INCLUDE_DEPRECATED_FEATURES + +#define SC_CP_DBCS 1 +#define SCI_SETUSEPALETTE 2039 +#define SCI_GETUSEPALETTE 2139 + +#endif + +#endif diff --git a/libs/qscintilla/include/Scintilla.iface b/libs/qscintilla/include/Scintilla.iface new file mode 100644 index 000000000..f5fac5480 --- /dev/null +++ b/libs/qscintilla/include/Scintilla.iface @@ -0,0 +1,4662 @@ +## First line may be used for shbang + +## This file defines the interface to Scintilla + +## Copyright 2000-2003 by Neil Hodgson +## The License.txt file describes the conditions under which this software may be distributed. + +## A line starting with ## is a pure comment and should be stripped by readers. +## A line starting with #! is for future shbang use +## A line starting with # followed by a space is a documentation comment and refers +## to the next feature definition. + +## Each feature is defined by a line starting with fun, get, set, val or evt. +## cat -> start a category +## fun -> a function +## get -> a property get function +## set -> a property set function +## val -> definition of a constant +## evt -> an event +## enu -> associate an enumeration with a set of vals with a prefix +## lex -> associate a lexer with the lexical classes it produces +## +## All other feature names should be ignored. They may be defined in the future. +## A property may have a set function, a get function or both. Each will have +## "Get" or "Set" in their names and the corresponding name will have the obvious switch. +## A property may be subscripted, in which case the first parameter is the subscript. +## fun, get, and set features have a strict syntax: +## [=,) +## where stands for white space. +## param may be empty (null value) or is [=] +## Additional white space is allowed between elements. +## The syntax for evt is [=[,]*]) +## Feature names that contain an underscore are defined by Windows, so in these +## cases, using the Windows definition is preferred where available. +## The feature numbers are stable so features will not be renumbered. +## Features may be removed but they will go through a period of deprecation +## before removal which is signalled by moving them into the Deprecated category. +## +## enu has the syntax enu=[]* where all the val +## features in this file starting with a given are considered part of the +## enumeration. +## +## lex has the syntax lex=[]* +## where name is a reasonably capitalised (Python, XML) identifier or UI name, +## lexerVal is the val used to specify the lexer, and the list of prefixes is similar +## to enu. The name may not be the same as that used within the lexer so the lexerVal +## should be used to tie these entities together. + +## Types: +## void +## int +## bool -> integer, 1=true, 0=false +## position -> integer position in a document +## colour -> colour integer containing red, green and blue bytes. +## string -> pointer to const character +## stringresult -> pointer to character, NULL-> return size of result +## cells -> pointer to array of cells, each cell containing a style byte and character byte +## textrange -> range of a min and a max position with an output string +## findtext -> searchrange, text -> foundposition +## keymod -> integer containing key in low half and modifiers in high half +## formatrange +## Types no longer used: +## findtextex -> searchrange +## charrange -> range of a min and a max position +## charrangeresult -> like charrange, but output param +## countedstring +## point -> x,y +## pointresult -> like point, but output param +## rectangle -> left,top,right,bottom +## Client code should ignore definitions containing types it does not understand, except +## for possibly #defining the constants + +## Line numbers and positions start at 0. +## String arguments may contain NUL ('\0') characters where the calls provide a length +## argument and retrieve NUL characters. All retrieved strings except for those retrieved +## by GetLine also have a NUL appended but client code should calculate the size that +## will be returned rather than relying upon the NUL whenever possible. Allow for the +## extra NUL character when allocating buffers. The size to allocate for a stringresult +## can be determined by calling with a NULL (0) pointer. + +cat Basics + +################################################ +## For Scintilla.h +val INVALID_POSITION=-1 +# Define start of Scintilla messages to be greater than all Windows edit (EM_*) messages +# as many EM_ messages can be used although that use is deprecated. +val SCI_START=2000 +val SCI_OPTIONAL_START=3000 +val SCI_LEXER_START=4000 + +# Add text to the document at current position. +fun void AddText=2001(int length, string text) + +# Add array of cells to document. +fun void AddStyledText=2002(int length, cells c) + +# Insert string at a position. +fun void InsertText=2003(position pos, string text) + +# Change the text that is being inserted in response to SC_MOD_INSERTCHECK +fun void ChangeInsertion=2672(int length, string text) + +# Delete all text in the document. +fun void ClearAll=2004(,) + +# Delete a range of text in the document. +fun void DeleteRange=2645(position pos, int deleteLength) + +# Set all style bytes to 0, remove all folding information. +fun void ClearDocumentStyle=2005(,) + +# Returns the number of bytes in the document. +get int GetLength=2006(,) + +# Returns the character byte at the position. +get int GetCharAt=2007(position pos,) + +# Returns the position of the caret. +get position GetCurrentPos=2008(,) + +# Returns the position of the opposite end of the selection to the caret. +get position GetAnchor=2009(,) + +# Returns the style byte at the position. +get int GetStyleAt=2010(position pos,) + +# Redoes the next action on the undo history. +fun void Redo=2011(,) + +# Choose between collecting actions into the undo +# history and discarding them. +set void SetUndoCollection=2012(bool collectUndo,) + +# Select all the text in the document. +fun void SelectAll=2013(,) + +# Remember the current position in the undo history as the position +# at which the document was saved. +fun void SetSavePoint=2014(,) + +# Retrieve a buffer of cells. +# Returns the number of bytes in the buffer not including terminating NULs. +fun int GetStyledText=2015(, textrange tr) + +# Are there any redoable actions in the undo history? +fun bool CanRedo=2016(,) + +# Retrieve the line number at which a particular marker is located. +fun int MarkerLineFromHandle=2017(int handle,) + +# Delete a marker. +fun void MarkerDeleteHandle=2018(int handle,) + +# Is undo history being collected? +get bool GetUndoCollection=2019(,) + +enu WhiteSpace=SCWS_ +val SCWS_INVISIBLE=0 +val SCWS_VISIBLEALWAYS=1 +val SCWS_VISIBLEAFTERINDENT=2 + +# Are white space characters currently visible? +# Returns one of SCWS_* constants. +get int GetViewWS=2020(,) + +# Make white space characters invisible, always visible or visible outside indentation. +set void SetViewWS=2021(int viewWS,) + +# Find the position from a point within the window. +fun position PositionFromPoint=2022(int x, int y) + +# Find the position from a point within the window but return +# INVALID_POSITION if not close to text. +fun position PositionFromPointClose=2023(int x, int y) + +# Set caret to start of a line and ensure it is visible. +fun void GotoLine=2024(int line,) + +# Set caret to a position and ensure it is visible. +fun void GotoPos=2025(position pos,) + +# Set the selection anchor to a position. The anchor is the opposite +# end of the selection from the caret. +set void SetAnchor=2026(position posAnchor,) + +# Retrieve the text of the line containing the caret. +# Returns the index of the caret on the line. +fun int GetCurLine=2027(int length, stringresult text) + +# Retrieve the position of the last correctly styled character. +get position GetEndStyled=2028(,) + +enu EndOfLine=SC_EOL_ +val SC_EOL_CRLF=0 +val SC_EOL_CR=1 +val SC_EOL_LF=2 + +# Convert all line endings in the document to one mode. +fun void ConvertEOLs=2029(int eolMode,) + +# Retrieve the current end of line mode - one of CRLF, CR, or LF. +get int GetEOLMode=2030(,) + +# Set the current end of line mode. +set void SetEOLMode=2031(int eolMode,) + +# Set the current styling position to pos and the styling mask to mask. +# The styling mask can be used to protect some bits in each styling byte from modification. +fun void StartStyling=2032(position pos, int mask) + +# Change style from current styling position for length characters to a style +# and move the current styling position to after this newly styled segment. +fun void SetStyling=2033(int length, int style) + +# Is drawing done first into a buffer or direct to the screen? +get bool GetBufferedDraw=2034(,) + +# If drawing is buffered then each line of text is drawn into a bitmap buffer +# before drawing it to the screen to avoid flicker. +set void SetBufferedDraw=2035(bool buffered,) + +# Change the visible size of a tab to be a multiple of the width of a space character. +set void SetTabWidth=2036(int tabWidth,) + +# Retrieve the visible size of a tab. +get int GetTabWidth=2121(,) + +# Clear explicit tabstops on a line. +fun void ClearTabStops=2675(int line,) + +# Add an explicit tab stop for a line. +fun void AddTabStop=2676(int line, int x) + +# Find the next explicit tab stop position on a line after a position. +fun int GetNextTabStop=2677(int line, int x) + +# The SC_CP_UTF8 value can be used to enter Unicode mode. +# This is the same value as CP_UTF8 in Windows +val SC_CP_UTF8=65001 + +# 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,) + +enu IMEInteraction=SC_IME_ +val SC_IME_WINDOWED=0 +val SC_IME_INLINE=1 + +# Is the IME displayed in a winow or inline? +get int GetIMEInteraction=2678(,) + +# Choose to display the the IME in a winow or inline. +set void SetIMEInteraction=2679(int imeInteraction,) + +enu MarkerSymbol=SC_MARK_ +val MARKER_MAX=31 +val SC_MARK_CIRCLE=0 +val SC_MARK_ROUNDRECT=1 +val SC_MARK_ARROW=2 +val SC_MARK_SMALLRECT=3 +val SC_MARK_SHORTARROW=4 +val SC_MARK_EMPTY=5 +val SC_MARK_ARROWDOWN=6 +val SC_MARK_MINUS=7 +val SC_MARK_PLUS=8 + +# Shapes used for outlining column. +val SC_MARK_VLINE=9 +val SC_MARK_LCORNER=10 +val SC_MARK_TCORNER=11 +val SC_MARK_BOXPLUS=12 +val SC_MARK_BOXPLUSCONNECTED=13 +val SC_MARK_BOXMINUS=14 +val SC_MARK_BOXMINUSCONNECTED=15 +val SC_MARK_LCORNERCURVE=16 +val SC_MARK_TCORNERCURVE=17 +val SC_MARK_CIRCLEPLUS=18 +val SC_MARK_CIRCLEPLUSCONNECTED=19 +val SC_MARK_CIRCLEMINUS=20 +val SC_MARK_CIRCLEMINUSCONNECTED=21 + +# 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_BOOKMARK=31 + +val SC_MARK_CHARACTER=10000 + +enu MarkerOutline=SC_MARKNUM_ +# Markers used for outlining column. +val SC_MARKNUM_FOLDEREND=25 +val SC_MARKNUM_FOLDEROPENMID=26 +val SC_MARKNUM_FOLDERMIDTAIL=27 +val SC_MARKNUM_FOLDERTAIL=28 +val SC_MARKNUM_FOLDERSUB=29 +val SC_MARKNUM_FOLDER=30 +val SC_MARKNUM_FOLDEROPEN=31 + +val SC_MASK_FOLDERS=0xFE000000 + +# Set the symbol used for a particular marker number. +fun void MarkerDefine=2040(int markerNumber, int markerSymbol) + +# Set the foreground colour used for a particular marker number. +set void MarkerSetFore=2041(int markerNumber, colour fore) + +# Set the background colour used for a particular marker number. +set void MarkerSetBack=2042(int markerNumber, colour back) + +# Set the background colour used for a particular marker number when its folding block is selected. +set 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) + +# Delete a marker from a line. +fun void MarkerDelete=2044(int line, int markerNumber) + +# Delete all markers with a particular number from all lines. +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 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. +fun int MarkerPrevious=2048(int lineStart, int markerMask) + +# Define a marker from a pixmap. +fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap) + +# Add a set of markers to a line. +fun void MarkerAddSet=2466(int line, int set) + +# Set the alpha used for a marker that is drawn in the text area, not the margin. +set void MarkerSetAlpha=2476(int markerNumber, int alpha) + +val SC_MAX_MARGIN=4 + +enu MarginType=SC_MARGIN_ +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) + +# Retrieve the type of a margin. +get int GetMarginTypeN=2241(int margin,) + +# Set the width of a margin to a width expressed in pixels. +set void SetMarginWidthN=2242(int margin, int pixelWidth) + +# Retrieve the width of a margin in pixels. +get int GetMarginWidthN=2243(int margin,) + +# Set a mask that determines which markers are displayed in a margin. +set void SetMarginMaskN=2244(int margin, int mask) + +# Retrieve the marker mask of a margin. +get int GetMarginMaskN=2245(int margin,) + +# Make a margin sensitive or insensitive to mouse clicks. +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_ +val STYLE_DEFAULT=32 +val STYLE_LINENUMBER=33 +val STYLE_BRACELIGHT=34 +val STYLE_BRACEBAD=35 +val STYLE_CONTROLCHAR=36 +val STYLE_INDENTGUIDE=37 +val STYLE_CALLTIP=38 +val STYLE_LASTPREDEFINED=39 +val STYLE_MAX=255 + +# Character set identifiers are used in StyleSetCharacterSet. +# The values are the same as the Windows *_CHARSET values. +enu CharacterSet=SC_CHARSET_ +val SC_CHARSET_ANSI=0 +val SC_CHARSET_DEFAULT=1 +val SC_CHARSET_BALTIC=186 +val SC_CHARSET_CHINESEBIG5=136 +val SC_CHARSET_EASTEUROPE=238 +val SC_CHARSET_GB2312=134 +val SC_CHARSET_GREEK=161 +val SC_CHARSET_HANGUL=129 +val SC_CHARSET_MAC=77 +val SC_CHARSET_OEM=255 +val SC_CHARSET_RUSSIAN=204 +val SC_CHARSET_CYRILLIC=1251 +val SC_CHARSET_SHIFTJIS=128 +val SC_CHARSET_SYMBOL=2 +val SC_CHARSET_TURKISH=162 +val SC_CHARSET_JOHAB=130 +val SC_CHARSET_HEBREW=177 +val SC_CHARSET_ARABIC=178 +val SC_CHARSET_VIETNAMESE=163 +val SC_CHARSET_THAI=222 +val SC_CHARSET_8859_15=1000 + +# Clear all the styles and make equivalent to the global default style. +fun void StyleClearAll=2050(,) + +# Set the foreground colour of a style. +set void StyleSetFore=2051(int style, colour fore) + +# Set the background colour of a style. +set void StyleSetBack=2052(int style, colour back) + +# Set a style to be bold or not. +set void StyleSetBold=2053(int style, bool bold) + +# Set a style to be italic or not. +set void StyleSetItalic=2054(int style, bool italic) + +# Set the size of characters of a style. +set void StyleSetSize=2055(int style, int sizePoints) + +# Set the font of a style. +set void StyleSetFont=2056(int style, string fontName) + +# Set a style to have its end of line filled or not. +set void StyleSetEOLFilled=2057(int style, bool filled) + +# Reset the default style to its state at startup +fun void StyleResetDefault=2058(,) + +# Set a style to be underlined or not. +set void StyleSetUnderline=2059(int style, bool underline) + +enu CaseVisible=SC_CASE_ +val SC_CASE_MIXED=0 +val SC_CASE_UPPER=1 +val SC_CASE_LOWER=2 + +# Get the foreground colour of a style. +get colour StyleGetFore=2481(int style,) + +# Get the background colour of a style. +get colour StyleGetBack=2482(int style,) + +# Get is a style bold or not. +get bool StyleGetBold=2483(int style,) + +# Get is a style italic or not. +get bool StyleGetItalic=2484(int style,) + +# Get the size of characters of a style. +get int StyleGetSize=2485(int style,) + +# Get the font of a style. +# Returns the length of the fontName +get int StyleGetFont=2486(int style, stringresult fontName) + +# Get is a style to have its end of line filled or not. +get bool StyleGetEOLFilled=2487(int style,) + +# Get is a style underlined or not. +get bool StyleGetUnderline=2488(int style,) + +# Get is a style mixed case, or to force upper or lower case. +get int StyleGetCase=2489(int style,) + +# Get the character get of the font in a style. +get int StyleGetCharacterSet=2490(int style,) + +# Get is a style visible or not. +get bool StyleGetVisible=2491(int style,) + +# Get is a style changeable or not (read only). +# Experimental feature, currently buggy. +get bool StyleGetChangeable=2492(int style,) + +# Get is a style a hotspot or not. +get bool StyleGetHotSpot=2493(int style,) + +# Set a style to be mixed case, or to force upper or lower case. +set void StyleSetCase=2060(int style, int caseForce) + +val SC_FONT_SIZE_MULTIPLIER=100 + +# Set the size of characters of a style. Size is in points multiplied by 100. +set void StyleSetSizeFractional=2061(int style, int caseForce) + +# Get the size of characters of a style in points multiplied by 100 +get int StyleGetSizeFractional=2062(int style,) + +enu FontWeight=SC_WEIGHT_ +val SC_WEIGHT_NORMAL=400 +val SC_WEIGHT_SEMIBOLD=600 +val SC_WEIGHT_BOLD=700 + +# Set the weight of characters of a style. +set void StyleSetWeight=2063(int style, int weight) + +# Get the weight of characters of a style. +get int StyleGetWeight=2064(int style,) + +# Set the character set of the font in a style. +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 main and additional selections and whether to use this setting. +fun void SetSelFore=2067(bool useSetting, colour fore) + +# 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. +get int GetSelAlpha=2477(,) + +# Set the alpha of the selection. +set void SetSelAlpha=2478(int alpha,) + +# Is the selection end of line filled? +get bool GetSelEOLFilled=2479(,) + +# Set the selection to have its end of line filled or not. +set void SetSelEOLFilled=2480(bool filled,) + +# Set the foreground colour of the caret. +set void SetCaretFore=2069(colour fore,) + +# When key+modifier combination km is pressed perform msg. +fun void AssignCmdKey=2070(keymod km, int msg) + +# When key+modifier combination km is pressed do nothing. +fun void ClearCmdKey=2071(keymod km,) + +# Drop all key mappings. +fun void ClearAllCmdKeys=2072(,) + +# Set the styles for a segment of the document. +fun void SetStylingEx=2073(int length, string styles) + +# Set a style to be visible or not. +set void StyleSetVisible=2074(int style, bool visible) + +# Get the time in milliseconds that the caret is on and off. +get int GetCaretPeriod=2075(,) + +# Get the time in milliseconds that the caret is on and off. 0 = steady on. +set void SetCaretPeriod=2076(int periodMilliseconds,) + +# Set the set of characters making up words for when moving or selecting by word. +# First sets defaults like SetCharsDefault. +set void SetWordChars=2077(, string characters) + +# Get the set of characters making up words for when moving or selecting by word. +# Retuns the number of characters +get int GetWordChars=2646(, stringresult characters) + +# Start a sequence of actions that is undone and redone as a unit. +# May be nested. +fun void BeginUndoAction=2078(,) + +# End a sequence of actions that is undone and redone as a unit. +fun void EndUndoAction=2079(,) + +# Indicator style enumeration and some constants +enu IndicatorStyle=INDIC_ +val INDIC_PLAIN=0 +val INDIC_SQUIGGLE=1 +val INDIC_TT=2 +val INDIC_DIAGONAL=3 +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_SQUIGGLEPIXMAP=13 +val INDIC_COMPOSITIONTHICK=14 +val INDIC_COMPOSITIONTHIN=15 +val INDIC_FULLBOX=16 +val INDIC_TEXTFORE=17 +val INDIC_IME=32 +val INDIC_IME_MAX=35 +val INDIC_MAX=35 +val INDIC_CONTAINER=8 +val INDIC0_MASK=0x20 +val INDIC1_MASK=0x40 +val INDIC2_MASK=0x80 +val INDICS_MASK=0xE0 + +# Set an indicator to plain, squiggle or TT. +set void IndicSetStyle=2080(int indic, int style) + +# Retrieve the style of an indicator. +get int IndicGetStyle=2081(int indic,) + +# Set the foreground colour of an indicator. +set void IndicSetFore=2082(int indic, colour fore) + +# Retrieve the foreground colour of an indicator. +get colour IndicGetFore=2083(int indic,) + +# Set an indicator to draw under text or over(default). +set void IndicSetUnder=2510(int indic, bool under) + +# Retrieve whether indicator drawn under or over text. +get bool IndicGetUnder=2511(int indic,) + +# Set a hover indicator to plain, squiggle or TT. +set void IndicSetHoverStyle=2680(int indic, int style) + +# Retrieve the hover style of an indicator. +get int IndicGetHoverStyle=2681(int indic,) + +# Set the foreground hover colour of an indicator. +set void IndicSetHoverFore=2682(int indic, colour fore) + +# Retrieve the foreground hover colour of an indicator. +get colour IndicGetHoverFore=2683(int indic,) + +val SC_INDICVALUEBIT=0x1000000 +val SC_INDICVALUEMASK=0xFFFFFF + +enu IndicFlag=SC_INDICFLAG_ +val SC_INDICFLAG_VALUEFORE=1 + +# Set the attributes of an indicator. +set void IndicSetFlags=2684(int indic, int flags) + +# Retrieve the attributes of an indicator. +get int IndicGetFlags=2685(int indic,) + +# Set the foreground colour of all whitespace and whether to use this setting. +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. +set void SetStyleBits=2090(int bits,) + +# Retrieve number of bits in style bytes used to hold the lexical state. +get int GetStyleBits=2091(,) + +# Used to hold extra styling information for each line. +set void SetLineState=2092(int line, int state) + +# Retrieve the extra styling information for a line. +get int GetLineState=2093(int line,) + +# Retrieve the last line number that has line state. +get int GetMaxLineState=2094(,) + +# Is the background of the line containing the caret in a different colour? +get bool GetCaretLineVisible=2095(,) + +# Display the background of the line containing the caret in a different colour. +set void SetCaretLineVisible=2096(bool show,) + +# Get the colour of the background of the line containing the caret. +get colour GetCaretLineBack=2097(,) + +# Set the colour of the background of the line containing the caret. +set void SetCaretLineBack=2098(colour back,) + +# Set a style to be changeable or not (read only). +# Experimental feature, currently buggy. +set void StyleSetChangeable=2099(int style, bool changeable) + +# Display a auto-completion list. +# The lenEntered parameter indicates how many characters before +# the caret should be used to provide context. +fun void AutoCShow=2100(int lenEntered, string itemList) + +# Remove the auto-completion list from the screen. +fun void AutoCCancel=2101(,) + +# Is there an auto-completion list visible? +fun bool AutoCActive=2102(,) + +# Retrieve the position of the caret when the auto-completion list was displayed. +fun position AutoCPosStart=2103(,) + +# User has selected an item so remove the list and insert the selection. +fun void AutoCComplete=2104(,) + +# Define a set of character that when typed cancel the auto-completion list. +fun void AutoCStops=2105(, string characterSet) + +# Change the separator character in the string setting up an auto-completion list. +# Default is space but can be changed if items contain space. +set void AutoCSetSeparator=2106(int separatorCharacter,) + +# Retrieve the auto-completion list separator character. +get int AutoCGetSeparator=2107(,) + +# Select the item in the auto-completion list that starts with a string. +fun void AutoCSelect=2108(, string text) + +# Should the auto-completion list be cancelled if the user backspaces to a +# position before where the box was created. +set void AutoCSetCancelAtStart=2110(bool cancel,) + +# Retrieve whether auto-completion cancelled by backspacing before start. +get bool AutoCGetCancelAtStart=2111(,) + +# Define a set of characters that when typed will cause the autocompletion to +# choose the selected item. +set void AutoCSetFillUps=2112(, string characterSet) + +# Should a single item auto-completion list automatically choose the item. +set void AutoCSetChooseSingle=2113(bool chooseSingle,) + +# Retrieve whether a single item auto-completion list automatically choose the item. +get bool AutoCGetChooseSingle=2114(,) + +# Set whether case is significant when performing auto-completion searches. +set void AutoCSetIgnoreCase=2115(bool ignoreCase,) + +# Retrieve state of ignore case flag. +get bool AutoCGetIgnoreCase=2116(,) + +# Display a list of strings and send notification when user chooses one. +fun void UserListShow=2117(int listType, string itemList) + +# Set whether or not autocompletion is hidden automatically when nothing matches. +set void AutoCSetAutoHide=2118(bool autoHide,) + +# Retrieve whether or not autocompletion is hidden automatically when nothing matches. +get bool AutoCGetAutoHide=2119(,) + +# Set whether or not autocompletion deletes any word characters +# after the inserted text upon completion. +set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,) + +# Retrieve whether or not autocompletion deletes any word characters +# after the inserted text upon completion. +get bool AutoCGetDropRestOfWord=2271(,) + +# Register an XPM image for use in autocompletion lists. +fun void RegisterImage=2405(int type, string xpmData) + +# Clear all the registered XPM images. +fun void ClearRegisteredImages=2408(,) + +# Retrieve the auto-completion list type-separator character. +get int AutoCGetTypeSeparator=2285(,) + +# Change the type-separator character in the string setting up an auto-completion list. +# Default is '?' but can be changed if items contain '?'. +set void AutoCSetTypeSeparator=2286(int separatorCharacter,) + +# Set the maximum width, in characters, of auto-completion and user lists. +# Set to 0 to autosize to fit longest item, which is the default. +set void AutoCSetMaxWidth=2208(int characterCount,) + +# Get the maximum width, in characters, of auto-completion and user lists. +get int AutoCGetMaxWidth=2209(,) + +# Set the maximum height, in rows, of auto-completion and user lists. +# The default is 5 rows. +set void AutoCSetMaxHeight=2210(int rowCount,) + +# Set the maximum height, in rows, of auto-completion and user lists. +get int AutoCGetMaxHeight=2211(,) + +# Set the number of spaces used for one level of indentation. +set void SetIndent=2122(int indentSize,) + +# Retrieve indentation size. +get int GetIndent=2123(,) + +# Indentation will only use space characters if useTabs is false, otherwise +# it will use a combination of tabs and spaces. +set void SetUseTabs=2124(bool useTabs,) + +# Retrieve whether tabs will be used in indentation. +get bool GetUseTabs=2125(,) + +# Change the indentation of a line to a number of columns. +set void SetLineIndentation=2126(int line, int indentSize) + +# Retrieve the number of columns that a line is indented. +get int GetLineIndentation=2127(int line,) + +# Retrieve the position before the first non indentation character on a line. +get position GetLineIndentPosition=2128(int line,) + +# Retrieve the column number of a position, taking tab width into account. +get int GetColumn=2129(position pos,) + +# Count characters between two positions. +fun int CountCharacters=2633(int startPos, int endPos) + +# Show or hide the horizontal scroll bar. +set void SetHScrollBar=2130(bool show,) +# Is the horizontal scroll bar visible? +get bool GetHScrollBar=2131(,) + +enu IndentView=SC_IV_ +val SC_IV_NONE=0 +val SC_IV_REAL=1 +val SC_IV_LOOKFORWARD=2 +val SC_IV_LOOKBOTH=3 + +# Show or hide indentation guides. +set void SetIndentationGuides=2132(int indentView,) + +# Are the indentation guides visible? +get int GetIndentationGuides=2133(,) + +# Set the highlighted indentation guide column. +# 0 = no highlighted guide. +set void SetHighlightGuide=2134(int column,) + +# Get the highlighted indentation guide column. +get int GetHighlightGuide=2135(,) + +# Get the position after the last visible characters on a line. +get position GetLineEndPosition=2136(int line,) + +# Get the code page used to interpret the bytes of the document as characters. +get int GetCodePage=2137(,) + +# Get the foreground colour of the caret. +get colour GetCaretFore=2138(,) + +# In read-only mode? +get bool GetReadOnly=2140(,) + +# Sets the position of the caret. +set void SetCurrentPos=2141(position pos,) + +# Sets the position that starts the selection - this becomes the anchor. +set void SetSelectionStart=2142(position pos,) + +# Returns the position at the start of the selection. +get position GetSelectionStart=2143(,) + +# Sets the position that ends the selection - this becomes the currentPosition. +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,) + +# Returns the print magnification. +get int GetPrintMagnification=2147(,) + +enu PrintOption=SC_PRINT_ +# PrintColourMode - use same colours as screen. +val SC_PRINT_NORMAL=0 +# PrintColourMode - invert the light value of each style for printing. +val SC_PRINT_INVERTLIGHT=1 +# PrintColourMode - force black text on white background for printing. +val SC_PRINT_BLACKONWHITE=2 +# PrintColourMode - text stays coloured, but all background is forced to be white for printing. +val SC_PRINT_COLOURONWHITE=3 +# PrintColourMode - only the default-background is forced to be white for printing. +val SC_PRINT_COLOURONWHITEDEFAULTBG=4 + +# Modify colours when printing for clearer printed text. +set void SetPrintColourMode=2148(int mode,) + +# Returns the print colour mode. +get int GetPrintColourMode=2149(,) + +enu FindOption=SCFIND_ +val SCFIND_WHOLEWORD=0x2 +val SCFIND_MATCHCASE=0x4 +val SCFIND_WORDSTART=0x00100000 +val SCFIND_REGEXP=0x00200000 +val SCFIND_POSIX=0x00400000 +val SCFIND_CXX11REGEX=0x00800000 + +# Find some text in the document. +fun position FindText=2150(int flags, findtext ft) + +# On Windows, will draw the document into a display context such as a printer. +fun position FormatRange=2151(bool draw, formatrange fr) + +# Retrieve the display line at the top of the display. +get int GetFirstVisibleLine=2152(,) + +# Retrieve the contents of a line. +# Returns the length of the line. +fun int GetLine=2153(int line, stringresult text) + +# Returns the number of lines in the document. There is always at least one. +get int GetLineCount=2154(,) + +# Sets the size in pixels of the left margin. +set void SetMarginLeft=2155(, int pixelWidth) + +# Returns the size in pixels of the left margin. +get int GetMarginLeft=2156(,) + +# Sets the size in pixels of the right margin. +set void SetMarginRight=2157(, int pixelWidth) + +# Returns the size in pixels of the right margin. +get int GetMarginRight=2158(,) + +# Is the document different from when it was last saved? +get bool GetModify=2159(,) + +# Select a range of text. +fun void SetSel=2160(position start, position end) + +# Retrieve the selected text. +# Return the length of the text. +fun int GetSelText=2161(, stringresult text) + +# Retrieve a range of text. +# Return the length of the text. +fun int GetTextRange=2162(, textrange tr) + +# Draw the selection in normal style or with selection highlighted. +fun void HideSelection=2163(bool normal,) + +# Retrieve the x value of the point in the window where a position is displayed. +fun int PointXFromPosition=2164(, position pos) + +# Retrieve the y value of the point in the window where a position is displayed. +fun int PointYFromPosition=2165(, position pos) + +# Retrieve the line containing a position. +fun int LineFromPosition=2166(position pos,) + +# Retrieve the position at the start of a line. +fun position PositionFromLine=2167(int line,) + +# Scroll horizontally and vertically. +fun void LineScroll=2168(int columns, int lines) + +# Ensure the caret is visible. +fun void ScrollCaret=2169(,) + +# Scroll the argument positions and the range between them into view giving +# priority to the primary position then the secondary position. +# This may be used to make a search match visible. +fun void ScrollRange=2569(position secondary, position primary) + +# Replace the selected text with the argument text. +fun void ReplaceSel=2170(, string text) + +# Set to read only or read write. +set void SetReadOnly=2171(bool readOnly,) + +# Null operation. +fun void Null=2172(,) + +# Will a paste succeed? +fun bool CanPaste=2173(,) + +# Are there any undoable actions in the undo history? +fun bool CanUndo=2174(,) + +# Delete the undo history. +fun void EmptyUndoBuffer=2175(,) + +# Undo one action in the undo history. +fun void Undo=2176(,) + +# Cut the selection to the clipboard. +fun void Cut=2177(,) + +# Copy the selection to the clipboard. +fun void Copy=2178(,) + +# Paste the contents of the clipboard into the document replacing the selection. +fun void Paste=2179(,) + +# Clear the selection. +fun void Clear=2180(,) + +# Replace the contents of the document with the argument text. +fun void SetText=2181(, string text) + +# Retrieve all the text in the document. +# Returns number of characters retrieved. +fun int GetText=2182(int length, stringresult text) + +# Retrieve the number of characters in the document. +get int GetTextLength=2183(,) + +# Retrieve a pointer to a function that processes messages for this Scintilla. +get int GetDirectFunction=2184(,) + +# Retrieve a pointer value to use as the first argument when calling +# the function returned by GetDirectFunction. +get int GetDirectPointer=2185(,) + +# Set to overtype (true) or insert mode. +set void SetOvertype=2186(bool overtype,) + +# Returns true if overtype mode is active otherwise false is returned. +get bool GetOvertype=2187(,) + +# Set the width of the insert mode caret. +set void SetCaretWidth=2188(int pixelWidth,) + +# Returns the width of the insert mode caret. +get int GetCaretWidth=2189(,) + +# Sets the position that starts the target which is used for updating the +# document without affecting the scroll position. +set void SetTargetStart=2190(position pos,) + +# Get the position that starts the target. +get position GetTargetStart=2191(,) + +# Sets the position that ends the target which is used for updating the +# document without affecting the scroll position. +set void SetTargetEnd=2192(position pos,) + +# Get the position that ends the target. +get position GetTargetEnd=2193(,) + +# Sets both the start and end of the target in one call. +fun void SetTargetRange=2686(position start, position end) + +# Retrieve the text in the target. +get int GetTargetText=2687(, stringresult characters) + +# Replace the target text with the argument text. +# Text is counted so it can contain NULs. +# Returns the length of the replacement text. +fun int ReplaceTarget=2194(int length, string text) + +# Replace the target text with the argument text after \d processing. +# Text is counted so it can contain NULs. +# Looks for \d where d is between 1 and 9 and replaces these with the strings +# matched in the last search operation which were surrounded by \( and \). +# Returns the length of the replacement text including any change +# caused by processing the \d patterns. +fun int ReplaceTargetRE=2195(int length, string text) + +# Search for a counted string in the target and set the target to the found +# range. Text is counted so it can contain NULs. +# Returns length of range or -1 for failure in which case target is not moved. +fun int SearchInTarget=2197(int length, string text) + +# Set the search flags used by SearchInTarget. +set void SetSearchFlags=2198(int flags,) + +# Get the search flags used by SearchInTarget. +get int GetSearchFlags=2199(,) + +# Show a call tip containing a definition near position pos. +fun void CallTipShow=2200(position pos, string definition) + +# Remove the call tip from the screen. +fun void CallTipCancel=2201(,) + +# Is there an active call tip? +fun bool CallTipActive=2202(,) + +# Retrieve the position where the caret was before displaying the call tip. +fun position CallTipPosStart=2203(,) + +# Set the start position in order to change when backspacing removes the calltip. +set void CallTipSetPosStart=2214(int posStart,) + +# Highlight a segment of the definition. +fun void CallTipSetHlt=2204(int start, int end) + +# Set the background colour for the call tip. +set void CallTipSetBack=2205(colour back,) + +# Set the foreground colour for the call tip. +set void CallTipSetFore=2206(colour fore,) + +# Set the foreground colour for the highlighted part of the call tip. +set void CallTipSetForeHlt=2207(colour fore,) + +# Enable use of STYLE_CALLTIP and set call tip tab size in pixels. +set void CallTipUseStyle=2212(int tabSize,) + +# Set position of calltip, above or below text. +set void CallTipSetPosition=2213(bool above,) + +# Find the display line of a document line taking hidden lines into account. +fun int VisibleFromDocLine=2220(int line,) + +# Find the document line of a display line taking hidden lines into account. +fun int DocLineFromVisible=2221(int lineDisplay,) + +# The number of display lines needed to wrap a document line +fun int WrapCount=2235(int line,) + +enu FoldLevel=SC_FOLDLEVEL +val SC_FOLDLEVELBASE=0x400 +val SC_FOLDLEVELWHITEFLAG=0x1000 +val SC_FOLDLEVELHEADERFLAG=0x2000 +val SC_FOLDLEVELNUMBERMASK=0x0FFF + +# Set the fold level of a line. +# This encodes an integer level along with flags indicating whether the +# line is a header and whether it is effectively white space. +set void SetFoldLevel=2222(int line, int level) + +# Retrieve the fold level of a line. +get int GetFoldLevel=2223(int line,) + +# Find the last child line of a header line. +get int GetLastChild=2224(int line, int level) + +# Find the parent line of a child line. +get int GetFoldParent=2225(int line,) + +# Make a range of lines visible. +fun void ShowLines=2226(int lineStart, int lineEnd) + +# Make a range of lines invisible. +fun void HideLines=2227(int lineStart, int lineEnd) + +# Is a line visible? +get bool GetLineVisible=2228(int line,) + +# Are all lines visible? +get bool GetAllLinesVisible=2236(,) + +# Show the children of a header line. +set void SetFoldExpanded=2229(int line, bool expanded) + +# Is a header line expanded? +get bool GetFoldExpanded=2230(int line,) + +# Switch a header line between expanded and contracted. +fun void ToggleFold=2231(int line,) + +enu FoldAction=SC_FOLDACTION +val SC_FOLDACTION_CONTRACT=0 +val SC_FOLDACTION_EXPAND=1 +val SC_FOLDACTION_TOGGLE=2 + +# Expand or contract a fold header. +fun void FoldLine=2237(int line, int action) + +# Expand or contract a fold header and its children. +fun void FoldChildren=2238(int line, int action) + +# Expand a fold header and all children. Use the level argument instead of the line's current level. +fun void ExpandChildren=2239(int line, int level) + +# Expand or contract all fold headers. +fun void FoldAll=2662(int action,) + +# Ensure a particular line is visible by expanding any header line hiding it. +fun void EnsureVisible=2232(int line,) + +enu AutomaticFold=SC_AUTOMATICFOLD_ +val SC_AUTOMATICFOLD_SHOW=0x0001 +val SC_AUTOMATICFOLD_CLICK=0x0002 +val SC_AUTOMATICFOLD_CHANGE=0x0004 + +# Set automatic folding behaviours. +set void SetAutomaticFold=2663(int automaticFold,) + +# Get automatic folding behaviours. +get int GetAutomaticFold=2664(,) + +enu FoldFlag=SC_FOLDFLAG_ +val SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002 +val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004 +val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 +val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 +val SC_FOLDFLAG_LEVELNUMBERS=0x0040 +val SC_FOLDFLAG_LINESTATE=0x0080 + +# Set some style options for folding. +set void SetFoldFlags=2233(int flags,) + +# Ensure a particular line is visible by expanding any header line hiding it. +# Use the currently set visibility policy to determine which range to display. +fun void EnsureVisibleEnforcePolicy=2234(int line,) + +# Sets whether a tab pressed when caret is within indentation indents. +set void SetTabIndents=2260(bool tabIndents,) + +# Does a tab pressed when caret is within indentation indent? +get bool GetTabIndents=2261(,) + +# Sets whether a backspace pressed when caret is within indentation unindents. +set void SetBackSpaceUnIndents=2262(bool bsUnIndents,) + +# Does a backspace pressed when caret is within indentation unindent? +get bool GetBackSpaceUnIndents=2263(,) + +val SC_TIME_FOREVER=10000000 + +# Sets the time the mouse must sit still to generate a mouse dwell event. +set void SetMouseDwellTime=2264(int periodMilliseconds,) + +# Retrieve the time the mouse must sit still to generate a mouse dwell event. +get int GetMouseDwellTime=2265(,) + +# Get position of start of word. +fun int WordStartPosition=2266(position pos, bool onlyWordCharacters) + +# Get position of end of word. +fun int WordEndPosition=2267(position pos, bool onlyWordCharacters) + +enu Wrap=SC_WRAP_ +val SC_WRAP_NONE=0 +val SC_WRAP_WORD=1 +val SC_WRAP_CHAR=2 +val SC_WRAP_WHITESPACE=3 + +# Sets whether text is word wrapped. +set void SetWrapMode=2268(int mode,) + +# Retrieve whether text is word wrapped. +get int GetWrapMode=2269(,) + +enu WrapVisualFlag=SC_WRAPVISUALFLAG_ +val SC_WRAPVISUALFLAG_NONE=0x0000 +val SC_WRAPVISUALFLAG_END=0x0001 +val SC_WRAPVISUALFLAG_START=0x0002 +val SC_WRAPVISUALFLAG_MARGIN=0x0004 + +# Set the display mode of visual flags for wrapped lines. +set void SetWrapVisualFlags=2460(int wrapVisualFlags,) + +# Retrive the display mode of visual flags for wrapped lines. +get int GetWrapVisualFlags=2461(,) + +enu WrapVisualLocation=SC_WRAPVISUALFLAGLOC_ +val SC_WRAPVISUALFLAGLOC_DEFAULT=0x0000 +val SC_WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001 +val SC_WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002 + +# Set the location of visual flags for wrapped lines. +set void SetWrapVisualFlagsLocation=2462(int wrapVisualFlagsLocation,) + +# Retrive the location of visual flags for wrapped lines. +get int GetWrapVisualFlagsLocation=2463(,) + +# Set the start indent for wrapped lines. +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 +val SC_CACHE_PAGE=2 +val SC_CACHE_DOCUMENT=3 + +# Sets the degree of caching of layout information. +set void SetLayoutCache=2272(int mode,) + +# Retrieve the degree of caching of layout information. +get int GetLayoutCache=2273(,) + +# Sets the document width assumed for scrolling. +set void SetScrollWidth=2274(int pixelWidth,) + +# Retrieve the document width assumed for scrolling. +get int GetScrollWidth=2275(,) + +# Sets whether the maximum width line displayed is used to set scroll width. +set void SetScrollWidthTracking=2516(bool tracking,) + +# Retrieve whether the scroll width tracks wide lines. +get bool GetScrollWidthTracking=2517(,) + +# Measure the pixel width of some text in a particular style. +# NUL terminated text argument. +# Does not handle tab or control characters. +fun int TextWidth=2276(int style, string text) + +# Sets the scroll range so that maximum scroll position has +# the last line at the bottom of the view (default). +# Setting this to false allows scrolling one page below the last line. +set void SetEndAtLastLine=2277(bool endAtLastLine,) + +# Retrieve whether the maximum scroll position has the last +# line at the bottom of the view. +get bool GetEndAtLastLine=2278(,) + +# Retrieve the height of a particular line of text in pixels. +fun int TextHeight=2279(int line,) + +# Show or hide the vertical scroll bar. +set void SetVScrollBar=2280(bool show,) + +# Is the vertical scroll bar visible? +get bool GetVScrollBar=2281(,) + +# Append a string to the end of the document without changing the selection. +fun void AppendText=2282(int length, string text) + +# Is drawing done in two phases with backgrounds drawn before foregrounds? +get bool GetTwoPhaseDraw=2283(,) + +# In twoPhaseDraw mode, drawing is performed in two phases, first the background +# and then the foreground. This avoids chopping off characters that overlap the next run. +set void SetTwoPhaseDraw=2284(bool twoPhase,) + +enu FontQuality=SC_PHASES_ +val SC_PHASES_ONE=0 +val SC_PHASES_TWO=1 +val SC_PHASES_MULTIPLE=2 + +# How many phases is drawing done in? +get int GetPhasesDraw=2673(,) + +# In one phase draw, text is drawn in a series of rectangular blocks with no overlap. +# In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally. +# In multiple phase draw, each element is drawn over the whole drawing area, allowing text +# to overlap from one line to the next. +set void SetPhasesDraw=2674(int phases,) + +# 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. +get 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(,) + +# Join the lines in the target. +fun void LinesJoin=2288(,) + +# Split the lines in the target into lines that are less wide than pixelWidth +# where possible. +fun void LinesSplit=2289(int pixelWidth,) + +# Set the colours used as a chequerboard pattern in the fold margin +fun void SetFoldMarginColour=2290(bool useSetting, colour back) +fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore) + +## New messages go here + +## Start of key messages +# Move caret down one line. +fun void LineDown=2300(,) + +# Move caret down one line extending selection to new caret position. +fun void LineDownExtend=2301(,) + +# Move caret up one line. +fun void LineUp=2302(,) + +# Move caret up one line extending selection to new caret position. +fun void LineUpExtend=2303(,) + +# Move caret left one character. +fun void CharLeft=2304(,) + +# Move caret left one character extending selection to new caret position. +fun void CharLeftExtend=2305(,) + +# Move caret right one character. +fun void CharRight=2306(,) + +# Move caret right one character extending selection to new caret position. +fun void CharRightExtend=2307(,) + +# Move caret left one word. +fun void WordLeft=2308(,) + +# Move caret left one word extending selection to new caret position. +fun void WordLeftExtend=2309(,) + +# Move caret right one word. +fun void WordRight=2310(,) + +# Move caret right one word extending selection to new caret position. +fun void WordRightExtend=2311(,) + +# Move caret to first position on line. +fun void Home=2312(,) + +# Move caret to first position on line extending selection to new caret position. +fun void HomeExtend=2313(,) + +# Move caret to last position on line. +fun void LineEnd=2314(,) + +# Move caret to last position on line extending selection to new caret position. +fun void LineEndExtend=2315(,) + +# Move caret to first position in document. +fun void DocumentStart=2316(,) + +# Move caret to first position in document extending selection to new caret position. +fun void DocumentStartExtend=2317(,) + +# Move caret to last position in document. +fun void DocumentEnd=2318(,) + +# Move caret to last position in document extending selection to new caret position. +fun void DocumentEndExtend=2319(,) + +# Move caret one page up. +fun void PageUp=2320(,) + +# Move caret one page up extending selection to new caret position. +fun void PageUpExtend=2321(,) + +# Move caret one page down. +fun void PageDown=2322(,) + +# Move caret one page down extending selection to new caret position. +fun void PageDownExtend=2323(,) + +# Switch from insert to overtype mode or the reverse. +fun void EditToggleOvertype=2324(,) + +# Cancel any modes such as call tip or auto-completion list display. +fun void Cancel=2325(,) + +# Delete the selection or if no selection, the character before the caret. +fun void DeleteBack=2326(,) + +# If selection is empty or all on one line replace the selection with a tab character. +# If more than one line selected, indent the lines. +fun void Tab=2327(,) + +# Dedent the selected lines. +fun void BackTab=2328(,) + +# Insert a new line, may use a CRLF, CR or LF depending on EOL mode. +fun void NewLine=2329(,) + +# Insert a Form Feed character. +fun void FormFeed=2330(,) + +# Move caret to before first visible character on line. +# If already there move to first character on line. +fun void VCHome=2331(,) + +# Like VCHome but extending selection to new caret position. +fun void VCHomeExtend=2332(,) + +# Magnify the displayed text by increasing the sizes by 1 point. +fun void ZoomIn=2333(,) + +# Make the displayed text smaller by decreasing the sizes by 1 point. +fun void ZoomOut=2334(,) + +# Delete the word to the left of the caret. +fun void DelWordLeft=2335(,) + +# Delete the word to the right of the caret. +fun void DelWordRight=2336(,) + +# Delete the word to the right of the caret, but not the trailing non-word characters. +fun void DelWordRightEnd=2518(,) + +# Cut the line containing the caret. +fun void LineCut=2337(,) + +# Delete the line containing the caret. +fun void LineDelete=2338(,) + +# Switch the current line with the previous. +fun void LineTranspose=2339(,) + +# Duplicate the current line. +fun void LineDuplicate=2404(,) + +# Transform the selection to lower case. +fun void LowerCase=2340(,) + +# Transform the selection to upper case. +fun void UpperCase=2341(,) + +# Scroll the document down, keeping the caret visible. +fun void LineScrollDown=2342(,) + +# Scroll the document up, keeping the caret visible. +fun void LineScrollUp=2343(,) + +# Delete the selection or if no selection, the character before the caret. +# Will not delete the character before at the start of a line. +fun void DeleteBackNotLine=2344(,) + +# Move caret to first position on display line. +fun void HomeDisplay=2345(,) + +# Move caret to first position on display line extending selection to +# new caret position. +fun void HomeDisplayExtend=2346(,) + +# Move caret to last position on display line. +fun void LineEndDisplay=2347(,) + +# Move caret to last position on display line extending selection to new +# caret position. +fun void LineEndDisplayExtend=2348(,) + +# These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? +# except they behave differently when word-wrap is enabled: +# They go first to the start / end of the display line, like (Home|LineEnd)Display +# The difference is that, the cursor is already at the point, it goes on to the start +# or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + +fun void HomeWrap=2349(,) +fun void HomeWrapExtend=2450(,) +fun void LineEndWrap=2451(,) +fun void LineEndWrapExtend=2452(,) +fun void VCHomeWrap=2453(,) +fun void VCHomeWrapExtend=2454(,) + +# Copy the line containing the caret. +fun void LineCopy=2455(,) + +# Move the caret inside current view if it's not there already. +fun void MoveCaretInsideView=2401(,) + +# How many characters are on a line, including end of line characters? +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,) + +# Are the end of line characters visible? +get bool GetViewEOL=2355(,) + +# Make the end of line characters visible or invisible. +set void SetViewEOL=2356(bool visible,) + +# Retrieve a pointer to the document object. +get int GetDocPointer=2357(,) + +# Change the document object used. +set void SetDocPointer=2358(, int pointer) + +# Set which document modification events are sent to the container. +set void SetModEventMask=2359(int mask,) + +enu EdgeVisualStyle=EDGE_ +val EDGE_NONE=0 +val EDGE_LINE=1 +val EDGE_BACKGROUND=2 + +# Retrieve the column number which text should be kept within. +get int GetEdgeColumn=2360(,) + +# Set the column number of the edge. +# If text goes past the edge then it is highlighted. +set void SetEdgeColumn=2361(int column,) + +# Retrieve the edge highlight mode. +get int GetEdgeMode=2362(,) + +# The edge may be displayed by a line (EDGE_LINE) or by highlighting text that +# goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). +set void SetEdgeMode=2363(int mode,) + +# Retrieve the colour used in edge indication. +get colour GetEdgeColour=2364(,) + +# Change the colour used in edge indication. +set void SetEdgeColour=2365(colour edgeColour,) + +# Sets the current caret position to be the search anchor. +fun void SearchAnchor=2366(,) + +# Find some text starting at the search anchor. +# Does not ensure the selection is visible. +fun int SearchNext=2367(int flags, string text) + +# Find some text starting at the search anchor and moving backwards. +# Does not ensure the selection is visible. +fun int SearchPrev=2368(int flags, string text) + +# Retrieves the number of lines completely visible. +get int LinesOnScreen=2370(,) + +# Set whether a pop up menu is displayed automatically when the user presses +# the wrong mouse button. +fun void UsePopUp=2371(bool allowPopUp,) + +# Is the selection rectangular? The alternative is the more common stream selection. +get bool SelectionIsRectangle=2372(,) + +# Set the zoom level. This number of points is added to the size of all fonts. +# It may be positive to magnify or negative to reduce. +set void SetZoom=2373(int zoom,) +# Retrieve the zoom level. +get int GetZoom=2374(,) + +# Create a new document object. +# Starts with reference count of 1 and not selected into editor. +fun int CreateDocument=2375(,) +# Extend life of document. +fun void AddRefDocument=2376(, int doc) +# Release a reference to the document, deleting document if it fades to black. +fun void ReleaseDocument=2377(, int doc) + +# Get which document modification events are sent to the container. +get int GetModEventMask=2378(,) + +# Change internal focus flag. +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 +val SC_STATUS_WARN_START=1000 +val SC_STATUS_WARN_REGEX=1001 + +# Change error status - 0 = OK. +set void SetStatus=2382(int statusCode,) +# Get error status. +get int GetStatus=2383(,) + +# Set whether the mouse is captured when its button is pressed. +set void SetMouseDownCaptures=2384(bool captures,) +# Get whether mouse gets captured. +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. +get int GetCursor=2387(,) + +# Change the way control characters are displayed: +# If symbol is < 32, keep the drawn way, else, use the given character. +set void SetControlCharSymbol=2388(int symbol,) +# Get the way control characters are displayed. +get int GetControlCharSymbol=2389(,) + +# Move to the previous change in capitalisation. +fun void WordPartLeft=2390(,) +# Move to the previous change in capitalisation extending selection +# to new caret position. +fun void WordPartLeftExtend=2391(,) +# Move to the change next in capitalisation. +fun void WordPartRight=2392(,) +# Move to the next change in capitalisation extending selection +# to new caret position. +fun void WordPartRightExtend=2393(,) + +# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. +val VISIBLE_SLOP=0x01 +val VISIBLE_STRICT=0x04 +# Set the way the display area is determined when a particular line +# is to be moved to by Find, FindNext, GotoLine, etc. +fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop) + +# Delete back from the current position to the start of the line. +fun void DelLineLeft=2395(,) + +# Delete forwards from the current position to the end of the line. +fun void DelLineRight=2396(,) + +# Get and Set the xOffset (ie, horizontal scroll position). +set void SetXOffset=2397(int newOffset,) +get int GetXOffset=2398(,) + +# Set the last x chosen value to be the caret x position. +fun void ChooseCaretX=2399(,) + +# Set the focus to this Scintilla widget. +fun void GrabFocus=2400(,) + +enu CaretPolicy=CARET_ +# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy. +# If CARET_SLOP is set, we can define a slop value: caretSlop. +# This value defines an unwanted zone (UZ) where the caret is... unwanted. +# This zone is defined as a number of pixels near the vertical margins, +# and as a number of lines near the horizontal margins. +# By keeping the caret away from the edges, it is seen within its context, +# so it is likely that the identifier that the caret is on can be completely seen, +# and that the current line is seen with some of the lines following it which are +# often dependent on that line. +val CARET_SLOP=0x01 +# If CARET_STRICT is set, the policy is enforced... strictly. +# The caret is centred on the display if slop is not set, +# and cannot go in the UZ if slop is set. +val CARET_STRICT=0x04 +# If CARET_JUMPS is set, the display is moved more energetically +# so the caret can move in the same direction longer before the policy is applied again. +val CARET_JUMPS=0x10 +# If CARET_EVEN is not set, instead of having symmetrical UZs, +# the left and bottom UZs are extended up to right and top UZs respectively. +# This way, we favour the displaying of useful information: the begining of lines, +# where most code reside, and the lines after the caret, eg. the body of a function. +val CARET_EVEN=0x08 + +# Set the way the caret is kept visible when going sideways. +# The exclusion zone is given in pixels. +fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop) + +# Set the way the line the caret is on is kept visible. +# The exclusion zone is given in lines. +fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop) + +# Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). +set void SetPrintWrapMode=2406(int mode,) + +# Is printing line wrapped? +get int GetPrintWrapMode=2407(,) + +# Set a fore colour for active hotspots. +set void SetHotspotActiveFore=2410(bool useSetting, colour fore) + +# Get the fore colour for active hotspots. +get colour GetHotspotActiveFore=2494(,) + +# Set a back colour for active hotspots. +set void SetHotspotActiveBack=2411(bool useSetting, colour back) + +# Get the back colour for active hotspots. +get colour GetHotspotActiveBack=2495(,) + +# Enable / Disable underlining active hotspots. +set void SetHotspotActiveUnderline=2412(bool underline,) + +# Get whether underlining for active hotspots. +get bool GetHotspotActiveUnderline=2496(,) + +# Limit hotspots to single line so hotspots on two lines don't merge. +set void SetHotspotSingleLine=2421(bool singleLine,) + +# Get the HotspotSingleLine property +get bool GetHotspotSingleLine=2497(,) + +# Move caret between paragraphs (delimited by empty lines). +fun void ParaDown=2413(,) +fun void ParaDownExtend=2414(,) +fun void ParaUp=2415(,) +fun void ParaUpExtend=2416(,) + +# Given a valid document position, return the previous position taking code +# page into account. Returns 0 if passed 0. +fun position PositionBefore=2417(position pos,) + +# Given a valid document position, return the next position taking code +# page into account. Maximum value returned is the last position in the document. +fun position PositionAfter=2418(position pos,) + +# Given a valid document position, return a position that differs in a number +# of characters. Returned value is always between 0 and last position in document. +fun position PositionRelative=2670(position pos, int relative) + +# Copy a range of text to the clipboard. Positions are clipped into the document. +fun void CopyRange=2419(position start, position end) + +# Copy argument text to the clipboard. +fun void CopyText=2420(int length, string text) + +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/SC_SEL_THIN) or +# by lines (SC_SEL_LINES). +set void SetSelectionMode=2422(int mode,) + +# Get the mode of the current selection. +get int GetSelectionMode=2423(,) + +# Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). +fun position GetLineSelStartPosition=2424(int line,) + +# Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). +fun position GetLineSelEndPosition=2425(int line,) + +## RectExtended rectangular selection moves +# Move caret down one line, extending rectangular selection to new caret position. +fun void LineDownRectExtend=2426(,) + +# Move caret up one line, extending rectangular selection to new caret position. +fun void LineUpRectExtend=2427(,) + +# Move caret left one character, extending rectangular selection to new caret position. +fun void CharLeftRectExtend=2428(,) + +# Move caret right one character, extending rectangular selection to new caret position. +fun void CharRightRectExtend=2429(,) + +# Move caret to first position on line, extending rectangular selection to new caret position. +fun void HomeRectExtend=2430(,) + +# Move caret to before first visible character on line. +# If already there move to first character on line. +# In either case, extend rectangular selection to new caret position. +fun void VCHomeRectExtend=2431(,) + +# Move caret to last position on line, extending rectangular selection to new caret position. +fun void LineEndRectExtend=2432(,) + +# Move caret one page up, extending rectangular selection to new caret position. +fun void PageUpRectExtend=2433(,) + +# Move caret one page down, extending rectangular selection to new caret position. +fun void PageDownRectExtend=2434(,) + + +# Move caret to top of page, or one page up if already at top of page. +fun void StutteredPageUp=2435(,) + +# Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. +fun void StutteredPageUpExtend=2436(,) + +# Move caret to bottom of page, or one page down if already at bottom of page. +fun void StutteredPageDown=2437(,) + +# Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. +fun void StutteredPageDownExtend=2438(,) + + +# Move caret left one word, position cursor at end of word. +fun void WordLeftEnd=2439(,) + +# Move caret left one word, position cursor at end of word, extending selection to new caret position. +fun void WordLeftEndExtend=2440(,) + +# Move caret right one word, position cursor at end of word. +fun void WordRightEnd=2441(,) + +# Move caret right one word, position cursor at end of word, extending selection to new caret position. +fun void WordRightEndExtend=2442(,) + +# Set the set of characters making up whitespace for when moving or selecting by word. +# Should be called after SetWordChars. +set void SetWhitespaceChars=2443(, string characters) + +# Get the set of characters making up whitespace for when moving or selecting by word. +get int GetWhitespaceChars=2647(, stringresult characters) + +# Set the set of characters making up punctuation characters +# Should be called after SetWordChars. +set void SetPunctuationChars=2648(, string characters) + +# Get the set of characters making up punctuation characters +get int GetPunctuationChars=2649(, stringresult characters) + +# Reset the set of characters for whitespace and word characters to the defaults. +fun void SetCharsDefault=2444(,) + +# Get currently selected item position in the auto-completion list +get int AutoCGetCurrent=2445(,) + +# Get currently selected item text in the auto-completion list +# Returns the length of the item text +get int AutoCGetCurrentText=2610(, stringresult s) + +enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_ +val SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE=0 +val SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE=1 + +# Set auto-completion case insensitive behaviour to either prefer case-sensitive matches or have no preference. +set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,) + +# Get auto-completion case insensitive behaviour. +get int AutoCGetCaseInsensitiveBehaviour=2635(,) + +enu MultiAutoComplete=SC_MULTIAUTOC_ +val SC_MULTIAUTOC_ONCE=0 +val SC_MULTIAUTOC_EACH=1 + +# Change the effect of autocompleting when there are multiple selections. +set void AutoCSetMulti=2636(int multi,) + +# Retrieve the effect of autocompleting when there are multiple selections.. +get int AutoCGetMulti=2637(,) + +enu Ordering=SC_ORDER_ +val SC_ORDER_PRESORTED=0 +val SC_ORDER_PERFORMSORT=1 +val SC_ORDER_CUSTOM=2 + +# Set the way autocompletion lists are ordered. +set void AutoCSetOrder=2660(int order,) + +# Get the way autocompletion lists are ordered. +get int AutoCGetOrder=2661(,) + +# Enlarge the document to a particular size of text bytes. +fun void Allocate=2446(int bytes,) + +# Returns the target converted to UTF8. +# Return the length in bytes. +fun int TargetAsUTF8=2447(, stringresult s) + +# Set the length of the utf8 argument for calling EncodedFromUTF8. +# Set to -1 and the string will be measured to the first nul. +fun void SetLengthForEncode=2448(int bytes,) + +# Translates a UTF8 string into the document encoding. +# Return the length of the result in bytes. +# On error return 0. +fun int EncodedFromUTF8=2449(string utf8, stringresult encoded) + +# Find the position of a column on a line taking into account tabs and +# multi-byte characters. If beyond end of line, return line end position. +fun int FindColumn=2456(int line, int column) + +# Can the caret preferred x position only be changed by explicit movement commands? +get int GetCaretSticky=2457(,) + +# Stop the caret preferred x position changing when the user types. +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(,) + +# Enable/Disable convert-on-paste for line endings +set void SetPasteConvertEndings=2467(bool convert,) + +# Get convert-on-paste setting +get bool GetPasteConvertEndings=2468(,) + +# Duplicate the selection. If selection empty duplicate the line containing the caret. +fun void SelectionDuplicate=2469(,) + +val SC_ALPHA_TRANSPARENT=0 +val SC_ALPHA_OPAQUE=255 +val SC_ALPHA_NOALPHA=256 + +# Set background alpha of the caret line. +set void SetCaretLineBackAlpha=2470(int alpha,) + +# Get the background alpha of the caret line. +get int GetCaretLineBackAlpha=2471(,) + +enu CaretStyle=CARETSTYLE_ +val CARETSTYLE_INVISIBLE=0 +val CARETSTYLE_LINE=1 +val CARETSTYLE_BLOCK=2 + +# Set the style of the caret to be drawn. +set void SetCaretStyle=2512(int caretStyle,) + +# Returns the current style of the caret. +get int GetCaretStyle=2513(,) + +# Set the indicator used for IndicatorFillRange and IndicatorClearRange +set void SetIndicatorCurrent=2500(int indicator,) + +# Get the current indicator +get int GetIndicatorCurrent=2501(,) + +# Set the value used for IndicatorFillRange +set void SetIndicatorValue=2502(int value,) + +# Get the current indicator value +get int GetIndicatorValue=2503(,) + +# Turn a indicator on over a range. +fun void IndicatorFillRange=2504(int position, int fillLength) + +# Turn a indicator off over a range. +fun void IndicatorClearRange=2505(int position, int clearLength) + +# Are any indicators present at position? +fun int IndicatorAllOnFor=2506(int position,) + +# What value does a particular indicator have at at a position? +fun int IndicatorValueAt=2507(int indicator, int position) + +# Where does a particular indicator start? +fun int IndicatorStart=2508(int indicator, int position) + +# Where does a particular indicator end? +fun int IndicatorEnd=2509(int indicator, int position) + +# Set number of entries in position cache +set void SetPositionCache=2514(int size,) + +# How many entries are allocated to the position cache? +get int GetPositionCache=2515(,) + +# Copy the selection, if selection empty copy the line with the caret +fun void CopyAllowLine=2519(,) + +# Compact the document buffer and return a read-only pointer to the +# characters in the document. +get int GetCharacterPointer=2520(,) + +# Return a read-only pointer to a range of characters in the document. +# May move the gap so that the range is contiguous, but will only move up +# to rangeLength bytes. +get int GetRangePointer=2643(int position, int rangeLength) + +# Return a position which, to avoid performance costs, should not be within +# the range of a call to GetRangePointer. +get position GetGapPosition=2644(,) + +# Always interpret keyboard input as Unicode +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 +val ANNOTATION_INDENTED=3 + +# 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(,) + +# Release all extended (>255) style numbers +fun void ReleaseAllExtendedStyles=2552(,) + +# Allocate some extended (>255) style numbers and return the start of the range +fun int AllocateExtendedStyles=2553(int numberStyles,) + +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 switching to rectangular mode while selecting with the mouse is allowed. +set void SetMouseSelectionRectangularSwitch=2668(bool mouseSelectionRectangularSwitch,) + +# Whether switching to rectangular mode while selecting with the mouse is allowed. +get bool GetMouseSelectionRectangularSwitch=2669(,) + +# 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(,) + +# Is every selected range empty? +get bool GetSelectionEmpty=2650(,) + +# 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) + +# Drop one selection +fun void DropSelectionN=2671(int selection,) + +# 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,) + +# Set the scale factor in percent for future RGBA image data. +set void RGBAImageSetScale=2651(int scalePercent,) + +# 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(,) + +val SC_TECHNOLOGY_DEFAULT=0 +val SC_TECHNOLOGY_DIRECTWRITE=1 +val SC_TECHNOLOGY_DIRECTWRITERETAIN=2 +val SC_TECHNOLOGY_DIRECTWRITEDC=3 + +# Set the technology used. +set void SetTechnology=2630(int technology,) + +# Get the tech. +get int GetTechnology=2631(,) + +# Create an ILoader*. +fun int CreateLoader=2632(int bytes,) + +# On OS X, show a find indicator. +fun void FindIndicatorShow=2640(position start, position end) + +# On OS X, flash a find indicator, then fade out. +fun void FindIndicatorFlash=2641(position start, position end) + +# On OS X, hide the find indicator. +fun void FindIndicatorHide=2642(,) + +# Move caret to before first visible character on display line. +# If already there move to first character on display line. +fun void VCHomeDisplay=2652(,) + +# Like VCHomeDisplay but extending selection to new caret position. +fun void VCHomeDisplayExtend=2653(,) + +# Is the caret line always visible? +get bool GetCaretLineVisibleAlways=2654(,) + +# Sets the caret line to always visible. +set void SetCaretLineVisibleAlways=2655(bool alwaysVisible,) + +# Line end types which may be used in addition to LF, CR, and CRLF +# SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, +# U+2029 Paragraph Separator, and U+0085 Next Line +enu LineEndType=SC_LINE_END_TYPE_ +val SC_LINE_END_TYPE_DEFAULT=0 +val SC_LINE_END_TYPE_UNICODE=1 + +# Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. +set void SetLineEndTypesAllowed=2656(int lineEndBitSet,) + +# Get the line end types currently allowed. +get int GetLineEndTypesAllowed=2657(,) + +# Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. +get int GetLineEndTypesActive=2658(,) + +# Set the way a character is drawn. +set void SetRepresentation=2665(string encodedCharacter, string representation) + +# Set the way a character is drawn. +get int GetRepresentation=2666(string encodedCharacter, stringresult representation) + +# Remove a character representation. +fun void ClearRepresentation=2667(string encodedCharacter,) + +# Start notifying the container of all key presses and commands. +fun void StartRecord=3001(,) + +# Stop notifying the container of all key presses and commands. +fun void StopRecord=3002(,) + +# Set the lexing language of the document. +set void SetLexer=4001(int lexer,) + +# Retrieve the lexing language of the document. +get int GetLexer=4002(,) + +# Colourise a segment of the document using the current lexing language. +fun void Colourise=4003(position start, position end) + +# Set up a value that may be used by a lexer for some optional feature. +set void SetProperty=4004(string key, string value) + +# Maximum value of keywordSet parameter of SetKeyWords. +val KEYWORDSET_MAX=8 + +# Set up the key words used by the lexer. +set void SetKeyWords=4005(int keywordSet, string keyWords) + +# Set the lexing language of the document based on string name. +set void SetLexerLanguage=4006(, string language) + +# Load a lexer library (dll / so). +fun void LoadLexerLibrary=4007(, string path) + +# Retrieve a "property" value previously set with SetProperty. +get int GetProperty=4008(string key, stringresult buf) + +# Retrieve a "property" value previously set with SetProperty, +# with "$()" variable replacement on returned buffer. +get int GetPropertyExpanded=4009(string key, stringresult buf) + +# Retrieve a "property" value previously set with SetProperty, +# interpreted as an int AFTER any "$()" variable replacement. +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) + +# Bit set of LineEndType enumertion for which line ends beyond the standard +# LF, CR, and CRLF are supported by the lexer. +get int GetLineEndTypesSupported=4018(,) + +# Allocate a set of sub styles for a particular base style, returning start of range +fun int AllocateSubStyles=4020(int styleBase, int numberStyles) + +# The starting style number for the sub styles associated with a base style +get int GetSubStylesStart=4021(int styleBase,) + +# The number of sub styles associated with a base style +get int GetSubStylesLength=4022(int styleBase,) + +# For a sub style, return the base style, else return the argument. +get int GetStyleFromSubStyle=4027(int subStyle,) + +# For a secondary style, return the primary style, else return the argument. +get int GetPrimaryStyleFromStyle=4028(int style,) + +# Free allocated sub styles +fun void FreeSubStyles=4023(,) + +# Set the identifiers that are shown in a particular style +set void SetIdentifiers=4024(int style, string identifiers) + +# Where styles are duplicated by a feature such as active/inactive code +# return the distance between the two types. +get int DistanceToSecondaryStyles=4025(,) + +# Get the set of base styles that can be extended with sub styles +get int GetSubStyleBases=4026(, stringresult styles) + +# 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. +# One bit is set from each of SC_MOD_* and SC_PERFORMED_*. +enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_MULTISTEPUNDOREDO SC_LASTSTEPINUNDOREDO SC_MULTILINEUNDOREDO SC_STARTACTION SC_MODEVENTMASKALL +val SC_MOD_INSERTTEXT=0x1 +val SC_MOD_DELETETEXT=0x2 +val SC_MOD_CHANGESTYLE=0x4 +val SC_MOD_CHANGEFOLD=0x8 +val SC_PERFORMED_USER=0x10 +val SC_PERFORMED_UNDO=0x20 +val SC_PERFORMED_REDO=0x40 +val SC_MULTISTEPUNDOREDO=0x80 +val SC_LASTSTEPINUNDOREDO=0x100 +val SC_MOD_CHANGEMARKER=0x200 +val SC_MOD_BEFOREINSERT=0x400 +val SC_MOD_BEFOREDELETE=0x800 +val SC_MULTILINEUNDOREDO=0x1000 +val SC_STARTACTION=0x2000 +val SC_MOD_CHANGEINDICATOR=0x4000 +val SC_MOD_CHANGELINESTATE=0x8000 +val SC_MOD_CHANGEMARGIN=0x10000 +val SC_MOD_CHANGEANNOTATION=0x20000 +val SC_MOD_CONTAINER=0x40000 +val SC_MOD_LEXERSTATE=0x80000 +val SC_MOD_INSERTCHECK=0x100000 +val SC_MOD_CHANGETABSTOPS=0x200000 +val SC_MODEVENTMASKALL=0x3FFFFF + +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. +# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_* +# As clients depend on these constants, this will not be changed. +val SCEN_CHANGE=768 +val SCEN_SETFOCUS=512 +val SCEN_KILLFOCUS=256 + +# Symbolic key codes and modifier flags. +# ASCII and other printable characters below 256. +# Extended keys above 300. + +enu Keys=SCK_ +val SCK_DOWN=300 +val SCK_UP=301 +val SCK_LEFT=302 +val SCK_RIGHT=303 +val SCK_HOME=304 +val SCK_END=305 +val SCK_PRIOR=306 +val SCK_NEXT=307 +val SCK_DELETE=308 +val SCK_INSERT=309 +val SCK_ESCAPE=7 +val SCK_BACK=8 +val SCK_TAB=9 +val SCK_RETURN=13 +val SCK_ADD=310 +val SCK_SUBTRACT=311 +val SCK_DIVIDE=312 +val SCK_WIN=313 +val SCK_RWIN=314 +val SCK_MENU=315 + +enu KeyMod=SCMOD_ +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 +enu Lexer=SCLEX_ +val SCLEX_CONTAINER=0 +val SCLEX_NULL=1 +val SCLEX_PYTHON=2 +val SCLEX_CPP=3 +val SCLEX_HTML=4 +val SCLEX_XML=5 +val SCLEX_PERL=6 +val SCLEX_SQL=7 +val SCLEX_VB=8 +val SCLEX_PROPERTIES=9 +val SCLEX_ERRORLIST=10 +val SCLEX_MAKEFILE=11 +val SCLEX_BATCH=12 +val SCLEX_XCODE=13 +val SCLEX_LATEX=14 +val SCLEX_LUA=15 +val SCLEX_DIFF=16 +val SCLEX_CONF=17 +val SCLEX_PASCAL=18 +val SCLEX_AVE=19 +val SCLEX_ADA=20 +val SCLEX_LISP=21 +val SCLEX_RUBY=22 +val SCLEX_EIFFEL=23 +val SCLEX_EIFFELKW=24 +val SCLEX_TCL=25 +val SCLEX_NNCRONTAB=26 +val SCLEX_BULLANT=27 +val SCLEX_VBSCRIPT=28 +val SCLEX_BAAN=31 +val SCLEX_MATLAB=32 +val SCLEX_SCRIPTOL=33 +val SCLEX_ASM=34 +val SCLEX_CPPNOCASE=35 +val SCLEX_FORTRAN=36 +val SCLEX_F77=37 +val SCLEX_CSS=38 +val SCLEX_POV=39 +val SCLEX_LOUT=40 +val SCLEX_ESCRIPT=41 +val SCLEX_PS=42 +val SCLEX_NSIS=43 +val SCLEX_MMIXAL=44 +val SCLEX_CLW=45 +val SCLEX_CLWNOCASE=46 +val SCLEX_LOT=47 +val SCLEX_YAML=48 +val SCLEX_TEX=49 +val SCLEX_METAPOST=50 +val SCLEX_POWERBASIC=51 +val SCLEX_FORTH=52 +val SCLEX_ERLANG=53 +val SCLEX_OCTAVE=54 +val SCLEX_MSSQL=55 +val SCLEX_VERILOG=56 +val SCLEX_KIX=57 +val SCLEX_GUI4CLI=58 +val SCLEX_SPECMAN=59 +val SCLEX_AU3=60 +val SCLEX_APDL=61 +val SCLEX_BASH=62 +val SCLEX_ASN1=63 +val SCLEX_VHDL=64 +val SCLEX_CAML=65 +val SCLEX_BLITZBASIC=66 +val SCLEX_PUREBASIC=67 +val SCLEX_HASKELL=68 +val SCLEX_PHPSCRIPT=69 +val SCLEX_TADS3=70 +val SCLEX_REBOL=71 +val SCLEX_SMALLTALK=72 +val SCLEX_FLAGSHIP=73 +val SCLEX_CSOUND=74 +val SCLEX_FREEBASIC=75 +val SCLEX_INNOSETUP=76 +val SCLEX_OPAL=77 +val SCLEX_SPICE=78 +val SCLEX_D=79 +val SCLEX_CMAKE=80 +val SCLEX_GAP=81 +val SCLEX_PLM=82 +val SCLEX_PROGRESS=83 +val SCLEX_ABAQUS=84 +val SCLEX_ASYMPTOTE=85 +val SCLEX_R=86 +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 +val SCLEX_COFFEESCRIPT=102 +val SCLEX_TCMD=103 +val SCLEX_AVS=104 +val SCLEX_ECL=105 +val SCLEX_OSCRIPT=106 +val SCLEX_VISUALPROLOG=107 +val SCLEX_LITERATEHASKELL=108 +val SCLEX_STTXT=109 +val SCLEX_KVIRC=110 +val SCLEX_RUST=111 +val SCLEX_DMAP=112 +val SCLEX_AS=113 +val SCLEX_DMIS=114 +val SCLEX_REGISTRY=115 +val SCLEX_BIBTEX=116 +val SCLEX_SREC=117 +val SCLEX_IHEX=118 +val SCLEX_TEHEX=119 + +# 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 +val SCE_P_STRING=3 +val SCE_P_CHARACTER=4 +val SCE_P_WORD=5 +val SCE_P_TRIPLE=6 +val SCE_P_TRIPLEDOUBLE=7 +val SCE_P_CLASSNAME=8 +val SCE_P_DEFNAME=9 +val SCE_P_OPERATOR=10 +val SCE_P_IDENTIFIER=11 +val SCE_P_COMMENTBLOCK=12 +val SCE_P_STRINGEOL=13 +val SCE_P_WORD2=14 +val SCE_P_DECORATOR=15 +# Lexical states for SCLEX_CPP +lex Cpp=SCLEX_CPP SCE_C_ +lex BullAnt=SCLEX_BULLANT SCE_C_ +val SCE_C_DEFAULT=0 +val SCE_C_COMMENT=1 +val SCE_C_COMMENTLINE=2 +val SCE_C_COMMENTDOC=3 +val SCE_C_NUMBER=4 +val SCE_C_WORD=5 +val SCE_C_STRING=6 +val SCE_C_CHARACTER=7 +val SCE_C_UUID=8 +val SCE_C_PREPROCESSOR=9 +val SCE_C_OPERATOR=10 +val SCE_C_IDENTIFIER=11 +val SCE_C_STRINGEOL=12 +val SCE_C_VERBATIM=13 +val SCE_C_REGEX=14 +val SCE_C_COMMENTLINEDOC=15 +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 +val SCE_C_HASHQUOTEDSTRING=22 +val SCE_C_PREPROCESSORCOMMENT=23 +val SCE_C_PREPROCESSORCOMMENTDOC=24 +val SCE_C_USERLITERAL=25 +val SCE_C_TASKMARKER=26 +val SCE_C_ESCAPESEQUENCE=27 +# Lexical states for SCLEX_D +lex D=SCLEX_D SCE_D_ +val SCE_D_DEFAULT=0 +val SCE_D_COMMENT=1 +val SCE_D_COMMENTLINE=2 +val SCE_D_COMMENTDOC=3 +val SCE_D_COMMENTNESTED=4 +val SCE_D_NUMBER=5 +val SCE_D_WORD=6 +val SCE_D_WORD2=7 +val SCE_D_WORD3=8 +val SCE_D_TYPEDEF=9 +val SCE_D_STRING=10 +val SCE_D_STRINGEOL=11 +val SCE_D_CHARACTER=12 +val SCE_D_OPERATOR=13 +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 +val SCE_TCL_COMMENT=1 +val SCE_TCL_COMMENTLINE=2 +val SCE_TCL_NUMBER=3 +val SCE_TCL_WORD_IN_QUOTE=4 +val SCE_TCL_IN_QUOTE=5 +val SCE_TCL_OPERATOR=6 +val SCE_TCL_IDENTIFIER=7 +val SCE_TCL_SUBSTITUTION=8 +val SCE_TCL_SUB_BRACE=9 +val SCE_TCL_MODIFIER=10 +val SCE_TCL_EXPAND=11 +val SCE_TCL_WORD=12 +val SCE_TCL_WORD2=13 +val SCE_TCL_WORD3=14 +val SCE_TCL_WORD4=15 +val SCE_TCL_WORD5=16 +val SCE_TCL_WORD6=17 +val SCE_TCL_WORD7=18 +val SCE_TCL_WORD8=19 +val SCE_TCL_COMMENT_BOX=20 +val SCE_TCL_BLOCK_COMMENT=21 +# Lexical states for SCLEX_HTML, SCLEX_XML +lex HTML=SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ +lex XML=SCLEX_XML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ +val SCE_H_DEFAULT=0 +val SCE_H_TAG=1 +val SCE_H_TAGUNKNOWN=2 +val SCE_H_ATTRIBUTE=3 +val SCE_H_ATTRIBUTEUNKNOWN=4 +val SCE_H_NUMBER=5 +val SCE_H_DOUBLESTRING=6 +val SCE_H_SINGLESTRING=7 +val SCE_H_OTHER=8 +val SCE_H_COMMENT=9 +val SCE_H_ENTITY=10 +# XML and ASP +val SCE_H_TAGEND=11 +val SCE_H_XMLSTART=12 +val SCE_H_XMLEND=13 +val SCE_H_SCRIPT=14 +val SCE_H_ASP=15 +val SCE_H_ASPAT=16 +val SCE_H_CDATA=17 +val SCE_H_QUESTION=18 +# More HTML +val SCE_H_VALUE=19 +# X-Code +val SCE_H_XCCOMMENT=20 +# SGML +val SCE_H_SGML_DEFAULT=21 +val SCE_H_SGML_COMMAND=22 +val SCE_H_SGML_1ST_PARAM=23 +val SCE_H_SGML_DOUBLESTRING=24 +val SCE_H_SGML_SIMPLESTRING=25 +val SCE_H_SGML_ERROR=26 +val SCE_H_SGML_SPECIAL=27 +val SCE_H_SGML_ENTITY=28 +val SCE_H_SGML_COMMENT=29 +val SCE_H_SGML_1ST_PARAM_COMMENT=30 +val SCE_H_SGML_BLOCK_DEFAULT=31 +# Embedded Javascript +val SCE_HJ_START=40 +val SCE_HJ_DEFAULT=41 +val SCE_HJ_COMMENT=42 +val SCE_HJ_COMMENTLINE=43 +val SCE_HJ_COMMENTDOC=44 +val SCE_HJ_NUMBER=45 +val SCE_HJ_WORD=46 +val SCE_HJ_KEYWORD=47 +val SCE_HJ_DOUBLESTRING=48 +val SCE_HJ_SINGLESTRING=49 +val SCE_HJ_SYMBOLS=50 +val SCE_HJ_STRINGEOL=51 +val SCE_HJ_REGEX=52 +# ASP Javascript +val SCE_HJA_START=55 +val SCE_HJA_DEFAULT=56 +val SCE_HJA_COMMENT=57 +val SCE_HJA_COMMENTLINE=58 +val SCE_HJA_COMMENTDOC=59 +val SCE_HJA_NUMBER=60 +val SCE_HJA_WORD=61 +val SCE_HJA_KEYWORD=62 +val SCE_HJA_DOUBLESTRING=63 +val SCE_HJA_SINGLESTRING=64 +val SCE_HJA_SYMBOLS=65 +val SCE_HJA_STRINGEOL=66 +val SCE_HJA_REGEX=67 +# Embedded VBScript +val SCE_HB_START=70 +val SCE_HB_DEFAULT=71 +val SCE_HB_COMMENTLINE=72 +val SCE_HB_NUMBER=73 +val SCE_HB_WORD=74 +val SCE_HB_STRING=75 +val SCE_HB_IDENTIFIER=76 +val SCE_HB_STRINGEOL=77 +# ASP VBScript +val SCE_HBA_START=80 +val SCE_HBA_DEFAULT=81 +val SCE_HBA_COMMENTLINE=82 +val SCE_HBA_NUMBER=83 +val SCE_HBA_WORD=84 +val SCE_HBA_STRING=85 +val SCE_HBA_IDENTIFIER=86 +val SCE_HBA_STRINGEOL=87 +# Embedded Python +val SCE_HP_START=90 +val SCE_HP_DEFAULT=91 +val SCE_HP_COMMENTLINE=92 +val SCE_HP_NUMBER=93 +val SCE_HP_STRING=94 +val SCE_HP_CHARACTER=95 +val SCE_HP_WORD=96 +val SCE_HP_TRIPLE=97 +val SCE_HP_TRIPLEDOUBLE=98 +val SCE_HP_CLASSNAME=99 +val SCE_HP_DEFNAME=100 +val SCE_HP_OPERATOR=101 +val SCE_HP_IDENTIFIER=102 +# PHP +val SCE_HPHP_COMPLEX_VARIABLE=104 +# ASP Python +val SCE_HPA_START=105 +val SCE_HPA_DEFAULT=106 +val SCE_HPA_COMMENTLINE=107 +val SCE_HPA_NUMBER=108 +val SCE_HPA_STRING=109 +val SCE_HPA_CHARACTER=110 +val SCE_HPA_WORD=111 +val SCE_HPA_TRIPLE=112 +val SCE_HPA_TRIPLEDOUBLE=113 +val SCE_HPA_CLASSNAME=114 +val SCE_HPA_DEFNAME=115 +val SCE_HPA_OPERATOR=116 +val SCE_HPA_IDENTIFIER=117 +# PHP +val SCE_HPHP_DEFAULT=118 +val SCE_HPHP_HSTRING=119 +val SCE_HPHP_SIMPLESTRING=120 +val SCE_HPHP_WORD=121 +val SCE_HPHP_NUMBER=122 +val SCE_HPHP_VARIABLE=123 +val SCE_HPHP_COMMENT=124 +val SCE_HPHP_COMMENTLINE=125 +val SCE_HPHP_HSTRING_VARIABLE=126 +val SCE_HPHP_OPERATOR=127 +# Lexical states for SCLEX_PERL +lex Perl=SCLEX_PERL SCE_PL_ +val SCE_PL_DEFAULT=0 +val SCE_PL_ERROR=1 +val SCE_PL_COMMENTLINE=2 +val SCE_PL_POD=3 +val SCE_PL_NUMBER=4 +val SCE_PL_WORD=5 +val SCE_PL_STRING=6 +val SCE_PL_CHARACTER=7 +val SCE_PL_PUNCTUATION=8 +val SCE_PL_PREPROCESSOR=9 +val SCE_PL_OPERATOR=10 +val SCE_PL_IDENTIFIER=11 +val SCE_PL_SCALAR=12 +val SCE_PL_ARRAY=13 +val SCE_PL_HASH=14 +val SCE_PL_SYMBOLTABLE=15 +val SCE_PL_VARIABLE_INDEXER=16 +val SCE_PL_REGEX=17 +val SCE_PL_REGSUBST=18 +val SCE_PL_LONGQUOTE=19 +val SCE_PL_BACKTICKS=20 +val SCE_PL_DATASECTION=21 +val SCE_PL_HERE_DELIM=22 +val SCE_PL_HERE_Q=23 +val SCE_PL_HERE_QQ=24 +val SCE_PL_HERE_QX=25 +val SCE_PL_STRING_Q=26 +val SCE_PL_STRING_QQ=27 +val SCE_PL_STRING_QX=28 +val SCE_PL_STRING_QR=29 +val SCE_PL_STRING_QW=30 +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 +val SCE_RB_ERROR=1 +val SCE_RB_COMMENTLINE=2 +val SCE_RB_POD=3 +val SCE_RB_NUMBER=4 +val SCE_RB_WORD=5 +val SCE_RB_STRING=6 +val SCE_RB_CHARACTER=7 +val SCE_RB_CLASSNAME=8 +val SCE_RB_DEFNAME=9 +val SCE_RB_OPERATOR=10 +val SCE_RB_IDENTIFIER=11 +val SCE_RB_REGEX=12 +val SCE_RB_GLOBAL=13 +val SCE_RB_SYMBOL=14 +val SCE_RB_MODULE_NAME=15 +val SCE_RB_INSTANCE_VAR=16 +val SCE_RB_CLASS_VAR=17 +val SCE_RB_BACKTICKS=18 +val SCE_RB_DATASECTION=19 +val SCE_RB_HERE_DELIM=20 +val SCE_RB_HERE_Q=21 +val SCE_RB_HERE_QQ=22 +val SCE_RB_HERE_QX=23 +val SCE_RB_STRING_Q=24 +val SCE_RB_STRING_QQ=25 +val SCE_RB_STRING_QX=26 +val SCE_RB_STRING_QR=27 +val SCE_RB_STRING_QW=28 +val SCE_RB_WORD_DEMOTED=29 +val SCE_RB_STDIN=30 +val SCE_RB_STDOUT=31 +val SCE_RB_STDERR=40 +val SCE_RB_UPPER_BOUND=41 +# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC +lex VB=SCLEX_VB SCE_B_ +lex VBScript=SCLEX_VBSCRIPT SCE_B_ +lex PowerBasic=SCLEX_POWERBASIC SCE_B_ +val SCE_B_DEFAULT=0 +val SCE_B_COMMENT=1 +val SCE_B_NUMBER=2 +val SCE_B_KEYWORD=3 +val SCE_B_STRING=4 +val SCE_B_PREPROCESSOR=5 +val SCE_B_OPERATOR=6 +val SCE_B_IDENTIFIER=7 +val SCE_B_DATE=8 +val SCE_B_STRINGEOL=9 +val SCE_B_KEYWORD2=10 +val SCE_B_KEYWORD3=11 +val SCE_B_KEYWORD4=12 +val SCE_B_CONSTANT=13 +val SCE_B_ASM=14 +val SCE_B_LABEL=15 +val SCE_B_ERROR=16 +val SCE_B_HEXNUMBER=17 +val SCE_B_BINNUMBER=18 +val SCE_B_COMMENTBLOCK=19 +val SCE_B_DOCLINE=20 +val SCE_B_DOCBLOCK=21 +val SCE_B_DOCKEYWORD=22 +# Lexical states for SCLEX_PROPERTIES +lex Properties=SCLEX_PROPERTIES SCE_PROPS_ +val SCE_PROPS_DEFAULT=0 +val SCE_PROPS_COMMENT=1 +val SCE_PROPS_SECTION=2 +val SCE_PROPS_ASSIGNMENT=3 +val SCE_PROPS_DEFVAL=4 +val SCE_PROPS_KEY=5 +# Lexical states for SCLEX_LATEX +lex LaTeX=SCLEX_LATEX SCE_L_ +val SCE_L_DEFAULT=0 +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 +val SCE_LUA_COMMENT=1 +val SCE_LUA_COMMENTLINE=2 +val SCE_LUA_COMMENTDOC=3 +val SCE_LUA_NUMBER=4 +val SCE_LUA_WORD=5 +val SCE_LUA_STRING=6 +val SCE_LUA_CHARACTER=7 +val SCE_LUA_LITERALSTRING=8 +val SCE_LUA_PREPROCESSOR=9 +val SCE_LUA_OPERATOR=10 +val SCE_LUA_IDENTIFIER=11 +val SCE_LUA_STRINGEOL=12 +val SCE_LUA_WORD2=13 +val SCE_LUA_WORD3=14 +val SCE_LUA_WORD4=15 +val SCE_LUA_WORD5=16 +val SCE_LUA_WORD6=17 +val SCE_LUA_WORD7=18 +val SCE_LUA_WORD8=19 +val SCE_LUA_LABEL=20 +# Lexical states for SCLEX_ERRORLIST +lex ErrorList=SCLEX_ERRORLIST SCE_ERR_ +val SCE_ERR_DEFAULT=0 +val SCE_ERR_PYTHON=1 +val SCE_ERR_GCC=2 +val SCE_ERR_MS=3 +val SCE_ERR_CMD=4 +val SCE_ERR_BORLAND=5 +val SCE_ERR_PERL=6 +val SCE_ERR_NET=7 +val SCE_ERR_LUA=8 +val SCE_ERR_CTAG=9 +val SCE_ERR_DIFF_CHANGED=10 +val SCE_ERR_DIFF_ADDITION=11 +val SCE_ERR_DIFF_DELETION=12 +val SCE_ERR_DIFF_MESSAGE=13 +val SCE_ERR_PHP=14 +val SCE_ERR_ELF=15 +val SCE_ERR_IFC=16 +val SCE_ERR_IFORT=17 +val SCE_ERR_ABSF=18 +val SCE_ERR_TIDY=19 +val SCE_ERR_JAVA_STACK=20 +val SCE_ERR_VALUE=21 +val SCE_ERR_GCC_INCLUDED_FROM=22 +# Lexical states for SCLEX_BATCH +lex Batch=SCLEX_BATCH SCE_BAT_ +val SCE_BAT_DEFAULT=0 +val SCE_BAT_COMMENT=1 +val SCE_BAT_WORD=2 +val SCE_BAT_LABEL=3 +val SCE_BAT_HIDE=4 +val SCE_BAT_COMMAND=5 +val SCE_BAT_IDENTIFIER=6 +val SCE_BAT_OPERATOR=7 +# Lexical states for SCLEX_TCMD +lex TCMD=SCLEX_TCMD SCE_TCMD_ +val SCE_TCMD_DEFAULT=0 +val SCE_TCMD_COMMENT=1 +val SCE_TCMD_WORD=2 +val SCE_TCMD_LABEL=3 +val SCE_TCMD_HIDE=4 +val SCE_TCMD_COMMAND=5 +val SCE_TCMD_IDENTIFIER=6 +val SCE_TCMD_OPERATOR=7 +val SCE_TCMD_ENVIRONMENT=8 +val SCE_TCMD_EXPANSION=9 +val SCE_TCMD_CLABEL=10 +# Lexical states for SCLEX_MAKEFILE +lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_ +val SCE_MAKE_DEFAULT=0 +val SCE_MAKE_COMMENT=1 +val SCE_MAKE_PREPROCESSOR=2 +val SCE_MAKE_IDENTIFIER=3 +val SCE_MAKE_OPERATOR=4 +val SCE_MAKE_TARGET=5 +val SCE_MAKE_IDEOL=9 +# Lexical states for SCLEX_DIFF +lex Diff=SCLEX_DIFF SCE_DIFF_ +val SCE_DIFF_DEFAULT=0 +val SCE_DIFF_COMMENT=1 +val SCE_DIFF_COMMAND=2 +val SCE_DIFF_HEADER=3 +val SCE_DIFF_POSITION=4 +val SCE_DIFF_DELETED=5 +val SCE_DIFF_ADDED=6 +val SCE_DIFF_CHANGED=7 +# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) +lex Conf=SCLEX_CONF SCE_CONF_ +val SCE_CONF_DEFAULT=0 +val SCE_CONF_COMMENT=1 +val SCE_CONF_NUMBER=2 +val SCE_CONF_IDENTIFIER=3 +val SCE_CONF_EXTENSION=4 +val SCE_CONF_PARAMETER=5 +val SCE_CONF_STRING=6 +val SCE_CONF_OPERATOR=7 +val SCE_CONF_IP=8 +val SCE_CONF_DIRECTIVE=9 +# Lexical states for SCLEX_AVE, Avenue +lex Avenue=SCLEX_AVE SCE_AVE_ +val SCE_AVE_DEFAULT=0 +val SCE_AVE_COMMENT=1 +val SCE_AVE_NUMBER=2 +val SCE_AVE_WORD=3 +val SCE_AVE_STRING=6 +val SCE_AVE_ENUM=7 +val SCE_AVE_STRINGEOL=8 +val SCE_AVE_IDENTIFIER=9 +val SCE_AVE_OPERATOR=10 +val SCE_AVE_WORD1=11 +val SCE_AVE_WORD2=12 +val SCE_AVE_WORD3=13 +val SCE_AVE_WORD4=14 +val SCE_AVE_WORD5=15 +val SCE_AVE_WORD6=16 +# Lexical states for SCLEX_ADA +lex Ada=SCLEX_ADA SCE_ADA_ +val SCE_ADA_DEFAULT=0 +val SCE_ADA_WORD=1 +val SCE_ADA_IDENTIFIER=2 +val SCE_ADA_NUMBER=3 +val SCE_ADA_DELIMITER=4 +val SCE_ADA_CHARACTER=5 +val SCE_ADA_CHARACTEREOL=6 +val SCE_ADA_STRING=7 +val SCE_ADA_STRINGEOL=8 +val SCE_ADA_LABEL=9 +val SCE_ADA_COMMENTLINE=10 +val SCE_ADA_ILLEGAL=11 +# Lexical states for SCLEX_BAAN +lex Baan=SCLEX_BAAN SCE_BAAN_ +val SCE_BAAN_DEFAULT=0 +val SCE_BAAN_COMMENT=1 +val SCE_BAAN_COMMENTDOC=2 +val SCE_BAAN_NUMBER=3 +val SCE_BAAN_WORD=4 +val SCE_BAAN_STRING=5 +val SCE_BAAN_PREPROCESSOR=6 +val SCE_BAAN_OPERATOR=7 +val SCE_BAAN_IDENTIFIER=8 +val SCE_BAAN_STRINGEOL=9 +val SCE_BAAN_WORD2=10 +# Lexical states for SCLEX_LISP +lex Lisp=SCLEX_LISP SCE_LISP_ +val SCE_LISP_DEFAULT=0 +val SCE_LISP_COMMENT=1 +val SCE_LISP_NUMBER=2 +val SCE_LISP_KEYWORD=3 +val SCE_LISP_KEYWORD_KW=4 +val SCE_LISP_SYMBOL=5 +val SCE_LISP_STRING=6 +val SCE_LISP_STRINGEOL=8 +val SCE_LISP_IDENTIFIER=9 +val SCE_LISP_OPERATOR=10 +val SCE_LISP_SPECIAL=11 +val SCE_LISP_MULTI_COMMENT=12 +# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW +lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_ +lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_ +val SCE_EIFFEL_DEFAULT=0 +val SCE_EIFFEL_COMMENTLINE=1 +val SCE_EIFFEL_NUMBER=2 +val SCE_EIFFEL_WORD=3 +val SCE_EIFFEL_STRING=4 +val SCE_EIFFEL_CHARACTER=5 +val SCE_EIFFEL_OPERATOR=6 +val SCE_EIFFEL_IDENTIFIER=7 +val SCE_EIFFEL_STRINGEOL=8 +# Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer) +lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_ +val SCE_NNCRONTAB_DEFAULT=0 +val SCE_NNCRONTAB_COMMENT=1 +val SCE_NNCRONTAB_TASK=2 +val SCE_NNCRONTAB_SECTION=3 +val SCE_NNCRONTAB_KEYWORD=4 +val SCE_NNCRONTAB_MODIFIER=5 +val SCE_NNCRONTAB_ASTERISK=6 +val SCE_NNCRONTAB_NUMBER=7 +val SCE_NNCRONTAB_STRING=8 +val SCE_NNCRONTAB_ENVIRONMENT=9 +val SCE_NNCRONTAB_IDENTIFIER=10 +# Lexical states for SCLEX_FORTH (Forth Lexer) +lex Forth=SCLEX_FORTH SCE_FORTH_ +val SCE_FORTH_DEFAULT=0 +val SCE_FORTH_COMMENT=1 +val SCE_FORTH_COMMENT_ML=2 +val SCE_FORTH_IDENTIFIER=3 +val SCE_FORTH_CONTROL=4 +val SCE_FORTH_KEYWORD=5 +val SCE_FORTH_DEFWORD=6 +val SCE_FORTH_PREWORD1=7 +val SCE_FORTH_PREWORD2=8 +val SCE_FORTH_NUMBER=9 +val SCE_FORTH_STRING=10 +val SCE_FORTH_LOCALE=11 +# Lexical states for SCLEX_MATLAB +lex MatLab=SCLEX_MATLAB SCE_MATLAB_ +val SCE_MATLAB_DEFAULT=0 +val SCE_MATLAB_COMMENT=1 +val SCE_MATLAB_COMMAND=2 +val SCE_MATLAB_NUMBER=3 +val SCE_MATLAB_KEYWORD=4 +# single quoted string +val SCE_MATLAB_STRING=5 +val SCE_MATLAB_OPERATOR=6 +val SCE_MATLAB_IDENTIFIER=7 +val SCE_MATLAB_DOUBLEQUOTESTRING=8 +# Lexical states for SCLEX_SCRIPTOL +lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_ +val SCE_SCRIPTOL_DEFAULT=0 +val SCE_SCRIPTOL_WHITE=1 +val SCE_SCRIPTOL_COMMENTLINE=2 +val SCE_SCRIPTOL_PERSISTENT=3 +val SCE_SCRIPTOL_CSTYLE=4 +val SCE_SCRIPTOL_COMMENTBLOCK=5 +val SCE_SCRIPTOL_NUMBER=6 +val SCE_SCRIPTOL_STRING=7 +val SCE_SCRIPTOL_CHARACTER=8 +val SCE_SCRIPTOL_STRINGEOL=9 +val SCE_SCRIPTOL_KEYWORD=10 +val SCE_SCRIPTOL_OPERATOR=11 +val SCE_SCRIPTOL_IDENTIFIER=12 +val SCE_SCRIPTOL_TRIPLE=13 +val SCE_SCRIPTOL_CLASSNAME=14 +val SCE_SCRIPTOL_PREPROCESSOR=15 +# Lexical states for SCLEX_ASM, SCLEX_AS +lex Asm=SCLEX_ASM SCE_ASM_ +lex As=SCLEX_AS SCE_ASM_ +val SCE_ASM_DEFAULT=0 +val SCE_ASM_COMMENT=1 +val SCE_ASM_NUMBER=2 +val SCE_ASM_STRING=3 +val SCE_ASM_OPERATOR=4 +val SCE_ASM_IDENTIFIER=5 +val SCE_ASM_CPUINSTRUCTION=6 +val SCE_ASM_MATHINSTRUCTION=7 +val SCE_ASM_REGISTER=8 +val SCE_ASM_DIRECTIVE=9 +val SCE_ASM_DIRECTIVEOPERAND=10 +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_ +val SCE_F_DEFAULT=0 +val SCE_F_COMMENT=1 +val SCE_F_NUMBER=2 +val SCE_F_STRING1=3 +val SCE_F_STRING2=4 +val SCE_F_STRINGEOL=5 +val SCE_F_OPERATOR=6 +val SCE_F_IDENTIFIER=7 +val SCE_F_WORD=8 +val SCE_F_WORD2=9 +val SCE_F_WORD3=10 +val SCE_F_PREPROCESSOR=11 +val SCE_F_OPERATOR2=12 +val SCE_F_LABEL=13 +val SCE_F_CONTINUATION=14 +# Lexical states for SCLEX_CSS +lex CSS=SCLEX_CSS SCE_CSS_ +val SCE_CSS_DEFAULT=0 +val SCE_CSS_TAG=1 +val SCE_CSS_CLASS=2 +val SCE_CSS_PSEUDOCLASS=3 +val SCE_CSS_UNKNOWN_PSEUDOCLASS=4 +val SCE_CSS_OPERATOR=5 +val SCE_CSS_IDENTIFIER=6 +val SCE_CSS_UNKNOWN_IDENTIFIER=7 +val SCE_CSS_VALUE=8 +val SCE_CSS_COMMENT=9 +val SCE_CSS_ID=10 +val SCE_CSS_IMPORTANT=11 +val SCE_CSS_DIRECTIVE=12 +val SCE_CSS_DOUBLESTRING=13 +val SCE_CSS_SINGLESTRING=14 +val SCE_CSS_IDENTIFIER2=15 +val SCE_CSS_ATTRIBUTE=16 +val SCE_CSS_IDENTIFIER3=17 +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 +val SCE_CSS_VARIABLE=23 +# Lexical states for SCLEX_POV +lex POV=SCLEX_POV SCE_POV_ +val SCE_POV_DEFAULT=0 +val SCE_POV_COMMENT=1 +val SCE_POV_COMMENTLINE=2 +val SCE_POV_NUMBER=3 +val SCE_POV_OPERATOR=4 +val SCE_POV_IDENTIFIER=5 +val SCE_POV_STRING=6 +val SCE_POV_STRINGEOL=7 +val SCE_POV_DIRECTIVE=8 +val SCE_POV_BADDIRECTIVE=9 +val SCE_POV_WORD2=10 +val SCE_POV_WORD3=11 +val SCE_POV_WORD4=12 +val SCE_POV_WORD5=13 +val SCE_POV_WORD6=14 +val SCE_POV_WORD7=15 +val SCE_POV_WORD8=16 +# Lexical states for SCLEX_LOUT +lex LOUT=SCLEX_LOUT SCE_LOUT_ +val SCE_LOUT_DEFAULT=0 +val SCE_LOUT_COMMENT=1 +val SCE_LOUT_NUMBER=2 +val SCE_LOUT_WORD=3 +val SCE_LOUT_WORD2=4 +val SCE_LOUT_WORD3=5 +val SCE_LOUT_WORD4=6 +val SCE_LOUT_STRING=7 +val SCE_LOUT_OPERATOR=8 +val SCE_LOUT_IDENTIFIER=9 +val SCE_LOUT_STRINGEOL=10 +# Lexical states for SCLEX_ESCRIPT +lex ESCRIPT=SCLEX_ESCRIPT SCE_ESCRIPT_ +val SCE_ESCRIPT_DEFAULT=0 +val SCE_ESCRIPT_COMMENT=1 +val SCE_ESCRIPT_COMMENTLINE=2 +val SCE_ESCRIPT_COMMENTDOC=3 +val SCE_ESCRIPT_NUMBER=4 +val SCE_ESCRIPT_WORD=5 +val SCE_ESCRIPT_STRING=6 +val SCE_ESCRIPT_OPERATOR=7 +val SCE_ESCRIPT_IDENTIFIER=8 +val SCE_ESCRIPT_BRACE=9 +val SCE_ESCRIPT_WORD2=10 +val SCE_ESCRIPT_WORD3=11 +# Lexical states for SCLEX_PS +lex PS=SCLEX_PS SCE_PS_ +val SCE_PS_DEFAULT=0 +val SCE_PS_COMMENT=1 +val SCE_PS_DSC_COMMENT=2 +val SCE_PS_DSC_VALUE=3 +val SCE_PS_NUMBER=4 +val SCE_PS_NAME=5 +val SCE_PS_KEYWORD=6 +val SCE_PS_LITERAL=7 +val SCE_PS_IMMEVAL=8 +val SCE_PS_PAREN_ARRAY=9 +val SCE_PS_PAREN_DICT=10 +val SCE_PS_PAREN_PROC=11 +val SCE_PS_TEXT=12 +val SCE_PS_HEXSTRING=13 +val SCE_PS_BASE85STRING=14 +val SCE_PS_BADSTRINGCHAR=15 +# Lexical states for SCLEX_NSIS +lex NSIS=SCLEX_NSIS SCE_NSIS_ +val SCE_NSIS_DEFAULT=0 +val SCE_NSIS_COMMENT=1 +val SCE_NSIS_STRINGDQ=2 +val SCE_NSIS_STRINGLQ=3 +val SCE_NSIS_STRINGRQ=4 +val SCE_NSIS_FUNCTION=5 +val SCE_NSIS_VARIABLE=6 +val SCE_NSIS_LABEL=7 +val SCE_NSIS_USERDEFINED=8 +val SCE_NSIS_SECTIONDEF=9 +val SCE_NSIS_SUBSECTIONDEF=10 +val SCE_NSIS_IFDEFINEDEF=11 +val SCE_NSIS_MACRODEF=12 +val SCE_NSIS_STRINGVAR=13 +val SCE_NSIS_NUMBER=14 +val SCE_NSIS_SECTIONGROUP=15 +val SCE_NSIS_PAGEEX=16 +val SCE_NSIS_FUNCTIONDEF=17 +val SCE_NSIS_COMMENTBOX=18 +# Lexical states for SCLEX_MMIXAL +lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_ +val SCE_MMIXAL_LEADWS=0 +val SCE_MMIXAL_COMMENT=1 +val SCE_MMIXAL_LABEL=2 +val SCE_MMIXAL_OPCODE=3 +val SCE_MMIXAL_OPCODE_PRE=4 +val SCE_MMIXAL_OPCODE_VALID=5 +val SCE_MMIXAL_OPCODE_UNKNOWN=6 +val SCE_MMIXAL_OPCODE_POST=7 +val SCE_MMIXAL_OPERANDS=8 +val SCE_MMIXAL_NUMBER=9 +val SCE_MMIXAL_REF=10 +val SCE_MMIXAL_CHAR=11 +val SCE_MMIXAL_STRING=12 +val SCE_MMIXAL_REGISTER=13 +val SCE_MMIXAL_HEX=14 +val SCE_MMIXAL_OPERATOR=15 +val SCE_MMIXAL_SYMBOL=16 +val SCE_MMIXAL_INCLUDE=17 +# Lexical states for SCLEX_CLW +lex Clarion=SCLEX_CLW SCE_CLW_ +val SCE_CLW_DEFAULT=0 +val SCE_CLW_LABEL=1 +val SCE_CLW_COMMENT=2 +val SCE_CLW_STRING=3 +val SCE_CLW_USER_IDENTIFIER=4 +val SCE_CLW_INTEGER_CONSTANT=5 +val SCE_CLW_REAL_CONSTANT=6 +val SCE_CLW_PICTURE_STRING=7 +val SCE_CLW_KEYWORD=8 +val SCE_CLW_COMPILER_DIRECTIVE=9 +val SCE_CLW_RUNTIME_EXPRESSIONS=10 +val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=11 +val SCE_CLW_STRUCTURE_DATA_TYPE=12 +val SCE_CLW_ATTRIBUTE=13 +val SCE_CLW_STANDARD_EQUATE=14 +val SCE_CLW_ERROR=15 +val SCE_CLW_DEPRECATED=16 +# Lexical states for SCLEX_LOT +lex LOT=SCLEX_LOT SCE_LOT_ +val SCE_LOT_DEFAULT=0 +val SCE_LOT_HEADER=1 +val SCE_LOT_BREAK=2 +val SCE_LOT_SET=3 +val SCE_LOT_PASS=4 +val SCE_LOT_FAIL=5 +val SCE_LOT_ABORT=6 +# Lexical states for SCLEX_YAML +lex YAML=SCLEX_YAML SCE_YAML_ +val SCE_YAML_DEFAULT=0 +val SCE_YAML_COMMENT=1 +val SCE_YAML_IDENTIFIER=2 +val SCE_YAML_KEYWORD=3 +val SCE_YAML_NUMBER=4 +val SCE_YAML_REFERENCE=5 +val SCE_YAML_DOCUMENT=6 +val SCE_YAML_TEXT=7 +val SCE_YAML_ERROR=8 +val SCE_YAML_OPERATOR=9 +# Lexical states for SCLEX_TEX +lex TeX=SCLEX_TEX SCE_TEX_ +val SCE_TEX_DEFAULT=0 +val SCE_TEX_SPECIAL=1 +val SCE_TEX_GROUP=2 +val SCE_TEX_SYMBOL=3 +val SCE_TEX_COMMAND=4 +val SCE_TEX_TEXT=5 +lex Metapost=SCLEX_METAPOST SCE_METAPOST_ +val SCE_METAPOST_DEFAULT=0 +val SCE_METAPOST_SPECIAL=1 +val SCE_METAPOST_GROUP=2 +val SCE_METAPOST_SYMBOL=3 +val SCE_METAPOST_COMMAND=4 +val SCE_METAPOST_TEXT=5 +val SCE_METAPOST_EXTRA=6 +# Lexical states for SCLEX_ERLANG +lex Erlang=SCLEX_ERLANG SCE_ERLANG_ +val SCE_ERLANG_DEFAULT=0 +val SCE_ERLANG_COMMENT=1 +val SCE_ERLANG_VARIABLE=2 +val SCE_ERLANG_NUMBER=3 +val SCE_ERLANG_KEYWORD=4 +val SCE_ERLANG_STRING=5 +val SCE_ERLANG_OPERATOR=6 +val SCE_ERLANG_ATOM=7 +val SCE_ERLANG_FUNCTION_NAME=8 +val SCE_ERLANG_CHARACTER=9 +val SCE_ERLANG_MACRO=10 +val SCE_ERLANG_RECORD=11 +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_ +# Lexical states for SCLEX_MSSQL +lex MSSQL=SCLEX_MSSQL SCE_MSSQL_ +val SCE_MSSQL_DEFAULT=0 +val SCE_MSSQL_COMMENT=1 +val SCE_MSSQL_LINE_COMMENT=2 +val SCE_MSSQL_NUMBER=3 +val SCE_MSSQL_STRING=4 +val SCE_MSSQL_OPERATOR=5 +val SCE_MSSQL_IDENTIFIER=6 +val SCE_MSSQL_VARIABLE=7 +val SCE_MSSQL_COLUMN_NAME=8 +val SCE_MSSQL_STATEMENT=9 +val SCE_MSSQL_DATATYPE=10 +val SCE_MSSQL_SYSTABLE=11 +val SCE_MSSQL_GLOBAL_VARIABLE=12 +val SCE_MSSQL_FUNCTION=13 +val SCE_MSSQL_STORED_PROCEDURE=14 +val SCE_MSSQL_DEFAULT_PREF_DATATYPE=15 +val SCE_MSSQL_COLUMN_NAME_2=16 +# Lexical states for SCLEX_VERILOG +lex Verilog=SCLEX_VERILOG SCE_V_ +val SCE_V_DEFAULT=0 +val SCE_V_COMMENT=1 +val SCE_V_COMMENTLINE=2 +val SCE_V_COMMENTLINEBANG=3 +val SCE_V_NUMBER=4 +val SCE_V_WORD=5 +val SCE_V_STRING=6 +val SCE_V_WORD2=7 +val SCE_V_WORD3=8 +val SCE_V_PREPROCESSOR=9 +val SCE_V_OPERATOR=10 +val SCE_V_IDENTIFIER=11 +val SCE_V_STRINGEOL=12 +val SCE_V_USER=19 +val SCE_V_COMMENT_WORD=20 +val SCE_V_INPUT=21 +val SCE_V_OUTPUT=22 +val SCE_V_INOUT=23 +val SCE_V_PORT_CONNECT=24 +# Lexical states for SCLEX_KIX +lex Kix=SCLEX_KIX SCE_KIX_ +val SCE_KIX_DEFAULT=0 +val SCE_KIX_COMMENT=1 +val SCE_KIX_STRING1=2 +val SCE_KIX_STRING2=3 +val SCE_KIX_NUMBER=4 +val SCE_KIX_VAR=5 +val SCE_KIX_MACRO=6 +val SCE_KIX_KEYWORD=7 +val SCE_KIX_FUNCTIONS=8 +val SCE_KIX_OPERATOR=9 +val SCE_KIX_COMMENTSTREAM=10 +val SCE_KIX_IDENTIFIER=31 +# Lexical states for SCLEX_GUI4CLI +lex Gui4Cli=SCLEX_GUI4CLI SCE_GC_ +val SCE_GC_DEFAULT=0 +val SCE_GC_COMMENTLINE=1 +val SCE_GC_COMMENTBLOCK=2 +val SCE_GC_GLOBAL=3 +val SCE_GC_EVENT=4 +val SCE_GC_ATTRIBUTE=5 +val SCE_GC_CONTROL=6 +val SCE_GC_COMMAND=7 +val SCE_GC_STRING=8 +val SCE_GC_OPERATOR=9 +# Lexical states for SCLEX_SPECMAN +lex Specman=SCLEX_SPECMAN SCE_SN_ +val SCE_SN_DEFAULT=0 +val SCE_SN_CODE=1 +val SCE_SN_COMMENTLINE=2 +val SCE_SN_COMMENTLINEBANG=3 +val SCE_SN_NUMBER=4 +val SCE_SN_WORD=5 +val SCE_SN_STRING=6 +val SCE_SN_WORD2=7 +val SCE_SN_WORD3=8 +val SCE_SN_PREPROCESSOR=9 +val SCE_SN_OPERATOR=10 +val SCE_SN_IDENTIFIER=11 +val SCE_SN_STRINGEOL=12 +val SCE_SN_REGEXTAG=13 +val SCE_SN_SIGNAL=14 +val SCE_SN_USER=19 +# Lexical states for SCLEX_AU3 +lex Au3=SCLEX_AU3 SCE_AU3_ +val SCE_AU3_DEFAULT=0 +val SCE_AU3_COMMENT=1 +val SCE_AU3_COMMENTBLOCK=2 +val SCE_AU3_NUMBER=3 +val SCE_AU3_FUNCTION=4 +val SCE_AU3_KEYWORD=5 +val SCE_AU3_MACRO=6 +val SCE_AU3_STRING=7 +val SCE_AU3_OPERATOR=8 +val SCE_AU3_VARIABLE=9 +val SCE_AU3_SENT=10 +val SCE_AU3_PREPROCESSOR=11 +val SCE_AU3_SPECIAL=12 +val SCE_AU3_EXPAND=13 +val SCE_AU3_COMOBJ=14 +val SCE_AU3_UDF=15 +# Lexical states for SCLEX_APDL +lex APDL=SCLEX_APDL SCE_APDL_ +val SCE_APDL_DEFAULT=0 +val SCE_APDL_COMMENT=1 +val SCE_APDL_COMMENTBLOCK=2 +val SCE_APDL_NUMBER=3 +val SCE_APDL_STRING=4 +val SCE_APDL_OPERATOR=5 +val SCE_APDL_WORD=6 +val SCE_APDL_PROCESSOR=7 +val SCE_APDL_COMMAND=8 +val SCE_APDL_SLASHCOMMAND=9 +val SCE_APDL_STARCOMMAND=10 +val SCE_APDL_ARGUMENT=11 +val SCE_APDL_FUNCTION=12 +# Lexical states for SCLEX_BASH +lex Bash=SCLEX_BASH SCE_SH_ +val SCE_SH_DEFAULT=0 +val SCE_SH_ERROR=1 +val SCE_SH_COMMENTLINE=2 +val SCE_SH_NUMBER=3 +val SCE_SH_WORD=4 +val SCE_SH_STRING=5 +val SCE_SH_CHARACTER=6 +val SCE_SH_OPERATOR=7 +val SCE_SH_IDENTIFIER=8 +val SCE_SH_SCALAR=9 +val SCE_SH_PARAM=10 +val SCE_SH_BACKTICKS=11 +val SCE_SH_HERE_DELIM=12 +val SCE_SH_HERE_Q=13 +# Lexical states for SCLEX_ASN1 +lex Asn1=SCLEX_ASN1 SCE_ASN1_ +val SCE_ASN1_DEFAULT=0 +val SCE_ASN1_COMMENT=1 +val SCE_ASN1_IDENTIFIER=2 +val SCE_ASN1_STRING=3 +val SCE_ASN1_OID=4 +val SCE_ASN1_SCALAR=5 +val SCE_ASN1_KEYWORD=6 +val SCE_ASN1_ATTRIBUTE=7 +val SCE_ASN1_DESCRIPTOR=8 +val SCE_ASN1_TYPE=9 +val SCE_ASN1_OPERATOR=10 +# Lexical states for SCLEX_VHDL +lex VHDL=SCLEX_VHDL SCE_VHDL_ +val SCE_VHDL_DEFAULT=0 +val SCE_VHDL_COMMENT=1 +val SCE_VHDL_COMMENTLINEBANG=2 +val SCE_VHDL_NUMBER=3 +val SCE_VHDL_STRING=4 +val SCE_VHDL_OPERATOR=5 +val SCE_VHDL_IDENTIFIER=6 +val SCE_VHDL_STRINGEOL=7 +val SCE_VHDL_KEYWORD=8 +val SCE_VHDL_STDOPERATOR=9 +val SCE_VHDL_ATTRIBUTE=10 +val SCE_VHDL_STDFUNCTION=11 +val SCE_VHDL_STDPACKAGE=12 +val SCE_VHDL_STDTYPE=13 +val SCE_VHDL_USERWORD=14 +val SCE_VHDL_BLOCK_COMMENT=15 +# Lexical states for SCLEX_CAML +lex Caml=SCLEX_CAML SCE_CAML_ +val SCE_CAML_DEFAULT=0 +val SCE_CAML_IDENTIFIER=1 +val SCE_CAML_TAGNAME=2 +val SCE_CAML_KEYWORD=3 +val SCE_CAML_KEYWORD2=4 +val SCE_CAML_KEYWORD3=5 +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 +val SCE_CAML_COMMENT2=14 +val SCE_CAML_COMMENT3=15 +# Lexical states for SCLEX_HASKELL +lex Haskell=SCLEX_HASKELL SCE_HA_ +val SCE_HA_DEFAULT=0 +val SCE_HA_IDENTIFIER=1 +val SCE_HA_KEYWORD=2 +val SCE_HA_NUMBER=3 +val SCE_HA_STRING=4 +val SCE_HA_CHARACTER=5 +val SCE_HA_CLASS=6 +val SCE_HA_MODULE=7 +val SCE_HA_CAPITAL=8 +val SCE_HA_DATA=9 +val SCE_HA_IMPORT=10 +val SCE_HA_OPERATOR=11 +val SCE_HA_INSTANCE=12 +val SCE_HA_COMMENTLINE=13 +val SCE_HA_COMMENTBLOCK=14 +val SCE_HA_COMMENTBLOCK2=15 +val SCE_HA_COMMENTBLOCK3=16 +val SCE_HA_PRAGMA=17 +val SCE_HA_PREPROCESSOR=18 +val SCE_HA_STRINGEOL=19 +val SCE_HA_RESERVED_OPERATOR=20 +val SCE_HA_LITERATE_COMMENT=21 +val SCE_HA_LITERATE_CODEDELIM=22 +# Lexical states of SCLEX_TADS3 +lex TADS3=SCLEX_TADS3 SCE_T3_ +val SCE_T3_DEFAULT=0 +val SCE_T3_X_DEFAULT=1 +val SCE_T3_PREPROCESSOR=2 +val SCE_T3_BLOCK_COMMENT=3 +val SCE_T3_LINE_COMMENT=4 +val SCE_T3_OPERATOR=5 +val SCE_T3_KEYWORD=6 +val SCE_T3_NUMBER=7 +val SCE_T3_IDENTIFIER=8 +val SCE_T3_S_STRING=9 +val SCE_T3_D_STRING=10 +val SCE_T3_X_STRING=11 +val SCE_T3_LIB_DIRECTIVE=12 +val SCE_T3_MSG_PARAM=13 +val SCE_T3_HTML_TAG=14 +val SCE_T3_HTML_DEFAULT=15 +val SCE_T3_HTML_STRING=16 +val SCE_T3_USER1=17 +val SCE_T3_USER2=18 +val SCE_T3_USER3=19 +val SCE_T3_BRACE=20 +# Lexical states for SCLEX_REBOL +lex Rebol=SCLEX_REBOL SCE_REBOL_ +val SCE_REBOL_DEFAULT=0 +val SCE_REBOL_COMMENTLINE=1 +val SCE_REBOL_COMMENTBLOCK=2 +val SCE_REBOL_PREFACE=3 +val SCE_REBOL_OPERATOR=4 +val SCE_REBOL_CHARACTER=5 +val SCE_REBOL_QUOTEDSTRING=6 +val SCE_REBOL_BRACEDSTRING=7 +val SCE_REBOL_NUMBER=8 +val SCE_REBOL_PAIR=9 +val SCE_REBOL_TUPLE=10 +val SCE_REBOL_BINARY=11 +val SCE_REBOL_MONEY=12 +val SCE_REBOL_ISSUE=13 +val SCE_REBOL_TAG=14 +val SCE_REBOL_FILE=15 +val SCE_REBOL_EMAIL=16 +val SCE_REBOL_URL=17 +val SCE_REBOL_DATE=18 +val SCE_REBOL_TIME=19 +val SCE_REBOL_IDENTIFIER=20 +val SCE_REBOL_WORD=21 +val SCE_REBOL_WORD2=22 +val SCE_REBOL_WORD3=23 +val SCE_REBOL_WORD4=24 +val SCE_REBOL_WORD5=25 +val SCE_REBOL_WORD6=26 +val SCE_REBOL_WORD7=27 +val SCE_REBOL_WORD8=28 +# Lexical states for SCLEX_SQL +lex SQL=SCLEX_SQL SCE_SQL_ +val SCE_SQL_DEFAULT=0 +val SCE_SQL_COMMENT=1 +val SCE_SQL_COMMENTLINE=2 +val SCE_SQL_COMMENTDOC=3 +val SCE_SQL_NUMBER=4 +val SCE_SQL_WORD=5 +val SCE_SQL_STRING=6 +val SCE_SQL_CHARACTER=7 +val SCE_SQL_SQLPLUS=8 +val SCE_SQL_SQLPLUS_PROMPT=9 +val SCE_SQL_OPERATOR=10 +val SCE_SQL_IDENTIFIER=11 +val SCE_SQL_SQLPLUS_COMMENT=13 +val SCE_SQL_COMMENTLINEDOC=15 +val SCE_SQL_WORD2=16 +val SCE_SQL_COMMENTDOCKEYWORD=17 +val SCE_SQL_COMMENTDOCKEYWORDERROR=18 +val SCE_SQL_USER1=19 +val SCE_SQL_USER2=20 +val SCE_SQL_USER3=21 +val SCE_SQL_USER4=22 +val SCE_SQL_QUOTEDIDENTIFIER=23 +val SCE_SQL_QOPERATOR=24 +# Lexical states for SCLEX_SMALLTALK +lex Smalltalk=SCLEX_SMALLTALK SCE_ST_ +val SCE_ST_DEFAULT=0 +val SCE_ST_STRING=1 +val SCE_ST_NUMBER=2 +val SCE_ST_COMMENT=3 +val SCE_ST_SYMBOL=4 +val SCE_ST_BINARY=5 +val SCE_ST_BOOL=6 +val SCE_ST_SELF=7 +val SCE_ST_SUPER=8 +val SCE_ST_NIL=9 +val SCE_ST_GLOBAL=10 +val SCE_ST_RETURN=11 +val SCE_ST_SPECIAL=12 +val SCE_ST_KWSEND=13 +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_FS_ +val SCE_FS_DEFAULT=0 +val SCE_FS_COMMENT=1 +val SCE_FS_COMMENTLINE=2 +val SCE_FS_COMMENTDOC=3 +val SCE_FS_COMMENTLINEDOC=4 +val SCE_FS_COMMENTDOCKEYWORD=5 +val SCE_FS_COMMENTDOCKEYWORDERROR=6 +val SCE_FS_KEYWORD=7 +val SCE_FS_KEYWORD2=8 +val SCE_FS_KEYWORD3=9 +val SCE_FS_KEYWORD4=10 +val SCE_FS_NUMBER=11 +val SCE_FS_STRING=12 +val SCE_FS_PREPROCESSOR=13 +val SCE_FS_OPERATOR=14 +val SCE_FS_IDENTIFIER=15 +val SCE_FS_DATE=16 +val SCE_FS_STRINGEOL=17 +val SCE_FS_CONSTANT=18 +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 +val SCE_CSOUND_COMMENT=1 +val SCE_CSOUND_NUMBER=2 +val SCE_CSOUND_OPERATOR=3 +val SCE_CSOUND_INSTR=4 +val SCE_CSOUND_IDENTIFIER=5 +val SCE_CSOUND_OPCODE=6 +val SCE_CSOUND_HEADERSTMT=7 +val SCE_CSOUND_USERKEYWORD=8 +val SCE_CSOUND_COMMENTBLOCK=9 +val SCE_CSOUND_PARAM=10 +val SCE_CSOUND_ARATE_VAR=11 +val SCE_CSOUND_KRATE_VAR=12 +val SCE_CSOUND_IRATE_VAR=13 +val SCE_CSOUND_GLOBAL_VAR=14 +val SCE_CSOUND_STRINGEOL=15 +# Lexical states for SCLEX_INNOSETUP +lex Inno=SCLEX_INNOSETUP SCE_INNO_ +val SCE_INNO_DEFAULT=0 +val SCE_INNO_COMMENT=1 +val SCE_INNO_KEYWORD=2 +val SCE_INNO_PARAMETER=3 +val SCE_INNO_SECTION=4 +val SCE_INNO_PREPROC=5 +val SCE_INNO_INLINE_EXPANSION=6 +val SCE_INNO_COMMENT_PASCAL=7 +val SCE_INNO_KEYWORD_PASCAL=8 +val SCE_INNO_KEYWORD_USER=9 +val SCE_INNO_STRING_DOUBLE=10 +val SCE_INNO_STRING_SINGLE=11 +val SCE_INNO_IDENTIFIER=12 +# Lexical states for SCLEX_OPAL +lex Opal=SCLEX_OPAL SCE_OPAL_ +val SCE_OPAL_SPACE=0 +val SCE_OPAL_COMMENT_BLOCK=1 +val SCE_OPAL_COMMENT_LINE=2 +val SCE_OPAL_INTEGER=3 +val SCE_OPAL_KEYWORD=4 +val SCE_OPAL_SORT=5 +val SCE_OPAL_STRING=6 +val SCE_OPAL_PAR=7 +val SCE_OPAL_BOOL_CONST=8 +val SCE_OPAL_DEFAULT=32 +# Lexical states for SCLEX_SPICE +lex Spice=SCLEX_SPICE SCE_SPICE_ +val SCE_SPICE_DEFAULT=0 +val SCE_SPICE_IDENTIFIER=1 +val SCE_SPICE_KEYWORD=2 +val SCE_SPICE_KEYWORD2=3 +val SCE_SPICE_KEYWORD3=4 +val SCE_SPICE_NUMBER=5 +val SCE_SPICE_DELIMITER=6 +val SCE_SPICE_VALUE=7 +val SCE_SPICE_COMMENTLINE=8 +# Lexical states for SCLEX_CMAKE +lex CMAKE=SCLEX_CMAKE SCE_CMAKE_ +val SCE_CMAKE_DEFAULT=0 +val SCE_CMAKE_COMMENT=1 +val SCE_CMAKE_STRINGDQ=2 +val SCE_CMAKE_STRINGLQ=3 +val SCE_CMAKE_STRINGRQ=4 +val SCE_CMAKE_COMMANDS=5 +val SCE_CMAKE_PARAMETERS=6 +val SCE_CMAKE_VARIABLE=7 +val SCE_CMAKE_USERDEFINED=8 +val SCE_CMAKE_WHILEDEF=9 +val SCE_CMAKE_FOREACHDEF=10 +val SCE_CMAKE_IFDEFINEDEF=11 +val SCE_CMAKE_MACRODEF=12 +val SCE_CMAKE_STRINGVAR=13 +val SCE_CMAKE_NUMBER=14 +# Lexical states for SCLEX_GAP +lex Gap=SCLEX_GAP SCE_GAP_ +val SCE_GAP_DEFAULT=0 +val SCE_GAP_IDENTIFIER=1 +val SCE_GAP_KEYWORD=2 +val SCE_GAP_KEYWORD2=3 +val SCE_GAP_KEYWORD3=4 +val SCE_GAP_KEYWORD4=5 +val SCE_GAP_STRING=6 +val SCE_GAP_CHAR=7 +val SCE_GAP_OPERATOR=8 +val SCE_GAP_COMMENT=9 +val SCE_GAP_NUMBER=10 +val SCE_GAP_STRINGEOL=11 +# Lexical state for SCLEX_PLM +lex PLM=SCLEX_PLM SCE_PLM_ +val SCE_PLM_DEFAULT=0 +val SCE_PLM_COMMENT=1 +val SCE_PLM_STRING=2 +val SCE_PLM_NUMBER=3 +val SCE_PLM_IDENTIFIER=4 +val SCE_PLM_OPERATOR=5 +val SCE_PLM_CONTROL=6 +val SCE_PLM_KEYWORD=7 +# Lexical state for SCLEX_PROGRESS +lex Progress=SCLEX_PROGRESS SCE_4GL_ +val SCE_4GL_DEFAULT=0 +val SCE_4GL_NUMBER=1 +val SCE_4GL_WORD=2 +val SCE_4GL_STRING=3 +val SCE_4GL_CHARACTER=4 +val SCE_4GL_PREPROCESSOR=5 +val SCE_4GL_OPERATOR=6 +val SCE_4GL_IDENTIFIER=7 +val SCE_4GL_BLOCK=8 +val SCE_4GL_END=9 +val SCE_4GL_COMMENT1=10 +val SCE_4GL_COMMENT2=11 +val SCE_4GL_COMMENT3=12 +val SCE_4GL_COMMENT4=13 +val SCE_4GL_COMMENT5=14 +val SCE_4GL_COMMENT6=15 +val SCE_4GL_DEFAULT_=16 +val SCE_4GL_NUMBER_=17 +val SCE_4GL_WORD_=18 +val SCE_4GL_STRING_=19 +val SCE_4GL_CHARACTER_=20 +val SCE_4GL_PREPROCESSOR_=21 +val SCE_4GL_OPERATOR_=22 +val SCE_4GL_IDENTIFIER_=23 +val SCE_4GL_BLOCK_=24 +val SCE_4GL_END_=25 +val SCE_4GL_COMMENT1_=26 +val SCE_4GL_COMMENT2_=27 +val SCE_4GL_COMMENT3_=28 +val SCE_4GL_COMMENT4_=29 +val SCE_4GL_COMMENT5_=30 +val SCE_4GL_COMMENT6_=31 +# Lexical states for SCLEX_ABAQUS +lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_ +val SCE_ABAQUS_DEFAULT=0 +val SCE_ABAQUS_COMMENT=1 +val SCE_ABAQUS_COMMENTBLOCK=2 +val SCE_ABAQUS_NUMBER=3 +val SCE_ABAQUS_STRING=4 +val SCE_ABAQUS_OPERATOR=5 +val SCE_ABAQUS_WORD=6 +val SCE_ABAQUS_PROCESSOR=7 +val SCE_ABAQUS_COMMAND=8 +val SCE_ABAQUS_SLASHCOMMAND=9 +val SCE_ABAQUS_STARCOMMAND=10 +val SCE_ABAQUS_ARGUMENT=11 +val SCE_ABAQUS_FUNCTION=12 +# Lexical states for SCLEX_ASYMPTOTE +lex Asymptote=SCLEX_ASYMPTOTE SCE_ASY_ +val SCE_ASY_DEFAULT=0 +val SCE_ASY_COMMENT=1 +val SCE_ASY_COMMENTLINE=2 +val SCE_ASY_NUMBER=3 +val SCE_ASY_WORD=4 +val SCE_ASY_STRING=5 +val SCE_ASY_CHARACTER=6 +val SCE_ASY_OPERATOR=7 +val SCE_ASY_IDENTIFIER=8 +val SCE_ASY_STRINGEOL=9 +val SCE_ASY_COMMENTLINEDOC=10 +val SCE_ASY_WORD2=11 +# Lexical states for SCLEX_R +lex R=SCLEX_R SCE_R_ +val SCE_R_DEFAULT=0 +val SCE_R_COMMENT=1 +val SCE_R_KWORD=2 +val SCE_R_BASEKWORD=3 +val SCE_R_OTHERKWORD=4 +val SCE_R_NUMBER=5 +val SCE_R_STRING=6 +val SCE_R_STRING2=7 +val SCE_R_OPERATOR=8 +val SCE_R_IDENTIFIER=9 +val SCE_R_INFIX=10 +val SCE_R_INFIXEOL=11 +# Lexical state for SCLEX_MAGIK +lex MagikSF=SCLEX_MAGIK SCE_MAGIK_ +val SCE_MAGIK_DEFAULT=0 +val SCE_MAGIK_COMMENT=1 +val SCE_MAGIK_HYPER_COMMENT=16 +val SCE_MAGIK_STRING=2 +val SCE_MAGIK_CHARACTER=3 +val SCE_MAGIK_NUMBER=4 +val SCE_MAGIK_IDENTIFIER=5 +val SCE_MAGIK_OPERATOR=6 +val SCE_MAGIK_FLOW=7 +val SCE_MAGIK_CONTAINER=8 +val SCE_MAGIK_BRACKET_BLOCK=9 +val SCE_MAGIK_BRACE_BLOCK=10 +val SCE_MAGIK_SQBRACKET_BLOCK=11 +val SCE_MAGIK_UNKNOWN_KEYWORD=12 +val SCE_MAGIK_KEYWORD=13 +val SCE_MAGIK_PRAGMA=14 +val SCE_MAGIK_SYMBOL=15 +# Lexical state for SCLEX_POWERSHELL +lex PowerShell=SCLEX_POWERSHELL SCE_POWERSHELL_ +val SCE_POWERSHELL_DEFAULT=0 +val SCE_POWERSHELL_COMMENT=1 +val SCE_POWERSHELL_STRING=2 +val SCE_POWERSHELL_CHARACTER=3 +val SCE_POWERSHELL_NUMBER=4 +val SCE_POWERSHELL_VARIABLE=5 +val SCE_POWERSHELL_OPERATOR=6 +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 +val SCE_POWERSHELL_HERE_STRING=14 +val SCE_POWERSHELL_HERE_CHARACTER=15 +val SCE_POWERSHELL_COMMENTDOCKEYWORD=16 +# Lexical state for SCLEX_MYSQL +lex MySQL=SCLEX_MYSQL SCE_MYSQL_ +val SCE_MYSQL_DEFAULT=0 +val SCE_MYSQL_COMMENT=1 +val SCE_MYSQL_COMMENTLINE=2 +val SCE_MYSQL_VARIABLE=3 +val SCE_MYSQL_SYSTEMVARIABLE=4 +val SCE_MYSQL_KNOWNSYSTEMVARIABLE=5 +val SCE_MYSQL_NUMBER=6 +val SCE_MYSQL_MAJORKEYWORD=7 +val SCE_MYSQL_KEYWORD=8 +val SCE_MYSQL_DATABASEOBJECT=9 +val SCE_MYSQL_PROCEDUREKEYWORD=10 +val SCE_MYSQL_STRING=11 +val SCE_MYSQL_SQSTRING=12 +val SCE_MYSQL_DQSTRING=13 +val SCE_MYSQL_OPERATOR=14 +val SCE_MYSQL_FUNCTION=15 +val SCE_MYSQL_IDENTIFIER=16 +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 +val SCE_MYSQL_PLACEHOLDER=22 +# Lexical state for SCLEX_PO +lex Po=SCLEX_PO SCE_PO_ +val SCE_PO_DEFAULT=0 +val SCE_PO_COMMENT=1 +val SCE_PO_MSGID=2 +val SCE_PO_MSGID_TEXT=3 +val SCE_PO_MSGSTR=4 +val SCE_PO_MSGSTR_TEXT=5 +val SCE_PO_MSGCTXT=6 +val SCE_PO_MSGCTXT_TEXT=7 +val SCE_PO_FUZZY=8 +val SCE_PO_PROGRAMMER_COMMENT=9 +val SCE_PO_REFERENCE=10 +val SCE_PO_FLAGS=11 +val SCE_PO_MSGID_TEXT_EOL=12 +val SCE_PO_MSGSTR_TEXT_EOL=13 +val SCE_PO_MSGCTXT_TEXT_EOL=14 +val SCE_PO_ERROR=15 +# 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 +# Lexical states for SCLEX_COFFEESCRIPT +lex CoffeeScript=SCLEX_COFFEESCRIPT SCE_COFFEESCRIPT_ +val SCE_COFFEESCRIPT_DEFAULT=0 +val SCE_COFFEESCRIPT_COMMENT=1 +val SCE_COFFEESCRIPT_COMMENTLINE=2 +val SCE_COFFEESCRIPT_COMMENTDOC=3 +val SCE_COFFEESCRIPT_NUMBER=4 +val SCE_COFFEESCRIPT_WORD=5 +val SCE_COFFEESCRIPT_STRING=6 +val SCE_COFFEESCRIPT_CHARACTER=7 +val SCE_COFFEESCRIPT_UUID=8 +val SCE_COFFEESCRIPT_PREPROCESSOR=9 +val SCE_COFFEESCRIPT_OPERATOR=10 +val SCE_COFFEESCRIPT_IDENTIFIER=11 +val SCE_COFFEESCRIPT_STRINGEOL=12 +val SCE_COFFEESCRIPT_VERBATIM=13 +val SCE_COFFEESCRIPT_REGEX=14 +val SCE_COFFEESCRIPT_COMMENTLINEDOC=15 +val SCE_COFFEESCRIPT_WORD2=16 +val SCE_COFFEESCRIPT_COMMENTDOCKEYWORD=17 +val SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR=18 +val SCE_COFFEESCRIPT_GLOBALCLASS=19 +val SCE_COFFEESCRIPT_STRINGRAW=20 +val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21 +val SCE_COFFEESCRIPT_COMMENTBLOCK=22 +val SCE_COFFEESCRIPT_VERBOSE_REGEX=23 +val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24 +# Lexical states for SCLEX_AVS +lex AVS=SCLEX_AVS SCE_AVS_ +val SCE_AVS_DEFAULT=0 +val SCE_AVS_COMMENTBLOCK=1 +val SCE_AVS_COMMENTBLOCKN=2 +val SCE_AVS_COMMENTLINE=3 +val SCE_AVS_NUMBER=4 +val SCE_AVS_OPERATOR=5 +val SCE_AVS_IDENTIFIER=6 +val SCE_AVS_STRING=7 +val SCE_AVS_TRIPLESTRING=8 +val SCE_AVS_KEYWORD=9 +val SCE_AVS_FILTER=10 +val SCE_AVS_PLUGIN=11 +val SCE_AVS_FUNCTION=12 +val SCE_AVS_CLIPPROP=13 +val SCE_AVS_USERDFN=14 +# Lexical states for SCLEX_ECL +lex ECL=SCLEX_ECL SCE_ECL_ +val SCE_ECL_DEFAULT=0 +val SCE_ECL_COMMENT=1 +val SCE_ECL_COMMENTLINE=2 +val SCE_ECL_NUMBER=3 +val SCE_ECL_STRING=4 +val SCE_ECL_WORD0=5 +val SCE_ECL_OPERATOR=6 +val SCE_ECL_CHARACTER=7 +val SCE_ECL_UUID=8 +val SCE_ECL_PREPROCESSOR=9 +val SCE_ECL_UNKNOWN=10 +val SCE_ECL_IDENTIFIER=11 +val SCE_ECL_STRINGEOL=12 +val SCE_ECL_VERBATIM=13 +val SCE_ECL_REGEX=14 +val SCE_ECL_COMMENTLINEDOC=15 +val SCE_ECL_WORD1=16 +val SCE_ECL_COMMENTDOCKEYWORD=17 +val SCE_ECL_COMMENTDOCKEYWORDERROR=18 +val SCE_ECL_WORD2=19 +val SCE_ECL_WORD3=20 +val SCE_ECL_WORD4=21 +val SCE_ECL_WORD5=22 +val SCE_ECL_COMMENTDOC=23 +val SCE_ECL_ADDED=24 +val SCE_ECL_DELETED=25 +val SCE_ECL_CHANGED=26 +val SCE_ECL_MOVED=27 +# Lexical states for SCLEX_OSCRIPT +lex OScript=SCLEX_OSCRIPT SCE_OSCRIPT_ +val SCE_OSCRIPT_DEFAULT=0 +val SCE_OSCRIPT_LINE_COMMENT=1 +val SCE_OSCRIPT_BLOCK_COMMENT=2 +val SCE_OSCRIPT_DOC_COMMENT=3 +val SCE_OSCRIPT_PREPROCESSOR=4 +val SCE_OSCRIPT_NUMBER=5 +val SCE_OSCRIPT_SINGLEQUOTE_STRING=6 +val SCE_OSCRIPT_DOUBLEQUOTE_STRING=7 +val SCE_OSCRIPT_CONSTANT=8 +val SCE_OSCRIPT_IDENTIFIER=9 +val SCE_OSCRIPT_GLOBAL=10 +val SCE_OSCRIPT_KEYWORD=11 +val SCE_OSCRIPT_OPERATOR=12 +val SCE_OSCRIPT_LABEL=13 +val SCE_OSCRIPT_TYPE=14 +val SCE_OSCRIPT_FUNCTION=15 +val SCE_OSCRIPT_OBJECT=16 +val SCE_OSCRIPT_PROPERTY=17 +val SCE_OSCRIPT_METHOD=18 +# Lexical states for SCLEX_VISUALPROLOG +lex VisualProlog=SCLEX_VISUALPROLOG SCE_VISUALPROLOG_ +val SCE_VISUALPROLOG_DEFAULT=0 +val SCE_VISUALPROLOG_KEY_MAJOR=1 +val SCE_VISUALPROLOG_KEY_MINOR=2 +val SCE_VISUALPROLOG_KEY_DIRECTIVE=3 +val SCE_VISUALPROLOG_COMMENT_BLOCK=4 +val SCE_VISUALPROLOG_COMMENT_LINE=5 +val SCE_VISUALPROLOG_COMMENT_KEY=6 +val SCE_VISUALPROLOG_COMMENT_KEY_ERROR=7 +val SCE_VISUALPROLOG_IDENTIFIER=8 +val SCE_VISUALPROLOG_VARIABLE=9 +val SCE_VISUALPROLOG_ANONYMOUS=10 +val SCE_VISUALPROLOG_NUMBER=11 +val SCE_VISUALPROLOG_OPERATOR=12 +val SCE_VISUALPROLOG_CHARACTER=13 +val SCE_VISUALPROLOG_CHARACTER_TOO_MANY=14 +val SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR=15 +val SCE_VISUALPROLOG_STRING=16 +val SCE_VISUALPROLOG_STRING_ESCAPE=17 +val SCE_VISUALPROLOG_STRING_ESCAPE_ERROR=18 +val SCE_VISUALPROLOG_STRING_EOL_OPEN=19 +val SCE_VISUALPROLOG_STRING_VERBATIM=20 +val SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL=21 +val SCE_VISUALPROLOG_STRING_VERBATIM_EOL=22 +# Lexical states for SCLEX_STTXT +lex StructuredText=SCLEX_STTXT SCE_STTXT_ +val SCE_STTXT_DEFAULT=0 +val SCE_STTXT_COMMENT=1 +val SCE_STTXT_COMMENTLINE=2 +val SCE_STTXT_KEYWORD=3 +val SCE_STTXT_TYPE=4 +val SCE_STTXT_FUNCTION=5 +val SCE_STTXT_FB=6 +val SCE_STTXT_NUMBER=7 +val SCE_STTXT_HEXNUMBER=8 +val SCE_STTXT_PRAGMA=9 +val SCE_STTXT_OPERATOR=10 +val SCE_STTXT_CHARACTER=11 +val SCE_STTXT_STRING1=12 +val SCE_STTXT_STRING2=13 +val SCE_STTXT_STRINGEOL=14 +val SCE_STTXT_IDENTIFIER=15 +val SCE_STTXT_DATETIME=16 +val SCE_STTXT_VARS=17 +val SCE_STTXT_PRAGMAS=18 +# Lexical states for SCLEX_KVIRC +lex KVIrc=SCLEX_KVIRC SCE_KVIRC_ +val SCE_KVIRC_DEFAULT=0 +val SCE_KVIRC_COMMENT=1 +val SCE_KVIRC_COMMENTBLOCK=2 +val SCE_KVIRC_STRING=3 +val SCE_KVIRC_WORD=4 +val SCE_KVIRC_KEYWORD=5 +val SCE_KVIRC_FUNCTION_KEYWORD=6 +val SCE_KVIRC_FUNCTION=7 +val SCE_KVIRC_VARIABLE=8 +val SCE_KVIRC_NUMBER=9 +val SCE_KVIRC_OPERATOR=10 +val SCE_KVIRC_STRING_FUNCTION=11 +val SCE_KVIRC_STRING_VARIABLE=12 +# Lexical states for SCLEX_RUST +lex Rust=SCLEX_RUST SCE_RUST_ +val SCE_RUST_DEFAULT=0 +val SCE_RUST_COMMENTBLOCK=1 +val SCE_RUST_COMMENTLINE=2 +val SCE_RUST_COMMENTBLOCKDOC=3 +val SCE_RUST_COMMENTLINEDOC=4 +val SCE_RUST_NUMBER=5 +val SCE_RUST_WORD=6 +val SCE_RUST_WORD2=7 +val SCE_RUST_WORD3=8 +val SCE_RUST_WORD4=9 +val SCE_RUST_WORD5=10 +val SCE_RUST_WORD6=11 +val SCE_RUST_WORD7=12 +val SCE_RUST_STRING=13 +val SCE_RUST_STRINGR=14 +val SCE_RUST_CHARACTER=15 +val SCE_RUST_OPERATOR=16 +val SCE_RUST_IDENTIFIER=17 +val SCE_RUST_LIFETIME=18 +val SCE_RUST_MACRO=19 +val SCE_RUST_LEXERROR=20 +val SCE_RUST_BYTESTRING=21 +val SCE_RUST_BYTESTRINGR=22 +val SCE_RUST_BYTECHARACTER=23 +# Lexical states for SCLEX_DMAP +lex DMAP=SCLEX_DMAP SCE_DMAP_ +val SCE_DMAP_DEFAULT=0 +val SCE_DMAP_COMMENT=1 +val SCE_DMAP_NUMBER=2 +val SCE_DMAP_STRING1=3 +val SCE_DMAP_STRING2=4 +val SCE_DMAP_STRINGEOL=5 +val SCE_DMAP_OPERATOR=6 +val SCE_DMAP_IDENTIFIER=7 +val SCE_DMAP_WORD=8 +val SCE_DMAP_WORD2=9 +val SCE_DMAP_WORD3=10 +# Lexical states for SCLEX_DMIS +lex DMIS=SCLEX_DMIS SCE_DMIS_ +val SCE_DMIS_DEFAULT=0 +val SCE_DMIS_COMMENT=1 +val SCE_DMIS_STRING=2 +val SCE_DMIS_NUMBER=3 +val SCE_DMIS_KEYWORD=4 +val SCE_DMIS_MAJORWORD=5 +val SCE_DMIS_MINORWORD=6 +val SCE_DMIS_UNSUPPORTED_MAJOR=7 +val SCE_DMIS_UNSUPPORTED_MINOR=8 +val SCE_DMIS_LABEL=9 +# Lexical states for SCLEX_REGISTRY +lex REG=SCLEX_REGISTRY SCE_REG_ +val SCE_REG_DEFAULT=0 +val SCE_REG_COMMENT=1 +val SCE_REG_VALUENAME=2 +val SCE_REG_STRING=3 +val SCE_REG_HEXDIGIT=4 +val SCE_REG_VALUETYPE=5 +val SCE_REG_ADDEDKEY=6 +val SCE_REG_DELETEDKEY=7 +val SCE_REG_ESCAPED=8 +val SCE_REG_KEYPATH_GUID=9 +val SCE_REG_STRING_GUID=10 +val SCE_REG_PARAMETER=11 +val SCE_REG_OPERATOR=12 +# Lexical state for SCLEX_BIBTEX +lex BibTeX=SCLEX_BIBTEX SCE_BIBTEX_ +val SCE_BIBTEX_DEFAULT=0 +val SCE_BIBTEX_ENTRY=1 +val SCE_BIBTEX_UNKNOWN_ENTRY=2 +val SCE_BIBTEX_KEY=3 +val SCE_BIBTEX_PARAMETER=4 +val SCE_BIBTEX_VALUE=5 +val SCE_BIBTEX_COMMENT=6 +# Lexical state for SCLEX_SREC +lex Srec=SCLEX_SREC SCE_HEX_ +val SCE_HEX_DEFAULT=0 +val SCE_HEX_RECSTART=1 +val SCE_HEX_RECTYPE=2 +val SCE_HEX_RECTYPE_UNKNOWN=3 +val SCE_HEX_BYTECOUNT=4 +val SCE_HEX_BYTECOUNT_WRONG=5 +val SCE_HEX_NOADDRESS=6 +val SCE_HEX_DATAADDRESS=7 +val SCE_HEX_RECCOUNT=8 +val SCE_HEX_STARTADDRESS=9 +val SCE_HEX_ADDRESSFIELD_UNKNOWN=10 +val SCE_HEX_EXTENDEDADDRESS=11 +val SCE_HEX_DATA_ODD=12 +val SCE_HEX_DATA_EVEN=13 +val SCE_HEX_DATA_UNKNOWN=14 +val SCE_HEX_DATA_EMPTY=15 +val SCE_HEX_CHECKSUM=16 +val SCE_HEX_CHECKSUM_WRONG=17 +val SCE_HEX_GARBAGE=18 +# Lexical state for SCLEX_IHEX (shared with Srec) +lex IHex=SCLEX_IHEX SCE_HEX_ +# Lexical state for SCLEX_TEHEX (shared with Srec) +lex TEHex=SCLEX_TEHEX SCE_HEX_ + +# Events + +evt void StyleNeeded=2000(int position) +evt void CharAdded=2001(int ch) +evt void SavePointReached=2002(void) +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(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, int position) +evt void URIDropped=2015(string text) +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, 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) +evt void FocusIn=2028(void) +evt void FocusOut=2029(void) + +# There are no provisional features currently + +cat Provisional + +cat Deprecated + +# Deprecated in 2.21 +# The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+. +val SC_CP_DBCS=1 + +# Deprecated in 2.30 + +# In palette mode? +get bool GetUsePalette=2139(,) + +# In palette mode, Scintilla uses the environment's palette calls to display +# more colours. This may lead to ugly displays. +set void SetUsePalette=2039(bool usePalette,) diff --git a/libs/qscintilla/include/ScintillaWidget.h b/libs/qscintilla/include/ScintillaWidget.h new file mode 100644 index 000000000..f8cd212b0 --- /dev/null +++ b/libs/qscintilla/include/ScintillaWidget.h @@ -0,0 +1,51 @@ +/* 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. */ + +#ifndef SCINTILLAWIDGET_H +#define SCINTILLAWIDGET_H + +#if defined(GTK) + +#ifdef __cplusplus +extern "C" { +#endif + +#define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject) +#define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) +#define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ()) + +typedef struct _ScintillaObject ScintillaObject; +typedef struct _ScintillaClass ScintillaClass; + +struct _ScintillaObject { + GtkContainer cont; + void *pscin; +}; + +struct _ScintillaClass { + GtkContainerClass parent_class; + + void (* command) (ScintillaObject *ttt); + void (* notify) (ScintillaObject *ttt); +}; + +GType scintilla_get_type (void); +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); + +#define SCINTILLA_NOTIFY "sci-notify" + +#ifdef __cplusplus +} +#endif + +#endif + +#endif diff --git a/libs/qscintilla/lexers/LexSQL.cpp b/libs/qscintilla/lexers/LexSQL.cpp new file mode 100644 index 000000000..9e1a19748 --- /dev/null +++ b/libs/qscintilla/lexers/LexSQL.cpp @@ -0,0 +1,967 @@ +//-*- coding: utf-8 -*- +// Scintilla source code edit control +/** @file LexSQL.cxx + ** Lexer for SQL, including PL/SQL and SQL*Plus. + ** Improved by Jérôme LAFORGE from 2010 to 2012. + **/ +// Copyright 1998-2012 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 + +#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 inline bool IsAWordChar(int ch, bool sqlAllowDottedWord) { + if (!sqlAllowDottedWord) + return (ch < 0x80) && (isalnum(ch) || ch == '_'); + else + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); +} + +static inline bool IsAWordStart(int ch) { + return (ch < 0x80) && (isalpha(ch) || ch == '_'); +} + +static inline bool IsADoxygenChar(int ch) { + return (islower(ch) || ch == '$' || ch == '@' || + ch == '\\' || ch == '&' || ch == '<' || + ch == '>' || ch == '#' || ch == '{' || + ch == '}' || ch == '[' || ch == ']'); +} + +static inline bool IsANumberChar(int ch) { + // Not exactly following number definition (several dots are seen as OK, etc.) + // but probably enough in most cases. + return (ch < 0x80) && + (isdigit(ch) || toupper(ch) == 'E' || + ch == '.' || ch == '-' || ch == '+'); +} + +typedef unsigned int sql_state_t; + +class SQLStates { +public : + void Set(int lineNumber, unsigned short int sqlStatesLine) { + sqlStatement.Set(lineNumber, sqlStatesLine); + } + + sql_state_t IgnoreWhen (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_IGNORE_WHEN; + else + sqlStatesLine &= ~MASK_IGNORE_WHEN; + + return sqlStatesLine; + } + + sql_state_t IntoCondition (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_CONDITION; + else + sqlStatesLine &= ~MASK_INTO_CONDITION; + + return sqlStatesLine; + } + + sql_state_t IntoExceptionBlock (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_EXCEPTION; + else + sqlStatesLine &= ~MASK_INTO_EXCEPTION; + + return sqlStatesLine; + } + + sql_state_t IntoDeclareBlock (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_DECLARE; + else + sqlStatesLine &= ~MASK_INTO_DECLARE; + + return sqlStatesLine; + } + + sql_state_t IntoMergeStatement (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_MERGE_STATEMENT; + else + sqlStatesLine &= ~MASK_MERGE_STATEMENT; + + return sqlStatesLine; + } + + sql_state_t CaseMergeWithoutWhenFound (sql_state_t sqlStatesLine, bool found) { + if (found) + sqlStatesLine |= MASK_CASE_MERGE_WITHOUT_WHEN_FOUND; + else + sqlStatesLine &= ~MASK_CASE_MERGE_WITHOUT_WHEN_FOUND; + + return sqlStatesLine; + } + sql_state_t IntoSelectStatementOrAssignment (sql_state_t sqlStatesLine, bool found) { + if (found) + sqlStatesLine |= MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT; + else + sqlStatesLine &= ~MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT; + return sqlStatesLine; + } + + sql_state_t BeginCaseBlock (sql_state_t sqlStatesLine) { + if ((sqlStatesLine & MASK_NESTED_CASES) < MASK_NESTED_CASES) { + sqlStatesLine++; + } + return sqlStatesLine; + } + + sql_state_t EndCaseBlock (sql_state_t sqlStatesLine) { + if ((sqlStatesLine & MASK_NESTED_CASES) > 0) { + sqlStatesLine--; + } + return sqlStatesLine; + } + + sql_state_t IntoCreateStatement (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_CREATE; + else + sqlStatesLine &= ~MASK_INTO_CREATE; + + return sqlStatesLine; + } + + sql_state_t IntoCreateViewStatement (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_CREATE_VIEW; + else + sqlStatesLine &= ~MASK_INTO_CREATE_VIEW; + + return sqlStatesLine; + } + + sql_state_t IntoCreateViewAsStatement (sql_state_t sqlStatesLine, bool enable) { + if (enable) + sqlStatesLine |= MASK_INTO_CREATE_VIEW_AS_STATEMENT; + else + sqlStatesLine &= ~MASK_INTO_CREATE_VIEW_AS_STATEMENT; + + return sqlStatesLine; + } + + bool IsIgnoreWhen (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_IGNORE_WHEN) != 0; + } + + bool IsIntoCondition (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_CONDITION) != 0; + } + + bool IsIntoCaseBlock (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_NESTED_CASES) != 0; + } + + bool IsIntoExceptionBlock (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_EXCEPTION) != 0; + } + bool IsIntoSelectStatementOrAssignment (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT) != 0; + } + bool IsCaseMergeWithoutWhenFound (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_CASE_MERGE_WITHOUT_WHEN_FOUND) != 0; + } + + bool IsIntoDeclareBlock (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_DECLARE) != 0; + } + + bool IsIntoMergeStatement (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_MERGE_STATEMENT) != 0; + } + + bool IsIntoCreateStatement (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_CREATE) != 0; + } + + bool IsIntoCreateViewStatement (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_CREATE_VIEW) != 0; + } + + bool IsIntoCreateViewAsStatement (sql_state_t sqlStatesLine) { + return (sqlStatesLine & MASK_INTO_CREATE_VIEW_AS_STATEMENT) != 0; + } + + sql_state_t ForLine(int lineNumber) { + return sqlStatement.ValueAt(lineNumber); + } + + SQLStates() {} + +private : + SparseState sqlStatement; + enum { + MASK_NESTED_CASES = 0x0001FF, + MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT = 0x000200, + MASK_CASE_MERGE_WITHOUT_WHEN_FOUND = 0x000400, + MASK_MERGE_STATEMENT = 0x000800, + MASK_INTO_DECLARE = 0x001000, + MASK_INTO_EXCEPTION = 0x002000, + MASK_INTO_CONDITION = 0x004000, + MASK_IGNORE_WHEN = 0x008000, + MASK_INTO_CREATE = 0x010000, + MASK_INTO_CREATE_VIEW = 0x020000, + MASK_INTO_CREATE_VIEW_AS_STATEMENT = 0x040000 + }; +}; + +// Options used for LexerSQL +struct OptionsSQL { + bool fold; + bool foldAtElse; + bool foldComment; + bool foldCompact; + bool foldOnlyBegin; + bool sqlBackticksIdentifier; + bool sqlNumbersignComment; + bool sqlBackslashEscapes; + bool sqlAllowDottedWord; + OptionsSQL() { + fold = false; + foldAtElse = false; + foldComment = false; + foldCompact = false; + foldOnlyBegin = false; + sqlBackticksIdentifier = false; + sqlNumbersignComment = false; + sqlBackslashEscapes = false; + sqlAllowDottedWord = false; + } +}; + +static const char * const sqlWordListDesc[] = { + "Keywords", + "Database Objects", + "PLDoc", + "SQL*Plus", + "User Keywords 1", + "User Keywords 2", + "User Keywords 3", + "User Keywords 4", + 0 +}; + +struct OptionSetSQL : public OptionSet { + OptionSetSQL() { + DefineProperty("fold", &OptionsSQL::fold); + + DefineProperty("fold.sql.at.else", &OptionsSQL::foldAtElse, + "This option enables SQL folding on a \"ELSE\" and \"ELSIF\" line of an IF statement."); + + DefineProperty("fold.comment", &OptionsSQL::foldComment); + + DefineProperty("fold.compact", &OptionsSQL::foldCompact); + + DefineProperty("fold.sql.only.begin", &OptionsSQL::foldOnlyBegin); + + DefineProperty("lexer.sql.backticks.identifier", &OptionsSQL::sqlBackticksIdentifier); + + DefineProperty("lexer.sql.numbersign.comment", &OptionsSQL::sqlNumbersignComment, + "If \"lexer.sql.numbersign.comment\" property is set to 0 a line beginning with '#' will not be a comment."); + + DefineProperty("sql.backslash.escapes", &OptionsSQL::sqlBackslashEscapes, + "Enables backslash as an escape character in SQL."); + + DefineProperty("lexer.sql.allow.dotted.word", &OptionsSQL::sqlAllowDottedWord, + "Set to 1 to colourise recognized words with dots " + "(recommended for Oracle PL/SQL objects)."); + + DefineWordListSets(sqlWordListDesc); + } +}; + +class LexerSQL : public ILexer { +public : + LexerSQL() {} + + virtual ~LexerSQL() {} + + int SCI_METHOD Version () const { + return lvOriginal; + } + + void SCI_METHOD Release() { + delete this; + } + + const char * SCI_METHOD PropertyNames() { + return osSQL.PropertyNames(); + } + + int SCI_METHOD PropertyType(const char *name) { + return osSQL.PropertyType(name); + } + + const char * SCI_METHOD DescribeProperty(const char *name) { + return osSQL.DescribeProperty(name); + } + + int SCI_METHOD PropertySet(const char *key, const char *val) { + if (osSQL.PropertySet(&options, key, val)) { + return 0; + } + return -1; + } + + const char * SCI_METHOD DescribeWordListSets() { + return osSQL.DescribeWordListSets(); + } + + int SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex (unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); + + void * SCI_METHOD PrivateCall(int, void *) { + return 0; + } + + static ILexer *LexerFactorySQL() { + return new LexerSQL(); + } +private: + bool IsStreamCommentStyle(int style) { + return style == SCE_SQL_COMMENT || + style == SCE_SQL_COMMENTDOC || + style == SCE_SQL_COMMENTDOCKEYWORD || + style == SCE_SQL_COMMENTDOCKEYWORDERROR; + } + + bool IsCommentStyle (int style) { + switch (style) { + case SCE_SQL_COMMENT : + case SCE_SQL_COMMENTDOC : + case SCE_SQL_COMMENTLINE : + case SCE_SQL_COMMENTLINEDOC : + case SCE_SQL_COMMENTDOCKEYWORD : + case SCE_SQL_COMMENTDOCKEYWORDERROR : + return true; + default : + return false; + } + } + + bool IsCommentLine (int line, LexAccessor &styler) { + int pos = styler.LineStart(line); + int eol_pos = styler.LineStart(line + 1) - 1; + for (int i = pos; i + 1 < eol_pos; i++) { + int style = styler.StyleAt(i); + // MySQL needs -- comments to be followed by space or control char + if (style == SCE_SQL_COMMENTLINE && styler.Match(i, "--")) + return true; + else if (!IsASpaceOrTab(styler[i])) + return false; + } + return false; + } + + OptionsSQL options; + OptionSetSQL osSQL; + SQLStates sqlStates; + + WordList keywords1; + WordList keywords2; + WordList kw_pldoc; + WordList kw_sqlplus; + WordList kw_user1; + WordList kw_user2; + WordList kw_user3; + WordList kw_user4; +}; + +int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) { + WordList *wordListN = 0; + switch (n) { + case 0: + wordListN = &keywords1; + break; + case 1: + wordListN = &keywords2; + break; + case 2: + wordListN = &kw_pldoc; + break; + case 3: + wordListN = &kw_sqlplus; + break; + case 4: + wordListN = &kw_user1; + break; + case 5: + wordListN = &kw_user2; + break; + case 6: + wordListN = &kw_user3; + break; + case 7: + wordListN = &kw_user4; + } + int firstModification = -1; + if (wordListN) { + WordList wlNew; + wlNew.Set(wl); + if (*wordListN != wlNew) { + wordListN->Set(wl); + firstModification = 0; + } + } + return firstModification; +} + +void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + LexAccessor styler(pAccess); + StyleContext sc(startPos, length, initStyle, styler); + int styleBeforeDCKeyword = SCE_SQL_DEFAULT; + int offset = 0; + + for (; sc.More(); sc.Forward(), offset++) { + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_SQL_OPERATOR: + sc.SetState(SCE_SQL_DEFAULT); + break; + case SCE_SQL_NUMBER: + // We stop the number definition on non-numerical non-dot non-eE non-sign char + if (!IsANumberChar(sc.ch)) { + sc.SetState(SCE_SQL_DEFAULT); + } + break; + case SCE_SQL_IDENTIFIER: + if (!IsAWordChar(sc.ch, options.sqlAllowDottedWord)) { + int nextState = SCE_SQL_DEFAULT; + char s[1000]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords1.InList(s)) { + sc.ChangeState(SCE_SQL_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_SQL_WORD2); + } else if (kw_sqlplus.InListAbbreviated(s, '~')) { + sc.ChangeState(SCE_SQL_SQLPLUS); + if (strncmp(s, "rem", 3) == 0) { + nextState = SCE_SQL_SQLPLUS_COMMENT; + } else if (strncmp(s, "pro", 3) == 0) { + nextState = SCE_SQL_SQLPLUS_PROMPT; + } + } else if (kw_user1.InList(s)) { + sc.ChangeState(SCE_SQL_USER1); + } else if (kw_user2.InList(s)) { + sc.ChangeState(SCE_SQL_USER2); + } else if (kw_user3.InList(s)) { + sc.ChangeState(SCE_SQL_USER3); + } else if (kw_user4.InList(s)) { + sc.ChangeState(SCE_SQL_USER4); + } + sc.SetState(nextState); + } + break; + case SCE_SQL_QUOTEDIDENTIFIER: + if (sc.ch == 0x60) { + if (sc.chNext == 0x60) { + sc.Forward(); // Ignore it + } else { + sc.ForwardSetState(SCE_SQL_DEFAULT); + } + } + break; + case SCE_SQL_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_SQL_DEFAULT); + } + break; + case SCE_SQL_COMMENTDOC: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_SQL_DEFAULT); + } else if (sc.ch == '@' || sc.ch == '\\') { // 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_SQL_COMMENTDOC; + sc.SetState(SCE_SQL_COMMENTDOCKEYWORD); + } + } + break; + case SCE_SQL_COMMENTLINE: + case SCE_SQL_COMMENTLINEDOC: + case SCE_SQL_SQLPLUS_COMMENT: + case SCE_SQL_SQLPLUS_PROMPT: + if (sc.atLineStart) { + sc.SetState(SCE_SQL_DEFAULT); + } + break; + case SCE_SQL_COMMENTDOCKEYWORD: + if ((styleBeforeDCKeyword == SCE_SQL_COMMENTDOC) && sc.Match('*', '/')) { + sc.ChangeState(SCE_SQL_COMMENTDOCKEYWORDERROR); + sc.Forward(); + sc.ForwardSetState(SCE_SQL_DEFAULT); + } else if (!IsADoxygenChar(sc.ch)) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + if (!isspace(sc.ch) || !kw_pldoc.InList(s + 1)) { + sc.ChangeState(SCE_SQL_COMMENTDOCKEYWORDERROR); + } + sc.SetState(styleBeforeDCKeyword); + } + break; + case SCE_SQL_CHARACTER: + if (options.sqlBackslashEscapes && sc.ch == '\\') { + sc.Forward(); + } else if (sc.ch == '\'') { + if (sc.chNext == '\"') { + sc.Forward(); + } else { + sc.ForwardSetState(SCE_SQL_DEFAULT); + } + } + break; + case SCE_SQL_STRING: + if (sc.ch == '\\') { + // Escape sequence + sc.Forward(); + } else if (sc.ch == '\"') { + if (sc.chNext == '\"') { + sc.Forward(); + } else { + sc.ForwardSetState(SCE_SQL_DEFAULT); + } + } + break; + case SCE_SQL_QOPERATOR: + // Locate the unique Q operator character + sc.Complete(); + char qOperator = 0x00; + for (int styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) { + if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) { + qOperator = styler.SafeGetCharAt(styleStartPos + 2); + break; + } + } + + char qComplement = 0x00; + + if (qOperator == '<') { + qComplement = '>'; + } else if (qOperator == '(') { + qComplement = ')'; + } else if (qOperator == '{') { + qComplement = '}'; + } else if (qOperator == '[') { + qComplement = ']'; + } else { + qComplement = qOperator; + } + + if (sc.Match(qComplement, '\'')) { + sc.Forward(); + sc.ForwardSetState(SCE_SQL_DEFAULT); + } + break; + } + + // Determine if a new state should be entered. + if (sc.state == SCE_SQL_DEFAULT) { + if (sc.Match('q', '\'') || sc.Match('Q', '\'')) { + sc.SetState(SCE_SQL_QOPERATOR); + sc.Forward(); + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_SQL_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_SQL_IDENTIFIER); + } else if (sc.ch == 0x60 && options.sqlBackticksIdentifier) { + sc.SetState(SCE_SQL_QUOTEDIDENTIFIER); + } else if (sc.Match('/', '*')) { + if (sc.Match("/**") || sc.Match("/*!")) { // Support of Doxygen doc. style + sc.SetState(SCE_SQL_COMMENTDOC); + } else { + sc.SetState(SCE_SQL_COMMENT); + } + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('-', '-')) { + // MySQL requires a space or control char after -- + // http://dev.mysql.com/doc/mysql/en/ansi-diff-comments.html + // Perhaps we should enforce that with proper property: + //~ } else if (sc.Match("-- ")) { + sc.SetState(SCE_SQL_COMMENTLINE); + } else if (sc.ch == '#' && options.sqlNumbersignComment) { + sc.SetState(SCE_SQL_COMMENTLINEDOC); + } else if (sc.ch == '\'') { + sc.SetState(SCE_SQL_CHARACTER); + } else if (sc.ch == '\"') { + sc.SetState(SCE_SQL_STRING); + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_SQL_OPERATOR); + } + } + } + sc.Complete(); +} + +void SCI_METHOD LexerSQL::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) { + // Backtrack to previous line in case need to fix its fold status for folding block of single-line comments (i.e. '--'). + int lastNLPos = -1; + // And keep going back until we find an operator ';' followed + // by white-space and/or comments. This will improve folding. + while (--startPos > 0) { + char ch = styler[startPos]; + if (ch == '\n' || (ch == '\r' && styler[startPos + 1] != '\n')) { + lastNLPos = startPos; + } else if (ch == ';' && + styler.StyleAt(startPos) == SCE_SQL_OPERATOR) { + bool isAllClear = true; + for (int tempPos = startPos + 1; + tempPos < lastNLPos; + ++tempPos) { + int tempStyle = styler.StyleAt(tempPos); + if (!IsCommentStyle(tempStyle) + && tempStyle != SCE_SQL_DEFAULT) { + isAllClear = false; + break; + } + } + if (isAllClear) { + startPos = lastNLPos + 1; + break; + } + } + } + lineCurrent = styler.GetLine(startPos); + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16; + } + // And because folding ends at ';', keep going until we find one + // Otherwise if create ... view ... as is split over multiple + // lines the folding won't always update immediately. + unsigned int docLength = styler.Length(); + for (; endPos < docLength; ++endPos) { + if (styler.SafeGetCharAt(endPos) == ';') { + break; + } + } + + int levelNext = levelCurrent; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + bool endFound = false; + bool isUnfoldingIgnored = false; + // this statementFound flag avoids to fold when the statement is on only one line by ignoring ELSE or ELSIF + // eg. "IF condition1 THEN ... ELSIF condition2 THEN ... ELSE ... END IF;" + bool statementFound = false; + sql_state_t sqlStatesCurrentLine = 0; + if (!options.foldOnlyBegin) { + sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent); + } + 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 (atEOL || (!IsCommentStyle(style) && ch == ';')) { + if (endFound) { + //Maybe this is the end of "EXCEPTION" BLOCK (eg. "BEGIN ... EXCEPTION ... END;") + sqlStatesCurrentLine = sqlStates.IntoExceptionBlock(sqlStatesCurrentLine, false); + } + // set endFound and isUnfoldingIgnored to false if EOL is reached or ';' is found + endFound = false; + isUnfoldingIgnored = false; + } + if ((!IsCommentStyle(style) && ch == ';')) { + if (sqlStates.IsIntoMergeStatement(sqlStatesCurrentLine)) { + // This is the end of "MERGE" statement. + if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) + levelNext--; + sqlStatesCurrentLine = sqlStates.IntoMergeStatement(sqlStatesCurrentLine, false); + levelNext--; + } + if (sqlStates.IsIntoSelectStatementOrAssignment(sqlStatesCurrentLine)) + sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, false); + if (sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) { + if (sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine)) { + if (sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) { + levelNext--; + sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, false); + } + sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, false); + } + sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, false); + } + } + if (ch == ':' && chNext == '=' && !IsCommentStyle(style)) + sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, true); + + if (options.foldComment && 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 && (style == SCE_SQL_COMMENTLINE)) { + // MySQL needs -- comments to be followed by space or control char + if ((ch == '-') && (chNext == '-')) { + char chNext2 = styler.SafeGetCharAt(i + 2); + char chNext3 = styler.SafeGetCharAt(i + 3); + if (chNext2 == '{' || chNext3 == '{') { + levelNext++; + } else if (chNext2 == '}' || chNext3 == '}') { + levelNext--; + } + } + } + // Fold block of single-line comments (i.e. '--'). + if (options.foldComment && atEOL && IsCommentLine(lineCurrent, styler)) { + if (!IsCommentLine(lineCurrent - 1, styler) && IsCommentLine(lineCurrent + 1, styler)) + levelNext++; + else if (IsCommentLine(lineCurrent - 1, styler) && !IsCommentLine(lineCurrent + 1, styler)) + levelNext--; + } + if (style == SCE_SQL_OPERATOR) { + if (ch == '(') { + if (levelCurrent > levelNext) + levelCurrent--; + levelNext++; + } else if (ch == ')') { + levelNext--; + } else if ((!options.foldOnlyBegin) && ch == ';') { + sqlStatesCurrentLine = sqlStates.IgnoreWhen(sqlStatesCurrentLine, false); + } + } + // If new keyword (cannot trigger on elseif or nullif, does less tests) + if (style == SCE_SQL_WORD && stylePrev != SCE_SQL_WORD) { + const int MAX_KW_LEN = 9; // Maximum length of folding keywords + char s[MAX_KW_LEN + 2]; + unsigned int j = 0; + for (; j < MAX_KW_LEN + 1; j++) { + if (!iswordchar(styler[i + j])) { + break; + } + s[j] = static_cast(tolower(styler[i + j])); + } + if (j == MAX_KW_LEN + 1) { + // Keyword too long, don't test it + s[0] = '\0'; + } else { + s[j] = '\0'; + } + if (!options.foldOnlyBegin && + strcmp(s, "select") == 0) { + sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, true); + } else if (strcmp(s, "if") == 0) { + if (endFound) { + endFound = false; + if (options.foldOnlyBegin && !isUnfoldingIgnored) { + // this end isn't for begin block, but for if block ("end if;") + // so ignore previous "end" by increment levelNext. + levelNext++; + } + } else { + if (!options.foldOnlyBegin) + sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true); + if (levelCurrent > levelNext) { + // doesn't include this line into the folding block + // because doesn't hide IF (eg "END; IF") + levelCurrent = levelNext; + } + } + } else if (!options.foldOnlyBegin && + strcmp(s, "then") == 0 && + sqlStates.IsIntoCondition(sqlStatesCurrentLine)) { + sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, false); + if (!options.foldOnlyBegin) { + if (levelCurrent > levelNext) { + levelCurrent = levelNext; + } + if (!statementFound) + levelNext++; + + statementFound = true; + } else if (levelCurrent > levelNext) { + // doesn't include this line into the folding block + // because doesn't hide LOOP or CASE (eg "END; LOOP" or "END; CASE") + levelCurrent = levelNext; + } + } else if (strcmp(s, "loop") == 0 || + strcmp(s, "case") == 0) { + if (endFound) { + endFound = false; + if (options.foldOnlyBegin && !isUnfoldingIgnored) { + // this end isn't for begin block, but for loop block ("end loop;") or case block ("end case;") + // so ignore previous "end" by increment levelNext. + levelNext++; + } + if ((!options.foldOnlyBegin) && strcmp(s, "case") == 0) { + sqlStatesCurrentLine = sqlStates.EndCaseBlock(sqlStatesCurrentLine); + if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) + levelNext--; //again for the "end case;" and block when + } + } else if (!options.foldOnlyBegin) { + if (strcmp(s, "case") == 0) { + sqlStatesCurrentLine = sqlStates.BeginCaseBlock(sqlStatesCurrentLine); + sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, true); + } + + if (levelCurrent > levelNext) + levelCurrent = levelNext; + + if (!statementFound) + levelNext++; + + statementFound = true; + } else if (levelCurrent > levelNext) { + // doesn't include this line into the folding block + // because doesn't hide LOOP or CASE (eg "END; LOOP" or "END; CASE") + levelCurrent = levelNext; + } + } else if ((!options.foldOnlyBegin) && ( + // folding for ELSE and ELSIF block only if foldAtElse is set + // and IF or CASE aren't on only one line with ELSE or ELSIF (with flag statementFound) + options.foldAtElse && !statementFound) && strcmp(s, "elsif") == 0) { + sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true); + levelCurrent--; + levelNext--; + } else if ((!options.foldOnlyBegin) && ( + // folding for ELSE and ELSIF block only if foldAtElse is set + // and IF or CASE aren't on only one line with ELSE or ELSIF (with flag statementFound) + options.foldAtElse && !statementFound) && strcmp(s, "else") == 0) { + // prevent also ELSE is on the same line (eg. "ELSE ... END IF;") + statementFound = true; + if (sqlStates.IsIntoCaseBlock(sqlStatesCurrentLine) && sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) { + sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, false); + levelNext++; + } else { + // we are in same case "} ELSE {" in C language + levelCurrent--; + } + } else if (strcmp(s, "begin") == 0) { + levelNext++; + sqlStatesCurrentLine = sqlStates.IntoDeclareBlock(sqlStatesCurrentLine, false); + } else if ((strcmp(s, "end") == 0) || + // SQL Anywhere permits IF ... ELSE ... ENDIF + // will only be active if "endif" appears in the + // keyword list. + (strcmp(s, "endif") == 0)) { + endFound = true; + levelNext--; + if (sqlStates.IsIntoSelectStatementOrAssignment(sqlStatesCurrentLine) && !sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) + levelNext--; + if (levelNext < SC_FOLDLEVELBASE) { + levelNext = SC_FOLDLEVELBASE; + isUnfoldingIgnored = true; + } + } else if ((!options.foldOnlyBegin) && + strcmp(s, "when") == 0 && + !sqlStates.IsIgnoreWhen(sqlStatesCurrentLine) && + !sqlStates.IsIntoExceptionBlock(sqlStatesCurrentLine) && ( + sqlStates.IsIntoCaseBlock(sqlStatesCurrentLine) || + sqlStates.IsIntoMergeStatement(sqlStatesCurrentLine) + ) + ) { + sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true); + + // Don't foldind when CASE and WHEN are on the same line (with flag statementFound) (eg. "CASE selector WHEN expression1 THEN sequence_of_statements1;\n") + // and same way for MERGE statement. + if (!statementFound) { + if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) { + levelCurrent--; + levelNext--; + } + sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, false); + } + } else if ((!options.foldOnlyBegin) && strcmp(s, "exit") == 0) { + sqlStatesCurrentLine = sqlStates.IgnoreWhen(sqlStatesCurrentLine, true); + } else if ((!options.foldOnlyBegin) && !sqlStates.IsIntoDeclareBlock(sqlStatesCurrentLine) && strcmp(s, "exception") == 0) { + sqlStatesCurrentLine = sqlStates.IntoExceptionBlock(sqlStatesCurrentLine, true); + } else if ((!options.foldOnlyBegin) && + (strcmp(s, "declare") == 0 || + strcmp(s, "function") == 0 || + strcmp(s, "procedure") == 0 || + strcmp(s, "package") == 0)) { + sqlStatesCurrentLine = sqlStates.IntoDeclareBlock(sqlStatesCurrentLine, true); + } else if ((!options.foldOnlyBegin) && + strcmp(s, "merge") == 0) { + sqlStatesCurrentLine = sqlStates.IntoMergeStatement(sqlStatesCurrentLine, true); + sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, true); + levelNext++; + statementFound = true; + } else if ((!options.foldOnlyBegin) && + strcmp(s, "create") == 0) { + sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, true); + } else if ((!options.foldOnlyBegin) && + strcmp(s, "view") == 0 && + sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) { + sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, true); + } else if ((!options.foldOnlyBegin) && + strcmp(s, "as") == 0 && + sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine) && + ! sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) { + sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, true); + levelNext++; + } + } + if (atEOL) { + 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; + visibleChars = 0; + statementFound = false; + if (!options.foldOnlyBegin) + sqlStates.Set(lineCurrent, sqlStatesCurrentLine); + } + if (!isspacechar(ch)) { + visibleChars++; + } + } +} + +LexerModule lmSQL(SCLEX_SQL, LexerSQL::LexerFactorySQL, "sql", sqlWordListDesc); diff --git a/libs/qscintilla/lexers/License.txt b/libs/qscintilla/lexers/License.txt new file mode 100644 index 000000000..cbe25b2fc --- /dev/null +++ b/libs/qscintilla/lexers/License.txt @@ -0,0 +1,20 @@ +License for Scintilla and SciTE + +Copyright 1998-2003 by Neil Hodgson + +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. + +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/libs/qscintilla/lexlib/Accessor.cpp b/libs/qscintilla/lexlib/Accessor.cpp new file mode 100644 index 000000000..f67737d4d --- /dev/null +++ b/libs/qscintilla/lexlib/Accessor.cpp @@ -0,0 +1,79 @@ +// Scintilla source code edit control +/** @file KeyWords.cxx + ** Colourise for particular languages. + **/ +// Copyright 1998-2002 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 "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +Accessor::Accessor(IDocument *pAccess_, PropSetSimple *pprops_) : LexAccessor(pAccess_), pprops(pprops_) { +} + +int Accessor::GetPropertyInt(const char *key, int defaultValue) const { + return pprops->GetInt(key, defaultValue); +} + +int Accessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { + int end = Length(); + int spaceFlags = 0; + + // Determines the indentation level of the current line and also checks for consistent + // indentation compared to the previous line. + // Indentation is judged consistent when the indentation whitespace of each line lines + // the same or the indentation of one line is a prefix of the other. + + int pos = LineStart(line); + char ch = (*this)[pos]; + int indent = 0; + bool inPrevPrefix = line > 0; + int posPrev = inPrevPrefix ? LineStart(line-1) : 0; + while ((ch == ' ' || ch == '\t') && (pos < end)) { + if (inPrevPrefix) { + char chPrev = (*this)[posPrev++]; + if (chPrev == ' ' || chPrev == '\t') { + if (chPrev != ch) + spaceFlags |= wsInconsistent; + } else { + inPrevPrefix = false; + } + } + if (ch == ' ') { + spaceFlags |= wsSpace; + indent++; + } else { // Tab + spaceFlags |= wsTab; + if (spaceFlags & wsSpace) + spaceFlags |= wsSpaceTab; + indent = (indent / 8 + 1) * 8; + } + ch = (*this)[++pos]; + } + + *flags = spaceFlags; + indent += SC_FOLDLEVELBASE; + // if completely empty line or the start of a comment... + if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || + (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) + return indent | SC_FOLDLEVELWHITEFLAG; + else + return indent; +} diff --git a/libs/qscintilla/lexlib/Accessor.h b/libs/qscintilla/lexlib/Accessor.h new file mode 100644 index 000000000..1bb86c53b --- /dev/null +++ b/libs/qscintilla/lexlib/Accessor.h @@ -0,0 +1,35 @@ +// Scintilla source code edit control +/** @file Accessor.h + ** Interfaces 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 ACCESSOR_H +#define ACCESSOR_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 }; + +class Accessor; +class WordList; +class PropSetSimple; + +typedef bool (*PFNIsCommentLeader)(Accessor &styler, int pos, int len); + +class Accessor : public LexAccessor { +public: + PropSetSimple *pprops; + Accessor(IDocument *pAccess_, PropSetSimple *pprops_); + int GetPropertyInt(const char *, int defaultValue=0) const; + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/CharacterCategory.cpp b/libs/qscintilla/lexlib/CharacterCategory.cpp new file mode 100644 index 000000000..2be46c013 --- /dev/null +++ b/libs/qscintilla/lexlib/CharacterCategory.cpp @@ -0,0 +1,3304 @@ +// Scintilla source code edit control +/** @file CharacterCategory.cxx + ** Returns the Unicode general category of a character. + ** Table automatically regenerated by scripts/GenerateCharacterCategory.py + ** Should only be rarely regenerated for new versions of Unicode. + **/ +// Copyright 2013 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include "StringCopy.h" +#include "CharacterCategory.h" + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +namespace { + // Use an unnamed namespace to protect the declarations from name conflicts + +const int catRanges[] = { +//++Autogenerated -- start of section automatically generated +// Created with Python 3.3.0, Unicode 6.1.0 +25, +1046, +1073, +1171, +1201, +1293, +1326, +1361, +1394, +1425, +1452, +1489, +1544, +1873, +1938, +2033, +2080, +2925, +2961, +2990, +3028, +3051, +3092, +3105, +3949, +3986, +4014, +4050, +4089, +5142, +5169, +5203, +5333, +5361, +5396, +5429, +5444, +5487, +5522, +5562, +5589, +5620, +5653, +5682, +5706, +5780, +5793, +5841, +5908, +5930, +5956, +6000, +6026, +6129, +6144, +6898, +6912, +7137, +7922, +7937, +8192, +8225, +8256, +8289, +8320, +8353, +8384, +8417, +8448, +8481, +8512, +8545, +8576, +8609, +8640, +8673, +8704, +8737, +8768, +8801, +8832, +8865, +8896, +8929, +8960, +8993, +9024, +9057, +9088, +9121, +9152, +9185, +9216, +9249, +9280, +9313, +9344, +9377, +9408, +9441, +9472, +9505, +9536, +9569, +9600, +9633, +9664, +9697, +9728, +9761, +9792, +9825, +9856, +9889, +9920, +9953, +10016, +10049, +10080, +10113, +10144, +10177, +10208, +10241, +10272, +10305, +10336, +10369, +10400, +10433, +10464, +10497, +10560, +10593, +10624, +10657, +10688, +10721, +10752, +10785, +10816, +10849, +10880, +10913, +10944, +10977, +11008, +11041, +11072, +11105, +11136, +11169, +11200, +11233, +11264, +11297, +11328, +11361, +11392, +11425, +11456, +11489, +11520, +11553, +11584, +11617, +11648, +11681, +11712, +11745, +11776, +11809, +11840, +11873, +11904, +11937, +11968, +12001, +12032, +12097, +12128, +12161, +12192, +12225, +12320, +12385, +12416, +12449, +12480, +12545, +12576, +12673, +12736, +12865, +12896, +12961, +12992, +13089, +13184, +13249, +13280, +13345, +13376, +13409, +13440, +13473, +13504, +13569, +13600, +13633, +13696, +13729, +13760, +13825, +13856, +13953, +13984, +14017, +14048, +14113, +14180, +14208, +14241, +14340, +14464, +14498, +14529, +14560, +14594, +14625, +14656, +14690, +14721, +14752, +14785, +14816, +14849, +14880, +14913, +14944, +14977, +15008, +15041, +15072, +15105, +15136, +15169, +15200, +15233, +15296, +15329, +15360, +15393, +15424, +15457, +15488, +15521, +15552, +15585, +15616, +15649, +15680, +15713, +15744, +15777, +15808, +15841, +15904, +15938, +15969, +16000, +16033, +16064, +16161, +16192, +16225, +16256, +16289, +16320, +16353, +16384, +16417, +16448, +16481, +16512, +16545, +16576, +16609, +16640, +16673, +16704, +16737, +16768, +16801, +16832, +16865, +16896, +16929, +16960, +16993, +17024, +17057, +17088, +17121, +17152, +17185, +17216, +17249, +17280, +17313, +17344, +17377, +17408, +17441, +17472, +17505, +17536, +17569, +17600, +17633, +17664, +17697, +17728, +17761, +17792, +17825, +17856, +17889, +17920, +17953, +17984, +18017, +18240, +18305, +18336, +18401, +18464, +18497, +18528, +18657, +18688, +18721, +18752, +18785, +18816, +18849, +18880, +18913, +21124, +21153, +22019, +22612, +22723, +23124, +23555, +23732, +23939, +23988, +24003, +24052, +24581, +28160, +28193, +28224, +28257, +28291, +28340, +28352, +28385, +28445, +28483, +28513, +28625, +28669, +28820, +28864, +28913, +28928, +29053, +29056, +29117, +29120, +29185, +29216, +29789, +29792, +30081, +31200, +31233, +31296, +31393, +31488, +31521, +31552, +31585, +31616, +31649, +31680, +31713, +31744, +31777, +31808, +31841, +31872, +31905, +31936, +31969, +32000, +32033, +32064, +32097, +32128, +32161, +32192, +32225, +32384, +32417, +32466, +32480, +32513, +32544, +32609, +32672, +34305, +35840, +35873, +35904, +35937, +35968, +36001, +36032, +36065, +36096, +36129, +36160, +36193, +36224, +36257, +36288, +36321, +36352, +36385, +36416, +36449, +36480, +36513, +36544, +36577, +36608, +36641, +36672, +36705, +36736, +36769, +36800, +36833, +36864, +36897, +36949, +36965, +37127, +37184, +37217, +37248, +37281, +37312, +37345, +37376, +37409, +37440, +37473, +37504, +37537, +37568, +37601, +37632, +37665, +37696, +37729, +37760, +37793, +37824, +37857, +37888, +37921, +37952, +37985, +38016, +38049, +38080, +38113, +38144, +38177, +38208, +38241, +38272, +38305, +38336, +38369, +38400, +38433, +38464, +38497, +38528, +38561, +38592, +38625, +38656, +38689, +38720, +38753, +38784, +38817, +38848, +38881, +38912, +38977, +39008, +39041, +39072, +39105, +39136, +39169, +39200, +39233, +39264, +39297, +39328, +39361, +39424, +39457, +39488, +39521, +39552, +39585, +39616, +39649, +39680, +39713, +39744, +39777, +39808, +39841, +39872, +39905, +39936, +39969, +40000, +40033, +40064, +40097, +40128, +40161, +40192, +40225, +40256, +40289, +40320, +40353, +40384, +40417, +40448, +40481, +40512, +40545, +40576, +40609, +40640, +40673, +40704, +40737, +40768, +40801, +40832, +40865, +40896, +40929, +40960, +40993, +41024, +41057, +41088, +41121, +41152, +41185, +41216, +41249, +41280, +41313, +41344, +41377, +41408, +41441, +41472, +41505, +41536, +41569, +41600, +41633, +41664, +41697, +41728, +41761, +41792, +41825, +41856, +41889, +41920, +41953, +41984, +42017, +42048, +42081, +42112, +42145, +42176, +42209, +42269, +42528, +43773, +43811, +43857, +44061, +44065, +45341, +45361, +45388, +45437, +45555, +45597, +45605, +47052, +47077, +47121, +47141, +47217, +47237, +47313, +47333, +47389, +47620, +48509, +48644, +48753, +48829, +49178, +49341, +49362, +49457, +49523, +49553, +49621, +49669, +50033, +50077, +50129, +50180, +51203, +51236, +51557, +52232, +52561, +52676, +52741, +52772, +55953, +55972, +56005, +56250, +56277, +56293, +56483, +56549, +56629, +56645, +56772, +56840, +57156, +57269, +57316, +57361, +57821, +57850, +57860, +57893, +57924, +58885, +59773, +59812, +62661, +63012, +63069, +63496, +63812, +64869, +65155, +65237, +65265, +65347, +65405, +65540, +66245, +66371, +66405, +66691, +66725, +66819, +66853, +67037, +67089, +67581, +67588, +68389, +68509, +68561, +68605, +70660, +70717, +70724, +71101, +72837, +73725, +73733, +73830, +73860, +75589, +75622, +75653, +75684, +75718, +75813, +76070, +76197, +76230, +76292, +76325, +76548, +76869, +76945, +77000, +77329, +77347, +77380, +77597, +77604, +77853, +77861, +77894, +77981, +77988, +78269, +78308, +78397, +78436, +79165, +79172, +79421, +79428, +79485, +79556, +79709, +79749, +79780, +79814, +79909, +80061, +80102, +80189, +80230, +80293, +80324, +80381, +80614, +80669, +80772, +80861, +80868, +80965, +81053, +81096, +81412, +81491, +81546, +81749, +81779, +81821, +81957, +82022, +82077, +82084, +82301, +82404, +82493, +82532, +83261, +83268, +83517, +83524, +83613, +83620, +83709, +83716, +83805, +83845, +83901, +83910, +84005, +84093, +84197, +84285, +84325, +84445, +84517, +84573, +84772, +84925, +84932, +84989, +85192, +85509, +85572, +85669, +85725, +86053, +86118, +86173, +86180, +86493, +86500, +86621, +86628, +87357, +87364, +87613, +87620, +87709, +87716, +87901, +87941, +87972, +88006, +88101, +88285, +88293, +88358, +88413, +88422, +88485, +88541, +88580, +88637, +89092, +89157, +89245, +89288, +89617, +89651, +89693, +90149, +90182, +90269, +90276, +90557, +90596, +90685, +90724, +91453, +91460, +91709, +91716, +91805, +91812, +91997, +92037, +92068, +92102, +92133, +92166, +92197, +92349, +92390, +92477, +92518, +92581, +92637, +92869, +92902, +92957, +93060, +93149, +93156, +93253, +93341, +93384, +93717, +93732, +93770, +93981, +94277, +94308, +94365, +94372, +94589, +94660, +94781, +94788, +94941, +95012, +95101, +95108, +95165, +95172, +95261, +95332, +95421, +95492, +95613, +95684, +96093, +96198, +96261, +96294, +96381, +96454, +96573, +96582, +96677, +96733, +96772, +96829, +96998, +97053, +97480, +97802, +97909, +98099, +98133, +98173, +98342, +98461, +98468, +98749, +98756, +98877, +98884, +99645, +99652, +99997, +100004, +100189, +100260, +100293, +100390, +100541, +100549, +100669, +100677, +100829, +101029, +101117, +101124, +101213, +101380, +101445, +101533, +101576, +101917, +102154, +102389, +102429, +102470, +102557, +102564, +102845, +102852, +102973, +102980, +103741, +103748, +104093, +104100, +104285, +104325, +104356, +104390, +104421, +104454, +104637, +104645, +104678, +104765, +104774, +104837, +104925, +105126, +105213, +105412, +105469, +105476, +105541, +105629, +105672, +106013, +106020, +106109, +106566, +106653, +106660, +106941, +106948, +107069, +107076, +108413, +108452, +108486, +108581, +108733, +108742, +108861, +108870, +108965, +108996, +109053, +109286, +109341, +109572, +109637, +109725, +109768, +110090, +110301, +110389, +110404, +110621, +110662, +110749, +110756, +111357, +111428, +112221, +112228, +112541, +112548, +112605, +112644, +112893, +112965, +113021, +113126, +113221, +113341, +113349, +113405, +113414, +113693, +114246, +114321, +114365, +114724, +116261, +116292, +116357, +116605, +116723, +116740, +116931, +116965, +117233, +117256, +117585, +117661, +118820, +118909, +118916, +118973, +119012, +119101, +119108, +119165, +119204, +119261, +119428, +119581, +119588, +119837, +119844, +119965, +119972, +120029, +120036, +120093, +120132, +120221, +120228, +120357, +120388, +120453, +120669, +120677, +120740, +120797, +120836, +121021, +121027, +121085, +121093, +121309, +121352, +121693, +121732, +121885, +122884, +122933, +123025, +123509, +123537, +123573, +123653, +123733, +123912, +124234, +124565, +124581, +124629, +124645, +124693, +124709, +124749, +124782, +124813, +124846, +124870, +124932, +125213, +125220, +126397, +126501, +126950, +126981, +127153, +127173, +127236, +127397, +127773, +127781, +128957, +128981, +129221, +129269, +129469, +129493, +129553, +129717, +129841, +129917, +131076, +132454, +132517, +132646, +132677, +132870, +132901, +132966, +133029, +133092, +133128, +133457, +133636, +133830, +133893, +133956, +134085, +134180, +134214, +134308, +134374, +134596, +134693, +134820, +135237, +135270, +135333, +135398, +135589, +135620, +135654, +135688, +136006, +136101, +136149, +136192, +137437, +137440, +137501, +137632, +137693, +137732, +139121, +139139, +139172, +149821, +149828, +149981, +150020, +150269, +150276, +150333, +150340, +150493, +150532, +151869, +151876, +152029, +152068, +153149, +153156, +153309, +153348, +153597, +153604, +153661, +153668, +153821, +153860, +154365, +154372, +156221, +156228, +156381, +156420, +158589, +158629, +158737, +159018, +159677, +159748, +160277, +160605, +160772, +163517, +163852, +163876, +183729, +183780, +184342, +184356, +185197, +185230, +185277, +185348, +187761, +187849, +187965, +188420, +188861, +188868, +188997, +189117, +189444, +190021, +190129, +190205, +190468, +191045, +191133, +191492, +191933, +191940, +192061, +192069, +192157, +192516, +194181, +194246, +194277, +194502, +194757, +194790, +194853, +195217, +195299, +195345, +195443, +195460, +195493, +195549, +195592, +195933, +196106, +196445, +196625, +196812, +196849, +196965, +197078, +197117, +197128, +197469, +197636, +198755, +198788, +200477, +200708, +202021, +202052, +202109, +202244, +204509, +204804, +205757, +205829, +205926, +206053, +206118, +206237, +206342, +206405, +206438, +206629, +206749, +206869, +206909, +206993, +207048, +207364, +208349, +208388, +208573, +208900, +210333, +210438, +210980, +211206, +211293, +211464, +211786, +211837, +211925, +212996, +213733, +213798, +213917, +213969, +214020, +215718, +215749, +215782, +215813, +216061, +216069, +216102, +216133, +216166, +216229, +216486, +216677, +217021, +217061, +217096, +217437, +217608, +217949, +218129, +218339, +218385, +218589, +221189, +221318, +221348, +222853, +222886, +222917, +223078, +223109, +223142, +223301, +223334, +223396, +223645, +223752, +224081, +224309, +224613, +224917, +225213, +225285, +225350, +225380, +226342, +226373, +226502, +226565, +226630, +226661, +226694, +226756, +226824, +227140, +228549, +228582, +228613, +228678, +228773, +228806, +228837, +228934, +229021, +229265, +229380, +230534, +230789, +231046, +231109, +231197, +231281, +231432, +231773, +231844, +231944, +232260, +233219, +233425, +233501, +235537, +235805, +236037, +236145, +236165, +236582, +236613, +236836, +236965, +236996, +237126, +237189, +237220, +237309, +237569, +238979, +240993, +241411, +241441, +242531, +243717, +244989, +245637, +245760, +245793, +245824, +245857, +245888, +245921, +245952, +245985, +246016, +246049, +246080, +246113, +246144, +246177, +246208, +246241, +246272, +246305, +246336, +246369, +246400, +246433, +246464, +246497, +246528, +246561, +246592, +246625, +246656, +246689, +246720, +246753, +246784, +246817, +246848, +246881, +246912, +246945, +246976, +247009, +247040, +247073, +247104, +247137, +247168, +247201, +247232, +247265, +247296, +247329, +247360, +247393, +247424, +247457, +247488, +247521, +247552, +247585, +247616, +247649, +247680, +247713, +247744, +247777, +247808, +247841, +247872, +247905, +247936, +247969, +248000, +248033, +248064, +248097, +248128, +248161, +248192, +248225, +248256, +248289, +248320, +248353, +248384, +248417, +248448, +248481, +248512, +248545, +248576, +248609, +248640, +248673, +248704, +248737, +248768, +248801, +248832, +248865, +248896, +248929, +248960, +248993, +249024, +249057, +249088, +249121, +249152, +249185, +249216, +249249, +249280, +249313, +249344, +249377, +249408, +249441, +249472, +249505, +249536, +249569, +249600, +249633, +249664, +249697, +249728, +249761, +249792, +249825, +249856, +249889, +249920, +249953, +249984, +250017, +250048, +250081, +250112, +250145, +250176, +250209, +250240, +250273, +250304, +250337, +250368, +250401, +250432, +250465, +250496, +250529, +250816, +250849, +250880, +250913, +250944, +250977, +251008, +251041, +251072, +251105, +251136, +251169, +251200, +251233, +251264, +251297, +251328, +251361, +251392, +251425, +251456, +251489, +251520, +251553, +251584, +251617, +251648, +251681, +251712, +251745, +251776, +251809, +251840, +251873, +251904, +251937, +251968, +252001, +252032, +252065, +252096, +252129, +252160, +252193, +252224, +252257, +252288, +252321, +252352, +252385, +252416, +252449, +252480, +252513, +252544, +252577, +252608, +252641, +252672, +252705, +252736, +252769, +252800, +252833, +252864, +252897, +252928, +252961, +252992, +253025, +253056, +253089, +253120, +253153, +253184, +253217, +253248, +253281, +253312, +253345, +253376, +253409, +253440, +253473, +253504, +253537, +253568, +253601, +253632, +253665, +253696, +253729, +253760, +253793, +253824, +253857, +253888, +253921, +254208, +254465, +254685, +254720, +254941, +254977, +255232, +255489, +255744, +256001, +256221, +256256, +256477, +256513, +256797, +256800, +256861, +256864, +256925, +256928, +256989, +256992, +257025, +257280, +257537, +258013, +258049, +258306, +258561, +258818, +259073, +259330, +259585, +259773, +259777, +259840, +259970, +260020, +260033, +260084, +260161, +260285, +260289, +260352, +260482, +260532, +260609, +260765, +260801, +260864, +261021, +261044, +261121, +261376, +261556, +261661, +261697, +261821, +261825, +261888, +262018, +262068, +262141, +262166, +262522, +262668, +262865, +262927, +262960, +262989, +263023, +263088, +263117, +263151, +263185, +263447, +263480, +263514, +263670, +263697, +263983, +264016, +264049, +264171, +264241, +264338, +264365, +264398, +264433, +264786, +264817, +264843, +264881, +265206, +265242, +265405, +265562, +265738, +265763, +265821, +265866, +266066, +266157, +266190, +266211, +266250, +266578, +266669, +266702, +266749, +266755, +267197, +267283, +268125, +268805, +269223, +269349, +269383, +269477, +269885, +270357, +270400, +270453, +270560, +270613, +270657, +270688, +270785, +270848, +270945, +270997, +271008, +271061, +271122, +271136, +271317, +271488, +271541, +271552, +271605, +271616, +271669, +271680, +271829, +271841, +271872, +272001, +272036, +272161, +272213, +272257, +272320, +272402, +272544, +272577, +272725, +272754, +272789, +272833, +272885, +272906, +273417, +274528, +274561, +274601, +274730, +274781, +274962, +275125, +275282, +275349, +275474, +275509, +275570, +275605, +275666, +275701, +275922, +275957, +276946, +277013, +277074, +277109, +277138, +277173, +278162, +286741, +286994, +287125, +287762, +287829, +288045, +288078, +288117, +290706, +290741, +291698, +292501, +293778, +293973, +294557, +294933, +296189, +296981, +297341, +297994, +299925, +302410, +303125, +308978, +309013, +309298, +309333, +311058, +311317, +314866, +314901, +319517, +319541, +322829, +322862, +322893, +322926, +322957, +322990, +323021, +323054, +323085, +323118, +323149, +323182, +323213, +323246, +323274, +324245, +325650, +325805, +325838, +325874, +326861, +326894, +326925, +326958, +326989, +327022, +327053, +327086, +327117, +327150, +327186, +327701, +335890, +340077, +340110, +340141, +340174, +340205, +340238, +340269, +340302, +340333, +340366, +340397, +340430, +340461, +340494, +340525, +340558, +340589, +340622, +340653, +340686, +340717, +340750, +340786, +342797, +342830, +342861, +342894, +342930, +343949, +343982, +344018, +352277, +353810, +354485, +354546, +354749, +354837, +355165, +360448, +361981, +361985, +363517, +363520, +363553, +363584, +363681, +363744, +363777, +363808, +363841, +363872, +363905, +363936, +364065, +364096, +364129, +364192, +364225, +364419, +364480, +364577, +364608, +364641, +364672, +364705, +364736, +364769, +364800, +364833, +364864, +364897, +364928, +364961, +364992, +365025, +365056, +365089, +365120, +365153, +365184, +365217, +365248, +365281, +365312, +365345, +365376, +365409, +365440, +365473, +365504, +365537, +365568, +365601, +365632, +365665, +365696, +365729, +365760, +365793, +365824, +365857, +365888, +365921, +365952, +365985, +366016, +366049, +366080, +366113, +366144, +366177, +366208, +366241, +366272, +366305, +366336, +366369, +366400, +366433, +366464, +366497, +366528, +366561, +366592, +366625, +366656, +366689, +366720, +366753, +366784, +366817, +366848, +366881, +366912, +366945, +366976, +367009, +367040, +367073, +367104, +367137, +367168, +367201, +367232, +367265, +367296, +367329, +367360, +367393, +367424, +367457, +367488, +367521, +367552, +367585, +367616, +367649, +367680, +367713, +367797, +367968, +368001, +368032, +368065, +368101, +368192, +368225, +368285, +368433, +368554, +368593, +368641, +369885, +369889, +369949, +370081, +370141, +370180, +371997, +372195, +372241, +372285, +372709, +372740, +373501, +373764, +374013, +374020, +374269, +374276, +374525, +374532, +374781, +374788, +375037, +375044, +375293, +375300, +375549, +375556, +375805, +375813, +376849, +376911, +376944, +376975, +377008, +377041, +377135, +377168, +377201, +377231, +377264, +377297, +377580, +377617, +377676, +377713, +377743, +377776, +377809, +377871, +377904, +377933, +377966, +377997, +378030, +378061, +378094, +378125, +378158, +378193, +378339, +378385, +378700, +378781, +380949, +381789, +381813, +384669, +385045, +391901, +392725, +393117, +393238, +393265, +393365, +393379, +393412, +393449, +393485, +393518, +393549, +393582, +393613, +393646, +393677, +393710, +393741, +393774, +393813, +393869, +393902, +393933, +393966, +393997, +394030, +394061, +394094, +394124, +394157, +394190, +394261, +394281, +394565, +394694, +394764, +394787, +394965, +395017, +395107, +395140, +395185, +395221, +395293, +395300, +398077, +398117, +398196, +398243, +398308, +398348, +398372, +401265, +401283, +401380, +401437, +401572, +402909, +402980, +406013, +406037, +406090, +406229, +406532, +407421, +407573, +408733, +409092, +409621, +410621, +410634, +410965, +411914, +412181, +412202, +412693, +413706, +414037, +415274, +415765, +417789, +417813, +425988, +636637, +636949, +638980, +1309117, +1310724, +1311395, +1311428, +1348029, +1348117, +1349885, +1350148, +1351427, +1351633, +1351684, +1360259, +1360305, +1360388, +1360904, +1361220, +1361309, +1361920, +1361953, +1361984, +1362017, +1362048, +1362081, +1362112, +1362145, +1362176, +1362209, +1362240, +1362273, +1362304, +1362337, +1362368, +1362401, +1362432, +1362465, +1362496, +1362529, +1362560, +1362593, +1362624, +1362657, +1362688, +1362721, +1362752, +1362785, +1362816, +1362849, +1362880, +1362913, +1362944, +1362977, +1363008, +1363041, +1363072, +1363105, +1363136, +1363169, +1363200, +1363233, +1363264, +1363297, +1363328, +1363361, +1363396, +1363429, +1363463, +1363569, +1363589, +1363921, +1363939, +1363968, +1364001, +1364032, +1364065, +1364096, +1364129, +1364160, +1364193, +1364224, +1364257, +1364288, +1364321, +1364352, +1364385, +1364416, +1364449, +1364480, +1364513, +1364544, +1364577, +1364608, +1364641, +1364672, +1364705, +1364765, +1364965, +1364996, +1367241, +1367557, +1367633, +1367837, +1368084, +1368803, +1369108, +1369152, +1369185, +1369216, +1369249, +1369280, +1369313, +1369344, +1369377, +1369408, +1369441, +1369472, +1369505, +1369536, +1369569, +1369664, +1369697, +1369728, +1369761, +1369792, +1369825, +1369856, +1369889, +1369920, +1369953, +1369984, +1370017, +1370048, +1370081, +1370112, +1370145, +1370176, +1370209, +1370240, +1370273, +1370304, +1370337, +1370368, +1370401, +1370432, +1370465, +1370496, +1370529, +1370560, +1370593, +1370624, +1370657, +1370688, +1370721, +1370752, +1370785, +1370816, +1370849, +1370880, +1370913, +1370944, +1370977, +1371008, +1371041, +1371072, +1371105, +1371136, +1371169, +1371200, +1371233, +1371264, +1371297, +1371328, +1371361, +1371392, +1371425, +1371456, +1371489, +1371520, +1371553, +1371584, +1371617, +1371651, +1371681, +1371936, +1371969, +1372000, +1372033, +1372064, +1372129, +1372160, +1372193, +1372224, +1372257, +1372288, +1372321, +1372352, +1372385, +1372419, +1372468, +1372512, +1372545, +1372576, +1372609, +1372669, +1372672, +1372705, +1372736, +1372769, +1372829, +1373184, +1373217, +1373248, +1373281, +1373312, +1373345, +1373376, +1373409, +1373440, +1373473, +1373504, +1373565, +1376003, +1376065, +1376100, +1376325, +1376356, +1376453, +1376484, +1376613, +1376644, +1377382, +1377445, +1377510, +1377557, +1377693, +1377802, +1378005, +1378067, +1378101, +1378141, +1378308, +1379985, +1380125, +1380358, +1380420, +1382022, +1382533, +1382589, +1382865, +1382920, +1383261, +1383429, +1384004, +1384209, +1384292, +1384349, +1384456, +1384772, +1385669, +1385937, +1385988, +1386725, +1387078, +1387165, +1387505, +1387524, +1388477, +1388549, +1388646, +1388676, +1390181, +1390214, +1390277, +1390406, +1390469, +1390502, +1390641, +1391069, +1391075, +1391112, +1391453, +1391569, +1391645, +1392644, +1393957, +1394150, +1394213, +1394278, +1394341, +1394429, +1394692, +1394789, +1394820, +1395077, +1395110, +1395165, +1395208, +1395549, +1395601, +1395716, +1396227, +1396260, +1396469, +1396548, +1396582, +1396637, +1396740, +1398277, +1398308, +1398341, +1398436, +1398501, +1398564, +1398725, +1398788, +1398821, +1398852, +1398909, +1399652, +1399715, +1399761, +1399812, +1400166, +1400197, +1400262, +1400337, +1400388, +1400419, +1400486, +1400517, +1400573, +1400868, +1401085, +1401124, +1401341, +1401380, +1401597, +1401860, +1402109, +1402116, +1402365, +1406980, +1408102, +1408165, +1408198, +1408261, +1408294, +1408369, +1408390, +1408421, +1408477, +1408520, +1408861, +1409028, +1766557, +1766916, +1767677, +1767780, +1769373, +1769499, +1835036, +2039812, +2051549, +2051588, +2055005, +2056193, +2056445, +2056801, +2056989, +2057124, +2057157, +2057188, +2057522, +2057540, +2057981, +2057988, +2058173, +2058180, +2058237, +2058244, +2058333, +2058340, +2058429, +2058436, +2061908, +2062429, +2062948, +2074573, +2074606, +2074653, +2075140, +2077213, +2077252, +2079005, +2080260, +2080659, +2080693, +2080733, +2080773, +2081297, +2081517, +2081550, +2081585, +2081629, +2081797, +2082045, +2082321, +2082348, +2082411, +2082477, +2082510, +2082541, +2082574, +2082605, +2082638, +2082669, +2082702, +2082733, +2082766, +2082797, +2082830, +2082861, +2082894, +2082925, +2082958, +2082993, +2083053, +2083086, +2083121, +2083243, +2083345, +2083453, +2083473, +2083596, +2083629, +2083662, +2083693, +2083726, +2083757, +2083790, +2083825, +2083922, +2083948, +2083986, +2084093, +2084113, +2084147, +2084177, +2084253, +2084356, +2084541, +2084548, +2088893, +2088954, +2088989, +2089009, +2089107, +2089137, +2089229, +2089262, +2089297, +2089330, +2089361, +2089388, +2089425, +2089480, +2089809, +2089874, +2089969, +2090016, +2090861, +2090897, +2090926, +2090964, +2090987, +2091028, +2091041, +2091885, +2091922, +2091950, +2091986, +2092013, +2092046, +2092081, +2092109, +2092142, +2092177, +2092228, +2092547, +2092580, +2094019, +2094084, +2095101, +2095172, +2095389, +2095428, +2095645, +2095684, +2095901, +2095940, +2096061, +2096147, +2096210, +2096244, +2096277, +2096307, +2096381, +2096405, +2096434, +2096565, +2096637, +2096954, +2097045, +2097117, +2097156, +2097565, +2097572, +2098429, +2098436, +2099069, +2099076, +2099165, +2099172, +2099677, +2099716, +2100189, +2101252, +2105213, +2105361, +2105469, +2105578, +2107037, +2107125, +2107401, +2109098, +2109237, +2109770, +2109821, +2109973, +2110365, +2112021, +2113445, +2113501, +2117636, +2118589, +2118660, +2120253, +2121732, +2122749, +2122762, +2122909, +2123268, +2123817, +2123844, +2124105, +2124157, +2125828, +2126813, +2126833, +2126852, +2128029, +2128132, +2128401, +2128425, +2128605, +2129920, +2131201, +2132484, +2135005, +2135048, +2135389, +2162692, +2162909, +2162948, +2163005, +2163012, +2164445, +2164452, +2164541, +2164612, +2164669, +2164708, +2165469, +2165489, +2165514, +2165789, +2170884, +2171594, +2171805, +2171889, +2171908, +2172765, +2172913, +2172957, +2174980, +2176797, +2176964, +2177053, +2179076, +2179109, +2179229, +2179237, +2179325, +2179461, +2179588, +2179741, +2179748, +2179869, +2179876, +2180765, +2180869, +2180989, +2181093, +2181130, +2181405, +2181649, +2181949, +2182148, +2183082, +2183153, +2183197, +2187268, +2189021, +2189105, +2189316, +2190045, +2190090, +2190340, +2190973, +2191114, +2191389, +2195460, +2197821, +2214922, +2215933, +2228230, +2228261, +2228294, +2228324, +2230021, +2230513, +2230749, +2230858, +2231496, +2231837, +2232325, +2232390, +2232420, +2233862, +2233957, +2234086, +2234149, +2234225, +2234298, +2234321, +2234461, +2234884, +2235709, +2235912, +2236253, +2236421, +2236516, +2237669, +2237830, +2237861, +2238141, +2238152, +2238481, +2238621, +2240517, +2240582, +2240612, +2242150, +2242245, +2242534, +2242596, +2242737, +2242877, +2243080, +2243421, +2281476, +2282853, +2282886, +2282917, +2282950, +2283013, +2283206, +2283237, +2283293, +2283528, +2283869, +2359300, +2387453, +2392073, +2395261, +2395665, +2395805, +2490372, +2524669, +2949124, +2967357, +3006468, +3008701, +3009028, +3009062, +3010557, +3011045, +3011171, +3011613, +3538948, +3539037, +3801109, +3808989, +3809301, +3810557, +3810613, +3812518, +3812581, +3812693, +3812774, +3812986, +3813221, +3813493, +3813541, +3813781, +3814725, +3814869, +3816413, +3817493, +3819589, +3819701, +3819741, +3825685, +3828477, +3828746, +3829341, +3833856, +3834689, +3835520, +3836353, +3836605, +3836609, +3837184, +3838017, +3838848, +3838909, +3838912, +3839005, +3839040, +3839101, +3839136, +3839229, +3839264, +3839421, +3839424, +3839681, +3839837, +3839841, +3839901, +3839905, +3840157, +3840161, +3840512, +3841345, +3842176, +3842269, +3842272, +3842429, +3842464, +3842749, +3842752, +3843005, +3843009, +3843840, +3843933, +3843936, +3844093, +3844096, +3844285, +3844288, +3844349, +3844416, +3844669, +3844673, +3845504, +3846337, +3847168, +3848001, +3848832, +3849665, +3850496, +3851329, +3852160, +3852993, +3853824, +3854657, +3855581, +3855616, +3856434, +3856449, +3857266, +3857281, +3857472, +3858290, +3858305, +3859122, +3859137, +3859328, +3860146, +3860161, +3860978, +3860993, +3861184, +3862002, +3862017, +3862834, +3862849, +3863040, +3863858, +3863873, +3864690, +3864705, +3864896, +3864929, +3864989, +3865032, +3866653, +4046852, +4047005, +4047012, +4047901, +4047908, +4047997, +4048004, +4048061, +4048100, +4048157, +4048164, +4048509, +4048516, +4048669, +4048676, +4048733, +4048740, +4048797, +4048964, +4049021, +4049124, +4049181, +4049188, +4049245, +4049252, +4049309, +4049316, +4049437, +4049444, +4049533, +4049540, +4049597, +4049636, +4049693, +4049700, +4049757, +4049764, +4049821, +4049828, +4049885, +4049892, +4049949, +4049956, +4050045, +4050052, +4050109, +4050148, +4050301, +4050308, +4050557, +4050564, +4050717, +4050724, +4050877, +4050884, +4050941, +4050948, +4051293, +4051300, +4051869, +4052004, +4052125, +4052132, +4052317, +4052324, +4052893, +4054546, +4054621, +4063253, +4064669, +4064789, +4067997, +4068373, +4068861, +4068917, +4069373, +4069429, +4069917, +4069941, +4070429, +4071434, +4071805, +4071957, +4072957, +4072981, +4074909, +4075029, +4076413, +4078805, +4079741, +4080149, +4081533, +4081685, +4081981, +4082197, +4082269, +4087829, +4088893, +4089365, +4089565, +4089589, +4091837, +4091925, +4092573, +4092949, +4094141, +4094165, +4094333, +4094997, +4095549, +4096021, +4098045, +4098069, +4098109, +4098133, +4103965, +4103989, +4104125, +4104213, +4106205, +4106261, +4106397, +4106773, +4107549, +4112245, +4114493, +4114613, +4114973, +4116501, +4118749, +4120597, +4124317, +4194308, +5561085, +5562372, +5695165, +5695492, +5702621, +6225924, +6243293, +29360186, +29360221, +29361178, +29364253, +29368325, +29376029, +31457308, +33554397, +33554460, +35651549, +//--Autogenerated -- end of section automatically generated +}; + +const int maxUnicode = 0x10ffff; +const int maskCategory = 0x1F; +const int nRanges = ELEMENTS(catRanges); + +} + +// Each element in catRanges is the start of a range of Unicode characters in +// one general category. +// The value is comprised of a 21-bit character value shifted 5 bits and a 5 bit +// category matching the CharacterCategory enumeration. +// Initial version has 3249 entries and adds about 13K to the executable. +// The array is in ascending order so can be searched using binary search. +// Therefore the average call takes log2(3249) = 12 comparisons. +// For speed, it may be useful to make a linear table for the common values, +// possibly for 0..0xff for most Western European text or 0..0xfff for most +// alphabetic languages. + +CharacterCategory CategoriseCharacter(int character) { + if (character < 0 || character > maxUnicode) + return ccCn; + const int baseValue = character * (maskCategory+1) + maskCategory; + const int *placeAfter = std::lower_bound(catRanges, catRanges+nRanges, baseValue); + return static_cast(*(placeAfter-1) & maskCategory); +} + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/libs/qscintilla/lexlib/CharacterCategory.h b/libs/qscintilla/lexlib/CharacterCategory.h new file mode 100644 index 000000000..c8600504b --- /dev/null +++ b/libs/qscintilla/lexlib/CharacterCategory.h @@ -0,0 +1,31 @@ +// Scintilla source code edit control +/** @file CharacterCategory.h + ** Returns the Unicode general category of a character. + **/ +// Copyright 2013 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CHARACTERCATEGORY_H +#define CHARACTERCATEGORY_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +enum CharacterCategory { + ccLu, ccLl, ccLt, ccLm, ccLo, + ccMn, ccMc, ccMe, + ccNd, ccNl, ccNo, + ccPc, ccPd, ccPs, ccPe, ccPi, ccPf, ccPo, + ccSm, ccSc, ccSk, ccSo, + ccZs, ccZl, ccZp, + ccCc, ccCf, ccCs, ccCo, ccCn +}; + +CharacterCategory CategoriseCharacter(int character); + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/CharacterSet.cpp b/libs/qscintilla/lexlib/CharacterSet.cpp new file mode 100644 index 000000000..0ab2cc0cc --- /dev/null +++ b/libs/qscintilla/lexlib/CharacterSet.cpp @@ -0,0 +1,61 @@ +// Scintilla source code edit control +/** @file CharacterSet.cxx + ** Simple case functions for ASCII. + ** Lexer infrastructure. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "CharacterSet.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +int CompareCaseInsensitive(const char *a, const char *b) { + while (*a && *b) { + if (*a != *b) { + char upperA = MakeUpperCase(*a); + char upperB = MakeUpperCase(*b); + if (upperA != upperB) + return upperA - upperB; + } + a++; + b++; + } + // Either *a or *b is nul + return *a - *b; +} + +int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { + while (*a && *b && len) { + if (*a != *b) { + char upperA = MakeUpperCase(*a); + char upperB = MakeUpperCase(*b); + if (upperA != upperB) + return upperA - upperB; + } + a++; + b++; + len--; + } + if (len == 0) + return 0; + else + // Either *a or *b is nul + return *a - *b; +} + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/libs/qscintilla/lexlib/CharacterSet.h b/libs/qscintilla/lexlib/CharacterSet.h new file mode 100644 index 000000000..e0b6f7e81 --- /dev/null +++ b/libs/qscintilla/lexlib/CharacterSet.h @@ -0,0 +1,178 @@ +// Scintilla source code edit control +/** @file CharacterSet.h + ** Encapsulates a set of characters. Used to test if a character is within a set. + **/ +// Copyright 2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CHARACTERSET_H +#define CHARACTERSET_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class CharacterSet { + int size; + bool valueAfter; + bool *bset; +public: + enum setBase { + setNone=0, + setLower=1, + setUpper=2, + setDigits=4, + setAlpha=setLower|setUpper, + setAlphaNum=setAlpha|setDigits + }; + CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) { + size = size_; + valueAfter = valueAfter_; + bset = new bool[size]; + for (int i=0; i < size; i++) { + bset[i] = false; + } + AddString(initialSet); + if (base & setLower) + AddString("abcdefghijklmnopqrstuvwxyz"); + if (base & setUpper) + AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + if (base & setDigits) + AddString("0123456789"); + } + CharacterSet(const CharacterSet &other) { + size = other.size; + valueAfter = other.valueAfter; + bset = new bool[size]; + for (int i=0; i < size; i++) { + bset[i] = other.bset[i]; + } + } + ~CharacterSet() { + delete []bset; + bset = 0; + size = 0; + } + CharacterSet &operator=(const CharacterSet &other) { + if (this != &other) { + bool *bsetNew = new bool[other.size]; + for (int i=0; i < other.size; i++) { + bsetNew[i] = other.bset[i]; + } + delete []bset; + size = other.size; + valueAfter = other.valueAfter; + bset = bsetNew; + } + return *this; + } + void Add(int val) { + assert(val >= 0); + assert(val < size); + bset[val] = true; + } + void AddString(const char *setToAdd) { + for (const char *cp=setToAdd; *cp; cp++) { + int val = static_cast(*cp); + assert(val >= 0); + assert(val < size); + bset[val] = true; + } + } + bool Contains(int val) const { + // val being -ve is valid (or there is a sign extension bug elsewhere. + //assert(val >= 0); + if (val < 0) return false; + return (val < size) ? bset[val] : valueAfter; + } +}; + +// Functions for classifying characters + +inline bool IsASpace(int ch) { + return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} + +inline bool IsASpaceOrTab(int ch) { + return (ch == ' ') || (ch == '\t'); +} + +inline bool IsADigit(int ch) { + return (ch >= '0') && (ch <= '9'); +} + +inline bool IsADigit(int ch, int base) { + if (base <= 10) { + return (ch >= '0') && (ch < '0' + base); + } else { + return ((ch >= '0') && (ch <= '9')) || + ((ch >= 'A') && (ch < 'A' + base - 10)) || + ((ch >= 'a') && (ch < 'a' + base - 10)); + } +} + +inline bool IsASCII(int ch) { + return (ch >= 0) && (ch < 0x80); +} + +inline bool IsLowerCase(int ch) { + return (ch >= 'a') && (ch <= 'z'); +} + +inline bool IsUpperCase(int ch) { + return (ch >= 'A') && (ch <= 'Z'); +} + +inline bool IsAlphaNumeric(int ch) { + return + ((ch >= '0') && (ch <= '9')) || + ((ch >= 'a') && (ch <= 'z')) || + ((ch >= 'A') && (ch <= 'Z')); +} + +/** + * Check if a character is a space. + * This is ASCII specific but is safe with chars >= 0x80. + */ +inline bool isspacechar(int ch) { + return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} + +inline bool iswordchar(int ch) { + return IsAlphaNumeric(ch) || ch == '.' || ch == '_'; +} + +inline bool iswordstart(int ch) { + return IsAlphaNumeric(ch) || ch == '_'; +} + +inline bool isoperator(int ch) { + if (IsAlphaNumeric(ch)) + return false; + 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; +} + +// Simple case functions for ASCII. + +inline char MakeUpperCase(char ch) { + if (ch < 'a' || ch > 'z') + return ch; + else + return static_cast(ch - 'a' + 'A'); +} + +int CompareCaseInsensitive(const char *a, const char *b); +int CompareNCaseInsensitive(const char *a, const char *b, size_t len); + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/LexAccessor.h b/libs/qscintilla/lexlib/LexAccessor.h new file mode 100644 index 000000000..8e3455d0c --- /dev/null +++ b/libs/qscintilla/lexlib/LexAccessor.h @@ -0,0 +1,204 @@ +// Scintilla source code edit control +/** @file LexAccessor.h + ** Interfaces 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 LEXACCESSOR_H +#define LEXACCESSOR_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +enum EncodingType { enc8bit, encUnicode, encDBCS }; + +class LexAccessor { +private: + IDocument *pAccess; + 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; + enum EncodingType encodingType; + int lenDoc; + char styleBuf[bufferSize]; + int validLen; + unsigned int startSeg; + int startPosStyling; + int documentVersion; + + void Fill(int position) { + startPos = position - slopSize; + if (startPos + bufferSize > lenDoc) + startPos = lenDoc - bufferSize; + if (startPos < 0) + startPos = 0; + endPos = startPos + bufferSize; + if (endPos > lenDoc) + endPos = lenDoc; + + pAccess->GetCharRange(buf, startPos, endPos-startPos); + buf[endPos-startPos] = '\0'; + } + +public: + explicit LexAccessor(IDocument *pAccess_) : + pAccess(pAccess_), startPos(extremePosition), endPos(0), + codePage(pAccess->CodePage()), + encodingType(enc8bit), + lenDoc(pAccess->Length()), + validLen(0), + startSeg(0), startPosStyling(0), + documentVersion(pAccess->Version()) { + // Prevent warnings by static analyzers about uninitialized buf and styleBuf. + buf[0] = 0; + styleBuf[0] = 0; + switch (codePage) { + case 65001: + encodingType = encUnicode; + break; + case 932: + case 936: + case 949: + case 950: + case 1361: + encodingType = encDBCS; + } + } + char operator[](int position) { + if (position < startPos || position >= endPos) { + Fill(position); + } + return buf[position - startPos]; + } + IDocumentWithLineEnd *MultiByteAccess() const { + if (documentVersion >= dvLineEnd) { + return static_cast(pAccess); + } + return 0; + } + /** 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) const { + return pAccess->IsDBCSLeadByte(ch); + } + EncodingType Encoding() const { + return encodingType; + } + bool Match(int pos, const char *s) { + for (int i=0; *s; i++) { + if (*s != SafeGetCharAt(pos+i)) + return false; + s++; + } + return true; + } + char StyleAt(int position) const { + return static_cast(pAccess->StyleAt(position)); + } + int GetLine(int position) const { + return pAccess->LineFromPosition(position); + } + int LineStart(int line) const { + return pAccess->LineStart(line); + } + int LineEnd(int line) { + if (documentVersion >= dvLineEnd) { + return (static_cast(pAccess))->LineEnd(line); + } else { + // Old interface means only '\r', '\n' and '\r\n' line ends. + int startNext = pAccess->LineStart(line+1); + char chLineEnd = SafeGetCharAt(startNext-1); + if (chLineEnd == '\n' && (SafeGetCharAt(startNext-2) == '\r')) + return startNext - 2; + else + return startNext - 1; + } + } + int LevelAt(int line) const { + return pAccess->GetLevel(line); + } + int Length() const { + return lenDoc; + } + void Flush() { + if (validLen > 0) { + pAccess->SetStyles(validLen, styleBuf); + startPosStyling += validLen; + validLen = 0; + } + } + int GetLineState(int line) const { + return pAccess->GetLineState(line); + } + int SetLineState(int line, int state) { + return pAccess->SetLineState(line, state); + } + // Style setting + void StartAt(unsigned int start) { + pAccess->StartStyling(start, '\377'); + startPosStyling = start; + } + unsigned int GetStartSegment() const { + return startSeg; + } + void StartSegment(unsigned int pos) { + startSeg = pos; + } + void ColourTo(unsigned int pos, int chAttr) { + // Only perform styling if non empty range + if (pos != startSeg - 1) { + assert(pos >= startSeg); + if (pos < startSeg) { + return; + } + + if (validLen + (pos - startSeg + 1) >= bufferSize) + Flush(); + if (validLen + (pos - startSeg + 1) >= bufferSize) { + // Too big for buffer so send directly + pAccess->SetStyleFor(pos - startSeg + 1, static_cast(chAttr)); + } else { + for (unsigned int i = startSeg; i <= pos; i++) { + assert((startPosStyling + validLen) < Length()); + styleBuf[validLen++] = static_cast(chAttr); + } + } + } + startSeg = pos+1; + } + void SetLevel(int line, int level) { + pAccess->SetLevel(line, level); + } + void IndicatorFill(int start, int end, int indicator, int value) { + pAccess->DecorationSetCurrentIndicator(indicator); + pAccess->DecorationFillRange(start, value, end - start); + } + + void ChangeLexerState(int start, int end) { + pAccess->ChangeLexerState(start, end); + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/LexerBase.cpp b/libs/qscintilla/lexlib/LexerBase.cpp new file mode 100644 index 000000000..bbef3f159 --- /dev/null +++ b/libs/qscintilla/lexlib/LexerBase.cpp @@ -0,0 +1,92 @@ +// Scintilla source code edit control +/** @file LexerBase.cxx + ** A simple lexer with no state. + **/ +// Copyright 1998-2010 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 "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "LexerModule.h" +#include "LexerBase.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LexerBase::LexerBase() { + for (int wl = 0; wl < numWordLists; wl++) + keyWordLists[wl] = new WordList; + keyWordLists[numWordLists] = 0; +} + +LexerBase::~LexerBase() { + for (int wl = 0; wl < numWordLists; wl++) { + delete keyWordLists[wl]; + keyWordLists[wl] = 0; + } + keyWordLists[numWordLists] = 0; +} + +void SCI_METHOD LexerBase::Release() { + delete this; +} + +int SCI_METHOD LexerBase::Version() const { + return lvOriginal; +} + +const char * SCI_METHOD LexerBase::PropertyNames() { + return ""; +} + +int SCI_METHOD LexerBase::PropertyType(const char *) { + return SC_TYPE_BOOLEAN; +} + +const char * SCI_METHOD LexerBase::DescribeProperty(const char *) { + return ""; +} + +int SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) { + const char *valOld = props.Get(key); + if (strcmp(val, valOld) != 0) { + props.Set(key, val); + return 0; + } else { + return -1; + } +} + +const char * SCI_METHOD LexerBase::DescribeWordListSets() { + return ""; +} + +int SCI_METHOD LexerBase::WordListSet(int n, const char *wl) { + if (n < numWordLists) { + WordList wlNew; + wlNew.Set(wl); + if (*keyWordLists[n] != wlNew) { + keyWordLists[n]->Set(wl); + return 0; + } + } + return -1; +} + +void * SCI_METHOD LexerBase::PrivateCall(int, void *) { + return 0; +} diff --git a/libs/qscintilla/lexlib/LexerBase.h b/libs/qscintilla/lexlib/LexerBase.h new file mode 100644 index 000000000..2998d2449 --- /dev/null +++ b/libs/qscintilla/lexlib/LexerBase.h @@ -0,0 +1,41 @@ +// Scintilla source code edit control +/** @file LexerBase.h + ** A simple lexer with no state. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef LEXERBASE_H +#define LEXERBASE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// A simple lexer with no state +class LexerBase : public ILexer { +protected: + PropSetSimple props; + enum {numWordLists=KEYWORDSET_MAX+1}; + WordList *keyWordLists[numWordLists+1]; +public: + LexerBase(); + virtual ~LexerBase(); + void SCI_METHOD Release(); + int SCI_METHOD Version() const; + const char * SCI_METHOD PropertyNames(); + int SCI_METHOD PropertyType(const char *name); + const char * SCI_METHOD DescribeProperty(const char *name); + int SCI_METHOD PropertySet(const char *key, const char *val); + const char * SCI_METHOD DescribeWordListSets(); + int SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; + void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; + void * SCI_METHOD PrivateCall(int operation, void *pointer); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/LexerModule.cpp b/libs/qscintilla/lexlib/LexerModule.cpp new file mode 100644 index 000000000..6cefbee77 --- /dev/null +++ b/libs/qscintilla/lexlib/LexerModule.cpp @@ -0,0 +1,111 @@ +// Scintilla source code edit control +/** @file LexerModule.cxx + ** Colourise for particular languages. + **/ +// Copyright 1998-2010 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 "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "LexerModule.h" +#include "LexerBase.h" +#include "LexerSimple.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LexerModule::LexerModule(int language_, + LexerFunction fnLexer_, + const char *languageName_, + LexerFunction fnFolder_, + const char *const wordListDescriptions_[]) : + language(language_), + fnLexer(fnLexer_), + fnFolder(fnFolder_), + fnFactory(0), + wordListDescriptions(wordListDescriptions_), + languageName(languageName_) { +} + +LexerModule::LexerModule(int language_, + LexerFactoryFunction fnFactory_, + const char *languageName_, + const char * const wordListDescriptions_[]) : + language(language_), + fnLexer(0), + fnFolder(0), + fnFactory(fnFactory_), + wordListDescriptions(wordListDescriptions_), + languageName(languageName_) { +} + +int LexerModule::GetNumWordLists() const { + if (wordListDescriptions == NULL) { + return -1; + } else { + int numWordLists = 0; + + while (wordListDescriptions[numWordLists]) { + ++numWordLists; + } + + return numWordLists; + } +} + +const char *LexerModule::GetWordListDescription(int index) const { + assert(index < GetNumWordLists()); + if (!wordListDescriptions || (index >= GetNumWordLists())) { + return ""; + } else { + return wordListDescriptions[index]; + } +} + +ILexer *LexerModule::Create() const { + if (fnFactory) + return fnFactory(); + else + return new LexerSimple(this); +} + +void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (fnLexer) + fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); +} + +void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (fnFolder) { + int lineCurrent = styler.GetLine(startPos); + // Move back one line in case deletion wrecked current line fold state + if (lineCurrent > 0) { + lineCurrent--; + int newStartPos = styler.LineStart(lineCurrent); + lengthDoc += startPos - newStartPos; + startPos = newStartPos; + initStyle = 0; + if (startPos > 0) { + initStyle = styler.StyleAt(startPos - 1); + } + } + fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); + } +} diff --git a/libs/qscintilla/lexlib/LexerModule.h b/libs/qscintilla/lexlib/LexerModule.h new file mode 100644 index 000000000..5993c0fe9 --- /dev/null +++ b/libs/qscintilla/lexlib/LexerModule.h @@ -0,0 +1,82 @@ +// Scintilla source code edit control +/** @file LexerModule.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. + +#ifndef LEXERMODULE_H +#define LEXERMODULE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class Accessor; +class WordList; + +typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler); +typedef ILexer *(*LexerFactoryFunction)(); + +/** + * 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: + int language; + LexerFunction fnLexer; + LexerFunction fnFolder; + LexerFactoryFunction fnFactory; + const char * const * wordListDescriptions; + +public: + const char *languageName; + LexerModule(int language_, + LexerFunction fnLexer_, + const char *languageName_=0, + LexerFunction fnFolder_=0, + const char * const wordListDescriptions_[] = NULL); + LexerModule(int language_, + LexerFactoryFunction fnFactory_, + const char *languageName_, + const char * const wordListDescriptions_[] = NULL); + 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; + + ILexer *Create() const; + + virtual void Lex(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + virtual void Fold(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + + friend class Catalogue; +}; + +inline int Maximum(int a, int b) { + return (a > b) ? a : b; +} + +// Shut up annoying Visual C++ warnings: +#ifdef _MSC_VER +#pragma warning(disable: 4244 4309 4456 4457) +#endif + +// Turn off shadow warnings for lexers as may be maintained by others +#if defined(__GNUC__) +#pragma GCC diagnostic ignored "-Wshadow" +#endif + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/LexerNoExceptions.cpp b/libs/qscintilla/lexlib/LexerNoExceptions.cpp new file mode 100644 index 000000000..9ebae2af0 --- /dev/null +++ b/libs/qscintilla/lexlib/LexerNoExceptions.cpp @@ -0,0 +1,68 @@ +// Scintilla source code edit control +/** @file LexerNoExceptions.cxx + ** A simple lexer with no state which does not throw exceptions so can be used in an external lexer. + **/ +// Copyright 1998-2010 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 "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "LexerModule.h" +#include "LexerBase.h" +#include "LexerNoExceptions.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +int SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) { + try { + return LexerBase::PropertySet(key, val); + } catch (...) { + // Should not throw into caller as may be compiled with different compiler or options + } + return -1; +} + +int SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) { + try { + return LexerBase::WordListSet(n, wl); + } catch (...) { + // Should not throw into caller as may be compiled with different compiler or options + } + return -1; +} + +void SCI_METHOD LexerNoExceptions::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + try { + Accessor astyler(pAccess, &props); + Lexer(startPos, length, initStyle, pAccess, astyler); + astyler.Flush(); + } catch (...) { + // Should not throw into caller as may be compiled with different compiler or options + pAccess->SetErrorStatus(SC_STATUS_FAILURE); + } +} +void SCI_METHOD LexerNoExceptions::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + try { + Accessor astyler(pAccess, &props); + Folder(startPos, length, initStyle, pAccess, astyler); + astyler.Flush(); + } catch (...) { + // Should not throw into caller as may be compiled with different compiler or options + pAccess->SetErrorStatus(SC_STATUS_FAILURE); + } +} diff --git a/libs/qscintilla/lexlib/LexerNoExceptions.h b/libs/qscintilla/lexlib/LexerNoExceptions.h new file mode 100644 index 000000000..70ff3c138 --- /dev/null +++ b/libs/qscintilla/lexlib/LexerNoExceptions.h @@ -0,0 +1,32 @@ +// Scintilla source code edit control +/** @file LexerNoExceptions.h + ** A simple lexer with no state. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef LEXERNOEXCEPTIONS_H +#define LEXERNOEXCEPTIONS_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// A simple lexer with no state +class LexerNoExceptions : public LexerBase { +public: + // TODO Also need to prevent exceptions in constructor and destructor + int SCI_METHOD PropertySet(const char *key, const char *val); + int SCI_METHOD WordListSet(int n, const char *wl); + void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *); + + virtual void Lexer(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; + virtual void Folder(unsigned int startPos, int length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/LexerSimple.cpp b/libs/qscintilla/lexlib/LexerSimple.cpp new file mode 100644 index 000000000..4d0e178ca --- /dev/null +++ b/libs/qscintilla/lexlib/LexerSimple.cpp @@ -0,0 +1,57 @@ +// Scintilla source code edit control +/** @file LexerSimple.cxx + ** A simple lexer with no state. + **/ +// Copyright 1998-2010 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 "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "LexerModule.h" +#include "LexerBase.h" +#include "LexerSimple.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LexerSimple::LexerSimple(const LexerModule *module_) : module(module_) { + for (int wl = 0; wl < module->GetNumWordLists(); wl++) { + if (!wordLists.empty()) + wordLists += "\n"; + wordLists += module->GetWordListDescription(wl); + } +} + +const char * SCI_METHOD LexerSimple::DescribeWordListSets() { + return wordLists.c_str(); +} + +void SCI_METHOD LexerSimple::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) { + Accessor astyler(pAccess, &props); + module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler); + astyler.Flush(); +} + +void SCI_METHOD LexerSimple::Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) { + if (props.GetInt("fold")) { + Accessor astyler(pAccess, &props); + module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler); + astyler.Flush(); + } +} diff --git a/libs/qscintilla/lexlib/LexerSimple.h b/libs/qscintilla/lexlib/LexerSimple.h new file mode 100644 index 000000000..e9fa9003f --- /dev/null +++ b/libs/qscintilla/lexlib/LexerSimple.h @@ -0,0 +1,30 @@ +// Scintilla source code edit control +/** @file LexerSimple.h + ** A simple lexer with no state. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef LEXERSIMPLE_H +#define LEXERSIMPLE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// A simple lexer with no state +class LexerSimple : public LexerBase { + const LexerModule *module; + std::string wordLists; +public: + explicit LexerSimple(const LexerModule *module_); + const char * SCI_METHOD DescribeWordListSets(); + void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/License.txt b/libs/qscintilla/lexlib/License.txt new file mode 100644 index 000000000..cbe25b2fc --- /dev/null +++ b/libs/qscintilla/lexlib/License.txt @@ -0,0 +1,20 @@ +License for Scintilla and SciTE + +Copyright 1998-2003 by Neil Hodgson + +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. + +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/libs/qscintilla/lexlib/OptionSet.h b/libs/qscintilla/lexlib/OptionSet.h new file mode 100644 index 000000000..2935a2089 --- /dev/null +++ b/libs/qscintilla/lexlib/OptionSet.h @@ -0,0 +1,142 @@ +// Scintilla source code edit control +/** @file OptionSet.h + ** Manage descriptive information about an options struct for a lexer. + ** Hold the names, positions, and descriptions of boolean, integer and string options and + ** allow setting options and retrieving metadata about the options. + **/ +// Copyright 2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef OPTIONSET_H +#define OPTIONSET_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +template +class OptionSet { + typedef T Target; + typedef bool T::*plcob; + typedef int T::*plcoi; + typedef std::string T::*plcos; + struct Option { + int opType; + union { + plcob pb; + plcoi pi; + plcos ps; + }; + std::string description; + Option() : + opType(SC_TYPE_BOOLEAN), pb(0), description("") { + } + Option(plcob pb_, std::string description_="") : + opType(SC_TYPE_BOOLEAN), pb(pb_), description(description_) { + } + Option(plcoi pi_, std::string description_) : + opType(SC_TYPE_INTEGER), pi(pi_), description(description_) { + } + Option(plcos ps_, std::string description_) : + opType(SC_TYPE_STRING), ps(ps_), description(description_) { + } + bool Set(T *base, const char *val) const { + switch (opType) { + case SC_TYPE_BOOLEAN: { + bool option = atoi(val) != 0; + if ((*base).*pb != option) { + (*base).*pb = option; + return true; + } + break; + } + case SC_TYPE_INTEGER: { + int option = atoi(val); + if ((*base).*pi != option) { + (*base).*pi = option; + return true; + } + break; + } + case SC_TYPE_STRING: { + if ((*base).*ps != val) { + (*base).*ps = val; + return true; + } + break; + } + } + return false; + } + }; + typedef std::map OptionMap; + OptionMap nameToDef; + std::string names; + std::string wordLists; + + void AppendName(const char *name) { + if (!names.empty()) + names += "\n"; + names += name; + } +public: + virtual ~OptionSet() { + } + void DefineProperty(const char *name, plcob pb, std::string description="") { + nameToDef[name] = Option(pb, description); + AppendName(name); + } + void DefineProperty(const char *name, plcoi pi, std::string description="") { + nameToDef[name] = Option(pi, description); + AppendName(name); + } + void DefineProperty(const char *name, plcos ps, std::string description="") { + nameToDef[name] = Option(ps, description); + AppendName(name); + } + const char *PropertyNames() const { + return names.c_str(); + } + int PropertyType(const char *name) { + typename OptionMap::iterator it = nameToDef.find(name); + if (it != nameToDef.end()) { + return it->second.opType; + } + return SC_TYPE_BOOLEAN; + } + const char *DescribeProperty(const char *name) { + typename OptionMap::iterator it = nameToDef.find(name); + if (it != nameToDef.end()) { + return it->second.description.c_str(); + } + return ""; + } + + bool PropertySet(T *base, const char *name, const char *val) { + typename OptionMap::iterator it = nameToDef.find(name); + if (it != nameToDef.end()) { + return it->second.Set(base, val); + } + return false; + } + + void DefineWordListSets(const char * const wordListDescriptions[]) { + if (wordListDescriptions) { + for (size_t wl = 0; wordListDescriptions[wl]; wl++) { + if (!wordLists.empty()) + wordLists += "\n"; + wordLists += wordListDescriptions[wl]; + } + } + } + + const char *DescribeWordListSets() const { + return wordLists.c_str(); + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/PropSetSimple.cpp b/libs/qscintilla/lexlib/PropSetSimple.cpp new file mode 100644 index 000000000..6592d70eb --- /dev/null +++ b/libs/qscintilla/lexlib/PropSetSimple.cpp @@ -0,0 +1,156 @@ +// SciTE - Scintilla based Text Editor +/** @file PropSetSimple.cxx + ** A Java style properties file module. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +// Maintain a dictionary of properties + +#include +#include +#include + +#include +#include + +#include "PropSetSimple.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +typedef std::map mapss; + +PropSetSimple::PropSetSimple() { + mapss *props = new mapss; + impl = static_cast(props); +} + +PropSetSimple::~PropSetSimple() { + mapss *props = static_cast(impl); + delete props; + impl = 0; +} + +void PropSetSimple::Set(const char *key, const char *val, int lenKey, int lenVal) { + mapss *props = static_cast(impl); + if (!*key) // Empty keys are not supported + return; + if (lenKey == -1) + lenKey = static_cast(strlen(key)); + if (lenVal == -1) + lenVal = static_cast(strlen(val)); + (*props)[std::string(key, lenKey)] = std::string(val, lenVal); +} + +static bool IsASpaceCharacter(unsigned int ch) { + return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} + +void PropSetSimple::Set(const char *keyVal) { + while (IsASpaceCharacter(*keyVal)) + keyVal++; + const char *endVal = keyVal; + while (*endVal && (*endVal != '\n')) + endVal++; + const char *eqAt = strchr(keyVal, '='); + if (eqAt) { + Set(keyVal, eqAt + 1, static_cast(eqAt-keyVal), + static_cast(endVal - eqAt - 1)); + } else if (*keyVal) { // No '=' so assume '=1' + Set(keyVal, "1", static_cast(endVal-keyVal), 1); + } +} + +void PropSetSimple::SetMultiple(const char *s) { + const char *eol = strchr(s, '\n'); + while (eol) { + Set(s); + s = eol + 1; + eol = strchr(s, '\n'); + } + Set(s); +} + +const char *PropSetSimple::Get(const char *key) const { + mapss *props = static_cast(impl); + mapss::const_iterator keyPos = props->find(std::string(key)); + if (keyPos != props->end()) { + return keyPos->second.c_str(); + } else { + return ""; + } +} + +// There is some inconsistency between GetExpanded("foo") and Expand("$(foo)"). +// A solution is to keep a stack of variables that have been expanded, so that +// recursive expansions can be skipped. For now I'll just use the C++ stack +// for that, through a recursive function and a simple chain of pointers. + +struct VarChain { + VarChain(const char *var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {} + + bool contains(const char *testVar) const { + return (var && (0 == strcmp(var, testVar))) + || (link && link->contains(testVar)); + } + + const char *var; + const VarChain *link; +}; + +static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, int maxExpands, const VarChain &blankVars) { + size_t varStart = withVars.find("$("); + while ((varStart != std::string::npos) && (maxExpands > 0)) { + size_t varEnd = withVars.find(")", varStart+2); + if (varEnd == std::string::npos) { + break; + } + + // For consistency, when we see '$(ab$(cde))', expand the inner variable first, + // regardless whether there is actually a degenerate variable named 'ab$(cde'. + size_t innerVarStart = withVars.find("$(", varStart+2); + while ((innerVarStart != std::string::npos) && (innerVarStart > varStart) && (innerVarStart < varEnd)) { + varStart = innerVarStart; + innerVarStart = withVars.find("$(", varStart+2); + } + + std::string var(withVars.c_str(), varStart + 2, varEnd - varStart - 2); + std::string val = props.Get(var.c_str()); + + if (blankVars.contains(var.c_str())) { + val = ""; // treat blankVar as an empty string (e.g. to block self-reference) + } + + if (--maxExpands >= 0) { + maxExpands = ExpandAllInPlace(props, val, maxExpands, VarChain(var.c_str(), &blankVars)); + } + + withVars.erase(varStart, varEnd-varStart+1); + withVars.insert(varStart, val.c_str(), val.length()); + + varStart = withVars.find("$("); + } + + return maxExpands; +} + +int PropSetSimple::GetExpanded(const char *key, char *result) const { + std::string val = Get(key); + ExpandAllInPlace(*this, val, 100, VarChain(key)); + const int n = static_cast(val.size()); + if (result) { + memcpy(result, val.c_str(), n+1); + } + return n; // Not including NUL +} + +int PropSetSimple::GetInt(const char *key, int defaultValue) const { + std::string val = Get(key); + ExpandAllInPlace(*this, val, 100, VarChain(key)); + if (!val.empty()) { + return atoi(val.c_str()); + } + return defaultValue; +} diff --git a/libs/qscintilla/lexlib/PropSetSimple.h b/libs/qscintilla/lexlib/PropSetSimple.h new file mode 100644 index 000000000..8ca741f03 --- /dev/null +++ b/libs/qscintilla/lexlib/PropSetSimple.h @@ -0,0 +1,32 @@ +// Scintilla source code edit control +/** @file PropSetSimple.h + ** A basic string to string map. + **/ +// Copyright 1998-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PROPSETSIMPLE_H +#define PROPSETSIMPLE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class PropSetSimple { + void *impl; + void Set(const char *keyVal); +public: + PropSetSimple(); + virtual ~PropSetSimple(); + void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); + void SetMultiple(const char *); + const char *Get(const char *key) const; + int GetExpanded(const char *key, char *result) const; + int GetInt(const char *key, int defaultValue=0) const; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/SparseState.h b/libs/qscintilla/lexlib/SparseState.h new file mode 100644 index 000000000..e767d6710 --- /dev/null +++ b/libs/qscintilla/lexlib/SparseState.h @@ -0,0 +1,110 @@ +// Scintilla source code edit control +/** @file SparseState.h + ** Hold lexer state that may change rarely. + ** This is often per-line state such as whether a particular type of section has been entered. + ** A state continues until it is changed. + **/ +// Copyright 2011 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SPARSESTATE_H +#define SPARSESTATE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +template +class SparseState { + struct State { + int position; + T value; + State(int position_, T value_) : position(position_), value(value_) { + } + inline bool operator<(const State &other) const { + return position < other.position; + } + inline bool operator==(const State &other) const { + return (position == other.position) && (value == other.value); + } + }; + int positionFirst; + typedef std::vector stateVector; + stateVector states; + + typename stateVector::iterator Find(int position) { + State searchValue(position, T()); + return std::lower_bound(states.begin(), states.end(), searchValue); + } + +public: + explicit SparseState(int positionFirst_=-1) { + positionFirst = positionFirst_; + } + void Set(int position, T value) { + Delete(position); + if (states.empty() || (value != states[states.size()-1].value)) { + states.push_back(State(position, value)); + } + } + T ValueAt(int position) { + if (states.empty()) + return T(); + if (position < states[0].position) + return T(); + typename stateVector::iterator low = Find(position); + if (low == states.end()) { + return states[states.size()-1].value; + } else { + if (low->position > position) { + --low; + } + return low->value; + } + } + bool Delete(int position) { + typename stateVector::iterator low = Find(position); + if (low != states.end()) { + states.erase(low, states.end()); + return true; + } + return false; + } + size_t size() const { + return states.size(); + } + + // Returns true if Merge caused a significant change + bool Merge(const SparseState &other, int ignoreAfter) { + // Changes caused beyond ignoreAfter are not significant + Delete(ignoreAfter+1); + + bool different = true; + bool changed = false; + typename stateVector::iterator low = Find(other.positionFirst); + if (static_cast(states.end() - low) == other.states.size()) { + // Same number in other as after positionFirst in this + different = !std::equal(low, states.end(), other.states.begin()); + } + if (different) { + if (low != states.end()) { + states.erase(low, states.end()); + changed = true; + } + typename stateVector::const_iterator startOther = other.states.begin(); + if (!states.empty() && !other.states.empty() && states.back().value == startOther->value) + ++startOther; + if (startOther != other.states.end()) { + states.insert(states.end(), startOther, other.states.end()); + changed = true; + } + } + return changed; + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/StringCopy.h b/libs/qscintilla/lexlib/StringCopy.h new file mode 100644 index 000000000..1812b4e35 --- /dev/null +++ b/libs/qscintilla/lexlib/StringCopy.h @@ -0,0 +1,36 @@ +// Scintilla source code edit control +/** @file StringCopy.h + ** Safe string copy function which always NUL terminates. + ** ELEMENTS macro for determining array sizes. + **/ +// Copyright 2013 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef STRINGCOPY_H +#define STRINGCOPY_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// Safer version of string copy functions like strcpy, wcsncpy, etc. +// Instantiate over fixed length strings of both char and wchar_t. +// May truncate if source doesn't fit into dest with room for NUL. + +template +void StringCopy(T (&dest)[count], const T* source) { + for (size_t i=0; i +// This file is in the public domain. + +#include +#include +#include +#include +#include + +#include "ILexer.h" + +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static void getRange(unsigned int start, + unsigned int end, + LexAccessor &styler, + char *s, + unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = styler[start + i]; + i++; + } + s[i] = '\0'; +} + +void StyleContext::GetCurrent(char *s, unsigned int len) { + getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); +} + +static void getRangeLowered(unsigned int start, + unsigned int end, + LexAccessor &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'; +} + +void StyleContext::GetCurrentLowered(char *s, unsigned int len) { + getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); +} diff --git a/libs/qscintilla/lexlib/StyleContext.h b/libs/qscintilla/lexlib/StyleContext.h new file mode 100644 index 000000000..837386cef --- /dev/null +++ b/libs/qscintilla/lexlib/StyleContext.h @@ -0,0 +1,231 @@ +// Scintilla source code edit control +/** @file StyleContext.h + ** Lexer infrastructure. + **/ +// Copyright 1998-2004 by Neil Hodgson +// This file is in the public domain. + +#ifndef STYLECONTEXT_H +#define STYLECONTEXT_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +static inline int MakeLowerCase(int ch) { + if (ch < 'A' || ch > 'Z') + return ch; + else + return ch - 'A' + 'a'; +} + +// All languages handled so far can treat all characters >= 0x80 as one class +// which just continues the current token or starts an identifier if in default. +// DBCS treated specially as the second character can be < 0x80 and hence +// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80 +class StyleContext { + LexAccessor &styler; + IDocumentWithLineEnd *multiByteAccess; + unsigned int endPos; + unsigned int lengthDocument; + + // Used for optimizing GetRelativeCharacter + unsigned int posRelative; + unsigned int currentPosLastRelative; + int offsetRelative; + + StyleContext &operator=(const StyleContext &); + + void GetNextChar() { + if (multiByteAccess) { + chNext = multiByteAccess->GetCharacterAndWidth(currentPos+width, &widthNext); + } else { + chNext = static_cast(styler.SafeGetCharAt(currentPos+width, 0)); + widthNext = 1; + } + // End of line determined from line end position, allowing CR, LF, + // CRLF and Unicode line ends as set by document. + if (currentLine < lineDocEnd) + atLineEnd = static_cast(currentPos) >= (lineStartNext-1); + else // Last line + atLineEnd = static_cast(currentPos) >= lineStartNext; + } + +public: + unsigned int currentPos; + int currentLine; + int lineDocEnd; + int lineStartNext; + bool atLineStart; + bool atLineEnd; + int state; + int chPrev; + int ch; + int width; + int chNext; + int widthNext; + + StyleContext(unsigned int startPos, unsigned int length, + int initStyle, LexAccessor &styler_, char chMask='\377') : + styler(styler_), + multiByteAccess(0), + endPos(startPos + length), + posRelative(0), + currentPosLastRelative(0x7FFFFFFF), + offsetRelative(0), + currentPos(startPos), + currentLine(-1), + lineStartNext(-1), + atLineEnd(false), + state(initStyle & chMask), // Mask off all bits which aren't in the chMask. + chPrev(0), + ch(0), + width(0), + chNext(0), + widthNext(1) { + if (styler.Encoding() != enc8bit) { + multiByteAccess = styler.MultiByteAccess(); + } + styler.StartAt(startPos /*, chMask*/); + styler.StartSegment(startPos); + currentLine = styler.GetLine(startPos); + lineStartNext = styler.LineStart(currentLine+1); + lengthDocument = static_cast(styler.Length()); + if (endPos == lengthDocument) + endPos++; + lineDocEnd = styler.GetLine(lengthDocument); + atLineStart = static_cast(styler.LineStart(currentLine)) == startPos; + + // Variable width is now 0 so GetNextChar gets the char at currentPos into chNext/widthNext + width = 0; + GetNextChar(); + ch = chNext; + width = widthNext; + + GetNextChar(); + } + void Complete() { + styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); + styler.Flush(); + } + bool More() const { + return currentPos < endPos; + } + void Forward() { + if (currentPos < endPos) { + atLineStart = atLineEnd; + if (atLineStart) { + currentLine++; + lineStartNext = styler.LineStart(currentLine+1); + } + chPrev = ch; + currentPos += width; + ch = chNext; + width = widthNext; + GetNextChar(); + } else { + atLineStart = false; + chPrev = ' '; + ch = ' '; + chNext = ' '; + atLineEnd = true; + } + } + void Forward(int nb) { + for (int i = 0; i < nb; i++) { + Forward(); + } + } + void ForwardBytes(int nb) { + size_t forwardPos = currentPos + nb; + while (forwardPos > currentPos) { + Forward(); + } + } + void ChangeState(int state_) { + state = state_; + } + void SetState(int state_) { + styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); + state = state_; + } + void ForwardSetState(int state_) { + Forward(); + styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); + state = state_; + } + int LengthCurrent() const { + return currentPos - styler.GetStartSegment(); + } + int GetRelative(int n) { + return static_cast(styler.SafeGetCharAt(currentPos+n, 0)); + } + int GetRelativeCharacter(int n) { + if (n == 0) + return ch; + if (multiByteAccess) { + if ((currentPosLastRelative != currentPos) || + ((n > 0) && ((offsetRelative < 0) || (n < offsetRelative))) || + ((n < 0) && ((offsetRelative > 0) || (n > offsetRelative)))) { + posRelative = currentPos; + offsetRelative = 0; + } + int diffRelative = n - offsetRelative; + int posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative); + int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, 0); + posRelative = posNew; + currentPosLastRelative = currentPos; + offsetRelative = n; + return chReturn; + } else { + // fast version for single byte encodings + return static_cast(styler.SafeGetCharAt(currentPos + n, 0)); + } + } + bool Match(char ch0) const { + return ch == static_cast(ch0); + } + bool Match(char ch0, char ch1) const { + return (ch == static_cast(ch0)) && (chNext == static_cast(ch1)); + } + bool Match(const char *s) { + if (ch != static_cast(*s)) + return false; + s++; + if (!*s) + return true; + if (chNext != static_cast(*s)) + return false; + s++; + for (int n=2; *s; n++) { + if (*s != styler.SafeGetCharAt(currentPos+n, 0)) + return false; + s++; + } + return true; + } + bool MatchIgnoreCase(const char *s) { + if (MakeLowerCase(ch) != static_cast(*s)) + return false; + s++; + if (MakeLowerCase(chNext) != static_cast(*s)) + return false; + s++; + for (int n=2; *s; n++) { + if (static_cast(*s) != + MakeLowerCase(static_cast(styler.SafeGetCharAt(currentPos+n, 0)))) + return false; + s++; + } + return true; + } + // Non-inline + void GetCurrent(char *s, unsigned int len); + void GetCurrentLowered(char *s, unsigned int len); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/SubStyles.h b/libs/qscintilla/lexlib/SubStyles.h new file mode 100644 index 000000000..579107819 --- /dev/null +++ b/libs/qscintilla/lexlib/SubStyles.h @@ -0,0 +1,177 @@ +// Scintilla source code edit control +/** @file SubStyles.h + ** Manage substyles for a lexer. + **/ +// Copyright 2012 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SUBSTYLES_H +#define SUBSTYLES_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class WordClassifier { + int baseStyle; + int firstStyle; + int lenStyles; + std::map wordToStyle; + +public: + + explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) { + } + + void Allocate(int firstStyle_, int lenStyles_) { + firstStyle = firstStyle_; + lenStyles = lenStyles_; + wordToStyle.clear(); + } + + int Base() const { + return baseStyle; + } + + int Start() const { + return firstStyle; + } + + int Length() const { + return lenStyles; + } + + void Clear() { + firstStyle = 0; + lenStyles = 0; + wordToStyle.clear(); + } + + int ValueFor(const std::string &s) const { + std::map::const_iterator it = wordToStyle.find(s); + if (it != wordToStyle.end()) + return it->second; + else + return -1; + } + + bool IncludesStyle(int style) const { + return (style >= firstStyle) && (style < (firstStyle + lenStyles)); + } + + void SetIdentifiers(int style, const char *identifiers) { + while (*identifiers) { + const char *cpSpace = identifiers; + while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n')) + cpSpace++; + if (cpSpace > identifiers) { + std::string word(identifiers, cpSpace - identifiers); + wordToStyle[word] = style; + } + identifiers = cpSpace; + if (*identifiers) + identifiers++; + } + } +}; + +class SubStyles { + int classifications; + const char *baseStyles; + int styleFirst; + int stylesAvailable; + int secondaryDistance; + int allocated; + std::vector classifiers; + + int BlockFromBaseStyle(int baseStyle) const { + for (int b=0; b < classifications; b++) { + if (baseStyle == baseStyles[b]) + return b; + } + return -1; + } + + int BlockFromStyle(int style) const { + int b = 0; + for (std::vector::const_iterator it=classifiers.begin(); it != classifiers.end(); ++it) { + if (it->IncludesStyle(style)) + return b; + b++; + } + return -1; + } + +public: + + SubStyles(const char *baseStyles_, int styleFirst_, int stylesAvailable_, int secondaryDistance_) : + classifications(0), + baseStyles(baseStyles_), + styleFirst(styleFirst_), + stylesAvailable(stylesAvailable_), + secondaryDistance(secondaryDistance_), + allocated(0) { + while (baseStyles[classifications]) { + classifiers.push_back(WordClassifier(baseStyles[classifications])); + classifications++; + } + } + + int Allocate(int styleBase, int numberStyles) { + int block = BlockFromBaseStyle(styleBase); + if (block >= 0) { + if ((allocated + numberStyles) > stylesAvailable) + return -1; + int startBlock = styleFirst + allocated; + allocated += numberStyles; + classifiers[block].Allocate(startBlock, numberStyles); + return startBlock; + } else { + return -1; + } + } + + int Start(int styleBase) { + int block = BlockFromBaseStyle(styleBase); + return (block >= 0) ? classifiers[block].Start() : -1; + } + + int Length(int styleBase) { + int block = BlockFromBaseStyle(styleBase); + return (block >= 0) ? classifiers[block].Length() : 0; + } + + int BaseStyle(int subStyle) const { + int block = BlockFromStyle(subStyle); + if (block >= 0) + return classifiers[block].Base(); + else + return subStyle; + } + + int DistanceToSecondaryStyles() const { + return secondaryDistance; + } + + void SetIdentifiers(int style, const char *identifiers) { + int block = BlockFromStyle(style); + if (block >= 0) + classifiers[block].SetIdentifiers(style, identifiers); + } + + void Free() { + allocated = 0; + for (std::vector::iterator it=classifiers.begin(); it != classifiers.end(); ++it) + it->Clear(); + } + + const WordClassifier &Classifier(int baseStyle) const { + return classifiers[BlockFromBaseStyle(baseStyle)]; + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/lexlib/WordList.cpp b/libs/qscintilla/lexlib/WordList.cpp new file mode 100644 index 000000000..be7fda505 --- /dev/null +++ b/libs/qscintilla/lexlib/WordList.cpp @@ -0,0 +1,242 @@ +// Scintilla source code edit control +/** @file KeyWords.cxx + ** Colourise for particular languages. + **/ +// Copyright 1998-2002 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include + +#include "StringCopy.h" +#include "WordList.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/** + * Creates an array that points into each word in the string and puts \0 terminators + * after each word. + */ +static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) { + int prev = '\n'; + int words = 0; + // For rapid determination of whether a character is a separator, build + // a look up table. + bool wordSeparator[256]; + for (int i=0; i<256; i++) { + wordSeparator[i] = false; + } + wordSeparator[static_cast('\r')] = true; + wordSeparator[static_cast('\n')] = true; + if (!onlyLineEnds) { + wordSeparator[static_cast(' ')] = true; + wordSeparator[static_cast('\t')] = true; + } + for (int j = 0; wordlist[j]; j++) { + int curr = static_cast(wordlist[j]); + if (!wordSeparator[curr] && wordSeparator[prev]) + words++; + prev = curr; + } + char **keywords = new char *[words + 1]; + int wordsStore = 0; + const size_t slen = strlen(wordlist); + if (words) { + prev = '\0'; + for (size_t k = 0; k < slen; k++) { + if (!wordSeparator[static_cast(wordlist[k])]) { + if (!prev) { + keywords[wordsStore] = &wordlist[k]; + wordsStore++; + } + } else { + wordlist[k] = '\0'; + } + prev = wordlist[k]; + } + } + keywords[wordsStore] = &wordlist[slen]; + *len = wordsStore; + return keywords; +} + +WordList::WordList(bool onlyLineEnds_) : + words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) { + // Prevent warnings by static analyzers about uninitialized starts. + starts[0] = -1; +} + +WordList::~WordList() { + Clear(); +} + +WordList::operator bool() const { + return len ? true : false; +} + +bool WordList::operator!=(const WordList &other) const { + if (len != other.len) + return true; + for (int i=0; i(a), *static_cast(b)); +} + +static void SortWordList(char **words, unsigned int len) { + qsort(reinterpret_cast(words), len, sizeof(*words), cmpWords); +} + +#endif + +void WordList::Set(const char *s) { + Clear(); + const size_t lenS = strlen(s) + 1; + list = new char[lenS]; + memcpy(list, s, lenS); + words = ArrayFromWordList(list, &len, onlyLineEnds); +#ifdef _MSC_VER + std::sort(words, words + len, cmpWords); +#else + SortWordList(words, len); +#endif + for (unsigned int k = 0; k < ELEMENTS(starts); k++) + starts[k] = -1; + for (int l = len - 1; l >= 0; l--) { + unsigned char indexChar = words[l][0]; + starts[indexChar] = l; + } +} + +/** Check whether a string is in the list. + * List elements are either exact matches or prefixes. + * Prefix elements start with '^' and match all strings that start with the rest of the element + * so '^GTK_' matches 'GTK_X', 'GTK_MAJOR_VERSION', and 'GTK_'. + */ +bool WordList::InList(const char *s) const { + if (0 == words) + return false; + unsigned char firstChar = s[0]; + int j = starts[firstChar]; + if (j >= 0) { + while (static_cast(words[j][0]) == firstChar) { + if (s[1] == words[j][1]) { + const char *a = words[j] + 1; + const char *b = s + 1; + while (*a && *a == *b) { + a++; + b++; + } + if (!*a && !*b) + return true; + } + j++; + } + } + j = starts[static_cast('^')]; + if (j >= 0) { + while (words[j][0] == '^') { + const char *a = words[j] + 1; + const char *b = s; + while (*a && *a == *b) { + a++; + b++; + } + if (!*a) + return true; + j++; + } + } + return false; +} + +/** similar to InList, but word s can be a substring of keyword. + * eg. the keyword define is defined as def~ine. This means the word must start + * with def to be a keyword, but also defi, defin and define are valid. + * The marker is ~ in this case. + */ +bool WordList::InListAbbreviated(const char *s, const char marker) const { + if (0 == words) + return false; + unsigned char firstChar = s[0]; + int j = starts[firstChar]; + if (j >= 0) { + while (static_cast(words[j][0]) == firstChar) { + bool isSubword = false; + int start = 1; + if (words[j][1] == marker) { + isSubword = true; + start++; + } + if (s[1] == words[j][start]) { + const char *a = words[j] + start; + const char *b = s + 1; + while (*a && *a == *b) { + a++; + if (*a == marker) { + isSubword = true; + a++; + } + b++; + } + if ((!*a || isSubword) && !*b) + return true; + } + j++; + } + } + j = starts[static_cast('^')]; + if (j >= 0) { + while (words[j][0] == '^') { + const char *a = words[j] + 1; + const char *b = s; + while (*a && *a == *b) { + a++; + b++; + } + if (!*a) + return true; + j++; + } + } + return false; +} + +const char *WordList::WordAt(int n) const { + return words[n]; +} + diff --git a/libs/qscintilla/lexlib/WordList.h b/libs/qscintilla/lexlib/WordList.h new file mode 100644 index 000000000..382be2812 --- /dev/null +++ b/libs/qscintilla/lexlib/WordList.h @@ -0,0 +1,41 @@ +// Scintilla source code edit control +/** @file WordList.h + ** Hold a list of words. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef WORDLIST_H +#define WORDLIST_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class WordList { + // 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 + int starts[256]; +public: + explicit WordList(bool onlyLineEnds_ = false); + ~WordList(); + operator bool() const; + bool operator!=(const WordList &other) const; + int Length() const; + void Clear(); + void Set(const char *s); + bool InList(const char *s) const; + bool InListAbbreviated(const char *s, const char marker) const; + const char *WordAt(int n) const; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/AutoComplete.cpp b/libs/qscintilla/src/AutoComplete.cpp new file mode 100644 index 000000000..d154a913a --- /dev/null +++ b/libs/qscintilla/src/AutoComplete.cpp @@ -0,0 +1,292 @@ +// Scintilla source code edit control +/** @file AutoComplete.cxx + ** Defines the auto completion list box. + **/ +// 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 + +#include "Platform.h" + +#include "Scintilla.h" +#include "CharacterSet.h" +#include "AutoComplete.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +AutoComplete::AutoComplete() : + active(false), + separator(' '), + typesep('?'), + ignoreCase(false), + chooseSingle(false), + lb(0), + posStart(0), + startLen(0), + cancelAtStartPos(true), + autoHide(true), + dropRestOfWord(false), + ignoreCaseBehaviour(SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE), + widthLBDefault(100), + heightLBDefault(100), + autoSort(SC_ORDER_PRESORTED) { + lb = ListBox::Allocate(); +} + +AutoComplete::~AutoComplete() { + if (lb) { + lb->Destroy(); + delete lb; + lb = 0; + } +} + +bool AutoComplete::Active() const { + return active; +} + +void AutoComplete::Start(Window &parent, int ctrlID, + int position, Point location, int startLen_, + int lineHeight, bool unicodeMode, int technology) { + if (active) { + Cancel(); + } + lb->Create(parent, ctrlID, location, lineHeight, unicodeMode, technology); + lb->Clear(); + active = true; + startLen = startLen_; + posStart = position; +} + +void AutoComplete::SetStopChars(const char *stopChars_) { + stopChars = stopChars_; +} + +bool AutoComplete::IsStopChar(char ch) { + return ch && (stopChars.find(ch) != std::string::npos); +} + +void AutoComplete::SetFillUpChars(const char *fillUpChars_) { + fillUpChars = fillUpChars_; +} + +bool AutoComplete::IsFillUpChar(char ch) { + return ch && (fillUpChars.find(ch) != std::string::npos); +} + +void AutoComplete::SetSeparator(char separator_) { + separator = separator_; +} + +char AutoComplete::GetSeparator() const { + return separator; +} + +void AutoComplete::SetTypesep(char separator_) { + typesep = separator_; +} + +char AutoComplete::GetTypesep() const { + return typesep; +} + +struct Sorter { + AutoComplete *ac; + const char *list; + std::vector indices; + + Sorter(AutoComplete *ac_, const char *list_) : ac(ac_), list(list_) { + int i = 0; + while (list[i]) { + indices.push_back(i); // word start + while (list[i] != ac->GetTypesep() && list[i] != ac->GetSeparator() && list[i]) + ++i; + indices.push_back(i); // word end + if (list[i] == ac->GetTypesep()) { + while (list[i] != ac->GetSeparator() && list[i]) + ++i; + } + if (list[i] == ac->GetSeparator()) { + ++i; + // preserve trailing separator as blank entry + if (!list[i]) { + indices.push_back(i); + indices.push_back(i); + } + } + } + indices.push_back(i); // index of last position + } + + bool operator()(int a, int b) { + int lenA = indices[a * 2 + 1] - indices[a * 2]; + int lenB = indices[b * 2 + 1] - indices[b * 2]; + int len = std::min(lenA, lenB); + int cmp; + if (ac->ignoreCase) + cmp = CompareNCaseInsensitive(list + indices[a * 2], list + indices[b * 2], len); + else + cmp = strncmp(list + indices[a * 2], list + indices[b * 2], len); + if (cmp == 0) + cmp = lenA - lenB; + return cmp < 0; + } +}; + +void AutoComplete::SetList(const char *list) { + if (autoSort == SC_ORDER_PRESORTED) { + lb->SetList(list, separator, typesep); + sortMatrix.clear(); + for (int i = 0; i < lb->Length(); ++i) + sortMatrix.push_back(i); + return; + } + + Sorter IndexSort(this, list); + sortMatrix.clear(); + for (int i = 0; i < (int)IndexSort.indices.size() / 2; ++i) + sortMatrix.push_back(i); + std::sort(sortMatrix.begin(), sortMatrix.end(), IndexSort); + if (autoSort == SC_ORDER_CUSTOM || sortMatrix.size() < 2) { + lb->SetList(list, separator, typesep); + PLATFORM_ASSERT(lb->Length() == static_cast(sortMatrix.size())); + return; + } + + std::string sortedList; + char item[maxItemLen]; + for (size_t i = 0; i < sortMatrix.size(); ++i) { + int wordLen = IndexSort.indices[sortMatrix[i] * 2 + 2] - IndexSort.indices[sortMatrix[i] * 2]; + strncpy(item, list + IndexSort.indices[sortMatrix[i] * 2], wordLen); + if ((i+1) == sortMatrix.size()) { + // Last item so remove separator if present + if ((wordLen > 0) && (item[wordLen-1] == separator)) + wordLen--; + } else { + // Item before last needs a separator + if ((wordLen == 0) || (item[wordLen-1] != separator)) { + item[wordLen] = separator; + wordLen++; + } + } + item[wordLen] = '\0'; + sortedList += item; + } + for (int i = 0; i < (int)sortMatrix.size(); ++i) + sortMatrix[i] = i; + lb->SetList(sortedList.c_str(), separator, typesep); +} + +int AutoComplete::GetSelection() const { + return lb->GetSelection(); +} + +std::string AutoComplete::GetValue(int item) const { + char value[maxItemLen]; + lb->GetValue(item, value, sizeof(value)); + return std::string(value); +} + +void AutoComplete::Show(bool show) { + lb->Show(show); + if (show) + lb->Select(0); +} + +void AutoComplete::Cancel() { + if (lb->Created()) { + lb->Clear(); + lb->Destroy(); + active = false; + } +} + + +void AutoComplete::Move(int delta) { + int count = lb->Length(); + int current = lb->GetSelection(); + current += delta; + if (current >= count) + current = count - 1; + if (current < 0) + current = 0; + lb->Select(current); +} + +void AutoComplete::Select(const char *word) { + size_t lenWord = strlen(word); + int location = -1; + int start = 0; // lower bound of the api array block to search + int end = lb->Length() - 1; // upper bound of the api array block to search + while ((start <= end) && (location == -1)) { // Binary searching loop + int pivot = (start + end) / 2; + char item[maxItemLen]; + lb->GetValue(sortMatrix[pivot], item, maxItemLen); + int cond; + if (ignoreCase) + cond = CompareNCaseInsensitive(word, item, lenWord); + else + cond = strncmp(word, item, lenWord); + if (!cond) { + // Find first match + while (pivot > start) { + lb->GetValue(sortMatrix[pivot-1], item, maxItemLen); + if (ignoreCase) + cond = CompareNCaseInsensitive(word, item, lenWord); + else + cond = strncmp(word, item, lenWord); + if (0 != cond) + break; + --pivot; + } + location = pivot; + if (ignoreCase + && ignoreCaseBehaviour == SC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE) { + // Check for exact-case match + for (; pivot <= end; pivot++) { + lb->GetValue(sortMatrix[pivot], item, maxItemLen); + if (!strncmp(word, item, lenWord)) { + location = pivot; + break; + } + if (CompareNCaseInsensitive(word, item, lenWord)) + break; + } + } + } else if (cond < 0) { + end = pivot - 1; + } else if (cond > 0) { + start = pivot + 1; + } + } + if (location == -1) { + if (autoHide) + Cancel(); + else + lb->Select(-1); + } else { + if (autoSort == SC_ORDER_CUSTOM) { + // Check for a logically earlier match + char item[maxItemLen]; + for (int i = location + 1; i <= end; ++i) { + lb->GetValue(sortMatrix[i], item, maxItemLen); + if (CompareNCaseInsensitive(word, item, lenWord)) + break; + if (sortMatrix[i] < sortMatrix[location] && !strncmp(word, item, lenWord)) + location = i; + } + } + lb->Select(sortMatrix[location]); + } +} + diff --git a/libs/qscintilla/src/AutoComplete.h b/libs/qscintilla/src/AutoComplete.h new file mode 100644 index 000000000..c35fa1a0e --- /dev/null +++ b/libs/qscintilla/src/AutoComplete.h @@ -0,0 +1,95 @@ +// Scintilla source code edit control +/** @file AutoComplete.h + ** Defines the auto completion list box. + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef AUTOCOMPLETE_H +#define AUTOCOMPLETE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class AutoComplete { + bool active; + std::string stopChars; + std::string fillUpChars; + char separator; + char typesep; // Type seperator + enum { maxItemLen=1000 }; + std::vector sortMatrix; + +public: + + bool ignoreCase; + bool chooseSingle; + ListBox *lb; + int posStart; + int startLen; + /// Should autocompletion be canceled if editor's currentPos <= startPos? + bool cancelAtStartPos; + bool autoHide; + bool dropRestOfWord; + unsigned int ignoreCaseBehaviour; + int widthLBDefault; + int heightLBDefault; + /** SC_ORDER_PRESORTED: Assume the list is presorted; selection will fail if it is not alphabetical
+ * SC_ORDER_PERFORMSORT: Sort the list alphabetically; start up performance cost for sorting
+ * SC_ORDER_CUSTOM: Handle non-alphabetical entries; start up performance cost for generating a sorted lookup table + */ + int autoSort; + + AutoComplete(); + ~AutoComplete(); + + /// Is the auto completion list displayed? + bool Active() const; + + /// Display the auto completion list positioned to be near a character position + void Start(Window &parent, int ctrlID, int position, Point location, + int startLen_, int lineHeight, bool unicodeMode, int technology); + + /// The stop chars are characters which, when typed, cause the auto completion list to disappear + void SetStopChars(const char *stopChars_); + bool IsStopChar(char ch); + + /// The fillup chars are characters which, when typed, fill up the selected word + void SetFillUpChars(const char *fillUpChars_); + bool IsFillUpChar(char ch); + + /// The separator character is used when interpreting the list in SetList + void SetSeparator(char separator_); + char GetSeparator() const; + + /// The typesep character is used for separating the word from the type + void SetTypesep(char separator_); + char GetTypesep() const; + + /// The list string contains a sequence of words separated by the separator character + void SetList(const char *list); + + /// Return the position of the currently selected list item + int GetSelection() const; + + /// Return the value of an item in the list + std::string GetValue(int item) const; + + void Show(bool show); + void Cancel(); + + /// Move the current list element by delta, scrolling appropriately + void Move(int delta); + + /// Select a list element that starts with word as the current element + void Select(const char *word); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/CallTip.cpp b/libs/qscintilla/src/CallTip.cpp new file mode 100644 index 000000000..f6f3f10ea --- /dev/null +++ b/libs/qscintilla/src/CallTip.cpp @@ -0,0 +1,334 @@ +// Scintilla source code edit control +/** @file CallTip.cxx + ** Code for displaying call tips. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include + +#include + +#include "Platform.h" + +#include "Scintilla.h" + +#include "StringCopy.h" +#include "CallTip.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +CallTip::CallTip() { + wCallTip = 0; + inCallTipMode = false; + posStartCallTip = 0; + rectUp = PRectangle(0,0,0,0); + rectDown = PRectangle(0,0,0,0); + lineHeight = 1; + offsetMain = 0; + startHighlight = 0; + endHighlight = 0; + tabSize = 0; + above = false; + useStyleCallTip = false; // for backwards compatibility + + insetX = 5; + widthArrow = 14; + borderHeight = 2; // Extra line for border and an empty line at top and bottom. + verticalOffset = 1; + +#ifdef __APPLE__ + // proper apple colours for the default + colourBG = ColourDesired(0xff, 0xff, 0xc6); + colourUnSel = ColourDesired(0, 0, 0); +#else + colourBG = ColourDesired(0xff, 0xff, 0xff); + colourUnSel = ColourDesired(0x80, 0x80, 0x80); +#endif + colourSel = ColourDesired(0, 0, 0x80); + colourShade = ColourDesired(0, 0, 0); + colourLight = ColourDesired(0xc0, 0xc0, 0xc0); + codePage = 0; + clickPlace = 0; +} + +CallTip::~CallTip() { + font.Release(); + wCallTip.Destroy(); +} + +// Although this test includes 0, we should never see a \0 character. +static bool IsArrowCharacter(char ch) { + return (ch == 0) || (ch == '\001') || (ch == '\002'); +} + +// We ignore tabs unless a tab width has been set. +bool CallTip::IsTabCharacter(char ch) const { + return (tabSize > 0) && (ch == '\t'); +} + +int CallTip::NextTabPos(int x) const { + if (tabSize > 0) { // paranoia... not called unless this is true + x -= insetX; // position relative to text + x = (x + tabSize) / tabSize; // tab "number" + return tabSize*x + insetX; // position of next tab + } else { + return x + 1; // arbitrary + } +} + +// Draw a section of the call tip that does not include \n in one colour. +// The text may include up to numEnds tabs or arrow characters. +void CallTip::DrawChunk(Surface *surface, int &x, const char *s, + int posStart, int posEnd, int ytext, PRectangle rcClient, + bool highlight, bool draw) { + s += posStart; + int len = posEnd - posStart; + + // Divide the text into sections that are all text, or that are + // single arrows or single tab characters (if tabSize > 0). + int maxEnd = 0; + const int numEnds = 10; + int ends[numEnds + 2]; + for (int i=0; i 0) + ends[maxEnd++] = i; + ends[maxEnd++] = i+1; + } + } + ends[maxEnd++] = len; + int startSeg = 0; + int xEnd; + for (int seg = 0; seg startSeg) { + if (IsArrowCharacter(s[startSeg])) { + xEnd = x + widthArrow; + bool upArrow = s[startSeg] == '\001'; + rcClient.left = static_cast(x); + rcClient.right = static_cast(xEnd); + if (draw) { + const int halfWidth = widthArrow / 2 - 3; + const int quarterWidth = halfWidth / 2; + const int centreX = x + widthArrow / 2 - 1; + const int centreY = static_cast(rcClient.top + rcClient.bottom) / 2; + surface->FillRectangle(rcClient, colourBG); + PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, + rcClient.right - 2, rcClient.bottom - 1); + surface->FillRectangle(rcClientInner, colourUnSel); + + if (upArrow) { // Up arrow + Point pts[] = { + Point::FromInts(centreX - halfWidth, centreY + quarterWidth), + Point::FromInts(centreX + halfWidth, centreY + quarterWidth), + Point::FromInts(centreX, centreY - halfWidth + quarterWidth), + }; + surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); + } else { // Down arrow + Point pts[] = { + Point::FromInts(centreX - halfWidth, centreY - quarterWidth), + Point::FromInts(centreX + halfWidth, centreY - quarterWidth), + Point::FromInts(centreX, centreY + halfWidth - quarterWidth), + }; + surface->Polygon(pts, ELEMENTS(pts), colourBG, colourBG); + } + } + offsetMain = xEnd; + if (upArrow) { + rectUp = rcClient; + } else { + rectDown = rcClient; + } + } else if (IsTabCharacter(s[startSeg])) { + xEnd = NextTabPos(x); + } else { + xEnd = x + RoundXYPosition(surface->WidthText(font, s + startSeg, endSeg - startSeg)); + if (draw) { + rcClient.left = static_cast(x); + rcClient.right = static_cast(xEnd); + surface->DrawTextTransparent(rcClient, font, static_cast(ytext), + s+startSeg, endSeg - startSeg, + highlight ? colourSel : colourUnSel); + } + } + x = xEnd; + startSeg = endSeg; + } + } +} + +int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { + PRectangle rcClientPos = wCallTip.GetClientPosition(); + PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, + rcClientPos.bottom - rcClientPos.top); + PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); + + // To make a nice small call tip window, it is only sized to fit most normal characters without accents + int ascent = RoundXYPosition(surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font)); + + // For each line... + // Draw the definition in three parts: before highlight, highlighted, after highlight + int ytext = static_cast(rcClient.top) + ascent + 1; + rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1; + const char *chunkVal = val.c_str(); + bool moreChunks = true; + int maxWidth = 0; + + while (moreChunks) { + const char *chunkEnd = strchr(chunkVal, '\n'); + if (chunkEnd == NULL) { + chunkEnd = chunkVal + strlen(chunkVal); + moreChunks = false; + } + int chunkOffset = static_cast(chunkVal - val.c_str()); + int chunkLength = static_cast(chunkEnd - chunkVal); + int chunkEndOffset = chunkOffset + chunkLength; + int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset); + thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset); + thisStartHighlight -= chunkOffset; + int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset); + thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset); + thisEndHighlight -= chunkOffset; + rcClient.top = static_cast(ytext - ascent - 1); + + int x = insetX; // start each line at this inset + + DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight, + ytext, rcClient, false, draw); + DrawChunk(surfaceWindow, x, chunkVal, thisStartHighlight, thisEndHighlight, + ytext, rcClient, true, draw); + DrawChunk(surfaceWindow, x, chunkVal, thisEndHighlight, chunkLength, + ytext, rcClient, false, draw); + + chunkVal = chunkEnd + 1; + ytext += lineHeight; + rcClient.bottom += lineHeight; + maxWidth = Platform::Maximum(maxWidth, x); + } + return maxWidth; +} + +void CallTip::PaintCT(Surface *surfaceWindow) { + if (val.empty()) + return; + PRectangle rcClientPos = wCallTip.GetClientPosition(); + PRectangle rcClientSize(0.0f, 0.0f, rcClientPos.right - rcClientPos.left, + rcClientPos.bottom - rcClientPos.top); + PRectangle rcClient(1.0f, 1.0f, rcClientSize.right - 1, rcClientSize.bottom - 1); + + surfaceWindow->FillRectangle(rcClient, colourBG); + + offsetMain = insetX; // initial alignment assuming no arrows + PaintContents(surfaceWindow, true); + +#ifndef __APPLE__ + // OSX doesn't put borders on "help tags" + // Draw a raised border around the edges of the window + surfaceWindow->MoveTo(0, static_cast(rcClientSize.bottom) - 1); + surfaceWindow->PenColour(colourShade); + surfaceWindow->LineTo(static_cast(rcClientSize.right) - 1, static_cast(rcClientSize.bottom) - 1); + surfaceWindow->LineTo(static_cast(rcClientSize.right) - 1, 0); + surfaceWindow->PenColour(colourLight); + surfaceWindow->LineTo(0, 0); + surfaceWindow->LineTo(0, static_cast(rcClientSize.bottom) - 1); +#endif +} + +void CallTip::MouseClick(Point pt) { + clickPlace = 0; + if (rectUp.Contains(pt)) + clickPlace = 1; + if (rectDown.Contains(pt)) + clickPlace = 2; +} + +PRectangle CallTip::CallTipStart(int pos, Point pt, int textHeight, const char *defn, + const char *faceName, int size, + int codePage_, int characterSet, + int technology, Window &wParent) { + clickPlace = 0; + val = defn; + codePage = codePage_; + Surface *surfaceMeasure = Surface::Allocate(technology); + if (!surfaceMeasure) + return PRectangle(); + surfaceMeasure->Init(wParent.GetID()); + surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage); + surfaceMeasure->SetDBCSMode(codePage); + startHighlight = 0; + endHighlight = 0; + inCallTipMode = true; + posStartCallTip = pos; + XYPOSITION deviceHeight = static_cast(surfaceMeasure->DeviceHeightFont(size)); + FontParameters fp(faceName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, SC_WEIGHT_NORMAL, false, 0, technology, characterSet); + font.Create(fp); + // Look for multiple lines in the text + // Only support \n here - simply means container must avoid \r! + int numLines = 1; + const char *newline; + const char *look = val.c_str(); + rectUp = PRectangle(0,0,0,0); + rectDown = PRectangle(0,0,0,0); + offsetMain = insetX; // changed to right edge of any arrows + int width = PaintContents(surfaceMeasure, false) + insetX; + while ((newline = strchr(look, '\n')) != NULL) { + look = newline + 1; + numLines++; + } + lineHeight = RoundXYPosition(surfaceMeasure->Height(font)); + + // The returned + // rectangle is aligned to the right edge of the last arrow encountered in + // the tip text, else to the tip text left edge. + int height = lineHeight * numLines - static_cast(surfaceMeasure->InternalLeading(font)) + borderHeight * 2; + delete surfaceMeasure; + if (above) { + return PRectangle(pt.x - offsetMain, pt.y - verticalOffset - height, pt.x + width - offsetMain, pt.y - verticalOffset); + } else { + return PRectangle(pt.x - offsetMain, pt.y + verticalOffset + textHeight, pt.x + width - offsetMain, pt.y + verticalOffset + textHeight + height); + } +} + +void CallTip::CallTipCancel() { + inCallTipMode = false; + if (wCallTip.Created()) { + wCallTip.Destroy(); + } +} + +void CallTip::SetHighlight(int start, int end) { + // Avoid flashing by checking something has really changed + if ((start != startHighlight) || (end != endHighlight)) { + startHighlight = start; + endHighlight = (end > start) ? end : start; + if (wCallTip.Created()) { + wCallTip.InvalidateAll(); + } + } +} + +// Set the tab size (sizes > 0 enable the use of tabs). This also enables the +// use of the STYLE_CALLTIP. +void CallTip::SetTabSize(int tabSz) { + tabSize = tabSz; + useStyleCallTip = true; +} + +// Set the calltip position, below the text by default or if above is false +// else above the text. +void CallTip::SetPosition(bool aboveText) { + above = aboveText; +} + +// It might be better to have two access functions for this and to use +// them for all settings of colours. +void CallTip::SetForeBack(const ColourDesired &fore, const ColourDesired &back) { + colourBG = back; + colourUnSel = fore; +} diff --git a/libs/qscintilla/src/CallTip.h b/libs/qscintilla/src/CallTip.h new file mode 100644 index 000000000..840aa26ac --- /dev/null +++ b/libs/qscintilla/src/CallTip.h @@ -0,0 +1,93 @@ +// Scintilla source code edit control +/** @file CallTip.h + ** Interface to the call tip control. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CALLTIP_H +#define CALLTIP_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class CallTip { + int startHighlight; // character offset to start and... + int endHighlight; // ...end of highlighted text + std::string val; + Font font; + PRectangle rectUp; // rectangle of last up angle in the tip + PRectangle rectDown; // rectangle of last down arrow in the tip + int lineHeight; // vertical line spacing + int offsetMain; // The alignment point of the call tip + int tabSize; // Tab size in pixels, <=0 no TAB expand + bool useStyleCallTip; // if true, STYLE_CALLTIP should be used + bool above; // if true, display calltip above text + + // Private so CallTip objects can not be copied + CallTip(const CallTip &); + CallTip &operator=(const CallTip &); + void DrawChunk(Surface *surface, int &x, const char *s, + int posStart, int posEnd, int ytext, PRectangle rcClient, + bool highlight, bool draw); + int PaintContents(Surface *surfaceWindow, bool draw); + bool IsTabCharacter(char c) const; + int NextTabPos(int x) const; + +public: + Window wCallTip; + Window wDraw; + bool inCallTipMode; + int posStartCallTip; + ColourDesired colourBG; + ColourDesired colourUnSel; + ColourDesired colourSel; + ColourDesired colourShade; + ColourDesired colourLight; + int codePage; + int clickPlace; + + int insetX; // text inset in x from calltip border + int widthArrow; + int borderHeight; + int verticalOffset; // pixel offset up or down of the calltip with respect to the line + + CallTip(); + ~CallTip(); + + void PaintCT(Surface *surfaceWindow); + + void MouseClick(Point pt); + + /// Setup the calltip and return a rectangle of the area required. + PRectangle CallTipStart(int pos, Point pt, int textHeight, const char *defn, + const char *faceName, int size, int codePage_, + int characterSet, int technology, Window &wParent); + + void CallTipCancel(); + + /// Set a range of characters to be displayed in a highlight style. + /// Commonly used to highlight the current parameter. + void SetHighlight(int start, int end); + + /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. + void SetTabSize(int tabSz); + + /// Set calltip position. + void SetPosition(bool aboveText); + + /// Used to determine which STYLE_xxxx to use for call tip information + bool UseStyleCallTip() const { return useStyleCallTip;} + + // Modify foreground and background colours + void SetForeBack(const ColourDesired &fore, const ColourDesired &back); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/CaseConvert.cpp b/libs/qscintilla/src/CaseConvert.cpp new file mode 100644 index 000000000..e8f533d5c --- /dev/null +++ b/libs/qscintilla/src/CaseConvert.cpp @@ -0,0 +1,634 @@ +// Scintilla source code edit control +// Encoding: UTF-8 +/** @file CaseConvert.cxx + ** Case fold characters and convert them to upper or lower case. + ** Tables automatically regenerated by scripts/GenerateCaseConvert.py + ** Should only be rarely regenerated for new versions of Unicode. + **/ +// Copyright 2013 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include +#include + +#include "StringCopy.h" +#include "CaseConvert.h" +#include "UniConversion.h" +#include "UnicodeFromUTF8.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +namespace { + // Use an unnamed namespace to protect the declarations from name conflicts + +// Unicode code points are ordered by groups and follow patterns. +// Most characters (pitch==1) are in ranges for a particular alphabet and their +// upper case forms are a fixed distance away. +// Another pattern (pitch==2) is where each lower case letter is preceded by +// the upper case form. These are also grouped into ranges. + +int symmetricCaseConversionRanges[] = { +//lower, upper, range length, range pitch +//++Autogenerated -- start of section automatically generated +//**\(\*\n\) +97,65,26,1, +224,192,23,1, +248,216,7,1, +257,256,24,2, +314,313,8,2, +331,330,23,2, +462,461,8,2, +479,478,9,2, +505,504,20,2, +547,546,9,2, +583,582,5,2, +945,913,17,1, +963,931,9,1, +985,984,12,2, +1072,1040,32,1, +1104,1024,16,1, +1121,1120,17,2, +1163,1162,27,2, +1218,1217,7,2, +1233,1232,44,2, +1377,1329,38,1, +7681,7680,75,2, +7841,7840,48,2, +7936,7944,8,1, +7952,7960,6,1, +7968,7976,8,1, +7984,7992,8,1, +8000,8008,6,1, +8032,8040,8,1, +8560,8544,16,1, +9424,9398,26,1, +11312,11264,47,1, +11393,11392,50,2, +11520,4256,38,1, +42561,42560,23,2, +42625,42624,12,2, +42787,42786,7,2, +42803,42802,31,2, +42879,42878,5,2, +42913,42912,5,2, +65345,65313,26,1, +66600,66560,40,1, + +//--Autogenerated -- end of section automatically generated +}; + +// Code points that are symmetric but don't fit into a range of similar characters +// are listed here. + +int symmetricCaseConversions[] = { +//lower, upper +//++Autogenerated -- start of section automatically generated +//**1 \(\*\n\) +255,376, +307,306, +309,308, +311,310, +378,377, +380,379, +382,381, +384,579, +387,386, +389,388, +392,391, +396,395, +402,401, +405,502, +409,408, +410,573, +414,544, +417,416, +419,418, +421,420, +424,423, +429,428, +432,431, +436,435, +438,437, +441,440, +445,444, +447,503, +454,452, +457,455, +460,458, +477,398, +499,497, +501,500, +572,571, +575,11390, +576,11391, +578,577, +592,11375, +593,11373, +594,11376, +595,385, +596,390, +598,393, +599,394, +601,399, +603,400, +608,403, +611,404, +613,42893, +614,42922, +616,407, +617,406, +619,11362, +623,412, +625,11374, +626,413, +629,415, +637,11364, +640,422, +643,425, +648,430, +649,580, +650,433, +651,434, +652,581, +658,439, +881,880, +883,882, +887,886, +891,1021, +892,1022, +893,1023, +940,902, +941,904, +942,905, +943,906, +972,908, +973,910, +974,911, +983,975, +1010,1017, +1016,1015, +1019,1018, +1231,1216, +7545,42877, +7549,11363, +8017,8025, +8019,8027, +8021,8029, +8023,8031, +8048,8122, +8049,8123, +8050,8136, +8051,8137, +8052,8138, +8053,8139, +8054,8154, +8055,8155, +8056,8184, +8057,8185, +8058,8170, +8059,8171, +8060,8186, +8061,8187, +8112,8120, +8113,8121, +8144,8152, +8145,8153, +8160,8168, +8161,8169, +8165,8172, +8526,8498, +8580,8579, +11361,11360, +11365,570, +11366,574, +11368,11367, +11370,11369, +11372,11371, +11379,11378, +11382,11381, +11500,11499, +11502,11501, +11507,11506, +11559,4295, +11565,4301, +42874,42873, +42876,42875, +42892,42891, +42897,42896, +42899,42898, + +//--Autogenerated -- end of section automatically generated +}; + +// Characters that have complex case conversions are listed here. +// This includes cases where more than one character is needed for a conversion, +// folding is different to lowering, or (as appropriate) upper(lower(x)) != x or +// lower(upper(x)) != x. + +const char *complexCaseConversions = +// Original | Folded | Upper | Lower | +//++Autogenerated -- start of section automatically generated +//**2 \(\*\n\) +"\xc2\xb5|\xce\xbc|\xce\x9c||" +"\xc3\x9f|ss|SS||" +"\xc4\xb0|i\xcc\x87||i\xcc\x87|" +"\xc4\xb1||I||" +"\xc5\x89|\xca\xbcn|\xca\xbcN||" +"\xc5\xbf|s|S||" +"\xc7\x85|\xc7\x86|\xc7\x84|\xc7\x86|" +"\xc7\x88|\xc7\x89|\xc7\x87|\xc7\x89|" +"\xc7\x8b|\xc7\x8c|\xc7\x8a|\xc7\x8c|" +"\xc7\xb0|j\xcc\x8c|J\xcc\x8c||" +"\xc7\xb2|\xc7\xb3|\xc7\xb1|\xc7\xb3|" +"\xcd\x85|\xce\xb9|\xce\x99||" +"\xce\x90|\xce\xb9\xcc\x88\xcc\x81|\xce\x99\xcc\x88\xcc\x81||" +"\xce\xb0|\xcf\x85\xcc\x88\xcc\x81|\xce\xa5\xcc\x88\xcc\x81||" +"\xcf\x82|\xcf\x83|\xce\xa3||" +"\xcf\x90|\xce\xb2|\xce\x92||" +"\xcf\x91|\xce\xb8|\xce\x98||" +"\xcf\x95|\xcf\x86|\xce\xa6||" +"\xcf\x96|\xcf\x80|\xce\xa0||" +"\xcf\xb0|\xce\xba|\xce\x9a||" +"\xcf\xb1|\xcf\x81|\xce\xa1||" +"\xcf\xb4|\xce\xb8||\xce\xb8|" +"\xcf\xb5|\xce\xb5|\xce\x95||" +"\xd6\x87|\xd5\xa5\xd6\x82|\xd4\xb5\xd5\x92||" +"\xe1\xba\x96|h\xcc\xb1|H\xcc\xb1||" +"\xe1\xba\x97|t\xcc\x88|T\xcc\x88||" +"\xe1\xba\x98|w\xcc\x8a|W\xcc\x8a||" +"\xe1\xba\x99|y\xcc\x8a|Y\xcc\x8a||" +"\xe1\xba\x9a|a\xca\xbe|A\xca\xbe||" +"\xe1\xba\x9b|\xe1\xb9\xa1|\xe1\xb9\xa0||" +"\xe1\xba\x9e|ss||\xc3\x9f|" +"\xe1\xbd\x90|\xcf\x85\xcc\x93|\xce\xa5\xcc\x93||" +"\xe1\xbd\x92|\xcf\x85\xcc\x93\xcc\x80|\xce\xa5\xcc\x93\xcc\x80||" +"\xe1\xbd\x94|\xcf\x85\xcc\x93\xcc\x81|\xce\xa5\xcc\x93\xcc\x81||" +"\xe1\xbd\x96|\xcf\x85\xcc\x93\xcd\x82|\xce\xa5\xcc\x93\xcd\x82||" +"\xe1\xbe\x80|\xe1\xbc\x80\xce\xb9|\xe1\xbc\x88\xce\x99||" +"\xe1\xbe\x81|\xe1\xbc\x81\xce\xb9|\xe1\xbc\x89\xce\x99||" +"\xe1\xbe\x82|\xe1\xbc\x82\xce\xb9|\xe1\xbc\x8a\xce\x99||" +"\xe1\xbe\x83|\xe1\xbc\x83\xce\xb9|\xe1\xbc\x8b\xce\x99||" +"\xe1\xbe\x84|\xe1\xbc\x84\xce\xb9|\xe1\xbc\x8c\xce\x99||" +"\xe1\xbe\x85|\xe1\xbc\x85\xce\xb9|\xe1\xbc\x8d\xce\x99||" +"\xe1\xbe\x86|\xe1\xbc\x86\xce\xb9|\xe1\xbc\x8e\xce\x99||" +"\xe1\xbe\x87|\xe1\xbc\x87\xce\xb9|\xe1\xbc\x8f\xce\x99||" +"\xe1\xbe\x88|\xe1\xbc\x80\xce\xb9|\xe1\xbc\x88\xce\x99|\xe1\xbe\x80|" +"\xe1\xbe\x89|\xe1\xbc\x81\xce\xb9|\xe1\xbc\x89\xce\x99|\xe1\xbe\x81|" +"\xe1\xbe\x8a|\xe1\xbc\x82\xce\xb9|\xe1\xbc\x8a\xce\x99|\xe1\xbe\x82|" +"\xe1\xbe\x8b|\xe1\xbc\x83\xce\xb9|\xe1\xbc\x8b\xce\x99|\xe1\xbe\x83|" +"\xe1\xbe\x8c|\xe1\xbc\x84\xce\xb9|\xe1\xbc\x8c\xce\x99|\xe1\xbe\x84|" +"\xe1\xbe\x8d|\xe1\xbc\x85\xce\xb9|\xe1\xbc\x8d\xce\x99|\xe1\xbe\x85|" +"\xe1\xbe\x8e|\xe1\xbc\x86\xce\xb9|\xe1\xbc\x8e\xce\x99|\xe1\xbe\x86|" +"\xe1\xbe\x8f|\xe1\xbc\x87\xce\xb9|\xe1\xbc\x8f\xce\x99|\xe1\xbe\x87|" +"\xe1\xbe\x90|\xe1\xbc\xa0\xce\xb9|\xe1\xbc\xa8\xce\x99||" +"\xe1\xbe\x91|\xe1\xbc\xa1\xce\xb9|\xe1\xbc\xa9\xce\x99||" +"\xe1\xbe\x92|\xe1\xbc\xa2\xce\xb9|\xe1\xbc\xaa\xce\x99||" +"\xe1\xbe\x93|\xe1\xbc\xa3\xce\xb9|\xe1\xbc\xab\xce\x99||" +"\xe1\xbe\x94|\xe1\xbc\xa4\xce\xb9|\xe1\xbc\xac\xce\x99||" +"\xe1\xbe\x95|\xe1\xbc\xa5\xce\xb9|\xe1\xbc\xad\xce\x99||" +"\xe1\xbe\x96|\xe1\xbc\xa6\xce\xb9|\xe1\xbc\xae\xce\x99||" +"\xe1\xbe\x97|\xe1\xbc\xa7\xce\xb9|\xe1\xbc\xaf\xce\x99||" +"\xe1\xbe\x98|\xe1\xbc\xa0\xce\xb9|\xe1\xbc\xa8\xce\x99|\xe1\xbe\x90|" +"\xe1\xbe\x99|\xe1\xbc\xa1\xce\xb9|\xe1\xbc\xa9\xce\x99|\xe1\xbe\x91|" +"\xe1\xbe\x9a|\xe1\xbc\xa2\xce\xb9|\xe1\xbc\xaa\xce\x99|\xe1\xbe\x92|" +"\xe1\xbe\x9b|\xe1\xbc\xa3\xce\xb9|\xe1\xbc\xab\xce\x99|\xe1\xbe\x93|" +"\xe1\xbe\x9c|\xe1\xbc\xa4\xce\xb9|\xe1\xbc\xac\xce\x99|\xe1\xbe\x94|" +"\xe1\xbe\x9d|\xe1\xbc\xa5\xce\xb9|\xe1\xbc\xad\xce\x99|\xe1\xbe\x95|" +"\xe1\xbe\x9e|\xe1\xbc\xa6\xce\xb9|\xe1\xbc\xae\xce\x99|\xe1\xbe\x96|" +"\xe1\xbe\x9f|\xe1\xbc\xa7\xce\xb9|\xe1\xbc\xaf\xce\x99|\xe1\xbe\x97|" +"\xe1\xbe\xa0|\xe1\xbd\xa0\xce\xb9|\xe1\xbd\xa8\xce\x99||" +"\xe1\xbe\xa1|\xe1\xbd\xa1\xce\xb9|\xe1\xbd\xa9\xce\x99||" +"\xe1\xbe\xa2|\xe1\xbd\xa2\xce\xb9|\xe1\xbd\xaa\xce\x99||" +"\xe1\xbe\xa3|\xe1\xbd\xa3\xce\xb9|\xe1\xbd\xab\xce\x99||" +"\xe1\xbe\xa4|\xe1\xbd\xa4\xce\xb9|\xe1\xbd\xac\xce\x99||" +"\xe1\xbe\xa5|\xe1\xbd\xa5\xce\xb9|\xe1\xbd\xad\xce\x99||" +"\xe1\xbe\xa6|\xe1\xbd\xa6\xce\xb9|\xe1\xbd\xae\xce\x99||" +"\xe1\xbe\xa7|\xe1\xbd\xa7\xce\xb9|\xe1\xbd\xaf\xce\x99||" +"\xe1\xbe\xa8|\xe1\xbd\xa0\xce\xb9|\xe1\xbd\xa8\xce\x99|\xe1\xbe\xa0|" +"\xe1\xbe\xa9|\xe1\xbd\xa1\xce\xb9|\xe1\xbd\xa9\xce\x99|\xe1\xbe\xa1|" +"\xe1\xbe\xaa|\xe1\xbd\xa2\xce\xb9|\xe1\xbd\xaa\xce\x99|\xe1\xbe\xa2|" +"\xe1\xbe\xab|\xe1\xbd\xa3\xce\xb9|\xe1\xbd\xab\xce\x99|\xe1\xbe\xa3|" +"\xe1\xbe\xac|\xe1\xbd\xa4\xce\xb9|\xe1\xbd\xac\xce\x99|\xe1\xbe\xa4|" +"\xe1\xbe\xad|\xe1\xbd\xa5\xce\xb9|\xe1\xbd\xad\xce\x99|\xe1\xbe\xa5|" +"\xe1\xbe\xae|\xe1\xbd\xa6\xce\xb9|\xe1\xbd\xae\xce\x99|\xe1\xbe\xa6|" +"\xe1\xbe\xaf|\xe1\xbd\xa7\xce\xb9|\xe1\xbd\xaf\xce\x99|\xe1\xbe\xa7|" +"\xe1\xbe\xb2|\xe1\xbd\xb0\xce\xb9|\xe1\xbe\xba\xce\x99||" +"\xe1\xbe\xb3|\xce\xb1\xce\xb9|\xce\x91\xce\x99||" +"\xe1\xbe\xb4|\xce\xac\xce\xb9|\xce\x86\xce\x99||" +"\xe1\xbe\xb6|\xce\xb1\xcd\x82|\xce\x91\xcd\x82||" +"\xe1\xbe\xb7|\xce\xb1\xcd\x82\xce\xb9|\xce\x91\xcd\x82\xce\x99||" +"\xe1\xbe\xbc|\xce\xb1\xce\xb9|\xce\x91\xce\x99|\xe1\xbe\xb3|" +"\xe1\xbe\xbe|\xce\xb9|\xce\x99||" +"\xe1\xbf\x82|\xe1\xbd\xb4\xce\xb9|\xe1\xbf\x8a\xce\x99||" +"\xe1\xbf\x83|\xce\xb7\xce\xb9|\xce\x97\xce\x99||" +"\xe1\xbf\x84|\xce\xae\xce\xb9|\xce\x89\xce\x99||" +"\xe1\xbf\x86|\xce\xb7\xcd\x82|\xce\x97\xcd\x82||" +"\xe1\xbf\x87|\xce\xb7\xcd\x82\xce\xb9|\xce\x97\xcd\x82\xce\x99||" +"\xe1\xbf\x8c|\xce\xb7\xce\xb9|\xce\x97\xce\x99|\xe1\xbf\x83|" +"\xe1\xbf\x92|\xce\xb9\xcc\x88\xcc\x80|\xce\x99\xcc\x88\xcc\x80||" +"\xe1\xbf\x93|\xce\xb9\xcc\x88\xcc\x81|\xce\x99\xcc\x88\xcc\x81||" +"\xe1\xbf\x96|\xce\xb9\xcd\x82|\xce\x99\xcd\x82||" +"\xe1\xbf\x97|\xce\xb9\xcc\x88\xcd\x82|\xce\x99\xcc\x88\xcd\x82||" +"\xe1\xbf\xa2|\xcf\x85\xcc\x88\xcc\x80|\xce\xa5\xcc\x88\xcc\x80||" +"\xe1\xbf\xa3|\xcf\x85\xcc\x88\xcc\x81|\xce\xa5\xcc\x88\xcc\x81||" +"\xe1\xbf\xa4|\xcf\x81\xcc\x93|\xce\xa1\xcc\x93||" +"\xe1\xbf\xa6|\xcf\x85\xcd\x82|\xce\xa5\xcd\x82||" +"\xe1\xbf\xa7|\xcf\x85\xcc\x88\xcd\x82|\xce\xa5\xcc\x88\xcd\x82||" +"\xe1\xbf\xb2|\xe1\xbd\xbc\xce\xb9|\xe1\xbf\xba\xce\x99||" +"\xe1\xbf\xb3|\xcf\x89\xce\xb9|\xce\xa9\xce\x99||" +"\xe1\xbf\xb4|\xcf\x8e\xce\xb9|\xce\x8f\xce\x99||" +"\xe1\xbf\xb6|\xcf\x89\xcd\x82|\xce\xa9\xcd\x82||" +"\xe1\xbf\xb7|\xcf\x89\xcd\x82\xce\xb9|\xce\xa9\xcd\x82\xce\x99||" +"\xe1\xbf\xbc|\xcf\x89\xce\xb9|\xce\xa9\xce\x99|\xe1\xbf\xb3|" +"\xe2\x84\xa6|\xcf\x89||\xcf\x89|" +"\xe2\x84\xaa|k||k|" +"\xe2\x84\xab|\xc3\xa5||\xc3\xa5|" +"\xef\xac\x80|ff|FF||" +"\xef\xac\x81|fi|FI||" +"\xef\xac\x82|fl|FL||" +"\xef\xac\x83|ffi|FFI||" +"\xef\xac\x84|ffl|FFL||" +"\xef\xac\x85|st|ST||" +"\xef\xac\x86|st|ST||" +"\xef\xac\x93|\xd5\xb4\xd5\xb6|\xd5\x84\xd5\x86||" +"\xef\xac\x94|\xd5\xb4\xd5\xa5|\xd5\x84\xd4\xb5||" +"\xef\xac\x95|\xd5\xb4\xd5\xab|\xd5\x84\xd4\xbb||" +"\xef\xac\x96|\xd5\xbe\xd5\xb6|\xd5\x8e\xd5\x86||" +"\xef\xac\x97|\xd5\xb4\xd5\xad|\xd5\x84\xd4\xbd||" + +//--Autogenerated -- end of section automatically generated +; + +class CaseConverter : public ICaseConverter { + // Maximum length of a case conversion result is 6 bytes in UTF-8 + enum { maxConversionLength=6 }; + struct ConversionString { + char conversion[maxConversionLength+1]; + ConversionString() { + conversion[0] = '\0'; + } + }; + // Conversions are initially store in a vector of structs but then decomposed into + // parallel arrays as that is about 10% faster to search. + struct CharacterConversion { + int character; + ConversionString conversion; + CharacterConversion(int character_=0, const char *conversion_="") : character(character_) { + StringCopy(conversion.conversion, conversion_); + } + bool operator<(const CharacterConversion &other) const { + return character < other.character; + } + }; + typedef std::vector CharacterToConversion; + CharacterToConversion characterToConversion; + // The parallel arrays + std::vector characters; + std::vector conversions; + +public: + CaseConverter() { + } + bool Initialised() const { + return characters.size() > 0; + } + void Add(int character, const char *conversion) { + characterToConversion.push_back(CharacterConversion(character, conversion)); + } + const char *Find(int character) { + const std::vector::iterator it = std::lower_bound(characters.begin(), characters.end(), character); + if (it == characters.end()) + return 0; + else if (*it == character) + return conversions[it - characters.begin()].conversion; + else + return 0; + } + size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) { + size_t lenConverted = 0; + size_t mixedPos = 0; + unsigned char bytes[UTF8MaxBytes + 1]; + while (mixedPos < lenMixed) { + const unsigned char leadByte = static_cast(mixed[mixedPos]); + const char *caseConverted = 0; + size_t lenMixedChar = 1; + if (UTF8IsAscii(leadByte)) { + caseConverted = Find(leadByte); + } else { + bytes[0] = leadByte; + const int widthCharBytes = UTF8BytesOfLead[leadByte]; + for (int b=1; b= sizeConverted) + return 0; + } + } else { + // Character has no conversion so copy the input to output + for (size_t i=0; i= sizeConverted) + return 0; + } + } + mixedPos += lenMixedChar; + } + return lenConverted; + } + void FinishedAdding() { + std::sort(characterToConversion.begin(), characterToConversion.end()); + characters.reserve(characterToConversion.size()); + conversions.reserve(characterToConversion.size()); + for (CharacterToConversion::iterator it = characterToConversion.begin(); it != characterToConversion.end(); ++it) { + characters.push_back(it->character); + conversions.push_back(it->conversion); + } + // Empty the original calculated data completely + CharacterToConversion().swap(characterToConversion); + } +}; + +CaseConverter caseConvFold; +CaseConverter caseConvUp; +CaseConverter caseConvLow; + +void UTF8FromUTF32Character(int uch, char *putf) { + size_t k = 0; + if (uch < 0x80) { + putf[k++] = static_cast(uch); + } else if (uch < 0x800) { + putf[k++] = static_cast(0xC0 | (uch >> 6)); + putf[k++] = static_cast(0x80 | (uch & 0x3f)); + } else if (uch < 0x10000) { + putf[k++] = static_cast(0xE0 | (uch >> 12)); + putf[k++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); + putf[k++] = static_cast(0x80 | (uch & 0x3f)); + } else { + putf[k++] = static_cast(0xF0 | (uch >> 18)); + putf[k++] = static_cast(0x80 | ((uch >> 12) & 0x3f)); + putf[k++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); + putf[k++] = static_cast(0x80 | (uch & 0x3f)); + } + putf[k] = 0; +} + +void AddSymmetric(enum CaseConversion conversion, int lower,int upper) { + char lowerUTF8[UTF8MaxBytes+1]; + UTF8FromUTF32Character(lower, lowerUTF8); + char upperUTF8[UTF8MaxBytes+1]; + UTF8FromUTF32Character(upper, upperUTF8); + + switch (conversion) { + case CaseConversionFold: + caseConvFold.Add(upper, lowerUTF8); + break; + case CaseConversionUpper: + caseConvUp.Add(lower, upperUTF8); + break; + case CaseConversionLower: + caseConvLow.Add(upper, lowerUTF8); + break; + } +} + +void SetupConversions(enum CaseConversion conversion) { + // First initialize for the symmetric ranges + for (size_t i=0; i(originUTF8)); + + if (conversion == CaseConversionFold && foldedUTF8[0]) { + caseConvFold.Add(character, foldedUTF8); + } + + if (conversion == CaseConversionUpper && upperUTF8[0]) { + caseConvUp.Add(character, upperUTF8); + } + + if (conversion == CaseConversionLower && lowerUTF8[0]) { + caseConvLow.Add(character, lowerUTF8); + } + } + + switch (conversion) { + case CaseConversionFold: + caseConvFold.FinishedAdding(); + break; + case CaseConversionUpper: + caseConvUp.FinishedAdding(); + break; + case CaseConversionLower: + caseConvLow.FinishedAdding(); + break; + } +} + +CaseConverter *ConverterForConversion(enum CaseConversion conversion) { + switch (conversion) { + case CaseConversionFold: + return &caseConvFold; + case CaseConversionUpper: + return &caseConvUp; + case CaseConversionLower: + return &caseConvLow; + } + return 0; +} + +} + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +ICaseConverter *ConverterFor(enum CaseConversion conversion) { + CaseConverter *pCaseConv = ConverterForConversion(conversion); + if (!pCaseConv->Initialised()) + SetupConversions(conversion); + return pCaseConv; +} + +const char *CaseConvert(int character, enum CaseConversion conversion) { + CaseConverter *pCaseConv = ConverterForConversion(conversion); + if (!pCaseConv->Initialised()) + SetupConversions(conversion); + return pCaseConv->Find(character); +} + +size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion) { + CaseConverter *pCaseConv = ConverterForConversion(conversion); + if (!pCaseConv->Initialised()) + SetupConversions(conversion); + return pCaseConv->CaseConvertString(converted, sizeConverted, mixed, lenMixed); +} + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/libs/qscintilla/src/CaseConvert.h b/libs/qscintilla/src/CaseConvert.h new file mode 100644 index 000000000..60de22799 --- /dev/null +++ b/libs/qscintilla/src/CaseConvert.h @@ -0,0 +1,47 @@ +// Scintilla source code edit control +// Encoding: UTF-8 +/** @file CaseConvert.h + ** Performs Unicode case conversions. + ** Does not handle locale-sensitive case conversion. + **/ +// Copyright 2013 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CASECONVERT_H +#define CASECONVERT_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +enum CaseConversion { + CaseConversionFold, + CaseConversionUpper, + CaseConversionLower +}; + +class ICaseConverter { +public: + virtual size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) = 0; +}; + +ICaseConverter *ConverterFor(enum CaseConversion conversion); + +// Returns a UTF-8 string. Empty when no conversion +const char *CaseConvert(int character, enum CaseConversion conversion); + +// When performing CaseConvertString, the converted value may be up to 3 times longer than the input. +// Ligatures are often decomposed into multiple characters and long cases include: +// ΐ "\xce\x90" folds to ΐ "\xce\xb9\xcc\x88\xcc\x81" +const int maxExpansionCaseConversion=3; + +// Converts a mixed case string using a particular conversion. +// Result may be a different length to input and the length is the return value. +// If there is not enough space then 0 is returned. +size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, enum CaseConversion conversion); + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/CaseFolder.cpp b/libs/qscintilla/src/CaseFolder.cpp new file mode 100644 index 000000000..200ac99b8 --- /dev/null +++ b/libs/qscintilla/src/CaseFolder.cpp @@ -0,0 +1,68 @@ +// Scintilla source code edit control +/** @file CaseFolder.cxx + ** Classes for case folding. + **/ +// Copyright 1998-2013 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include + +#include "CaseFolder.h" +#include "CaseConvert.h" +#include "UniConversion.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +CaseFolder::~CaseFolder() { +} + +CaseFolderTable::CaseFolderTable() { + for (size_t iChar=0; iChar(iChar); + } +} + +CaseFolderTable::~CaseFolderTable() { +} + +size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { + if (lenMixed > sizeFolded) { + return 0; + } else { + for (size_t i=0; i(mixed[i])]; + } + return lenMixed; + } +} + +void CaseFolderTable::SetTranslation(char ch, char chTranslation) { + mapping[static_cast(ch)] = chTranslation; +} + +void CaseFolderTable::StandardASCII() { + for (size_t iChar=0; iChar= 'A' && iChar <= 'Z') { + mapping[iChar] = static_cast(iChar - 'A' + 'a'); + } else { + mapping[iChar] = static_cast(iChar); + } + } +} + +CaseFolderUnicode::CaseFolderUnicode() { + StandardASCII(); + converter = ConverterFor(CaseConversionFold); +} + +size_t CaseFolderUnicode::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { + if ((lenMixed == 1) && (sizeFolded > 0)) { + folded[0] = mapping[static_cast(mixed[0])]; + return 1; + } else { + return converter->CaseConvertString(folded, sizeFolded, mixed, lenMixed); + } +} diff --git a/libs/qscintilla/src/CaseFolder.h b/libs/qscintilla/src/CaseFolder.h new file mode 100644 index 000000000..2d754d4f3 --- /dev/null +++ b/libs/qscintilla/src/CaseFolder.h @@ -0,0 +1,45 @@ +// Scintilla source code edit control +/** @file CaseFolder.h + ** Classes for case folding. + **/ +// Copyright 1998-2013 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CASEFOLDER_H +#define CASEFOLDER_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class CaseFolder { +public: + virtual ~CaseFolder(); + virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0; +}; + +class CaseFolderTable : public CaseFolder { +protected: + char mapping[256]; +public: + CaseFolderTable(); + virtual ~CaseFolderTable(); + virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed); + void SetTranslation(char ch, char chTranslation); + void StandardASCII(); +}; + +class ICaseConverter; + +class CaseFolderUnicode : public CaseFolderTable { + ICaseConverter *converter; +public: + CaseFolderUnicode(); + virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Catalogue.cpp b/libs/qscintilla/src/Catalogue.cpp new file mode 100644 index 000000000..c318d1874 --- /dev/null +++ b/libs/qscintilla/src/Catalogue.cpp @@ -0,0 +1,84 @@ +// Scintilla source code edit control +/** @file Catalogue.cxx + ** Colourise for particular languages. + **/ +// Copyright 1998-2002 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 "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "LexerModule.h" +#include "Catalogue.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static std::vector lexerCatalogue; +static int nextLanguage = SCLEX_AUTOMATIC+1; + +const LexerModule *Catalogue::Find(int language) { + Scintilla_LinkLexers(); + for (std::vector::iterator it=lexerCatalogue.begin(); + it != lexerCatalogue.end(); ++it) { + if ((*it)->GetLanguage() == language) { + return *it; + } + } + return 0; +} + +const LexerModule *Catalogue::Find(const char *languageName) { + Scintilla_LinkLexers(); + if (languageName) { + for (std::vector::iterator it=lexerCatalogue.begin(); + it != lexerCatalogue.end(); ++it) { + if ((*it)->languageName && (0 == strcmp((*it)->languageName, languageName))) { + return *it; + } + } + } + return 0; +} + +void Catalogue::AddLexerModule(LexerModule *plm) { + if (plm->GetLanguage() == SCLEX_AUTOMATIC) { + plm->language = nextLanguage; + nextLanguage++; + } + lexerCatalogue.push_back(plm); +} + +// To add or remove a lexer, add or remove its file and run LexGen.py. + +// Force a reference to all of the Scintilla lexers so that the linker will +// not remove the code of the lexers. +int Scintilla_LinkLexers() { + + static int initialised = 0; + if (initialised) + return 0; + initialised = 1; + +// Shorten the code that declares a lexer and ensures it is linked in by calling a method. +#define LINK_LEXER(lexer) extern LexerModule lexer; Catalogue::AddLexerModule(&lexer); + +//++Autogenerated -- run scripts/LexGen.py to regenerate +//**\(\tLINK_LEXER(\*);\n\) + LINK_LEXER(lmSQL); + +//--Autogenerated -- end of automatically generated section + + return 1; +} diff --git a/libs/qscintilla/src/Catalogue.h b/libs/qscintilla/src/Catalogue.h new file mode 100644 index 000000000..7fea37da8 --- /dev/null +++ b/libs/qscintilla/src/Catalogue.h @@ -0,0 +1,26 @@ +// Scintilla source code edit control +/** @file Catalogue.h + ** Lexer infrastructure. + **/ +// Copyright 1998-2010 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CATALOGUE_H +#define CATALOGUE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class Catalogue { +public: + static const LexerModule *Find(int language); + static const LexerModule *Find(const char *languageName); + static void AddLexerModule(LexerModule *plm); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/CellBuffer.cpp b/libs/qscintilla/src/CellBuffer.cpp new file mode 100644 index 000000000..dfa1350c0 --- /dev/null +++ b/libs/qscintilla/src/CellBuffer.cpp @@ -0,0 +1,822 @@ +// Scintilla source code edit control +/** @file CellBuffer.cxx + ** Manages a buffer of cells. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "CellBuffer.h" +#include "UniConversion.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LineVector::LineVector() : starts(256), perLine(0) { + Init(); +} + +LineVector::~LineVector() { + starts.DeleteAll(); +} + +void LineVector::Init() { + starts.DeleteAll(); + if (perLine) { + perLine->Init(); + } +} + +void LineVector::SetPerLine(PerLine *pl) { + perLine = pl; +} + +void LineVector::InsertText(int line, int delta) { + starts.InsertText(line, delta); +} + +void LineVector::InsertLine(int line, int position, bool lineStart) { + starts.InsertPartition(line, position); + if (perLine) { + if ((line > 0) && lineStart) + line--; + perLine->InsertLine(line); + } +} + +void LineVector::SetLineStart(int line, int position) { + starts.SetPartitionStartPosition(line, position); +} + +void LineVector::RemoveLine(int line) { + starts.RemovePartition(line); + if (perLine) { + perLine->RemoveLine(line); + } +} + +int LineVector::LineFromPosition(int pos) const { + return starts.PartitionFromPosition(pos); +} + +Action::Action() { + at = startAction; + position = 0; + data = 0; + lenData = 0; + mayCoalesce = false; +} + +Action::~Action() { + Destroy(); +} + +void Action::Create(actionType at_, int position_, const char *data_, int lenData_, bool mayCoalesce_) { + delete []data; + data = NULL; + position = position_; + at = at_; + if (lenData_) { + data = new char[lenData_]; + memcpy(data, data_, lenData_); + } + lenData = lenData_; + mayCoalesce = mayCoalesce_; +} + +void Action::Destroy() { + delete []data; + data = 0; +} + +void Action::Grab(Action *source) { + delete []data; + + position = source->position; + at = source->at; + data = source->data; + lenData = source->lenData; + mayCoalesce = source->mayCoalesce; + + // Ownership of source data transferred to this + source->position = 0; + source->at = startAction; + source->data = 0; + source->lenData = 0; + source->mayCoalesce = true; +} + +// The undo history stores a sequence of user operations that represent the user's view of the +// commands executed on the text. +// Each user operation contains a sequence of text insertion and text deletion actions. +// All the user operations are stored in a list of individual actions with 'start' actions used +// as delimiters between user operations. +// Initially there is one start action in the history. +// As each action is performed, it is recorded in the history. The action may either become +// part of the current user operation or may start a new user operation. If it is to be part of the +// current operation, then it overwrites the current last action. If it is to be part of a new +// operation, it is appended after the current last action. +// After writing the new action, a new start action is appended at the end of the history. +// The decision of whether to start a new user operation is based upon two factors. If a +// compound operation has been explicitly started by calling BeginUndoAction and no matching +// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current +// operation. If there is no outstanding BeginUndoAction call then a new operation is started +// unless it looks as if the new action is caused by the user typing or deleting a stream of text. +// Sequences that look like typing or deletion are coalesced into a single user operation. + +UndoHistory::UndoHistory() { + + lenActions = 100; + actions = new Action[lenActions]; + maxAction = 0; + currentAction = 0; + undoSequenceDepth = 0; + savePoint = 0; + tentativePoint = -1; + + actions[currentAction].Create(startAction); +} + +UndoHistory::~UndoHistory() { + delete []actions; + actions = 0; +} + +void UndoHistory::EnsureUndoRoom() { + // Have to test that there is room for 2 more actions in the array + // as two actions may be created by the calling function + if (currentAction >= (lenActions - 2)) { + // Run out of undo nodes so extend the array + int lenActionsNew = lenActions * 2; + Action *actionsNew = new Action[lenActionsNew]; + for (int act = 0; act <= currentAction; act++) + actionsNew[act].Grab(&actions[act]); + delete []actions; + lenActions = lenActionsNew; + actions = actionsNew; + } +} + +const char *UndoHistory::AppendAction(actionType at, int position, const char *data, int lengthData, + bool &startSequence, bool mayCoalesce) { + EnsureUndoRoom(); + //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); + //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, + // actions[currentAction - 1].position, actions[currentAction - 1].lenData); + if (currentAction < savePoint) { + savePoint = -1; + } + int oldCurrentAction = currentAction; + if (currentAction >= 1) { + if (0 == undoSequenceDepth) { + // Top level actions may not always be coalesced + int targetAct = -1; + const Action *actPrevious = &(actions[currentAction + targetAct]); + // Container actions may forward the coalesce state of Scintilla Actions. + while ((actPrevious->at == containerAction) && actPrevious->mayCoalesce) { + targetAct--; + actPrevious = &(actions[currentAction + targetAct]); + } + // See if current action can be coalesced into previous action + // Will work if both are inserts or deletes and position is same +#if defined(_MSC_VER) && defined(_PREFAST_) + // Visual Studio 2013 Code Analysis wrongly believes actions can be NULL at its next reference + __analysis_assume(actions); +#endif + if ((currentAction == savePoint) || (currentAction == tentativePoint)) { + currentAction++; + } else if (!actions[currentAction].mayCoalesce) { + // Not allowed to coalesce if this set + currentAction++; + } else if (!mayCoalesce || !actPrevious->mayCoalesce) { + currentAction++; + } else if (at == containerAction || actions[currentAction].at == containerAction) { + ; // A coalescible containerAction + } else if ((at != actPrevious->at) && (actPrevious->at != startAction)) { + currentAction++; + } else if ((at == insertAction) && + (position != (actPrevious->position + actPrevious->lenData))) { + // Insertions must be immediately after to coalesce + currentAction++; + } else if (at == removeAction) { + if ((lengthData == 1) || (lengthData == 2)) { + if ((position + lengthData) == actPrevious->position) { + ; // Backspace -> OK + } else if (position == actPrevious->position) { + ; // Delete -> OK + } else { + // Removals must be at same position to coalesce + currentAction++; + } + } else { + // Removals must be of one character to coalesce + currentAction++; + } + } else { + // Action coalesced. + } + + } else { + // Actions not at top level are always coalesced unless this is after return to top level + if (!actions[currentAction].mayCoalesce) + currentAction++; + } + } else { + currentAction++; + } + startSequence = oldCurrentAction != currentAction; + int actionWithData = currentAction; + actions[currentAction].Create(at, position, data, lengthData, mayCoalesce); + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + return actions[actionWithData].data; +} + +void UndoHistory::BeginUndoAction() { + EnsureUndoRoom(); + if (undoSequenceDepth == 0) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } + undoSequenceDepth++; +} + +void UndoHistory::EndUndoAction() { + PLATFORM_ASSERT(undoSequenceDepth > 0); + EnsureUndoRoom(); + undoSequenceDepth--; + if (0 == undoSequenceDepth) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } +} + +void UndoHistory::DropUndoSequence() { + undoSequenceDepth = 0; +} + +void UndoHistory::DeleteUndoHistory() { + for (int i = 1; i < maxAction; i++) + actions[i].Destroy(); + maxAction = 0; + currentAction = 0; + actions[currentAction].Create(startAction); + savePoint = 0; + tentativePoint = -1; +} + +void UndoHistory::SetSavePoint() { + savePoint = currentAction; +} + +bool UndoHistory::IsSavePoint() const { + return savePoint == currentAction; +} + +void UndoHistory::TentativeStart() { + tentativePoint = currentAction; +} + +void UndoHistory::TentativeCommit() { + tentativePoint = -1; + // Truncate undo history + maxAction = currentAction; +} + +int UndoHistory::TentativeSteps() { + // Drop any trailing startAction + if (actions[currentAction].at == startAction && currentAction > 0) + currentAction--; + if (tentativePoint >= 0) + return currentAction - tentativePoint; + else + return -1; +} + +bool UndoHistory::CanUndo() const { + return (currentAction > 0) && (maxAction > 0); +} + +int UndoHistory::StartUndo() { + // Drop any trailing startAction + if (actions[currentAction].at == startAction && currentAction > 0) + currentAction--; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act > 0) { + act--; + } + return currentAction - act; +} + +const Action &UndoHistory::GetUndoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedUndoStep() { + currentAction--; +} + +bool UndoHistory::CanRedo() const { + return maxAction > currentAction; +} + +int UndoHistory::StartRedo() { + // Drop any leading startAction + if (actions[currentAction].at == startAction && currentAction < maxAction) + currentAction++; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act < maxAction) { + act++; + } + return act - currentAction; +} + +const Action &UndoHistory::GetRedoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedRedoStep() { + currentAction++; +} + +CellBuffer::CellBuffer() { + readOnly = false; + utf8LineEnds = 0; + collectingUndo = true; +} + +CellBuffer::~CellBuffer() { +} + +char CellBuffer::CharAt(int position) const { + return substance.ValueAt(position); +} + +void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) const { + if (lengthRetrieve <= 0) + return; + if (position < 0) + return; + if ((position + lengthRetrieve) > substance.Length()) { + Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", position, + lengthRetrieve, substance.Length()); + return; + } + substance.GetRange(buffer, position, lengthRetrieve); +} + +char CellBuffer::StyleAt(int position) const { + return style.ValueAt(position); +} + +void CellBuffer::GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const { + if (lengthRetrieve < 0) + return; + if (position < 0) + return; + if ((position + lengthRetrieve) > style.Length()) { + Platform::DebugPrintf("Bad GetStyleRange %d for %d of %d\n", position, + lengthRetrieve, style.Length()); + return; + } + style.GetRange(reinterpret_cast(buffer), position, lengthRetrieve); +} + +const char *CellBuffer::BufferPointer() { + return substance.BufferPointer(); +} + +const char *CellBuffer::RangePointer(int position, int rangeLength) { + return substance.RangePointer(position, rangeLength); +} + +int CellBuffer::GapPosition() const { + return substance.GapPosition(); +} + +// The char* returned is to an allocation owned by the undo history +const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) { + // InsertString and DeleteChars are the bottleneck though which all changes occur + const char *data = s; + if (!readOnly) { + if (collectingUndo) { + // Save into the undo/redo stack, but only the characters - not the formatting + // This takes up about half load time + data = uh.AppendAction(insertAction, position, s, insertLength, startSequence); + } + + BasicInsertString(position, s, insertLength); + } + return data; +} + +bool CellBuffer::SetStyleAt(int position, char styleValue) { + char curVal = style.ValueAt(position); + if (curVal != styleValue) { + style.SetValueAt(position, styleValue); + return true; + } else { + return false; + } +} + +bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue) { + bool changed = false; + PLATFORM_ASSERT(lengthStyle == 0 || + (lengthStyle > 0 && lengthStyle + position <= style.Length())); + while (lengthStyle--) { + char curVal = style.ValueAt(position); + if (curVal != styleValue) { + style.SetValueAt(position, styleValue); + changed = true; + } + position++; + } + return changed; +} + +// The char* returned is to an allocation owned by the undo history +const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) { + // InsertString and DeleteChars are the bottleneck though which all changes occur + PLATFORM_ASSERT(deleteLength > 0); + const char *data = 0; + if (!readOnly) { + if (collectingUndo) { + // Save into the undo/redo stack, but only the characters - not the formatting + // The gap would be moved to position anyway for the deletion so this doesn't cost extra + data = substance.RangePointer(position, deleteLength); + data = uh.AppendAction(removeAction, position, data, deleteLength, startSequence); + } + + BasicDeleteChars(position, deleteLength); + } + return data; +} + +int CellBuffer::Length() const { + return substance.Length(); +} + +void CellBuffer::Allocate(int newSize) { + substance.ReAllocate(newSize); + style.ReAllocate(newSize); +} + +void CellBuffer::SetLineEndTypes(int utf8LineEnds_) { + if (utf8LineEnds != utf8LineEnds_) { + utf8LineEnds = utf8LineEnds_; + ResetLineEnds(); + } +} + +void CellBuffer::SetPerLine(PerLine *pl) { + lv.SetPerLine(pl); +} + +int CellBuffer::Lines() const { + return lv.Lines(); +} + +int CellBuffer::LineStart(int line) const { + if (line < 0) + return 0; + else if (line >= Lines()) + return Length(); + else + return lv.LineStart(line); +} + +bool CellBuffer::IsReadOnly() const { + return readOnly; +} + +void CellBuffer::SetReadOnly(bool set) { + readOnly = set; +} + +void CellBuffer::SetSavePoint() { + uh.SetSavePoint(); +} + +bool CellBuffer::IsSavePoint() const { + return uh.IsSavePoint(); +} + +void CellBuffer::TentativeStart() { + uh.TentativeStart(); +} + +void CellBuffer::TentativeCommit() { + uh.TentativeCommit(); +} + +int CellBuffer::TentativeSteps() { + return uh.TentativeSteps(); +} + +bool CellBuffer::TentativeActive() const { + return uh.TentativeActive(); +} + +// Without undo + +void CellBuffer::InsertLine(int line, int position, bool lineStart) { + lv.InsertLine(line, position, lineStart); +} + +void CellBuffer::RemoveLine(int line) { + lv.RemoveLine(line); +} + +bool CellBuffer::UTF8LineEndOverlaps(int position) const { + unsigned char bytes[] = { + static_cast(substance.ValueAt(position-2)), + static_cast(substance.ValueAt(position-1)), + static_cast(substance.ValueAt(position)), + static_cast(substance.ValueAt(position+1)), + }; + return UTF8IsSeparator(bytes) || UTF8IsSeparator(bytes+1) || UTF8IsNEL(bytes+1); +} + +void CellBuffer::ResetLineEnds() { + // Reinitialize line data -- too much work to preserve + lv.Init(); + + int position = 0; + int length = Length(); + int lineInsert = 1; + bool atLineStart = true; + lv.InsertText(lineInsert-1, length); + unsigned char chBeforePrev = 0; + unsigned char chPrev = 0; + for (int i = 0; i < length; i++) { + unsigned char ch = substance.ValueAt(position + i); + if (ch == '\r') { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; + } else if (ch == '\n') { + if (chPrev == '\r') { + // Patch up what was end of line + lv.SetLineStart(lineInsert - 1, (position + i) + 1); + } else { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; + } + } else if (utf8LineEnds) { + unsigned char back3[3] = {chBeforePrev, chPrev, ch}; + if (UTF8IsSeparator(back3) || UTF8IsNEL(back3+1)) { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; + } + } + chBeforePrev = chPrev; + chPrev = ch; + } +} + +void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { + if (insertLength == 0) + return; + PLATFORM_ASSERT(insertLength > 0); + + unsigned char chAfter = substance.ValueAt(position); + bool breakingUTF8LineEnd = false; + if (utf8LineEnds && UTF8IsTrailByte(chAfter)) { + breakingUTF8LineEnd = UTF8LineEndOverlaps(position); + } + + substance.InsertFromArray(position, s, 0, insertLength); + style.InsertValue(position, insertLength, 0); + + int lineInsert = lv.LineFromPosition(position) + 1; + bool atLineStart = lv.LineStart(lineInsert-1) == position; + // Point all the lines after the insertion point further along in the buffer + lv.InsertText(lineInsert-1, insertLength); + unsigned char chBeforePrev = substance.ValueAt(position - 2); + unsigned char chPrev = substance.ValueAt(position - 1); + if (chPrev == '\r' && chAfter == '\n') { + // Splitting up a crlf pair at position + InsertLine(lineInsert, position, false); + lineInsert++; + } + if (breakingUTF8LineEnd) { + RemoveLine(lineInsert); + } + unsigned char ch = ' '; + for (int i = 0; i < insertLength; i++) { + ch = s[i]; + if (ch == '\r') { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; + } else if (ch == '\n') { + if (chPrev == '\r') { + // Patch up what was end of line + lv.SetLineStart(lineInsert - 1, (position + i) + 1); + } else { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; + } + } else if (utf8LineEnds) { + unsigned char back3[3] = {chBeforePrev, chPrev, ch}; + if (UTF8IsSeparator(back3) || UTF8IsNEL(back3+1)) { + InsertLine(lineInsert, (position + i) + 1, atLineStart); + lineInsert++; + } + } + chBeforePrev = chPrev; + chPrev = ch; + } + // Joining two lines where last insertion is cr and following substance starts with lf + if (chAfter == '\n') { + if (ch == '\r') { + // End of line already in buffer so drop the newly created one + RemoveLine(lineInsert - 1); + } + } else if (utf8LineEnds && !UTF8IsAscii(chAfter)) { + // May have end of UTF-8 line end in buffer and start in insertion + for (int j = 0; j < UTF8SeparatorLength-1; j++) { + unsigned char chAt = substance.ValueAt(position + insertLength + j); + unsigned char back3[3] = {chBeforePrev, chPrev, chAt}; + if (UTF8IsSeparator(back3)) { + InsertLine(lineInsert, (position + insertLength + j) + 1, atLineStart); + lineInsert++; + } + if ((j == 0) && UTF8IsNEL(back3+1)) { + InsertLine(lineInsert, (position + insertLength + j) + 1, atLineStart); + lineInsert++; + } + chBeforePrev = chPrev; + chPrev = chAt; + } + } +} + +void CellBuffer::BasicDeleteChars(int position, int deleteLength) { + if (deleteLength == 0) + return; + + if ((position == 0) && (deleteLength == substance.Length())) { + // If whole buffer is being deleted, faster to reinitialise lines data + // than to delete each line. + lv.Init(); + } else { + // Have to fix up line positions before doing deletion as looking at text in buffer + // to work out which lines have been removed + + int lineRemove = lv.LineFromPosition(position) + 1; + lv.InsertText(lineRemove-1, - (deleteLength)); + unsigned char chPrev = substance.ValueAt(position - 1); + unsigned char chBefore = chPrev; + unsigned char chNext = substance.ValueAt(position); + bool ignoreNL = false; + if (chPrev == '\r' && chNext == '\n') { + // Move back one + lv.SetLineStart(lineRemove, position); + lineRemove++; + ignoreNL = true; // First \n is not real deletion + } + if (utf8LineEnds && UTF8IsTrailByte(chNext)) { + if (UTF8LineEndOverlaps(position)) { + RemoveLine(lineRemove); + } + } + + unsigned char ch = chNext; + for (int i = 0; i < deleteLength; i++) { + chNext = substance.ValueAt(position + i + 1); + if (ch == '\r') { + if (chNext != '\n') { + RemoveLine(lineRemove); + } + } else if (ch == '\n') { + if (ignoreNL) { + ignoreNL = false; // Further \n are real deletions + } else { + RemoveLine(lineRemove); + } + } else if (utf8LineEnds) { + if (!UTF8IsAscii(ch)) { + unsigned char next3[3] = {ch, chNext, + static_cast(substance.ValueAt(position + i + 2))}; + if (UTF8IsSeparator(next3) || UTF8IsNEL(next3)) { + RemoveLine(lineRemove); + } + } + } + + ch = chNext; + } + // May have to fix up end if last deletion causes cr to be next to lf + // or removes one of a crlf pair + char chAfter = substance.ValueAt(position + deleteLength); + if (chBefore == '\r' && chAfter == '\n') { + // Using lineRemove-1 as cr ended line before start of deletion + RemoveLine(lineRemove - 1); + lv.SetLineStart(lineRemove - 1, position + 1); + } + } + substance.DeleteRange(position, deleteLength); + style.DeleteRange(position, deleteLength); +} + +bool CellBuffer::SetUndoCollection(bool collectUndo) { + collectingUndo = collectUndo; + uh.DropUndoSequence(); + return collectingUndo; +} + +bool CellBuffer::IsCollectingUndo() const { + return collectingUndo; +} + +void CellBuffer::BeginUndoAction() { + uh.BeginUndoAction(); +} + +void CellBuffer::EndUndoAction() { + uh.EndUndoAction(); +} + +void CellBuffer::AddUndoAction(int token, bool mayCoalesce) { + bool startSequence; + uh.AppendAction(containerAction, token, 0, 0, startSequence, mayCoalesce); +} + +void CellBuffer::DeleteUndoHistory() { + uh.DeleteUndoHistory(); +} + +bool CellBuffer::CanUndo() const { + return uh.CanUndo(); +} + +int CellBuffer::StartUndo() { + return uh.StartUndo(); +} + +const Action &CellBuffer::GetUndoStep() const { + return uh.GetUndoStep(); +} + +void CellBuffer::PerformUndoStep() { + const Action &actionStep = uh.GetUndoStep(); + if (actionStep.at == insertAction) { + if (substance.Length() < actionStep.lenData) { + throw std::runtime_error( + "CellBuffer::PerformUndoStep: deletion must be less than document length."); + } + BasicDeleteChars(actionStep.position, actionStep.lenData); + } else if (actionStep.at == removeAction) { + BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); + } + uh.CompletedUndoStep(); +} + +bool CellBuffer::CanRedo() const { + return uh.CanRedo(); +} + +int CellBuffer::StartRedo() { + return uh.StartRedo(); +} + +const Action &CellBuffer::GetRedoStep() const { + return uh.GetRedoStep(); +} + +void CellBuffer::PerformRedoStep() { + const Action &actionStep = uh.GetRedoStep(); + if (actionStep.at == insertAction) { + BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); + } else if (actionStep.at == removeAction) { + BasicDeleteChars(actionStep.position, actionStep.lenData); + } + uh.CompletedRedoStep(); +} + diff --git a/libs/qscintilla/src/CellBuffer.h b/libs/qscintilla/src/CellBuffer.h new file mode 100644 index 000000000..5e4fc7c8c --- /dev/null +++ b/libs/qscintilla/src/CellBuffer.h @@ -0,0 +1,231 @@ +// Scintilla source code edit control +/** @file CellBuffer.h + ** Manages the text of the document. + **/ +// Copyright 1998-2004 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CELLBUFFER_H +#define CELLBUFFER_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// Interface to per-line data that wants to see each line insertion and deletion +class PerLine { +public: + virtual ~PerLine() {} + virtual void Init()=0; + virtual void InsertLine(int line)=0; + virtual void RemoveLine(int line)=0; +}; + +/** + * The line vector contains information about each of the lines in a cell buffer. + */ +class LineVector { + + Partitioning starts; + PerLine *perLine; + +public: + + LineVector(); + ~LineVector(); + void Init(); + void SetPerLine(PerLine *pl); + + void InsertText(int line, int delta); + void InsertLine(int line, int position, bool lineStart); + void SetLineStart(int line, int position); + void RemoveLine(int line); + int Lines() const { + return starts.Partitions(); + } + int LineFromPosition(int pos) const; + int LineStart(int line) const { + return starts.PositionFromPartition(line); + } + + int MarkValue(int line); + int AddMark(int line, int marker); + void MergeMarkers(int pos); + void DeleteMark(int line, int markerNum, bool all); + void DeleteMarkFromHandle(int markerHandle); + int LineFromHandle(int markerHandle); + + void ClearLevels(); + int SetLevel(int line, int level); + int GetLevel(int line); + + int SetLineState(int line, int state); + int GetLineState(int line); + int GetMaxLineState(); + +}; + +enum actionType { insertAction, removeAction, startAction, containerAction }; + +/** + * Actions are used to store all the information required to perform one undo/redo step. + */ +class Action { +public: + actionType at; + int position; + char *data; + int lenData; + bool mayCoalesce; + + Action(); + ~Action(); + void Create(actionType at_, int position_=0, const char *data_=0, int lenData_=0, bool mayCoalesce_=true); + void Destroy(); + void Grab(Action *source); +}; + +/** + * + */ +class UndoHistory { + Action *actions; + int lenActions; + int maxAction; + int currentAction; + int undoSequenceDepth; + int savePoint; + int tentativePoint; + + void EnsureUndoRoom(); + + // Private so UndoHistory objects can not be copied + UndoHistory(const UndoHistory &); + +public: + UndoHistory(); + ~UndoHistory(); + + const char *AppendAction(actionType at, int position, const char *data, int length, bool &startSequence, bool mayCoalesce=true); + + void BeginUndoAction(); + void EndUndoAction(); + void DropUndoSequence(); + void DeleteUndoHistory(); + + /// The save point is a marker in the undo stack where the container has stated that + /// the buffer was saved. Undo and redo can move over the save point. + void SetSavePoint(); + bool IsSavePoint() const; + + // Tentative actions are used for input composition so that it can be undone cleanly + void TentativeStart(); + void TentativeCommit(); + bool TentativeActive() const { return tentativePoint >= 0; } + int TentativeSteps(); + + /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is + /// called that many times. Similarly for redo. + bool CanUndo() const; + int StartUndo(); + const Action &GetUndoStep() const; + void CompletedUndoStep(); + bool CanRedo() const; + int StartRedo(); + const Action &GetRedoStep() const; + void CompletedRedoStep(); +}; + +/** + * Holder for an expandable array of characters that supports undo and line markers. + * Based on article "Data Structures in a Bit-Mapped Text Editor" + * by Wilfred J. Hansen, Byte January 1987, page 183. + */ +class CellBuffer { +private: + SplitVector substance; + SplitVector style; + bool readOnly; + int utf8LineEnds; + + bool collectingUndo; + UndoHistory uh; + + LineVector lv; + + bool UTF8LineEndOverlaps(int position) const; + void ResetLineEnds(); + /// Actions without undo + void BasicInsertString(int position, const char *s, int insertLength); + void BasicDeleteChars(int position, int deleteLength); + +public: + + CellBuffer(); + ~CellBuffer(); + + /// Retrieving positions outside the range of the buffer works and returns 0 + char CharAt(int position) const; + void GetCharRange(char *buffer, int position, int lengthRetrieve) const; + char StyleAt(int position) const; + void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const; + const char *BufferPointer(); + const char *RangePointer(int position, int rangeLength); + int GapPosition() const; + + int Length() const; + void Allocate(int newSize); + int GetLineEndTypes() const { return utf8LineEnds; } + void SetLineEndTypes(int utf8LineEnds_); + void SetPerLine(PerLine *pl); + int Lines() const; + int LineStart(int line) const; + int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); } + void InsertLine(int line, int position, bool lineStart); + void RemoveLine(int line); + const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); + + /// Setting styles for positions outside the range of the buffer is safe and has no effect. + /// @return true if the style of a character is changed. + bool SetStyleAt(int position, char styleValue); + bool SetStyleFor(int position, int length, char styleValue); + + const char *DeleteChars(int position, int deleteLength, bool &startSequence); + + bool IsReadOnly() const; + void SetReadOnly(bool set); + + /// The save point is a marker in the undo stack where the container has stated that + /// the buffer was saved. Undo and redo can move over the save point. + void SetSavePoint(); + bool IsSavePoint() const; + + void TentativeStart(); + void TentativeCommit(); + bool TentativeActive() const; + int TentativeSteps(); + + bool SetUndoCollection(bool collectUndo); + bool IsCollectingUndo() const; + void BeginUndoAction(); + void EndUndoAction(); + void AddUndoAction(int token, bool mayCoalesce); + void DeleteUndoHistory(); + + /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is + /// called that many times. Similarly for redo. + bool CanUndo() const; + int StartUndo(); + const Action &GetUndoStep() const; + void PerformUndoStep(); + bool CanRedo() const; + int StartRedo(); + const Action &GetRedoStep() const; + void PerformRedoStep(); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/CharClassify.cpp b/libs/qscintilla/src/CharClassify.cpp new file mode 100644 index 000000000..cc431630d --- /dev/null +++ b/libs/qscintilla/src/CharClassify.cpp @@ -0,0 +1,59 @@ +// Scintilla source code edit control +/** @file CharClassify.cxx + ** Character classifications used by Document and RESearch. + **/ +// Copyright 2006 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include + +#include "CharClassify.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +CharClassify::CharClassify() { + SetDefaultCharClasses(true); +} + +void CharClassify::SetDefaultCharClasses(bool includeWordClass) { + // Initialize all char classes to default values + for (int ch = 0; ch < 256; ch++) { + if (ch == '\r' || ch == '\n') + charClass[ch] = ccNewLine; + else if (ch < 0x20 || ch == ' ') + charClass[ch] = ccSpace; + else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_')) + charClass[ch] = ccWord; + else + charClass[ch] = ccPunctuation; + } +} + +void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { + // Apply the newCharClass to the specifed chars + if (chars) { + while (*chars) { + charClass[*chars] = static_cast(newCharClass); + chars++; + } + } +} + +int CharClassify::GetCharsOfClass(cc characterClass, unsigned char *buffer) { + // Get characters belonging to the given char class; return the number + // of characters (if the buffer is NULL, don't write to it). + int count = 0; + for (int ch = maxChar - 1; ch >= 0; --ch) { + if (charClass[ch] == characterClass) { + ++count; + if (buffer) { + *buffer = static_cast(ch); + buffer++; + } + } + } + return count; +} diff --git a/libs/qscintilla/src/CharClassify.h b/libs/qscintilla/src/CharClassify.h new file mode 100644 index 000000000..5d2734c00 --- /dev/null +++ b/libs/qscintilla/src/CharClassify.h @@ -0,0 +1,35 @@ +// Scintilla source code edit control +/** @file CharClassify.h + ** Character classifications used by Document and RESearch. + **/ +// Copyright 2006-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CHARCLASSIFY_H +#define CHARCLASSIFY_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class CharClassify { +public: + CharClassify(); + + enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; + void SetDefaultCharClasses(bool includeWordClass); + void SetCharClasses(const unsigned char *chars, cc newCharClass); + int GetCharsOfClass(cc charClass, unsigned char *buffer); + cc GetClass(unsigned char ch) const { return static_cast(charClass[ch]);} + bool IsWord(unsigned char ch) const { return static_cast(charClass[ch]) == ccWord;} + +private: + enum { maxChar=256 }; + unsigned char charClass[maxChar]; // not type cc to save space +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/ContractionState.cpp b/libs/qscintilla/src/ContractionState.cpp new file mode 100644 index 000000000..7b7655420 --- /dev/null +++ b/libs/qscintilla/src/ContractionState.cpp @@ -0,0 +1,284 @@ +// Scintilla source code edit control +/** @file ContractionState.cxx + ** Manages visibility of lines for folding and wrapping. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include + +#include "Platform.h" + +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) { + //InsertLine(0); +} + +ContractionState::~ContractionState() { + Clear(); +} + +void ContractionState::EnsureData() { + if (OneToOne()) { + visible = new RunStyles(); + expanded = new RunStyles(); + heights = new RunStyles(); + displayLines = new Partitioning(4); + InsertLines(0, linesInDocument); + } +} + +void ContractionState::Clear() { + delete visible; + visible = 0; + delete expanded; + expanded = 0; + delete heights; + heights = 0; + delete displayLines; + displayLines = 0; + linesInDocument = 1; +} + +int ContractionState::LinesInDoc() const { + if (OneToOne()) { + return linesInDocument; + } else { + return displayLines->Partitions() - 1; + } +} + +int ContractionState::LinesDisplayed() const { + if (OneToOne()) { + return linesInDocument; + } else { + return displayLines->PositionFromPartition(LinesInDoc()); + } +} + +int ContractionState::DisplayFromDoc(int lineDoc) const { + if (OneToOne()) { + return (lineDoc <= linesInDocument) ? lineDoc : linesInDocument; + } else { + if (lineDoc > displayLines->Partitions()) + lineDoc = displayLines->Partitions(); + return displayLines->PositionFromPartition(lineDoc); + } +} + +int ContractionState::DisplayLastFromDoc(int lineDoc) const { + return DisplayFromDoc(lineDoc) + GetHeight(lineDoc) - 1; +} + +int ContractionState::DocFromDisplay(int lineDisplay) const { + if (OneToOne()) { + return lineDisplay; + } else { + if (lineDisplay <= 0) { + return 0; + } + if (lineDisplay > LinesDisplayed()) { + return displayLines->PartitionFromPosition(LinesDisplayed()); + } + int lineDoc = displayLines->PartitionFromPosition(lineDisplay); + PLATFORM_ASSERT(GetVisible(lineDoc)); + return lineDoc; + } +} + +void ContractionState::InsertLine(int lineDoc) { + if (OneToOne()) { + linesInDocument++; + } else { + visible->InsertSpace(lineDoc, 1); + visible->SetValueAt(lineDoc, 1); + expanded->InsertSpace(lineDoc, 1); + expanded->SetValueAt(lineDoc, 1); + heights->InsertSpace(lineDoc, 1); + heights->SetValueAt(lineDoc, 1); + int lineDisplay = DisplayFromDoc(lineDoc); + displayLines->InsertPartition(lineDoc, lineDisplay); + displayLines->InsertText(lineDoc, 1); + } +} + +void ContractionState::InsertLines(int lineDoc, int lineCount) { + for (int l = 0; l < lineCount; l++) { + InsertLine(lineDoc + l); + } + Check(); +} + +void ContractionState::DeleteLine(int lineDoc) { + if (OneToOne()) { + linesInDocument--; + } else { + if (GetVisible(lineDoc)) { + displayLines->InsertText(lineDoc, -heights->ValueAt(lineDoc)); + } + displayLines->RemovePartition(lineDoc); + visible->DeleteRange(lineDoc, 1); + expanded->DeleteRange(lineDoc, 1); + heights->DeleteRange(lineDoc, 1); + } +} + +void ContractionState::DeleteLines(int lineDoc, int lineCount) { + for (int l = 0; l < lineCount; l++) { + DeleteLine(lineDoc); + } + Check(); +} + +bool ContractionState::GetVisible(int lineDoc) const { + if (OneToOne()) { + return true; + } else { + if (lineDoc >= visible->Length()) + return true; + return visible->ValueAt(lineDoc) == 1; + } +} + +bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool isVisible) { + if (OneToOne() && isVisible) { + return false; + } else { + EnsureData(); + int delta = 0; + Check(); + if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) { + for (int line = lineDocStart; line <= lineDocEnd; line++) { + if (GetVisible(line) != isVisible) { + int difference = isVisible ? heights->ValueAt(line) : -heights->ValueAt(line); + visible->SetValueAt(line, isVisible ? 1 : 0); + displayLines->InsertText(line, difference); + delta += difference; + } + } + } else { + return false; + } + Check(); + return delta != 0; + } +} + +bool ContractionState::HiddenLines() const { + if (OneToOne()) { + return false; + } else { + return !visible->AllSameAs(1); + } +} + +bool ContractionState::GetExpanded(int lineDoc) const { + if (OneToOne()) { + return true; + } else { + Check(); + return expanded->ValueAt(lineDoc) == 1; + } +} + +bool ContractionState::SetExpanded(int lineDoc, bool isExpanded) { + if (OneToOne() && isExpanded) { + return false; + } else { + EnsureData(); + if (isExpanded != (expanded->ValueAt(lineDoc) == 1)) { + expanded->SetValueAt(lineDoc, isExpanded ? 1 : 0); + Check(); + return true; + } else { + Check(); + return false; + } + } +} + +int ContractionState::ContractedNext(int lineDocStart) const { + if (OneToOne()) { + return -1; + } else { + Check(); + if (!expanded->ValueAt(lineDocStart)) { + return lineDocStart; + } else { + int lineDocNextChange = expanded->EndRun(lineDocStart); + if (lineDocNextChange < LinesInDoc()) + return lineDocNextChange; + else + return -1; + } + } +} + +int ContractionState::GetHeight(int lineDoc) const { + if (OneToOne()) { + return 1; + } else { + return heights->ValueAt(lineDoc); + } +} + +// Set the number of display lines needed for this line. +// Return true if this is a change. +bool ContractionState::SetHeight(int lineDoc, int height) { + if (OneToOne() && (height == 1)) { + return false; + } else if (lineDoc < LinesInDoc()) { + EnsureData(); + if (GetHeight(lineDoc) != height) { + if (GetVisible(lineDoc)) { + displayLines->InsertText(lineDoc, height - GetHeight(lineDoc)); + } + heights->SetValueAt(lineDoc, height); + Check(); + return true; + } else { + Check(); + return false; + } + } else { + return false; + } +} + +void ContractionState::ShowAll() { + int lines = LinesInDoc(); + Clear(); + linesInDocument = lines; +} + +// Debugging checks + +void ContractionState::Check() const { +#ifdef CHECK_CORRECTNESS + for (int vline = 0; vline < LinesDisplayed(); vline++) { + const int lineDoc = DocFromDisplay(vline); + PLATFORM_ASSERT(GetVisible(lineDoc)); + } + for (int lineDoc = 0; lineDoc < LinesInDoc(); lineDoc++) { + const int displayThis = DisplayFromDoc(lineDoc); + const int displayNext = DisplayFromDoc(lineDoc + 1); + const int height = displayNext - displayThis; + PLATFORM_ASSERT(height >= 0); + if (GetVisible(lineDoc)) { + PLATFORM_ASSERT(GetHeight(lineDoc) == height); + } else { + PLATFORM_ASSERT(0 == height); + } + } +#endif +} diff --git a/libs/qscintilla/src/ContractionState.h b/libs/qscintilla/src/ContractionState.h new file mode 100644 index 000000000..96cbf0763 --- /dev/null +++ b/libs/qscintilla/src/ContractionState.h @@ -0,0 +1,69 @@ +// Scintilla source code edit control +/** @file ContractionState.h + ** Manages visibility of lines for folding and wrapping. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CONTRACTIONSTATE_H +#define CONTRACTIONSTATE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class ContractionState { + // These contain 1 element for every document line. + RunStyles *visible; + RunStyles *expanded; + RunStyles *heights; + Partitioning *displayLines; + int linesInDocument; + + void EnsureData(); + + bool OneToOne() const { + // True when each document line is exactly one display line so need for + // complex data structures. + return visible == 0; + } + +public: + ContractionState(); + virtual ~ContractionState(); + + void Clear(); + + int LinesInDoc() const; + int LinesDisplayed() const; + int DisplayFromDoc(int lineDoc) const; + int DisplayLastFromDoc(int lineDoc) const; + int DocFromDisplay(int lineDisplay) const; + + void InsertLine(int lineDoc); + void InsertLines(int lineDoc, int lineCount); + void DeleteLine(int lineDoc); + void DeleteLines(int lineDoc, int lineCount); + + bool GetVisible(int lineDoc) const; + bool SetVisible(int lineDocStart, int lineDocEnd, bool isVisible); + bool HiddenLines() const; + + bool GetExpanded(int lineDoc) const; + bool SetExpanded(int lineDoc, bool isExpanded); + int ContractedNext(int lineDocStart) const; + + int GetHeight(int lineDoc) const; + bool SetHeight(int lineDoc, int height); + + void ShowAll(); + void Check() const; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Decoration.cpp b/libs/qscintilla/src/Decoration.cpp new file mode 100644 index 000000000..e7610e0b6 --- /dev/null +++ b/libs/qscintilla/src/Decoration.cpp @@ -0,0 +1,196 @@ +/** @file Decoration.cxx + ** Visual elements added over text. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "Decoration.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) { +} + +Decoration::~Decoration() { +} + +bool Decoration::Empty() const { + return (rs.Runs() == 1) && (rs.AllSameAs(0)); +} + +DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0), + lengthDocument(0), root(0), clickNotified(false) { +} + +DecorationList::~DecorationList() { + Decoration *deco = root; + while (deco) { + Decoration *decoNext = deco->next; + delete deco; + deco = decoNext; + } + root = 0; + current = 0; +} + +Decoration *DecorationList::DecorationFromIndicator(int indicator) { + for (Decoration *deco=root; deco; deco = deco->next) { + if (deco->indicator == indicator) { + return deco; + } + } + return 0; +} + +Decoration *DecorationList::Create(int indicator, int length) { + currentIndicator = indicator; + Decoration *decoNew = new Decoration(indicator); + decoNew->rs.InsertSpace(0, length); + + Decoration *decoPrev = 0; + Decoration *deco = root; + + while (deco && (deco->indicator < indicator)) { + decoPrev = deco; + deco = deco->next; + } + if (decoPrev == 0) { + decoNew->next = root; + root = decoNew; + } else { + decoNew->next = deco; + decoPrev->next = decoNew; + } + return decoNew; +} + +void DecorationList::Delete(int indicator) { + Decoration *decoToDelete = 0; + if (root) { + if (root->indicator == indicator) { + decoToDelete = root; + root = root->next; + } else { + Decoration *deco=root; + while (deco->next && !decoToDelete) { + if (deco->next && deco->next->indicator == indicator) { + decoToDelete = deco->next; + deco->next = decoToDelete->next; + } else { + deco = deco->next; + } + } + } + } + if (decoToDelete) { + delete decoToDelete; + current = 0; + } +} + +void DecorationList::SetCurrentIndicator(int indicator) { + currentIndicator = indicator; + current = DecorationFromIndicator(indicator); + currentValue = 1; +} + +void DecorationList::SetCurrentValue(int value) { + currentValue = value ? value : 1; +} + +bool DecorationList::FillRange(int &position, int value, int &fillLength) { + if (!current) { + current = DecorationFromIndicator(currentIndicator); + if (!current) { + current = Create(currentIndicator, lengthDocument); + } + } + bool changed = current->rs.FillRange(position, value, fillLength); + if (current->Empty()) { + Delete(currentIndicator); + } + return changed; +} + +void DecorationList::InsertSpace(int position, int insertLength) { + const bool atEnd = position == lengthDocument; + lengthDocument += insertLength; + for (Decoration *deco=root; deco; deco = deco->next) { + deco->rs.InsertSpace(position, insertLength); + if (atEnd) { + deco->rs.FillRange(position, 0, insertLength); + } + } +} + +void DecorationList::DeleteRange(int position, int deleteLength) { + lengthDocument -= deleteLength; + Decoration *deco; + for (deco=root; deco; deco = deco->next) { + deco->rs.DeleteRange(position, deleteLength); + } + DeleteAnyEmpty(); +} + +void DecorationList::DeleteAnyEmpty() { + Decoration *deco = root; + while (deco) { + if ((lengthDocument == 0) || deco->Empty()) { + Delete(deco->indicator); + deco = root; + } else { + deco = deco->next; + } + } +} + +int DecorationList::AllOnFor(int position) const { + int mask = 0; + for (Decoration *deco=root; deco; deco = deco->next) { + if (deco->rs.ValueAt(position)) { + if (deco->indicator < INDIC_IME) { + mask |= 1 << deco->indicator; + } + } + } + return mask; +} + +int DecorationList::ValueAt(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.ValueAt(position); + } + return 0; +} + +int DecorationList::Start(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.StartRun(position); + } + return 0; +} + +int DecorationList::End(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.EndRun(position); + } + return 0; +} diff --git a/libs/qscintilla/src/Decoration.h b/libs/qscintilla/src/Decoration.h new file mode 100644 index 000000000..a0c434af8 --- /dev/null +++ b/libs/qscintilla/src/Decoration.h @@ -0,0 +1,64 @@ +/** @file Decoration.h + ** Visual elements added over text. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef DECORATION_H +#define DECORATION_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class Decoration { +public: + Decoration *next; + RunStyles rs; + int indicator; + + explicit Decoration(int indicator_); + ~Decoration(); + + bool Empty() const; +}; + +class DecorationList { + int currentIndicator; + int currentValue; + Decoration *current; + int lengthDocument; + Decoration *DecorationFromIndicator(int indicator); + Decoration *Create(int indicator, int length); + void Delete(int indicator); + void DeleteAnyEmpty(); +public: + Decoration *root; + bool clickNotified; + + DecorationList(); + ~DecorationList(); + + void SetCurrentIndicator(int indicator); + int GetCurrentIndicator() const { return currentIndicator; } + + void SetCurrentValue(int value); + int GetCurrentValue() const { return currentValue; } + + // Returns true if some values may have changed + bool FillRange(int &position, int value, int &fillLength); + + void InsertSpace(int position, int insertLength); + void DeleteRange(int position, int deleteLength); + + int AllOnFor(int position) const; + int ValueAt(int indicator, int position); + int Start(int indicator, int position); + int End(int indicator, int position); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Document.cpp b/libs/qscintilla/src/Document.cpp new file mode 100644 index 000000000..7d34dace1 --- /dev/null +++ b/libs/qscintilla/src/Document.cpp @@ -0,0 +1,2815 @@ +// Scintilla source code edit control +/** @file Document.cxx + ** Text document that handles notifications, DBCS, styling, words and end of line. + **/ +// Copyright 1998-2011 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 + +#ifdef CXX11_REGEX +#include +#endif + +#include "Platform.h" + +#include "ILexer.h" +#include "Scintilla.h" + +#include "CharacterSet.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "CellBuffer.h" +#include "PerLine.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "RESearch.h" +#include "UniConversion.h" +#include "UnicodeFromUTF8.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsPunctuation(char ch) { + return IsASCII(ch) && ispunct(ch); +} + +void LexInterface::Colourise(int start, int end) { + if (pdoc && instance && !performingStyle) { + // Protect against reentrance, which may occur, for example, when + // fold points are discovered while performing styling and the folding + // code looks for child lines which may trigger styling. + performingStyle = true; + + int lengthDoc = pdoc->Length(); + if (end == -1) + end = lengthDoc; + int len = end - start; + + PLATFORM_ASSERT(len >= 0); + PLATFORM_ASSERT(start + len <= lengthDoc); + + int styleStart = 0; + if (start > 0) + styleStart = pdoc->StyleAt(start - 1); + + if (len > 0) { + instance->Lex(start, len, styleStart, pdoc); + instance->Fold(start, len, styleStart, pdoc); + } + + performingStyle = false; + } +} + +int LexInterface::LineEndTypesSupported() { + if (instance) { + int interfaceVersion = instance->Version(); + if (interfaceVersion >= lvSubStyles) { + ILexerWithSubStyles *ssinstance = static_cast(instance); + return ssinstance->LineEndTypesSupported(); + } + } + return 0; +} + +Document::Document() { + refCount = 0; + pcf = NULL; +#ifdef _WIN32 + eolMode = SC_EOL_CRLF; +#else + eolMode = SC_EOL_LF; +#endif + dbcsCodePage = 0; + lineEndBitSet = SC_LINE_END_TYPE_DEFAULT; + endStyled = 0; + styleClock = 0; + enteredModification = 0; + enteredStyling = 0; + enteredReadOnlyCount = 0; + insertionSet = false; + tabInChars = 8; + indentInChars = 0; + actualIndentInChars = 8; + useTabs = true; + tabIndents = true; + backspaceUnindents = false; + + matchesValid = false; + regex = 0; + + UTF8BytesOfLeadInitialise(); + + perLineData[ldMarkers] = new LineMarkers(); + perLineData[ldLevels] = new LineLevels(); + perLineData[ldState] = new LineState(); + perLineData[ldMargin] = new LineAnnotation(); + perLineData[ldAnnotation] = new LineAnnotation(); + + cb.SetPerLine(this); + + pli = 0; +} + +Document::~Document() { + for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { + it->watcher->NotifyDeleted(this, it->userData); + } + for (int j=0; jInit(); + } +} + +int Document::LineEndTypesSupported() const { + if ((SC_CP_UTF8 == dbcsCodePage) && pli) + return pli->LineEndTypesSupported(); + else + return 0; +} + +bool Document::SetDBCSCodePage(int dbcsCodePage_) { + if (dbcsCodePage != dbcsCodePage_) { + dbcsCodePage = dbcsCodePage_; + SetCaseFolder(NULL); + cb.SetLineEndTypes(lineEndBitSet & LineEndTypesSupported()); + return true; + } else { + return false; + } +} + +bool Document::SetLineEndTypesAllowed(int lineEndBitSet_) { + if (lineEndBitSet != lineEndBitSet_) { + lineEndBitSet = lineEndBitSet_; + int lineEndBitSetActive = lineEndBitSet & LineEndTypesSupported(); + if (lineEndBitSetActive != cb.GetLineEndTypes()) { + ModifiedAt(0); + cb.SetLineEndTypes(lineEndBitSetActive); + return true; + } else { + return false; + } + } else { + return false; + } +} + +void Document::InsertLine(int line) { + for (int j=0; jInsertLine(line); + } +} + +void Document::RemoveLine(int line) { + for (int j=0; jRemoveLine(line); + } +} + +// Increase reference count and return its previous value. +int Document::AddRef() { + return refCount++; +} + +// Decrease reference count and return its previous value. +// Delete the document if reference count reaches zero. +int SCI_METHOD Document::Release() { + int curRefCount = --refCount; + if (curRefCount == 0) + delete this; + return curRefCount; +} + +void Document::SetSavePoint() { + cb.SetSavePoint(); + NotifySavePoint(true); +} + +void Document::TentativeUndo() { + CheckReadOnly(); + if (enteredModification == 0) { + enteredModification++; + if (!cb.IsReadOnly()) { + bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; + int steps = cb.TentativeSteps(); + //Platform::DebugPrintf("Steps=%d\n", steps); + for (int step = 0; step < steps; step++) { + const int prevLinesTotal = LinesTotal(); + const Action &action = cb.GetUndoStep(); + if (action.at == removeAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); + } else if (action.at == containerAction) { + DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO); + dm.token = action.position; + NotifyModified(dm); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); + } + cb.PerformUndoStep(); + if (action.at != containerAction) { + ModifiedAt(action.position); + } + + int modFlags = SC_PERFORMED_UNDO; + // With undo, an insertion action becomes a deletion notification + if (action.at == removeAction) { + modFlags |= SC_MOD_INSERTTEXT; + } else if (action.at == insertAction) { + modFlags |= SC_MOD_DELETETEXT; + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; + const int linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { + modFlags |= SC_LASTSTEPINUNDOREDO; + if (multiLine) + modFlags |= SC_MULTILINEUNDOREDO; + } + NotifyModified(DocModification(modFlags, action.position, action.lenData, + linesAdded, action.data)); + } + + bool endSavePoint = cb.IsSavePoint(); + if (startSavePoint != endSavePoint) + NotifySavePoint(endSavePoint); + + cb.TentativeCommit(); + } + enteredModification--; + } +} + +int Document::GetMark(int line) { + return static_cast(perLineData[ldMarkers])->MarkValue(line); +} + +int Document::MarkerNext(int lineStart, int mask) const { + return static_cast(perLineData[ldMarkers])->MarkerNext(lineStart, mask); +} + +int Document::AddMark(int line, int markerNum) { + if (line >= 0 && line <= LinesTotal()) { + int prev = static_cast(perLineData[ldMarkers])-> + AddMark(line, markerNum, LinesTotal()); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); + return prev; + } else { + return 0; + } +} + +void Document::AddMarkSet(int line, int valueSet) { + if (line < 0 || line > LinesTotal()) { + return; + } + unsigned int m = valueSet; + for (int i = 0; m; i++, m >>= 1) + if (m & 1) + static_cast(perLineData[ldMarkers])-> + AddMark(line, i, LinesTotal()); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +} + +void Document::DeleteMark(int line, int markerNum) { + static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +} + +void Document::DeleteMarkFromHandle(int markerHandle) { + static_cast(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + mh.line = -1; + NotifyModified(mh); +} + +void Document::DeleteAllMarks(int markerNum) { + bool someChanges = false; + for (int line = 0; line < LinesTotal(); line++) { + if (static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, true)) + someChanges = true; + } + if (someChanges) { + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + mh.line = -1; + NotifyModified(mh); + } +} + +int Document::LineFromHandle(int markerHandle) { + return static_cast(perLineData[ldMarkers])->LineFromHandle(markerHandle); +} + +int SCI_METHOD Document::LineStart(int line) const { + return cb.LineStart(line); +} + +bool Document::IsLineStartPosition(int position) const { + return LineStart(LineFromPosition(position)) == position; +} + +int SCI_METHOD Document::LineEnd(int line) const { + if (line >= LinesTotal() - 1) { + return LineStart(line + 1); + } else { + int position = LineStart(line + 1); + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char bytes[] = { + static_cast(cb.CharAt(position-3)), + static_cast(cb.CharAt(position-2)), + static_cast(cb.CharAt(position-1)), + }; + if (UTF8IsSeparator(bytes)) { + return position - UTF8SeparatorLength; + } + if (UTF8IsNEL(bytes+1)) { + return position - UTF8NELLength; + } + } + position--; // Back over CR or LF + // When line terminator is CR+LF, may need to go back one more + if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { + position--; + } + return position; + } +} + +void SCI_METHOD Document::SetErrorStatus(int status) { + // Tell the watchers an error has occurred. + for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { + it->watcher->NotifyErrorOccurred(this, it->userData, status); + } +} + +int SCI_METHOD Document::LineFromPosition(int pos) const { + return cb.LineFromPosition(pos); +} + +int Document::LineEndPosition(int position) const { + return LineEnd(LineFromPosition(position)); +} + +bool Document::IsLineEndPosition(int position) const { + return LineEnd(LineFromPosition(position)) == position; +} + +bool Document::IsPositionInLineEnd(int position) const { + return position >= LineEnd(LineFromPosition(position)); +} + +int Document::VCHomePosition(int position) const { + int line = LineFromPosition(position); + int startPosition = LineStart(line); + int endLine = LineEnd(line); + int startText = startPosition; + while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t')) + startText++; + if (position == startText) + return startPosition; + else + return startText; +} + +int SCI_METHOD Document::SetLevel(int line, int level) { + int prev = static_cast(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); + if (prev != level) { + DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, + LineStart(line), 0, 0, 0, line); + mh.foldLevelNow = level; + mh.foldLevelPrev = prev; + NotifyModified(mh); + } + return prev; +} + +int SCI_METHOD Document::GetLevel(int line) const { + return static_cast(perLineData[ldLevels])->GetLevel(line); +} + +void Document::ClearLevels() { + static_cast(perLineData[ldLevels])->ClearLevels(); +} + +static bool IsSubordinate(int levelStart, int levelTry) { + if (levelTry & SC_FOLDLEVELWHITEFLAG) + return true; + else + return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK); +} + +int Document::GetLastChild(int lineParent, int level, int lastLine) { + if (level == -1) + level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; + int maxLine = LinesTotal(); + int lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1; + int lineMaxSubord = lineParent; + while (lineMaxSubord < maxLine - 1) { + EnsureStyledTo(LineStart(lineMaxSubord + 2)); + if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1))) + break; + if ((lookLastLine != -1) && (lineMaxSubord >= lookLastLine) && !(GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG)) + break; + lineMaxSubord++; + } + if (lineMaxSubord > lineParent) { + if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) { + // Have chewed up some whitespace that belongs to a parent so seek back + if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) { + lineMaxSubord--; + } + } + } + return lineMaxSubord; +} + +int Document::GetFoldParent(int line) const { + int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK; + int lineLook = line - 1; + while ((lineLook > 0) && ( + (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || + ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level)) + ) { + lineLook--; + } + if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && + ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) { + return lineLook; + } else { + return -1; + } +} + +void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, int line, int lastLine) { + int level = GetLevel(line); + int lookLastLine = Platform::Maximum(line, lastLine) + 1; + + int lookLine = line; + int lookLineLevel = level; + int lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + while ((lookLine > 0) && ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || + ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))))) { + lookLineLevel = GetLevel(--lookLine); + lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + } + + int beginFoldBlock = (lookLineLevel & SC_FOLDLEVELHEADERFLAG) ? lookLine : GetFoldParent(lookLine); + if (beginFoldBlock == -1) { + highlightDelimiter.Clear(); + return; + } + + int endFoldBlock = GetLastChild(beginFoldBlock, -1, lookLastLine); + int firstChangeableLineBefore = -1; + if (endFoldBlock < line) { + lookLine = beginFoldBlock - 1; + lookLineLevel = GetLevel(lookLine); + lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + while ((lookLine >= 0) && (lookLineLevelNum >= SC_FOLDLEVELBASE)) { + if (lookLineLevel & SC_FOLDLEVELHEADERFLAG) { + if (GetLastChild(lookLine, -1, lookLastLine) == line) { + beginFoldBlock = lookLine; + endFoldBlock = line; + firstChangeableLineBefore = line - 1; + } + } + if ((lookLine > 0) && (lookLineLevelNum == SC_FOLDLEVELBASE) && ((GetLevel(lookLine - 1) & SC_FOLDLEVELNUMBERMASK) > lookLineLevelNum)) + break; + lookLineLevel = GetLevel(--lookLine); + lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + } + } + if (firstChangeableLineBefore == -1) { + for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + lookLine >= beginFoldBlock; + lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) { + if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > (level & SC_FOLDLEVELNUMBERMASK))) { + firstChangeableLineBefore = lookLine; + break; + } + } + } + if (firstChangeableLineBefore == -1) + firstChangeableLineBefore = beginFoldBlock - 1; + + int firstChangeableLineAfter = -1; + for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK; + lookLine <= endFoldBlock; + lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) { + if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))) { + firstChangeableLineAfter = lookLine; + break; + } + } + if (firstChangeableLineAfter == -1) + firstChangeableLineAfter = endFoldBlock + 1; + + highlightDelimiter.beginFoldBlock = beginFoldBlock; + highlightDelimiter.endFoldBlock = endFoldBlock; + highlightDelimiter.firstChangeableLineBefore = firstChangeableLineBefore; + highlightDelimiter.firstChangeableLineAfter = firstChangeableLineAfter; +} + +int Document::ClampPositionIntoDocument(int pos) const { + return Platform::Clamp(pos, 0, Length()); +} + +bool Document::IsCrLf(int pos) const { + if (pos < 0) + return false; + if (pos >= (Length() - 1)) + return false; + return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n'); +} + +int Document::LenChar(int pos) { + if (pos < 0) { + return 1; + } else if (IsCrLf(pos)) { + return 2; + } else if (SC_CP_UTF8 == dbcsCodePage) { + const unsigned char leadByte = static_cast(cb.CharAt(pos)); + const int widthCharBytes = UTF8BytesOfLead[leadByte]; + int lengthDoc = Length(); + if ((pos + widthCharBytes) > lengthDoc) + return lengthDoc - pos; + else + return widthCharBytes; + } else if (dbcsCodePage) { + return IsDBCSLeadByte(cb.CharAt(pos)) ? 2 : 1; + } else { + return 1; + } +} + +bool Document::InGoodUTF8(int pos, int &start, int &end) const { + int trail = pos; + while ((trail>0) && (pos-trail < UTF8MaxBytes) && UTF8IsTrailByte(static_cast(cb.CharAt(trail-1)))) + trail--; + start = (trail > 0) ? trail-1 : trail; + + const unsigned char leadByte = static_cast(cb.CharAt(start)); + const int widthCharBytes = UTF8BytesOfLead[leadByte]; + if (widthCharBytes == 1) { + return false; + } else { + int trailBytes = widthCharBytes - 1; + int len = pos - start; + if (len > trailBytes) + // pos too far from lead + return false; + char charBytes[UTF8MaxBytes] = {static_cast(leadByte),0,0,0}; + for (int b=1; b(start+b)); + int utf8status = UTF8Classify(reinterpret_cast(charBytes), widthCharBytes); + if (utf8status & UTF8MaskInvalid) + return false; + end = start + widthCharBytes; + return true; + } +} + +// Normalise a position so that it is not halfway through a two byte character. +// This can occur in two situations - +// When lines are terminated with \r\n pairs which should be treated as one character. +// When displaying DBCS text such as Japanese. +// If moving, move the position in the indicated direction. +int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) const { + //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); + // If out of range, just return minimum/maximum value. + if (pos <= 0) + return 0; + if (pos >= Length()) + return Length(); + + // PLATFORM_ASSERT(pos > 0 && pos < Length()); + if (checkLineEnd && IsCrLf(pos - 1)) { + if (moveDir > 0) + return pos + 1; + else + return pos - 1; + } + + if (dbcsCodePage) { + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast(cb.CharAt(pos)); + // If ch is not a trail byte then pos is valid intercharacter position + if (UTF8IsTrailByte(ch)) { + int startUTF = pos; + int endUTF = pos; + if (InGoodUTF8(pos, startUTF, endUTF)) { + // ch is a trail byte within a UTF-8 character + if (moveDir > 0) + pos = endUTF; + else + pos = startUTF; + } + // Else invalid UTF-8 so return position of isolated trail byte + } + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. + int posStartLine = LineStart(LineFromPosition(pos)); + if (pos == posStartLine) + return pos; + + // Step back until a non-lead-byte is found. + int posCheck = pos; + while ((posCheck > posStartLine) && IsDBCSLeadByte(cb.CharAt(posCheck-1))) + posCheck--; + + // Check from known start of character. + while (posCheck < pos) { + int mbsize = IsDBCSLeadByte(cb.CharAt(posCheck)) ? 2 : 1; + if (posCheck + mbsize == pos) { + return pos; + } else if (posCheck + mbsize > pos) { + if (moveDir > 0) { + return posCheck + mbsize; + } else { + return posCheck; + } + } + posCheck += mbsize; + } + } + } + + return pos; +} + +// NextPosition moves between valid positions - it can not handle a position in the middle of a +// multi-byte character. It is used to iterate through text more efficiently than MovePositionOutsideChar. +// A \r\n pair is treated as two characters. +int Document::NextPosition(int pos, int moveDir) const { + // If out of range, just return minimum/maximum value. + int increment = (moveDir > 0) ? 1 : -1; + if (pos + increment <= 0) + return 0; + if (pos + increment >= Length()) + return Length(); + + if (dbcsCodePage) { + if (SC_CP_UTF8 == dbcsCodePage) { + if (increment == 1) { + // Simple forward movement case so can avoid some checks + const unsigned char leadByte = static_cast(cb.CharAt(pos)); + if (UTF8IsAscii(leadByte)) { + // Single byte character or invalid + pos++; + } else { + const int widthCharBytes = UTF8BytesOfLead[leadByte]; + char charBytes[UTF8MaxBytes] = {static_cast(leadByte),0,0,0}; + for (int b=1; b(pos+b)); + int utf8status = UTF8Classify(reinterpret_cast(charBytes), widthCharBytes); + if (utf8status & UTF8MaskInvalid) + pos++; + else + pos += utf8status & UTF8MaskWidth; + } + } else { + // Examine byte before position + pos--; + unsigned char ch = static_cast(cb.CharAt(pos)); + // If ch is not a trail byte then pos is valid intercharacter position + if (UTF8IsTrailByte(ch)) { + // If ch is a trail byte in a valid UTF-8 character then return start of character + int startUTF = pos; + int endUTF = pos; + if (InGoodUTF8(pos, startUTF, endUTF)) { + pos = startUTF; + } + // Else invalid UTF-8 so return position of isolated trail byte + } + } + } else { + if (moveDir > 0) { + int mbsize = IsDBCSLeadByte(cb.CharAt(pos)) ? 2 : 1; + pos += mbsize; + if (pos > Length()) + pos = Length(); + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. + int posStartLine = LineStart(LineFromPosition(pos)); + // See http://msdn.microsoft.com/en-us/library/cc194792%28v=MSDN.10%29.aspx + // http://msdn.microsoft.com/en-us/library/cc194790.aspx + if ((pos - 1) <= posStartLine) { + return pos - 1; + } else if (IsDBCSLeadByte(cb.CharAt(pos - 1))) { + // Must actually be trail byte + return pos - 2; + } else { + // Otherwise, step back until a non-lead-byte is found. + int posTemp = pos - 1; + while (posStartLine <= --posTemp && IsDBCSLeadByte(cb.CharAt(posTemp))) + ; + // Now posTemp+1 must point to the beginning of a character, + // so figure out whether we went back an even or an odd + // number of bytes and go back 1 or 2 bytes, respectively. + return (pos - 1 - ((pos - posTemp) & 1)); + } + } + } + } else { + pos += increment; + } + + return pos; +} + +bool Document::NextCharacter(int &pos, int moveDir) const { + // Returns true if pos changed + int posNext = NextPosition(pos, moveDir); + if (posNext == pos) { + return false; + } else { + pos = posNext; + return true; + } +} + +// Return -1 on out-of-bounds +int SCI_METHOD Document::GetRelativePosition(int positionStart, int characterOffset) const { + int pos = positionStart; + if (dbcsCodePage) { + const int increment = (characterOffset > 0) ? 1 : -1; + while (characterOffset != 0) { + const int posNext = NextPosition(pos, increment); + if (posNext == pos) + return INVALID_POSITION; + pos = posNext; + characterOffset -= increment; + } + } else { + pos = positionStart + characterOffset; + if ((pos < 0) || (pos > Length())) + return INVALID_POSITION; + } + return pos; +} + +int Document::GetRelativePositionUTF16(int positionStart, int characterOffset) const { + int pos = positionStart; + if (dbcsCodePage) { + const int increment = (characterOffset > 0) ? 1 : -1; + while (characterOffset != 0) { + const int posNext = NextPosition(pos, increment); + if (posNext == pos) + return INVALID_POSITION; + if (abs(pos-posNext) > 3) // 4 byte character = 2*UTF16. + characterOffset -= increment; + pos = posNext; + characterOffset -= increment; + } + } else { + pos = positionStart + characterOffset; + if ((pos < 0) || (pos > Length())) + return INVALID_POSITION; + } + return pos; +} + +int SCI_METHOD Document::GetCharacterAndWidth(int position, int *pWidth) const { + int character; + int bytesInCharacter = 1; + if (dbcsCodePage) { + const unsigned char leadByte = static_cast(cb.CharAt(position)); + if (SC_CP_UTF8 == dbcsCodePage) { + if (UTF8IsAscii(leadByte)) { + // Single byte character or invalid + character = leadByte; + } else { + const int widthCharBytes = UTF8BytesOfLead[leadByte]; + unsigned char charBytes[UTF8MaxBytes] = {leadByte,0,0,0}; + for (int b=1; b(cb.CharAt(position+b)); + int utf8status = UTF8Classify(charBytes, widthCharBytes); + if (utf8status & UTF8MaskInvalid) { + // Report as singleton surrogate values which are invalid Unicode + character = 0xDC80 + leadByte; + } else { + bytesInCharacter = utf8status & UTF8MaskWidth; + character = UnicodeFromUTF8(charBytes); + } + } + } else { + if (IsDBCSLeadByte(leadByte)) { + bytesInCharacter = 2; + character = (leadByte << 8) | static_cast(cb.CharAt(position+1)); + } else { + character = leadByte; + } + } + } else { + character = cb.CharAt(position); + } + if (pWidth) { + *pWidth = bytesInCharacter; + } + return character; +} + +int SCI_METHOD Document::CodePage() const { + return dbcsCodePage; +} + +bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const { + // Byte ranges found in Wikipedia articles with relevant search strings in each case + unsigned char uch = static_cast(ch); + switch (dbcsCodePage) { + case 932: + // Shift_jis + return ((uch >= 0x81) && (uch <= 0x9F)) || + ((uch >= 0xE0) && (uch <= 0xFC)); + // Lead bytes F0 to FC may be a Microsoft addition. + case 936: + // GBK + return (uch >= 0x81) && (uch <= 0xFE); + case 949: + // Korean Wansung KS C-5601-1987 + return (uch >= 0x81) && (uch <= 0xFE); + case 950: + // Big5 + return (uch >= 0x81) && (uch <= 0xFE); + case 1361: + // Korean Johab KS C-5601-1992 + return + ((uch >= 0x84) && (uch <= 0xD3)) || + ((uch >= 0xD8) && (uch <= 0xDE)) || + ((uch >= 0xE0) && (uch <= 0xF9)); + } + return false; +} + +static inline bool IsSpaceOrTab(int ch) { + return ch == ' ' || ch == '\t'; +} + +// Need to break text into segments near lengthSegment but taking into +// account the encoding to not break inside a UTF-8 or DBCS character +// and also trying to avoid breaking inside a pair of combining characters. +// The segment length must always be long enough (more than 4 bytes) +// so that there will be at least one whole character to make a segment. +// For UTF-8, text must consist only of valid whole characters. +// In preference order from best to worst: +// 1) Break after space +// 2) Break before punctuation +// 3) Break after whole character + +int Document::SafeSegment(const char *text, int length, int lengthSegment) const { + if (length <= lengthSegment) + return length; + int lastSpaceBreak = -1; + int lastPunctuationBreak = -1; + int lastEncodingAllowedBreak = 0; + for (int j=0; j < lengthSegment;) { + unsigned char ch = static_cast(text[j]); + if (j > 0) { + if (IsSpaceOrTab(text[j - 1]) && !IsSpaceOrTab(text[j])) { + lastSpaceBreak = j; + } + if (ch < 'A') { + lastPunctuationBreak = j; + } + } + lastEncodingAllowedBreak = j; + + if (dbcsCodePage == SC_CP_UTF8) { + j += UTF8BytesOfLead[ch]; + } else if (dbcsCodePage) { + j += IsDBCSLeadByte(ch) ? 2 : 1; + } else { + j++; + } + } + if (lastSpaceBreak >= 0) { + return lastSpaceBreak; + } else if (lastPunctuationBreak >= 0) { + return lastPunctuationBreak; + } + return lastEncodingAllowedBreak; +} + +EncodingFamily Document::CodePageFamily() const { + if (SC_CP_UTF8 == dbcsCodePage) + return efUnicode; + else if (dbcsCodePage) + return efDBCS; + else + return efEightBit; +} + +void Document::ModifiedAt(int pos) { + if (endStyled > pos) + endStyled = pos; +} + +void Document::CheckReadOnly() { + if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { + enteredReadOnlyCount++; + NotifyModifyAttempt(); + enteredReadOnlyCount--; + } +} + +// Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt. +// SetStyleAt does not change the persistent state of a document + +bool Document::DeleteChars(int pos, int len) { + if (pos < 0) + return false; + if (len <= 0) + return false; + if ((pos + len) > Length()) + return false; + CheckReadOnly(); + if (enteredModification != 0) { + return false; + } else { + enteredModification++; + if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, + pos, len, + 0, 0)); + int prevLinesTotal = LinesTotal(); + bool startSavePoint = cb.IsSavePoint(); + bool startSequence = false; + const char *text = cb.DeleteChars(pos, len, startSequence); + if (startSavePoint && cb.IsCollectingUndo()) + NotifySavePoint(!startSavePoint); + if ((pos < Length()) || (pos == 0)) + ModifiedAt(pos); + else + ModifiedAt(pos-1); + NotifyModified( + DocModification( + SC_MOD_DELETETEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), + pos, len, + LinesTotal() - prevLinesTotal, text)); + } + enteredModification--; + } + return !cb.IsReadOnly(); +} + +/** + * Insert a string with a length. + */ +int Document::InsertString(int position, const char *s, int insertLength) { + if (insertLength <= 0) { + return 0; + } + CheckReadOnly(); // Application may change read only state here + if (cb.IsReadOnly()) { + return 0; + } + if (enteredModification != 0) { + return 0; + } + enteredModification++; + insertionSet = false; + insertion.clear(); + NotifyModified( + DocModification( + SC_MOD_INSERTCHECK, + position, insertLength, + 0, s)); + if (insertionSet) { + s = insertion.c_str(); + insertLength = static_cast(insertion.length()); + } + NotifyModified( + DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, + position, insertLength, + 0, s)); + int prevLinesTotal = LinesTotal(); + bool startSavePoint = cb.IsSavePoint(); + bool startSequence = false; + const char *text = cb.InsertString(position, s, insertLength, startSequence); + if (startSavePoint && cb.IsCollectingUndo()) + NotifySavePoint(!startSavePoint); + ModifiedAt(position); + NotifyModified( + DocModification( + SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), + position, insertLength, + LinesTotal() - prevLinesTotal, text)); + if (insertionSet) { // Free memory as could be large + std::string().swap(insertion); + } + enteredModification--; + return insertLength; +} + +void Document::ChangeInsertion(const char *s, int length) { + insertionSet = true; + insertion.assign(s, length); +} + +int SCI_METHOD Document::AddData(char *data, int length) { + try { + int position = Length(); + InsertString(position, data, length); + } catch (std::bad_alloc &) { + return SC_STATUS_BADALLOC; + } catch (...) { + return SC_STATUS_FAILURE; + } + return 0; +} + +void * SCI_METHOD Document::ConvertToDocument() { + return this; +} + +int Document::Undo() { + int newPos = -1; + CheckReadOnly(); + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { + enteredModification++; + if (!cb.IsReadOnly()) { + bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; + int steps = cb.StartUndo(); + //Platform::DebugPrintf("Steps=%d\n", steps); + int coalescedRemovePos = -1; + int coalescedRemoveLen = 0; + int prevRemoveActionPos = -1; + int prevRemoveActionLen = 0; + for (int step = 0; step < steps; step++) { + const int prevLinesTotal = LinesTotal(); + const Action &action = cb.GetUndoStep(); + if (action.at == removeAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); + } else if (action.at == containerAction) { + DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO); + dm.token = action.position; + NotifyModified(dm); + if (!action.mayCoalesce) { + coalescedRemovePos = -1; + coalescedRemoveLen = 0; + prevRemoveActionPos = -1; + prevRemoveActionLen = 0; + } + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); + } + cb.PerformUndoStep(); + if (action.at != containerAction) { + ModifiedAt(action.position); + newPos = action.position; + } + + int modFlags = SC_PERFORMED_UNDO; + // With undo, an insertion action becomes a deletion notification + if (action.at == removeAction) { + newPos += action.lenData; + modFlags |= SC_MOD_INSERTTEXT; + if ((coalescedRemoveLen > 0) && + (action.position == prevRemoveActionPos || action.position == (prevRemoveActionPos + prevRemoveActionLen))) { + coalescedRemoveLen += action.lenData; + newPos = coalescedRemovePos + coalescedRemoveLen; + } else { + coalescedRemovePos = action.position; + coalescedRemoveLen = action.lenData; + } + prevRemoveActionPos = action.position; + prevRemoveActionLen = action.lenData; + } else if (action.at == insertAction) { + modFlags |= SC_MOD_DELETETEXT; + coalescedRemovePos = -1; + coalescedRemoveLen = 0; + prevRemoveActionPos = -1; + prevRemoveActionLen = 0; + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; + const int linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { + modFlags |= SC_LASTSTEPINUNDOREDO; + if (multiLine) + modFlags |= SC_MULTILINEUNDOREDO; + } + NotifyModified(DocModification(modFlags, action.position, action.lenData, + linesAdded, action.data)); + } + + bool endSavePoint = cb.IsSavePoint(); + if (startSavePoint != endSavePoint) + NotifySavePoint(endSavePoint); + } + enteredModification--; + } + return newPos; +} + +int Document::Redo() { + int newPos = -1; + CheckReadOnly(); + if ((enteredModification == 0) && (cb.IsCollectingUndo())) { + enteredModification++; + if (!cb.IsReadOnly()) { + bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; + int steps = cb.StartRedo(); + for (int step = 0; step < steps; step++) { + const int prevLinesTotal = LinesTotal(); + const Action &action = cb.GetRedoStep(); + if (action.at == insertAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); + } else if (action.at == containerAction) { + DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_REDO); + dm.token = action.position; + NotifyModified(dm); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); + } + cb.PerformRedoStep(); + if (action.at != containerAction) { + ModifiedAt(action.position); + newPos = action.position; + } + + int modFlags = SC_PERFORMED_REDO; + if (action.at == insertAction) { + newPos += action.lenData; + modFlags |= SC_MOD_INSERTTEXT; + } else if (action.at == removeAction) { + modFlags |= SC_MOD_DELETETEXT; + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; + const int linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { + modFlags |= SC_LASTSTEPINUNDOREDO; + if (multiLine) + modFlags |= SC_MULTILINEUNDOREDO; + } + NotifyModified( + DocModification(modFlags, action.position, action.lenData, + linesAdded, action.data)); + } + + bool endSavePoint = cb.IsSavePoint(); + if (startSavePoint != endSavePoint) + NotifySavePoint(endSavePoint); + } + enteredModification--; + } + return newPos; +} + +void Document::DelChar(int pos) { + DeleteChars(pos, LenChar(pos)); +} + +void Document::DelCharBack(int pos) { + if (pos <= 0) { + return; + } else if (IsCrLf(pos - 2)) { + DeleteChars(pos - 2, 2); + } else if (dbcsCodePage) { + int startChar = NextPosition(pos, -1); + DeleteChars(startChar, pos - startChar); + } else { + DeleteChars(pos - 1, 1); + } +} + +static int NextTab(int pos, int tabSize) { + return ((pos / tabSize) + 1) * tabSize; +} + +static std::string CreateIndentation(int indent, int tabSize, bool insertSpaces) { + std::string indentation; + if (!insertSpaces) { + while (indent >= tabSize) { + indentation += '\t'; + indent -= tabSize; + } + } + while (indent > 0) { + indentation += ' '; + indent--; + } + return indentation; +} + +int SCI_METHOD Document::GetLineIndentation(int line) { + int indent = 0; + if ((line >= 0) && (line < LinesTotal())) { + int lineStart = LineStart(line); + int length = Length(); + for (int i = lineStart; i < length; i++) { + char ch = cb.CharAt(i); + if (ch == ' ') + indent++; + else if (ch == '\t') + indent = NextTab(indent, tabInChars); + else + return indent; + } + } + return indent; +} + +int Document::SetLineIndentation(int line, int indent) { + int indentOfLine = GetLineIndentation(line); + if (indent < 0) + indent = 0; + if (indent != indentOfLine) { + std::string linebuf = CreateIndentation(indent, tabInChars, !useTabs); + int thisLineStart = LineStart(line); + int indentPos = GetLineIndentPosition(line); + UndoGroup ug(this); + DeleteChars(thisLineStart, indentPos - thisLineStart); + return thisLineStart + InsertString(thisLineStart, linebuf.c_str(), + static_cast(linebuf.length())); + } else { + return GetLineIndentPosition(line); + } +} + +int Document::GetLineIndentPosition(int line) const { + if (line < 0) + return 0; + int pos = LineStart(line); + int length = Length(); + while ((pos < length) && IsSpaceOrTab(cb.CharAt(pos))) { + pos++; + } + return pos; +} + +int Document::GetColumn(int pos) { + int column = 0; + int line = LineFromPosition(pos); + if ((line >= 0) && (line < LinesTotal())) { + for (int i = LineStart(line); i < pos;) { + char ch = cb.CharAt(i); + if (ch == '\t') { + column = NextTab(column, tabInChars); + i++; + } else if (ch == '\r') { + return column; + } else if (ch == '\n') { + return column; + } else if (i >= Length()) { + return column; + } else { + column++; + i = NextPosition(i, 1); + } + } + } + return column; +} + +int Document::CountCharacters(int startPos, int endPos) const { + startPos = MovePositionOutsideChar(startPos, 1, false); + endPos = MovePositionOutsideChar(endPos, -1, false); + int count = 0; + int i = startPos; + while (i < endPos) { + count++; + if (IsCrLf(i)) + i++; + i = NextPosition(i, 1); + } + return count; +} + +int Document::CountUTF16(int startPos, int endPos) const { + startPos = MovePositionOutsideChar(startPos, 1, false); + endPos = MovePositionOutsideChar(endPos, -1, false); + int count = 0; + int i = startPos; + while (i < endPos) { + count++; + const int next = NextPosition(i, 1); + if ((next - i) > 3) + count++; + i = next; + } + return count; +} + +int Document::FindColumn(int line, int column) { + int position = LineStart(line); + if ((line >= 0) && (line < LinesTotal())) { + int columnCurrent = 0; + while ((columnCurrent < column) && (position < Length())) { + char ch = cb.CharAt(position); + if (ch == '\t') { + columnCurrent = NextTab(columnCurrent, tabInChars); + if (columnCurrent > column) + return position; + position++; + } else if (ch == '\r') { + return position; + } else if (ch == '\n') { + return position; + } else { + columnCurrent++; + position = NextPosition(position, 1); + } + } + } + return position; +} + +void Document::Indent(bool forwards, int lineBottom, int lineTop) { + // Dedent - suck white space off the front of the line to dedent by equivalent of a tab + for (int line = lineBottom; line >= lineTop; line--) { + int indentOfLine = GetLineIndentation(line); + if (forwards) { + if (LineStart(line) < LineEnd(line)) { + SetLineIndentation(line, indentOfLine + IndentSize()); + } + } else { + SetLineIndentation(line, indentOfLine - IndentSize()); + } + } +} + +// Convert line endings for a piece of text to a particular mode. +// Stop at len or when a NUL is found. +std::string Document::TransformLineEnds(const char *s, size_t len, int eolModeWanted) { + std::string dest; + for (size_t i = 0; (i < len) && (s[i]); i++) { + if (s[i] == '\n' || s[i] == '\r') { + if (eolModeWanted == SC_EOL_CR) { + dest.push_back('\r'); + } else if (eolModeWanted == SC_EOL_LF) { + dest.push_back('\n'); + } else { // eolModeWanted == SC_EOL_CRLF + dest.push_back('\r'); + dest.push_back('\n'); + } + if ((s[i] == '\r') && (i+1 < len) && (s[i+1] == '\n')) { + i++; + } + } else { + dest.push_back(s[i]); + } + } + return dest; +} + +void Document::ConvertLineEnds(int eolModeSet) { + UndoGroup ug(this); + + for (int pos = 0; pos < Length(); pos++) { + if (cb.CharAt(pos) == '\r') { + if (cb.CharAt(pos + 1) == '\n') { + // CRLF + if (eolModeSet == SC_EOL_CR) { + DeleteChars(pos + 1, 1); // Delete the LF + } else if (eolModeSet == SC_EOL_LF) { + DeleteChars(pos, 1); // Delete the CR + } else { + pos++; + } + } else { + // CR + if (eolModeSet == SC_EOL_CRLF) { + pos += InsertString(pos + 1, "\n", 1); // Insert LF + } else if (eolModeSet == SC_EOL_LF) { + pos += InsertString(pos, "\n", 1); // Insert LF + DeleteChars(pos, 1); // Delete CR + pos--; + } + } + } else if (cb.CharAt(pos) == '\n') { + // LF + if (eolModeSet == SC_EOL_CRLF) { + pos += InsertString(pos, "\r", 1); // Insert CR + } else if (eolModeSet == SC_EOL_CR) { + pos += InsertString(pos, "\r", 1); // Insert CR + DeleteChars(pos, 1); // Delete LF + pos--; + } + } + } + +} + +bool Document::IsWhiteLine(int line) const { + int currentChar = LineStart(line); + int endLine = LineEnd(line); + while (currentChar < endLine) { + if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') { + return false; + } + ++currentChar; + } + return true; +} + +int Document::ParaUp(int pos) const { + int line = LineFromPosition(pos); + line--; + while (line >= 0 && IsWhiteLine(line)) { // skip empty lines + line--; + } + while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines + line--; + } + line++; + return LineStart(line); +} + +int Document::ParaDown(int pos) const { + int line = LineFromPosition(pos); + while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines + line++; + } + while (line < LinesTotal() && IsWhiteLine(line)) { // skip empty lines + line++; + } + if (line < LinesTotal()) + return LineStart(line); + else // end of a document + return LineEnd(line-1); +} + +CharClassify::cc Document::WordCharClass(unsigned char ch) const { + if ((SC_CP_UTF8 == dbcsCodePage) && (!UTF8IsAscii(ch))) + return CharClassify::ccWord; + return charClass.GetClass(ch); +} + +/** + * Used by commmands that want to select whole words. + * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. + */ +int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { + CharClassify::cc ccStart = CharClassify::ccWord; + if (delta < 0) { + if (!onlyWordCharacters) + ccStart = WordCharClass(cb.CharAt(pos-1)); + while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) + pos--; + } else { + if (!onlyWordCharacters && pos < Length()) + ccStart = WordCharClass(cb.CharAt(pos)); + while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) + pos++; + } + return MovePositionOutsideChar(pos, delta, true); +} + +/** + * Find the start of the next word in either a forward (delta >= 0) or backwards direction + * (delta < 0). + * This is looking for a transition between character classes although there is also some + * additional movement to transit white space. + * Used by cursor movement by word commands. + */ +int Document::NextWordStart(int pos, int delta) { + if (delta < 0) { + while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace)) + pos--; + if (pos > 0) { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); + while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) { + pos--; + } + } + } else { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); + while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) + pos++; + while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace)) + pos++; + } + return pos; +} + +/** + * Find the end of the next word in either a forward (delta >= 0) or backwards direction + * (delta < 0). + * This is looking for a transition between character classes although there is also some + * additional movement to transit white space. + * Used by cursor movement by word commands. + */ +int Document::NextWordEnd(int pos, int delta) { + if (delta < 0) { + if (pos > 0) { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); + if (ccStart != CharClassify::ccSpace) { + while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { + pos--; + } + } + while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) { + pos--; + } + } + } else { + while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) { + pos++; + } + if (pos < Length()) { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); + while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { + pos++; + } + } + } + return pos; +} + +/** + * Check that the character at the given position is a word or punctuation character and that + * the previous character is of a different character class. + */ +bool Document::IsWordStartAt(int pos) const { + if (pos > 0) { + CharClassify::cc ccPos = WordCharClass(CharAt(pos)); + return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && + (ccPos != WordCharClass(CharAt(pos - 1))); + } + return true; +} + +/** + * Check that the character at the given position is a word or punctuation character and that + * the next character is of a different character class. + */ +bool Document::IsWordEndAt(int pos) const { + if (pos < Length()) { + CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1)); + return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && + (ccPrev != WordCharClass(CharAt(pos))); + } + return true; +} + +/** + * Check that the given range is has transitions between character classes at both + * ends and where the characters on the inside are word or punctuation characters. + */ +bool Document::IsWordAt(int start, int end) const { + return IsWordStartAt(start) && IsWordEndAt(end); +} + +bool Document::MatchesWordOptions(bool word, bool wordStart, int pos, int length) const { + return (!word && !wordStart) || + (word && IsWordAt(pos, pos + length)) || + (wordStart && IsWordStartAt(pos)); +} + +bool Document::HasCaseFolder(void) const { + return pcf != 0; +} + +void Document::SetCaseFolder(CaseFolder *pcf_) { + delete pcf; + pcf = pcf_; +} + +Document::CharacterExtracted Document::ExtractCharacter(int position) const { + const unsigned char leadByte = static_cast(cb.CharAt(position)); + if (UTF8IsAscii(leadByte)) { + // Common case: ASCII character + return CharacterExtracted(leadByte, 1); + } + const int widthCharBytes = UTF8BytesOfLead[leadByte]; + unsigned char charBytes[UTF8MaxBytes] = { leadByte, 0, 0, 0 }; + for (int b=1; b(cb.CharAt(position + b)); + int utf8status = UTF8Classify(charBytes, widthCharBytes); + if (utf8status & UTF8MaskInvalid) { + // Treat as invalid and use up just one byte + return CharacterExtracted(unicodeReplacementChar, 1); + } else { + return CharacterExtracted(UnicodeFromUTF8(charBytes), utf8status & UTF8MaskWidth); + } +} + +/** + * Find text in document, supporting both forward and backward + * searches (just pass minPos > maxPos to do a backward search) + * Has not been tested with backwards DBCS searches yet. + */ +long Document::FindText(int minPos, int maxPos, const char *search, + bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, + int *length) { + if (*length <= 0) + return minPos; + if (regExp) { + if (!regex) + regex = CreateRegexSearch(&charClass); + return regex->FindText(this, minPos, maxPos, search, caseSensitive, word, wordStart, flags, length); + } else { + + const bool forward = minPos <= maxPos; + const int increment = forward ? 1 : -1; + + // Range endpoints should not be inside DBCS characters, but just in case, move them. + const int startPos = MovePositionOutsideChar(minPos, increment, false); + const int endPos = MovePositionOutsideChar(maxPos, increment, false); + + // Compute actual search ranges needed + const int lengthFind = *length; + + //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); + const int limitPos = Platform::Maximum(startPos, endPos); + int pos = startPos; + if (!forward) { + // Back all of a character + pos = NextPosition(pos, increment); + } + if (caseSensitive) { + const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; + const char charStartSearch = search[0]; + while (forward ? (pos < endSearch) : (pos >= endSearch)) { + if (CharAt(pos) == charStartSearch) { + bool found = (pos + lengthFind) <= limitPos; + for (int indexSearch = 1; (indexSearch < lengthFind) && found; indexSearch++) { + found = CharAt(pos + indexSearch) == search[indexSearch]; + } + if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) { + return pos; + } + } + if (!NextCharacter(pos, increment)) + break; + } + } else if (SC_CP_UTF8 == dbcsCodePage) { + const size_t maxFoldingExpansion = 4; + std::vector searchThing(lengthFind * UTF8MaxBytes * maxFoldingExpansion + 1); + const int lenSearch = static_cast( + pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind)); + char bytes[UTF8MaxBytes + 1]; + char folded[UTF8MaxBytes * maxFoldingExpansion + 1]; + while (forward ? (pos < endPos) : (pos >= endPos)) { + int widthFirstCharacter = 0; + int posIndexDocument = pos; + int indexSearch = 0; + bool characterMatches = true; + for (;;) { + const unsigned char leadByte = static_cast(cb.CharAt(posIndexDocument)); + bytes[0] = leadByte; + int widthChar = 1; + if (!UTF8IsAscii(leadByte)) { + const int widthCharBytes = UTF8BytesOfLead[leadByte]; + for (int b=1; b(bytes), widthCharBytes) & UTF8MaskWidth; + } + if (!widthFirstCharacter) + widthFirstCharacter = widthChar; + if ((posIndexDocument + widthChar) > limitPos) + break; + const int lenFlat = static_cast(pcf->Fold(folded, sizeof(folded), bytes, widthChar)); + folded[lenFlat] = 0; + // Does folded match the buffer + characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat); + if (!characterMatches) + break; + posIndexDocument += widthChar; + indexSearch += lenFlat; + if (indexSearch >= lenSearch) + break; + } + if (characterMatches && (indexSearch == static_cast(lenSearch))) { + if (MatchesWordOptions(word, wordStart, pos, posIndexDocument - pos)) { + *length = posIndexDocument - pos; + return pos; + } + } + if (forward) { + pos += widthFirstCharacter; + } else { + if (!NextCharacter(pos, increment)) + break; + } + } + } else if (dbcsCodePage) { + const size_t maxBytesCharacter = 2; + const size_t maxFoldingExpansion = 4; + std::vector searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1); + const int lenSearch = static_cast( + pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind)); + while (forward ? (pos < endPos) : (pos >= endPos)) { + int indexDocument = 0; + int indexSearch = 0; + bool characterMatches = true; + while (characterMatches && + ((pos + indexDocument) < limitPos) && + (indexSearch < lenSearch)) { + char bytes[maxBytesCharacter + 1]; + bytes[0] = cb.CharAt(pos + indexDocument); + const int widthChar = IsDBCSLeadByte(bytes[0]) ? 2 : 1; + if (widthChar == 2) + bytes[1] = cb.CharAt(pos + indexDocument + 1); + if ((pos + indexDocument + widthChar) > limitPos) + break; + char folded[maxBytesCharacter * maxFoldingExpansion + 1]; + const int lenFlat = static_cast(pcf->Fold(folded, sizeof(folded), bytes, widthChar)); + folded[lenFlat] = 0; + // Does folded match the buffer + characterMatches = 0 == memcmp(folded, &searchThing[0] + indexSearch, lenFlat); + indexDocument += widthChar; + indexSearch += lenFlat; + } + if (characterMatches && (indexSearch == static_cast(lenSearch))) { + if (MatchesWordOptions(word, wordStart, pos, indexDocument)) { + *length = indexDocument; + return pos; + } + } + if (!NextCharacter(pos, increment)) + break; + } + } else { + const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos; + std::vector searchThing(lengthFind + 1); + pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind); + while (forward ? (pos < endSearch) : (pos >= endSearch)) { + bool found = (pos + lengthFind) <= limitPos; + for (int indexSearch = 0; (indexSearch < lengthFind) && found; indexSearch++) { + char ch = CharAt(pos + indexSearch); + char folded[2]; + pcf->Fold(folded, sizeof(folded), &ch, 1); + found = folded[0] == searchThing[indexSearch]; + } + if (found && MatchesWordOptions(word, wordStart, pos, lengthFind)) { + return pos; + } + if (!NextCharacter(pos, increment)) + break; + } + } + } + //Platform::DebugPrintf("Not found\n"); + return -1; +} + +const char *Document::SubstituteByPosition(const char *text, int *length) { + if (regex) + return regex->SubstituteByPosition(this, text, length); + else + return 0; +} + +int Document::LinesTotal() const { + return cb.Lines(); +} + +void Document::SetDefaultCharClasses(bool includeWordClass) { + charClass.SetDefaultCharClasses(includeWordClass); +} + +void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) { + charClass.SetCharClasses(chars, newCharClass); +} + +int Document::GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer) { + return charClass.GetCharsOfClass(characterClass, buffer); +} + +void SCI_METHOD Document::StartStyling(int position, char) { + endStyled = position; +} + +bool SCI_METHOD Document::SetStyleFor(int length, char style) { + if (enteredStyling != 0) { + return false; + } else { + enteredStyling++; + int prevEndStyled = endStyled; + if (cb.SetStyleFor(endStyled, length, style)) { + DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, + prevEndStyled, length); + NotifyModified(mh); + } + endStyled += length; + enteredStyling--; + return true; + } +} + +bool SCI_METHOD Document::SetStyles(int length, const char *styles) { + if (enteredStyling != 0) { + return false; + } else { + enteredStyling++; + bool didChange = false; + int startMod = 0; + int endMod = 0; + for (int iPos = 0; iPos < length; iPos++, endStyled++) { + PLATFORM_ASSERT(endStyled < Length()); + if (cb.SetStyleAt(endStyled, styles[iPos])) { + if (!didChange) { + startMod = endStyled; + } + didChange = true; + endMod = endStyled; + } + } + if (didChange) { + DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, + startMod, endMod - startMod + 1); + NotifyModified(mh); + } + enteredStyling--; + return true; + } +} + +void Document::EnsureStyledTo(int pos) { + if ((enteredStyling == 0) && (pos > GetEndStyled())) { + IncrementStyleClock(); + if (pli && !pli->UseContainerLexing()) { + int lineEndStyled = LineFromPosition(GetEndStyled()); + int endStyledTo = LineStart(lineEndStyled); + pli->Colourise(endStyledTo, pos); + } else { + // Ask the watchers to style, and stop as soon as one responds. + for (std::vector::iterator it = watchers.begin(); + (pos > GetEndStyled()) && (it != watchers.end()); ++it) { + it->watcher->NotifyStyleNeeded(this, it->userData, pos); + } + } + } +} + +void Document::LexerChanged() { + // Tell the watchers the lexer has changed. + for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { + it->watcher->NotifyLexerChanged(this, it->userData); + } +} + +int SCI_METHOD Document::SetLineState(int line, int state) { + int statePrevious = static_cast(perLineData[ldState])->SetLineState(line, state); + if (state != statePrevious) { + DocModification mh(SC_MOD_CHANGELINESTATE, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); + } + return statePrevious; +} + +int SCI_METHOD Document::GetLineState(int line) const { + return static_cast(perLineData[ldState])->GetLineState(line); +} + +int Document::GetMaxLineState() { + return static_cast(perLineData[ldState])->GetMaxLineState(); +} + +void SCI_METHOD Document::ChangeLexerState(int start, int end) { + DocModification mh(SC_MOD_LEXERSTATE, start, end-start, 0, 0, 0); + NotifyModified(mh); +} + +StyledText Document::MarginStyledText(int line) const { + LineAnnotation *pla = static_cast(perLineData[ldMargin]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); +} + +void Document::MarginSetText(int line, const char *text) { + static_cast(perLineData[ldMargin])->SetText(line, text); + DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +} + +void Document::MarginSetStyle(int line, int style) { + static_cast(perLineData[ldMargin])->SetStyle(line, style); + NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line)); +} + +void Document::MarginSetStyles(int line, const unsigned char *styles) { + static_cast(perLineData[ldMargin])->SetStyles(line, styles); + NotifyModified(DocModification(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line)); +} + +void Document::MarginClearAll() { + int maxEditorLine = LinesTotal(); + for (int l=0; l(perLineData[ldMargin])->ClearAll(); +} + +StyledText Document::AnnotationStyledText(int line) const { + LineAnnotation *pla = static_cast(perLineData[ldAnnotation]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); +} + +void Document::AnnotationSetText(int line, const char *text) { + if (line >= 0 && line < LinesTotal()) { + const int linesBefore = AnnotationLines(line); + static_cast(perLineData[ldAnnotation])->SetText(line, text); + const int linesAfter = AnnotationLines(line); + DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); + mh.annotationLinesAdded = linesAfter - linesBefore; + NotifyModified(mh); + } +} + +void Document::AnnotationSetStyle(int line, int style) { + static_cast(perLineData[ldAnnotation])->SetStyle(line, style); + DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +} + +void Document::AnnotationSetStyles(int line, const unsigned char *styles) { + if (line >= 0 && line < LinesTotal()) { + static_cast(perLineData[ldAnnotation])->SetStyles(line, styles); + } +} + +int Document::AnnotationLines(int line) const { + return static_cast(perLineData[ldAnnotation])->Lines(line); +} + +void Document::AnnotationClearAll() { + int maxEditorLine = LinesTotal(); + for (int l=0; l(perLineData[ldAnnotation])->ClearAll(); +} + +void Document::IncrementStyleClock() { + styleClock = (styleClock + 1) % 0x100000; +} + +void SCI_METHOD Document::DecorationFillRange(int position, int value, int fillLength) { + if (decorations.FillRange(position, value, fillLength)) { + DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, + position, fillLength); + NotifyModified(mh); + } +} + +bool Document::AddWatcher(DocWatcher *watcher, void *userData) { + WatcherWithUserData wwud(watcher, userData); + std::vector::iterator it = + std::find(watchers.begin(), watchers.end(), wwud); + if (it != watchers.end()) + return false; + watchers.push_back(wwud); + return true; +} + +bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) { + std::vector::iterator it = + std::find(watchers.begin(), watchers.end(), WatcherWithUserData(watcher, userData)); + if (it != watchers.end()) { + watchers.erase(it); + return true; + } + return false; +} + +void Document::NotifyModifyAttempt() { + for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { + it->watcher->NotifyModifyAttempt(this, it->userData); + } +} + +void Document::NotifySavePoint(bool atSavePoint) { + for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { + it->watcher->NotifySavePoint(this, it->userData, atSavePoint); + } +} + +void Document::NotifyModified(DocModification mh) { + if (mh.modificationType & SC_MOD_INSERTTEXT) { + decorations.InsertSpace(mh.position, mh.length); + } else if (mh.modificationType & SC_MOD_DELETETEXT) { + decorations.DeleteRange(mh.position, mh.length); + } + for (std::vector::iterator it = watchers.begin(); it != watchers.end(); ++it) { + it->watcher->NotifyModified(this, mh, it->userData); + } +} + +bool Document::IsWordPartSeparator(char ch) const { + return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch); +} + +int Document::WordPartLeft(int pos) { + if (pos > 0) { + --pos; + char startChar = cb.CharAt(pos); + if (IsWordPartSeparator(startChar)) { + while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { + --pos; + } + } + if (pos > 0) { + startChar = cb.CharAt(pos); + --pos; + if (IsLowerCase(startChar)) { + while (pos > 0 && IsLowerCase(cb.CharAt(pos))) + --pos; + if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) + ++pos; + } else if (IsUpperCase(startChar)) { + while (pos > 0 && IsUpperCase(cb.CharAt(pos))) + --pos; + if (!IsUpperCase(cb.CharAt(pos))) + ++pos; + } else if (IsADigit(startChar)) { + while (pos > 0 && IsADigit(cb.CharAt(pos))) + --pos; + if (!IsADigit(cb.CharAt(pos))) + ++pos; + } else if (IsPunctuation(startChar)) { + while (pos > 0 && IsPunctuation(cb.CharAt(pos))) + --pos; + if (!IsPunctuation(cb.CharAt(pos))) + ++pos; + } else if (isspacechar(startChar)) { + while (pos > 0 && isspacechar(cb.CharAt(pos))) + --pos; + if (!isspacechar(cb.CharAt(pos))) + ++pos; + } else if (!IsASCII(startChar)) { + while (pos > 0 && !IsASCII(cb.CharAt(pos))) + --pos; + if (IsASCII(cb.CharAt(pos))) + ++pos; + } else { + ++pos; + } + } + } + return pos; +} + +int Document::WordPartRight(int pos) { + char startChar = cb.CharAt(pos); + int length = Length(); + if (IsWordPartSeparator(startChar)) { + while (pos < length && IsWordPartSeparator(cb.CharAt(pos))) + ++pos; + startChar = cb.CharAt(pos); + } + if (!IsASCII(startChar)) { + while (pos < length && !IsASCII(cb.CharAt(pos))) + ++pos; + } else if (IsLowerCase(startChar)) { + while (pos < length && IsLowerCase(cb.CharAt(pos))) + ++pos; + } else if (IsUpperCase(startChar)) { + if (IsLowerCase(cb.CharAt(pos + 1))) { + ++pos; + while (pos < length && IsLowerCase(cb.CharAt(pos))) + ++pos; + } else { + while (pos < length && IsUpperCase(cb.CharAt(pos))) + ++pos; + } + if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1))) + --pos; + } else if (IsADigit(startChar)) { + while (pos < length && IsADigit(cb.CharAt(pos))) + ++pos; + } else if (IsPunctuation(startChar)) { + while (pos < length && IsPunctuation(cb.CharAt(pos))) + ++pos; + } else if (isspacechar(startChar)) { + while (pos < length && isspacechar(cb.CharAt(pos))) + ++pos; + } else { + ++pos; + } + return pos; +} + +bool IsLineEndChar(char c) { + return (c == '\n' || c == '\r'); +} + +int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { + int sStart = cb.StyleAt(pos); + if (delta < 0) { + while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) + pos--; + pos++; + } else { + while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos)))) + pos++; + } + return pos; +} + +static char BraceOpposite(char ch) { + switch (ch) { + case '(': + return ')'; + case ')': + return '('; + case '[': + return ']'; + case ']': + return '['; + case '{': + return '}'; + case '}': + return '{'; + case '<': + return '>'; + case '>': + return '<'; + default: + return '\0'; + } +} + +// TODO: should be able to extend styled region to find matching brace +int Document::BraceMatch(int position, int /*maxReStyle*/) { + char chBrace = CharAt(position); + char chSeek = BraceOpposite(chBrace); + if (chSeek == '\0') + return - 1; + char styBrace = static_cast(StyleAt(position)); + int direction = -1; + if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') + direction = 1; + int depth = 1; + position = NextPosition(position, direction); + while ((position >= 0) && (position < Length())) { + char chAtPos = CharAt(position); + char styAtPos = static_cast(StyleAt(position)); + if ((position > GetEndStyled()) || (styAtPos == styBrace)) { + if (chAtPos == chBrace) + depth++; + if (chAtPos == chSeek) + depth--; + if (depth == 0) + return position; + } + int positionBeforeMove = position; + position = NextPosition(position, direction); + if (position == positionBeforeMove) + break; + } + return - 1; +} + +/** + * Implementation of RegexSearchBase for the default built-in regular expression engine + */ +class BuiltinRegex : public RegexSearchBase { +public: + explicit BuiltinRegex(CharClassify *charClassTable) : search(charClassTable) {} + + virtual ~BuiltinRegex() { + } + + virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, int flags, + int *length); + + virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length); + +private: + RESearch search; + std::string substituted; +}; + +namespace { + +/** +* RESearchRange keeps track of search range. +*/ +class RESearchRange { +public: + const Document *doc; + int increment; + int startPos; + int endPos; + int lineRangeStart; + int lineRangeEnd; + int lineRangeBreak; + RESearchRange(const Document *doc_, int minPos, int maxPos) : doc(doc_) { + increment = (minPos <= maxPos) ? 1 : -1; + + // Range endpoints should not be inside DBCS characters, but just in case, move them. + startPos = doc->MovePositionOutsideChar(minPos, 1, false); + endPos = doc->MovePositionOutsideChar(maxPos, 1, false); + + lineRangeStart = doc->LineFromPosition(startPos); + lineRangeEnd = doc->LineFromPosition(endPos); + if ((increment == 1) && + (startPos >= doc->LineEnd(lineRangeStart)) && + (lineRangeStart < lineRangeEnd)) { + // the start position is at end of line or between line end characters. + lineRangeStart++; + startPos = doc->LineStart(lineRangeStart); + } else if ((increment == -1) && + (startPos <= doc->LineStart(lineRangeStart)) && + (lineRangeStart > lineRangeEnd)) { + // the start position is at beginning of line. + lineRangeStart--; + startPos = doc->LineEnd(lineRangeStart); + } + lineRangeBreak = lineRangeEnd + increment; + } + Range LineRange(int line) const { + Range range(doc->LineStart(line), doc->LineEnd(line)); + if (increment == 1) { + if (line == lineRangeStart) + range.start = startPos; + if (line == lineRangeEnd) + range.end = endPos; + } else { + if (line == lineRangeEnd) + range.start = endPos; + if (line == lineRangeStart) + range.end = startPos; + } + return range; + } +}; + +// Define a way for the Regular Expression code to access the document +class DocumentIndexer : public CharacterIndexer { + Document *pdoc; + int end; +public: + DocumentIndexer(Document *pdoc_, int end_) : + pdoc(pdoc_), end(end_) { + } + + virtual ~DocumentIndexer() { + } + + virtual char CharAt(int index) { + if (index < 0 || index >= end) + return 0; + else + return pdoc->CharAt(index); + } +}; + +#ifdef CXX11_REGEX + +class ByteIterator : public std::iterator { +public: + const Document *doc; + Position position; + ByteIterator(const Document *doc_ = 0, Position position_ = 0) : doc(doc_), position(position_) { + } + ByteIterator(const ByteIterator &other) { + doc = other.doc; + position = other.position; + } + ByteIterator &operator=(const ByteIterator &other) { + if (this != &other) { + doc = other.doc; + position = other.position; + } + return *this; + } + char operator*() const { + return doc->CharAt(position); + } + ByteIterator &operator++() { + position++; + return *this; + } + ByteIterator operator++(int) { + ByteIterator retVal(*this); + position++; + return retVal; + } + ByteIterator &operator--() { + position--; + return *this; + } + bool operator==(const ByteIterator &other) const { + return doc == other.doc && position == other.position; + } + bool operator!=(const ByteIterator &other) const { + return doc != other.doc || position != other.position; + } + int Pos() const { + return position; + } + int PosRoundUp() const { + return position; + } +}; + +// On Windows, wchar_t is 16 bits wide and on Unix it is 32 bits wide. +// Would be better to use sizeof(wchar_t) or similar to differentiate +// but easier for now to hard-code platforms. +// C++11 has char16_t and char32_t but neither Clang nor Visual C++ +// appear to allow specializing basic_regex over these. + +#ifdef _WIN32 +#define WCHAR_T_IS_16 1 +#else +#define WCHAR_T_IS_16 0 +#endif + +#if WCHAR_T_IS_16 + +// On Windows, report non-BMP characters as 2 separate surrogates as that +// matches wregex since it is based on wchar_t. +class UTF8Iterator : public std::iterator { + // These 3 fields determine the iterator position and are used for comparisons + const Document *doc; + Position position; + size_t characterIndex; + // Remaining fields are derived from the determining fields so are excluded in comparisons + unsigned int lenBytes; + size_t lenCharacters; + wchar_t buffered[2]; +public: + UTF8Iterator(const Document *doc_ = 0, Position position_ = 0) : + doc(doc_), position(position_), characterIndex(0), lenBytes(0), lenCharacters(0) { + buffered[0] = 0; + buffered[1] = 0; + if (doc) { + ReadCharacter(); + } + } + UTF8Iterator(const UTF8Iterator &other) { + doc = other.doc; + position = other.position; + characterIndex = other.characterIndex; + lenBytes = other.lenBytes; + lenCharacters = other.lenCharacters; + buffered[0] = other.buffered[0]; + buffered[1] = other.buffered[1]; + } + UTF8Iterator &operator=(const UTF8Iterator &other) { + if (this != &other) { + doc = other.doc; + position = other.position; + characterIndex = other.characterIndex; + lenBytes = other.lenBytes; + lenCharacters = other.lenCharacters; + buffered[0] = other.buffered[0]; + buffered[1] = other.buffered[1]; + } + return *this; + } + wchar_t operator*() const { + assert(lenCharacters != 0); + return buffered[characterIndex]; + } + UTF8Iterator &operator++() { + if ((characterIndex + 1) < (lenCharacters)) { + characterIndex++; + } else { + position += lenBytes; + ReadCharacter(); + characterIndex = 0; + } + return *this; + } + UTF8Iterator operator++(int) { + UTF8Iterator retVal(*this); + if ((characterIndex + 1) < (lenCharacters)) { + characterIndex++; + } else { + position += lenBytes; + ReadCharacter(); + characterIndex = 0; + } + return retVal; + } + UTF8Iterator &operator--() { + if (characterIndex) { + characterIndex--; + } else { + position = doc->NextPosition(position, -1); + ReadCharacter(); + characterIndex = lenCharacters - 1; + } + return *this; + } + bool operator==(const UTF8Iterator &other) const { + // Only test the determining fields, not the character widths and values derived from this + return doc == other.doc && + position == other.position && + characterIndex == other.characterIndex; + } + bool operator!=(const UTF8Iterator &other) const { + // Only test the determining fields, not the character widths and values derived from this + return doc != other.doc || + position != other.position || + characterIndex != other.characterIndex; + } + int Pos() const { + return position; + } + int PosRoundUp() const { + if (characterIndex) + return position + lenBytes; // Force to end of character + else + return position; + } +private: + void ReadCharacter() { + Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position); + lenBytes = charExtracted.widthBytes; + if (charExtracted.character == unicodeReplacementChar) { + lenCharacters = 1; + buffered[0] = static_cast(charExtracted.character); + } else { + lenCharacters = UTF16FromUTF32Character(charExtracted.character, buffered); + } + } +}; + +#else + +// On Unix, report non-BMP characters as single characters + +class UTF8Iterator : public std::iterator { + const Document *doc; + Position position; +public: + UTF8Iterator(const Document *doc_=0, Position position_=0) : doc(doc_), position(position_) { + } + UTF8Iterator(const UTF8Iterator &other) { + doc = other.doc; + position = other.position; + } + UTF8Iterator &operator=(const UTF8Iterator &other) { + if (this != &other) { + doc = other.doc; + position = other.position; + } + return *this; + } + wchar_t operator*() const { + Document::CharacterExtracted charExtracted = doc->ExtractCharacter(position); + return charExtracted.character; + } + UTF8Iterator &operator++() { + position = doc->NextPosition(position, 1); + return *this; + } + UTF8Iterator operator++(int) { + UTF8Iterator retVal(*this); + position = doc->NextPosition(position, 1); + return retVal; + } + UTF8Iterator &operator--() { + position = doc->NextPosition(position, -1); + return *this; + } + bool operator==(const UTF8Iterator &other) const { + return doc == other.doc && position == other.position; + } + bool operator!=(const UTF8Iterator &other) const { + return doc != other.doc || position != other.position; + } + int Pos() const { + return position; + } + int PosRoundUp() const { + return position; + } +}; + +#endif + +std::regex_constants::match_flag_type MatchFlags(const Document *doc, int startPos, int endPos) { + std::regex_constants::match_flag_type flagsMatch = std::regex_constants::match_default; + if (!doc->IsLineStartPosition(startPos)) + flagsMatch |= std::regex_constants::match_not_bol; + if (!doc->IsLineEndPosition(endPos)) + flagsMatch |= std::regex_constants::match_not_eol; + return flagsMatch; +} + +template +bool MatchOnLines(const Document *doc, const Regex ®exp, const RESearchRange &resr, RESearch &search) { + bool matched = false; + std::match_results match; + + // MSVC and libc++ have problems with ^ and $ matching line ends inside a range + // If they didn't then the line by line iteration could be removed for the forwards + // case and replaced with the following 4 lines: + // Iterator uiStart(doc, startPos); + // Iterator uiEnd(doc, endPos); + // flagsMatch = MatchFlags(doc, startPos, endPos); + // matched = std::regex_search(uiStart, uiEnd, match, regexp, flagsMatch); + + // Line by line. + for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { + const Range lineRange = resr.LineRange(line); + Iterator itStart(doc, lineRange.start); + Iterator itEnd(doc, lineRange.end); + std::regex_constants::match_flag_type flagsMatch = MatchFlags(doc, lineRange.start, lineRange.end); + matched = std::regex_search(itStart, itEnd, match, regexp, flagsMatch); + // Check for the last match on this line. + if (matched) { + if (resr.increment == -1) { + while (matched) { + Iterator itNext(doc, match[0].second.PosRoundUp()); + flagsMatch = MatchFlags(doc, itNext.Pos(), lineRange.end); + std::match_results matchNext; + matched = std::regex_search(itNext, itEnd, matchNext, regexp, flagsMatch); + if (matched) { + if (match[0].first == match[0].second) { + // Empty match means failure so exit + return false; + } + match = matchNext; + } + } + matched = true; + } + break; + } + } + if (matched) { + for (size_t co = 0; co < match.size(); co++) { + search.bopat[co] = match[co].first.Pos(); + search.eopat[co] = match[co].second.PosRoundUp(); + size_t lenMatch = search.eopat[co] - search.bopat[co]; + search.pat[co].resize(lenMatch); + for (size_t iPos = 0; iPos < lenMatch; iPos++) { + search.pat[co][iPos] = doc->CharAt(iPos + search.bopat[co]); + } + } + } + return matched; +} + +long Cxx11RegexFindText(Document *doc, int minPos, int maxPos, const char *s, + bool caseSensitive, int *length, RESearch &search) { + const RESearchRange resr(doc, minPos, maxPos); + try { + //ElapsedTime et; + std::regex::flag_type flagsRe = std::regex::ECMAScript; + // Flags that apper to have no effect: + // | std::regex::collate | std::regex::extended; + if (!caseSensitive) + flagsRe = flagsRe | std::regex::icase; + + // Clear the RESearch so can fill in matches + search.Clear(); + + bool matched = false; + if (SC_CP_UTF8 == doc->dbcsCodePage) { + unsigned int lenS = static_cast(strlen(s)); + std::vector ws(lenS + 1); +#if WCHAR_T_IS_16 + size_t outLen = UTF16FromUTF8(s, lenS, &ws[0], lenS); +#else + size_t outLen = UTF32FromUTF8(s, lenS, reinterpret_cast(&ws[0]), lenS); +#endif + ws[outLen] = 0; + std::wregex regexp; +#if defined(__APPLE__) + // Using a UTF-8 locale doesn't change to Unicode over a byte buffer so '.' + // is one byte not one character. + // However, on OS X this makes wregex act as Unicode + std::locale localeU("en_US.UTF-8"); + regexp.imbue(localeU); +#endif + regexp.assign(&ws[0], flagsRe); + matched = MatchOnLines(doc, regexp, resr, search); + + } else { + std::regex regexp; + regexp.assign(s, flagsRe); + matched = MatchOnLines(doc, regexp, resr, search); + } + + int posMatch = -1; + if (matched) { + posMatch = search.bopat[0]; + *length = search.eopat[0] - search.bopat[0]; + } + // Example - search in doc/ScintillaHistory.html for + // [[:upper:]]eta[[:space:]] + // On MacBook, normally around 1 second but with locale imbued -> 14 seconds. + //double durSearch = et.Duration(true); + //Platform::DebugPrintf("Search:%9.6g \n", durSearch); + return posMatch; + } catch (std::regex_error &) { + // Failed to create regular expression + throw RegexError(); + } catch (...) { + // Failed in some other way + return -1; + } +} + +#endif + +} + +long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s, + bool caseSensitive, bool, bool, int flags, + int *length) { + +#ifdef CXX11_REGEX + if (flags & SCFIND_CXX11REGEX) { + return Cxx11RegexFindText(doc, minPos, maxPos, s, + caseSensitive, length, search); + } +#endif + + const RESearchRange resr(doc, minPos, maxPos); + + const bool posix = (flags & SCFIND_POSIX) != 0; + + const char *errmsg = search.Compile(s, *length, caseSensitive, posix); + if (errmsg) { + return -1; + } + // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\)) + // Replace first '.' with '-' in each property file variable reference: + // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) + // Replace: $(\1-\2) + int pos = -1; + int lenRet = 0; + const char searchEnd = s[*length - 1]; + const char searchEndPrev = (*length > 1) ? s[*length - 2] : '\0'; + for (int line = resr.lineRangeStart; line != resr.lineRangeBreak; line += resr.increment) { + int startOfLine = doc->LineStart(line); + int endOfLine = doc->LineEnd(line); + if (resr.increment == 1) { + if (line == resr.lineRangeStart) { + if ((resr.startPos != startOfLine) && (s[0] == '^')) + continue; // Can't match start of line if start position after start of line + startOfLine = resr.startPos; + } + if (line == resr.lineRangeEnd) { + if ((resr.endPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\')) + continue; // Can't match end of line if end position before end of line + endOfLine = resr.endPos; + } + } else { + if (line == resr.lineRangeEnd) { + if ((resr.endPos != startOfLine) && (s[0] == '^')) + continue; // Can't match start of line if end position after start of line + startOfLine = resr.endPos; + } + if (line == resr.lineRangeStart) { + if ((resr.startPos != endOfLine) && (searchEnd == '$') && (searchEndPrev != '\\')) + continue; // Can't match end of line if start position before end of line + endOfLine = resr.startPos; + } + } + + DocumentIndexer di(doc, endOfLine); + int success = search.Execute(di, startOfLine, endOfLine); + if (success) { + pos = search.bopat[0]; + // Ensure only whole characters selected + search.eopat[0] = doc->MovePositionOutsideChar(search.eopat[0], 1, false); + lenRet = search.eopat[0] - search.bopat[0]; + // There can be only one start of a line, so no need to look for last match in line + if ((resr.increment == -1) && (s[0] != '^')) { + // Check for the last match on this line. + int repetitions = 1000; // Break out of infinite loop + while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) { + success = search.Execute(di, pos+1, endOfLine); + if (success) { + if (search.eopat[0] <= minPos) { + pos = search.bopat[0]; + lenRet = search.eopat[0] - search.bopat[0]; + } else { + success = 0; + } + } + } + } + break; + } + } + *length = lenRet; + return pos; +} + +const char *BuiltinRegex::SubstituteByPosition(Document *doc, const char *text, int *length) { + substituted.clear(); + DocumentIndexer di(doc, doc->Length()); + search.GrabMatches(di); + for (int j = 0; j < *length; j++) { + if (text[j] == '\\') { + if (text[j + 1] >= '0' && text[j + 1] <= '9') { + unsigned int patNum = text[j + 1] - '0'; + unsigned int len = search.eopat[patNum] - search.bopat[patNum]; + if (!search.pat[patNum].empty()) // Will be null if try for a match that did not occur + substituted.append(search.pat[patNum].c_str(), len); + j++; + } else { + j++; + switch (text[j]) { + case 'a': + substituted.push_back('\a'); + break; + case 'b': + substituted.push_back('\b'); + break; + case 'f': + substituted.push_back('\f'); + break; + case 'n': + substituted.push_back('\n'); + break; + case 'r': + substituted.push_back('\r'); + break; + case 't': + substituted.push_back('\t'); + break; + case 'v': + substituted.push_back('\v'); + break; + case '\\': + substituted.push_back('\\'); + break; + default: + substituted.push_back('\\'); + j--; + } + } + } else { + substituted.push_back(text[j]); + } + } + *length = static_cast(substituted.length()); + return substituted.c_str(); +} + +#ifndef SCI_OWNREGEX + +#ifdef SCI_NAMESPACE + +RegexSearchBase *Scintilla::CreateRegexSearch(CharClassify *charClassTable) { + return new BuiltinRegex(charClassTable); +} + +#else + +RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable) { + return new BuiltinRegex(charClassTable); +} + +#endif + +#endif diff --git a/libs/qscintilla/src/Document.h b/libs/qscintilla/src/Document.h new file mode 100644 index 000000000..5e66dc2b6 --- /dev/null +++ b/libs/qscintilla/src/Document.h @@ -0,0 +1,536 @@ +// Scintilla source code edit control +/** @file Document.h + ** Text document that handles notifications, DBCS, styling, words and end of line. + **/ +// Copyright 1998-2011 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef DOCUMENT_H +#define DOCUMENT_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + * A Position is a position within a document between two characters or at the beginning or end. + * Sometimes used as a character index where it identifies the character after the position. + */ +typedef int Position; +const Position invalidPosition = -1; + +enum EncodingFamily { efEightBit, efUnicode, efDBCS }; + +/** + * The range class represents a range of text in a document. + * The two values are not sorted as one end may be more significant than the other + * as is the case for the selection where the end position is the position of the caret. + * If either position is invalidPosition then the range is invalid and most operations will fail. + */ +class Range { +public: + Position start; + Position end; + + explicit Range(Position pos=0) : + start(pos), end(pos) { + } + Range(Position start_, Position end_) : + start(start_), end(end_) { + } + + bool operator==(const Range &other) const { + return (start == other.start) && (end == other.end); + } + + bool Valid() const { + return (start != invalidPosition) && (end != invalidPosition); + } + + Position First() const { + return (start <= end) ? start : end; + } + + Position Last() const { + return (start > end) ? start : end; + } + + // Is the position within the range? + bool Contains(Position pos) const { + if (start < end) { + return (pos >= start && pos <= end); + } else { + return (pos <= start && pos >= end); + } + } + + // Is the character after pos within the range? + bool ContainsCharacter(Position pos) const { + if (start < end) { + return (pos >= start && pos < end); + } else { + return (pos < start && pos >= end); + } + } + + bool Contains(Range other) const { + return Contains(other.start) && Contains(other.end); + } + + bool Overlaps(Range other) const { + return + Contains(other.start) || + Contains(other.end) || + other.Contains(start) || + other.Contains(end); + } +}; + +class DocWatcher; +class DocModification; +class Document; + +/** + * Interface class for regular expression searching + */ +class RegexSearchBase { +public: + virtual ~RegexSearchBase() {} + + virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0; + + ///@return String with the substitutions, must remain valid until the next call or destruction + virtual const char *SubstituteByPosition(Document *doc, const char *text, int *length) = 0; +}; + +/// Factory function for RegexSearchBase +extern RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable); + +struct StyledText { + size_t length; + const char *text; + bool multipleStyles; + size_t style; + const unsigned char *styles; + StyledText(size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) : + length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) { + } + // Return number of bytes from start to before '\n' or end of text. + // Return 1 when start is outside text + size_t LineLength(size_t start) const { + size_t cur = start; + while ((cur < length) && (text[cur] != '\n')) + cur++; + return cur-start; + } + size_t StyleAt(size_t i) const { + return multipleStyles ? styles[i] : style; + } +}; + +class HighlightDelimiter { +public: + HighlightDelimiter() : isEnabled(false) { + Clear(); + } + + void Clear() { + beginFoldBlock = -1; + endFoldBlock = -1; + firstChangeableLineBefore = -1; + firstChangeableLineAfter = -1; + } + + bool NeedsDrawing(int line) const { + return isEnabled && (line <= firstChangeableLineBefore || line >= firstChangeableLineAfter); + } + + bool IsFoldBlockHighlighted(int line) const { + return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock; + } + + bool IsHeadOfFoldBlock(int line) const { + return beginFoldBlock == line && line < endFoldBlock; + } + + bool IsBodyOfFoldBlock(int line) const { + return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock; + } + + bool IsTailOfFoldBlock(int line) const { + return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock; + } + + int beginFoldBlock; // Begin of current fold block + int endFoldBlock; // End of current fold block + int firstChangeableLineBefore; // First line that triggers repaint before starting line that determined current fold block + int firstChangeableLineAfter; // First line that triggers repaint after starting line that determined current fold block + bool isEnabled; +}; + +class Document; + +class LexInterface { +protected: + Document *pdoc; + ILexer *instance; + bool performingStyle; ///< Prevent reentrance +public: + explicit LexInterface(Document *pdoc_) : pdoc(pdoc_), instance(0), performingStyle(false) { + } + virtual ~LexInterface() { + } + void Colourise(int start, int end); + int LineEndTypesSupported(); + bool UseContainerLexing() const { + return instance == 0; + } +}; + +struct RegexError : public std::runtime_error { + RegexError() : std::runtime_error("regex failure") {} +}; + +/** + */ +class Document : PerLine, public IDocumentWithLineEnd, public ILoader { + +public: + /** Used to pair watcher pointer with user data. */ + struct WatcherWithUserData { + DocWatcher *watcher; + void *userData; + WatcherWithUserData(DocWatcher *watcher_=0, void *userData_=0) : + watcher(watcher_), userData(userData_) { + } + bool operator==(const WatcherWithUserData &other) const { + return (watcher == other.watcher) && (userData == other.userData); + } + }; + +private: + int refCount; + CellBuffer cb; + CharClassify charClass; + CaseFolder *pcf; + int endStyled; + int styleClock; + int enteredModification; + int enteredStyling; + int enteredReadOnlyCount; + + bool insertionSet; + std::string insertion; + + std::vector watchers; + + // ldSize is not real data - it is for dimensions and loops + enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize }; + PerLine *perLineData[ldSize]; + + bool matchesValid; + RegexSearchBase *regex; + +public: + + LexInterface *pli; + + int eolMode; + /// Can also be SC_CP_UTF8 to enable UTF-8 mode + int dbcsCodePage; + int lineEndBitSet; + int tabInChars; + int indentInChars; + int actualIndentInChars; + bool useTabs; + bool tabIndents; + bool backspaceUnindents; + + DecorationList decorations; + + Document(); + virtual ~Document(); + + int AddRef(); + int SCI_METHOD Release(); + + virtual void Init(); + int LineEndTypesSupported() const; + bool SetDBCSCodePage(int dbcsCodePage_); + int GetLineEndTypesAllowed() const { return cb.GetLineEndTypes(); } + bool SetLineEndTypesAllowed(int lineEndBitSet_); + int GetLineEndTypesActive() const { return cb.GetLineEndTypes(); } + virtual void InsertLine(int line); + virtual void RemoveLine(int line); + + int SCI_METHOD Version() const { + return dvLineEnd; + } + + void SCI_METHOD SetErrorStatus(int status); + + int SCI_METHOD LineFromPosition(int pos) const; + int ClampPositionIntoDocument(int pos) const; + bool IsCrLf(int pos) const; + int LenChar(int pos); + bool InGoodUTF8(int pos, int &start, int &end) const; + int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; + int NextPosition(int pos, int moveDir) const; + bool NextCharacter(int &pos, int moveDir) const; // Returns true if pos changed + int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const; + int GetRelativePositionUTF16(int positionStart, int characterOffset) const; + int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const; + int SCI_METHOD CodePage() const; + bool SCI_METHOD IsDBCSLeadByte(char ch) const; + int SafeSegment(const char *text, int length, int lengthSegment) const; + EncodingFamily CodePageFamily() const; + + // Gateways to modifying document + void ModifiedAt(int pos); + void CheckReadOnly(); + bool DeleteChars(int pos, int len); + int InsertString(int position, const char *s, int insertLength); + void ChangeInsertion(const char *s, int length); + int SCI_METHOD AddData(char *data, int length); + void * SCI_METHOD ConvertToDocument(); + int Undo(); + int Redo(); + bool CanUndo() const { return cb.CanUndo(); } + bool CanRedo() const { return cb.CanRedo(); } + void DeleteUndoHistory() { cb.DeleteUndoHistory(); } + bool SetUndoCollection(bool collectUndo) { + return cb.SetUndoCollection(collectUndo); + } + bool IsCollectingUndo() const { return cb.IsCollectingUndo(); } + void BeginUndoAction() { cb.BeginUndoAction(); } + void EndUndoAction() { cb.EndUndoAction(); } + void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } + void SetSavePoint(); + bool IsSavePoint() const { return cb.IsSavePoint(); } + + void TentativeStart() { cb.TentativeStart(); } + void TentativeCommit() { cb.TentativeCommit(); } + void TentativeUndo(); + bool TentativeActive() const { return cb.TentativeActive(); } + + const char * SCI_METHOD BufferPointer() { return cb.BufferPointer(); } + const char *RangePointer(int position, int rangeLength) { return cb.RangePointer(position, rangeLength); } + int GapPosition() const { return cb.GapPosition(); } + + int SCI_METHOD GetLineIndentation(int line); + int SetLineIndentation(int line, int indent); + int GetLineIndentPosition(int line) const; + int GetColumn(int position); + int CountCharacters(int startPos, int endPos) const; + int CountUTF16(int startPos, int endPos) const; + int FindColumn(int line, int column); + void Indent(bool forwards, int lineBottom, int lineTop); + static std::string TransformLineEnds(const char *s, size_t len, int eolModeWanted); + void ConvertLineEnds(int eolModeSet); + void SetReadOnly(bool set) { cb.SetReadOnly(set); } + bool IsReadOnly() const { return cb.IsReadOnly(); } + + void DelChar(int pos); + void DelCharBack(int pos); + + char CharAt(int position) const { return cb.CharAt(position); } + void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const { + cb.GetCharRange(buffer, position, lengthRetrieve); + } + char SCI_METHOD StyleAt(int position) const { return cb.StyleAt(position); } + void GetStyleRange(unsigned char *buffer, int position, int lengthRetrieve) const { + cb.GetStyleRange(buffer, position, lengthRetrieve); + } + int GetMark(int line); + int MarkerNext(int lineStart, int mask) const; + int AddMark(int line, int markerNum); + void AddMarkSet(int line, int valueSet); + void DeleteMark(int line, int markerNum); + void DeleteMarkFromHandle(int markerHandle); + void DeleteAllMarks(int markerNum); + int LineFromHandle(int markerHandle); + int SCI_METHOD LineStart(int line) const; + bool IsLineStartPosition(int position) const; + int SCI_METHOD LineEnd(int line) const; + int LineEndPosition(int position) const; + bool IsLineEndPosition(int position) const; + bool IsPositionInLineEnd(int position) const; + int VCHomePosition(int position) const; + + int SCI_METHOD SetLevel(int line, int level); + int SCI_METHOD GetLevel(int line) const; + void ClearLevels(); + int GetLastChild(int lineParent, int level=-1, int lastLine=-1); + int GetFoldParent(int line) const; + void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int lastLine); + + void Indent(bool forwards); + int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); + int NextWordStart(int pos, int delta); + int NextWordEnd(int pos, int delta); + int SCI_METHOD Length() const { return cb.Length(); } + void Allocate(int newSize) { cb.Allocate(newSize); } + + struct CharacterExtracted { + unsigned int character; + unsigned int widthBytes; + CharacterExtracted(unsigned int character_, unsigned int widthBytes_) : + character(character_), widthBytes(widthBytes_) { + } + }; + CharacterExtracted ExtractCharacter(int position) const; + + bool MatchesWordOptions(bool word, bool wordStart, int pos, int length) const; + bool HasCaseFolder(void) const; + void SetCaseFolder(CaseFolder *pcf_); + long FindText(int minPos, int maxPos, const char *search, bool caseSensitive, bool word, + bool wordStart, bool regExp, int flags, int *length); + const char *SubstituteByPosition(const char *text, int *length); + int LinesTotal() const; + + void SetDefaultCharClasses(bool includeWordClass); + void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass); + int GetCharsOfClass(CharClassify::cc characterClass, unsigned char *buffer); + void SCI_METHOD StartStyling(int position, char mask); + bool SCI_METHOD SetStyleFor(int length, char style); + bool SCI_METHOD SetStyles(int length, const char *styles); + int GetEndStyled() const { return endStyled; } + void EnsureStyledTo(int pos); + void LexerChanged(); + int GetStyleClock() const { return styleClock; } + void IncrementStyleClock(); + void SCI_METHOD DecorationSetCurrentIndicator(int indicator) { + decorations.SetCurrentIndicator(indicator); + } + void SCI_METHOD DecorationFillRange(int position, int value, int fillLength); + + int SCI_METHOD SetLineState(int line, int state); + int SCI_METHOD GetLineState(int line) const; + int GetMaxLineState(); + void SCI_METHOD ChangeLexerState(int start, int end); + + StyledText MarginStyledText(int line) const; + void MarginSetStyle(int line, int style); + void MarginSetStyles(int line, const unsigned char *styles); + void MarginSetText(int line, const char *text); + void MarginClearAll(); + + StyledText AnnotationStyledText(int line) const; + void AnnotationSetText(int line, const char *text); + void AnnotationSetStyle(int line, int style); + void AnnotationSetStyles(int line, const unsigned char *styles); + int AnnotationLines(int line) const; + void AnnotationClearAll(); + + bool AddWatcher(DocWatcher *watcher, void *userData); + bool RemoveWatcher(DocWatcher *watcher, void *userData); + + CharClassify::cc WordCharClass(unsigned char ch) const; + bool IsWordPartSeparator(char ch) const; + int WordPartLeft(int pos); + int WordPartRight(int pos); + int ExtendStyleRange(int pos, int delta, bool singleLine = false); + bool IsWhiteLine(int line) const; + int ParaUp(int pos) const; + int ParaDown(int pos) const; + int IndentSize() const { return actualIndentInChars; } + int BraceMatch(int position, int maxReStyle); + +private: + bool IsWordStartAt(int pos) const; + bool IsWordEndAt(int pos) const; + bool IsWordAt(int start, int end) const; + + void NotifyModifyAttempt(); + void NotifySavePoint(bool atSavePoint); + void NotifyModified(DocModification mh); +}; + +class UndoGroup { + Document *pdoc; + bool groupNeeded; +public: + UndoGroup(Document *pdoc_, bool groupNeeded_=true) : + pdoc(pdoc_), groupNeeded(groupNeeded_) { + if (groupNeeded) { + pdoc->BeginUndoAction(); + } + } + ~UndoGroup() { + if (groupNeeded) { + pdoc->EndUndoAction(); + } + } + bool Needed() const { + return groupNeeded; + } +}; + + +/** + * To optimise processing of document modifications by DocWatchers, a hint is passed indicating the + * scope of the change. + * If the DocWatcher is a document view then this can be used to optimise screen updating. + */ +class DocModification { +public: + int modificationType; + int position; + int length; + int linesAdded; /**< Negative if lines deleted. */ + const char *text; /**< Only valid for changes to text, not for changes to style. */ + int line; + int foldLevelNow; + int foldLevelPrev; + int annotationLinesAdded; + int token; + + DocModification(int modificationType_, int position_=0, int length_=0, + int linesAdded_=0, const char *text_=0, int line_=0) : + modificationType(modificationType_), + position(position_), + length(length_), + linesAdded(linesAdded_), + text(text_), + line(line_), + foldLevelNow(0), + foldLevelPrev(0), + annotationLinesAdded(0), + token(0) {} + + DocModification(int modificationType_, const Action &act, int linesAdded_=0) : + modificationType(modificationType_), + position(act.position), + length(act.lenData), + linesAdded(linesAdded_), + text(act.data), + line(0), + foldLevelNow(0), + foldLevelPrev(0), + annotationLinesAdded(0), + token(0) {} +}; + +/** + * A class that wants to receive notifications from a Document must be derived from DocWatcher + * and implement the notification methods. It can then be added to the watcher list with AddWatcher. + */ +class DocWatcher { +public: + virtual ~DocWatcher() {} + + virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0; + virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; + virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; + virtual void NotifyDeleted(Document *doc, void *userData) = 0; + virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; + virtual void NotifyLexerChanged(Document *doc, void *userData) = 0; + virtual void NotifyErrorOccurred(Document *doc, void *userData, int status) = 0; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/EditModel.cpp b/libs/qscintilla/src/EditModel.cpp new file mode 100644 index 000000000..b50ade258 --- /dev/null +++ b/libs/qscintilla/src/EditModel.cpp @@ -0,0 +1,77 @@ +// Scintilla source code edit control +/** @file EditModel.cxx + ** Defines the editor state that must be visible to EditorView. + **/ +// Copyright 1998-2014 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 +#include +#include + +#include "Platform.h" + +#include "ILexer.h" +#include "Scintilla.h" + +#include "StringCopy.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" +#include "CellBuffer.h" +#include "KeyMap.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "UniConversion.h" +#include "Selection.h" +#include "PositionCache.h" +#include "EditModel.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +Caret::Caret() : + active(false), on(false), period(500) {} + +EditModel::EditModel() { + inOverstrike = false; + xOffset = 0; + trackLineWidth = false; + posDrag = SelectionPosition(invalidPosition); + braces[0] = invalidPosition; + braces[1] = invalidPosition; + bracesMatchStyle = STYLE_BRACEBAD; + highlightGuideColumn = 0; + primarySelection = true; + imeInteraction = imeWindowed; + foldFlags = 0; + hotspot = Range(invalidPosition); + hoverIndicatorPos = invalidPosition; + wrapWidth = LineLayout::wrapWidthInfinite; + pdoc = new Document(); + pdoc->AddRef(); +} + +EditModel::~EditModel() { + pdoc->Release(); + pdoc = 0; +} diff --git a/libs/qscintilla/src/EditModel.h b/libs/qscintilla/src/EditModel.h new file mode 100644 index 000000000..fce26bd22 --- /dev/null +++ b/libs/qscintilla/src/EditModel.h @@ -0,0 +1,70 @@ +// Scintilla source code edit control +/** @file EditModel.h + ** Defines the editor state that must be visible to EditorView. + **/ +// Copyright 1998-2014 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef EDITMODEL_H +#define EDITMODEL_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** +*/ +class Caret { +public: + bool active; + bool on; + int period; + + Caret(); +}; + +class EditModel { + // Private so EditModel objects can not be copied + EditModel(const EditModel &); + EditModel &operator=(const EditModel &); + +public: + bool inOverstrike; + int xOffset; ///< Horizontal scrolled amount in pixels + bool trackLineWidth; + + SpecialRepresentations reprs; + Caret caret; + SelectionPosition posDrag; + Position braces[2]; + int bracesMatchStyle; + int highlightGuideColumn; + Selection sel; + bool primarySelection; + + enum IMEInteraction { imeWindowed, imeInline } imeInteraction; + + int foldFlags; + ContractionState cs; + // Hotspot support + Range hotspot; + int hoverIndicatorPos; + + // Wrapping support + int wrapWidth; + + Document *pdoc; + + EditModel(); + virtual ~EditModel(); + virtual int TopLineOfMain() const = 0; + virtual Point GetVisibleOriginInMain() const = 0; + virtual int LinesOnScreen() const = 0; + virtual Range GetHotSpotRange() const = 0; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/EditView.cpp b/libs/qscintilla/src/EditView.cpp new file mode 100644 index 000000000..9d940f701 --- /dev/null +++ b/libs/qscintilla/src/EditView.cpp @@ -0,0 +1,2116 @@ +// Scintilla source code edit control +/** @file Editor.cxx + ** Defines the appearance of the main text area of the editor window. + **/ +// Copyright 1998-2014 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 +#include +#include + +#include "Platform.h" + +#include "ILexer.h" +#include "Scintilla.h" + +#include "StringCopy.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" +#include "CellBuffer.h" +#include "PerLine.h" +#include "KeyMap.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "UniConversion.h" +#include "Selection.h" +#include "PositionCache.h" +#include "EditModel.h" +#include "MarginView.h" +#include "EditView.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsControlCharacter(int ch) { + // iscntrl returns true for lots of chars > 127 which are displayable + return ch >= 0 && ch < ' '; +} + +PrintParameters::PrintParameters() { + magnification = 0; + colourMode = SC_PRINT_NORMAL; + wrapState = eWrapWord; +} + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st) { + if (st.multipleStyles) { + for (size_t iStyle = 0; iStyle(styles[endSegment + 1]) == style)) + endSegment++; + FontAlias fontText = vs.styles[style + styleOffset].font; + width += static_cast(surface->WidthText(fontText, text + start, + static_cast(endSegment - start + 1))); + start = endSegment + 1; + } + return width; +} + +int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st) { + int widthMax = 0; + size_t start = 0; + while (start < st.length) { + size_t lenLine = st.LineLength(start); + int widthSubLine; + if (st.multipleStyles) { + widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine); + } else { + FontAlias fontText = vs.styles[styleOffset + st.style].font; + widthSubLine = static_cast(surface->WidthText(fontText, + st.text + start, static_cast(lenLine))); + } + if (widthSubLine > widthMax) + widthMax = widthSubLine; + start += lenLine + 1; + } + return widthMax; +} + +void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XYPOSITION ybase, + const char *s, int len, DrawPhase phase) { + FontAlias fontText = style.font; + if (phase & drawBack) { + if (phase & drawText) { + // Drawing both + surface->DrawTextNoClip(rc, fontText, ybase, s, len, + style.fore, style.back); + } else { + surface->FillRectangle(rc, style.back); + } + } else if (phase & drawText) { + surface->DrawTextTransparent(rc, fontText, ybase, s, len, style.fore); + } +} + +void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText, + const StyledText &st, size_t start, size_t length, DrawPhase phase) { + + if (st.multipleStyles) { + int x = static_cast(rcText.left); + size_t i = 0; + while (i < length) { + size_t end = i; + size_t style = st.styles[i + start]; + while (end < length - 1 && st.styles[start + end + 1] == style) + end++; + style += styleOffset; + FontAlias fontText = vs.styles[style].font; + const int width = static_cast(surface->WidthText(fontText, + st.text + start + i, static_cast(end - i + 1))); + PRectangle rcSegment = rcText; + rcSegment.left = static_cast(x); + rcSegment.right = static_cast(x + width + 1); + DrawTextNoClipPhase(surface, rcSegment, vs.styles[style], + rcText.top + vs.maxAscent, st.text + start + i, + static_cast(end - i + 1), phase); + x += width; + i = end + 1; + } + } else { + const size_t style = st.style + styleOffset; + DrawTextNoClipPhase(surface, rcText, vs.styles[style], + rcText.top + vs.maxAscent, st.text + start, + static_cast(length), phase); + } +} + +#ifdef SCI_NAMESPACE +} +#endif + +const XYPOSITION epsilon = 0.0001f; // A small nudge to avoid floating point precision issues + +EditView::EditView() { + ldTabstops = NULL; + hideSelection = false; + drawOverstrikeCaret = true; + bufferedDraw = true; + phasesDraw = phasesTwo; + lineWidthMaxSeen = 0; + additionalCaretsBlink = true; + additionalCaretsVisible = true; + imeCaretBlockOverride = false; + pixmapLine = 0; + pixmapIndentGuide = 0; + pixmapIndentGuideHighlight = 0; + llc.SetLevel(LineLayoutCache::llcCaret); + posCache.SetSize(0x400); + tabArrowHeight = 4; + customDrawTabArrow = NULL; + customDrawWrapMarker = NULL; +} + +EditView::~EditView() { + delete ldTabstops; + ldTabstops = NULL; +} + +bool EditView::SetTwoPhaseDraw(bool twoPhaseDraw) { + const PhasesDraw phasesDrawNew = twoPhaseDraw ? phasesTwo : phasesOne; + const bool redraw = phasesDraw != phasesDrawNew; + phasesDraw = phasesDrawNew; + return redraw; +} + +bool EditView::SetPhasesDraw(int phases) { + const PhasesDraw phasesDrawNew = static_cast(phases); + const bool redraw = phasesDraw != phasesDrawNew; + phasesDraw = phasesDrawNew; + return redraw; +} + +bool EditView::LinesOverlap() const { + return phasesDraw == phasesMultiple; +} + +void EditView::ClearAllTabstops() { + delete ldTabstops; + ldTabstops = 0; +} + +XYPOSITION EditView::NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const { + int next = GetNextTabstop(line, static_cast(x + 2)); + if (next > 0) + return static_cast(next); + return (static_cast((x + 2) / tabWidth) + 1) * tabWidth; +} + +bool EditView::ClearTabstops(int line) { + LineTabstops *lt = static_cast(ldTabstops); + return lt && lt->ClearTabstops(line); +} + +bool EditView::AddTabstop(int line, int x) { + if (!ldTabstops) { + ldTabstops = new LineTabstops(); + } + LineTabstops *lt = static_cast(ldTabstops); + return lt && lt->AddTabstop(line, x); +} + +int EditView::GetNextTabstop(int line, int x) const { + LineTabstops *lt = static_cast(ldTabstops); + if (lt) { + return lt->GetNextTabstop(line, x); + } else { + return 0; + } +} + +void EditView::LinesAddedOrRemoved(int lineOfPos, int linesAdded) { + if (ldTabstops) { + if (linesAdded > 0) { + for (int line = lineOfPos; line < lineOfPos + linesAdded; line++) { + ldTabstops->InsertLine(line); + } + } else { + for (int line = (lineOfPos + -linesAdded) - 1; line >= lineOfPos; line--) { + ldTabstops->RemoveLine(line); + } + } + } +} + +void EditView::DropGraphics(bool freeObjects) { + if (freeObjects) { + delete pixmapLine; + pixmapLine = 0; + delete pixmapIndentGuide; + pixmapIndentGuide = 0; + delete pixmapIndentGuideHighlight; + pixmapIndentGuideHighlight = 0; + } else { + if (pixmapLine) + pixmapLine->Release(); + if (pixmapIndentGuide) + pixmapIndentGuide->Release(); + if (pixmapIndentGuideHighlight) + pixmapIndentGuideHighlight->Release(); + } +} + +void EditView::AllocateGraphics(const ViewStyle &vsDraw) { + if (!pixmapLine) + pixmapLine = Surface::Allocate(vsDraw.technology); + if (!pixmapIndentGuide) + pixmapIndentGuide = Surface::Allocate(vsDraw.technology); + if (!pixmapIndentGuideHighlight) + pixmapIndentGuideHighlight = Surface::Allocate(vsDraw.technology); +} + +const char *ControlCharacterString(unsigned char ch) { + const char *reps[] = { + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", + "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", + "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" + }; + if (ch < ELEMENTS(reps)) { + return reps[ch]; + } else { + return "BAD"; + } +} + +void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) { + int ydiff = static_cast(rcTab.bottom - rcTab.top) / 2; + int xhead = static_cast(rcTab.right) - 1 - ydiff; + if (xhead <= rcTab.left) { + ydiff -= static_cast(rcTab.left) - xhead - 1; + xhead = static_cast(rcTab.left) - 1; + } + if ((rcTab.left + 2) < (rcTab.right - 1)) + surface->MoveTo(static_cast(rcTab.left) + 2, ymid); + else + surface->MoveTo(static_cast(rcTab.right) - 1, ymid); + surface->LineTo(static_cast(rcTab.right) - 1, ymid); + surface->LineTo(xhead, ymid - ydiff); + surface->MoveTo(static_cast(rcTab.right) - 1, ymid); + surface->LineTo(xhead, ymid + ydiff); +} + +void EditView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) { + if (!pixmapIndentGuide->Initialised()) { + // 1 extra pixel in height so can handle odd/even positions and so produce a continuous line + pixmapIndentGuide->InitPixMap(1, vsDraw.lineHeight + 1, surfaceWindow, wid); + pixmapIndentGuideHighlight->InitPixMap(1, vsDraw.lineHeight + 1, surfaceWindow, wid); + PRectangle rcIG = PRectangle::FromInts(0, 0, 1, vsDraw.lineHeight); + pixmapIndentGuide->FillRectangle(rcIG, vsDraw.styles[STYLE_INDENTGUIDE].back); + pixmapIndentGuide->PenColour(vsDraw.styles[STYLE_INDENTGUIDE].fore); + pixmapIndentGuideHighlight->FillRectangle(rcIG, vsDraw.styles[STYLE_BRACELIGHT].back); + pixmapIndentGuideHighlight->PenColour(vsDraw.styles[STYLE_BRACELIGHT].fore); + for (int stripe = 1; stripe < vsDraw.lineHeight + 1; stripe += 2) { + PRectangle rcPixel = PRectangle::FromInts(0, stripe, 1, stripe + 1); + pixmapIndentGuide->FillRectangle(rcPixel, vsDraw.styles[STYLE_INDENTGUIDE].fore); + pixmapIndentGuideHighlight->FillRectangle(rcPixel, vsDraw.styles[STYLE_BRACELIGHT].fore); + } + } +} + +LineLayout *EditView::RetrieveLineLayout(int lineNumber, const EditModel &model) { + int posLineStart = model.pdoc->LineStart(lineNumber); + int posLineEnd = model.pdoc->LineStart(lineNumber + 1); + PLATFORM_ASSERT(posLineEnd >= posLineStart); + int lineCaret = model.pdoc->LineFromPosition(model.sel.MainCaret()); + return llc.Retrieve(lineNumber, lineCaret, + posLineEnd - posLineStart, model.pdoc->GetStyleClock(), + model.LinesOnScreen() + 1, model.pdoc->LinesTotal()); +} + +/** +* Fill in the LineLayout data for the given line. +* Copy the given @a line and its styles from the document into local arrays. +* Also determine the x position at which each character starts. +*/ +void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, const ViewStyle &vstyle, LineLayout *ll, int width) { + if (!ll) + return; + + PLATFORM_ASSERT(line < model.pdoc->LinesTotal()); + PLATFORM_ASSERT(ll->chars != NULL); + int posLineStart = model.pdoc->LineStart(line); + int posLineEnd = model.pdoc->LineStart(line + 1); + // If the line is very long, limit the treatment to a length that should fit in the viewport + if (posLineEnd >(posLineStart + ll->maxLineLength)) { + posLineEnd = posLineStart + ll->maxLineLength; + } + if (ll->validity == LineLayout::llCheckTextAndStyle) { + int lineLength = posLineEnd - posLineStart; + if (!vstyle.viewEOL) { + lineLength = model.pdoc->LineEnd(line) - posLineStart; + } + if (lineLength == ll->numCharsInLine) { + // See if chars, styles, indicators, are all the same + bool allSame = true; + // Check base line layout + char styleByte = 0; + int numCharsInLine = 0; + while (numCharsInLine < lineLength) { + int charInDoc = numCharsInLine + posLineStart; + char chDoc = model.pdoc->CharAt(charInDoc); + styleByte = model.pdoc->StyleAt(charInDoc); + allSame = allSame && + (ll->styles[numCharsInLine] == static_cast(styleByte)); + if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed) + allSame = allSame && + (ll->chars[numCharsInLine] == chDoc); + else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) + allSame = allSame && + (ll->chars[numCharsInLine] == static_cast(tolower(chDoc))); + else // Style::caseUpper + allSame = allSame && + (ll->chars[numCharsInLine] == static_cast(toupper(chDoc))); + numCharsInLine++; + } + allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled + if (allSame) { + ll->validity = LineLayout::llPositions; + } else { + ll->validity = LineLayout::llInvalid; + } + } else { + ll->validity = LineLayout::llInvalid; + } + } + if (ll->validity == LineLayout::llInvalid) { + ll->widthLine = LineLayout::wrapWidthInfinite; + ll->lines = 1; + if (vstyle.edgeState == EDGE_BACKGROUND) { + ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge); + if (ll->edgeColumn >= posLineStart) { + ll->edgeColumn -= posLineStart; + } + } else { + ll->edgeColumn = -1; + } + + // Fill base line layout + const int lineLength = posLineEnd - posLineStart; + model.pdoc->GetCharRange(ll->chars, posLineStart, lineLength); + model.pdoc->GetStyleRange(ll->styles, posLineStart, lineLength); + int numCharsBeforeEOL = model.pdoc->LineEnd(line) - posLineStart; + const int numCharsInLine = (vstyle.viewEOL) ? lineLength : numCharsBeforeEOL; + for (int styleInLine = 0; styleInLine < numCharsInLine; styleInLine++) { + const unsigned char styleByte = ll->styles[styleInLine]; + ll->styles[styleInLine] = styleByte; + } + const unsigned char styleByteLast = (lineLength > 0) ? ll->styles[lineLength - 1] : 0; + if (vstyle.someStylesForceCase) { + for (int charInLine = 0; charInLinechars[charInLine]; + if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseUpper) + ll->chars[charInLine] = static_cast(toupper(chDoc)); + else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower) + ll->chars[charInLine] = static_cast(tolower(chDoc)); + } + } + ll->xHighlightGuide = 0; + // Extra element at the end of the line to hold end x position and act as + ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character + ll->styles[numCharsInLine] = styleByteLast; // For eolFilled + + // Layout the line, determining the position of each character, + // with an extra element at the end for the end of the line. + ll->positions[0] = 0; + bool lastSegItalics = false; + + BreakFinder bfLayout(ll, NULL, Range(0, numCharsInLine), posLineStart, 0, false, model.pdoc, &model.reprs, NULL); + while (bfLayout.More()) { + + const TextSegment ts = bfLayout.Next(); + + std::fill(&ll->positions[ts.start + 1], &ll->positions[ts.end() + 1], 0.0f); + if (vstyle.styles[ll->styles[ts.start]].visible) { + if (ts.representation) { + XYPOSITION representationWidth = vstyle.controlCharWidth; + if (ll->chars[ts.start] == '\t') { + // Tab is a special case of representation, taking a variable amount of space + const XYPOSITION x = ll->positions[ts.start]; + representationWidth = NextTabstopPos(line, x, vstyle.tabWidth) - ll->positions[ts.start]; + } else { + if (representationWidth <= 0.0) { + XYPOSITION positionsRepr[256]; // Should expand when needed + posCache.MeasureWidths(surface, vstyle, STYLE_CONTROLCHAR, ts.representation->stringRep.c_str(), + static_cast(ts.representation->stringRep.length()), positionsRepr, model.pdoc); + representationWidth = positionsRepr[ts.representation->stringRep.length() - 1] + vstyle.ctrlCharPadding; + } + } + for (int ii = 0; ii < ts.length; ii++) + ll->positions[ts.start + 1 + ii] = representationWidth; + } else { + if ((ts.length == 1) && (' ' == ll->chars[ts.start])) { + // Over half the segments are single characters and of these about half are space characters. + ll->positions[ts.start + 1] = vstyle.styles[ll->styles[ts.start]].spaceWidth; + } else { + posCache.MeasureWidths(surface, vstyle, ll->styles[ts.start], ll->chars + ts.start, + ts.length, ll->positions + ts.start + 1, model.pdoc); + } + } + lastSegItalics = (!ts.representation) && ((ll->chars[ts.end() - 1] != ' ') && vstyle.styles[ll->styles[ts.start]].italic); + } + + for (int posToIncrease = ts.start + 1; posToIncrease <= ts.end(); posToIncrease++) { + ll->positions[posToIncrease] += ll->positions[ts.start]; + } + } + + // Small hack to make lines that end with italics not cut off the edge of the last character + if (lastSegItalics) { + ll->positions[numCharsInLine] += vstyle.lastSegItalicsOffset; + } + ll->numCharsInLine = numCharsInLine; + ll->numCharsBeforeEOL = numCharsBeforeEOL; + ll->validity = LineLayout::llPositions; + } + // Hard to cope when too narrow, so just assume there is space + if (width < 20) { + width = 20; + } + if ((ll->validity == LineLayout::llPositions) || (ll->widthLine != width)) { + ll->widthLine = width; + if (width == LineLayout::wrapWidthInfinite) { + ll->lines = 1; + } else if (width > ll->positions[ll->numCharsInLine]) { + // Simple common case where line does not need wrapping. + ll->lines = 1; + } else { + if (vstyle.wrapVisualFlags & SC_WRAPVISUALFLAG_END) { + width -= static_cast(vstyle.aveCharWidth); // take into account the space for end wrap mark + } + XYPOSITION wrapAddIndent = 0; // This will be added to initial indent of line + if (vstyle.wrapIndentMode == SC_WRAPINDENT_INDENT) { + wrapAddIndent = model.pdoc->IndentSize() * vstyle.spaceWidth; + } else if (vstyle.wrapIndentMode == SC_WRAPINDENT_FIXED) { + wrapAddIndent = vstyle.wrapVisualStartIndent * vstyle.aveCharWidth; + } + ll->wrapIndent = wrapAddIndent; + if (vstyle.wrapIndentMode != SC_WRAPINDENT_FIXED) + for (int i = 0; i < ll->numCharsInLine; i++) { + if (!IsSpaceOrTab(ll->chars[i])) { + ll->wrapIndent += ll->positions[i]; // Add line indent + break; + } + } + // Check for text width minimum + if (ll->wrapIndent > width - static_cast(vstyle.aveCharWidth) * 15) + ll->wrapIndent = wrapAddIndent; + // Check for wrapIndent minimum + if ((vstyle.wrapVisualFlags & SC_WRAPVISUALFLAG_START) && (ll->wrapIndent < vstyle.aveCharWidth)) + ll->wrapIndent = vstyle.aveCharWidth; // Indent to show start visual + ll->lines = 0; + // Calculate line start positions based upon width. + int lastGoodBreak = 0; + int lastLineStart = 0; + XYACCUMULATOR startOffset = 0; + int p = 0; + while (p < ll->numCharsInLine) { + if ((ll->positions[p + 1] - startOffset) >= width) { + if (lastGoodBreak == lastLineStart) { + // Try moving to start of last character + if (p > 0) { + lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) + - posLineStart; + } + if (lastGoodBreak == lastLineStart) { + // Ensure at least one character on line. + lastGoodBreak = model.pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) + - posLineStart; + } + } + lastLineStart = lastGoodBreak; + ll->lines++; + ll->SetLineStart(ll->lines, lastGoodBreak); + startOffset = ll->positions[lastGoodBreak]; + // take into account the space for start wrap mark and indent + startOffset -= ll->wrapIndent; + p = lastGoodBreak + 1; + continue; + } + if (p > 0) { + if (vstyle.wrapState == eWrapChar) { + lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1) + - posLineStart; + p = model.pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; + continue; + } else if ((vstyle.wrapState == eWrapWord) && (ll->styles[p] != ll->styles[p - 1])) { + lastGoodBreak = p; + } else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) { + lastGoodBreak = p; + } + } + p++; + } + ll->lines++; + } + ll->validity = LineLayout::llLines; + } +} + +Point EditView::LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, const ViewStyle &vs) { + Point pt; + if (pos.Position() == INVALID_POSITION) + return pt; + const int line = model.pdoc->LineFromPosition(pos.Position()); + const int lineVisible = model.cs.DisplayFromDoc(line); + //Platform::DebugPrintf("line=%d\n", line); + AutoLineLayout ll(llc, RetrieveLineLayout(line, model)); + if (surface && ll) { + const int posLineStart = model.pdoc->LineStart(line); + LayoutLine(model, line, surface, vs, ll, model.wrapWidth); + const int posInLine = pos.Position() - posLineStart; + pt = ll->PointFromPosition(posInLine, vs.lineHeight); + pt.y += (lineVisible - topLine) * vs.lineHeight; + pt.x += vs.textStart - model.xOffset; + } + pt.x += pos.VirtualSpace() * vs.styles[ll->EndLineStyle()].spaceWidth; + return pt; +} + +SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, Point pt, bool canReturnInvalid, bool charPosition, bool virtualSpace, const ViewStyle &vs) { + pt.x = pt.x - vs.textStart; + int visibleLine = static_cast(floor(pt.y / vs.lineHeight)); + if (!canReturnInvalid && (visibleLine < 0)) + visibleLine = 0; + const int lineDoc = model.cs.DocFromDisplay(visibleLine); + if (canReturnInvalid && (lineDoc < 0)) + return SelectionPosition(INVALID_POSITION); + if (lineDoc >= model.pdoc->LinesTotal()) + return SelectionPosition(canReturnInvalid ? INVALID_POSITION : model.pdoc->Length()); + const int posLineStart = model.pdoc->LineStart(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); + const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); + const int subLine = visibleLine - lineStartSet; + if (subLine < ll->lines) { + const Range rangeSubLine = ll->SubLineRange(subLine); + const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; + if (subLine > 0) // Wrapped + pt.x -= ll->wrapIndent; + const int positionInLine = ll->FindPositionFromX(pt.x + subLineStart, rangeSubLine, charPosition); + if (positionInLine < rangeSubLine.end) { + return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); + } + if (virtualSpace) { + const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth; + const int spaceOffset = static_cast( + (pt.x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth); + return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset); + } else if (canReturnInvalid) { + if (pt.x < (ll->positions[rangeSubLine.end] - subLineStart)) { + return SelectionPosition(model.pdoc->MovePositionOutsideChar(rangeSubLine.end + posLineStart, 1)); + } + } else { + return SelectionPosition(rangeSubLine.end + posLineStart); + } + } + if (!canReturnInvalid) + return SelectionPosition(ll->numCharsInLine + posLineStart); + } + return SelectionPosition(canReturnInvalid ? INVALID_POSITION : posLineStart); +} + +/** +* Find the document position corresponding to an x coordinate on a particular document line. +* Ensure is between whole characters when document is in multi-byte or UTF-8 mode. +* This method is used for rectangular selections and does not work on wrapped lines. +*/ +SelectionPosition EditView::SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs) { + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + const int posLineStart = model.pdoc->LineStart(lineDoc); + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); + const Range rangeSubLine = ll->SubLineRange(0); + const XYPOSITION subLineStart = ll->positions[rangeSubLine.start]; + const int positionInLine = ll->FindPositionFromX(x + subLineStart, rangeSubLine, false); + if (positionInLine < rangeSubLine.end) { + return SelectionPosition(model.pdoc->MovePositionOutsideChar(positionInLine + posLineStart, 1)); + } + const XYPOSITION spaceWidth = vs.styles[ll->EndLineStyle()].spaceWidth; + const int spaceOffset = static_cast( + (x + subLineStart - ll->positions[rangeSubLine.end] + spaceWidth / 2) / spaceWidth); + return SelectionPosition(rangeSubLine.end + posLineStart, spaceOffset); + } + return SelectionPosition(0); +} + +int EditView::DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs) { + int lineDoc = model.pdoc->LineFromPosition(pos); + int lineDisplay = model.cs.DisplayFromDoc(lineDoc); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); + if (surface && ll) { + LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); + unsigned int posLineStart = model.pdoc->LineStart(lineDoc); + int posInLine = pos - posLineStart; + lineDisplay--; // To make up for first increment ahead. + for (int subLine = 0; subLine < ll->lines; subLine++) { + if (posInLine >= ll->LineStart(subLine)) { + lineDisplay++; + } + } + } + return lineDisplay; +} + +int EditView::StartEndDisplayLine(Surface *surface, const EditModel &model, int pos, bool start, const ViewStyle &vs) { + int line = model.pdoc->LineFromPosition(pos); + AutoLineLayout ll(llc, RetrieveLineLayout(line, model)); + int posRet = INVALID_POSITION; + if (surface && ll) { + unsigned int posLineStart = model.pdoc->LineStart(line); + LayoutLine(model, line, surface, vs, ll, model.wrapWidth); + int posInLine = pos - posLineStart; + if (posInLine <= ll->maxLineLength) { + for (int subLine = 0; subLine < ll->lines; subLine++) { + if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine + 1))) { + if (start) { + posRet = ll->LineStart(subLine) + posLineStart; + } else { + if (subLine == ll->lines - 1) + posRet = ll->LineStart(subLine + 1) + posLineStart; + else + posRet = ll->LineStart(subLine + 1) + posLineStart - 1; + } + } + } + } + } + return posRet; +} + +static ColourDesired SelectionBackground(const ViewStyle &vsDraw, bool main, bool primarySelection) { + return main ? + (primarySelection ? vsDraw.selColours.back : vsDraw.selBackground2) : + vsDraw.selAdditionalBackground; +} + +static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + ColourOptional background, int inSelection, bool inHotspot, int styleMain, int i) { + if (inSelection == 1) { + if (vsDraw.selColours.back.isSet && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { + return SelectionBackground(vsDraw, true, model.primarySelection); + } + } else if (inSelection == 2) { + if (vsDraw.selColours.back.isSet && (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA)) { + return SelectionBackground(vsDraw, false, model.primarySelection); + } + } else { + if ((vsDraw.edgeState == EDGE_BACKGROUND) && + (i >= ll->edgeColumn) && + (i < ll->numCharsBeforeEOL)) + return vsDraw.edgecolour; + if (inHotspot && vsDraw.hotspotColours.back.isSet) + return vsDraw.hotspotColours.back; + } + if (background.isSet && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) { + return background; + } else { + return vsDraw.styles[styleMain].back; + } +} + +void EditView::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) { + Point from = Point::FromInts(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); + PRectangle rcCopyArea = PRectangle::FromInts(start + 1, static_cast(rcSegment.top), start + 2, static_cast(rcSegment.bottom)); + surface->Copy(rcCopyArea, from, + highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); +} + +static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourDesired fill, int alpha) { + if (alpha != SC_ALPHA_NOALPHA) { + surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0); + } +} + +static void DrawTextBlob(Surface *surface, const ViewStyle &vsDraw, PRectangle rcSegment, + const char *s, ColourDesired textBack, ColourDesired textFore, bool fillBackground) { + if (fillBackground) { + surface->FillRectangle(rcSegment, textBack); + } + FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; + int normalCharHeight = static_cast(surface->Ascent(ctrlCharsFont) - + surface->InternalLeading(ctrlCharsFont)); + PRectangle rcCChar = rcSegment; + rcCChar.left = rcCChar.left + 1; + rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; + rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; + PRectangle rcCentral = rcCChar; + rcCentral.top++; + rcCentral.bottom--; + surface->FillRectangle(rcCentral, textFore); + PRectangle rcChar = rcCChar; + rcChar.left++; + rcChar.right--; + surface->DrawTextClipped(rcChar, ctrlCharsFont, + rcSegment.top + vsDraw.maxAscent, s, static_cast(s ? strlen(s) : 0), + textBack, textFore); +} + +void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + PRectangle rcLine, int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, + ColourOptional background) { + + const int posLineStart = model.pdoc->LineStart(line); + PRectangle rcSegment = rcLine; + + const bool lastSubLine = subLine == (ll->lines - 1); + XYPOSITION virtualSpace = 0; + if (lastSubLine) { + const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; + virtualSpace = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)) * spaceWidth; + } + XYPOSITION xEol = static_cast(ll->positions[lineEnd] - subLineStart); + + // Fill the virtual space and show selections within it + if (virtualSpace > 0.0f) { + rcSegment.left = xEol + xStart; + rcSegment.right = xEol + xStart + virtualSpace; + surface->FillRectangle(rcSegment, background.isSet ? background : vsDraw.styles[ll->styles[ll->numCharsInLine]].back); + if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) { + SelectionSegment virtualSpaceRange(SelectionPosition(model.pdoc->LineEnd(line)), SelectionPosition(model.pdoc->LineEnd(line), model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)))); + for (size_t r = 0; rEndLineStyle()].spaceWidth; + rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - + static_cast(subLineStart)+portion.start.VirtualSpace() * spaceWidth; + rcSegment.right = xStart + ll->positions[portion.end.Position() - posLineStart] - + static_cast(subLineStart)+portion.end.VirtualSpace() * spaceWidth; + rcSegment.left = (rcSegment.left > rcLine.left) ? rcSegment.left : rcLine.left; + rcSegment.right = (rcSegment.right < rcLine.right) ? rcSegment.right : rcLine.right; + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, r == model.sel.Main(), model.primarySelection)); + } + } + } + } + } + + int eolInSelection = 0; + int alpha = SC_ALPHA_NOALPHA; + if (!hideSelection) { + int posAfterLineEnd = model.pdoc->LineStart(line + 1); + eolInSelection = (subLine == (ll->lines - 1)) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0; + alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + } + + // Draw the [CR], [LF], or [CR][LF] blobs if visible line ends are on + XYPOSITION blobsWidth = 0; + if (lastSubLine) { + for (int eolPos = ll->numCharsBeforeEOL; eolPosnumCharsInLine; eolPos++) { + rcSegment.left = xStart + ll->positions[eolPos] - static_cast(subLineStart)+virtualSpace; + rcSegment.right = xStart + ll->positions[eolPos + 1] - static_cast(subLineStart)+virtualSpace; + blobsWidth += rcSegment.Width(); + char hexits[4]; + const char *ctrlChar; + unsigned char chEOL = ll->chars[eolPos]; + int styleMain = ll->styles[eolPos]; + ColourDesired textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, false, styleMain, eolPos); + if (UTF8IsAscii(chEOL)) { + ctrlChar = ControlCharacterString(chEOL); + } else { + const Representation *repr = model.reprs.RepresentationFromCharacter(ll->chars + eolPos, ll->numCharsInLine - eolPos); + if (repr) { + ctrlChar = repr->stringRep.c_str(); + eolPos = ll->numCharsInLine; + } else { + sprintf(hexits, "x%2X", chEOL); + ctrlChar = hexits; + } + } + ColourDesired textFore = vsDraw.styles[styleMain].fore; + if (eolInSelection && vsDraw.selColours.fore.isSet) { + textFore = (eolInSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground; + } + if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1)) { + if (alpha == SC_ALPHA_NOALPHA) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); + } else { + surface->FillRectangle(rcSegment, textBack); + } + } else { + surface->FillRectangle(rcSegment, textBack); + } + DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, phasesDraw == phasesOne); + if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); + } + } + } + + // Draw the eol-is-selected rectangle + rcSegment.left = xEol + xStart + virtualSpace + blobsWidth; + rcSegment.right = rcSegment.left + vsDraw.aveCharWidth; + + if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); + } else { + if (background.isSet) { + surface->FillRectangle(rcSegment, background); + } else if (line < model.pdoc->LinesTotal() - 1) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); + } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); + } else { + surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back); + } + if (eolInSelection && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); + } + } + + // Fill the remainder of the line + rcSegment.left = rcSegment.right; + if (rcSegment.left < rcLine.left) + rcSegment.left = rcLine.left; + rcSegment.right = rcLine.right; + + if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); + } else { + if (background.isSet) { + surface->FillRectangle(rcSegment, background); + } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); + } else { + surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back); + } + if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); + } + } + + bool drawWrapMarkEnd = false; + + if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) { + if (subLine + 1 < ll->lines) { + drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0; + } + } + + if (drawWrapMarkEnd) { + PRectangle rcPlace = rcSegment; + + if (vsDraw.wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_END_BY_TEXT) { + rcPlace.left = xEol + xStart + virtualSpace; + rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; + } else { + // rcLine is clipped to text area + rcPlace.right = rcLine.right; + rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; + } + if (customDrawWrapMarker == NULL) { + DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour()); + } else { + customDrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour()); + } + } +} + +static void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, const ViewStyle &vsDraw, + const LineLayout *ll, int xStart, PRectangle rcLine, int subLine, Indicator::DrawState drawState, int value) { + const XYPOSITION subLineStart = ll->positions[ll->LineStart(subLine)]; + PRectangle rcIndic( + ll->positions[startPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent, + ll->positions[endPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent + 3); + vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, drawState, value); +} + +static void DrawIndicators(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, int xStart, PRectangle rcLine, int subLine, int lineEnd, bool under, int hoverIndicatorPos) { + // Draw decorators + const int posLineStart = model.pdoc->LineStart(line); + const int lineStart = ll->LineStart(subLine); + const int posLineEnd = posLineStart + lineEnd; + + for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) { + if (under == vsDraw.indicators[deco->indicator].under) { + int startPos = posLineStart + lineStart; + if (!deco->rs.ValueAt(startPos)) { + startPos = deco->rs.EndRun(startPos); + } + while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) { + int endPos = deco->rs.EndRun(startPos); + if (endPos > posLineEnd) + endPos = posLineEnd; + const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() && + ((hoverIndicatorPos >= startPos) && (hoverIndicatorPos <= endPos)); + const int value = deco->rs.ValueAt(startPos); + Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal; + DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart, + surface, vsDraw, ll, xStart, rcLine, subLine, drawState, value); + startPos = endPos; + if (!deco->rs.ValueAt(startPos)) { + startPos = deco->rs.EndRun(startPos); + } + } + } + } + + // Use indicators to highlight matching braces + if ((vsDraw.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) || + (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))) { + int braceIndicator = (model.bracesMatchStyle == STYLE_BRACELIGHT) ? vsDraw.braceHighlightIndicator : vsDraw.braceBadLightIndicator; + if (under == vsDraw.indicators[braceIndicator].under) { + Range rangeLine(posLineStart + lineStart, posLineEnd); + if (rangeLine.ContainsCharacter(model.braces[0])) { + int braceOffset = model.braces[0] - posLineStart; + if (braceOffset < ll->numCharsInLine) { + DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal, 1); + } + } + if (rangeLine.ContainsCharacter(model.braces[1])) { + int braceOffset = model.braces[1] - posLineStart; + if (braceOffset < ll->numCharsInLine) { + DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, subLine, Indicator::drawNormal, 1); + } + } + } + } +} + +static bool AnnotationBoxedOrIndented(int annotationVisible) { + return annotationVisible == ANNOTATION_BOXED || annotationVisible == ANNOTATION_INDENTED; +} + +void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { + int indent = static_cast(model.pdoc->GetLineIndentation(line) * vsDraw.spaceWidth); + PRectangle rcSegment = rcLine; + int annotationLine = subLine - ll->lines; + const StyledText stAnnotation = model.pdoc->AnnotationStyledText(line); + if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) { + if (phase & drawBack) { + surface->FillRectangle(rcSegment, vsDraw.styles[0].back); + } + rcSegment.left = static_cast(xStart); + if (model.trackLineWidth || AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { + // Only care about calculating width if tracking or need to draw indented box + int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation); + if (AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { + widthAnnotation += static_cast(vsDraw.spaceWidth * 2); // Margins + rcSegment.left = static_cast(xStart + indent); + rcSegment.right = rcSegment.left + widthAnnotation; + } + if (widthAnnotation > lineWidthMaxSeen) + lineWidthMaxSeen = widthAnnotation; + } + const int annotationLines = model.pdoc->AnnotationLines(line); + size_t start = 0; + size_t lengthAnnotation = stAnnotation.LineLength(start); + int lineInAnnotation = 0; + while ((lineInAnnotation < annotationLine) && (start < stAnnotation.length)) { + start += lengthAnnotation + 1; + lengthAnnotation = stAnnotation.LineLength(start); + lineInAnnotation++; + } + PRectangle rcText = rcSegment; + if ((phase & drawBack) && AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { + surface->FillRectangle(rcText, + vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back); + rcText.left += vsDraw.spaceWidth; + } + DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, + stAnnotation, start, lengthAnnotation, phase); + if ((phase & drawBack) && (vsDraw.annotationVisible == ANNOTATION_BOXED)) { + surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore); + surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.top)); + surface->LineTo(static_cast(rcSegment.left), static_cast(rcSegment.bottom)); + surface->MoveTo(static_cast(rcSegment.right), static_cast(rcSegment.top)); + surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.bottom)); + if (subLine == ll->lines) { + surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.top)); + surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.top)); + } + if (subLine == ll->lines + annotationLines - 1) { + surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.bottom - 1)); + surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.bottom - 1)); + } + } + } +} + +static void DrawBlockCaret(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) { + + int lineStart = ll->LineStart(subLine); + int posBefore = posCaret; + int posAfter = model.pdoc->MovePositionOutsideChar(posCaret + 1, 1); + int numCharsToDraw = posAfter - posCaret; + + // Work out where the starting and ending offsets are. We need to + // see if the previous character shares horizontal space, such as a + // glyph / combining character. If so we'll need to draw that too. + int offsetFirstChar = offset; + int offsetLastChar = offset + (posAfter - posCaret); + while ((posBefore > 0) && ((offsetLastChar - numCharsToDraw) >= lineStart)) { + if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - numCharsToDraw]) > 0) { + // The char does not share horizontal space + break; + } + // Char shares horizontal space, update the numChars to draw + // Update posBefore to point to the prev char + posBefore = model.pdoc->MovePositionOutsideChar(posBefore - 1, -1); + numCharsToDraw = posAfter - posBefore; + offsetFirstChar = offset - (posCaret - posBefore); + } + + // See if the next character shares horizontal space, if so we'll + // need to draw that too. + if (offsetFirstChar < 0) + offsetFirstChar = 0; + numCharsToDraw = offsetLastChar - offsetFirstChar; + while ((offsetLastChar < ll->LineStart(subLine + 1)) && (offsetLastChar <= ll->numCharsInLine)) { + // Update posAfter to point to the 2nd next char, this is where + // the next character ends, and 2nd next begins. We'll need + // to compare these two + posBefore = posAfter; + posAfter = model.pdoc->MovePositionOutsideChar(posAfter + 1, 1); + offsetLastChar = offset + (posAfter - posCaret); + if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - (posAfter - posBefore)]) > 0) { + // The char does not share horizontal space + break; + } + // Char shares horizontal space, update the numChars to draw + numCharsToDraw = offsetLastChar - offsetFirstChar; + } + + // We now know what to draw, update the caret drawing rectangle + rcCaret.left = ll->positions[offsetFirstChar] - ll->positions[lineStart] + xStart; + rcCaret.right = ll->positions[offsetFirstChar + numCharsToDraw] - ll->positions[lineStart] + xStart; + + // Adjust caret position to take into account any word wrapping symbols. + if ((ll->wrapIndent != 0) && (lineStart != 0)) { + XYPOSITION wordWrapCharWidth = ll->wrapIndent; + rcCaret.left += wordWrapCharWidth; + rcCaret.right += wordWrapCharWidth; + } + + // This character is where the caret block is, we override the colours + // (inversed) for drawing the caret here. + int styleMain = ll->styles[offsetFirstChar]; + FontAlias fontText = vsDraw.styles[styleMain].font; + surface->DrawTextClipped(rcCaret, fontText, + rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, + numCharsToDraw, vsDraw.styles[styleMain].back, + caretColour); +} + +void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int lineDoc, int xStart, PRectangle rcLine, int subLine) const { + // When drag is active it is the only caret drawn + bool drawDrag = model.posDrag.IsValid(); + if (hideSelection && !drawDrag) + return; + const int posLineStart = model.pdoc->LineStart(lineDoc); + // For each selection draw + for (size_t r = 0; (rEndLineStyle()].spaceWidth; + const XYPOSITION virtualOffset = posCaret.VirtualSpace() * spaceWidth; + if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { + XYPOSITION xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)]; + if (ll->wrapIndent != 0) { + int lineStart = ll->LineStart(subLine); + if (lineStart != 0) // Wrapped + xposCaret += ll->wrapIndent; + } + bool caretBlinkState = (model.caret.active && model.caret.on) || (!additionalCaretsBlink && !mainCaret); + bool caretVisibleState = additionalCaretsVisible || mainCaret; + if ((xposCaret >= 0) && (vsDraw.caretWidth > 0) && (vsDraw.caretStyle != CARETSTYLE_INVISIBLE) && + ((model.posDrag.IsValid()) || (caretBlinkState && caretVisibleState))) { + bool caretAtEOF = false; + bool caretAtEOL = false; + bool drawBlockCaret = false; + XYPOSITION widthOverstrikeCaret; + XYPOSITION caretWidthOffset = 0; + PRectangle rcCaret = rcLine; + + if (posCaret.Position() == model.pdoc->Length()) { // At end of document + caretAtEOF = true; + widthOverstrikeCaret = vsDraw.aveCharWidth; + } else if ((posCaret.Position() - posLineStart) >= ll->numCharsInLine) { // At end of line + caretAtEOL = true; + widthOverstrikeCaret = vsDraw.aveCharWidth; + } else { + const int widthChar = model.pdoc->LenChar(posCaret.Position()); + widthOverstrikeCaret = ll->positions[offset + widthChar] - ll->positions[offset]; + } + if (widthOverstrikeCaret < 3) // Make sure its visible + widthOverstrikeCaret = 3; + + if (xposCaret > 0) + caretWidthOffset = 0.51f; // Move back so overlaps both character cells. + xposCaret += xStart; + if (model.posDrag.IsValid()) { + /* Dragging text, use a line caret */ + rcCaret.left = static_cast(RoundXYPosition(xposCaret - caretWidthOffset)); + rcCaret.right = rcCaret.left + vsDraw.caretWidth; + } else if (model.inOverstrike && drawOverstrikeCaret) { + /* Overstrike (insert mode), use a modified bar caret */ + rcCaret.top = rcCaret.bottom - 2; + rcCaret.left = xposCaret + 1; + rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; + } else if ((vsDraw.caretStyle == CARETSTYLE_BLOCK) || imeCaretBlockOverride) { + /* Block caret */ + rcCaret.left = xposCaret; + if (!caretAtEOL && !caretAtEOF && (ll->chars[offset] != '\t') && !(IsControlCharacter(ll->chars[offset]))) { + drawBlockCaret = true; + rcCaret.right = xposCaret + widthOverstrikeCaret; + } else { + rcCaret.right = xposCaret + vsDraw.aveCharWidth; + } + } else { + /* Line caret */ + rcCaret.left = static_cast(RoundXYPosition(xposCaret - caretWidthOffset)); + rcCaret.right = rcCaret.left + vsDraw.caretWidth; + } + ColourDesired caretColour = mainCaret ? vsDraw.caretcolour : vsDraw.additionalCaretColour; + if (drawBlockCaret) { + DrawBlockCaret(surface, model, vsDraw, ll, subLine, xStart, offset, posCaret.Position(), rcCaret, caretColour); + } else { + surface->FillRectangle(rcCaret, caretColour); + } + } + } + if (drawDrag) + break; + } +} + +static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, + int xStart, PRectangle rcLine, ColourOptional background, DrawWrapMarkerFn customDrawWrapMarker) { + // default bgnd here.. + surface->FillRectangle(rcLine, background.isSet ? background : + vsDraw.styles[STYLE_DEFAULT].back); + + if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_START) { + + // draw continuation rect + PRectangle rcPlace = rcLine; + + rcPlace.left = static_cast(xStart); + rcPlace.right = rcPlace.left + ll->wrapIndent; + + if (vsDraw.wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_START_BY_TEXT) + rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; + else + rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; + + if (customDrawWrapMarker == NULL) { + DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour()); + } else { + customDrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour()); + } + } +} + +void EditView::DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + PRectangle rcLine, Range lineRange, int posLineStart, int xStart, + int subLine, ColourOptional background) const { + + const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn(); + bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. + const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; + // Does not take margin into account but not significant + const int xStartVisible = static_cast(subLineStart)-xStart; + + BreakFinder bfBack(ll, &model.sel, lineRange, posLineStart, xStartVisible, selBackDrawn, model.pdoc, &model.reprs, NULL); + + const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background.isSet; + + // Background drawing loop + while (bfBack.More()) { + + const TextSegment ts = bfBack.Next(); + const int i = ts.end() - 1; + const int iDoc = i + posLineStart; + + PRectangle rcSegment = rcLine; + rcSegment.left = ll->positions[ts.start] + xStart - static_cast(subLineStart); + rcSegment.right = ll->positions[ts.end()] + xStart - static_cast(subLineStart); + // Only try to draw if really visible - enhances performance by not calling environment to + // draw strings that are completely past the right side of the window. + if (rcSegment.Intersects(rcLine)) { + // Clip to line rectangle, since may have a huge position which will not work with some platforms + if (rcSegment.left < rcLine.left) + rcSegment.left = rcLine.left; + if (rcSegment.right > rcLine.right) + rcSegment.right = rcLine.right; + + const int inSelection = hideSelection ? 0 : model.sel.CharacterInSelection(iDoc); + const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc); + ColourDesired textBack = TextBackground(model, vsDraw, ll, background, inSelection, + inHotspot, ll->styles[i], i); + if (ts.representation) { + if (ll->chars[i] == '\t') { + // Tab display + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + textBack = vsDraw.whitespaceColours.back; + } else { + // Blob display + inIndentation = false; + } + surface->FillRectangle(rcSegment, textBack); + } else { + // Normal text display + surface->FillRectangle(rcSegment, textBack); + if (vsDraw.viewWhitespace != wsInvisible || + (inIndentation && vsDraw.viewIndentationGuides == ivReal)) { + for (int cpos = 0; cpos <= i - ts.start; cpos++) { + if (ll->chars[cpos + ts.start] == ' ') { + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + PRectangle rcSpace( + ll->positions[cpos + ts.start] + xStart - static_cast(subLineStart), + rcSegment.top, + ll->positions[cpos + ts.start + 1] + xStart - static_cast(subLineStart), + rcSegment.bottom); + surface->FillRectangle(rcSpace, vsDraw.whitespaceColours.back); + } + } else { + inIndentation = false; + } + } + } + } + } else if (rcSegment.left > rcLine.right) { + break; + } + } +} + +static void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, + Range lineRange, int xStart) { + if (vsDraw.edgeState == EDGE_LINE) { + PRectangle rcSegment = rcLine; + int edgeX = static_cast(vsDraw.theEdge * vsDraw.spaceWidth); + rcSegment.left = static_cast(edgeX + xStart); + if ((ll->wrapIndent != 0) && (lineRange.start != 0)) + rcSegment.left -= ll->wrapIndent; + rcSegment.right = rcSegment.left + 1; + surface->FillRectangle(rcSegment, vsDraw.edgecolour); + } +} + +// Draw underline mark as part of background if not transparent +static void DrawMarkUnderline(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, + int line, PRectangle rcLine) { + int marks = model.pdoc->GetMark(line); + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE) && + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + PRectangle rcUnderline = rcLine; + rcUnderline.top = rcUnderline.bottom - 2; + surface->FillRectangle(rcUnderline, vsDraw.markers[markBit].back); + } + marks >>= 1; + } +} +static void DrawTranslucentSelection(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, PRectangle rcLine, int subLine, Range lineRange, int xStart) { + if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA)) { + const int posLineStart = model.pdoc->LineStart(line); + const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; + // For each selection draw + int virtualSpaces = 0; + if (subLine == (ll->lines - 1)) { + virtualSpaces = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)); + } + SelectionPosition posStart(posLineStart + lineRange.start); + SelectionPosition posEnd(posLineStart + lineRange.end, virtualSpaces); + SelectionSegment virtualSpaceRange(posStart, posEnd); + for (size_t r = 0; r < model.sel.Count(); r++) { + int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + if (alpha != SC_ALPHA_NOALPHA) { + SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange); + if (!portion.Empty()) { + const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; + PRectangle rcSegment = rcLine; + rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - + static_cast(subLineStart)+portion.start.VirtualSpace() * spaceWidth; + rcSegment.right = xStart + ll->positions[portion.end.Position() - posLineStart] - + static_cast(subLineStart)+portion.end.VirtualSpace() * spaceWidth; + if ((ll->wrapIndent != 0) && (lineRange.start != 0)) { + if ((portion.start.Position() - posLineStart) == lineRange.start && model.sel.Range(r).ContainsCharacter(portion.start.Position() - 1)) + rcSegment.left -= static_cast(ll->wrapIndent); // indentation added to xStart was truncated to int, so we do the same here + } + rcSegment.left = (rcSegment.left > rcLine.left) ? rcSegment.left : rcLine.left; + rcSegment.right = (rcSegment.right < rcLine.right) ? rcSegment.right : rcLine.right; + if (rcSegment.right > rcLine.left) + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, r == model.sel.Main(), model.primarySelection), alpha); + } + } + } + } +} + +// Draw any translucent whole line states +static void DrawTranslucentLineState(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, PRectangle rcLine) { + if ((model.caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && ll->containsCaret) { + SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLineBackground, vsDraw.caretLineAlpha); + } + int marks = model.pdoc->GetMark(line); + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) { + SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); + } else if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE)) { + PRectangle rcUnderline = rcLine; + rcUnderline.top = rcUnderline.bottom - 2; + SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); + } + marks >>= 1; + } + if (vsDraw.maskInLine) { + int marksMasked = model.pdoc->GetMark(line) & vsDraw.maskInLine; + if (marksMasked) { + for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { + if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) { + SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); + } + marksMasked >>= 1; + } + } + } +} + +void EditView::DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int lineVisible, PRectangle rcLine, Range lineRange, int posLineStart, int xStart, + int subLine, ColourOptional background) { + + const bool selBackDrawn = vsDraw.SelectionBackgroundDrawn(); + const bool drawWhitespaceBackground = vsDraw.WhitespaceBackgroundDrawn() && !background.isSet; + bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. + + const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; + const XYPOSITION indentWidth = model.pdoc->IndentSize() * vsDraw.spaceWidth; + + // Does not take margin into account but not significant + const int xStartVisible = static_cast(subLineStart)-xStart; + + // Foreground drawing loop + BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible, + (((phasesDraw == phasesOne) && selBackDrawn) || vsDraw.selColours.fore.isSet), model.pdoc, &model.reprs, &vsDraw); + + while (bfFore.More()) { + + const TextSegment ts = bfFore.Next(); + const int i = ts.end() - 1; + const int iDoc = i + posLineStart; + + PRectangle rcSegment = rcLine; + rcSegment.left = ll->positions[ts.start] + xStart - static_cast(subLineStart); + rcSegment.right = ll->positions[ts.end()] + xStart - static_cast(subLineStart); + // Only try to draw if really visible - enhances performance by not calling environment to + // draw strings that are completely past the right side of the window. + if (rcSegment.Intersects(rcLine)) { + int styleMain = ll->styles[i]; + ColourDesired textFore = vsDraw.styles[styleMain].fore; + FontAlias textFont = vsDraw.styles[styleMain].font; + //hotspot foreground + const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc); + if (inHotspot) { + if (vsDraw.hotspotColours.fore.isSet) + textFore = vsDraw.hotspotColours.fore; + } + if (vsDraw.indicatorsSetFore > 0) { + // At least one indicator sets the text colour so see if it applies to this segment + for (Decoration *deco = model.pdoc->decorations.root; deco; deco = deco->next) { + const int indicatorValue = deco->rs.ValueAt(ts.start + posLineStart); + if (indicatorValue) { + const Indicator &indicator = vsDraw.indicators[deco->indicator]; + const bool hover = indicator.IsDynamic() && + ((model.hoverIndicatorPos >= ts.start + posLineStart) && + (model.hoverIndicatorPos <= ts.end() + posLineStart)); + if (hover) { + if (indicator.sacHover.style == INDIC_TEXTFORE) { + textFore = indicator.sacHover.fore; + } + } else { + if (indicator.sacNormal.style == INDIC_TEXTFORE) { + if (indicator.Flags() & SC_INDICFLAG_VALUEFORE) + textFore = indicatorValue & SC_INDICVALUEMASK; + else + textFore = indicator.sacNormal.fore; + } + } + } + } + } + const int inSelection = hideSelection ? 0 : model.sel.CharacterInSelection(iDoc); + if (inSelection && (vsDraw.selColours.fore.isSet)) { + textFore = (inSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground; + } + ColourDesired textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, styleMain, i); + if (ts.representation) { + if (ll->chars[i] == '\t') { + // Tab display + if (phasesDraw == phasesOne) { + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + textBack = vsDraw.whitespaceColours.back; + surface->FillRectangle(rcSegment, textBack); + } + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { + for (int indentCount = static_cast((ll->positions[i] + epsilon) / indentWidth); + indentCount <= (ll->positions[i + 1] - epsilon) / indentWidth; + indentCount++) { + if (indentCount > 0) { + int xIndent = static_cast(indentCount * indentWidth); + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, + (ll->xHighlightGuide == xIndent)); + } + } + } + if (vsDraw.viewWhitespace != wsInvisible) { + if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + if (vsDraw.whitespaceColours.fore.isSet) + textFore = vsDraw.whitespaceColours.fore; + surface->PenColour(textFore); + PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight, + rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); + if (customDrawTabArrow == NULL) + DrawTabArrow(surface, rcTab, static_cast(rcSegment.top + vsDraw.lineHeight / 2)); + else + customDrawTabArrow(surface, rcTab, static_cast(rcSegment.top + vsDraw.lineHeight / 2)); + } + } + } else { + inIndentation = false; + if (vsDraw.controlCharSymbol >= 32) { + // Using one font for all control characters so it can be controlled independently to ensure + // the box goes around the characters tightly. Seems to be no way to work out what height + // is taken by an individual character - internal leading gives varying results. + FontAlias ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; + char cc[2] = { static_cast(vsDraw.controlCharSymbol), '\0' }; + surface->DrawTextNoClip(rcSegment, ctrlCharsFont, + rcSegment.top + vsDraw.maxAscent, + cc, 1, textBack, textFore); + } else { + DrawTextBlob(surface, vsDraw, rcSegment, ts.representation->stringRep.c_str(), + textBack, textFore, phasesDraw == phasesOne); + } + } + } else { + // Normal text display + if (vsDraw.styles[styleMain].visible) { + if (phasesDraw != phasesOne) { + surface->DrawTextTransparent(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, ll->chars + ts.start, + i - ts.start + 1, textFore); + } else { + surface->DrawTextNoClip(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, ll->chars + ts.start, + i - ts.start + 1, textFore, textBack); + } + } + if (vsDraw.viewWhitespace != wsInvisible || + (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { + for (int cpos = 0; cpos <= i - ts.start; cpos++) { + if (ll->chars[cpos + ts.start] == ' ') { + if (vsDraw.viewWhitespace != wsInvisible) { + if (vsDraw.whitespaceColours.fore.isSet) + textFore = vsDraw.whitespaceColours.fore; + if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + XYPOSITION xmid = (ll->positions[cpos + ts.start] + ll->positions[cpos + ts.start + 1]) / 2; + if ((phasesDraw == phasesOne) && drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + textBack = vsDraw.whitespaceColours.back; + PRectangle rcSpace( + ll->positions[cpos + ts.start] + xStart - static_cast(subLineStart), + rcSegment.top, + ll->positions[cpos + ts.start + 1] + xStart - static_cast(subLineStart), + rcSegment.bottom); + surface->FillRectangle(rcSpace, textBack); + } + PRectangle rcDot(xmid + xStart - static_cast(subLineStart), + rcSegment.top + vsDraw.lineHeight / 2, 0.0f, 0.0f); + rcDot.right = rcDot.left + vsDraw.whitespaceSize; + rcDot.bottom = rcDot.top + vsDraw.whitespaceSize; + surface->FillRectangle(rcDot, textFore); + } + } + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { + for (int indentCount = static_cast((ll->positions[cpos + ts.start] + epsilon) / indentWidth); + indentCount <= (ll->positions[cpos + ts.start + 1] - epsilon) / indentWidth; + indentCount++) { + if (indentCount > 0) { + int xIndent = static_cast(indentCount * indentWidth); + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, + (ll->xHighlightGuide == xIndent)); + } + } + } + } else { + inIndentation = false; + } + } + } + } + if (ll->hotspot.Valid() && vsDraw.hotspotUnderline && ll->hotspot.ContainsCharacter(iDoc)) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + if (vsDraw.hotspotColours.fore.isSet) + surface->FillRectangle(rcUL, vsDraw.hotspotColours.fore); + else + surface->FillRectangle(rcUL, textFore); + } else if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); + } + } else if (rcSegment.left > rcLine.right) { + break; + } + } +} + +void EditView::DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, int lineVisible, PRectangle rcLine, int xStart, int subLine) { + if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth) + && (subLine == 0)) { + const int posLineStart = model.pdoc->LineStart(line); + int indentSpace = model.pdoc->GetLineIndentation(line); + int xStartText = static_cast(ll->positions[model.pdoc->GetLineIndentPosition(line) - posLineStart]); + + // Find the most recent line with some text + + int lineLastWithText = line; + while (lineLastWithText > Platform::Maximum(line - 20, 0) && model.pdoc->IsWhiteLine(lineLastWithText)) { + lineLastWithText--; + } + if (lineLastWithText < line) { + xStartText = 100000; // Don't limit to visible indentation on empty line + // This line is empty, so use indentation of last line with text + int indentLastWithText = model.pdoc->GetLineIndentation(lineLastWithText); + int isFoldHeader = model.pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; + if (isFoldHeader) { + // Level is one more level than parent + indentLastWithText += model.pdoc->IndentSize(); + } + if (vsDraw.viewIndentationGuides == ivLookForward) { + // In viLookForward mode, previous line only used if it is a fold header + if (isFoldHeader) { + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); + } + } else { // viLookBoth + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); + } + } + + int lineNextWithText = line; + while (lineNextWithText < Platform::Minimum(line + 20, model.pdoc->LinesTotal()) && model.pdoc->IsWhiteLine(lineNextWithText)) { + lineNextWithText++; + } + if (lineNextWithText > line) { + xStartText = 100000; // Don't limit to visible indentation on empty line + // This line is empty, so use indentation of first next line with text + indentSpace = Platform::Maximum(indentSpace, + model.pdoc->GetLineIndentation(lineNextWithText)); + } + + for (int indentPos = model.pdoc->IndentSize(); indentPos < indentSpace; indentPos += model.pdoc->IndentSize()) { + int xIndent = static_cast(indentPos * vsDraw.spaceWidth); + if (xIndent < xStartText) { + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcLine, + (ll->xHighlightGuide == xIndent)); + } + } + } +} + +void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, int lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { + + if (subLine >= ll->lines) { + DrawAnnotation(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, phase); + return; // No further drawing + } + + // See if something overrides the line background color. + const ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); + + const int posLineStart = model.pdoc->LineStart(line); + + const Range lineRange = ll->SubLineRange(subLine); + const XYACCUMULATOR subLineStart = ll->positions[lineRange.start]; + + if ((ll->wrapIndent != 0) && (subLine > 0)) { + if (phase & drawBack) { + DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background, customDrawWrapMarker); + } + xStart += static_cast(ll->wrapIndent); + } + + if ((phasesDraw != phasesOne) && (phase & drawBack)) { + DrawBackground(surface, model, vsDraw, ll, rcLine, lineRange, posLineStart, xStart, + subLine, background); + DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, + xStart, subLine, subLineStart, background); + } + + if (phase & drawIndicatorsBack) { + DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, true, model.hoverIndicatorPos); + DrawEdgeLine(surface, vsDraw, ll, rcLine, lineRange, xStart); + DrawMarkUnderline(surface, model, vsDraw, line, rcLine); + } + + if (phase & drawText) { + DrawForeground(surface, model, vsDraw, ll, lineVisible, rcLine, lineRange, posLineStart, xStart, + subLine, background); + } + + if (phase & drawIndentationGuides) { + DrawIndentGuidesOverEmpty(surface, model, vsDraw, ll, line, lineVisible, rcLine, xStart, subLine); + } + + if (phase & drawIndicatorsFore) { + DrawIndicators(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, lineRange.end, false, model.hoverIndicatorPos); + } + + // End of the drawing of the current line + if (phasesDraw == phasesOne) { + DrawEOL(surface, model, vsDraw, ll, rcLine, line, lineRange.end, + xStart, subLine, subLineStart, background); + } + + if (!hideSelection && (phase & drawSelectionTranslucent)) { + DrawTranslucentSelection(surface, model, vsDraw, ll, line, rcLine, subLine, lineRange, xStart); + } + + if (phase & drawLineTranslucent) { + DrawTranslucentLineState(surface, model, vsDraw, ll, line, rcLine); + } +} + +static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, int line, PRectangle rcLine) { + bool expanded = model.cs.GetExpanded(line); + const int level = model.pdoc->GetLevel(line); + const int levelNext = model.pdoc->GetLevel(line + 1); + if ((level & SC_FOLDLEVELHEADERFLAG) && + ((level & SC_FOLDLEVELNUMBERMASK) < (levelNext & SC_FOLDLEVELNUMBERMASK))) { + // Paint the line above the fold + if ((expanded && (model.foldFlags & SC_FOLDFLAG_LINEBEFORE_EXPANDED)) + || + (!expanded && (model.foldFlags & SC_FOLDFLAG_LINEBEFORE_CONTRACTED))) { + PRectangle rcFoldLine = rcLine; + rcFoldLine.bottom = rcFoldLine.top + 1; + surface->FillRectangle(rcFoldLine, vsDraw.styles[STYLE_DEFAULT].fore); + } + // Paint the line below the fold + if ((expanded && (model.foldFlags & SC_FOLDFLAG_LINEAFTER_EXPANDED)) + || + (!expanded && (model.foldFlags & SC_FOLDFLAG_LINEAFTER_CONTRACTED))) { + PRectangle rcFoldLine = rcLine; + rcFoldLine.top = rcFoldLine.bottom - 1; + surface->FillRectangle(rcFoldLine, vsDraw.styles[STYLE_DEFAULT].fore); + } + } +} + +void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea, + PRectangle rcClient, const ViewStyle &vsDraw) { + // Allow text at start of line to overlap 1 pixel into the margin as this displays + // serifs and italic stems for aliased text. + const int leftTextOverlap = ((model.xOffset == 0) && (vsDraw.leftMarginWidth > 0)) ? 1 : 0; + + // Do the painting + if (rcArea.right > vsDraw.textStart - leftTextOverlap) { + + Surface *surface = surfaceWindow; + if (bufferedDraw) { + surface = pixmapLine; + PLATFORM_ASSERT(pixmapLine->Initialised()); + } + surface->SetUnicodeMode(SC_CP_UTF8 == model.pdoc->dbcsCodePage); + surface->SetDBCSMode(model.pdoc->dbcsCodePage); + + const Point ptOrigin = model.GetVisibleOriginInMain(); + + const int screenLinePaintFirst = static_cast(rcArea.top) / vsDraw.lineHeight; + const int xStart = vsDraw.textStart - model.xOffset + static_cast(ptOrigin.x); + + SelectionPosition posCaret = model.sel.RangeMain().caret; + if (model.posDrag.IsValid()) + posCaret = model.posDrag; + const int lineCaret = model.pdoc->LineFromPosition(posCaret.Position()); + + PRectangle rcTextArea = rcClient; + if (vsDraw.marginInside) { + rcTextArea.left += vsDraw.textStart; + rcTextArea.right -= vsDraw.rightMarginWidth; + } else { + rcTextArea = rcArea; + } + + // Remove selection margin from drawing area so text will not be drawn + // on it in unbuffered mode. + if (!bufferedDraw && vsDraw.marginInside) { + PRectangle rcClipText = rcTextArea; + rcClipText.left -= leftTextOverlap; + surfaceWindow->SetClip(rcClipText); + } + + // Loop on visible lines + //double durLayout = 0.0; + //double durPaint = 0.0; + //double durCopy = 0.0; + //ElapsedTime etWhole; + + const bool bracesIgnoreStyle = ((vsDraw.braceHighlightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACELIGHT)) || + (vsDraw.braceBadLightIndicatorSet && (model.bracesMatchStyle == STYLE_BRACEBAD))); + + int lineDocPrevious = -1; // Used to avoid laying out one document line multiple times + AutoLineLayout ll(llc, 0); + std::vector phases; + if ((phasesDraw == phasesMultiple) && !bufferedDraw) { + for (DrawPhase phase = drawBack; phase <= drawCarets; phase = static_cast(phase * 2)) { + phases.push_back(phase); + } + } else { + phases.push_back(drawAll); + } + for (std::vector::iterator it = phases.begin(); it != phases.end(); ++it) { + int ypos = 0; + if (!bufferedDraw) + ypos += screenLinePaintFirst * vsDraw.lineHeight; + int yposScreen = screenLinePaintFirst * vsDraw.lineHeight; + int visibleLine = model.TopLineOfMain() + screenLinePaintFirst; + while (visibleLine < model.cs.LinesDisplayed() && yposScreen < rcArea.bottom) { + + const int lineDoc = model.cs.DocFromDisplay(visibleLine); + // Only visible lines should be handled by the code within the loop + PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); + const int lineStartSet = model.cs.DisplayFromDoc(lineDoc); + const int subLine = visibleLine - lineStartSet; + + // Copy this line and its styles from the document into local arrays + // and determine the x position at which each character starts. + //ElapsedTime et; + if (lineDoc != lineDocPrevious) { + ll.Set(0); + ll.Set(RetrieveLineLayout(lineDoc, model)); + LayoutLine(model, lineDoc, surface, vsDraw, ll, model.wrapWidth); + lineDocPrevious = lineDoc; + } + //durLayout += et.Duration(true); + + if (ll) { + ll->containsCaret = !hideSelection && (lineDoc == lineCaret); + ll->hotspot = model.GetHotSpotRange(); + + PRectangle rcLine = rcTextArea; + rcLine.top = static_cast(ypos); + rcLine.bottom = static_cast(ypos + vsDraw.lineHeight); + + Range rangeLine(model.pdoc->LineStart(lineDoc), model.pdoc->LineStart(lineDoc + 1)); + + // Highlight the current braces if any + ll->SetBracesHighlight(rangeLine, model.braces, static_cast(model.bracesMatchStyle), + static_cast(model.highlightGuideColumn * vsDraw.spaceWidth), bracesIgnoreStyle); + + if (leftTextOverlap && bufferedDraw) { + PRectangle rcSpacer = rcLine; + rcSpacer.right = rcSpacer.left; + rcSpacer.left -= 1; + surface->FillRectangle(rcSpacer, vsDraw.styles[STYLE_DEFAULT].back); + } + + DrawLine(surface, model, vsDraw, ll, lineDoc, visibleLine, xStart, rcLine, subLine, *it); + //durPaint += et.Duration(true); + + // Restore the previous styles for the brace highlights in case layout is in cache. + ll->RestoreBracesHighlight(rangeLine, model.braces, bracesIgnoreStyle); + + if (*it & drawFoldLines) { + DrawFoldLines(surface, model, vsDraw, lineDoc, rcLine); + } + + if (*it & drawCarets) { + DrawCarets(surface, model, vsDraw, ll, lineDoc, xStart, rcLine, subLine); + } + + if (bufferedDraw) { + Point from = Point::FromInts(vsDraw.textStart - leftTextOverlap, 0); + PRectangle rcCopyArea = PRectangle::FromInts(vsDraw.textStart - leftTextOverlap, yposScreen, + static_cast(rcClient.right - vsDraw.rightMarginWidth), + yposScreen + vsDraw.lineHeight); + surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); + } + + lineWidthMaxSeen = Platform::Maximum( + lineWidthMaxSeen, static_cast(ll->positions[ll->numCharsInLine])); + //durCopy += et.Duration(true); + } + + if (!bufferedDraw) { + ypos += vsDraw.lineHeight; + } + + yposScreen += vsDraw.lineHeight; + visibleLine++; + } + } + ll.Set(0); + //if (durPaint < 0.00000001) + // durPaint = 0.00000001; + + // Right column limit indicator + PRectangle rcBeyondEOF = (vsDraw.marginInside) ? rcClient : rcArea; + rcBeyondEOF.left = static_cast(vsDraw.textStart); + rcBeyondEOF.right = rcBeyondEOF.right - ((vsDraw.marginInside) ? vsDraw.rightMarginWidth : 0); + rcBeyondEOF.top = static_cast((model.cs.LinesDisplayed() - model.TopLineOfMain()) * vsDraw.lineHeight); + if (rcBeyondEOF.top < rcBeyondEOF.bottom) { + surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.styles[STYLE_DEFAULT].back); + if (vsDraw.edgeState == EDGE_LINE) { + int edgeX = static_cast(vsDraw.theEdge * vsDraw.spaceWidth); + rcBeyondEOF.left = static_cast(edgeX + xStart); + rcBeyondEOF.right = rcBeyondEOF.left + 1; + surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.edgecolour); + } + } + //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); + + //Platform::DebugPrintf( + //"Layout:%9.6g Paint:%9.6g Ratio:%9.6g Copy:%9.6g Total:%9.6g\n", + //durLayout, durPaint, durLayout / durPaint, durCopy, etWhole.Duration()); + } +} + +// Space (3 space characters) between line numbers and text when printing. +#define lineNumberPrintSpace " " + +ColourDesired InvertedLight(ColourDesired orig) { + unsigned int r = orig.GetRed(); + unsigned int g = orig.GetGreen(); + unsigned int b = orig.GetBlue(); + unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye + unsigned int il = 0xff - l; + if (l == 0) + return ColourDesired(0xff, 0xff, 0xff); + r = r * il / l; + g = g * il / l; + b = b * il / l; + return ColourDesired(Platform::Minimum(r, 0xff), Platform::Minimum(g, 0xff), Platform::Minimum(b, 0xff)); +} + +long EditView::FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, + const EditModel &model, const ViewStyle &vs) { + // Can't use measurements cached for screen + posCache.Clear(); + + ViewStyle vsPrint(vs); + vsPrint.technology = SC_TECHNOLOGY_DEFAULT; + + // Modify the view style for printing as do not normally want any of the transient features to be printed + // Printing supports only the line number margin. + int lineNumberIndex = -1; + for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { + if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) { + lineNumberIndex = margin; + } else { + vsPrint.ms[margin].width = 0; + } + } + vsPrint.fixedColumnWidth = 0; + vsPrint.zoomLevel = printParameters.magnification; + // Don't show indentation guides + // If this ever gets changed, cached pixmap would need to be recreated if technology != SC_TECHNOLOGY_DEFAULT + vsPrint.viewIndentationGuides = ivNone; + // Don't show the selection when printing + vsPrint.selColours.back.isSet = false; + vsPrint.selColours.fore.isSet = false; + vsPrint.selAlpha = SC_ALPHA_NOALPHA; + vsPrint.selAdditionalAlpha = SC_ALPHA_NOALPHA; + vsPrint.whitespaceColours.back.isSet = false; + vsPrint.whitespaceColours.fore.isSet = false; + vsPrint.showCaretLineBackground = false; + vsPrint.alwaysShowCaretLineBackground = false; + // Don't highlight matching braces using indicators + vsPrint.braceHighlightIndicatorSet = false; + vsPrint.braceBadLightIndicatorSet = false; + + // Set colours for printing according to users settings + for (size_t sty = 0; sty < vsPrint.styles.size(); sty++) { + if (printParameters.colourMode == SC_PRINT_INVERTLIGHT) { + vsPrint.styles[sty].fore = InvertedLight(vsPrint.styles[sty].fore); + vsPrint.styles[sty].back = InvertedLight(vsPrint.styles[sty].back); + } else if (printParameters.colourMode == SC_PRINT_BLACKONWHITE) { + vsPrint.styles[sty].fore = ColourDesired(0, 0, 0); + vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff); + } else if (printParameters.colourMode == SC_PRINT_COLOURONWHITE) { + vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff); + } else if (printParameters.colourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) { + if (sty <= STYLE_DEFAULT) { + vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff); + } + } + } + // White background for the line numbers + vsPrint.styles[STYLE_LINENUMBER].back = ColourDesired(0xff, 0xff, 0xff); + + // Printing uses different margins, so reset screen margins + vsPrint.leftMarginWidth = 0; + vsPrint.rightMarginWidth = 0; + + vsPrint.Refresh(*surfaceMeasure, model.pdoc->tabInChars); + // Determining width must happen after fonts have been realised in Refresh + int lineNumberWidth = 0; + if (lineNumberIndex >= 0) { + lineNumberWidth = static_cast(surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, + "99999" lineNumberPrintSpace, 5 + static_cast(strlen(lineNumberPrintSpace)))); + vsPrint.ms[lineNumberIndex].width = lineNumberWidth; + vsPrint.Refresh(*surfaceMeasure, model.pdoc->tabInChars); // Recalculate fixedColumnWidth + } + + int linePrintStart = model.pdoc->LineFromPosition(static_cast(pfr->chrg.cpMin)); + int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; + if (linePrintLast < linePrintStart) + linePrintLast = linePrintStart; + int linePrintMax = model.pdoc->LineFromPosition(static_cast(pfr->chrg.cpMax)); + if (linePrintLast > linePrintMax) + linePrintLast = linePrintMax; + //Platform::DebugPrintf("Formatting lines=[%0d,%0d,%0d] top=%0d bottom=%0d line=%0d %0d\n", + // linePrintStart, linePrintLast, linePrintMax, pfr->rc.top, pfr->rc.bottom, vsPrint.lineHeight, + // surfaceMeasure->Height(vsPrint.styles[STYLE_LINENUMBER].font)); + int endPosPrint = model.pdoc->Length(); + if (linePrintLast < model.pdoc->LinesTotal()) + endPosPrint = model.pdoc->LineStart(linePrintLast + 1); + + // Ensure we are styled to where we are formatting. + model.pdoc->EnsureStyledTo(endPosPrint); + + int xStart = vsPrint.fixedColumnWidth + pfr->rc.left; + int ypos = pfr->rc.top; + + int lineDoc = linePrintStart; + + int nPrintPos = static_cast(pfr->chrg.cpMin); + int visibleLine = 0; + int widthPrint = pfr->rc.right - pfr->rc.left - vsPrint.fixedColumnWidth; + if (printParameters.wrapState == eWrapNone) + widthPrint = LineLayout::wrapWidthInfinite; + + while (lineDoc <= linePrintLast && ypos < pfr->rc.bottom) { + + // When printing, the hdc and hdcTarget may be the same, so + // changing the state of surfaceMeasure may change the underlying + // state of surface. Therefore, any cached state is discarded before + // using each surface. + surfaceMeasure->FlushCachedState(); + + // Copy this line and its styles from the document into local arrays + // and determine the x position at which each character starts. + LineLayout ll(model.pdoc->LineStart(lineDoc + 1) - model.pdoc->LineStart(lineDoc) + 1); + LayoutLine(model, lineDoc, surfaceMeasure, vsPrint, &ll, widthPrint); + + ll.containsCaret = false; + + PRectangle rcLine = PRectangle::FromInts( + pfr->rc.left, + ypos, + pfr->rc.right - 1, + ypos + vsPrint.lineHeight); + + // When document line is wrapped over multiple display lines, find where + // to start printing from to ensure a particular position is on the first + // line of the page. + if (visibleLine == 0) { + int startWithinLine = nPrintPos - model.pdoc->LineStart(lineDoc); + for (int iwl = 0; iwl < ll.lines - 1; iwl++) { + if (ll.LineStart(iwl) <= startWithinLine && ll.LineStart(iwl + 1) >= startWithinLine) { + visibleLine = -iwl; + } + } + + if (ll.lines > 1 && startWithinLine >= ll.LineStart(ll.lines - 1)) { + visibleLine = -(ll.lines - 1); + } + } + + if (draw && lineNumberWidth && + (ypos + vsPrint.lineHeight <= pfr->rc.bottom) && + (visibleLine >= 0)) { + char number[100]; + sprintf(number, "%d" lineNumberPrintSpace, lineDoc + 1); + PRectangle rcNumber = rcLine; + rcNumber.right = rcNumber.left + lineNumberWidth; + // Right justify + rcNumber.left = rcNumber.right - surfaceMeasure->WidthText( + vsPrint.styles[STYLE_LINENUMBER].font, number, static_cast(strlen(number))); + surface->FlushCachedState(); + surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, + static_cast(ypos + vsPrint.maxAscent), number, static_cast(strlen(number)), + vsPrint.styles[STYLE_LINENUMBER].fore, + vsPrint.styles[STYLE_LINENUMBER].back); + } + + // Draw the line + surface->FlushCachedState(); + + for (int iwl = 0; iwl < ll.lines; iwl++) { + if (ypos + vsPrint.lineHeight <= pfr->rc.bottom) { + if (visibleLine >= 0) { + if (draw) { + rcLine.top = static_cast(ypos); + rcLine.bottom = static_cast(ypos + vsPrint.lineHeight); + DrawLine(surface, model, vsPrint, &ll, lineDoc, visibleLine, xStart, rcLine, iwl, drawAll); + } + ypos += vsPrint.lineHeight; + } + visibleLine++; + if (iwl == ll.lines - 1) + nPrintPos = model.pdoc->LineStart(lineDoc + 1); + else + nPrintPos += ll.LineStart(iwl + 1) - ll.LineStart(iwl); + } + } + + ++lineDoc; + } + + // Clear cache so measurements are not used for screen + posCache.Clear(); + + return nPrintPos; +} diff --git a/libs/qscintilla/src/EditView.h b/libs/qscintilla/src/EditView.h new file mode 100644 index 000000000..70af6b2bf --- /dev/null +++ b/libs/qscintilla/src/EditView.h @@ -0,0 +1,173 @@ +// Scintilla source code edit control +/** @file EditView.h + ** Defines the appearance of the main text area of the editor window. + **/ +// Copyright 1998-2014 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef EDITVIEW_H +#define EDITVIEW_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +struct PrintParameters { + int magnification; + int colourMode; + WrapMode wrapState; + PrintParameters(); +}; + +/** +* The view may be drawn in separate phases. +*/ +enum DrawPhase { + drawBack = 0x1, + drawIndicatorsBack = 0x2, + drawText = 0x4, + drawIndentationGuides = 0x8, + drawIndicatorsFore = 0x10, + drawSelectionTranslucent = 0x20, + drawLineTranslucent = 0x40, + drawFoldLines = 0x80, + drawCarets = 0x100, + drawAll = 0x1FF +}; + +bool ValidStyledText(const ViewStyle &vs, size_t styleOffset, const StyledText &st); +int WidestLineWidth(Surface *surface, const ViewStyle &vs, int styleOffset, const StyledText &st); +void DrawTextNoClipPhase(Surface *surface, PRectangle rc, const Style &style, XYPOSITION ybase, + const char *s, int len, DrawPhase phase); +void DrawStyledText(Surface *surface, const ViewStyle &vs, int styleOffset, PRectangle rcText, + const StyledText &st, size_t start, size_t length, DrawPhase phase); + +typedef void (*DrawTabArrowFn)(Surface *surface, PRectangle rcTab, int ymid); + +/** +* EditView draws the main text area. +*/ +class EditView { +public: + PrintParameters printParameters; + PerLine *ldTabstops; + + bool hideSelection; + bool drawOverstrikeCaret; + + /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to + * the screen. This avoids flashing but is about 30% slower. */ + bool bufferedDraw; + /** In phasesTwo mode, drawing is performed in two phases, first the background + * and then the foreground. This avoids chopping off characters that overlap the next run. + * In multiPhaseDraw mode, drawing is performed in multiple phases with each phase drawing + * one feature over the whole drawing area, instead of within one line. This allows text to + * overlap from one line to the next. */ + enum PhasesDraw { phasesOne, phasesTwo, phasesMultiple }; + PhasesDraw phasesDraw; + + int lineWidthMaxSeen; + + bool additionalCaretsBlink; + bool additionalCaretsVisible; + + bool imeCaretBlockOverride; + + Surface *pixmapLine; + Surface *pixmapIndentGuide; + Surface *pixmapIndentGuideHighlight; + + LineLayoutCache llc; + PositionCache posCache; + + int tabArrowHeight; // draw arrow heads this many pixels above/below line midpoint + /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native + * DrawTabArrow function for drawing tab characters. Allow those platforms to + * override it instead of creating a new method in the Surface class that + * existing platforms must implement as empty. */ + DrawTabArrowFn customDrawTabArrow; + DrawWrapMarkerFn customDrawWrapMarker; + + EditView(); + virtual ~EditView(); + + bool SetTwoPhaseDraw(bool twoPhaseDraw); + bool SetPhasesDraw(int phases); + bool LinesOverlap() const; + + void ClearAllTabstops(); + XYPOSITION NextTabstopPos(int line, XYPOSITION x, XYPOSITION tabWidth) const; + bool ClearTabstops(int line); + bool AddTabstop(int line, int x); + int GetNextTabstop(int line, int x) const; + void LinesAddedOrRemoved(int lineOfPos, int linesAdded); + + void DropGraphics(bool freeObjects); + void AllocateGraphics(const ViewStyle &vsDraw); + void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); + + LineLayout *RetrieveLineLayout(int lineNumber, const EditModel &model); + void LayoutLine(const EditModel &model, int line, Surface *surface, const ViewStyle &vstyle, + LineLayout *ll, int width = LineLayout::wrapWidthInfinite); + + Point LocationFromPosition(Surface *surface, const EditModel &model, SelectionPosition pos, int topLine, const ViewStyle &vs); + SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, Point pt, bool canReturnInvalid, + bool charPosition, bool virtualSpace, const ViewStyle &vs); + SelectionPosition SPositionFromLineX(Surface *surface, const EditModel &model, int lineDoc, int x, const ViewStyle &vs); + int DisplayFromPosition(Surface *surface, const EditModel &model, int pos, const ViewStyle &vs); + int StartEndDisplayLine(Surface *surface, const EditModel &model, int pos, bool start, const ViewStyle &vs); + + void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); + void DrawEOL(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, + int line, int lineEnd, int xStart, int subLine, XYACCUMULATOR subLineStart, + ColourOptional background); + void DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); + void DrawCarets(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, + int xStart, PRectangle rcLine, int subLine) const; + void DrawBackground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, + Range lineRange, int posLineStart, int xStart, + int subLine, ColourOptional background) const; + void DrawForeground(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int lineVisible, + PRectangle rcLine, Range lineRange, int posLineStart, int xStart, + int subLine, ColourOptional background); + void DrawIndentGuidesOverEmpty(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, + int line, int lineVisible, PRectangle rcLine, int xStart, int subLine); + void DrawLine(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, + int lineVisible, int xStart, PRectangle rcLine, int subLine, DrawPhase phase); + void PaintText(Surface *surfaceWindow, const EditModel &model, PRectangle rcArea, PRectangle rcClient, + const ViewStyle &vsDraw); + long FormatRange(bool draw, Sci_RangeToFormat *pfr, Surface *surface, Surface *surfaceMeasure, + const EditModel &model, const ViewStyle &vs); +}; + +/** +* Convenience class to ensure LineLayout objects are always disposed. +*/ +class AutoLineLayout { + LineLayoutCache &llc; + LineLayout *ll; + AutoLineLayout &operator=(const AutoLineLayout &); +public: + AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {} + ~AutoLineLayout() { + llc.Dispose(ll); + ll = 0; + } + LineLayout *operator->() const { + return ll; + } + operator LineLayout *() const { + return ll; + } + void Set(LineLayout *ll_) { + llc.Dispose(ll); + ll = ll_; + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Editor.cpp b/libs/qscintilla/src/Editor.cpp new file mode 100644 index 000000000..585acb086 --- /dev/null +++ b/libs/qscintilla/src/Editor.cpp @@ -0,0 +1,7679 @@ +// Scintilla source code edit control +/** @file Editor.cxx + ** Main code for the edit control. + **/ +// Copyright 1998-2011 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 +#include +#include + +#include "Platform.h" + +#include "ILexer.h" +#include "Scintilla.h" + +#include "StringCopy.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" +#include "CellBuffer.h" +#include "PerLine.h" +#include "KeyMap.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "UniConversion.h" +#include "Selection.h" +#include "PositionCache.h" +#include "EditModel.h" +#include "MarginView.h" +#include "EditView.h" +#include "Editor.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/* + return whether this modification represents an operation that + may reasonably be deferred (not done now OR [possibly] at all) +*/ +static bool CanDeferToLastStep(const DocModification &mh) { + if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) + return true; // CAN skip + if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) + return false; // MUST do + if (mh.modificationType & SC_MULTISTEPUNDOREDO) + return true; // CAN skip + return false; // PRESUMABLY must do +} + +static bool CanEliminate(const DocModification &mh) { + return + (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; +} + +/* + return whether this modification represents the FINAL step + in a [possibly lengthy] multi-step Undo/Redo sequence +*/ +static bool IsLastStep(const DocModification &mh) { + return + (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 + && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 + && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 + && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; +} + +Timer::Timer() : + ticking(false), ticksToWait(0), tickerID(0) {} + +Idler::Idler() : + state(false), idlerID(0) {} + +static inline bool IsAllSpacesOrTabs(const char *s, unsigned int len) { + for (unsigned int i = 0; i < len; i++) { + // This is safe because IsSpaceOrTab() will return false for null terminators + if (!IsSpaceOrTab(s[i])) + return false; + } + return true; +} + +Editor::Editor() { + ctrlID = 0; + + stylesValid = false; + technology = SC_TECHNOLOGY_DEFAULT; + scaleRGBAImage = 100.0f; + + cursorMode = SC_CURSORNORMAL; + + hasFocus = false; + errorStatus = 0; + mouseDownCaptures = true; + + lastClickTime = 0; + doubleClickCloseThreshold = Point(3, 3); + dwellDelay = SC_TIME_FOREVER; + ticksToDwell = SC_TIME_FOREVER; + dwelling = false; + ptMouseLast.x = 0; + ptMouseLast.y = 0; + inDragDrop = ddNone; + dropWentOutside = false; + posDrop = SelectionPosition(invalidPosition); + hotSpotClickPos = INVALID_POSITION; + selectionType = selChar; + + lastXChosen = 0; + lineAnchorPos = 0; + originalAnchorPos = 0; + wordSelectAnchorStartPos = 0; + wordSelectAnchorEndPos = 0; + wordSelectInitialCaretPos = -1; + + caretXPolicy = CARET_SLOP | CARET_EVEN; + caretXSlop = 50; + + caretYPolicy = CARET_EVEN; + caretYSlop = 0; + + visiblePolicy = 0; + visibleSlop = 0; + + searchAnchor = 0; + + xCaretMargin = 50; + horizontalScrollBarVisible = true; + scrollWidth = 2000; + verticalScrollBarVisible = true; + endAtLastLine = true; + caretSticky = SC_CARETSTICKY_OFF; + marginOptions = SC_MARGINOPTION_NONE; + mouseSelectionRectangularSwitch = false; + multipleSelection = false; + additionalSelectionTyping = false; + multiPasteMode = SC_MULTIPASTE_ONCE; + virtualSpaceOptions = SCVS_NONE; + + targetStart = 0; + targetEnd = 0; + searchFlags = 0; + + topLine = 0; + posTopLine = 0; + + lengthForEncode = -1; + + needUpdateUI = 0; + ContainerNeedsUpdate(SC_UPDATE_CONTENT); + + paintState = notPainting; + paintAbandonedByStyling = false; + paintingAllText = false; + willRedrawAll = false; + + modEventMask = SC_MODEVENTMASKALL; + + pdoc->AddWatcher(this, 0); + + recordingMacro = false; + foldAutomatic = 0; + + convertPastes = true; + + SetRepresentations(); +} + +Editor::~Editor() { + pdoc->RemoveWatcher(this, 0); + DropGraphics(true); +} + +void Editor::Finalise() { + SetIdle(false); + CancelModes(); +} + +void Editor::SetRepresentations() { + reprs.Clear(); + + // C0 control set + const char *reps[] = { + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", + "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", + "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" + }; + for (size_t j=0; j < ELEMENTS(reps); j++) { + char c[2] = { static_cast(j), 0 }; + reprs.SetRepresentation(c, reps[j]); + } + + // C1 control set + // As well as Unicode mode, ISO-8859-1 should use these + if (IsUnicodeMode()) { + const char *repsC1[] = { + "PAD", "HOP", "BPH", "NBH", "IND", "NEL", "SSA", "ESA", + "HTS", "HTJ", "VTS", "PLD", "PLU", "RI", "SS2", "SS3", + "DCS", "PU1", "PU2", "STS", "CCH", "MW", "SPA", "EPA", + "SOS", "SGCI", "SCI", "CSI", "ST", "OSC", "PM", "APC" + }; + for (size_t j=0; j < ELEMENTS(repsC1); j++) { + char c1[3] = { '\xc2', static_cast(0x80+j), 0 }; + reprs.SetRepresentation(c1, repsC1[j]); + } + reprs.SetRepresentation("\xe2\x80\xa8", "LS"); + reprs.SetRepresentation("\xe2\x80\xa9", "PS"); + } + + // UTF-8 invalid bytes + if (IsUnicodeMode()) { + for (int k=0x80; k < 0x100; k++) { + char hiByte[2] = { static_cast(k), 0 }; + char hexits[4]; + sprintf(hexits, "x%2X", k); + reprs.SetRepresentation(hiByte, hexits); + } + } +} + +void Editor::DropGraphics(bool freeObjects) { + marginView.DropGraphics(freeObjects); + view.DropGraphics(freeObjects); +} + +void Editor::AllocateGraphics() { + marginView.AllocateGraphics(vs); + view.AllocateGraphics(vs); +} + +void Editor::InvalidateStyleData() { + stylesValid = false; + vs.technology = technology; + DropGraphics(false); + AllocateGraphics(); + view.llc.Invalidate(LineLayout::llInvalid); + view.posCache.Clear(); +} + +void Editor::InvalidateStyleRedraw() { + NeedWrapping(); + InvalidateStyleData(); + Redraw(); +} + +void Editor::RefreshStyleData() { + if (!stylesValid) { + stylesValid = true; + AutoSurface surface(this); + if (surface) { + vs.Refresh(*surface, pdoc->tabInChars); + } + SetScrollBars(); + SetRectangularRange(); + } +} + +Point Editor::GetVisibleOriginInMain() const { + return Point(0,0); +} + +Point Editor::DocumentPointFromView(Point ptView) const { + Point ptDocument = ptView; + if (wMargin.GetID()) { + Point ptOrigin = GetVisibleOriginInMain(); + ptDocument.x += ptOrigin.x; + ptDocument.y += ptOrigin.y; + } else { + ptDocument.x += xOffset; + ptDocument.y += topLine * vs.lineHeight; + } + return ptDocument; +} + +int Editor::TopLineOfMain() const { + if (wMargin.GetID()) + return 0; + else + return topLine; +} + +PRectangle Editor::GetClientRectangle() const { + Window &win = const_cast(wMain); + return win.GetClientPosition(); +} + +PRectangle Editor::GetClientDrawingRectangle() { + return GetClientRectangle(); +} + +PRectangle Editor::GetTextRectangle() const { + PRectangle rc = GetClientRectangle(); + rc.left += vs.textStart; + rc.right -= vs.rightMarginWidth; + return rc; +} + +int Editor::LinesOnScreen() const { + PRectangle rcClient = GetClientRectangle(); + int htClient = static_cast(rcClient.bottom - rcClient.top); + //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); + return htClient / vs.lineHeight; +} + +int Editor::LinesToScroll() const { + int retVal = LinesOnScreen() - 1; + if (retVal < 1) + return 1; + else + return retVal; +} + +int Editor::MaxScrollPos() const { + //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n", + //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1); + int retVal = cs.LinesDisplayed(); + if (endAtLastLine) { + retVal -= LinesOnScreen(); + } else { + retVal--; + } + if (retVal < 0) { + return 0; + } else { + return retVal; + } +} + +SelectionPosition Editor::ClampPositionIntoDocument(SelectionPosition sp) const { + if (sp.Position() < 0) { + return SelectionPosition(0); + } else if (sp.Position() > pdoc->Length()) { + return SelectionPosition(pdoc->Length()); + } else { + // If not at end of line then set offset to 0 + if (!pdoc->IsLineEndPosition(sp.Position())) + sp.SetVirtualSpace(0); + return sp; + } +} + +Point Editor::LocationFromPosition(SelectionPosition pos) { + RefreshStyleData(); + AutoSurface surface(this); + return view.LocationFromPosition(surface, *this, pos, topLine, vs); +} + +Point Editor::LocationFromPosition(int pos) { + return LocationFromPosition(SelectionPosition(pos)); +} + +int Editor::XFromPosition(int pos) { + Point pt = LocationFromPosition(pos); + return static_cast(pt.x) - vs.textStart + xOffset; +} + +int Editor::XFromPosition(SelectionPosition sp) { + Point pt = LocationFromPosition(sp); + return static_cast(pt.x) - vs.textStart + xOffset; +} + +SelectionPosition Editor::SPositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition, bool virtualSpace) { + RefreshStyleData(); + AutoSurface surface(this); + + if (canReturnInvalid) { + PRectangle rcClient = GetTextRectangle(); + // May be in scroll view coordinates so translate back to main view + Point ptOrigin = GetVisibleOriginInMain(); + rcClient.Move(-ptOrigin.x, -ptOrigin.y); + if (!rcClient.Contains(pt)) + return SelectionPosition(INVALID_POSITION); + if (pt.x < vs.textStart) + return SelectionPosition(INVALID_POSITION); + if (pt.y < 0) + return SelectionPosition(INVALID_POSITION); + } + pt = DocumentPointFromView(pt); + return view.SPositionFromLocation(surface, *this, pt, canReturnInvalid, charPosition, virtualSpace, vs); +} + +int Editor::PositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition) { + return SPositionFromLocation(pt, canReturnInvalid, charPosition, false).Position(); +} + +/** +* Find the document position corresponding to an x coordinate on a particular document line. +* Ensure is between whole characters when document is in multi-byte or UTF-8 mode. +* This method is used for rectangular selections and does not work on wrapped lines. +*/ +SelectionPosition Editor::SPositionFromLineX(int lineDoc, int x) { + RefreshStyleData(); + if (lineDoc >= pdoc->LinesTotal()) + return SelectionPosition(pdoc->Length()); + //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); + AutoSurface surface(this); + return view.SPositionFromLineX(surface, *this, lineDoc, x, vs); +} + +int Editor::PositionFromLineX(int lineDoc, int x) { + return SPositionFromLineX(lineDoc, x).Position(); +} + +int Editor::LineFromLocation(Point pt) const { + return cs.DocFromDisplay(static_cast(pt.y) / vs.lineHeight + topLine); +} + +void Editor::SetTopLine(int topLineNew) { + if ((topLine != topLineNew) && (topLineNew >= 0)) { + topLine = topLineNew; + ContainerNeedsUpdate(SC_UPDATE_V_SCROLL); + } + posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine)); +} + +/** + * If painting then abandon the painting because a wider redraw is needed. + * @return true if calling code should stop drawing. + */ +bool Editor::AbandonPaint() { + if ((paintState == painting) && !paintingAllText) { + paintState = paintAbandoned; + } + return paintState == paintAbandoned; +} + +void Editor::RedrawRect(PRectangle rc) { + //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom); + + // Clip the redraw rectangle into the client area + PRectangle rcClient = GetClientRectangle(); + if (rc.top < rcClient.top) + rc.top = rcClient.top; + if (rc.bottom > rcClient.bottom) + rc.bottom = rcClient.bottom; + if (rc.left < rcClient.left) + rc.left = rcClient.left; + if (rc.right > rcClient.right) + rc.right = rcClient.right; + + if ((rc.bottom > rc.top) && (rc.right > rc.left)) { + wMain.InvalidateRectangle(rc); + } +} + +void Editor::DiscardOverdraw() { + // Overridden on platforms that may draw outside visible area. +} + +void Editor::Redraw() { + //Platform::DebugPrintf("Redraw all\n"); + PRectangle rcClient = GetClientRectangle(); + wMain.InvalidateRectangle(rcClient); + if (wMargin.GetID()) + wMargin.InvalidateAll(); + //wMain.InvalidateAll(); +} + +void Editor::RedrawSelMargin(int line, bool allAfter) { + bool abandonDraw = false; + if (!wMargin.GetID()) // Margin in main window so may need to abandon and retry + abandonDraw = AbandonPaint(); + if (!abandonDraw) { + if (vs.maskInLine) { + Redraw(); + } else { + PRectangle rcSelMargin = GetClientRectangle(); + rcSelMargin.right = rcSelMargin.left + vs.fixedColumnWidth; + if (line != -1) { + PRectangle rcLine = RectangleFromRange(Range(pdoc->LineStart(line)), 0); + + // Inflate line rectangle if there are image markers with height larger than line height + if (vs.largestMarkerHeight > vs.lineHeight) { + int delta = (vs.largestMarkerHeight - vs.lineHeight + 1) / 2; + rcLine.top -= delta; + rcLine.bottom += delta; + if (rcLine.top < rcSelMargin.top) + rcLine.top = rcSelMargin.top; + if (rcLine.bottom > rcSelMargin.bottom) + rcLine.bottom = rcSelMargin.bottom; + } + + rcSelMargin.top = rcLine.top; + if (!allAfter) + rcSelMargin.bottom = rcLine.bottom; + if (rcSelMargin.Empty()) + return; + } + if (wMargin.GetID()) { + Point ptOrigin = GetVisibleOriginInMain(); + rcSelMargin.Move(-ptOrigin.x, -ptOrigin.y); + wMargin.InvalidateRectangle(rcSelMargin); + } else { + wMain.InvalidateRectangle(rcSelMargin); + } + } + } +} + +PRectangle Editor::RectangleFromRange(Range r, int overlap) { + const int minLine = cs.DisplayFromDoc(pdoc->LineFromPosition(r.First())); + const int maxLine = cs.DisplayLastFromDoc(pdoc->LineFromPosition(r.Last())); + const PRectangle rcClientDrawing = GetClientDrawingRectangle(); + PRectangle rc; + const int leftTextOverlap = ((xOffset == 0) && (vs.leftMarginWidth > 0)) ? 1 : 0; + rc.left = static_cast(vs.textStart - leftTextOverlap); + rc.top = static_cast((minLine - TopLineOfMain()) * vs.lineHeight - overlap); + if (rc.top < rcClientDrawing.top) + rc.top = rcClientDrawing.top; + // Extend to right of prepared area if any to prevent artifacts from caret line highlight + rc.right = rcClientDrawing.right; + rc.bottom = static_cast((maxLine - TopLineOfMain() + 1) * vs.lineHeight + overlap); + + return rc; +} + +void Editor::InvalidateRange(int start, int end) { + RedrawRect(RectangleFromRange(Range(start, end), view.LinesOverlap() ? vs.lineOverlap : 0)); +} + +int Editor::CurrentPosition() const { + return sel.MainCaret(); +} + +bool Editor::SelectionEmpty() const { + return sel.Empty(); +} + +SelectionPosition Editor::SelectionStart() { + return sel.RangeMain().Start(); +} + +SelectionPosition Editor::SelectionEnd() { + return sel.RangeMain().End(); +} + +void Editor::SetRectangularRange() { + if (sel.IsRectangular()) { + int xAnchor = XFromPosition(sel.Rectangular().anchor); + int xCaret = XFromPosition(sel.Rectangular().caret); + if (sel.selType == Selection::selThin) { + xCaret = xAnchor; + } + int lineAnchorRect = pdoc->LineFromPosition(sel.Rectangular().anchor.Position()); + int lineCaret = pdoc->LineFromPosition(sel.Rectangular().caret.Position()); + int increment = (lineCaret > lineAnchorRect) ? 1 : -1; + for (int line=lineAnchorRect; line != lineCaret+increment; line += increment) { + SelectionRange range(SPositionFromLineX(line, xCaret), SPositionFromLineX(line, xAnchor)); + if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) == 0) + range.ClearVirtualSpace(); + if (line == lineAnchorRect) + sel.SetSelection(range); + else + sel.AddSelectionWithoutTrim(range); + } + } +} + +void Editor::ThinRectangularRange() { + if (sel.IsRectangular()) { + sel.selType = Selection::selThin; + if (sel.Rectangular().caret < sel.Rectangular().anchor) { + sel.Rectangular() = SelectionRange(sel.Range(sel.Count()-1).caret, sel.Range(0).anchor); + } else { + sel.Rectangular() = SelectionRange(sel.Range(sel.Count()-1).anchor, sel.Range(0).caret); + } + SetRectangularRange(); + } +} + +void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection) { + if (sel.Count() > 1 || !(sel.RangeMain().anchor == newMain.anchor) || sel.IsRectangular()) { + invalidateWholeSelection = true; + } + int firstAffected = Platform::Minimum(sel.RangeMain().Start().Position(), newMain.Start().Position()); + // +1 for lastAffected ensures caret repainted + int lastAffected = Platform::Maximum(newMain.caret.Position()+1, newMain.anchor.Position()); + lastAffected = Platform::Maximum(lastAffected, sel.RangeMain().End().Position()); + if (invalidateWholeSelection) { + for (size_t r=0; rLineFromPosition(currentPos_.Position()); + /* For Line selection - ensure the anchor and caret are always + at the beginning and end of the region lines. */ + if (sel.selType == Selection::selLines) { + if (currentPos_ > anchor_) { + anchor_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(anchor_.Position()))); + currentPos_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(currentPos_.Position()))); + } else { + currentPos_ = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(currentPos_.Position()))); + anchor_ = SelectionPosition(pdoc->LineEnd(pdoc->LineFromPosition(anchor_.Position()))); + } + } + SelectionRange rangeNew(currentPos_, anchor_); + if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { + InvalidateSelection(rangeNew); + } + sel.RangeMain() = rangeNew; + SetRectangularRange(); + ClaimSelection(); + SetHoverIndicatorPosition(sel.MainCaret()); + + if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } + QueueIdleWork(WorkNeeded::workUpdateUI); +} + +void Editor::SetSelection(int currentPos_, int anchor_) { + SetSelection(SelectionPosition(currentPos_), SelectionPosition(anchor_)); +} + +// Just move the caret on the main selection +void Editor::SetSelection(SelectionPosition currentPos_) { + currentPos_ = ClampPositionIntoDocument(currentPos_); + int currentLine = pdoc->LineFromPosition(currentPos_.Position()); + if (sel.Count() > 1 || !(sel.RangeMain().caret == currentPos_)) { + InvalidateSelection(SelectionRange(currentPos_)); + } + if (sel.IsRectangular()) { + sel.Rectangular() = + SelectionRange(SelectionPosition(currentPos_), sel.Rectangular().anchor); + SetRectangularRange(); + } else { + sel.RangeMain() = + SelectionRange(SelectionPosition(currentPos_), sel.RangeMain().anchor); + } + ClaimSelection(); + SetHoverIndicatorPosition(sel.MainCaret()); + + if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } + QueueIdleWork(WorkNeeded::workUpdateUI); +} + +void Editor::SetSelection(int currentPos_) { + SetSelection(SelectionPosition(currentPos_)); +} + +void Editor::SetEmptySelection(SelectionPosition currentPos_) { + int currentLine = pdoc->LineFromPosition(currentPos_.Position()); + SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_)); + if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { + InvalidateSelection(rangeNew); + } + sel.Clear(); + sel.RangeMain() = rangeNew; + SetRectangularRange(); + ClaimSelection(); + SetHoverIndicatorPosition(sel.MainCaret()); + + if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } + QueueIdleWork(WorkNeeded::workUpdateUI); +} + +void Editor::SetEmptySelection(int currentPos_) { + SetEmptySelection(SelectionPosition(currentPos_)); +} + +bool Editor::RangeContainsProtected(int start, int end) const { + if (vs.ProtectionActive()) { + if (start > end) { + int t = start; + start = end; + end = t; + } + for (int pos = start; pos < end; pos++) { + if (vs.styles[pdoc->StyleAt(pos)].IsProtected()) + return true; + } + } + return false; +} + +bool Editor::SelectionContainsProtected() { + for (size_t r=0; rMovePositionOutsideChar(pos.Position(), moveDir, checkLineEnd); + if (posMoved != pos.Position()) + pos.SetPosition(posMoved); + if (vs.ProtectionActive()) { + if (moveDir > 0) { + if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected()) { + while ((pos.Position() < pdoc->Length()) && + (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected())) + pos.Add(1); + } + } else if (moveDir < 0) { + if (vs.styles[pdoc->StyleAt(pos.Position())].IsProtected()) { + while ((pos.Position() > 0) && + (vs.styles[pdoc->StyleAt(pos.Position() - 1)].IsProtected())) + pos.Add(-1); + } + } + } + return pos; +} + +int Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, bool ensureVisible) { + bool simpleCaret = (sel.Count() == 1) && sel.Empty(); + SelectionPosition spCaret = sel.Last(); + + int delta = newPos.Position() - sel.MainCaret(); + newPos = ClampPositionIntoDocument(newPos); + newPos = MovePositionOutsideChar(newPos, delta); + if (!multipleSelection && sel.IsRectangular() && (selt == Selection::selStream)) { + // Can't turn into multiple selection so clear additional selections + InvalidateSelection(SelectionRange(newPos), true); + SelectionRange rangeMain = sel.RangeMain(); + sel.SetSelection(rangeMain); + } + if (!sel.IsRectangular() && (selt == Selection::selRectangle)) { + // Switching to rectangular + InvalidateSelection(sel.RangeMain(), false); + SelectionRange rangeMain = sel.RangeMain(); + sel.Clear(); + sel.Rectangular() = rangeMain; + } + if (selt != Selection::noSel) { + sel.selType = selt; + } + if (selt != Selection::noSel || sel.MoveExtends()) { + SetSelection(newPos); + } else { + SetEmptySelection(newPos); + } + ShowCaretAtCurrentPosition(); + + int currentLine = pdoc->LineFromPosition(newPos.Position()); + if (ensureVisible) { + // In case in need of wrapping to ensure DisplayFromDoc works. + if (currentLine >= wrapPending.start) + WrapLines(wsAll); + XYScrollPosition newXY = XYScrollToMakeVisible( + SelectionRange(posDrag.IsValid() ? posDrag : sel.RangeMain().caret), xysDefault); + if (simpleCaret && (newXY.xOffset == xOffset)) { + // simple vertical scroll then invalidate + ScrollTo(newXY.topLine); + InvalidateSelection(SelectionRange(spCaret), true); + } else { + SetXYScroll(newXY); + } + } + + if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { + RedrawSelMargin(); + } + return 0; +} + +int Editor::MovePositionTo(int newPos, Selection::selTypes selt, bool ensureVisible) { + return MovePositionTo(SelectionPosition(newPos), selt, ensureVisible); +} + +SelectionPosition Editor::MovePositionSoVisible(SelectionPosition pos, int moveDir) { + pos = ClampPositionIntoDocument(pos); + pos = MovePositionOutsideChar(pos, moveDir); + int lineDoc = pdoc->LineFromPosition(pos.Position()); + if (cs.GetVisible(lineDoc)) { + return pos; + } else { + int lineDisplay = cs.DisplayFromDoc(lineDoc); + if (moveDir > 0) { + // lineDisplay is already line before fold as lines in fold use display line of line after fold + lineDisplay = Platform::Clamp(lineDisplay, 0, cs.LinesDisplayed()); + return SelectionPosition(pdoc->LineStart(cs.DocFromDisplay(lineDisplay))); + } else { + lineDisplay = Platform::Clamp(lineDisplay - 1, 0, cs.LinesDisplayed()); + return SelectionPosition(pdoc->LineEnd(cs.DocFromDisplay(lineDisplay))); + } + } +} + +SelectionPosition Editor::MovePositionSoVisible(int pos, int moveDir) { + return MovePositionSoVisible(SelectionPosition(pos), moveDir); +} + +Point Editor::PointMainCaret() { + return LocationFromPosition(sel.Range(sel.Main()).caret); +} + +/** + * Choose the x position that the caret will try to stick to + * as it moves up and down. + */ +void Editor::SetLastXChosen() { + Point pt = PointMainCaret(); + lastXChosen = static_cast(pt.x) + xOffset; +} + +void Editor::ScrollTo(int line, bool moveThumb) { + int topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); + if (topLineNew != topLine) { + // Try to optimise small scrolls +#ifndef UNDER_CE + int linesToMove = topLine - topLineNew; + bool performBlit = (abs(linesToMove) <= 10) && (paintState == notPainting); + willRedrawAll = !performBlit; +#endif + SetTopLine(topLineNew); + // Optimize by styling the view as this will invalidate any needed area + // which could abort the initial paint if discovered later. + StyleToPositionInView(PositionAfterArea(GetClientRectangle())); +#ifndef UNDER_CE + // Perform redraw rather than scroll if many lines would be redrawn anyway. + if (performBlit) { + ScrollText(linesToMove); + } else { + Redraw(); + } + willRedrawAll = false; +#else + Redraw(); +#endif + if (moveThumb) { + SetVerticalScrollPos(); + } + } +} + +void Editor::ScrollText(int /* linesToMove */) { + //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove); + Redraw(); +} + +void Editor::HorizontalScrollTo(int xPos) { + //Platform::DebugPrintf("HorizontalScroll %d\n", xPos); + if (xPos < 0) + xPos = 0; + if (!Wrapping() && (xOffset != xPos)) { + xOffset = xPos; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); + SetHorizontalScrollPos(); + RedrawRect(GetClientRectangle()); + } +} + +void Editor::VerticalCentreCaret() { + int lineDoc = pdoc->LineFromPosition(sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret()); + int lineDisplay = cs.DisplayFromDoc(lineDoc); + int newTop = lineDisplay - (LinesOnScreen() / 2); + if (topLine != newTop) { + SetTopLine(newTop > 0 ? newTop : 0); + RedrawRect(GetClientRectangle()); + } +} + +// Avoid 64 bit compiler warnings. +// Scintilla does not support text buffers larger than 2**31 +static int istrlen(const char *s) { + return static_cast(s ? strlen(s) : 0); +} + +void Editor::MoveSelectedLines(int lineDelta) { + + // if selection doesn't start at the beginning of the line, set the new start + int selectionStart = SelectionStart().Position(); + int startLine = pdoc->LineFromPosition(selectionStart); + int beginningOfStartLine = pdoc->LineStart(startLine); + selectionStart = beginningOfStartLine; + + // if selection doesn't end at the beginning of a line greater than that of the start, + // then set it at the beginning of the next one + int selectionEnd = SelectionEnd().Position(); + int endLine = pdoc->LineFromPosition(selectionEnd); + int beginningOfEndLine = pdoc->LineStart(endLine); + bool appendEol = false; + if (selectionEnd > beginningOfEndLine + || selectionStart == selectionEnd) { + selectionEnd = pdoc->LineStart(endLine + 1); + appendEol = (selectionEnd == pdoc->Length() && pdoc->LineFromPosition(selectionEnd) == endLine); + } + + // if there's nowhere for the selection to move + // (i.e. at the beginning going up or at the end going down), + // stop it right there! + if ((selectionStart == 0 && lineDelta < 0) + || (selectionEnd == pdoc->Length() && lineDelta > 0) + || selectionStart == selectionEnd) { + return; + } + + UndoGroup ug(pdoc); + + if (lineDelta > 0 && selectionEnd == pdoc->LineStart(pdoc->LinesTotal() - 1)) { + SetSelection(pdoc->MovePositionOutsideChar(selectionEnd - 1, -1), selectionEnd); + ClearSelection(); + selectionEnd = CurrentPosition(); + } + SetSelection(selectionStart, selectionEnd); + + SelectionText selectedText; + CopySelectionRange(&selectedText); + + int selectionLength = SelectionRange(selectionStart, selectionEnd).Length(); + Point currentLocation = LocationFromPosition(CurrentPosition()); + int currentLine = LineFromLocation(currentLocation); + + if (appendEol) + SetSelection(pdoc->MovePositionOutsideChar(selectionStart - 1, -1), selectionEnd); + ClearSelection(); + + const char *eol = StringFromEOLMode(pdoc->eolMode); + if (currentLine + lineDelta >= pdoc->LinesTotal()) + pdoc->InsertString(pdoc->Length(), eol, istrlen(eol)); + GoToLine(currentLine + lineDelta); + + selectionLength = pdoc->InsertString(CurrentPosition(), selectedText.Data(), selectionLength); + if (appendEol) { + const int lengthInserted = pdoc->InsertString(CurrentPosition() + selectionLength, eol, istrlen(eol)); + selectionLength += lengthInserted; + } + SetSelection(CurrentPosition(), CurrentPosition() + selectionLength); +} + +void Editor::MoveSelectedLinesUp() { + MoveSelectedLines(-1); +} + +void Editor::MoveSelectedLinesDown() { + MoveSelectedLines(1); +} + +void Editor::MoveCaretInsideView(bool ensureVisible) { + PRectangle rcClient = GetTextRectangle(); + Point pt = PointMainCaret(); + if (pt.y < rcClient.top) { + MovePositionTo(SPositionFromLocation( + Point::FromInts(lastXChosen - xOffset, static_cast(rcClient.top)), + false, false, UserVirtualSpace()), + Selection::noSel, ensureVisible); + } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { + int yOfLastLineFullyDisplayed = static_cast(rcClient.top) + (LinesOnScreen() - 1) * vs.lineHeight; + MovePositionTo(SPositionFromLocation( + Point::FromInts(lastXChosen - xOffset, static_cast(rcClient.top) + yOfLastLineFullyDisplayed), + false, false, UserVirtualSpace()), + Selection::noSel, ensureVisible); + } +} + +int Editor::DisplayFromPosition(int pos) { + AutoSurface surface(this); + return view.DisplayFromPosition(surface, *this, pos, vs); +} + +/** + * Ensure the caret is reasonably visible in context. + * +Caret policy in SciTE + +If slop is set, we can define a slop value. +This value defines an unwanted zone (UZ) where the caret is... unwanted. +This zone is defined as a number of pixels near the vertical margins, +and as a number of lines near the horizontal margins. +By keeping the caret away from the edges, it is seen within its context, +so it is likely that the identifier that the caret is on can be completely seen, +and that the current line is seen with some of the lines following it which are +often dependent on that line. + +If strict is set, the policy is enforced... strictly. +The caret is centred on the display if slop is not set, +and cannot go in the UZ if slop is set. + +If jumps is set, the display is moved more energetically +so the caret can move in the same direction longer before the policy is applied again. +'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin. + +If even is not set, instead of having symmetrical UZs, +the left and bottom UZs are extended up to right and top UZs respectively. +This way, we favour the displaying of useful information: the beginning of lines, +where most code reside, and the lines after the caret, eg. the body of a function. + + | | | | | +slop | strict | jumps | even | Caret can go to the margin | When reaching limit (caret going out of + | | | | | visibility or going into the UZ) display is... +-----+--------+-------+------+--------------------------------------------+-------------------------------------------------------------- + 0 | 0 | 0 | 0 | Yes | moved to put caret on top/on right + 0 | 0 | 0 | 1 | Yes | moved by one position + 0 | 0 | 1 | 0 | Yes | moved to put caret on top/on right + 0 | 0 | 1 | 1 | Yes | centred on the caret + 0 | 1 | - | 0 | Caret is always on top/on right of display | - + 0 | 1 | - | 1 | No, caret is always centred | - + 1 | 0 | 0 | 0 | Yes | moved to put caret out of the asymmetrical UZ + 1 | 0 | 0 | 1 | Yes | moved to put caret out of the UZ + 1 | 0 | 1 | 0 | Yes | moved to put caret at 3UZ of the top or right margin + 1 | 0 | 1 | 1 | Yes | moved to put caret at 3UZ of the margin + 1 | 1 | - | 0 | Caret is always at UZ of top/right margin | - + 1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position + 1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin +*/ + +Editor::XYScrollPosition Editor::XYScrollToMakeVisible(const SelectionRange &range, const XYScrollOptions options) { + PRectangle rcClient = GetTextRectangle(); + Point pt = LocationFromPosition(range.caret); + Point ptAnchor = LocationFromPosition(range.anchor); + const Point ptOrigin = GetVisibleOriginInMain(); + pt.x += ptOrigin.x; + pt.y += ptOrigin.y; + ptAnchor.x += ptOrigin.x; + ptAnchor.y += ptOrigin.y; + const Point ptBottomCaret(pt.x, pt.y + vs.lineHeight - 1); + + XYScrollPosition newXY(xOffset, topLine); + if (rcClient.Empty()) { + return newXY; + } + + // Vertical positioning + if ((options & xysVertical) && (pt.y < rcClient.top || ptBottomCaret.y >= rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { + const int lineCaret = DisplayFromPosition(range.caret.Position()); + const int linesOnScreen = LinesOnScreen(); + const int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; + const bool bSlop = (caretYPolicy & CARET_SLOP) != 0; + const bool bStrict = (caretYPolicy & CARET_STRICT) != 0; + const bool bJump = (caretYPolicy & CARET_JUMPS) != 0; + const bool bEven = (caretYPolicy & CARET_EVEN) != 0; + + // It should be possible to scroll the window to show the caret, + // but this fails to remove the caret on GTK+ + if (bSlop) { // A margin is defined + int yMoveT, yMoveB; + if (bStrict) { + int yMarginT, yMarginB; + if (!(options & xysUseMargin)) { + // In drag mode, avoid moves + // otherwise, a double click will select several lines. + yMarginT = yMarginB = 0; + } else { + // yMarginT must equal to caretYSlop, with a minimum of 1 and + // a maximum of slightly less than half the heigth of the text area. + yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen); + if (bEven) { + yMarginB = yMarginT; + } else { + yMarginB = linesOnScreen - yMarginT - 1; + } + } + yMoveT = yMarginT; + if (bEven) { + if (bJump) { + yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen); + } + yMoveB = yMoveT; + } else { + yMoveB = linesOnScreen - yMoveT - 1; + } + if (lineCaret < topLine + yMarginT) { + // Caret goes too high + newXY.topLine = lineCaret - yMoveT; + } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) { + // Caret goes too low + newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB; + } + } else { // Not strict + yMoveT = bJump ? caretYSlop * 3 : caretYSlop; + yMoveT = Platform::Clamp(yMoveT, 1, halfScreen); + if (bEven) { + yMoveB = yMoveT; + } else { + yMoveB = linesOnScreen - yMoveT - 1; + } + if (lineCaret < topLine) { + // Caret goes too high + newXY.topLine = lineCaret - yMoveT; + } else if (lineCaret > topLine + linesOnScreen - 1) { + // Caret goes too low + newXY.topLine = lineCaret - linesOnScreen + 1 + yMoveB; + } + } + } else { // No slop + if (!bStrict && !bJump) { + // Minimal move + if (lineCaret < topLine) { + // Caret goes too high + newXY.topLine = lineCaret; + } else if (lineCaret > topLine + linesOnScreen - 1) { + // Caret goes too low + if (bEven) { + newXY.topLine = lineCaret - linesOnScreen + 1; + } else { + newXY.topLine = lineCaret; + } + } + } else { // Strict or going out of display + if (bEven) { + // Always center caret + newXY.topLine = lineCaret - halfScreen; + } else { + // Always put caret on top of display + newXY.topLine = lineCaret; + } + } + } + if (!(range.caret == range.anchor)) { + const int lineAnchor = DisplayFromPosition(range.anchor.Position()); + if (lineAnchor < lineCaret) { + // Shift up to show anchor or as much of range as possible + newXY.topLine = std::min(newXY.topLine, lineAnchor); + newXY.topLine = std::max(newXY.topLine, lineCaret - LinesOnScreen()); + } else { + // Shift down to show anchor or as much of range as possible + newXY.topLine = std::max(newXY.topLine, lineAnchor - LinesOnScreen()); + newXY.topLine = std::min(newXY.topLine, lineCaret); + } + } + newXY.topLine = Platform::Clamp(newXY.topLine, 0, MaxScrollPos()); + } + + // Horizontal positioning + if ((options & xysHorizontal) && !Wrapping()) { + const int halfScreen = Platform::Maximum(static_cast(rcClient.Width()) - 4, 4) / 2; + const bool bSlop = (caretXPolicy & CARET_SLOP) != 0; + const bool bStrict = (caretXPolicy & CARET_STRICT) != 0; + const bool bJump = (caretXPolicy & CARET_JUMPS) != 0; + const bool bEven = (caretXPolicy & CARET_EVEN) != 0; + + if (bSlop) { // A margin is defined + int xMoveL, xMoveR; + if (bStrict) { + int xMarginL, xMarginR; + if (!(options & xysUseMargin)) { + // In drag mode, avoid moves unless very near of the margin + // otherwise, a simple click will select text. + xMarginL = xMarginR = 2; + } else { + // xMargin must equal to caretXSlop, with a minimum of 2 and + // a maximum of slightly less than half the width of the text area. + xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen); + if (bEven) { + xMarginL = xMarginR; + } else { + xMarginL = static_cast(rcClient.Width()) - xMarginR - 4; + } + } + if (bJump && bEven) { + // Jump is used only in even mode + xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen); + } else { + xMoveL = xMoveR = 0; // Not used, avoid a warning + } + if (pt.x < rcClient.left + xMarginL) { + // Caret is on the left of the display + if (bJump && bEven) { + newXY.xOffset -= xMoveL; + } else { + // Move just enough to allow to display the caret + newXY.xOffset -= static_cast((rcClient.left + xMarginL) - pt.x); + } + } else if (pt.x >= rcClient.right - xMarginR) { + // Caret is on the right of the display + if (bJump && bEven) { + newXY.xOffset += xMoveR; + } else { + // Move just enough to allow to display the caret + newXY.xOffset += static_cast(pt.x - (rcClient.right - xMarginR) + 1); + } + } + } else { // Not strict + xMoveR = bJump ? caretXSlop * 3 : caretXSlop; + xMoveR = Platform::Clamp(xMoveR, 1, halfScreen); + if (bEven) { + xMoveL = xMoveR; + } else { + xMoveL = static_cast(rcClient.Width()) - xMoveR - 4; + } + if (pt.x < rcClient.left) { + // Caret is on the left of the display + newXY.xOffset -= xMoveL; + } else if (pt.x >= rcClient.right) { + // Caret is on the right of the display + newXY.xOffset += xMoveR; + } + } + } else { // No slop + if (bStrict || + (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) { + // Strict or going out of display + if (bEven) { + // Center caret + newXY.xOffset += static_cast(pt.x - rcClient.left - halfScreen); + } else { + // Put caret on right + newXY.xOffset += static_cast(pt.x - rcClient.right + 1); + } + } else { + // Move just enough to allow to display the caret + if (pt.x < rcClient.left) { + // Caret is on the left of the display + if (bEven) { + newXY.xOffset -= static_cast(rcClient.left - pt.x); + } else { + newXY.xOffset += static_cast(pt.x - rcClient.right) + 1; + } + } else if (pt.x >= rcClient.right) { + // Caret is on the right of the display + newXY.xOffset += static_cast(pt.x - rcClient.right) + 1; + } + } + } + // In case of a jump (find result) largely out of display, adjust the offset to display the caret + if (pt.x + xOffset < rcClient.left + newXY.xOffset) { + newXY.xOffset = static_cast(pt.x + xOffset - rcClient.left) - 2; + } else if (pt.x + xOffset >= rcClient.right + newXY.xOffset) { + newXY.xOffset = static_cast(pt.x + xOffset - rcClient.right) + 2; + if ((vs.caretStyle == CARETSTYLE_BLOCK) || view.imeCaretBlockOverride) { + // Ensure we can see a good portion of the block caret + newXY.xOffset += static_cast(vs.aveCharWidth); + } + } + if (!(range.caret == range.anchor)) { + if (ptAnchor.x < pt.x) { + // Shift to left to show anchor or as much of range as possible + int maxOffset = static_cast(ptAnchor.x + xOffset - rcClient.left) - 1; + int minOffset = static_cast(pt.x + xOffset - rcClient.right) + 1; + newXY.xOffset = std::min(newXY.xOffset, maxOffset); + newXY.xOffset = std::max(newXY.xOffset, minOffset); + } else { + // Shift to right to show anchor or as much of range as possible + int minOffset = static_cast(ptAnchor.x + xOffset - rcClient.right) + 1; + int maxOffset = static_cast(pt.x + xOffset - rcClient.left) - 1; + newXY.xOffset = std::max(newXY.xOffset, minOffset); + newXY.xOffset = std::min(newXY.xOffset, maxOffset); + } + } + if (newXY.xOffset < 0) { + newXY.xOffset = 0; + } + } + + return newXY; +} + +void Editor::SetXYScroll(XYScrollPosition newXY) { + if ((newXY.topLine != topLine) || (newXY.xOffset != xOffset)) { + if (newXY.topLine != topLine) { + SetTopLine(newXY.topLine); + SetVerticalScrollPos(); + } + if (newXY.xOffset != xOffset) { + xOffset = newXY.xOffset; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); + if (newXY.xOffset > 0) { + PRectangle rcText = GetTextRectangle(); + if (horizontalScrollBarVisible && + rcText.Width() + xOffset > scrollWidth) { + scrollWidth = xOffset + static_cast(rcText.Width()); + SetScrollBars(); + } + } + SetHorizontalScrollPos(); + } + Redraw(); + UpdateSystemCaret(); + } +} + +void Editor::ScrollRange(SelectionRange range) { + SetXYScroll(XYScrollToMakeVisible(range, xysDefault)); +} + +void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { + SetXYScroll(XYScrollToMakeVisible(SelectionRange(posDrag.IsValid() ? posDrag : sel.RangeMain().caret), + static_cast((useMargin?xysUseMargin:0)|(vert?xysVertical:0)|(horiz?xysHorizontal:0)))); +} + +void Editor::ShowCaretAtCurrentPosition() { + if (hasFocus) { + caret.active = true; + caret.on = true; + if (FineTickerAvailable()) { + FineTickerCancel(tickCaret); + if (caret.period > 0) + FineTickerStart(tickCaret, caret.period, caret.period/10); + } else { + SetTicking(true); + } + } else { + caret.active = false; + caret.on = false; + if (FineTickerAvailable()) { + FineTickerCancel(tickCaret); + } + } + InvalidateCaret(); +} + +void Editor::DropCaret() { + caret.active = false; + if (FineTickerAvailable()) { + FineTickerCancel(tickCaret); + } + InvalidateCaret(); +} + +void Editor::CaretSetPeriod(int period) { + if (caret.period != period) { + caret.period = period; + caret.on = true; + if (FineTickerAvailable()) { + FineTickerCancel(tickCaret); + if ((caret.active) && (caret.period > 0)) + FineTickerStart(tickCaret, caret.period, caret.period/10); + } + InvalidateCaret(); + } +} + +void Editor::InvalidateCaret() { + if (posDrag.IsValid()) { + InvalidateRange(posDrag.Position(), posDrag.Position() + 1); + } else { + for (size_t r=0; rlines; + } + return cs.SetHeight(lineToWrap, linesWrapped + + (vs.annotationVisible ? pdoc->AnnotationLines(lineToWrap) : 0)); +} + +// Perform wrapping for a subset of the lines needing wrapping. +// wsAll: wrap all lines which need wrapping in this single call +// wsVisible: wrap currently visible lines +// wsIdle: wrap one page + 100 lines +// Return true if wrapping occurred. +bool Editor::WrapLines(enum wrapScope ws) { + int goodTopLine = topLine; + bool wrapOccurred = false; + if (!Wrapping()) { + if (wrapWidth != LineLayout::wrapWidthInfinite) { + wrapWidth = LineLayout::wrapWidthInfinite; + for (int lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) { + cs.SetHeight(lineDoc, 1 + + (vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0)); + } + wrapOccurred = true; + } + wrapPending.Reset(); + + } else if (wrapPending.NeedsWrap()) { + wrapPending.start = std::min(wrapPending.start, pdoc->LinesTotal()); + if (!SetIdle(true)) { + // Idle processing not supported so full wrap required. + ws = wsAll; + } + // Decide where to start wrapping + int lineToWrap = wrapPending.start; + int lineToWrapEnd = std::min(wrapPending.end, pdoc->LinesTotal()); + const int lineDocTop = cs.DocFromDisplay(topLine); + const int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); + if (ws == wsVisible) { + lineToWrap = Platform::Clamp(lineDocTop-5, wrapPending.start, pdoc->LinesTotal()); + // Priority wrap to just after visible area. + // Since wrapping could reduce display lines, treat each + // as taking only one display line. + lineToWrapEnd = lineDocTop; + int lines = LinesOnScreen() + 1; + while ((lineToWrapEnd < cs.LinesInDoc()) && (lines>0)) { + if (cs.GetVisible(lineToWrapEnd)) + lines--; + lineToWrapEnd++; + } + // .. and if the paint window is outside pending wraps + if ((lineToWrap > wrapPending.end) || (lineToWrapEnd < wrapPending.start)) { + // Currently visible text does not need wrapping + return false; + } + } else if (ws == wsIdle) { + lineToWrapEnd = lineToWrap + LinesOnScreen() + 100; + } + const int lineEndNeedWrap = std::min(wrapPending.end, pdoc->LinesTotal()); + lineToWrapEnd = std::min(lineToWrapEnd, lineEndNeedWrap); + + // Ensure all lines being wrapped are styled. + pdoc->EnsureStyledTo(pdoc->LineStart(lineToWrapEnd)); + + if (lineToWrap < lineToWrapEnd) { + + PRectangle rcTextArea = GetClientRectangle(); + rcTextArea.left = static_cast(vs.textStart); + rcTextArea.right -= vs.rightMarginWidth; + wrapWidth = static_cast(rcTextArea.Width()); + RefreshStyleData(); + AutoSurface surface(this); + if (surface) { +//Platform::DebugPrintf("Wraplines: scope=%0d need=%0d..%0d perform=%0d..%0d\n", ws, wrapPending.start, wrapPending.end, lineToWrap, lineToWrapEnd); + + while (lineToWrap < lineToWrapEnd) { + if (WrapOneLine(surface, lineToWrap)) { + wrapOccurred = true; + } + wrapPending.Wrapped(lineToWrap); + lineToWrap++; + } + + goodTopLine = cs.DisplayFromDoc(lineDocTop) + std::min(subLineTop, cs.GetHeight(lineDocTop)-1); + } + } + + // If wrapping is done, bring it to resting position + if (wrapPending.start >= lineEndNeedWrap) { + wrapPending.Reset(); + } + } + + if (wrapOccurred) { + SetScrollBars(); + SetTopLine(Platform::Clamp(goodTopLine, 0, MaxScrollPos())); + SetVerticalScrollPos(); + } + + return wrapOccurred; +} + +void Editor::LinesJoin() { + if (!RangeContainsProtected(targetStart, targetEnd)) { + UndoGroup ug(pdoc); + bool prevNonWS = true; + for (int pos = targetStart; pos < targetEnd; pos++) { + if (pdoc->IsPositionInLineEnd(pos)) { + targetEnd -= pdoc->LenChar(pos); + pdoc->DelChar(pos); + if (prevNonWS) { + // Ensure at least one space separating previous lines + const int lengthInserted = pdoc->InsertString(pos, " ", 1); + targetEnd += lengthInserted; + } + } else { + prevNonWS = pdoc->CharAt(pos) != ' '; + } + } + } +} + +const char *Editor::StringFromEOLMode(int eolMode) { + if (eolMode == SC_EOL_CRLF) { + return "\r\n"; + } else if (eolMode == SC_EOL_CR) { + return "\r"; + } else { + return "\n"; + } +} + +void Editor::LinesSplit(int pixelWidth) { + if (!RangeContainsProtected(targetStart, targetEnd)) { + if (pixelWidth == 0) { + PRectangle rcText = GetTextRectangle(); + pixelWidth = static_cast(rcText.Width()); + } + int lineStart = pdoc->LineFromPosition(targetStart); + int lineEnd = pdoc->LineFromPosition(targetEnd); + const char *eol = StringFromEOLMode(pdoc->eolMode); + UndoGroup ug(pdoc); + for (int line = lineStart; line <= lineEnd; line++) { + AutoSurface surface(this); + AutoLineLayout ll(view.llc, view.RetrieveLineLayout(line, *this)); + if (surface && ll) { + unsigned int posLineStart = pdoc->LineStart(line); + view.LayoutLine(*this, line, surface, vs, ll, pixelWidth); + int lengthInsertedTotal = 0; + for (int subLine = 1; subLine < ll->lines; subLine++) { + const int lengthInserted = pdoc->InsertString( + static_cast(posLineStart + lengthInsertedTotal + + ll->LineStart(subLine)), + eol, istrlen(eol)); + targetEnd += lengthInserted; + lengthInsertedTotal += lengthInserted; + } + } + lineEnd = pdoc->LineFromPosition(targetEnd); + } + } +} + +void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { + if (vs.fixedColumnWidth == 0) + return; + + AllocateGraphics(); + RefreshStyleData(); + RefreshPixMaps(surfWindow); + + // On GTK+ with Ubuntu overlay scroll bars, the surface may have been finished + // at this point. The Initialised call checks for this case and sets the status + // to be bad which avoids crashes in following calls. + if (!surfWindow->Initialised()) { + return; + } + + PRectangle rcMargin = GetClientRectangle(); + Point ptOrigin = GetVisibleOriginInMain(); + rcMargin.Move(0, -ptOrigin.y); + rcMargin.left = 0; + rcMargin.right = static_cast(vs.fixedColumnWidth); + + if (!rc.Intersects(rcMargin)) + return; + + Surface *surface; + if (view.bufferedDraw) { + surface = marginView.pixmapSelMargin; + } else { + surface = surfWindow; + } + + // Clip vertically to paint area to avoid drawing line numbers + if (rcMargin.bottom > rc.bottom) + rcMargin.bottom = rc.bottom; + if (rcMargin.top < rc.top) + rcMargin.top = rc.top; + + marginView.PaintMargin(surface, topLine, rc, rcMargin, *this, vs); + + if (view.bufferedDraw) { + surfWindow->Copy(rcMargin, Point(rcMargin.left, rcMargin.top), *marginView.pixmapSelMargin); + } +} + +void Editor::RefreshPixMaps(Surface *surfaceWindow) { + view.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); + marginView.RefreshPixMaps(surfaceWindow, wMain.GetID(), vs); + if (view.bufferedDraw) { + PRectangle rcClient = GetClientRectangle(); + if (!view.pixmapLine->Initialised()) { + + view.pixmapLine->InitPixMap(static_cast(rcClient.Width()), vs.lineHeight, + surfaceWindow, wMain.GetID()); + } + if (!marginView.pixmapSelMargin->Initialised()) { + marginView.pixmapSelMargin->InitPixMap(vs.fixedColumnWidth, + static_cast(rcClient.Height()), surfaceWindow, wMain.GetID()); + } + } +} + +void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { + //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n", + // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom); + AllocateGraphics(); + + RefreshStyleData(); + if (paintState == paintAbandoned) + return; // Scroll bars may have changed so need redraw + RefreshPixMaps(surfaceWindow); + + paintAbandonedByStyling = false; + + StyleToPositionInView(PositionAfterArea(rcArea)); + + PRectangle rcClient = GetClientRectangle(); + //Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d) %d\n", + // rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); + + if (NotifyUpdateUI()) { + RefreshStyleData(); + RefreshPixMaps(surfaceWindow); + } + + // Wrap the visible lines if needed. + if (WrapLines(wsVisible)) { + // The wrapping process has changed the height of some lines so + // abandon this paint for a complete repaint. + if (AbandonPaint()) { + return; + } + RefreshPixMaps(surfaceWindow); // In case pixmaps invalidated by scrollbar change + } + PLATFORM_ASSERT(marginView.pixmapSelPattern->Initialised()); + + if (!view.bufferedDraw) + surfaceWindow->SetClip(rcArea); + + if (paintState != paintAbandoned) { + if (vs.marginInside) { + PaintSelMargin(surfaceWindow, rcArea); + PRectangle rcRightMargin = rcClient; + rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; + if (rcArea.Intersects(rcRightMargin)) { + surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back); + } + } else { // Else separate view so separate paint event but leftMargin included to allow overlap + PRectangle rcLeftMargin = rcArea; + rcLeftMargin.left = 0; + rcLeftMargin.right = rcLeftMargin.left + vs.leftMarginWidth; + if (rcArea.Intersects(rcLeftMargin)) { + surfaceWindow->FillRectangle(rcLeftMargin, vs.styles[STYLE_DEFAULT].back); + } + } + } + + if (paintState == paintAbandoned) { + // Either styling or NotifyUpdateUI noticed that painting is needed + // outside the current painting rectangle + //Platform::DebugPrintf("Abandoning paint\n"); + if (Wrapping()) { + if (paintAbandonedByStyling) { + // Styling has spilled over a line end, such as occurs by starting a multiline + // comment. The width of subsequent text may have changed, so rewrap. + NeedWrapping(cs.DocFromDisplay(topLine)); + } + } + return; + } + + view.PaintText(surfaceWindow, *this, rcArea, rcClient, vs); + + if (horizontalScrollBarVisible && trackLineWidth && (view.lineWidthMaxSeen > scrollWidth)) { + if (FineTickerAvailable()) { + scrollWidth = view.lineWidthMaxSeen; + if (!FineTickerRunning(tickWiden)) { + FineTickerStart(tickWiden, 50, 5); + } + } + } + + NotifyPainted(); +} + +// This is mostly copied from the Paint method but with some things omitted +// such as the margin markers, line numbers, selection and caret +// Should be merged back into a combined Draw method. +long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { + if (!pfr) + return 0; + + AutoSurface surface(pfr->hdc, this, SC_TECHNOLOGY_DEFAULT); + if (!surface) + return 0; + AutoSurface surfaceMeasure(pfr->hdcTarget, this, SC_TECHNOLOGY_DEFAULT); + if (!surfaceMeasure) { + return 0; + } + return view.FormatRange(draw, pfr, surface, surfaceMeasure, *this, vs); +} + +int Editor::TextWidth(int style, const char *text) { + RefreshStyleData(); + AutoSurface surface(this); + if (surface) { + return static_cast(surface->WidthText(vs.styles[style].font, text, istrlen(text))); + } else { + return 1; + } +} + +// Empty method is overridden on GTK+ to show / hide scrollbars +void Editor::ReconfigureScrollBars() {} + +void Editor::SetScrollBars() { + RefreshStyleData(); + + int nMax = MaxScrollPos(); + int nPage = LinesOnScreen(); + bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); + if (modified) { + DwellEnd(true); + } + + // TODO: ensure always showing as many lines as possible + // May not be, if, for example, window made larger + if (topLine > MaxScrollPos()) { + SetTopLine(Platform::Clamp(topLine, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + if (modified) { + if (!AbandonPaint()) + Redraw(); + } + //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage); +} + +void Editor::ChangeSize() { + DropGraphics(false); + SetScrollBars(); + if (Wrapping()) { + PRectangle rcTextArea = GetClientRectangle(); + rcTextArea.left = static_cast(vs.textStart); + rcTextArea.right -= vs.rightMarginWidth; + if (wrapWidth != rcTextArea.Width()) { + NeedWrapping(); + Redraw(); + } + } +} + +int Editor::InsertSpace(int position, unsigned int spaces) { + if (spaces > 0) { + std::string spaceText(spaces, ' '); + const int lengthInserted = pdoc->InsertString(position, spaceText.c_str(), spaces); + position += lengthInserted; + } + return position; +} + +void Editor::AddChar(char ch) { + char s[2]; + s[0] = ch; + s[1] = '\0'; + AddCharUTF(s, 1); +} + +void Editor::FilterSelections() { + if (!additionalSelectionTyping && (sel.Count() > 1)) { + SelectionRange rangeOnly = sel.RangeMain(); + InvalidateSelection(rangeOnly, true); + sel.SetSelection(rangeOnly); + } +} + +static bool cmpSelPtrs(const SelectionRange *a, const SelectionRange *b) { + return *a < *b; +} + +// AddCharUTF inserts an array of bytes which may or may not be in UTF-8. +void Editor::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) { + FilterSelections(); + { + UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike); + + // Vector elements point into selection in order to change selection. + std::vector selPtrs; + for (size_t r = 0; r < sel.Count(); r++) { + selPtrs.push_back(&sel.Range(r)); + } + // Order selections by position in document. + std::sort(selPtrs.begin(), selPtrs.end(), cmpSelPtrs); + + // Loop in reverse to avoid disturbing positions of selections yet to be processed. + for (std::vector::reverse_iterator rit = selPtrs.rbegin(); + rit != selPtrs.rend(); ++rit) { + SelectionRange *currentSel = *rit; + if (!RangeContainsProtected(currentSel->Start().Position(), + currentSel->End().Position())) { + int positionInsert = currentSel->Start().Position(); + if (!currentSel->Empty()) { + if (currentSel->Length()) { + pdoc->DeleteChars(positionInsert, currentSel->Length()); + currentSel->ClearVirtualSpace(); + } else { + // Range is all virtual so collapse to start of virtual space + currentSel->MinimizeVirtualSpace(); + } + } else if (inOverstrike) { + if (positionInsert < pdoc->Length()) { + if (!pdoc->IsPositionInLineEnd(positionInsert)) { + pdoc->DelChar(positionInsert); + currentSel->ClearVirtualSpace(); + } + } + } + positionInsert = InsertSpace(positionInsert, currentSel->caret.VirtualSpace()); + const int lengthInserted = pdoc->InsertString(positionInsert, s, len); + if (lengthInserted > 0) { + currentSel->caret.SetPosition(positionInsert + lengthInserted); + currentSel->anchor.SetPosition(positionInsert + lengthInserted); + } + currentSel->ClearVirtualSpace(); + // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information + if (Wrapping()) { + AutoSurface surface(this); + if (surface) { + if (WrapOneLine(surface, pdoc->LineFromPosition(positionInsert))) { + SetScrollBars(); + SetVerticalScrollPos(); + Redraw(); + } + } + } + } + } + } + if (Wrapping()) { + SetScrollBars(); + } + ThinRectangularRange(); + // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information + EnsureCaretVisible(); + // Avoid blinking during rapid typing: + ShowCaretAtCurrentPosition(); + if ((caretSticky == SC_CARETSTICKY_OFF) || + ((caretSticky == SC_CARETSTICKY_WHITESPACE) && !IsAllSpacesOrTabs(s, len))) { + SetLastXChosen(); + } + + if (treatAsDBCS) { + NotifyChar((static_cast(s[0]) << 8) | + static_cast(s[1])); + } else if (len > 0) { + int byte = static_cast(s[0]); + if ((byte < 0xC0) || (1 == len)) { + // Handles UTF-8 characters between 0x01 and 0x7F and single byte + // characters when not in UTF-8 mode. + // Also treats \0 and naked trail bytes 0x80 to 0xBF as valid + // characters representing themselves. + } else { + unsigned int utf32[1] = { 0 }; + UTF32FromUTF8(s, len, utf32, ELEMENTS(utf32)); + byte = utf32[0]; + } + NotifyChar(byte); + } + + if (recordingMacro) { + NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(s)); + } +} + +void Editor::FillVirtualSpace() { + const bool tmpOverstrike = inOverstrike; + inOverstrike = false; // not allow to be deleted twice. + AddCharUTF("", 0); + inOverstrike = tmpOverstrike; +} + +void Editor::InsertPaste(const char *text, int len) { + if (multiPasteMode == SC_MULTIPASTE_ONCE) { + SelectionPosition selStart = sel.Start(); + selStart = SelectionPosition(InsertSpace(selStart.Position(), selStart.VirtualSpace())); + const int lengthInserted = pdoc->InsertString(selStart.Position(), text, len); + if (lengthInserted > 0) { + SetEmptySelection(selStart.Position() + lengthInserted); + } + } else { + // SC_MULTIPASTE_EACH + for (size_t r=0; rDeleteChars(positionInsert, sel.Range(r).Length()); + sel.Range(r).ClearVirtualSpace(); + } else { + // Range is all virtual so collapse to start of virtual space + sel.Range(r).MinimizeVirtualSpace(); + } + } + positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); + const int lengthInserted = pdoc->InsertString(positionInsert, text, len); + if (lengthInserted > 0) { + sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); + sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); + } + sel.Range(r).ClearVirtualSpace(); + } + } + } +} + +void Editor::InsertPasteShape(const char *text, int len, PasteShape shape) { + std::string convertedText; + if (convertPastes) { + // Convert line endings of the paste into our local line-endings mode + convertedText = Document::TransformLineEnds(text, len, pdoc->eolMode); + len = static_cast(convertedText.length()); + text = convertedText.c_str(); + } + if (shape == pasteRectangular) { + PasteRectangular(sel.Start(), text, len); + } else { + if (shape == pasteLine) { + int insertPos = pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())); + int lengthInserted = pdoc->InsertString(insertPos, text, len); + // add the newline if necessary + if ((len > 0) && (text[len - 1] != '\n' && text[len - 1] != '\r')) { + const char *endline = StringFromEOLMode(pdoc->eolMode); + int length = static_cast(strlen(endline)); + lengthInserted += pdoc->InsertString(insertPos + lengthInserted, endline, length); + } + if (sel.MainCaret() == insertPos) { + SetEmptySelection(sel.MainCaret() + lengthInserted); + } + } else { + InsertPaste(text, len); + } + } +} + +void Editor::ClearSelection(bool retainMultipleSelections) { + if (!sel.IsRectangular() && !retainMultipleSelections) + FilterSelections(); + UndoGroup ug(pdoc); + for (size_t r=0; rDeleteChars(sel.Range(r).Start().Position(), + sel.Range(r).Length()); + sel.Range(r) = SelectionRange(sel.Range(r).Start()); + } + } + } + ThinRectangularRange(); + sel.RemoveDuplicates(); + ClaimSelection(); + SetHoverIndicatorPosition(sel.MainCaret()); +} + +void Editor::ClearAll() { + { + UndoGroup ug(pdoc); + if (0 != pdoc->Length()) { + pdoc->DeleteChars(0, pdoc->Length()); + } + if (!pdoc->IsReadOnly()) { + cs.Clear(); + pdoc->AnnotationClearAll(); + pdoc->MarginClearAll(); + } + } + + view.ClearAllTabstops(); + + sel.Clear(); + SetTopLine(0); + SetVerticalScrollPos(); + InvalidateStyleRedraw(); +} + +void Editor::ClearDocumentStyle() { + Decoration *deco = pdoc->decorations.root; + while (deco) { + // Save next in case deco deleted + Decoration *decoNext = deco->next; + if (deco->indicator < INDIC_CONTAINER) { + pdoc->decorations.SetCurrentIndicator(deco->indicator); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); + } + deco = decoNext; + } + pdoc->StartStyling(0, '\377'); + pdoc->SetStyleFor(pdoc->Length(), 0); + cs.ShowAll(); + SetAnnotationHeights(0, pdoc->LinesTotal()); + pdoc->ClearLevels(); +} + +void Editor::CopyAllowLine() { + SelectionText selectedText; + CopySelectionRange(&selectedText, true); + CopyToClipboard(selectedText); +} + +void Editor::Cut() { + pdoc->CheckReadOnly(); + if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) { + Copy(); + ClearSelection(); + } +} + +void Editor::PasteRectangular(SelectionPosition pos, const char *ptr, int len) { + if (pdoc->IsReadOnly() || SelectionContainsProtected()) { + return; + } + sel.Clear(); + sel.RangeMain() = SelectionRange(pos); + int line = pdoc->LineFromPosition(sel.MainCaret()); + UndoGroup ug(pdoc); + sel.RangeMain().caret = SelectionPosition( + InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace())); + int xInsert = XFromPosition(sel.RangeMain().caret); + bool prevCr = false; + while ((len > 0) && IsEOLChar(ptr[len-1])) + len--; + for (int i = 0; i < len; i++) { + if (IsEOLChar(ptr[i])) { + if ((ptr[i] == '\r') || (!prevCr)) + line++; + if (line >= pdoc->LinesTotal()) { + if (pdoc->eolMode != SC_EOL_LF) + pdoc->InsertString(pdoc->Length(), "\r", 1); + if (pdoc->eolMode != SC_EOL_CR) + pdoc->InsertString(pdoc->Length(), "\n", 1); + } + // Pad the end of lines with spaces if required + sel.RangeMain().caret.SetPosition(PositionFromLineX(line, xInsert)); + if ((XFromPosition(sel.MainCaret()) < xInsert) && (i + 1 < len)) { + while (XFromPosition(sel.MainCaret()) < xInsert) { + const int lengthInserted = pdoc->InsertString(sel.MainCaret(), " ", 1); + sel.RangeMain().caret.Add(lengthInserted); + } + } + prevCr = ptr[i] == '\r'; + } else { + const int lengthInserted = pdoc->InsertString(sel.MainCaret(), ptr + i, 1); + sel.RangeMain().caret.Add(lengthInserted); + prevCr = false; + } + } + SetEmptySelection(pos); +} + +bool Editor::CanPaste() { + return !pdoc->IsReadOnly() && !SelectionContainsProtected(); +} + +void Editor::Clear() { + // If multiple selections, don't delete EOLS + if (sel.Empty()) { + bool singleVirtual = false; + if ((sel.Count() == 1) && + !RangeContainsProtected(sel.MainCaret(), sel.MainCaret() + 1) && + sel.RangeMain().Start().VirtualSpace()) { + singleVirtual = true; + } + UndoGroup ug(pdoc, (sel.Count() > 1) || singleVirtual); + for (size_t r=0; rIsPositionInLineEnd(sel.Range(r).caret.Position())) { + pdoc->DelChar(sel.Range(r).caret.Position()); + sel.Range(r).ClearVirtualSpace(); + } // else multiple selection so don't eat line ends + } else { + sel.Range(r).ClearVirtualSpace(); + } + } + } else { + ClearSelection(); + } + sel.RemoveDuplicates(); + ShowCaretAtCurrentPosition(); // Avoid blinking +} + +void Editor::SelectAll() { + sel.Clear(); + SetSelection(0, pdoc->Length()); + Redraw(); +} + +void Editor::Undo() { + if (pdoc->CanUndo()) { + InvalidateCaret(); + int newPos = pdoc->Undo(); + if (newPos >= 0) + SetEmptySelection(newPos); + EnsureCaretVisible(); + } +} + +void Editor::Redo() { + if (pdoc->CanRedo()) { + int newPos = pdoc->Redo(); + if (newPos >= 0) + SetEmptySelection(newPos); + EnsureCaretVisible(); + } +} + +void Editor::DelCharBack(bool allowLineStartDeletion) { + RefreshStyleData(); + if (!sel.IsRectangular()) + FilterSelections(); + if (sel.IsRectangular()) + allowLineStartDeletion = false; + UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty()); + if (sel.Empty()) { + for (size_t r=0; rLineFromPosition(sel.Range(r).caret.Position()); + if (allowLineStartDeletion || (pdoc->LineStart(lineCurrentPos) != sel.Range(r).caret.Position())) { + if (pdoc->GetColumn(sel.Range(r).caret.Position()) <= pdoc->GetLineIndentation(lineCurrentPos) && + pdoc->GetColumn(sel.Range(r).caret.Position()) > 0 && pdoc->backspaceUnindents) { + UndoGroup ugInner(pdoc, !ug.Needed()); + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); + int indentationChange = indentation % indentationStep; + if (indentationChange == 0) + indentationChange = indentationStep; + const int posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationChange); + // SetEmptySelection + sel.Range(r) = SelectionRange(posSelect); + } else { + pdoc->DelCharBack(sel.Range(r).caret.Position()); + } + } + } + } else { + sel.Range(r).ClearVirtualSpace(); + } + } + ThinRectangularRange(); + } else { + ClearSelection(); + } + sel.RemoveDuplicates(); + ContainerNeedsUpdate(SC_UPDATE_SELECTION); + // Avoid blinking during rapid typing: + ShowCaretAtCurrentPosition(); +} + +int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta) { + return + (shift ? SCI_SHIFT : 0) | + (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0) | + (meta ? SCI_META : 0); +} + +void Editor::NotifyFocus(bool focus) { + SCNotification scn = {}; + scn.nmhdr.code = focus ? SCN_FOCUSIN : SCN_FOCUSOUT; + NotifyParent(scn); +} + +void Editor::SetCtrlID(int identifier) { + ctrlID = identifier; +} + +void Editor::NotifyStyleToNeeded(int endStyleNeeded) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_STYLENEEDED; + scn.position = endStyleNeeded; + NotifyParent(scn); +} + +void Editor::NotifyStyleNeeded(Document *, void *, int endStyleNeeded) { + NotifyStyleToNeeded(endStyleNeeded); +} + +void Editor::NotifyLexerChanged(Document *, void *) { +} + +void Editor::NotifyErrorOccurred(Document *, void *, int status) { + errorStatus = status; +} + +void Editor::NotifyChar(int ch) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_CHARADDED; + scn.ch = ch; + NotifyParent(scn); +} + +void Editor::NotifySavePoint(bool isSavePoint) { + SCNotification scn = {}; + if (isSavePoint) { + scn.nmhdr.code = SCN_SAVEPOINTREACHED; + } else { + scn.nmhdr.code = SCN_SAVEPOINTLEFT; + } + NotifyParent(scn); +} + +void Editor::NotifyModifyAttempt() { + SCNotification scn = {}; + scn.nmhdr.code = SCN_MODIFYATTEMPTRO; + NotifyParent(scn); +} + +void Editor::NotifyDoubleClick(Point pt, int modifiers) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_DOUBLECLICK; + scn.line = LineFromLocation(pt); + scn.position = PositionFromLocation(pt, true); + scn.modifiers = modifiers; + NotifyParent(scn); +} + +void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { + NotifyDoubleClick(pt, ModifierFlags(shift, ctrl, alt)); +} + +void Editor::NotifyHotSpotDoubleClicked(int position, int modifiers) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; + scn.position = position; + scn.modifiers = modifiers; + NotifyParent(scn); +} + +void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) { + NotifyHotSpotDoubleClicked(position, ModifierFlags(shift, ctrl, alt)); +} + +void Editor::NotifyHotSpotClicked(int position, int modifiers) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_HOTSPOTCLICK; + scn.position = position; + scn.modifiers = modifiers; + NotifyParent(scn); +} + +void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) { + NotifyHotSpotClicked(position, ModifierFlags(shift, ctrl, alt)); +} + +void Editor::NotifyHotSpotReleaseClick(int position, int modifiers) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_HOTSPOTRELEASECLICK; + scn.position = position; + scn.modifiers = modifiers; + NotifyParent(scn); +} + +void Editor::NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt) { + NotifyHotSpotReleaseClick(position, ModifierFlags(shift, ctrl, alt)); +} + +bool Editor::NotifyUpdateUI() { + if (needUpdateUI) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_UPDATEUI; + scn.updated = needUpdateUI; + NotifyParent(scn); + needUpdateUI = 0; + return true; + } + return false; +} + +void Editor::NotifyPainted() { + SCNotification scn = {}; + scn.nmhdr.code = SCN_PAINTED; + NotifyParent(scn); +} + +void Editor::NotifyIndicatorClick(bool click, int position, int modifiers) { + int mask = pdoc->decorations.AllOnFor(position); + if ((click && mask) || pdoc->decorations.clickNotified) { + SCNotification scn = {}; + pdoc->decorations.clickNotified = click; + scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE; + scn.modifiers = modifiers; + scn.position = position; + NotifyParent(scn); + } +} + +void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) { + NotifyIndicatorClick(click, position, ModifierFlags(shift, ctrl, alt)); +} + +bool Editor::NotifyMarginClick(Point pt, int modifiers) { + int marginClicked = -1; + int x = vs.textStart - vs.fixedColumnWidth; + for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { + if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width)) + marginClicked = margin; + x += vs.ms[margin].width; + } + if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { + int position = pdoc->LineStart(LineFromLocation(pt)); + if ((vs.ms[marginClicked].mask & SC_MASK_FOLDERS) && (foldAutomatic & SC_AUTOMATICFOLD_CLICK)) { + const bool ctrl = (modifiers & SCI_CTRL) != 0; + const bool shift = (modifiers & SCI_SHIFT) != 0; + int lineClick = pdoc->LineFromPosition(position); + if (shift && ctrl) { + FoldAll(SC_FOLDACTION_TOGGLE); + } else { + int levelClick = pdoc->GetLevel(lineClick); + if (levelClick & SC_FOLDLEVELHEADERFLAG) { + if (shift) { + // Ensure all children visible + FoldExpand(lineClick, SC_FOLDACTION_EXPAND, levelClick); + } else if (ctrl) { + FoldExpand(lineClick, SC_FOLDACTION_TOGGLE, levelClick); + } else { + // Toggle this line + FoldLine(lineClick, SC_FOLDACTION_TOGGLE); + } + } + } + return true; + } + SCNotification scn = {}; + scn.nmhdr.code = SCN_MARGINCLICK; + scn.modifiers = modifiers; + scn.position = position; + scn.margin = marginClicked; + NotifyParent(scn); + return true; + } else { + return false; + } +} + +bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { + return NotifyMarginClick(pt, ModifierFlags(shift, ctrl, alt)); +} + +void Editor::NotifyNeedShown(int pos, int len) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_NEEDSHOWN; + scn.position = pos; + scn.length = len; + NotifyParent(scn); +} + +void Editor::NotifyDwelling(Point pt, bool state) { + SCNotification scn = {}; + scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND; + scn.position = PositionFromLocation(pt, true); + scn.x = static_cast(pt.x + vs.ExternalMarginWidth()); + scn.y = static_cast(pt.y); + NotifyParent(scn); +} + +void Editor::NotifyZoom() { + SCNotification scn = {}; + scn.nmhdr.code = SCN_ZOOM; + NotifyParent(scn); +} + +// Notifications from document +void Editor::NotifyModifyAttempt(Document *, void *) { + //Platform::DebugPrintf("** Modify Attempt\n"); + NotifyModifyAttempt(); +} + +void Editor::NotifySavePoint(Document *, void *, bool atSavePoint) { + //Platform::DebugPrintf("** Save Point %s\n", atSavePoint ? "On" : "Off"); + NotifySavePoint(atSavePoint); +} + +void Editor::CheckModificationForWrap(DocModification mh) { + if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { + view.llc.Invalidate(LineLayout::llCheckTextAndStyle); + int lineDoc = pdoc->LineFromPosition(mh.position); + int lines = Platform::Maximum(0, mh.linesAdded); + if (Wrapping()) { + NeedWrapping(lineDoc, lineDoc + lines + 1); + } + RefreshStyleData(); + // Fix up annotation heights + SetAnnotationHeights(lineDoc, lineDoc + lines + 2); + } +} + +// Move a position so it is still after the same character as before the insertion. +static inline int MovePositionForInsertion(int position, int startInsertion, int length) { + if (position > startInsertion) { + return position + length; + } + return position; +} + +// Move a position so it is still after the same character as before the deletion if that +// character is still present else after the previous surviving character. +static inline int MovePositionForDeletion(int position, int startDeletion, int length) { + if (position > startDeletion) { + int endDeletion = startDeletion + length; + if (position > endDeletion) { + return position - length; + } else { + return startDeletion; + } + } else { + return position; + } +} + +void Editor::NotifyModified(Document *, DocModification mh, void *) { + ContainerNeedsUpdate(SC_UPDATE_CONTENT); + if (paintState == painting) { + CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); + } + if (mh.modificationType & SC_MOD_CHANGELINESTATE) { + if (paintState == painting) { + CheckForChangeOutsidePaint( + Range(pdoc->LineStart(mh.line), pdoc->LineStart(mh.line + 1))); + } else { + // Could check that change is before last visible line. + Redraw(); + } + } + if (mh.modificationType & SC_MOD_CHANGETABSTOPS) { + Redraw(); + } + if (mh.modificationType & SC_MOD_LEXERSTATE) { + if (paintState == painting) { + CheckForChangeOutsidePaint( + Range(mh.position, mh.position + mh.length)); + } else { + Redraw(); + } + } + if (mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) { + if (mh.modificationType & SC_MOD_CHANGESTYLE) { + pdoc->IncrementStyleClock(); + } + if (paintState == notPainting) { + if (mh.position < pdoc->LineStart(topLine)) { + // Styling performed before this view + Redraw(); + } else { + InvalidateRange(mh.position, mh.position + mh.length); + } + } + if (mh.modificationType & SC_MOD_CHANGESTYLE) { + view.llc.Invalidate(LineLayout::llCheckTextAndStyle); + } + } else { + // Move selection and brace highlights + if (mh.modificationType & SC_MOD_INSERTTEXT) { + sel.MovePositions(true, mh.position, mh.length); + braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length); + braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length); + } else if (mh.modificationType & SC_MOD_DELETETEXT) { + sel.MovePositions(false, mh.position, mh.length); + braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length); + braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length); + } + if ((mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) && cs.HiddenLines()) { + // Some lines are hidden so may need shown. + // TODO: check if the modified area is hidden. + if (mh.modificationType & SC_MOD_BEFOREINSERT) { + int lineOfPos = pdoc->LineFromPosition(mh.position); + bool insertingNewLine = false; + for (int i=0; i < mh.length; i++) { + if ((mh.text[i] == '\n') || (mh.text[i] == '\r')) + insertingNewLine = true; + } + if (insertingNewLine && (mh.position != pdoc->LineStart(lineOfPos))) + NeedShown(mh.position, pdoc->LineStart(lineOfPos+1) - mh.position); + else + NeedShown(mh.position, 0); + } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { + NeedShown(mh.position, mh.length); + } + } + if (mh.linesAdded != 0) { + // Update contraction state for inserted and removed lines + // lineOfPos should be calculated in context of state before modification, shouldn't it + int lineOfPos = pdoc->LineFromPosition(mh.position); + if (mh.position > pdoc->LineStart(lineOfPos)) + lineOfPos++; // Affecting subsequent lines + if (mh.linesAdded > 0) { + cs.InsertLines(lineOfPos, mh.linesAdded); + } else { + cs.DeleteLines(lineOfPos, -mh.linesAdded); + } + view.LinesAddedOrRemoved(lineOfPos, mh.linesAdded); + } + if (mh.modificationType & SC_MOD_CHANGEANNOTATION) { + int lineDoc = pdoc->LineFromPosition(mh.position); + if (vs.annotationVisible) { + cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded); + Redraw(); + } + } + CheckModificationForWrap(mh); + if (mh.linesAdded != 0) { + // Avoid scrolling of display if change before current display + if (mh.position < posTopLine && !CanDeferToLastStep(mh)) { + int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); + if (newTop != topLine) { + SetTopLine(newTop); + SetVerticalScrollPos(); + } + } + + if (paintState == notPainting && !CanDeferToLastStep(mh)) { + QueueIdleWork(WorkNeeded::workStyle, pdoc->Length()); + Redraw(); + } + } else { + if (paintState == notPainting && mh.length && !CanEliminate(mh)) { + QueueIdleWork(WorkNeeded::workStyle, mh.position + mh.length); + InvalidateRange(mh.position, mh.position + mh.length); + } + } + } + + if (mh.linesAdded != 0 && !CanDeferToLastStep(mh)) { + SetScrollBars(); + } + + if ((mh.modificationType & SC_MOD_CHANGEMARKER) || (mh.modificationType & SC_MOD_CHANGEMARGIN)) { + if ((!willRedrawAll) && ((paintState == notPainting) || !PaintContainsMargin())) { + if (mh.modificationType & SC_MOD_CHANGEFOLD) { + // Fold changes can affect the drawing of following lines so redraw whole margin + RedrawSelMargin(marginView.highlightDelimiter.isEnabled ? -1 : mh.line - 1, true); + } else { + RedrawSelMargin(mh.line); + } + } + } + if ((mh.modificationType & SC_MOD_CHANGEFOLD) && (foldAutomatic & SC_AUTOMATICFOLD_CHANGE)) { + FoldChanged(mh.line, mh.foldLevelNow, mh.foldLevelPrev); + } + + // NOW pay the piper WRT "deferred" visual updates + if (IsLastStep(mh)) { + SetScrollBars(); + Redraw(); + } + + // If client wants to see this modification + if (mh.modificationType & modEventMask) { + if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { + // Real modification made to text of document. + NotifyChange(); // Send EN_CHANGE + } + + SCNotification scn = {}; + scn.nmhdr.code = SCN_MODIFIED; + scn.position = mh.position; + scn.modificationType = mh.modificationType; + scn.text = mh.text; + scn.length = mh.length; + scn.linesAdded = mh.linesAdded; + scn.line = mh.line; + scn.foldLevelNow = mh.foldLevelNow; + scn.foldLevelPrev = mh.foldLevelPrev; + scn.token = mh.token; + scn.annotationLinesAdded = mh.annotationLinesAdded; + NotifyParent(scn); + } +} + +void Editor::NotifyDeleted(Document *, void *) { + /* Do nothing */ +} + +void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + + // Enumerates all macroable messages + switch (iMessage) { + case SCI_CUT: + case SCI_COPY: + case SCI_PASTE: + case SCI_CLEAR: + case SCI_REPLACESEL: + case SCI_ADDTEXT: + case SCI_INSERTTEXT: + case SCI_APPENDTEXT: + case SCI_CLEARALL: + case SCI_SELECTALL: + case SCI_GOTOLINE: + case SCI_GOTOPOS: + case SCI_SEARCHANCHOR: + case SCI_SEARCHNEXT: + case SCI_SEARCHPREV: + case SCI_LINEDOWN: + case SCI_LINEDOWNEXTEND: + case SCI_PARADOWN: + case SCI_PARADOWNEXTEND: + case SCI_LINEUP: + case SCI_LINEUPEXTEND: + case SCI_PARAUP: + case SCI_PARAUPEXTEND: + case SCI_CHARLEFT: + case SCI_CHARLEFTEXTEND: + case SCI_CHARRIGHT: + case SCI_CHARRIGHTEXTEND: + case SCI_WORDLEFT: + case SCI_WORDLEFTEXTEND: + case SCI_WORDRIGHT: + case SCI_WORDRIGHTEXTEND: + case SCI_WORDPARTLEFT: + case SCI_WORDPARTLEFTEXTEND: + case SCI_WORDPARTRIGHT: + case SCI_WORDPARTRIGHTEXTEND: + case SCI_WORDLEFTEND: + case SCI_WORDLEFTENDEXTEND: + case SCI_WORDRIGHTEND: + case SCI_WORDRIGHTENDEXTEND: + case SCI_HOME: + case SCI_HOMEEXTEND: + case SCI_LINEEND: + case SCI_LINEENDEXTEND: + case SCI_HOMEWRAP: + case SCI_HOMEWRAPEXTEND: + case SCI_LINEENDWRAP: + case SCI_LINEENDWRAPEXTEND: + case SCI_DOCUMENTSTART: + case SCI_DOCUMENTSTARTEXTEND: + case SCI_DOCUMENTEND: + case SCI_DOCUMENTENDEXTEND: + case SCI_STUTTEREDPAGEUP: + case SCI_STUTTEREDPAGEUPEXTEND: + case SCI_STUTTEREDPAGEDOWN: + case SCI_STUTTEREDPAGEDOWNEXTEND: + case SCI_PAGEUP: + case SCI_PAGEUPEXTEND: + case SCI_PAGEDOWN: + case SCI_PAGEDOWNEXTEND: + case SCI_EDITTOGGLEOVERTYPE: + case SCI_CANCEL: + case SCI_DELETEBACK: + case SCI_TAB: + case SCI_BACKTAB: + case SCI_FORMFEED: + case SCI_VCHOME: + case SCI_VCHOMEEXTEND: + case SCI_VCHOMEWRAP: + case SCI_VCHOMEWRAPEXTEND: + case SCI_VCHOMEDISPLAY: + case SCI_VCHOMEDISPLAYEXTEND: + case SCI_DELWORDLEFT: + case SCI_DELWORDRIGHT: + case SCI_DELWORDRIGHTEND: + case SCI_DELLINELEFT: + case SCI_DELLINERIGHT: + case SCI_LINECOPY: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: + case SCI_LINESCROLLDOWN: + case SCI_LINESCROLLUP: + case SCI_DELETEBACKNOTLINE: + case SCI_HOMEDISPLAY: + case SCI_HOMEDISPLAYEXTEND: + case SCI_LINEENDDISPLAY: + case SCI_LINEENDDISPLAYEXTEND: + case SCI_SETSELECTIONMODE: + case SCI_LINEDOWNRECTEXTEND: + case SCI_LINEUPRECTEXTEND: + case SCI_CHARLEFTRECTEXTEND: + case SCI_CHARRIGHTRECTEXTEND: + case SCI_HOMERECTEXTEND: + case SCI_VCHOMERECTEXTEND: + case SCI_LINEENDRECTEXTEND: + case SCI_PAGEUPRECTEXTEND: + case SCI_PAGEDOWNRECTEXTEND: + case SCI_SELECTIONDUPLICATE: + case SCI_COPYALLOWLINE: + case SCI_VERTICALCENTRECARET: + case SCI_MOVESELECTEDLINESUP: + case SCI_MOVESELECTEDLINESDOWN: + case SCI_SCROLLTOSTART: + case SCI_SCROLLTOEND: + break; + + // Filter out all others like display changes. Also, newlines are redundant + // with char insert messages. + case SCI_NEWLINE: + default: + // printf("Filtered out %ld of macro recording\n", iMessage); + return; + } + + // Send notification + SCNotification scn = {}; + scn.nmhdr.code = SCN_MACRORECORD; + scn.message = iMessage; + scn.wParam = wParam; + scn.lParam = lParam; + NotifyParent(scn); +} + +// Something has changed that the container should know about +void Editor::ContainerNeedsUpdate(int flags) { + needUpdateUI |= flags; +} + +/** + * Force scroll and keep position relative to top of window. + * + * If stuttered = true and not already at first/last row, move to first/last row of window. + * If stuttered = true and already at first/last row, scroll as normal. + */ +void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { + int topLineNew; + SelectionPosition newPos; + + int currentLine = pdoc->LineFromPosition(sel.MainCaret()); + int topStutterLine = topLine + caretYSlop; + int bottomStutterLine = + pdoc->LineFromPosition(PositionFromLocation( + Point::FromInts(lastXChosen - xOffset, direction * vs.lineHeight * LinesToScroll()))) + - caretYSlop - 1; + + if (stuttered && (direction < 0 && currentLine > topStutterLine)) { + topLineNew = topLine; + newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * caretYSlop), + false, false, UserVirtualSpace()); + + } else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) { + topLineNew = topLine; + newPos = SPositionFromLocation(Point::FromInts(lastXChosen - xOffset, vs.lineHeight * (LinesToScroll() - caretYSlop)), + false, false, UserVirtualSpace()); + + } else { + Point pt = LocationFromPosition(sel.MainCaret()); + + topLineNew = Platform::Clamp( + topLine + direction * LinesToScroll(), 0, MaxScrollPos()); + newPos = SPositionFromLocation( + Point::FromInts(lastXChosen - xOffset, static_cast(pt.y) + direction * (vs.lineHeight * LinesToScroll())), + false, false, UserVirtualSpace()); + } + + if (topLineNew != topLine) { + SetTopLine(topLineNew); + MovePositionTo(newPos, selt); + Redraw(); + SetVerticalScrollPos(); + } else { + MovePositionTo(newPos, selt); + } +} + +void Editor::ChangeCaseOfSelection(int caseMapping) { + UndoGroup ug(pdoc); + for (size_t r=0; r 0) { + std::string sText = RangeText(currentNoVS.Start().Position(), currentNoVS.End().Position()); + + std::string sMapped = CaseMapString(sText, caseMapping); + + if (sMapped != sText) { + size_t firstDifference = 0; + while (sMapped[firstDifference] == sText[firstDifference]) + firstDifference++; + size_t lastDifferenceText = sText.size() - 1; + size_t lastDifferenceMapped = sMapped.size() - 1; + while (sMapped[lastDifferenceMapped] == sText[lastDifferenceText]) { + lastDifferenceText--; + lastDifferenceMapped--; + } + size_t endDifferenceText = sText.size() - 1 - lastDifferenceText; + pdoc->DeleteChars( + static_cast(currentNoVS.Start().Position() + firstDifference), + static_cast(rangeBytes - firstDifference - endDifferenceText)); + const int lengthChange = static_cast(lastDifferenceMapped - firstDifference + 1); + const int lengthInserted = pdoc->InsertString( + static_cast(currentNoVS.Start().Position() + firstDifference), + sMapped.c_str() + firstDifference, + lengthChange); + // Automatic movement changes selection so reset to exactly the same as it was. + int diffSizes = static_cast(sMapped.size() - sText.size()) + lengthInserted - lengthChange; + if (diffSizes != 0) { + if (current.anchor > current.caret) + current.anchor.Add(diffSizes); + else + current.caret.Add(diffSizes); + } + sel.Range(r) = current; + } + } + } +} + +void Editor::LineTranspose() { + int line = pdoc->LineFromPosition(sel.MainCaret()); + if (line > 0) { + UndoGroup ug(pdoc); + + const int startPrevious = pdoc->LineStart(line - 1); + const std::string linePrevious = RangeText(startPrevious, pdoc->LineEnd(line - 1)); + + int startCurrent = pdoc->LineStart(line); + const std::string lineCurrent = RangeText(startCurrent, pdoc->LineEnd(line)); + + pdoc->DeleteChars(startCurrent, static_cast(lineCurrent.length())); + pdoc->DeleteChars(startPrevious, static_cast(linePrevious.length())); + startCurrent -= static_cast(linePrevious.length()); + + startCurrent += pdoc->InsertString(startPrevious, lineCurrent.c_str(), + static_cast(lineCurrent.length())); + pdoc->InsertString(startCurrent, linePrevious.c_str(), + static_cast(linePrevious.length())); + // Move caret to start of current line + MovePositionTo(SelectionPosition(startCurrent)); + } +} + +void Editor::Duplicate(bool forLine) { + if (sel.Empty()) { + forLine = true; + } + UndoGroup ug(pdoc); + const char *eol = ""; + int eolLen = 0; + if (forLine) { + eol = StringFromEOLMode(pdoc->eolMode); + eolLen = istrlen(eol); + } + for (size_t r=0; rLineFromPosition(sel.Range(r).caret.Position()); + start = SelectionPosition(pdoc->LineStart(line)); + end = SelectionPosition(pdoc->LineEnd(line)); + } + std::string text = RangeText(start.Position(), end.Position()); + int lengthInserted = eolLen; + if (forLine) + lengthInserted = pdoc->InsertString(end.Position(), eol, eolLen); + pdoc->InsertString(end.Position() + lengthInserted, text.c_str(), static_cast(text.length())); + } + if (sel.Count() && sel.IsRectangular()) { + SelectionPosition last = sel.Last(); + if (forLine) { + int line = pdoc->LineFromPosition(last.Position()); + last = SelectionPosition(last.Position() + pdoc->LineStart(line+1) - pdoc->LineStart(line)); + } + if (sel.Rectangular().anchor > sel.Rectangular().caret) + sel.Rectangular().anchor = last; + else + sel.Rectangular().caret = last; + SetRectangularRange(); + } +} + +void Editor::CancelModes() { + sel.SetMoveExtends(false); +} + +void Editor::NewLine() { + // Remove non-main ranges + InvalidateSelection(sel.RangeMain(), true); + sel.SetSelection(sel.RangeMain()); + sel.RangeMain().ClearVirtualSpace(); + + // Clear main range and insert line end + bool needGroupUndo = !sel.Empty(); + if (needGroupUndo) + pdoc->BeginUndoAction(); + + if (!sel.Empty()) + ClearSelection(); + const char *eol = "\n"; + if (pdoc->eolMode == SC_EOL_CRLF) { + eol = "\r\n"; + } else if (pdoc->eolMode == SC_EOL_CR) { + eol = "\r"; + } // else SC_EOL_LF -> "\n" already set + const int insertLength = pdoc->InsertString(sel.MainCaret(), eol, istrlen(eol)); + // Want to end undo group before NotifyChar as applications often modify text here + if (needGroupUndo) + pdoc->EndUndoAction(); + if (insertLength > 0) { + SetEmptySelection(sel.MainCaret() + insertLength); + while (*eol) { + NotifyChar(*eol); + if (recordingMacro) { + char txt[2]; + txt[0] = *eol; + txt[1] = '\0'; + NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(txt)); + } + eol++; + } + } + SetLastXChosen(); + SetScrollBars(); + EnsureCaretVisible(); + // Avoid blinking during rapid typing: + ShowCaretAtCurrentPosition(); +} + +void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { + SelectionPosition caretToUse = sel.Range(sel.Main()).caret; + if (sel.IsRectangular()) { + if (selt == Selection::noSel) { + caretToUse = (direction > 0) ? sel.Limits().end : sel.Limits().start; + } else { + caretToUse = sel.Rectangular().caret; + } + } + + Point pt = LocationFromPosition(caretToUse); + int skipLines = 0; + + if (vs.annotationVisible) { + int lineDoc = pdoc->LineFromPosition(caretToUse.Position()); + Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc)); + int subLine = static_cast(pt.y - ptStartLine.y) / vs.lineHeight; + + if (direction < 0 && subLine == 0) { + int lineDisplay = cs.DisplayFromDoc(lineDoc); + if (lineDisplay > 0) { + skipLines = pdoc->AnnotationLines(cs.DocFromDisplay(lineDisplay - 1)); + } + } else if (direction > 0 && subLine >= (cs.GetHeight(lineDoc) - 1 - pdoc->AnnotationLines(lineDoc))) { + skipLines = pdoc->AnnotationLines(lineDoc); + } + } + + int newY = static_cast(pt.y) + (1 + skipLines) * direction * vs.lineHeight; + SelectionPosition posNew = SPositionFromLocation( + Point::FromInts(lastXChosen - xOffset, newY), false, false, UserVirtualSpace()); + + if (direction < 0) { + // Line wrapping may lead to a location on the same line, so + // seek back if that is the case. + Point ptNew = LocationFromPosition(posNew.Position()); + while ((posNew.Position() > 0) && (pt.y == ptNew.y)) { + posNew.Add(-1); + posNew.SetVirtualSpace(0); + ptNew = LocationFromPosition(posNew.Position()); + } + } else if (direction > 0 && posNew.Position() != pdoc->Length()) { + // There is an equivalent case when moving down which skips + // over a line. + Point ptNew = LocationFromPosition(posNew.Position()); + while ((posNew.Position() > caretToUse.Position()) && (ptNew.y > newY)) { + posNew.Add(-1); + posNew.SetVirtualSpace(0); + ptNew = LocationFromPosition(posNew.Position()); + } + } + + MovePositionTo(MovePositionSoVisible(posNew, direction), selt); +} + +void Editor::ParaUpOrDown(int direction, Selection::selTypes selt) { + int lineDoc, savedPos = sel.MainCaret(); + do { + MovePositionTo(SelectionPosition(direction > 0 ? pdoc->ParaDown(sel.MainCaret()) : pdoc->ParaUp(sel.MainCaret())), selt); + lineDoc = pdoc->LineFromPosition(sel.MainCaret()); + if (direction > 0) { + if (sel.MainCaret() >= pdoc->Length() && !cs.GetVisible(lineDoc)) { + if (selt == Selection::noSel) { + MovePositionTo(SelectionPosition(pdoc->LineEndPosition(savedPos))); + } + break; + } + } + } while (!cs.GetVisible(lineDoc)); +} + +int Editor::StartEndDisplayLine(int pos, bool start) { + RefreshStyleData(); + AutoSurface surface(this); + int posRet = view.StartEndDisplayLine(surface, *this, pos, start, vs); + if (posRet == INVALID_POSITION) { + return pos; + } else { + return posRet; + } +} + +int Editor::KeyCommand(unsigned int iMessage) { + switch (iMessage) { + case SCI_LINEDOWN: + CursorUpOrDown(1); + break; + case SCI_LINEDOWNEXTEND: + CursorUpOrDown(1, Selection::selStream); + break; + case SCI_LINEDOWNRECTEXTEND: + CursorUpOrDown(1, Selection::selRectangle); + break; + case SCI_PARADOWN: + ParaUpOrDown(1); + break; + case SCI_PARADOWNEXTEND: + ParaUpOrDown(1, Selection::selStream); + break; + case SCI_LINESCROLLDOWN: + ScrollTo(topLine + 1); + MoveCaretInsideView(false); + break; + case SCI_LINEUP: + CursorUpOrDown(-1); + break; + case SCI_LINEUPEXTEND: + CursorUpOrDown(-1, Selection::selStream); + break; + case SCI_LINEUPRECTEXTEND: + CursorUpOrDown(-1, Selection::selRectangle); + break; + case SCI_PARAUP: + ParaUpOrDown(-1); + break; + case SCI_PARAUPEXTEND: + ParaUpOrDown(-1, Selection::selStream); + break; + case SCI_LINESCROLLUP: + ScrollTo(topLine - 1); + MoveCaretInsideView(false); + break; + case SCI_CHARLEFT: + if (SelectionEmpty() || sel.MoveExtends()) { + if ((sel.Count() == 1) && pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); + MovePositionTo(spCaret); + } else if (sel.MoveExtends() && sel.selType == Selection::selStream) { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1)); + } else { + MovePositionTo(MovePositionSoVisible( + SelectionPosition((sel.LimitsForRectangularElseMain().start).Position() - 1), -1)); + } + } else { + MovePositionTo(sel.LimitsForRectangularElseMain().start); + } + SetLastXChosen(); + break; + case SCI_CHARLEFTEXTEND: + if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); + MovePositionTo(spCaret, Selection::selStream); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1), Selection::selStream); + } + SetLastXChosen(); + break; + case SCI_CHARLEFTRECTEXTEND: + if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); + MovePositionTo(spCaret, Selection::selRectangle); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1), Selection::selRectangle); + } + SetLastXChosen(); + break; + case SCI_CHARRIGHT: + if (SelectionEmpty() || sel.MoveExtends()) { + if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(sel.MainCaret())) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); + MovePositionTo(spCaret); + } else if (sel.MoveExtends() && sel.selType == Selection::selStream) { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1)); + } else { + MovePositionTo(MovePositionSoVisible( + SelectionPosition((sel.LimitsForRectangularElseMain().end).Position() + 1), 1)); + } + } else { + MovePositionTo(sel.LimitsForRectangularElseMain().end); + } + SetLastXChosen(); + break; + case SCI_CHARRIGHTEXTEND: + if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(sel.MainCaret())) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); + MovePositionTo(spCaret, Selection::selStream); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1), Selection::selStream); + } + SetLastXChosen(); + break; + case SCI_CHARRIGHTRECTEXTEND: + if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) && pdoc->IsLineEndPosition(sel.MainCaret())) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); + MovePositionTo(spCaret, Selection::selRectangle); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1), Selection::selRectangle); + } + SetLastXChosen(); + break; + case SCI_WORDLEFT: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), -1), -1)); + SetLastXChosen(); + break; + case SCI_WORDLEFTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), -1), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_WORDRIGHT: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), 1), 1)); + SetLastXChosen(); + break; + case SCI_WORDRIGHTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), 1), 1), Selection::selStream); + SetLastXChosen(); + break; + + case SCI_WORDLEFTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), -1), -1)); + SetLastXChosen(); + break; + case SCI_WORDLEFTENDEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), -1), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_WORDRIGHTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), 1), 1)); + SetLastXChosen(); + break; + case SCI_WORDRIGHTENDEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), 1), 1), Selection::selStream); + SetLastXChosen(); + break; + + case SCI_HOME: + MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret()))); + SetLastXChosen(); + break; + case SCI_HOMEEXTEND: + MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())), Selection::selStream); + SetLastXChosen(); + break; + case SCI_HOMERECTEXTEND: + MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())), Selection::selRectangle); + SetLastXChosen(); + break; + case SCI_LINEEND: + MovePositionTo(pdoc->LineEndPosition(sel.MainCaret())); + SetLastXChosen(); + break; + case SCI_LINEENDEXTEND: + MovePositionTo(pdoc->LineEndPosition(sel.MainCaret()), Selection::selStream); + SetLastXChosen(); + break; + case SCI_LINEENDRECTEXTEND: + MovePositionTo(pdoc->LineEndPosition(sel.MainCaret()), Selection::selRectangle); + SetLastXChosen(); + break; + case SCI_HOMEWRAP: { + SelectionPosition homePos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if (sel.RangeMain().caret <= homePos) + homePos = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret()))); + MovePositionTo(homePos); + SetLastXChosen(); + } + break; + case SCI_HOMEWRAPEXTEND: { + SelectionPosition homePos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if (sel.RangeMain().caret <= homePos) + homePos = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret()))); + MovePositionTo(homePos, Selection::selStream); + SetLastXChosen(); + } + break; + case SCI_LINEENDWRAP: { + SelectionPosition endPos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), false), 1); + SelectionPosition realEndPos = SelectionPosition(pdoc->LineEndPosition(sel.MainCaret())); + if (endPos > realEndPos // if moved past visible EOLs + || sel.RangeMain().caret >= endPos) // if at end of display line already + endPos = realEndPos; + MovePositionTo(endPos); + SetLastXChosen(); + } + break; + case SCI_LINEENDWRAPEXTEND: { + SelectionPosition endPos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), false), 1); + SelectionPosition realEndPos = SelectionPosition(pdoc->LineEndPosition(sel.MainCaret())); + if (endPos > realEndPos // if moved past visible EOLs + || sel.RangeMain().caret >= endPos) // if at end of display line already + endPos = realEndPos; + MovePositionTo(endPos, Selection::selStream); + SetLastXChosen(); + } + break; + case SCI_DOCUMENTSTART: + MovePositionTo(0); + SetLastXChosen(); + break; + case SCI_DOCUMENTSTARTEXTEND: + MovePositionTo(0, Selection::selStream); + SetLastXChosen(); + break; + case SCI_DOCUMENTEND: + MovePositionTo(pdoc->Length()); + SetLastXChosen(); + break; + case SCI_DOCUMENTENDEXTEND: + MovePositionTo(pdoc->Length(), Selection::selStream); + SetLastXChosen(); + break; + case SCI_STUTTEREDPAGEUP: + PageMove(-1, Selection::noSel, true); + break; + case SCI_STUTTEREDPAGEUPEXTEND: + PageMove(-1, Selection::selStream, true); + break; + case SCI_STUTTEREDPAGEDOWN: + PageMove(1, Selection::noSel, true); + break; + case SCI_STUTTEREDPAGEDOWNEXTEND: + PageMove(1, Selection::selStream, true); + break; + case SCI_PAGEUP: + PageMove(-1); + break; + case SCI_PAGEUPEXTEND: + PageMove(-1, Selection::selStream); + break; + case SCI_PAGEUPRECTEXTEND: + PageMove(-1, Selection::selRectangle); + break; + case SCI_PAGEDOWN: + PageMove(1); + break; + case SCI_PAGEDOWNEXTEND: + PageMove(1, Selection::selStream); + break; + case SCI_PAGEDOWNRECTEXTEND: + PageMove(1, Selection::selRectangle); + break; + case SCI_EDITTOGGLEOVERTYPE: + inOverstrike = !inOverstrike; + ShowCaretAtCurrentPosition(); + ContainerNeedsUpdate(SC_UPDATE_CONTENT); + NotifyUpdateUI(); + break; + case SCI_CANCEL: // Cancel any modes - handled in subclass + // Also unselect text + CancelModes(); + break; + case SCI_DELETEBACK: + DelCharBack(true); + if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { + SetLastXChosen(); + } + EnsureCaretVisible(); + break; + case SCI_DELETEBACKNOTLINE: + DelCharBack(false); + if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { + SetLastXChosen(); + } + EnsureCaretVisible(); + break; + case SCI_TAB: + Indent(true); + if (caretSticky == SC_CARETSTICKY_OFF) { + SetLastXChosen(); + } + EnsureCaretVisible(); + ShowCaretAtCurrentPosition(); // Avoid blinking + break; + case SCI_BACKTAB: + Indent(false); + if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { + SetLastXChosen(); + } + EnsureCaretVisible(); + ShowCaretAtCurrentPosition(); // Avoid blinking + break; + case SCI_NEWLINE: + NewLine(); + break; + case SCI_FORMFEED: + AddChar('\f'); + break; + case SCI_VCHOME: + MovePositionTo(pdoc->VCHomePosition(sel.MainCaret())); + SetLastXChosen(); + break; + case SCI_VCHOMEEXTEND: + MovePositionTo(pdoc->VCHomePosition(sel.MainCaret()), Selection::selStream); + SetLastXChosen(); + break; + case SCI_VCHOMERECTEXTEND: + MovePositionTo(pdoc->VCHomePosition(sel.MainCaret()), Selection::selRectangle); + SetLastXChosen(); + break; + case SCI_VCHOMEWRAP: { + SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret())); + SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if ((viewLineStart < sel.RangeMain().caret) && (viewLineStart > homePos)) + homePos = viewLineStart; + + MovePositionTo(homePos); + SetLastXChosen(); + } + break; + case SCI_VCHOMEWRAPEXTEND: { + SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret())); + SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if ((viewLineStart < sel.RangeMain().caret) && (viewLineStart > homePos)) + homePos = viewLineStart; + + MovePositionTo(homePos, Selection::selStream); + SetLastXChosen(); + } + break; + case SCI_ZOOMIN: + if (vs.zoomLevel < 20) { + vs.zoomLevel++; + InvalidateStyleRedraw(); + NotifyZoom(); + } + break; + case SCI_ZOOMOUT: + if (vs.zoomLevel > -10) { + vs.zoomLevel--; + InvalidateStyleRedraw(); + NotifyZoom(); + } + break; + case SCI_DELWORDLEFT: { + int startWord = pdoc->NextWordStart(sel.MainCaret(), -1); + pdoc->DeleteChars(startWord, sel.MainCaret() - startWord); + sel.RangeMain().ClearVirtualSpace(); + SetLastXChosen(); + } + break; + case SCI_DELWORDRIGHT: { + UndoGroup ug(pdoc); + InvalidateSelection(sel.RangeMain(), true); + sel.RangeMain().caret = SelectionPosition( + InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace())); + sel.RangeMain().anchor = sel.RangeMain().caret; + int endWord = pdoc->NextWordStart(sel.MainCaret(), 1); + pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret()); + } + break; + case SCI_DELWORDRIGHTEND: { + UndoGroup ug(pdoc); + InvalidateSelection(sel.RangeMain(), true); + sel.RangeMain().caret = SelectionPosition( + InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace())); + int endWord = pdoc->NextWordEnd(sel.MainCaret(), 1); + pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret()); + } + break; + case SCI_DELLINELEFT: { + int line = pdoc->LineFromPosition(sel.MainCaret()); + int start = pdoc->LineStart(line); + pdoc->DeleteChars(start, sel.MainCaret() - start); + sel.RangeMain().ClearVirtualSpace(); + SetLastXChosen(); + } + break; + case SCI_DELLINERIGHT: { + int line = pdoc->LineFromPosition(sel.MainCaret()); + int end = pdoc->LineEnd(line); + pdoc->DeleteChars(sel.MainCaret(), end - sel.MainCaret()); + } + break; + case SCI_LINECOPY: { + int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); + CopyRangeToClipboard(pdoc->LineStart(lineStart), + pdoc->LineStart(lineEnd + 1)); + } + break; + case SCI_LINECUT: { + int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); + int start = pdoc->LineStart(lineStart); + int end = pdoc->LineStart(lineEnd + 1); + SetSelection(start, end); + Cut(); + SetLastXChosen(); + } + break; + case SCI_LINEDELETE: { + int line = pdoc->LineFromPosition(sel.MainCaret()); + int start = pdoc->LineStart(line); + int end = pdoc->LineStart(line + 1); + pdoc->DeleteChars(start, end - start); + } + break; + case SCI_LINETRANSPOSE: + LineTranspose(); + break; + case SCI_LINEDUPLICATE: + Duplicate(true); + break; + case SCI_SELECTIONDUPLICATE: + Duplicate(false); + break; + case SCI_LOWERCASE: + ChangeCaseOfSelection(cmLower); + break; + case SCI_UPPERCASE: + ChangeCaseOfSelection(cmUpper); + break; + case SCI_WORDPARTLEFT: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(sel.MainCaret()), -1)); + SetLastXChosen(); + break; + case SCI_WORDPARTLEFTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(sel.MainCaret()), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_WORDPARTRIGHT: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(sel.MainCaret()), 1)); + SetLastXChosen(); + break; + case SCI_WORDPARTRIGHTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(sel.MainCaret()), 1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_HOMEDISPLAY: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), true), -1)); + SetLastXChosen(); + break; + case SCI_VCHOMEDISPLAY: { + SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret())); + SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if (viewLineStart > homePos) + homePos = viewLineStart; + + MovePositionTo(homePos); + SetLastXChosen(); + } + break; + case SCI_HOMEDISPLAYEXTEND: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), true), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_VCHOMEDISPLAYEXTEND: { + SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret())); + SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if (viewLineStart > homePos) + homePos = viewLineStart; + + MovePositionTo(homePos, Selection::selStream); + SetLastXChosen(); + } + break; + case SCI_LINEENDDISPLAY: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), false), 1)); + SetLastXChosen(); + break; + case SCI_LINEENDDISPLAYEXTEND: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), false), 1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_SCROLLTOSTART: + ScrollTo(0); + break; + case SCI_SCROLLTOEND: + ScrollTo(MaxScrollPos()); + break; + } + return 0; +} + +int Editor::KeyDefault(int, int) { + return 0; +} + +int Editor::KeyDownWithModifiers(int key, int modifiers, bool *consumed) { + DwellEnd(false); + int msg = kmap.Find(key, modifiers); + if (msg) { + if (consumed) + *consumed = true; + return static_cast(WndProc(msg, 0, 0)); + } else { + if (consumed) + *consumed = false; + return KeyDefault(key, modifiers); + } +} + +int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { + return KeyDownWithModifiers(key, ModifierFlags(shift, ctrl, alt), consumed); +} + +void Editor::Indent(bool forwards) { + UndoGroup ug(pdoc); + for (size_t r=0; rLineFromPosition(sel.Range(r).anchor.Position()); + int caretPosition = sel.Range(r).caret.Position(); + int lineCurrentPos = pdoc->LineFromPosition(caretPosition); + if (lineOfAnchor == lineCurrentPos) { + if (forwards) { + pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); + caretPosition = sel.Range(r).caret.Position(); + if (pdoc->GetColumn(caretPosition) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) && + pdoc->tabIndents) { + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); + const int posSelect = pdoc->SetLineIndentation( + lineCurrentPos, indentation + indentationStep - indentation % indentationStep); + sel.Range(r) = SelectionRange(posSelect); + } else { + if (pdoc->useTabs) { + const int lengthInserted = pdoc->InsertString(caretPosition, "\t", 1); + sel.Range(r) = SelectionRange(caretPosition + lengthInserted); + } else { + int numSpaces = (pdoc->tabInChars) - + (pdoc->GetColumn(caretPosition) % (pdoc->tabInChars)); + if (numSpaces < 1) + numSpaces = pdoc->tabInChars; + const std::string spaceText(numSpaces, ' '); + const int lengthInserted = pdoc->InsertString(caretPosition, spaceText.c_str(), + static_cast(spaceText.length())); + sel.Range(r) = SelectionRange(caretPosition + lengthInserted); + } + } + } else { + if (pdoc->GetColumn(caretPosition) <= pdoc->GetLineIndentation(lineCurrentPos) && + pdoc->tabIndents) { + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); + const int posSelect = pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); + sel.Range(r) = SelectionRange(posSelect); + } else { + int newColumn = ((pdoc->GetColumn(caretPosition) - 1) / pdoc->tabInChars) * + pdoc->tabInChars; + if (newColumn < 0) + newColumn = 0; + int newPos = caretPosition; + while (pdoc->GetColumn(newPos) > newColumn) + newPos--; + sel.Range(r) = SelectionRange(newPos); + } + } + } else { // Multiline + int anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); + int currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); + // Multiple lines selected so indent / dedent + int lineTopSel = Platform::Minimum(lineOfAnchor, lineCurrentPos); + int lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); + if (pdoc->LineStart(lineBottomSel) == sel.Range(r).anchor.Position() || pdoc->LineStart(lineBottomSel) == caretPosition) + lineBottomSel--; // If not selecting any characters on a line, do not indent + pdoc->Indent(forwards, lineBottomSel, lineTopSel); + if (lineOfAnchor < lineCurrentPos) { + if (currentPosPosOnLine == 0) + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); + else + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos + 1), pdoc->LineStart(lineOfAnchor)); + } else { + if (anchorPosOnLine == 0) + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); + else + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor + 1)); + } + } + } + ContainerNeedsUpdate(SC_UPDATE_SELECTION); +} + +class CaseFolderASCII : public CaseFolderTable { +public: + CaseFolderASCII() { + StandardASCII(); + } + ~CaseFolderASCII() { + } +}; + + +CaseFolder *Editor::CaseFolderForEncoding() { + // Simple default that only maps ASCII upper case to lower case. + return new CaseFolderASCII(); +} + +/** + * Search of a text in the document, in the given range. + * @return The position of the found text, -1 if not found. + */ +long Editor::FindText( + uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. + + Sci_TextToFind *ft = reinterpret_cast(lParam); + int lengthFound = istrlen(ft->lpstrText); + if (!pdoc->HasCaseFolder()) + pdoc->SetCaseFolder(CaseFolderForEncoding()); + try { + long pos = pdoc->FindText( + static_cast(ft->chrg.cpMin), + static_cast(ft->chrg.cpMax), + ft->lpstrText, + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + static_cast(wParam), + &lengthFound); + if (pos != -1) { + ft->chrgText.cpMin = pos; + ft->chrgText.cpMax = pos + lengthFound; + } + return static_cast(pos); + } catch (RegexError &) { + errorStatus = SC_STATUS_WARN_REGEX; + return -1; + } +} + +/** + * Relocatable search support : Searches relative to current selection + * point and sets the selection to the found text range with + * each search. + */ +/** + * Anchor following searches at current selection start: This allows + * multiple incremental interactive searches to be macro recorded + * while still setting the selection to found text so the find/select + * operation is self-contained. + */ +void Editor::SearchAnchor() { + searchAnchor = SelectionStart().Position(); +} + +/** + * Find text from current search anchor: Must call @c SearchAnchor first. + * Used for next text and previous text requests. + * @return The position of the found text, -1 if not found. + */ +long Editor::SearchText( + unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. + uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + sptr_t lParam) { ///< The text to search for. + + const char *txt = reinterpret_cast(lParam); + long pos; + int lengthFound = istrlen(txt); + if (!pdoc->HasCaseFolder()) + pdoc->SetCaseFolder(CaseFolderForEncoding()); + try { + if (iMessage == SCI_SEARCHNEXT) { + pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + static_cast(wParam), + &lengthFound); + } else { + pos = pdoc->FindText(searchAnchor, 0, txt, + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + static_cast(wParam), + &lengthFound); + } + } catch (RegexError &) { + errorStatus = SC_STATUS_WARN_REGEX; + return -1; + } + if (pos != -1) { + SetSelection(static_cast(pos), static_cast(pos + lengthFound)); + } + + return pos; +} + +std::string Editor::CaseMapString(const std::string &s, int caseMapping) { + std::string ret(s); + for (size_t i=0; i= 'a' && ret[i] <= 'z') + ret[i] = static_cast(ret[i] - 'a' + 'A'); + break; + case cmLower: + if (ret[i] >= 'A' && ret[i] <= 'Z') + ret[i] = static_cast(ret[i] - 'A' + 'a'); + break; + } + } + return ret; +} + +/** + * Search for text in the target range of the document. + * @return The position of the found text, -1 if not found. + */ +long Editor::SearchInTarget(const char *text, int length) { + int lengthFound = length; + + if (!pdoc->HasCaseFolder()) + pdoc->SetCaseFolder(CaseFolderForEncoding()); + try { + long pos = pdoc->FindText(targetStart, targetEnd, text, + (searchFlags & SCFIND_MATCHCASE) != 0, + (searchFlags & SCFIND_WHOLEWORD) != 0, + (searchFlags & SCFIND_WORDSTART) != 0, + (searchFlags & SCFIND_REGEXP) != 0, + searchFlags, + &lengthFound); + if (pos != -1) { + targetStart = static_cast(pos); + targetEnd = static_cast(pos + lengthFound); + } + return pos; + } catch (RegexError &) { + errorStatus = SC_STATUS_WARN_REGEX; + return -1; + } +} + +void Editor::GoToLine(int lineNo) { + if (lineNo > pdoc->LinesTotal()) + lineNo = pdoc->LinesTotal(); + if (lineNo < 0) + lineNo = 0; + SetEmptySelection(pdoc->LineStart(lineNo)); + ShowCaretAtCurrentPosition(); + EnsureCaretVisible(); +} + +static bool Close(Point pt1, Point pt2, Point threshold) { + if (std::abs(pt1.x - pt2.x) > threshold.x) + return false; + if (std::abs(pt1.y - pt2.y) > threshold.y) + return false; + return true; +} + +std::string Editor::RangeText(int start, int end) const { + if (start < end) { + int len = end - start; + std::string ret(len, '\0'); + for (int i = 0; i < len; i++) { + ret[i] = pdoc->CharAt(start + i); + } + return ret; + } + return std::string(); +} + +void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { + if (sel.Empty()) { + if (allowLineCopy) { + int currentLine = pdoc->LineFromPosition(sel.MainCaret()); + int start = pdoc->LineStart(currentLine); + int end = pdoc->LineEnd(currentLine); + + std::string text = RangeText(start, end); + if (pdoc->eolMode != SC_EOL_LF) + text.push_back('\r'); + if (pdoc->eolMode != SC_EOL_CR) + text.push_back('\n'); + ss->Copy(text, pdoc->dbcsCodePage, + vs.styles[STYLE_DEFAULT].characterSet, false, true); + } + } else { + std::string text; + std::vector rangesInOrder = sel.RangesCopy(); + if (sel.selType == Selection::selRectangle) + std::sort(rangesInOrder.begin(), rangesInOrder.end()); + for (size_t r=0; reolMode != SC_EOL_LF) + text.push_back('\r'); + if (pdoc->eolMode != SC_EOL_CR) + text.push_back('\n'); + } + } + ss->Copy(text, pdoc->dbcsCodePage, + vs.styles[STYLE_DEFAULT].characterSet, sel.IsRectangular(), sel.selType == Selection::selLines); + } +} + +void Editor::CopyRangeToClipboard(int start, int end) { + start = pdoc->ClampPositionIntoDocument(start); + end = pdoc->ClampPositionIntoDocument(end); + SelectionText selectedText; + std::string text = RangeText(start, end); + selectedText.Copy(text, + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); + CopyToClipboard(selectedText); +} + +void Editor::CopyText(int length, const char *text) { + SelectionText selectedText; + selectedText.Copy(std::string(text, length), + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); + CopyToClipboard(selectedText); +} + +void Editor::SetDragPosition(SelectionPosition newPos) { + if (newPos.Position() >= 0) { + newPos = MovePositionOutsideChar(newPos, 1); + posDrop = newPos; + } + if (!(posDrag == newPos)) { + caret.on = true; + if (FineTickerAvailable()) { + FineTickerCancel(tickCaret); + if ((caret.active) && (caret.period > 0) && (newPos.Position() < 0)) + FineTickerStart(tickCaret, caret.period, caret.period/10); + } else { + SetTicking(true); + } + InvalidateCaret(); + posDrag = newPos; + InvalidateCaret(); + } +} + +void Editor::DisplayCursor(Window::Cursor c) { + if (cursorMode == SC_CURSORNORMAL) + wMain.SetCursor(c); + else + wMain.SetCursor(static_cast(cursorMode)); +} + +bool Editor::DragThreshold(Point ptStart, Point ptNow) { + int xMove = static_cast(ptStart.x - ptNow.x); + int yMove = static_cast(ptStart.y - ptNow.y); + int distanceSquared = xMove * xMove + yMove * yMove; + return distanceSquared > 16; +} + +void Editor::StartDrag() { + // Always handled by subclasses + //SetMouseCapture(true); + //DisplayCursor(Window::cursorArrow); +} + +void Editor::DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular) { + //Platform::DebugPrintf("DropAt %d %d\n", inDragDrop, position); + if (inDragDrop == ddDragging) + dropWentOutside = false; + + bool positionWasInSelection = PositionInSelection(position.Position()); + + bool positionOnEdgeOfSelection = + (position == SelectionStart()) || (position == SelectionEnd()); + + if ((inDragDrop != ddDragging) || !(positionWasInSelection) || + (positionOnEdgeOfSelection && !moving)) { + + SelectionPosition selStart = SelectionStart(); + SelectionPosition selEnd = SelectionEnd(); + + UndoGroup ug(pdoc); + + SelectionPosition positionAfterDeletion = position; + if ((inDragDrop == ddDragging) && moving) { + // Remove dragged out text + if (rectangular || sel.selType == Selection::selLines) { + for (size_t r=0; r= sel.Range(r).Start()) { + if (position > sel.Range(r).End()) { + positionAfterDeletion.Add(-sel.Range(r).Length()); + } else { + positionAfterDeletion.Add(-SelectionRange(position, sel.Range(r).Start()).Length()); + } + } + } + } else { + if (position > selStart) { + positionAfterDeletion.Add(-SelectionRange(selEnd, selStart).Length()); + } + } + ClearSelection(); + } + position = positionAfterDeletion; + + std::string convertedText = Document::TransformLineEnds(value, lengthValue, pdoc->eolMode); + + if (rectangular) { + PasteRectangular(position, convertedText.c_str(), static_cast(convertedText.length())); + // Should try to select new rectangle but it may not be a rectangle now so just select the drop position + SetEmptySelection(position); + } else { + position = MovePositionOutsideChar(position, sel.MainCaret() - position.Position()); + position = SelectionPosition(InsertSpace(position.Position(), position.VirtualSpace())); + const int lengthInserted = pdoc->InsertString( + position.Position(), convertedText.c_str(), static_cast(convertedText.length())); + if (lengthInserted > 0) { + SelectionPosition posAfterInsertion = position; + posAfterInsertion.Add(lengthInserted); + SetSelection(posAfterInsertion, position); + } + } + } else if (inDragDrop == ddDragging) { + SetEmptySelection(position); + } +} + +void Editor::DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular) { + DropAt(position, value, strlen(value), moving, rectangular); +} + +/** + * @return true if given position is inside the selection, + */ +bool Editor::PositionInSelection(int pos) { + pos = MovePositionOutsideChar(pos, sel.MainCaret() - pos); + for (size_t r=0; r ptPos.x) { + hit = false; + } + } + if (hit) + return true; + } + } + return false; +} + +bool Editor::PointInSelMargin(Point pt) const { + // Really means: "Point in a margin" + if (vs.fixedColumnWidth > 0) { // There is a margin + PRectangle rcSelMargin = GetClientRectangle(); + rcSelMargin.right = static_cast(vs.textStart - vs.leftMarginWidth); + rcSelMargin.left = static_cast(vs.textStart - vs.fixedColumnWidth); + return rcSelMargin.ContainsWholePixel(pt); + } else { + return false; + } +} + +Window::Cursor Editor::GetMarginCursor(Point pt) const { + int x = 0; + for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { + if ((pt.x >= x) && (pt.x < x + vs.ms[margin].width)) + return static_cast(vs.ms[margin].cursor); + x += vs.ms[margin].width; + } + return Window::cursorReverseArrow; +} + +void Editor::TrimAndSetSelection(int currentPos_, int anchor_) { + sel.TrimSelection(SelectionRange(currentPos_, anchor_)); + SetSelection(currentPos_, anchor_); +} + +void Editor::LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine) { + int selCurrentPos, selAnchorPos; + if (wholeLine) { + int lineCurrent_ = pdoc->LineFromPosition(lineCurrentPos_); + int lineAnchor_ = pdoc->LineFromPosition(lineAnchorPos_); + if (lineAnchorPos_ < lineCurrentPos_) { + selCurrentPos = pdoc->LineStart(lineCurrent_ + 1); + selAnchorPos = pdoc->LineStart(lineAnchor_); + } else if (lineAnchorPos_ > lineCurrentPos_) { + selCurrentPos = pdoc->LineStart(lineCurrent_); + selAnchorPos = pdoc->LineStart(lineAnchor_ + 1); + } else { // Same line, select it + selCurrentPos = pdoc->LineStart(lineAnchor_ + 1); + selAnchorPos = pdoc->LineStart(lineAnchor_); + } + } else { + if (lineAnchorPos_ < lineCurrentPos_) { + selCurrentPos = StartEndDisplayLine(lineCurrentPos_, false) + 1; + selCurrentPos = pdoc->MovePositionOutsideChar(selCurrentPos, 1); + selAnchorPos = StartEndDisplayLine(lineAnchorPos_, true); + } else if (lineAnchorPos_ > lineCurrentPos_) { + selCurrentPos = StartEndDisplayLine(lineCurrentPos_, true); + selAnchorPos = StartEndDisplayLine(lineAnchorPos_, false) + 1; + selAnchorPos = pdoc->MovePositionOutsideChar(selAnchorPos, 1); + } else { // Same line, select it + selCurrentPos = StartEndDisplayLine(lineAnchorPos_, false) + 1; + selCurrentPos = pdoc->MovePositionOutsideChar(selCurrentPos, 1); + selAnchorPos = StartEndDisplayLine(lineAnchorPos_, true); + } + } + TrimAndSetSelection(selCurrentPos, selAnchorPos); +} + +void Editor::WordSelection(int pos) { + if (pos < wordSelectAnchorStartPos) { + // Extend backward to the word containing pos. + // Skip ExtendWordSelect if the line is empty or if pos is after the last character. + // This ensures that a series of empty lines isn't counted as a single "word". + if (!pdoc->IsLineEndPosition(pos)) + pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos + 1, 1), -1); + TrimAndSetSelection(pos, wordSelectAnchorEndPos); + } else if (pos > wordSelectAnchorEndPos) { + // Extend forward to the word containing the character to the left of pos. + // Skip ExtendWordSelect if the line is empty or if pos is the first position on the line. + // This ensures that a series of empty lines isn't counted as a single "word". + if (pos > pdoc->LineStart(pdoc->LineFromPosition(pos))) + pos = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(pos - 1, -1), 1); + TrimAndSetSelection(pos, wordSelectAnchorStartPos); + } else { + // Select only the anchored word + if (pos >= originalAnchorPos) + TrimAndSetSelection(wordSelectAnchorEndPos, wordSelectAnchorStartPos); + else + TrimAndSetSelection(wordSelectAnchorStartPos, wordSelectAnchorEndPos); + } +} + +void Editor::DwellEnd(bool mouseMoved) { + if (mouseMoved) + ticksToDwell = dwellDelay; + else + ticksToDwell = SC_TIME_FOREVER; + if (dwelling && (dwellDelay < SC_TIME_FOREVER)) { + dwelling = false; + NotifyDwelling(ptMouseLast, dwelling); + } + if (FineTickerAvailable()) { + FineTickerCancel(tickDwell); + if (mouseMoved && (dwellDelay < SC_TIME_FOREVER)) { + //FineTickerStart(tickDwell, dwellDelay, dwellDelay/10); + } + } +} + +void Editor::MouseLeave() { + SetHotSpotRange(NULL); + if (!HaveMouseCapture()) { + ptMouseLast = Point(-1,-1); + DwellEnd(true); + } +} + +static bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) { + return (!rectangular && ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0)) + || (rectangular && ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) != 0)); +} + +void Editor::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) { + SetHoverIndicatorPoint(pt); + //Platform::DebugPrintf("ButtonDown %d %d = %d alt=%d %d\n", curTime, lastClickTime, curTime - lastClickTime, alt, inDragDrop); + ptMouseLast = pt; + const bool ctrl = (modifiers & SCI_CTRL) != 0; + const bool shift = (modifiers & SCI_SHIFT) != 0; + const bool alt = (modifiers & SCI_ALT) != 0; + SelectionPosition newPos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, alt)); + newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); + SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false); + newCharPos = MovePositionOutsideChar(newCharPos, -1); + inDragDrop = ddNone; + sel.SetMoveExtends(false); + + if (NotifyMarginClick(pt, modifiers)) + return; + + NotifyIndicatorClick(true, newPos.Position(), modifiers); + + bool inSelMargin = PointInSelMargin(pt); + // In margin ctrl+(double)click should always select everything + if (ctrl && inSelMargin) { + SelectAll(); + lastClickTime = curTime; + lastClick = pt; + return; + } + if (shift && !inSelMargin) { + SetSelection(newPos); + } + if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick, doubleClickCloseThreshold)) { + //Platform::DebugPrintf("Double click %d %d = %d\n", curTime, lastClickTime, curTime - lastClickTime); + SetMouseCapture(true); + if (FineTickerAvailable()) { + FineTickerStart(tickScroll, 100, 10); + } + if (!ctrl || !multipleSelection || (selectionType != selChar && selectionType != selWord)) + SetEmptySelection(newPos.Position()); + bool doubleClick = false; + // Stop mouse button bounce changing selection type + if (!Platform::MouseButtonBounce() || curTime != lastClickTime) { + if (inSelMargin) { + // Inside margin selection type should be either selSubLine or selWholeLine. + if (selectionType == selSubLine) { + // If it is selSubLine, we're inside a *double* click and word wrap is enabled, + // so we switch to selWholeLine in order to select whole line. + selectionType = selWholeLine; + } else if (selectionType != selSubLine && selectionType != selWholeLine) { + // If it is neither, reset selection type to line selection. + selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; + } + } else { + if (selectionType == selChar) { + selectionType = selWord; + doubleClick = true; + } else if (selectionType == selWord) { + // Since we ended up here, we're inside a *triple* click, which should always select + // whole line regardless of word wrap being enabled or not. + selectionType = selWholeLine; + } else { + selectionType = selChar; + originalAnchorPos = sel.MainCaret(); + } + } + } + + if (selectionType == selWord) { + int charPos = originalAnchorPos; + if (sel.MainCaret() == originalAnchorPos) { + charPos = PositionFromLocation(pt, false, true); + charPos = MovePositionOutsideChar(charPos, -1); + } + + int startWord, endWord; + if ((sel.MainCaret() >= originalAnchorPos) && !pdoc->IsLineEndPosition(charPos)) { + startWord = pdoc->ExtendWordSelect(pdoc->MovePositionOutsideChar(charPos + 1, 1), -1); + endWord = pdoc->ExtendWordSelect(charPos, 1); + } else { + // Selecting backwards, or anchor beyond last character on line. In these cases, + // we select the word containing the character to the *left* of the anchor. + if (charPos > pdoc->LineStart(pdoc->LineFromPosition(charPos))) { + startWord = pdoc->ExtendWordSelect(charPos, -1); + endWord = pdoc->ExtendWordSelect(startWord, 1); + } else { + // Anchor at start of line; select nothing to begin with. + startWord = charPos; + endWord = charPos; + } + } + + wordSelectAnchorStartPos = startWord; + wordSelectAnchorEndPos = endWord; + wordSelectInitialCaretPos = sel.MainCaret(); + WordSelection(wordSelectInitialCaretPos); + } else if (selectionType == selSubLine || selectionType == selWholeLine) { + lineAnchorPos = newPos.Position(); + LineSelection(lineAnchorPos, lineAnchorPos, selectionType == selWholeLine); + //Platform::DebugPrintf("Triple click: %d - %d\n", anchor, currentPos); + } else { + SetEmptySelection(sel.MainCaret()); + } + //Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos); + if (doubleClick) { + NotifyDoubleClick(pt, modifiers); + if (PositionIsHotspot(newCharPos.Position())) + NotifyHotSpotDoubleClicked(newCharPos.Position(), modifiers); + } + } else { // Single click + if (inSelMargin) { + sel.selType = Selection::selStream; + if (!shift) { + // Single click in margin: select whole line or only subline if word wrap is enabled + lineAnchorPos = newPos.Position(); + selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; + LineSelection(lineAnchorPos, lineAnchorPos, selectionType == selWholeLine); + } else { + // Single shift+click in margin: select from line anchor to clicked line + if (sel.MainAnchor() > sel.MainCaret()) + lineAnchorPos = sel.MainAnchor() - 1; + else + lineAnchorPos = sel.MainAnchor(); + // Reset selection type if there is an empty selection. + // This ensures that we don't end up stuck in previous selection mode, which is no longer valid. + // Otherwise, if there's a non empty selection, reset selection type only if it differs from selSubLine and selWholeLine. + // This ensures that we continue selecting in the same selection mode. + if (sel.Empty() || (selectionType != selSubLine && selectionType != selWholeLine)) + selectionType = (Wrapping() && (marginOptions & SC_MARGINOPTION_SUBLINESELECT)) ? selSubLine : selWholeLine; + LineSelection(newPos.Position(), lineAnchorPos, selectionType == selWholeLine); + } + + SetDragPosition(SelectionPosition(invalidPosition)); + SetMouseCapture(true); + if (FineTickerAvailable()) { + FineTickerStart(tickScroll, 100, 10); + } + } else { + if (PointIsHotspot(pt)) { + NotifyHotSpotClicked(newCharPos.Position(), modifiers); + hotSpotClickPos = newCharPos.Position(); + } + if (!shift) { + if (PointInSelection(pt) && !SelectionEmpty()) + inDragDrop = ddInitial; + else + inDragDrop = ddNone; + } + SetMouseCapture(true); + if (FineTickerAvailable()) { + FineTickerStart(tickScroll, 100, 10); + } + if (inDragDrop != ddInitial) { + SetDragPosition(SelectionPosition(invalidPosition)); + if (!shift) { + if (ctrl && multipleSelection) { + SelectionRange range(newPos); + sel.TentativeSelection(range); + InvalidateSelection(range, true); + } else { + InvalidateSelection(SelectionRange(newPos), true); + if (sel.Count() > 1) + Redraw(); + if ((sel.Count() > 1) || (sel.selType != Selection::selStream)) + sel.Clear(); + sel.selType = alt ? Selection::selRectangle : Selection::selStream; + SetSelection(newPos, newPos); + } + } + SelectionPosition anchorCurrent = newPos; + if (shift) + anchorCurrent = sel.IsRectangular() ? + sel.Rectangular().anchor : sel.RangeMain().anchor; + sel.selType = alt ? Selection::selRectangle : Selection::selStream; + selectionType = selChar; + originalAnchorPos = sel.MainCaret(); + sel.Rectangular() = SelectionRange(newPos, anchorCurrent); + SetRectangularRange(); + } + } + } + lastClickTime = curTime; + lastClick = pt; + lastXChosen = static_cast(pt.x) + xOffset; + ShowCaretAtCurrentPosition(); +} + +void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { + return ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); +} + +bool Editor::PositionIsHotspot(int position) const { + return vs.styles[static_cast(pdoc->StyleAt(position))].hotspot; +} + +bool Editor::PointIsHotspot(Point pt) { + int pos = PositionFromLocation(pt, true, true); + if (pos == INVALID_POSITION) + return false; + return PositionIsHotspot(pos); +} + +void Editor::SetHoverIndicatorPosition(int position) { + int hoverIndicatorPosPrev = hoverIndicatorPos; + hoverIndicatorPos = INVALID_POSITION; + if (vs.indicatorsDynamic == 0) + return; + if (position != INVALID_POSITION) { + for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { + if (vs.indicators[deco->indicator].IsDynamic()) { + if (pdoc->decorations.ValueAt(deco->indicator, position)) { + hoverIndicatorPos = position; + } + } + } + } + if (hoverIndicatorPosPrev != hoverIndicatorPos) { + if (hoverIndicatorPosPrev != INVALID_POSITION) + InvalidateRange(hoverIndicatorPosPrev, hoverIndicatorPosPrev + 1); + if (hoverIndicatorPos != INVALID_POSITION) + InvalidateRange(hoverIndicatorPos, hoverIndicatorPos + 1); + } +} + +void Editor::SetHoverIndicatorPoint(Point pt) { + if (vs.indicatorsDynamic == 0) { + SetHoverIndicatorPosition(INVALID_POSITION); + } else { + SetHoverIndicatorPosition(PositionFromLocation(pt, true, true)); + } +} + +void Editor::SetHotSpotRange(Point *pt) { + if (pt) { + int pos = PositionFromLocation(*pt, false, true); + + // If we don't limit this to word characters then the + // range can encompass more than the run range and then + // the underline will not be drawn properly. + Range hsNew; + hsNew.start = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine); + hsNew.end = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine); + + // Only invalidate the range if the hotspot range has changed... + if (!(hsNew == hotspot)) { + if (hotspot.Valid()) { + InvalidateRange(hotspot.start, hotspot.end); + } + hotspot = hsNew; + InvalidateRange(hotspot.start, hotspot.end); + } + } else { + if (hotspot.Valid()) { + InvalidateRange(hotspot.start, hotspot.end); + } + hotspot = Range(invalidPosition); + } +} + +Range Editor::GetHotSpotRange() const { + return hotspot; +} + +void Editor::ButtonMoveWithModifiers(Point pt, int modifiers) { + if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) { + DwellEnd(true); + } + + SelectionPosition movePos = SPositionFromLocation(pt, false, false, + AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); + movePos = MovePositionOutsideChar(movePos, sel.MainCaret() - movePos.Position()); + + if (inDragDrop == ddInitial) { + if (DragThreshold(ptMouseLast, pt)) { + SetMouseCapture(false); + if (FineTickerAvailable()) { + FineTickerCancel(tickScroll); + } + SetDragPosition(movePos); + CopySelectionRange(&drag); + StartDrag(); + } + return; + } + + ptMouseLast = pt; + PRectangle rcClient = GetClientRectangle(); + Point ptOrigin = GetVisibleOriginInMain(); + rcClient.Move(0, -ptOrigin.y); + if (FineTickerAvailable() && (dwellDelay < SC_TIME_FOREVER) && rcClient.Contains(pt)) { + FineTickerStart(tickDwell, dwellDelay, dwellDelay/10); + } + //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y); + if (HaveMouseCapture()) { + + // Slow down autoscrolling/selection + autoScrollTimer.ticksToWait -= timer.tickSize; + if (autoScrollTimer.ticksToWait > 0) + return; + autoScrollTimer.ticksToWait = autoScrollDelay; + + // Adjust selection + if (posDrag.IsValid()) { + SetDragPosition(movePos); + } else { + if (selectionType == selChar) { + if (sel.selType == Selection::selStream && (modifiers & SCI_ALT) && mouseSelectionRectangularSwitch) { + sel.selType = Selection::selRectangle; + } + if (sel.IsRectangular()) { + sel.Rectangular() = SelectionRange(movePos, sel.Rectangular().anchor); + SetSelection(movePos, sel.RangeMain().anchor); + } else if (sel.Count() > 1) { + InvalidateSelection(sel.RangeMain(), false); + SelectionRange range(movePos, sel.RangeMain().anchor); + sel.TentativeSelection(range); + InvalidateSelection(range, true); + } else { + SetSelection(movePos, sel.RangeMain().anchor); + } + } else if (selectionType == selWord) { + // Continue selecting by word + if (movePos.Position() == wordSelectInitialCaretPos) { // Didn't move + // No need to do anything. Previously this case was lumped + // in with "Moved forward", but that can be harmful in this + // case: a handler for the NotifyDoubleClick re-adjusts + // the selection for a fancier definition of "word" (for + // example, in Perl it is useful to include the leading + // '$', '%' or '@' on variables for word selection). In this + // the ButtonMove() called via Tick() for auto-scrolling + // could result in the fancier word selection adjustment + // being unmade. + } else { + wordSelectInitialCaretPos = -1; + WordSelection(movePos.Position()); + } + } else { + // Continue selecting by line + LineSelection(movePos.Position(), lineAnchorPos, selectionType == selWholeLine); + } + } + + // Autoscroll + int lineMove = DisplayFromPosition(movePos.Position()); + if (pt.y > rcClient.bottom) { + ScrollTo(lineMove - LinesOnScreen() + 1); + Redraw(); + } else if (pt.y < rcClient.top) { + ScrollTo(lineMove); + Redraw(); + } + EnsureCaretVisible(false, false, true); + + if (hotspot.Valid() && !PointIsHotspot(pt)) + SetHotSpotRange(NULL); + + if (hotSpotClickPos != INVALID_POSITION && PositionFromLocation(pt,true,true) != hotSpotClickPos) { + if (inDragDrop == ddNone) { + DisplayCursor(Window::cursorText); + } + hotSpotClickPos = INVALID_POSITION; + } + + } else { + if (vs.fixedColumnWidth > 0) { // There is a margin + if (PointInSelMargin(pt)) { + DisplayCursor(GetMarginCursor(pt)); + SetHotSpotRange(NULL); + return; // No need to test for selection + } + } + // Display regular (drag) cursor over selection + if (PointInSelection(pt) && !SelectionEmpty()) { + DisplayCursor(Window::cursorArrow); + } else { + SetHoverIndicatorPoint(pt); + if (PointIsHotspot(pt)) { + DisplayCursor(Window::cursorHand); + SetHotSpotRange(&pt); + } else { + if (hoverIndicatorPos != invalidPosition) + DisplayCursor(Window::cursorHand); + else + DisplayCursor(Window::cursorText); + SetHotSpotRange(NULL); + } + } + } +} + +void Editor::ButtonMove(Point pt) { + ButtonMoveWithModifiers(pt, 0); +} + +void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { + //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); + SelectionPosition newPos = SPositionFromLocation(pt, false, false, + AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); + if (hoverIndicatorPos != INVALID_POSITION) + InvalidateRange(newPos.Position(), newPos.Position() + 1); + newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); + if (inDragDrop == ddInitial) { + inDragDrop = ddNone; + SetEmptySelection(newPos); + selectionType = selChar; + originalAnchorPos = sel.MainCaret(); + } + if (hotSpotClickPos != INVALID_POSITION && PointIsHotspot(pt)) { + hotSpotClickPos = INVALID_POSITION; + SelectionPosition newCharPos = SPositionFromLocation(pt, false, true, false); + newCharPos = MovePositionOutsideChar(newCharPos, -1); + NotifyHotSpotReleaseClick(newCharPos.Position(), ctrl ? SCI_CTRL : 0); + } + if (HaveMouseCapture()) { + if (PointInSelMargin(pt)) { + DisplayCursor(GetMarginCursor(pt)); + } else { + DisplayCursor(Window::cursorText); + SetHotSpotRange(NULL); + } + ptMouseLast = pt; + SetMouseCapture(false); + if (FineTickerAvailable()) { + FineTickerCancel(tickScroll); + } + NotifyIndicatorClick(false, newPos.Position(), 0); + if (inDragDrop == ddDragging) { + SelectionPosition selStart = SelectionStart(); + SelectionPosition selEnd = SelectionEnd(); + if (selStart < selEnd) { + if (drag.Length()) { + const int length = static_cast(drag.Length()); + if (ctrl) { + const int lengthInserted = pdoc->InsertString( + newPos.Position(), drag.Data(), length); + if (lengthInserted > 0) { + SetSelection(newPos.Position(), newPos.Position() + lengthInserted); + } + } else if (newPos < selStart) { + pdoc->DeleteChars(selStart.Position(), static_cast(drag.Length())); + const int lengthInserted = pdoc->InsertString( + newPos.Position(), drag.Data(), length); + if (lengthInserted > 0) { + SetSelection(newPos.Position(), newPos.Position() + lengthInserted); + } + } else if (newPos > selEnd) { + pdoc->DeleteChars(selStart.Position(), static_cast(drag.Length())); + newPos.Add(-static_cast(drag.Length())); + const int lengthInserted = pdoc->InsertString( + newPos.Position(), drag.Data(), length); + if (lengthInserted > 0) { + SetSelection(newPos.Position(), newPos.Position() + lengthInserted); + } + } else { + SetEmptySelection(newPos.Position()); + } + drag.Clear(); + } + selectionType = selChar; + } + } else { + if (selectionType == selChar) { + if (sel.Count() > 1) { + sel.RangeMain() = + SelectionRange(newPos, sel.Range(sel.Count() - 1).anchor); + InvalidateSelection(sel.RangeMain(), true); + } else { + SetSelection(newPos, sel.RangeMain().anchor); + } + } + sel.CommitTentative(); + } + SetRectangularRange(); + lastClickTime = curTime; + lastClick = pt; + lastXChosen = static_cast(pt.x) + xOffset; + if (sel.selType == Selection::selStream) { + SetLastXChosen(); + } + inDragDrop = ddNone; + EnsureCaretVisible(false); + } +} + +// Called frequently to perform background UI including +// caret blinking and automatic scrolling. +void Editor::Tick() { + if (HaveMouseCapture()) { + // Auto scroll + ButtonMove(ptMouseLast); + } + if (caret.period > 0) { + timer.ticksToWait -= timer.tickSize; + if (timer.ticksToWait <= 0) { + caret.on = !caret.on; + timer.ticksToWait = caret.period; + if (caret.active) { + InvalidateCaret(); + } + } + } + if (horizontalScrollBarVisible && trackLineWidth && (view.lineWidthMaxSeen > scrollWidth)) { + scrollWidth = view.lineWidthMaxSeen; + SetScrollBars(); + } + if ((dwellDelay < SC_TIME_FOREVER) && + (ticksToDwell > 0) && + (!HaveMouseCapture()) && + (ptMouseLast.y >= 0)) { + ticksToDwell -= timer.tickSize; + if (ticksToDwell <= 0) { + dwelling = true; + NotifyDwelling(ptMouseLast, dwelling); + } + } +} + +bool Editor::Idle() { + + bool idleDone; + + bool wrappingDone = !Wrapping(); + + if (!wrappingDone) { + // Wrap lines during idle. + WrapLines(wsIdle); + // No more wrapping + if (!wrapPending.NeedsWrap()) + wrappingDone = true; + } + + // Add more idle things to do here, but make sure idleDone is + // set correctly before the function returns. returning + // false will stop calling this idle function until SetIdle() is + // called again. + + idleDone = wrappingDone; // && thatDone && theOtherThingDone... + + return !idleDone; +} + +void Editor::SetTicking(bool) { + // SetTicking is deprecated. In the past it was pure virtual and was overridden in each + // derived platform class but fine grained timers should now be implemented. + // Either way, execution should not arrive here so assert failure. + assert(false); +} + +void Editor::TickFor(TickReason reason) { + switch (reason) { + case tickCaret: + caret.on = !caret.on; + if (caret.active) { + InvalidateCaret(); + } + break; + case tickScroll: + // Auto scroll + ButtonMove(ptMouseLast); + break; + case tickWiden: + SetScrollBars(); + FineTickerCancel(tickWiden); + break; + case tickDwell: + if ((!HaveMouseCapture()) && + (ptMouseLast.y >= 0)) { + dwelling = true; + NotifyDwelling(ptMouseLast, dwelling); + } + FineTickerCancel(tickDwell); + break; + default: + // tickPlatform handled by subclass + break; + } +} + +bool Editor::FineTickerAvailable() { + return false; +} + +// FineTickerStart is be overridden by subclasses that support fine ticking so +// this method should never be called. +bool Editor::FineTickerRunning(TickReason) { + assert(false); + return false; +} + +// FineTickerStart is be overridden by subclasses that support fine ticking so +// this method should never be called. +void Editor::FineTickerStart(TickReason, int, int) { + assert(false); +} + +// FineTickerCancel is be overridden by subclasses that support fine ticking so +// this method should never be called. +void Editor::FineTickerCancel(TickReason) { + assert(false); +} + +void Editor::SetFocusState(bool focusState) { + hasFocus = focusState; + NotifyFocus(hasFocus); + if (!hasFocus) { + CancelModes(); + } + ShowCaretAtCurrentPosition(); +} + +int Editor::PositionAfterArea(PRectangle rcArea) const { + // The start of the document line after the display line after the area + // This often means that the line after a modification is restyled which helps + // detect multiline comment additions and heals single line comments + int lineAfter = TopLineOfMain() + static_cast(rcArea.bottom - 1) / vs.lineHeight + 1; + if (lineAfter < cs.LinesDisplayed()) + return pdoc->LineStart(cs.DocFromDisplay(lineAfter) + 1); + else + return pdoc->Length(); +} + +// Style to a position within the view. If this causes a change at end of last line then +// affects later lines so style all the viewed text. +void Editor::StyleToPositionInView(Position pos) { + int endWindow = PositionAfterArea(GetClientDrawingRectangle()); + if (pos > endWindow) + pos = endWindow; + int styleAtEnd = pdoc->StyleAt(pos-1); + pdoc->EnsureStyledTo(pos); + if ((endWindow > pos) && (styleAtEnd != pdoc->StyleAt(pos-1))) { + // Style at end of line changed so is multi-line change like starting a comment + // so require rest of window to be styled. + DiscardOverdraw(); // Prepared bitmaps may be invalid + // DiscardOverdraw may have truncated client drawing area so recalculate endWindow + endWindow = PositionAfterArea(GetClientDrawingRectangle()); + pdoc->EnsureStyledTo(endWindow); + } +} + +void Editor::IdleWork() { + // Style the line after the modification as this allows modifications that change just the + // line of the modification to heal instead of propagating to the rest of the window. + if (workNeeded.items & WorkNeeded::workStyle) + StyleToPositionInView(pdoc->LineStart(pdoc->LineFromPosition(workNeeded.upTo) + 2)); + + NotifyUpdateUI(); + workNeeded.Reset(); +} + +void Editor::QueueIdleWork(WorkNeeded::workItems items, int upTo) { + workNeeded.Need(items, upTo); +} + +bool Editor::PaintContains(PRectangle rc) { + if (rc.Empty()) { + return true; + } else { + return rcPaint.Contains(rc); + } +} + +bool Editor::PaintContainsMargin() { + if (wMargin.GetID()) { + // With separate margin view, paint of text view + // never contains margin. + return false; + } + PRectangle rcSelMargin = GetClientRectangle(); + rcSelMargin.right = static_cast(vs.textStart); + return PaintContains(rcSelMargin); +} + +void Editor::CheckForChangeOutsidePaint(Range r) { + if (paintState == painting && !paintingAllText) { + //Platform::DebugPrintf("Checking range in paint %d-%d\n", r.start, r.end); + if (!r.Valid()) + return; + + PRectangle rcRange = RectangleFromRange(r, 0); + PRectangle rcText = GetTextRectangle(); + if (rcRange.top < rcText.top) { + rcRange.top = rcText.top; + } + if (rcRange.bottom > rcText.bottom) { + rcRange.bottom = rcText.bottom; + } + + if (!PaintContains(rcRange)) { + AbandonPaint(); + paintAbandonedByStyling = true; + } + } +} + +void Editor::SetBraceHighlight(Position pos0, Position pos1, int matchStyle) { + if ((pos0 != braces[0]) || (pos1 != braces[1]) || (matchStyle != bracesMatchStyle)) { + if ((braces[0] != pos0) || (matchStyle != bracesMatchStyle)) { + CheckForChangeOutsidePaint(Range(braces[0])); + CheckForChangeOutsidePaint(Range(pos0)); + braces[0] = pos0; + } + if ((braces[1] != pos1) || (matchStyle != bracesMatchStyle)) { + CheckForChangeOutsidePaint(Range(braces[1])); + CheckForChangeOutsidePaint(Range(pos1)); + braces[1] = pos1; + } + bracesMatchStyle = matchStyle; + if (paintState == notPainting) { + Redraw(); + } + } +} + +void Editor::SetAnnotationHeights(int start, int end) { + if (vs.annotationVisible) { + RefreshStyleData(); + bool changedHeight = false; + for (int line=start; lineLinesTotal(); line++) { + int linesWrapped = 1; + if (Wrapping()) { + AutoSurface surface(this); + AutoLineLayout ll(view.llc, view.RetrieveLineLayout(line, *this)); + if (surface && ll) { + view.LayoutLine(*this, line, surface, vs, ll, wrapWidth); + linesWrapped = ll->lines; + } + } + if (cs.SetHeight(line, pdoc->AnnotationLines(line) + linesWrapped)) + changedHeight = true; + } + if (changedHeight) { + Redraw(); + } + } +} + +void Editor::SetDocPointer(Document *document) { + //Platform::DebugPrintf("** %x setdoc to %x\n", pdoc, document); + pdoc->RemoveWatcher(this, 0); + pdoc->Release(); + if (document == NULL) { + pdoc = new Document(); + } else { + pdoc = document; + } + pdoc->AddRef(); + + // Ensure all positions within document + sel.Clear(); + targetStart = 0; + targetEnd = 0; + + braces[0] = invalidPosition; + braces[1] = invalidPosition; + + vs.ReleaseAllExtendedStyles(); + + SetRepresentations(); + + // Reset the contraction state to fully shown. + cs.Clear(); + cs.InsertLines(0, pdoc->LinesTotal() - 1); + SetAnnotationHeights(0, pdoc->LinesTotal()); + view.llc.Deallocate(); + NeedWrapping(); + + hotspot = Range(invalidPosition); + hoverIndicatorPos = invalidPosition; + + view.ClearAllTabstops(); + + pdoc->AddWatcher(this, 0); + SetScrollBars(); + Redraw(); +} + +void Editor::SetAnnotationVisible(int visible) { + if (vs.annotationVisible != visible) { + bool changedFromOrToHidden = ((vs.annotationVisible != 0) != (visible != 0)); + vs.annotationVisible = visible; + if (changedFromOrToHidden) { + int dir = vs.annotationVisible ? 1 : -1; + for (int line=0; lineLinesTotal(); line++) { + int annotationLines = pdoc->AnnotationLines(line); + if (annotationLines > 0) { + cs.SetHeight(line, cs.GetHeight(line) + annotationLines * dir); + } + } + } + Redraw(); + } +} + +/** + * Recursively expand a fold, making lines visible except where they have an unexpanded parent. + */ +int Editor::ExpandLine(int line) { + int lineMaxSubord = pdoc->GetLastChild(line); + line++; + while (line <= lineMaxSubord) { + cs.SetVisible(line, line, true); + int level = pdoc->GetLevel(line); + if (level & SC_FOLDLEVELHEADERFLAG) { + if (cs.GetExpanded(line)) { + line = ExpandLine(line); + } else { + line = pdoc->GetLastChild(line); + } + } + line++; + } + return lineMaxSubord; +} + +void Editor::SetFoldExpanded(int lineDoc, bool expanded) { + if (cs.SetExpanded(lineDoc, expanded)) { + RedrawSelMargin(); + } +} + +void Editor::FoldLine(int line, int action) { + if (line >= 0) { + if (action == SC_FOLDACTION_TOGGLE) { + if ((pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) == 0) { + line = pdoc->GetFoldParent(line); + if (line < 0) + return; + } + action = (cs.GetExpanded(line)) ? SC_FOLDACTION_CONTRACT : SC_FOLDACTION_EXPAND; + } + + if (action == SC_FOLDACTION_CONTRACT) { + int lineMaxSubord = pdoc->GetLastChild(line); + if (lineMaxSubord > line) { + cs.SetExpanded(line, 0); + cs.SetVisible(line + 1, lineMaxSubord, false); + + int lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); + if (lineCurrent > line && lineCurrent <= lineMaxSubord) { + // This does not re-expand the fold + EnsureCaretVisible(); + } + } + + } else { + if (!(cs.GetVisible(line))) { + EnsureLineVisible(line, false); + GoToLine(line); + } + cs.SetExpanded(line, 1); + ExpandLine(line); + } + + SetScrollBars(); + Redraw(); + } +} + +void Editor::FoldExpand(int line, int action, int level) { + bool expanding = action == SC_FOLDACTION_EXPAND; + if (action == SC_FOLDACTION_TOGGLE) { + expanding = !cs.GetExpanded(line); + } + SetFoldExpanded(line, expanding); + if (expanding && (cs.HiddenLines() == 0)) + // Nothing to do + return; + int lineMaxSubord = pdoc->GetLastChild(line, level & SC_FOLDLEVELNUMBERMASK); + line++; + cs.SetVisible(line, lineMaxSubord, expanding); + while (line <= lineMaxSubord) { + int levelLine = pdoc->GetLevel(line); + if (levelLine & SC_FOLDLEVELHEADERFLAG) { + SetFoldExpanded(line, expanding); + } + line++; + } + SetScrollBars(); + Redraw(); +} + +int Editor::ContractedFoldNext(int lineStart) const { + for (int line = lineStart; lineLinesTotal();) { + if (!cs.GetExpanded(line) && (pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG)) + return line; + line = cs.ContractedNext(line+1); + if (line < 0) + return -1; + } + + return -1; +} + +/** + * Recurse up from this line to find any folds that prevent this line from being visible + * and unfold them all. + */ +void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { + + // In case in need of wrapping to ensure DisplayFromDoc works. + if (lineDoc >= wrapPending.start) + WrapLines(wsAll); + + if (!cs.GetVisible(lineDoc)) { + // Back up to find a non-blank line + int lookLine = lineDoc; + int lookLineLevel = pdoc->GetLevel(lookLine); + while ((lookLine > 0) && (lookLineLevel & SC_FOLDLEVELWHITEFLAG)) { + lookLineLevel = pdoc->GetLevel(--lookLine); + } + int lineParent = pdoc->GetFoldParent(lookLine); + if (lineParent < 0) { + // Backed up to a top level line, so try to find parent of initial line + lineParent = pdoc->GetFoldParent(lineDoc); + } + if (lineParent >= 0) { + if (lineDoc != lineParent) + EnsureLineVisible(lineParent, enforcePolicy); + if (!cs.GetExpanded(lineParent)) { + cs.SetExpanded(lineParent, 1); + ExpandLine(lineParent); + } + } + SetScrollBars(); + Redraw(); + } + if (enforcePolicy) { + int lineDisplay = cs.DisplayFromDoc(lineDoc); + if (visiblePolicy & VISIBLE_SLOP) { + if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) { + SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } else if ((lineDisplay > topLine + LinesOnScreen() - 1) || + ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { + SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + } else { + if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) { + SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + } + } +} + +void Editor::FoldAll(int action) { + pdoc->EnsureStyledTo(pdoc->Length()); + int maxLine = pdoc->LinesTotal(); + bool expanding = action == SC_FOLDACTION_EXPAND; + if (action == SC_FOLDACTION_TOGGLE) { + // Discover current state + for (int lineSeek = 0; lineSeek < maxLine; lineSeek++) { + if (pdoc->GetLevel(lineSeek) & SC_FOLDLEVELHEADERFLAG) { + expanding = !cs.GetExpanded(lineSeek); + break; + } + } + } + if (expanding) { + cs.SetVisible(0, maxLine-1, true); + for (int line = 0; line < maxLine; line++) { + int levelLine = pdoc->GetLevel(line); + if (levelLine & SC_FOLDLEVELHEADERFLAG) { + SetFoldExpanded(line, true); + } + } + } else { + for (int line = 0; line < maxLine; line++) { + int level = pdoc->GetLevel(line); + if ((level & SC_FOLDLEVELHEADERFLAG) && + (SC_FOLDLEVELBASE == (level & SC_FOLDLEVELNUMBERMASK))) { + SetFoldExpanded(line, false); + int lineMaxSubord = pdoc->GetLastChild(line, -1); + if (lineMaxSubord > line) { + cs.SetVisible(line + 1, lineMaxSubord, false); + } + } + } + } + SetScrollBars(); + Redraw(); +} + +void Editor::FoldChanged(int line, int levelNow, int levelPrev) { + if (levelNow & SC_FOLDLEVELHEADERFLAG) { + if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { + // Adding a fold point. + if (cs.SetExpanded(line, true)) { + RedrawSelMargin(); + } + FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); + } + } else if (levelPrev & SC_FOLDLEVELHEADERFLAG) { + if (!cs.GetExpanded(line)) { + // Removing the fold from one that has been contracted so should expand + // otherwise lines are left invisible with no way to make them visible + if (cs.SetExpanded(line, true)) { + RedrawSelMargin(); + } + FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); + } + } + if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && + ((levelPrev & SC_FOLDLEVELNUMBERMASK) > (levelNow & SC_FOLDLEVELNUMBERMASK))) { + if (cs.HiddenLines()) { + // See if should still be hidden + int parentLine = pdoc->GetFoldParent(line); + if ((parentLine < 0) || (cs.GetExpanded(parentLine) && cs.GetVisible(parentLine))) { + cs.SetVisible(line, line, true); + SetScrollBars(); + Redraw(); + } + } + } +} + +void Editor::NeedShown(int pos, int len) { + if (foldAutomatic & SC_AUTOMATICFOLD_SHOW) { + int lineStart = pdoc->LineFromPosition(pos); + int lineEnd = pdoc->LineFromPosition(pos+len); + for (int line = lineStart; line <= lineEnd; line++) { + EnsureLineVisible(line, false); + } + } else { + NotifyNeedShown(pos, len); + } +} + +int Editor::GetTag(char *tagValue, int tagNumber) { + const char *text = 0; + int length = 0; + if ((tagNumber >= 1) && (tagNumber <= 9)) { + char name[3] = "\\?"; + name[1] = static_cast(tagNumber + '0'); + length = 2; + text = pdoc->SubstituteByPosition(name, &length); + } + if (tagValue) { + if (text) + memcpy(tagValue, text, length + 1); + else + *tagValue = '\0'; + } + return length; +} + +int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { + UndoGroup ug(pdoc); + if (length == -1) + length = istrlen(text); + if (replacePatterns) { + text = pdoc->SubstituteByPosition(text, &length); + if (!text) { + return 0; + } + } + if (targetStart != targetEnd) + pdoc->DeleteChars(targetStart, targetEnd - targetStart); + targetEnd = targetStart; + const int lengthInserted = pdoc->InsertString(targetStart, text, length); + targetEnd = targetStart + lengthInserted; + return length; +} + +bool Editor::IsUnicodeMode() const { + return pdoc && (SC_CP_UTF8 == pdoc->dbcsCodePage); +} + +int Editor::CodePage() const { + if (pdoc) + return pdoc->dbcsCodePage; + else + return 0; +} + +int Editor::WrapCount(int line) { + AutoSurface surface(this); + AutoLineLayout ll(view.llc, view.RetrieveLineLayout(line, *this)); + + if (surface && ll) { + view.LayoutLine(*this, line, surface, vs, ll, wrapWidth); + return ll->lines; + } else { + return 1; + } +} + +void Editor::AddStyledText(char *buffer, int appendLength) { + // The buffer consists of alternating character bytes and style bytes + int textLength = appendLength / 2; + std::string text(textLength, '\0'); + int i; + for (i = 0; i < textLength; i++) { + text[i] = buffer[i*2]; + } + const int lengthInserted = pdoc->InsertString(CurrentPosition(), text.c_str(), textLength); + for (i = 0; i < textLength; i++) { + text[i] = buffer[i*2+1]; + } + pdoc->StartStyling(CurrentPosition(), static_cast(0xff)); + pdoc->SetStyles(textLength, text.c_str()); + SetEmptySelection(sel.MainCaret() + lengthInserted); +} + +static bool ValidMargin(uptr_t wParam) { + return wParam <= SC_MAX_MARGIN; +} + +static char *CharPtrFromSPtr(sptr_t lParam) { + return reinterpret_cast(lParam); +} + +void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLESETFORE: + vs.styles[wParam].fore = ColourDesired(static_cast(lParam)); + break; + case SCI_STYLESETBACK: + vs.styles[wParam].back = ColourDesired(static_cast(lParam)); + break; + case SCI_STYLESETBOLD: + vs.styles[wParam].weight = lParam != 0 ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL; + break; + case SCI_STYLESETWEIGHT: + vs.styles[wParam].weight = static_cast(lParam); + break; + case SCI_STYLESETITALIC: + vs.styles[wParam].italic = lParam != 0; + break; + case SCI_STYLESETEOLFILLED: + vs.styles[wParam].eolFilled = lParam != 0; + break; + case SCI_STYLESETSIZE: + vs.styles[wParam].size = static_cast(lParam * SC_FONT_SIZE_MULTIPLIER); + break; + case SCI_STYLESETSIZEFRACTIONAL: + vs.styles[wParam].size = static_cast(lParam); + break; + case SCI_STYLESETFONT: + if (lParam != 0) { + vs.SetStyleFontName(static_cast(wParam), CharPtrFromSPtr(lParam)); + } + break; + case SCI_STYLESETUNDERLINE: + vs.styles[wParam].underline = lParam != 0; + break; + case SCI_STYLESETCASE: + vs.styles[wParam].caseForce = static_cast(lParam); + break; + case SCI_STYLESETCHARACTERSET: + vs.styles[wParam].characterSet = static_cast(lParam); + pdoc->SetCaseFolder(NULL); + break; + case SCI_STYLESETVISIBLE: + vs.styles[wParam].visible = lParam != 0; + break; + case SCI_STYLESETCHANGEABLE: + vs.styles[wParam].changeable = lParam != 0; + break; + case SCI_STYLESETHOTSPOT: + vs.styles[wParam].hotspot = lParam != 0; + break; + } + InvalidateStyleRedraw(); +} + +sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLEGETFORE: + return vs.styles[wParam].fore.AsLong(); + case SCI_STYLEGETBACK: + return vs.styles[wParam].back.AsLong(); + case SCI_STYLEGETBOLD: + return vs.styles[wParam].weight > SC_WEIGHT_NORMAL; + case SCI_STYLEGETWEIGHT: + return vs.styles[wParam].weight; + case SCI_STYLEGETITALIC: + return vs.styles[wParam].italic ? 1 : 0; + case SCI_STYLEGETEOLFILLED: + return vs.styles[wParam].eolFilled ? 1 : 0; + case SCI_STYLEGETSIZE: + return vs.styles[wParam].size / SC_FONT_SIZE_MULTIPLIER; + case SCI_STYLEGETSIZEFRACTIONAL: + return vs.styles[wParam].size; + case SCI_STYLEGETFONT: + return StringResult(lParam, vs.styles[wParam].fontName); + case SCI_STYLEGETUNDERLINE: + return vs.styles[wParam].underline ? 1 : 0; + case SCI_STYLEGETCASE: + return static_cast(vs.styles[wParam].caseForce); + case SCI_STYLEGETCHARACTERSET: + return vs.styles[wParam].characterSet; + case SCI_STYLEGETVISIBLE: + return vs.styles[wParam].visible ? 1 : 0; + case SCI_STYLEGETCHANGEABLE: + return vs.styles[wParam].changeable ? 1 : 0; + case SCI_STYLEGETHOTSPOT: + return vs.styles[wParam].hotspot ? 1 : 0; + } + return 0; +} + +sptr_t Editor::StringResult(sptr_t lParam, const char *val) { + const size_t len = val ? strlen(val) : 0; + if (lParam) { + char *ptr = CharPtrFromSPtr(lParam); + if (val) + memcpy(ptr, val, len+1); + else + *ptr = 0; + } + return len; // Not including NUL +} + +sptr_t Editor::BytesResult(sptr_t lParam, const unsigned char *val, size_t len) { + // No NUL termination: len is number of valid/displayed bytes + if ((lParam) && (len > 0)) { + char *ptr = CharPtrFromSPtr(lParam); + if (val) + memcpy(ptr, val, len); + else + *ptr = 0; + } + return val ? len : 0; +} + +sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); + + // Optional macro recording hook + if (recordingMacro) + NotifyMacroRecord(iMessage, wParam, lParam); + + switch (iMessage) { + + case SCI_GETTEXT: { + if (lParam == 0) + return pdoc->Length() + 1; + if (wParam == 0) + return 0; + char *ptr = CharPtrFromSPtr(lParam); + unsigned int iChar = 0; + for (; iChar < wParam - 1; iChar++) + ptr[iChar] = pdoc->CharAt(iChar); + ptr[iChar] = '\0'; + return iChar; + } + + case SCI_SETTEXT: { + if (lParam == 0) + return 0; + UndoGroup ug(pdoc); + pdoc->DeleteChars(0, pdoc->Length()); + SetEmptySelection(0); + const char *text = CharPtrFromSPtr(lParam); + pdoc->InsertString(0, text, istrlen(text)); + return 1; + } + + case SCI_GETTEXTLENGTH: + return pdoc->Length(); + + case SCI_CUT: + Cut(); + SetLastXChosen(); + break; + + case SCI_COPY: + Copy(); + break; + + case SCI_COPYALLOWLINE: + CopyAllowLine(); + break; + + case SCI_VERTICALCENTRECARET: + VerticalCentreCaret(); + break; + + case SCI_MOVESELECTEDLINESUP: + MoveSelectedLinesUp(); + break; + + case SCI_MOVESELECTEDLINESDOWN: + MoveSelectedLinesDown(); + break; + + case SCI_COPYRANGE: + CopyRangeToClipboard(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_COPYTEXT: + CopyText(static_cast(wParam), CharPtrFromSPtr(lParam)); + break; + + case SCI_PASTE: + Paste(); + if ((caretSticky == SC_CARETSTICKY_OFF) || (caretSticky == SC_CARETSTICKY_WHITESPACE)) { + SetLastXChosen(); + } + EnsureCaretVisible(); + break; + + case SCI_CLEAR: + Clear(); + SetLastXChosen(); + EnsureCaretVisible(); + break; + + case SCI_UNDO: + Undo(); + SetLastXChosen(); + break; + + case SCI_CANUNDO: + return (pdoc->CanUndo() && !pdoc->IsReadOnly()) ? 1 : 0; + + case SCI_EMPTYUNDOBUFFER: + pdoc->DeleteUndoHistory(); + return 0; + + case SCI_GETFIRSTVISIBLELINE: + return topLine; + + case SCI_SETFIRSTVISIBLELINE: + ScrollTo(static_cast(wParam)); + break; + + case SCI_GETLINE: { // Risk of overwriting the end of the buffer + int lineStart = pdoc->LineStart(static_cast(wParam)); + int lineEnd = pdoc->LineStart(static_cast(wParam + 1)); + if (lParam == 0) { + return lineEnd - lineStart; + } + char *ptr = CharPtrFromSPtr(lParam); + int iPlace = 0; + for (int iChar = lineStart; iChar < lineEnd; iChar++) { + ptr[iPlace++] = pdoc->CharAt(iChar); + } + return iPlace; + } + + case SCI_GETLINECOUNT: + if (pdoc->LinesTotal() == 0) + return 1; + else + return pdoc->LinesTotal(); + + case SCI_GETMODIFY: + return !pdoc->IsSavePoint(); + + case SCI_SETSEL: { + int nStart = static_cast(wParam); + int nEnd = static_cast(lParam); + if (nEnd < 0) + nEnd = pdoc->Length(); + if (nStart < 0) + nStart = nEnd; // Remove selection + InvalidateSelection(SelectionRange(nStart, nEnd)); + sel.Clear(); + sel.selType = Selection::selStream; + SetSelection(nEnd, nStart); + EnsureCaretVisible(); + } + break; + + case SCI_GETSELTEXT: { + SelectionText selectedText; + CopySelectionRange(&selectedText); + if (lParam == 0) { + return selectedText.LengthWithTerminator(); + } else { + char *ptr = CharPtrFromSPtr(lParam); + unsigned int iChar = 0; + if (selectedText.Length()) { + for (; iChar < selectedText.LengthWithTerminator(); iChar++) + ptr[iChar] = selectedText.Data()[iChar]; + } else { + ptr[0] = '\0'; + } + return iChar; + } + } + + case SCI_LINEFROMPOSITION: + if (static_cast(wParam) < 0) + return 0; + return pdoc->LineFromPosition(static_cast(wParam)); + + case SCI_POSITIONFROMLINE: + if (static_cast(wParam) < 0) + wParam = pdoc->LineFromPosition(SelectionStart().Position()); + if (wParam == 0) + return 0; // Even if there is no text, there is a first line that starts at 0 + if (static_cast(wParam) > pdoc->LinesTotal()) + return -1; + //if (wParam > pdoc->LineFromPosition(pdoc->Length())) // Useful test, anyway... + // return -1; + return pdoc->LineStart(static_cast(wParam)); + + // Replacement of the old Scintilla interpretation of EM_LINELENGTH + case SCI_LINELENGTH: + if ((static_cast(wParam) < 0) || + (static_cast(wParam) > pdoc->LineFromPosition(pdoc->Length()))) + return 0; + return pdoc->LineStart(static_cast(wParam) + 1) - pdoc->LineStart(static_cast(wParam)); + + case SCI_REPLACESEL: { + if (lParam == 0) + return 0; + UndoGroup ug(pdoc); + ClearSelection(); + char *replacement = CharPtrFromSPtr(lParam); + const int lengthInserted = pdoc->InsertString( + sel.MainCaret(), replacement, istrlen(replacement)); + SetEmptySelection(sel.MainCaret() + lengthInserted); + EnsureCaretVisible(); + } + break; + + case SCI_SETTARGETSTART: + targetStart = static_cast(wParam); + break; + + case SCI_GETTARGETSTART: + return targetStart; + + case SCI_SETTARGETEND: + targetEnd = static_cast(wParam); + break; + + case SCI_GETTARGETEND: + return targetEnd; + + case SCI_SETTARGETRANGE: + targetStart = static_cast(wParam); + targetEnd = static_cast(lParam); + break; + + case SCI_TARGETFROMSELECTION: + if (sel.MainCaret() < sel.MainAnchor()) { + targetStart = sel.MainCaret(); + targetEnd = sel.MainAnchor(); + } else { + targetStart = sel.MainAnchor(); + targetEnd = sel.MainCaret(); + } + break; + + case SCI_GETTARGETTEXT: { + std::string text = RangeText(targetStart, targetEnd); + return BytesResult(lParam, reinterpret_cast(text.c_str()), text.length()); + } + + case SCI_REPLACETARGET: + PLATFORM_ASSERT(lParam); + return ReplaceTarget(false, CharPtrFromSPtr(lParam), static_cast(wParam)); + + case SCI_REPLACETARGETRE: + PLATFORM_ASSERT(lParam); + return ReplaceTarget(true, CharPtrFromSPtr(lParam), static_cast(wParam)); + + case SCI_SEARCHINTARGET: + PLATFORM_ASSERT(lParam); + return SearchInTarget(CharPtrFromSPtr(lParam), static_cast(wParam)); + + case SCI_SETSEARCHFLAGS: + searchFlags = static_cast(wParam); + break; + + case SCI_GETSEARCHFLAGS: + return searchFlags; + + case SCI_GETTAG: + return GetTag(CharPtrFromSPtr(lParam), static_cast(wParam)); + + case SCI_POSITIONBEFORE: + return pdoc->MovePositionOutsideChar(static_cast(wParam) - 1, -1, true); + + case SCI_POSITIONAFTER: + return pdoc->MovePositionOutsideChar(static_cast(wParam) + 1, 1, true); + + case SCI_POSITIONRELATIVE: + return Platform::Clamp(pdoc->GetRelativePosition(static_cast(wParam), static_cast(lParam)), 0, pdoc->Length()); + + case SCI_LINESCROLL: + ScrollTo(topLine + static_cast(lParam)); + HorizontalScrollTo(xOffset + static_cast(wParam)* static_cast(vs.spaceWidth)); + return 1; + + case SCI_SETXOFFSET: + xOffset = static_cast(wParam); + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); + SetHorizontalScrollPos(); + Redraw(); + break; + + case SCI_GETXOFFSET: + return xOffset; + + case SCI_CHOOSECARETX: + SetLastXChosen(); + break; + + case SCI_SCROLLCARET: + EnsureCaretVisible(); + break; + + case SCI_SETREADONLY: + pdoc->SetReadOnly(wParam != 0); + return 1; + + case SCI_GETREADONLY: + return pdoc->IsReadOnly(); + + case SCI_CANPASTE: + return CanPaste(); + + case SCI_POINTXFROMPOSITION: + if (lParam < 0) { + return 0; + } else { + Point pt = LocationFromPosition(static_cast(lParam)); + // Convert to view-relative + return static_cast(pt.x) - vs.textStart + vs.fixedColumnWidth; + } + + case SCI_POINTYFROMPOSITION: + if (lParam < 0) { + return 0; + } else { + Point pt = LocationFromPosition(static_cast(lParam)); + return static_cast(pt.y); + } + + case SCI_FINDTEXT: + return FindText(wParam, lParam); + + case SCI_GETTEXTRANGE: { + if (lParam == 0) + return 0; + Sci_TextRange *tr = reinterpret_cast(lParam); + int cpMax = static_cast(tr->chrg.cpMax); + if (cpMax == -1) + cpMax = pdoc->Length(); + PLATFORM_ASSERT(cpMax <= pdoc->Length()); + int len = static_cast(cpMax - tr->chrg.cpMin); // No -1 as cpMin and cpMax are referring to inter character positions + pdoc->GetCharRange(tr->lpstrText, static_cast(tr->chrg.cpMin), len); + // Spec says copied text is terminated with a NUL + tr->lpstrText[len] = '\0'; + return len; // Not including NUL + } + + case SCI_HIDESELECTION: + view.hideSelection = wParam != 0; + Redraw(); + break; + + case SCI_FORMATRANGE: + return FormatRange(wParam != 0, reinterpret_cast(lParam)); + + case SCI_GETMARGINLEFT: + return vs.leftMarginWidth; + + case SCI_GETMARGINRIGHT: + return vs.rightMarginWidth; + + case SCI_SETMARGINLEFT: + lastXChosen += static_cast(lParam) - vs.leftMarginWidth; + vs.leftMarginWidth = static_cast(lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETMARGINRIGHT: + vs.rightMarginWidth = static_cast(lParam); + InvalidateStyleRedraw(); + break; + + // Control specific mesages + + case SCI_ADDTEXT: { + if (lParam == 0) + return 0; + const int lengthInserted = pdoc->InsertString( + CurrentPosition(), CharPtrFromSPtr(lParam), static_cast(wParam)); + SetEmptySelection(sel.MainCaret() + lengthInserted); + return 0; + } + + case SCI_ADDSTYLEDTEXT: + if (lParam) + AddStyledText(CharPtrFromSPtr(lParam), static_cast(wParam)); + return 0; + + case SCI_INSERTTEXT: { + if (lParam == 0) + return 0; + int insertPos = static_cast(wParam); + if (static_cast(wParam) == -1) + insertPos = CurrentPosition(); + int newCurrent = CurrentPosition(); + char *sz = CharPtrFromSPtr(lParam); + const int lengthInserted = pdoc->InsertString(insertPos, sz, istrlen(sz)); + if (newCurrent > insertPos) + newCurrent += lengthInserted; + SetEmptySelection(newCurrent); + return 0; + } + + case SCI_CHANGEINSERTION: + PLATFORM_ASSERT(lParam); + pdoc->ChangeInsertion(CharPtrFromSPtr(lParam), static_cast(wParam)); + return 0; + + case SCI_APPENDTEXT: + pdoc->InsertString(pdoc->Length(), CharPtrFromSPtr(lParam), static_cast(wParam)); + return 0; + + case SCI_CLEARALL: + ClearAll(); + return 0; + + case SCI_DELETERANGE: + pdoc->DeleteChars(static_cast(wParam), static_cast(lParam)); + return 0; + + case SCI_CLEARDOCUMENTSTYLE: + ClearDocumentStyle(); + return 0; + + case SCI_SETUNDOCOLLECTION: + pdoc->SetUndoCollection(wParam != 0); + return 0; + + case SCI_GETUNDOCOLLECTION: + return pdoc->IsCollectingUndo(); + + case SCI_BEGINUNDOACTION: + pdoc->BeginUndoAction(); + return 0; + + case SCI_ENDUNDOACTION: + pdoc->EndUndoAction(); + return 0; + + case SCI_GETCARETPERIOD: + return caret.period; + + case SCI_SETCARETPERIOD: + CaretSetPeriod(static_cast(wParam)); + break; + + case SCI_GETWORDCHARS: + return pdoc->GetCharsOfClass(CharClassify::ccWord, reinterpret_cast(lParam)); + + case SCI_SETWORDCHARS: { + pdoc->SetDefaultCharClasses(false); + if (lParam == 0) + return 0; + pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccWord); + } + break; + + case SCI_GETWHITESPACECHARS: + return pdoc->GetCharsOfClass(CharClassify::ccSpace, reinterpret_cast(lParam)); + + case SCI_SETWHITESPACECHARS: { + if (lParam == 0) + return 0; + pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccSpace); + } + break; + + case SCI_GETPUNCTUATIONCHARS: + return pdoc->GetCharsOfClass(CharClassify::ccPunctuation, reinterpret_cast(lParam)); + + case SCI_SETPUNCTUATIONCHARS: { + if (lParam == 0) + return 0; + pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccPunctuation); + } + break; + + case SCI_SETCHARSDEFAULT: + pdoc->SetDefaultCharClasses(true); + break; + + case SCI_GETLENGTH: + return pdoc->Length(); + + case SCI_ALLOCATE: + pdoc->Allocate(static_cast(wParam)); + break; + + case SCI_GETCHARAT: + return pdoc->CharAt(static_cast(wParam)); + + case SCI_SETCURRENTPOS: + if (sel.IsRectangular()) { + sel.Rectangular().caret.SetPosition(static_cast(wParam)); + SetRectangularRange(); + Redraw(); + } else { + SetSelection(static_cast(wParam), sel.MainAnchor()); + } + break; + + case SCI_GETCURRENTPOS: + return sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret(); + + case SCI_SETANCHOR: + if (sel.IsRectangular()) { + sel.Rectangular().anchor.SetPosition(static_cast(wParam)); + SetRectangularRange(); + Redraw(); + } else { + SetSelection(sel.MainCaret(), static_cast(wParam)); + } + break; + + case SCI_GETANCHOR: + return sel.IsRectangular() ? sel.Rectangular().anchor.Position() : sel.MainAnchor(); + + case SCI_SETSELECTIONSTART: + SetSelection(Platform::Maximum(sel.MainCaret(), static_cast(wParam)), static_cast(wParam)); + break; + + case SCI_GETSELECTIONSTART: + return sel.LimitsForRectangularElseMain().start.Position(); + + case SCI_SETSELECTIONEND: + SetSelection(static_cast(wParam), Platform::Minimum(sel.MainAnchor(), static_cast(wParam))); + break; + + case SCI_GETSELECTIONEND: + return sel.LimitsForRectangularElseMain().end.Position(); + + case SCI_SETEMPTYSELECTION: + SetEmptySelection(static_cast(wParam)); + break; + + case SCI_SETPRINTMAGNIFICATION: + view.printParameters.magnification = static_cast(wParam); + break; + + case SCI_GETPRINTMAGNIFICATION: + return view.printParameters.magnification; + + case SCI_SETPRINTCOLOURMODE: + view.printParameters.colourMode = static_cast(wParam); + break; + + case SCI_GETPRINTCOLOURMODE: + return view.printParameters.colourMode; + + case SCI_SETPRINTWRAPMODE: + view.printParameters.wrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone; + break; + + case SCI_GETPRINTWRAPMODE: + return view.printParameters.wrapState; + + case SCI_GETSTYLEAT: + if (static_cast(wParam) >= pdoc->Length()) + return 0; + else + return pdoc->StyleAt(static_cast(wParam)); + + case SCI_REDO: + Redo(); + break; + + case SCI_SELECTALL: + SelectAll(); + break; + + case SCI_SETSAVEPOINT: + pdoc->SetSavePoint(); + break; + + case SCI_GETSTYLEDTEXT: { + if (lParam == 0) + return 0; + Sci_TextRange *tr = reinterpret_cast(lParam); + int iPlace = 0; + for (long iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { + tr->lpstrText[iPlace++] = pdoc->CharAt(static_cast(iChar)); + tr->lpstrText[iPlace++] = pdoc->StyleAt(static_cast(iChar)); + } + tr->lpstrText[iPlace] = '\0'; + tr->lpstrText[iPlace + 1] = '\0'; + return iPlace; + } + + case SCI_CANREDO: + return (pdoc->CanRedo() && !pdoc->IsReadOnly()) ? 1 : 0; + + case SCI_MARKERLINEFROMHANDLE: + return pdoc->LineFromHandle(static_cast(wParam)); + + case SCI_MARKERDELETEHANDLE: + pdoc->DeleteMarkFromHandle(static_cast(wParam)); + break; + + case SCI_GETVIEWWS: + return vs.viewWhitespace; + + case SCI_SETVIEWWS: + vs.viewWhitespace = static_cast(wParam); + Redraw(); + break; + + case SCI_GETWHITESPACESIZE: + return vs.whitespaceSize; + + case SCI_SETWHITESPACESIZE: + vs.whitespaceSize = static_cast(wParam); + Redraw(); + break; + + case SCI_POSITIONFROMPOINT: + return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), + false, false); + + case SCI_POSITIONFROMPOINTCLOSE: + return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), + true, false); + + case SCI_CHARPOSITIONFROMPOINT: + return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), + false, true); + + case SCI_CHARPOSITIONFROMPOINTCLOSE: + return PositionFromLocation(Point::FromInts(static_cast(wParam) - vs.ExternalMarginWidth(), static_cast(lParam)), + true, true); + + case SCI_GOTOLINE: + GoToLine(static_cast(wParam)); + break; + + case SCI_GOTOPOS: + SetEmptySelection(static_cast(wParam)); + EnsureCaretVisible(); + break; + + case SCI_GETCURLINE: { + int lineCurrentPos = pdoc->LineFromPosition(sel.MainCaret()); + int lineStart = pdoc->LineStart(lineCurrentPos); + unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1); + if (lParam == 0) { + return 1 + lineEnd - lineStart; + } + PLATFORM_ASSERT(wParam > 0); + char *ptr = CharPtrFromSPtr(lParam); + unsigned int iPlace = 0; + for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { + ptr[iPlace++] = pdoc->CharAt(iChar); + } + ptr[iPlace] = '\0'; + return sel.MainCaret() - lineStart; + } + + case SCI_GETENDSTYLED: + return pdoc->GetEndStyled(); + + case SCI_GETEOLMODE: + return pdoc->eolMode; + + case SCI_SETEOLMODE: + pdoc->eolMode = static_cast(wParam); + break; + + case SCI_SETLINEENDTYPESALLOWED: + if (pdoc->SetLineEndTypesAllowed(static_cast(wParam))) { + cs.Clear(); + cs.InsertLines(0, pdoc->LinesTotal() - 1); + SetAnnotationHeights(0, pdoc->LinesTotal()); + InvalidateStyleRedraw(); + } + break; + + case SCI_GETLINEENDTYPESALLOWED: + return pdoc->GetLineEndTypesAllowed(); + + case SCI_GETLINEENDTYPESACTIVE: + return pdoc->GetLineEndTypesActive(); + + case SCI_STARTSTYLING: + pdoc->StartStyling(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_SETSTYLING: + pdoc->SetStyleFor(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_SETSTYLINGEX: // Specify a complete styling buffer + if (lParam == 0) + return 0; + pdoc->SetStyles(static_cast(wParam), CharPtrFromSPtr(lParam)); + break; + + case SCI_SETBUFFEREDDRAW: + view.bufferedDraw = wParam != 0; + break; + + case SCI_GETBUFFEREDDRAW: + return view.bufferedDraw; + + case SCI_GETTWOPHASEDRAW: + return view.phasesDraw == EditView::phasesTwo; + + case SCI_SETTWOPHASEDRAW: + if (view.SetTwoPhaseDraw(wParam != 0)) + InvalidateStyleRedraw(); + break; + + case SCI_GETPHASESDRAW: + return view.phasesDraw; + + case SCI_SETPHASESDRAW: + if (view.SetPhasesDraw(static_cast(wParam))) + InvalidateStyleRedraw(); + break; + + case SCI_SETFONTQUALITY: + vs.extraFontFlag &= ~SC_EFF_QUALITY_MASK; + vs.extraFontFlag |= (wParam & SC_EFF_QUALITY_MASK); + InvalidateStyleRedraw(); + break; + + case SCI_GETFONTQUALITY: + return (vs.extraFontFlag & SC_EFF_QUALITY_MASK); + + case SCI_SETTABWIDTH: + if (wParam > 0) { + pdoc->tabInChars = static_cast(wParam); + if (pdoc->indentInChars == 0) + pdoc->actualIndentInChars = pdoc->tabInChars; + } + InvalidateStyleRedraw(); + break; + + case SCI_GETTABWIDTH: + return pdoc->tabInChars; + + case SCI_CLEARTABSTOPS: + if (view.ClearTabstops(static_cast(wParam))) { + DocModification mh(SC_MOD_CHANGETABSTOPS, 0, 0, 0, 0, static_cast(wParam)); + NotifyModified(pdoc, mh, NULL); + } + break; + + case SCI_ADDTABSTOP: + if (view.AddTabstop(static_cast(wParam), static_cast(lParam))) { + DocModification mh(SC_MOD_CHANGETABSTOPS, 0, 0, 0, 0, static_cast(wParam)); + NotifyModified(pdoc, mh, NULL); + } + break; + + case SCI_GETNEXTTABSTOP: + return view.GetNextTabstop(static_cast(wParam), static_cast(lParam)); + + case SCI_SETINDENT: + pdoc->indentInChars = static_cast(wParam); + if (pdoc->indentInChars != 0) + pdoc->actualIndentInChars = pdoc->indentInChars; + else + pdoc->actualIndentInChars = pdoc->tabInChars; + InvalidateStyleRedraw(); + break; + + case SCI_GETINDENT: + return pdoc->indentInChars; + + case SCI_SETUSETABS: + pdoc->useTabs = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_GETUSETABS: + return pdoc->useTabs; + + case SCI_SETLINEINDENTATION: + pdoc->SetLineIndentation(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_GETLINEINDENTATION: + return pdoc->GetLineIndentation(static_cast(wParam)); + + case SCI_GETLINEINDENTPOSITION: + return pdoc->GetLineIndentPosition(static_cast(wParam)); + + case SCI_SETTABINDENTS: + pdoc->tabIndents = wParam != 0; + break; + + case SCI_GETTABINDENTS: + return pdoc->tabIndents; + + case SCI_SETBACKSPACEUNINDENTS: + pdoc->backspaceUnindents = wParam != 0; + break; + + case SCI_GETBACKSPACEUNINDENTS: + return pdoc->backspaceUnindents; + + case SCI_SETMOUSEDWELLTIME: + dwellDelay = static_cast(wParam); + ticksToDwell = dwellDelay; + break; + + case SCI_GETMOUSEDWELLTIME: + return dwellDelay; + + case SCI_WORDSTARTPOSITION: + return pdoc->ExtendWordSelect(static_cast(wParam), -1, lParam != 0); + + case SCI_WORDENDPOSITION: + return pdoc->ExtendWordSelect(static_cast(wParam), 1, lParam != 0); + + case SCI_SETWRAPMODE: + if (vs.SetWrapState(static_cast(wParam))) { + xOffset = 0; + ContainerNeedsUpdate(SC_UPDATE_H_SCROLL); + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + } + break; + + case SCI_GETWRAPMODE: + return vs.wrapState; + + case SCI_SETWRAPVISUALFLAGS: + if (vs.SetWrapVisualFlags(static_cast(wParam))) { + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + } + break; + + case SCI_GETWRAPVISUALFLAGS: + return vs.wrapVisualFlags; + + case SCI_SETWRAPVISUALFLAGSLOCATION: + if (vs.SetWrapVisualFlagsLocation(static_cast(wParam))) { + InvalidateStyleRedraw(); + } + break; + + case SCI_GETWRAPVISUALFLAGSLOCATION: + return vs.wrapVisualFlagsLocation; + + case SCI_SETWRAPSTARTINDENT: + if (vs.SetWrapVisualStartIndent(static_cast(wParam))) { + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + } + break; + + case SCI_GETWRAPSTARTINDENT: + return vs.wrapVisualStartIndent; + + case SCI_SETWRAPINDENTMODE: + if (vs.SetWrapIndentMode(static_cast(wParam))) { + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + } + break; + + case SCI_GETWRAPINDENTMODE: + return vs.wrapIndentMode; + + case SCI_SETLAYOUTCACHE: + view.llc.SetLevel(static_cast(wParam)); + break; + + case SCI_GETLAYOUTCACHE: + return view.llc.GetLevel(); + + case SCI_SETPOSITIONCACHE: + view.posCache.SetSize(wParam); + break; + + case SCI_GETPOSITIONCACHE: + return view.posCache.GetSize(); + + case SCI_SETSCROLLWIDTH: + PLATFORM_ASSERT(wParam > 0); + if ((wParam > 0) && (wParam != static_cast(scrollWidth))) { + view.lineWidthMaxSeen = 0; + scrollWidth = static_cast(wParam); + SetScrollBars(); + } + break; + + case SCI_GETSCROLLWIDTH: + return scrollWidth; + + case SCI_SETSCROLLWIDTHTRACKING: + trackLineWidth = wParam != 0; + break; + + case SCI_GETSCROLLWIDTHTRACKING: + return trackLineWidth; + + case SCI_LINESJOIN: + LinesJoin(); + break; + + case SCI_LINESSPLIT: + LinesSplit(static_cast(wParam)); + break; + + case SCI_TEXTWIDTH: + PLATFORM_ASSERT(wParam < vs.styles.size()); + PLATFORM_ASSERT(lParam); + return TextWidth(static_cast(wParam), CharPtrFromSPtr(lParam)); + + case SCI_TEXTHEIGHT: + return vs.lineHeight; + + case SCI_SETENDATLASTLINE: + PLATFORM_ASSERT((wParam == 0) || (wParam == 1)); + if (endAtLastLine != (wParam != 0)) { + endAtLastLine = wParam != 0; + SetScrollBars(); + } + break; + + case SCI_GETENDATLASTLINE: + return endAtLastLine; + + case SCI_SETCARETSTICKY: + PLATFORM_ASSERT(wParam <= SC_CARETSTICKY_WHITESPACE); + if (wParam <= SC_CARETSTICKY_WHITESPACE) { + caretSticky = static_cast(wParam); + } + break; + + case SCI_GETCARETSTICKY: + return caretSticky; + + case SCI_TOGGLECARETSTICKY: + caretSticky = !caretSticky; + break; + + case SCI_GETCOLUMN: + return pdoc->GetColumn(static_cast(wParam)); + + case SCI_FINDCOLUMN: + return pdoc->FindColumn(static_cast(wParam), static_cast(lParam)); + + case SCI_SETHSCROLLBAR : + if (horizontalScrollBarVisible != (wParam != 0)) { + horizontalScrollBarVisible = wParam != 0; + SetScrollBars(); + ReconfigureScrollBars(); + } + break; + + case SCI_GETHSCROLLBAR: + return horizontalScrollBarVisible; + + case SCI_SETVSCROLLBAR: + if (verticalScrollBarVisible != (wParam != 0)) { + verticalScrollBarVisible = wParam != 0; + SetScrollBars(); + ReconfigureScrollBars(); + if (verticalScrollBarVisible) + SetVerticalScrollPos(); + } + break; + + case SCI_GETVSCROLLBAR: + return verticalScrollBarVisible; + + case SCI_SETINDENTATIONGUIDES: + vs.viewIndentationGuides = IndentView(wParam); + Redraw(); + break; + + case SCI_GETINDENTATIONGUIDES: + return vs.viewIndentationGuides; + + case SCI_SETHIGHLIGHTGUIDE: + if ((highlightGuideColumn != static_cast(wParam)) || (wParam > 0)) { + highlightGuideColumn = static_cast(wParam); + Redraw(); + } + break; + + case SCI_GETHIGHLIGHTGUIDE: + return highlightGuideColumn; + + case SCI_GETLINEENDPOSITION: + return pdoc->LineEnd(static_cast(wParam)); + + case SCI_SETCODEPAGE: + if (ValidCodePage(static_cast(wParam))) { + if (pdoc->SetDBCSCodePage(static_cast(wParam))) { + cs.Clear(); + cs.InsertLines(0, pdoc->LinesTotal() - 1); + SetAnnotationHeights(0, pdoc->LinesTotal()); + InvalidateStyleRedraw(); + SetRepresentations(); + } + } + break; + + case SCI_GETCODEPAGE: + return pdoc->dbcsCodePage; + + case SCI_SETIMEINTERACTION: + imeInteraction = static_cast(wParam); + break; + + case SCI_GETIMEINTERACTION: + return imeInteraction; + +#ifdef INCLUDE_DEPRECATED_FEATURES + case SCI_SETUSEPALETTE: + InvalidateStyleRedraw(); + break; + + case SCI_GETUSEPALETTE: + return 0; +#endif + + // Marker definition and setting + case SCI_MARKERDEFINE: + if (wParam <= MARKER_MAX) { + vs.markers[wParam].markType = static_cast(lParam); + vs.CalcLargestMarkerHeight(); + } + InvalidateStyleData(); + RedrawSelMargin(); + break; + + case SCI_MARKERSYMBOLDEFINED: + if (wParam <= MARKER_MAX) + return vs.markers[wParam].markType; + else + return 0; + + case SCI_MARKERSETFORE: + if (wParam <= MARKER_MAX) + vs.markers[wParam].fore = ColourDesired(static_cast(lParam)); + InvalidateStyleData(); + RedrawSelMargin(); + break; + case SCI_MARKERSETBACKSELECTED: + if (wParam <= MARKER_MAX) + vs.markers[wParam].backSelected = ColourDesired(static_cast(lParam)); + InvalidateStyleData(); + RedrawSelMargin(); + break; + case SCI_MARKERENABLEHIGHLIGHT: + marginView.highlightDelimiter.isEnabled = wParam == 1; + RedrawSelMargin(); + break; + case SCI_MARKERSETBACK: + if (wParam <= MARKER_MAX) + vs.markers[wParam].back = ColourDesired(static_cast(lParam)); + InvalidateStyleData(); + RedrawSelMargin(); + break; + case SCI_MARKERSETALPHA: + if (wParam <= MARKER_MAX) + vs.markers[wParam].alpha = static_cast(lParam); + InvalidateStyleRedraw(); + break; + case SCI_MARKERADD: { + int markerID = pdoc->AddMark(static_cast(wParam), static_cast(lParam)); + return markerID; + } + case SCI_MARKERADDSET: + if (lParam != 0) + pdoc->AddMarkSet(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_MARKERDELETE: + pdoc->DeleteMark(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_MARKERDELETEALL: + pdoc->DeleteAllMarks(static_cast(wParam)); + break; + + case SCI_MARKERGET: + return pdoc->GetMark(static_cast(wParam)); + + case SCI_MARKERNEXT: + return pdoc->MarkerNext(static_cast(wParam), static_cast(lParam)); + + case SCI_MARKERPREVIOUS: { + for (int iLine = static_cast(wParam); iLine >= 0; iLine--) { + if ((pdoc->GetMark(iLine) & lParam) != 0) + return iLine; + } + } + return -1; + + case SCI_MARKERDEFINEPIXMAP: + if (wParam <= MARKER_MAX) { + vs.markers[wParam].SetXPM(CharPtrFromSPtr(lParam)); + vs.CalcLargestMarkerHeight(); + } + InvalidateStyleData(); + RedrawSelMargin(); + break; + + case SCI_RGBAIMAGESETWIDTH: + sizeRGBAImage.x = static_cast(wParam); + break; + + case SCI_RGBAIMAGESETHEIGHT: + sizeRGBAImage.y = static_cast(wParam); + break; + + case SCI_RGBAIMAGESETSCALE: + scaleRGBAImage = static_cast(wParam); + break; + + case SCI_MARKERDEFINERGBAIMAGE: + if (wParam <= MARKER_MAX) { + vs.markers[wParam].SetRGBAImage(sizeRGBAImage, scaleRGBAImage / 100.0f, reinterpret_cast(lParam)); + vs.CalcLargestMarkerHeight(); + } + InvalidateStyleData(); + RedrawSelMargin(); + break; + + case SCI_SETMARGINTYPEN: + if (ValidMargin(wParam)) { + vs.ms[wParam].style = static_cast(lParam); + InvalidateStyleRedraw(); + } + break; + + case SCI_GETMARGINTYPEN: + if (ValidMargin(wParam)) + return vs.ms[wParam].style; + else + return 0; + + case SCI_SETMARGINWIDTHN: + if (ValidMargin(wParam)) { + // Short-circuit if the width is unchanged, to avoid unnecessary redraw. + if (vs.ms[wParam].width != lParam) { + lastXChosen += static_cast(lParam) - vs.ms[wParam].width; + vs.ms[wParam].width = static_cast(lParam); + InvalidateStyleRedraw(); + } + } + break; + + case SCI_GETMARGINWIDTHN: + if (ValidMargin(wParam)) + return vs.ms[wParam].width; + else + return 0; + + case SCI_SETMARGINMASKN: + if (ValidMargin(wParam)) { + vs.ms[wParam].mask = static_cast(lParam); + InvalidateStyleRedraw(); + } + break; + + case SCI_GETMARGINMASKN: + if (ValidMargin(wParam)) + return vs.ms[wParam].mask; + else + return 0; + + case SCI_SETMARGINSENSITIVEN: + if (ValidMargin(wParam)) { + vs.ms[wParam].sensitive = lParam != 0; + InvalidateStyleRedraw(); + } + break; + + case SCI_GETMARGINSENSITIVEN: + if (ValidMargin(wParam)) + return vs.ms[wParam].sensitive ? 1 : 0; + else + return 0; + + case SCI_SETMARGINCURSORN: + if (ValidMargin(wParam)) + vs.ms[wParam].cursor = static_cast(lParam); + break; + + case SCI_GETMARGINCURSORN: + if (ValidMargin(wParam)) + return vs.ms[wParam].cursor; + else + return 0; + + case SCI_STYLECLEARALL: + vs.ClearStyles(); + InvalidateStyleRedraw(); + break; + + case SCI_STYLESETFORE: + case SCI_STYLESETBACK: + case SCI_STYLESETBOLD: + case SCI_STYLESETWEIGHT: + case SCI_STYLESETITALIC: + case SCI_STYLESETEOLFILLED: + case SCI_STYLESETSIZE: + case SCI_STYLESETSIZEFRACTIONAL: + case SCI_STYLESETFONT: + case SCI_STYLESETUNDERLINE: + case SCI_STYLESETCASE: + case SCI_STYLESETCHARACTERSET: + case SCI_STYLESETVISIBLE: + case SCI_STYLESETCHANGEABLE: + case SCI_STYLESETHOTSPOT: + StyleSetMessage(iMessage, wParam, lParam); + break; + + case SCI_STYLEGETFORE: + case SCI_STYLEGETBACK: + case SCI_STYLEGETBOLD: + case SCI_STYLEGETWEIGHT: + case SCI_STYLEGETITALIC: + case SCI_STYLEGETEOLFILLED: + case SCI_STYLEGETSIZE: + case SCI_STYLEGETSIZEFRACTIONAL: + case SCI_STYLEGETFONT: + case SCI_STYLEGETUNDERLINE: + case SCI_STYLEGETCASE: + case SCI_STYLEGETCHARACTERSET: + case SCI_STYLEGETVISIBLE: + case SCI_STYLEGETCHANGEABLE: + case SCI_STYLEGETHOTSPOT: + return StyleGetMessage(iMessage, wParam, lParam); + + case SCI_STYLERESETDEFAULT: + vs.ResetDefaultStyle(); + InvalidateStyleRedraw(); + break; + case SCI_SETSTYLEBITS: + vs.EnsureStyle(0xff); + break; + + case SCI_GETSTYLEBITS: + return 8; + + case SCI_SETLINESTATE: + return pdoc->SetLineState(static_cast(wParam), static_cast(lParam)); + + case SCI_GETLINESTATE: + return pdoc->GetLineState(static_cast(wParam)); + + case SCI_GETMAXLINESTATE: + return pdoc->GetMaxLineState(); + + case SCI_GETCARETLINEVISIBLE: + return vs.showCaretLineBackground; + case SCI_SETCARETLINEVISIBLE: + vs.showCaretLineBackground = wParam != 0; + InvalidateStyleRedraw(); + break; + case SCI_GETCARETLINEVISIBLEALWAYS: + return vs.alwaysShowCaretLineBackground; + case SCI_SETCARETLINEVISIBLEALWAYS: + vs.alwaysShowCaretLineBackground = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETLINEBACK: + return vs.caretLineBackground.AsLong(); + case SCI_SETCARETLINEBACK: + vs.caretLineBackground = static_cast(wParam); + InvalidateStyleRedraw(); + break; + case SCI_GETCARETLINEBACKALPHA: + return vs.caretLineAlpha; + case SCI_SETCARETLINEBACKALPHA: + vs.caretLineAlpha = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + // Folding messages + + case SCI_VISIBLEFROMDOCLINE: + return cs.DisplayFromDoc(static_cast(wParam)); + + case SCI_DOCLINEFROMVISIBLE: + return cs.DocFromDisplay(static_cast(wParam)); + + case SCI_WRAPCOUNT: + return WrapCount(static_cast(wParam)); + + case SCI_SETFOLDLEVEL: { + int prev = pdoc->SetLevel(static_cast(wParam), static_cast(lParam)); + if (prev != static_cast(lParam)) + RedrawSelMargin(); + return prev; + } + + case SCI_GETFOLDLEVEL: + return pdoc->GetLevel(static_cast(wParam)); + + case SCI_GETLASTCHILD: + return pdoc->GetLastChild(static_cast(wParam), static_cast(lParam)); + + case SCI_GETFOLDPARENT: + return pdoc->GetFoldParent(static_cast(wParam)); + + case SCI_SHOWLINES: + cs.SetVisible(static_cast(wParam), static_cast(lParam), true); + SetScrollBars(); + Redraw(); + break; + + case SCI_HIDELINES: + if (wParam > 0) + cs.SetVisible(static_cast(wParam), static_cast(lParam), false); + SetScrollBars(); + Redraw(); + break; + + case SCI_GETLINEVISIBLE: + return cs.GetVisible(static_cast(wParam)); + + case SCI_GETALLLINESVISIBLE: + return cs.HiddenLines() ? 0 : 1; + + case SCI_SETFOLDEXPANDED: + SetFoldExpanded(static_cast(wParam), lParam != 0); + break; + + case SCI_GETFOLDEXPANDED: + return cs.GetExpanded(static_cast(wParam)); + + case SCI_SETAUTOMATICFOLD: + foldAutomatic = static_cast(wParam); + break; + + case SCI_GETAUTOMATICFOLD: + return foldAutomatic; + + case SCI_SETFOLDFLAGS: + foldFlags = static_cast(wParam); + Redraw(); + break; + + case SCI_TOGGLEFOLD: + FoldLine(static_cast(wParam), SC_FOLDACTION_TOGGLE); + break; + + case SCI_FOLDLINE: + FoldLine(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_FOLDCHILDREN: + FoldExpand(static_cast(wParam), static_cast(lParam), pdoc->GetLevel(static_cast(wParam))); + break; + + case SCI_FOLDALL: + FoldAll(static_cast(wParam)); + break; + + case SCI_EXPANDCHILDREN: + FoldExpand(static_cast(wParam), SC_FOLDACTION_EXPAND, static_cast(lParam)); + break; + + case SCI_CONTRACTEDFOLDNEXT: + return ContractedFoldNext(static_cast(wParam)); + + case SCI_ENSUREVISIBLE: + EnsureLineVisible(static_cast(wParam), false); + break; + + case SCI_ENSUREVISIBLEENFORCEPOLICY: + EnsureLineVisible(static_cast(wParam), true); + break; + + case SCI_SCROLLRANGE: + ScrollRange(SelectionRange(static_cast(wParam), static_cast(lParam))); + break; + + case SCI_SEARCHANCHOR: + SearchAnchor(); + break; + + case SCI_SEARCHNEXT: + case SCI_SEARCHPREV: + return SearchText(iMessage, wParam, lParam); + + case SCI_SETXCARETPOLICY: + caretXPolicy = static_cast(wParam); + caretXSlop = static_cast(lParam); + break; + + case SCI_SETYCARETPOLICY: + caretYPolicy = static_cast(wParam); + caretYSlop = static_cast(lParam); + break; + + case SCI_SETVISIBLEPOLICY: + visiblePolicy = static_cast(wParam); + visibleSlop = static_cast(lParam); + break; + + case SCI_LINESONSCREEN: + return LinesOnScreen(); + + case SCI_SETSELFORE: + vs.selColours.fore = ColourOptional(wParam, lParam); + vs.selAdditionalForeground = ColourDesired(static_cast(lParam)); + InvalidateStyleRedraw(); + break; + + case SCI_SETSELBACK: + vs.selColours.back = ColourOptional(wParam, lParam); + vs.selAdditionalBackground = ColourDesired(static_cast(lParam)); + InvalidateStyleRedraw(); + break; + + case SCI_SETSELALPHA: + vs.selAlpha = static_cast(wParam); + vs.selAdditionalAlpha = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETSELALPHA: + return vs.selAlpha; + + case SCI_GETSELEOLFILLED: + return vs.selEOLFilled; + + case SCI_SETSELEOLFILLED: + vs.selEOLFilled = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_SETWHITESPACEFORE: + vs.whitespaceColours.fore = ColourOptional(wParam, lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETWHITESPACEBACK: + vs.whitespaceColours.back = ColourOptional(wParam, lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETCARETFORE: + vs.caretcolour = ColourDesired(static_cast(wParam)); + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETFORE: + return vs.caretcolour.AsLong(); + + case SCI_SETCARETSTYLE: + if (wParam <= CARETSTYLE_BLOCK) + vs.caretStyle = static_cast(wParam); + else + /* Default to the line caret */ + vs.caretStyle = CARETSTYLE_LINE; + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETSTYLE: + return vs.caretStyle; + + case SCI_SETCARETWIDTH: + if (static_cast(wParam) <= 0) + vs.caretWidth = 0; + else if (wParam >= 3) + vs.caretWidth = 3; + else + vs.caretWidth = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETWIDTH: + return vs.caretWidth; + + case SCI_ASSIGNCMDKEY: + kmap.AssignCmdKey(Platform::LowShortFromLong(static_cast(wParam)), + Platform::HighShortFromLong(static_cast(wParam)), static_cast(lParam)); + break; + + case SCI_CLEARCMDKEY: + kmap.AssignCmdKey(Platform::LowShortFromLong(static_cast(wParam)), + Platform::HighShortFromLong(static_cast(wParam)), SCI_NULL); + break; + + case SCI_CLEARALLCMDKEYS: + kmap.Clear(); + break; + + case SCI_INDICSETSTYLE: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].sacNormal.style = static_cast(lParam); + vs.indicators[wParam].sacHover.style = static_cast(lParam); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETSTYLE: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.style : 0; + + case SCI_INDICSETFORE: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].sacNormal.fore = ColourDesired(static_cast(lParam)); + vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast(lParam)); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETFORE: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.fore.AsLong() : 0; + + case SCI_INDICSETHOVERSTYLE: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].sacHover.style = static_cast(lParam); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETHOVERSTYLE: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.style : 0; + + case SCI_INDICSETHOVERFORE: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast(lParam)); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETHOVERFORE: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.fore.AsLong() : 0; + + case SCI_INDICSETFLAGS: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].SetFlags(static_cast(lParam)); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETFLAGS: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].Flags() : 0; + + case SCI_INDICSETUNDER: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].under = lParam != 0; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETUNDER: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; + + case SCI_INDICSETALPHA: + if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) { + vs.indicators[wParam].fillAlpha = static_cast(lParam); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETALPHA: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fillAlpha : 0; + + case SCI_INDICSETOUTLINEALPHA: + if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) { + vs.indicators[wParam].outlineAlpha = static_cast(lParam); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETOUTLINEALPHA: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].outlineAlpha : 0; + + case SCI_SETINDICATORCURRENT: + pdoc->decorations.SetCurrentIndicator(static_cast(wParam)); + break; + case SCI_GETINDICATORCURRENT: + return pdoc->decorations.GetCurrentIndicator(); + case SCI_SETINDICATORVALUE: + pdoc->decorations.SetCurrentValue(static_cast(wParam)); + break; + case SCI_GETINDICATORVALUE: + return pdoc->decorations.GetCurrentValue(); + + case SCI_INDICATORFILLRANGE: + pdoc->DecorationFillRange(static_cast(wParam), pdoc->decorations.GetCurrentValue(), static_cast(lParam)); + break; + + case SCI_INDICATORCLEARRANGE: + pdoc->DecorationFillRange(static_cast(wParam), 0, static_cast(lParam)); + break; + + case SCI_INDICATORALLONFOR: + return pdoc->decorations.AllOnFor(static_cast(wParam)); + + case SCI_INDICATORVALUEAT: + return pdoc->decorations.ValueAt(static_cast(wParam), static_cast(lParam)); + + case SCI_INDICATORSTART: + return pdoc->decorations.Start(static_cast(wParam), static_cast(lParam)); + + case SCI_INDICATOREND: + return pdoc->decorations.End(static_cast(wParam), static_cast(lParam)); + + case SCI_LINEDOWN: + case SCI_LINEDOWNEXTEND: + case SCI_PARADOWN: + case SCI_PARADOWNEXTEND: + case SCI_LINEUP: + case SCI_LINEUPEXTEND: + case SCI_PARAUP: + case SCI_PARAUPEXTEND: + case SCI_CHARLEFT: + case SCI_CHARLEFTEXTEND: + case SCI_CHARRIGHT: + case SCI_CHARRIGHTEXTEND: + case SCI_WORDLEFT: + case SCI_WORDLEFTEXTEND: + case SCI_WORDRIGHT: + case SCI_WORDRIGHTEXTEND: + case SCI_WORDLEFTEND: + case SCI_WORDLEFTENDEXTEND: + case SCI_WORDRIGHTEND: + case SCI_WORDRIGHTENDEXTEND: + case SCI_HOME: + case SCI_HOMEEXTEND: + case SCI_LINEEND: + case SCI_LINEENDEXTEND: + case SCI_HOMEWRAP: + case SCI_HOMEWRAPEXTEND: + case SCI_LINEENDWRAP: + case SCI_LINEENDWRAPEXTEND: + case SCI_DOCUMENTSTART: + case SCI_DOCUMENTSTARTEXTEND: + case SCI_DOCUMENTEND: + case SCI_DOCUMENTENDEXTEND: + case SCI_SCROLLTOSTART: + case SCI_SCROLLTOEND: + + case SCI_STUTTEREDPAGEUP: + case SCI_STUTTEREDPAGEUPEXTEND: + case SCI_STUTTEREDPAGEDOWN: + case SCI_STUTTEREDPAGEDOWNEXTEND: + + case SCI_PAGEUP: + case SCI_PAGEUPEXTEND: + case SCI_PAGEDOWN: + case SCI_PAGEDOWNEXTEND: + case SCI_EDITTOGGLEOVERTYPE: + case SCI_CANCEL: + case SCI_DELETEBACK: + case SCI_TAB: + case SCI_BACKTAB: + case SCI_NEWLINE: + case SCI_FORMFEED: + case SCI_VCHOME: + case SCI_VCHOMEEXTEND: + case SCI_VCHOMEWRAP: + case SCI_VCHOMEWRAPEXTEND: + case SCI_VCHOMEDISPLAY: + case SCI_VCHOMEDISPLAYEXTEND: + case SCI_ZOOMIN: + case SCI_ZOOMOUT: + case SCI_DELWORDLEFT: + case SCI_DELWORDRIGHT: + case SCI_DELWORDRIGHTEND: + case SCI_DELLINELEFT: + case SCI_DELLINERIGHT: + case SCI_LINECOPY: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: + case SCI_LINESCROLLDOWN: + case SCI_LINESCROLLUP: + case SCI_WORDPARTLEFT: + case SCI_WORDPARTLEFTEXTEND: + case SCI_WORDPARTRIGHT: + case SCI_WORDPARTRIGHTEXTEND: + case SCI_DELETEBACKNOTLINE: + case SCI_HOMEDISPLAY: + case SCI_HOMEDISPLAYEXTEND: + case SCI_LINEENDDISPLAY: + case SCI_LINEENDDISPLAYEXTEND: + case SCI_LINEDOWNRECTEXTEND: + case SCI_LINEUPRECTEXTEND: + case SCI_CHARLEFTRECTEXTEND: + case SCI_CHARRIGHTRECTEXTEND: + case SCI_HOMERECTEXTEND: + case SCI_VCHOMERECTEXTEND: + case SCI_LINEENDRECTEXTEND: + case SCI_PAGEUPRECTEXTEND: + case SCI_PAGEDOWNRECTEXTEND: + case SCI_SELECTIONDUPLICATE: + return KeyCommand(iMessage); + + case SCI_BRACEHIGHLIGHT: + SetBraceHighlight(static_cast(wParam), static_cast(lParam), STYLE_BRACELIGHT); + break; + + case SCI_BRACEHIGHLIGHTINDICATOR: + if (lParam >= 0 && lParam <= INDIC_MAX) { + vs.braceHighlightIndicatorSet = wParam != 0; + vs.braceHighlightIndicator = static_cast(lParam); + } + break; + + case SCI_BRACEBADLIGHT: + SetBraceHighlight(static_cast(wParam), -1, STYLE_BRACEBAD); + break; + + case SCI_BRACEBADLIGHTINDICATOR: + if (lParam >= 0 && lParam <= INDIC_MAX) { + vs.braceBadLightIndicatorSet = wParam != 0; + vs.braceBadLightIndicator = static_cast(lParam); + } + break; + + case SCI_BRACEMATCH: + // wParam is position of char to find brace for, + // lParam is maximum amount of text to restyle to find it + return pdoc->BraceMatch(static_cast(wParam), static_cast(lParam)); + + case SCI_GETVIEWEOL: + return vs.viewEOL; + + case SCI_SETVIEWEOL: + vs.viewEOL = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_SETZOOM: + vs.zoomLevel = static_cast(wParam); + InvalidateStyleRedraw(); + NotifyZoom(); + break; + + case SCI_GETZOOM: + return vs.zoomLevel; + + case SCI_GETEDGECOLUMN: + return vs.theEdge; + + case SCI_SETEDGECOLUMN: + vs.theEdge = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETEDGEMODE: + return vs.edgeState; + + case SCI_SETEDGEMODE: + vs.edgeState = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETEDGECOLOUR: + return vs.edgecolour.AsLong(); + + case SCI_SETEDGECOLOUR: + vs.edgecolour = ColourDesired(static_cast(wParam)); + InvalidateStyleRedraw(); + break; + + case SCI_GETDOCPOINTER: + return reinterpret_cast(pdoc); + + case SCI_SETDOCPOINTER: + CancelModes(); + SetDocPointer(reinterpret_cast(lParam)); + return 0; + + case SCI_CREATEDOCUMENT: { + Document *doc = new Document(); + doc->AddRef(); + return reinterpret_cast(doc); + } + + case SCI_ADDREFDOCUMENT: + (reinterpret_cast(lParam))->AddRef(); + break; + + case SCI_RELEASEDOCUMENT: + (reinterpret_cast(lParam))->Release(); + break; + + case SCI_CREATELOADER: { + Document *doc = new Document(); + doc->AddRef(); + doc->Allocate(static_cast(wParam)); + doc->SetUndoCollection(false); + return reinterpret_cast(static_cast(doc)); + } + + case SCI_SETMODEVENTMASK: + modEventMask = static_cast(wParam); + return 0; + + case SCI_GETMODEVENTMASK: + return modEventMask; + + case SCI_CONVERTEOLS: + pdoc->ConvertLineEnds(static_cast(wParam)); + SetSelection(sel.MainCaret(), sel.MainAnchor()); // Ensure selection inside document + return 0; + + case SCI_SETLENGTHFORENCODE: + lengthForEncode = static_cast(wParam); + return 0; + + case SCI_SELECTIONISRECTANGLE: + return sel.selType == Selection::selRectangle ? 1 : 0; + + case SCI_SETSELECTIONMODE: { + switch (wParam) { + case SC_SEL_STREAM: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selStream)); + sel.selType = Selection::selStream; + break; + case SC_SEL_RECTANGLE: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selRectangle)); + sel.selType = Selection::selRectangle; + break; + case SC_SEL_LINES: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selLines)); + sel.selType = Selection::selLines; + break; + case SC_SEL_THIN: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selThin)); + sel.selType = Selection::selThin; + break; + default: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selStream)); + sel.selType = Selection::selStream; + } + InvalidateSelection(sel.RangeMain(), true); + break; + } + case SCI_GETSELECTIONMODE: + switch (sel.selType) { + case Selection::selStream: + return SC_SEL_STREAM; + case Selection::selRectangle: + return SC_SEL_RECTANGLE; + case Selection::selLines: + return SC_SEL_LINES; + case Selection::selThin: + return SC_SEL_THIN; + default: // ?! + return SC_SEL_STREAM; + } + case SCI_GETLINESELSTARTPOSITION: + case SCI_GETLINESELENDPOSITION: { + SelectionSegment segmentLine(SelectionPosition(pdoc->LineStart(static_cast(wParam))), + SelectionPosition(pdoc->LineEnd(static_cast(wParam)))); + for (size_t r=0; r(wParam); + break; + + case SCI_GETSTATUS: + return errorStatus; + + case SCI_SETMOUSEDOWNCAPTURES: + mouseDownCaptures = wParam != 0; + break; + + case SCI_GETMOUSEDOWNCAPTURES: + return mouseDownCaptures; + + case SCI_SETCURSOR: + cursorMode = static_cast(wParam); + DisplayCursor(Window::cursorText); + break; + + case SCI_GETCURSOR: + return cursorMode; + + case SCI_SETCONTROLCHARSYMBOL: + vs.controlCharSymbol = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETCONTROLCHARSYMBOL: + return vs.controlCharSymbol; + + case SCI_SETREPRESENTATION: + reprs.SetRepresentation(reinterpret_cast(wParam), CharPtrFromSPtr(lParam)); + break; + + case SCI_GETREPRESENTATION: { + const Representation *repr = reprs.RepresentationFromCharacter( + reinterpret_cast(wParam), UTF8MaxBytes); + if (repr) { + return StringResult(lParam, repr->stringRep.c_str()); + } + return 0; + } + + case SCI_CLEARREPRESENTATION: + reprs.ClearRepresentation(reinterpret_cast(wParam)); + break; + + case SCI_STARTRECORD: + recordingMacro = true; + return 0; + + case SCI_STOPRECORD: + recordingMacro = false; + return 0; + + case SCI_MOVECARETINSIDEVIEW: + MoveCaretInsideView(); + break; + + case SCI_SETFOLDMARGINCOLOUR: + vs.foldmarginColour = ColourOptional(wParam, lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETFOLDMARGINHICOLOUR: + vs.foldmarginHighlightColour = ColourOptional(wParam, lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETHOTSPOTACTIVEFORE: + vs.hotspotColours.fore = ColourOptional(wParam, lParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETHOTSPOTACTIVEFORE: + return vs.hotspotColours.fore.AsLong(); + + case SCI_SETHOTSPOTACTIVEBACK: + vs.hotspotColours.back = ColourOptional(wParam, lParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETHOTSPOTACTIVEBACK: + return vs.hotspotColours.back.AsLong(); + + case SCI_SETHOTSPOTACTIVEUNDERLINE: + vs.hotspotUnderline = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_GETHOTSPOTACTIVEUNDERLINE: + return vs.hotspotUnderline ? 1 : 0; + + case SCI_SETHOTSPOTSINGLELINE: + vs.hotspotSingleLine = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_GETHOTSPOTSINGLELINE: + return vs.hotspotSingleLine ? 1 : 0; + + case SCI_SETPASTECONVERTENDINGS: + convertPastes = wParam != 0; + break; + + case SCI_GETPASTECONVERTENDINGS: + return convertPastes ? 1 : 0; + + case SCI_GETCHARACTERPOINTER: + return reinterpret_cast(pdoc->BufferPointer()); + + case SCI_GETRANGEPOINTER: + return reinterpret_cast(pdoc->RangePointer(static_cast(wParam), static_cast(lParam))); + + case SCI_GETGAPPOSITION: + return pdoc->GapPosition(); + + case SCI_SETEXTRAASCENT: + vs.extraAscent = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETEXTRAASCENT: + return vs.extraAscent; + + case SCI_SETEXTRADESCENT: + vs.extraDescent = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETEXTRADESCENT: + return vs.extraDescent; + + case SCI_MARGINSETSTYLEOFFSET: + vs.marginStyleOffset = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_MARGINGETSTYLEOFFSET: + return vs.marginStyleOffset; + + case SCI_SETMARGINOPTIONS: + marginOptions = static_cast(wParam); + break; + + case SCI_GETMARGINOPTIONS: + return marginOptions; + + case SCI_MARGINSETTEXT: + pdoc->MarginSetText(static_cast(wParam), CharPtrFromSPtr(lParam)); + break; + + case SCI_MARGINGETTEXT: { + const StyledText st = pdoc->MarginStyledText(static_cast(wParam)); + return BytesResult(lParam, reinterpret_cast(st.text), st.length); + } + + case SCI_MARGINSETSTYLE: + pdoc->MarginSetStyle(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_MARGINGETSTYLE: { + const StyledText st = pdoc->MarginStyledText(static_cast(wParam)); + return st.style; + } + + case SCI_MARGINSETSTYLES: + pdoc->MarginSetStyles(static_cast(wParam), reinterpret_cast(lParam)); + break; + + case SCI_MARGINGETSTYLES: { + const StyledText st = pdoc->MarginStyledText(static_cast(wParam)); + return BytesResult(lParam, st.styles, st.length); + } + + case SCI_MARGINTEXTCLEARALL: + pdoc->MarginClearAll(); + break; + + case SCI_ANNOTATIONSETTEXT: + pdoc->AnnotationSetText(static_cast(wParam), CharPtrFromSPtr(lParam)); + break; + + case SCI_ANNOTATIONGETTEXT: { + const StyledText st = pdoc->AnnotationStyledText(static_cast(wParam)); + return BytesResult(lParam, reinterpret_cast(st.text), st.length); + } + + case SCI_ANNOTATIONGETSTYLE: { + const StyledText st = pdoc->AnnotationStyledText(static_cast(wParam)); + return st.style; + } + + case SCI_ANNOTATIONSETSTYLE: + pdoc->AnnotationSetStyle(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_ANNOTATIONSETSTYLES: + pdoc->AnnotationSetStyles(static_cast(wParam), reinterpret_cast(lParam)); + break; + + case SCI_ANNOTATIONGETSTYLES: { + const StyledText st = pdoc->AnnotationStyledText(static_cast(wParam)); + return BytesResult(lParam, st.styles, st.length); + } + + case SCI_ANNOTATIONGETLINES: + return pdoc->AnnotationLines(static_cast(wParam)); + + case SCI_ANNOTATIONCLEARALL: + pdoc->AnnotationClearAll(); + break; + + case SCI_ANNOTATIONSETVISIBLE: + SetAnnotationVisible(static_cast(wParam)); + break; + + case SCI_ANNOTATIONGETVISIBLE: + return vs.annotationVisible; + + case SCI_ANNOTATIONSETSTYLEOFFSET: + vs.annotationStyleOffset = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_ANNOTATIONGETSTYLEOFFSET: + return vs.annotationStyleOffset; + + case SCI_RELEASEALLEXTENDEDSTYLES: + vs.ReleaseAllExtendedStyles(); + break; + + case SCI_ALLOCATEEXTENDEDSTYLES: + return vs.AllocateExtendedStyles(static_cast(wParam)); + + case SCI_ADDUNDOACTION: + pdoc->AddUndoAction(static_cast(wParam), lParam & UNDO_MAY_COALESCE); + break; + + case SCI_SETMOUSESELECTIONRECTANGULARSWITCH: + mouseSelectionRectangularSwitch = wParam != 0; + break; + + case SCI_GETMOUSESELECTIONRECTANGULARSWITCH: + return mouseSelectionRectangularSwitch; + + case SCI_SETMULTIPLESELECTION: + multipleSelection = wParam != 0; + InvalidateCaret(); + break; + + case SCI_GETMULTIPLESELECTION: + return multipleSelection; + + case SCI_SETADDITIONALSELECTIONTYPING: + additionalSelectionTyping = wParam != 0; + InvalidateCaret(); + break; + + case SCI_GETADDITIONALSELECTIONTYPING: + return additionalSelectionTyping; + + case SCI_SETMULTIPASTE: + multiPasteMode = static_cast(wParam); + break; + + case SCI_GETMULTIPASTE: + return multiPasteMode; + + case SCI_SETADDITIONALCARETSBLINK: + view.additionalCaretsBlink = wParam != 0; + InvalidateCaret(); + break; + + case SCI_GETADDITIONALCARETSBLINK: + return view.additionalCaretsBlink; + + case SCI_SETADDITIONALCARETSVISIBLE: + view.additionalCaretsVisible = wParam != 0; + InvalidateCaret(); + break; + + case SCI_GETADDITIONALCARETSVISIBLE: + return view.additionalCaretsVisible; + + case SCI_GETSELECTIONS: + return sel.Count(); + + case SCI_GETSELECTIONEMPTY: + return sel.Empty(); + + case SCI_CLEARSELECTIONS: + sel.Clear(); + Redraw(); + break; + + case SCI_SETSELECTION: + sel.SetSelection(SelectionRange(static_cast(wParam), static_cast(lParam))); + Redraw(); + break; + + case SCI_ADDSELECTION: + sel.AddSelection(SelectionRange(static_cast(wParam), static_cast(lParam))); + Redraw(); + break; + + case SCI_DROPSELECTIONN: + sel.DropSelection(static_cast(wParam)); + Redraw(); + break; + + case SCI_SETMAINSELECTION: + sel.SetMain(static_cast(wParam)); + Redraw(); + break; + + case SCI_GETMAINSELECTION: + return sel.Main(); + + case SCI_SETSELECTIONNCARET: + sel.Range(wParam).caret.SetPosition(static_cast(lParam)); + Redraw(); + break; + + case SCI_GETSELECTIONNCARET: + return sel.Range(wParam).caret.Position(); + + case SCI_SETSELECTIONNANCHOR: + sel.Range(wParam).anchor.SetPosition(static_cast(lParam)); + Redraw(); + break; + case SCI_GETSELECTIONNANCHOR: + return sel.Range(wParam).anchor.Position(); + + case SCI_SETSELECTIONNCARETVIRTUALSPACE: + sel.Range(wParam).caret.SetVirtualSpace(static_cast(lParam)); + Redraw(); + break; + + case SCI_GETSELECTIONNCARETVIRTUALSPACE: + return sel.Range(wParam).caret.VirtualSpace(); + + case SCI_SETSELECTIONNANCHORVIRTUALSPACE: + sel.Range(wParam).anchor.SetVirtualSpace(static_cast(lParam)); + Redraw(); + break; + + case SCI_GETSELECTIONNANCHORVIRTUALSPACE: + return sel.Range(wParam).anchor.VirtualSpace(); + + case SCI_SETSELECTIONNSTART: + sel.Range(wParam).anchor.SetPosition(static_cast(lParam)); + Redraw(); + break; + + case SCI_GETSELECTIONNSTART: + return sel.Range(wParam).Start().Position(); + + case SCI_SETSELECTIONNEND: + sel.Range(wParam).caret.SetPosition(static_cast(lParam)); + Redraw(); + break; + + case SCI_GETSELECTIONNEND: + return sel.Range(wParam).End().Position(); + + case SCI_SETRECTANGULARSELECTIONCARET: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().caret.SetPosition(static_cast(wParam)); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONCARET: + return sel.Rectangular().caret.Position(); + + case SCI_SETRECTANGULARSELECTIONANCHOR: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().anchor.SetPosition(static_cast(wParam)); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONANCHOR: + return sel.Rectangular().anchor.Position(); + + case SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().caret.SetVirtualSpace(static_cast(wParam)); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE: + return sel.Rectangular().caret.VirtualSpace(); + + case SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().anchor.SetVirtualSpace(static_cast(wParam)); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE: + return sel.Rectangular().anchor.VirtualSpace(); + + case SCI_SETVIRTUALSPACEOPTIONS: + virtualSpaceOptions = static_cast(wParam); + break; + + case SCI_GETVIRTUALSPACEOPTIONS: + return virtualSpaceOptions; + + case SCI_SETADDITIONALSELFORE: + vs.selAdditionalForeground = ColourDesired(static_cast(wParam)); + InvalidateStyleRedraw(); + break; + + case SCI_SETADDITIONALSELBACK: + vs.selAdditionalBackground = ColourDesired(static_cast(wParam)); + InvalidateStyleRedraw(); + break; + + case SCI_SETADDITIONALSELALPHA: + vs.selAdditionalAlpha = static_cast(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETADDITIONALSELALPHA: + return vs.selAdditionalAlpha; + + case SCI_SETADDITIONALCARETFORE: + vs.additionalCaretColour = ColourDesired(static_cast(wParam)); + InvalidateStyleRedraw(); + break; + + case SCI_GETADDITIONALCARETFORE: + return vs.additionalCaretColour.AsLong(); + + case SCI_ROTATESELECTION: + sel.RotateMain(); + InvalidateSelection(sel.RangeMain(), true); + break; + + case SCI_SWAPMAINANCHORCARET: + InvalidateSelection(sel.RangeMain()); + sel.RangeMain() = SelectionRange(sel.RangeMain().anchor, sel.RangeMain().caret); + break; + + case SCI_CHANGELEXERSTATE: + pdoc->ChangeLexerState(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_SETIDENTIFIER: + SetCtrlID(static_cast(wParam)); + break; + + case SCI_GETIDENTIFIER: + return GetCtrlID(); + + case SCI_SETTECHNOLOGY: + // No action by default + break; + + case SCI_GETTECHNOLOGY: + return technology; + + case SCI_COUNTCHARACTERS: + return pdoc->CountCharacters(static_cast(wParam), static_cast(lParam)); + + default: + return DefWndProc(iMessage, wParam, lParam); + } + //Platform::DebugPrintf("end wnd proc\n"); + return 0l; +} diff --git a/libs/qscintilla/src/Editor.h b/libs/qscintilla/src/Editor.h new file mode 100644 index 000000000..1fc907ac7 --- /dev/null +++ b/libs/qscintilla/src/Editor.h @@ -0,0 +1,620 @@ +// Scintilla source code edit control +/** @file Editor.h + ** Defines the main editor class. + **/ +// Copyright 1998-2011 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef EDITOR_H +#define EDITOR_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class Timer { +public: + bool ticking; + int ticksToWait; + enum {tickSize = 100}; + TickerID tickerID; + + Timer(); +}; + +/** + */ +class Idler { +public: + bool state; + IdlerID idlerID; + + Idler(); +}; + +/** + * When platform has a way to generate an event before painting, + * accumulate needed styling range and other work items in + * WorkNeeded to avoid unnecessary work inside paint handler + */ +class WorkNeeded { +public: + enum workItems { + workNone=0, + workStyle=1, + workUpdateUI=2 + }; + bool active; + enum workItems items; + Position upTo; + + WorkNeeded() : active(false), items(workNone), upTo(0) {} + void Reset() { + active = false; + items = workNone; + upTo = 0; + } + void Need(workItems items_, Position pos) { + if ((items_ & workStyle) && (upTo < pos)) + upTo = pos; + items = static_cast(items | items_); + } +}; + +/** + * Hold a piece of text selected for copying or dragging, along with encoding and selection format information. + */ +class SelectionText { + std::string s; +public: + bool rectangular; + bool lineCopy; + int codePage; + int characterSet; + SelectionText() : rectangular(false), lineCopy(false), codePage(0), characterSet(0) {} + ~SelectionText() { + } + void Clear() { + s.clear(); + rectangular = false; + lineCopy = false; + codePage = 0; + characterSet = 0; + } + void Copy(const std::string &s_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) { + s = s_; + codePage = codePage_; + characterSet = characterSet_; + rectangular = rectangular_; + lineCopy = lineCopy_; + FixSelectionForClipboard(); + } + void Copy(const SelectionText &other) { + Copy(other.s, other.codePage, other.characterSet, other.rectangular, other.lineCopy); + } + const char *Data() const { + return s.c_str(); + } + size_t Length() const { + return s.length(); + } + size_t LengthWithTerminator() const { + return s.length() + 1; + } + bool Empty() const { + return s.empty(); + } +private: + void FixSelectionForClipboard() { + // To avoid truncating the contents of the clipboard when pasted where the + // clipboard contains NUL characters, replace NUL characters by spaces. + std::replace(s.begin(), s.end(), '\0', ' '); + } +}; + +struct WrapPending { + // The range of lines that need to be wrapped + enum { lineLarge = 0x7ffffff }; + int start; // When there are wraps pending, will be in document range + int end; // May be lineLarge to indicate all of document after start + WrapPending() { + start = lineLarge; + end = lineLarge; + } + void Reset() { + start = lineLarge; + end = lineLarge; + } + void Wrapped(int line) { + if (start == line) + start++; + } + bool NeedsWrap() const { + return start < end; + } + bool AddRange(int lineStart, int lineEnd) { + const bool neededWrap = NeedsWrap(); + bool changed = false; + if (start > lineStart) { + start = lineStart; + changed = true; + } + if ((end < lineEnd) || !neededWrap) { + end = lineEnd; + changed = true; + } + return changed; + } +}; + +/** + */ +class Editor : public EditModel, public DocWatcher { + // Private so Editor objects can not be copied + Editor(const Editor &); + Editor &operator=(const Editor &); + +protected: // ScintillaBase subclass needs access to much of Editor + + /** On GTK+, Scintilla is a container widget holding two scroll bars + * whereas on Windows there is just one window with both scroll bars turned on. */ + Window wMain; ///< The Scintilla parent window + Window wMargin; ///< May be separate when using a scroll view for wMain + + /** Style resources may be expensive to allocate so are cached between uses. + * When a style attribute is changed, this cache is flushed. */ + bool stylesValid; + ViewStyle vs; + int technology; + Point sizeRGBAImage; + float scaleRGBAImage; + + MarginView marginView; + EditView view; + + int cursorMode; + + bool hasFocus; + bool mouseDownCaptures; + + int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret + bool horizontalScrollBarVisible; + int scrollWidth; + bool verticalScrollBarVisible; + bool endAtLastLine; + int caretSticky; + int marginOptions; + bool mouseSelectionRectangularSwitch; + bool multipleSelection; + bool additionalSelectionTyping; + int multiPasteMode; + + int virtualSpaceOptions; + + KeyMap kmap; + + Timer timer; + Timer autoScrollTimer; + enum { autoScrollDelay = 200 }; + + Idler idler; + + Point lastClick; + unsigned int lastClickTime; + Point doubleClickCloseThreshold; + int dwellDelay; + int ticksToDwell; + bool dwelling; + enum { selChar, selWord, selSubLine, selWholeLine } selectionType; + Point ptMouseLast; + enum { ddNone, ddInitial, ddDragging } inDragDrop; + bool dropWentOutside; + SelectionPosition posDrop; + int hotSpotClickPos; + int lastXChosen; + int lineAnchorPos; + int originalAnchorPos; + int wordSelectAnchorStartPos; + int wordSelectAnchorEndPos; + int wordSelectInitialCaretPos; + int targetStart; + int targetEnd; + int searchFlags; + int topLine; + int posTopLine; + int lengthForEncode; + + int needUpdateUI; + + enum { notPainting, painting, paintAbandoned } paintState; + bool paintAbandonedByStyling; + PRectangle rcPaint; + bool paintingAllText; + bool willRedrawAll; + WorkNeeded workNeeded; + + int modEventMask; + + SelectionText drag; + + int caretXPolicy; + int caretXSlop; ///< Ensure this many pixels visible on both sides of caret + + int caretYPolicy; + int caretYSlop; ///< Ensure this many lines visible on both sides of caret + + int visiblePolicy; + int visibleSlop; + + int searchAnchor; + + bool recordingMacro; + + int foldAutomatic; + + // Wrapping support + WrapPending wrapPending; + + bool convertPastes; + + Editor(); + virtual ~Editor(); + virtual void Initialise() = 0; + virtual void Finalise(); + + void InvalidateStyleData(); + void InvalidateStyleRedraw(); + void RefreshStyleData(); + void SetRepresentations(); + void DropGraphics(bool freeObjects); + void AllocateGraphics(); + + // The top left visible point in main window coordinates. Will be 0,0 except for + // scroll views where it will be equivalent to the current scroll position. + virtual Point GetVisibleOriginInMain() const; + Point DocumentPointFromView(Point ptView) const; // Convert a point from view space to document + int TopLineOfMain() const; // Return the line at Main's y coordinate 0 + virtual PRectangle GetClientRectangle() const; + virtual PRectangle GetClientDrawingRectangle(); + PRectangle GetTextRectangle() const; + + virtual int LinesOnScreen() const; + int LinesToScroll() const; + int MaxScrollPos() const; + SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; + Point LocationFromPosition(SelectionPosition pos); + Point LocationFromPosition(int pos); + int XFromPosition(int pos); + int XFromPosition(SelectionPosition sp); + SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true); + int PositionFromLocation(Point pt, bool canReturnInvalid = false, bool charPosition = false); + SelectionPosition SPositionFromLineX(int lineDoc, int x); + int PositionFromLineX(int line, int x); + int LineFromLocation(Point pt) const; + void SetTopLine(int topLineNew); + + virtual bool AbandonPaint(); + virtual void RedrawRect(PRectangle rc); + virtual void DiscardOverdraw(); + virtual void Redraw(); + void RedrawSelMargin(int line=-1, bool allAfter=false); + PRectangle RectangleFromRange(Range r, int overlap); + void InvalidateRange(int start, int end); + + bool UserVirtualSpace() const { + return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0); + } + int CurrentPosition() const; + bool SelectionEmpty() const; + SelectionPosition SelectionStart(); + SelectionPosition SelectionEnd(); + void SetRectangularRange(); + void ThinRectangularRange(); + void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false); + void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_); + void SetSelection(int currentPos_, int anchor_); + void SetSelection(SelectionPosition currentPos_); + void SetSelection(int currentPos_); + void SetEmptySelection(SelectionPosition currentPos_); + void SetEmptySelection(int currentPos_); + bool RangeContainsProtected(int start, int end) const; + bool SelectionContainsProtected(); + int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; + SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const; + int MovePositionTo(SelectionPosition newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); + int MovePositionTo(int newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); + SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir); + SelectionPosition MovePositionSoVisible(int pos, int moveDir); + Point PointMainCaret(); + void SetLastXChosen(); + + void ScrollTo(int line, bool moveThumb=true); + virtual void ScrollText(int linesToMove); + void HorizontalScrollTo(int xPos); + void VerticalCentreCaret(); + void MoveSelectedLines(int lineDelta); + void MoveSelectedLinesUp(); + void MoveSelectedLinesDown(); + void MoveCaretInsideView(bool ensureVisible=true); + int DisplayFromPosition(int pos); + + struct XYScrollPosition { + int xOffset; + int topLine; + XYScrollPosition(int xOffset_, int topLine_) : xOffset(xOffset_), topLine(topLine_) {} + bool operator==(const XYScrollPosition &other) const { + return (xOffset == other.xOffset) && (topLine == other.topLine); + } + }; + enum XYScrollOptions { + xysUseMargin=0x1, + xysVertical=0x2, + xysHorizontal=0x4, + xysDefault=xysUseMargin|xysVertical|xysHorizontal}; + XYScrollPosition XYScrollToMakeVisible(const SelectionRange &range, const XYScrollOptions options); + void SetXYScroll(XYScrollPosition newXY); + void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true); + void ScrollRange(SelectionRange range); + void ShowCaretAtCurrentPosition(); + void DropCaret(); + void CaretSetPeriod(int period); + void InvalidateCaret(); + virtual void UpdateSystemCaret(); + + bool Wrapping() const; + void NeedWrapping(int docLineStart=0, int docLineEnd=WrapPending::lineLarge); + bool WrapOneLine(Surface *surface, int lineToWrap); + enum wrapScope {wsAll, wsVisible, wsIdle}; + bool WrapLines(enum wrapScope ws); + void LinesJoin(); + void LinesSplit(int pixelWidth); + + void PaintSelMargin(Surface *surface, PRectangle &rc); + void RefreshPixMaps(Surface *surfaceWindow); + void Paint(Surface *surfaceWindow, PRectangle rcArea); + long FormatRange(bool draw, Sci_RangeToFormat *pfr); + int TextWidth(int style, const char *text); + + virtual void SetVerticalScrollPos() = 0; + virtual void SetHorizontalScrollPos() = 0; + virtual bool ModifyScrollBars(int nMax, int nPage) = 0; + virtual void ReconfigureScrollBars(); + void SetScrollBars(); + void ChangeSize(); + + void FilterSelections(); + int InsertSpace(int position, unsigned int spaces); + void AddChar(char ch); + virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); + void FillVirtualSpace(); + void InsertPaste(const char *text, int len); + enum PasteShape { pasteStream=0, pasteRectangular = 1, pasteLine = 2 }; + void InsertPasteShape(const char *text, int len, PasteShape shape); + void ClearSelection(bool retainMultipleSelections = false); + void ClearAll(); + void ClearDocumentStyle(); + void Cut(); + void PasteRectangular(SelectionPosition pos, const char *ptr, int len); + virtual void Copy() = 0; + virtual void CopyAllowLine(); + virtual bool CanPaste(); + virtual void Paste() = 0; + void Clear(); + void SelectAll(); + void Undo(); + void Redo(); + void DelCharBack(bool allowLineStartDeletion); + virtual void ClaimSelection() = 0; + + static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false); + virtual void NotifyChange() = 0; + virtual void NotifyFocus(bool focus); + virtual void SetCtrlID(int identifier); + virtual int GetCtrlID() { return ctrlID; } + virtual void NotifyParent(SCNotification scn) = 0; + virtual void NotifyStyleToNeeded(int endStyleNeeded); + void NotifyChar(int ch); + void NotifySavePoint(bool isSavePoint); + void NotifyModifyAttempt(); + virtual void NotifyDoubleClick(Point pt, int modifiers); + virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); + void NotifyHotSpotClicked(int position, int modifiers); + void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt); + void NotifyHotSpotDoubleClicked(int position, int modifiers); + void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt); + void NotifyHotSpotReleaseClick(int position, int modifiers); + void NotifyHotSpotReleaseClick(int position, bool shift, bool ctrl, bool alt); + bool NotifyUpdateUI(); + void NotifyPainted(); + void NotifyIndicatorClick(bool click, int position, int modifiers); + void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt); + bool NotifyMarginClick(Point pt, int modifiers); + bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt); + void NotifyNeedShown(int pos, int len); + void NotifyDwelling(Point pt, bool state); + void NotifyZoom(); + + void NotifyModifyAttempt(Document *document, void *userData); + void NotifySavePoint(Document *document, void *userData, bool atSavePoint); + void CheckModificationForWrap(DocModification mh); + void NotifyModified(Document *document, DocModification mh, void *userData); + void NotifyDeleted(Document *document, void *userData); + void NotifyStyleNeeded(Document *doc, void *userData, int endPos); + void NotifyLexerChanged(Document *doc, void *userData); + void NotifyErrorOccurred(Document *doc, void *userData, int status); + void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + + void ContainerNeedsUpdate(int flags); + void PageMove(int direction, Selection::selTypes selt=Selection::noSel, bool stuttered = false); + enum { cmSame, cmUpper, cmLower }; + virtual std::string CaseMapString(const std::string &s, int caseMapping); + void ChangeCaseOfSelection(int caseMapping); + void LineTranspose(); + void Duplicate(bool forLine); + virtual void CancelModes(); + void NewLine(); + void CursorUpOrDown(int direction, Selection::selTypes selt=Selection::noSel); + void ParaUpOrDown(int direction, Selection::selTypes selt=Selection::noSel); + int StartEndDisplayLine(int pos, bool start); + virtual int KeyCommand(unsigned int iMessage); + virtual int KeyDefault(int /* key */, int /*modifiers*/); + int KeyDownWithModifiers(int key, int modifiers, bool *consumed); + int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0); + + void Indent(bool forwards); + + virtual CaseFolder *CaseFolderForEncoding(); + long FindText(uptr_t wParam, sptr_t lParam); + void SearchAnchor(); + long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + long SearchInTarget(const char *text, int length); + void GoToLine(int lineNo); + + virtual void CopyToClipboard(const SelectionText &selectedText) = 0; + std::string RangeText(int start, int end) const; + void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false); + void CopyRangeToClipboard(int start, int end); + void CopyText(int length, const char *text); + void SetDragPosition(SelectionPosition newPos); + virtual void DisplayCursor(Window::Cursor c); + virtual bool DragThreshold(Point ptStart, Point ptNow); + virtual void StartDrag(); + void DropAt(SelectionPosition position, const char *value, size_t lengthValue, bool moving, bool rectangular); + void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular); + /** PositionInSelection returns true if position in selection. */ + bool PositionInSelection(int pos); + bool PointInSelection(Point pt); + bool PointInSelMargin(Point pt) const; + Window::Cursor GetMarginCursor(Point pt) const; + void TrimAndSetSelection(int currentPos_, int anchor_); + void LineSelection(int lineCurrentPos_, int lineAnchorPos_, bool wholeLine); + void WordSelection(int pos); + void DwellEnd(bool mouseMoved); + void MouseLeave(); + virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); + virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); + void ButtonMoveWithModifiers(Point pt, int modifiers); + void ButtonMove(Point pt); + void ButtonUp(Point pt, unsigned int curTime, bool ctrl); + + void Tick(); + bool Idle(); + virtual void SetTicking(bool on); + enum TickReason { tickCaret, tickScroll, tickWiden, tickDwell, tickPlatform }; + virtual void TickFor(TickReason reason); + virtual bool FineTickerAvailable(); + virtual bool FineTickerRunning(TickReason reason); + virtual void FineTickerStart(TickReason reason, int millis, int tolerance); + virtual void FineTickerCancel(TickReason reason); + virtual bool SetIdle(bool) { return false; } + virtual void SetMouseCapture(bool on) = 0; + virtual bool HaveMouseCapture() = 0; + void SetFocusState(bool focusState); + + int PositionAfterArea(PRectangle rcArea) const; + void StyleToPositionInView(Position pos); + virtual void IdleWork(); + virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo=0); + + virtual bool PaintContains(PRectangle rc); + bool PaintContainsMargin(); + void CheckForChangeOutsidePaint(Range r); + void SetBraceHighlight(Position pos0, Position pos1, int matchStyle); + + void SetAnnotationHeights(int start, int end); + virtual void SetDocPointer(Document *document); + + void SetAnnotationVisible(int visible); + + int ExpandLine(int line); + void SetFoldExpanded(int lineDoc, bool expanded); + void FoldLine(int line, int action); + void FoldExpand(int line, int action, int level); + int ContractedFoldNext(int lineStart) const; + void EnsureLineVisible(int lineDoc, bool enforcePolicy); + void FoldChanged(int line, int levelNow, int levelPrev); + void NeedShown(int pos, int len); + void FoldAll(int action); + + int GetTag(char *tagValue, int tagNumber); + int ReplaceTarget(bool replacePatterns, const char *text, int length=-1); + + bool PositionIsHotspot(int position) const; + bool PointIsHotspot(Point pt); + void SetHotSpotRange(Point *pt); + Range GetHotSpotRange() const; + void SetHoverIndicatorPosition(int position); + void SetHoverIndicatorPoint(Point pt); + + int CodePage() const; + virtual bool ValidCodePage(int /* codePage */) const { return true; } + int WrapCount(int line); + void AddStyledText(char *buffer, int appendLength); + + virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; + void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + + static const char *StringFromEOLMode(int eolMode); + + static sptr_t StringResult(sptr_t lParam, const char *val); + static sptr_t BytesResult(sptr_t lParam, const unsigned char *val, size_t len); + +public: + // Public so the COM thunks can access it. + bool IsUnicodeMode() const; + // Public so scintilla_send_message can use it. + virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + // Public so scintilla_set_id can use it. + int ctrlID; + // Public so COM methods for drag and drop can set it. + int errorStatus; + friend class AutoSurface; + friend class SelectionLineIterator; +}; + +/** + * A smart pointer class to ensure Surfaces are set up and deleted correctly. + */ +class AutoSurface { +private: + Surface *surf; +public: + AutoSurface(Editor *ed, int technology = -1) : surf(0) { + if (ed->wMain.GetID()) { + surf = Surface::Allocate(technology != -1 ? technology : ed->technology); + if (surf) { + surf->Init(ed->wMain.GetID()); + surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); + surf->SetDBCSMode(ed->CodePage()); + } + } + } + AutoSurface(SurfaceID sid, Editor *ed, int technology = -1) : surf(0) { + if (ed->wMain.GetID()) { + surf = Surface::Allocate(technology != -1 ? technology : ed->technology); + if (surf) { + surf->Init(sid, ed->wMain.GetID()); + surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); + surf->SetDBCSMode(ed->CodePage()); + } + } + } + ~AutoSurface() { + delete surf; + } + Surface *operator->() const { + return surf; + } + operator Surface *() const { + return surf; + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/ExternalLexer.cpp b/libs/qscintilla/src/ExternalLexer.cpp new file mode 100644 index 000000000..25d83ceb8 --- /dev/null +++ b/libs/qscintilla/src/ExternalLexer.cpp @@ -0,0 +1,191 @@ +// Scintilla source code edit control +/** @file ExternalLexer.cxx + ** Support external lexers in DLLs. + **/ +// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. +// 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 "LexerModule.h" +#include "Catalogue.h" +#include "ExternalLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LexerManager *LexerManager::theInstance = NULL; + +//------------------------------------------ +// +// ExternalLexerModule +// +//------------------------------------------ + +void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int index) { + fneFactory = fFactory; + fnFactory = fFactory(index); +} + +//------------------------------------------ +// +// LexerLibrary +// +//------------------------------------------ + +LexerLibrary::LexerLibrary(const char *ModuleName) { + // Initialise some members... + first = NULL; + last = NULL; + + // Load the DLL + lib = DynamicLibrary::Load(ModuleName); + if (lib->IsValid()) { + m_sModuleName = ModuleName; + //Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects + GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount"); + + if (GetLexerCount) { + ExternalLexerModule *lex; + LexerMinder *lm; + + // Find functions in the DLL + GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName"); + GetLexerFactoryFunction fnFactory = (GetLexerFactoryFunction)(sptr_t)lib->FindFunction("GetLexerFactory"); + + int nl = GetLexerCount(); + + for (int i = 0; i < nl; i++) { + // Assign a buffer for the lexer name. + char lexname[100] = ""; + GetLexerName(i, lexname, sizeof(lexname)); + lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL); + Catalogue::AddLexerModule(lex); + + // Create a LexerMinder so we don't leak the ExternalLexerModule... + lm = new LexerMinder; + lm->self = lex; + lm->next = NULL; + if (first != NULL) { + last->next = lm; + last = lm; + } else { + first = lm; + last = lm; + } + + // The external lexer needs to know how to call into its DLL to + // do its lexing and folding, we tell it here. + lex->SetExternal(fnFactory, i); + } + } + } + next = NULL; +} + +LexerLibrary::~LexerLibrary() { + Release(); + delete lib; +} + +void LexerLibrary::Release() { + LexerMinder *lm; + LexerMinder *lmNext; + lm = first; + while (NULL != lm) { + lmNext = lm->next; + delete lm->self; + delete lm; + lm = lmNext; + } + + first = NULL; + last = NULL; +} + +//------------------------------------------ +// +// LexerManager +// +//------------------------------------------ + +/// Return the single LexerManager instance... +LexerManager *LexerManager::GetInstance() { + if (!theInstance) + theInstance = new LexerManager; + return theInstance; +} + +/// Delete any LexerManager instance... +void LexerManager::DeleteInstance() { + delete theInstance; + theInstance = NULL; +} + +/// protected constructor - this is a singleton... +LexerManager::LexerManager() { + first = NULL; + last = NULL; +} + +LexerManager::~LexerManager() { + Clear(); +} + +void LexerManager::Load(const char *path) { + LoadLexerLibrary(path); +} + +void LexerManager::LoadLexerLibrary(const char *module) { + for (LexerLibrary *ll = first; ll; ll= ll->next) { + if (strcmp(ll->m_sModuleName.c_str(), module) == 0) + return; + } + LexerLibrary *lib = new LexerLibrary(module); + if (NULL != first) { + last->next = lib; + last = lib; + } else { + first = lib; + last = lib; + } +} + +void LexerManager::Clear() { + if (NULL != first) { + LexerLibrary *cur = first; + LexerLibrary *next; + while (cur) { + next = cur->next; + delete cur; + cur = next; + } + first = NULL; + last = NULL; + } +} + +//------------------------------------------ +// +// LexerManager +// +//------------------------------------------ + +LMMinder::~LMMinder() { + LexerManager::DeleteInstance(); +} + +LMMinder minder; diff --git a/libs/qscintilla/src/ExternalLexer.h b/libs/qscintilla/src/ExternalLexer.h new file mode 100644 index 000000000..191f64976 --- /dev/null +++ b/libs/qscintilla/src/ExternalLexer.h @@ -0,0 +1,99 @@ +// Scintilla source code edit control +/** @file ExternalLexer.h + ** Support external lexers in DLLs. + **/ +// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef EXTERNALLEXER_H +#define EXTERNALLEXER_H + +#if PLAT_WIN +#define EXT_LEXER_DECL __stdcall +#elif PLAT_QT +#include +#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) +#define EXT_LEXER_DECL __stdcall +#else +#define EXT_LEXER_DECL +#endif +#else +#define EXT_LEXER_DECL +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +typedef void*(EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); +typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); +typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); +typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index); + +/// Sub-class of LexerModule to use an external lexer. +class ExternalLexerModule : public LexerModule { +protected: + GetLexerFactoryFunction fneFactory; + std::string name; +public: + ExternalLexerModule(int language_, LexerFunction fnLexer_, + const char *languageName_=0, LexerFunction fnFolder_=0) : + LexerModule(language_, fnLexer_, 0, fnFolder_), + fneFactory(0), name(languageName_){ + languageName = name.c_str(); + } + virtual void SetExternal(GetLexerFactoryFunction fFactory, int index); +}; + +/// LexerMinder points to an ExternalLexerModule - so we don't leak them. +class LexerMinder { +public: + ExternalLexerModule *self; + LexerMinder *next; +}; + +/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. +class LexerLibrary { + DynamicLibrary *lib; + LexerMinder *first; + LexerMinder *last; + +public: + explicit LexerLibrary(const char *ModuleName); + ~LexerLibrary(); + void Release(); + + LexerLibrary *next; + std::string m_sModuleName; +}; + +/// LexerManager manages external lexers, contains LexerLibrarys. +class LexerManager { +public: + ~LexerManager(); + + static LexerManager *GetInstance(); + static void DeleteInstance(); + + void Load(const char *path); + void Clear(); + +private: + LexerManager(); + static LexerManager *theInstance; + + void LoadLexerLibrary(const char *module); + LexerLibrary *first; + LexerLibrary *last; +}; + +class LMMinder { +public: + ~LMMinder(); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/FontQuality.h b/libs/qscintilla/src/FontQuality.h new file mode 100644 index 000000000..a0ae207f8 --- /dev/null +++ b/libs/qscintilla/src/FontQuality.h @@ -0,0 +1,31 @@ +// Scintilla source code edit control +/** @file FontQuality.h + ** Definitions to control font anti-aliasing. + ** Redefine constants from Scintilla.h to avoid including Scintilla.h in PlatWin.cxx. + **/ +// Copyright 1998-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef FONTQUALITY_H +#define FONTQUALITY_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// These definitions match Scintilla.h +#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 + +// These definitions must match SC_TECHNOLOGY_* in Scintilla.h +#define SCWIN_TECH_GDI 0 +#define SCWIN_TECH_DIRECTWRITE 1 + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Indicator.cpp b/libs/qscintilla/src/Indicator.cpp new file mode 100644 index 000000000..62df0b716 --- /dev/null +++ b/libs/qscintilla/src/Indicator.cpp @@ -0,0 +1,180 @@ +// Scintilla source code edit control +/** @file Indicator.cxx + ** Defines the style of indicators which are text decorations such as underlining. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "Indicator.h" +#include "XPM.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static PRectangle PixelGridAlign(const PRectangle &rc) { + // Move left and right side to nearest pixel to avoid blurry visuals + return PRectangle::FromInts(int(rc.left + 0.5), int(rc.top), int(rc.right + 0.5), int(rc.bottom)); +} + +void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const { + StyleAndColour sacDraw = sacNormal; + if (Flags() & SC_INDICFLAG_VALUEFORE) { + sacDraw.fore = value & SC_INDICVALUEMASK; + } + if (drawState == drawHover) { + sacDraw = sacHover; + } + surface->PenColour(sacDraw.fore); + int ymid = static_cast(rc.bottom + rc.top) / 2; + if (sacDraw.style == INDIC_SQUIGGLE) { + int x = int(rc.left+0.5); + int xLast = int(rc.right+0.5); + int y = 0; + surface->MoveTo(x, static_cast(rc.top) + y); + while (x < xLast) { + if ((x + 2) > xLast) { + if (xLast > x) + y = 1; + x = xLast; + } else { + x += 2; + y = 2 - y; + } + surface->LineTo(x, static_cast(rc.top) + y); + } + } else if (sacDraw.style == INDIC_SQUIGGLEPIXMAP) { + PRectangle rcSquiggle = PixelGridAlign(rc); + + int width = Platform::Minimum(4000, static_cast(rcSquiggle.Width())); + RGBAImage image(width, 3, 1.0, 0); + enum { alphaFull = 0xff, alphaSide = 0x2f, alphaSide2=0x5f }; + for (int x = 0; x < width; x++) { + if (x%2) { + // Two halfway columns have a full pixel in middle flanked by light pixels + image.SetPixel(x, 0, sacDraw.fore, alphaSide); + image.SetPixel(x, 1, sacDraw.fore, alphaFull); + image.SetPixel(x, 2, sacDraw.fore, alphaSide); + } else { + // Extreme columns have a full pixel at bottom or top and a mid-tone pixel in centre + image.SetPixel(x, (x % 4) ? 0 : 2, sacDraw.fore, alphaFull); + image.SetPixel(x, 1, sacDraw.fore, alphaSide2); + } + } + surface->DrawRGBAImage(rcSquiggle, image.GetWidth(), image.GetHeight(), image.Pixels()); + } else if (sacDraw.style == INDIC_SQUIGGLELOW) { + surface->MoveTo(static_cast(rc.left), static_cast(rc.top)); + int x = static_cast(rc.left) + 3; + int y = 0; + while (x < rc.right) { + surface->LineTo(x - 1, static_cast(rc.top) + y); + y = 1 - y; + surface->LineTo(x, static_cast(rc.top) + y); + x += 3; + } + surface->LineTo(static_cast(rc.right), static_cast(rc.top) + y); // Finish the line + } else if (sacDraw.style == INDIC_TT) { + surface->MoveTo(static_cast(rc.left), ymid); + int x = static_cast(rc.left) + 5; + while (x < rc.right) { + surface->LineTo(x, ymid); + surface->MoveTo(x-3, ymid); + surface->LineTo(x-3, ymid+2); + x++; + surface->MoveTo(x, ymid); + x += 5; + } + surface->LineTo(static_cast(rc.right), ymid); // Finish the line + if (x - 3 <= rc.right) { + surface->MoveTo(x-3, ymid); + surface->LineTo(x-3, ymid+2); + } + } else if (sacDraw.style == INDIC_DIAGONAL) { + int x = static_cast(rc.left); + while (x < rc.right) { + surface->MoveTo(x, static_cast(rc.top) + 2); + int endX = x+3; + int endY = static_cast(rc.top) - 1; + if (endX > rc.right) { + endY += endX - static_cast(rc.right); + endX = static_cast(rc.right); + } + surface->LineTo(endX, endY); + x += 4; + } + } else if (sacDraw.style == INDIC_STRIKE) { + surface->MoveTo(static_cast(rc.left), static_cast(rc.top) - 4); + surface->LineTo(static_cast(rc.right), static_cast(rc.top) - 4); + } else if ((sacDraw.style == INDIC_HIDDEN) || (sacDraw.style == INDIC_TEXTFORE)) { + // Draw nothing + } else if (sacDraw.style == INDIC_BOX) { + surface->MoveTo(static_cast(rc.left), ymid + 1); + surface->LineTo(static_cast(rc.right), ymid + 1); + surface->LineTo(static_cast(rc.right), static_cast(rcLine.top) + 1); + surface->LineTo(static_cast(rc.left), static_cast(rcLine.top) + 1); + surface->LineTo(static_cast(rc.left), ymid + 1); + } else if (sacDraw.style == INDIC_ROUNDBOX || + sacDraw.style == INDIC_STRAIGHTBOX || + sacDraw.style == INDIC_FULLBOX) { + PRectangle rcBox = rcLine; + if (sacDraw.style != INDIC_FULLBOX) + rcBox.top = rcLine.top + 1; + rcBox.left = rc.left; + rcBox.right = rc.right; + surface->AlphaRectangle(rcBox, (sacDraw.style == INDIC_ROUNDBOX) ? 1 : 0, + sacDraw.fore, fillAlpha, sacDraw.fore, outlineAlpha, 0); + } else if (sacDraw.style == INDIC_DOTBOX) { + PRectangle rcBox = PixelGridAlign(rc); + rcBox.top = rcLine.top + 1; + rcBox.bottom = rcLine.bottom; + // Cap width at 4000 to avoid large allocations when mistakes made + int width = Platform::Minimum(static_cast(rcBox.Width()), 4000); + RGBAImage image(width, static_cast(rcBox.Height()), 1.0, 0); + // Draw horizontal lines top and bottom + for (int x=0; x(rcBox.Height()); y += static_cast(rcBox.Height()) - 1) { + image.SetPixel(x, y, sacDraw.fore, ((x + y) % 2) ? outlineAlpha : fillAlpha); + } + } + // Draw vertical lines left and right + for (int y = 1; y(rcBox.Height()); y++) { + for (int x=0; xDrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels()); + } else if (sacDraw.style == INDIC_DASH) { + int x = static_cast(rc.left); + while (x < rc.right) { + surface->MoveTo(x, ymid); + surface->LineTo(Platform::Minimum(x + 4, static_cast(rc.right)), ymid); + x += 7; + } + } else if (sacDraw.style == INDIC_DOTS) { + int x = static_cast(rc.left); + while (x < static_cast(rc.right)) { + PRectangle rcDot = PRectangle::FromInts(x, ymid, x + 1, ymid + 1); + surface->FillRectangle(rcDot, sacDraw.fore); + x += 2; + } + } else if (sacDraw.style == INDIC_COMPOSITIONTHICK) { + PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom); + surface->FillRectangle(rcComposition, sacDraw.fore); + } else if (sacDraw.style == INDIC_COMPOSITIONTHIN) { + PRectangle rcComposition(rc.left+1, rcLine.bottom-2, rc.right-1, rcLine.bottom-1); + surface->FillRectangle(rcComposition, sacDraw.fore); + } else { // Either INDIC_PLAIN or unknown + surface->MoveTo(static_cast(rc.left), ymid); + surface->LineTo(static_cast(rc.right), ymid); + } +} + +void Indicator::SetFlags(int attributes_) { + attributes = attributes_; +} diff --git a/libs/qscintilla/src/Indicator.h b/libs/qscintilla/src/Indicator.h new file mode 100644 index 000000000..c22ec71c6 --- /dev/null +++ b/libs/qscintilla/src/Indicator.h @@ -0,0 +1,60 @@ +// Scintilla source code edit control +/** @file Indicator.h + ** Defines the style of indicators which are text decorations such as underlining. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef INDICATOR_H +#define INDICATOR_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +struct StyleAndColour { + int style; + ColourDesired fore; + StyleAndColour() : style(INDIC_PLAIN), fore(0, 0, 0) { + } + StyleAndColour(int style_, ColourDesired fore_ = ColourDesired(0, 0, 0)) : style(style_), fore(fore_) { + } + bool operator==(const StyleAndColour &other) const { + return (style == other.style) && (fore == other.fore); + } +}; + +/** + */ +class Indicator { +public: + enum DrawState { drawNormal, drawHover }; + StyleAndColour sacNormal; + StyleAndColour sacHover; + bool under; + int fillAlpha; + int outlineAlpha; + int attributes; + Indicator() : under(false), fillAlpha(30), outlineAlpha(50), attributes(0) { + } + Indicator(int style_, ColourDesired fore_=ColourDesired(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) : + sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(0) { + } + void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, DrawState drawState, int value) const; + bool IsDynamic() const { + return !(sacNormal == sacHover); + } + bool OverridesTextFore() const { + return sacNormal.style == INDIC_TEXTFORE || sacHover.style == INDIC_TEXTFORE; + } + int Flags() const { + return attributes; + } + void SetFlags(int attributes_); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/KeyMap.cpp b/libs/qscintilla/src/KeyMap.cpp new file mode 100644 index 000000000..cb6f2b8d4 --- /dev/null +++ b/libs/qscintilla/src/KeyMap.cpp @@ -0,0 +1,160 @@ +// Scintilla source code edit control +/** @file KeyMap.cxx + ** Defines a mapping between keystrokes and commands. + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" + +#include "KeyMap.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +KeyMap::KeyMap() { + for (int i = 0; MapDefault[i].key; i++) { + AssignCmdKey(MapDefault[i].key, + MapDefault[i].modifiers, + MapDefault[i].msg); + } +} + +KeyMap::~KeyMap() { + Clear(); +} + +void KeyMap::Clear() { + kmap.clear(); +} + +void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) { + kmap[KeyModifiers(key, modifiers)] = msg; +} + +unsigned int KeyMap::Find(int key, int modifiers) const { + std::map::const_iterator it = kmap.find(KeyModifiers(key, modifiers)); + return (it == kmap.end()) ? 0 : it->second; +} + +#if PLAT_GTK_MACOSX +#define OS_X_KEYS 1 +#else +#define OS_X_KEYS 0 +#endif + +// Define a modifier that is exactly Ctrl key on all platforms +// Most uses of Ctrl map to Cmd on OS X but some can't so use SCI_[S]CTRL_META +#if OS_X_KEYS +#define SCI_CTRL_META SCI_META +#define SCI_SCTRL_META (SCI_META | SCI_SHIFT) +#else +#define SCI_CTRL_META SCI_CTRL +#define SCI_SCTRL_META (SCI_CTRL | SCI_SHIFT) +#endif + +const KeyToCommand KeyMap::MapDefault[] = { + +#if OS_X_KEYS + {SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND}, + {SCK_DOWN, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, + {SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART}, + {SCK_UP, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, + {SCK_LEFT, SCI_CTRL, SCI_VCHOME}, + {SCK_LEFT, SCI_CSHIFT, SCI_VCHOMEEXTEND}, + {SCK_RIGHT, SCI_CTRL, SCI_LINEEND}, + {SCK_RIGHT, SCI_CSHIFT, SCI_LINEENDEXTEND}, +#endif + + {SCK_DOWN, SCI_NORM, SCI_LINEDOWN}, + {SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND}, + {SCK_DOWN, SCI_CTRL_META, SCI_LINESCROLLDOWN}, + {SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND}, + {SCK_UP, SCI_NORM, SCI_LINEUP}, + {SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND}, + {SCK_UP, SCI_CTRL_META, SCI_LINESCROLLUP}, + {SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND}, + {'[', SCI_CTRL, SCI_PARAUP}, + {'[', SCI_CSHIFT, SCI_PARAUPEXTEND}, + {']', SCI_CTRL, SCI_PARADOWN}, + {']', SCI_CSHIFT, SCI_PARADOWNEXTEND}, + {SCK_LEFT, SCI_NORM, SCI_CHARLEFT}, + {SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND}, + {SCK_LEFT, SCI_CTRL_META, SCI_WORDLEFT}, + {SCK_LEFT, SCI_SCTRL_META, SCI_WORDLEFTEXTEND}, + {SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND}, + {SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT}, + {SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND}, + {SCK_RIGHT, SCI_CTRL_META, SCI_WORDRIGHT}, + {SCK_RIGHT, SCI_SCTRL_META, SCI_WORDRIGHTEXTEND}, + {SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND}, + {'/', SCI_CTRL, SCI_WORDPARTLEFT}, + {'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND}, + {'\\', SCI_CTRL, SCI_WORDPARTRIGHT}, + {'\\', SCI_CSHIFT, SCI_WORDPARTRIGHTEXTEND}, + {SCK_HOME, SCI_NORM, SCI_VCHOME}, + {SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND}, + {SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART}, + {SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND}, + {SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY}, + {SCK_HOME, SCI_ASHIFT, SCI_VCHOMERECTEXTEND}, + {SCK_END, SCI_NORM, SCI_LINEEND}, + {SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND}, + {SCK_END, SCI_CTRL, SCI_DOCUMENTEND}, + {SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND}, + {SCK_END, SCI_ALT, SCI_LINEENDDISPLAY}, + {SCK_END, SCI_ASHIFT, SCI_LINEENDRECTEXTEND}, + {SCK_PRIOR, SCI_NORM, SCI_PAGEUP}, + {SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND}, + {SCK_PRIOR, SCI_ASHIFT, SCI_PAGEUPRECTEXTEND}, + {SCK_NEXT, SCI_NORM, SCI_PAGEDOWN}, + {SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND}, + {SCK_NEXT, SCI_ASHIFT, SCI_PAGEDOWNRECTEXTEND}, + {SCK_DELETE, SCI_NORM, SCI_CLEAR}, + {SCK_DELETE, SCI_SHIFT, SCI_CUT}, + {SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT}, + {SCK_DELETE, SCI_CSHIFT, SCI_DELLINERIGHT}, + {SCK_INSERT, SCI_NORM, SCI_EDITTOGGLEOVERTYPE}, + {SCK_INSERT, SCI_SHIFT, SCI_PASTE}, + {SCK_INSERT, SCI_CTRL, SCI_COPY}, + {SCK_ESCAPE, SCI_NORM, SCI_CANCEL}, + {SCK_BACK, SCI_NORM, SCI_DELETEBACK}, + {SCK_BACK, SCI_SHIFT, SCI_DELETEBACK}, + {SCK_BACK, SCI_CTRL, SCI_DELWORDLEFT}, + {SCK_BACK, SCI_ALT, SCI_UNDO}, + {SCK_BACK, SCI_CSHIFT, SCI_DELLINELEFT}, + {'Z', SCI_CTRL, SCI_UNDO}, +#if OS_X_KEYS + {'Z', SCI_CSHIFT, SCI_REDO}, +#else + {'Y', SCI_CTRL, SCI_REDO}, +#endif + {'X', SCI_CTRL, SCI_CUT}, + {'C', SCI_CTRL, SCI_COPY}, + {'V', SCI_CTRL, SCI_PASTE}, + {'A', SCI_CTRL, SCI_SELECTALL}, + {SCK_TAB, SCI_NORM, SCI_TAB}, + {SCK_TAB, SCI_SHIFT, SCI_BACKTAB}, + {SCK_RETURN, SCI_NORM, SCI_NEWLINE}, + {SCK_RETURN, SCI_SHIFT, SCI_NEWLINE}, + {SCK_ADD, SCI_CTRL, SCI_ZOOMIN}, + {SCK_SUBTRACT, SCI_CTRL, SCI_ZOOMOUT}, + {SCK_DIVIDE, SCI_CTRL, SCI_SETZOOM}, + {'L', SCI_CTRL, SCI_LINECUT}, + {'L', SCI_CSHIFT, SCI_LINEDELETE}, + {'T', SCI_CSHIFT, SCI_LINECOPY}, + {'T', SCI_CTRL, SCI_LINETRANSPOSE}, + {'D', SCI_CTRL, SCI_SELECTIONDUPLICATE}, + {'U', SCI_CTRL, SCI_LOWERCASE}, + {'U', SCI_CSHIFT, SCI_UPPERCASE}, + {0,0,0}, +}; + diff --git a/libs/qscintilla/src/KeyMap.h b/libs/qscintilla/src/KeyMap.h new file mode 100644 index 000000000..b102b356f --- /dev/null +++ b/libs/qscintilla/src/KeyMap.h @@ -0,0 +1,66 @@ +// Scintilla source code edit control +/** @file KeyMap.h + ** Defines a mapping between keystrokes and commands. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef KEYMAP_H +#define KEYMAP_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +#define SCI_NORM 0 +#define SCI_SHIFT SCMOD_SHIFT +#define SCI_CTRL SCMOD_CTRL +#define SCI_ALT SCMOD_ALT +#define SCI_META SCMOD_META +#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT) +#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT) + +/** + */ +class KeyModifiers { +public: + int key; + int modifiers; + KeyModifiers(int key_, int modifiers_) : key(key_), modifiers(modifiers_) { + } + bool operator<(const KeyModifiers &other) const { + if (key == other.key) + return modifiers < other.modifiers; + else + return key < other.key; + } +}; + +/** + */ +class KeyToCommand { +public: + int key; + int modifiers; + unsigned int msg; +}; + +/** + */ +class KeyMap { + std::map kmap; + static const KeyToCommand MapDefault[]; + +public: + KeyMap(); + ~KeyMap(); + void Clear(); + void AssignCmdKey(int key, int modifiers, unsigned int msg); + unsigned int Find(int key, int modifiers) const; // 0 returned on failure +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/License.txt b/libs/qscintilla/src/License.txt new file mode 100644 index 000000000..cbe25b2fc --- /dev/null +++ b/libs/qscintilla/src/License.txt @@ -0,0 +1,20 @@ +License for Scintilla and SciTE + +Copyright 1998-2003 by Neil Hodgson + +All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation. + +NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY +SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE +OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file diff --git a/libs/qscintilla/src/LineMarker.cpp b/libs/qscintilla/src/LineMarker.cpp new file mode 100644 index 000000000..98e75ca52 --- /dev/null +++ b/libs/qscintilla/src/LineMarker.cpp @@ -0,0 +1,398 @@ +// Scintilla source code edit control +/** @file LineMarker.cxx + ** Defines the look of a line marker in the margin. + **/ +// Copyright 1998-2011 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" + +#include "StringCopy.h" +#include "XPM.h" +#include "LineMarker.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +void LineMarker::SetXPM(const char *textForm) { + delete pxpm; + pxpm = new XPM(textForm); + markType = SC_MARK_PIXMAP; +} + +void LineMarker::SetXPM(const char *const *linesForm) { + delete pxpm; + pxpm = new XPM(linesForm); + markType = SC_MARK_PIXMAP; +} + +void LineMarker::SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage) { + delete image; + image = new RGBAImage(static_cast(sizeRGBAImage.x), static_cast(sizeRGBAImage.y), scale, pixelsRGBAImage); + markType = SC_MARK_RGBAIMAGE; +} + +static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { + PRectangle rc = PRectangle::FromInts( + centreX - armSize, + centreY - armSize, + centreX + armSize + 1, + centreY + armSize + 1); + surface->RectangleDraw(rc, back, fore); +} + +static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) { + PRectangle rcCircle = PRectangle::FromInts( + centreX - armSize, + centreY - armSize, + centreX + armSize + 1, + centreY + armSize + 1); + surface->Ellipse(rcCircle, back, fore); +} + +static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { + PRectangle rcV = PRectangle::FromInts(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1); + surface->FillRectangle(rcV, fore); + PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1); + surface->FillRectangle(rcH, fore); +} + +static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) { + PRectangle rcH = PRectangle::FromInts(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY + 1); + surface->FillRectangle(rcH, fore); +} + +void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const { + if (customDraw != NULL) { + customDraw(surface, rcWhole, fontForCharacter, tFold, marginStyle, this); + return; + } + + ColourDesired colourHead = back; + ColourDesired colourBody = back; + ColourDesired colourTail = back; + + switch (tFold) { + case LineMarker::head : + case LineMarker::headWithTail : + colourHead = backSelected; + colourTail = backSelected; + break; + case LineMarker::body : + colourHead = backSelected; + colourBody = backSelected; + break; + case LineMarker::tail : + colourBody = backSelected; + colourTail = backSelected; + break; + default : + // LineMarker::undefined + break; + } + + if ((markType == SC_MARK_PIXMAP) && (pxpm)) { + pxpm->Draw(surface, rcWhole); + return; + } + if ((markType == SC_MARK_RGBAIMAGE) && (image)) { + // Make rectangle just large enough to fit image centred on centre of rcWhole + PRectangle rcImage; + rcImage.top = ((rcWhole.top + rcWhole.bottom) - image->GetScaledHeight()) / 2; + rcImage.bottom = rcImage.top + image->GetScaledHeight(); + rcImage.left = ((rcWhole.left + rcWhole.right) - image->GetScaledWidth()) / 2; + rcImage.right = rcImage.left + image->GetScaledWidth(); + surface->DrawRGBAImage(rcImage, image->GetWidth(), image->GetHeight(), image->Pixels()); + return; + } + // Restrict most shapes a bit + PRectangle rc = rcWhole; + rc.top++; + rc.bottom--; + int minDim = Platform::Minimum(static_cast(rc.Width()), static_cast(rc.Height())); + minDim--; // Ensure does not go beyond edge + int centreX = static_cast(floor((rc.right + rc.left) / 2.0)); + int centreY = static_cast(floor((rc.bottom + rc.top) / 2.0)); + int dimOn2 = minDim / 2; + int dimOn4 = minDim / 4; + int blobSize = dimOn2-1; + int armSize = dimOn2-2; + if (marginStyle == SC_MARGIN_NUMBER || marginStyle == SC_MARGIN_TEXT || marginStyle == SC_MARGIN_RTEXT) { + // On textual margins move marker to the left to try to avoid overlapping the text + centreX = static_cast(rc.left) + dimOn2 + 1; + } + if (markType == SC_MARK_ROUNDRECT) { + PRectangle rcRounded = rc; + rcRounded.left = rc.left + 1; + rcRounded.right = rc.right - 1; + surface->RoundedRectangle(rcRounded, fore, back); + } else if (markType == SC_MARK_CIRCLE) { + PRectangle rcCircle = PRectangle::FromInts( + centreX - dimOn2, + centreY - dimOn2, + centreX + dimOn2, + centreY + dimOn2); + surface->Ellipse(rcCircle, fore, back); + } else if (markType == SC_MARK_ARROW) { + Point pts[] = { + Point::FromInts(centreX - dimOn4, centreY - dimOn2), + Point::FromInts(centreX - dimOn4, centreY + dimOn2), + Point::FromInts(centreX + dimOn2 - dimOn4, centreY), + }; + surface->Polygon(pts, ELEMENTS(pts), fore, back); + + } else if (markType == SC_MARK_ARROWDOWN) { + Point pts[] = { + Point::FromInts(centreX - dimOn2, centreY - dimOn4), + Point::FromInts(centreX + dimOn2, centreY - dimOn4), + Point::FromInts(centreX, centreY + dimOn2 - dimOn4), + }; + surface->Polygon(pts, ELEMENTS(pts), fore, back); + + } else if (markType == SC_MARK_PLUS) { + Point pts[] = { + Point::FromInts(centreX - armSize, centreY - 1), + Point::FromInts(centreX - 1, centreY - 1), + Point::FromInts(centreX - 1, centreY - armSize), + Point::FromInts(centreX + 1, centreY - armSize), + Point::FromInts(centreX + 1, centreY - 1), + Point::FromInts(centreX + armSize, centreY -1), + Point::FromInts(centreX + armSize, centreY +1), + Point::FromInts(centreX + 1, centreY + 1), + Point::FromInts(centreX + 1, centreY + armSize), + Point::FromInts(centreX - 1, centreY + armSize), + Point::FromInts(centreX - 1, centreY + 1), + Point::FromInts(centreX - armSize, centreY + 1), + }; + surface->Polygon(pts, ELEMENTS(pts), fore, back); + + } else if (markType == SC_MARK_MINUS) { + Point pts[] = { + Point::FromInts(centreX - armSize, centreY - 1), + Point::FromInts(centreX + armSize, centreY -1), + Point::FromInts(centreX + armSize, centreY +1), + Point::FromInts(centreX - armSize, centreY + 1), + }; + surface->Polygon(pts, ELEMENTS(pts), fore, back); + + } else if (markType == SC_MARK_SMALLRECT) { + PRectangle rcSmall; + rcSmall.left = rc.left + 1; + rcSmall.top = rc.top + 2; + rcSmall.right = rc.right - 1; + rcSmall.bottom = rc.bottom - 2; + surface->RectangleDraw(rcSmall, fore, back); + + } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND || + markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) { + // An invisible marker so don't draw anything + + } else if (markType == SC_MARK_VLINE) { + surface->PenColour(colourBody); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + } else if (markType == SC_MARK_LCORNER) { + surface->PenColour(colourTail); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY); + surface->LineTo(static_cast(rc.right) - 1, centreY); + + } else if (markType == SC_MARK_TCORNER) { + surface->PenColour(colourTail); + surface->MoveTo(centreX, centreY); + surface->LineTo(static_cast(rc.right) - 1, centreY); + + surface->PenColour(colourBody); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY + 1); + + surface->PenColour(colourHead); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + } else if (markType == SC_MARK_LCORNERCURVE) { + surface->PenColour(colourTail); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY-3); + surface->LineTo(centreX+3, centreY); + surface->LineTo(static_cast(rc.right) - 1, centreY); + + } else if (markType == SC_MARK_TCORNERCURVE) { + surface->PenColour(colourTail); + surface->MoveTo(centreX, centreY-3); + surface->LineTo(centreX+3, centreY); + surface->LineTo(static_cast(rc.right) - 1, centreY); + + surface->PenColour(colourBody); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY-2); + + surface->PenColour(colourHead); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + } else if (markType == SC_MARK_BOXPLUS) { + DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); + DrawPlus(surface, centreX, centreY, blobSize, colourTail); + + } else if (markType == SC_MARK_BOXPLUSCONNECTED) { + if (tFold == LineMarker::headWithTail) + surface->PenColour(colourTail); + else + surface->PenColour(colourBody); + surface->MoveTo(centreX, centreY + blobSize); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + surface->PenColour(colourBody); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY - blobSize); + + DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); + DrawPlus(surface, centreX, centreY, blobSize, colourTail); + + if (tFold == LineMarker::body) { + surface->PenColour(colourTail); + surface->MoveTo(centreX + 1, centreY + blobSize); + surface->LineTo(centreX + blobSize + 1, centreY + blobSize); + + surface->MoveTo(centreX + blobSize, centreY + blobSize); + surface->LineTo(centreX + blobSize, centreY - blobSize); + + surface->MoveTo(centreX + 1, centreY - blobSize); + surface->LineTo(centreX + blobSize + 1, centreY - blobSize); + } + } else if (markType == SC_MARK_BOXMINUS) { + DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); + DrawMinus(surface, centreX, centreY, blobSize, colourTail); + + surface->PenColour(colourHead); + surface->MoveTo(centreX, centreY + blobSize); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + } else if (markType == SC_MARK_BOXMINUSCONNECTED) { + DrawBox(surface, centreX, centreY, blobSize, fore, colourHead); + DrawMinus(surface, centreX, centreY, blobSize, colourTail); + + surface->PenColour(colourHead); + surface->MoveTo(centreX, centreY + blobSize); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + surface->PenColour(colourBody); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY - blobSize); + + if (tFold == LineMarker::body) { + surface->PenColour(colourTail); + surface->MoveTo(centreX + 1, centreY + blobSize); + surface->LineTo(centreX + blobSize + 1, centreY + blobSize); + + surface->MoveTo(centreX + blobSize, centreY + blobSize); + surface->LineTo(centreX + blobSize, centreY - blobSize); + + surface->MoveTo(centreX + 1, centreY - blobSize); + surface->LineTo(centreX + blobSize + 1, centreY - blobSize); + } + } else if (markType == SC_MARK_CIRCLEPLUS) { + DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); + DrawPlus(surface, centreX, centreY, blobSize, colourTail); + + } else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) { + if (tFold == LineMarker::headWithTail) + surface->PenColour(colourTail); + else + surface->PenColour(colourBody); + surface->MoveTo(centreX, centreY + blobSize); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + surface->PenColour(colourBody); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY - blobSize); + + DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); + DrawPlus(surface, centreX, centreY, blobSize, colourTail); + + } else if (markType == SC_MARK_CIRCLEMINUS) { + surface->PenColour(colourHead); + surface->MoveTo(centreX, centreY + blobSize); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); + DrawMinus(surface, centreX, centreY, blobSize, colourTail); + + } else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) { + surface->PenColour(colourHead); + surface->MoveTo(centreX, centreY + blobSize); + surface->LineTo(centreX, static_cast(rcWhole.bottom)); + + surface->PenColour(colourBody); + surface->MoveTo(centreX, static_cast(rcWhole.top)); + surface->LineTo(centreX, centreY - blobSize); + + DrawCircle(surface, centreX, centreY, blobSize, fore, colourHead); + DrawMinus(surface, centreX, centreY, blobSize, colourTail); + + } else if (markType >= SC_MARK_CHARACTER) { + char character[1]; + character[0] = static_cast(markType - SC_MARK_CHARACTER); + XYPOSITION width = surface->WidthText(fontForCharacter, character, 1); + rc.left += (rc.Width() - width) / 2; + rc.right = rc.left + width; + surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2, + character, 1, fore, back); + + } else if (markType == SC_MARK_DOTDOTDOT) { + XYPOSITION right = static_cast(centreX - 6); + for (int b=0; b<3; b++) { + PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2); + surface->FillRectangle(rcBlob, fore); + right += 5.0f; + } + } else if (markType == SC_MARK_ARROWS) { + surface->PenColour(fore); + int right = centreX - 2; + const int armLength = dimOn2 - 1; + for (int b = 0; b<3; b++) { + surface->MoveTo(right, centreY); + surface->LineTo(right - armLength, centreY - armLength); + surface->MoveTo(right, centreY); + surface->LineTo(right - armLength, centreY + armLength); + right += 4; + } + } else if (markType == SC_MARK_SHORTARROW) { + Point pts[] = { + Point::FromInts(centreX, centreY + dimOn2), + Point::FromInts(centreX + dimOn2, centreY), + Point::FromInts(centreX, centreY - dimOn2), + Point::FromInts(centreX, centreY - dimOn4), + Point::FromInts(centreX - dimOn4, centreY - dimOn4), + Point::FromInts(centreX - dimOn4, centreY + dimOn4), + Point::FromInts(centreX, centreY + dimOn4), + Point::FromInts(centreX, centreY + dimOn2), + }; + surface->Polygon(pts, ELEMENTS(pts), fore, back); + } else if (markType == SC_MARK_LEFTRECT) { + PRectangle rcLeft = rcWhole; + rcLeft.right = rcLeft.left + 4; + surface->FillRectangle(rcLeft, back); + } else if (markType == SC_MARK_BOOKMARK) { + int halfHeight = minDim / 3; + Point pts[] = { + Point::FromInts(static_cast(rc.left), centreY-halfHeight), + Point::FromInts(static_cast(rc.right) - 3, centreY - halfHeight), + Point::FromInts(static_cast(rc.right) - 3 - halfHeight, centreY), + Point::FromInts(static_cast(rc.right) - 3, centreY + halfHeight), + Point::FromInts(static_cast(rc.left), centreY + halfHeight), + }; + surface->Polygon(pts, ELEMENTS(pts), fore, back); + } else { // SC_MARK_FULLRECT + surface->FillRectangle(rcWhole, back); + } +} diff --git a/libs/qscintilla/src/LineMarker.h b/libs/qscintilla/src/LineMarker.h new file mode 100644 index 000000000..6a5fe7492 --- /dev/null +++ b/libs/qscintilla/src/LineMarker.h @@ -0,0 +1,86 @@ +// Scintilla source code edit control +/** @file LineMarker.h + ** Defines the look of a line marker in the margin . + **/ +// Copyright 1998-2011 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef LINEMARKER_H +#define LINEMARKER_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +typedef void (*DrawLineMarkerFn)(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, int tFold, int marginStyle, const void *lineMarker); + +/** + */ +class LineMarker { +public: + enum typeOfFold { undefined, head, body, tail, headWithTail }; + + int markType; + ColourDesired fore; + ColourDesired back; + ColourDesired backSelected; + int alpha; + XPM *pxpm; + RGBAImage *image; + /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native + * Draw function for drawing line markers. Allow those platforms to override + * it instead of creating a new method(s) in the Surface class that existing + * platforms must implement as empty. */ + DrawLineMarkerFn customDraw; + LineMarker() { + markType = SC_MARK_CIRCLE; + fore = ColourDesired(0,0,0); + back = ColourDesired(0xff,0xff,0xff); + backSelected = ColourDesired(0xff,0x00,0x00); + alpha = SC_ALPHA_NOALPHA; + pxpm = NULL; + image = NULL; + customDraw = NULL; + } + LineMarker(const LineMarker &) { + // Defined to avoid pxpm being blindly copied, not as a complete copy constructor + markType = SC_MARK_CIRCLE; + fore = ColourDesired(0,0,0); + back = ColourDesired(0xff,0xff,0xff); + backSelected = ColourDesired(0xff,0x00,0x00); + alpha = SC_ALPHA_NOALPHA; + pxpm = NULL; + image = NULL; + customDraw = NULL; + } + ~LineMarker() { + delete pxpm; + delete image; + } + LineMarker &operator=(const LineMarker &other) { + // Defined to avoid pxpm being blindly copied, not as a complete assignment operator + if (this != &other) { + markType = SC_MARK_CIRCLE; + fore = ColourDesired(0,0,0); + back = ColourDesired(0xff,0xff,0xff); + backSelected = ColourDesired(0xff,0x00,0x00); + alpha = SC_ALPHA_NOALPHA; + delete pxpm; + pxpm = NULL; + delete image; + image = NULL; + customDraw = NULL; + } + return *this; + } + void SetXPM(const char *textForm); + void SetXPM(const char *const *linesForm); + void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); + void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter, typeOfFold tFold, int marginStyle) const; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/MarginView.cpp b/libs/qscintilla/src/MarginView.cpp new file mode 100644 index 000000000..a6fc1f40b --- /dev/null +++ b/libs/qscintilla/src/MarginView.cpp @@ -0,0 +1,470 @@ +// Scintilla source code edit control +/** @file MarginView.cxx + ** Defines the appearance of the editor margin. + **/ +// Copyright 1998-2014 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 +#include +#include + +#include "Platform.h" + +#include "ILexer.h" +#include "Scintilla.h" + +#include "StringCopy.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" +#include "CellBuffer.h" +#include "KeyMap.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "UniConversion.h" +#include "Selection.h" +#include "PositionCache.h" +#include "EditModel.h" +#include "MarginView.h" +#include "EditView.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +void DrawWrapMarker(Surface *surface, PRectangle rcPlace, + bool isEndMarker, ColourDesired wrapColour) { + surface->PenColour(wrapColour); + + enum { xa = 1 }; // gap before start + int w = static_cast(rcPlace.right - rcPlace.left) - xa - 1; + + bool xStraight = isEndMarker; // x-mirrored symbol for start marker + + int x0 = static_cast(xStraight ? rcPlace.left : rcPlace.right - 1); + int y0 = static_cast(rcPlace.top); + + int dy = static_cast(rcPlace.bottom - rcPlace.top) / 5; + int y = static_cast(rcPlace.bottom - rcPlace.top) / 2 + dy; + + struct Relative { + Surface *surface; + int xBase; + int xDir; + int yBase; + int yDir; + void MoveTo(int xRelative, int yRelative) { + surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + } + void LineTo(int xRelative, int yRelative) { + surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + } + }; + Relative rel = { surface, x0, xStraight ? 1 : -1, y0, 1 }; + + // arrow head + rel.MoveTo(xa, y); + rel.LineTo(xa + 2 * w / 3, y - dy); + rel.MoveTo(xa, y); + rel.LineTo(xa + 2 * w / 3, y + dy); + + // arrow body + rel.MoveTo(xa, y); + rel.LineTo(xa + w, y); + rel.LineTo(xa + w, y - 2 * dy); + rel.LineTo(xa - 1, // on windows lineto is exclusive endpoint, perhaps GTK not... + y - 2 * dy); +} + +MarginView::MarginView() { + pixmapSelMargin = 0; + pixmapSelPattern = 0; + pixmapSelPatternOffset1 = 0; + wrapMarkerPaddingRight = 3; + customDrawWrapMarker = NULL; +} + +void MarginView::DropGraphics(bool freeObjects) { + if (freeObjects) { + delete pixmapSelMargin; + pixmapSelMargin = 0; + delete pixmapSelPattern; + pixmapSelPattern = 0; + delete pixmapSelPatternOffset1; + pixmapSelPatternOffset1 = 0; + } else { + if (pixmapSelMargin) + pixmapSelMargin->Release(); + if (pixmapSelPattern) + pixmapSelPattern->Release(); + if (pixmapSelPatternOffset1) + pixmapSelPatternOffset1->Release(); + } +} + +void MarginView::AllocateGraphics(const ViewStyle &vsDraw) { + if (!pixmapSelMargin) + pixmapSelMargin = Surface::Allocate(vsDraw.technology); + if (!pixmapSelPattern) + pixmapSelPattern = Surface::Allocate(vsDraw.technology); + if (!pixmapSelPatternOffset1) + pixmapSelPatternOffset1 = Surface::Allocate(vsDraw.technology); +} + +void MarginView::RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw) { + if (!pixmapSelPattern->Initialised()) { + const int patternSize = 8; + pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow, wid); + pixmapSelPatternOffset1->InitPixMap(patternSize, patternSize, surfaceWindow, wid); + // This complex procedure is to reproduce the checkerboard dithered pattern used by windows + // for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half + // way between the chrome colour and the chrome highlight colour making a nice transition + // between the window chrome and the content area. And it works in low colour depths. + PRectangle rcPattern = PRectangle::FromInts(0, 0, patternSize, patternSize); + + // Initialize default colours based on the chrome colour scheme. Typically the highlight is white. + ColourDesired colourFMFill = vsDraw.selbar; + ColourDesired colourFMStripes = vsDraw.selbarlight; + + if (!(vsDraw.selbarlight == ColourDesired(0xff, 0xff, 0xff))) { + // User has chosen an unusual chrome colour scheme so just use the highlight edge colour. + // (Typically, the highlight colour is white.) + colourFMFill = vsDraw.selbarlight; + } + + if (vsDraw.foldmarginColour.isSet) { + // override default fold margin colour + colourFMFill = vsDraw.foldmarginColour; + } + if (vsDraw.foldmarginHighlightColour.isSet) { + // override default fold margin highlight colour + colourFMStripes = vsDraw.foldmarginHighlightColour; + } + + pixmapSelPattern->FillRectangle(rcPattern, colourFMFill); + pixmapSelPatternOffset1->FillRectangle(rcPattern, colourFMStripes); + for (int y = 0; y < patternSize; y++) { + for (int x = y % 2; x < patternSize; x += 2) { + PRectangle rcPixel = PRectangle::FromInts(x, y, x + 1, y + 1); + pixmapSelPattern->FillRectangle(rcPixel, colourFMStripes); + pixmapSelPatternOffset1->FillRectangle(rcPixel, colourFMFill); + } + } + } +} + +static int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault, const ViewStyle &vs) { + if (vs.markers[markerCheck].markType == SC_MARK_EMPTY) + return markerDefault; + return markerCheck; +} + +void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin, + const EditModel &model, const ViewStyle &vs) { + + PRectangle rcSelMargin = rcMargin; + rcSelMargin.right = rcMargin.left; + if (rcSelMargin.bottom < rc.bottom) + rcSelMargin.bottom = rc.bottom; + + Point ptOrigin = model.GetVisibleOriginInMain(); + FontAlias fontLineNumber = vs.styles[STYLE_LINENUMBER].font; + for (int margin = 0; margin <= SC_MAX_MARGIN; margin++) { + if (vs.ms[margin].width > 0) { + + rcSelMargin.left = rcSelMargin.right; + rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width; + + if (vs.ms[margin].style != SC_MARGIN_NUMBER) { + if (vs.ms[margin].mask & SC_MASK_FOLDERS) { + // Required because of special way brush is created for selection margin + // Ensure patterns line up when scrolling with separate margin view + // by choosing correctly aligned variant. + bool invertPhase = static_cast(ptOrigin.y) & 1; + surface->FillRectangle(rcSelMargin, + invertPhase ? *pixmapSelPattern : *pixmapSelPatternOffset1); + } else { + ColourDesired colour; + switch (vs.ms[margin].style) { + case SC_MARGIN_BACK: + colour = vs.styles[STYLE_DEFAULT].back; + break; + case SC_MARGIN_FORE: + colour = vs.styles[STYLE_DEFAULT].fore; + break; + default: + colour = vs.styles[STYLE_LINENUMBER].back; + break; + } + surface->FillRectangle(rcSelMargin, colour); + } + } else { + surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back); + } + + const int lineStartPaint = static_cast(rcMargin.top + ptOrigin.y) / vs.lineHeight; + int visibleLine = model.TopLineOfMain() + lineStartPaint; + int yposScreen = lineStartPaint * vs.lineHeight - static_cast(ptOrigin.y); + // Work out whether the top line is whitespace located after a + // lessening of fold level which implies a 'fold tail' but which should not + // be displayed until the last of a sequence of whitespace. + bool needWhiteClosure = false; + if (vs.ms[margin].mask & SC_MASK_FOLDERS) { + int level = model.pdoc->GetLevel(model.cs.DocFromDisplay(visibleLine)); + if (level & SC_FOLDLEVELWHITEFLAG) { + int lineBack = model.cs.DocFromDisplay(visibleLine); + int levelPrev = level; + while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) { + lineBack--; + levelPrev = model.pdoc->GetLevel(lineBack); + } + if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { + if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK)) + needWhiteClosure = true; + } + } + if (highlightDelimiter.isEnabled) { + int lastLine = model.cs.DocFromDisplay(topLine + model.LinesOnScreen()) + 1; + model.pdoc->GetHighlightDelimiters(highlightDelimiter, model.pdoc->LineFromPosition(model.sel.MainCaret()), lastLine); + } + } + + // Old code does not know about new markers needed to distinguish all cases + const int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, + SC_MARKNUM_FOLDEROPEN, vs); + const int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, + SC_MARKNUM_FOLDER, vs); + + while ((visibleLine < model.cs.LinesDisplayed()) && yposScreen < rc.bottom) { + + PLATFORM_ASSERT(visibleLine < model.cs.LinesDisplayed()); + const int lineDoc = model.cs.DocFromDisplay(visibleLine); + PLATFORM_ASSERT(model.cs.GetVisible(lineDoc)); + const int firstVisibleLine = model.cs.DisplayFromDoc(lineDoc); + const int lastVisibleLine = model.cs.DisplayLastFromDoc(lineDoc); + const bool firstSubLine = visibleLine == firstVisibleLine; + const bool lastSubLine = visibleLine == lastVisibleLine; + + int marks = model.pdoc->GetMark(lineDoc); + if (!firstSubLine) + marks = 0; + + bool headWithTail = false; + + if (vs.ms[margin].mask & SC_MASK_FOLDERS) { + // Decide which fold indicator should be displayed + const int level = model.pdoc->GetLevel(lineDoc); + const int levelNext = model.pdoc->GetLevel(lineDoc + 1); + const int levelNum = level & SC_FOLDLEVELNUMBERMASK; + const int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK; + if (level & SC_FOLDLEVELHEADERFLAG) { + if (firstSubLine) { + if (levelNum < levelNextNum) { + if (model.cs.GetExpanded(lineDoc)) { + if (levelNum == SC_FOLDLEVELBASE) + marks |= 1 << SC_MARKNUM_FOLDEROPEN; + else + marks |= 1 << folderOpenMid; + } else { + if (levelNum == SC_FOLDLEVELBASE) + marks |= 1 << SC_MARKNUM_FOLDER; + else + marks |= 1 << folderEnd; + } + } else if (levelNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } else { + if (levelNum < levelNextNum) { + if (model.cs.GetExpanded(lineDoc)) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } else if (levelNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } else if (levelNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } + needWhiteClosure = false; + const int firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1)); + const int firstFollowupLineLevel = model.pdoc->GetLevel(firstFollowupLine); + const int secondFollowupLineLevelNum = model.pdoc->GetLevel(firstFollowupLine + 1) & SC_FOLDLEVELNUMBERMASK; + if (!model.cs.GetExpanded(lineDoc)) { + if ((firstFollowupLineLevel & SC_FOLDLEVELWHITEFLAG) && + (levelNum > secondFollowupLineLevelNum)) + needWhiteClosure = true; + + if (highlightDelimiter.IsFoldBlockHighlighted(firstFollowupLine)) + headWithTail = true; + } + } else if (level & SC_FOLDLEVELWHITEFLAG) { + if (needWhiteClosure) { + if (levelNext & SC_FOLDLEVELWHITEFLAG) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } else if (levelNextNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; + needWhiteClosure = false; + } else { + marks |= 1 << SC_MARKNUM_FOLDERTAIL; + needWhiteClosure = false; + } + } else if (levelNum > SC_FOLDLEVELBASE) { + if (levelNextNum < levelNum) { + if (levelNextNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; + } else { + marks |= 1 << SC_MARKNUM_FOLDERTAIL; + } + } else { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } + } else if (levelNum > SC_FOLDLEVELBASE) { + if (levelNextNum < levelNum) { + needWhiteClosure = false; + if (levelNext & SC_FOLDLEVELWHITEFLAG) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + needWhiteClosure = true; + } else if (lastSubLine) { + if (levelNextNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; + } else { + marks |= 1 << SC_MARKNUM_FOLDERTAIL; + } + } else { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } else { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } + } + + marks &= vs.ms[margin].mask; + + PRectangle rcMarker = rcSelMargin; + rcMarker.top = static_cast(yposScreen); + rcMarker.bottom = static_cast(yposScreen + vs.lineHeight); + if (vs.ms[margin].style == SC_MARGIN_NUMBER) { + if (firstSubLine) { + char number[100] = ""; + if (lineDoc >= 0) + sprintf(number, "%d", lineDoc + 1); + if (model.foldFlags & (SC_FOLDFLAG_LEVELNUMBERS | SC_FOLDFLAG_LINESTATE)) { + if (model.foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { + int lev = model.pdoc->GetLevel(lineDoc); + sprintf(number, "%c%c %03X %03X", + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', + lev & SC_FOLDLEVELNUMBERMASK, + lev >> 16 + ); + } else { + int state = model.pdoc->GetLineState(lineDoc); + sprintf(number, "%0X", state); + } + } + PRectangle rcNumber = rcMarker; + // Right justify + XYPOSITION width = surface->WidthText(fontLineNumber, number, static_cast(strlen(number))); + XYPOSITION xpos = rcNumber.right - width - vs.marginNumberPadding; + rcNumber.left = xpos; + DrawTextNoClipPhase(surface, rcNumber, vs.styles[STYLE_LINENUMBER], + rcNumber.top + vs.maxAscent, number, static_cast(strlen(number)), drawAll); + } else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) { + PRectangle rcWrapMarker = rcMarker; + rcWrapMarker.right -= wrapMarkerPaddingRight; + rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth; + if (customDrawWrapMarker == NULL) { + DrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore); + } else { + customDrawWrapMarker(surface, rcWrapMarker, false, vs.styles[STYLE_LINENUMBER].fore); + } + } + } else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) { + const StyledText stMargin = model.pdoc->MarginStyledText(lineDoc); + if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { + if (firstSubLine) { + surface->FillRectangle(rcMarker, + vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); + if (vs.ms[margin].style == SC_MARGIN_RTEXT) { + int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin); + rcMarker.left = rcMarker.right - width - 3; + } + DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, + stMargin, 0, stMargin.length, drawAll); + } else { + // if we're displaying annotation lines, color the margin to match the associated document line + const int annotationLines = model.pdoc->AnnotationLines(lineDoc); + if (annotationLines && (visibleLine > lastVisibleLine - annotationLines)) { + surface->FillRectangle(rcMarker, vs.styles[stMargin.StyleAt(0) + vs.marginStyleOffset].back); + } + } + } + } + + if (marks) { + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if (marks & 1) { + LineMarker::typeOfFold tFold = LineMarker::undefined; + if ((vs.ms[margin].mask & SC_MASK_FOLDERS) && highlightDelimiter.IsFoldBlockHighlighted(lineDoc)) { + if (highlightDelimiter.IsBodyOfFoldBlock(lineDoc)) { + tFold = LineMarker::body; + } else if (highlightDelimiter.IsHeadOfFoldBlock(lineDoc)) { + if (firstSubLine) { + tFold = headWithTail ? LineMarker::headWithTail : LineMarker::head; + } else { + if (model.cs.GetExpanded(lineDoc) || headWithTail) { + tFold = LineMarker::body; + } else { + tFold = LineMarker::undefined; + } + } + } else if (highlightDelimiter.IsTailOfFoldBlock(lineDoc)) { + tFold = LineMarker::tail; + } + } + vs.markers[markBit].Draw(surface, rcMarker, fontLineNumber, tFold, vs.ms[margin].style); + } + marks >>= 1; + } + } + + visibleLine++; + yposScreen += vs.lineHeight; + } + } + } + + PRectangle rcBlankMargin = rcMargin; + rcBlankMargin.left = rcSelMargin.right; + surface->FillRectangle(rcBlankMargin, vs.styles[STYLE_DEFAULT].back); +} + +#ifdef SCI_NAMESPACE +} +#endif + diff --git a/libs/qscintilla/src/MarginView.h b/libs/qscintilla/src/MarginView.h new file mode 100644 index 000000000..ff5564676 --- /dev/null +++ b/libs/qscintilla/src/MarginView.h @@ -0,0 +1,50 @@ +// Scintilla source code edit control +/** @file MarginView.h + ** Defines the appearance of the editor margin. + **/ +// Copyright 1998-2014 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef MARGINVIEW_H +#define MARGINVIEW_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); + +typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour); + +/** +* MarginView draws the margins. +*/ +class MarginView { +public: + Surface *pixmapSelMargin; + Surface *pixmapSelPattern; + Surface *pixmapSelPatternOffset1; + // Highlight current folding block + HighlightDelimiter highlightDelimiter; + + int wrapMarkerPaddingRight; // right-most pixel padding of wrap markers + /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native + * DrawWrapMarker function for drawing wrap markers. Allow those platforms to + * override it instead of creating a new method in the Surface class that + * existing platforms must implement as empty. */ + DrawWrapMarkerFn customDrawWrapMarker; + + MarginView(); + + void DropGraphics(bool freeObjects); + void AllocateGraphics(const ViewStyle &vsDraw); + void RefreshPixMaps(Surface *surfaceWindow, WindowID wid, const ViewStyle &vsDraw); + void PaintMargin(Surface *surface, int topLine, PRectangle rc, PRectangle rcMargin, + const EditModel &model, const ViewStyle &vs); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Partitioning.h b/libs/qscintilla/src/Partitioning.h new file mode 100644 index 000000000..688b38d7d --- /dev/null +++ b/libs/qscintilla/src/Partitioning.h @@ -0,0 +1,198 @@ +// Scintilla source code edit control +/** @file Partitioning.h + ** Data structure used to partition an interval. Used for holding line start/end positions. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PARTITIONING_H +#define PARTITIONING_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/// A split vector of integers with a method for adding a value to all elements +/// in a range. +/// Used by the Partitioning class. + +class SplitVectorWithRangeAdd : public SplitVector { +public: + explicit SplitVectorWithRangeAdd(int growSize_) { + SetGrowSize(growSize_); + ReAllocate(growSize_); + } + ~SplitVectorWithRangeAdd() { + } + void RangeAddDelta(int start, int end, int delta) { + // end is 1 past end, so end-start is number of elements to change + int i = 0; + int rangeLength = end - start; + int range1Length = rangeLength; + int part1Left = part1Length - start; + if (range1Length > part1Left) + range1Length = part1Left; + while (i < range1Length) { + body[start++] += delta; + i++; + } + start += gapLength; + while (i < rangeLength) { + body[start++] += delta; + i++; + } + } +}; + +/// Divide an interval into multiple partitions. +/// Useful for breaking a document down into sections such as lines. +/// A 0 length interval has a single 0 length partition, numbered 0 +/// If interval not 0 length then each partition non-zero length +/// When needed, positions after the interval are considered part of the last partition +/// but the end of the last partition can be found with PositionFromPartition(last+1). + +class Partitioning { +private: + // To avoid calculating all the partition positions whenever any text is inserted + // there may be a step somewhere in the list. + int stepPartition; + int stepLength; + SplitVectorWithRangeAdd *body; + + // Move step forward + void ApplyStep(int partitionUpTo) { + if (stepLength != 0) { + body->RangeAddDelta(stepPartition+1, partitionUpTo + 1, stepLength); + } + stepPartition = partitionUpTo; + if (stepPartition >= body->Length()-1) { + stepPartition = body->Length()-1; + stepLength = 0; + } + } + + // Move step backward + void BackStep(int partitionDownTo) { + if (stepLength != 0) { + body->RangeAddDelta(partitionDownTo+1, stepPartition+1, -stepLength); + } + stepPartition = partitionDownTo; + } + + void Allocate(int growSize) { + body = new SplitVectorWithRangeAdd(growSize); + stepPartition = 0; + stepLength = 0; + body->Insert(0, 0); // This value stays 0 for ever + body->Insert(1, 0); // This is the end of the first partition and will be the start of the second + } + +public: + explicit Partitioning(int growSize) { + Allocate(growSize); + } + + ~Partitioning() { + delete body; + body = 0; + } + + int Partitions() const { + return body->Length()-1; + } + + void InsertPartition(int partition, int pos) { + if (stepPartition < partition) { + ApplyStep(partition); + } + body->Insert(partition, pos); + stepPartition++; + } + + void SetPartitionStartPosition(int partition, int pos) { + ApplyStep(partition+1); + if ((partition < 0) || (partition > body->Length())) { + return; + } + body->SetValueAt(partition, pos); + } + + void InsertText(int partitionInsert, int delta) { + // Point all the partitions after the insertion point further along in the buffer + if (stepLength != 0) { + if (partitionInsert >= stepPartition) { + // Fill in up to the new insertion point + ApplyStep(partitionInsert); + stepLength += delta; + } else if (partitionInsert >= (stepPartition - body->Length() / 10)) { + // Close to step but before so move step back + BackStep(partitionInsert); + stepLength += delta; + } else { + ApplyStep(body->Length()-1); + stepPartition = partitionInsert; + stepLength = delta; + } + } else { + stepPartition = partitionInsert; + stepLength = delta; + } + } + + void RemovePartition(int partition) { + if (partition > stepPartition) { + ApplyStep(partition); + stepPartition--; + } else { + stepPartition--; + } + body->Delete(partition); + } + + int PositionFromPartition(int partition) const { + PLATFORM_ASSERT(partition >= 0); + PLATFORM_ASSERT(partition < body->Length()); + if ((partition < 0) || (partition >= body->Length())) { + return 0; + } + int pos = body->ValueAt(partition); + if (partition > stepPartition) + pos += stepLength; + return pos; + } + + /// Return value in range [0 .. Partitions() - 1] even for arguments outside interval + int PartitionFromPosition(int pos) const { + if (body->Length() <= 1) + return 0; + if (pos >= (PositionFromPartition(body->Length()-1))) + return body->Length() - 1 - 1; + int lower = 0; + int upper = body->Length()-1; + do { + int middle = (upper + lower + 1) / 2; // Round high + int posMiddle = body->ValueAt(middle); + if (middle > stepPartition) + posMiddle += stepLength; + if (pos < posMiddle) { + upper = middle - 1; + } else { + lower = middle; + } + } while (lower < upper); + return lower; + } + + void DeleteAll() { + int growSize = body->GetGrowSize(); + delete body; + Allocate(growSize); + } +}; + + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/PerLine.cpp b/libs/qscintilla/src/PerLine.cpp new file mode 100644 index 000000000..8fd96cbed --- /dev/null +++ b/libs/qscintilla/src/PerLine.cpp @@ -0,0 +1,556 @@ +// Scintilla source code edit control +/** @file PerLine.cxx + ** Manages data associated with each line of the document + **/ +// Copyright 1998-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "CellBuffer.h" +#include "PerLine.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +MarkerHandleSet::MarkerHandleSet() { + root = 0; +} + +MarkerHandleSet::~MarkerHandleSet() { + MarkerHandleNumber *mhn = root; + while (mhn) { + MarkerHandleNumber *mhnToFree = mhn; + mhn = mhn->next; + delete mhnToFree; + } + root = 0; +} + +int MarkerHandleSet::Length() const { + int c = 0; + MarkerHandleNumber *mhn = root; + while (mhn) { + c++; + mhn = mhn->next; + } + return c; +} + +int MarkerHandleSet::MarkValue() const { + unsigned int m = 0; + MarkerHandleNumber *mhn = root; + while (mhn) { + m |= (1 << mhn->number); + mhn = mhn->next; + } + return m; +} + +bool MarkerHandleSet::Contains(int handle) const { + MarkerHandleNumber *mhn = root; + while (mhn) { + if (mhn->handle == handle) { + return true; + } + mhn = mhn->next; + } + return false; +} + +bool MarkerHandleSet::InsertHandle(int handle, int markerNum) { + MarkerHandleNumber *mhn = new MarkerHandleNumber; + mhn->handle = handle; + mhn->number = markerNum; + mhn->next = root; + root = mhn; + return true; +} + +void MarkerHandleSet::RemoveHandle(int handle) { + MarkerHandleNumber **pmhn = &root; + while (*pmhn) { + MarkerHandleNumber *mhn = *pmhn; + if (mhn->handle == handle) { + *pmhn = mhn->next; + delete mhn; + return; + } + pmhn = &((*pmhn)->next); + } +} + +bool MarkerHandleSet::RemoveNumber(int markerNum, bool all) { + bool performedDeletion = false; + MarkerHandleNumber **pmhn = &root; + while (*pmhn) { + MarkerHandleNumber *mhn = *pmhn; + if (mhn->number == markerNum) { + *pmhn = mhn->next; + delete mhn; + performedDeletion = true; + if (!all) + break; + } else { + pmhn = &((*pmhn)->next); + } + } + return performedDeletion; +} + +void MarkerHandleSet::CombineWith(MarkerHandleSet *other) { + MarkerHandleNumber **pmhn = &root; + while (*pmhn) { + pmhn = &((*pmhn)->next); + } + *pmhn = other->root; + other->root = 0; +} + +LineMarkers::~LineMarkers() { + Init(); +} + +void LineMarkers::Init() { + for (int line = 0; line < markers.Length(); line++) { + delete markers[line]; + markers[line] = 0; + } + markers.DeleteAll(); +} + +void LineMarkers::InsertLine(int line) { + if (markers.Length()) { + markers.Insert(line, 0); + } +} + +void LineMarkers::RemoveLine(int line) { + // Retain the markers from the deleted line by oring them into the previous line + if (markers.Length()) { + if (line > 0) { + MergeMarkers(line - 1); + } + markers.Delete(line); + } +} + +int LineMarkers::LineFromHandle(int markerHandle) { + if (markers.Length()) { + for (int line = 0; line < markers.Length(); line++) { + if (markers[line]) { + if (markers[line]->Contains(markerHandle)) { + return line; + } + } + } + } + return -1; +} + +void LineMarkers::MergeMarkers(int pos) { + if (markers[pos + 1] != NULL) { + if (markers[pos] == NULL) + markers[pos] = new MarkerHandleSet; + markers[pos]->CombineWith(markers[pos + 1]); + delete markers[pos + 1]; + markers[pos + 1] = NULL; + } +} + +int LineMarkers::MarkValue(int line) { + if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) + return markers[line]->MarkValue(); + else + return 0; +} + +int LineMarkers::MarkerNext(int lineStart, int mask) const { + if (lineStart < 0) + lineStart = 0; + int length = markers.Length(); + for (int iLine = lineStart; iLine < length; iLine++) { + MarkerHandleSet *onLine = markers[iLine]; + if (onLine && ((onLine->MarkValue() & mask) != 0)) + //if ((pdoc->GetMark(iLine) & lParam) != 0) + return iLine; + } + return -1; +} + +int LineMarkers::AddMark(int line, int markerNum, int lines) { + handleCurrent++; + if (!markers.Length()) { + // No existing markers so allocate one element per line + markers.InsertValue(0, lines, 0); + } + if (line >= markers.Length()) { + return -1; + } + if (!markers[line]) { + // Need new structure to hold marker handle + markers[line] = new MarkerHandleSet(); + } + markers[line]->InsertHandle(handleCurrent, markerNum); + + return handleCurrent; +} + +bool LineMarkers::DeleteMark(int line, int markerNum, bool all) { + bool someChanges = false; + if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) { + if (markerNum == -1) { + someChanges = true; + delete markers[line]; + markers[line] = NULL; + } else { + someChanges = markers[line]->RemoveNumber(markerNum, all); + if (markers[line]->Length() == 0) { + delete markers[line]; + markers[line] = NULL; + } + } + } + return someChanges; +} + +void LineMarkers::DeleteMarkFromHandle(int markerHandle) { + int line = LineFromHandle(markerHandle); + if (line >= 0) { + markers[line]->RemoveHandle(markerHandle); + if (markers[line]->Length() == 0) { + delete markers[line]; + markers[line] = NULL; + } + } +} + +LineLevels::~LineLevels() { +} + +void LineLevels::Init() { + levels.DeleteAll(); +} + +void LineLevels::InsertLine(int line) { + if (levels.Length()) { + int level = (line < levels.Length()) ? levels[line] : SC_FOLDLEVELBASE; + levels.InsertValue(line, 1, level); + } +} + +void LineLevels::RemoveLine(int line) { + if (levels.Length()) { + // Move up following lines but merge header flag from this line + // to line before to avoid a temporary disappearence causing expansion. + int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG; + levels.Delete(line); + if (line == levels.Length()-1) // Last line loses the header flag + levels[line-1] &= ~SC_FOLDLEVELHEADERFLAG; + else if (line > 0) + levels[line-1] |= firstHeader; + } +} + +void LineLevels::ExpandLevels(int sizeNew) { + levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE); +} + +void LineLevels::ClearLevels() { + levels.DeleteAll(); +} + +int LineLevels::SetLevel(int line, int level, int lines) { + int prev = 0; + if ((line >= 0) && (line < lines)) { + if (!levels.Length()) { + ExpandLevels(lines + 1); + } + prev = levels[line]; + if (prev != level) { + levels[line] = level; + } + } + return prev; +} + +int LineLevels::GetLevel(int line) const { + if (levels.Length() && (line >= 0) && (line < levels.Length())) { + return levels[line]; + } else { + return SC_FOLDLEVELBASE; + } +} + +LineState::~LineState() { +} + +void LineState::Init() { + lineStates.DeleteAll(); +} + +void LineState::InsertLine(int line) { + if (lineStates.Length()) { + lineStates.EnsureLength(line); + int val = (line < lineStates.Length()) ? lineStates[line] : 0; + lineStates.Insert(line, val); + } +} + +void LineState::RemoveLine(int line) { + if (lineStates.Length() > line) { + lineStates.Delete(line); + } +} + +int LineState::SetLineState(int line, int state) { + lineStates.EnsureLength(line + 1); + int stateOld = lineStates[line]; + lineStates[line] = state; + return stateOld; +} + +int LineState::GetLineState(int line) { + if (line < 0) + return 0; + lineStates.EnsureLength(line + 1); + return lineStates[line]; +} + +int LineState::GetMaxLineState() const { + return lineStates.Length(); +} + +static int NumberLines(const char *text) { + if (text) { + int newLines = 0; + while (*text) { + if (*text == '\n') + newLines++; + text++; + } + return newLines+1; + } else { + return 0; + } +} + +// Each allocated LineAnnotation is a char array which starts with an AnnotationHeader +// and then has text and optional styles. + +static const int IndividualStyles = 0x100; + +struct AnnotationHeader { + short style; // Style IndividualStyles implies array of styles + short lines; + int length; +}; + +LineAnnotation::~LineAnnotation() { + ClearAll(); +} + +void LineAnnotation::Init() { + ClearAll(); +} + +void LineAnnotation::InsertLine(int line) { + if (annotations.Length()) { + annotations.EnsureLength(line); + annotations.Insert(line, 0); + } +} + +void LineAnnotation::RemoveLine(int line) { + if (annotations.Length() && (line > 0) && (line <= annotations.Length())) { + delete []annotations[line-1]; + annotations.Delete(line-1); + } +} + +bool LineAnnotation::MultipleStyles(int line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast(annotations[line])->style == IndividualStyles; + else + return 0; +} + +int LineAnnotation::Style(int line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast(annotations[line])->style; + else + return 0; +} + +const char *LineAnnotation::Text(int line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return annotations[line]+sizeof(AnnotationHeader); + else + return 0; +} + +const unsigned char *LineAnnotation::Styles(int line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line] && MultipleStyles(line)) + return reinterpret_cast(annotations[line] + sizeof(AnnotationHeader) + Length(line)); + else + return 0; +} + +static char *AllocateAnnotation(int length, int style) { + size_t len = sizeof(AnnotationHeader) + length + ((style == IndividualStyles) ? length : 0); + char *ret = new char[len]; + memset(ret, 0, len); + return ret; +} + +void LineAnnotation::SetText(int line, const char *text) { + if (text && (line >= 0)) { + annotations.EnsureLength(line+1); + int style = Style(line); + if (annotations[line]) { + delete []annotations[line]; + } + annotations[line] = AllocateAnnotation(static_cast(strlen(text)), style); + AnnotationHeader *pah = reinterpret_cast(annotations[line]); + pah->style = static_cast(style); + pah->length = static_cast(strlen(text)); + pah->lines = static_cast(NumberLines(text)); + memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length); + } else { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) { + delete []annotations[line]; + annotations[line] = 0; + } + } +} + +void LineAnnotation::ClearAll() { + for (int line = 0; line < annotations.Length(); line++) { + delete []annotations[line]; + annotations[line] = 0; + } + annotations.DeleteAll(); +} + +void LineAnnotation::SetStyle(int line, int style) { + annotations.EnsureLength(line+1); + if (!annotations[line]) { + annotations[line] = AllocateAnnotation(0, style); + } + reinterpret_cast(annotations[line])->style = static_cast(style); +} + +void LineAnnotation::SetStyles(int line, const unsigned char *styles) { + if (line >= 0) { + annotations.EnsureLength(line+1); + if (!annotations[line]) { + annotations[line] = AllocateAnnotation(0, IndividualStyles); + } else { + AnnotationHeader *pahSource = reinterpret_cast(annotations[line]); + if (pahSource->style != IndividualStyles) { + char *allocation = AllocateAnnotation(pahSource->length, IndividualStyles); + AnnotationHeader *pahAlloc = reinterpret_cast(allocation); + pahAlloc->length = pahSource->length; + pahAlloc->lines = pahSource->lines; + memcpy(allocation + sizeof(AnnotationHeader), annotations[line] + sizeof(AnnotationHeader), pahSource->length); + delete []annotations[line]; + annotations[line] = allocation; + } + } + AnnotationHeader *pah = reinterpret_cast(annotations[line]); + pah->style = IndividualStyles; + memcpy(annotations[line] + sizeof(AnnotationHeader) + pah->length, styles, pah->length); + } +} + +int LineAnnotation::Length(int line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast(annotations[line])->length; + else + return 0; +} + +int LineAnnotation::Lines(int line) const { + if (annotations.Length() && (line >= 0) && (line < annotations.Length()) && annotations[line]) + return reinterpret_cast(annotations[line])->lines; + else + return 0; +} + +LineTabstops::~LineTabstops() { + Init(); +} + +void LineTabstops::Init() { + for (int line = 0; line < tabstops.Length(); line++) { + delete tabstops[line]; + } + tabstops.DeleteAll(); +} + +void LineTabstops::InsertLine(int line) { + if (tabstops.Length()) { + tabstops.EnsureLength(line); + tabstops.Insert(line, 0); + } +} + +void LineTabstops::RemoveLine(int line) { + if (tabstops.Length() > line) { + delete tabstops[line]; + tabstops.Delete(line); + } +} + +bool LineTabstops::ClearTabstops(int line) { + if (line < tabstops.Length()) { + TabstopList *tl = tabstops[line]; + if (tl) { + tl->clear(); + return true; + } + } + return false; +} + +bool LineTabstops::AddTabstop(int line, int x) { + tabstops.EnsureLength(line + 1); + if (!tabstops[line]) { + tabstops[line] = new TabstopList(); + } + + TabstopList *tl = tabstops[line]; + if (tl) { + // tabstop positions are kept in order - insert in the right place + std::vector::iterator it = std::lower_bound(tl->begin(), tl->end(), x); + // don't insert duplicates + if (it == tl->end() || *it != x) { + tl->insert(it, x); + return true; + } + } + return false; +} + +int LineTabstops::GetNextTabstop(int line, int x) const { + if (line < tabstops.Length()) { + TabstopList *tl = tabstops[line]; + if (tl) { + for (size_t i = 0; i < tl->size(); i++) { + if ((*tl)[i] > x) { + return (*tl)[i]; + } + } + } + } + return 0; +} diff --git a/libs/qscintilla/src/PerLine.h b/libs/qscintilla/src/PerLine.h new file mode 100644 index 000000000..4bf1c88fd --- /dev/null +++ b/libs/qscintilla/src/PerLine.h @@ -0,0 +1,136 @@ +// Scintilla source code edit control +/** @file PerLine.h + ** Manages data associated with each line of the document + **/ +// Copyright 1998-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PERLINE_H +#define PERLINE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + * This holds the marker identifier and the marker type to display. + * MarkerHandleNumbers are members of lists. + */ +struct MarkerHandleNumber { + int handle; + int number; + MarkerHandleNumber *next; +}; + +/** + * A marker handle set contains any number of MarkerHandleNumbers. + */ +class MarkerHandleSet { + MarkerHandleNumber *root; + +public: + MarkerHandleSet(); + ~MarkerHandleSet(); + int Length() const; + int MarkValue() const; ///< Bit set of marker numbers. + bool Contains(int handle) const; + bool InsertHandle(int handle, int markerNum); + void RemoveHandle(int handle); + bool RemoveNumber(int markerNum, bool all); + void CombineWith(MarkerHandleSet *other); +}; + +class LineMarkers : public PerLine { + SplitVector markers; + /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big. + int handleCurrent; +public: + LineMarkers() : handleCurrent(0) { + } + virtual ~LineMarkers(); + virtual void Init(); + virtual void InsertLine(int line); + virtual void RemoveLine(int line); + + int MarkValue(int line); + int MarkerNext(int lineStart, int mask) const; + int AddMark(int line, int marker, int lines); + void MergeMarkers(int pos); + bool DeleteMark(int line, int markerNum, bool all); + void DeleteMarkFromHandle(int markerHandle); + int LineFromHandle(int markerHandle); +}; + +class LineLevels : public PerLine { + SplitVector levels; +public: + virtual ~LineLevels(); + virtual void Init(); + virtual void InsertLine(int line); + virtual void RemoveLine(int line); + + void ExpandLevels(int sizeNew=-1); + void ClearLevels(); + int SetLevel(int line, int level, int lines); + int GetLevel(int line) const; +}; + +class LineState : public PerLine { + SplitVector lineStates; +public: + LineState() { + } + virtual ~LineState(); + virtual void Init(); + virtual void InsertLine(int line); + virtual void RemoveLine(int line); + + int SetLineState(int line, int state); + int GetLineState(int line); + int GetMaxLineState() const; +}; + +class LineAnnotation : public PerLine { + SplitVector annotations; +public: + LineAnnotation() { + } + virtual ~LineAnnotation(); + virtual void Init(); + virtual void InsertLine(int line); + virtual void RemoveLine(int line); + + bool MultipleStyles(int line) const; + int Style(int line) const; + const char *Text(int line) const; + const unsigned char *Styles(int line) const; + void SetText(int line, const char *text); + void ClearAll(); + void SetStyle(int line, int style); + void SetStyles(int line, const unsigned char *styles); + int Length(int line) const; + int Lines(int line) const; +}; + +typedef std::vector TabstopList; + +class LineTabstops : public PerLine { + SplitVector tabstops; +public: + LineTabstops() { + } + virtual ~LineTabstops(); + virtual void Init(); + virtual void InsertLine(int line); + virtual void RemoveLine(int line); + + bool ClearTabstops(int line); + bool AddTabstop(int line, int x); + int GetNextTabstop(int line, int x) const; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/PositionCache.cpp b/libs/qscintilla/src/PositionCache.cpp new file mode 100644 index 000000000..860a780d9 --- /dev/null +++ b/libs/qscintilla/src/PositionCache.cpp @@ -0,0 +1,703 @@ +// Scintilla source code edit control +/** @file PositionCache.cxx + ** Classes for caching layout information. + **/ +// Copyright 1998-2007 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 "ILexer.h" +#include "Scintilla.h" + +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" +#include "CellBuffer.h" +#include "KeyMap.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "UniConversion.h" +#include "Selection.h" +#include "PositionCache.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LineLayout::LineLayout(int maxLineLength_) : + lineStarts(0), + lenLineStarts(0), + lineNumber(-1), + inCache(false), + maxLineLength(-1), + numCharsInLine(0), + numCharsBeforeEOL(0), + validity(llInvalid), + xHighlightGuide(0), + highlightColumn(0), + containsCaret(false), + edgeColumn(0), + chars(0), + styles(0), + positions(0), + hotspot(0,0), + widthLine(wrapWidthInfinite), + lines(1), + wrapIndent(0) { + bracePreviousStyles[0] = 0; + bracePreviousStyles[1] = 0; + Resize(maxLineLength_); +} + +LineLayout::~LineLayout() { + Free(); +} + +void LineLayout::Resize(int maxLineLength_) { + if (maxLineLength_ > maxLineLength) { + Free(); + chars = new char[maxLineLength_ + 1]; + styles = new unsigned char[maxLineLength_ + 1]; + // Extra position allocated as sometimes the Windows + // GetTextExtentExPoint API writes an extra element. + positions = new XYPOSITION[maxLineLength_ + 1 + 1]; + maxLineLength = maxLineLength_; + } +} + +void LineLayout::Free() { + delete []chars; + chars = 0; + delete []styles; + styles = 0; + delete []positions; + positions = 0; + delete []lineStarts; + lineStarts = 0; +} + +void LineLayout::Invalidate(validLevel validity_) { + if (validity > validity_) + validity = validity_; +} + +int LineLayout::LineStart(int line) const { + if (line <= 0) { + return 0; + } else if ((line >= lines) || !lineStarts) { + return numCharsInLine; + } else { + return lineStarts[line]; + } +} + +int LineLayout::LineLastVisible(int line) const { + if (line < 0) { + return 0; + } else if ((line >= lines-1) || !lineStarts) { + return numCharsBeforeEOL; + } else { + return lineStarts[line+1]; + } +} + +Range LineLayout::SubLineRange(int subLine) const { + return Range(LineStart(subLine), LineLastVisible(subLine)); +} + +bool LineLayout::InLine(int offset, int line) const { + return ((offset >= LineStart(line)) && (offset < LineStart(line + 1))) || + ((offset == numCharsInLine) && (line == (lines-1))); +} + +void LineLayout::SetLineStart(int line, int start) { + if ((line >= lenLineStarts) && (line != 0)) { + int newMaxLines = line + 20; + int *newLineStarts = new int[newMaxLines]; + for (int i = 0; i < newMaxLines; i++) { + if (i < lenLineStarts) + newLineStarts[i] = lineStarts[i]; + else + newLineStarts[i] = 0; + } + delete []lineStarts; + lineStarts = newLineStarts; + lenLineStarts = newMaxLines; + } + lineStarts[line] = start; +} + +void LineLayout::SetBracesHighlight(Range rangeLine, const Position braces[], + char bracesMatchStyle, int xHighlight, bool ignoreStyle) { + if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { + int braceOffset = braces[0] - rangeLine.start; + if (braceOffset < numCharsInLine) { + bracePreviousStyles[0] = styles[braceOffset]; + styles[braceOffset] = bracesMatchStyle; + } + } + if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) { + int braceOffset = braces[1] - rangeLine.start; + if (braceOffset < numCharsInLine) { + bracePreviousStyles[1] = styles[braceOffset]; + styles[braceOffset] = bracesMatchStyle; + } + } + if ((braces[0] >= rangeLine.start && braces[1] <= rangeLine.end) || + (braces[1] >= rangeLine.start && braces[0] <= rangeLine.end)) { + xHighlightGuide = xHighlight; + } +} + +void LineLayout::RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle) { + if (!ignoreStyle && rangeLine.ContainsCharacter(braces[0])) { + int braceOffset = braces[0] - rangeLine.start; + if (braceOffset < numCharsInLine) { + styles[braceOffset] = bracePreviousStyles[0]; + } + } + if (!ignoreStyle && rangeLine.ContainsCharacter(braces[1])) { + int braceOffset = braces[1] - rangeLine.start; + if (braceOffset < numCharsInLine) { + styles[braceOffset] = bracePreviousStyles[1]; + } + } + xHighlightGuide = 0; +} + +int LineLayout::FindBefore(XYPOSITION x, int lower, int upper) const { + do { + int middle = (upper + lower + 1) / 2; // Round high + XYPOSITION posMiddle = positions[middle]; + if (x < posMiddle) { + upper = middle - 1; + } else { + lower = middle; + } + } while (lower < upper); + return lower; +} + + +int LineLayout::FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const { + int pos = FindBefore(x, range.start, range.end); + while (pos < range.end) { + if (charPosition) { + if (x < (positions[pos + 1])) { + return pos; + } + } else { + if (x < ((positions[pos] + positions[pos + 1]) / 2)) { + return pos; + } + } + pos++; + } + return range.end; +} + +Point LineLayout::PointFromPosition(int posInLine, int lineHeight) const { + Point pt; + // In case of very long line put x at arbitrary large position + if (posInLine > maxLineLength) { + pt.x = positions[maxLineLength] - positions[LineStart(lines)]; + } + + for (int subLine = 0; subLine < lines; subLine++) { + const Range rangeSubLine = SubLineRange(subLine); + if (posInLine >= rangeSubLine.start) { + pt.y = static_cast(subLine*lineHeight); + if (posInLine <= rangeSubLine.end) { + pt.x = positions[posInLine] - positions[rangeSubLine.start]; + if (rangeSubLine.start != 0) // Wrapped lines may be indented + pt.x += wrapIndent; + } + } else { + break; + } + } + return pt; +} + +int LineLayout::EndLineStyle() const { + return styles[numCharsBeforeEOL > 0 ? numCharsBeforeEOL-1 : 0]; +} + +LineLayoutCache::LineLayoutCache() : + level(0), + allInvalidated(false), styleClock(-1), useCount(0) { + Allocate(0); +} + +LineLayoutCache::~LineLayoutCache() { + Deallocate(); +} + +void LineLayoutCache::Allocate(size_t length_) { + PLATFORM_ASSERT(cache.empty()); + allInvalidated = false; + cache.resize(length_); +} + +void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) { + PLATFORM_ASSERT(useCount == 0); + size_t lengthForLevel = 0; + if (level == llcCaret) { + lengthForLevel = 1; + } else if (level == llcPage) { + lengthForLevel = linesOnScreen + 1; + } else if (level == llcDocument) { + lengthForLevel = linesInDoc; + } + if (lengthForLevel > cache.size()) { + Deallocate(); + Allocate(lengthForLevel); + } else { + if (lengthForLevel < cache.size()) { + for (size_t i = lengthForLevel; i < cache.size(); i++) { + delete cache[i]; + cache[i] = 0; + } + } + cache.resize(lengthForLevel); + } + PLATFORM_ASSERT(cache.size() == lengthForLevel); +} + +void LineLayoutCache::Deallocate() { + PLATFORM_ASSERT(useCount == 0); + for (size_t i = 0; i < cache.size(); i++) + delete cache[i]; + cache.clear(); +} + +void LineLayoutCache::Invalidate(LineLayout::validLevel validity_) { + if (!cache.empty() && !allInvalidated) { + for (size_t i = 0; i < cache.size(); i++) { + if (cache[i]) { + cache[i]->Invalidate(validity_); + } + } + if (validity_ == LineLayout::llInvalid) { + allInvalidated = true; + } + } +} + +void LineLayoutCache::SetLevel(int level_) { + allInvalidated = false; + if ((level_ != -1) && (level != level_)) { + level = level_; + Deallocate(); + } +} + +LineLayout *LineLayoutCache::Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, + int linesOnScreen, int linesInDoc) { + AllocateForLevel(linesOnScreen, linesInDoc); + if (styleClock != styleClock_) { + Invalidate(LineLayout::llCheckTextAndStyle); + styleClock = styleClock_; + } + allInvalidated = false; + int pos = -1; + LineLayout *ret = 0; + if (level == llcCaret) { + pos = 0; + } else if (level == llcPage) { + if (lineNumber == lineCaret) { + pos = 0; + } else if (cache.size() > 1) { + pos = 1 + (lineNumber % (cache.size() - 1)); + } + } else if (level == llcDocument) { + pos = lineNumber; + } + if (pos >= 0) { + PLATFORM_ASSERT(useCount == 0); + if (!cache.empty() && (pos < static_cast(cache.size()))) { + if (cache[pos]) { + if ((cache[pos]->lineNumber != lineNumber) || + (cache[pos]->maxLineLength < maxChars)) { + delete cache[pos]; + cache[pos] = 0; + } + } + if (!cache[pos]) { + cache[pos] = new LineLayout(maxChars); + } + cache[pos]->lineNumber = lineNumber; + cache[pos]->inCache = true; + ret = cache[pos]; + useCount++; + } + } + + if (!ret) { + ret = new LineLayout(maxChars); + ret->lineNumber = lineNumber; + } + + return ret; +} + +void LineLayoutCache::Dispose(LineLayout *ll) { + allInvalidated = false; + if (ll) { + if (!ll->inCache) { + delete ll; + } else { + useCount--; + } + } +} + +// Simply pack the (maximum 4) character bytes into an int +static inline int KeyFromString(const char *charBytes, size_t len) { + PLATFORM_ASSERT(len <= 4); + int k=0; + for (size_t i=0; i(charBytes[i]); + } + return k; +} + +SpecialRepresentations::SpecialRepresentations() { + std::fill(startByteHasReprs, startByteHasReprs+0x100, 0); +} + +void SpecialRepresentations::SetRepresentation(const char *charBytes, const char *value) { + MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, UTF8MaxBytes)); + if (it == mapReprs.end()) { + // New entry so increment for first byte + startByteHasReprs[static_cast(charBytes[0])]++; + } + mapReprs[KeyFromString(charBytes, UTF8MaxBytes)] = Representation(value); +} + +void SpecialRepresentations::ClearRepresentation(const char *charBytes) { + MapRepresentation::iterator it = mapReprs.find(KeyFromString(charBytes, UTF8MaxBytes)); + if (it != mapReprs.end()) { + mapReprs.erase(it); + startByteHasReprs[static_cast(charBytes[0])]--; + } +} + +const Representation *SpecialRepresentations::RepresentationFromCharacter(const char *charBytes, size_t len) const { + PLATFORM_ASSERT(len <= 4); + if (!startByteHasReprs[static_cast(charBytes[0])]) + return 0; + MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len)); + if (it != mapReprs.end()) { + return &(it->second); + } + return 0; +} + +bool SpecialRepresentations::Contains(const char *charBytes, size_t len) const { + PLATFORM_ASSERT(len <= 4); + if (!startByteHasReprs[static_cast(charBytes[0])]) + return false; + MapRepresentation::const_iterator it = mapReprs.find(KeyFromString(charBytes, len)); + return it != mapReprs.end(); +} + +void SpecialRepresentations::Clear() { + mapReprs.clear(); + std::fill(startByteHasReprs, startByteHasReprs+0x100, 0); +} + +void BreakFinder::Insert(int val) { + if (val > nextBreak) { + const std::vector::iterator it = std::lower_bound(selAndEdge.begin(), selAndEdge.end(), val); + if (it == selAndEdge.end()) { + selAndEdge.push_back(val); + } else if (*it != val) { + selAndEdge.insert(it, 1, val); + } + } +} + +BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lineRange_, int posLineStart_, + int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw) : + ll(ll_), + lineRange(lineRange_), + posLineStart(posLineStart_), + nextBreak(lineRange_.start), + saeCurrentPos(0), + saeNext(0), + subBreak(-1), + pdoc(pdoc_), + encodingFamily(pdoc_->CodePageFamily()), + preprs(preprs_) { + + // Search for first visible break + // First find the first visible character + if (xStart > 0.0f) + nextBreak = ll->FindBefore(static_cast(xStart), lineRange.start, lineRange.end); + // Now back to a style break + while ((nextBreak > lineRange.start) && (ll->styles[nextBreak] == ll->styles[nextBreak - 1])) { + nextBreak--; + } + + if (breakForSelection) { + SelectionPosition posStart(posLineStart); + SelectionPosition posEnd(posLineStart + lineRange.end); + SelectionSegment segmentLine(posStart, posEnd); + for (size_t r=0; rCount(); r++) { + SelectionSegment portion = psel->Range(r).Intersect(segmentLine); + if (!(portion.start == portion.end)) { + if (portion.start.IsValid()) + Insert(portion.start.Position() - posLineStart); + if (portion.end.IsValid()) + Insert(portion.end.Position() - posLineStart); + } + } + } + if (pvsDraw && pvsDraw->indicatorsSetFore > 0) { + for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { + if (pvsDraw->indicators[deco->indicator].OverridesTextFore()) { + int startPos = deco->rs.EndRun(posLineStart); + while (startPos < (posLineStart + lineRange.end)) { + Insert(startPos - posLineStart); + startPos = deco->rs.EndRun(startPos); + } + } + } + } + Insert(ll->edgeColumn); + Insert(lineRange.end); + saeNext = (!selAndEdge.empty()) ? selAndEdge[0] : -1; +} + +BreakFinder::~BreakFinder() { +} + +TextSegment BreakFinder::Next() { + if (subBreak == -1) { + int prev = nextBreak; + while (nextBreak < lineRange.end) { + int charWidth = 1; + if (encodingFamily == efUnicode) + charWidth = UTF8DrawBytes(reinterpret_cast(ll->chars) + nextBreak, lineRange.end - nextBreak); + else if (encodingFamily == efDBCS) + charWidth = pdoc->IsDBCSLeadByte(ll->chars[nextBreak]) ? 2 : 1; + const Representation *repr = preprs->RepresentationFromCharacter(ll->chars + nextBreak, charWidth); + if (((nextBreak > 0) && (ll->styles[nextBreak] != ll->styles[nextBreak - 1])) || + repr || + (nextBreak == saeNext)) { + while ((nextBreak >= saeNext) && (saeNext < lineRange.end)) { + saeCurrentPos++; + saeNext = (saeCurrentPos < selAndEdge.size()) ? selAndEdge[saeCurrentPos] : lineRange.end; + } + if ((nextBreak > prev) || repr) { + // Have a segment to report + if (nextBreak == prev) { + nextBreak += charWidth; + } else { + repr = 0; // Optimize -> should remember repr + } + if ((nextBreak - prev) < lengthStartSubdivision) { + return TextSegment(prev, nextBreak - prev, repr); + } else { + break; + } + } + } + nextBreak += charWidth; + } + if ((nextBreak - prev) < lengthStartSubdivision) { + return TextSegment(prev, nextBreak - prev); + } + subBreak = prev; + } + // Splitting up a long run from prev to nextBreak in lots of approximately lengthEachSubdivision. + // For very long runs add extra breaks after spaces or if no spaces before low punctuation. + int startSegment = subBreak; + if ((nextBreak - subBreak) <= lengthEachSubdivision) { + subBreak = -1; + return TextSegment(startSegment, nextBreak - startSegment); + } else { + subBreak += pdoc->SafeSegment(ll->chars + subBreak, nextBreak-subBreak, lengthEachSubdivision); + if (subBreak >= nextBreak) { + subBreak = -1; + return TextSegment(startSegment, nextBreak - startSegment); + } else { + return TextSegment(startSegment, subBreak - startSegment); + } + } +} + +bool BreakFinder::More() const { + return (subBreak >= 0) || (nextBreak < lineRange.end); +} + +PositionCacheEntry::PositionCacheEntry() : + styleNumber(0), len(0), clock(0), positions(0) { +} + +void PositionCacheEntry::Set(unsigned int styleNumber_, const char *s_, + unsigned int len_, XYPOSITION *positions_, unsigned int clock_) { + Clear(); + styleNumber = styleNumber_; + len = len_; + clock = clock_; + if (s_ && positions_) { + positions = new XYPOSITION[len + (len / 4) + 1]; + for (unsigned int i=0; i(reinterpret_cast(positions + len)), s_, len); + } +} + +PositionCacheEntry::~PositionCacheEntry() { + Clear(); +} + +void PositionCacheEntry::Clear() { + delete []positions; + positions = 0; + styleNumber = 0; + len = 0; + clock = 0; +} + +bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, + unsigned int len_, XYPOSITION *positions_) const { + if ((styleNumber == styleNumber_) && (len == len_) && + (memcmp(reinterpret_cast(reinterpret_cast(positions + len)), s_, len)== 0)) { + for (unsigned int i=0; i other.clock; +} + +void PositionCacheEntry::ResetClock() { + if (clock > 0) { + clock = 1; + } +} + +PositionCache::PositionCache() { + clock = 1; + pces.resize(0x400); + allClear = true; +} + +PositionCache::~PositionCache() { + Clear(); +} + +void PositionCache::Clear() { + if (!allClear) { + for (size_t i=0; i BreakFinder::lengthStartSubdivision) { + // Break up into segments + unsigned int startSegment = 0; + XYPOSITION xStartSegment = 0; + while (startSegment < len) { + unsigned int lenSegment = pdoc->SafeSegment(s + startSegment, len - startSegment, BreakFinder::lengthEachSubdivision); + FontAlias fontStyle = vstyle.styles[styleNumber].font; + surface->MeasureWidths(fontStyle, s + startSegment, lenSegment, positions + startSegment); + for (unsigned int inSeg = 0; inSeg < lenSegment; inSeg++) { + positions[startSegment + inSeg] += xStartSegment; + } + xStartSegment = positions[startSegment + lenSegment - 1]; + startSegment += lenSegment; + } + } else { + FontAlias fontStyle = vstyle.styles[styleNumber].font; + surface->MeasureWidths(fontStyle, s, len, positions); + } + if (probe < pces.size()) { + // Store into cache + clock++; + if (clock > 60000) { + // Since there are only 16 bits for the clock, wrap it round and + // reset all cache entries so none get stuck with a high clock. + for (size_t i=0; i +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef POSITIONCACHE_H +#define POSITIONCACHE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +static inline bool IsEOLChar(char ch) { + return (ch == '\r') || (ch == '\n'); +} + +/** + */ +class LineLayout { +private: + friend class LineLayoutCache; + int *lineStarts; + int lenLineStarts; + /// Drawing is only performed for @a maxLineLength characters on each line. + int lineNumber; + bool inCache; +public: + enum { wrapWidthInfinite = 0x7ffffff }; + int maxLineLength; + int numCharsInLine; + int numCharsBeforeEOL; + enum validLevel { llInvalid, llCheckTextAndStyle, llPositions, llLines } validity; + int xHighlightGuide; + bool highlightColumn; + bool containsCaret; + int edgeColumn; + char *chars; + unsigned char *styles; + XYPOSITION *positions; + char bracePreviousStyles[2]; + + // Hotspot support + Range hotspot; + + // Wrapped line support + int widthLine; + int lines; + XYPOSITION wrapIndent; // In pixels + + explicit LineLayout(int maxLineLength_); + virtual ~LineLayout(); + void Resize(int maxLineLength_); + void Free(); + void Invalidate(validLevel validity_); + int LineStart(int line) const; + int LineLastVisible(int line) const; + Range SubLineRange(int line) const; + bool InLine(int offset, int line) const; + void SetLineStart(int line, int start); + void SetBracesHighlight(Range rangeLine, const Position braces[], + char bracesMatchStyle, int xHighlight, bool ignoreStyle); + void RestoreBracesHighlight(Range rangeLine, const Position braces[], bool ignoreStyle); + int FindBefore(XYPOSITION x, int lower, int upper) const; + int FindPositionFromX(XYPOSITION x, Range range, bool charPosition) const; + Point PointFromPosition(int posInLine, int lineHeight) const; + int EndLineStyle() const; +}; + +/** + */ +class LineLayoutCache { + int level; + std::vectorcache; + bool allInvalidated; + int styleClock; + int useCount; + void Allocate(size_t length_); + void AllocateForLevel(int linesOnScreen, int linesInDoc); +public: + LineLayoutCache(); + virtual ~LineLayoutCache(); + void Deallocate(); + enum { + llcNone=SC_CACHE_NONE, + llcCaret=SC_CACHE_CARET, + llcPage=SC_CACHE_PAGE, + llcDocument=SC_CACHE_DOCUMENT + }; + void Invalidate(LineLayout::validLevel validity_); + void SetLevel(int level_); + int GetLevel() const { return level; } + LineLayout *Retrieve(int lineNumber, int lineCaret, int maxChars, int styleClock_, + int linesOnScreen, int linesInDoc); + void Dispose(LineLayout *ll); +}; + +class PositionCacheEntry { + unsigned int styleNumber:8; + unsigned int len:8; + unsigned int clock:16; + XYPOSITION *positions; +public: + PositionCacheEntry(); + ~PositionCacheEntry(); + void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_, unsigned int clock_); + void Clear(); + bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, XYPOSITION *positions_) const; + static unsigned int Hash(unsigned int styleNumber_, const char *s, unsigned int len); + bool NewerThan(const PositionCacheEntry &other) const; + void ResetClock(); +}; + +class Representation { +public: + std::string stringRep; + explicit Representation(const char *value="") : stringRep(value) { + } +}; + +typedef std::map MapRepresentation; + +class SpecialRepresentations { + MapRepresentation mapReprs; + short startByteHasReprs[0x100]; +public: + SpecialRepresentations(); + void SetRepresentation(const char *charBytes, const char *value); + void ClearRepresentation(const char *charBytes); + const Representation *RepresentationFromCharacter(const char *charBytes, size_t len) const; + bool Contains(const char *charBytes, size_t len) const; + void Clear(); +}; + +struct TextSegment { + int start; + int length; + const Representation *representation; + TextSegment(int start_=0, int length_=0, const Representation *representation_=0) : + start(start_), length(length_), representation(representation_) { + } + int end() const { + return start + length; + } +}; + +// Class to break a line of text into shorter runs at sensible places. +class BreakFinder { + const LineLayout *ll; + Range lineRange; + int posLineStart; + int nextBreak; + std::vector selAndEdge; + unsigned int saeCurrentPos; + int saeNext; + int subBreak; + const Document *pdoc; + EncodingFamily encodingFamily; + const SpecialRepresentations *preprs; + void Insert(int val); + // Private so BreakFinder objects can not be copied + BreakFinder(const BreakFinder &); +public: + // If a whole run is longer than lengthStartSubdivision then subdivide + // into smaller runs at spaces or punctuation. + enum { lengthStartSubdivision = 300 }; + // Try to make each subdivided run lengthEachSubdivision or shorter. + enum { lengthEachSubdivision = 100 }; + BreakFinder(const LineLayout *ll_, const Selection *psel, Range rangeLine_, int posLineStart_, + int xStart, bool breakForSelection, const Document *pdoc_, const SpecialRepresentations *preprs_, const ViewStyle *pvsDraw); + ~BreakFinder(); + TextSegment Next(); + bool More() const; +}; + +class PositionCache { + std::vector pces; + unsigned int clock; + bool allClear; + // Private so PositionCache objects can not be copied + PositionCache(const PositionCache &); +public: + PositionCache(); + ~PositionCache(); + void Clear(); + void SetSize(size_t size_); + size_t GetSize() const { return pces.size(); } + void MeasureWidths(Surface *surface, const ViewStyle &vstyle, unsigned int styleNumber, + const char *s, unsigned int len, XYPOSITION *positions, Document *pdoc); +}; + +inline bool IsSpaceOrTab(int ch) { + return ch == ' ' || ch == '\t'; +} + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/RESearch.cpp b/libs/qscintilla/src/RESearch.cpp new file mode 100644 index 000000000..2824a5b70 --- /dev/null +++ b/libs/qscintilla/src/RESearch.cpp @@ -0,0 +1,960 @@ +// Scintilla source code edit control +/** @file RESearch.cxx + ** Regular expression search library. + **/ + +/* + * regex - Regular expression pattern matching and replacement + * + * By: Ozan S. Yigit (oz) + * Dept. of Computer Science + * York University + * + * Original code available from http://www.cs.yorku.ca/~oz/ + * Translation to C++ by Neil Hodgson neilh@scintilla.org + * Removed all use of register. + * Converted to modern function prototypes. + * Put all global/static variables into an object so this code can be + * used from multiple threads, etc. + * Some extensions by Philippe Lhoste PhiLho(a)GMX.net + * '?' extensions by Michael Mullin masmullin@gmail.com + * + * These routines are the PUBLIC DOMAIN equivalents of regex + * routines as found in 4.nBSD UN*X, with minor extensions. + * + * These routines are derived from various implementations found + * in software tools books, and Conroy's grep. They are NOT derived + * from licensed/restricted software. + * For more interesting/academic/complicated implementations, + * see Henry Spencer's regexp routines, or GNU Emacs pattern + * matching module. + * + * Modification history removed. + * + * Interfaces: + * RESearch::Compile: compile a regular expression into a NFA. + * + * const char *RESearch::Compile(const char *pattern, int length, + * bool caseSensitive, bool posix) + * + * Returns a short error string if they fail. + * + * RESearch::Execute: execute the NFA to match a pattern. + * + * int RESearch::Execute(characterIndexer &ci, int lp, int endp) + * + * re_fail: failure routine for RESearch::Execute. (no longer used) + * + * void re_fail(char *msg, char op) + * + * Regular Expressions: + * + * [1] char matches itself, unless it is a special + * character (metachar): . \ [ ] * + ? ^ $ + * and ( ) if posix option. + * + * [2] . matches any character. + * + * [3] \ matches the character following it, except: + * - \a, \b, \f, \n, \r, \t, \v match the corresponding C + * escape char, respectively BEL, BS, FF, LF, CR, TAB and VT; + * Note that \r and \n are never matched because Scintilla + * regex searches are made line per line + * (stripped of end-of-line chars). + * - if not in posix mode, when followed by a + * left or right round bracket (see [8]); + * - when followed by a digit 1 to 9 (see [9]); + * - when followed by a left or right angle bracket + * (see [10]); + * - when followed by d, D, s, S, w or W (see [11]); + * - when followed by x and two hexa digits (see [12]. + * Backslash is used as an escape character for all + * other meta-characters, and itself. + * + * [4] [set] matches one of the characters in the set. + * If the first character in the set is "^", + * it matches the characters NOT in the set, i.e. + * complements the set. A shorthand S-E (start dash end) + * is used to specify a set of characters S up to + * E, inclusive. S and E must be characters, otherwise + * the dash is taken literally (eg. in expression [\d-a]). + * The special characters "]" and "-" have no special + * meaning if they appear as the first chars in the set. + * To include both, put - first: [-]A-Z] + * (or just backslash them). + * examples: match: + * + * [-]|] matches these 3 chars, + * + * []-|] matches from ] to | chars + * + * [a-z] any lowercase alpha + * + * [^-]] any char except - and ] + * + * [^A-Z] any char except uppercase + * alpha + * + * [a-zA-Z] any alpha + * + * [5] * any regular expression form [1] to [4] + * (except [8], [9] and [10] forms of [3]), + * followed by closure char (*) + * matches zero or more matches of that form. + * + * [6] + same as [5], except it matches one or more. + * + * [5-6] Both [5] and [6] are greedy (they match as much as possible). + * Unless they are followed by the 'lazy' quantifier (?) + * In which case both [5] and [6] try to match as little as possible + * + * [7] ? same as [5] except it matches zero or one. + * + * [8] a regular expression in the form [1] to [13], enclosed + * as \(form\) (or (form) with posix flag) matches what + * form matches. The enclosure creates a set of tags, + * used for [9] and for pattern substitution. + * The tagged forms are numbered starting from 1. + * + * [9] a \ followed by a digit 1 to 9 matches whatever a + * previously tagged regular expression ([8]) matched. + * + * [10] \< a regular expression starting with a \< construct + * \> and/or ending with a \> construct, restricts the + * pattern matching to the beginning of a word, and/or + * the end of a word. A word is defined to be a character + * string beginning and/or ending with the characters + * A-Z a-z 0-9 and _. Scintilla extends this definition + * by user setting. The word must also be preceded and/or + * followed by any character outside those mentioned. + * + * [11] \l a backslash followed by d, D, s, S, w or W, + * becomes a character class (both inside and + * outside sets []). + * d: decimal digits + * D: any char except decimal digits + * s: whitespace (space, \t \n \r \f \v) + * S: any char except whitespace (see above) + * w: alphanumeric & underscore (changed by user setting) + * W: any char except alphanumeric & underscore (see above) + * + * [12] \xHH a backslash followed by x and two hexa digits, + * becomes the character whose Ascii code is equal + * to these digits. If not followed by two digits, + * it is 'x' char itself. + * + * [13] a composite regular expression xy where x and y + * are in the form [1] to [12] matches the longest + * match of x followed by a match for y. + * + * [14] ^ a regular expression starting with a ^ character + * $ and/or ending with a $ character, restricts the + * pattern matching to the beginning of the line, + * or the end of line. [anchors] Elsewhere in the + * pattern, ^ and $ are treated as ordinary characters. + * + * + * Acknowledgements: + * + * HCR's Hugh Redelmeier has been most helpful in various + * stages of development. He convinced me to include BOW + * and EOW constructs, originally invented by Rob Pike at + * the University of Toronto. + * + * References: + * Software tools Kernighan & Plauger + * Software tools in Pascal Kernighan & Plauger + * Grep [rsx-11 C dist] David Conroy + * ed - text editor Un*x Programmer's Manual + * Advanced editing on Un*x B. W. Kernighan + * RegExp routines Henry Spencer + * + * Notes: + * + * This implementation uses a bit-set representation for character + * classes for speed and compactness. Each character is represented + * by one bit in a 256-bit block. Thus, CCL always takes a + * constant 32 bytes in the internal nfa, and RESearch::Execute does a single + * bit comparison to locate the character in the set. + * + * Examples: + * + * pattern: foo*.* + * compile: CHR f CHR o CLO CHR o END CLO ANY END END + * matches: fo foo fooo foobar fobar foxx ... + * + * pattern: fo[ob]a[rz] + * compile: CHR f CHR o CCL bitset CHR a CCL bitset END + * matches: fobar fooar fobaz fooaz + * + * pattern: foo\\+ + * compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END + * matches: foo\ foo\\ foo\\\ ... + * + * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo) + * compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END + * matches: foo1foo foo2foo foo3foo + * + * pattern: \(fo.*\)-\1 + * compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END + * matches: foo-foo fo-fo fob-fob foobar-foobar ... + */ + +#include + +#include +#include + +#include "CharClassify.h" +#include "RESearch.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#define OKP 1 +#define NOP 0 + +#define CHR 1 +#define ANY 2 +#define CCL 3 +#define BOL 4 +#define EOL 5 +#define BOT 6 +#define EOT 7 +#define BOW 8 +#define EOW 9 +#define REF 10 +#define CLO 11 +#define CLQ 12 /* 0 to 1 closure */ +#define LCLO 13 /* lazy closure */ + +#define END 0 + +/* + * The following defines are not meant to be changeable. + * They are for readability only. + */ +#define BLKIND 0370 +#define BITIND 07 + +const char bitarr[] = { 1, 2, 4, 8, 16, 32, 64, '\200' }; + +#define badpat(x) (*nfa = END, x) + +/* + * Character classification table for word boundary operators BOW + * and EOW is passed in by the creator of this object (Scintilla + * Document). The Document default state is that word chars are: + * 0-9, a-z, A-Z and _ + */ + +RESearch::RESearch(CharClassify *charClassTable) { + failure = 0; + charClass = charClassTable; + sta = NOP; /* status of lastpat */ + bol = 0; + std::fill(bittab, bittab + BITBLK, 0); + std::fill(tagstk, tagstk + MAXTAG, 0); + std::fill(nfa, nfa + MAXNFA, 0); + Clear(); +} + +RESearch::~RESearch() { + Clear(); +} + +void RESearch::Clear() { + for (int i = 0; i < MAXTAG; i++) { + pat[i].clear(); + bopat[i] = NOTFOUND; + eopat[i] = NOTFOUND; + } +} + +void RESearch::GrabMatches(CharacterIndexer &ci) { + for (unsigned int i = 0; i < MAXTAG; i++) { + if ((bopat[i] != NOTFOUND) && (eopat[i] != NOTFOUND)) { + unsigned int len = eopat[i] - bopat[i]; + pat[i].resize(len); + for (unsigned int j = 0; j < len; j++) + pat[i][j] = ci.CharAt(bopat[i] + j); + } + } +} + +void RESearch::ChSet(unsigned char c) { + bittab[((c) & BLKIND) >> 3] |= bitarr[(c) & BITIND]; +} + +void RESearch::ChSetWithCase(unsigned char c, bool caseSensitive) { + if (caseSensitive) { + ChSet(c); + } else { + if ((c >= 'a') && (c <= 'z')) { + ChSet(c); + ChSet(static_cast(c - 'a' + 'A')); + } else if ((c >= 'A') && (c <= 'Z')) { + ChSet(c); + ChSet(static_cast(c - 'A' + 'a')); + } else { + ChSet(c); + } + } +} + +unsigned char escapeValue(unsigned char ch) { + switch (ch) { + case 'a': return '\a'; + case 'b': return '\b'; + case 'f': return '\f'; + case 'n': return '\n'; + case 'r': return '\r'; + case 't': return '\t'; + case 'v': return '\v'; + } + return 0; +} + +static int GetHexaChar(unsigned char hd1, unsigned char hd2) { + int hexValue = 0; + if (hd1 >= '0' && hd1 <= '9') { + hexValue += 16 * (hd1 - '0'); + } else if (hd1 >= 'A' && hd1 <= 'F') { + hexValue += 16 * (hd1 - 'A' + 10); + } else if (hd1 >= 'a' && hd1 <= 'f') { + hexValue += 16 * (hd1 - 'a' + 10); + } else { + return -1; + } + if (hd2 >= '0' && hd2 <= '9') { + hexValue += hd2 - '0'; + } else if (hd2 >= 'A' && hd2 <= 'F') { + hexValue += hd2 - 'A' + 10; + } else if (hd2 >= 'a' && hd2 <= 'f') { + hexValue += hd2 - 'a' + 10; + } else { + return -1; + } + return hexValue; +} + +/** + * Called when the parser finds a backslash not followed + * by a valid expression (like \( in non-Posix mode). + * @param pattern : pointer on the char after the backslash. + * @param incr : (out) number of chars to skip after expression evaluation. + * @return the char if it resolves to a simple char, + * or -1 for a char class. In this case, bittab is changed. + */ +int RESearch::GetBackslashExpression( + const char *pattern, + int &incr) { + // Since error reporting is primitive and messages are not used anyway, + // I choose to interpret unexpected syntax in a logical way instead + // of reporting errors. Otherwise, we can stick on, eg., PCRE behavior. + incr = 0; // Most of the time, will skip the char "naturally". + int c; + int result = -1; + unsigned char bsc = *pattern; + if (!bsc) { + // Avoid overrun + result = '\\'; // \ at end of pattern, take it literally + return result; + } + + switch (bsc) { + case 'a': + case 'b': + case 'n': + case 'f': + case 'r': + case 't': + case 'v': + result = escapeValue(bsc); + break; + case 'x': { + unsigned char hd1 = *(pattern + 1); + unsigned char hd2 = *(pattern + 2); + int hexValue = GetHexaChar(hd1, hd2); + if (hexValue >= 0) { + result = hexValue; + incr = 2; // Must skip the digits + } else { + result = 'x'; // \x without 2 digits: see it as 'x' + } + } + break; + case 'd': + for (c = '0'; c <= '9'; c++) { + ChSet(static_cast(c)); + } + break; + case 'D': + for (c = 0; c < MAXCHR; c++) { + if (c < '0' || c > '9') { + ChSet(static_cast(c)); + } + } + break; + case 's': + ChSet(' '); + ChSet('\t'); + ChSet('\n'); + ChSet('\r'); + ChSet('\f'); + ChSet('\v'); + break; + case 'S': + for (c = 0; c < MAXCHR; c++) { + if (c != ' ' && !(c >= 0x09 && c <= 0x0D)) { + ChSet(static_cast(c)); + } + } + break; + case 'w': + for (c = 0; c < MAXCHR; c++) { + if (iswordc(static_cast(c))) { + ChSet(static_cast(c)); + } + } + break; + case 'W': + for (c = 0; c < MAXCHR; c++) { + if (!iswordc(static_cast(c))) { + ChSet(static_cast(c)); + } + } + break; + default: + result = bsc; + } + return result; +} + +const char *RESearch::Compile(const char *pattern, int length, bool caseSensitive, bool posix) { + char *mp=nfa; /* nfa pointer */ + char *lp; /* saved pointer */ + char *sp=nfa; /* another one */ + char *mpMax = mp + MAXNFA - BITBLK - 10; + + int tagi = 0; /* tag stack index */ + int tagc = 1; /* actual tag count */ + + int n; + char mask; /* xor mask -CCL/NCL */ + int c1, c2, prevChar; + + if (!pattern || !length) { + if (sta) + return 0; + else + return badpat("No previous regular expression"); + } + sta = NOP; + + const char *p=pattern; /* pattern pointer */ + for (int i=0; i mpMax) + return badpat("Pattern too long"); + lp = mp; + switch (*p) { + + case '.': /* match any char */ + *mp++ = ANY; + break; + + case '^': /* match beginning */ + if (p == pattern) { + *mp++ = BOL; + } else { + *mp++ = CHR; + *mp++ = *p; + } + break; + + case '$': /* match endofline */ + if (!*(p+1)) { + *mp++ = EOL; + } else { + *mp++ = CHR; + *mp++ = *p; + } + break; + + case '[': /* match char class */ + *mp++ = CCL; + prevChar = 0; + + i++; + if (*++p == '^') { + mask = '\377'; + i++; + p++; + } else { + mask = 0; + } + + if (*p == '-') { /* real dash */ + i++; + prevChar = *p; + ChSet(*p++); + } + if (*p == ']') { /* real brace */ + i++; + prevChar = *p; + ChSet(*p++); + } + while (*p && *p != ']') { + if (*p == '-') { + if (prevChar < 0) { + // Previous def. was a char class like \d, take dash literally + prevChar = *p; + ChSet(*p); + } else if (*(p+1)) { + if (*(p+1) != ']') { + c1 = prevChar + 1; + i++; + c2 = static_cast(*++p); + if (c2 == '\\') { + if (!*(p+1)) { // End of RE + return badpat("Missing ]"); + } else { + i++; + p++; + int incr; + c2 = GetBackslashExpression(p, incr); + i += incr; + p += incr; + if (c2 >= 0) { + // Convention: \c (c is any char) is case sensitive, whatever the option + ChSet(static_cast(c2)); + prevChar = c2; + } else { + // bittab is already changed + prevChar = -1; + } + } + } + if (prevChar < 0) { + // Char after dash is char class like \d, take dash literally + prevChar = '-'; + ChSet('-'); + } else { + // Put all chars between c1 and c2 included in the char set + while (c1 <= c2) { + ChSetWithCase(static_cast(c1++), caseSensitive); + } + } + } else { + // Dash before the ], take it literally + prevChar = *p; + ChSet(*p); + } + } else { + return badpat("Missing ]"); + } + } else if (*p == '\\' && *(p+1)) { + i++; + p++; + int incr; + int c = GetBackslashExpression(p, incr); + i += incr; + p += incr; + if (c >= 0) { + // Convention: \c (c is any char) is case sensitive, whatever the option + ChSet(static_cast(c)); + prevChar = c; + } else { + // bittab is already changed + prevChar = -1; + } + } else { + prevChar = static_cast(*p); + ChSetWithCase(*p, caseSensitive); + } + i++; + p++; + } + if (!*p) + return badpat("Missing ]"); + + for (n = 0; n < BITBLK; bittab[n++] = 0) + *mp++ = static_cast(mask ^ bittab[n]); + + break; + + case '*': /* match 0 or more... */ + case '+': /* match 1 or more... */ + case '?': + if (p == pattern) + return badpat("Empty closure"); + lp = sp; /* previous opcode */ + if (*lp == CLO || *lp == LCLO) /* equivalence... */ + break; + switch (*lp) { + + case BOL: + case BOT: + case EOT: + case BOW: + case EOW: + case REF: + return badpat("Illegal closure"); + default: + break; + } + + if (*p == '+') + for (sp = mp; lp < sp; lp++) + *mp++ = *lp; + + *mp++ = END; + *mp++ = END; + sp = mp; + + while (--mp > lp) + *mp = mp[-1]; + if (*p == '?') *mp = CLQ; + else if (*(p+1) == '?') *mp = LCLO; + else *mp = CLO; + + mp = sp; + break; + + case '\\': /* tags, backrefs... */ + i++; + switch (*++p) { + case '<': + *mp++ = BOW; + break; + case '>': + if (*sp == BOW) + return badpat("Null pattern inside \\<\\>"); + *mp++ = EOW; + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + n = *p-'0'; + if (tagi > 0 && tagstk[tagi] == n) + return badpat("Cyclical reference"); + if (tagc > n) { + *mp++ = static_cast(REF); + *mp++ = static_cast(n); + } else { + return badpat("Undetermined reference"); + } + break; + default: + if (!posix && *p == '(') { + if (tagc < MAXTAG) { + tagstk[++tagi] = tagc; + *mp++ = BOT; + *mp++ = static_cast(tagc++); + } else { + return badpat("Too many \\(\\) pairs"); + } + } else if (!posix && *p == ')') { + if (*sp == BOT) + return badpat("Null pattern inside \\(\\)"); + if (tagi > 0) { + *mp++ = static_cast(EOT); + *mp++ = static_cast(tagstk[tagi--]); + } else { + return badpat("Unmatched \\)"); + } + } else { + int incr; + int c = GetBackslashExpression(p, incr); + i += incr; + p += incr; + if (c >= 0) { + *mp++ = CHR; + *mp++ = static_cast(c); + } else { + *mp++ = CCL; + mask = 0; + for (n = 0; n < BITBLK; bittab[n++] = 0) + *mp++ = static_cast(mask ^ bittab[n]); + } + } + } + break; + + default : /* an ordinary char */ + if (posix && *p == '(') { + if (tagc < MAXTAG) { + tagstk[++tagi] = tagc; + *mp++ = BOT; + *mp++ = static_cast(tagc++); + } else { + return badpat("Too many () pairs"); + } + } else if (posix && *p == ')') { + if (*sp == BOT) + return badpat("Null pattern inside ()"); + if (tagi > 0) { + *mp++ = static_cast(EOT); + *mp++ = static_cast(tagstk[tagi--]); + } else { + return badpat("Unmatched )"); + } + } else { + unsigned char c = *p; + if (!c) // End of RE + c = '\\'; // We take it as raw backslash + if (caseSensitive || !iswordc(c)) { + *mp++ = CHR; + *mp++ = c; + } else { + *mp++ = CCL; + mask = 0; + ChSetWithCase(c, false); + for (n = 0; n < BITBLK; bittab[n++] = 0) + *mp++ = static_cast(mask ^ bittab[n]); + } + } + break; + } + sp = lp; + } + if (tagi > 0) + return badpat((posix ? "Unmatched (" : "Unmatched \\(")); + *mp = END; + sta = OKP; + return 0; +} + +/* + * RESearch::Execute: + * execute nfa to find a match. + * + * special cases: (nfa[0]) + * BOL + * Match only once, starting from the + * beginning. + * CHR + * First locate the character without + * calling PMatch, and if found, call + * PMatch for the remaining string. + * END + * RESearch::Compile failed, poor luser did not + * check for it. Fail fast. + * + * If a match is found, bopat[0] and eopat[0] are set + * to the beginning and the end of the matched fragment, + * respectively. + * + */ +int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) { + unsigned char c; + int ep = NOTFOUND; + char *ap = nfa; + + bol = lp; + failure = 0; + + Clear(); + + switch (*ap) { + + case BOL: /* anchored: match from BOL only */ + ep = PMatch(ci, lp, endp, ap); + break; + case EOL: /* just searching for end of line normal path doesn't work */ + if (*(ap+1) == END) { + lp = endp; + ep = lp; + break; + } else { + return 0; + } + case CHR: /* ordinary char: locate it fast */ + c = *(ap+1); + while ((lp < endp) && (static_cast(ci.CharAt(lp)) != c)) + lp++; + if (lp >= endp) /* if EOS, fail, else fall through. */ + return 0; + default: /* regular matching all the way. */ + while (lp < endp) { + ep = PMatch(ci, lp, endp, ap); + if (ep != NOTFOUND) + break; + lp++; + } + break; + case END: /* munged automaton. fail always */ + return 0; + } + if (ep == NOTFOUND) + return 0; + + bopat[0] = lp; + eopat[0] = ep; + return 1; +} + +/* + * PMatch: internal routine for the hard part + * + * This code is partly snarfed from an early grep written by + * David Conroy. The backref and tag stuff, and various other + * innovations are by oz. + * + * special case optimizations: (nfa[n], nfa[n+1]) + * CLO ANY + * We KNOW .* will match everything up to the + * end of line. Thus, directly go to the end of + * line, without recursive PMatch calls. As in + * the other closure cases, the remaining pattern + * must be matched by moving backwards on the + * string recursively, to find a match for xy + * (x is ".*" and y is the remaining pattern) + * where the match satisfies the LONGEST match for + * x followed by a match for y. + * CLO CHR + * We can again scan the string forward for the + * single char and at the point of failure, we + * execute the remaining nfa recursively, same as + * above. + * + * At the end of a successful match, bopat[n] and eopat[n] + * are set to the beginning and end of subpatterns matched + * by tagged expressions (n = 1 to 9). + */ + +extern void re_fail(char *,char); + +#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND]) + +/* + * skip values for CLO XXX to skip past the closure + */ + +#define ANYSKIP 2 /* [CLO] ANY END */ +#define CHRSKIP 3 /* [CLO] CHR chr END */ +#define CCLSKIP 34 /* [CLO] CCL 32 bytes END */ + +int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) { + int op, c, n; + int e; /* extra pointer for CLO */ + int bp; /* beginning of subpat... */ + int ep; /* ending of subpat... */ + int are; /* to save the line ptr. */ + int llp; /* lazy lp for LCLO */ + + while ((op = *ap++) != END) + switch (op) { + + case CHR: + if (ci.CharAt(lp++) != *ap++) + return NOTFOUND; + break; + case ANY: + if (lp++ >= endp) + return NOTFOUND; + break; + case CCL: + if (lp >= endp) + return NOTFOUND; + c = ci.CharAt(lp++); + if (!isinset(ap,c)) + return NOTFOUND; + ap += BITBLK; + break; + case BOL: + if (lp != bol) + return NOTFOUND; + break; + case EOL: + if (lp < endp) + return NOTFOUND; + break; + case BOT: + bopat[static_cast(*ap++)] = lp; + break; + case EOT: + eopat[static_cast(*ap++)] = lp; + break; + case BOW: + if ((lp!=bol && iswordc(ci.CharAt(lp-1))) || !iswordc(ci.CharAt(lp))) + return NOTFOUND; + break; + case EOW: + if (lp==bol || !iswordc(ci.CharAt(lp-1)) || iswordc(ci.CharAt(lp))) + return NOTFOUND; + break; + case REF: + n = *ap++; + bp = bopat[n]; + ep = eopat[n]; + while (bp < ep) + if (ci.CharAt(bp++) != ci.CharAt(lp++)) + return NOTFOUND; + break; + case LCLO: + case CLQ: + case CLO: + are = lp; + switch (*ap) { + + case ANY: + if (op == CLO || op == LCLO) + while (lp < endp) + lp++; + else if (lp < endp) + lp++; + + n = ANYSKIP; + break; + case CHR: + c = *(ap+1); + if (op == CLO || op == LCLO) + while ((lp < endp) && (c == ci.CharAt(lp))) + lp++; + else if ((lp < endp) && (c == ci.CharAt(lp))) + lp++; + n = CHRSKIP; + break; + case CCL: + while ((lp < endp) && isinset(ap+1,ci.CharAt(lp))) + lp++; + n = CCLSKIP; + break; + default: + failure = true; + //re_fail("closure: bad nfa.", *ap); + return NOTFOUND; + } + ap += n; + + llp = lp; + e = NOTFOUND; + while (llp >= are) { + int q; + if ((q = PMatch(ci, llp, endp, ap)) != NOTFOUND) { + e = q; + lp = llp; + if (op != LCLO) return e; + } + if (*ap == END) return e; + --llp; + } + if (*ap == EOT) + PMatch(ci, lp, endp, ap); + return e; + default: + //re_fail("RESearch::Execute: bad nfa.", static_cast(op)); + return NOTFOUND; + } + return lp; +} + + diff --git a/libs/qscintilla/src/RESearch.h b/libs/qscintilla/src/RESearch.h new file mode 100644 index 000000000..3a7f0e4d6 --- /dev/null +++ b/libs/qscintilla/src/RESearch.h @@ -0,0 +1,73 @@ +// Scintilla source code edit control +/** @file RESearch.h + ** Interface to the regular expression search library. + **/ +// Written by Neil Hodgson +// Based on the work of Ozan S. Yigit. +// This file is in the public domain. + +#ifndef RESEARCH_H +#define RESEARCH_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/* + * The following defines are not meant to be changeable. + * They are for readability only. + */ +#define MAXCHR 256 +#define CHRBIT 8 +#define BITBLK MAXCHR/CHRBIT + +class CharacterIndexer { +public: + virtual char CharAt(int index)=0; + virtual ~CharacterIndexer() { + } +}; + +class RESearch { + +public: + explicit RESearch(CharClassify *charClassTable); + ~RESearch(); + void Clear(); + void GrabMatches(CharacterIndexer &ci); + const char *Compile(const char *pattern, int length, bool caseSensitive, bool posix); + int Execute(CharacterIndexer &ci, int lp, int endp); + + enum { MAXTAG=10 }; + enum { MAXNFA=2048 }; + enum { NOTFOUND=-1 }; + + int bopat[MAXTAG]; + int eopat[MAXTAG]; + std::string pat[MAXTAG]; + +private: + void ChSet(unsigned char c); + void ChSetWithCase(unsigned char c, bool caseSensitive); + int GetBackslashExpression(const char *pattern, int &incr); + + int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap); + + int bol; + int tagstk[MAXTAG]; /* subpat tag stack */ + char nfa[MAXNFA]; /* automaton */ + int sta; + unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ + int failure; + CharClassify *charClass; + bool iswordc(unsigned char x) const { + return charClass->IsWord(x); + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif + diff --git a/libs/qscintilla/src/RunStyles.cpp b/libs/qscintilla/src/RunStyles.cpp new file mode 100644 index 000000000..ad8d977d6 --- /dev/null +++ b/libs/qscintilla/src/RunStyles.cpp @@ -0,0 +1,288 @@ +/** @file RunStyles.cxx + ** Data structure used to store sparse styles. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +// Find the first run at a position +int RunStyles::RunFromPosition(int position) const { + int run = starts->PartitionFromPosition(position); + // Go to first element with this position + while ((run > 0) && (position == starts->PositionFromPartition(run-1))) { + run--; + } + return run; +} + +// If there is no run boundary at position, insert one continuing style. +int RunStyles::SplitRun(int position) { + int run = RunFromPosition(position); + int posRun = starts->PositionFromPartition(run); + if (posRun < position) { + int runStyle = ValueAt(position); + run++; + starts->InsertPartition(run, position); + styles->InsertValue(run, 1, runStyle); + } + return run; +} + +void RunStyles::RemoveRun(int run) { + starts->RemovePartition(run); + styles->DeleteRange(run, 1); +} + +void RunStyles::RemoveRunIfEmpty(int run) { + if ((run < starts->Partitions()) && (starts->Partitions() > 1)) { + if (starts->PositionFromPartition(run) == starts->PositionFromPartition(run+1)) { + RemoveRun(run); + } + } +} + +void RunStyles::RemoveRunIfSameAsPrevious(int run) { + if ((run > 0) && (run < starts->Partitions())) { + if (styles->ValueAt(run-1) == styles->ValueAt(run)) { + RemoveRun(run); + } + } +} + +RunStyles::RunStyles() { + starts = new Partitioning(8); + styles = new SplitVector(); + styles->InsertValue(0, 2, 0); +} + +RunStyles::~RunStyles() { + delete starts; + starts = NULL; + delete styles; + styles = NULL; +} + +int RunStyles::Length() const { + return starts->PositionFromPartition(starts->Partitions()); +} + +int RunStyles::ValueAt(int position) const { + return styles->ValueAt(starts->PartitionFromPosition(position)); +} + +int RunStyles::FindNextChange(int position, int end) const { + int run = starts->PartitionFromPosition(position); + if (run < starts->Partitions()) { + int runChange = starts->PositionFromPartition(run); + if (runChange > position) + return runChange; + int nextChange = starts->PositionFromPartition(run + 1); + if (nextChange > position) { + return nextChange; + } else if (position < end) { + return end; + } else { + return end + 1; + } + } else { + return end + 1; + } +} + +int RunStyles::StartRun(int position) const { + return starts->PositionFromPartition(starts->PartitionFromPosition(position)); +} + +int RunStyles::EndRun(int position) const { + return starts->PositionFromPartition(starts->PartitionFromPosition(position) + 1); +} + +bool RunStyles::FillRange(int &position, int value, int &fillLength) { + if (fillLength <= 0) { + return false; + } + int end = position + fillLength; + if (end > Length()) { + return false; + } + int runEnd = RunFromPosition(end); + if (styles->ValueAt(runEnd) == value) { + // End already has value so trim range. + end = starts->PositionFromPartition(runEnd); + if (position >= end) { + // Whole range is already same as value so no action + return false; + } + fillLength = end - position; + } else { + runEnd = SplitRun(end); + } + int runStart = RunFromPosition(position); + if (styles->ValueAt(runStart) == value) { + // Start is in expected value so trim range. + runStart++; + position = starts->PositionFromPartition(runStart); + fillLength = end - position; + } else { + if (starts->PositionFromPartition(runStart) < position) { + runStart = SplitRun(position); + runEnd++; + } + } + if (runStart < runEnd) { + styles->SetValueAt(runStart, value); + // Remove each old run over the range + for (int run=runStart+1; runPositionFromPartition(runStart) == position) { + int runStyle = ValueAt(position); + // Inserting at start of run so make previous longer + if (runStart == 0) { + // Inserting at start of document so ensure 0 + if (runStyle) { + styles->SetValueAt(0, 0); + starts->InsertPartition(1, 0); + styles->InsertValue(1, 1, runStyle); + starts->InsertText(0, insertLength); + } else { + starts->InsertText(runStart, insertLength); + } + } else { + if (runStyle) { + starts->InsertText(runStart-1, insertLength); + } else { + // Insert at end of run so do not extend style + starts->InsertText(runStart, insertLength); + } + } + } else { + starts->InsertText(runStart, insertLength); + } +} + +void RunStyles::DeleteAll() { + delete starts; + starts = NULL; + delete styles; + styles = NULL; + starts = new Partitioning(8); + styles = new SplitVector(); + styles->InsertValue(0, 2, 0); +} + +void RunStyles::DeleteRange(int position, int deleteLength) { + int end = position + deleteLength; + int runStart = RunFromPosition(position); + int runEnd = RunFromPosition(end); + if (runStart == runEnd) { + // Deleting from inside one run + starts->InsertText(runStart, -deleteLength); + RemoveRunIfEmpty(runStart); + } else { + runStart = SplitRun(position); + runEnd = SplitRun(end); + starts->InsertText(runStart, -deleteLength); + // Remove each old run over the range + for (int run=runStart; runPartitions(); +} + +bool RunStyles::AllSame() const { + for (int run = 1; run < starts->Partitions(); run++) { + if (styles->ValueAt(run) != styles->ValueAt(run - 1)) + return false; + } + return true; +} + +bool RunStyles::AllSameAs(int value) const { + return AllSame() && (styles->ValueAt(0) == value); +} + +int RunStyles::Find(int value, int start) const { + if (start < Length()) { + int run = start ? RunFromPosition(start) : 0; + if (styles->ValueAt(run) == value) + return start; + run++; + while (run < starts->Partitions()) { + if (styles->ValueAt(run) == value) + return starts->PositionFromPartition(run); + run++; + } + } + return -1; +} + +void RunStyles::Check() const { + if (Length() < 0) { + throw std::runtime_error("RunStyles: Length can not be negative."); + } + if (starts->Partitions() < 1) { + throw std::runtime_error("RunStyles: Must always have 1 or more partitions."); + } + if (starts->Partitions() != styles->Length()-1) { + throw std::runtime_error("RunStyles: Partitions and styles different lengths."); + } + int start=0; + while (start < Length()) { + int end = EndRun(start); + if (start >= end) { + throw std::runtime_error("RunStyles: Partition is 0 length."); + } + start = end; + } + if (styles->ValueAt(styles->Length()-1) != 0) { + throw std::runtime_error("RunStyles: Unused style at end changed."); + } + for (int j=1; jLength()-1; j++) { + if (styles->ValueAt(j) == styles->ValueAt(j-1)) { + throw std::runtime_error("RunStyles: Style of a partition same as previous."); + } + } +} diff --git a/libs/qscintilla/src/RunStyles.h b/libs/qscintilla/src/RunStyles.h new file mode 100644 index 000000000..b096ad800 --- /dev/null +++ b/libs/qscintilla/src/RunStyles.h @@ -0,0 +1,54 @@ +/** @file RunStyles.h + ** Data structure used to store sparse styles. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +/// Styling buffer using one element for each run rather than using +/// a filled buffer. + +#ifndef RUNSTYLES_H +#define RUNSTYLES_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class RunStyles { +private: + Partitioning *starts; + SplitVector *styles; + int RunFromPosition(int position) const; + int SplitRun(int position); + void RemoveRun(int run); + void RemoveRunIfEmpty(int run); + void RemoveRunIfSameAsPrevious(int run); + // Private so RunStyles objects can not be copied + RunStyles(const RunStyles &); +public: + RunStyles(); + ~RunStyles(); + int Length() const; + int ValueAt(int position) const; + int FindNextChange(int position, int end) const; + int StartRun(int position) const; + int EndRun(int position) const; + // Returns true if some values may have changed + bool FillRange(int &position, int value, int &fillLength); + void SetValueAt(int position, int value); + void InsertSpace(int position, int insertLength); + void DeleteAll(); + void DeleteRange(int position, int deleteLength); + int Runs() const; + bool AllSame() const; + bool AllSameAs(int value) const; + int Find(int value, int start) const; + + void Check() const; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/SciTE.properties b/libs/qscintilla/src/SciTE.properties new file mode 100644 index 000000000..1eda9fae4 --- /dev/null +++ b/libs/qscintilla/src/SciTE.properties @@ -0,0 +1,6 @@ +# SciTE.properties is the per directory local options file and can be used to override +# settings made in SciTEGlobal.properties +command.build.directory.*.cxx=..\win32 +command.build.directory.*.h=..\win32 +command.build.*.cxx=nmake -f scintilla.mak QUIET=1 +command.build.*.h=nmake -f scintilla.mak QUIET=1 diff --git a/libs/qscintilla/src/ScintillaBase.cpp b/libs/qscintilla/src/ScintillaBase.cpp new file mode 100644 index 000000000..b52fb9a04 --- /dev/null +++ b/libs/qscintilla/src/ScintillaBase.cpp @@ -0,0 +1,1070 @@ +// Scintilla source code edit control +/** @file ScintillaBase.cxx + ** An enhanced subclass of Editor with calltips, autocomplete and context menu. + **/ +// 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 +#include +#include +#include + +#include "Platform.h" + +#include "ILexer.h" +#include "Scintilla.h" + +#ifdef SCI_LEXER +#include "SciLexer.h" +#endif + +#include "PropSetSimple.h" + +#ifdef SCI_LEXER +#include "LexerModule.h" +#include "Catalogue.h" +#endif + +#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 "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "CaseFolder.h" +#include "Document.h" +#include "Selection.h" +#include "PositionCache.h" +#include "EditModel.h" +#include "MarginView.h" +#include "EditView.h" +#include "Editor.h" +#include "AutoComplete.h" +#include "ScintillaBase.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +ScintillaBase::ScintillaBase() { + displayPopupMenu = true; + listType = 0; + maxListWidth = 0; + multiAutoCMode = SC_MULTIAUTOC_ONCE; +} + +ScintillaBase::~ScintillaBase() { +} + +void ScintillaBase::Finalise() { + Editor::Finalise(); + popup.Destroy(); +} + +void ScintillaBase::AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS) { + bool isFillUp = ac.Active() && ac.IsFillUpChar(*s); + if (!isFillUp) { + Editor::AddCharUTF(s, len, treatAsDBCS); + } + if (ac.Active()) { + AutoCompleteCharacterAdded(s[0]); + // For fill ups add the character after the autocompletion has + // triggered so containers see the key so can display a calltip. + if (isFillUp) { + Editor::AddCharUTF(s, len, treatAsDBCS); + } + } +} + +void ScintillaBase::Command(int cmdId) { + + switch (cmdId) { + + case idAutoComplete: // Nothing to do + + break; + + case idCallTip: // Nothing to do + + break; + + case idcmdUndo: + WndProc(SCI_UNDO, 0, 0); + break; + + case idcmdRedo: + WndProc(SCI_REDO, 0, 0); + break; + + case idcmdCut: + WndProc(SCI_CUT, 0, 0); + break; + + case idcmdCopy: + WndProc(SCI_COPY, 0, 0); + break; + + case idcmdPaste: + WndProc(SCI_PASTE, 0, 0); + break; + + case idcmdDelete: + WndProc(SCI_CLEAR, 0, 0); + break; + + case idcmdSelectAll: + WndProc(SCI_SELECTALL, 0, 0); + break; + } +} + +int ScintillaBase::KeyCommand(unsigned int iMessage) { + // Most key commands cancel autocompletion mode + if (ac.Active()) { + switch (iMessage) { + // Except for these + case SCI_LINEDOWN: + AutoCompleteMove(1); + return 0; + case SCI_LINEUP: + AutoCompleteMove(-1); + return 0; + case SCI_PAGEDOWN: + AutoCompleteMove(ac.lb->GetVisibleRows()); + return 0; + case SCI_PAGEUP: + AutoCompleteMove(-ac.lb->GetVisibleRows()); + return 0; + case SCI_VCHOME: + AutoCompleteMove(-5000); + return 0; + case SCI_LINEEND: + AutoCompleteMove(5000); + return 0; + case SCI_DELETEBACK: + DelCharBack(true); + AutoCompleteCharacterDeleted(); + EnsureCaretVisible(); + return 0; + case SCI_DELETEBACKNOTLINE: + DelCharBack(false); + AutoCompleteCharacterDeleted(); + EnsureCaretVisible(); + return 0; + case SCI_TAB: + AutoCompleteCompleted(); + return 0; + case SCI_NEWLINE: + AutoCompleteCompleted(); + return 0; + + default: + AutoCompleteCancel(); + } + } + + if (ct.inCallTipMode) { + if ( + (iMessage != SCI_CHARLEFT) && + (iMessage != SCI_CHARLEFTEXTEND) && + (iMessage != SCI_CHARRIGHT) && + (iMessage != SCI_CHARRIGHTEXTEND) && + (iMessage != SCI_EDITTOGGLEOVERTYPE) && + (iMessage != SCI_DELETEBACK) && + (iMessage != SCI_DELETEBACKNOTLINE) + ) { + ct.CallTipCancel(); + } + if ((iMessage == SCI_DELETEBACK) || (iMessage == SCI_DELETEBACKNOTLINE)) { + if (sel.MainCaret() <= ct.posStartCallTip) { + ct.CallTipCancel(); + } + } + } + return Editor::KeyCommand(iMessage); +} + +void ScintillaBase::AutoCompleteDoubleClick(void *p) { + ScintillaBase *sci = reinterpret_cast(p); + sci->AutoCompleteCompleted(); +} + +void ScintillaBase::AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen) { + UndoGroup ug(pdoc); + if (multiAutoCMode == SC_MULTIAUTOC_ONCE) { + pdoc->DeleteChars(startPos, removeLen); + const int lengthInserted = pdoc->InsertString(startPos, text, textLen); + SetEmptySelection(startPos + lengthInserted); + } else { + // SC_MULTIAUTOC_EACH + for (size_t r=0; r= 0) { + positionInsert -= removeLen; + pdoc->DeleteChars(positionInsert, removeLen); + } + const int lengthInserted = pdoc->InsertString(positionInsert, text, textLen); + if (lengthInserted > 0) { + sel.Range(r).caret.SetPosition(positionInsert + lengthInserted); + sel.Range(r).anchor.SetPosition(positionInsert + lengthInserted); + } + sel.Range(r).ClearVirtualSpace(); + } + } + } +} + +void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { + //Platform::DebugPrintf("AutoComplete %s\n", list); + ct.CallTipCancel(); + + if (ac.chooseSingle && (listType == 0)) { + if (list && !strchr(list, ac.GetSeparator())) { + const char *typeSep = strchr(list, ac.GetTypesep()); + int lenInsert = typeSep ? + static_cast(typeSep-list) : static_cast(strlen(list)); + if (ac.ignoreCase) { + // May need to convert the case before invocation, so remove lenEntered characters + AutoCompleteInsert(sel.MainCaret() - lenEntered, lenEntered, list, lenInsert); + } else { + AutoCompleteInsert(sel.MainCaret(), 0, list + lenEntered, lenInsert - lenEntered); + } + ac.Cancel(); + return; + } + } + ac.Start(wMain, idAutoComplete, sel.MainCaret(), PointMainCaret(), + lenEntered, vs.lineHeight, IsUnicodeMode(), technology); + + PRectangle rcClient = GetClientRectangle(); + Point pt = LocationFromPosition(sel.MainCaret() - lenEntered); + PRectangle rcPopupBounds = wMain.GetMonitorRect(pt); + if (rcPopupBounds.Height() == 0) + rcPopupBounds = rcClient; + + int heightLB = ac.heightLBDefault; + int widthLB = ac.widthLBDefault; + if (pt.x >= rcClient.right - widthLB) { + HorizontalScrollTo(static_cast(xOffset + pt.x - rcClient.right + widthLB)); + Redraw(); + pt = PointMainCaret(); + } + if (wMargin.GetID()) { + Point ptOrigin = GetVisibleOriginInMain(); + pt.x += ptOrigin.x; + pt.y += ptOrigin.y; + } + PRectangle rcac; + rcac.left = pt.x - ac.lb->CaretFromEdge(); + if (pt.y >= rcPopupBounds.bottom - heightLB && // Wont fit below. + pt.y >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2) { // and there is more room above. + rcac.top = pt.y - heightLB; + if (rcac.top < rcPopupBounds.top) { + heightLB -= static_cast(rcPopupBounds.top - rcac.top); + rcac.top = rcPopupBounds.top; + } + } else { + rcac.top = pt.y + vs.lineHeight; + } + rcac.right = rcac.left + widthLB; + rcac.bottom = static_cast(Platform::Minimum(static_cast(rcac.top) + heightLB, static_cast(rcPopupBounds.bottom))); + ac.lb->SetPositionRelative(rcac, wMain); + ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font); + unsigned int aveCharWidth = static_cast(vs.styles[STYLE_DEFAULT].aveCharWidth); + ac.lb->SetAverageCharWidth(aveCharWidth); + ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this); + + ac.SetList(list ? list : ""); + + // Fiddle the position of the list so it is right next to the target and wide enough for all its strings + PRectangle rcList = ac.lb->GetDesiredRect(); + int heightAlloced = static_cast(rcList.bottom - rcList.top); + widthLB = Platform::Maximum(widthLB, static_cast(rcList.right - rcList.left)); + if (maxListWidth != 0) + widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth); + // Make an allowance for large strings in list + rcList.left = pt.x - ac.lb->CaretFromEdge(); + rcList.right = rcList.left + widthLB; + if (((pt.y + vs.lineHeight) >= (rcPopupBounds.bottom - heightAlloced)) && // Wont fit below. + ((pt.y + vs.lineHeight / 2) >= (rcPopupBounds.bottom + rcPopupBounds.top) / 2)) { // and there is more room above. + rcList.top = pt.y - heightAlloced; + } else { + rcList.top = pt.y + vs.lineHeight; + } + rcList.bottom = rcList.top + heightAlloced; + ac.lb->SetPositionRelative(rcList, wMain); + ac.Show(true); + if (lenEntered != 0) { + AutoCompleteMoveToCurrentWord(); + } +} + +void ScintillaBase::AutoCompleteCancel() { + if (ac.Active()) { + SCNotification scn = {}; + scn.nmhdr.code = SCN_AUTOCCANCELLED; + scn.wParam = 0; + scn.listType = 0; + NotifyParent(scn); + } + ac.Cancel(); +} + +void ScintillaBase::AutoCompleteMove(int delta) { + ac.Move(delta); +} + +void ScintillaBase::AutoCompleteMoveToCurrentWord() { + std::string wordCurrent = RangeText(ac.posStart - ac.startLen, sel.MainCaret()); + ac.Select(wordCurrent.c_str()); +} + +void ScintillaBase::AutoCompleteCharacterAdded(char ch) { + if (ac.IsFillUpChar(ch)) { + AutoCompleteCompleted(); + } else if (ac.IsStopChar(ch)) { + AutoCompleteCancel(); + } else { + AutoCompleteMoveToCurrentWord(); + } +} + +void ScintillaBase::AutoCompleteCharacterDeleted() { + if (sel.MainCaret() < ac.posStart - ac.startLen) { + AutoCompleteCancel(); + } else if (ac.cancelAtStartPos && (sel.MainCaret() <= ac.posStart)) { + AutoCompleteCancel(); + } else { + AutoCompleteMoveToCurrentWord(); + } + SCNotification scn = {}; + scn.nmhdr.code = SCN_AUTOCCHARDELETED; + scn.wParam = 0; + scn.listType = 0; + NotifyParent(scn); +} + +void ScintillaBase::AutoCompleteCompleted() { + int item = ac.GetSelection(); + if (item == -1) { + AutoCompleteCancel(); + return; + } + const std::string selected = ac.GetValue(item); + + ac.Show(false); + + SCNotification scn = {}; + scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION; + scn.message = 0; + scn.wParam = listType; + scn.listType = listType; + Position firstPos = ac.posStart - ac.startLen; + scn.position = firstPos; + scn.lParam = firstPos; + scn.text = selected.c_str(); + NotifyParent(scn); + + if (!ac.Active()) + return; + ac.Cancel(); + + if (listType > 0) + return; + + Position endPos = sel.MainCaret(); + if (ac.dropRestOfWord) + endPos = pdoc->ExtendWordSelect(endPos, 1, true); + if (endPos < firstPos) + return; + AutoCompleteInsert(firstPos, endPos - firstPos, selected.c_str(), static_cast(selected.length())); + SetLastXChosen(); +} + +int ScintillaBase::AutoCompleteGetCurrent() const { + if (!ac.Active()) + return -1; + return ac.GetSelection(); +} + +int ScintillaBase::AutoCompleteGetCurrentText(char *buffer) const { + if (ac.Active()) { + int item = ac.GetSelection(); + if (item != -1) { + const std::string selected = ac.GetValue(item); + if (buffer != NULL) + memcpy(buffer, selected.c_str(), selected.length()+1); + return static_cast(selected.length()); + } + } + if (buffer != NULL) + *buffer = '\0'; + return 0; +} + +void ScintillaBase::CallTipShow(Point pt, const char *defn) { + ac.Cancel(); + // If container knows about STYLE_CALLTIP then use it in place of the + // STYLE_DEFAULT for the face name, size and character set. Also use it + // for the foreground and background colour. + int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT; + if (ct.UseStyleCallTip()) { + ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back); + } + if (wMargin.GetID()) { + Point ptOrigin = GetVisibleOriginInMain(); + pt.x += ptOrigin.x; + pt.y += ptOrigin.y; + } + PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt, + vs.lineHeight, + defn, + vs.styles[ctStyle].fontName, + vs.styles[ctStyle].sizeZoomed, + CodePage(), + vs.styles[ctStyle].characterSet, + vs.technology, + wMain); + // If the call-tip window would be out of the client + // space + PRectangle rcClient = GetClientRectangle(); + int offset = vs.lineHeight + static_cast(rc.Height()); + // adjust so it displays above the text. + if (rc.bottom > rcClient.bottom && rc.Height() < rcClient.Height()) { + rc.top -= offset; + rc.bottom -= offset; + } + // adjust so it displays below the text. + if (rc.top < rcClient.top && rc.Height() < rcClient.Height()) { + rc.top += offset; + rc.bottom += offset; + } + // Now display the window. + CreateCallTipWindow(rc); + ct.wCallTip.SetPositionRelative(rc, wMain); + ct.wCallTip.Show(); +} + +void ScintillaBase::CallTipClick() { + SCNotification scn = {}; + scn.nmhdr.code = SCN_CALLTIPCLICK; + scn.position = ct.clickPlace; + NotifyParent(scn); +} + +void ScintillaBase::ContextMenu(Point pt) { + if (displayPopupMenu) { + bool writable = !WndProc(SCI_GETREADONLY, 0, 0); + popup.CreatePopUp(); + AddToPopUp("Undo", idcmdUndo, writable && pdoc->CanUndo()); + AddToPopUp("Redo", idcmdRedo, writable && pdoc->CanRedo()); + AddToPopUp(""); + AddToPopUp("Cut", idcmdCut, writable && !sel.Empty()); + AddToPopUp("Copy", idcmdCopy, !sel.Empty()); + AddToPopUp("Paste", idcmdPaste, writable && WndProc(SCI_CANPASTE, 0, 0)); + AddToPopUp("Delete", idcmdDelete, writable && !sel.Empty()); + AddToPopUp(""); + AddToPopUp("Select All", idcmdSelectAll); + popup.Show(pt, wMain); + } +} + +void ScintillaBase::CancelModes() { + AutoCompleteCancel(); + ct.CallTipCancel(); + Editor::CancelModes(); +} + +void ScintillaBase::ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) { + CancelModes(); + Editor::ButtonDownWithModifiers(pt, curTime, modifiers); +} + +void ScintillaBase::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { + ButtonDownWithModifiers(pt, curTime, ModifierFlags(shift, ctrl, alt)); +} + +#ifdef SCI_LEXER + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class LexState : public LexInterface { + const LexerModule *lexCurrent; + void SetLexerModule(const LexerModule *lex); + PropSetSimple props; + int interfaceVersion; +public: + int lexLanguage; + + explicit LexState(Document *pdoc_); + virtual ~LexState(); + void SetLexer(uptr_t wParam); + void SetLexerLanguage(const char *languageName); + const char *DescribeWordListSets(); + void SetWordList(int n, const char *wl); + const char *GetName() const; + void *PrivateCall(int operation, void *pointer); + const char *PropertyNames(); + int PropertyType(const char *name); + const char *DescribeProperty(const char *name); + void PropSet(const char *key, const char *val); + const char *PropGet(const char *key) const; + int PropGetInt(const char *key, int defaultValue=0) const; + int PropGetExpanded(const char *key, char *result) const; + + int LineEndTypesSupported(); + int AllocateSubStyles(int styleBase, int numberStyles); + int SubStylesStart(int styleBase); + int SubStylesLength(int styleBase); + int StyleFromSubStyle(int subStyle); + int PrimaryStyleFromStyle(int style); + void FreeSubStyles(); + void SetIdentifiers(int style, const char *identifiers); + int DistanceToSecondaryStyles(); + const char *GetSubStyleBases(); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +LexState::LexState(Document *pdoc_) : LexInterface(pdoc_) { + lexCurrent = 0; + performingStyle = false; + interfaceVersion = lvOriginal; + lexLanguage = SCLEX_CONTAINER; +} + +LexState::~LexState() { + if (instance) { + instance->Release(); + instance = 0; + } +} + +LexState *ScintillaBase::DocumentLexState() { + if (!pdoc->pli) { + pdoc->pli = new LexState(pdoc); + } + return static_cast(pdoc->pli); +} + +void LexState::SetLexerModule(const LexerModule *lex) { + if (lex != lexCurrent) { + if (instance) { + instance->Release(); + instance = 0; + } + interfaceVersion = lvOriginal; + lexCurrent = lex; + if (lexCurrent) { + instance = lexCurrent->Create(); + interfaceVersion = instance->Version(); + } + pdoc->LexerChanged(); + } +} + +void LexState::SetLexer(uptr_t wParam) { + lexLanguage = static_cast(wParam); + if (lexLanguage == SCLEX_CONTAINER) { + SetLexerModule(0); + } else { + const LexerModule *lex = Catalogue::Find(lexLanguage); + if (!lex) + lex = Catalogue::Find(SCLEX_NULL); + SetLexerModule(lex); + } +} + +void LexState::SetLexerLanguage(const char *languageName) { + const LexerModule *lex = Catalogue::Find(languageName); + if (!lex) + lex = Catalogue::Find(SCLEX_NULL); + if (lex) + lexLanguage = lex->GetLanguage(); + SetLexerModule(lex); +} + +const char *LexState::DescribeWordListSets() { + if (instance) { + return instance->DescribeWordListSets(); + } else { + return 0; + } +} + +void LexState::SetWordList(int n, const char *wl) { + if (instance) { + int firstModification = instance->WordListSet(n, wl); + if (firstModification >= 0) { + pdoc->ModifiedAt(firstModification); + } + } +} + +const char *LexState::GetName() const { + return lexCurrent ? lexCurrent->languageName : ""; +} + +void *LexState::PrivateCall(int operation, void *pointer) { + if (pdoc && instance) { + return instance->PrivateCall(operation, pointer); + } else { + return 0; + } +} + +const char *LexState::PropertyNames() { + if (instance) { + return instance->PropertyNames(); + } else { + return 0; + } +} + +int LexState::PropertyType(const char *name) { + if (instance) { + return instance->PropertyType(name); + } else { + return SC_TYPE_BOOLEAN; + } +} + +const char *LexState::DescribeProperty(const char *name) { + if (instance) { + return instance->DescribeProperty(name); + } else { + return 0; + } +} + +void LexState::PropSet(const char *key, const char *val) { + props.Set(key, val); + if (instance) { + int firstModification = instance->PropertySet(key, val); + if (firstModification >= 0) { + pdoc->ModifiedAt(firstModification); + } + } +} + +const char *LexState::PropGet(const char *key) const { + return props.Get(key); +} + +int LexState::PropGetInt(const char *key, int defaultValue) const { + return props.GetInt(key, defaultValue); +} + +int LexState::PropGetExpanded(const char *key, char *result) const { + return props.GetExpanded(key, result); +} + +int LexState::LineEndTypesSupported() { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->LineEndTypesSupported(); + } + return 0; +} + +int LexState::AllocateSubStyles(int styleBase, int numberStyles) { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->AllocateSubStyles(styleBase, numberStyles); + } + return -1; +} + +int LexState::SubStylesStart(int styleBase) { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->SubStylesStart(styleBase); + } + return -1; +} + +int LexState::SubStylesLength(int styleBase) { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->SubStylesLength(styleBase); + } + return 0; +} + +int LexState::StyleFromSubStyle(int subStyle) { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->StyleFromSubStyle(subStyle); + } + return 0; +} + +int LexState::PrimaryStyleFromStyle(int style) { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->PrimaryStyleFromStyle(style); + } + return 0; +} + +void LexState::FreeSubStyles() { + if (instance && (interfaceVersion >= lvSubStyles)) { + static_cast(instance)->FreeSubStyles(); + } +} + +void LexState::SetIdentifiers(int style, const char *identifiers) { + if (instance && (interfaceVersion >= lvSubStyles)) { + static_cast(instance)->SetIdentifiers(style, identifiers); + } +} + +int LexState::DistanceToSecondaryStyles() { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->DistanceToSecondaryStyles(); + } + return 0; +} + +const char *LexState::GetSubStyleBases() { + if (instance && (interfaceVersion >= lvSubStyles)) { + return static_cast(instance)->GetSubStyleBases(); + } + return ""; +} + +#endif + +void ScintillaBase::NotifyStyleToNeeded(int endStyleNeeded) { +#ifdef SCI_LEXER + if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) { + int lineEndStyled = pdoc->LineFromPosition(pdoc->GetEndStyled()); + int endStyled = pdoc->LineStart(lineEndStyled); + DocumentLexState()->Colourise(endStyled, endStyleNeeded); + return; + } +#endif + Editor::NotifyStyleToNeeded(endStyleNeeded); +} + +void ScintillaBase::NotifyLexerChanged(Document *, void *) { +#ifdef SCI_LEXER + vs.EnsureStyle(0xff); +#endif +} + +sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + switch (iMessage) { + case SCI_AUTOCSHOW: + listType = 0; + AutoCompleteStart(static_cast(wParam), reinterpret_cast(lParam)); + break; + + case SCI_AUTOCCANCEL: + ac.Cancel(); + break; + + case SCI_AUTOCACTIVE: + return ac.Active(); + + case SCI_AUTOCPOSSTART: + return ac.posStart; + + case SCI_AUTOCCOMPLETE: + AutoCompleteCompleted(); + break; + + case SCI_AUTOCSETSEPARATOR: + ac.SetSeparator(static_cast(wParam)); + break; + + case SCI_AUTOCGETSEPARATOR: + return ac.GetSeparator(); + + case SCI_AUTOCSTOPS: + ac.SetStopChars(reinterpret_cast(lParam)); + break; + + case SCI_AUTOCSELECT: + ac.Select(reinterpret_cast(lParam)); + break; + + case SCI_AUTOCGETCURRENT: + return AutoCompleteGetCurrent(); + + case SCI_AUTOCGETCURRENTTEXT: + return AutoCompleteGetCurrentText(reinterpret_cast(lParam)); + + case SCI_AUTOCSETCANCELATSTART: + ac.cancelAtStartPos = wParam != 0; + break; + + case SCI_AUTOCGETCANCELATSTART: + return ac.cancelAtStartPos; + + case SCI_AUTOCSETFILLUPS: + ac.SetFillUpChars(reinterpret_cast(lParam)); + break; + + case SCI_AUTOCSETCHOOSESINGLE: + ac.chooseSingle = wParam != 0; + break; + + case SCI_AUTOCGETCHOOSESINGLE: + return ac.chooseSingle; + + case SCI_AUTOCSETIGNORECASE: + ac.ignoreCase = wParam != 0; + break; + + case SCI_AUTOCGETIGNORECASE: + return ac.ignoreCase; + + case SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR: + ac.ignoreCaseBehaviour = static_cast(wParam); + break; + + case SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR: + return ac.ignoreCaseBehaviour; + + case SCI_AUTOCSETMULTI: + multiAutoCMode = static_cast(wParam); + break; + + case SCI_AUTOCGETMULTI: + return multiAutoCMode; + + case SCI_AUTOCSETORDER: + ac.autoSort = static_cast(wParam); + break; + + case SCI_AUTOCGETORDER: + return ac.autoSort; + + case SCI_USERLISTSHOW: + listType = static_cast(wParam); + AutoCompleteStart(0, reinterpret_cast(lParam)); + break; + + case SCI_AUTOCSETAUTOHIDE: + ac.autoHide = wParam != 0; + break; + + case SCI_AUTOCGETAUTOHIDE: + return ac.autoHide; + + case SCI_AUTOCSETDROPRESTOFWORD: + ac.dropRestOfWord = wParam != 0; + break; + + case SCI_AUTOCGETDROPRESTOFWORD: + return ac.dropRestOfWord; + + case SCI_AUTOCSETMAXHEIGHT: + ac.lb->SetVisibleRows(static_cast(wParam)); + break; + + case SCI_AUTOCGETMAXHEIGHT: + return ac.lb->GetVisibleRows(); + + case SCI_AUTOCSETMAXWIDTH: + maxListWidth = static_cast(wParam); + break; + + case SCI_AUTOCGETMAXWIDTH: + return maxListWidth; + + case SCI_REGISTERIMAGE: + ac.lb->RegisterImage(static_cast(wParam), reinterpret_cast(lParam)); + break; + + case SCI_REGISTERRGBAIMAGE: + ac.lb->RegisterRGBAImage(static_cast(wParam), static_cast(sizeRGBAImage.x), static_cast(sizeRGBAImage.y), + reinterpret_cast(lParam)); + break; + + case SCI_CLEARREGISTEREDIMAGES: + ac.lb->ClearRegisteredImages(); + break; + + case SCI_AUTOCSETTYPESEPARATOR: + ac.SetTypesep(static_cast(wParam)); + break; + + case SCI_AUTOCGETTYPESEPARATOR: + return ac.GetTypesep(); + + case SCI_CALLTIPSHOW: + CallTipShow(LocationFromPosition(static_cast(wParam)), + reinterpret_cast(lParam)); + break; + + case SCI_CALLTIPCANCEL: + ct.CallTipCancel(); + break; + + case SCI_CALLTIPACTIVE: + return ct.inCallTipMode; + + case SCI_CALLTIPPOSSTART: + return ct.posStartCallTip; + + case SCI_CALLTIPSETPOSSTART: + ct.posStartCallTip = static_cast(wParam); + break; + + case SCI_CALLTIPSETHLT: + ct.SetHighlight(static_cast(wParam), static_cast(lParam)); + break; + + case SCI_CALLTIPSETBACK: + ct.colourBG = ColourDesired(static_cast(wParam)); + vs.styles[STYLE_CALLTIP].back = ct.colourBG; + InvalidateStyleRedraw(); + break; + + case SCI_CALLTIPSETFORE: + ct.colourUnSel = ColourDesired(static_cast(wParam)); + vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel; + InvalidateStyleRedraw(); + break; + + case SCI_CALLTIPSETFOREHLT: + ct.colourSel = ColourDesired(static_cast(wParam)); + InvalidateStyleRedraw(); + break; + + case SCI_CALLTIPUSESTYLE: + ct.SetTabSize(static_cast(wParam)); + InvalidateStyleRedraw(); + break; + + case SCI_CALLTIPSETPOSITION: + ct.SetPosition(wParam != 0); + InvalidateStyleRedraw(); + break; + + case SCI_USEPOPUP: + displayPopupMenu = wParam != 0; + break; + +#ifdef SCI_LEXER + case SCI_SETLEXER: + DocumentLexState()->SetLexer(static_cast(wParam)); + break; + + case SCI_GETLEXER: + return DocumentLexState()->lexLanguage; + + case SCI_COLOURISE: + if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) { + pdoc->ModifiedAt(static_cast(wParam)); + NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : static_cast(lParam)); + } else { + DocumentLexState()->Colourise(static_cast(wParam), static_cast(lParam)); + } + Redraw(); + break; + + case SCI_SETPROPERTY: + DocumentLexState()->PropSet(reinterpret_cast(wParam), + reinterpret_cast(lParam)); + break; + + case SCI_GETPROPERTY: + return StringResult(lParam, DocumentLexState()->PropGet(reinterpret_cast(wParam))); + + case SCI_GETPROPERTYEXPANDED: + return DocumentLexState()->PropGetExpanded(reinterpret_cast(wParam), + reinterpret_cast(lParam)); + + case SCI_GETPROPERTYINT: + return DocumentLexState()->PropGetInt(reinterpret_cast(wParam), static_cast(lParam)); + + case SCI_SETKEYWORDS: + DocumentLexState()->SetWordList(static_cast(wParam), reinterpret_cast(lParam)); + break; + + case SCI_SETLEXERLANGUAGE: + DocumentLexState()->SetLexerLanguage(reinterpret_cast(lParam)); + break; + + case SCI_GETLEXERLANGUAGE: + return StringResult(lParam, DocumentLexState()->GetName()); + + case SCI_PRIVATELEXERCALL: + return reinterpret_cast( + DocumentLexState()->PrivateCall(static_cast(wParam), reinterpret_cast(lParam))); + + case SCI_GETSTYLEBITSNEEDED: + return 8; + + case SCI_PROPERTYNAMES: + return StringResult(lParam, DocumentLexState()->PropertyNames()); + + case SCI_PROPERTYTYPE: + return DocumentLexState()->PropertyType(reinterpret_cast(wParam)); + + case SCI_DESCRIBEPROPERTY: + return StringResult(lParam, + DocumentLexState()->DescribeProperty(reinterpret_cast(wParam))); + + case SCI_DESCRIBEKEYWORDSETS: + return StringResult(lParam, DocumentLexState()->DescribeWordListSets()); + + case SCI_GETLINEENDTYPESSUPPORTED: + return DocumentLexState()->LineEndTypesSupported(); + + case SCI_ALLOCATESUBSTYLES: + return DocumentLexState()->AllocateSubStyles(static_cast(wParam), static_cast(lParam)); + + case SCI_GETSUBSTYLESSTART: + return DocumentLexState()->SubStylesStart(static_cast(wParam)); + + case SCI_GETSUBSTYLESLENGTH: + return DocumentLexState()->SubStylesLength(static_cast(wParam)); + + case SCI_GETSTYLEFROMSUBSTYLE: + return DocumentLexState()->StyleFromSubStyle(static_cast(wParam)); + + case SCI_GETPRIMARYSTYLEFROMSTYLE: + return DocumentLexState()->PrimaryStyleFromStyle(static_cast(wParam)); + + case SCI_FREESUBSTYLES: + DocumentLexState()->FreeSubStyles(); + break; + + case SCI_SETIDENTIFIERS: + DocumentLexState()->SetIdentifiers(static_cast(wParam), + reinterpret_cast(lParam)); + break; + + case SCI_DISTANCETOSECONDARYSTYLES: + return DocumentLexState()->DistanceToSecondaryStyles(); + + case SCI_GETSUBSTYLEBASES: + return StringResult(lParam, DocumentLexState()->GetSubStyleBases()); +#endif + + default: + return Editor::WndProc(iMessage, wParam, lParam); + } + return 0l; +} diff --git a/libs/qscintilla/src/ScintillaBase.h b/libs/qscintilla/src/ScintillaBase.h new file mode 100644 index 000000000..668abed3c --- /dev/null +++ b/libs/qscintilla/src/ScintillaBase.h @@ -0,0 +1,104 @@ +// Scintilla source code edit control +/** @file ScintillaBase.h + ** Defines an enhanced subclass of Editor with calltips, autocomplete and context menu. + **/ +// Copyright 1998-2002 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCINTILLABASE_H +#define SCINTILLABASE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +#ifdef SCI_LEXER +class LexState; +#endif + +/** + */ +class ScintillaBase : public Editor { + // Private so ScintillaBase objects can not be copied + ScintillaBase(const ScintillaBase &); + ScintillaBase &operator=(const ScintillaBase &); + +protected: + /** Enumeration of commands and child windows. */ + enum { + idCallTip=1, + idAutoComplete=2, + + idcmdUndo=10, + idcmdRedo=11, + idcmdCut=12, + idcmdCopy=13, + idcmdPaste=14, + idcmdDelete=15, + idcmdSelectAll=16 + }; + + enum { maxLenInputIME = 200 }; + + bool displayPopupMenu; + Menu popup; + AutoComplete ac; + + CallTip ct; + + int listType; ///< 0 is an autocomplete list + int maxListWidth; /// Maximum width of list, in average character widths + int multiAutoCMode; /// Mode for autocompleting when multiple selections are present + +#ifdef SCI_LEXER + LexState *DocumentLexState(); + void SetLexer(uptr_t wParam); + void SetLexerLanguage(const char *languageName); + void Colourise(int start, int end); +#endif + + ScintillaBase(); + virtual ~ScintillaBase(); + virtual void Initialise() = 0; + virtual void Finalise(); + + virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); + void Command(int cmdId); + virtual void CancelModes(); + virtual int KeyCommand(unsigned int iMessage); + + void AutoCompleteInsert(Position startPos, int removeLen, const char *text, int textLen); + void AutoCompleteStart(int lenEntered, const char *list); + void AutoCompleteCancel(); + void AutoCompleteMove(int delta); + int AutoCompleteGetCurrent() const; + int AutoCompleteGetCurrentText(char *buffer) const; + void AutoCompleteCharacterAdded(char ch); + void AutoCompleteCharacterDeleted(); + void AutoCompleteCompleted(); + void AutoCompleteMoveToCurrentWord(); + static void AutoCompleteDoubleClick(void *p); + + void CallTipClick(); + void CallTipShow(Point pt, const char *defn); + virtual void CreateCallTipWindow(PRectangle rc) = 0; + + virtual void AddToPopUp(const char *label, int cmd=0, bool enabled=true) = 0; + void ContextMenu(Point pt); + + virtual void ButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); + virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); + + void NotifyStyleToNeeded(int endStyleNeeded); + void NotifyLexerChanged(Document *doc, void *userData); + +public: + // Public so scintilla_send_message can use it + virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Selection.cpp b/libs/qscintilla/src/Selection.cpp new file mode 100644 index 000000000..52ed5774e --- /dev/null +++ b/libs/qscintilla/src/Selection.cpp @@ -0,0 +1,418 @@ +// Scintilla source code edit control +/** @file Selection.cxx + ** Classes maintaining the selection. + **/ +// Copyright 2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" + +#include "Selection.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +void SelectionPosition::MoveForInsertDelete(bool insertion, int startChange, int length) { + if (insertion) { + if (position == startChange) { + int virtualLengthRemove = std::min(length, virtualSpace); + virtualSpace -= virtualLengthRemove; + position += virtualLengthRemove; + } else if (position > startChange) { + position += length; + } + } else { + if (position == startChange) { + virtualSpace = 0; + } + if (position > startChange) { + int endDeletion = startChange + length; + if (position > endDeletion) { + position -= length; + } else { + position = startChange; + virtualSpace = 0; + } + } + } +} + +bool SelectionPosition::operator <(const SelectionPosition &other) const { + if (position == other.position) + return virtualSpace < other.virtualSpace; + else + return position < other.position; +} + +bool SelectionPosition::operator >(const SelectionPosition &other) const { + if (position == other.position) + return virtualSpace > other.virtualSpace; + else + return position > other.position; +} + +bool SelectionPosition::operator <=(const SelectionPosition &other) const { + if (position == other.position && virtualSpace == other.virtualSpace) + return true; + else + return other > *this; +} + +bool SelectionPosition::operator >=(const SelectionPosition &other) const { + if (position == other.position && virtualSpace == other.virtualSpace) + return true; + else + return *this > other; +} + +int SelectionRange::Length() const { + if (anchor > caret) { + return anchor.Position() - caret.Position(); + } else { + return caret.Position() - anchor.Position(); + } +} + +void SelectionRange::MoveForInsertDelete(bool insertion, int startChange, int length) { + caret.MoveForInsertDelete(insertion, startChange, length); + anchor.MoveForInsertDelete(insertion, startChange, length); +} + +bool SelectionRange::Contains(int pos) const { + if (anchor > caret) + return (pos >= caret.Position()) && (pos <= anchor.Position()); + else + return (pos >= anchor.Position()) && (pos <= caret.Position()); +} + +bool SelectionRange::Contains(SelectionPosition sp) const { + if (anchor > caret) + return (sp >= caret) && (sp <= anchor); + else + return (sp >= anchor) && (sp <= caret); +} + +bool SelectionRange::ContainsCharacter(int posCharacter) const { + if (anchor > caret) + return (posCharacter >= caret.Position()) && (posCharacter < anchor.Position()); + else + return (posCharacter >= anchor.Position()) && (posCharacter < caret.Position()); +} + +SelectionSegment SelectionRange::Intersect(SelectionSegment check) const { + SelectionSegment inOrder(caret, anchor); + if ((inOrder.start <= check.end) || (inOrder.end >= check.start)) { + SelectionSegment portion = check; + if (portion.start < inOrder.start) + portion.start = inOrder.start; + if (portion.end > inOrder.end) + portion.end = inOrder.end; + if (portion.start > portion.end) + return SelectionSegment(); + else + return portion; + } else { + return SelectionSegment(); + } +} + +bool SelectionRange::Trim(SelectionRange range) { + SelectionPosition startRange = range.Start(); + SelectionPosition endRange = range.End(); + SelectionPosition start = Start(); + SelectionPosition end = End(); + PLATFORM_ASSERT(start <= end); + PLATFORM_ASSERT(startRange <= endRange); + if ((startRange <= end) && (endRange >= start)) { + if ((start > startRange) && (end < endRange)) { + // Completely covered by range -> empty at start + end = start; + } else if ((start < startRange) && (end > endRange)) { + // Completely covers range -> empty at start + end = start; + } else if (start <= startRange) { + // Trim end + end = startRange; + } else { // + PLATFORM_ASSERT(end >= endRange); + // Trim start + start = endRange; + } + if (anchor > caret) { + caret = start; + anchor = end; + } else { + anchor = start; + caret = end; + } + return Empty(); + } else { + return false; + } +} + +// If range is all virtual collapse to start of virtual space +void SelectionRange::MinimizeVirtualSpace() { + if (caret.Position() == anchor.Position()) { + int virtualSpace = caret.VirtualSpace(); + if (virtualSpace > anchor.VirtualSpace()) + virtualSpace = anchor.VirtualSpace(); + caret.SetVirtualSpace(virtualSpace); + anchor.SetVirtualSpace(virtualSpace); + } +} + +Selection::Selection() : mainRange(0), moveExtends(false), tentativeMain(false), selType(selStream) { + AddSelection(SelectionRange(SelectionPosition(0))); +} + +Selection::~Selection() { +} + +bool Selection::IsRectangular() const { + return (selType == selRectangle) || (selType == selThin); +} + +int Selection::MainCaret() const { + return ranges[mainRange].caret.Position(); +} + +int Selection::MainAnchor() const { + return ranges[mainRange].anchor.Position(); +} + +SelectionRange &Selection::Rectangular() { + return rangeRectangular; +} + +SelectionSegment Selection::Limits() const { + if (ranges.empty()) { + return SelectionSegment(); + } else { + SelectionSegment sr(ranges[0].anchor, ranges[0].caret); + for (size_t i=1; i 1) && (r < ranges.size())) { + size_t mainNew = mainRange; + if (mainNew >= r) { + if (mainNew == 0) { + mainNew = ranges.size() - 2; + } else { + mainNew--; + } + } + ranges.erase(ranges.begin() + r); + mainRange = mainNew; + } +} + +void Selection::TentativeSelection(SelectionRange range) { + if (!tentativeMain) { + rangesSaved = ranges; + } + ranges = rangesSaved; + AddSelection(range); + TrimSelection(ranges[mainRange]); + tentativeMain = true; +} + +void Selection::CommitTentative() { + rangesSaved.clear(); + tentativeMain = false; +} + +int Selection::CharacterInSelection(int posCharacter) const { + for (size_t i=0; i ranges[i].Start().Position()) && (pos <= ranges[i].End().Position())) + return i == mainRange ? 1 : 2; + } + return 0; +} + +int Selection::VirtualSpaceFor(int pos) const { + int virtualSpace = 0; + for (size_t i=0; i= j) + mainRange--; + } else { + j++; + } + } + } + } +} + +void Selection::RotateMain() { + mainRange = (mainRange + 1) % ranges.size(); +} + diff --git a/libs/qscintilla/src/Selection.h b/libs/qscintilla/src/Selection.h new file mode 100644 index 000000000..499f83771 --- /dev/null +++ b/libs/qscintilla/src/Selection.h @@ -0,0 +1,193 @@ +// Scintilla source code edit control +/** @file Selection.h + ** Classes maintaining the selection. + **/ +// Copyright 2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SELECTION_H +#define SELECTION_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class SelectionPosition { + int position; + int virtualSpace; +public: + explicit SelectionPosition(int position_=INVALID_POSITION, int virtualSpace_=0) : position(position_), virtualSpace(virtualSpace_) { + PLATFORM_ASSERT(virtualSpace < 800000); + if (virtualSpace < 0) + virtualSpace = 0; + } + void Reset() { + position = 0; + virtualSpace = 0; + } + void MoveForInsertDelete(bool insertion, int startChange, int length); + bool operator ==(const SelectionPosition &other) const { + return position == other.position && virtualSpace == other.virtualSpace; + } + bool operator <(const SelectionPosition &other) const; + bool operator >(const SelectionPosition &other) const; + bool operator <=(const SelectionPosition &other) const; + bool operator >=(const SelectionPosition &other) const; + int Position() const { + return position; + } + void SetPosition(int position_) { + position = position_; + virtualSpace = 0; + } + int VirtualSpace() const { + return virtualSpace; + } + void SetVirtualSpace(int virtualSpace_) { + PLATFORM_ASSERT(virtualSpace_ < 800000); + if (virtualSpace_ >= 0) + virtualSpace = virtualSpace_; + } + void Add(int increment) { + position = position + increment; + } + bool IsValid() const { + return position >= 0; + } +}; + +// Ordered range to make drawing simpler +struct SelectionSegment { + SelectionPosition start; + SelectionPosition end; + SelectionSegment() : start(), end() { + } + SelectionSegment(SelectionPosition a, SelectionPosition b) { + if (a < b) { + start = a; + end = b; + } else { + start = b; + end = a; + } + } + bool Empty() const { + return start == end; + } + void Extend(SelectionPosition p) { + if (start > p) + start = p; + if (end < p) + end = p; + } +}; + +struct SelectionRange { + SelectionPosition caret; + SelectionPosition anchor; + + SelectionRange() : caret(), anchor() { + } + explicit SelectionRange(SelectionPosition single) : caret(single), anchor(single) { + } + explicit SelectionRange(int single) : caret(single), anchor(single) { + } + SelectionRange(SelectionPosition caret_, SelectionPosition anchor_) : caret(caret_), anchor(anchor_) { + } + SelectionRange(int caret_, int anchor_) : caret(caret_), anchor(anchor_) { + } + bool Empty() const { + return anchor == caret; + } + int Length() const; + // int Width() const; // Like Length but takes virtual space into account + bool operator ==(const SelectionRange &other) const { + return caret == other.caret && anchor == other.anchor; + } + bool operator <(const SelectionRange &other) const { + return caret < other.caret || ((caret == other.caret) && (anchor < other.anchor)); + } + void Reset() { + anchor.Reset(); + caret.Reset(); + } + void ClearVirtualSpace() { + anchor.SetVirtualSpace(0); + caret.SetVirtualSpace(0); + } + void MoveForInsertDelete(bool insertion, int startChange, int length); + bool Contains(int pos) const; + bool Contains(SelectionPosition sp) const; + bool ContainsCharacter(int posCharacter) const; + SelectionSegment Intersect(SelectionSegment check) const; + SelectionPosition Start() const { + return (anchor < caret) ? anchor : caret; + } + SelectionPosition End() const { + return (anchor < caret) ? caret : anchor; + } + bool Trim(SelectionRange range); + // If range is all virtual collapse to start of virtual space + void MinimizeVirtualSpace(); +}; + +class Selection { + std::vector ranges; + std::vector rangesSaved; + SelectionRange rangeRectangular; + size_t mainRange; + bool moveExtends; + bool tentativeMain; +public: + enum selTypes { noSel, selStream, selRectangle, selLines, selThin }; + selTypes selType; + + Selection(); + ~Selection(); + bool IsRectangular() const; + int MainCaret() const; + int MainAnchor() const; + SelectionRange &Rectangular(); + SelectionSegment Limits() const; + // This is for when you want to move the caret in response to a + // user direction command - for rectangular selections, use the range + // that covers all selected text otherwise return the main selection. + SelectionSegment LimitsForRectangularElseMain() const; + size_t Count() const; + size_t Main() const; + void SetMain(size_t r); + SelectionRange &Range(size_t r); + const SelectionRange &Range(size_t r) const; + SelectionRange &RangeMain(); + const SelectionRange &RangeMain() const; + SelectionPosition Start() const; + bool MoveExtends() const; + void SetMoveExtends(bool moveExtends_); + bool Empty() const; + SelectionPosition Last() const; + int Length() const; + void MovePositions(bool insertion, int startChange, int length); + void TrimSelection(SelectionRange range); + void SetSelection(SelectionRange range); + void AddSelection(SelectionRange range); + void AddSelectionWithoutTrim(SelectionRange range); + void DropSelection(size_t r); + void TentativeSelection(SelectionRange range); + void CommitTentative(); + int CharacterInSelection(int posCharacter) const; + int InSelectionForEOL(int pos) const; + int VirtualSpaceFor(int pos) const; + void Clear(); + void RemoveDuplicates(); + void RotateMain(); + bool Tentative() const { return tentativeMain; } + std::vector RangesCopy() const { + return ranges; + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/SplitVector.h b/libs/qscintilla/src/SplitVector.h new file mode 100644 index 000000000..288c9e39f --- /dev/null +++ b/libs/qscintilla/src/SplitVector.h @@ -0,0 +1,291 @@ +// Scintilla source code edit control +/** @file SplitVector.h + ** Main data structure for holding arrays that handle insertions + ** and deletions efficiently. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SPLITVECTOR_H +#define SPLITVECTOR_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +template +class SplitVector { +protected: + T *body; + int size; + int lengthBody; + int part1Length; + int gapLength; /// invariant: gapLength == size - lengthBody + int growSize; + + /// Move the gap to a particular position so that insertion and + /// deletion at that point will not require much copying and + /// hence be fast. + void GapTo(int position) { + if (position != part1Length) { + if (position < part1Length) { + memmove( + body + position + gapLength, + body + position, + sizeof(T) * (part1Length - position)); + } else { // position > part1Length + memmove( + body + part1Length, + body + part1Length + gapLength, + sizeof(T) * (position - part1Length)); + } + part1Length = position; + } + } + + /// Check that there is room in the buffer for an insertion, + /// reallocating if more space needed. + void RoomFor(int insertionLength) { + if (gapLength <= insertionLength) { + while (growSize < size / 6) + growSize *= 2; + ReAllocate(size + insertionLength + growSize); + } + } + + void Init() { + body = NULL; + growSize = 8; + size = 0; + lengthBody = 0; + part1Length = 0; + gapLength = 0; + } + +public: + /// Construct a split buffer. + SplitVector() { + Init(); + } + + ~SplitVector() { + delete []body; + body = 0; + } + + int GetGrowSize() const { + return growSize; + } + + void SetGrowSize(int growSize_) { + growSize = growSize_; + } + + /// Reallocate the storage for the buffer to be newSize and + /// copy exisiting contents to the new buffer. + /// Must not be used to decrease the size of the buffer. + void ReAllocate(int newSize) { + if (newSize > size) { + // Move the gap to the end + GapTo(lengthBody); + T *newBody = new T[newSize]; + if ((size != 0) && (body != 0)) { + memmove(newBody, body, sizeof(T) * lengthBody); + delete []body; + } + body = newBody; + gapLength += newSize - size; + size = newSize; + } + } + + /// Retrieve the character at a particular position. + /// Retrieving positions outside the range of the buffer returns 0. + /// The assertions here are disabled since calling code can be + /// simpler if out of range access works and returns 0. + T ValueAt(int position) const { + if (position < part1Length) { + //PLATFORM_ASSERT(position >= 0); + if (position < 0) { + return 0; + } else { + return body[position]; + } + } else { + //PLATFORM_ASSERT(position < lengthBody); + if (position >= lengthBody) { + return 0; + } else { + return body[gapLength + position]; + } + } + } + + void SetValueAt(int position, T v) { + if (position < part1Length) { + PLATFORM_ASSERT(position >= 0); + if (position < 0) { + ; + } else { + body[position] = v; + } + } else { + PLATFORM_ASSERT(position < lengthBody); + if (position >= lengthBody) { + ; + } else { + body[gapLength + position] = v; + } + } + } + + T &operator[](int position) const { + PLATFORM_ASSERT(position >= 0 && position < lengthBody); + if (position < part1Length) { + return body[position]; + } else { + return body[gapLength + position]; + } + } + + /// Retrieve the length of the buffer. + int Length() const { + return lengthBody; + } + + /// Insert a single value into the buffer. + /// Inserting at positions outside the current range fails. + void Insert(int position, T v) { + PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); + if ((position < 0) || (position > lengthBody)) { + return; + } + RoomFor(1); + GapTo(position); + body[part1Length] = v; + lengthBody++; + part1Length++; + gapLength--; + } + + /// Insert a number of elements into the buffer setting their value. + /// Inserting at positions outside the current range fails. + void InsertValue(int position, int insertLength, T v) { + PLATFORM_ASSERT((position >= 0) && (position <= lengthBody)); + if (insertLength > 0) { + if ((position < 0) || (position > lengthBody)) { + return; + } + RoomFor(insertLength); + GapTo(position); + std::fill(&body[part1Length], &body[part1Length + insertLength], v); + lengthBody += insertLength; + part1Length += insertLength; + gapLength -= insertLength; + } + } + + /// Ensure at least length elements allocated, + /// appending zero valued elements if needed. + void EnsureLength(int wantedLength) { + if (Length() < wantedLength) { + InsertValue(Length(), wantedLength - Length(), 0); + } + } + + /// Insert text into the buffer from an array. + void InsertFromArray(int positionToInsert, const T s[], int positionFrom, int insertLength) { + PLATFORM_ASSERT((positionToInsert >= 0) && (positionToInsert <= lengthBody)); + if (insertLength > 0) { + if ((positionToInsert < 0) || (positionToInsert > lengthBody)) { + return; + } + RoomFor(insertLength); + GapTo(positionToInsert); + memmove(body + part1Length, s + positionFrom, sizeof(T) * insertLength); + lengthBody += insertLength; + part1Length += insertLength; + gapLength -= insertLength; + } + } + + /// Delete one element from the buffer. + void Delete(int position) { + PLATFORM_ASSERT((position >= 0) && (position < lengthBody)); + if ((position < 0) || (position >= lengthBody)) { + return; + } + DeleteRange(position, 1); + } + + /// Delete a range from the buffer. + /// Deleting positions outside the current range fails. + void DeleteRange(int position, int deleteLength) { + PLATFORM_ASSERT((position >= 0) && (position + deleteLength <= lengthBody)); + if ((position < 0) || ((position + deleteLength) > lengthBody)) { + return; + } + if ((position == 0) && (deleteLength == lengthBody)) { + // Full deallocation returns storage and is faster + delete []body; + Init(); + } else if (deleteLength > 0) { + GapTo(position); + lengthBody -= deleteLength; + gapLength += deleteLength; + } + } + + /// Delete all the buffer contents. + void DeleteAll() { + DeleteRange(0, lengthBody); + } + + // Retrieve a range of elements into an array + void GetRange(T *buffer, int position, int retrieveLength) const { + // Split into up to 2 ranges, before and after the split then use memcpy on each. + int range1Length = 0; + if (position < part1Length) { + int part1AfterPosition = part1Length - position; + range1Length = retrieveLength; + if (range1Length > part1AfterPosition) + range1Length = part1AfterPosition; + } + memcpy(buffer, body + position, range1Length * sizeof(T)); + buffer += range1Length; + position = position + range1Length + gapLength; + int range2Length = retrieveLength - range1Length; + memcpy(buffer, body + position, range2Length * sizeof(T)); + } + + T *BufferPointer() { + RoomFor(1); + GapTo(lengthBody); + body[lengthBody] = 0; + return body; + } + + T *RangePointer(int position, int rangeLength) { + if (position < part1Length) { + if ((position + rangeLength) > part1Length) { + // Range overlaps gap, so move gap to start of range. + GapTo(position); + return body + position + gapLength; + } else { + return body + position; + } + } else { + return body + position + gapLength; + } + } + + int GapPosition() const { + return part1Length; + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/Style.cpp b/libs/qscintilla/src/Style.cpp new file mode 100644 index 000000000..10fc0d2bf --- /dev/null +++ b/libs/qscintilla/src/Style.cpp @@ -0,0 +1,170 @@ +// Scintilla source code edit control +/** @file Style.cxx + ** Defines the font and colour style for a class of text. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "Style.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +FontAlias::FontAlias() { +} + +FontAlias::FontAlias(const FontAlias &other) : Font() { + SetID(other.fid); +} + +FontAlias::~FontAlias() { + SetID(0); + // ~Font will not release the actual font resource since it is now 0 +} + +void FontAlias::MakeAlias(Font &fontOrigin) { + SetID(fontOrigin.GetID()); +} + +void FontAlias::ClearFont() { + SetID(0); +} + +bool FontSpecification::operator==(const FontSpecification &other) const { + return fontName == other.fontName && + weight == other.weight && + italic == other.italic && + size == other.size && + characterSet == other.characterSet && + extraFontFlag == other.extraFontFlag; +} + +bool FontSpecification::operator<(const FontSpecification &other) const { + if (fontName != other.fontName) + return fontName < other.fontName; + if (weight != other.weight) + return weight < other.weight; + if (italic != other.italic) + return italic == false; + if (size != other.size) + return size < other.size; + if (characterSet != other.characterSet) + return characterSet < other.characterSet; + if (extraFontFlag != other.extraFontFlag) + return extraFontFlag < other.extraFontFlag; + return false; +} + +FontMeasurements::FontMeasurements() { + Clear(); +} + +void FontMeasurements::Clear() { + ascent = 1; + descent = 1; + aveCharWidth = 1; + spaceWidth = 1; + sizeZoomed = 2; +} + +Style::Style() : FontSpecification() { + Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), + Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, 0, SC_CHARSET_DEFAULT, + SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); +} + +Style::Style(const Style &source) : FontSpecification(), FontMeasurements() { + Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), + 0, 0, 0, + SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); + fore = source.fore; + back = source.back; + characterSet = source.characterSet; + weight = source.weight; + italic = source.italic; + size = source.size; + fontName = source.fontName; + eolFilled = source.eolFilled; + underline = source.underline; + caseForce = source.caseForce; + visible = source.visible; + changeable = source.changeable; + hotspot = source.hotspot; +} + +Style::~Style() { +} + +Style &Style::operator=(const Style &source) { + if (this == &source) + return * this; + Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff), + 0, 0, SC_CHARSET_DEFAULT, + SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); + fore = source.fore; + back = source.back; + characterSet = source.characterSet; + weight = source.weight; + italic = source.italic; + size = source.size; + fontName = source.fontName; + eolFilled = source.eolFilled; + underline = source.underline; + caseForce = source.caseForce; + visible = source.visible; + changeable = source.changeable; + return *this; +} + +void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_, + const char *fontName_, int characterSet_, + int weight_, bool italic_, bool eolFilled_, + bool underline_, ecaseForced caseForce_, + bool visible_, bool changeable_, bool hotspot_) { + fore = fore_; + back = back_; + characterSet = characterSet_; + weight = weight_; + italic = italic_; + size = size_; + fontName = fontName_; + eolFilled = eolFilled_; + underline = underline_; + caseForce = caseForce_; + visible = visible_; + changeable = changeable_; + hotspot = hotspot_; + font.ClearFont(); + FontMeasurements::Clear(); +} + +void Style::ClearTo(const Style &source) { + Clear( + source.fore, + source.back, + source.size, + source.fontName, + source.characterSet, + source.weight, + source.italic, + source.eolFilled, + source.underline, + source.caseForce, + source.visible, + source.changeable, + source.hotspot); +} + +void Style::Copy(Font &font_, const FontMeasurements &fm_) { + font.MakeAlias(font_); +#if PLAT_WX + font.SetAscent(fm_.ascent); +#endif + (FontMeasurements &)(*this) = fm_; +} diff --git a/libs/qscintilla/src/Style.h b/libs/qscintilla/src/Style.h new file mode 100644 index 000000000..411b11a08 --- /dev/null +++ b/libs/qscintilla/src/Style.h @@ -0,0 +1,91 @@ +// Scintilla source code edit control +/** @file Style.h + ** Defines the font and colour style for a class of text. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef STYLE_H +#define STYLE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +struct FontSpecification { + const char *fontName; + int weight; + bool italic; + int size; + int characterSet; + int extraFontFlag; + FontSpecification() : + fontName(0), + weight(SC_WEIGHT_NORMAL), + italic(false), + size(10 * SC_FONT_SIZE_MULTIPLIER), + characterSet(0), + extraFontFlag(0) { + } + bool operator==(const FontSpecification &other) const; + bool operator<(const FontSpecification &other) const; +}; + +// Just like Font but only has a copy of the FontID so should not delete it +class FontAlias : public Font { + // Private so FontAlias objects can not be assigned except for intiialization + FontAlias &operator=(const FontAlias &); +public: + FontAlias(); + FontAlias(const FontAlias &); + virtual ~FontAlias(); + void MakeAlias(Font &fontOrigin); + void ClearFont(); +}; + +struct FontMeasurements { + unsigned int ascent; + unsigned int descent; + XYPOSITION aveCharWidth; + XYPOSITION spaceWidth; + int sizeZoomed; + FontMeasurements(); + void Clear(); +}; + +/** + */ +class Style : public FontSpecification, public FontMeasurements { +public: + ColourDesired fore; + ColourDesired back; + bool eolFilled; + bool underline; + enum ecaseForced {caseMixed, caseUpper, caseLower}; + ecaseForced caseForce; + bool visible; + bool changeable; + bool hotspot; + + FontAlias font; + + Style(); + Style(const Style &source); + ~Style(); + Style &operator=(const Style &source); + void Clear(ColourDesired fore_, ColourDesired back_, + int size_, + const char *fontName_, int characterSet_, + int weight_, bool italic_, bool eolFilled_, + bool underline_, ecaseForced caseForce_, + bool visible_, bool changeable_, bool hotspot_); + void ClearTo(const Style &source); + void Copy(Font &font_, const FontMeasurements &fm_); + bool IsProtected() const { return !(changeable && visible);} +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/UniConversion.cpp b/libs/qscintilla/src/UniConversion.cpp new file mode 100644 index 000000000..04053b057 --- /dev/null +++ b/libs/qscintilla/src/UniConversion.cpp @@ -0,0 +1,311 @@ +// Scintilla source code edit control +/** @file UniConversion.cxx + ** Functions to handle UTF-8 and UTF-16 strings. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include "UniConversion.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; +enum { SURROGATE_TRAIL_LAST = 0xDFFF }; +enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 }; + +unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen) { + unsigned int len = 0; + for (unsigned int i = 0; i < tlen && uptr[i];) { + unsigned int uch = uptr[i]; + if (uch < 0x80) { + len++; + } else if (uch < 0x800) { + len += 2; + } else if ((uch >= SURROGATE_LEAD_FIRST) && + (uch <= SURROGATE_TRAIL_LAST)) { + len += 4; + i++; + } else { + len += 3; + } + i++; + } + return len; +} + +void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len) { + unsigned int k = 0; + for (unsigned int i = 0; i < tlen && uptr[i];) { + unsigned int uch = uptr[i]; + if (uch < 0x80) { + putf[k++] = static_cast(uch); + } else if (uch < 0x800) { + putf[k++] = static_cast(0xC0 | (uch >> 6)); + putf[k++] = static_cast(0x80 | (uch & 0x3f)); + } else if ((uch >= SURROGATE_LEAD_FIRST) && + (uch <= SURROGATE_TRAIL_LAST)) { + // Half a surrogate pair + i++; + unsigned int xch = 0x10000 + ((uch & 0x3ff) << 10) + (uptr[i] & 0x3ff); + putf[k++] = static_cast(0xF0 | (xch >> 18)); + putf[k++] = static_cast(0x80 | ((xch >> 12) & 0x3f)); + putf[k++] = static_cast(0x80 | ((xch >> 6) & 0x3f)); + putf[k++] = static_cast(0x80 | (xch & 0x3f)); + } else { + putf[k++] = static_cast(0xE0 | (uch >> 12)); + putf[k++] = static_cast(0x80 | ((uch >> 6) & 0x3f)); + putf[k++] = static_cast(0x80 | (uch & 0x3f)); + } + i++; + } + if (k < len) + putf[k] = '\0'; +} + +unsigned int UTF8CharLength(unsigned char ch) { + if (ch < 0x80) { + return 1; + } else if (ch < 0x80 + 0x40 + 0x20) { + return 2; + } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { + return 3; + } else { + return 4; + } +} + +size_t UTF16Length(const char *s, size_t len) { + size_t ulen = 0; + size_t charLen; + for (size_t i = 0; i(s[i]); + if (ch < 0x80) { + charLen = 1; + } else if (ch < 0x80 + 0x40 + 0x20) { + charLen = 2; + } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { + charLen = 3; + } else { + charLen = 4; + ulen++; + } + i += charLen; + ulen++; + } + return ulen; +} + +size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen) { + size_t ui = 0; + const unsigned char *us = reinterpret_cast(s); + size_t i = 0; + while ((i((ch & 0x1F) << 6); + ch = us[i++]; + tbuf[ui] = static_cast(tbuf[ui] + (ch & 0x7F)); + } else if (ch < 0x80 + 0x40 + 0x20 + 0x10) { + tbuf[ui] = static_cast((ch & 0xF) << 12); + ch = us[i++]; + tbuf[ui] = static_cast(tbuf[ui] + ((ch & 0x7F) << 6)); + ch = us[i++]; + tbuf[ui] = static_cast(tbuf[ui] + (ch & 0x7F)); + } else { + // Outside the BMP so need two surrogates + int val = (ch & 0x7) << 18; + ch = us[i++]; + val += (ch & 0x3F) << 12; + ch = us[i++]; + val += (ch & 0x3F) << 6; + ch = us[i++]; + val += (ch & 0x3F); + tbuf[ui] = static_cast(((val - 0x10000) >> 10) + SURROGATE_LEAD_FIRST); + ui++; + tbuf[ui] = static_cast((val & 0x3ff) + SURROGATE_TRAIL_FIRST); + } + ui++; + } + return ui; +} + +unsigned int UTF32FromUTF8(const char *s, unsigned int len, unsigned int *tbuf, unsigned int tlen) { + unsigned int ui=0; + const unsigned char *us = reinterpret_cast(s); + unsigned int i=0; + while ((i= 1) && (ch < 0x80 + 0x40 + 0x20)) { + value = (ch & 0x1F) << 6; + ch = us[i++]; + value += ch & 0x7F; + } else if (((len-i) >= 2) && (ch < 0x80 + 0x40 + 0x20 + 0x10)) { + value = (ch & 0xF) << 12; + ch = us[i++]; + value += (ch & 0x7F) << 6; + ch = us[i++]; + value += ch & 0x7F; + } else if ((len-i) >= 3) { + value = (ch & 0x7) << 18; + ch = us[i++]; + value += (ch & 0x3F) << 12; + ch = us[i++]; + value += (ch & 0x3F) << 6; + ch = us[i++]; + value += ch & 0x3F; + } + tbuf[ui] = value; + ui++; + } + return ui; +} + +unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf) { + if (val < SUPPLEMENTAL_PLANE_FIRST) { + tbuf[0] = static_cast(val); + return 1; + } else { + tbuf[0] = static_cast(((val - SUPPLEMENTAL_PLANE_FIRST) >> 10) + SURROGATE_LEAD_FIRST); + tbuf[1] = static_cast((val & 0x3ff) + SURROGATE_TRAIL_FIRST); + return 2; + } +} + +int UTF8BytesOfLead[256]; +static bool initialisedBytesOfLead = false; + +static int BytesFromLead(int leadByte) { + if (leadByte < 0xC2) { + // Single byte or invalid + return 1; + } else if (leadByte < 0xE0) { + return 2; + } else if (leadByte < 0xF0) { + return 3; + } else if (leadByte < 0xF5) { + return 4; + } else { + // Characters longer than 4 bytes not possible in current UTF-8 + return 1; + } +} + +void UTF8BytesOfLeadInitialise() { + if (!initialisedBytesOfLead) { + for (int i=0; i<256; i++) { + UTF8BytesOfLead[i] = BytesFromLead(i); + } + initialisedBytesOfLead = true; + } +} + +// Return both the width of the first character in the string and a status +// saying whether it is valid or invalid. +// Most invalid sequences return a width of 1 so are treated as isolated bytes but +// the non-characters *FFFE, *FFFF and FDD0 .. FDEF return 3 or 4 as they can be +// reasonably treated as code points in some circumstances. They will, however, +// not have associated glyphs. +int UTF8Classify(const unsigned char *us, int len) { + // For the rules: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 + if (*us < 0x80) { + // Single bytes easy + return 1; + } else if (*us > 0xf4) { + // Characters longer than 4 bytes not possible in current UTF-8 + return UTF8MaskInvalid | 1; + } else if (*us >= 0xf0) { + // 4 bytes + if (len < 4) + return UTF8MaskInvalid | 1; + if (UTF8IsTrailByte(us[1]) && UTF8IsTrailByte(us[2]) && UTF8IsTrailByte(us[3])) { + if (((us[1] & 0xf) == 0xf) && (us[2] == 0xbf) && ((us[3] == 0xbe) || (us[3] == 0xbf))) { + // *FFFE or *FFFF non-character + return UTF8MaskInvalid | 4; + } + if (*us == 0xf4) { + // Check if encoding a value beyond the last Unicode character 10FFFF + if (us[1] > 0x8f) { + return UTF8MaskInvalid | 1; + } else if (us[1] == 0x8f) { + if (us[2] > 0xbf) { + return UTF8MaskInvalid | 1; + } else if (us[2] == 0xbf) { + if (us[3] > 0xbf) { + return UTF8MaskInvalid | 1; + } + } + } + } else if ((*us == 0xf0) && ((us[1] & 0xf0) == 0x80)) { + // Overlong + return UTF8MaskInvalid | 1; + } + return 4; + } else { + return UTF8MaskInvalid | 1; + } + } else if (*us >= 0xe0) { + // 3 bytes + if (len < 3) + return UTF8MaskInvalid | 1; + if (UTF8IsTrailByte(us[1]) && UTF8IsTrailByte(us[2])) { + if ((*us == 0xe0) && ((us[1] & 0xe0) == 0x80)) { + // Overlong + return UTF8MaskInvalid | 1; + } + if ((*us == 0xed) && ((us[1] & 0xe0) == 0xa0)) { + // Surrogate + return UTF8MaskInvalid | 1; + } + if ((*us == 0xef) && (us[1] == 0xbf) && (us[2] == 0xbe)) { + // U+FFFE non-character - 3 bytes long + return UTF8MaskInvalid | 3; + } + if ((*us == 0xef) && (us[1] == 0xbf) && (us[2] == 0xbf)) { + // U+FFFF non-character - 3 bytes long + return UTF8MaskInvalid | 3; + } + if ((*us == 0xef) && (us[1] == 0xb7) && (((us[2] & 0xf0) == 0x90) || ((us[2] & 0xf0) == 0xa0))) { + // U+FDD0 .. U+FDEF + return UTF8MaskInvalid | 3; + } + return 3; + } else { + return UTF8MaskInvalid | 1; + } + } else if (*us >= 0xc2) { + // 2 bytes + if (len < 2) + return UTF8MaskInvalid | 1; + if (UTF8IsTrailByte(us[1])) { + return 2; + } else { + return UTF8MaskInvalid | 1; + } + } else { + // 0xc0 .. 0xc1 is overlong encoding + // 0x80 .. 0xbf is trail byte + return UTF8MaskInvalid | 1; + } +} + +int UTF8DrawBytes(const unsigned char *us, int len) { + int utf8StatusNext = UTF8Classify(us, len); + return (utf8StatusNext & UTF8MaskInvalid) ? 1 : (utf8StatusNext & UTF8MaskWidth); +} + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/libs/qscintilla/src/UniConversion.h b/libs/qscintilla/src/UniConversion.h new file mode 100644 index 000000000..08898cac3 --- /dev/null +++ b/libs/qscintilla/src/UniConversion.h @@ -0,0 +1,68 @@ +// Scintilla source code edit control +/** @file UniConversion.h + ** Functions to handle UTF-8 and UTF-16 strings. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef UNICONVERSION_H +#define UNICONVERSION_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +const int UTF8MaxBytes = 4; + +const int unicodeReplacementChar = 0xFFFD; + +unsigned int UTF8Length(const wchar_t *uptr, unsigned int tlen); +void UTF8FromUTF16(const wchar_t *uptr, unsigned int tlen, char *putf, unsigned int len); +unsigned int UTF8CharLength(unsigned char ch); +size_t UTF16Length(const char *s, size_t len); +size_t UTF16FromUTF8(const char *s, size_t len, wchar_t *tbuf, size_t tlen); +unsigned int UTF32FromUTF8(const char *s, unsigned int len, unsigned int *tbuf, unsigned int tlen); +unsigned int UTF16FromUTF32Character(unsigned int val, wchar_t *tbuf); + +extern int UTF8BytesOfLead[256]; +void UTF8BytesOfLeadInitialise(); + +inline bool UTF8IsTrailByte(int ch) { + return (ch >= 0x80) && (ch < 0xc0); +} + +inline bool UTF8IsAscii(int ch) { + return ch < 0x80; +} + +enum { UTF8MaskWidth=0x7, UTF8MaskInvalid=0x8 }; +int UTF8Classify(const unsigned char *us, int len); + +// Similar to UTF8Classify but returns a length of 1 for invalid bytes +// instead of setting the invalid flag +int UTF8DrawBytes(const unsigned char *us, int len); + +// Line separator is U+2028 \xe2\x80\xa8 +// Paragraph separator is U+2029 \xe2\x80\xa9 +const int UTF8SeparatorLength = 3; +inline bool UTF8IsSeparator(const unsigned char *us) { + return (us[0] == 0xe2) && (us[1] == 0x80) && ((us[2] == 0xa8) || (us[2] == 0xa9)); +} + +// NEL is U+0085 \xc2\x85 +const int UTF8NELLength = 2; +inline bool UTF8IsNEL(const unsigned char *us) { + return (us[0] == 0xc2) && (us[1] == 0x85); +} + +enum { SURROGATE_LEAD_FIRST = 0xD800 }; +enum { SURROGATE_LEAD_LAST = 0xDBFF }; +inline unsigned int UTF16CharLength(wchar_t uch) { + return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1; +} + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/UnicodeFromUTF8.h b/libs/qscintilla/src/UnicodeFromUTF8.h new file mode 100644 index 000000000..ae66cb0a9 --- /dev/null +++ b/libs/qscintilla/src/UnicodeFromUTF8.h @@ -0,0 +1,32 @@ +// Scintilla source code edit control +/** @file UnicodeFromUTF8.h + ** Lexer infrastructure. + **/ +// Copyright 2013 by Neil Hodgson +// This file is in the public domain. + +#ifndef UNICODEFROMUTF8_H +#define UNICODEFROMUTF8_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +inline int UnicodeFromUTF8(const unsigned char *us) { + if (us[0] < 0xC2) { + return us[0]; + } else if (us[0] < 0xE0) { + return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F); + } else if (us[0] < 0xF0) { + return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F); + } else if (us[0] < 0xF5) { + return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F); + } + return us[0]; +} + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/libs/qscintilla/src/ViewStyle.cpp b/libs/qscintilla/src/ViewStyle.cpp new file mode 100644 index 000000000..e56c8f375 --- /dev/null +++ b/libs/qscintilla/src/ViewStyle.cpp @@ -0,0 +1,589 @@ +// Scintilla source code edit control +/** @file ViewStyle.cxx + ** Store information on how the document is to be viewed. + **/ +// 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 "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +MarginStyle::MarginStyle() : + style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false), cursor(SC_CURSORREVERSEARROW) { +} + +// A list of the fontnames - avoids wasting space in each style +FontNames::FontNames() { +} + +FontNames::~FontNames() { + Clear(); +} + +void FontNames::Clear() { + for (std::vector::const_iterator it=names.begin(); it != names.end(); ++it) { + delete []*it; + } + names.clear(); +} + +const char *FontNames::Save(const char *name) { + if (!name) + return 0; + + for (std::vector::const_iterator it=names.begin(); it != names.end(); ++it) { + if (strcmp(*it, name) == 0) { + return *it; + } + } + const size_t lenName = strlen(name) + 1; + char *nameSave = new char[lenName]; + memcpy(nameSave, name, lenName); + names.push_back(nameSave); + return nameSave; +} + +FontRealised::FontRealised() { +} + +FontRealised::~FontRealised() { + font.Release(); +} + +void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs) { + PLATFORM_ASSERT(fs.fontName); + sizeZoomed = fs.size + zoomLevel * SC_FONT_SIZE_MULTIPLIER; + if (sizeZoomed <= 2 * SC_FONT_SIZE_MULTIPLIER) // Hangs if sizeZoomed <= 1 + sizeZoomed = 2 * SC_FONT_SIZE_MULTIPLIER; + + float deviceHeight = static_cast(surface.DeviceHeightFont(sizeZoomed)); + FontParameters fp(fs.fontName, deviceHeight / SC_FONT_SIZE_MULTIPLIER, fs.weight, fs.italic, fs.extraFontFlag, technology, fs.characterSet); + font.Create(fp); + + ascent = static_cast(surface.Ascent(font)); + descent = static_cast(surface.Descent(font)); + aveCharWidth = surface.AverageCharWidth(font); + spaceWidth = surface.WidthChar(font, ' '); +} + +ViewStyle::ViewStyle() { + Init(); +} + +ViewStyle::ViewStyle(const ViewStyle &source) { + Init(source.styles.size()); + for (unsigned int sty=0; stysecond; + } + fonts.clear(); +} + +void ViewStyle::Init(size_t stylesSize_) { + AllocStyles(stylesSize_); + nextExtendedStyle = 256; + fontNames.Clear(); + ResetDefaultStyle(); + + // There are no image markers by default, so no need for calling CalcLargestMarkerHeight() + largestMarkerHeight = 0; + + indicators[0] = Indicator(INDIC_SQUIGGLE, ColourDesired(0, 0x7f, 0)); + indicators[1] = Indicator(INDIC_TT, ColourDesired(0, 0, 0xff)); + indicators[2] = Indicator(INDIC_PLAIN, ColourDesired(0xff, 0, 0)); + + technology = SC_TECHNOLOGY_DEFAULT; + indicatorsDynamic = 0; + indicatorsSetFore = 0; + lineHeight = 1; + lineOverlap = 0; + maxAscent = 1; + maxDescent = 1; + aveCharWidth = 8; + spaceWidth = 8; + tabWidth = spaceWidth * 8; + + selColours.fore = ColourOptional(ColourDesired(0xff, 0, 0)); + selColours.back = ColourOptional(ColourDesired(0xc0, 0xc0, 0xc0), true); + selAdditionalForeground = ColourDesired(0xff, 0, 0); + selAdditionalBackground = ColourDesired(0xd7, 0xd7, 0xd7); + selBackground2 = ColourDesired(0xb0, 0xb0, 0xb0); + selAlpha = SC_ALPHA_NOALPHA; + selAdditionalAlpha = SC_ALPHA_NOALPHA; + selEOLFilled = false; + + foldmarginColour = ColourOptional(ColourDesired(0xff, 0, 0)); + foldmarginHighlightColour = ColourOptional(ColourDesired(0xc0, 0xc0, 0xc0)); + + whitespaceColours.fore = ColourOptional(); + whitespaceColours.back = ColourOptional(ColourDesired(0xff, 0xff, 0xff)); + controlCharSymbol = 0; /* Draw the control characters */ + controlCharWidth = 0; + selbar = Platform::Chrome(); + selbarlight = Platform::ChromeHighlight(); + styles[STYLE_LINENUMBER].fore = ColourDesired(0, 0, 0); + styles[STYLE_LINENUMBER].back = Platform::Chrome(); + caretcolour = ColourDesired(0, 0, 0); + additionalCaretColour = ColourDesired(0x7f, 0x7f, 0x7f); + showCaretLineBackground = false; + alwaysShowCaretLineBackground = false; + caretLineBackground = ColourDesired(0xff, 0xff, 0); + caretLineAlpha = SC_ALPHA_NOALPHA; + edgecolour = ColourDesired(0xc0, 0xc0, 0xc0); + edgeState = EDGE_NONE; + caretStyle = CARETSTYLE_LINE; + caretWidth = 1; + someStylesProtected = false; + someStylesForceCase = false; + + hotspotColours.fore = ColourOptional(ColourDesired(0, 0, 0xff)); + hotspotColours.back = ColourOptional(ColourDesired(0xff, 0xff, 0xff)); + hotspotUnderline = true; + hotspotSingleLine = true; + + leftMarginWidth = 1; + rightMarginWidth = 1; + ms[0].style = SC_MARGIN_NUMBER; + ms[0].width = 0; + ms[0].mask = 0; + ms[1].style = SC_MARGIN_SYMBOL; + ms[1].width = 16; + ms[1].mask = ~SC_MASK_FOLDERS; + ms[2].style = SC_MARGIN_SYMBOL; + ms[2].width = 0; + ms[2].mask = 0; + marginInside = true; + fixedColumnWidth = marginInside ? leftMarginWidth : 0; + maskInLine = 0xffffffff; + for (int margin=0; margin <= SC_MAX_MARGIN; margin++) { + fixedColumnWidth += ms[margin].width; + if (ms[margin].width > 0) + maskInLine &= ~ms[margin].mask; + } + textStart = marginInside ? fixedColumnWidth : leftMarginWidth; + zoomLevel = 0; + viewWhitespace = wsInvisible; + whitespaceSize = 1; + viewIndentationGuides = ivNone; + viewEOL = false; + extraFontFlag = 0; + extraAscent = 0; + extraDescent = 0; + marginStyleOffset = 0; + annotationVisible = ANNOTATION_HIDDEN; + annotationStyleOffset = 0; + braceHighlightIndicatorSet = false; + braceHighlightIndicator = 0; + braceBadLightIndicatorSet = false; + braceBadLightIndicator = 0; + + theEdge = 0; + + marginNumberPadding = 3; + ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side + lastSegItalicsOffset = 2; + + wrapState = eWrapNone; + wrapVisualFlags = 0; + wrapVisualFlagsLocation = 0; + wrapVisualStartIndent = 0; + wrapIndentMode = SC_WRAPINDENT_FIXED; +} + +void ViewStyle::Refresh(Surface &surface, int tabInChars) { + for (FontMap::iterator it = fonts.begin(); it != fonts.end(); ++it) { + delete it->second; + } + fonts.clear(); + + selbar = Platform::Chrome(); + selbarlight = Platform::ChromeHighlight(); + + for (unsigned int i=0; isecond->Realise(surface, zoomLevel, technology, it->first); + } + + for (unsigned int k=0; kfont, *fr); + } + indicatorsDynamic = 0; + indicatorsSetFore = 0; + for (int ind = 0; ind <= INDIC_MAX; ind++) { + if (indicators[ind].IsDynamic()) + indicatorsDynamic++; + if (indicators[ind].OverridesTextFore()) + indicatorsSetFore++; + } + maxAscent = 1; + maxDescent = 1; + FindMaxAscentDescent(); + maxAscent += extraAscent; + maxDescent += extraDescent; + lineHeight = maxAscent + maxDescent; + lineOverlap = lineHeight / 10; + if (lineOverlap < 2) + lineOverlap = 2; + if (lineOverlap > lineHeight) + lineOverlap = lineHeight; + + someStylesProtected = false; + someStylesForceCase = false; + for (unsigned int l=0; l= 32) { + controlCharWidth = surface.WidthChar(styles[STYLE_CONTROLCHAR].font, static_cast(controlCharSymbol)); + } + + fixedColumnWidth = marginInside ? leftMarginWidth : 0; + maskInLine = 0xffffffff; + for (int margin=0; margin <= SC_MAX_MARGIN; margin++) { + fixedColumnWidth += ms[margin].width; + if (ms[margin].width > 0) + maskInLine &= ~ms[margin].mask; + } + textStart = marginInside ? fixedColumnWidth : leftMarginWidth; +} + +void ViewStyle::ReleaseAllExtendedStyles() { + nextExtendedStyle = 256; +} + +int ViewStyle::AllocateExtendedStyles(int numberStyles) { + int startRange = static_cast(nextExtendedStyle); + nextExtendedStyle += numberStyles; + EnsureStyle(nextExtendedStyle); + for (size_t i=startRange; i= styles.size()) { + AllocStyles(index+1); + } +} + +void ViewStyle::ResetDefaultStyle() { + styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0), + ColourDesired(0xff,0xff,0xff), + Platform::DefaultFontSize() * SC_FONT_SIZE_MULTIPLIER, fontNames.Save(Platform::DefaultFont()), + SC_CHARSET_DEFAULT, + SC_WEIGHT_NORMAL, false, false, false, Style::caseMixed, true, true, false); +} + +void ViewStyle::ClearStyles() { + // Reset all styles to be like the default style + for (unsigned int i=0; iGetHeight() > largestMarkerHeight) + largestMarkerHeight = markers[m].pxpm->GetHeight(); + break; + case SC_MARK_RGBAIMAGE: + if (markers[m].image && markers[m].image->GetHeight() > largestMarkerHeight) + largestMarkerHeight = markers[m].image->GetHeight(); + break; + } + } +} + +// See if something overrides the line background color: Either if caret is on the line +// and background color is set for that, or if a marker is defined that forces its background +// color onto the line, or if a marker is defined but has no selection margin in which to +// display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order +// with the earlier taking precedence. When multiple markers cause background override, +// the color for the highest numbered one is used. +ColourOptional ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const { + ColourOptional background; + if ((caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground && (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) { + background = ColourOptional(caretLineBackground, true); + } + if (!background.isSet && marksOfLine) { + int marks = marksOfLine; + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (markers[markBit].markType == SC_MARK_BACKGROUND) && + (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + background = ColourOptional(markers[markBit].back, true); + } + marks >>= 1; + } + } + if (!background.isSet && maskInLine) { + int marksMasked = marksOfLine & maskInLine; + if (marksMasked) { + for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { + if ((marksMasked & 1) && (markers[markBit].markType != SC_MARK_EMPTY) && + (markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + background = ColourOptional(markers[markBit].back, true); + } + marksMasked >>= 1; + } + } + } + return background; +} + +bool ViewStyle::SelectionBackgroundDrawn() const { + return selColours.back.isSet && + ((selAlpha == SC_ALPHA_NOALPHA) || (selAdditionalAlpha == SC_ALPHA_NOALPHA)); +} + +bool ViewStyle::WhitespaceBackgroundDrawn() const { + return (viewWhitespace != wsInvisible) && (whitespaceColours.back.isSet); +} + +ColourDesired ViewStyle::WrapColour() const { + if (whitespaceColours.fore.isSet) + return whitespaceColours.fore; + else + return styles[STYLE_DEFAULT].fore; +} + +bool ViewStyle::SetWrapState(int wrapState_) { + WrapMode wrapStateWanted; + switch (wrapState_) { + case SC_WRAP_WORD: + wrapStateWanted = eWrapWord; + break; + case SC_WRAP_CHAR: + wrapStateWanted = eWrapChar; + break; + case SC_WRAP_WHITESPACE: + wrapStateWanted = eWrapWhitespace; + break; + default: + wrapStateWanted = eWrapNone; + break; + } + bool changed = wrapState != wrapStateWanted; + wrapState = wrapStateWanted; + return changed; +} + +bool ViewStyle::SetWrapVisualFlags(int wrapVisualFlags_) { + bool changed = wrapVisualFlags != wrapVisualFlags_; + wrapVisualFlags = wrapVisualFlags_; + return changed; +} + +bool ViewStyle::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_) { + bool changed = wrapVisualFlagsLocation != wrapVisualFlagsLocation_; + wrapVisualFlagsLocation = wrapVisualFlagsLocation_; + return changed; +} + +bool ViewStyle::SetWrapVisualStartIndent(int wrapVisualStartIndent_) { + bool changed = wrapVisualStartIndent != wrapVisualStartIndent_; + wrapVisualStartIndent = wrapVisualStartIndent_; + return changed; +} + +bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) { + bool changed = wrapIndentMode != wrapIndentMode_; + wrapIndentMode = wrapIndentMode_; + return changed; +} + +void ViewStyle::AllocStyles(size_t sizeNew) { + size_t i=styles.size(); + styles.resize(sizeNew); + if (styles.size() > STYLE_DEFAULT) { + for (; isecond; + FontMap::iterator it = fonts.find(fs); + if (it != fonts.end()) { + // Should always reach here since map was just set for all styles + return it->second; + } + return 0; +} + +void ViewStyle::FindMaxAscentDescent() { + for (FontMap::const_iterator it = fonts.begin(); it != fonts.end(); ++it) { + if (maxAscent < it->second->ascent) + maxAscent = it->second->ascent; + if (maxDescent < it->second->descent) + maxDescent = it->second->descent; + } +} diff --git a/libs/qscintilla/src/ViewStyle.h b/libs/qscintilla/src/ViewStyle.h new file mode 100644 index 000000000..930ad104c --- /dev/null +++ b/libs/qscintilla/src/ViewStyle.h @@ -0,0 +1,199 @@ +// Scintilla source code edit control +/** @file ViewStyle.h + ** Store information on how the document is to be viewed. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef VIEWSTYLE_H +#define VIEWSTYLE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class MarginStyle { +public: + int style; + int width; + int mask; + bool sensitive; + int cursor; + MarginStyle(); +}; + +/** + */ +class FontNames { +private: + std::vector names; + + // Private so FontNames objects can not be copied + FontNames(const FontNames &); +public: + FontNames(); + ~FontNames(); + void Clear(); + const char *Save(const char *name); +}; + +class FontRealised : public FontMeasurements { + // Private so FontRealised objects can not be copied + FontRealised(const FontRealised &); + FontRealised &operator=(const FontRealised &); +public: + Font font; + FontRealised(); + virtual ~FontRealised(); + void Realise(Surface &surface, int zoomLevel, int technology, const FontSpecification &fs); +}; + +enum IndentView {ivNone, ivReal, ivLookForward, ivLookBoth}; + +enum WhiteSpaceVisibility {wsInvisible=0, wsVisibleAlways=1, wsVisibleAfterIndent=2}; + +typedef std::map FontMap; + +enum WrapMode { eWrapNone, eWrapWord, eWrapChar, eWrapWhitespace }; + +class ColourOptional : public ColourDesired { +public: + bool isSet; + ColourOptional(ColourDesired colour_=ColourDesired(0,0,0), bool isSet_=false) : ColourDesired(colour_), isSet(isSet_) { + } + ColourOptional(uptr_t wParam, sptr_t lParam) : ColourDesired(static_cast(lParam)), isSet(wParam != 0) { + } +}; + +struct ForeBackColours { + ColourOptional fore; + ColourOptional back; +}; + +/** + */ +class ViewStyle { + FontNames fontNames; + FontMap fonts; +public: + std::vector