pax_global_header00006660000000000000000000000064131604721270014515gustar00rootroot0000000000000052 comment=969022093f5f6c004f7cbaaba4cdf61645df2cd5 sqlitebrowser-3.10.1/000077500000000000000000000000001316047212700145045ustar00rootroot00000000000000sqlitebrowser-3.10.1/.github/000077500000000000000000000000001316047212700160445ustar00rootroot00000000000000sqlitebrowser-3.10.1/.github/ISSUE_TEMPLATE.md000066400000000000000000000017121316047212700205520ustar00rootroot00000000000000### Details for the issue ### Useful extra information #### I'm opening this issue because: - [ ] DB4S is crashing - [ ] DB4S has a bug - [ ] DB4S needs a feature - [ ] DB4S has another problem #### I'm using DB4S on: - [ ] Windows: ( _version:_ ___ ) - [ ] Linux: ( _distro:_ ___ ) - [ ] Mac OS: ( _version:_ ___ ) - [ ] Other: ___ #### I'm using DB4S version: - [ ] 3.10.0 - [ ] 3.10.0-beta* - [ ] 3.9.1 - [ ] Other: ___ #### I have also: - [ ] Tried out the latest nightly version: https://github.com/sqlitebrowser/sqlitebrowser#nightly-builds - [ ] Searched for an existing similar issue: https://github.com/sqlitebrowser/sqlitebrowser/issues?utf8=%E2%9C%93&q=is%3Aissue%20 sqlitebrowser-3.10.1/.gitignore000066400000000000000000000011211316047212700164670ustar00rootroot00000000000000Makefile sqlitebrowser.pro.user .qmake.stash CMakeLists.txt.user CMakeFiles *.cmake *.cxx_parameters # ignore any build folders build*/ # folder with temporary test data testdata/ src/.ui/ src/sqlitebrowser src/Makefile* src/debug src/release src/gen_version.h # ignore compiled translation files src/translations/*.qm # ignore compiled macOS app src/*.app/ # no one needs the txt file 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 sqlitebrowser-3.10.1/.travis.yml000066400000000000000000000045001316047212700166140ustar00rootroot00000000000000language: cpp sudo: required dist: trusty matrix: fast_finish: true include: - compiler: gcc addons: apt: sources: - ubuntu-toolchain-r-test packages: - g++-5 env: COMPILER=g++-5 CXX=g++-5 - compiler: clang addons: apt: sources: - ubuntu-toolchain-r-test - llvm-toolchain-precise-3.8 packages: - clang-3.8 env: COMPILER=clang++-3.8 before_install: - sudo add-apt-repository ppa:likemartinma/devel -y - sudo add-apt-repository --yes ppa:beineri/opt-qt571-trusty - sudo apt-get update -qq - sudo apt-get --force-yes install qt57-meta-full - sudo apt-get --force-yes install libsqlite3-dev libsqlcipher-dev libantlr-dev - QT_ENV_SCRIPT=$(find /opt -name 'qt*-env.sh') - source $QT_ENV_SCRIPT install: - if [ "$CXX" = "g++" ]; then export CXX="g++-5" CC="gcc-5"; fi - if [ "$CXX" = "clang++" ]; then export CXX="clang++-3.8" CC="clang-3.8"; fi script: - mkdir build - mkdir build_cipher - cd build - cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_TESTING=ON .. - make - ctest -V - cd ../build_cipher - cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DENABLE_TESTING=ON -Dsqlcipher=1 .. - make - ctest -V - # AppImage generation - cd ../build - sudo apt-get -y install checkinstall - sudo checkinstall --pkgname=app --pkgversion="1" --pkgrelease="1" --backup=no --fstrans=no --default --deldoc - mkdir appdir ; cd appdir - dpkg -x ../app_1-1_amd64.deb . ; find . - cp ./usr/share/applications/sqlitebrowser.desktop . - cp ./usr/share/icons/hicolor/256x256/apps/sqlitebrowser.png . - cd .. - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" - chmod a+x linuxdeployqt*.AppImage - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH - ./linuxdeployqt*.AppImage ./appdir/usr/bin/sqlitebrowser -bundle-non-qt-libs - ./linuxdeployqt*.AppImage ./appdir/usr/bin/sqlitebrowser -appimage - curl --upload-file ./DB*.AppImage https://transfer.sh/sqlitebrowser-git.$(git rev-parse --short HEAD)-x86_64.AppImage notifications: email: recipients: - mkleusberg@gmail.com - innermous@gmail.com - justin@postgresql.org on_success: never on_failure: always sqlitebrowser-3.10.1/BUILDING.md000066400000000000000000000226141316047212700162300ustar00rootroot00000000000000## BUILD INSTRUCTIONS AND REQUIREMENTS DB Browser for SQLite requires Qt as well as SQLite. For more information on Qt please consult http://www.qt.io and for SQLite please see https://sqlite.org/. Please note that all versions after 3.9.1 will require: * Qt 5.5 or later, however we advise you to use 5.7 or later * A C++ compiler with support for C++11 or later Without these or with older versions you won't be able to compile DB Browser for Sqlite anymore. This applies to all platforms. However, most likely you won't have to worry about these as most systems meet these requirements today. If you have any chance, please use Qt 5.7 or any later version. Even though Qt 5.5 and 5.6 are supported by us, there might be glitches and minor problems when using them. ### Generic Linux and FreeBSD The only requirements for building this code are the presence of Qt5 and sqlite3. Qt can be included as a static or shared library, depending on the current Qt configuration on the building machine. Provided you have Qt and cmake installed and configured, simply run: $ cmake . There is one potential problem... several Linux distributions provide a QScintilla package compiled for (only) Qt4. If it's present it can confuse CMake, which will use it during compiling. The resulting program just crashes instead of running. If you experience that kind of crash, try using this cmake command instead when compiling: $ cmake -DFORCE_INTERNAL_QSCINTILLA=ON That tells cmake to compile QScintilla itself, using the source code version we bundle. After the cmake line, run this: $ make in the main directory. This will generate the sqlitebrowser (or `sqlitebrowser.exe`, or `sqlitebrowser.app`) application in the src subdirectory. On some distributions you can then install this in the correct places by running: $ sudo make install The same process works for building the code in any platform supported by Qt (including other Unix systems with X11.) ### Ubuntu Linux ```bash $ sudo apt install build-essential git cmake libsqlite3-dev qt5-default qttools5-dev-tools $ git clone https://github.com/sqlitebrowser/sqlitebrowser $ cd sqlitebrowser $ mkdir build $ cd build $ cmake -Wno-dev .. $ make $ sudo make install ``` This should complete without errors, giving you a binary file called 'sqlitebrowser'. Done. :) ### CentOS / Fedora Linux **Note** - On CentOS or an older version of Fedora, you may need to use `yum` instead of `dnf` **Note 2** - On CentOS 7.x, you need to add `qt5-qtbase-devel` to the `dnf install` line below ``` $ sudo dnf install ant-antlr antlr-C++ cmake gcc-c++ git qt-devel qt5-linguist qwt-qt5-devel \ sqlite-devel $ git clone https://github.com/sqlitebrowser/sqlitebrowser $ cd sqlitebrowser $ cmake -Wno-dev . $ make $ sudo make install ``` This should complete without errors, and `sqlitebrowser` should now be launch-able from the command line. ### MacOS X The application can be compiled to a single executable binary file, similar to other command line utilities. Or it can be compiled to a .app bundle, suitable for placing in /Applications. ### Building a single executable binary This is incredibly easy using [Homebrew](http://brew.sh). Just run this command: $ brew install sqlitebrowser And you're done. A "sqlitebrowser" command should now be available in your PATH, and can also be launched through Spotlight. ### Building an .app bundle Building an .app bundle version takes a bit more effort, but isn't too hard. It requires SQLite and Qt 5.x to be installed first. These are the [Homebrew](http://brew.sh) steps, though other package managers should work: $ brew install sqlite --with-functions --with-json1 --without-readline $ brew install qt $ brew link sqlite3 --force Then it's just a matter of getting the source: $ git clone https://github.com/sqlitebrowser/sqlitebrowser.git **Note** - Don't clone the repo to a directory with a quote character (') in its name (eg ~/tmp/foo'), as compiling will error out. And compiling it: $ cd sqlitebrowser $ qmake $ make $ brew unlink sqlite3 $ mv src/DB\ Browser\ for\ SQLite.app /Applications/ An icon for "DB Browser for SQLite" should now be in your main OSX Applications list, ready to launch. **Note 2** - There have been occasional [reports of compilation problems on OSX 10.9](https://github.com/sqlitebrowser/sqlitebrowser/issues/38), with the 'make' step complaining about no targets. This seems to be solvable by running: $ qmake -spec macx-g++ or: $ qmake -spec macx-llvm (before the 'make' step) ### Compiling on Windows with MSVC Complete setup, build, and packaging instructions with MSVC 2013 x64 are online here:     https://github.com/sqlitebrowser/sqlitebrowser/wiki/Setting-up-a-Win64-development-environment-for-DB4S ### Cross compiling for Windows These are instructions to cross compile within a Linux system a Windows binary and installer. Requirements: * mxe cross compile environment → http://mxe.cc * cmake * sqlitebrowser sources Get the following mxe packages: $ make gcc sqlite qt nsis After successful compilation go into your mxedir/usr/bin and add 3 symlinks: $ ln -s i686-pc-mingw32-windres windres $ ln -s i686-pc-mingw32-makensis makensis $ ln -s /usr/bin/lrelease Now cd into your sqlitebrowser source directory and create a build directory for the windows binary and create the correct makefiles: $ mkdir build-win $ cd build-win $ cmake -DCMAKE_TOOLCHAIN_FILE=/path to mxe/usr/i686-pc-mingw32/share/cmake/mxe-conf.cmake .. Before compiling we have to add the mxe/usr/bin directory to the PATH (so windres and makensis can be found): $ export PATH=/path to mxe/usr/bin:$PATH Now compile: $ make If you additionaly want an NSIS installer: $ make package done. ## Build with SQLCipher support When built with SQLCipher support, DB Browser for SQLite will allow you to open and edit databases encrypted using SQLCipher as well as standard SQLite3 databases. Before compiling make sure you have the necessary SQLCipher development files installed. On Linux this can usually be accomplished by just installing the correct package (e.g. 'libsqlcipher-dev' on Debian-based distributions). On MacOS X the easiest way is to install it via Homebrew ('brew install sqlcipher'). On Windows unfortunately it's a bit more difficult: You'll have to download and compile the code as described on the [SQLCipher website](https://www.zetetic.net/sqlcipher/) before you can proceed. If SQLCipher is installed, simply follow the standard instructions for your platform but enable the 'sqlcipher' build option by replacing any calls to cmake and qmake like this: ``` If it says... Change it to... cmake cmake -Dsqlcipher=1 cmake .. cmake -Dsqlcipher=1 .. qmake qmake CONFIG+=sqlcipher ``` ## Building and running the Unit Tests DB Browser for SQLite has unit tests in the "src/tests" subdirectory. ### Build the unit tests The unit tests are enabled using the cmake variable `ENABLE_TESTING`; it can be passed when running `cmake` to configure sqlitebrowser, for example like this: ```bash $ mkdir build $ cd build $ cmake -DENABLE_TESTING=ON .. $ make ``` ### Run the unit tests Tests can be then run using `make test` or invoking `ctest` directly, for example like this: ``` $ ctest -V UpdateCTestConfiguration from :SRCDIR/build/DartConfiguration.tcl UpdateCTestConfiguration from :SRCDIR/build/DartConfiguration.tcl Test project SRCDIR/build Constructing a list of tests Done constructing a list of tests Checking test dependency graph... Checking test dependency graph end test 1 Start 1: test-sqlobjects 1: Test command: SRCDIR/build/src/tests/test-sqlobjects 1: Test timeout computed to be: 9.99988e+06 1: ********* Start testing of TestTable ********* 1: Config: Using QTest library 4.8.6, Qt 4.8.6 1: PASS : TestTable::initTestCase() 1: PASS : TestTable::sqlOutput() 1: PASS : TestTable::autoincrement() 1: PASS : TestTable::notnull() 1: PASS : TestTable::withoutRowid() 1: PASS : TestTable::foreignKeys() 1: PASS : TestTable::parseSQL() 1: PASS : TestTable::parseSQLdefaultexpr() 1: PASS : TestTable::parseSQLMultiPk() 1: PASS : TestTable::parseSQLForeignKey() 1: PASS : TestTable::parseSQLSingleQuotes() 1: PASS : TestTable::parseSQLKeywordInIdentifier() 1: PASS : TestTable::parseSQLWithoutRowid() 1: PASS : TestTable::parseNonASCIIChars() 1: PASS : TestTable::parseSQLEscapedQuotes() 1: PASS : TestTable::parseSQLForeignKeys() 1: PASS : TestTable::parseSQLCheckConstraint() 1: PASS : TestTable::createTableWithIn() 1: PASS : TestTable::createTableWithNotLikeConstraint() 1: PASS : TestTable::cleanupTestCase() 1: Totals: 20 passed, 0 failed, 0 skipped 1: ********* Finished testing of TestTable ********* 1/2 Test #1: test-sqlobjects .................. Passed 0.02 sec test 2 Start 2: test-import 2: Test command: SRCDIR/build/src/tests/test-import 2: Test timeout computed to be: 9.99988e+06 2: ********* Start testing of TestImport ********* 2: Config: Using QTest library 4.8.6, Qt 4.8.6 2: PASS : TestImport::initTestCase() 2: PASS : TestImport::csvImport() 2: PASS : TestImport::cleanupTestCase() 2: Totals: 3 passed, 0 failed, 0 skipped 2: ********* Finished testing of TestImport ********* 2/2 Test #2: test-import ...................... Passed 0.01 sec 100% tests passed, 0 tests failed out of 2 Total Test time (real) = 0.04 sec ``` Everything should PASS, with no failures, and nothing skipped. sqlitebrowser-3.10.1/CMakeLists.txt000066400000000000000000000317771316047212700172630ustar00rootroot00000000000000project(sqlitebrowser) cmake_minimum_required(VERSION 2.8.7) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}") OPTION(ENABLE_TESTING "Enable the unit tests" OFF) OPTION(FORCE_INTERNAL_ANTLR "Don't use the distribution's Antlr library even if there is one" OFF) OPTION(FORCE_INTERNAL_QSCINTILLA "Don't use the distribution's QScintilla library even if there is one" OFF) if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() add_definitions(-std=c++11) if(WIN32 AND MSVC) project("DB Browser for SQLite") if(CMAKE_CL_64) # Paths for 64-bit windows builds set(OPENSSL_PATH "C:/dev/OpenSSL-Win64") set(QT5_PATH "C:/dev/Qt/5.7/msvc2013_64") set(VSREDIST "vcredist_x64.exe") # Choose between SQLCipher or SQLite, depending whether # -Dsqlcipher=1 is passed on the command line if(sqlcipher) set(SQLITE3_PATH "C:/git_repos/SQLCipher-Win64") else() set(SQLITE3_PATH "C:/dev/SQLite-Win64") endif() else() # Paths for 32-bit windows builds set(OPENSSL_PATH "C:/dev/OpenSSL-Win32") set(QT5_PATH "C:/dev/Qt/5.7/msvc2013") set(VSREDIST "vcredist_x86.exe") # Choose between SQLCipher or SQLite, depending whether # -Dsqlcipher=1 is passed on the command line if(sqlcipher) set(SQLITE3_PATH "C:/git_repos/SQLCipher-Win32") else() set(SQLITE3_PATH "C:/dev/SQLite-Win32") endif() endif() set(CMAKE_PREFIX_PATH "${QT5_PATH};${SQLITE3_PATH}") set(VSREDIST_DIR "C:/dev/dependencies") endif() if(NOT FORCE_INTERNAL_ANTLR) find_package(Antlr2) endif() if(NOT FORCE_INTERNAL_QSCINTILLA) find_package(QScintilla) endif() set(QHEXEDIT_DIR libs/qhexedit) set(QCUSTOMPLOT_DIR libs/qcustomplot-source) if(NOT ANTLR2_FOUND) set(ANTLR_DIR libs/antlr-2.7.7) add_subdirectory(${ANTLR_DIR}) endif() if(NOT QSCINTILLA_FOUND) set(QSCINTILLA_DIR libs/qscintilla/Qt4Qt5) add_subdirectory(${QSCINTILLA_DIR}) endif() add_subdirectory(${QHEXEDIT_DIR}) add_subdirectory(${QCUSTOMPLOT_DIR}) find_package(Qt5Widgets REQUIRED) find_package(Qt5LinguistTools REQUIRED) find_package(Qt5Network REQUIRED) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) if(ENABLE_TESTING) enable_testing() endif() set(SQLB_HDR src/version.h src/sqlitetypes.h src/csvparser.h src/sqlite.h src/grammar/sqlite3TokenTypes.hpp src/grammar/Sqlite3Lexer.hpp src/grammar/Sqlite3Parser.hpp ) set(SQLB_MOC_HDR src/sqlitedb.h src/AboutDialog.h src/EditIndexDialog.h src/EditDialog.h src/EditTableDialog.h src/ExportDataDialog.h src/ExtendedTableWidget.h src/FilterTableHeader.h src/ImportCsvDialog.h src/MainWindow.h src/Settings.h src/PreferencesDialog.h src/SqlExecutionArea.h src/VacuumDialog.h src/sqlitetablemodel.h src/sqltextedit.h src/DbStructureModel.h src/Application.h src/CipherDialog.h src/ExportSqlDialog.h src/SqlUiLexer.h src/FileDialog.h src/ColumnDisplayFormatDialog.h src/FilterLineEdit.h src/RemoteDatabase.h src/ForeignKeyEditorDelegate.h src/PlotDock.h src/RemoteDock.h src/RemoteModel.h src/RemotePushDialog.h ) set(SQLB_SRC src/AboutDialog.cpp src/EditIndexDialog.cpp src/EditDialog.cpp src/EditTableDialog.cpp src/ExportDataDialog.cpp src/ExtendedTableWidget.cpp src/FilterTableHeader.cpp src/ImportCsvDialog.cpp src/MainWindow.cpp src/Settings.cpp src/PreferencesDialog.cpp src/SqlExecutionArea.cpp src/VacuumDialog.cpp src/sqlitedb.cpp src/sqlitetablemodel.cpp src/sqlitetypes.cpp src/sqltextedit.cpp src/csvparser.cpp src/DbStructureModel.cpp src/grammar/Sqlite3Lexer.cpp src/grammar/Sqlite3Parser.cpp src/main.cpp src/Application.cpp src/CipherDialog.cpp src/ExportSqlDialog.cpp src/SqlUiLexer.cpp src/FileDialog.cpp src/ColumnDisplayFormatDialog.cpp src/FilterLineEdit.cpp src/RemoteDatabase.cpp src/ForeignKeyEditorDelegate.cpp src/PlotDock.cpp src/RemoteDock.cpp src/RemoteModel.cpp src/RemotePushDialog.cpp ) set(SQLB_FORMS src/AboutDialog.ui src/EditIndexDialog.ui src/EditDialog.ui src/EditTableDialog.ui src/ExportDataDialog.ui src/ImportCsvDialog.ui src/MainWindow.ui src/PreferencesDialog.ui src/SqlExecutionArea.ui src/VacuumDialog.ui src/CipherDialog.ui src/ExportSqlDialog.ui src/ColumnDisplayFormatDialog.ui src/PlotDock.ui src/RemoteDock.ui src/RemotePushDialog.ui ) set(SQLB_RESOURCES src/icons/icons.qrc src/translations/flags/flags.qrc src/translations/translations.qrc src/certs/CaCerts.qrc ) set(SQLB_MISC src/grammar/sqlite3.g ) # Translation files set(SQLB_TSS "${CMAKE_SOURCE_DIR}/src/translations/sqlb_ar_SA.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_cs.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_zh.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_zh_TW.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_de.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_es_ES.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_fr.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_ru.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_pt_BR.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_en_GB.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_ko_KR.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_tr.ts" "${CMAKE_SOURCE_DIR}/src/translations/sqlb_uk_UA.ts" ) qt5_wrap_ui(SQLB_FORM_HDR ${SQLB_FORMS}) if(SQLB_TSS) # add translations foreach(SQLB_TS ${SQLB_TSS}) SET_SOURCE_FILES_PROPERTIES("${SQLB_TS}" PROPERTIES OUTPUT_LOCATION "${CMAKE_SOURCE_DIR}/src/translations") endforeach(SQLB_TS ${SQLB_TSS}) qt5_add_translation(SQLB_QMS ${SQLB_TSS}) endif(SQLB_TSS) qt5_add_resources(SQLB_RESOURCES_RCC ${SQLB_RESOURCES}) #icon and correct libs/subsystem for windows if(WIN32) #enable version check for windows add_definitions(-DCHECKNEWVERSION) IF( MINGW ) # resource compilation for MinGW ADD_CUSTOM_COMMAND(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o" COMMAND windres "-I${CMAKE_CURRENT_SOURCE_DIR}" "-i${CMAKE_CURRENT_SOURCE_DIR}/src/winapp.rc" -o "${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o" VERBATIM) set(SQLB_SRC ${SQLB_SRC} "${CMAKE_CURRENT_BINARY_DIR}/sqlbicon.o") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-subsystem,windows") set(WIN32_STATIC_LINK -Wl,-Bstatic -lssl -lcrypto -lws2_32) set(ADDITIONAL_LIBS lzma) ELSE( MINGW ) set(SQLB_SRC ${SQLB_SRC} "${CMAKE_CURRENT_SOURCE_DIR}/src/winapp.rc") ENDIF( MINGW ) endif(WIN32) #enable version check for MacOS if(APPLE) add_definitions(-DCHECKNEWVERSION) endif(APPLE) # SQLCipher option if(sqlcipher) add_definitions(-DENABLE_SQLCIPHER) set(LIBSQLITE_NAME sqlcipher) else(sqlcipher) set(LIBSQLITE_NAME sqlite3) endif(sqlcipher) # add extra library path for MacOS and FreeBSD set(EXTRAPATH APPLE OR ${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") if(EXTRAPATH) find_library(LIBSQLITE ${LIBSQLITE_NAME} HINTS /usr/local/lib /usr/local/opt/sqlite/lib) set(ADDITIONAL_INCLUDE_PATHS /usr/local/include /usr/local/opt/sqlite/include) else(EXTRAPATH) find_library(LIBSQLITE ${LIBSQLITE_NAME}) endif(EXTRAPATH) if(WIN32 AND MSVC) find_path(SQLITE3_INCLUDE_DIR sqlite3.h) if(sqlcipher) find_file(SQLITE3_DLL sqlcipher.dll) else(sqlcipher) find_file(SQLITE3_DLL sqlite3.dll) endif(sqlcipher) include_directories(${SQLITE3_INCLUDE_DIR}) endif() include_directories( "${CMAKE_CURRENT_BINARY_DIR}" ${QHEXEDIT_DIR} ${QCUSTOMPLOT_DIR} ${ADDITIONAL_INCLUDE_PATHS} src) if(ANTLR2_FOUND) include_directories(${ANTLR2_INCLUDE_DIRS}) else() include_directories(${ANTLR_DIR}) endif() if(QSCINTILLA_FOUND) include_directories(${QSCINTILLA_INCLUDE_DIR}) else() include_directories(${QSCINTILLA_DIR}) endif() add_executable(${PROJECT_NAME} ${SQLB_HDR} ${SQLB_SRC} ${SQLB_FORM_HDR} ${SQLB_MOC} ${SQLB_RESOURCES_RCC} ${SQLB_MISC}) qt5_use_modules(${PROJECT_NAME} Gui Widgets Network Test PrintSupport) set(QT_LIBRARIES "") add_dependencies(${PROJECT_NAME} qhexedit qcustomplot) if(NOT ANTLR2_FOUND) add_dependencies(${PROJECT_NAME} antlr) endif() if(NOT QSCINTILLA_FOUND) add_dependencies(${PROJECT_NAME} qscintilla2) endif() link_directories( "${CMAKE_CURRENT_BINARY_DIR}/${QHEXEDIT_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/${QCUSTOMPLOT_DIR}" ) if(NOT ANTLR2_FOUND) link_directories("${CMAKE_CURRENT_BINARY_DIR}/${ANTLR_DIR}") endif() if(NOT QSCINTILLA_FOUND) link_directories("${CMAKE_CURRENT_BINARY_DIR}/${QSCINTILLA_DIR}") endif() target_link_libraries(${PROJECT_NAME} qhexedit qcustomplot ${QT_LIBRARIES} ${WIN32_STATIC_LINK} ${LIBSQLITE} ${ADDITIONAL_LIBS}) if(ANTLR2_FOUND) target_link_libraries(${PROJECT_NAME} ${ANTLR2_LIBRARIES}) else() target_link_libraries(${PROJECT_NAME} antlr) endif() if(QSCINTILLA_FOUND) target_link_libraries(${PROJECT_NAME} ${QSCINTILLA_LIBRARIES}) else() target_link_libraries(${PROJECT_NAME} qscintilla2) endif() if(WIN32 AND MSVC) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE") set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS_DEBUG "_CONSOLE") set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELWITHDEBINFO "/SUBSYSTEM:CONSOLE") set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_DEFINITIONS_RELWITHDEBINFO "_CONSOLE") if(CMAKE_CL_64) set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS,5.02 /ENTRY:mainCRTStartup") set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS,5.02") else() set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS,5.01 /ENTRY:mainCRTStartup") set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS_MINSIZEREL "/SUBSYSTEM:WINDOWS,5.01") endif() endif() if(NOT WIN32) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin LIBRARY DESTINATION lib) endif() if(ENABLE_TESTING) add_subdirectory(src/tests) endif() if(UNIX AND NOT APPLE) install(FILES src/icons/${PROJECT_NAME}.png DESTINATION share/icons/hicolor/256x256/apps/) install(FILES distri/${PROJECT_NAME}.desktop DESTINATION share/applications/) install(FILES distri/${PROJECT_NAME}.desktop.appdata.xml DESTINATION share/appdata/) endif(UNIX AND NOT APPLE) if(WIN32 AND MSVC) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "/" LIBRARY DESTINATION lib) set(QT5_BIN_PATH ${QT5_PATH}/bin) # The Qt5 Debug configuration library files have a 'd' postfix install(FILES ${QT5_BIN_PATH}/Qt5Cored.dll ${QT5_BIN_PATH}/Qt5Guid.dll ${QT5_BIN_PATH}/Qt5Networkd.dll ${QT5_BIN_PATH}/Qt5PrintSupportd.dll ${QT5_BIN_PATH}/Qt5Widgetsd.dll DESTINATION "/" CONFIGURATIONS Debug) # The Qt5 Release configuration files don't have a postfix install(FILES ${QT5_BIN_PATH}/Qt5Core.dll ${QT5_BIN_PATH}/Qt5Gui.dll ${QT5_BIN_PATH}/Qt5Network.dll ${QT5_BIN_PATH}/Qt5PrintSupport.dll ${QT5_BIN_PATH}/Qt5Widgets.dll DESTINATION "/" CONFIGURATIONS Release) # The files below are common to all configurations install(FILES ${SQLITE3_DLL} ${OPENSSL_PATH}/libeay32.dll ${OPENSSL_PATH}/ssleay32.dll DESTINATION "/") install(FILES ${QT5_PATH}/plugins/platforms/qwindows.dll DESTINATION platforms) install(PROGRAMS "${VSREDIST_DIR}/${VSREDIST}" DESTINATION redist) # The batch file launcher install(FILES distri/winlaunch.bat DESTINATION "/") endif() #cpack set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "DB Browser for SQLite") set(CPACK_PACKAGE_VENDOR "DB Browser for SQLite Team") set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") set(CPACK_PACKAGE_VERSION_MAJOR "3") set(CPACK_PACKAGE_VERSION_MINOR "10") set(CPACK_PACKAGE_VERSION_PATCH "1") set(CPACK_PACKAGE_INSTALL_DIRECTORY "DB Browser for SQLite") if(WIN32 AND NOT UNIX) # There is a bug in NSIS that does not handle full unix paths properly. Make # sure there is at least one set of four (4) backlasshes. set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\src\\\\iconwin.ico") set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\src\\\\iconwin.ico") set(CPACK_NSIS_EXECUTABLES_DIRECTORY "/") set(CPACK_NSIS_INSTALLED_ICON_NAME "DB Browser for SQLite.exe") set(CPACK_NSIS_DISPLAY_NAME "DB Browser for SQLite") set(CPACK_NSIS_HELP_LINK "https:\\\\\\\\github.com\\\\sqlitebrowser\\\\sqlitebrowser") set(CPACK_NSIS_URL_INFO_ABOUT "https:\\\\\\\\github.com\\\\sqlitebrowser\\\\sqlitebrowser") set(CPACK_NSIS_CONTACT "justin@postgresql.org") set(CPACK_NSIS_MODIFY_PATH OFF) set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) set(CPACK_NSIS_MUI_FINISHPAGE_RUN "winlaunch.bat") set(CPACK_NSIS_COMPRESSOR "/SOLID lzma") # VS redist list(APPEND CPACK_NSIS_EXTRA_INSTALL_COMMANDS " ExecWait '\\\"$INSTDIR\\\\redist\\\\${VSREDIST}\\\" /install /passive /norestart /quiet' Delete '\\\"$INSTDIR\\\\redist\\\\${VSREDIST}\\\"' ") else(WIN32 AND NOT UNIX) set(CPACK_STRIP_FILES "DB Browser for SQLite") set(CPACK_SOURCE_STRIP_FILES "") endif(WIN32 AND NOT UNIX) set(CPACK_PACKAGE_EXECUTABLES "DB Browser for SQLite" "DB Browser for SQLite") include(CPack) sqlitebrowser-3.10.1/LICENSE000066400000000000000000001460161316047212700155210ustar00rootroot00000000000000DB Browser for SQLite is bi-licensed under the Mozilla Public License Version 2, as well as the GNU General Public License Version 3 or later. You can modify or redistribute it under the conditions of these licenses. ----------------------------------------------------------------------- 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 . ----------------------------------------------------------------------- Mozilla Public License Version 2.0 ================================== 1. Definitions -------------- 1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. 1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. 1.3. "Contribution" means Covered Software of a particular Contributor. 1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. 1.5. "Incompatible With Secondary Licenses" means (a) that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or (b) that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. 1.6. "Executable Form" means any form of the work other than Source Code Form. 1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. 1.8. "License" means this document. 1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. 1.10. "Modifications" means any of the following: (a) any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or (b) any new file in Source Code Form that contains any Covered Software. 1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. 1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. 1.13. "Source Code Form" means the form of the work preferred for making modifications. 1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. 2. License Grants and Conditions -------------------------------- 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: (a) under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and (b) under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: (a) for any code that a Contributor has removed from Covered Software; or (b) for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or (c) under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. 3. Responsibilities ------------------- 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: (a) such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and (b) You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. 4. Inability to Comply Due to Statute or Regulation --------------------------------------------------- If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. 5. Termination -------------- 5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. 5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ************************************************************************ * * * 6. Disclaimer of Warranty * * ------------------------- * * * * Covered Software is provided under this License on an "as is" * * basis, without warranty of any kind, either expressed, implied, or * * statutory, including, without limitation, warranties that the * * Covered Software is free of defects, merchantable, fit for a * * particular purpose or non-infringing. The entire risk as to the * * quality and performance of the Covered Software is with You. * * Should any Covered Software prove defective in any respect, You * * (not any Contributor) assume the cost of any necessary servicing, * * repair, or correction. This disclaimer of warranty constitutes an * * essential part of this License. No use of any Covered Software is * * authorized under this License except under this disclaimer. * * * ************************************************************************ ************************************************************************ * * * 7. Limitation of Liability * * -------------------------- * * * * Under no circumstances and under no legal theory, whether tort * * (including negligence), contract, or otherwise, shall any * * Contributor, or anyone who distributes Covered Software as * * permitted above, be liable to You for any direct, indirect, * * special, incidental, or consequential damages of any character * * including, without limitation, damages for lost profits, loss of * * goodwill, work stoppage, computer failure or malfunction, or any * * and all other commercial damages or losses, even if such party * * shall have been informed of the possibility of such damages. This * * limitation of liability shall not apply to liability for death or * * personal injury resulting from such party's negligence to the * * extent applicable law prohibits such limitation. Some * * jurisdictions do not allow the exclusion or limitation of * * incidental or consequential damages, so this exclusion and * * limitation may not apply to You. * * * ************************************************************************ 8. Litigation ------------- Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. 9. Miscellaneous ---------------- This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. 10. Versions of the License --------------------------- 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. Exhibit A - Source Code Form License Notice ------------------------------------------- This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. Exhibit B - "Incompatible With Secondary Licenses" Notice --------------------------------------------------------- This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. sqlitebrowser-3.10.1/README.md000066400000000000000000000231051316047212700157640ustar00rootroot00000000000000# DB Browser for SQLite [![Build Status][travis-img]][travis] [![Join the chat at https://gitter.im/sqlitebrowser/sqlitebrowser][gitter-img]][gitter] [![Download][download-img]][download] [![Qt][qt-img]][qt] [![Coverity][coverity-img]][coverity] ![DB Browser for SQLite Screenshot](https://github.com/sqlitebrowser/sqlitebrowser/raw/master/images/sqlitebrowser.png "DB Browser for SQLite Screenshot") ## What it is DB Browser for SQLite is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite. It is for users and developers wanting to create databases, search, and edit data. It uses a familiar spreadsheet-like interface, and you don't need to learn complicated SQL commands. Controls and wizards are available for users to: * Create and compact database files * Create, define, modify and delete tables * Create, define and delete indexes * Browse, edit, add and delete records * Search records * Import and export records as text * Import and export tables from/to CSV files * Import and export databases from/to SQL dump files * Issue SQL queries and inspect the results * Examine a log of all SQL commands issued by the application ## What it is not This program is not a visual shell for the sqlite command line tool. It does not require familiarity with SQL commands. It is a tool to be used both by developers and by end users, and it must remain as simple to use as possible in order to achieve its goals. ## Nightly builds Nightly builds for Windows and OSX can be downloaded here: * https://nightlies.sqlitebrowser.org/latest ## Windows Windows releases can be downloaded here: * https://github.com/sqlitebrowser/sqlitebrowser/releases **Note** - If for some reason the standard Windows release doesn't work for you (eg it gives an error), try a nightly build. They often fix bugs reported after the last release. :D ## MacOS X DB Browser for SQLite works well on MacOS X. * OSX 10.8 (Mountain Lion) - 10.12 (Sierra) are tested and known to work OSX releases can be downloaded here: * https://github.com/sqlitebrowser/sqlitebrowser/releases Latest OSX binary can be installed via [Homebrew Cask](https://caskroom.github.io/ "Homebrew Cask"): ``` brew cask install sqlitebrowser ``` ## Linux DB Browser for SQLite works well on Linux. ### Arch Linux Arch Linux provides a package through pacman. ### Fedora For Fedora (i386 and x86_64) you can install by issuing: $ sudo dnf install sqlitebrowser ### Ubuntu and Derivatives #### Stable release For Ubuntu and derivaties, [@deepsidhu1313](https://github.com/deepsidhu1313) provides a PPA with our latest release here: * https://launchpad.net/~linuxgndu/+archive/ubuntu/sqlitebrowser To add this ppa just type in these commands in terminal: sudo add-apt-repository -y ppa:linuxgndu/sqlitebrowser Then update the cache using: sudo apt-get update Install the package using: sudo apt-get install sqlitebrowser Ubuntu 14.04.X, 15.04.X, 15.10.X and 16.04.X are supported for now (until Launchpad decides to discontinue building for any series). Ubuntu Precise (12.04) and Utopic (14.10) are not supported: * Precise doesn't have a new enough Qt package in its repository by default, which is a dependency * Launchpad doesn't support Utopic any more, as that has reached its End of Life #### Nightly builds Nightly builds are available here: * https://launchpad.net/~linuxgndu/+archive/ubuntu/sqlitebrowser-testing To add this ppa just type in these commands in terminal: sudo add-apt-repository -y ppa:linuxgndu/sqlitebrowser-testing Then update the cache using: sudo apt-get update Install the package using: sudo apt-get install sqlitebrowser ### Other Linux On others you'll need to compile it yourself using the (simple) instructions in [BUILDING.md](BUILDING.md). ## FreeBSD DB Browser for SQLite works well on FreeBSD, and there is a port for it (thanks to [lbartoletti](https://github.com/lbartoletti) :smile:). It can be installed using either this: # make -C /usr/ports/databases/sqlitebrowser install or this: # pkg install sqlitebrowser ### Compiling Instructions for compiling on (at least) Windows, OSX, Linux, and FreeBSD are in [BUILDING](BUILDING.md). ## Developer mailing list For development related discussion about DB4S and DBHub.io: * https://lists.sqlitebrowser.org/mailman/listinfo/db4s-dev ## Twitter Follow us on Twitter: https://twitter.com/sqlitebrowser ## Website * http://sqlitebrowser.org ## Old project page * https://sourceforge.net/projects/sqlitebrowser ## Releases * [Version 3.9.1 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.9.1) - 2016-10-03 * [Version 3.9.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.9.0) - 2016-08-24 * [Version 3.8.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.8.0) - 2015-12-25 * [Version 3.7.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.7.0) - 2015-06-14 * [Version 3.6.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.6.0) - 2015-04-27 * [Version 3.5.1 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.5.1) - 2015-02-08 * [Version 3.5.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.5.0) - 2015-01-31 * [Version 3.4.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.4.0) - 2014-10-29 * [Version 3.3.1 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.3.1) - 2014-08-31 - Project renamed from "SQLite Database Browser" * [Version 3.3.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/v3.3.0) - 2014-08-24 * [Version 3.2.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/sqlb-3.2.0) - 2014-07-06 * [Version 3.1.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/sqlb-3.1.0) - 2014-05-17 * [Version 3.0.3 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/sqlb-3.0.3) - 2014-04-28 * [Version 3.0.2 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/sqlb-3.0.2) - 2014-02-12 * [Version 3.0.1 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/sqlb-3.0.1) - 2013-12-02 * [Version 3.0 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/sqlb-3.0) - 2013-09-15 * [Version 3.0rc1 released](https://github.com/sqlitebrowser/sqlitebrowser/releases/tag/rc1) - 2013-09-09 - Project now on GitHub * Version 2.0b1 released - 2009-12-10 - Based on Qt4.6 * Version 1.2 released - 2005-04-05 * Version 1.1 released - 2004-07-20 * Version 1.01 released - 2003-10-02 * Version 1.0 released to public domain - 2003-08-19 ## History This program was developed originally by Mauricio Piacentini ([@piacentini](https://github.com/piacentini)) from Tabuleiro Producoes, as the Arca Database Browser. The original version was used as a free companion tool to the Arca Database Xtra, a commercial product that embeds SQLite databases with some additional extensions to handle compressed and binary data. The original code was trimmed and adjusted to be compatible with standard SQLite 2.x databases. The resulting program was renamed SQLite Database Browser, and released into the Public Domain by Mauricio. Icons were contributed by [Raquel Ravanini](http://www.raquelravanini.com), also from Tabuleiro. Jens Miltner ([@jmiltner](https://github.com/jmiltner)) contributed the code to support SQLite 3.x databases for the 1.2 release. Pete Morgan ([@daffodil](https://github.com/daffodil)) created an initial project on GitHub with the code in 2012, where several contributors fixed and improved pieces over the years. René Peinthor ([@rp-](https://github.com/rp-)) and Martin Kleusberg ([@MKleusberg](https://github.com/MKleusberg)) then became involved, and have been the main driving force from that point. Justin Clift ([@justinclift](https://github.com/justinclift)) helps out with testing on OSX, and started the new github.com/sqlitebrowser organisation on GitHub. [John T. Haller](http://johnhaller.com), of [PortableApps.com](http://portableapps.com) fame, created the new logo. He based it on the Tango icon set (public domain). In August 2014, the project was renamed to "Database Browser for SQLite" at the request of [Richard Hipp](http://www.hwaci.com/drh) (creator of [SQLite](http://sqlite.org)), as the previous name was creating unintended support issues. In September 2014, the project was renamed to "DB Browser for SQLite", to avoid confusion with an existing application called "Database Browser". ## Contributors You can see the list by going to the [__Contributors__ tab](https://github.com/sqlitebrowser/sqlitebrowser/graphs/contributors). ## License DB Browser for SQLite is bi-licensed under the Mozilla Public License Version 2, as well as the GNU General Public License Version 3 or later. You can modify or redistribute it under the conditions of these licenses. [travis-img]: https://travis-ci.org/sqlitebrowser/sqlitebrowser.svg?branch=master [travis]: https://travis-ci.org/sqlitebrowser/sqlitebrowser [gitter-img]: https://badges.gitter.im/sqlitebrowser/sqlitebrowser.svg [gitter]: https://gitter.im/sqlitebrowser/sqlitebrowser?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge [download-img]: https://img.shields.io/github/downloads/sqlitebrowser/sqlitebrowser/total.svg [download]: https://github.com/sqlitebrowser/sqlitebrowser/releases [qt-img]: https://img.shields.io/badge/Qt-qmake-green.svg [qt]: https://www.qt.io [coverity-img]: https://img.shields.io/coverity/scan/11712.svg [coverity]: https://scan.coverity.com/projects/sqlitebrowser-sqlitebrowser sqlitebrowser-3.10.1/cmake/000077500000000000000000000000001316047212700155645ustar00rootroot00000000000000sqlitebrowser-3.10.1/cmake/FindAntlr2.cmake000066400000000000000000000041361316047212700205350ustar00rootroot00000000000000# - try to find Antlr v2 # Once done this will define: # # ANTLR2_FOUND - system has antlr2 # ANTLR2_INCLUDE_DIRS - the include directories for antlr2 # ANTLR2_LIBRARIES - Link these to use antl2 # ANTLR2_EXECUTABLE - The 'antlr' or 'runantlr' executable # Copyright (C) 2015, Pino Toscano, # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. find_library(ANTLR2_LIBRARY antlr) set(ANTLR2_LIBRARIES "${ANTLR2_LIBRARY}") find_path(ANTLR2_INCLUDE_DIR antlr/AST.hpp) set(ANTLR2_INCLUDE_DIRS "${ANTLR2_INCLUDE_DIR}") include(FindPackageHandleStandardArgs) find_package_handle_standard_args(Antlr2 DEFAULT_MSG ANTLR2_LIBRARIES ANTLR2_INCLUDE_DIRS) find_program(ANTLR2_EXECUTABLE NAMES runantlr runantlr2 antlr) mark_as_advanced( ANTLR2_INCLUDE_DIRS ANTLR2_LIBRARIES ANTLR2_EXECUTABLE ) sqlitebrowser-3.10.1/cmake/FindQScintilla.cmake000066400000000000000000000116001316047212700214300ustar00rootroot00000000000000# QScintilla is a port to Qt of Neil Hodgson's Scintilla C++ editor control # available at http://www.riverbankcomputing.com/software/qscintilla/ # # The module defines the following variables: # QSCINTILLA_FOUND - the system has QScintilla # QSCINTILLA_INCLUDE_DIR - where to find qsciscintilla.h # QSCINTILLA_INCLUDE_DIRS - qscintilla includes # QSCINTILLA_LIBRARY - where to find the QScintilla library # QSCINTILLA_LIBRARIES - aditional libraries # QSCINTILLA_MAJOR_VERSION - major version # QSCINTILLA_MINOR_VERSION - minor version # QSCINTILLA_PATCH_VERSION - patch version # QSCINTILLA_VERSION_STRING - version (ex. 2.6.2) # QSCINTILLA_ROOT_DIR - root dir (ex. /usr/local) #============================================================================= # Copyright 2010-2013, Julien Schueller # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # The views and conclusions contained in the software and documentation are those # of the authors and should not be interpreted as representing official policies, # either expressed or implied, of the FreeBSD Project. #============================================================================= find_path ( QSCINTILLA_INCLUDE_DIR NAMES qsciscintilla.h HINTS ${QT_INCLUDE_DIR} PATH_SUFFIXES Qsci ) set ( QSCINTILLA_INCLUDE_DIRS ${QSCINTILLA_INCLUDE_DIR} ) # version set ( _VERSION_FILE ${QSCINTILLA_INCLUDE_DIR}/Qsci/qsciglobal.h ) if ( EXISTS ${_VERSION_FILE} ) file ( STRINGS ${_VERSION_FILE} _VERSION_LINE REGEX "define[ ]+QSCINTILLA_VERSION_STR" ) if ( _VERSION_LINE ) string ( REGEX REPLACE ".*define[ ]+QSCINTILLA_VERSION_STR[ ]+\"(.*)\".*" "\\1" QSCINTILLA_VERSION_STRING "${_VERSION_LINE}" ) string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" QSCINTILLA_MAJOR_VERSION "${QSCINTILLA_VERSION_STRING}" ) string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" QSCINTILLA_MINOR_VERSION "${QSCINTILLA_VERSION_STRING}" ) string ( REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" QSCINTILLA_PATCH_VERSION "${QSCINTILLA_VERSION_STRING}" ) endif () endif () # check version set ( _QSCINTILLA_VERSION_MATCH TRUE ) if ( QScintilla_FIND_VERSION AND QSCINTILLA_VERSION_STRING ) if ( QScintilla_FIND_VERSION_EXACT ) if ( NOT QScintilla_FIND_VERSION VERSION_EQUAL QSCINTILLA_VERSION_STRING ) set ( _QSCINTILLA_VERSION_MATCH FALSE ) endif () else () if ( QSCINTILLA_VERSION_STRING VERSION_LESS QScintilla_FIND_VERSION ) set ( _QSCINTILLA_VERSION_MATCH FALSE ) endif () endif () endif () find_library ( QSCINTILLA_LIBRARY NAMES qscintilla qscintilla2 libqscintilla2 HINTS ${QT_LIBRARY_DIR} ) set ( QSCINTILLA_LIBRARIES ${QSCINTILLA_LIBRARY} ) # try to guess root dir from include dir if ( QSCINTILLA_INCLUDE_DIR ) string ( REGEX REPLACE "(.*)/include.*" "\\1" QSCINTILLA_ROOT_DIR ${QSCINTILLA_INCLUDE_DIR} ) # try to guess root dir from library dir elseif ( QSCINTILLA_LIBRARY ) string ( REGEX REPLACE "(.*)/lib[/|32|64].*" "\\1" QSCINTILLA_ROOT_DIR ${QSCINTILLA_LIBRARY} ) endif () # handle the QUIETLY and REQUIRED arguments include ( FindPackageHandleStandardArgs ) if ( CMAKE_VERSION VERSION_LESS 2.8.3 ) find_package_handle_standard_args( QScintilla DEFAULT_MSG QSCINTILLA_LIBRARY QSCINTILLA_INCLUDE_DIR _QSCINTILLA_VERSION_MATCH ) else () find_package_handle_standard_args( QScintilla REQUIRED_VARS QSCINTILLA_LIBRARY QSCINTILLA_INCLUDE_DIR _QSCINTILLA_VERSION_MATCH VERSION_VAR QSCINTILLA_VERSION_STRING ) endif () mark_as_advanced ( QSCINTILLA_LIBRARY QSCINTILLA_LIBRARIES QSCINTILLA_INCLUDE_DIR QSCINTILLA_INCLUDE_DIRS QSCINTILLA_MAJOR_VERSION QSCINTILLA_MINOR_VERSION QSCINTILLA_PATCH_VERSION QSCINTILLA_VERSION_STRING QSCINTILLA_ROOT_DIR ) sqlitebrowser-3.10.1/currentrelease000066400000000000000000000000771316047212700174560ustar00rootroot000000000000003.9.1 https://github.com/sqlitebrowser/sqlitebrowser/releases sqlitebrowser-3.10.1/distri/000077500000000000000000000000001316047212700160025ustar00rootroot00000000000000sqlitebrowser-3.10.1/distri/sqlitebrowser.desktop000066400000000000000000000006641316047212700223100ustar00rootroot00000000000000[Desktop Entry] Name=DB Browser for SQLite Comment=DB Browser for SQLite is a light GUI editor for SQLite databases Comment[de]=DB Browser for SQLite ist ein GUI-Editor für SQLite-Datenbanken Exec=sqlitebrowser %f Icon=sqlitebrowser Terminal=false X-MultipleArgs=false Type=Application Categories=Development;Utility;Database; MimeType=application/sqlitebrowser;application/x-sqlitebrowser;application/x-sqlite2;application/x-sqlite3; sqlitebrowser-3.10.1/distri/sqlitebrowser.desktop.appdata.xml000066400000000000000000000045461316047212700245230ustar00rootroot00000000000000 sqlitebrowser.desktop CC0-1.0 MPL-2.0 and GPL-3.0+ DB Browser for SQLite DB Browser for SQLite is a light GUI editor for SQLite databases

DB Browser for SQLite is a high quality, visual, open source tool to create, design, and edit database files compatible with SQLite.

It is for users and developers wanting to create databases, search, and edit data. It uses a familiar spreadsheet-like interface, and you don't need to learn complicated SQL commands.

Controls and wizards are available for users to:

  • Create and compact database files
  • Create, define, modify and delete tables
  • Create, define and delete indexes
  • Browse, edit, add and delete records
  • Search records
  • Import and export records as text
  • Import and export tables from/to CSV files
  • Import and export databases from/to SQL dump files
  • Issue SQL queries and inspect the results
  • Examine a log of all SQL commands issued by the application
https://raw.githubusercontent.com/sqlitebrowser/db4s-screenshots/master/v3.3/gnome3_2-execute.png DB Browser for SQLite, executing query https://raw.githubusercontent.com/sqlitebrowser/db4s-screenshots/master/v3.3/gnome3_1-plot.png DB Browser for SQLite, browsing data with plot https://raw.githubusercontent.com/sqlitebrowser/db4s-screenshots/master/v3.3/kde413_2-blob.png DB Browser for SQLite, browsing a blob field https://raw.githubusercontent.com/sqlitebrowser/db4s-screenshots/master/v3.3/kde413_1-create_table.png DB Browser for SQLite, creating a table http://sqlitebrowser.org/ https://github.com/sqlitebrowser/sqlitebrowser/issues
sqlitebrowser-3.10.1/distri/winlaunch.bat000066400000000000000000000000621316047212700204600ustar00rootroot00000000000000%WINDIR%\explorer.exe "DB Browser for SQLite.exe" sqlitebrowser-3.10.1/images/000077500000000000000000000000001316047212700157515ustar00rootroot00000000000000sqlitebrowser-3.10.1/images/sqlitebrowser.png000066400000000000000000003435021316047212700213730ustar00rootroot00000000000000PNG  IHDRWtiCCPICC Profile1K@*ڡHEuhSڂJUP[i$E.:~]AA HSq޻?%D;nmvY*f@y{¬V7I2f ޡȫ7]#i)bC/#_H~"NAO͈%CVe)iwV qfyɼe5HS!֢?ӕ2 :A/;X͆z%Q&ρYާ=p btU@IDATx]Umc٥ދbƨXcD[{oآ[4X"*Xҗ{vDqwΜ6gG#x<G`x<G#xO:x<G##>^GG#x<G'~ x<G#xT##x<G#j<G#x<눀O@ox<G#H4+ͳG#x~ze3fL[/ /7cuxUG#x<k/-)Y&>q^<G#l~ O>ހ cl2߅G#x<1zK[0IFg}@G# h$d$uHw⼾ G#x<?!Z$!N2޵SH7ڤz-uMp>"G#x<?[*Qvhƚ`otIu3&w{ 7<G#l$4+Mss4YcK7z=$kM5EG#x~49vhMStC&-L7%)n3u9G#x<0MNp#cl]c:1-nbBX2rMB2?dG#x<;ɒd2U+Iu $ɒd2Nh]=''O:ċOOA5z0Df<~jES%W'=G#liq&JV]=vm]>m#ꨝgi^m֮N2>e뭬;IRGDD|OT2TҮL|EmծKrv<:YK'-TpBDW@pۤmꉧ:|xzQ~EDuͦ){#x<zB 1W_U/:ZK&ڬU$SMKk'ߢoIu19(mK'r&ߥzMG#x~DT年D|jW5T@+%VXR.u4YmjՋjh'Zu<+'wy%j/y"x<G#1 ɬ *bW&ZƤvv%Om-DJ[$nMJtvaƚzB96nWONmE7{pTMmwv<ꨣږUUUĒ'U֪uBIMM|䛵ۧܓ/ɗxԍW(g";'ZOvIOv|V|_cںGE1^cm'N˚fXdzϵ.՟[xhO<d];Y˯tiRg?KOmK?ϭ'u/f.yŢ%phj7aPs*G|I:˯jٲ-}Ѯ(ͶbBT5ۢ%g[y7ٲ&:YkiN%OҥZlK_'J?Ϗs}׿]6OsNvD2Ov,PZ/wu%}Z'ն׼r=Fyn[tsj{a;en'mRИESq(%sym:kqyQ[ɣg8ؖOc_XX A?Im2ӯKr[coõ!xi/sCoQ\\\'[nS4}/'}(qy5~vۥ]D9ȯh٩˟KSEccsOXkM9ҥ\2Gڝ a-=,_uV?5_]ꃵV߮ 8ep];gJZ{ExE}ȧ^զS1ۍ|胶,%-Se"=,YuV|ڱo(C]s˟PO6Gz;!5pۤN$suԚ]K4KMB[᪪m45V-+YGgٹ|{P->BtTtj!RW&ZsSӆҗ}>i#SnܔȞۗboYM|Cie6q yfaM6OtI|B>'׶m'5%kGAAAǗA|ڵ[C_Ж_ 씈M;. aaU^^^GOnQL^}k+iCOII k&t^ulu )_[];F]{@Q,j-ArOzu| ۆ86 7 ۢeǚŐc~'^ŒpMKN h V!MXن`faެ_͙uS+|ܴزo;@ݗf& u])c?]w{4e)״uYYDnє\sS0Q,mꐩ~6>~U*Ӄ(ڎǗ(-GQ:ꫯrʸ.\ӧOO]\mf/ɓ'xmpK/XHK>xwmLKCPSW)nDSW#rّ~.b}"9L}QY:eaP2xݑV`~GoWc[t_ǰ΁A,V 69 ?`軦v Nڣo(u B\ ރwm}uZ̶oVm3mU5}֍|v M]>ݍw h}vL[Z3I_6夵¾4~hCv5jQ|9!G1f{7vs.FEYSG[?UƯqw!s1j@6J翋c:jkS3رc%jCsIekMK㗍:C&_mf;ʓdSW~',V\x?Dڱ/1&^{5xѺdNpnAOaaL}-Q塹$Bzc{th,lk4oC$\K럴σ .m͠ #@C_ ѬY0jDѶdjC hʥ#ڭ郠JGtfa[2Eʅk7i.e* /46$LxGMHgdd<Ҽ)Zn {_pᢦNϸoҤI / 6Ohѿ6kɣc!; ҧ=QdK=$I/I ꐯj6 O+唱V-qXFq|U>>cvBqKQlfx ] j Z'Ϲc<SOݩT᫞us8yb5r l_zZt0ƨqkn[1W V7 SRE%݉佉xzVs0U#o1Ddr~tS20άX+ S䳬/%`'<&}.߄vX. tP&ZFT!⠮Uptۊ6 uVGEY;DeEdX±aը:|N:f>Xhʥؤ)/_isUcm'S"ه>P2\;tM|wƣySxBz9>zذ>:Jo}kwNjX2נ]bE٨5V^r6z_8q-3f7lu&/̼P,Xu^xG[u ÓO蛴|4v}50hĕ\Cڸȋ1>鋖bg4i`hÙ5kV6m߾}@4&Q{uZLt1cF}cOmF'xה7mx (dхˋ}PWvea_. miCved#0Va0y'A۫7x#~iWjEeW?{q9|Ohcc[&em Wxv} C66)~G8s'lb Ͽp< Nq|ĊmY3Vy>ᤓN\g'f}۟zn9ǚb]UYb&%|^qÒ6sSR8?`̘WŴn.7ΚV%`Mk4kSO5nSqPE}˿l)S⳦.zԩY1/:`Զ)zfv1|~7=plxalUpqckvt5>Z`ȵ+ZS/xQyf?? /n1؆f|m1PipkM[ckq} a֓`x-%_}f,җ ;e,oґ̭T\ZlSSA~`tԦm rCijѣ233;ӼįXy(u7|`Я|bEߜtV~ ;m 桋Nh%=O! }]WBBLzpr ;sdϺ{;uט La;եp4NqI1cOa om4u} HQeYֳm5|f D;+=9}u/k(rةG+Ԕ>zu=EGوo뱮 AK{ .>Qm\}8 8nV} `[qk3&L9 #ơqσ~)dZ2ׇ51RE= BM9ugd]:/OvڗfE+aY)8hGZlSOXˎ-|4&4 yMZ1gMEHGj&у>;qm;v2pո1epG&ʒ.1m*V#njv^Uҙ VƦ~xgbr/Tt`ߝn#ڣVry?[D՛ط~]LwEEmris*ǪۡvKmKʐ:@gb肏䇳N=*ӃZRi?Lr0nAӷ$;<񿙵dy)ES0t$s3Xd\UUn8#w> 9xyxqc/wLE?܀3?m7GA-~(Z63g~g c;Ľ뻪-^7zݎ?ܰZ,ƣcū wظל('A>jL|S0P7\gvz(Y7~>@+` ypypy#p6~(w~^oXY]s;BZS"~ee(?ؙv?ޞo~'p.?j;lęaX\|R>Oc2G_.n%18}P5dJRoJ8ވ;~F|7_uvs5z~t\di/ͦx&<0*uzёh`.?L:V3c8O m]/w^ N 1bXq&݌q QlYƉ'O\f+zkc[G&+/]w?2k쿨[Iύ#U___87=QsW <2/ )5XӸE8qQ{#'p3_j7kRXHӏhOPL!ٰ?Quh.Ơ}wY/<˿z\z!ku)=VhSIaup1)ah.ڻ}RƤ n X6~ V2&"(Z5/'ɱvw5$D> 늊",[4%;'{>~W$g6oCjf2s{A }ݓCE@}-Nm`TTi+ũ{o^~mw>]0i%6w{,K GtӲc(|y}ݘ2l3UxQv*w;ا3|q 6g_'|:#ҷ0+~fR.3L1MQtdl1u0lԏarl2jD0 GYw}à>] >-%sf񱮙3g-ُ?*YMgo*[,zᇑ[\'SEE9ixE?`:W˫ۣw Kh `,^Vo0m^ 9w_(? C:f^,!نI+un l@6 ukxA[&[n1x1|fG~wR5u}cn[>f. \13UK:8s1l- s W w=8(r .>,G\qX/ÒW~9_ ؆MI< rSp˷/Vi|-E]Ng do|#zz˝P쇴x\vO:_H5}E1O| @Eh#Z~h<ហ_҇ O~W8!o\-"Պl\,sAsy.wk<&KTY:1>8šbСCL3֏ȧ ijj1SEKtOqqaӇ6:}q4}p^~#ǡ(gߴc)&ʈdB색*CiO?RZiC9a,<)M W}3޴*,m]# otuFf'%hЎ(Voכ?95:&@G}J+Vڕc4ҰŦ>/ }W kL}5̮U]-˛oy[:{LО c.XeZ_-ۃ`N1R@*L5̒<[~;P#aQjTuLÛſcu /DYYL=p=b~O_^2lm2Ҧb\)}kn)ae}s{ۘ:{!?y / 77 ε '}qUG]:R:mN:,CRUMv8Ua¼ &=Ei~;ueHkl3XɌ?})`x[&W& ֦};g[Wl_smqq#vDvE561\p~̙T?~8dԵM-[XZ?zQ+ 0\G'RN?Bۃ/Bz~)㫬]綗**loЈXhY[\sm]0}gwe^~V/9e{>*ƹ"f{+1ߝ;Flwm+g}ndưNI@pr!v+l~ </#RVߔcoS0uu㠮#'A;G_1 氱뿩“Uخ=PN]QNڪU)Fh/}n\zJmh'ӡLr%:\<ڤŗ f`[?D;_w5  u(kj1KG 臱q136̃<)lj|[c&Ц8$T?n걸+a,0І_ԡhUKG|:pWlQL'^@{ ;++Wba!b=p•gSgY<ޙ].N4 (6YYf_fڇ#'b "b&kdv6+_9xq(yK, O[92?,?s:pH-ǧ܇[} g 1~Cza?}o`mW2k9cϢ%y6WYW3^oNox^$3V]Y{)oYbj<7yGt n,6=s1ZL5v7x͞KؗRc̜a?Nm;}k,(X|EH&R{+5 ѯ_@hw .lLe)Tv7u9Ox~ !S6KByxe`_B>KӺ8dw;npFm]Ui82 WbB|NQyvgܾ~GLK/Xwq>H/[vJ0-23QCGd ,= mo'Oœѥԟ#:ݍjm1t7"u?~W8ΝaܓӭEU"|pl9x}iV[Jebo<˯|-+Ƣyy?{)] +Q;_G@b O$TaM5Lѹ&o=3l>YCjl2r(5ѻB8WWƀ-ѝc+7+{}{q\~Ճ8vCX /X.H=>dz5֠˛3G)z_Ͽq.bI v;'^=ەܯ6{n+{U+GA=Ѧk`e#L8olw 6w0hݽ656JvV-޵|tVm-_h6;ZbX^/+ǪlC>@j4Ls_Ân%j9x xp*0W־p/K垳v,8Y"ƻRn{G/{ ]byovǺ^iORaa} k[vڵX:fc%4d0ڥUcʋwGG/+|-p!'?[|aw_/tvN*]&3 E$hY"[spNQ oo<)WeK}P웇a l곐0 zzڃnyX[X愆+ iɨ-|-}WIuYZ5sF[AY@QZ4sOVNI<lc-H)vN(3y&swW%(7eK4Miiu?_3l[X8TїcYCqspK>gcMmt 3~}xGq…9:ק`۾eѵJW5}P3e_}qtGkӖh<ǼsxvpDF yji:+5'Բ66onj'twє`tDGW_򡯽ړlp`0id?TbO8 |o"?8ib$ /1!?Ѡ?ڨӦcԥΰ/&ױcP~xhB2aLK:!Pr 4"9ґ-kOtϘt?3\|u:|g;H삵~ֱ j"w%A)н/[:|[K$0)]j׃p(KVMqlm?\:~LWacNA~]Φ=T> ްm[`iݱtF=i{~L28W1z ;g|+ٻ䌎4=k=WTNգo }IݶM*- RzGl2-\{Q>h ڧasmlGPe~69胱j#CQ?gcX4}!Cb]&Z;y^s0#lhǒA=o/@vкb=3l8}1K:-5Y`jeK+CH2-3;X3~E5e}`LHmkߦs[R^m3t=kIc!KGG3h5oXKwXLtoW/|~PsIXGB=OL<}MVմ@gW6ի`C^*|La%-'ĮWދl "6oLg#"|sN87om?\4c{5 f#wU;n9Xpd{+rڡ-Iy@db‚/oY,۞Z1~ƃnPEFjV7NKkjvf?)c*[{A紊`Mо)]=g*-y+X[{mc=wcUfd#ÞW9#7zbNZa,lcKg24?Z/gJq>Xhσ{:lSdO%8K:ڛQ<]w5Π?aLalH7u+vY(A qPNjʃmEvM%/QM=W6kThð0QIu*m}Z.c5k)N<w.i|b"b$Q "W&N&YĖ G6k|,mi[ȵhCHwx9 _xDž_+Xџ:oE:sSV' bG5mXksib$E9eSxO}=rX? oD,/ 01bDM3̖T}@~N⭛ 2xrME|q ~w>,Eq?bα?[DJߪ=l2{uu;}-_EŝKB2/HB{~%^lܣ ̰gO8-Ϣp XaJ۳%%d}D^F-dOz;0RҬmyY2˹峭i6_F5ރڰ/KX7 O_ɶnv=z`k1= s /1۵{{ơ9MpslߜspF3Vs˖E{k+Uo$Uq e4Ǡ31r5ΚxO1CA`uu1>{Ln 53gbE^U֌ -W>ҽ}W}4[gןqmtv֧[Uu_Iy]]?vf».>UP+~ixl^8X>uW}u?zk[~'{Z"]7: g{ְ#6韱kf+|dx]c%.^nʬݗS]?/d?E.HsxXԟjaD[a.|+P߽1rNXۚOE}Ov0<VHsỺIǭE8W-},nҮl Lz'-MNm«S;-ڭ]VKvH5Ѵ&Ԓ5_|_Z h0EFIkͤh˶&>mkTM]G68#d#?HXi#:,9nb[}5_G;BK{P_m_6f,MZmǦ>蓅mGlvy`yn׮]Iі6Oj.](wVExkw…5ԕqSIsJ9ćs5D%hIkWG9pƻ:b.Xt, ۰7DT_By(7/Cxg}˓j.fw?:Ϳ},]mtwχ8ʾV0k }xpgW]4tkc{roݳksߘ{@c95σ,:'i?ڢ"i>ʺtj7Y&Ő5kɍg- uX+ڭ4-;Hg-Ly:S/g[:JvRz?^xD ƽfŚE $x6W_m.^JeK c>)y0." bbrC<Ҵ~hCۊ~U#'{A;јq1)^_sG9u8gag27N~sh}:kr~/K/‘5cͣOA=!M[2b%?c';أ:~jަ3:fΗػjIğky^$OMpsj.~?CTGd^yޕ&=GhҦؓ<ѬYT^XXIuՅEu"Z/:kǶx.&Тm?l Eœ Of_&ޑ&HǭEj݃|Emԝj&*u2K9*pc|s/G#x<?Ϙ4fa܍Du2mnM> ]ڮZuMPT9\]-8KZ|MVT?eGIq3fLtG#!k0٥\hцEy0+W2y<:޺&uj ,g[duT ?z2:x 3<3x&uxcG#C@F&ٔюhMlԋ_$:lmj"hCy<(_mXm;Q}#x<E nf(\r8(Z/ң\|*tI?^-dqykTu&s у(O,dGIuNq#߃G#i!LQ3A_|,X2Ɏ5mTzWR[(_r׆:N@eɒj,Ax<uAO #"۔LsdQڲIK%OdVL`@'Z:n]Z5kM=)Swl}x<G#ha|2%ZoQZf|֬+KLM>xYKFZouIDC>O>Y0.((f?Ӄd;??pJ'O^cI;= ҳgOL-ZvaF֭ (/z0Λ7 ,A$ f*ԁs9G5%K`b欉V};nmL]~PAvkFґ\5%n}sx%t5Ɠܭi_njR|o>}_*Hּ]ɓ'5sY>y">-ol-򗣰i ٙz)*1y+(rF *DV7$J۶mbŊ۰t\y waedd!++©O>B0 ۾$C9k_-[w.ˍTo>e&]6Ҹ}Xk@]^fzfqy!'9O:nMɒ䮯&+ ÏڰC~Ԗ[ɒ%՝:u |1f޽{PdznݺdXϘ1#@l2~p~Zq>y쁱bױpژ`~-/b ;lYDh&?k$n|Sx gvs Z4Ylyu)`)eI)>=x)v;ri]x'GwrssG?ڇtj(={~{دޥ -f?Hu`Znz₧>ũ;Dze334tK4ex'? KKJ֯i,=E>O_9^YBr|:$IÂŶґ[ThS<5ءU%ghHr&:to>a*0,M~뤱iPZw漉q|kp@2xO){b?p+&#N޳_$k&]+5eAF,ͯ8 r4TΕ4Mɠn2(jZҘ:4}e˂dz+$@:@A5Mya-ԓŇ`K:쀼ϞqLțõGwWze%?I;܍Cz,){.\1m'werfu3}uv>j0>{tӋNG^]y$J'^y0#1~ʵd,N<  ?O=t%FXR,xqc0Y4ߦh書"xcۈz(-8mSipܿ0z𛦍iw}#zk&L+AFZ+TȬT|w%pU˾o Z/f$VVmfiYj?-ˬ~jfh(B ,|2rwΜ9sf> \NdC4cnZ7 Zzի>ғEH:;~ :V6'7G"m26~:"G Z)Nyw1]uf~|l݀wݵ=?)Ϗ̻qGFN'y+ )f47U8}vOਫ਼)~=2;Au7OCnޅm\&[:dnǶHe'-ǒ(-:}!2E`gL2=A#_BzdѯN >[\V2,`鈫wN&YRMJ6#ƞBU"fadk%h^؇(ٗh{{[w~§|Ԍq7?+W4$ 98i+!B-1zxgo?lɻFz 4(Wo`Oqpr'~taQfw+ں(˜wp{xq(FikF,Ma xqE W\Sw///Uzu2O\篆E^[mף˙g'/t&HN܉Yð ~k!b oƦ$JŸ >G竩D̈؏?q}l\/Ց/pz2w^$y0?2~&ê(EFR,$\NFi5CS0,fɍ AnTFngMa3jIck<2ݤ8itt62al(^zc<)ܞU<dމ3Ώ㥗AÔ8tWjBQOʔMJuln3F`֜x[C-P!0``\9Ć:T)I<}J:C?Kk6;""*(`Oy6P ݙq/!!A+ن:Öiw* )˴J\CRUl%z I`OcD*[Tj}x )pnqUz?֮^oIW[g?464x6iYǷoe>KcO8Q Ŀqń?g^| > sGaXx`h1јvSuf2;75Md|7Ǜ @?YzPP+\bU_ܖƌ]8| Q;݃v8x ,K&GZYS%ON$Gل+/l/n.J< (ru7wZ ?[bֶ%]rΕTʯQϯN&SǏoc`|K-.PqT-D]g^b9(,WIdyt4ýMY@iGC'Cdu3j}πrYSRHhЎ,CmP@Dq6? l#MWxotYmII)C_AfVפ_az DOu(oQgۂo,5V,Ң`:TEnG<}~C|:?&ENm4x Qy@`K**Fu )y֠:;Š}W4Pjx*gXfԨA z /ZMkXc4i`I*?ALJhܲǚACع7o M<0)|xxEׇ5c wNQTgN+8UMXv(JDVJ~g%LrSN!D&ˏ%m3B$a='] 3exO' Q'pxɡSQmkF8G\1vuz3ƍA= ,zY)/$l r=. ރC)f(T|YOvC܏HzD۹$6L{a ֿ5u!(bV$e%E"?d>ӗsѿX45QrsF'2@:4 wh^#pu[h֤9]|GKJO9OEV3᜛ @!O+)ZOutm_w35 I wc-|~G4,[jaGq`GH%RⓌ&)jΖ*de$Eb+o ߯r8tx9}<@'0xtZSSE2]ug.;_X[Pdwںz"J bURMd %"4=~HM[!v;a<Л &B Vcǹyz6Zw )6pt(/mhGrdwg:Ik"R~YvkBFCj;uP*TG%Er$%#ZKքf#0p!> o /4C=/vʳr}廉NP4 %SʔgKp5j/%- ,8+ЊkVw?nġWN5A5im%Yр}oĎ Xzm"GMG4iW)0sy+O߃Xwӆ{v;TVRoEī!X3w/& 0 4MYzΗҭQ;|U2"0miSճ//9[ۺ v${*5ElWirpt4rɪ2S\Rofsòd~0ѷ$teт Z♍Vli)EZnUrފٌq_O@M|˷%NE&Mhj}8C hĢFy.t =Cg❐ɤ.@??[$1o[8fDLv 8eKtM򓼧zHJ?&!jdNotenlY`HFƍPQ/T SǺ0/ዟ"CJSw76|k:E=+X4>@>5,,i~x}@ὖnȱ0]gmJy3ovx hF]Q:`(2k]~vu: ɽе廊7^\;^ I{_y8k-m?Mq/~?)Dw ˯22&M(Ɔ=`-Ό˻h2]0A_L1Z$OW>{CXjJy܉ʇ:= E4~Uvm@Kg:uJ[?\bPx+E<>?+(l峰 rCi/?\X*mi9nJ[+N¯c>8|[ו;p+b$M22mKO6}8Nxvz6L\/oaLk86??[hh'ׅk]L~l]l~ޠiP3۰ަ!=r%|R.2m ꤝ5%nh8S} $."L%Bl)XKZjAmԆ_ڑT[3hW>D@ S8w^@\\;ƤSQ]R}imVl_vMGi GOG)|6Z#u~=Twhmeg{:=NֹȠ%v͈ق,HNtʝNg i{@fY YqquT2'/>'o׵Դ=AUY9%ЖCj*JOVnK'_IǦ`C,X4glm+ j\8̴ *음!3,Hi낓2TWƻ!?{0m#eR>jd)9A9{@jR}ЉRLk;n%mfy ް]S^:cYYA[ъl8тV(h+w#G7Xd%Kya.Rg_pL m]$Nu]:z ^8KJd_ݹZmQX6Ʊ2ԮȽK+Duo䓋 aM)@ 퇇WVzϧbRm*eTs H]E|(wϊUR_gVY+ϊ"ߕdQ4K]K|X?g񷨯\" cK,vw\Ns4 Np덑Ì~h٭Ʒ+N^:u]ƶvKER"XAկjR$iiT*M|$VKGԐՑVh>8j${t.{) 'OgЀ>VՒXVcyWM[<3՞Xf=Hqd -M:A'߹><ZKhHYW .)9s.Q /Ym#UE(ՊbjV(ƊT+qJ\;KŏgN^UCWYQg?&&f6e̱uիW ?@@ D 00p> b(ʆwE8ʳa%=M]0+a3;Ny7kfQwnqI2>2p@@ e+=ڮ*(<0ي/_jPT<D@@ Coɓ|ģ@@ TR͍Jy{{KwVA`ҤIb^D@@ # j@@ (cR]ƀ r@F`ܸqbGfQ{@"P%k׮U@@ xT sG:7n )) |**wر:Bg`~^^` r<8::f͚A5"WUB`xˇ!-m<ʡdi`4oPka. ej As'b2Ѻk M}Ul1P89x]l*&.ZGO4k}yA0ȟձ<20SX R='_/B_ryeXleJSo4q4\l$'o;O Rmbˆ* JARIw %!VFq- Jg_gf&ɐf2zt:#iՉaVf*ن9/'F ߪٝؔGxokNҩrd7{S+п8٪ ?Ę9˵쉹߽&v9qV/,]Rh=揁ȺR P xxˑ#s[?ϩa*N -5]ipjO!̨e.lz=l-+p |ٽ%^?K7FX|92WTPlpl=uBތ JI1+RFeuȁ7@IDAT2s5w8jgԴWa3$8>rvGn \M ^KWf? zPۈ?:a%W]_3*\\K=`Iy *6~\RU%$Gw )UWfji<WyBPx^{_P?I,Ųh`#jڅ`؂qvJ<ƙxqq'fU"P!YsSxU<AϦ.ҽR;?;cz93(<*} Ir蕯O`3c<ճC' |=A[5.Y](ܥ"#i/f҅OX]P[ј?e$&c`Jp)sFJ=B&8X73dQZ9\Į:J]Z:*e8l 3#fߊ =;| *+|FA#hyttx% 7ݤ+/Af"|x(&| jA$6ml[Nnn$$ w^)AE˔]uyXY 7G*q Yw$6h+u!tJ\SpIz]â~/dYaTqGe+ٚ_Et2Wt#f~)' aa䮴'0TBz r)J Id ^0u t)}ѱn^wlݮOa2 >_DFblZEX{IbG, =$q<fv~B||MދWo@$@84 7 2ygbGT,vjD6>h.ޥǧY6c}8oEC\2 _vy*g+J<0)`{1<WJH[sqZˠ:7fѧF.E wKXj|Iݲі)By-=VZ :٤^Erj6= ldfU]CmD$y8"e=CCKjh(v IMHpo4ZTl9qh!Џ<ԼG{X:Btr2.⎴'Z[oi!?ZXٞP`Eۓ߾\;xhZu}\cp;(`K[RcT<jODi楒9 v9^9)OӬw)~|z> ON NJwQzS>>9Go)4)+5)N^axbUp-՛-bIO,T9G laI%|_5)=ukgN?JF}q4nu;qIb-OƜµhՕbKFʇ85s_ijuhTA7g>7p 3HNc߻6`)xq0$ZGޚ]Wld49GOIc;YSxRz1wox ܽ{)D}yjzdyz2?gggо*GDmFˡٴ7TMӢjrxQ*Ge]zO!%Τaᘻ.W&)EŗZPnr9nb2񗲣Qq9;؍Yz okSajH}hdݤ@?H)2Fvy/ ̎4U/5 2*275CK ϑsTi)&NE<]ɕF0#mGH3d%pnA |ɚ4iu:T Yc‹Xzʐ#!Tƌ-]ŝ'{Šx4g84FAhD#7Cͽk#`gmcuFa'nHn-0r\ Arhū+( w]79 Cz4:W@oa{7{L}588ܒ֠3a@[N))5MHZ\BKш %G#2+te?R~}0_ƏF?6!Ù:OkQkzNHoRp&I2^4WќK, 2[!\ypKDDMg?m,~C6pՒTQ,ǿ|iVm5} VUotR,wG3 ۃdT*ߋ34 6e&[pJntZ8fK NO˓bcy<֮]ۜ$"lc݁/Ʋ**T!Z+<,#MDߥDal.vփ0tB'kGi}{lG2-RbRNFH g1;.3.%;k}2n& .:^ JLԖ-YISݺ:L k[N"jID+~gؿ )I3M.\M6xL$=FFX? )ol1'V}5bOcܤ.eYR"-aOdp'5Q;F^r|6sc^<'ɰ=Û1"+ck]1ls߲ zƚ\i+Nö?ٹydaYC _qu{D=#I< yN=XFKDx|XRWL;RY_?%/cw0^j?cq!dWїOsFy Q!ꤤPߝ wn 5<oE_(4f/UDE--=.K=wfF\q2V(<Nndm_}Pz^qk>ʖmf|} &($HT˖jâ!g 埦dh LK+RS\oޢHeP~1ZjEGF4"=*R;-ѾDa.y;7p6$=Oƿ肈SrlCRn" F~qd-jNִsȆhNc&IK^[>سmX#?Tvri)y,XGo]N lMhS~uh!9 ̦KoLtk&"FWד XqvFZH߆h-.\_Ms_CÆδb‰9va𻹓-ioRNCח`#8ν܃;ˑgWM”EDo!_io= ܉)=BrN\voN5Ѽ1aM̓h뼁@by< =pi54W,ڻьk3qWб YqQqi o %N`w|wRCV~(ռѠpPV7(6EcZU~mb$Xzהqz#xTV9q$ /MְFdڠ^xAW:0FQ|Ql7_ +*q5 굤~rb~F)b{7m/7g1d_*4TQ?,-sn)7323<")Хya<9>eE]y`TX'a˶s?4h.:(u[* 3֟[`o(mHf§ȾI.= t͠tgOGb匷+3NA` |3:piE$mZR1ƥbV`V>+rpG}탗 U2 J.ѱcB7+I|d4|пUBga4 ]BVDt)(:>)<>m ڻ `Ћ,gZ _9Vo)Q30c+iыb1gK]}YwFh?أ?ê>pB "?"Vo3|BNlHp*۔ЎPEh.2n΍DԦ_7< FKͽ7(S.Y}]k9u SBϏ6\E%s}LJZܳf+ 2]Z"?~[\Ckl:j+tҢª٤ &cX\9,Ж6M-DؐpO>tQ}I[H®:;gЦP퀘UGm 셉Sb0*[Fp"ZJ9twf@ 2CB`mKXޏ@,p\aahjK<֐^ʀcNT0t +}?,sB<'pm-rGZR߯CBB!6#ݽ#X?l6) o|misxUX&xe* S[EʂaAXr2G!zWbòe/b+y:kg*N`Q͋N1+q8v:XQ*R8Xf Mfƞjɑ4HI'̖hr)))/#Vw249g ">GOEtDAtʌ&v,[5W:+,\J鿊HוE/ d|˴S dU IHhoh Ͼ!fY[$Ѣ[^t^}UiWJg.)U 9@ /O8X@rn;iCҫ{ ne׋6F|jJ+tܕkW[/\$Yz}=e%$_3WPKK#i3 ڵۤKET^ǵ1 3't*h7ӱV꯾ F23f뙗/_ա.Pt=i|َtʳĥ8l좃*:~V.<+wy'0/+~U p,\X1⥜2q4)V"W!GB^ZDj EP""+Y-xɴ%EA!eyTT{h4:E63Jƒ_QuӣZT~YpR-QVhڨsVFj >E#@Z*u@/5нJ@l$,D.ՉN̥/E8:Qx![C)KOg'uLCr^mމB?%Ni\ikNfpjhԀNuDQ 嬴KKIQBT_^Go~?-kei6 (Bͅ)Z:fT6T/ RpP&VlD_uZ]GOf|-ߔ[ѫx|tJӖV>dp 4 b&jVADyFʳeUivt]6ՠڅ9qx/q_JsS|f^DZ=|šWqUz>}AGWi<(@RmJUKEc A@(T̙38t7n O◷8dURweAoTW h ޺u ^f͚EA* YG%$v%%%a֭U8 [N·{P+| Bű0˲e*0"gCo߷hҤI5i*u1R]r0^zU9J$J!@r!PIU^Q@@ @C@(ՕID@@ 6R(@@ @C@(ՕID@@ 6RͧN @!Pt*T>#r@@ Pt*T+ +@@ @@(偪)@@ PJujnQY@@ @@(偪)@@ PJujnQY@@ @@(偪)@@ PJujnQY@@ @@(偪)@@ PJujnQY@@ @@(偪)@@ PJujnQY@@ @@(偪)@@ PJujnQY@@ @@(偪)@@ PR8111$D J1T@@ PtСL;zxEJ(yyyꁂ+2drrr@@ PPtP*T[ZZ/A@RUL"͛7qe\~,_q:uz#+L*q䇒V*`UB.)TBPV.zVP.*˒Xԭ[۷GZ++AL]gJ_jZWhe^V5WV`z*}A)JI'4S[xkQ0-Z6ŮSw@M)'aɷ,.h . Wv)m[Z*gYS*aHw]6eppYO]R!j64ҁ<@C?s!7/\䣶-k}B JThcg%[0W <`Mlg[ zJ9?kwl8#Q"@䌌 [JgNEH~Qצ%˫Ů bܳ7aGCCJ& ۭamKIŪ҂WNΕx{Pk*Asrs 䧄Ȫ]!.mΟe_J拹sbΜ9E~1$cbaIҾi੮ нeM\A<@%%2@QM%|n\\>#~#|ZAˏX"PTK@yD.Ǐzxb{cx P}6Ȥ\6vĢ d}"ckI+.)ղ/նcPݹTwBY¦ 48'xL5]pOO( G?NxJ>aČY: 1X}fd6^Aj )$ƭP+(y* RYQw(oTW TzM5hbAeicYEիM 4رctϥdr`g1ظ,j/]my"|oN`?:nCia~_I5jV^򠼻xoN ěo>ŽcfdnG s_qx,ž8Θ<5/}i[W$|/8?cou)"rK[5 ?;CXp%**fȧrr( ~0ːrJ h58\jQa+{d#z??_L] L+ MUhOGu137Ro⌙AVї:̹@Z0]Y^L~幂9/}J+PJWajè.TG{4QɃ%cOajZ {DDD?3XJcd"{4sâUAEJ>_5\hۇd 5cLau `^ቺ1)/I)ft}wZĆ|R IW"ԎV [ԯ ^M#hr\ҹAqH?P) jSYl.n*v}.It;Rtss3px|)eT2|Lɡ0b|+V}8/ߝ0e,hqǏ"öxkxjt8i推t:%BT/XYҚ{VvZ)w-j& J3WE Sufw )|.$h _N($eP%h_ D x3WnǦOk](6%\C7{uNފኰ I0Y FԮD nnN_[c8͉ɠz+MT8Sy%9|: N3Gi&RzmP)WnLH9Km>O)]萦)1a V`&FHl6JhB>Gat싈8yN:&+67# #aoh vD D{y0 qT' fPD Y#3'KdM3lVs˭^WwIm8eٍ%6w+8uE3K:1=(;ZQ.<0yCץ/r:hEʬllR աyGd\,V( aM# h+Ww$VPj[1 ֈz*0N ]3HխLFy1 ʓЀzqx ɧpM͟?ж  99VKc6fWc<ٱ0jX n rssiˈ[S <_x{+~@jwŠԏD:J";}A"I@:ĦMD'fIͣ1s8}ƪo:d]aiG[O\Y ?+UYDmRph|\ݘ׻6`)xq0iNy՜G?Ƿ_SVPڤopFP&93]%![J;Tb40tC†{߶UP?ZTڶ "iv]z ewlJvR4c(hWlaݙd}#yJnY}[ϙm?0Q+cw'.G0)OY%:'~Ty[$E++~(2*(Frg 3~իfhLF]Cu]KءQ E:d{!k[)Ւi$Z& 暦uy JtVڡ6!tϕ4RM I{*jR5 %]ϞN| }qg!2.Qmw݋AEr;hԨR߁ܹ.E ھ]5\Vj/j~O9AR&#_-wk4C~]HNcOI'SMQ+[ro bCEDW:]6sRD'˷?\\Z1 E."=XSCNW _|Y*c#Ob~N:vT2 A4"S]{5x.y6/tG sH゚^xc<Ԋ;xMJ¿޺#{P|]-(]Bjĝ,ha~S{jAH Tkע^'0twi$2qu'5)Y O{ן4hb奢J[tڥ ]j2NE8_w^~SSetA8Mc#El_'j㋚6]r*NjUEȈUqޚ!]4;H֕AA 9]~HT:p4@( ˾vtAn@㶃g Lɇ%N"q\hIٜZ񿟮gkX- ~EE9/_+~(8v  :s2 O|0- O-~+YԼqcڛow.@?aN񟢟$۠ѳ~I4>z&NpY\0~9uSZO.%tb:YIgڊ55{u FBC䠩I!ԿI\^H}eUuhҔ`_~9n@ /]Y~6뎣F&iT+9(pCgqM(%Ss=qG8_U3' '4_gʺq_圄od/z)D109`߿ [r <DL^g8r8'v_ÄB*iמa];k=/qSO܅zMu ? ȁ!{EJd5H#߿g)B,;(pXx Q\`X8שg#<qvSiEFj8ؖAƆ]n "xJ3w\t]t/EOx/^Cھi5ԡnERگY: 8wA:+aGM ,[W_%^Uf~pǰA4Sm(ӝn3!5&ydlOxp]-y+y: ˟ MFb\ixH3IXGCֽ(Boa?fڻ?bh rOs8 x/}x$kxU15@IOaa6M{ !x"oVH[Z덈zI֏c w]淈U4g7MhzUtcO_f1!6RMdc4QnVF6]| 3cߦ{}Jv]Z9$] bn h%iٷr<}Γܱ ۅS'' d,--ň#^hFbtry[ޗ ϝ'-9^lˋ5EIyZĉ`D9N䯝*5)Ż$ 2¸6ړ jhG†0--~`b1t Ap;U%yf;@A gNvQǣtqҞDeOK'ucTF/oF?ץ˥g2y 1VF8}ʍ"R >@IDAT[#ug|?]O2?G%r !NΟn79 O4c@4l;|h "|A **J2Muh1cOma_h:82+{㏸)+kb3U2<=uqdžiB C(Y1], ݼLFqkl=]SV8ՕgltMNJbn1Gr Zxb/ ?=Qԩ=^(͂qERDg-mrsowf ͝D'16Vae0e&$H,LmJf"Eq[&nŸ)-ȓОmR#)WeʣYjqcgo+u4n*o1yEEYqoS]mSɹV9GMl5VM Ɯ(0^ "\|_GZLG>8yÒAݜ\ָ/NbKs=^<=z-~=ܣTazjo‘$"m*9))jK6T\z%N;wC8UU.>)nE7|3?_~֭ż2Ξ=#GHcYC$4jm`G.5j.k ([Ԝ2?)r|?z) ;y$v܉9߿?~XM%Zu>Q:.(x 0&ܘO1&`L 6[3`L 0&بvcrט`L 0&Z-ÙkaL 0&pclTrkL 0&`-C̵0&`L 16X5&`L 0!FupZ`L 0&ܘn\`L 0&@`e8s-L 0&`nLj7V.w 0&`Le ի &`L 0#Жl6aTkb`L 0&rڒ ƖfW\`L 0&`MbL 0&h9lTk 0&`LM Qn1&`L 6[5`L 0&بvSr`L 0&Z-ǚkbL 0&pSlTb[L 0&`-G@rUgM~{v{`L )>hꯣ;Fu3 **R8`L'PQQqw{c.]B.]H{xx@P@Ҿ}{gb[k׮ʕ+rrrxtlT7dL 0&KpΞ= J%7x#:ucGq[@vvv˕'0υc`2aP(//Gmm>}%%%iKjdinL@<":X n `I@x4Nĝ9sA,kipulT[éL 0&`L&6aT<`L 0&PmkFuv9zz4yX)z*v 5}ߑ˫@# %MՍ?go vwe9峴Sb6Aq%'oORܶ-~GnK`L= Qzm^yzSސ&=[r 1r34Ek O1(`׶eHD.0=J/O>o9wd㼺Y2`L 4DžPb݋qRM-ڱ\\OƬ4Ex~@,%AへFYiLh\%ҧgCnBQD_xb]v5r.D|ܵ(2Rhc,#6 Ȝ8G2ki^6s#bǮ:ơXSK=], qZ=ƭ*lAXMKC v,&(/sit֔`u\6>t.r*?0u&LMF8JDjskq`AjЃ3R0<8],سҔH+,ǛO p;;ucXr2(brL&횏s"j#@,z0digӗ1'mDp,Vf槣 @x"?q"L:.$eDt,--Gn>v^lL!vK0?0c枎3N!>GcP~Gˏ#eJ}zXa/l{b+E v:.Aݵkȟ{ ßDzN XRr?P?39MaL +iv z`L`bxܜDJНps Íj/bœC 1dKy~P_K ?rY6"(3OѤ1'g }B2.+nF~Ry\=V`?x##c) +ƘocA?-L|88&T f L<t_k @A) iWaHgo][Ps;BC-.Vm"HyNMF ɸ&C}UGLl=6[L p]=Q-O|;ӀGk=IEZ4QWc_vM[ C; -|{ʩAј<:=DGW#tNe<20(&iih#XC}pE3lTӶҀc'㝔lZW-Bwԭ8W8 A BFն*"y!Kփ4 &/S`*|sOA QJ+7V}5ϐuӇL]60&d<AwWGKTVi"tf*HҍO|u<|?fn QȨ8gƢ/d*:jQnhzDL %^^^|.4%p}X3u%<Ҟ.샅!W4ou:⋿&ǖSMu@{rM_ZOիZz?IF Q#y=qהW{wxOuY>g6b,ғ] K!cPxcҟ O6gFēo)NMjn*>gNN l< jVMewРk9"N)iB*(g5DOK9{}kMh}>"Оw;*M AG ~Kty,Zنdi.# tY2Ϟ= Io:u.;.~p`L 0% kὖnͯ pfǴYfL 0&`nN=.`ś&'tpU>\G&оY9K `}d 0&&?F:ᄏ#p>\J&@'?\ظq#9p/uP5 Bc.`m@0b|lV[ŇF)-秳>ϸ1518/`O@ܿڏ}?uhn6| >Z_5ׁq d}؜;۸o3&&\6Xc&<ՍjA-~5>\Cr+X2 ^3&@k`5Q7ߵR ea]h;a} >Z4W`eUm<ś&Ǻp-5>XE[@['S#`L 0&llT7s4U~0.hۮ(]:g}.DKpsk`&?й=mFQ}0j`ޢ\?Q>l>zX͇ fsBpB, 0&بveie3e6Fꃺ+@{O/tg /]{Rz.ĝ=XZ(p,Jc}4 gL 0M%BL?T ]:A0: |E^{@EXhjqw0>bO}BLZsњmhc`Mݗי~7Ё\xu•+>VK(ʥwFS#wO :v!<'Ƣ|ef<1.Ua'x4n6Xo[!XdL 08'z̾SGQ5myOY}o \Pl~9 rcݤ2+0h9fu!2>rzUE}4J gfL \بv4zLDo߾^10 1#-u W_WuP_8vEfBda}BQmg5agQp lT;@Tkޕ5j:2RN~p:V^݊vˢ,@guS  >g9Y-A`L 0SFiKF?bh{^?zbD)Co!3$ NG8]EL7}X7HItxe.D.ևyV-h aNL 0럀ǵk׬yeM^ox}9N--jibm-n4-1]y۷@|СC f8'|x衇 )Bt*._&!l—_~)ed}gn|YÇo\AC K.LU|S(#!ZY' իWq%`РAm&)--ň#^CX[O#or~Zrؖ'ok?q"E_8m6⎻GU?CG^`}j*b}؅31& ֖jK\2Ha}uu>,&6aTGb}8ZG)ug .Z5L # `-M ۡaL 0&\@[ڄ8[Ȱ[aQH 0&Nj /8)u]Nb`L 0&Ejܽ{qwOX&`L 0!FT1aHaN࣏6bɮ6>ևkZִM%%%m.6񢢋f0&`L )6lHi(Yr1L 0&`!Fusʊ9%meL 0&hبn3&`L 8B`L 0&26۲L 0&`!FC0&`L 0LjԾyY+.zWYbhZbde@Պmઙ`L 0ׯ;"oVNұU ښc""BM5(ؑPxxh0)H]OY n.vlJܘPLMΫ u.LuDN]2uFqٮ%PNL̔(ܛ1zI~*7 ѓ2-!s$/Dn*ݐmnHbMU†>I?XQś8<oEa^D{jQs+`͑Ӹt.Vȝs' i+c|*[xJ'K!qC$"mq$NTbIF#ɲ`LQ$eh207T>H5Y:R'=r̚*ֈEJFbA̧iִxb $ d$MMuJ.Of is)GEPً&C>$C!ETЈPHLo!ʆt*~y>]FPR*[݊SRf_o.̤.Š4YqC1$r6 7Τ.$V:eVkƱRD`+)17B6ggL 0%Fkne,|5h9Fn @y4..فй({UH Eܦ"] X>U#ftWrV&DBjAq1w MsIڳtCB7v'[-~ڵnB<1{nAhb6*NƢTǰ0y$T Fq&rJQWp^k$H1S|nO6#~(z5 KƲW] d%١{w-I-rI]B) 7^|ah;Oo[6y:_N)]1ӦНVzL 0&ڄQ-L_'F# LJ$vGi3^xG< u k;{p(|dƨ !zdE|왭{K51,"%}/R!ݻe)zA4T$?BeQvH0Dmv{zk=f`^?rLnm5 yq,jhe+XOfS.Aj_L-(dr-҉:T?N7`F5lb`V ZvA,-`VhR*&ƅA؜ >-^R%nruV< aw-Sp N7G똒;W/Gk2c3hK[IASYBU5nX @/?Q(3GV XҰݞʙ_?'_ -M}}O EHxJp \K(IO;ԅңB?OЌ?T0Qlm{equZFf r߾Ɲ(]#]%JJ@aV]P^dHhGD<[/?˕1&;' ًq+8WGN~Lm+W޸E/JS'8@]w NڊbyѡuP`Xd8##aY<dGWCzR$Ā؝J[%w){$[-7)X/`i^VI@U#`Oj'H#vp%g90iC^[cdf/oܫ^X8V35kfqX(-ENMJ7ұw g=VzDž`LQ4F鉁5pͭOydh,_ 腻6Xӭ3Ge G 0,fB޺ 4.JEnE!ci,^NӒ@ccy" rA8Sɱ1='e+]rbL5 EԘ1iX +02|sfc؃1v"'ˠ1Chi M/_fD/NǻOj Wƚǩ b0BzhRc'a H^@I SPG ]{l<6t&6n]s Ehx`)!lA0Q)!M"$GR`Y6Yw3z3 n 6fC 6QZM8v}uc)KR׍לda|j1&'[ے0pМ1s4Q;ޜfK{aڧBTtOKnt1juTU錾A`=8Zyۦk-o/lj.MMe^b[c ڷoˁ4~W¡CбcG ndL9@QFF8(;z":c$jɫ\GfyHJEu 5MI*iJ3.VF0~viȣFzSiEא_k,XY* PN˖?h#O,6i]YVFuOPo=D|&uh_zzk5A^/߳&_UYU =Z1Śݰӱ$3Wyœs'~{lH~-gtEA< B?mL"Lg O8O|+'' rxwE=4;׈#^#h^ȫ6]C^9-ybmi&E򚢤b-D0]|r6_S$w! JSO=l,?f L'Rr;g|6M/QLd50\G&@['F &8@ pufZ-0&Z@S-x(L 0&`-G-`m¨h8s&lΒƲP&`L p fR] لw\g`L 0&hkبnk2&`L 8G`L 0&6ۚƹL 0&`'FÑ@&`L 0FjԸyY+tq`L 0&jبv58=5Os4b;4K1 RWaǦd̍ zKvaN#r䔩屵*&r#"LSHYZuaW^5%H8y%;иl8]sע~wmxJTaP]B$`nFj'*TUY 4qLc=-`Vop&ң6"0i˦`M|4b ]K){Q7iK'b W"o'ceZ~C59I؛_U8!ß0zL }4ϣHwp7!px,.ߊ½5;9Z6,2V#q%\:s5ё;yS16~%"OV"ToV-$ҮaH=H[XQn,&p!lT;C"%_ѽ{wx`G#~hVSda9fM~GZΠ) n2xb $ d$MMuJ.Of is)GEPً&yWF QA#Bo# 3y6+ҩAkt/ƖCHH8VCI%>خZl߉>%%m~vl_L"OØeH7C"gpLPAlS[ d%١{w-I-rI]B) 7^|ah;Oo[6y:_N)]1ӦНV:*׷7`LQ -*z!<| #z9P7_e ӣ崙H/i8EIz 2Q{߰l2ШVu>OS3ub̯?iJd/ܽuyK~PX^=cVD27X꫶c@lQ :U_GDOE/T`׎T, C1HkVc% #T@ڦ]'z8Ov6E ltW`%H)&:7WPtnt⨭Oxjִmq`L 0#`_\Gex73h8s^Jrĸ=WGE2L/uZ_J x@x2UPPtSH1%wtg_ЏפefЖ0|=h«j^~!mD%.\%G߅Nts\^ɜۢ:el(#LJ7 r,=sA>wظkDI yC(3֊ӽQj ^dHhGD<[/?˕1ǽy`鞽L^ix^|nd59~1gu-quFu9H'.]&m}yz| ;Y880&[`O* ,1D>!h#G#6/OErvfa0jG z+'~%w mWs7&drt"Z5gH^jQSkzE:{,v Xz=2hu|`gcaPo"\k%q@x }Ĩ/FAe͕EE#o !xe5\,/DҔ|ď}yXr/?CFh-U?5sّdwߡ2=T.^B{i7O!MWQope*SGSã|Zzσ-o(ԧ[o)mg()@$a0%YH(@EHyuoFi(:\܊C07)KҼy"de5c0v᫼bJFyRHcVq<{-'2E|؋U WTdJZ뫜kReT,deZJL!Dz1HvCUE$<b0+JhHN+]*qj5TH^OMBc4WYIS,yݚ b_D I/ #t͙di Ij^!n)FƵdcS,oWBx >Űnth*W {Vr,&SWwMLcy`L ].«Wʕ+Vboi4.E~4xs -n f"+4- Nފ=106'PR3!sRbٺdBM1&"f4TkDL $6Cg4"Q'B!O/qa^Y֗ FcUb̊MD'i'aYhm N|bRmXCͷJ_^k.PlpCq2/-|X߇޲vr͆a L i!!?Y} Qw3z3 ^ݘo 1Fi 7Cfh ֍,I{K1^7~^s(/1}#3- 'C]D)_.fX׆eX/n+[bpM[w3`L Ziڈ D3BeY GQڄЩG/m>6G3&_| IUSGC+ <ċ3NyAYE9igewشw! >tڵU(heH6''>ʕA9R-5~^C6Gry[ޗ" \9Mlˋ5EIyZĉ`8m֓I{슃K, 
vPEeV]2LDj"6Sn>y φL(C&ra03$6v˛:^0j_Ҵ|ȘmZQH}~6'(du|?:ƚƔ7X곕N#1e]o@#_PnL9/`L58s^j[&jgo0AZAfc{釃8Q~'-GxHY,!aL 0&{`z|2jj 3q8@$Bȵz Y."-%s<`L 0&@ `\H/BMOO{F;}jThU#X+gLQL%8cP3ř`L 0&ZkpuL 0&`LQZ^&`L 0!Fۨ;`L 0&Zبn-\/`L 0&`mTaL 0&h-lTy 0&`LmQ60&`L 6[<`L 0&6بvUrG`L 0&ZխEeL 0&plT*#L 0&`E"2&`L 6aT_zb`L 0&rڒ &vA,`L 0&Z@[lkbL 0&pSlTb[L 0&`-Gc51&`L )źuA5x`і+`esߙkضm<<<\1܊6Iڵk0aB컣:FH}b^'pC !3gΠtz:vݻ#007xMH}݇74a#p|7¥F:HaIuؚnW' Ç[n]w݅={z޾SN_8 8ᆵ!svxY E@V,i ّFle#޹JJJЫW/5S9@IDATʹtq#! V ׅ)pӘF_TFӘ`LK+ q<x<cgOuC&8[7t#F sz*&P@uuuQnGxG@cgOuC&uZ,AG5g4!H,>?1܌P]C#'b_g!ㄹ[Ӆ|6QO6UН,Q L 773dj4ÅEd\d\<<`G]ZT}.Tt}z}-ƻ_5 &} P`c?~JmͳRkm;bEv1N[π%aI&3&(Sn5%T?KE|țPV_d%Q7{6^[[>g=j(Wo>87_~%|2YBri^KGe ?7xWBm |W:i:PJFuP@W?X}5FB~X/T6!x͟(&R:ɜ (aPicmZ8L9jx7M2$>73r MiW{"J8kʻ O0"| -x1k96_.]-ȱm]wWpM]YaVNaaP oX7f>{s5z/ OS/ڽ6W_,!Sk{yMGj)}o굷?r[Dk~WQu[J 0`yҖ) ͷac6 54i"~ޔ21-QX}~Xy90 d1?Be‚1,iLt)6:=JI)wԙ,{[jz_;hjv߃3LO> s_.g3у-^O~ JH eoϘ34OdGc.rycH-&m;_GXf`|\˗\hR]UP.9U ~}+FYOӒi#^5Ujwy>OrUո@Ygž,R2ƙYwt{YF́ &>OMxeJq`%3Hٴjmzekt7̔e0u0ŲAM3jz j|UZԦE8Yix芺LCwE+)raP?&onA->WּBgaT.6ui_8pO]s,0Co,K=Ut ޸`a1PW'o(.Q)#:w[lHS6SBݒAg`6aTqB9VȻ[_Gƣ#|pD& NG8]zGNJBܮ A;ak|m="xrX[Zt[E9/h`ic|$.s~)ƍWjUIHH /mRyGle\y2TxoA~A Bg^x\F~E Ӵuy"0/㋵E%-"myM^RX~;6{,*O@FMʱdW>!C" d/`ܷ#ܼN4KDAٮT  &KYѭ-IA vEڙ*\CPU|j 0j&>NIO۰|.+++dffғ&NBAnǏޫ(WY|VYT̈́}`L@@+nY%$eA- 8<;]N JASIǢ8ݝɨjm@nZ4\Z@m۶$Q?#:wf߷ٯ]ils-h.`"\&@-#кukiFt޽5_1Eҥ p*&4x@XTWhfv6nG5K@P-[!&soN<䥺ߧONcL`Q]ED6Uq5%&k`Lrf`L 0&@<`L 0&|0&`L 0*`Q]E 0&`L s 0&`L T*L 0&`LE5L 0&`Lꅨ xnpt&`L T@}`BTŽ 0&`LO;8'&`L 0:JEumX`L 0&#朘`L 0&(uaZL 0&`ǚsbL 0&XTцj1&`L <8,kΉ 0&`L`Q]G`L 0&~p9'&`L 0:JEumX`L 0&#朘`L 0&(uaZL 0&`ǚsbL 0&XTцj1&`L <8,kΉ 0&`L`Q]G`L 0&~p9'&`L 0:Jވ6!W 0&`@}_BT[YY֭[lR1&`LK˃BPg#`L 0&&F#5^j[[[IL߼y-:2&`c=!RЛ _W_b`L 0&0 Ν;^ew l᯿}O- up[XEG}B (*C5'sX+;GYېXWEf]_ Fȱ$l >ɻǶ.u4eڲ`@Vf񕏆 Jd96lx;;;鸸Ȉo6jOO'INSηD&5Ϧä15n! n,Pt4C?þLdD.c@t/?7eL iNTW^sE۶m|wŊ+puB!`gLl1Zg, gL> qy^ww"q=f uVWF6ŽIj)L(Hcg۽-( zm/yކ xrpo-tİܱ3@Ɏ`u@5 b-CسgOIP!&Lyqモ ‰<(=) 0&py#ܦ?wӺ l\(ўokTKC;JݠcݹӰLW||! UMVi`L>Zܽ{wF ƆMyl 0K1(#Y۴ 91yX}O.o-L)_ ō|Lla rnNOʸÇKSgee@(bi޼9 Agl33&P.B.ݜk`t\ܼM7i lዳ@a&q+VQ7X4)+IhD¹VYUɞ2&PwГeT_iibp0/㋵E}._"6۠SGtuAv0( L0}gLh`FCʗחY@> c~O'TȌ򶲢\uIݾ N"fE#N&U,GgL ZBTߦO]^ W^XWˇ`x 5lU~zw>z~Yϋz-[4_1Oꅨ.ϺSNf6hFՙx Q]SGL 0&`5C^jTé2&`L h 3 0&`L T@`L 0&@ "@`L 0&XT9`L 0&HEurt&`L 0&&`L 0&PE*L 0&233+WZB۶mѢE:[Ϛꚠi2J/u%(nRRRvޝu%ڒEu%`qP&PSg]j[|Am-aU'& AU=ZRfk cMg!@EG& P\xZ-;&}.]_J@WԛXTJR$]tzAsI HyDZs^;Gĸ>q4&P  RԜZS{afg:FX]Nġ-Ѳv^j|7b4F|j$fy/6CX6uhI[<_%]+P>.e_:Gg|(55YƵS71_jcpsEԋzK|hРn / 9/E!v ۗgb<ïŃ+rXk.:2q z.]6q/D5`>haVN̚W'm}_AXL{2c‘͘<T%] \X_# 3Tr587JMnZC[(Ѩ5ro/na]|1/Q&{ 5f B&_Xhĺ"Wٶ(->% o߾}_K+ѸGe!t~t;}ĮыRfCW[ݫ{Q;si?%g@ٜ6Cr 4 jdeBT,*@D'(>c[2>@gm/Fͺ\);LK'@ZcfbŬK™Aœg\N맣mwQ'Tm.:/?X yxnx۷ߩq(|$KBr.^8emlusF [- M!ۺu+T*:vrK"Q;D-Dh%Dz{|ޜK;KJ71NW>ѰaOȖr䛜w(/զhIqh9O/ :sRĘM:VOJ/t4c"N݄,]laqH'V/:e'#NPbڸbf4ٌɢsi6e1 &6 u^93+iLWO|4F| pY"/ca {WOqz{Ӳpe%ܖmOX~T1l3 ş$]uŐ: Izc- (Q\ؾeNWҤ)R!E"^Olxrg]@:v9![tl_?IUS}.A=d98KҲvEES>>嗿4;o@g15b.xV!=qN]~kiO`r'O[q.4 V?q.\#XmF)ݦjJd|Le^<(ԏ|Cr=|<P裏*_NnduQ:WǑ%{iXKÐx,< q&7A*g&"lA|aL\gǟ{WT~mQO6 TeQ]3Xsq$|qme:+.Iؑ#y|(p4, I=[o]ۢmg%~>d5xaɹDŽ:[7 Q&EYc! ֒~ $'ks]fځidII[sv8%{_ {83!5 #y~;y_B^NߦSM::uH_i}+쨨4F^-z%)~d'~#gL:ĥX% [u9N*h\nX"XFe '/ IǬ#tLQ4<ô: 0oᇷ)lCZ,B橃?xju?k/JK[-ѝb1qpA&XhoiP5)؈BklfJh-~L <8-[IşDלJRZ6uxeV8q]6ܧt+y=,|tl.UjmO@zuқ)To.2[}@YFtV>N?4V]A?o L*,}ڒP^ߘinWaƪi/&ދv 1b~ hZOsw!%%Ӵ}n;: _mW!-K v[*VDZwFz!l Y?߆Ā=REѣum/DȬ34:y_:o,zP9_IiQst=|O#zp^TTz_%O}2.M ;#4LAVd㟯>lJ>|+ItBfEoft!|PۦQC]Yz de,W'I:/x.^ŒeE댈_F4]܈ꜦY.*F4Zh^~e3FZ?9&I`?cuHJϢIUrZL_u5q zӗiIWaL w+:Ҏi1>T ?/GʰI,+՜ْ| GaH )i.g4qѥ/χBɜhY%Iz}$n_)QOe\'¾N1qcNz0Laza\~_ q`8L=\&ˀҞ;NpђX&{9ھ^`<bM2NH%L~:YNT.ǜ7wAy n-x@]Bw A T9IlϟUeٮe=.iq}I{ p+?6KgbT)pA Ցox ba,Ew͌98B7_w[,qd]vωC\\O>Cof|掅2t\D>+',֮ዛHg/'lfӿ(TF99nAAA={6aff3vL 0/kio-1 zB[bE[m?, ߆ ֽ?zahwKXYJϹ0'BQcLmmc E~bml167"rõիW1E1E_Mְ퇆,hgLhSDaĸ-=Oܱ2q YNqn[ V 71(Fa ˻)%k<6PUrҾn7?lD'%; KLeId.~rlypKKSCacwyq=q?]K rz˖-4i4FdXOļ%g 2H2>c!GjSYEv,vhw>':aڅp'%`DrKw%߽-mc' !l UmT2!u XǴp!oxKXPIzWI+#5~(T~ }&MNX܈FàٲWzE|2|wY.qעKo}v w aėL>3?yrL <\6vz7n*NIaIVg* H=A8eѲT۞DDD7߼KPLjTm焘4OxE\םXT{j7Q®-hfqZc cɂZaU~^K ;˩o CX P=+Ǻb),&r,2ɛnDSukax lym)ڔ`u.}VV7n,o`HWZD}EٙNE8$}P}ɥ:kK,Cp#K ^6+YB^c Ry؏ <Zn}-1~Ea-_R-+t,Mg!@κa+ =J/HU%@$#&C駟䄦MZ˗/ET,M%@ Ou !UV5 T 6mH<ҋʅՒnmLD<= Qov`Qm:+j@}k`-K/HA8L( 8::JbSIwBPQov`ZLFԧκFֲDTYdV: :ڰ\Gw֏V{qi`L cL 0&`L XTWGeL 0&`j>`L 0&@ "@`L 0&XT9`L 0&HEurt&`L 0&&`L 0&PE,3&`L 0|0&`L 0*`Q]E 0&`L s 0&`L T*L 0&`LE5L 0&`LXTW GgL 0&`,`L 0&`U$9:`L 0&`Q`L 0&"Uљ`L 0&M **nOaL 0&0 , ]ggg9#`L 0M ..~0R{a {3&`L 0S 6cL 0&`F6`L 0&XTJ1&`L 0#XTL 0&`LT,M%U'iVkj&9ȫlL=jg`L I=Rzah[F`9߈G 49P p3[o|2kO+t Onaxy c"q;,b!YwÆ(INNZs~GEGeGde5u li$ps 80i2~ĴCmC6{P&,m\wŔڮ?#mۛv|[sl[b⚆ q uVx 0&xRmb(9ێv@9 _/r,'K[SoAa]oJqau%l f7)݈&)KaOnW>sƱ2 60bϐ7%Ŕ};HCAMj,cna.ԠU8 F؆P4^hZ GˇT>N)U,IfM(945lclX{h LVhL[-q 0&5XT R!2tvǛcO?:䟞UwEJrK@W}kҁ&4S POɑ=vChNےB7,6 M[ UjJA=Ta={bOP{9 /|=PxU"$VZDCO|/IUḤT"d\6wo-2CoW6P*z*ꐖ.x쉠CR{HbREA31 ~l[K8ܝCP:C% 0y6v-lHR7Bcz!\Cfhfzmho ¾ ȕ85,BϠ2`L 0ET<8Ja3?"hwC?8 6Y;٣C=9@8= K qnQC4HEHBycxh[vi#ǧcXtyG]otPDYr ֳ ]W@,?vB{@|p'|p rY YmCYs2<+TXlX:avx$Cf! /Q8ZN 0Ép"[mii(KF!c6({8 F~ bfmؖl 91wMK{>|',I~|Pӛ.RϽiu ţK%+pvcBr VBI褽=Lm7[t%5h%F/Wᎁ/2&`jSykȺ| aq8#飏qWz)$x/v,@hTꛀ_ oiHڳ #״ŠDz^aE;?ni8UZ+|8 O[_걱Xd^-HW̄3h'z7S$˴p9qHo2$)NɞvJu ']0/vP- ᯓxi~)_0 -6cF޵WLJw")-zNAy!k|Mr4Tw,{aH gAqkM E Qz;W q;^ Ȫ+ F:~8| 0&v|W{Ry0^2s\K:B59*ObB8(;o`Rk!Xqߥ[ëY |g~~NbGcnC"d &Ingp KPNA xqgZ׃Ҡ8(z]2Z"5 ]fM h[bN`@VG*+$$|.?OMoy­${`LF 4sT\SrzZ~Q/p_kcKC167"rõիWf#GZlMYu!h,-:'+M"HDlM[؛dYO7s<9Yhldf@E z܃άFNf!q$Pv.Q"v6,c1&xлwJԲeeWZnn- [#orX9Xy~&/)X ? ,iC>$gPz`iߢXđRzM!XpF,o Yhߢl4UXrU+=L;[^ Ĝ۬oneL 0&pO,TE)Y&y퐕]286xh=]9h?FEUԑ3_r'fL 0&PCꈴ!:l5PD%W ^d`L 0Fآ#[Gsѧl7aT}F?o749P p/Tm{;'C|oO+t Onax}_9EJvX0 KC.fFu7l4J<`]Uw}8~6w•$`L 0&j[MdjD3 * }j:EMG.oMUStq)ʼn?ձn$MwG\ 4t#SƯ>.=f0G|85QFF&r,&ըFRcIӂo0 7غ/FnؐpmǴ 0&`5OEO df64r yɲG'ӳh^qh@IQ~ Ȑ oM:MgoB=1Ih> ?isl7t1-I/tɒ6 R  GN覒ozf QѴ/:GS*ow RjD[C:$oBwYy9jBd|R=Kg Q>^ ^X*=^7`L 0& DNF|=UA-(VM3)5Y߬OBioY$#8IPMaaFN5vþ™5;|M|Av<~눤GpDJќONDFL]qH 4f'vT6 ix bf.H:ʼȢ]W@D$ř^ǤRzjl64κI(M()O{@Dn7 3Khp(.$ (m)$,Nǚ*g'*@\̍`L 0&PJ9NǜѬ$LV8 !ӕў4Qt$dL s}q~;ڃ$bɂlOgf9GӔl.9|7% 7 /F|D"[5ںV$% h9 t_kԺB̵wFJG\B`?5 M?Ȳ*c7Fudn͛h]G3划 fte=&`L <|l6 4q ^CTdފ(q==X!Goj ;iia: lW6揸=K+ޢb w "RzE" _$N=1ݕ[3M]37CCp5\]|ٜ$;3 gY'R2ޗf#,[hiܕ%[VJZ@?@]`L 0&jյ P8`\bRl[žL 0&A,k.']u,5|W=AN 0&`5@@;f`L 0&@<' W4s"9<2\5͍ףW_.1`L %?p/: }0{46ǫ X9V&Bciɣh#5Qkh5D@qM3O( MlSpP\(&2K+/]YT VmJ|\_s=7^tsyʭfO'鼿c_ W& {мMXp =c0v/RÚW\Ê8֯lv7hc!2CHvE+>(P;W T O}N+}zҤ,n8E\s VȋAvl77; n Gܤc7عWф'iXs֎ⴁ|$dѴ$v9z=GJ; nRģl/^AT9MsYڄ^FtV쯩Zq:QCX +Xj4Ǐ2GHliQme8ҕQّaU& QvpxZi/Z%9&MnIQtsڑI>NSH3~$;./ֶEĴ14$6VAW8]|Z ZSNjJO:, \ kay뮃t70eÈ;S2cR y | xRN]̾L 0:O6qqY-_hgsˆZSxwAn5+:ٰanN/bC =>A SuǴسXedOEO XH3T_ o;RZI<ば߀硕H*O<K5P\xee5\R o~2v^A?`5B1d~ |ƠؖXƹ1`=啃]!Xs`.VXÃjB"+d'hPc8Yܰ&r!:aw;IpҰP:?LnExmW[%d,je(ts;KbbM2MО:\rԠ[;yZiQd=V濨Nb\:;Q  dvJhx0VImq2kUfmwfN#b++4y{K+8d~s^u@D<xouSL!\pCBǧc{t&Y~4So1j^;웒#nO9MάVt(-ȥA(~2f IUuGKF)a7hb#' ¹> aRŒi%e+9-[%̣o ҹ 7$--/9 mYԶQTjY5!sVDNP*Uw8]b|fWR'蘋41T'5[}~G0 {0>tf+EAq!x-Kzz``͗B`L%Զm >+0ӽ!a`Y\D"n_jAhQX 2Ѐ4_ៃV}C Ԣ;^Zr~\ICW{lVݰ)]wX:y 4>\x{?&wLE>ZO:/X6bk z·j$2B包Jƒ?d{k=G5wf)OG';g9T@#q_ţM:) l+5R.~KZ.Ă1Vh:7['E_K(APr^(FKT=es|?%T m 7 rF ڂƓOoTaywjV*y?h,/VI6Hȝ>Dz͢8߼WcbzC`)tdh==a~[pD25;|;Ӥ~ s>(M3A R^[}ѩ\D?4VDJ7򿫓G 6\wo=XGSkK]P{D; UC ,-JߐK<;:m%lOwT5mL:/Aa V /F|D"[5-mlI7 .bK܏4ji -cJUA`L`Qmb%' l88 {i8x{mk;Ol)c'@!U߶U'-nƫ WӺ"'aUx |\sHT3P8YJO!Ŗ͉n~x8>L4#W'1tVIq X |$ -H%aƙA CE2`L({(EݙYk )}^$8K@Q qK)Zn qZڢ X<^?ul 4>r:!q kG|lPXu$.p[+sK~ }0A!`}Mc;r[̦N?YR /^^ )V# xBYS⇘Juc&SQjf.V {LY]п`.AMc=-DP{9O߾zz^Vb0NE 6@)`^ D$aQF*㲏׏޷UUe (FM4Kr1kX:631>>>FɴQ_DS3_)#|BrCsl.Q^k8߳>Xrx(xe ^D- \T'-2_D*s3A6NS@cx!L~Kn݂0:z"i= 1w5ԡ"՝ɘM\Cn!,?},\6-F}PL.z8֮?U=!d1 m.:TYMK(?^o/.3h$-GTMAV#*d5Q!8`,^eğ .=M*9urݔ]91g99IH6wWw<< ֓ۅp=7tοn^C_;L'ޜg;A$L5jCQ7K8E)(Jǿo,Cbz-=j ]H±}]? 1_Uc=#<{ތ}᭸gƅZ> 7}`1F%铘 HhW{( 4vaacc\ɘ;;`1w qX8reХK^';'"##{9`-KoRpFu*A^*?KtK&Ǹfc:?\<\Q+ڸ\6GZRd9QlmTuui*&ҷs;ǺTehw%)vd#֙f3s(%/%4\S9x fҹp {]ӿ%ˮ1U֘%bDDz) P5V)saVlH~Df6YWV-Yzo҆-yTxSۤj!Ag٦'i:  ݻwGU|M?6aV6*VgqXXŠȰe2&Gj݃D<[NnMs95Y׬'g5VYZ]c'HK@ 9|O>oG+Q=oKk}^7L8zq9W7uvѡ放-++Ф7 C9o]ᜳH'qx,L# n\:P-2j{V?OYKSk̰j1I Z9Oh@)mUAwZ]/0g܋O-5Q<_ߎ?ByKy蒼J[=vG9k/l1ZX݊2t6 FE٣3CZ ( }E`߱X)|8(%,խ`w 훲1EjSHM"&u$q^oq]JJqIZޙ??!p3~Ei%gw!b4R[15&aI&z$&ڰvf\o&f)6SX_N ƶV3ƚ律ي[C1u^(_XAG2kK> mfr+>v+V]=h]/n'``kOװ}PVȴ=\09Ť }ʚT"OԶD7#ûyG2&oA e|h%Mjuv>HK-ɇKxVPXGvݨ\]9h)JEg:ay%gвde ۷sn=dEOg9TU%rrV\ +hڴԐo هi򧴢s),39 `RLϋs9r5MMrwWWg⭑󪧮Cj =ˌU mmֱ 1.ra -G¡Xn3`6.EIA݌> vvxyEoPr 'eߡ.zͺbTd#RZ/S\YJyWU)*i3@~Gr=J[ Q g!k=mm53ۣ l*va ]0 QtN7~Œ|ڔ Զ5;"e{?# W#5 nc.ƢG"aWvvV,mkH KOp)° C)@pyy,GXt7:9 '!4='b`Ȥ͓.R=O)q&}< ЧX=_('xq@ʔřGt bbXtoݐ*NK#tų˱/PF#-{%MAkn`mx[^}+R\I{9!_6TC>k,yw zD0SdN~=ug6, 뇿E[dxkC}iCXKح<-Ohpfėp;xjQpL,oV=aGJ}Qs^pMFFbRij/{.{޴舶6{aݱkSЗٞIo|JOPzٟʬLʺJ1 |foo7$cضF^VXDIĎNv24I-'Ӝޟ9.?s3Z2V"zX4G%D~<o?CMG}?ƌFvaꐇo:޷>^+ 7#/׹>)D+_߇W"ͷ!2V|Ls(;x&%n(.hȉn-!$l`ʙ[bu u`{R+ :Ԭْ|F3F)`@~AaWܣЏDr(h" M׀n|[ܲ'nd-yfQzq)2Crt?Fio6ܯ<RΏ~B"JlzmtXg:$ӣ+ulC.9Dk߆<$7C 7tj 4}(n3٨'"qbq() Y7Z`$%3,3N쭝hDln~غp1mehx2 ;&QXl}VQL9%4e:xkxm FMK-Hl3e+]k:$2X;(Ix$}gAwdz؜bһXB;f]5nQamc^`)-KI:ڑBbǐ[ GTv,H_1iь2-gˋB!?Ť>tSd |ymVn Wγg[2&~u|_-i{ɡ2 xr1~]> ]{Cx8SCLRwbퟎ"vL5mC)!CM3.C~ /SfaUcp(+3%+ >[qLuaZ7=UP#}7ƵQp]|w`7?:n4q_J?_е^j$~4l刡>jH u&Oz۰* E OOKU#̿leL7i yA%zɦhK*c Wwtv(rh\m6,x\?3>5rpL6e<۠{#n/Mרѵ=Ifct`@ƶ( 6d\#^O gp9뱚}F`JP2:÷68cY޴XWfW2w!{}W\Npį}trc6ؽr(>a4(4`vJOJ&v&U%h`8(4wk~LN@>K7mEsLIь3pծjXr nя5եYi]&IYL5b{+o\zS0)*3w䢱sEMxҾNJ*%C@jO~tр#z6]E4B@DZwz .JDǴ/m}8+2# '7p,Qw@',$%!*(N4.<}:s]OV)s"53)PJ6XHNp6 3D7֝}GsC; L$[xg;gOVg!,)p (ϑ#5~geFuox@|3a y[S~pt<cفQcל={[؇vZu&;gIFFe#(}ڲ͡F8DY5k *҆`ϿA>/O!jc#g+0TɑGފ]h8SSx22{Ɨ|IMvD˟㘽}chf-kO4 n޾ijvBTEYA&?AC07Wmf3H;moy! ,p 9_)9PMҷ I*ዏ+~5E,׏VqJLk፯> du?s%tna_TADЏQܚxu_zM48v~~uz9󥯶ciR.U"(ʍ(ʛbfpj] 9;M01rȽ p==/I&]U)豃l%G_g`Ϲ)c"tuƩV 1(%)3_\ŕO:O7cM?j@f2X$.~?HɑJ&k\(!o‡􁤉uiCq(_6Ԛy4Ma2Ú咔8ƒN32v{ .w80mImB?b#; bȜV8nߔo2 8$D#Ð8'`gq*}Bvfk鬶.8Ծ!,{*PGʞ-{JӜpB7>~K' 0#uϕ|Vzsq(XK1G5ߣe1\m EЮ;Sd,l5ZlwZ;agcH*8>[N}u˱&@@IDAT<@O +< Z"M?uچ_QZA)[L#O aKP_=sAlؠmfPvl/[R`HDI_c`ϣjt {k?.#0ҷqETp 럧kڃۉ(1h5w̧13CFb䧵@ ͑+E/;|E_ѱ<\RU Qknz ՝%nN@qv u_yϭ, -Nhž1ŴZ?KIvT4?TbT+ c*v܄:l_ZJ閉 hЍ|'MKHNFk導Fwg1W=jY f;֯> *Rs4hp +QE?6oKhܓFG(CD%(U`| Oݏc+=e}WQ,Io*%Un҅Kj6v;OC sՆi x}_۴3gMZaTݤ41]cc|*NiHk@zRyש\CMuVCgzMo*:UJ-yf=/ɓnEVLoDރ<w3^%*ž#pTUDĩ6?WTRSmb/!`&%~Q[rY- @ǚ kWdt,bNKKɦa>o}8N uB Yۚc6Vː P;CEN/A@A@G )BHXA&&   @S]=>u@IA6,S5koӼUE)ΧfW,ovA%mߝ.;@)-x>by:drKv>ǒvג*?@IfO$:٦KydE>]?G/L|ٴE @@ǰrvZؖ?]W\A;׍C/}Ur KvoJ l݆ -rvG1gʇHb"X|>: iG%Dq')OxKXT+gk-JBhXIk-XԥsQ3 j<8tޤ##´m΅wDDb,m͔}SL@j)+}[0~9`>bDRWֽVlPp9ک"_PJ= .hUY[q`I[;D56Gi]) =qGhmmAg_J۫oń cC^b҆|㵿ay*sj[}"C]<#7 YZ!&n }l|U%Zhq?G@.~ .B~?d+-I0a &70GSZMk#57a\Q.]7iߥ }_Z2/<;1>3݋cc`_u<~1 3 F={VyA^<ԇXd Ak1}ha:E3ot98S ɯQfmOW]=YdžGЊ.}b=ǿіVGp̎ }xwLHZ?Zd_잹 NC%I[,%7>ڇ'6&bfUv< wv,CMU&n AFZcwOʼ)!!͐E~?rHW@ڦзmƸ6N4iVɗigvj)/ )\v9ɹv5us1݃/¾˴٭L8HԐeb|mrl?׆ո^=t:cbܭ֡!]a-$ e?hk  NڟҶPu3_t}r;?ow? NSy%ɘD|}j^{\,FE6B(LƯ=/C, Rmf4x8v R}Yyۥh{ X5&-;hVf"nsW`k"sZ$<-`唝(|h36Dxla-KwfigKTs=S[AAMtڄj77ETwa.D:Zޗv`ڗV~Yd,3xNWV]ظew^&jc89Bo .C_s n'?ܭ9vv-o>v]\O;Vhu$D`Io*#z6CMځ}7n,@^iBK ̚2C Z&k1üE+0PF`JF,56a kXؽ}m؅^ۗ!~ˋ'aYXqػ[^vJ<&v+rO{NS ?Aã p<[??==?3>;|p~H@tuê2;1x~ѳ9"r:(*g0 ꀜˍm%9ɒScup1o »X5@WB[<'bΛ3;6%4Z73_FE0 "`IZQo'aHgw f,£e3v#x5|Eq%@#RsS6ҖU=d|,=Day0mh";E(mٓt.†EC΢ e vO=qf{4SUҽhC8|pqۆgCx6p{ŒF~Rhoh'&iD}B4"57li〄 _#؝aw)R3Pzx5R֫?Obt'A ,0lj(CMLwGhS&9 'i/xyVZcqVҋec1 ܧ4 ЧX=_4!jpqm!MtG&Ʊޚ1r(q[i|읖/79Jwxu.q6L#hQJQp'h5cp<6v=;r  0Fn7p1L_rz=,ֆahbkqsS=ԎhS#ЦFzėp;xjQpج"okxug$?G/zLgdd$&.^>_];Ҷhچ;ď(wv:N4}/ mB)mf=E3^2+Skr731X0-TYa]O"vD(8j'B"7M/`=_4F* p!w^yߏ1hU}:!$3e7xhb?|\J{>zWl n*Աt pT6DƊP?Ϥ ٻB– *< |㗈CIip:xˑi02N쭝hDln~غpshx2 hE-BKٝl2 qƖ#Vyo1snܟ+,1aLIc,HVͤr͐t&nnB s8RO#'QQ*V8A*:mĢdz/ͮ5d"a~1ƤM7#xyQ(Bbǐ+ GTvz(ybRpZl/mxB 5~OK/\;Ϟof,KׯnE4=4RPuTMۭ'Vb86@%u'(bga]ӭ4,zhC5eCHܯ`!E`jL4,jZ<e`deg+*WsTWEyRDuRxi$bA*m9kV2!n(b8ήg tÇ߁gc,Ͷ0OI?__jX%F3#&4:#:'mX;=mu./[`<Ӎi%e8yMv.-'~/zVLBMу{Oc$+v%oCMeײF_yf/:tڃAO>L96*GW=pr7N!Ӄ&SLw7pPޝVzau~ֶ&7A}HB,5eØ%g l@:9ޏUy<}Twq۷ޥtKlm5ZLpLItf}^)G;p+RzF|aKyzA^( ;9[ R*)&wʣv8귄nA75ipg[ҥ^J?kK;Ց7qĎ:l%zɦPk<Cg#)8N:K=N9;L=ʂjOOÜ!ޙDL] qú$9 7^ c#M'm B]iڀ׃ ?QTv QseWNƄAOmhc܀Mm\vq MH|{ .nhɸ5m}(בM^Vl~6!Ϡ(ظal裦fC i

^ĩO>Gʔ$8^*MΡ!Z-qá23=)ך,'f1wp9XyӇp+8_?IQ #5nyR"HU`qM}J4uqNºiQU܍3#ޣ=|[fdv9^GՅߢK;Yp<5% cep{q]أj/wrN8FҪ['DٛF4ѶԾz*dLk!ǨB\䒢yǟHG Q]?ٌךbQ3=LMġ5EFgW$Kb끖vcz#QpzV8T$ݴYfwL=FWFF5q^ZUek9׍nj6cV1७BpzX13KCY>S.T<fÅmhQ<ǖQ5Pޱמ0ʟ==/$v v5v":kC)8,]{_5H]i*MsA9G2o ⡫O9m^܎ ޤich}{b ;_fZ3S@;xL޼i4 NWo=>類IqnWԯiӹ GVKN̅p=7pz9M I|mG!p Nf{ ־Ky"'a.aV?@UZRl=C7V$J<oKƞsASh"peFdL}E|GbJ\zrtɎ9_i%:t)sWhN^璽0lcĩM}rtB!m#T׍ e pnel9]n`ĕ8Ӧ#.|4W4 { BY%\yAPڧ9֜T^#!_6_$?Q,#|h2``|;i{?E~f(:Vv}'cх_vzh5OC0j@М3i"{emcML)-x9^!?oQPêS*;kQ!8EsO:oC(L O0?<'&Y –ARl}+Tj|%e jMGjIJS^sS)xpKߪ;FDžo0Pp 럧kڃۉ(1h%߱+38_n}}J6ĸ{[.w 3rCѝC~N|;]#peGK0:֚SMxu=d5WkbX/|/wvˏӷ BP̌uZ~לj5g SaqYlTm8s=SVmMs9]czg;6-ZTEHA@ہ˗9r l~M#է]h?58W7*/c\mtg\镌v TM+c2H129ҾhF?U1WNq@y''s+J&\A@;TM&hq9՝W3VnP ~uٞ,?%W\pIřLmk+}TA9Ѫfziu mc:^ATw,^  :)Ra;L*^Zqƹ|3\NT،s^Nu`wv`@*sWan*8'eLsXՍB  mtDqEʆj,q:&^rVюwnũ$W\aǃrE6O^9lav39 I9㼔LJǜ A@An!"=2;}(]] VUtVf2ߊS1W̉TS:N+;W88'yq=;zXcLϙLy*RypA@A@&dl2t;rG[](g*K+bVU)L.tBP*t*\;1)m8֩N3gRN6dzӫ8s)zRW"$  w cIɘ?SqUez\d*/Fa.T.v$eR;ʕr*;tz8O]laE0+ұ=˔as&]Š[-*:+pA@A@ʯQeq?Qq?1gzeJnƕ^na 3gzؙHde%\+OW+8r;V?>1\sX9ºvZ9ъNJd1w qNädaC)A@A@o,'Sqq·JWW:.ʆ*8H3JL_E^J&+;uƌn^) NzTcTZg(J/\A@IT،L؞})g|+%g\T:F91IU::GR8U+S^ʋ* $Nq%W@ tʗL+n2:8ۨ0s&Gn_A@A@Mؿaҹ\򻘳NaWv*o+a9[cFUZeƕTN ;rG[]:N21f2q:>*=tY;T:Q ~:3-aC)A@A@Hg91u',2SgJr=Wz:98?&G /ڕ8trX*nc&㓠ұ:Qf4qZ1\TX镜mUXq9,$ ;Lfe\Y,;YaV锭SyIŭ1_g2e8SN5rBL6*8ۛhgg^HUIq&Uη:YٲQ?%W(̙tU"A@A@{O,2%WasZtq%c{q%3z”vFS]jèdJ|0*le*fa>1L*TY+,gZqWq֩0s&GnZ*.  w RuP2s,RNWac)]gfs sbR+dҦz:%W\T%^WZϜ v<*N8s&1)>dl_%SvJ\?q.Yª\'WfbXkc[}NA@A—r wWagctwf{cnV6z]NI+׃uXHWrW휆]v'j@4ze9sea3je:鎵s9S:5a*_2gRqǰJ&\A@708dfa%c/JdW?;%SVÜIUL٩tʮV_WT!NrDv^qeIWrF"NwqfNQy;rWYWvA@A@簊\ɫ)=\g,W?,G{K\L8,MTU+ΥQNq 3LV- @C (Kr줷J0bm6=8q,>Q:|JTP;4fk>nlVıs7j#>s'nbltwj] H@$ d -ԡzѰhѦOج[#៵;[{d6ysr9@r3O{>03fOhY}5~b܇>|kMg_X޶nk%  H@"3Xql1o16u/>ytևlϢ}<(Oc\low~lE"sɞ!{#}R۝b?_uU H@$ACfmb#Kݑe&q|lԒˍS=~JCRxV{?R̆y8b0l|  L[OmGˊڬ4=fm>豬䳰ߒ>$  H@7$3>OjZ|5Ѣ3m=gzjj\OMk?mʥ4O=N?\ ^c4h7ZgO. H@$S}||VjX=l=T璫m.?k; كڬ/qƏ=y+VGșѲlª%J@$ ?I;t'N3:cb~SO}!q{g չf>-5I` =#q_\lԺ$  H@w'0g1E;'Ɵ1uK>vΊ5ExPOcy\a}V/@0>{&=iG=I~l%xG$  H@~a8:QLd}SO nԃ~گ}Nw_38-L={dO \|Gg!~hmSm-K$  @/>-~DQ3ñgϧK}bw>G:g y0g%[Ǐ~MxD9XN==SsZg_겢gMg$  H@3Pߢ^ԉl8 }onZlǏ͢%xN}wx}zh'Ʀ3g鳆Z2_:]z=c}Ԣūח$  H@_M`5Mmƹc4=Lր{3tr_ج?ӏ4y7\tƹ*wXC[g ' Ѩ%Y{kٛ% H@~cV>ڴyhӲ;7p̾q9d/\'?cm?MuNZ|[u R$=O״ֻg>sh%  H@w#0ʎCr;ctj͞%BDއ|YR3m +<عosVh?:Xö?\k}+! H@9pw{cuhݛ<ڌ#:l(O:jW>9uMkmۧs{uMrX$  Ѡk{j:O=۽gQ{n#<@Rl,~j:^է&%) H@ռ2O˛F_ZϞֽڧ/-{o~S~n;R.NG>q[yu֞}dtZ H@$ {z9|,Du]i{=W:Z[z635s$  H@,ɪ5IDATx6߆j:Ӗ<6:ЉcY_{ZǏCuz dKf{q+> w?{Z%  H@O"0}j353O<-\V:ZnهxUs=[4}P5] dKXs݋tZ&?kCöu+OѴ$  H=}j[Rm{N?ԟ=P簗 [Mb⩧=خ;i%  H@O%PW׹=v]r{N^rs樂bNWzдTWzg<'OmzO>]V+ H@^Mw+G׵GK]V5:_j_Mun}[ۭ#(7gݽgVM$  :ݫǮt4}yշ9Cv@xv;VclE̞_H@$ ?@`5޺3/}g5=6-C5g=[b[o`rgj짏V$  GQ;\}|}/sz+ 7^Guڕ}t$  H@x69gϚY{{kϯsہ屳֣\ڭ+m=:$  HdڳҺQW9ˇj(> Ύ=;vU$  H@wG=Rh忝ScCu.tr[Hi$  H5ș}jng׃ߜ?:Ts'i!3{x$  H@W z Й=gjr松Peb_0`Ҿ|U$ oO@{Ms; nrw~$  H@ӃawC5ĀWʯ{h%  H@Wką>?bov* H@:'0HPݗسխ!!$  2$ӆ>?~/ j$  H@~zr^(7$$  Hu?7T8s(?C H@~:m(~ˡQ$  H@ ' H@$  image/svg+xml Jakub Steiner http://jimmac.musichall.cz battery apm acpi power management sqlitebrowser-3.10.1/libs/000077500000000000000000000000001316047212700154355ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/DB4S_PATCHES000066400000000000000000000007531316047212700172300ustar00rootroot00000000000000diff --git a/libs/qscintilla/lexers/LexSQL.cpp b/libs/qscintilla/lexers/LexSQL.cpp index 1d00918..086955a 100644 --- a/libs/qscintilla/lexers/LexSQL.cpp +++ b/libs/qscintilla/lexers/LexSQL.cpp @@ -546,7 +546,7 @@ void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int i } break; case SCE_SQL_STRING: - if (sc.ch == '\\') { + if (options.sqlBackslashEscapes && sc.ch == '\\') { // Escape sequence sc.Forward(); } else if (sc.ch == '\"') { sqlitebrowser-3.10.1/libs/antlr-2.7.7/000077500000000000000000000000001316047212700172265ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/antlr-2.7.7/AUTHORS000066400000000000000000000000611316047212700202730ustar00rootroot00000000000000Author: Peter Wells sqlitebrowser-3.10.1/libs/antlr-2.7.7/CMakeLists.txt000066400000000000000000000043621316047212700217730ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.6) set(ANTLR_SRC src/ANTLRUtil.cpp src/ASTFactory.cpp src/ASTNULLType.cpp src/ASTRefCount.cpp src/BaseAST.cpp src/BitSet.cpp src/CharBuffer.cpp src/CharScanner.cpp src/CommonAST.cpp src/CommonASTWithHiddenTokens.cpp src/CommonHiddenStreamToken.cpp src/CommonToken.cpp src/InputBuffer.cpp src/LLkParser.cpp src/MismatchedCharException.cpp src/MismatchedTokenException.cpp src/NoViableAltException.cpp src/NoViableAltForCharException.cpp src/Parser.cpp src/RecognitionException.cpp src/String.cpp src/Token.cpp src/TokenBuffer.cpp src/TokenRefCount.cpp src/TokenStreamBasicFilter.cpp src/TokenStreamHiddenTokenFilter.cpp src/TokenStreamRewriteEngine.cpp src/TokenStreamSelector.cpp src/TreeParser.cpp ) set(ANTLR_HDR antlr/ANTLRException.hpp antlr/ANTLRUtil.hpp antlr/AST.hpp antlr/ASTArray.hpp antlr/ASTFactory.hpp antlr/ASTNULLType.hpp antlr/ASTPair.hpp antlr/ASTRefCount.hpp antlr/BaseAST.hpp antlr/BitSet.hpp antlr/CharBuffer.hpp antlr/CharInputBuffer.hpp antlr/CharScanner.hpp antlr/CharStreamException.hpp antlr/CharStreamIOException.hpp antlr/CircularQueue.hpp antlr/CommonAST.hpp antlr/CommonASTWithHiddenTokens.hpp antlr/CommonHiddenStreamToken.hpp antlr/CommonToken.hpp antlr/IOException.hpp antlr/InputBuffer.hpp antlr/LLkParser.hpp antlr/LexerSharedInputState.hpp antlr/MismatchedCharException.hpp antlr/MismatchedTokenException.hpp antlr/NoViableAltException.hpp antlr/NoViableAltForCharException.hpp antlr/Parser.hpp antlr/ParserSharedInputState.hpp antlr/RecognitionException.hpp antlr/RefCount.hpp antlr/SemanticException.hpp antlr/String.hpp antlr/Token.hpp antlr/TokenBuffer.hpp antlr/TokenRefCount.hpp antlr/TokenStream.hpp antlr/TokenStreamBasicFilter.hpp antlr/TokenStreamException.hpp antlr/TokenStreamHiddenTokenFilter.hpp antlr/TokenStreamIOException.hpp antlr/TokenStreamRecognitionException.hpp antlr/TokenStreamRetryException.hpp antlr/TokenStreamRewriteEngine.hpp antlr/TokenStreamSelector.hpp antlr/TokenWithIndex.hpp antlr/TreeParser.hpp antlr/TreeParserSharedInputState.hpp antlr/config.hpp ) include_directories(.) add_library(antlr ${ANTLR_SRC} ${ANTLR_HDR}) sqlitebrowser-3.10.1/libs/antlr-2.7.7/LICENSE.txt000066400000000000000000000022531316047212700210530ustar00rootroot00000000000000 SOFTWARE RIGHTS ANTLR 1989-2006 Developed by Terence Parr Partially supported by University of San Francisco & jGuru.com We reserve no legal rights to the ANTLR--it is fully in the public domain. An individual or company may do whatever they wish with source code distributed with ANTLR or the code generated by ANTLR, including the incorporation of ANTLR, or its output, into commerical software. We encourage users to develop software with ANTLR. However, we do ask that credit is given to us for developing ANTLR. By "credit", we mean that if you use ANTLR or incorporate any source code into one of your programs (commercial product, research project, or otherwise) that you acknowledge this fact somewhere in the documentation, research report, etc... If you like ANTLR and have developed a nice tool with the output, please mention that you developed it using ANTLR. In addition, we ask that the headers remain intact in our source code. As long as these guidelines are kept, we expect to continue enhancing this system and expect to make other tools available as they are completed. The primary ANTLR guy: Terence Parr parrt@cs.usfca.edu parrt@antlr.org sqlitebrowser-3.10.1/libs/antlr-2.7.7/README000066400000000000000000000143451316047212700201150ustar00rootroot00000000000000ANTLR C++ Support Libraries Additional Notes 1.1 Using Microsoft Visual C++ Currently this is still (or again) somewhat experimental. MSVC is not the development platform and I don't have access to the compiler currently. YMMV Make sure you compile the library *and* your project with the same settings. (multithreaded/debug/etc.) Visual C++ 6 only is supported for static builds. Some hacking and STLPort is needed to build a DLL (only for experts). Visual C++ 7.0 and 7.1 should support both static and DLL builds (DLL builds might be broken). In general the main problem is getting the right template instantiations into the DLL. For 7.0 you might have to tweak the list in lib/cpp/src/dll.cpp. I'm told 7.1 does not need this. For a static build (works probably best) 1. Create a win32 static library project. 2. Enable RTTI. (Run Time Type Information) 3. Add the source files from /antlr/lib/cpp/src to the project (except dll.cpp) put /antlr/lib/cpp in the search path for include files. For the DLL build (MSVC 7.0 tested) * Project settings ("create new project" dialogs) - Win32 project - Application Settings - Application type - DLL - Additional options - Export symbols * Project properties (change defaults to) - Configuration Properties - C/C++ - General - Additional Include Directories - drive:\antlr-2.7.2\lib\cpp - Preprocessor - Preprocessor Definitions - WIN32;_DEBUG;_WINDOWS;_USRDLL;ANTLR_EXPORTS - Code Generation - Runtime Library - Multi-threaded Debug DLL (/MDd) - Enable Function-Level Linking: - Yes - Language - Enable Run-Time Type Info - Yes - Precompiled Headers - Create/Use Precompiled Headers NOTE: Do not use the antlr generated and support library in a multithreaded way. It was not designed for a multithreaded environment. 1.3 Building with GCJ NOTE: outdated the new Makefiles do not support this anymore. It is also possible to build a native binary of ANTLR. This is somewhat experimental and can be enabled by giving the --enable-gcj option to configure. You need a recent GCC to do this and even then the constructed binary crashes on some platforms. 2. Tested Compilers for this release Don't get worried if your favourite compiler is not mentioned here. Any somewhat recent ISO compliant C++ compiler should have little trouble with the runtime library. *NOTE* this section was not updated for the new configure script/Makefiles some of the things listed here to pass different flags to configure may not work anymore. Check INSTALL.txt or handedit generated scripts after configure. 2.1 Solaris 2.1.1 Sun Workshop 6.0 Identifies itself as: CC: Sun WorkShop 6 2000/08/30 C++ 5.1 Patch 109490-01 Compiles out of the box configure using: CXX=CC CC=cc AR=CC ARFLAGS="-xar -o" ./configure Use CC to make the archive to ensure bundling of template instances. Check manpage for details. 2.1.2 GCC Tested 3.0.4, 3.2.1, 3.2.3, 3.3.2, 3.4.0. All tested gcc are using a recent GNU binutils for linker and assembler. You will probably run into trouble if you use the solaris linker/assembler. 2.2 Windows 2.2.1 Visual C++ Visual C++ 6.0 reported to work well with static build. DLL build not supported (reported to work when using STLPort in previous ANTLR versions). I heart that in some cases there could be problems with precompiled headers and the use of normal '/' in the #include directives (with service pack 5). Visual C++ 7.0 reported to work, might need some tweaks for DLL builds due to some shuffling around in the code. Visual C++ 7.1 reported to work, might need some tweaks, see above. My current guess is that DLL builds are all over the line broken. A workaround is to make a DLL from the complete generated parser including the static ANTLR support library. 2.2.2 Cygwin/MinGW Not expecting any big problems maybe some tweaks needed in configure. 3. Old notes for a number of compilers 3.1 SGI Irix 6.5.10 MIPSPro compiler You can't compile ANTLR with the MIPSPro compiler on anything < 6.5.10 because SGI just fixed a big bug dealing with namespaces in that release. Note: To get it to compile do basically the following: CC=cc CXX=CC CXXFLAGS=-LANG:std ./configure --prefix=/usr/local/antlr Note probably dates back to 2.7.0-2.7.1 era. 3.2 Sun CC 5 It may be you'll have to change one or two static_cast()'s to a C-style cast. (think that's a compiler bug) Configure using: CXX=CC CC=cc RANLIB="CC -xar" ./configure The custom ranlib is needed to get the template instances into the archive. Check manpages. Maybe the Sun CC 6 instructions above will work as well. 3.3 GCC on some platforms (Alpha Tru64) The -pipe option not supported it seems. Configure using: CFLAGS="-W -Wall" ./configure Or remove the -pipe's from the generated scripts/Config.make. 4. IT DOESN'T WORK!? 4.1 Compile problems The ANTLR code uses some relatively new features of C++ which not all compilers support yet (such as namespaces, and new style standard headers). At the moment, you may be able to work around the problem with a few nasty tricks: Try creating some header files like 'iostream' just containing: #include and compile with an option to define away the word 'std', such as CC .... -Dstd= .... Also in the antlr subdirectory there's a file config.hpp. Tweak this one to enable/disable the different bells and whistles used in the rest of the code. Don't forget to submit those changes back to us (along with compiler info) so we can incorporate them in our next release! 4.2 Reporting problems When reporting problems please try to be as specific as possible e.g. mention ANTLR release, and try to provide a clear and minimal example of what goes wrong and what you expected. Bug reports can be done to Terence or the current subsystem maintainers as mentioned in the doc directory. Another option is to use the mailing list linked from http://www.antlr.org. Before reporting a problem you might want to try with a development snapshot, there is a link to these in the File Sharing section of http://www.antlr.org. sqlitebrowser-3.10.1/libs/antlr-2.7.7/TODO000066400000000000000000000066471316047212700177330ustar00rootroot00000000000000* ANTLR should issue a warning if you have protected rules and filter == true or filter=IGNORE in a lexer? This can be tackled by tracking rule references in a more general approach. * Have a look at the doc's. * Add allocators to the objects * Look more at exception handling * TreeParser.cpp around line 76 the MismatchedTokenException here does not use ttype to improve it's errormessage. Would require changing a bit in MismatchedTokenException.cpp * On Thu, Sep 21, 2000 at 12:33:48AM -0700, John Lambert wrote: > 1) The literal EOF is not defined and causes the define of EOF_CHAR in > CharScanner.hpp to fail. ANTLR with STL Port. Changing the EOF define to char_traits::eof() breaks things for gcc-2.95.2. Fix this in next release portably. http://www.egroups.com/message/antlr-interest/2520 * Fix heterogeneous AST stuff. It boils down to adding a method to AST types that knows how to duplicate the sucker. -> done clone() added. Knowing one factory is not enough. -> done in C++ have a superfactory. Also look at having to set the astfactory by hand (this is not 100% necessary). Double check generated code. http://groups.yahoo.com/group/antlr-interest/message/2496 * Look at messageLog stuff Ross Bencina proposed. Looks good at first glance. http://www.egroups.com/message/antlr-interest/2555 * Add RW_STL & CC 4.2 patch from Ulrich Teichert: See my mailbox.. and these comments from Ross Bencina: http://www.egroups.com/message/antlr-interest/2494 * in action.g (java and C++) ##.initialize / ##->initialize is not recognized as an assigment to the root node. In the case ## is followed by ./-> initialize transInfo.assignToRoot should be set to true. Report by Matthew Ford (12 march 2001) * Add TokenLabelType option for generated lexers. Hmmm can already set token factory. Then again.. you may run into a cast fest.. * Fix some #line counting oddities (Mike Barnett) > nonterm > { > ## = #([TOK,"TOK"], > ... Other stuff ... > ); > f(); > } generates wrong #line info need to fix action.g a bit better. * This one triggers a bug in antlr's codegen. #perform_action = #( create_tau_ast(#p1->getLine(),#p1->getColumn()), #p1 ); #p1 are replaced by p1 in stead of p1_AST. It's really time to rewrite this mess. Workaround: RefModest_AST tau = create_tau_ast(#p1->getLine(),#p1->getColumn()); #perform_action = #( tau, #p1 ); * Unicode and related. - The patch from Jean-Daniel Fekete is an approach. But has some issues. + It is probably necessary to discern an 'internal' string/char type and 'external' ones. The external ones are for the lexer input. The 'internal ones' are for standard antlr error messages etc. Translators from external to internal should be provided. Hmm on second thought.. probably not really an issue. + What should the lexer read? - Unicode units from a 'unicode reader' in a sense this unicode reader is a lexer itself. Just reading iconv/iconv_open manpages.. Maybe we can hide this with iconv in the InputBuffer mechanisms? - Interpret unicode ourselves. Ugh don't want to think of that right now. we probably redo something that has been done. Only problem is that we need something that's portable (C++ case) + What changes are necessary in the rest of the code to support a wide character set? Think most should be handled in/below the lexer level. sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr.pro000066400000000000000000000050101316047212700210640ustar00rootroot00000000000000TEMPLATE = lib CONFIG += staticlib CONFIG += debug_and_release INCLUDEPATH += ./ HEADERS += \ antlr/config.hpp \ antlr/TreeParserSharedInputState.hpp \ antlr/TreeParser.hpp \ antlr/TokenWithIndex.hpp \ antlr/TokenStreamSelector.hpp \ antlr/TokenStreamRewriteEngine.hpp \ antlr/TokenStreamRetryException.hpp \ antlr/TokenStreamRecognitionException.hpp \ antlr/TokenStreamIOException.hpp \ antlr/TokenStreamHiddenTokenFilter.hpp \ antlr/TokenStreamException.hpp \ antlr/TokenStreamBasicFilter.hpp \ antlr/TokenStream.hpp \ antlr/TokenRefCount.hpp \ antlr/TokenBuffer.hpp \ antlr/Token.hpp \ antlr/String.hpp \ antlr/SemanticException.hpp \ antlr/RefCount.hpp \ antlr/RecognitionException.hpp \ antlr/ParserSharedInputState.hpp \ antlr/Parser.hpp \ antlr/NoViableAltForCharException.hpp \ antlr/NoViableAltException.hpp \ antlr/MismatchedTokenException.hpp \ antlr/MismatchedCharException.hpp \ antlr/LexerSharedInputState.hpp \ antlr/LLkParser.hpp \ antlr/InputBuffer.hpp \ antlr/IOException.hpp \ antlr/CommonToken.hpp \ antlr/CommonHiddenStreamToken.hpp \ antlr/CommonASTWithHiddenTokens.hpp \ antlr/CommonAST.hpp \ antlr/CircularQueue.hpp \ antlr/CharStreamIOException.hpp \ antlr/CharStreamException.hpp \ antlr/CharScanner.hpp \ antlr/CharInputBuffer.hpp \ antlr/CharBuffer.hpp \ antlr/BitSet.hpp \ antlr/BaseAST.hpp \ antlr/ASTRefCount.hpp \ antlr/ASTPair.hpp \ antlr/ASTNULLType.hpp \ antlr/ASTFactory.hpp \ antlr/ASTArray.hpp \ antlr/AST.hpp \ antlr/ANTLRUtil.hpp \ antlr/ANTLRException.hpp SOURCES += \ src/TreeParser.cpp \ src/TokenStreamSelector.cpp \ src/TokenStreamRewriteEngine.cpp \ src/TokenStreamHiddenTokenFilter.cpp \ src/TokenStreamBasicFilter.cpp \ src/TokenRefCount.cpp \ src/TokenBuffer.cpp \ src/Token.cpp \ src/String.cpp \ src/RecognitionException.cpp \ src/Parser.cpp \ src/NoViableAltForCharException.cpp \ src/NoViableAltException.cpp \ src/MismatchedTokenException.cpp \ src/MismatchedCharException.cpp \ src/LLkParser.cpp \ src/InputBuffer.cpp \ src/CommonToken.cpp \ src/CommonHiddenStreamToken.cpp \ src/CommonASTWithHiddenTokens.cpp \ src/CommonAST.cpp \ src/CharScanner.cpp \ src/CharBuffer.cpp \ src/BitSet.cpp \ src/BaseAST.cpp \ src/ASTRefCount.cpp \ src/ASTNULLType.cpp \ src/ASTFactory.cpp \ src/ANTLRUtil.cpp sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/000077500000000000000000000000001316047212700203465ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ANTLRException.hpp000066400000000000000000000026461316047212700236260ustar00rootroot00000000000000#ifndef INC_ANTLRException_hpp__ #define INC_ANTLRException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ANTLRException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API ANTLRException { public: /// Create ANTLR base exception without error message ANTLRException() : text("") { } /// Create ANTLR base exception with error message ANTLRException(const ANTLR_USE_NAMESPACE(std)string& s) : text(s) { } virtual ~ANTLRException() throw() { } /** Return complete error message with line/column number info (if present) * @note for your own exceptions override this one. Call getMessage from * here to get the 'clean' error message stored in the text attribute. */ virtual ANTLR_USE_NAMESPACE(std)string toString() const { return text; } /** Return error message without additional info (if present) * @note when making your own exceptions classes override toString * and call in toString getMessage which relays the text attribute * from here. */ virtual ANTLR_USE_NAMESPACE(std)string getMessage() const { return text; } private: ANTLR_USE_NAMESPACE(std)string text; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_ANTLRException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ANTLRUtil.hpp000066400000000000000000000032071316047212700225770ustar00rootroot00000000000000#ifndef INC_ANTLRUtil_hpp__ #define INC_ANTLRUtil_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** Eat whitespace from the input stream * @param is the stream to read from */ ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is ); /** Read a string enclosed by '"' from a stream. Also handles escaping of \". * Skips leading whitespace. * @param in the istream to read from. * @returns the string read from file exclusive the '"' * @throws ios_base::failure if string is badly formatted */ ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in ); /* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace. * @param in the istream to read from. */ ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in ); /** Read a attribute="value" thing. Leading whitespace is skipped. * Between attribute and '=' no whitespace is allowed. After the '=' it is * permitted. * @param in the istream to read from. * @param attribute string the attribute name is put in * @param value string the value of the attribute is put in * @throws ios_base::failure if something is fishy. E.g. malformed quoting * or missing '=' */ void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in, ANTLR_USE_NAMESPACE(std)string& attribute, ANTLR_USE_NAMESPACE(std)string& value ); #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/AST.hpp000066400000000000000000000123021316047212700215040ustar00rootroot00000000000000#ifndef INC_AST_hpp__ #define INC_AST_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/AST.hpp#2 $ */ #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif struct ASTRef; class ANTLR_API AST { public: AST() : ref(0) {} AST(const AST&) : ref(0) {} virtual ~AST() {} /// Return the type name for this AST node. (for XML output) virtual const char* typeName( void ) const = 0; /// Clone this AST node. virtual RefAST clone( void ) const = 0; /// Is node t equal to this in terms of token type and text? virtual bool equals(RefAST t) const = 0; /** Is t an exact structural and equals() match of this tree. The * 'this' reference is considered the start of a sibling list. */ virtual bool equalsList(RefAST t) const = 0; /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. */ virtual bool equalsListPartial(RefAST t) const = 0; /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are * ignored. */ virtual bool equalsTree(RefAST t) const = 0; /** Is 't' a subtree of the tree rooted at 'this'? The siblings of * 'this' are ignored. */ virtual bool equalsTreePartial(RefAST t) const = 0; /** Walk the tree looking for all exact subtree matches. Return * a vector of RefAST that lets the caller walk the list * of subtree roots found herein. */ virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t) = 0; /** Walk the tree looking for all subtrees. Return * a vector of RefAST that lets the caller walk the list * of subtree roots found herein. */ virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t) = 0; /// Add a node to the end of the child list for this node virtual void addChild(RefAST c) = 0; /// Get the number of children. Returns 0 if the node is a leaf virtual size_t getNumberOfChildren() const = 0; /// Get the first child of this node; null if no children virtual RefAST getFirstChild() const = 0; /// Get the next sibling in line after this one virtual RefAST getNextSibling() const = 0; /// Get the token text for this node virtual ANTLR_USE_NAMESPACE(std)string getText() const = 0; /// Get the token type for this node virtual int getType() const = 0; /** Various initialization routines. Used by several factories to initialize * an AST element. */ virtual void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt) = 0; virtual void initialize(RefAST t) = 0; virtual void initialize(RefToken t) = 0; #ifdef ANTLR_SUPPORT_XML /** initialize this node from the contents of a stream. * @param in the stream to read the AST attributes from. */ virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ) = 0; #endif /// Set the first child of a node. virtual void setFirstChild(RefAST c) = 0; /// Set the next sibling after this one. virtual void setNextSibling(RefAST n) = 0; /// Set the token text for this node virtual void setText(const ANTLR_USE_NAMESPACE(std)string& txt) = 0; /// Set the token type for this node virtual void setType(int type) = 0; /// Return this AST node as a string virtual ANTLR_USE_NAMESPACE(std)string toString() const = 0; /// Print out a child-sibling tree in LISP notation virtual ANTLR_USE_NAMESPACE(std)string toStringList() const = 0; virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const = 0; #ifdef ANTLR_SUPPORT_XML /** get attributes of this node to 'out'. Override to customize XML * output. * @param out the stream to write the AST attributes to. * @returns if a explicit closetag should be written */ virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const = 0; /** Print a symbol over ostream. Overload this one to customize the XML * output for AST derived AST-types * @param output stream */ virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const = 0; /** Dump AST contents in XML format to output stream. * Works in conjunction with to_stream method. Overload that one is * derived classes to customize behaviour. * @param output stream to write to string to put the stuff in. * @param ast RefAST object to write. */ friend ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ); #endif private: friend struct ASTRef; ASTRef* ref; AST(RefAST other); AST& operator=(const AST& other); AST& operator=(RefAST other); }; #ifdef ANTLR_SUPPORT_XML inline ANTLR_USE_NAMESPACE(std)ostream& operator<<( ANTLR_USE_NAMESPACE(std)ostream& output, const RefAST& ast ) { ast->toStream(output); return output; } #endif extern ANTLR_API RefAST nullAST; extern ANTLR_API AST* const nullASTptr; #ifdef NEEDS_OPERATOR_LESS_THAN // RK: apparently needed by MSVC and a SUN CC, up to and including // 2.7.2 this was undefined ? inline bool operator<( RefAST l, RefAST r ) { return nullAST == l ? ( nullAST == r ? false : true ) : l->getType() < r->getType(); } #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_AST_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ASTArray.hpp000066400000000000000000000016041316047212700225060ustar00rootroot00000000000000#ifndef INC_ASTArray_hpp__ #define INC_ASTArray_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTArray.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** ASTArray is a class that allows ANTLR to * generate code that can create and initialize an array * in one expression, like: * (new ASTArray(3))->add(x)->add(y)->add(z) */ class ANTLR_API ASTArray { public: int size; // = 0; ANTLR_USE_NAMESPACE(std)vector array; ASTArray(int capacity) : size(0) , array(capacity) { } ASTArray* add(RefAST node) { array[size++] = node; return this; } }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_ASTArray_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ASTFactory.hpp000066400000000000000000000131741316047212700230440ustar00rootroot00000000000000#ifndef INC_ASTFactory_hpp__ #define INC_ASTFactory_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTFactory.hpp#2 $ */ #include #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif // Using these extra types to appease MSVC typedef RefAST (*factory_type_)(); typedef ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ > factory_descriptor_; typedef ANTLR_USE_NAMESPACE(std)vector< factory_descriptor_* > factory_descriptor_list_; /** AST Super Factory shared by TreeParser and Parser. * This super factory maintains a map of all AST node types to their respective * AST factories. One instance should be shared among a parser/treeparser * chain. * * @todo check all this code for possible use of references in * stead of RefAST's. */ class ANTLR_API ASTFactory { public: typedef factory_type_ factory_type; typedef factory_descriptor_ factory_descriptor; typedef factory_descriptor_list_ factory_descriptor_list; protected: /* The mapping of AST node type to factory.. */ factory_descriptor default_factory_descriptor; factory_descriptor_list nodeFactories; public: /// Make new factory. Per default (Ref)CommonAST instances are generated. ASTFactory(); /** Initialize factory with a non default node type. * factory_node_name should be the name of the AST node type the factory * generates. (should exist during the existance of this ASTFactory * instance) */ ASTFactory( const char* factory_node_name, factory_type factory ); /// Destroy factory virtual ~ASTFactory(); /// Register a node factory for the node type type with name ast_name void registerFactory( int type, const char* ast_name, factory_type factory ); /// Set the maximum node (AST) type this factory may encounter void setMaxNodeType( int type ); /// Add a child to the current AST void addASTChild(ASTPair& currentAST, RefAST child); /// Create new empty AST node. The right default type shou virtual RefAST create(); /// Create AST node of the right type for 'type' RefAST create(int type); /// Create AST node of the right type for 'type' and initialize with txt RefAST create(int type, const ANTLR_USE_NAMESPACE(std)string& txt); /// Create duplicate of tr RefAST create(RefAST tr); /// Create new AST node and initialize contents from a token. RefAST create(RefToken tok); /// Create new AST node and initialize contents from a stream. RefAST create(const ANTLR_USE_NAMESPACE(std)string& txt, ANTLR_USE_NAMESPACE(std)istream& infile ); /** Deep copy a single node. This function the new clone() methods in the * AST interface. Returns a new RefAST(nullASTptr) if t is null. */ RefAST dup(RefAST t); /// Duplicate tree including siblings of root. RefAST dupList(RefAST t); /** Duplicate a tree, assuming this is a root node of a tree-- * duplicate that node and what's below; ignore siblings of root node. */ RefAST dupTree(RefAST t); /** Make a tree from a list of nodes. The first element in the * array is the root. If the root is null, then the tree is * a simple list not a tree. Handles null children nodes correctly. * For example, make(a, b, null, c) yields tree (a b c). make(null,a,b) * yields tree (nil a b). */ RefAST make(ANTLR_USE_NAMESPACE(std)vector& nodes); /** Make a tree from a list of nodes, where the nodes are contained * in an ASTArray object. The ASTArray is deleted after use. * @todo FIXME! I have a feeling we can get rid of this ugly ASTArray thing */ RefAST make(ASTArray* nodes); /// Make an AST the root of current AST void makeASTRoot(ASTPair& currentAST, RefAST root); /** Set a new default AST type. * factory_node_name should be the name of the AST node type the factory * generates. (should exist during the existance of this ASTFactory * instance). * Only change factory between parser runs. You might get unexpected results * otherwise. */ void setASTNodeFactory( const char* factory_node_name, factory_type factory ); #ifdef ANTLR_SUPPORT_XML /** Load a XML AST from stream. Make sure you have all the factories * registered before use. * @note this 'XML' stuff is quite rough still. YMMV. */ RefAST LoadAST( ANTLR_USE_NAMESPACE(std)istream& infile ); #endif protected: void loadChildren( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); void loadSiblings( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ); bool checkCloseTag( ANTLR_USE_NAMESPACE(std)istream& infile ); #ifdef ANTLR_VECTOR_HAS_AT /// construct a node of 'type' inline RefAST getNodeOfType( unsigned int type ) { return RefAST(nodeFactories.at(type)->second()); } /// get the name of the node 'type' const char* getASTNodeType( unsigned int type ) { return nodeFactories.at(type)->first; } /// get the factory used for node 'type' factory_type getASTNodeFactory( unsigned int type ) { return nodeFactories.at(type)->second; } #else inline RefAST getNodeOfType( unsigned int type ) { return RefAST(nodeFactories[type]->second()); } /// get the name of the node 'type' const char* getASTNodeType( unsigned int type ) { return nodeFactories[type]->first; } factory_type getASTNodeFactory( unsigned int type ) { return nodeFactories[type]->second; } #endif private: // no copying and such.. ASTFactory( const ASTFactory& ); ASTFactory& operator=( const ASTFactory& ); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_ASTFactory_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ASTNULLType.hpp000066400000000000000000000034341316047212700230470ustar00rootroot00000000000000#ifndef INC_ASTNULLType_hpp__ #define INC_ASTNULLType_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTNULLType.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** There is only one instance of this class **/ class ANTLR_API ASTNULLType : public AST { public: const char* typeName( void ) const; RefAST clone( void ) const; void addChild(RefAST c); size_t getNumberOfChildren() const; void setFirstChild(RefAST c); void setNextSibling(RefAST n); bool equals(RefAST t) const; bool equalsList(RefAST t) const; bool equalsListPartial(RefAST t) const; bool equalsTree(RefAST t) const; bool equalsTreePartial(RefAST t) const; ANTLR_USE_NAMESPACE(std)vector findAll(RefAST tree); ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST subtree); RefAST getFirstChild() const; RefAST getNextSibling() const; ANTLR_USE_NAMESPACE(std)string getText() const; int getType() const; void initialize(int t, const ANTLR_USE_NAMESPACE(std)string& txt); void initialize(RefAST t); void initialize(RefToken t); void initialize(ANTLR_USE_NAMESPACE(std)istream& infile); void setText(const ANTLR_USE_NAMESPACE(std)string& text); void setType(int ttype); ANTLR_USE_NAMESPACE(std)string toString() const; ANTLR_USE_NAMESPACE(std)string toStringList() const; ANTLR_USE_NAMESPACE(std)string toStringTree() const; bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_ASTNULLType_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ASTPair.hpp000066400000000000000000000030751316047212700223270ustar00rootroot00000000000000#ifndef INC_ASTPair_hpp__ #define INC_ASTPair_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTPair.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** ASTPair: utility class used for manipulating a pair of ASTs * representing the current AST root and current AST sibling. * This exists to compensate for the lack of pointers or 'var' * arguments in Java. * * OK, so we can do those things in C++, but it seems easier * to stick with the Java way for now. */ class ANTLR_API ASTPair { public: RefAST root; // current root of tree RefAST child; // current child to which siblings are added /** Make sure that child is the last sibling */ void advanceChildToEnd() { if (child) { while (child->getNextSibling()) { child = child->getNextSibling(); } } } // /** Copy an ASTPair. Don't call it clone() because we want type-safety */ // ASTPair copy() { // ASTPair tmp = new ASTPair(); // tmp.root = root; // tmp.child = child; // return tmp; // } ANTLR_USE_NAMESPACE(std)string toString() const { ANTLR_USE_NAMESPACE(std)string r = !root ? ANTLR_USE_NAMESPACE(std)string("null") : root->getText(); ANTLR_USE_NAMESPACE(std)string c = !child ? ANTLR_USE_NAMESPACE(std)string("null") : child->getText(); return "["+r+","+c+"]"; } }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_ASTPair_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ASTRefCount.hpp000066400000000000000000000033141316047212700231550ustar00rootroot00000000000000#ifndef INC_ASTRefCount_hpp__ # define INC_ASTRefCount_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ASTRefCount.hpp#2 $ */ # include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class AST; struct ANTLR_API ASTRef { AST* const ptr; unsigned int count; ASTRef(AST* p); ~ASTRef(); ASTRef* increment() { ++count; return this; } bool decrement() { return (--count==0); } static ASTRef* getRef(const AST* p); private: ASTRef( const ASTRef& ); ASTRef& operator=( const ASTRef& ); }; template class ANTLR_API ASTRefCount { private: ASTRef* ref; public: ASTRefCount(const AST* p=0) : ref(p ? ASTRef::getRef(p) : 0) { } ASTRefCount(const ASTRefCount& other) : ref(other.ref ? other.ref->increment() : 0) { } ~ASTRefCount() { if (ref && ref->decrement()) delete ref; } ASTRefCount& operator=(AST* other) { ASTRef* tmp = ASTRef::getRef(other); if (ref && ref->decrement()) delete ref; ref=tmp; return *this; } ASTRefCount& operator=(const ASTRefCount& other) { if( other.ref != ref ) { ASTRef* tmp = other.ref ? other.ref->increment() : 0; if (ref && ref->decrement()) delete ref; ref=tmp; } return *this; } operator T* () const { return ref ? static_cast(ref->ptr) : 0; } T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } T* get() const { return ref ? static_cast(ref->ptr) : 0; } }; typedef ASTRefCount RefAST; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_ASTRefCount_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/BaseAST.hpp000066400000000000000000000110271316047212700223020ustar00rootroot00000000000000#ifndef INC_BaseAST_hpp__ #define INC_BaseAST_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/BaseAST.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API BaseAST; typedef ASTRefCount RefBaseAST; class ANTLR_API BaseAST : public AST { public: BaseAST() : AST() { } BaseAST(const BaseAST& other) : AST(other) { } virtual ~BaseAST() { } /// Return the class name virtual const char* typeName( void ) const = 0; /// Clone this AST node. virtual RefAST clone( void ) const = 0; /// Is node t equal to this in terms of token type and text? virtual bool equals(RefAST t) const; /** Is t an exact structural and equals() match of this tree. The * 'this' reference is considered the start of a sibling list. */ virtual bool equalsList(RefAST t) const; /** Is 't' a subtree of this list? The siblings of the root are NOT ignored. */ virtual bool equalsListPartial(RefAST t) const; /** Is tree rooted at 'this' equal to 't'? The siblings of 'this' are * ignored. */ virtual bool equalsTree(RefAST t) const; /** Is 't' a subtree of the tree rooted at 'this'? The siblings of * 'this' are ignored. */ virtual bool equalsTreePartial(RefAST t) const; /** Walk the tree looking for all exact subtree matches. Return * an ASTEnumerator that lets the caller walk the list * of subtree roots found herein. */ virtual ANTLR_USE_NAMESPACE(std)vector findAll(RefAST t); /** Walk the tree looking for all subtrees. Return * an ASTEnumerator that lets the caller walk the list * of subtree roots found herein. */ virtual ANTLR_USE_NAMESPACE(std)vector findAllPartial(RefAST t); /// Add a node to the end of the child list for this node virtual void addChild(RefAST c) { if( !c ) return; RefBaseAST tmp = down; if (tmp) { while (tmp->right) tmp = tmp->right; tmp->right = c; } else down = c; } /** Get the number of child nodes of this node (shallow e.g. not of the * whole tree it spans). */ virtual size_t getNumberOfChildren() const; /// Get the first child of this node; null if no children virtual RefAST getFirstChild() const { return RefAST(down); } /// Get the next sibling in line after this one virtual RefAST getNextSibling() const { return RefAST(right); } /// Get the token text for this node virtual ANTLR_USE_NAMESPACE(std)string getText() const { return ""; } /// Get the token type for this node virtual int getType() const { return 0; } /// Remove all children virtual void removeChildren() { down = static_cast(static_cast(nullAST)); } /// Set the first child of a node. virtual void setFirstChild(RefAST c) { down = static_cast(static_cast(c)); } /// Set the next sibling after this one. virtual void setNextSibling(RefAST n) { right = static_cast(static_cast(n)); } /// Set the token text for this node virtual void setText(const ANTLR_USE_NAMESPACE(std)string& /*txt*/) { } /// Set the token type for this node virtual void setType(int /*type*/) { } #ifdef ANTLR_SUPPORT_XML /** print attributes of this node to 'out'. Override to customize XML * output. * @param out the stream to write the AST attributes to. */ virtual bool attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const; /** Write this subtree to a stream. Overload this one to customize the XML * output for AST derived AST-types * @param output stream */ virtual void toStream( ANTLR_USE_NAMESPACE(std)ostream &out ) const; #endif /// Return string representation for the AST virtual ANTLR_USE_NAMESPACE(std)string toString() const { return getText(); } /// Print out a child sibling tree in LISP notation virtual ANTLR_USE_NAMESPACE(std)string toStringList() const; virtual ANTLR_USE_NAMESPACE(std)string toStringTree() const; protected: RefBaseAST down; RefBaseAST right; private: void doWorkForFindAll(ANTLR_USE_NAMESPACE(std)vector& v, RefAST target, bool partialMatch); }; /** Is node t equal to this in terms of token type and text? */ inline bool BaseAST::equals(RefAST t) const { if (!t) return false; return ((getType() == t->getType()) && (getText() == t->getText())); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_BaseAST_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/BitSet.hpp000066400000000000000000000034761316047212700222630ustar00rootroot00000000000000#ifndef INC_BitSet_hpp__ #define INC_BitSet_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/BitSet.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** A BitSet to replace java.util.BitSet. * Primary differences are that most set operators return new sets * as opposed to oring and anding "in place". Further, a number of * operations were added. I cannot contain a BitSet because there * is no way to access the internal bits (which I need for speed) * and, because it is final, I cannot subclass to add functionality. * Consider defining set degree. Without access to the bits, I must * call a method n times to test the ith bit...ack! * * Also seems like or() from util is wrong when size of incoming set is bigger * than this.length. * * This is a C++ version of the Java class described above, with only * a handful of the methods implemented, because we don't need the * others at runtime. It's really just a wrapper around vector, * which should probably be changed to a wrapper around bitset, once * bitset is more widely available. * * @author Terence Parr, MageLang Institute * @author
Pete Wells */ class ANTLR_API BitSet { private: ANTLR_USE_NAMESPACE(std)vector storage; public: BitSet( unsigned int nbits=64 ); BitSet( const unsigned long* bits_, unsigned int nlongs); ~BitSet(); void add( unsigned int el ); bool member( unsigned int el ) const; ANTLR_USE_NAMESPACE(std)vector toArray() const; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_BitSet_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CharBuffer.hpp000066400000000000000000000026721316047212700230750ustar00rootroot00000000000000#ifndef INC_CharBuffer_hpp__ #define INC_CharBuffer_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharBuffer.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /**A Stream of characters fed to the lexer from a InputStream that can * be rewound via mark()/rewind() methods. *

* A dynamic array is used to buffer up all the input characters. Normally, * "k" characters are stored in the buffer. More characters may be stored * during guess mode (testing syntactic predicate), or when LT(i>k) is * referenced. * Consumption of characters is deferred. In other words, reading the next * character is not done by consume(), but deferred until needed by LA or LT. *

* * @see antlr.CharQueue */ class ANTLR_API CharBuffer : public InputBuffer { public: /// Create a character buffer CharBuffer( ANTLR_USE_NAMESPACE(std)istream& input ); /// Get the next character from the stream int getChar(); protected: // character source ANTLR_USE_NAMESPACE(std)istream& input; private: // NOTE: Unimplemented CharBuffer(const CharBuffer& other); CharBuffer& operator=(const CharBuffer& other); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CharBuffer_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CharInputBuffer.hpp000066400000000000000000000033441316047212700241120ustar00rootroot00000000000000#ifndef INC_CharInputBuffer_hpp__ # define INC_CharInputBuffer_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ # include # include # ifdef HAS_NOT_CCTYPE_H # include # else # include # endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** CharInputBuffer.hpp provides an InputBuffer for plain character arrays (buffers). */ class CharInputBuffer : public InputBuffer { public: /** Construct a CharInputBuffer.hpp object with a char* buffer of 'size' * if 'owner' is true, then the buffer will be delete[]-ed on destruction. * @note it is assumed the buffer was allocated with new[]! */ CharInputBuffer( unsigned char* buf, size_t size, bool owner = false ) : buffer(buf) , ptr(buf) , end(buf + size) , delete_buffer(owner) { } /** Destructor * @note If you're using malloced data, then you probably need to change * this destructor. Or better use this class as template for your own. */ ~CharInputBuffer( void ) { if( delete_buffer && buffer ) delete [] buffer; } /** Reset the CharInputBuffer to initial state * Called from LexerInputState::reset. * @see LexerInputState */ virtual inline void reset( void ) { InputBuffer::reset(); ptr = buffer; } virtual int getChar( void ) { return (ptr < end) ? *ptr++ : EOF; } protected: unsigned char* buffer; ///< the buffer with data unsigned char* ptr; ///< position ptr into the buffer unsigned char* end; ///< end sentry for buffer bool delete_buffer; ///< flag signifying if we have to delete the buffer }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CharScanner.hpp000066400000000000000000000327431316047212700232570ustar00rootroot00000000000000#ifndef INC_CharScanner_hpp__ #define INC_CharScanner_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharScanner.hpp#2 $ */ #include #include #ifdef HAS_NOT_CCTYPE_H #include #else #include #endif #if ( _MSC_VER == 1200 ) // VC6 seems to need this // note that this is not a standard C++ include file. # include #endif #include #include #include #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API CharScanner; ANTLR_C_USING(tolower) #ifdef ANTLR_REALLY_NO_STRCASECMP // Apparently, neither strcasecmp nor stricmp is standard, and Codewarrior // on the mac has neither... inline int strcasecmp(const char *s1, const char *s2) { while (true) { char c1 = tolower(*s1++), c2 = tolower(*s2++); if (c1 < c2) return -1; if (c1 > c2) return 1; if (c1 == 0) return 0; } } #else #ifdef NO_STRCASECMP ANTLR_C_USING(stricmp) #else #include ANTLR_C_USING(strcasecmp) #endif #endif /** Functor for the literals map */ class ANTLR_API CharScannerLiteralsLess : public ANTLR_USE_NAMESPACE(std)binary_function { private: const CharScanner* scanner; public: #ifdef NO_TEMPLATE_PARTS CharScannerLiteralsLess() {} // not really used, definition to appease MSVC #endif CharScannerLiteralsLess(const CharScanner* theScanner) : scanner(theScanner) { } bool operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const; // defaults are good enough.. // CharScannerLiteralsLess(const CharScannerLiteralsLess&); // CharScannerLiteralsLess& operator=(const CharScannerLiteralsLess&); }; /** Superclass of generated lexers */ class ANTLR_API CharScanner : public TokenStream { protected: typedef RefToken (*factory_type)(); public: CharScanner(InputBuffer& cb, bool case_sensitive ); CharScanner(InputBuffer* cb, bool case_sensitive ); CharScanner(const LexerSharedInputState& state, bool case_sensitive ); virtual ~CharScanner() { } virtual int LA(unsigned int i); virtual void append(char c) { if (saveConsumedInput) { size_t l = text.length(); if ((l%256) == 0) text.reserve(l+256); text.replace(l,0,&c,1); } } virtual void append(const ANTLR_USE_NAMESPACE(std)string& s) { if( saveConsumedInput ) text += s; } virtual void commit() { inputState->getInput().commit(); } /** called by the generated lexer to do error recovery, override to * customize the behaviour. */ virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) { (void)ex; consume(); consumeUntil(tokenSet); } virtual void consume() { if (inputState->guessing == 0) { int c = LA(1); if (caseSensitive) { append(c); } else { // use input.LA(), not LA(), to get original case // CharScanner.LA() would toLower it. append(inputState->getInput().LA(1)); } // RK: in a sense I don't like this automatic handling. if (c == '\t') tab(); else inputState->column++; } inputState->getInput().consume(); } /** Consume chars until one matches the given char */ virtual void consumeUntil(int c) { for(;;) { int la_1 = LA(1); if( la_1 == EOF_CHAR || la_1 == c ) break; consume(); } } /** Consume chars until one matches the given set */ virtual void consumeUntil(const BitSet& set) { for(;;) { int la_1 = LA(1); if( la_1 == EOF_CHAR || set.member(la_1) ) break; consume(); } } /// Mark the current position and return a id for it virtual unsigned int mark() { return inputState->getInput().mark(); } /// Rewind the scanner to a previously marked position virtual void rewind(unsigned int pos) { inputState->getInput().rewind(pos); } /// See if input contains character 'c' throw MismatchedCharException if not virtual void match(int c) { int la_1 = LA(1); if ( la_1 != c ) throw MismatchedCharException(la_1, c, false, this); consume(); } /** See if input contains element from bitset b * throw MismatchedCharException if not */ virtual void match(const BitSet& b) { int la_1 = LA(1); if ( !b.member(la_1) ) throw MismatchedCharException( la_1, b, false, this ); consume(); } /** See if input contains string 's' throw MismatchedCharException if not * @note the string cannot match EOF */ virtual void match( const char* s ) { while( *s != '\0' ) { // the & 0xFF is here to prevent sign extension lateron int la_1 = LA(1), c = (*s++ & 0xFF); if ( la_1 != c ) throw MismatchedCharException(la_1, c, false, this); consume(); } } /** See if input contains string 's' throw MismatchedCharException if not * @note the string cannot match EOF */ virtual void match(const ANTLR_USE_NAMESPACE(std)string& s) { size_t len = s.length(); for (size_t i = 0; i < len; i++) { // the & 0xFF is here to prevent sign extension lateron int la_1 = LA(1), c = (s[i] & 0xFF); if ( la_1 != c ) throw MismatchedCharException(la_1, c, false, this); consume(); } } /** See if input does not contain character 'c' * throw MismatchedCharException if not */ virtual void matchNot(int c) { int la_1 = LA(1); if ( la_1 == c ) throw MismatchedCharException(la_1, c, true, this); consume(); } /** See if input contains character in range c1-c2 * throw MismatchedCharException if not */ virtual void matchRange(int c1, int c2) { int la_1 = LA(1); if ( la_1 < c1 || la_1 > c2 ) throw MismatchedCharException(la_1, c1, c2, false, this); consume(); } virtual bool getCaseSensitive() const { return caseSensitive; } virtual void setCaseSensitive(bool t) { caseSensitive = t; } virtual bool getCaseSensitiveLiterals() const=0; /// Get the line the scanner currently is in (starts at 1) virtual int getLine() const { return inputState->line; } /// set the line number virtual void setLine(int l) { inputState->line = l; } /// Get the column the scanner currently is in (starts at 1) virtual int getColumn() const { return inputState->column; } /// set the column number virtual void setColumn(int c) { inputState->column = c; } /// get the filename for the file currently used virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const { return inputState->filename; } /// Set the filename the scanner is using (used in error messages) virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) { inputState->filename = f; } virtual bool getCommitToPath() const { return commitToPath; } virtual void setCommitToPath(bool commit) { commitToPath = commit; } /** return a copy of the current text buffer */ virtual const ANTLR_USE_NAMESPACE(std)string& getText() const { return text; } virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) { text = s; } virtual void resetText() { text = ""; inputState->tokenStartColumn = inputState->column; inputState->tokenStartLine = inputState->line; } virtual RefToken getTokenObject() const { return _returnToken; } /** Used to keep track of line breaks, needs to be called from * within generated lexers when a \n \r is encountered. */ virtual void newline() { ++inputState->line; inputState->column = 1; } /** Advance the current column number by an appropriate amount according * to the tabsize. This method needs to be explicitly called from the * lexer rules encountering tabs. */ virtual void tab() { int c = getColumn(); int nc = ( ((c-1)/tabsize) + 1) * tabsize + 1; // calculate tab stop setColumn( nc ); } /// set the tabsize. Returns the old tabsize int setTabsize( int size ) { int oldsize = tabsize; tabsize = size; return oldsize; } /// Return the tabsize used by the scanner int getTabSize() const { return tabsize; } /** Report exception errors caught in nextToken() */ virtual void reportError(const RecognitionException& e); /** Parser error-reporting function can be overridden in subclass */ virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); /** Parser warning-reporting function can be overridden in subclass */ virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); virtual InputBuffer& getInputBuffer() { return inputState->getInput(); } virtual LexerSharedInputState getInputState() { return inputState; } /** set the input state for the lexer. * @note state is a reference counted object, hence no reference */ virtual void setInputState(LexerSharedInputState state) { inputState = state; } /// Set the factory for created tokens virtual void setTokenObjectFactory(factory_type factory) { tokenFactory = factory; } /** Test the token text against the literals table * Override this method to perform a different literals test */ virtual int testLiteralsTable(int ttype) const { ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(text); if (i != literals.end()) ttype = (*i).second; return ttype; } /** Test the text passed in against the literals table * Override this method to perform a different literals test * This is used primarily when you want to test a portion of * a token */ virtual int testLiteralsTable(const ANTLR_USE_NAMESPACE(std)string& txt,int ttype) const { ANTLR_USE_NAMESPACE(std)map::const_iterator i = literals.find(txt); if (i != literals.end()) ttype = (*i).second; return ttype; } /// Override this method to get more specific case handling virtual int toLower(int c) const { // test on EOF_CHAR for buggy (?) STLPort tolower (or HPUX tolower?) // also VC++ 6.0 does this. (see fix 422 (is reverted by this fix) // this one is more structural. Maybe make this configurable. return (c == EOF_CHAR ? EOF_CHAR : tolower(c)); } /** This method is called by YourLexer::nextToken() when the lexer has * hit EOF condition. EOF is NOT a character. * This method is not called if EOF is reached during * syntactic predicate evaluation or during evaluation * of normal lexical rules, which presumably would be * an IOException. This traps the "normal" EOF condition. * * uponEOF() is called after the complete evaluation of * the previous token and only if your parser asks * for another token beyond that last non-EOF token. * * You might want to throw token or char stream exceptions * like: "Heh, premature eof" or a retry stream exception * ("I found the end of this file, go back to referencing file"). */ virtual void uponEOF() { } /// Methods used to change tracing behavior virtual void traceIndent(); virtual void traceIn(const char* rname); virtual void traceOut(const char* rname); #ifndef NO_STATIC_CONSTS static const int EOF_CHAR = EOF; #else enum { EOF_CHAR = EOF }; #endif protected: ANTLR_USE_NAMESPACE(std)string text; ///< Text of current token /// flag indicating wether consume saves characters bool saveConsumedInput; factory_type tokenFactory; ///< Factory for tokens bool caseSensitive; ///< Is this lexer case sensitive ANTLR_USE_NAMESPACE(std)map literals; // set by subclass RefToken _returnToken; ///< used to return tokens w/o using return val /// Input state, gives access to input stream, shared among different lexers LexerSharedInputState inputState; /** Used during filter mode to indicate that path is desired. * A subsequent scan error will report an error as usual * if acceptPath=true; */ bool commitToPath; int tabsize; ///< tab size the scanner uses. /// Create a new RefToken of type t virtual RefToken makeToken(int t) { RefToken tok = tokenFactory(); tok->setType(t); tok->setColumn(inputState->tokenStartColumn); tok->setLine(inputState->tokenStartLine); return tok; } /** Tracer class, used when -traceLexer is passed to antlr */ class Tracer { private: CharScanner* parser; const char* text; Tracer(const Tracer& other); // undefined Tracer& operator=(const Tracer& other); // undefined public: Tracer( CharScanner* p,const char* t ) : parser(p), text(t) { parser->traceIn(text); } ~Tracer() { parser->traceOut(text); } }; int traceDepth; private: CharScanner( const CharScanner& other ); // undefined CharScanner& operator=( const CharScanner& other ); // undefined #ifndef NO_STATIC_CONSTS static const int NO_CHAR = 0; #else enum { NO_CHAR = 0 }; #endif }; inline int CharScanner::LA(unsigned int i) { int c = inputState->getInput().LA(i); if ( caseSensitive ) return c; else return toLower(c); // VC 6 tolower bug caught in toLower. } inline bool CharScannerLiteralsLess::operator() (const ANTLR_USE_NAMESPACE(std)string& x,const ANTLR_USE_NAMESPACE(std)string& y) const { if (scanner->getCaseSensitiveLiterals()) return ANTLR_USE_NAMESPACE(std)less()(x,y); else { #ifdef NO_STRCASECMP return (stricmp(x.c_str(),y.c_str())<0); #else return (strcasecmp(x.c_str(),y.c_str())<0); #endif } } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CharScanner_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CharStreamException.hpp000066400000000000000000000013251316047212700247700ustar00rootroot00000000000000#ifndef INC_CharStreamException_hpp__ #define INC_CharStreamException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharStreamException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API CharStreamException : public ANTLRException { public: CharStreamException(const ANTLR_USE_NAMESPACE(std)string& s) : ANTLRException(s) {} ~CharStreamException() throw() {} }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CharStreamException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CharStreamIOException.hpp000066400000000000000000000014451316047212700252230ustar00rootroot00000000000000#ifndef INC_CharStreamIOException_hpp__ #define INC_CharStreamIOException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CharStreamIOException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API CharStreamIOException : public CharStreamException { public: ANTLR_USE_NAMESPACE(std)exception io; CharStreamIOException(ANTLR_USE_NAMESPACE(std)exception& e) : CharStreamException(e.what()), io(e) {} ~CharStreamIOException() throw() {} }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CharStreamIOException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CircularQueue.hpp000066400000000000000000000041471316047212700236360ustar00rootroot00000000000000#ifndef INC_CircularQueue_hpp__ #define INC_CircularQueue_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CircularQueue.hpp#2 $ */ #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif // Resize every 5000 items #define OFFSET_MAX_RESIZE 5000 template class ANTLR_API CircularQueue { public: CircularQueue() : storage() , m_offset(0) { } ~CircularQueue() { } /// Clear the queue inline void clear( void ) { m_offset = 0; storage.clear(); } /// @todo this should use at or should have a check inline T elementAt( size_t idx ) const { return storage[idx+m_offset]; } void removeFirst() { if (m_offset >= OFFSET_MAX_RESIZE) { storage.erase( storage.begin(), storage.begin() + m_offset + 1 ); m_offset = 0; } else ++m_offset; } inline void removeItems( size_t nb ) { // it would be nice if we would not get called with nb > entries // (or to be precise when entries() == 0) // This case is possible when lexer/parser::recover() calls // consume+consumeUntil when the queue is empty. // In recover the consume says to prepare to read another // character/token. Then in the subsequent consumeUntil the // LA() call will trigger // syncConsume which calls this method *before* the same queue // has been sufficiently filled. if( nb > entries() ) nb = entries(); if (m_offset >= OFFSET_MAX_RESIZE) { storage.erase( storage.begin(), storage.begin() + m_offset + nb ); m_offset = 0; } else m_offset += nb; } inline void append(const T& t) { storage.push_back(t); } inline size_t entries() const { return storage.size() - m_offset; } private: ANTLR_USE_NAMESPACE(std)vector storage; size_t m_offset; CircularQueue(const CircularQueue&); const CircularQueue& operator=(const CircularQueue&); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CircularQueue_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CommonAST.hpp000066400000000000000000000035561316047212700226700ustar00rootroot00000000000000#ifndef INC_CommonAST_hpp__ #define INC_CommonAST_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonAST.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API CommonAST : public BaseAST { public: CommonAST() : BaseAST() , ttype( Token::INVALID_TYPE ) , text() { } CommonAST( RefToken t ) : BaseAST() , ttype( t->getType() ) , text( t->getText() ) { } CommonAST( const CommonAST& other ) : BaseAST(other) , ttype(other.ttype) , text(other.text) { } virtual ~CommonAST() { } virtual const char* typeName( void ) const { return CommonAST::TYPE_NAME; } /// Clone this AST node. virtual RefAST clone( void ) const { CommonAST *ast = new CommonAST( *this ); return RefAST(ast); } virtual ANTLR_USE_NAMESPACE(std)string getText() const { return text; } virtual int getType() const { return ttype; } virtual void initialize( int t, const ANTLR_USE_NAMESPACE(std)string& txt ) { setType(t); setText(txt); } virtual void initialize( RefAST t ) { setType(t->getType()); setText(t->getText()); } virtual void initialize( RefToken t ) { setType(t->getType()); setText(t->getText()); } #ifdef ANTLR_SUPPORT_XML virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in ); #endif virtual void setText( const ANTLR_USE_NAMESPACE(std)string& txt ) { text = txt; } virtual void setType( int type ) { ttype = type; } static RefAST factory(); static const char* const TYPE_NAME; protected: int ttype; ANTLR_USE_NAMESPACE(std)string text; }; typedef ASTRefCount RefCommonAST; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CommonAST_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CommonASTWithHiddenTokens.hpp000066400000000000000000000030151316047212700260120ustar00rootroot00000000000000#ifndef INC_CommonASTWithHiddenTokens_hpp__ #define INC_CommonASTWithHiddenTokens_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonASTWithHiddenTokens.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** A CommonAST whose initialization copies hidden token * information from the Token used to create a node. */ class ANTLR_API CommonASTWithHiddenTokens : public CommonAST { public: CommonASTWithHiddenTokens(); virtual ~CommonASTWithHiddenTokens(); virtual const char* typeName( void ) const { return CommonASTWithHiddenTokens::TYPE_NAME; } /// Clone this AST node. virtual RefAST clone( void ) const; // Borland C++ builder seems to need the decl's of the first two... virtual void initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt); virtual void initialize(RefAST t); virtual void initialize(RefToken t); virtual RefToken getHiddenAfter() const { return hiddenAfter; } virtual RefToken getHiddenBefore() const { return hiddenBefore; } static RefAST factory(); static const char* const TYPE_NAME; protected: RefToken hiddenBefore,hiddenAfter; // references to hidden tokens }; typedef ASTRefCount RefCommonASTWithHiddenTokens; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CommonASTWithHiddenTokens_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CommonHiddenStreamToken.hpp000066400000000000000000000017561316047212700256110ustar00rootroot00000000000000#ifndef INC_CommonHiddenStreamToken_hpp__ #define INC_CommonHiddenStreamToken_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonHiddenStreamToken.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API CommonHiddenStreamToken : public CommonToken { protected: RefToken hiddenBefore; RefToken hiddenAfter; public: CommonHiddenStreamToken(); CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s); RefToken getHiddenAfter(); RefToken getHiddenBefore(); static RefToken factory(); void setHiddenAfter(RefToken t); void setHiddenBefore(RefToken t); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CommonHiddenStreamToken_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/CommonToken.hpp000066400000000000000000000032431316047212700233120ustar00rootroot00000000000000#ifndef INC_CommonToken_hpp__ #define INC_CommonToken_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/CommonToken.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API CommonToken : public Token { public: CommonToken(); CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt); CommonToken(const ANTLR_USE_NAMESPACE(std)string& s); /// return contents of token virtual ANTLR_USE_NAMESPACE(std)string getText() const { return text; } /// set contents of token virtual void setText(const ANTLR_USE_NAMESPACE(std)string& s) { text = s; } /** get the line the token is at (starting at 1) * @see CharScanner::newline() * @see CharScanner::tab() */ virtual int getLine() const { return line; } /** gt the column the token is at (starting at 1) * @see CharScanner::newline() * @see CharScanner::tab() */ virtual int getColumn() const { return col; } /// set line for token virtual void setLine(int l) { line = l; } /// set column for token virtual void setColumn(int c) { col = c; } virtual ANTLR_USE_NAMESPACE(std)string toString() const; static RefToken factory(); protected: // most tokens will want line and text information int line; int col; ANTLR_USE_NAMESPACE(std)string text; private: CommonToken(const CommonToken&); const CommonToken& operator=(const CommonToken&); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CommonToken_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/IOException.hpp000066400000000000000000000016621316047212700232520ustar00rootroot00000000000000#ifndef INC_IOException_hpp__ #define INC_IOException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** Generic IOException used inside support code. (thrown by XML I/O routs) * basically this is something I'm using since a lot of compilers don't * support ios_base::failure. */ class ANTLR_API IOException : public ANTLRException { public: ANTLR_USE_NAMESPACE(std)exception io; IOException( ANTLR_USE_NAMESPACE(std)exception& e ) : ANTLRException(e.what()) { } IOException( const ANTLR_USE_NAMESPACE(std)string& mesg ) : ANTLRException(mesg) { } virtual ~IOException() throw() { } }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_IOException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/InputBuffer.hpp000066400000000000000000000066651316047212700233250ustar00rootroot00000000000000#ifndef INC_InputBuffer_hpp__ #define INC_InputBuffer_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/InputBuffer.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** A Stream of characters fed to the lexer from a InputStream that can * be rewound via mark()/rewind() methods. *

* A dynamic array is used to buffer up all the input characters. Normally, * "k" characters are stored in the buffer. More characters may be stored during * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. * Consumption of characters is deferred. In other words, reading the next * character is not done by conume(), but deferred until needed by LA or LT. *

* * @see antlr.CharQueue */ class ANTLR_API InputBuffer { public: /** Create a character buffer */ InputBuffer() : nMarkers(0) , markerOffset(0) , numToConsume(0) { } virtual ~InputBuffer() { } /// Reset the input buffer to empty state virtual inline void reset( void ) { nMarkers = 0; markerOffset = 0; numToConsume = 0; queue.clear(); } /** This method updates the state of the input buffer so that * the text matched since the most recent mark() is no longer * held by the buffer. So, you either do a mark/rewind for * failed predicate or mark/commit to keep on parsing without * rewinding the input. */ inline void commit( void ) { nMarkers--; } /** Mark another character for deferred consumption */ virtual inline void consume() { numToConsume++; } /** Ensure that the character buffer is sufficiently full */ virtual void fill(unsigned int amount); /** Override this in subclasses to get the next character */ virtual int getChar()=0; /** Get a lookahead character */ virtual inline int LA(unsigned int i) { fill(i); return queue.elementAt(markerOffset + i - 1); } /** Return an integer marker that can be used to rewind the buffer to * its current state. */ virtual unsigned int mark(); /// Are there any marks active in the InputBuffer virtual inline bool isMarked() const { return (nMarkers != 0); } /** Rewind the character buffer to a marker. * @param mark Marker returned previously from mark() */ virtual void rewind(unsigned int mark); /** Get the number of non-consumed characters */ virtual unsigned int entries() const; ANTLR_USE_NAMESPACE(std)string getLAChars() const; ANTLR_USE_NAMESPACE(std)string getMarkedChars() const; protected: // char source // leave to subclasses // Number of active markers unsigned int nMarkers; // = 0; // Additional offset used when markers are active unsigned int markerOffset; // = 0; // Number of calls to consume() since last LA() or LT() call unsigned int numToConsume; // = 0; // Circular queue CircularQueue queue; /** Sync up deferred consumption */ void syncConsume(); private: InputBuffer(const InputBuffer& other); InputBuffer& operator=(const InputBuffer& other); }; /** Sync up deferred consumption */ inline void InputBuffer::syncConsume() { if (numToConsume > 0) { if (nMarkers > 0) markerOffset += numToConsume; else queue.removeItems( numToConsume ); numToConsume = 0; } } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_InputBuffer_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/LLkParser.hpp000066400000000000000000000030761316047212700227240ustar00rootroot00000000000000#ifndef INC_LLkParser_hpp__ #define INC_LLkParser_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/LLkParser.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /**An LL(k) parser. * * @see antlr.Token * @see antlr.TokenBuffer * @see antlr.LL1Parser */ class ANTLR_API LLkParser : public Parser { public: LLkParser(const ParserSharedInputState& lexer, int k_); LLkParser(TokenBuffer& tokenBuf, int k_); LLkParser(TokenStream& lexer, int k_); /** Consume another token from the input stream. Can only write sequentially! * If you need 3 tokens ahead, you must consume() 3 times. *

* Note that it is possible to overwrite tokens that have not been matched. * For example, calling consume() 3 times when k=2, means that the first token * consumed will be overwritten with the 3rd. */ virtual inline void consume() { inputState->getInput().consume(); } virtual inline int LA(unsigned int i) { return inputState->getInput().LA(i); } virtual inline RefToken LT(unsigned int i) { return inputState->getInput().LT(i); } protected: /// the lookahead this LL(k) parser is using. int k; private: void trace(const char* ee, const char* rname); public: virtual void traceIn(const char* rname); virtual void traceOut(const char* rname); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_LLkParser_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/LexerSharedInputState.hpp000066400000000000000000000066271316047212700253210ustar00rootroot00000000000000#ifndef INC_LexerSharedInputState_hpp__ #define INC_LexerSharedInputState_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/LexerSharedInputState.hpp#2 $ */ #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** This object contains the data associated with an * input stream of characters. Multiple lexers * share a single LexerSharedInputState to lex * the same input stream. */ class ANTLR_API LexerInputState { public: /** Construct a new LexerInputState * @param inbuf the InputBuffer to read from. The object is deleted together * with the LexerInputState object. */ LexerInputState(InputBuffer* inbuf) : column(1) , line(1) , tokenStartColumn(1) , tokenStartLine(1) , guessing(0) , filename("") , input(inbuf) , inputResponsible(true) { } /** Construct a new LexerInputState * @param inbuf the InputBuffer to read from. */ LexerInputState(InputBuffer& inbuf) : column(1) , line(1) , tokenStartColumn(1) , tokenStartLine(1) , guessing(0) , filename("") , input(&inbuf) , inputResponsible(false) { } /** Construct a new LexerInputState * @param in an istream to read from. * @see antlr.CharBuffer */ LexerInputState(ANTLR_USE_NAMESPACE(std)istream& in) : column(1) , line(1) , tokenStartColumn(1) , tokenStartLine(1) , guessing(0) , filename("") , input(new CharBuffer(in)) , inputResponsible(true) { } /** Reset the LexerInputState with a specified stream and filename. * This method is a hack, dunno what I was thinking when I added it. * This should actually be done in a subclass. * @deprecated */ virtual void initialize( ANTLR_USE_NAMESPACE(std)istream& in, const char* file = "" ) { column = 1; line = 1; tokenStartColumn = 1; tokenStartLine = 1; guessing = 0; filename = file; if( input && inputResponsible ) delete input; input = new CharBuffer(in); inputResponsible = true; } /** Reset the LexerInputState to initial state. * The underlying InputBuffer is also reset. */ virtual void reset( void ) { column = 1; line = 1; tokenStartColumn = 1; tokenStartLine = 1; guessing = 0; input->reset(); } /** Set the file position of the SharedLexerInputState. * @param line_ line number to be set * @param column_ column number to be set */ void setPosition( int line_, int column_ ) { line = line_; column = column_; } virtual ~LexerInputState() { if (inputResponsible) delete input; } int column; int line; int tokenStartColumn; int tokenStartLine; int guessing; /** What file (if known) caused the problem? */ ANTLR_USE_NAMESPACE(std)string filename; InputBuffer& getInput(); private: /// Input buffer we use InputBuffer* input; /// Who is responsible for cleaning up the InputBuffer? bool inputResponsible; // we don't want these: LexerInputState(const LexerInputState&); LexerInputState& operator=(const LexerInputState&); }; inline InputBuffer& LexerInputState::getInput() { return *input; } /// A reference counted LexerInputState object typedef RefCount LexerSharedInputState; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_LexerSharedInputState_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/MismatchedCharException.hpp000066400000000000000000000037001316047212700256120ustar00rootroot00000000000000#ifndef INC_MismatchedCharException_hpp__ #define INC_MismatchedCharException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/MismatchedCharException.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class CharScanner; class ANTLR_API MismatchedCharException : public RecognitionException { public: // Types of chars #ifndef NO_STATIC_CONSTS static const int CHAR = 1; static const int NOT_CHAR = 2; static const int RANGE = 3; static const int NOT_RANGE = 4; static const int SET = 5; static const int NOT_SET = 6; #else enum { CHAR = 1, NOT_CHAR = 2, RANGE = 3, NOT_RANGE = 4, SET = 5, NOT_SET = 6 }; #endif public: // One of the above int mismatchType; // what was found on the input stream int foundChar; // For CHAR/NOT_CHAR and RANGE/NOT_RANGE int expecting; // For RANGE/NOT_RANGE (expecting is lower bound of range) int upper; // For SET/NOT_SET BitSet set; protected: // who knows...they may want to ask scanner questions CharScanner* scanner; public: MismatchedCharException(); // Expected range / not range MismatchedCharException( int c, int lower, int upper_, bool matchNot, CharScanner* scanner_ ); // Expected token / not token MismatchedCharException( int c, int expecting_, bool matchNot, CharScanner* scanner_ ); // Expected BitSet / not BitSet MismatchedCharException( int c, BitSet set_, bool matchNot, CharScanner* scanner_ ); ~MismatchedCharException() throw() {} /** * Returns a clean error message (no line number/column information) */ ANTLR_USE_NAMESPACE(std)string getMessage() const; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_MismatchedCharException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/MismatchedTokenException.hpp000066400000000000000000000061301316047212700260150ustar00rootroot00000000000000#ifndef INC_MismatchedTokenException_hpp__ #define INC_MismatchedTokenException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/MismatchedTokenException.hpp#2 $ */ #include #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API MismatchedTokenException : public RecognitionException { public: MismatchedTokenException(); /// Expected range / not range MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefAST node_, int lower, int upper_, bool matchNot ); // Expected token / not token MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefAST node_, int expecting_, bool matchNot ); // Expected BitSet / not BitSet MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefAST node_, BitSet set_, bool matchNot ); // Expected range / not range MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefToken token_, int lower, int upper_, bool matchNot, const ANTLR_USE_NAMESPACE(std)string& fileName_ ); // Expected token / not token MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefToken token_, int expecting_, bool matchNot, const ANTLR_USE_NAMESPACE(std)string& fileName_ ); // Expected BitSet / not BitSet MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefToken token_, BitSet set_, bool matchNot, const ANTLR_USE_NAMESPACE(std)string& fileName_ ); ~MismatchedTokenException() throw() {} /** * Returns a clean error message (no line number/column information) */ ANTLR_USE_NAMESPACE(std)string getMessage() const; public: /// The token that was encountered const RefToken token; /// The offending AST node if tree walking const RefAST node; /// taken from node or token object ANTLR_USE_NAMESPACE(std)string tokenText; /// Types of tokens #ifndef NO_STATIC_CONSTS static const int TOKEN = 1; static const int NOT_TOKEN = 2; static const int RANGE = 3; static const int NOT_RANGE = 4; static const int SET = 5; static const int NOT_SET = 6; #else enum { TOKEN = 1, NOT_TOKEN = 2, RANGE = 3, NOT_RANGE = 4, SET = 5, NOT_SET = 6 }; #endif public: /// One of the above int mismatchType; /// For TOKEN/NOT_TOKEN and RANGE/NOT_RANGE int expecting; /// For RANGE/NOT_RANGE (expecting is lower bound of range) int upper; /// For SET/NOT_SET BitSet set; private: /// Token names array for formatting const char* const* tokenNames; /// Max number of tokens in tokenNames const int numTokens; /// Return token name for tokenType ANTLR_USE_NAMESPACE(std)string tokenName(int tokenType) const; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_MismatchedTokenException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/NoViableAltException.hpp000066400000000000000000000020151316047212700250740ustar00rootroot00000000000000#ifndef INC_NoViableAltException_hpp__ #define INC_NoViableAltException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/NoViableAltException.hpp#2 $ */ #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API NoViableAltException : public RecognitionException { public: const RefToken token; const RefAST node; // handles parsing and treeparsing NoViableAltException(RefAST t); NoViableAltException(RefToken t,const ANTLR_USE_NAMESPACE(std)string& fileName_); ~NoViableAltException() throw() {} /** * Returns a clean error message (no line number/column information) */ ANTLR_USE_NAMESPACE(std)string getMessage() const; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_NoViableAltException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/NoViableAltForCharException.hpp000066400000000000000000000020721316047212700263440ustar00rootroot00000000000000#ifndef INC_NoViableAltForCharException_hpp__ # define INC_NoViableAltForCharException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/NoViableAltForCharException.hpp#2 $ */ # include # include # include # ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { # endif class ANTLR_API NoViableAltForCharException : public RecognitionException { public: NoViableAltForCharException(int c, CharScanner* scanner); NoViableAltForCharException(int c, const ANTLR_USE_NAMESPACE(std)string& fileName_, int line_, int column_); virtual ~NoViableAltForCharException() throw() { } /// Returns a clean error message (no line number/column information) ANTLR_USE_NAMESPACE(std)string getMessage() const; protected: int foundChar; }; # ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } # endif #endif //INC_NoViableAltForCharException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/Parser.hpp000066400000000000000000000212741316047212700223210ustar00rootroot00000000000000#ifndef INC_Parser_hpp__ #define INC_Parser_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/Parser.hpp#2 $ */ #include #include #include #include #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif extern bool DEBUG_PARSER; /** A generic ANTLR parser (LL(k) for k>=1) containing a bunch of * utility routines useful at any lookahead depth. We distinguish between * the LL(1) and LL(k) parsers because of efficiency. This may not be * necessary in the near future. * * Each parser object contains the state of the parse including a lookahead * cache (the form of which is determined by the subclass), whether or * not the parser is in guess mode, where tokens come from, etc... * *

* During guess mode, the current lookahead token(s) and token type(s) * cache must be saved because the token stream may not have been informed * to save the token (via mark) before the try block. * Guessing is started by: *

    *
  1. saving the lookahead cache. *
  2. marking the current position in the TokenBuffer. *
  3. increasing the guessing level. *
* * After guessing, the parser state is restored by: *
    *
  1. restoring the lookahead cache. *
  2. rewinding the TokenBuffer. *
  3. decreasing the guessing level. *
* * @see antlr.Token * @see antlr.TokenBuffer * @see antlr.TokenStream * @see antlr.LL1Parser * @see antlr.LLkParser * * @todo add constructors with ASTFactory. */ class ANTLR_API Parser { protected: Parser(TokenBuffer& input) : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) { } Parser(TokenBuffer* input) : inputState(new ParserInputState(input)), astFactory(0), traceDepth(0) { } Parser(const ParserSharedInputState& state) : inputState(state), astFactory(0), traceDepth(0) { } public: virtual ~Parser() { } /** Return the token type of the ith token of lookahead where i=1 * is the current token being examined by the parser (i.e., it * has not been matched yet). */ virtual int LA(unsigned int i)=0; /// Return the i-th token of lookahead virtual RefToken LT(unsigned int i)=0; /** DEPRECATED! Specify the factory to be used during tree building. (Compulsory) * Setting the factory is nowadays compulsory. * @see setASTFactory */ virtual void setASTNodeFactory( ASTFactory *factory ) { astFactory = factory; } /** Specify the factory to be used during tree building. (Compulsory) * Setting the factory is nowadays compulsory. */ virtual void setASTFactory( ASTFactory *factory ) { astFactory = factory; } /** Return a pointer to the ASTFactory used. * So you might use it in subsequent treewalkers or to reload AST's * from disk. */ virtual ASTFactory* getASTFactory() { return astFactory; } /** Get the root AST node of the generated AST. When using a custom AST type * or heterogenous AST's, you'll have to convert it to the right type * yourself. */ virtual RefAST getAST() = 0; /// Return the filename of the input file. virtual inline ANTLR_USE_NAMESPACE(std)string getFilename() const { return inputState->filename; } /// Set the filename of the input file (used for error reporting). virtual void setFilename(const ANTLR_USE_NAMESPACE(std)string& f) { inputState->filename = f; } virtual void setInputState(ParserSharedInputState state) { inputState = state; } virtual inline ParserSharedInputState getInputState() const { return inputState; } /// Get another token object from the token stream virtual void consume()=0; /// Consume tokens until one matches the given token virtual void consumeUntil(int tokenType) { while (LA(1) != Token::EOF_TYPE && LA(1) != tokenType) consume(); } /// Consume tokens until one matches the given token set virtual void consumeUntil(const BitSet& set) { while (LA(1) != Token::EOF_TYPE && !set.member(LA(1))) consume(); } /** Make sure current lookahead symbol matches token type t. * Throw an exception upon mismatch, which is catch by either the * error handler or by the syntactic predicate. */ virtual void match(int t) { if ( DEBUG_PARSER ) { traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "enter match(" << t << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; } if ( LA(1) != t ) { if ( DEBUG_PARSER ) { traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << "!=" << t << ANTLR_USE_NAMESPACE(std)endl; } throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, false, getFilename()); } else { // mark token as consumed -- fetch next token deferred until LA/LT consume(); } } virtual void matchNot(int t) { if ( LA(1)==t ) { // Throws inverted-sense exception throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), t, true, getFilename()); } else { // mark token as consumed -- fetch next token deferred until LA/LT consume(); } } /** Make sure current lookahead symbol matches the given set * Throw an exception upon mismatch, which is catch by either the * error handler or by the syntactic predicate. */ virtual void match(const BitSet& b) { if ( DEBUG_PARSER ) { traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "enter match(" << "bitset" /*b.toString()*/ << ") with LA(1)=" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; } if ( !b.member(LA(1)) ) { if ( DEBUG_PARSER ) { traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "token mismatch: " << LA(1) << " not member of " << "bitset" /*b.toString()*/ << ANTLR_USE_NAMESPACE(std)endl; } throw MismatchedTokenException(getTokenNames(), getNumTokens(), LT(1), b, false, getFilename()); } else { // mark token as consumed -- fetch next token deferred until LA/LT consume(); } } /** Mark a spot in the input and return the position. * Forwarded to TokenBuffer. */ virtual inline unsigned int mark() { return inputState->getInput().mark(); } /// rewind to a previously marked position virtual inline void rewind(unsigned int pos) { inputState->getInput().rewind(pos); } /** called by the generated parser to do error recovery, override to * customize the behaviour. */ virtual void recover(const RecognitionException& ex, const BitSet& tokenSet) { (void)ex; consume(); consumeUntil(tokenSet); } /// Parser error-reporting function can be overridden in subclass virtual void reportError(const RecognitionException& ex); /// Parser error-reporting function can be overridden in subclass virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); /// Parser warning-reporting function can be overridden in subclass virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); /// get the token name for the token number 'num' virtual const char* getTokenName(int num) const = 0; /// get a vector with all token names virtual const char* const* getTokenNames() const = 0; /** Get the number of tokens defined. * This one should be overridden in subclasses. */ virtual int getNumTokens(void) const = 0; /** Set or change the input token buffer */ // void setTokenBuffer(TokenBuffer* t); virtual void traceIndent(); virtual void traceIn(const char* rname); virtual void traceOut(const char* rname); protected: // void setTokenNames(const char** tokenNames_); ParserSharedInputState inputState; // /// AST return value for a rule is squirreled away here // RefAST returnAST; /// AST support code; parser and treeparser delegate to this object ASTFactory *astFactory; // used to keep track of the indentation for the trace int traceDepth; /** Utility class which allows tracing to work even when exceptions are * thrown. */ class Tracer { /*{{{*/ private: Parser* parser; const char* text; public: Tracer(Parser* p,const char * t) : parser(p), text(t) { parser->traceIn(text); } ~Tracer() { #ifdef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION // Only give trace if there's no uncaught exception.. if(!ANTLR_USE_NAMESPACE(std)uncaught_exception()) #endif parser->traceOut(text); } private: Tracer(const Tracer&); // undefined const Tracer& operator=(const Tracer&); // undefined /*}}}*/ }; private: Parser(const Parser&); // undefined const Parser& operator=(const Parser&); // undefined }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_Parser_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/ParserSharedInputState.hpp000066400000000000000000000040701316047212700254640ustar00rootroot00000000000000#ifndef INC_ParserSharedInputState_hpp__ #define INC_ParserSharedInputState_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/ParserSharedInputState.hpp#2 $ */ #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** This object contains the data associated with an * input stream of tokens. Multiple parsers * share a single ParserSharedInputState to parse * the same stream of tokens. */ class ANTLR_API ParserInputState { public: /** Construct a new ParserInputState * @param in the TokenBuffer to read from. The object is deleted together * with the ParserInputState object. */ ParserInputState( TokenBuffer* in ) : guessing(0) , filename() , input(in) , inputResponsible(true) { } /** Construct a new ParserInputState * @param in the TokenBuffer to read from. */ ParserInputState( TokenBuffer& in ) : guessing(0) , filename("") , input(&in) , inputResponsible(false) { } virtual ~ParserInputState() { if (inputResponsible) delete input; } TokenBuffer& getInput( void ) { return *input; } /// Reset the ParserInputState and the underlying TokenBuffer void reset( void ) { input->reset(); guessing = 0; } public: /** Are we guessing (guessing>0)? */ int guessing; /** What file (if known) caused the problem? * @todo wrap this one.. */ ANTLR_USE_NAMESPACE(std)string filename; private: /** Where to get token objects */ TokenBuffer* input; /// Do we need to free the TokenBuffer or is it owned by another.. bool inputResponsible; // we don't want these: ParserInputState(const ParserInputState&); ParserInputState& operator=(const ParserInputState&); }; /// A reference counted ParserInputState typedef RefCount ParserSharedInputState; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_ParserSharedInputState_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/RecognitionException.hpp000066400000000000000000000033701316047212700252210ustar00rootroot00000000000000#ifndef INC_RecognitionException_hpp__ # define INC_RecognitionException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/RecognitionException.hpp#2 $ */ # include # include # ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { # endif class ANTLR_API RecognitionException : public ANTLRException { public: RecognitionException(); RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s); RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s, const ANTLR_USE_NAMESPACE(std)string& fileName, int line, int column ); virtual ~RecognitionException() throw() { } /// Return file where mishap occurred. virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() { return fileName; } /** * @return the line number that this exception happened on. */ virtual int getLine() const throw() { return line; } /** * @return the column number that this exception happened on. */ virtual int getColumn() const throw() { return column; } /// Return complete error message with line/column number info (if present) virtual ANTLR_USE_NAMESPACE(std)string toString() const; /// See what file/line/column info is present and return it as a string virtual ANTLR_USE_NAMESPACE(std)string getFileLineColumnString() const; protected: ANTLR_USE_NAMESPACE(std)string fileName; // not used by treeparsers int line; // not used by treeparsers int column; // not used by treeparsers }; # ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } # endif #endif //INC_RecognitionException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/RefCount.hpp000066400000000000000000000026401316047212700226060ustar00rootroot00000000000000#ifndef INC_RefCount_hpp__ #define INC_RefCount_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/RefCount.hpp#2 $ */ #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif template class ANTLR_API RefCount { private: struct Ref { T* const ptr; unsigned int count; Ref(T* p) : ptr(p), count(1) {} ~Ref() {delete ptr;} Ref* increment() {++count;return this;} bool decrement() {return (--count==0);} private: Ref(const Ref&); Ref& operator=(const Ref&); }* ref; public: explicit RefCount(T* p = 0) : ref(p ? new Ref(p) : 0) { } RefCount(const RefCount& other) : ref(other.ref ? other.ref->increment() : 0) { } ~RefCount() { if (ref && ref->decrement()) delete ref; } RefCount& operator=(const RefCount& other) { Ref* tmp = other.ref ? other.ref->increment() : 0; if (ref && ref->decrement()) delete ref; ref = tmp; return *this; } operator T* () const { return ref ? ref->ptr : 0; } T* operator->() const { return ref ? ref->ptr : 0; } T* get() const { return ref ? ref->ptr : 0; } template operator RefCount() { return RefCount(ref); } }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_RefCount_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/SemanticException.hpp000066400000000000000000000016521316047212700245050ustar00rootroot00000000000000#ifndef INC_SemanticException_hpp__ #define INC_SemanticException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/SemanticException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API SemanticException : public RecognitionException { public: SemanticException(const ANTLR_USE_NAMESPACE(std)string& s) : RecognitionException(s) { } SemanticException(const ANTLR_USE_NAMESPACE(std)string& s, const ANTLR_USE_NAMESPACE(std)string& fileName_, int line_,int column_) : RecognitionException(s,fileName_,line_,column_) { } ~SemanticException() throw() { } }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_SemanticException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/String.hpp000066400000000000000000000013471316047212700223320ustar00rootroot00000000000000#ifndef INC_String_hpp__ #define INC_String_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/String.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, const int rhs ); ANTLR_API ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, size_t rhs ); ANTLR_API ANTLR_USE_NAMESPACE(std)string charName( int ch ); #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_String_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/Token.hpp000066400000000000000000000043101316047212700221350ustar00rootroot00000000000000#ifndef INC_Token_hpp__ #define INC_Token_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/Token.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif struct TokenRef; /** A token is minimally a token type. Subclasses can add the text matched * for the token and line info. */ class ANTLR_API Token { public: // constants #ifndef NO_STATIC_CONSTS static const int MIN_USER_TYPE = 4; static const int NULL_TREE_LOOKAHEAD = 3; static const int INVALID_TYPE = 0; static const int EOF_TYPE = 1; static const int SKIP = -1; #else enum { MIN_USER_TYPE = 4, NULL_TREE_LOOKAHEAD = 3, INVALID_TYPE = 0, EOF_TYPE = 1, SKIP = -1 }; #endif Token() : ref(0) , type(INVALID_TYPE) { } Token(int t) : ref(0) , type(t) { } Token(int t, const ANTLR_USE_NAMESPACE(std)string& txt) : ref(0) , type(t) { setText(txt); } virtual ~Token() { } virtual int getColumn() const; virtual int getLine() const; virtual ANTLR_USE_NAMESPACE(std)string getText() const; virtual const ANTLR_USE_NAMESPACE(std)string& getFilename() const; virtual int getType() const; virtual void setColumn(int c); virtual void setLine(int l); virtual void setText(const ANTLR_USE_NAMESPACE(std)string& t); virtual void setType(int t); virtual void setFilename( const std::string& file ); virtual ANTLR_USE_NAMESPACE(std)string toString() const; private: friend struct TokenRef; TokenRef* ref; int type; ///< the type of the token Token(RefToken other); Token& operator=(const Token& other); Token& operator=(RefToken other); Token(const Token&); }; extern ANTLR_API RefToken nullToken; #ifdef NEEDS_OPERATOR_LESS_THAN // RK: Added after 2.7.2 previously it was undefined. // AL: what to return if l and/or r point to nullToken??? inline bool operator<( RefToken l, RefToken r ) { return nullToken == l ? ( nullToken == r ? false : true ) : l->getType() < r->getType(); } #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_Token_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenBuffer.hpp000066400000000000000000000055171316047212700233010ustar00rootroot00000000000000#ifndef INC_TokenBuffer_hpp__ #define INC_TokenBuffer_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenBuffer.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /**A Stream of Token objects fed to the parser from a TokenStream that can * be rewound via mark()/rewind() methods. *

* A dynamic array is used to buffer up all the input tokens. Normally, * "k" tokens are stored in the buffer. More tokens may be stored during * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. * Consumption of tokens is deferred. In other words, reading the next * token is not done by conume(), but deferred until needed by LA or LT. *

* * @todo: see if we can integrate this one with InputBuffer into one template * or so. * * @see antlr.Token * @see antlr.TokenStream * @see antlr.TokenQueue */ class ANTLR_API TokenBuffer { public: /** Create a token buffer */ TokenBuffer(TokenStream& input_); virtual ~TokenBuffer(); /// Reset the input buffer to empty state inline void reset( void ) { nMarkers = 0; markerOffset = 0; numToConsume = 0; queue.clear(); } /** Get a lookahead token value */ int LA( unsigned int i ); /** Get a lookahead token */ RefToken LT( unsigned int i ); /** Return an integer marker that can be used to rewind the buffer to * its current state. */ unsigned int mark(); /**Rewind the token buffer to a marker. * @param mark Marker returned previously from mark() */ void rewind(unsigned int mark); /** Mark another token for deferred consumption */ inline void consume() { numToConsume++; } /// Return the number of entries in the TokenBuffer virtual unsigned int entries() const; private: /** Ensure that the token buffer is sufficiently full */ void fill(unsigned int amount); /** Sync up deferred consumption */ void syncConsume(); protected: /// Token source TokenStream& input; /// Number of active markers unsigned int nMarkers; /// Additional offset used when markers are active unsigned int markerOffset; /// Number of calls to consume() since last LA() or LT() call unsigned int numToConsume; /// Circular queue with Tokens CircularQueue queue; private: TokenBuffer(const TokenBuffer& other); const TokenBuffer& operator=(const TokenBuffer& other); }; /** Sync up deferred consumption */ inline void TokenBuffer::syncConsume() { if (numToConsume > 0) { if (nMarkers > 0) markerOffset += numToConsume; else queue.removeItems( numToConsume ); numToConsume = 0; } } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenBuffer_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenRefCount.hpp000066400000000000000000000033031316047212700236040ustar00rootroot00000000000000#ifndef INC_TokenRefCount_hpp__ # define INC_TokenRefCount_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ # include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class Token; struct ANTLR_API TokenRef { Token* const ptr; unsigned int count; TokenRef(Token* p); ~TokenRef(); TokenRef* increment() { ++count; return this; } bool decrement() { return (--count==0); } static TokenRef* getRef(const Token* p); private: TokenRef( const TokenRef& ); TokenRef& operator=( const TokenRef& ); }; template class ANTLR_API TokenRefCount { private: TokenRef* ref; public: TokenRefCount(const Token* p=0) : ref(p ? TokenRef::getRef(p) : 0) { } TokenRefCount(const TokenRefCount& other) : ref(other.ref ? other.ref->increment() : 0) { } ~TokenRefCount() { if (ref && ref->decrement()) delete ref; } TokenRefCount& operator=(Token* other) { TokenRef* tmp = TokenRef::getRef(other); if (ref && ref->decrement()) delete ref; ref=tmp; return *this; } TokenRefCount& operator=(const TokenRefCount& other) { if( other.ref != ref ) { TokenRef* tmp = other.ref ? other.ref->increment() : 0; if (ref && ref->decrement()) delete ref; ref=tmp; } return *this; } operator T* () const { return ref ? static_cast(ref->ptr) : 0; } T* operator->() const { return ref ? static_cast(ref->ptr) : 0; } T* get() const { return ref ? static_cast(ref->ptr) : 0; } }; typedef TokenRefCount RefToken; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenRefCount_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStream.hpp000066400000000000000000000013161316047212700233140ustar00rootroot00000000000000#ifndef INC_TokenStream_hpp__ #define INC_TokenStream_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStream.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** This interface allows any object to pretend it is a stream * of tokens. * @author Terence Parr, MageLang Institute */ class ANTLR_API TokenStream { public: virtual RefToken nextToken()=0; virtual ~TokenStream() { } }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStream_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamBasicFilter.hpp000066400000000000000000000020511316047212700254210ustar00rootroot00000000000000#ifndef INC_TokenStreamBasicFilter_hpp__ #define INC_TokenStreamBasicFilter_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamBasicFilter.hpp#2 $ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** This object is a TokenStream that passes through all * tokens except for those that you tell it to discard. * There is no buffering of the tokens. */ class ANTLR_API TokenStreamBasicFilter : public TokenStream { /** The set of token types to discard */ protected: BitSet discardMask; /** The input stream */ protected: TokenStream* input; public: TokenStreamBasicFilter(TokenStream& input_); void discard(int ttype); void discard(const BitSet& mask); RefToken nextToken(); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStreamBasicFilter_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamException.hpp000066400000000000000000000016171316047212700251770ustar00rootroot00000000000000#ifndef INC_TokenStreamException_hpp__ #define INC_TokenStreamException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** Baseclass for exceptions thrown by classes implementing the TokenStream * interface. * @see TokenStream */ class ANTLR_API TokenStreamException : public ANTLRException { public: TokenStreamException() : ANTLRException() { } TokenStreamException(const ANTLR_USE_NAMESPACE(std)string& s) : ANTLRException(s) { } virtual ~TokenStreamException() throw() { } }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStreamException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamHiddenTokenFilter.hpp000066400000000000000000000043761316047212700266100ustar00rootroot00000000000000#ifndef INC_TokenStreamHiddenTokenFilter_hpp__ #define INC_TokenStreamHiddenTokenFilter_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamHiddenTokenFilter.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /**This object filters a token stream coming from a lexer * or another TokenStream so that only certain token channels * get transmitted to the parser. * * Any of the channels can be filtered off as "hidden" channels whose * tokens can be accessed from the parser. */ class ANTLR_API TokenStreamHiddenTokenFilter : public TokenStreamBasicFilter { // protected BitSet discardMask; protected: BitSet hideMask; private: RefToken nextMonitoredToken; protected: /** track tail of hidden list emanating from previous * monitored token */ RefToken lastHiddenToken; RefToken firstHidden; // = null; public: TokenStreamHiddenTokenFilter(TokenStream& input); protected: void consume(); private: void consumeFirst(); public: BitSet getDiscardMask() const; /** Return a ptr to the hidden token appearing immediately after * token t in the input stream. */ RefToken getHiddenAfter(RefToken t); /** Return a ptr to the hidden token appearing immediately before * token t in the input stream. */ RefToken getHiddenBefore(RefToken t); BitSet getHideMask() const; /** Return the first hidden token if one appears * before any monitored token. */ RefToken getInitialHiddenToken(); void hide(int m); void hide(const BitSet& mask); protected: RefToken LA(int i); public: /** Return the next monitored token. * Test the token following the monitored token. * If following is another monitored token, save it * for the next invocation of nextToken (like a single * lookahead token) and return it then. * If following is unmonitored, nondiscarded (hidden) * channel token, add it to the monitored token. * * Note: EOF must be a monitored Token. */ RefToken nextToken(); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStreamHiddenTokenFilter_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamIOException.hpp000066400000000000000000000015651316047212700254310ustar00rootroot00000000000000#ifndef INC_TokenStreamIOException_hpp__ #define INC_TokenStreamIOException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamIOException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class TokenStreamIOException : public TokenStreamException { public: TokenStreamIOException() : TokenStreamException() { } TokenStreamIOException(const ANTLR_USE_NAMESPACE(std)exception& e) : TokenStreamException(e.what()) , io(e) { } ~TokenStreamIOException() throw() { } private: ANTLR_USE_NAMESPACE(std)exception io; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStreamIOException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamRecognitionException.hpp000066400000000000000000000025241316047212700273760ustar00rootroot00000000000000#ifndef INC_TokenStreamRecognitionException_hpp__ #define INC_TokenStreamRecognitionException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamRecognitionException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** Exception thrown from generated lexers when there's no default error * handler specified. * @see TokenStream */ class TokenStreamRecognitionException : public TokenStreamException { public: TokenStreamRecognitionException(RecognitionException& re) : TokenStreamException(re.getMessage()) , recog(re) { } virtual ~TokenStreamRecognitionException() throw() { } virtual ANTLR_USE_NAMESPACE(std)string toString() const { return recog.getFileLineColumnString()+getMessage(); } virtual ANTLR_USE_NAMESPACE(std)string getFilename() const throw() { return recog.getFilename(); } virtual int getLine() const throw() { return recog.getLine(); } virtual int getColumn() const throw() { return recog.getColumn(); } private: RecognitionException recog; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStreamRecognitionException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamRetryException.hpp000066400000000000000000000013041316047212700262160ustar00rootroot00000000000000#ifndef INC_TokenStreamRetryException_hpp__ #define INC_TokenStreamRetryException_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamRetryException.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class TokenStreamRetryException : public TokenStreamException { public: TokenStreamRetryException() {} ~TokenStreamRetryException() throw() {} }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStreamRetryException_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamRewriteEngine.hpp000066400000000000000000000304541316047212700260110ustar00rootroot00000000000000#ifndef INC_TokenStreamRewriteEngine_hpp__ #define INC_TokenStreamRewriteEngine_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html */ #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** This token stream tracks the *entire* token stream coming from * a lexer, but does not pass on the whitespace (or whatever else * you want to discard) to the parser. * * This class can then be asked for the ith token in the input stream. * Useful for dumping out the input stream exactly after doing some * augmentation or other manipulations. Tokens are index from 0..n-1 * * You can insert stuff, replace, and delete chunks. Note that the * operations are done lazily--only if you convert the buffer to a * String. This is very efficient because you are not moving data around * all the time. As the buffer of tokens is converted to strings, the * toString() method(s) check to see if there is an operation at the * current index. If so, the operation is done and then normal String * rendering continues on the buffer. This is like having multiple Turing * machine instruction streams (programs) operating on a single input tape. :) * * Since the operations are done lazily at toString-time, operations do not * screw up the token index values. That is, an insert operation at token * index i does not change the index values for tokens i+1..n-1. * * Because operations never actually alter the buffer, you may always get * the original token stream back without undoing anything. Since * the instructions are queued up, you can easily simulate transactions and * roll back any changes if there is an error just by removing instructions. * For example, * * TokenStreamRewriteEngine rewriteEngine = * new TokenStreamRewriteEngine(lexer); * JavaRecognizer parser = new JavaRecognizer(rewriteEngine); * ... * rewriteEngine.insertAfter("pass1", t, "foobar");} * rewriteEngine.insertAfter("pass2", u, "start");} * System.out.println(rewriteEngine.toString("pass1")); * System.out.println(rewriteEngine.toString("pass2")); * * You can also have multiple "instruction streams" and get multiple * rewrites from a single pass over the input. Just name the instruction * streams and use that name again when printing the buffer. This could be * useful for generating a C file and also its header file--all from the * same buffer. * * If you don't use named rewrite streams, a "default" stream is used. * * Terence Parr, parrt@cs.usfca.edu * University of San Francisco * February 2004 */ class TokenStreamRewriteEngine : public TokenStream { public: typedef ANTLR_USE_NAMESPACE(std)vector token_list; static const char* DEFAULT_PROGRAM_NAME; #ifndef NO_STATIC_CONSTS static const size_t MIN_TOKEN_INDEX; static const int PROGRAM_INIT_SIZE; #else enum { MIN_TOKEN_INDEX = 0, PROGRAM_INIT_SIZE = 100 }; #endif struct tokenToStream { tokenToStream( ANTLR_USE_NAMESPACE(std)ostream& o ) : out(o) {} template void operator() ( const T& t ) { out << t->getText(); } ANTLR_USE_NAMESPACE(std)ostream& out; }; class RewriteOperation { protected: RewriteOperation( size_t idx, const ANTLR_USE_NAMESPACE(std)string& txt ) : index(idx), text(txt) { } public: virtual ~RewriteOperation() { } /** Execute the rewrite operation by possibly adding to the buffer. * Return the index of the next token to operate on. */ virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& /* out */ ) { return index; } virtual size_t getIndex() const { return index; } virtual const char* type() const { return "RewriteOperation"; } protected: size_t index; ANTLR_USE_NAMESPACE(std)string text; }; struct executeOperation { ANTLR_USE_NAMESPACE(std)ostream& out; executeOperation( ANTLR_USE_NAMESPACE(std)ostream& s ) : out(s) {} void operator () ( RewriteOperation* t ) { t->execute(out); } }; /// list of rewrite operations typedef ANTLR_USE_NAMESPACE(std)list operation_list; /// map program name to tuple typedef ANTLR_USE_NAMESPACE(std)map program_map; class InsertBeforeOp : public RewriteOperation { public: InsertBeforeOp( size_t index, const ANTLR_USE_NAMESPACE(std)string& text ) : RewriteOperation(index, text) { } virtual ~InsertBeforeOp() {} virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) { out << text; return index; } virtual const char* type() const { return "InsertBeforeOp"; } }; class ReplaceOp : public RewriteOperation { public: ReplaceOp(size_t from, size_t to, ANTLR_USE_NAMESPACE(std)string text) : RewriteOperation(from,text) , lastIndex(to) { } virtual ~ReplaceOp() {} virtual size_t execute( ANTLR_USE_NAMESPACE(std)ostream& out ) { out << text; return lastIndex+1; } virtual const char* type() const { return "ReplaceOp"; } protected: size_t lastIndex; }; class DeleteOp : public ReplaceOp { public: DeleteOp(size_t from, size_t to) : ReplaceOp(from,to,"") { } virtual const char* type() const { return "DeleteOp"; } }; TokenStreamRewriteEngine(TokenStream& upstream); TokenStreamRewriteEngine(TokenStream& upstream, size_t initialSize); RefToken nextToken( void ); void rollback(size_t instructionIndex) { rollback(DEFAULT_PROGRAM_NAME, instructionIndex); } /** Rollback the instruction stream for a program so that * the indicated instruction (via instructionIndex) is no * longer in the stream. UNTESTED! */ void rollback(const ANTLR_USE_NAMESPACE(std)string& programName, size_t instructionIndex ); void deleteProgram() { deleteProgram(DEFAULT_PROGRAM_NAME); } /** Reset the program so that no instructions exist */ void deleteProgram(const ANTLR_USE_NAMESPACE(std)string& programName) { rollback(programName, MIN_TOKEN_INDEX); } void insertAfter( RefTokenWithIndex t, const ANTLR_USE_NAMESPACE(std)string& text ) { insertAfter(DEFAULT_PROGRAM_NAME, t, text); } void insertAfter(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { insertAfter(DEFAULT_PROGRAM_NAME, index, text); } void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, RefTokenWithIndex t, const ANTLR_USE_NAMESPACE(std)string& text ) { insertAfter(programName, t->getIndex(), text); } void insertAfter( const ANTLR_USE_NAMESPACE(std)string& programName, size_t index, const ANTLR_USE_NAMESPACE(std)string& text ) { // to insert after, just insert before next index (even if past end) insertBefore(programName,index+1, text); } void insertBefore( RefTokenWithIndex t, const ANTLR_USE_NAMESPACE(std)string& text ) { // std::cout << "insertBefore index " << t->getIndex() << " " << text << std::endl; insertBefore(DEFAULT_PROGRAM_NAME, t, text); } void insertBefore(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { insertBefore(DEFAULT_PROGRAM_NAME, index, text); } void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, RefTokenWithIndex t, const ANTLR_USE_NAMESPACE(std)string& text ) { insertBefore(programName, t->getIndex(), text); } void insertBefore( const ANTLR_USE_NAMESPACE(std)string& programName, size_t index, const ANTLR_USE_NAMESPACE(std)string& text ) { addToSortedRewriteList(programName, new InsertBeforeOp(index,text)); } void replace(size_t index, const ANTLR_USE_NAMESPACE(std)string& text) { replace(DEFAULT_PROGRAM_NAME, index, index, text); } void replace( size_t from, size_t to, const ANTLR_USE_NAMESPACE(std)string& text) { replace(DEFAULT_PROGRAM_NAME, from, to, text); } void replace( RefTokenWithIndex indexT, const ANTLR_USE_NAMESPACE(std)string& text ) { replace(DEFAULT_PROGRAM_NAME, indexT->getIndex(), indexT->getIndex(), text); } void replace( RefTokenWithIndex from, RefTokenWithIndex to, const ANTLR_USE_NAMESPACE(std)string& text ) { replace(DEFAULT_PROGRAM_NAME, from, to, text); } void replace(const ANTLR_USE_NAMESPACE(std)string& programName, size_t from, size_t to, const ANTLR_USE_NAMESPACE(std)string& text ) { addToSortedRewriteList(programName,new ReplaceOp(from, to, text)); } void replace( const ANTLR_USE_NAMESPACE(std)string& programName, RefTokenWithIndex from, RefTokenWithIndex to, const ANTLR_USE_NAMESPACE(std)string& text ) { replace(programName, from->getIndex(), to->getIndex(), text); } void remove(size_t index) { remove(DEFAULT_PROGRAM_NAME, index, index); } void remove(size_t from, size_t to) { remove(DEFAULT_PROGRAM_NAME, from, to); } void remove(RefTokenWithIndex indexT) { remove(DEFAULT_PROGRAM_NAME, indexT, indexT); } void remove(RefTokenWithIndex from, RefTokenWithIndex to) { remove(DEFAULT_PROGRAM_NAME, from, to); } void remove( const ANTLR_USE_NAMESPACE(std)string& programName, size_t from, size_t to) { replace(programName,from,to,""); } void remove( const ANTLR_USE_NAMESPACE(std)string& programName, RefTokenWithIndex from, RefTokenWithIndex to ) { replace(programName,from,to,""); } void discard(int ttype) { discardMask.add(ttype); } RefToken getToken( size_t i ) { return RefToken(tokens.at(i)); } size_t getTokenStreamSize() const { return tokens.size(); } void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { ANTLR_USE_NAMESPACE(std)for_each( tokens.begin(), tokens.end(), tokenToStream(out) ); } void originalToStream( ANTLR_USE_NAMESPACE(std)ostream& out, size_t start, size_t end ) const; void toStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { toStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); } void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, const ANTLR_USE_NAMESPACE(std)string& programName ) const { toStream( out, programName, MIN_TOKEN_INDEX, getTokenStreamSize()); } void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, size_t start, size_t end ) const { toStream(out, DEFAULT_PROGRAM_NAME, start, end); } void toStream( ANTLR_USE_NAMESPACE(std)ostream& out, const ANTLR_USE_NAMESPACE(std)string& programName, size_t firstToken, size_t lastToken ) const; void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { toDebugStream( out, MIN_TOKEN_INDEX, getTokenStreamSize()); } void toDebugStream( ANTLR_USE_NAMESPACE(std)ostream& out, size_t start, size_t end ) const; size_t getLastRewriteTokenIndex() const { return getLastRewriteTokenIndex(DEFAULT_PROGRAM_NAME); } /** Return the last index for the program named programName * return 0 if the program does not exist or the program is empty. * (Note this is different from the java implementation that returns -1) */ size_t getLastRewriteTokenIndex(const ANTLR_USE_NAMESPACE(std)string& programName) const { program_map::const_iterator rewrites = programs.find(programName); if( rewrites == programs.end() ) return 0; const operation_list& prog = rewrites->second; if( !prog.empty() ) { operation_list::const_iterator last = prog.end(); --last; return (*last)->getIndex(); } return 0; } protected: /** If op.index > lastRewriteTokenIndexes, just add to the end. * Otherwise, do linear */ void addToSortedRewriteList(RewriteOperation* op) { addToSortedRewriteList(DEFAULT_PROGRAM_NAME, op); } void addToSortedRewriteList( const ANTLR_USE_NAMESPACE(std)string& programName, RewriteOperation* op ); protected: /** Who do we suck tokens from? */ TokenStream& stream; /** track index of tokens */ size_t index; /** Track the incoming list of tokens */ token_list tokens; /** You may have multiple, named streams of rewrite operations. * I'm calling these things "programs." * Maps String (name) -> rewrite (List) */ program_map programs; /** Which (whitespace) token(s) to throw out */ BitSet discardMask; }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenStreamSelector.hpp000066400000000000000000000053171316047212700250220ustar00rootroot00000000000000#ifndef INC_TokenStreamSelector_hpp__ #define INC_TokenStreamSelector_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TokenStreamSelector.hpp#2 $ */ #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** A token stream MUX (multiplexor) knows about n token streams * and can multiplex them onto the same channel for use by token * stream consumer like a parser. This is a way to have multiple * lexers break up the same input stream for a single parser. * Or, you can have multiple instances of the same lexer handle * multiple input streams; this works great for includes. */ class ANTLR_API TokenStreamSelector : public TokenStream { protected: /** The set of inputs to the MUX */ #ifdef OS_NO_ALLOCATOR typedef ANTLR_USE_NAMESPACE(std)less lessp; typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; #else typedef ANTLR_USE_NAMESPACE(std)map inputStreamNames_coll; #endif inputStreamNames_coll inputStreamNames; /** The currently-selected token stream input */ TokenStream* input; /** Used to track stack of input streams */ #ifdef OS_NO_ALLOCATOR typedef ANTLR_USE_NAMESPACE(std)stack > streamStack_coll; #else typedef ANTLR_USE_NAMESPACE(std)stack streamStack_coll; #endif streamStack_coll streamStack; public: TokenStreamSelector(); ~TokenStreamSelector(); void addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key); /// Return the stream from which tokens are being pulled at the moment. TokenStream* getCurrentStream() const; TokenStream* getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const; RefToken nextToken(); TokenStream* pop(); void push(TokenStream* stream); void push(const ANTLR_USE_NAMESPACE(std)string& sname); /** Abort recognition of current Token and try again. * A stream can push a new stream (for include files * for example, and then retry(), which will cause * the current stream to abort back to this.nextToken(). * this.nextToken() then asks for a token from the * current stream, which is the new "substream." */ void retry(); /** Set the stream without pushing old stream */ void select(TokenStream* stream); void select(const ANTLR_USE_NAMESPACE(std)string& sname); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TokenStreamSelector_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TokenWithIndex.hpp000066400000000000000000000031451316047212700237660ustar00rootroot00000000000000#ifndef INC_TokenWithIndex_hpp__ #define INC_TokenWithIndex_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API TokenWithIndex : public ANTLR_USE_NAMESPACE(antlr)CommonToken { public: // static size_t count; TokenWithIndex() : CommonToken(), index(0) { // std::cout << __PRETTY_FUNCTION__ << std::endl; // count++; } TokenWithIndex(int t, const ANTLR_USE_NAMESPACE(std)string& txt) : CommonToken(t,txt) , index(0) { // std::cout << __PRETTY_FUNCTION__ << std::endl; // count++; } TokenWithIndex(const ANTLR_USE_NAMESPACE(std)string& s) : CommonToken(s) , index(0) { // std::cout << __PRETTY_FUNCTION__ << std::endl; // count++; } ~TokenWithIndex() { // count--; } void setIndex( size_t idx ) { index = idx; } size_t getIndex( void ) const { return index; } ANTLR_USE_NAMESPACE(std)string toString() const { return ANTLR_USE_NAMESPACE(std)string("[")+ index+ ":\""+ getText()+"\",<"+ getType()+">,line="+ getLine()+",column="+ getColumn()+"]"; } static RefToken factory() { return RefToken(new TokenWithIndex()); } protected: size_t index; private: TokenWithIndex(const TokenWithIndex&); const TokenWithIndex& operator=(const TokenWithIndex&); }; typedef TokenRefCount RefTokenWithIndex; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_CommonToken_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TreeParser.hpp000066400000000000000000000103511316047212700231330ustar00rootroot00000000000000#ifndef INC_TreeParser_hpp__ #define INC_TreeParser_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TreeParser.hpp#2 $ */ #include #include #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif class ANTLR_API TreeParser { public: TreeParser() : astFactory(0) , inputState(new TreeParserInputState()) , traceDepth(0) { } TreeParser(const TreeParserSharedInputState& state) : astFactory(0) , inputState(state) , traceDepth(0) { } virtual ~TreeParser() { } /// Get the AST return value squirreled away in the parser virtual RefAST getAST() = 0; /** Make sure current lookahead symbol matches the given set * Throw an exception upon mismatch, which is caught by either the * error handler or by a syntactic predicate. */ virtual void match(RefAST t, const BitSet& b) { if ( !t || t==ASTNULL || !b.member(t->getType()) ) throw MismatchedTokenException( getTokenNames(), getNumTokens(), t, b, false ); } /** Specify the AST factory to be used during tree building. (Compulsory) * Setting the factory is compulsory (if you intend to modify * the tree in the treeparser). The AST Factory is shared between * parser (who builds the initial AST) and treeparser. * @see Parser::getASTFactory() */ virtual void setASTFactory(ASTFactory* factory) { astFactory = factory; } /// Return pointer to ASTFactory virtual ASTFactory* getASTFactory() const { return astFactory; } /// Get the name for token 'num' virtual const char* getTokenName(int num) const = 0; /// Return the number of tokens defined virtual int getNumTokens() const = 0; /// Return an array of getNumTokens() token names virtual const char* const* getTokenNames() const = 0; /// Parser error-reporting function can be overridden in subclass virtual void reportError(const RecognitionException& ex); /// Parser error-reporting function can be overridden in subclass virtual void reportError(const ANTLR_USE_NAMESPACE(std)string& s); /// Parser warning-reporting function can be overridden in subclass virtual void reportWarning(const ANTLR_USE_NAMESPACE(std)string& s); /// These are used during when traceTreeParser commandline option is passed. virtual void traceIndent(); virtual void traceIn(const char* rname, RefAST t); virtual void traceOut(const char* rname, RefAST t); /** The AST Null object; the parsing cursor is set to this when * it is found to be null. This way, we can test the * token type of a node without having to have tests for 0 * everywhere. */ static RefAST ASTNULL; protected: virtual void match(RefAST t, int ttype) { if (!t || t == ASTNULL || t->getType() != ttype ) throw MismatchedTokenException( getTokenNames(), getNumTokens(), t, ttype, false ); } virtual void matchNot(RefAST t, int ttype) { if ( !t || t == ASTNULL || t->getType() == ttype ) throw MismatchedTokenException( getTokenNames(), getNumTokens(), t, ttype, true ); } /** AST support code; parser and treeparser delegate to this object */ ASTFactory* astFactory; /// The input state of this tree parser. TreeParserSharedInputState inputState; /** Used to keep track of indent depth with -traceTreeParser */ int traceDepth; /** Utility class which allows tracing to work even when exceptions are * thrown. */ class Tracer { private: TreeParser* parser; const char* text; RefAST tree; public: Tracer(TreeParser* p, const char* t, RefAST a) : parser(p), text(t), tree(a) { parser->traceIn(text,tree); } ~Tracer() { parser->traceOut(text,tree); } private: Tracer(const Tracer&); // undefined const Tracer& operator=(const Tracer&); // undefined }; private: // no copying of treeparser instantiations... TreeParser(const TreeParser& other); TreeParser& operator=(const TreeParser& other); }; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TreeParser_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/TreeParserSharedInputState.hpp000066400000000000000000000022301316047212700263000ustar00rootroot00000000000000#ifndef INC_TreeParserSharedInputState_hpp__ #define INC_TreeParserSharedInputState_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/TreeParserSharedInputState.hpp#2 $ */ #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** This object contains the data associated with an * input AST. Multiple parsers * share a single TreeParserSharedInputState to parse * the same tree or to have the parser walk multiple * trees. */ class ANTLR_API TreeParserInputState { public: TreeParserInputState() : guessing(0) {} virtual ~TreeParserInputState() {} public: /** Are we guessing (guessing>0)? */ int guessing; //= 0; private: // we don't want these: TreeParserInputState(const TreeParserInputState&); TreeParserInputState& operator=(const TreeParserInputState&); }; typedef RefCount TreeParserSharedInputState; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif #endif //INC_TreeParserSharedInputState_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/antlr/config.hpp000066400000000000000000000206511316047212700223300ustar00rootroot00000000000000#ifndef INC_config_hpp__ #define INC_config_hpp__ /* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/antlr/config.hpp#2 $ */ /* * Just a simple configuration file to differentiate between the * various compilers used and reconfigure stuff for any oddities of the * compiler in question. * * These are the defaults. Per compiler these are amended. */ #define ANTLR_USE_NAMESPACE(_x_) _x_:: #define ANTLR_USING_NAMESPACE(_x_) using namespace _x_; #define ANTLR_CXX_SUPPORTS_NAMESPACE 1 #define ANTLR_C_USING(_x_) #define ANTLR_API #ifndef CUSTOM_API # define CUSTOM_API #endif #define ANTLR_IOS_BASE ios_base /** define if cctype functions/macros need a std:: prefix. A lot of compilers * define these as macros, in which case something barfs. */ #define ANTLR_CCTYPE_NEEDS_STD /// Define if C++ compiler supports std::uncaught_exception #define ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION #define ANTLR_ATOI_IN_STD /******************************************************************************/ /*{{{ Microsoft Visual C++ */ // NOTE: If you provide patches for a specific MSVC version guard them for // the specific version!!!! // _MSC_VER == 1100 for Microsoft Visual C++ 5.0 // _MSC_VER == 1200 for Microsoft Visual C++ 6.0 // _MSC_VER == 1300 for Microsoft Visual C++ 7.0 #if defined(_MSC_VER) # if _MSC_VER < 1300 # define NOMINMAX # pragma warning(disable : 4786) # define min _cpp_min # endif // This warning really gets on my nerves. // It's the one about symbol longer than 256 chars, and it happens // all the time with STL. # pragma warning( disable : 4786 4231 ) // this shuts up some DLL interface warnings for STL # pragma warning( disable : 4251 ) # ifdef ANTLR_CXX_USE_STLPORT # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION # endif # if ( _MSC_VER < 1300 ) && ( defined(ANTLR_EXPORTS) || defined(ANTLR_IMPORTS) ) # error "DLL Build not supported on these MSVC versions." // see comment in lib/cpp/src/dll.cpp # endif // For the DLL support originally contributed by Stephen Naughton // If you are building statically leave ANTLR_EXPORTS/ANTLR_IMPORTS undefined // If you are building the DLL define ANTLR_EXPORTS // If you are compiling code to be used with the DLL define ANTLR_IMPORTS # ifdef ANTLR_EXPORTS # undef ANTLR_API # define ANTLR_API __declspec(dllexport) # endif # ifdef ANTLR_IMPORTS # undef ANTLR_API # define ANTLR_API __declspec(dllimport) # endif # if ( _MSC_VER < 1200 ) // supposedly only for MSVC5 and before... // Using vector requires operator<(X,X) to be defined # define NEEDS_OPERATOR_LESS_THAN # endif // VC6 # if ( _MSC_VER == 1200 ) # undef ANTLR_ATOI_IN_STD # endif # if ( _MSC_VER < 1310 ) // Supposedly only for MSVC7 and before... // Not allowed to put 'static const int XXX=20;' in a class definition # define NO_STATIC_CONSTS # define NO_TEMPLATE_PARTS # endif // No strcasecmp in the C library (so use stricmp instead) // - Anyone know which is in which standard? # define NO_STRCASECMP # undef ANTLR_CCTYPE_NEEDS_STD # define NO_STATIC_CONSTS #endif // End of Microsoft Visual C++ /*}}}*/ /******************************************************************************/ /*{{{ SunPro Compiler (Using OBJECTSPACE STL) *****************************************************************************/ #ifdef __SUNPRO_CC # if (__SUNPRO_CC >= 0x500) # define NEEDS_OPERATOR_LESS_THAN # define NO_TEMPLATE_PARTS # else # undef namespace # define namespace # if (__SUNPRO_CC == 0x420) /* This code is specif to SunWspro Compiler 4.2, and will compile with the objectspace 2.1 toolkit for Solaris2.6 */ # define HAS_NOT_CASSERT_H # define HAS_NOT_CSTRING_H # define HAS_NOT_CCTYPE_H # define HAS_NOT_CSTDIO_H # define HAS_OSTREAM_H /* #define OS_SOLARIS_2_6 #define OS_NO_WSTRING #define OS_NO_ALLOCATORS #define OS_MULTI_THREADED #define OS_SOLARIS_NATIVE #define OS_REALTIME #define __OSVERSION__=5 #define SVR4 */ // ObjectSpace + some specific templates constructions with stl. /* #define OS_NO_ALLOCATOR */ // This great compiler does not have the namespace feature. # undef ANTLR_USE_NAMESPACE # define ANTLR_USE_NAMESPACE(_x_) # undef ANTLR_USING_NAMESPACE # define ANTLR_USING_NAMESPACE(_x_) # undef ANTLR_CXX_SUPPORTS_NAMESPACE # endif // End __SUNPRO_CC == 0x420 # undef explicit # define explicit # define exception os_exception # define bad_exception os_bad_exception // Not allowed to put 'static const int XXX=20;' in a class definition # define NO_STATIC_CONSTS // Using vector requires operator<(X,X) to be defined # define NEEDS_OPERATOR_LESS_THAN # endif # undef ANTLR_CCTYPE_NEEDS_STD #endif // end __SUNPRO_CC /*}}}*/ /*****************************************************************************/ /*{{{ Inprise C++ Builder 3.0 *****************************************************************************/ #ifdef __BCPLUSPLUS__ # define NO_TEMPLATE_PARTS # define NO_STRCASECMP # undef ANTLR_CCTYPE_NEEDS_STD #endif // End of C++ Builder 3.0 /*}}}*/ /*****************************************************************************/ /*{{{ IBM VisualAge C++ ( which includes the Dinkumware C++ Library ) *****************************************************************************/ #ifdef __IBMCPP__ // No strcasecmp in the C library (so use stricmp instead) // - Anyone know which is in which standard? #if (defined(_AIX) && (__IBMCPP__ >= 600)) # define NO_STATIC_CONSTS #else # define NO_STRCASECMP # undef ANTLR_CCTYPE_NEEDS_STD #endif #endif // end IBM VisualAge C++ /*}}}*/ /*****************************************************************************/ /*{{{ Metrowerks Codewarrior *****************************************************************************/ #ifdef __MWERKS__ # if (__MWERKS__ <= 0x2201) # define NO_TEMPLATE_PARTS # endif // CW 6.0 and 7.0 still do not have it. # define ANTLR_REALLY_NO_STRCASECMP # undef ANTLR_C_USING # define ANTLR_C_USING(_x_) using std:: ## _x_; # define ANTLR_CCTYPE_NEEDS_STD # undef ANTLR_CXX_SUPPORTS_UNCAUGHT_EXCEPTION #endif // End of Metrowerks Codewarrior /*}}}*/ /*****************************************************************************/ /*{{{ SGI Irix 6.5.10 MIPSPro compiler *****************************************************************************/ // (contributed by Anna Winkler) // Note: you can't compile ANTLR with the MIPSPro compiler on // anything < 6.5.10 because SGI just fixed a big bug dealing with // namespaces in that release. #ifdef __sgi # define HAS_NOT_CCTYPE_H # define HAS_NOT_CSTRING_H # define HAS_NOT_CSTDIO_H # undef ANTLR_CCTYPE_NEEDS_STD #endif // End IRIX MIPSPro /*}}}*/ /*****************************************************************************/ /*{{{ G++ in various incarnations *****************************************************************************/ // With the gcc-2.95 and 3.0 being in the near future we should start handling // incompatabilities between the various libstdc++'s. #if defined(__GNUC__) || defined(__GNUG__) // gcc 2 branch.. # if (__GNUC__ == 2 ) # if (__GNUC_MINOR__ <= 8 ) # undef ANTLR_USE_NAMESPACE # define ANTLR_USE_NAMESPACE(_x_) # undef ANTLR_USING_NAMESPACE # define ANTLR_USING_NAMESPACE(_x_) # undef ANTLR_CXX_SUPPORTS_NAMESPACE # endif # if (__GNUC_MINOR__ > 8 && __GNUC_MINOR__ <= 95 ) # undef ANTLR_IOS_BASE # define ANTLR_IOS_BASE ios # undef ANTLR_CCTYPE_NEEDS_STD // compiling with -ansi ? # ifdef __STRICT_ANSI__ # undef ANTLR_REALLY_NO_STRCASECMP # define ANTLR_REALLY_NO_STRCASECMP # endif # else // experimental .96 .97 branches.. # undef ANTLR_CCTYPE_NEEDS_STD # endif # endif #endif // ! __GNUC__ /*}}}*/ /*****************************************************************************/ /*{{{ Digital CXX (Tru64) *****************************************************************************/ #ifdef __DECCXX #define __USE_STD_IOSTREAM #endif /*}}}*/ /*****************************************************************************/ #ifdef __BORLANDC__ # if __BORLANDC__ >= 560 # include # include # define ANTLR_CCTYPE_NEEDS_STD # else # error "sorry, compiler is too old - consider an update." # endif #endif // Redefine these for backwards compatability.. #undef ANTLR_BEGIN_NAMESPACE #undef ANTLR_END_NAMESPACE #if ANTLR_CXX_SUPPORTS_NAMESPACE == 1 # define ANTLR_BEGIN_NAMESPACE(_x_) namespace _x_ { # define ANTLR_END_NAMESPACE } #else # define ANTLR_BEGIN_NAMESPACE(_x_) # define ANTLR_END_NAMESPACE #endif #endif //INC_config_hpp__ sqlitebrowser-3.10.1/libs/antlr-2.7.7/doxygen.cfg000066400000000000000000000071531316047212700213720ustar00rootroot00000000000000# # Doxygen config file for ANTLR's C++ support libraries. # # Thanks to Bill Zheng for parts of this. # PROJECT_NAME = "ANTLR Support Libraries 2.7.1+" # Input files: INPUT = antlr src RECURSIVE = YES FILE_PATTERNS = *.cpp *.h *.hpp JAVADOC_AUTOBRIEF = NO #--------------------------------------------------------------------------- # Configuration options related to the preprocessor #--------------------------------------------------------------------------- # If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will # evaluate all C-preprocessor directives found in the sources and include # files. ENABLE_PREPROCESSING = YES # If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro # names in the source code. If set to NO (the default) only conditional # compilation will be performed. MACRO_EXPANSION = YES # If the SEARCH_INCLUDES tag is set to YES (the default) the includes files # in the INCLUDE_PATH (see below) will be search if a #include is found. SEARCH_INCLUDES = YES # The INCLUDE_PATH tag can be used to specify one or more directories that # contain include files that are not input files but should be processed by # the preprocessor. INCLUDE_PATH = # The PREDEFINED tag can be used to specify one or more macro names that # are defined before the preprocessor is started (similar to the -D option of # gcc). The argument of the tag is a list of macros of the form: name # or name=definition (no spaces). If the definition and the = are # omitted =1 is assumed. PREDEFINED = "ANTLR_USE_NAMESPACE(_x_)=_x_::" \ "ANTLR_USING_NAMESPACE(_x_)=using namespace _x_;" \ "ANTLR_C_USING(_x_)=" \ "ANTLR_API=" # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES # then the macro expansion is limited to the macros specified with the # PREDEFINED tag. EXPAND_ONLY_PREDEF = YES # Output options OUTPUT_DIRECTORY = gen_doc PAPER_TYPE = a4wide #PAPER_TYPE = a4 TAB_SIZE = 3 CASE_SENSE_NAMES = YES # If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend # the brief description of a member or function before the detailed description. # Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the # brief descriptions will be completely suppressed. REPEAT_BRIEF = YES # The INTERNAL_DOCS tag determines if documentation # that is typed after a \internal command is included. If the tag is set # to NO (the default) then the documentation will be excluded. # Set it to YES to include the internal documentation. INTERNAL_DOCS = NO # if the INHERIT_DOCS tag is set to YES (the default) then an undocumented # member inherits the documentation from any documented member that it # reimplements. INHERIT_DOCS = YES # if the INLINE_INFO tag is set to YES (the default) then a tag [inline] # is inserted in the documentation for inline members. INLINE_INFO = YES # Dot and friends... HAVE_DOT = YES CLASS_GRAPH = YES COLLABORATION_GRAPH = YES INCLUDE_GRAPH = YES INCLUDED_BY_GRAPH = YES EXTRACT_ALL = YES EXTRACT_STATIC = YES EXTRACT_PRIVATE = YES # HTML output and friends... GENERATE_HTML = YES # Tree view gives too much trouble with various browsers. GENERATE_TREEVIEW = NO # Latex output and friends... GENERATE_LATEX = NO PDF_HYPERLINKS = YES GENERATE_MAN = NO GENERATE_RTF = NO # Control of convenience stuff GENERATE_TODOLIST = YES # Control over warnings etc. Unset EXTRACT_ALL to get this to work WARN_IF_UNDOCUMENTED = YES WARNINGS = YES QUIET = YES sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/000077500000000000000000000000001316047212700200155ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/ANTLRUtil.cpp000066400000000000000000000070741316047212700222470ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** Eat whitespace from the input stream * @param is the stream to read from */ ANTLR_USE_NAMESPACE(std)istream& eatwhite( ANTLR_USE_NAMESPACE(std)istream& is ) { char c; while( is.get(c) ) { #ifdef ANTLR_CCTYPE_NEEDS_STD if( !ANTLR_USE_NAMESPACE(std)isspace(c) ) #else if( !isspace(c) ) #endif { is.putback(c); break; } } return is; } /** Read a string enclosed by '"' from a stream. Also handles escaping of \". * Skips leading whitespace. * @param in the istream to read from. * @returns the string read from file exclusive the '"' * @throws IOException if string is badly formatted */ ANTLR_USE_NAMESPACE(std)string read_string( ANTLR_USE_NAMESPACE(std)istream& in ) { char ch; ANTLR_USE_NAMESPACE(std)string ret(""); // States for a simple state machine... enum { START, READING, ESCAPE, FINISHED }; int state = START; eatwhite(in); while( state != FINISHED && in.get(ch) ) { switch( state ) { case START: // start state: check wether starting with " then switch to READING if( ch != '"' ) throw IOException("string must start with '\"'"); state = READING; continue; case READING: // reading state: look out for escape sequences and closing " if( ch == '\\' ) // got escape sequence { state = ESCAPE; continue; } if( ch == '"' ) // close quote -> stop { state = FINISHED; continue; } ret += ch; // else append... continue; case ESCAPE: switch(ch) { case '\\': ret += ch; state = READING; continue; case '"': ret += ch; state = READING; continue; case '0': ret += '\0'; state = READING; continue; default: // unrecognized escape is not mapped ret += '\\'; ret += ch; state = READING; continue; } } } if( state != FINISHED ) throw IOException("badly formatted string: "+ret); return ret; } /* Read a ([A-Z][0-9][a-z]_)* kindoff thing. Skips leading whitespace. * @param in the istream to read from. */ ANTLR_USE_NAMESPACE(std)string read_identifier( ANTLR_USE_NAMESPACE(std)istream& in ) { char ch; ANTLR_USE_NAMESPACE(std)string ret(""); eatwhite(in); while( in.get(ch) ) { #ifdef ANTLR_CCTYPE_NEEDS_STD if( ANTLR_USE_NAMESPACE(std)isupper(ch) || ANTLR_USE_NAMESPACE(std)islower(ch) || ANTLR_USE_NAMESPACE(std)isdigit(ch) || ch == '_' ) #else if( isupper(ch) || islower(ch) || isdigit(ch) || ch == '_' ) #endif ret += ch; else { in.putback(ch); break; } } return ret; } /** Read a attribute="value" thing. Leading whitespace is skipped. * Between attribute and '=' no whitespace is allowed. After the '=' it is * permitted. * @param in the istream to read from. * @param attribute string the attribute name is put in * @param value string the value of the attribute is put in * @throws IOException if something is fishy. E.g. malformed quoting * or missing '=' */ void read_AttributeNValue( ANTLR_USE_NAMESPACE(std)istream& in, ANTLR_USE_NAMESPACE(std)string& attribute, ANTLR_USE_NAMESPACE(std)string& value ) { attribute = read_identifier(in); char ch; if( in.get(ch) && ch == '=' ) value = read_string(in); else throw IOException("invalid attribute=value thing "+attribute); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/ASTFactory.cpp000066400000000000000000000301051316047212700224770ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/ASTFactory.cpp#2 $ */ #include "antlr/CommonAST.hpp" #include "antlr/ANTLRException.hpp" #include "antlr/IOException.hpp" #include "antlr/ASTFactory.hpp" #include "antlr/ANTLRUtil.hpp" #include #include using namespace std; #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** AST Support code shared by TreeParser and Parser. * We use delegation to share code (and have only one * bit of code to maintain) rather than subclassing * or superclassing (forces AST support code to be * loaded even when you don't want to do AST stuff). * * This class collects all factories of AST types used inside the code. * New AST node types are registered with the registerFactory method. * On creation of an ASTFactory object a default AST node factory may be * specified. * * When registering types gaps between different types are filled with entries * for the default factory. */ /// Initialize factory ASTFactory::ASTFactory() : default_factory_descriptor(ANTLR_USE_NAMESPACE(std)make_pair(CommonAST::TYPE_NAME,&CommonAST::factory)) { nodeFactories.resize( Token::MIN_USER_TYPE, &default_factory_descriptor ); } /** Initialize factory with a non default node type. * factory_node_name should be the name of the AST node type the factory * generates. (should exist during the existance of this ASTFactory instance) */ ASTFactory::ASTFactory( const char* factory_node_name, factory_type fact ) : default_factory_descriptor(ANTLR_USE_NAMESPACE(std)make_pair(factory_node_name, fact)) { nodeFactories.resize( Token::MIN_USER_TYPE, &default_factory_descriptor ); } /// Delete ASTFactory ASTFactory::~ASTFactory() { factory_descriptor_list::iterator i = nodeFactories.begin(); while( i != nodeFactories.end() ) { if( *i != &default_factory_descriptor ) delete *i; i++; } } /// Register a factory for a given AST type void ASTFactory::registerFactory( int type, const char* ast_name, factory_type factory ) { // check validity of arguments... if( type < Token::MIN_USER_TYPE ) throw ANTLRException("Internal parser error invalid type passed to RegisterFactory"); if( factory == 0 ) throw ANTLRException("Internal parser error 0 factory passed to RegisterFactory"); // resize up to and including 'type' and initalize any gaps to default // factory. if( nodeFactories.size() < (static_cast(type)+1) ) nodeFactories.resize( type+1, &default_factory_descriptor ); // And add new thing.. nodeFactories[type] = new ANTLR_USE_NAMESPACE(std)pair( ast_name, factory ); } void ASTFactory::setMaxNodeType( int type ) { if( nodeFactories.size() < (static_cast(type)+1) ) nodeFactories.resize( type+1, &default_factory_descriptor ); } /** Create a new empty AST node; if the user did not specify * an AST node type, then create a default one: CommonAST. */ RefAST ASTFactory::create() { RefAST node = nodeFactories[0]->second(); node->setType(Token::INVALID_TYPE); return node; } RefAST ASTFactory::create(int type) { RefAST t = nodeFactories[type]->second(); t->initialize(type,""); return t; } RefAST ASTFactory::create(int type, const ANTLR_USE_NAMESPACE(std)string& txt) { RefAST t = nodeFactories[type]->second(); t->initialize(type,txt); return t; } #ifdef ANTLR_SUPPORT_XML RefAST ASTFactory::create(const ANTLR_USE_NAMESPACE(std)string& type_name, ANTLR_USE_NAMESPACE(std)istream& infile ) { factory_descriptor_list::iterator fact = nodeFactories.begin(); while( fact != nodeFactories.end() ) { if( type_name == (*fact)->first ) { RefAST t = (*fact)->second(); t->initialize(infile); return t; } fact++; } string error = "ASTFactory::create: Unknown AST type '" + type_name + "'"; throw ANTLRException(error); } #endif /** Create a new empty AST node; if the user did not specify * an AST node type, then create a default one: CommonAST. */ RefAST ASTFactory::create(RefAST tr) { if (!tr) return nullAST; // cout << "create(tr)" << endl; RefAST t = nodeFactories[tr->getType()]->second(); t->initialize(tr); return t; } RefAST ASTFactory::create(RefToken tok) { // cout << "create( tok="<< tok->getType() << ", " << tok->getText() << ")" << nodeFactories.size() << endl; RefAST t = nodeFactories[tok->getType()]->second(); t->initialize(tok); return t; } /** Add a child to the current AST */ void ASTFactory::addASTChild(ASTPair& currentAST, RefAST child) { if (child) { if (!currentAST.root) { // Make new child the current root currentAST.root = child; } else { if (!currentAST.child) { // Add new child to current root currentAST.root->setFirstChild(child); } else { currentAST.child->setNextSibling(child); } } // Make new child the current child currentAST.child = child; currentAST.advanceChildToEnd(); } } /** Deep copy a single node. This function the new clone() methods in the AST * interface. Returns nullAST if t is null. */ RefAST ASTFactory::dup(RefAST t) { if( t ) return t->clone(); else return RefAST(nullASTptr); } /** Duplicate tree including siblings of root. */ RefAST ASTFactory::dupList(RefAST t) { RefAST result = dupTree(t); // if t == null, then result==null RefAST nt = result; while( t ) { // for each sibling of the root t = t->getNextSibling(); nt->setNextSibling(dupTree(t)); // dup each subtree, building new tree nt = nt->getNextSibling(); } return result; } /** Duplicate a tree, assuming this is a root node of a tree * duplicate that node and what's below; ignore siblings of root node. */ RefAST ASTFactory::dupTree(RefAST t) { RefAST result = dup(t); // make copy of root // copy all children of root. if( t ) result->setFirstChild( dupList(t->getFirstChild()) ); return result; } /** Make a tree from a list of nodes. The first element in the * array is the root. If the root is null, then the tree is * a simple list not a tree. Handles null children nodes correctly. * For example, make(a, b, null, c) yields tree (a b c). make(null,a,b) * yields tree (nil a b). */ RefAST ASTFactory::make(ANTLR_USE_NAMESPACE(std)vector& nodes) { if ( nodes.size() == 0 ) return RefAST(nullASTptr); RefAST root = nodes[0]; RefAST tail = RefAST(nullASTptr); if( root ) root->setFirstChild(RefAST(nullASTptr)); // don't leave any old pointers set // link in children; for( unsigned int i = 1; i < nodes.size(); i++ ) { if ( nodes[i] == 0 ) // ignore null nodes continue; if ( root == 0 ) // Set the root and set it up for a flat list root = tail = nodes[i]; else if ( tail == 0 ) { root->setFirstChild(nodes[i]); tail = root->getFirstChild(); } else { tail->setNextSibling(nodes[i]); tail = tail->getNextSibling(); } if( tail ) // RK: I cannot fathom why this missing check didn't bite anyone else... { // Chase tail to last sibling while (tail->getNextSibling()) tail = tail->getNextSibling(); } } return root; } /** Make a tree from a list of nodes, where the nodes are contained * in an ASTArray object */ RefAST ASTFactory::make(ASTArray* nodes) { RefAST ret = make(nodes->array); delete nodes; return ret; } /// Make an AST the root of current AST void ASTFactory::makeASTRoot( ASTPair& currentAST, RefAST root ) { if (root) { // Add the current root as a child of new root root->addChild(currentAST.root); // The new current child is the last sibling of the old root currentAST.child = currentAST.root; currentAST.advanceChildToEnd(); // Set the new root currentAST.root = root; } } void ASTFactory::setASTNodeFactory( const char* factory_node_name, factory_type factory ) { default_factory_descriptor.first = factory_node_name; default_factory_descriptor.second = factory; } #ifdef ANTLR_SUPPORT_XML bool ASTFactory::checkCloseTag( ANTLR_USE_NAMESPACE(std)istream& in ) { char ch; if( in.get(ch) ) { if( ch == '<' ) { char ch2; if( in.get(ch2) ) { if( ch2 == '/' ) { in.putback(ch2); in.putback(ch); return true; } in.putback(ch2); in.putback(ch); return false; } } in.putback(ch); return false; } return false; } void ASTFactory::loadChildren( ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ) { char ch; for(;;) // for all children of this node.... { eatwhite(infile); infile.get(ch); // '<' if( ch != '<' ) { string error = "Invalid XML file... no '<' found ("; error += ch + ")"; throw IOException(error); } infile.get(ch); // / or text.... if( ch == '/' ) // check for close tag... { string temp; // read until '>' and see if it matches the open tag... if not trouble temp = read_identifier( infile ); if( strcmp(temp.c_str(), current->typeName() ) != 0 ) { string error = "Invalid XML file... close tag does not match start tag: "; error += current->typeName(); error += " closed by " + temp; throw IOException(error); } infile.get(ch); // must be a '>' if( ch != '>' ) { string error = "Invalid XML file... no '>' found ("; error += ch + ")"; throw IOException(error); } // close tag => exit loop break; } // put our 'look ahead' back where it came from infile.putback(ch); infile.putback('<'); // and recurse into the tree... RefAST child = LoadAST(infile); current->addChild( child ); } } void ASTFactory::loadSiblings(ANTLR_USE_NAMESPACE(std)istream& infile, RefAST current ) { for(;;) { eatwhite(infile); if( infile.eof() ) break; if( checkCloseTag(infile) ) break; RefAST sibling = LoadAST(infile); current->setNextSibling(sibling); } } RefAST ASTFactory::LoadAST( ANTLR_USE_NAMESPACE(std)istream& infile ) { RefAST current = nullAST; char ch; eatwhite(infile); if( !infile.get(ch) ) return nullAST; if( ch != '<' ) { string error = "Invalid XML file... no '<' found ("; error += ch + ")"; throw IOException(error); } string ast_type = read_identifier(infile); // create the ast of type 'ast_type' current = create( ast_type, infile ); if( current == nullAST ) { string error = "Unsuported AST type: " + ast_type; throw IOException(error); } eatwhite(infile); infile.get(ch); // now if we have a '/' here it's a single node. If it's a '>' we get // a tree with children if( ch == '/' ) { infile.get(ch); // get the closing '>' if( ch != '>' ) { string error = "Invalid XML file... no '>' found after '/' ("; error += ch + ")"; throw IOException(error); } // get the rest on this level loadSiblings( infile, current ); return current; } // and finaly see if we got the close tag... if( ch != '>' ) { string error = "Invalid XML file... no '>' found ("; error += ch + ")"; throw IOException(error); } // handle the ones below this level.. loadChildren( infile, current ); // load the rest on this level... loadSiblings( infile, current ); return current; } #endif // ANTLR_SUPPORT_XML #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif /* Heterogeneous AST/XML-I/O ramblings... * * So there is some heterogeneous AST support.... * basically in the code generators a new custom ast is generated without * going throug the factory. It also expects the RefXAST to be defined. * * Is it maybe better to register all AST types with the ASTFactory class * together with the respective factory methods. * * More and more I get the impression that hetero ast was a kindoff hack * on top of ANTLR's normal AST system. * * The heteroast stuff will generate trouble for all astFactory.create( ... ) * invocations. Most of this is handled via getASTCreateString methods in the * codegenerator. At the moment getASTCreateString(GrammarAtom, String) has * slightly to little info to do it's job (ok the hack that is in now * works, but it's an ugly hack) * * An extra caveat is the 'nice' action.g thing. Which also judiciously calls * getASTCreateString methods because it handles the #( ... ) syntax. * And converts that to ASTFactory calls. * * */ sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/ASTNULLType.cpp000066400000000000000000000042161316047212700225100ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ #include "antlr/config.hpp" #include "antlr/AST.hpp" #include "antlr/ASTNULLType.hpp" #include ANTLR_USING_NAMESPACE(std) #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif RefAST ASTNULLType::clone( void ) const { return RefAST(this); } void ASTNULLType::addChild( RefAST ) { } size_t ASTNULLType::getNumberOfChildren() const { return 0; } bool ASTNULLType::equals( RefAST ) const { return false; } bool ASTNULLType::equalsList( RefAST ) const { return false; } bool ASTNULLType::equalsListPartial( RefAST ) const { return false; } bool ASTNULLType::equalsTree( RefAST ) const { return false; } bool ASTNULLType::equalsTreePartial( RefAST ) const { return false; } vector ASTNULLType::findAll( RefAST ) { return vector(); } vector ASTNULLType::findAllPartial( RefAST ) { return vector(); } RefAST ASTNULLType::getFirstChild() const { return this; } RefAST ASTNULLType::getNextSibling() const { return this; } string ASTNULLType::getText() const { return ""; } int ASTNULLType::getType() const { return Token::NULL_TREE_LOOKAHEAD; } void ASTNULLType::initialize( int, const string& ) { } void ASTNULLType::initialize( RefAST ) { } void ASTNULLType::initialize( RefToken ) { } #ifdef ANTLR_SUPPORT_XML void ASTNULLType::initialize( istream& ) { } #endif void ASTNULLType::setFirstChild( RefAST ) { } void ASTNULLType::setNextSibling( RefAST ) { } void ASTNULLType::setText( const string& ) { } void ASTNULLType::setType( int ) { } string ASTNULLType::toString() const { return getText(); } string ASTNULLType::toStringList() const { return getText(); } string ASTNULLType::toStringTree() const { return getText(); } #ifdef ANTLR_SUPPORT_XML bool ASTNULLType::attributesToStream( ostream& ) const { return false; } void ASTNULLType::toStream( ostream& out ) const { out << "" << endl; } #endif const char* ASTNULLType::typeName( void ) const { return "ASTNULLType"; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/ASTRefCount.cpp000066400000000000000000000012741316047212700226220ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/ASTRefCount.cpp#2 $ */ #include "antlr/ASTRefCount.hpp" #include "antlr/AST.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif ASTRef::ASTRef(AST* p) : ptr(p), count(1) { if (p && !p->ref) p->ref = this; } ASTRef::~ASTRef() { delete ptr; } ASTRef* ASTRef::getRef(const AST* p) { if (p) { AST* pp = const_cast(p); if (pp->ref) return pp->ref->increment(); else return new ASTRef(pp); } else return 0; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/BaseAST.cpp000066400000000000000000000151071316047212700217470ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/BaseAST.cpp#2 $ */ #include "antlr/config.hpp" #include #include "antlr/AST.hpp" #include "antlr/BaseAST.hpp" ANTLR_USING_NAMESPACE(std) #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif size_t BaseAST::getNumberOfChildren() const { RefBaseAST t = this->down; size_t n = 0; if( t ) { n = 1; while( t->right ) { t = t->right; n++; } return n; } return n; } void BaseAST::doWorkForFindAll( ANTLR_USE_NAMESPACE(std)vector& v, RefAST target,bool partialMatch) { // Start walking sibling lists, looking for matches. for (RefAST sibling=this; sibling; sibling=sibling->getNextSibling()) { if ( (partialMatch && sibling->equalsTreePartial(target)) || (!partialMatch && sibling->equalsTree(target)) ) { v.push_back(sibling); } // regardless of match or not, check any children for matches if ( sibling->getFirstChild() ) { RefBaseAST(sibling->getFirstChild())->doWorkForFindAll(v, target, partialMatch); } } } /** Is t an exact structural and equals() match of this tree. The * 'this' reference is considered the start of a sibling list. */ bool BaseAST::equalsList(RefAST t) const { // the empty tree is not a match of any non-null tree. if (!t) return false; // Otherwise, start walking sibling lists. First mismatch, return false. RefAST sibling=this; for (;sibling && t; sibling=sibling->getNextSibling(), t=t->getNextSibling()) { // as a quick optimization, check roots first. if (!sibling->equals(t)) return false; // if roots match, do full list match test on children. if (sibling->getFirstChild()) { if (!sibling->getFirstChild()->equalsList(t->getFirstChild())) return false; } // sibling has no kids, make sure t doesn't either else if (t->getFirstChild()) return false; } if (!sibling && !t) return true; // one sibling list has more than the other return false; } /** Is 'sub' a subtree of this list? * The siblings of the root are NOT ignored. */ bool BaseAST::equalsListPartial(RefAST sub) const { // the empty tree is always a subset of any tree. if (!sub) return true; // Otherwise, start walking sibling lists. First mismatch, return false. RefAST sibling=this; for (;sibling && sub; sibling=sibling->getNextSibling(), sub=sub->getNextSibling()) { // as a quick optimization, check roots first. if (!sibling->equals(sub)) return false; // if roots match, do partial list match test on children. if (sibling->getFirstChild()) if (!sibling->getFirstChild()->equalsListPartial(sub->getFirstChild())) return false; } if (!sibling && sub) // nothing left to match in this tree, but subtree has more return false; // either both are null or sibling has more, but subtree doesn't return true; } /** Is tree rooted at 'this' equal to 't'? The siblings * of 'this' are ignored. */ bool BaseAST::equalsTree(RefAST t) const { // check roots first if (!equals(t)) return false; // if roots match, do full list match test on children. if (getFirstChild()) { if (!getFirstChild()->equalsList(t->getFirstChild())) return false; } // sibling has no kids, make sure t doesn't either else if (t->getFirstChild()) return false; return true; } /** Is 'sub' a subtree of the tree rooted at 'this'? The siblings * of 'this' are ignored. */ bool BaseAST::equalsTreePartial(RefAST sub) const { // the empty tree is always a subset of any tree. if (!sub) return true; // check roots first if (!equals(sub)) return false; // if roots match, do full list partial match test on children. if (getFirstChild()) if (!getFirstChild()->equalsListPartial(sub->getFirstChild())) return false; return true; } /** Walk the tree looking for all exact subtree matches. Return * an ASTEnumerator that lets the caller walk the list * of subtree roots found herein. */ ANTLR_USE_NAMESPACE(std)vector BaseAST::findAll(RefAST target) { ANTLR_USE_NAMESPACE(std)vector roots; // the empty tree cannot result in an enumeration if (target) { doWorkForFindAll(roots,target,false); // find all matches recursively } return roots; } /** Walk the tree looking for all subtrees. Return * an ASTEnumerator that lets the caller walk the list * of subtree roots found herein. */ ANTLR_USE_NAMESPACE(std)vector BaseAST::findAllPartial(RefAST target) { ANTLR_USE_NAMESPACE(std)vector roots; // the empty tree cannot result in an enumeration if (target) doWorkForFindAll(roots,target,true); // find all matches recursively return roots; } ANTLR_USE_NAMESPACE(std)string BaseAST::toStringList() const { ANTLR_USE_NAMESPACE(std)string ts=""; if (getFirstChild()) { ts+=" ( "; ts+=toString(); ts+=getFirstChild()->toStringList(); ts+=" )"; } else { ts+=" "; ts+=toString(); } if (getNextSibling()) ts+=getNextSibling()->toStringList(); return ts; } ANTLR_USE_NAMESPACE(std)string BaseAST::toStringTree() const { ANTLR_USE_NAMESPACE(std)string ts = ""; if (getFirstChild()) { ts+=" ( "; ts+=toString(); ts+=getFirstChild()->toStringList(); ts+=" )"; } else { ts+=" "; ts+=toString(); } return ts; } #ifdef ANTLR_SUPPORT_XML /* This whole XML output stuff needs a little bit more thought * I'd like to store extra XML data in the node. e.g. for custom ast's * with for instance symboltable references. This * should be more pluggable.. * @returns boolean value indicating wether a closetag should be produced. */ bool BaseAST::attributesToStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { out << "text=\"" << this->getText() << "\" type=\"" << this->getType() << "\""; return false; } void BaseAST::toStream( ANTLR_USE_NAMESPACE(std)ostream& out ) const { for( RefAST node = this; node != 0; node = node->getNextSibling() ) { out << "<" << this->typeName() << " "; // Write out attributes and if there is extra data... bool need_close_tag = node->attributesToStream( out ); if( need_close_tag ) { // got children so write them... if( node->getFirstChild() != 0 ) node->getFirstChild()->toStream( out ); // and a closing tag.. out << "typeName() << ">" << endl; } } } #endif // this is nasty, but it makes the code generation easier ANTLR_API RefAST nullAST; #if defined(_MSC_VER) && !defined(__ICL) // Microsoft Visual C++ extern ANTLR_API AST* const nullASTptr = 0; #else ANTLR_API AST* const nullASTptr = 0; #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/BitSet.cpp000066400000000000000000000022701316047212700217140ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/BitSet.cpp#2 $ */ #include "antlr/BitSet.hpp" #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif BitSet::BitSet(unsigned int nbits) : storage(nbits) { for (unsigned int i = 0; i < nbits ; i++ ) storage[i] = false; } BitSet::BitSet( const unsigned long* bits_, unsigned int nlongs ) : storage(nlongs*32) { for ( unsigned int i = 0 ; i < (nlongs * 32); i++) storage[i] = (bits_[i>>5] & (1UL << (i&31))) ? true : false; } BitSet::~BitSet() { } void BitSet::add(unsigned int el) { if( el >= storage.size() ) storage.resize( el+1, false ); storage[el] = true; } bool BitSet::member(unsigned int el) const { if ( el >= storage.size()) return false; return storage[el]; } ANTLR_USE_NAMESPACE(std)vector BitSet::toArray() const { ANTLR_USE_NAMESPACE(std)vector elems; for (unsigned int i = 0; i < storage.size(); i++) { if (storage[i]) elems.push_back(i); } return elems; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/CharBuffer.cpp000066400000000000000000000026121316047212700225310ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CharBuffer.cpp#2 $ */ #include "antlr/CharBuffer.hpp" #include //#include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /* RK: Per default istream does not throw exceptions. This can be * enabled with: * stream.exceptions(ios_base::badbit|ios_base::failbit|ios_base::eofbit); * * We could try catching the bad/fail stuff. But handling eof via this is * not a good idea. EOF is best handled as a 'normal' character. * * So this does not work yet with gcc... Comment it until I get to a platform * that does.. */ /** Create a character buffer. Enable fail and bad exceptions, if supported * by platform. */ CharBuffer::CharBuffer(ANTLR_USE_NAMESPACE(std)istream& input_) : input(input_) { // input.exceptions(ANTLR_USE_NAMESPACE(std)ios_base::badbit| // ANTLR_USE_NAMESPACE(std)ios_base::failbit); } /** Get the next character from the stream. May throw CharStreamIOException * when something bad happens (not EOF) (if supported by platform). */ int CharBuffer::getChar() { // try { return input.get(); // } // catch (ANTLR_USE_NAMESPACE(std)ios_base::failure& e) { // throw CharStreamIOException(e); // } } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/CharScanner.cpp000066400000000000000000000057601316047212700227200ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CharScanner.cpp#2 $ */ #include #include "antlr/CharScanner.hpp" #include "antlr/CommonToken.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif ANTLR_C_USING(exit) CharScanner::CharScanner(InputBuffer& cb, bool case_sensitive ) : saveConsumedInput(true) //, caseSensitiveLiterals(true) , caseSensitive(case_sensitive) , literals(CharScannerLiteralsLess(this)) , inputState(new LexerInputState(cb)) , commitToPath(false) , tabsize(8) , traceDepth(0) { setTokenObjectFactory(&CommonToken::factory); } CharScanner::CharScanner(InputBuffer* cb, bool case_sensitive ) : saveConsumedInput(true) //, caseSensitiveLiterals(true) , caseSensitive(case_sensitive) , literals(CharScannerLiteralsLess(this)) , inputState(new LexerInputState(cb)) , commitToPath(false) , tabsize(8) , traceDepth(0) { setTokenObjectFactory(&CommonToken::factory); } CharScanner::CharScanner( const LexerSharedInputState& state, bool case_sensitive ) : saveConsumedInput(true) //, caseSensitiveLiterals(true) , caseSensitive(case_sensitive) , literals(CharScannerLiteralsLess(this)) , inputState(state) , commitToPath(false) , tabsize(8) , traceDepth(0) { setTokenObjectFactory(&CommonToken::factory); } /** Report exception errors caught in nextToken() */ void CharScanner::reportError(const RecognitionException& ex) { ANTLR_USE_NAMESPACE(std)cerr << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Parser error-reporting function can be overridden in subclass */ void CharScanner::reportError(const ANTLR_USE_NAMESPACE(std)string& s) { if (getFilename() == "") ANTLR_USE_NAMESPACE(std)cerr << "error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; else ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Parser warning-reporting function can be overridden in subclass */ void CharScanner::reportWarning(const ANTLR_USE_NAMESPACE(std)string& s) { if (getFilename() == "") ANTLR_USE_NAMESPACE(std)cerr << "warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; else ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; } void CharScanner::traceIndent() { for( int i = 0; i < traceDepth; i++ ) ANTLR_USE_NAMESPACE(std)cout << " "; } void CharScanner::traceIn(const char* rname) { traceDepth++; traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "> lexer " << rname << "; c==" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; } void CharScanner::traceOut(const char* rname) { traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "< lexer " << rname << "; c==" << LA(1) << ANTLR_USE_NAMESPACE(std)endl; traceDepth--; } #ifndef NO_STATIC_CONSTS const int CharScanner::NO_CHAR; const int CharScanner::EOF_CHAR; #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/CommonAST.cpp000066400000000000000000000017641316047212700223310ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonAST.cpp#2 $ */ #include "antlr/config.hpp" #include #include #include "antlr/CommonAST.hpp" #include "antlr/ANTLRUtil.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif const char* const CommonAST::TYPE_NAME = "CommonAST"; #ifdef ANTLR_SUPPORT_XML void CommonAST::initialize( ANTLR_USE_NAMESPACE(std)istream& in ) { ANTLR_USE_NAMESPACE(std)string t1, t2, text; // text read_AttributeNValue( in, t1, text ); read_AttributeNValue( in, t1, t2 ); #ifdef ANTLR_ATOI_IN_STD int type = ANTLR_USE_NAMESPACE(std)atoi(t2.c_str()); #else int type = atoi(t2.c_str()); #endif // initialize first part of AST. this->initialize( type, text ); } #endif RefAST CommonAST::factory() { return RefAST(new CommonAST); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/CommonASTWithHiddenTokens.cpp000066400000000000000000000034661316047212700254660ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonASTWithHiddenTokens.cpp#2 $ */ #include "antlr/config.hpp" #include "antlr/AST.hpp" #include "antlr/BaseAST.hpp" #include "antlr/CommonAST.hpp" #include "antlr/CommonASTWithHiddenTokens.hpp" #include "antlr/CommonHiddenStreamToken.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif const char* const CommonASTWithHiddenTokens::TYPE_NAME = "CommonASTWithHiddenTokens"; // RK: Do not put constructor and destructor into the header file here.. // this triggers something very obscure in gcc 2.95.3 (and 3.0) // missing vtables and stuff. // Although this may be a problem with with binutils. CommonASTWithHiddenTokens::CommonASTWithHiddenTokens() : CommonAST() { } CommonASTWithHiddenTokens::~CommonASTWithHiddenTokens() { } void CommonASTWithHiddenTokens::initialize(int t,const ANTLR_USE_NAMESPACE(std)string& txt) { CommonAST::initialize(t,txt); } void CommonASTWithHiddenTokens::initialize(RefAST t) { CommonAST::initialize(t); hiddenBefore = RefCommonASTWithHiddenTokens(t)->getHiddenBefore(); hiddenAfter = RefCommonASTWithHiddenTokens(t)->getHiddenAfter(); } void CommonASTWithHiddenTokens::initialize(RefToken t) { CommonAST::initialize(t); hiddenBefore = static_cast(t.get())->getHiddenBefore(); hiddenAfter = static_cast(t.get())->getHiddenAfter(); } RefAST CommonASTWithHiddenTokens::factory() { return RefAST(new CommonASTWithHiddenTokens); } RefAST CommonASTWithHiddenTokens::clone( void ) const { CommonASTWithHiddenTokens *ast = new CommonASTWithHiddenTokens( *this ); return RefAST(ast); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/CommonHiddenStreamToken.cpp000066400000000000000000000021361316047212700252440ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonHiddenStreamToken.cpp#2 $ */ #include "antlr/CommonHiddenStreamToken.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif CommonHiddenStreamToken::CommonHiddenStreamToken() : CommonToken() { } CommonHiddenStreamToken::CommonHiddenStreamToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt) : CommonToken(t,txt) { } CommonHiddenStreamToken::CommonHiddenStreamToken(const ANTLR_USE_NAMESPACE(std)string& s) : CommonToken(s) { } RefToken CommonHiddenStreamToken::getHiddenAfter() { return hiddenAfter; } RefToken CommonHiddenStreamToken::getHiddenBefore() { return hiddenBefore; } RefToken CommonHiddenStreamToken::factory() { return RefToken(new CommonHiddenStreamToken); } void CommonHiddenStreamToken::setHiddenAfter(RefToken t) { hiddenAfter = t; } void CommonHiddenStreamToken::setHiddenBefore(RefToken t) { hiddenBefore = t; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/CommonToken.cpp000066400000000000000000000016351316047212700227570ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/CommonToken.cpp#2 $ */ #include "antlr/CommonToken.hpp" #include "antlr/String.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif CommonToken::CommonToken() : Token(), line(1), col(1), text("") {} CommonToken::CommonToken(int t, const ANTLR_USE_NAMESPACE(std)string& txt) : Token(t) , line(1) , col(1) , text(txt) {} CommonToken::CommonToken(const ANTLR_USE_NAMESPACE(std)string& s) : Token() , line(1) , col(1) , text(s) {} ANTLR_USE_NAMESPACE(std)string CommonToken::toString() const { return "[\""+getText()+"\",<"+getType()+">,line="+getLine()+",column="+getColumn()+"]"; } RefToken CommonToken::factory() { return RefToken(new CommonToken); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/InputBuffer.cpp000066400000000000000000000034671316047212700227640ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/InputBuffer.cpp#2 $ */ #include "antlr/config.hpp" #include "antlr/InputBuffer.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** Ensure that the character buffer is sufficiently full */ void InputBuffer::fill(unsigned int amount) { syncConsume(); // Fill the buffer sufficiently to hold needed characters while (queue.entries() < amount + markerOffset) { // Append the next character queue.append(getChar()); } } /** get the current lookahead characters as a string * @warning it may treat 0 and EOF values wrong */ ANTLR_USE_NAMESPACE(std)string InputBuffer::getLAChars( void ) const { ANTLR_USE_NAMESPACE(std)string ret; for(unsigned int i = markerOffset; i < queue.entries(); i++) ret += queue.elementAt(i); return ret; } /** get the current marked characters as a string * @warning it may treat 0 and EOF values wrong */ ANTLR_USE_NAMESPACE(std)string InputBuffer::getMarkedChars( void ) const { ANTLR_USE_NAMESPACE(std)string ret; for(unsigned int i = 0; i < markerOffset; i++) ret += queue.elementAt(i); return ret; } /** Return an integer marker that can be used to rewind the buffer to * its current state. */ unsigned int InputBuffer::mark() { syncConsume(); nMarkers++; return markerOffset; } /** Rewind the character buffer to a marker. * @param mark Marker returned previously from mark() */ void InputBuffer::rewind(unsigned int mark) { syncConsume(); markerOffset = mark; nMarkers--; } unsigned int InputBuffer::entries() const { //assert(queue.entries() >= markerOffset); return queue.entries() - markerOffset; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/LLkParser.cpp000066400000000000000000000026251316047212700223650ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/LLkParser.cpp#2 $ */ #include "antlr/LLkParser.hpp" #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif ANTLR_USING_NAMESPACE(std) /**An LL(k) parser. * * @see antlr.Token * @see antlr.TokenBuffer * @see antlr.LL1Parser */ // LLkParser(int k_); LLkParser::LLkParser(const ParserSharedInputState& state, int k_) : Parser(state), k(k_) { } LLkParser::LLkParser(TokenBuffer& tokenBuf, int k_) : Parser(tokenBuf), k(k_) { } LLkParser::LLkParser(TokenStream& lexer, int k_) : Parser(new TokenBuffer(lexer)), k(k_) { } void LLkParser::trace(const char* ee, const char* rname) { traceIndent(); cout << ee << rname << ((inputState->guessing>0)?"; [guessing]":"; "); for (int i = 1; i <= k; i++) { if (i != 1) { cout << ", "; } cout << "LA(" << i << ")=="; string temp; try { temp = LT(i)->getText().c_str(); } catch( ANTLRException& ae ) { temp = "[error: "; temp += ae.toString(); temp += ']'; } cout << temp; } cout << endl; } void LLkParser::traceIn(const char* rname) { traceDepth++; trace("> ",rname); } void LLkParser::traceOut(const char* rname) { trace("< ",rname); traceDepth--; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/MismatchedCharException.cpp000066400000000000000000000062151316047212700252600ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/MismatchedCharException.cpp#2 $ */ #include "antlr/CharScanner.hpp" #include "antlr/MismatchedCharException.hpp" #include "antlr/String.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif MismatchedCharException::MismatchedCharException() : RecognitionException("Mismatched char") {} // Expected range / not range MismatchedCharException::MismatchedCharException( int c, int lower, int upper_, bool matchNot, CharScanner* scanner_ ) : RecognitionException("Mismatched char", scanner_->getFilename(), scanner_->getLine(), scanner_->getColumn()) , mismatchType(matchNot ? NOT_RANGE : RANGE) , foundChar(c) , expecting(lower) , upper(upper_) , scanner(scanner_) { } // Expected token / not token MismatchedCharException::MismatchedCharException( int c, int expecting_, bool matchNot, CharScanner* scanner_ ) : RecognitionException("Mismatched char", scanner_->getFilename(), scanner_->getLine(), scanner_->getColumn()) , mismatchType(matchNot ? NOT_CHAR : CHAR) , foundChar(c) , expecting(expecting_) , scanner(scanner_) { } // Expected BitSet / not BitSet MismatchedCharException::MismatchedCharException( int c, BitSet set_, bool matchNot, CharScanner* scanner_ ) : RecognitionException("Mismatched char", scanner_->getFilename(), scanner_->getLine(), scanner_->getColumn()) , mismatchType(matchNot ? NOT_SET : SET) , foundChar(c) , set(set_) , scanner(scanner_) { } ANTLR_USE_NAMESPACE(std)string MismatchedCharException::getMessage() const { ANTLR_USE_NAMESPACE(std)string s; switch (mismatchType) { case CHAR : s += "expecting '" + charName(expecting) + "', found '" + charName(foundChar) + "'"; break; case NOT_CHAR : s += "expecting anything but '" + charName(expecting) + "'; got it anyway"; break; case RANGE : s += "expecting token in range: '" + charName(expecting) + "'..'" + charName(upper) + "', found '" + charName(foundChar) + "'"; break; case NOT_RANGE : s += "expecting token NOT in range: " + charName(expecting) + "'..'" + charName(upper) + "', found '" + charName(foundChar) + "'"; break; case SET : case NOT_SET : { s += ANTLR_USE_NAMESPACE(std)string("expecting ") + (mismatchType == NOT_SET ? "NOT " : "") + "one of ("; ANTLR_USE_NAMESPACE(std)vector elems = set.toArray(); for ( unsigned int i = 0; i < elems.size(); i++ ) { s += " '"; s += charName(elems[i]); s += "'"; } s += "), found '" + charName(foundChar) + "'"; } break; default : s += RecognitionException::getMessage(); break; } return s; } #ifndef NO_STATIC_CONSTS const int MismatchedCharException::CHAR; const int MismatchedCharException::NOT_CHAR; const int MismatchedCharException::RANGE; const int MismatchedCharException::NOT_RANGE; const int MismatchedCharException::SET; const int MismatchedCharException::NOT_SET; #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/MismatchedTokenException.cpp000066400000000000000000000124651316047212700254670ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/MismatchedTokenException.cpp#2 $ */ #include "antlr/MismatchedTokenException.hpp" #include "antlr/String.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif MismatchedTokenException::MismatchedTokenException() : RecognitionException("Mismatched Token: expecting any AST node","",-1,-1) , token(0) , node(nullASTptr) , tokenNames(0) , numTokens(0) { } // Expected range / not range MismatchedTokenException::MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefAST node_, int lower, int upper_, bool matchNot ) : RecognitionException("Mismatched Token","",-1,-1) , token(0) , node(node_) , tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("")) ) , mismatchType(matchNot ? NOT_RANGE : RANGE) , expecting(lower) , upper(upper_) , tokenNames(tokenNames_) , numTokens(numTokens_) { } // Expected token / not token MismatchedTokenException::MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefAST node_, int expecting_, bool matchNot ) : RecognitionException("Mismatched Token","",-1,-1) , token(0) , node(node_) , tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("")) ) , mismatchType(matchNot ? NOT_TOKEN : TOKEN) , expecting(expecting_) , tokenNames(tokenNames_) , numTokens(numTokens_) { } // Expected BitSet / not BitSet MismatchedTokenException::MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefAST node_, BitSet set_, bool matchNot ) : RecognitionException("Mismatched Token","",-1,-1) , token(0) , node(node_) , tokenText( (node_ ? node_->toString(): ANTLR_USE_NAMESPACE(std)string("")) ) , mismatchType(matchNot ? NOT_SET : SET) , set(set_) , tokenNames(tokenNames_) , numTokens(numTokens_) { } // Expected range / not range MismatchedTokenException::MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefToken token_, int lower, int upper_, bool matchNot, const ANTLR_USE_NAMESPACE(std)string& fileName_ ) : RecognitionException("Mismatched Token",fileName_,token_->getLine(),token_->getColumn()) , token(token_) , node(nullASTptr) , tokenText(token_->getText()) , mismatchType(matchNot ? NOT_RANGE : RANGE) , expecting(lower) , upper(upper_) , tokenNames(tokenNames_) , numTokens(numTokens_) { } // Expected token / not token MismatchedTokenException::MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefToken token_, int expecting_, bool matchNot, const ANTLR_USE_NAMESPACE(std)string& fileName_ ) : RecognitionException("Mismatched Token",fileName_,token_->getLine(),token_->getColumn()) , token(token_) , node(nullASTptr) , tokenText(token_->getText()) , mismatchType(matchNot ? NOT_TOKEN : TOKEN) , expecting(expecting_) , tokenNames(tokenNames_) , numTokens(numTokens_) { } // Expected BitSet / not BitSet MismatchedTokenException::MismatchedTokenException( const char* const* tokenNames_, const int numTokens_, RefToken token_, BitSet set_, bool matchNot, const ANTLR_USE_NAMESPACE(std)string& fileName_ ) : RecognitionException("Mismatched Token",fileName_,token_->getLine(),token_->getColumn()) , token(token_) , node(nullASTptr) , tokenText(token_->getText()) , mismatchType(matchNot ? NOT_SET : SET) , set(set_) , tokenNames(tokenNames_) , numTokens(numTokens_) { } ANTLR_USE_NAMESPACE(std)string MismatchedTokenException::getMessage() const { ANTLR_USE_NAMESPACE(std)string s; switch (mismatchType) { case TOKEN: s += "expecting " + tokenName(expecting) + ", found '" + tokenText + "'"; break; case NOT_TOKEN: s += "expecting anything but " + tokenName(expecting) + "; got it anyway"; break; case RANGE: s += "expecting token in range: " + tokenName(expecting) + ".." + tokenName(upper) + ", found '" + tokenText + "'"; break; case NOT_RANGE: s += "expecting token NOT in range: " + tokenName(expecting) + ".." + tokenName(upper) + ", found '" + tokenText + "'"; break; case SET: case NOT_SET: { s += ANTLR_USE_NAMESPACE(std)string("expecting ") + (mismatchType == NOT_SET ? "NOT " : "") + "one of ("; ANTLR_USE_NAMESPACE(std)vector elems = set.toArray(); for ( unsigned int i = 0; i < elems.size(); i++ ) { s += " "; s += tokenName(elems[i]); } s += "), found '" + tokenText + "'"; } break; default: s = RecognitionException::getMessage(); break; } return s; } ANTLR_USE_NAMESPACE(std)string MismatchedTokenException::tokenName(int tokenType) const { if (tokenType == Token::INVALID_TYPE) return ""; else if (tokenType < 0 || tokenType >= numTokens) return ANTLR_USE_NAMESPACE(std)string("<") + tokenType + ">"; else return tokenNames[tokenType]; } #ifndef NO_STATIC_CONSTS const int MismatchedTokenException::TOKEN; const int MismatchedTokenException::NOT_TOKEN; const int MismatchedTokenException::RANGE; const int MismatchedTokenException::NOT_RANGE; const int MismatchedTokenException::SET; const int MismatchedTokenException::NOT_SET; #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/NoViableAltException.cpp000066400000000000000000000024321316047212700245410ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/NoViableAltException.cpp#2 $ */ #include "antlr/NoViableAltException.hpp" #include "antlr/String.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif ANTLR_USING_NAMESPACE(std) NoViableAltException::NoViableAltException(RefAST t) : RecognitionException("NoViableAlt","",-1,-1), token(0), node(t) { } NoViableAltException::NoViableAltException( RefToken t, const ANTLR_USE_NAMESPACE(std)string& fileName_ ) : RecognitionException("NoViableAlt",fileName_,t->getLine(),t->getColumn()), token(t), node(nullASTptr) { } ANTLR_USE_NAMESPACE(std)string NoViableAltException::getMessage() const { if (token) { if( token->getType() == Token::EOF_TYPE ) return string("unexpected end of file"); else if( token->getType() == Token::NULL_TREE_LOOKAHEAD ) return string("unexpected end of tree"); else return string("unexpected token: ")+token->getText(); } // must a tree parser error if token==null if (!node) return "unexpected end of subtree"; return string("unexpected AST node: ")+node->toString(); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/NoViableAltForCharException.cpp000066400000000000000000000021061316047212700260040ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/NoViableAltForCharException.cpp#2 $ */ #include "antlr/NoViableAltForCharException.hpp" #include "antlr/String.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif NoViableAltForCharException::NoViableAltForCharException(int c, CharScanner* scanner) : RecognitionException("NoViableAlt", scanner->getFilename(), scanner->getLine(),scanner->getColumn()), foundChar(c) { } NoViableAltForCharException::NoViableAltForCharException( int c, const ANTLR_USE_NAMESPACE(std)string& fileName_, int line_, int column_) : RecognitionException("NoViableAlt",fileName_,line_,column_), foundChar(c) { } ANTLR_USE_NAMESPACE(std)string NoViableAltForCharException::getMessage() const { return ANTLR_USE_NAMESPACE(std)string("unexpected char: ")+charName(foundChar); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/Parser.cpp000066400000000000000000000065221316047212700217620ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/Parser.cpp#2 $ */ #include "antlr/Parser.hpp" #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** A generic ANTLR parser (LL(k) for k>=1) containing a bunch of * utility routines useful at any lookahead depth. We distinguish between * the LL(1) and LL(k) parsers because of efficiency. This may not be * necessary in the near future. * * Each parser object contains the state of the parse including a lookahead * cache (the form of which is determined by the subclass), whether or * not the parser is in guess mode, where tokens come from, etc... * *

* During guess mode, the current lookahead token(s) and token type(s) * cache must be saved because the token stream may not have been informed * to save the token (via mark) before the try block. * Guessing is started by: *

    *
  1. saving the lookahead cache. *
  2. marking the current position in the TokenBuffer. *
  3. increasing the guessing level. *
* * After guessing, the parser state is restored by: *
    *
  1. restoring the lookahead cache. *
  2. rewinding the TokenBuffer. *
  3. decreasing the guessing level. *
* * @see antlr.Token * @see antlr.TokenBuffer * @see antlr.TokenStream * @see antlr.LL1Parser * @see antlr.LLkParser */ bool DEBUG_PARSER = false; /** Parser error-reporting function can be overridden in subclass */ void Parser::reportError(const RecognitionException& ex) { ANTLR_USE_NAMESPACE(std)cerr << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Parser error-reporting function can be overridden in subclass */ void Parser::reportError(const ANTLR_USE_NAMESPACE(std)string& s) { if ( getFilename()=="" ) ANTLR_USE_NAMESPACE(std)cerr << "error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; else ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Parser warning-reporting function can be overridden in subclass */ void Parser::reportWarning(const ANTLR_USE_NAMESPACE(std)string& s) { if ( getFilename()=="" ) ANTLR_USE_NAMESPACE(std)cerr << "warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; else ANTLR_USE_NAMESPACE(std)cerr << getFilename().c_str() << ": warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Set or change the input token buffer */ // void setTokenBuffer(TokenBuffer* t); void Parser::traceIndent() { for( int i = 0; i < traceDepth; i++ ) ANTLR_USE_NAMESPACE(std)cout << " "; } void Parser::traceIn(const char* rname) { traceDepth++; for( int i = 0; i < traceDepth; i++ ) ANTLR_USE_NAMESPACE(std)cout << " "; ANTLR_USE_NAMESPACE(std)cout << "> " << rname << "; LA(1)==" << LT(1)->getText().c_str() << ((inputState->guessing>0)?" [guessing]":"") << ANTLR_USE_NAMESPACE(std)endl; } void Parser::traceOut(const char* rname) { for( int i = 0; i < traceDepth; i++ ) ANTLR_USE_NAMESPACE(std)cout << " "; ANTLR_USE_NAMESPACE(std)cout << "< " << rname << "; LA(1)==" << LT(1)->getText().c_str() << ((inputState->guessing>0)?" [guessing]":"") << ANTLR_USE_NAMESPACE(std)endl; traceDepth--; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/RecognitionException.cpp000066400000000000000000000032611316047212700246620ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/RecognitionException.cpp#2 $ */ #include "antlr/RecognitionException.hpp" #include "antlr/String.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif RecognitionException::RecognitionException() : ANTLRException("parsing error") , line(-1) , column(-1) { } RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s) : ANTLRException(s) , line(-1) , column(-1) { } RecognitionException::RecognitionException(const ANTLR_USE_NAMESPACE(std)string& s, const ANTLR_USE_NAMESPACE(std)string& fileName_, int line_,int column_) : ANTLRException(s) , fileName(fileName_) , line(line_) , column(column_) { } ANTLR_USE_NAMESPACE(std)string RecognitionException::getFileLineColumnString() const { ANTLR_USE_NAMESPACE(std)string fileLineColumnString; if ( fileName.length() > 0 ) fileLineColumnString = fileName + ":"; if ( line != -1 ) { if ( fileName.length() == 0 ) fileLineColumnString = fileLineColumnString + "line "; fileLineColumnString = fileLineColumnString + line; if ( column != -1 ) fileLineColumnString = fileLineColumnString + ":" + column; fileLineColumnString = fileLineColumnString + ":"; } fileLineColumnString = fileLineColumnString + " "; return fileLineColumnString; } ANTLR_USE_NAMESPACE(std)string RecognitionException::toString() const { return getFileLineColumnString()+getMessage(); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/String.cpp000066400000000000000000000031141316047212700217660ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/String.cpp#2 $ */ #include "antlr/String.hpp" #include #ifdef HAS_NOT_CSTDIO_H #include #else #include #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif // wh: hack for Borland C++ 5.6 #if __BORLANDC__ using std::sprintf; #endif // RK: should be using snprintf actually... (or stringstream) ANTLR_C_USING(sprintf) ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, const int rhs ) { char tmp[100]; sprintf(tmp,"%d",rhs); return lhs+tmp; } ANTLR_USE_NAMESPACE(std)string operator+( const ANTLR_USE_NAMESPACE(std)string& lhs, size_t rhs ) { char tmp[100]; sprintf(tmp,"%zu",rhs); return lhs+tmp; } /** Convert character to readable string */ ANTLR_USE_NAMESPACE(std)string charName(int ch) { if (ch == EOF) return "EOF"; else { ANTLR_USE_NAMESPACE(std)string s; // when you think you've seen it all.. an isprint that crashes... ch = ch & 0xFF; #ifdef ANTLR_CCTYPE_NEEDS_STD if( ANTLR_USE_NAMESPACE(std)isprint( ch ) ) #else if( isprint( ch ) ) #endif { s.append("'"); s += ch; s.append("'"); // s += "'"+ch+"'"; } else { s += "0x"; unsigned int t = ch >> 4; if( t < 10 ) s += t | 0x30; else s += t + 0x37; t = ch & 0xF; if( t < 10 ) s += t | 0x30; else s += t + 0x37; } return s; } } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/Token.cpp000066400000000000000000000024171316047212700216050ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/Token.cpp#2 $ */ #include "antlr/Token.hpp" #include "antlr/String.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif int Token::getColumn() const { return 0; } int Token::getLine() const { return 0; } ANTLR_USE_NAMESPACE(std)string Token::getText() const { return ""; } int Token::getType() const { return type; } void Token::setColumn(int) { } void Token::setLine(int) { } void Token::setText(const ANTLR_USE_NAMESPACE(std)string&) { } void Token::setType(int t) { type = t; } void Token::setFilename(const ANTLR_USE_NAMESPACE(std)string&) { } ANTLR_USE_NAMESPACE(std)string emptyString(""); const ANTLR_USE_NAMESPACE(std)string& Token::getFilename() const { return emptyString; } ANTLR_USE_NAMESPACE(std)string Token::toString() const { return "[\""+getText()+"\",<"+type+">]"; } ANTLR_API RefToken nullToken; #ifndef NO_STATIC_CONSTS const int Token::MIN_USER_TYPE; const int Token::NULL_TREE_LOOKAHEAD; const int Token::INVALID_TYPE; const int Token::EOF_TYPE; const int Token::SKIP; #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/TokenBuffer.cpp000066400000000000000000000042321316047212700227340ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenBuffer.cpp#2 $ */ #include "antlr/TokenBuffer.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /**A Stream of Token objects fed to the parser from a TokenStream that can * be rewound via mark()/rewind() methods. *

* A dynamic array is used to buffer up all the input tokens. Normally, * "k" tokens are stored in the buffer. More tokens may be stored during * guess mode (testing syntactic predicate), or when LT(i>k) is referenced. * Consumption of tokens is deferred. In other words, reading the next * token is not done by conume(), but deferred until needed by LA or LT. *

* * @see antlr.Token * @see antlr.TokenStream * @see antlr.TokenQueue */ /** Create a token buffer */ TokenBuffer::TokenBuffer( TokenStream& inp ) : input(inp) , nMarkers(0) , markerOffset(0) , numToConsume(0) { } TokenBuffer::~TokenBuffer( void ) { } /** Ensure that the token buffer is sufficiently full */ void TokenBuffer::fill(unsigned int amount) { syncConsume(); // Fill the buffer sufficiently to hold needed tokens while (queue.entries() < (amount + markerOffset)) { // Append the next token queue.append(input.nextToken()); } } /** Get a lookahead token value */ int TokenBuffer::LA(unsigned int i) { fill(i); return queue.elementAt(markerOffset+i-1)->getType(); } /** Get a lookahead token */ RefToken TokenBuffer::LT(unsigned int i) { fill(i); return queue.elementAt(markerOffset+i-1); } /** Return an integer marker that can be used to rewind the buffer to * its current state. */ unsigned int TokenBuffer::mark() { syncConsume(); nMarkers++; return markerOffset; } /**Rewind the token buffer to a marker. * @param mark Marker returned previously from mark() */ void TokenBuffer::rewind(unsigned int mark) { syncConsume(); markerOffset=mark; nMarkers--; } /// Get number of non-consumed tokens unsigned int TokenBuffer::entries() const { return queue.entries() - markerOffset; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/TokenRefCount.cpp000066400000000000000000000012141316047212700232450ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ #include "antlr/TokenRefCount.hpp" #include "antlr/Token.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif TokenRef::TokenRef(Token* p) : ptr(p), count(1) { if (p && !p->ref) p->ref = this; } TokenRef::~TokenRef() { delete ptr; } TokenRef* TokenRef::getRef(const Token* p) { if (p) { Token* pp = const_cast(p); if (pp->ref) return pp->ref->increment(); else return new TokenRef(pp); } else return 0; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/TokenStreamBasicFilter.cpp000066400000000000000000000017341316047212700250720ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenStreamBasicFilter.cpp#2 $ */ #include "antlr/TokenStreamBasicFilter.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** This object is a TokenStream that passes through all * tokens except for those that you tell it to discard. * There is no buffering of the tokens. */ TokenStreamBasicFilter::TokenStreamBasicFilter(TokenStream& input_) : input(&input_) { } void TokenStreamBasicFilter::discard(int ttype) { discardMask.add(ttype); } void TokenStreamBasicFilter::discard(const BitSet& mask) { discardMask = mask; } RefToken TokenStreamBasicFilter::nextToken() { RefToken tok = input->nextToken(); while ( tok && discardMask.member(tok->getType()) ) { tok = input->nextToken(); } return tok; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/TokenStreamHiddenTokenFilter.cpp000066400000000000000000000103031316047212700262350ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenStreamHiddenTokenFilter.cpp#2 $ */ #include "antlr/TokenStreamHiddenTokenFilter.hpp" #include "antlr/CommonHiddenStreamToken.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /**This object filters a token stream coming from a lexer * or another TokenStream so that only certain token channels * get transmitted to the parser. * * Any of the channels can be filtered off as "hidden" channels whose * tokens can be accessed from the parser. */ TokenStreamHiddenTokenFilter::TokenStreamHiddenTokenFilter(TokenStream& input) : TokenStreamBasicFilter(input) { } void TokenStreamHiddenTokenFilter::consume() { nextMonitoredToken = input->nextToken(); } void TokenStreamHiddenTokenFilter::consumeFirst() { consume(); // Handle situation where hidden or discarded tokens // appear first in input stream RefToken p; // while hidden or discarded scarf tokens while ( hideMask.member(LA(1)->getType()) || discardMask.member(LA(1)->getType()) ) { if ( hideMask.member(LA(1)->getType()) ) { if ( !p ) { p = LA(1); } else { static_cast(p.get())->setHiddenAfter(LA(1)); static_cast(LA(1).get())->setHiddenBefore(p); // double-link p = LA(1); } lastHiddenToken = p; if (!firstHidden) firstHidden = p; // record hidden token if first } consume(); } } BitSet TokenStreamHiddenTokenFilter::getDiscardMask() const { return discardMask; } /** Return a ptr to the hidden token appearing immediately after * token t in the input stream. */ RefToken TokenStreamHiddenTokenFilter::getHiddenAfter(RefToken t) { return static_cast(t.get())->getHiddenAfter(); } /** Return a ptr to the hidden token appearing immediately before * token t in the input stream. */ RefToken TokenStreamHiddenTokenFilter::getHiddenBefore(RefToken t) { return static_cast(t.get())->getHiddenBefore(); } BitSet TokenStreamHiddenTokenFilter::getHideMask() const { return hideMask; } /** Return the first hidden token if one appears * before any monitored token. */ RefToken TokenStreamHiddenTokenFilter::getInitialHiddenToken() { return firstHidden; } void TokenStreamHiddenTokenFilter::hide(int m) { hideMask.add(m); } void TokenStreamHiddenTokenFilter::hide(const BitSet& mask) { hideMask = mask; } RefToken TokenStreamHiddenTokenFilter::LA(int) { return nextMonitoredToken; } /** Return the next monitored token. * Test the token following the monitored token. * If following is another monitored token, save it * for the next invocation of nextToken (like a single * lookahead token) and return it then. * If following is unmonitored, nondiscarded (hidden) * channel token, add it to the monitored token. * * Note: EOF must be a monitored Token. */ RefToken TokenStreamHiddenTokenFilter::nextToken() { // handle an initial condition; don't want to get lookahead // token of this splitter until first call to nextToken if ( !LA(1) ) { consumeFirst(); } // we always consume hidden tokens after monitored, thus, // upon entry LA(1) is a monitored token. RefToken monitored = LA(1); // point to hidden tokens found during last invocation static_cast(monitored.get())->setHiddenBefore(lastHiddenToken); lastHiddenToken = nullToken; // Look for hidden tokens, hook them into list emanating // from the monitored tokens. consume(); RefToken p = monitored; // while hidden or discarded scarf tokens while ( hideMask.member(LA(1)->getType()) || discardMask.member(LA(1)->getType()) ) { if ( hideMask.member(LA(1)->getType()) ) { // attach the hidden token to the monitored in a chain // link forwards static_cast(p.get())->setHiddenAfter(LA(1)); // link backwards if (p != monitored) { //hidden cannot point to monitored tokens static_cast(LA(1).get())->setHiddenBefore(p); } p = lastHiddenToken = LA(1); } consume(); } return monitored; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/TokenStreamRewriteEngine.cpp000066400000000000000000000132731316047212700254530ustar00rootroot00000000000000#include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif #ifndef NO_STATIC_CONSTS const size_t TokenStreamRewriteEngine::MIN_TOKEN_INDEX = 0; const int TokenStreamRewriteEngine::PROGRAM_INIT_SIZE = 100; #endif const char* TokenStreamRewriteEngine::DEFAULT_PROGRAM_NAME = "default"; namespace { struct compareOperationIndex { typedef TokenStreamRewriteEngine::RewriteOperation RewriteOperation; bool operator() ( const RewriteOperation* a, const RewriteOperation* b ) const { return a->getIndex() < b->getIndex(); } }; struct dumpTokenWithIndex { dumpTokenWithIndex( ANTLR_USE_NAMESPACE(std)ostream& o ) : out(o) {} void operator() ( const RefTokenWithIndex& t ) { out << "[txt='" << t->getText() << "' tp=" << t->getType() << " idx=" << t->getIndex() << "]\n"; } ANTLR_USE_NAMESPACE(std)ostream& out; }; } TokenStreamRewriteEngine::TokenStreamRewriteEngine(TokenStream& upstream) : stream(upstream) , index(MIN_TOKEN_INDEX) , tokens() , programs() , discardMask() { } TokenStreamRewriteEngine::TokenStreamRewriteEngine(TokenStream& upstream, size_t initialSize ) : stream(upstream) , index(MIN_TOKEN_INDEX) , tokens(initialSize) , programs() , discardMask() { } RefToken TokenStreamRewriteEngine::nextToken( void ) { RefTokenWithIndex t; // suck tokens until end of stream or we find a non-discarded token do { t = RefTokenWithIndex(stream.nextToken()); if ( t ) { t->setIndex(index); // what is t's index in list? if ( t->getType() != Token::EOF_TYPE ) { tokens.push_back(t); // track all tokens except EOF } index++; // move to next position } } while ( t && discardMask.member(t->getType()) ); return RefToken(t); } void TokenStreamRewriteEngine::rollback( const std::string& programName, size_t instructionIndex ) { program_map::iterator rewrite = programs.find(programName); if( rewrite != programs.end() ) { operation_list& prog = rewrite->second; operation_list::iterator j = prog.begin(), end = prog.end(); std::advance(j,instructionIndex); if( j != end ) prog.erase(j, end); } } void TokenStreamRewriteEngine::originalToStream( std::ostream& out, size_t start, size_t end ) const { token_list::const_iterator s = tokens.begin(); std::advance( s, start ); token_list::const_iterator e = s; std::advance( e, end-start ); std::for_each( s, e, tokenToStream(out) ); } void TokenStreamRewriteEngine::toStream( std::ostream& out, const std::string& programName, size_t firstToken, size_t lastToken ) const { if( tokens.size() == 0 ) return; program_map::const_iterator rewriter = programs.find(programName); if ( rewriter == programs.end() ) return; // get the prog and some iterators in it... const operation_list& prog = rewriter->second; operation_list::const_iterator rewriteOpIndex = prog.begin(), rewriteOpEnd = prog.end(); size_t tokenCursor = firstToken; // make sure we don't run out of the tokens we have... if( lastToken > (tokens.size() - 1) ) lastToken = tokens.size() - 1; while ( tokenCursor <= lastToken ) { // std::cout << "tokenCursor = " << tokenCursor << " first prog index = " << (*rewriteOpIndex)->getIndex() << std::endl; if( rewriteOpIndex != rewriteOpEnd ) { size_t up_to_here = std::min(lastToken,(*rewriteOpIndex)->getIndex()); while( tokenCursor < up_to_here ) out << tokens[tokenCursor++]->getText(); } while ( rewriteOpIndex != rewriteOpEnd && tokenCursor == (*rewriteOpIndex)->getIndex() && tokenCursor <= lastToken ) { tokenCursor = (*rewriteOpIndex)->execute(out); ++rewriteOpIndex; } if( tokenCursor <= lastToken ) out << tokens[tokenCursor++]->getText(); } // std::cout << "Handling tail operations # left = " << std::distance(rewriteOpIndex,rewriteOpEnd) << std::endl; // now see if there are operations (append) beyond last token index std::for_each( rewriteOpIndex, rewriteOpEnd, executeOperation(out) ); rewriteOpIndex = rewriteOpEnd; } void TokenStreamRewriteEngine::toDebugStream( std::ostream& out, size_t start, size_t end ) const { token_list::const_iterator s = tokens.begin(); std::advance( s, start ); token_list::const_iterator e = s; std::advance( e, end-start ); std::for_each( s, e, dumpTokenWithIndex(out) ); } void TokenStreamRewriteEngine::addToSortedRewriteList( const std::string& programName, RewriteOperation* op ) { program_map::iterator rewrites = programs.find(programName); // check if we got the program already.. if ( rewrites == programs.end() ) { // no prog make a new one... operation_list ops; ops.push_back(op); programs.insert(std::make_pair(programName,ops)); return; } operation_list& prog = rewrites->second; if( prog.empty() ) { prog.push_back(op); return; } operation_list::iterator i, end = prog.end(); i = end; --i; // if at or beyond last op's index, just append if ( op->getIndex() >= (*i)->getIndex() ) { prog.push_back(op); // append to list of operations return; } i = prog.begin(); if( i != end ) { operation_list::iterator pos = std::upper_bound( i, end, op, compareOperationIndex() ); prog.insert(pos,op); } else prog.push_back(op); } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/TokenStreamSelector.cpp000066400000000000000000000050011316047212700244520ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TokenStreamSelector.cpp#2 $ */ #include "antlr/TokenStreamSelector.hpp" #include "antlr/TokenStreamRetryException.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** A token stream MUX (multiplexor) knows about n token streams * and can multiplex them onto the same channel for use by token * stream consumer like a parser. This is a way to have multiple * lexers break up the same input stream for a single parser. * Or, you can have multiple instances of the same lexer handle * multiple input streams; this works great for includes. */ TokenStreamSelector::TokenStreamSelector() : input(0) { } TokenStreamSelector::~TokenStreamSelector() { } void TokenStreamSelector::addInputStream(TokenStream* stream, const ANTLR_USE_NAMESPACE(std)string& key) { inputStreamNames[key] = stream; } TokenStream* TokenStreamSelector::getCurrentStream() const { return input; } TokenStream* TokenStreamSelector::getStream(const ANTLR_USE_NAMESPACE(std)string& sname) const { inputStreamNames_coll::const_iterator i = inputStreamNames.find(sname); if (i == inputStreamNames.end()) { throw ANTLR_USE_NAMESPACE(std)string("TokenStream ")+sname+" not found"; } return (*i).second; } RefToken TokenStreamSelector::nextToken() { // keep looking for a token until you don't // get a retry exception for (;;) { try { return input->nextToken(); } catch (TokenStreamRetryException&) { // just retry "forever" } } } TokenStream* TokenStreamSelector::pop() { TokenStream* stream = streamStack.top(); streamStack.pop(); select(stream); return stream; } void TokenStreamSelector::push(TokenStream* stream) { streamStack.push(input); select(stream); } void TokenStreamSelector::push(const ANTLR_USE_NAMESPACE(std)string& sname) { streamStack.push(input); select(sname); } void TokenStreamSelector::retry() { throw TokenStreamRetryException(); } /** Set the stream without pushing old stream */ void TokenStreamSelector::select(TokenStream* stream) { input = stream; } void TokenStreamSelector::select(const ANTLR_USE_NAMESPACE(std)string& sname) { inputStreamNames_coll::const_iterator i = inputStreamNames.find(sname); if (i == inputStreamNames.end()) { throw ANTLR_USE_NAMESPACE(std)string("TokenStream ")+sname+" not found"; } input = (*i).second; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/TreeParser.cpp000066400000000000000000000040501316047212700225740ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id: //depot/code/org.antlr/release/antlr-2.7.7/lib/cpp/src/TreeParser.cpp#2 $ */ #include "antlr/TreeParser.hpp" #include "antlr/ASTNULLType.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif /** The AST Null object; the parsing cursor is set to this when * it is found to be null. This way, we can test the * token type of a node without having to have tests for null * everywhere. */ RefAST TreeParser::ASTNULL(new ASTNULLType); /** Parser error-reporting function can be overridden in subclass */ void TreeParser::reportError(const RecognitionException& ex) { ANTLR_USE_NAMESPACE(std)cerr << ex.toString().c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Parser error-reporting function can be overridden in subclass */ void TreeParser::reportError(const ANTLR_USE_NAMESPACE(std)string& s) { ANTLR_USE_NAMESPACE(std)cerr << "error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Parser warning-reporting function can be overridden in subclass */ void TreeParser::reportWarning(const ANTLR_USE_NAMESPACE(std)string& s) { ANTLR_USE_NAMESPACE(std)cerr << "warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl; } /** Procedure to write out an indent for traceIn and traceOut */ void TreeParser::traceIndent() { for( int i = 0; i < traceDepth; i++ ) ANTLR_USE_NAMESPACE(std)cout << " "; } void TreeParser::traceIn(const char* rname, RefAST t) { traceDepth++; traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "> " << rname << "(" << (t ? t->toString().c_str() : "null") << ")" << ((inputState->guessing>0)?" [guessing]":"") << ANTLR_USE_NAMESPACE(std)endl; } void TreeParser::traceOut(const char* rname, RefAST t) { traceIndent(); ANTLR_USE_NAMESPACE(std)cout << "< " << rname << "(" << (t ? t->toString().c_str() : "null") << ")" << ((inputState->guessing>0)?" [guessing]":"") << ANTLR_USE_NAMESPACE(std)endl; traceDepth--; } #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/antlr-2.7.7/src/dll.cpp000066400000000000000000000237051316047212700213030ustar00rootroot00000000000000/* ANTLR Translator Generator * Project led by Terence Parr at http://www.jGuru.com * Software rights: http://www.antlr.org/license.html * * $Id:$ */ /* * DLL stub for MSVC++. Based upon versions of Stephen Naughton and Michael * T. Richter */ // RK: Uncommented by instruction of Alexander Lenski //#if _MSC_VER > 1000 //# pragma once //#endif // _MSC_VER > 1000 // Exclude rarely-used stuff from Windows headers #define WIN32_LEAN_AND_MEAN #include #if defined( _MSC_VER ) && ( _MSC_VER < 1300 ) # error "DLL Build not supported on old MSVC's" // Ok it seems to be possible with STLPort in stead of the vanilla MSVC STL // implementation. This needs some work though. (and don't try it if you're // not that familiar with compilers/building C++ DLL's in windows) #endif #include #include "antlr/config.hpp" #include "antlr/Token.hpp" #include "antlr/CircularQueue.hpp" #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE namespace antlr { #endif // Take care of necessary implicit instantiations of templates from STL // This should take care of MSVC 7.0 #if defined( _MSC_VER ) && ( _MSC_VER == 1300 ) // these come from AST.hpp template class ANTLR_API ASTRefCount< AST >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< RefAST >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< RefAST >; //template ANTLR_API int operator<( ASTRefCount< AST >, ASTRefCount< AST > ); // ASTFactory.hpp template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< factory_descriptor_* >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ > >; template struct ANTLR_API ANTLR_USE_NAMESPACE(std)pair< const char*, factory_type_ >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< factory_descriptor_*, ANTLR_USE_NAMESPACE(std)allocator< factory_descriptor_* > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< factory_descriptor_* >; // BitSet.hpp template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< bool >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< bool, ANTLR_USE_NAMESPACE(std)allocator< bool > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< bool >; // CharScanner.hpp template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, int > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >, false > >::_Node >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >, false > >::_Nodeptr >; template struct ANTLR_API ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, int >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_val< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, int > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)map< ANTLR_USE_NAMESPACE(std)string, int, CharScannerLiteralsLess >; // CircularQueue.hpp // RK: it might well be that a load of these ints need to be unsigned ints // (made some more stuff unsigned) template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< int >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< int, ANTLR_USE_NAMESPACE(std)allocator< int > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< int >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< int, ANTLR_USE_NAMESPACE(std)allocator< int > >; // template ANTLR_API inline int CircularQueue< int >::entries() const; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< RefToken >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Vector_val< RefToken, ANTLR_USE_NAMESPACE(std)allocator< RefToken > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< RefToken >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)vector< RefToken, ANTLR_USE_NAMESPACE(std)allocator< RefToken > >; // template ANTLR_API inline int CircularQueue< RefToken >::entries() const; // CommonAST.hpp template class ANTLR_API ASTRefCount< CommonAST >; // CommonASTWithHiddenTokenTypes.hpp template class ANTLR_API ASTRefCount< CommonASTWithHiddenTokens >; // LexerSharedInputState.hpp template class ANTLR_API RefCount< LexerInputState >; // ParserSharedInputState.hpp template class ANTLR_API RefCount< ParserInputState >; // TokenStreamSelector.hpp template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, TokenStream* > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >, false > >::_Node >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >, false > >::_Nodeptr >; template struct ANTLR_API ANTLR_USE_NAMESPACE(std)pair< ANTLR_USE_NAMESPACE(std)string, TokenStream* >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_nod< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_ptr< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree_val< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Tree< ANTLR_USE_NAMESPACE(std)_Tmap_traits< ANTLR_USE_NAMESPACE(std)string, TokenStream*, ANTLR_USE_NAMESPACE(std)less< ANTLR_USE_NAMESPACE(std)string >, ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)pair< const ANTLR_USE_NAMESPACE(std)string, TokenStream* > >,false > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)map< ANTLR_USE_NAMESPACE(std)string, TokenStream* >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< TokenStream* >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)allocator< ANTLR_USE_NAMESPACE(std)_Deque_map< TokenStream* , ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >::_Tptr >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Deque_map< TokenStream*, ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)_Deque_val< TokenStream*, ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)deque< TokenStream*, ANTLR_USE_NAMESPACE(std)allocator< TokenStream* > >; template class ANTLR_API ANTLR_USE_NAMESPACE(std)stack< TokenStream*, ANTLR_USE_NAMESPACE(std)deque >; #elif defined( _MSC_VER ) && ( _MSC_VER == 1310 ) // Instantiations for MSVC 7.1 template class ANTLR_API CircularQueue< int >; template class ANTLR_API CircularQueue< RefToken >; // #else future msvc's #endif #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE } #endif BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } sqlitebrowser-3.10.1/libs/qcustomplot-source/000077500000000000000000000000001316047212700213255ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qcustomplot-source/CMakeLists.txt000066400000000000000000000005601316047212700240660ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.7) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(Qt5Widgets REQUIRED) set(QCUSTOMPLOT_SRC qcustomplot.cpp ) set(QCUSTOMPLOT_HDR ) set(QCUSTOMPLOT_MOC_HDR qcustomplot.h ) add_library(qcustomplot ${QCUSTOMPLOT_SRC} ${QCUSTOMPLOT_HDR} ${QCUSTOMPLOT_MOC}) qt5_use_modules(qcustomplot Widgets PrintSupport) sqlitebrowser-3.10.1/libs/qcustomplot-source/GPL.txt000066400000000000000000001045131316047212700225140ustar00rootroot00000000000000 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 . sqlitebrowser-3.10.1/libs/qcustomplot-source/changelog.txt000066400000000000000000001335671316047212700240340ustar00rootroot00000000000000#### Version 2.0.0-beta released on 13.09.16 #### Added major features: - Axis tick and tick label generation was completely refactored and is now handled in the QCPAxisTicker class (also see QCPAxis::setTicker). Available ticker subclasses for special uses cases: QCPAxisTicker, QCPAxisTickerFixed, QCPAxisTickerLog, QCPAxisTickerPi, QCPAxisTickerTime, QCPAxisTickerDateTime, QCPAxisTickerText - Data container is now based on QCPDataContainer template for unified data interface and significantly improved memory footprint and better performance for common use-cases, especially data adding/removing. - New data selection mechanism allows selection of single data points and data ranges for plottables. See special documentation page "data selection mechanism". - Rubber band/selection rect for data point selection and axis zooming is now available, see documentation of QCustomPlot::setSelectionRectMode and QCPSelectionRect. For this purpose, the new default layer "overlay" was introduced, which is now the top layer, and holds the QCustomPlot's QCPSelectionRect instance. - Data sharing between plottables of the same type (see setData methods taking a QSharedPointer) - OpenGL hardware acceleration is now available across all Qt versions (including Qt4) in a unified, simple interface, with QCustomPlot::setOpenGl - QCPStatisticalBox can now display a series of statistical boxes instead of only a single one - New QCPErrorBars plottable allows attaching error bars to any one-dimensional plottable (QCPGraph has thus lost its own error-bar capability) - QCPColorMap now supports transparency via alpha in its color gradient stops, and via a dedicated cell-wise alpha map (see QCPColorMapData::setAlpha) - Layers may now be individually replotted (QCPLayer::replot), if the mode (QCPLayer::setMode) is set to lmBuffered. Mutually adjacent lmLogical layers share a single paint buffer to save resources. By default, the new topmost "overlay" layer which contains the selection rect is an lmBuffered layer. Updating the selection rect is thus very fast, independent of the plot contents. - QCPLayerable (and thus practically all objects in QCP) now have virtual methods to receive mouse press/move/release/doubleclick/wheel events. Before, only QCPLayoutElement provided them. this makes it much easier to subclass e.g. items and plottables to provide custom mouse interactions that were cumbersome and awkward with the simpler signal-based interface Added minor features: - High-DPI support for Qt versions 5.0 and up, using device pixel ratio detected by Qt (can be changed manually via QCustomPlot::setBufferDevicePixelRatio). - QCPGraph and QCPCurve can now be configured to only display every n'th scatter symbol, see ::setScatterSkip() method - QCPFinancial allows to define bar width in absolute pixels and axis rect ratio, instead of only in plot key coordinates (see QCPFinancial::setWidthType) - Range dragging/zooming can now be configured to affect more than one axis per orientation (see new overloads of QCPAxisRect::setRangeDragAxes/setRangeZoomAxes) - Added QCPTextElement (replaces QCPPlotTitle) for general texts in layouts. Provides clicked and doubleClicked signals, as replacement for the removed QCustomPlot::titleClicked/titleDoubleClicked - Export functions (QCustomPlot::savePng etc.) now support specifying the resolution that will be written to the image file header. This improves operability with other tools which respect metadata. - Replots can now be queued to the next event loop iteration with replot(QCP::rpQueuedReplot). This way you can successively ask for a replot at multiple code locations without causing redundant replots - QCPAxisRect::zoom(...) allows to zoom to a specific rectangular region given in pixel coordinates, either affecting all axes or a specified subset of axes. - QCPRange::bounded returns a bounded range, trying to preserve its size. Works with rangeChanged signal to limit the allowed range (see rangeChanged doc) - Plottable rescaleValueAxis method (and getValueRange) now take parameter inKeyRange, which allows rescaling of the value axis only with respect to data in the currently visible key range - plottableClick and plottableDoubleClick signals now carry the clicked data point index as second parameter - Added QCPAxis::scaleRange overload without "center" argument, which scales around the current axis range center - Added QCPRange::expand/expanded overloads which take only one double parameter - Plottables addToLegend/removeFromLegend methods now have overloads that take any QCPLegend, to make working with non-default legends easier (legends that are not QCustomPlot::legend) - Added QCPStatisticalBox::setWhiskerAntialiased to allow controlling antialiasing state of whiskers independently of quartile box/median line - The virtual method QCPLayoutElement::layoutChanged() now allows subclasses to react on a move of the layout element between logical positions in the parent layout, or between layouts - QCPMarginGroup::commonMargin is now virtual, to facilitate subclassing of QCPMarginGroup - QCPGraph::getPreparedData is now virtual, and thus allows subclasses to easily generate own plotted data, e.g. on-the-fly. - Added QCPRange qDebug stream operator - QCPLayoutGrid (and thus QCPLegend) can now wrap rows or columns at specified row/column counts, see setFillOrder, setWrap and the new addElement overload which doesn't have row/column index Bugfixes [Also backported to 1.3.2]: - Fixed possible crash when having a QCPGraph with scatters only and a non-transparent main/fill brush of the graph - Fixed QCPItemPixmap not updating internally cached scaled pixmap if new pixmap set with same scaled dimensions - When using log axis scale and zooming out as far as possible (~1e-280..1e280), axis doesn't end up in (via mouse) unrecoverable range with strange axis ticks anymore - Axis tick label algorithm for beautifully typeset powers now checks whether "e" in tick label is actually part of a number before converting the exponent to superscript - Fixed QCustomPlot::moveLayer performing incorrect move and possible crash in certain situations - Fixed possible crash on QCustomPlot destruction due to wrong QObject-hierarchy. Only occurs if a QCPAxisRect is removed from the normal QCustomPlot destruction hierarchy by taking it out of its layout - Fixed possible freeze when data values become infinity after coord-to-pixel transformation (e.g. maximally zoomed out log axis), and line style is not solid (e.g. dashed) or phFastPolylines is disabled - Fixed a few missing enums in meta type system, by unifying usage of Q_ENUMS, Q_FLAGS and Q_DECLARE_METATYPE Bugfixes [Not in 1.3.2]: - Fixed QCPItemLine/QCPItemStraightLine not being selectable when defining coords are many orders of magnitude (>1e8) larger than currently viewed range - Fixed/worked around crash due to bug in QPainter::drawPixmap with very large negative x/y pixel coordinates, when drawing sparse pixmap scatters - Fixed possible (but unlikely) int overflow in adaptive sampling algorithm, that could cause plot artifacts when using extremely sparse data (with respect to current key axis range). - Fixed QCPBarsGroup bug which caused stPlotCoords spacing to be wrong with vertical key axes - A QCPBars axis rescale in the main window constructor (i.e. without well-defined plot size) now falls back to a datapoint-tight rescaling instead of doing nothing (because bar width can't be determined) - Improved QCPBars stacking when using bars with very large keys and key separation at limit of double precision Summary of backward incompatible changes: Plottable related: - Removed QCustomPlot::addPlottable, not needed anymore as plottables now automatically register in their constructor - Removed QCustomPlot::addItem, not needed anymore as items now automatically register in their constructor - QCPAbstractPlottable::addToLegend/removeFromLegend are not virtual anymore. If your plottable requires a custom legend item, add it to the legend manually. - setData/addData method overloads of plottables have changed to facilitate data sharing and new data container (see documentation) - plottableClick and plottableDoubleClick signals now carry the clicked data point index as second parameter, and the QMouseEvent parameter has moved to third. Check all your usages of those signals, because Qt's connect method only reports problems during runtime! - setSelectable now not only limits what can be selected by the user, but limits also any programmatic selection changes via setSelected. - enum QCPAbstractPlottable::SignDomain has changed namespace to QCP::SignDomain Axis related: - Removed QCPAxis::setAutoTicks, setAutoTickCount, setAutoTickLabels, setAutoTickStep, setAutoSubTicks, setTickLabelType, setDateTimeFormat, setDateTimeSpec, setTickStep, setTickVector, setTickVectorLabels, setSubTickCount in favor of new QCPAxisTicker-based interface - Added QCPAxis::setSubTicks to enable/disable subticks (manually controlling the subtick count needs subclassing of QCPAxisTicker, e.g. QCPAxisTickerText and QCPAxisTickerLog provide setSubTickCount) Item related: - Renamed QCPAbstractItem::rectSelectTest to rectDistance, to prevent confusion with new QCPAbstractPlottable1D::selectTestRect - Renamed QCPItemAnchor::pixelPoint to QCPItemAnchor::pixelPosition (also affects subclass QCPItemPosition) General: - Renamed QCustomPlot::RefreshPriority enums (parameter of the replot() method): rpImmediate to rpImmediateRefresh, rpQueued to rpQueuedRefresh, rpHint to rpRefreshHint - Renamed QCustomPlot::PlottingHint enum phForceRepaint to phImmediateRefresh - Removed QCPPlotTitle layout element (See new QCPTextElement for almost drop-in replacement) - Removed signals QCustomPlot::titleClicked/titleDoubleClicked, replaced by QCPTextElement signals clicked/doubleClicked. - QCustomPlot::savePdf has changed parameters from (fileName, bool noCosmeticPen, width, height,...) to (fileName, width, height, QCP::ExportPen exportPen,...) - Virtual methods QCPLayoutElement::mouseMoveEvent/mouseReleaseEvent (which are now introduced already in the superclass QCPLayerable) have gained an additional parameter const QPointF &startPos. If you have reimplemented these methods, make sure to update your function signatures, otherwise your reimplementations will likely be ignored by the compiler without warning - Creating a new QCPColorGradient without supplying a preset parameter in the constructor now creates an empty gradient, instead of loading the gpCold preset Other: - Replaced usage of Qt's QVector2D with own QCPVector2D which uses double precision and offers some convenience functions - Extended relative range to which QCPItemLine/QCPItemStraightLine can be zoomed before vanishing from ~1e9 to ~1e16 - Removed QCPItemStraightLine::distToStraightLine (replaced by QCPVector2D::distanceToStraightLine) - Removed QCPAbstractPlottable::distSqrToLine and QCPAbstractItem::distSqrToLine (replaced by QCPVector2D::distanceSquaredToLine) - Qt5.5 compatibility (If you use PDF export, test your outputs, as output dimensions might change when switching Qt versions -- QCP does not try to emulate previous Qt version behaviour here) - QCP now includes instead of just because some users had problems with the latter. Please report if you now experience issues due to the new include. - QCPGraph can now use a brush (filled polygon under the graph data) without having a graph line (line style lsNone) - QCPFinancial is now two-colored (setTwoColored(true)) by default, and has green/red as default two-colored brushes and pens - Plottable pixelsToCoords/coordsToPixels methods are now public, and offer transformations from pixel to plot coordinates and vice versa, using the plottable's axes - Plottable getKeyRange/getValueRange methods are now public - QCPBarsGroup now always places the QCPBars that was added to the group first towards lower keys, independent of axis orientation or direction (the ordering used to flip with axis orientation) - Default focus policy for QCustomPlot is now Qt::ClickFocus, instead of Qt::NoFocus. - tweaked QCPLegend and QCPAbstractLegendItem margins: The items have by default zero own margins, and QCPLegend row- and column spacing was increased to compensate. Legend was made slightly denser by default. - Used doxygen version is now 1.8.12, and documentation/postprocessing-scripts were adapted accordingly. Expect minor issues and some warnings when using older doxygen. #### Version 1.3.2 released on 22.12.15 #### Bugfixes [Backported from 2.0.0 branch]: - Fixed possible crash when having a QCPGraph with scatters only and a non-transparent main/fill brush of the graph - Fixed QCPItemPixmap not updating internally cached scaled pixmap if new pixmap set with same scaled dimensions - When using log axis scale and zooming out as far as possible (~1e-280..1e280), axis doesn't end up in (via mouse) unrecoverable range with strange axis ticks anymore - Axis tick label algorithm for beautifully typeset powers now checks whether "e" in tick label is actually part of a number before converting the exponent to superscript - Fixed QCustomPlot::moveLayer performing incorrect move and possible crash in certain situations - Fixed possible crash on QCustomPlot destruction due to wrong QObject-hierarchy. Only occurs if a QCPAxisRect is removed from the normal QCustomPlot destruction hierarchy by taking it out of its layout - Fixed possible freeze when data values become infinity after coord-to-pixel transformation (e.g. maximally zoomed out log axis), and line style is not solid (e.g. dashed) or phFastPolylines is disabled Other [Backported from 2.0.0 branch]: - A few documentation fixes/improvements - Qt5.5 compatibility (If you use PDF export, test your outputs, as output dimensions might change when switching Qt versions -- QCP does not try to emulate previous Qt version behaviour here) - QCP now includes instead of just because some users had problems with the latter. Please report if you now experience issues due to the new include. #### Version 1.3.1 released on 25.04.15 #### Bugfixes: - Fixed bug that prevented automatic axis rescaling when some graphs/curves had only NaN data points - Improved QCPItemBracket selection boundaries, especially bsCurly and bsCalligraphic - Fixed bug of axis rect and colorscale background shifted downward by one logical pixel (visible in scaled png and pdf export) - Replot upon mouse release is now only performed if a selection change has actually happened (improves responsivity on particularly complex plots) - Fixed bug that allowed scatter-only graphs to be selected by clicking the non-existent line between scatters - Fixed crash when trying to select a scatter-only QCPGraph whose only points in the visible key range are at identical key coordinates and vertically off-screen, with adaptive sampling enabled - Fixed pdf export of QCPColorMap with enabled interpolation (didn't appear interpolated in pdf) - Reduced QCPColorMap jitter of internal cell boundaries for small sized maps when viewed with high zoom, by applying oversampling factors dependant on map size - Fixed bug of QCPColorMap::fill() not causing the buffered internal image map to be updated, and thus the change didn't become visible immediately - Axis labels with size set in pixels (setPixelSize) instead of points now correctly calculate the exponent's font size if beautifully typeset powers are enabled - Fixed QCPColorMap appearing at the wrong position for logarithmic axes and color map spanning larger ranges Other: - Pdf export used to embed entire QCPColorMaps, potentially leading to large files. Now only the visible portion of the map is embedded in the pdf - Many documentation fixes and extensions, style modernization - Reduced documentation file size (and thus full package size) by automatically reducing image palettes during package build - Fixed MSVC warning message (at warning level 4) due to temporary QLists in some foreach statements #### Version 1.3.0 released on 27.12.14 #### Added features: - New plottable class QCPFinancial allows display of candlestick/ohlc data - New class QCPBarsGroup allows horizontal grouping of multiple QCPBars plottables - Added QCPBars feature allowing non-zero base values (see property QCPBars::setBaseValue) - Added QCPBars width type, for more flexible bar widths (see property QCPBars::setWidthType) - New QCPCurve optimization algorithm, fixes bug which caused line flicker at deep zoom into curve segment - Item positions can now have different position types and anchors for their x and y coordinates (QCPItemPosition::setTypeX/Y, setParentAnchorX/Y) - QCPGraph and QCPCurve can now display gaps in their lines, when inserting quiet NaNs as values (std::numeric_limits::quiet_NaN()) - QCPAxis now supports placing the tick labels inside the axis rect, for particularly space saving plots (QCPAxis::setTickLabelSide) Added features after beta: - Made code compatible with QT_NO_CAST_FROM_ASCII, QT_NO_CAST_TO_ASCII - Added compatibility with QT_NO_KEYWORDS after sending code files through a simple reg-ex script - Added possibility to inject own QCPAxis(-subclasses) via second, optional QCPAxisRect::addAxis parameter - Added parameter to QCPItemPixmap::setScaled to specify transformation mode Bugfixes: - Fixed bug in QCPCurve rendering of very zoomed-in curves (via new optimization algorithm) - Fixed conflict with MSVC-specific keyword "interface" in text-document-integration example - Fixed QCPScatterStyle bug ignoring the specified pen in the custom scatter shape constructor - Fixed bug (possible crash) during QCustomPlot teardown, when a QCPLegend that has no parent layout (i.e. was removed from layout manually) gets deleted Bugfixes after beta: - Fixed bug of QCPColorMap/QCPColorGradient colors being off by one color sampling step (only noticeable in special cases) - Fixed bug of QCPGraph adaptive sampling on vertical key axis, causing staggered look - Fixed low (float) precision in QCPCurve optimization algorithm, by not using QVector2D anymore Other: - Qt 5.3 and Qt 5.4 compatibility #### Version 1.2.1 released on 07.04.14 #### Bugfixes: - Fixed regression which garbled date-time tick labels on axes, if setTickLabelType is ltDateTime and setNumberFormat contains the "b" option #### Version 1.2.0 released on 14.03.14 #### Added features: - Adaptive Sampling for QCPGraph greatly improves performance for high data densities (see QCPGraph::setAdaptiveSampling) - QCPColorMap plottable with QCPColorScale layout element allows plotting of 2D color maps - QCustomPlot::savePdf now has additional optional parameters pdfCreator and pdfTitle to set according PDF metadata fields - QCustomPlot::replot now allows specifying whether the widget update is immediate (repaint) or queued (update) - QCPRange operators +, -, *, / with double operand for range shifting and scaling, and ==, != for range comparison - Layers now have a visibility property (QCPLayer::setVisible) - static functions QCPAxis::opposite and QCPAxis::orientation now offer more convenience when handling axis types - added notification signals for selectability change (selectableChanged) on all objects that have a selected/selectable property - added notification signal for QCPAxis scaleType property - added notification signal QCPLayerable::layerChanged Bugfixes: - Fixed assert halt, when QCPAxis auto tick labels not disabled but nevertheless a custom non-number tick label ending in "e" given - Fixed painting glitches when QCustomPlot resized inside a QMdiArea or under certain conditions inside a QLayout - If changing QCPAxis::scaleType and thus causing range sanitizing and a range modification, rangeChanged wouldn't be emitted - Fixed documentation bug that caused indentation to be lost in code examples Bugfixes after beta: - Fixed bug that caused crash if clicked-on legend item is removed in mousePressEvent. - On some systems, font size defaults to -1, which used to cause a debug output in QCPAxisPainterPrivate::TickLabelDataQCP. Now it's checked before setting values based on the default font size. - When using multiple axes on one side, setting one to invisible didn't properly compress the freed space. - Fixed bug that allowed selection of plottables when clicking in the bottom or top margin of a QCPAxisRect (outside the inner rect) Other: - In method QCPAbstractPlottable::getKeyRange/getValueRange, renamed parameter "validRange" to "foundRange", to better reflect its meaning (and contrast it from QCPRange::validRange) - QCPAxis low-level axis painting methods exported to QCPAxisPainterPrivate #### Version 1.1.1 released on 09.12.13 #### Bugfixes: - Fixed bug causing legends blocking input events from reaching underlying axis rect even if legend is invisible - Added missing Q_PROPERTY for QCPAxis::setDateTimeSpec - Fixed behaviour of QCPAxisRect::setupFullAxesBox (now transfers more properties from bottom/left to top/right axes and sets visibility of bottom/left axes to true) - Made sure PDF export doesn't default to grayscale output on some systems Other: - Plotting hint QCP::phForceRepaint is now enabled on all systems (and not only on windows) by default - Documentation improvements #### Version 1.1.0 released on 04.11.13 #### Added features: - Added QCPRange::expand and QCPRange::expanded - Added QCPAxis::rescale to rescale axis to all associated plottables - Added QCPAxis::setDateTimeSpec/dateTimeSpec to allow axis labels either in UTC or local time - QCPAxis now additionally emits a rangeChanged signal overload that provides the old range as second parameter Bugfixes: - Fixed QCustomPlot::rescaleAxes not rescaling properly if first plottable has an empty range - QCPGraph::rescaleAxes/rescaleKeyAxis/rescaleValueAxis are no longer virtual (never were in base class, was a mistake) - Fixed bugs in QCPAxis::items and QCPAxisRect::items not properly returning associated items and potentially stalling Other: - Internal change from QWeakPointer to QPointer, thus got rid of deprecated Qt functionality - Qt5.1 and Qt5.2 (beta1) compatibility - Release packages now extract to single subdirectory and don't place multiple files in current working directory #### Version 1.0.1 released on 05.09.13 #### Bugfixes: - using define flag QCUSTOMPLOT_CHECK_DATA caused debug output when data was correct, instead of invalid (fixed QCP::isInvalidData) - documentation images are now properly shown when viewed with Qt Assistant - fixed various documentation mistakes Other: - Adapted documentation style sheet to better match Qt5 documentation #### Version 1.0.0 released on 01.08.13 #### Quick Summary: - Layout system for multiple axis rects in one plot - Multiple axes per side - Qt5 compatibility - More flexible and consistent scatter configuration with QCPScatterStyle - Various interface cleanups/refactoring - Pixmap-cached axis labels for improved replot performance Changes that break backward compatibility: - QCustomPlot::axisRect() changed meaning due to the extensive changes to how axes and axis rects are handled it now returns a pointer to a QCPAxisRect and takes an integer index as parameter. - QCPAxis constructor changed to now take QCPAxisRect* as parent - setAutoMargin, setMarginLeft/Right/Top/Bottom removed due to the axis rect changes (see QCPAxisRect::setMargins/setAutoMargins) - setAxisRect removed due to the axis rect changes - setAxisBackground(-Scaled/-ScaledMode) now moved to QCPAxisRect as setBackground(-Scaled/ScaledMode) (access via QCustomPlot::axisRects()) - QCPLegend now is a QCPLayoutElement - QCPAbstractPlottable::drawLegendIcon parameter "rect" changed from QRect to QRectF - QCPAbstractLegendItem::draw second parameter removed (position/size now handled via QCPLayoutElement base class) - removed QCPLegend::setMargin/setMarginLeft/Right/Top/Bottom (now inherits the capability from QCPLayoutElement::setMargins) - removed QCPLegend::setMinimumSize (now inherits the capability from QCPLayoutElement::setMinimumSize) - removed enum QCPLegend::PositionStyle, QCPLegend::positionStyle/setPositionStyle/position/setPosition (replaced by capabilities of QCPLayoutInset) - QCPLegend transformed to work with new layout system (almost everything changed) - removed entire title interface: QCustomPlot::setTitle/setTitleFont/setTitleColor/setTitleSelected/setTitleSelectedFont/setTitleSelectedColor and the QCustomPlot::iSelectTitle interaction flag (all functionality is now given by the layout element "QCPPlotTitle" which can be added to the plot layout) - selectTest functions now take two additional parameters: bool onlySelectable and QVariant *details=0 - selectTest functions now ignores visibility of objects and (if parameter onlySelectable is true) does not anymore ignore selectability of the object - moved QCustomPlot::Interaction/Interactions to QCP namespace as QCP::Interaction/Interactions - moved QCustomPlot::setupFullAxesBox() to QCPAxisRect::setupFullAxesBox. Now also accepts parameter to decide whether to connect opposite axis ranges - moved range dragging/zooming interface from QCustomPlot to QCPAxisRect (setRangeDrag, setRangeZoom, setRangeDragAxes, setRangeZoomAxes,...) - rangeDrag/Zoom is now set to Qt::Horizontal|Qt::Vertical instead of 0 by default, on the other hand, iRangeDrag/Zoom is unset in interactions by default (this makes enabling dragging/zooming easier by just adding the interaction flags) - QCPScatterStyle takes over everything related to handling scatters in all plottables - removed setScatterPen/Size on QCPGraph and QCPCurve, removed setOutlierPen/Size on QCPStatisticalBox (now handled via QCPScatterStyle) - modified setScatterStyle on QCPGraph and QCPCurve, and setOutlierStyle on QCPStatisticalBox, to take QCPScatterStyle - axis grid and subgrid are now reachable via the QCPGrid *QCPAxis::grid() method. (e.g. instead of xAxis->setGrid(true), write xAxis->grid()->setVisible(true)) Added features: - Axis tick labels are now pixmap-cached, thus increasing replot performance (in usual setups by about 24%). See plotting hint phCacheLabels which is set by default - Advanced layout system, including the classes QCPLayoutElement, QCPLayout, QCPLayoutGrid, QCPLayoutInset, QCPAxisRect - QCustomPlot::axisRects() returns all the axis rects in the QCustomPlot. - QCustomPlot::plotLayout() returns the top level layout (initially a QCPLayoutGrid with one QCPAxisRect inside) - QCPAxis now may have an offset to the axis rect (setOffset) - Multiple axes per QCPAxisRect side are now supported (see QCPAxisRect::addAxis) - QCustomPlot::toPixmap renders the plot into a pixmap and returns it - When setting tick label rotation to +90 or -90 degrees on a vertical axis, the labels are now centered vertically on the tick height (This allows space saving vertical tick labels by having the text direction parallel to the axis) - Substantially increased replot performance when using very large manual tick vectors (> 10000 ticks) via QCPAxis::setTickVector - QCPAxis and QCPAxisRect now allow easy access to all plottables(), graphs() and items() that are associated with them - Added QCustomPlot::hasItem method for consistency with plottable interface, hasPlottable - Added QCPAxisRect::setMinimumMargins as replacement for hardcoded minimum axis margin (15 px) when auto margin is enabled - Added Flags type QCPAxis::AxisTypes (from QCPAxis::AxisType), used in QCPAxisRect interface - Automatic margin calculation can now be enabled/disabled on a per-side basis, see QCPAxisRect::setAutoMargins - QCPAxisRect margins of multiple axis rects can be coupled via QCPMarginGroup - Added new default layers "background" and "legend" (QCPAxisRect draws its background on the "background" layer, QCPLegend is on the "legend" layer by default) - Custom scatter style via QCP::ssCustom and respective setCustomScatter functions that take a QPainterPath - Filled scatters via QCPScatterStyle::setBrush Added features after beta: - Added QCustomPlot::toPainter method, to allow rendering with existing painter - QCPItemEllipse now provides a center anchor Bugfixes: - Fixed compile error on ARM - Wrong legend icons were displayed if using pixmaps for scatters that are smaller than the legend icon rect - Fixed clipping inaccuracy for rotated tick labels (were hidden too early, because the non-rotated bounding box was used) - Fixed bug that caused wrong clipping of axis ticks and subticks when the ticks were given manually by QCPAxis::setTickVector - Fixed Qt5 crash when dragging graph out of view (iterator out of bounds in QCPGraph::getVisibleDataBounds) - Fixed QCPItemText not scaling properly when using scaled raster export Bugfixes after beta: - Fixed bug that clipped the rightmost pixel column of tick labels when caching activated (only visible on windows for superscript exponents) - Restored compatibility to Qt4.6 - Restored support for -no-RTTI compilation - Empty manual tick labels are handled more gracefully (no QPainter qDebug messages anymore) - Fixed type ambiguity in QCPLineEnding::draw causing compile error on ARM - Fixed bug of grid layouts not propagating the minimum size from their child elements to the parent layout correctly - Fixed bug of child elements (e.g. axis rects) of inset layouts not properly receiving mouse events Other: - Opened up non-amalgamated project structure to public via git repository #### Version released on 09.06.12 #### Quick Summary: - Items (arrows, text,...) - Layers (easier control over rendering order) - New antialiasing system (Each objects controls own antialiasing with setAntialiased) - Performance Improvements - improved pixel-precise drawing - easier shared library creation/usage Changes that (might) break backward compatibility: - enum QCPGraph::ScatterSymbol was moved to QCP namespace (now QCP::ScatterSymbol). This replace should fix your code: "QCPGraph::ss" -> "QCP::ss" - enum QCustomPlot::AntialiasedElement and flag QCustomPlot::AntialiasedElements was moved to QCP namespace This replace should fix your code: "QCustomPlot::ae" -> "QCP::ae" - the meaning of QCustomPlot::setAntialiasedElements has changed slightly: It is now an override to force elements to be antialiased. If you want to force elements to not be drawn antialiased, use the new setNotAntialiasedElements. If an element is mentioned in neither of those functions, it now controls its antialiasing itself via its "setAntialiased" function(s). (e.g. QCPAxis::setAntialiased(bool), QCPAbstractPlottable::setAntialiased(bool), QCPAbstractPlottable::setAntialiasedScatters(bool), etc.) - QCPAxis::setTickVector and QCPAxis::setTickVectorLabels no longer take a pointer but a const reference of the respective QVector as parameter. (handing over a pointer didn't give any noticeable performance benefits but was inconsistent with the rest of the interface) - Equally QCPAxis::tickVector and QCPAxis::tickVectorLabels don't return by pointer but by value now - QCustomPlot::savePngScaled was removed, its purpose is now included as optional parameter "scale" of savePng. - If you have derived from QCPAbstractPlottable: all selectTest functions now consistently take the argument "const QPointF &pos" which is the test point in pixel coordinates. (the argument there was "double key, double value" in plot coordinates, before). - QCPAbstractPlottable, QCPAxis and QCPLegend now inherit from QCPLayerable - If you have derived from QCPAbstractPlottable: the draw method signature has changed from "draw (..) const" to "draw (..)", i.e. the method is not const anymore. This allows the draw function of your plottable to perform buffering/caching operations, if necessary. Added features: - Item system: QCPAbstractItem, QCPItemAnchor, QCPItemPosition, QCPLineEnding. Allows placing of lines, arrows, text, pixmaps etc. - New Items: QCPItemStraightLine, QCPItemLine, QCPItemCurve, QCPItemEllipse, QCPItemRect, QCPItemPixmap, QCPItemText, QCPItemBracket, QCPItemTracer - QCustomPlot::addItem/itemCount/item/removeItem/selectedItems - signals QCustomPlot::itemClicked/itemDoubleClicked - the QCustomPlot interactions property now includes iSelectItems (for selection of QCPAbstractItem) - QCPLineEnding. Represents the different styles a line/curve can end (e.g. different arrows, circle, square, bar, etc.), see e.g. QCPItemCurve::setHead - Layer system: QCPLayerable, QCPLayer. Allows more sophisticated control over drawing order and a kind of grouping. - QCPAbstractPlottable, QCPAbstractItem, QCPAxis, QCPGrid, QCPLegend are layerables and derive from QCPLayerable - QCustomPlot::addLayer/moveLayer/removeLayer/setCurrentLayer/layer/currentLayer/layerCount - Initially there are three layers: "grid", "main", and "axes". The "main" layer is initially empty and set as current layer, so new plottables/items are put there. - QCustomPlot::viewport now makes the previously inaccessible viewport rect read-only-accessible (needed that for item-interface) - PNG export now allows transparent background by calling QCustomPlot::setColor(Qt::transparent) before savePng - QCPStatisticalBox outlier symbols may now be all scatter symbols, not only hardcoded circles. - perfect precision of scatter symbol/error bar drawing and clipping in both antialiased and non-antialiased mode, by introducing QCPPainter that works around some QPainter bugs/inconveniences. Further, more complex symbols like ssCrossSquare used to look crooked, now they look good. - new antialiasing control system: Each drawing element now has its own "setAntialiased" function to control whether it is drawn antialiased. - QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements can be used to override the individual settings. - Subclasses of QCPAbstractPlottable can now use the convenience functions like applyFillAntialiasingHint or applyScattersAntialiasingHint to easily make their drawing code comply with the overall antialiasing system. - QCustomPlot::setNoAntialiasingOnDrag allows greatly improved performance and responsiveness by temporarily disabling all antialiasing while the user is dragging axis ranges - QCPGraph can now show scatter symbols at data points and hide its line (see QCPGraph::setScatterStyle, setScatterSize, setScatterPixmap, setLineStyle) - Grid drawing code was sourced out from QCPAxis to QCPGrid. QCPGrid is mainly an internal class and every QCPAxis owns one. The grid interface still works through QCPAxis and hasn't changed. The separation allows the grid to be drawn on a different layer as the axes, such that e.g. a graph can be above the grid but below the axes. - QCustomPlot::hasPlottable(plottable), returns whether the QCustomPlot contains the plottable - QCustomPlot::setPlottingHint/setPlottingHints, plotting hints control details about the plotting quality/speed - export to jpg and bmp added (QCustomPlot::saveJpg/saveBmp), as well as control over compression quality for png and jpg - multi-select-modifier may now be specified with QCustomPlot::setMultiSelectModifier and is not fixed to Ctrl anymore Bugfixes: - fixed QCustomPlot ignores replot after it had size (0,0) even if size becomes valid again - on Windows, a repaint used to be delayed during dragging/zooming of a complex plot, until the drag operation was done. This was fixed, i.e. repaints are forced after a replot() call. See QCP::phForceRepaint and setPlottingHints. - when using the raster paintengine and exporting to scaled PNG, pen widths are now scaled correctly (QPainter bug workaround via QCPPainter) - PDF export now respects QCustomPlot background color (QCustomPlot::setColor), also Qt::transparent - fixed a bug on QCPBars and QCPStatisticalBox where auto-rescaling of axis would fail when all data is very small (< 1e-11) - fixed mouse event propagation bug that prevented range dragging from working on KDE (GNU/Linux) - fixed a compiler warning on 64-bit systems due to pointer cast to int instead of quintptr in a qDebug output Other: - Added support for easier shared library creation (including examples for compiling and using QCustomPlot as shared library) - QCustomPlot now has the Qt::WA_OpaquePaintEvent widget attribute (gives slightly improved performance). - QCP::aeGraphs (enum QCP::AntialiasedElement, previously QCustomPlot::aeGraphs) has been marked deprecated since version 02.02.12 and was now removed. Use QCP::aePlottables instead. - optional performance-quality-tradeoff for solid graph lines (see QCustomPlot::setPlottingHints). - marked data classes and QCPRange as Q_MOVABLE_TYPE - replaced usage of own macro FUNCNAME with Qt macro Q_FUNC_INFO - QCustomPlot now returns a minimum size hint of 50*50 #### Version released on 31.03.12 #### Changes that (might) break backward compatibility: - QCPAbstractLegendItem now inherits from QObject - mousePress, mouseMove and mouseRelease signals are now emitted before and not after any QCustomPlot processing (range dragging, selecting, etc.) Added features: - Interaction system: now allows selecting of objects like plottables, axes, legend and plot title, see QCustomPlot::setInteractions documentation - Interaction system for plottables: - setSelectable, setSelected, setSelectedPen, setSelectedBrush, selectTest on QCPAbstractPlottable and all derived plottables - setSelectionTolerance on QCustomPlot - selectedPlottables and selectedGraphs on QCustomPlot (returns the list of currently selected plottables/graphs) - Interaction system for axes: - setSelectable, setSelected, setSelectedBasePen, setSelectedTickPen, setSelectedSubTickPen, setSelectedLabelFont, setSelectedTickLabelFont, setSelectedLabelColor, setSelectedTickLabelColor, selectTest on QCPAxis - selectedAxes on QCustomPlot (returns a list of the axes that currently have selected parts) - Interaction system for legend: - setSelectable, setSelected, setSelectedBorderPen, setSelectedIconBorderPen, setSelectedBrush, setSelectedFont, setSelectedTextColor, selectedItems on QCPLegend - setSelectedFont, setSelectedTextColor, setSelectable, setSelected on QCPAbstractLegendItem - selectedLegends on QCustomPlot - Interaction system for title: - setSelectedTitleFont, setSelectedTitleColor, setTitleSelected on QCustomPlot - new signals in accordance with the interaction system: - selectionChangedByUser on QCustomPlot - selectionChanged on QCPAbstractPlottable - selectionChanged on QCPAxis - selectionChanged on QCPLegend and QCPAbstractLegendItem - plottableClick, legendClick, axisClick, titleClick, plottableDoubleClick, legendDoubleClick, axisDoubleClick, titleDoubleClick on QCustomPlot - QCustomPlot::deselectAll (deselects everything, i.e. axes and plottables) - QCPAbstractPlottable::pixelsToCoords (inverse function to the already existing coordsToPixels function) - QCPRange::contains(double value) - QCPAxis::setLabelColor and setTickLabelColor - QCustomPlot::setTitleColor - QCustomPlot now emits beforeReplot and afterReplot signals. Note that it is safe to make two customPlots mutually call eachothers replot functions in one of these slots, it will not cause an infinite loop. (usefull for synchronizing axes ranges between two customPlots, because setRange alone doesn't replot) - If the Qt version is 4.7 or greater, the tick label strings in date-time-mode now support sub-second accuracy (e.g. with format like "hh:mm:ss.zzz"). Bugfixes: - tick labels/margins should no longer oscillate by one pixel when dragging range or replotting repeatedly while changing e.g. data. This was caused by a bug in Qt's QFontMetrics::boundingRect function when the font has an integer point size (probably some rounding problem). The fix hence consists of creating a temporary font (only for bounding-box calculation) which is 0.05pt larger and thus avoiding the jittering rounding outcome. - tick label, axis label and plot title colors used to be undefined. This was fixed by providing explicit color properties. Other: - fixed some glitches in the documentation - QCustomPlot::replot and QCustomPlot::rescaleAxes are now slots #### Version released on 02.02.12 #### Changes that break backward compatibility: - renamed all secondary classes from QCustomPlot[...] to QCP[...]: QCustomPlotAxis -> QCPAxis QCustomPlotGraph -> QCPGraph QCustomPlotRange -> QCPRange QCustomPlotData -> QCPData QCustomPlotDataMap -> QCPDataMap QCustomPlotLegend -> QCPLegend QCustomPlotDataMapIterator -> QCPDataMapIterator QCustomPlotDataMutableMapIterator -> QCPDataMutableMapIterator A simple search and replace on all code files should make your code run again, e.g. consider the regex "QCustomPlot(?=[AGRDL])" -> "QCP". Make sure not to just replace "QCustomPlot" with "QCP" because the main class QCustomPlot hasn't changed to QCP. This change was necessary because class names became unhandy, pardon my bad naming decision in the beginning. - QCPAxis::tickLength() and QCPAxis::subTickLength() now each split into two functions for inward and outward ticks (tickLengthIn/tickLengthOut). - QCPLegend now uses QCPAbstractLegendItem to carry item data (before, the legend was passed QCPGraphs directly) - QCustomPlot::addGraph() now doesn't return the index of the created graph anymore, but a pointer to the created QCPGraph. - QCustomPlot::setAutoAddGraphToLegend is replaced by setAutoAddPlottableToLegend Added features: - Reversed axis range with QCPAxis::setRangeReversed(bool) - Tick labels are now only drawn if not clipped by the viewport (widget border) on the sides (e.g. left and right on a horizontal axis). - Zerolines. Like grid lines only with a separate pen (QCPAxis::setZeroLinePen), at tick position zero. - Outward ticks. QCPAxis::setTickLength/setSubTickLength now accepts two arguments for inward and outward tick length. This doesn't break backward compatibility because the second argument (outward) has default value zero and thereby a call with one argument hasn't changed its meaning. - QCPGraph now inherits from QCPAbstractPlottable - QCustomPlot::addPlottable/plottable/removePlottable/clearPlottables added to interface with the new QCPAbstractPlottable-based system. The simpler interface which only acts on QCPGraphs (addGraph, graph, removeGraph, etc.) was adapted internally and is kept for backward compatibility and ease of use. - QCPLegend items for plottables (e.g. graphs) can automatically wrap their texts to fit the widths, see QCPLegend::setMinimumSize and QCPPlottableLegendItem::setTextWrap. - QCustomPlot::rescaleAxes. Adapts axis ranges to show all plottables/graphs, by calling QCPAbstractPlottable::rescaleAxes on all plottables in the plot. - QCPCurve. For plotting of parametric curves. - QCPBars. For plotting of bar charts. - QCPStatisticalBox. For statistical box plots. Bugfixes: - Fixed QCustomPlot::removeGraph(int) not being able to remove graph index 0 - made QCustomPlot::replot() abort painting when painter initialization fails (e.g. because width/height of QCustomPlot is zero) - The distance of the axis label from the axis ignored the tick label padding, this could have caused overlapping axis labels and tick labels - fixed memory leak in QCustomPlot (dtor didn't delete legend) - fixed bug that prevented QCPAxis::setRangeLower/Upper from setting the value to exactly 0. Other: - Changed default error bar handle size (QCustomPlotGraph::setErrorBarSize) from 4 to 6. - Removed QCustomPlotDataFetcher. Was deprecated and not used class. - Extended documentation, especially class descriptions. #### Version released on 15.01.12 #### Changes that (might) break backward compatibility: - QCustomPlotGraph now inherits from QObject Added features: - Added axis background pixmap (QCustomPlot::setAxisBackground, setAxisBackgroundScaled, setAxisBackgroundScaledMode) - Added width and height parameter on PDF export function QCustomPlot::savePdf(). This now allows PDF export to have arbitrary dimensions, independent of the current geometry of the QCustomPlot. - Added overload of QCustomPlot::removeGraph that takes QCustomPlotGraph* as parameter, instead the index of the graph - Added all enums to the Qt meta system via Q_ENUMS(). The enums can now be transformed to QString values easily with the Qt meta system, which makes saving state e.g. as XML significantly nicer. - added typedef QMapIterator QCustomPlotDataMapIterator and typedef QMutableMapIterator QCustomPlotDataMutableMapIterator for improved information hiding, when using iterators outside QCustomPlot code Bugfixes: - Fixed savePngScaled. Axis/label drawing functions used to reset the painter transform and thereby break savePngScaled. Now they buffer the current transform and restore it afterwards. - Fixed some glitches in the doxygen comments (affects documentation only) Other: - Changed the default tickLabelPadding of top axis from 3 to 6 pixels. Looks better. - Changed the default QCustomPlot::setAntialiasedElements setting: Graph fills are now antialiased by default. That's a bit slower, but makes fill borders look better. #### Version released on 19.11.11 #### Changes that break backward compatibility: - QCustomPlotAxis: tickFont and setTickFont renamed to tickLabelFont and setTickLabelFont (for naming consistency) Other: - QCustomPlotAxis: Added rotated tick labels, see setTickLabelRotation sqlitebrowser-3.10.1/libs/qcustomplot-source/qcustomplot.cpp000066400000000000000000041512311316047212700244320ustar00rootroot00000000000000/*************************************************************************** ** ** ** QCustomPlot, an easy to use, modern plotting widget for Qt ** ** Copyright (C) 2011-2016 Emanuel Eichhammer ** ** ** ** 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 http://www.gnu.org/licenses/. ** ** ** **************************************************************************** ** Author: Emanuel Eichhammer ** ** Website/Contact: http://www.qcustomplot.com/ ** ** Date: 13.09.16 ** ** Version: 2.0.0-beta ** ****************************************************************************/ #include "qcustomplot.h" /* including file 'src/vector2d.cpp', size 7340 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPVector2D //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPVector2D \brief Represents two doubles as a mathematical 2D vector This class acts as a replacement for QVector2D with the advantage of double precision instead of single, and some convenience methods tailored for the QCustomPlot library. */ /* start documentation of inline functions */ /*! \fn void QCPVector2D::setX(double x) Sets the x coordinate of this vector to \a x. \see setY */ /*! \fn void QCPVector2D::setY(double y) Sets the y coordinate of this vector to \a y. \see setX */ /*! \fn double QCPVector2D::length() const Returns the length of this vector. \see lengthSquared */ /*! \fn double QCPVector2D::lengthSquared() const Returns the squared length of this vector. In some situations, e.g. when just trying to find the shortest vector of a group, this is faster than calculating \ref length, because it avoids calculation of a square root. \see length */ /*! \fn QPoint QCPVector2D::toPoint() const Returns a QPoint which has the x and y coordinates of this vector, truncating any floating point information. \see toPointF */ /*! \fn QPointF QCPVector2D::toPointF() const Returns a QPointF which has the x and y coordinates of this vector. \see toPoint */ /*! \fn bool QCPVector2D::isNull() const Returns whether this vector is null. A vector is null if \c qIsNull returns true for both x and y coordinates, i.e. if both are binary equal to 0. */ /*! \fn QCPVector2D QCPVector2D::perpendicular() const Returns a vector perpendicular to this vector, with the same length. */ /*! \fn double QCPVector2D::dot() const Returns the dot/scalar product of this vector with the specified vector \a vec. */ /* end documentation of inline functions */ /*! Creates a QCPVector2D object and initializes the x and y coordinates to 0. */ QCPVector2D::QCPVector2D() : mX(0), mY(0) { } /*! Creates a QCPVector2D object and initializes the \a x and \a y coordinates with the specified values. */ QCPVector2D::QCPVector2D(double x, double y) : mX(x), mY(y) { } /*! Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified \a point. */ QCPVector2D::QCPVector2D(const QPoint &point) : mX(point.x()), mY(point.y()) { } /*! Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified \a point. */ QCPVector2D::QCPVector2D(const QPointF &point) : mX(point.x()), mY(point.y()) { } /*! Normalizes this vector. After this operation, the length of the vector is equal to 1. \see normalized, length, lengthSquared */ void QCPVector2D::normalize() { double len = length(); mX /= len; mY /= len; } /*! Returns a normalized version of this vector. The length of the returned vector is equal to 1. \see normalize, length, lengthSquared */ QCPVector2D QCPVector2D::normalized() const { QCPVector2D result(mX, mY); result.normalize(); return result; } /*! \overload Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by \a start and \a end. \see distanceToStraightLine */ double QCPVector2D::distanceSquaredToLine(const QCPVector2D &start, const QCPVector2D &end) const { QCPVector2D v(end-start); double vLengthSqr = v.lengthSquared(); if (!qFuzzyIsNull(vLengthSqr)) { double mu = v.dot(*this-start)/vLengthSqr; if (mu < 0) return (*this-start).lengthSquared(); else if (mu > 1) return (*this-end).lengthSquared(); else return ((start + mu*v)-*this).lengthSquared(); } else return (*this-start).lengthSquared(); } /*! \overload Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by \a line. \see distanceToStraightLine */ double QCPVector2D::distanceSquaredToLine(const QLineF &line) const { return distanceSquaredToLine(QCPVector2D(line.p1()), QCPVector2D(line.p2())); } /*! Returns the shortest distance of this vector (interpreted as a point) to the infinite straight line given by a \a base point and a \a direction vector. \see distanceSquaredToLine */ double QCPVector2D::distanceToStraightLine(const QCPVector2D &base, const QCPVector2D &direction) const { return qAbs((*this-base).dot(direction.perpendicular()))/direction.length(); } /*! Scales this vector by the given \a factor, i.e. the x and y components are multiplied by \a factor. */ QCPVector2D &QCPVector2D::operator*=(double factor) { mX *= factor; mY *= factor; return *this; } /*! Scales this vector by the given \a divisor, i.e. the x and y components are divided by \a divisor. */ QCPVector2D &QCPVector2D::operator/=(double divisor) { mX /= divisor; mY /= divisor; return *this; } /*! Adds the given \a vector to this vector component-wise. */ QCPVector2D &QCPVector2D::operator+=(const QCPVector2D &vector) { mX += vector.mX; mY += vector.mY; return *this; } /*! subtracts the given \a vector from this vector component-wise. */ QCPVector2D &QCPVector2D::operator-=(const QCPVector2D &vector) { mX -= vector.mX; mY -= vector.mY; return *this; } /* end of 'src/vector2d.cpp' */ /* including file 'src/painter.cpp', size 8670 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPainter //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPPainter \brief QPainter subclass used internally This QPainter subclass is used to provide some extended functionality e.g. for tweaking position consistency between antialiased and non-antialiased painting. Further it provides workarounds for QPainter quirks. \warning This class intentionally hides non-virtual functions of QPainter, e.g. setPen, save and restore. So while it is possible to pass a QCPPainter instance to a function that expects a QPainter pointer, some of the workarounds and tweaks will be unavailable to the function (because it will call the base class implementations of the functions actually hidden by QCPPainter). */ /*! Creates a new QCPPainter instance and sets default values */ QCPPainter::QCPPainter() : QPainter(), mModes(pmDefault), mIsAntialiasing(false) { // don't setRenderHint(QPainter::NonCosmeticDefautPen) here, because painter isn't active yet and // a call to begin() will follow } /*! Creates a new QCPPainter instance on the specified paint \a device and sets default values. Just like the analogous QPainter constructor, begins painting on \a device immediately. Like \ref begin, this method sets QPainter::NonCosmeticDefaultPen in Qt versions before Qt5. */ QCPPainter::QCPPainter(QPaintDevice *device) : QPainter(device), mModes(pmDefault), mIsAntialiasing(false) { #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // before Qt5, default pens used to be cosmetic if NonCosmeticDefaultPen flag isn't set. So we set it to get consistency across Qt versions. if (isActive()) setRenderHint(QPainter::NonCosmeticDefaultPen); #endif } /*! Sets the pen of the painter and applies certain fixes to it, depending on the mode of this QCPPainter. \note this function hides the non-virtual base class implementation. */ void QCPPainter::setPen(const QPen &pen) { QPainter::setPen(pen); if (mModes.testFlag(pmNonCosmetic)) makeNonCosmetic(); } /*! \overload Sets the pen (by color) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter. \note this function hides the non-virtual base class implementation. */ void QCPPainter::setPen(const QColor &color) { QPainter::setPen(color); if (mModes.testFlag(pmNonCosmetic)) makeNonCosmetic(); } /*! \overload Sets the pen (by style) of the painter and applies certain fixes to it, depending on the mode of this QCPPainter. \note this function hides the non-virtual base class implementation. */ void QCPPainter::setPen(Qt::PenStyle penStyle) { QPainter::setPen(penStyle); if (mModes.testFlag(pmNonCosmetic)) makeNonCosmetic(); } /*! \overload Works around a Qt bug introduced with Qt 4.8 which makes drawing QLineF unpredictable when antialiasing is disabled. Thus when antialiasing is disabled, it rounds the \a line to integer coordinates and then passes it to the original drawLine. \note this function hides the non-virtual base class implementation. */ void QCPPainter::drawLine(const QLineF &line) { if (mIsAntialiasing || mModes.testFlag(pmVectorized)) QPainter::drawLine(line); else QPainter::drawLine(line.toLine()); } /*! Sets whether painting uses antialiasing or not. Use this method instead of using setRenderHint with QPainter::Antialiasing directly, as it allows QCPPainter to regain pixel exactness between antialiased and non-antialiased painting (Since Qt < 5.0 uses slightly different coordinate systems for AA/Non-AA painting). */ void QCPPainter::setAntialiasing(bool enabled) { setRenderHint(QPainter::Antialiasing, enabled); if (mIsAntialiasing != enabled) { mIsAntialiasing = enabled; if (!mModes.testFlag(pmVectorized)) // antialiasing half-pixel shift only needed for rasterized outputs { if (mIsAntialiasing) translate(0.5, 0.5); else translate(-0.5, -0.5); } } } /*! Sets the mode of the painter. This controls whether the painter shall adjust its fixes/workarounds optimized for certain output devices. */ void QCPPainter::setModes(QCPPainter::PainterModes modes) { mModes = modes; } /*! Sets the QPainter::NonCosmeticDefaultPen in Qt versions before Qt5 after beginning painting on \a device. This is necessary to get cosmetic pen consistency across Qt versions, because since Qt5, all pens are non-cosmetic by default, and in Qt4 this render hint must be set to get that behaviour. The Constructor \ref QCPPainter(QPaintDevice *device) which directly starts painting also sets the render hint as appropriate. \note this function hides the non-virtual base class implementation. */ bool QCPPainter::begin(QPaintDevice *device) { bool result = QPainter::begin(device); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) // before Qt5, default pens used to be cosmetic if NonCosmeticDefaultPen flag isn't set. So we set it to get consistency across Qt versions. if (result) setRenderHint(QPainter::NonCosmeticDefaultPen); #endif return result; } /*! \overload Sets the mode of the painter. This controls whether the painter shall adjust its fixes/workarounds optimized for certain output devices. */ void QCPPainter::setMode(QCPPainter::PainterMode mode, bool enabled) { if (!enabled && mModes.testFlag(mode)) mModes &= ~mode; else if (enabled && !mModes.testFlag(mode)) mModes |= mode; } /*! Saves the painter (see QPainter::save). Since QCPPainter adds some new internal state to QPainter, the save/restore functions are reimplemented to also save/restore those members. \note this function hides the non-virtual base class implementation. \see restore */ void QCPPainter::save() { mAntialiasingStack.push(mIsAntialiasing); QPainter::save(); } /*! Restores the painter (see QPainter::restore). Since QCPPainter adds some new internal state to QPainter, the save/restore functions are reimplemented to also save/restore those members. \note this function hides the non-virtual base class implementation. \see save */ void QCPPainter::restore() { if (!mAntialiasingStack.isEmpty()) mIsAntialiasing = mAntialiasingStack.pop(); else qDebug() << Q_FUNC_INFO << "Unbalanced save/restore"; QPainter::restore(); } /*! Changes the pen width to 1 if it currently is 0. This function is called in the \ref setPen overrides when the \ref pmNonCosmetic mode is set. */ void QCPPainter::makeNonCosmetic() { if (qFuzzyIsNull(pen().widthF())) { QPen p = pen(); p.setWidth(1); QPainter::setPen(p); } } /* end of 'src/painter.cpp' */ /* including file 'src/paintbuffer.cpp', size 18502 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAbstractPaintBuffer //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAbstractPaintBuffer \brief The abstract base class for paint buffers, which define the rendering backend This abstract base class defines the basic interface that a paint buffer needs to provide in order to be usable by QCustomPlot. A paint buffer manages both a surface to draw onto, and the matching paint device. The size of the surface can be changed via \ref setSize. External classes (\ref QCustomPlot and \ref QCPLayer) request a painter via \ref startPainting and then perform the draw calls. Once the painting is complete, \ref donePainting is called, so the paint buffer implementation can do clean up if necessary. Before rendering a frame, each paint buffer is usually filled with a color using \ref clear (usually the color is \c Qt::transparent), to remove the contents of the previous frame. The simplest paint buffer implementation is \ref QCPPaintBufferPixmap which allows regular software rendering via the raster engine. Hardware accelerated rendering via pixel buffers and frame buffer objects is provided by \ref QCPPaintBufferGlPbuffer and \ref QCPPaintBufferGlFbo. They are used automatically if \ref QCustomPlot::setOpenGl is enabled. */ /* start documentation of pure virtual functions */ /*! \fn virtual QCPPainter *QCPAbstractPaintBuffer::startPainting() = 0 Returns a \ref QCPPainter which is ready to draw to this buffer. The ownership and thus the responsibility to delete the painter after the painting operations are complete is given to the caller of this method. Once you are done using the painter, delete the painter and call \ref donePainting. While a painter generated with this method is active, you must not call \ref setSize, \ref setDevicePixelRatio or \ref clear. This method may return 0, if a painter couldn't be activated on the buffer. This usually indicates a problem with the respective painting backend. */ /*! \fn virtual void QCPAbstractPaintBuffer::draw(QCPPainter *painter) const = 0 Draws the contents of this buffer with the provided \a painter. This is the method that is used to finally join all paint buffers and draw them onto the screen. */ /*! \fn virtual void QCPAbstractPaintBuffer::clear(const QColor &color) = 0 Fills the entire buffer with the provided \a color. To have an empty transparent buffer, use the named color \c Qt::transparent. This method must not be called if there is currently a painter (acquired with \ref startPainting) active. */ /*! \fn virtual void QCPAbstractPaintBuffer::reallocateBuffer() = 0 Reallocates the internal buffer with the currently configured size (\ref setSize) and device pixel ratio, if applicable (\ref setDevicePixelRatio). It is called as soon as any of those properties are changed on this paint buffer. \note Subclasses of \ref QCPAbstractPaintBuffer must call their reimplementation of this method in their constructor, to perform the first allocation (this can not be done by the base class because calling pure virtual methods in base class constructors is not possible). */ /* end documentation of pure virtual functions */ /* start documentation of inline functions */ /*! \fn virtual void QCPAbstractPaintBuffer::donePainting() If you have acquired a \ref QCPPainter to paint onto this paint buffer via \ref startPainting, call this method as soon as you are done with the painting operations and have deleted the painter. paint buffer subclasses may use this method to perform any type of cleanup that is necessary. The default implementation does nothing. */ /* end documentation of inline functions */ /*! Creates a paint buffer and initializes it with the provided \a size and \a devicePixelRatio. Subclasses must call their \ref reallocateBuffer implementation in their respective constructors. */ QCPAbstractPaintBuffer::QCPAbstractPaintBuffer(const QSize &size, double devicePixelRatio) : mSize(size), mDevicePixelRatio(devicePixelRatio), mInvalidated(true) { } QCPAbstractPaintBuffer::~QCPAbstractPaintBuffer() { } /*! Sets the paint buffer size. The buffer is reallocated (by calling \ref reallocateBuffer), so any painters that were obtained by \ref startPainting are invalidated and must not be used after calling this method. If \a size is already the current buffer size, this method does nothing. */ void QCPAbstractPaintBuffer::setSize(const QSize &size) { if (mSize != size) { mSize = size; reallocateBuffer(); } } /*! Sets the invalidated flag to \a invalidated. This mechanism is used internally in conjunction with isolated replotting of \ref QCPLayer instances (in \ref QCPLayer::lmBuffered mode). If \ref QCPLayer::replot is called on a buffered layer, i.e. an isolated repaint of only that layer (and its dedicated paint buffer) is requested, QCustomPlot will decide depending on the invalidated flags of other paint buffers whether it also replots them, instead of only the layer on which the replot was called. The invalidated flag is set to true when \ref QCPLayer association has changed, i.e. if layers were added or removed from this buffer, or if they were reordered. It is set to false as soon as all associated \ref QCPLayer instances are drawn onto the buffer. Under normal circumstances, it is not necessary to manually call this method. */ void QCPAbstractPaintBuffer::setInvalidated(bool invalidated) { mInvalidated = invalidated; } /*! Sets the the device pixel ratio to \a ratio. This is useful to render on high-DPI output devices. The ratio is automatically set to the device pixel ratio used by the parent QCustomPlot instance. The buffer is reallocated (by calling \ref reallocateBuffer), so any painters that were obtained by \ref startPainting are invalidated and must not be used after calling this method. \note This method is only available for Qt versions 5.4 and higher. */ void QCPAbstractPaintBuffer::setDevicePixelRatio(double ratio) { if (!qFuzzyCompare(ratio, mDevicePixelRatio)) { #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED mDevicePixelRatio = ratio; reallocateBuffer(); #else qDebug() << Q_FUNC_INFO << "Device pixel ratios not supported for Qt versions before 5.4"; mDevicePixelRatio = 1.0; #endif } } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPaintBufferPixmap //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPPaintBufferPixmap \brief A paint buffer based on QPixmap, using software raster rendering This paint buffer is the default and fall-back paint buffer which uses software rendering and QPixmap as internal buffer. It is used if \ref QCustomPlot::setOpenGl is false. */ /*! Creates a pixmap paint buffer instancen with the specified \a size and \a devicePixelRatio, if applicable. */ QCPPaintBufferPixmap::QCPPaintBufferPixmap(const QSize &size, double devicePixelRatio) : QCPAbstractPaintBuffer(size, devicePixelRatio) { QCPPaintBufferPixmap::reallocateBuffer(); } QCPPaintBufferPixmap::~QCPPaintBufferPixmap() { } /* inherits documentation from base class */ QCPPainter *QCPPaintBufferPixmap::startPainting() { QCPPainter *result = new QCPPainter(&mBuffer); result->setRenderHint(QPainter::HighQualityAntialiasing); return result; } /* inherits documentation from base class */ void QCPPaintBufferPixmap::draw(QCPPainter *painter) const { if (painter && painter->isActive()) painter->drawPixmap(0, 0, mBuffer); else qDebug() << Q_FUNC_INFO << "invalid or inactive painter passed"; } /* inherits documentation from base class */ void QCPPaintBufferPixmap::clear(const QColor &color) { mBuffer.fill(color); } /* inherits documentation from base class */ void QCPPaintBufferPixmap::reallocateBuffer() { setInvalidated(); if (!qFuzzyCompare(1.0, mDevicePixelRatio)) { #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED mBuffer = QPixmap(mSize*mDevicePixelRatio); mBuffer.setDevicePixelRatio(mDevicePixelRatio); #else qDebug() << Q_FUNC_INFO << "Device pixel ratios not supported for Qt versions before 5.4"; mDevicePixelRatio = 1.0; mBuffer = QPixmap(mSize); #endif } else { mBuffer = QPixmap(mSize); } } #ifdef QCP_OPENGL_PBUFFER //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPaintBufferGlPbuffer //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPPaintBufferGlPbuffer \brief A paint buffer based on OpenGL pixel buffers, using hardware accelerated rendering This paint buffer is one of the OpenGL paint buffers which facilitate hardware accelerated plot rendering. It is based on OpenGL pixel buffers (pbuffer) and is used in Qt versions before 5.0. (See \ref QCPPaintBufferGlFbo used in newer Qt versions.) The OpenGL paint buffers are used if \ref QCustomPlot::setOpenGl is set to true, and if they are supported by the system. */ /*! Creates a \ref QCPPaintBufferGlPbuffer instance with the specified \a size and \a devicePixelRatio, if applicable. The parameter \a multisamples defines how many samples are used per pixel. Higher values thus result in higher quality antialiasing. If the specified \a multisamples value exceeds the capability of the graphics hardware, the highest supported multisampling is used. */ QCPPaintBufferGlPbuffer::QCPPaintBufferGlPbuffer(const QSize &size, double devicePixelRatio, int multisamples) : QCPAbstractPaintBuffer(size, devicePixelRatio), mGlPBuffer(0), mMultisamples(qMax(0, multisamples)) { QCPPaintBufferGlPbuffer::reallocateBuffer(); } QCPPaintBufferGlPbuffer::~QCPPaintBufferGlPbuffer() { if (mGlPBuffer) delete mGlPBuffer; } /* inherits documentation from base class */ QCPPainter *QCPPaintBufferGlPbuffer::startPainting() { if (!mGlPBuffer->isValid()) { qDebug() << Q_FUNC_INFO << "OpenGL frame buffer object doesn't exist, reallocateBuffer was not called?"; return 0; } QCPPainter *result = new QCPPainter(mGlPBuffer); result->setRenderHint(QPainter::HighQualityAntialiasing); return result; } /* inherits documentation from base class */ void QCPPaintBufferGlPbuffer::draw(QCPPainter *painter) const { if (!painter || !painter->isActive()) { qDebug() << Q_FUNC_INFO << "invalid or inactive painter passed"; return; } if (!mGlPBuffer->isValid()) { qDebug() << Q_FUNC_INFO << "OpenGL pbuffer isn't valid, reallocateBuffer was not called?"; return; } painter->drawImage(0, 0, mGlPBuffer->toImage()); } /* inherits documentation from base class */ void QCPPaintBufferGlPbuffer::clear(const QColor &color) { if (mGlPBuffer->isValid()) { mGlPBuffer->makeCurrent(); glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF()); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); mGlPBuffer->doneCurrent(); } else qDebug() << Q_FUNC_INFO << "OpenGL pbuffer invalid or context not current"; } /* inherits documentation from base class */ void QCPPaintBufferGlPbuffer::reallocateBuffer() { if (mGlPBuffer) delete mGlPBuffer; QGLFormat format; format.setAlpha(true); format.setSamples(mMultisamples); mGlPBuffer = new QGLPixelBuffer(mSize, format); } #endif // QCP_OPENGL_PBUFFER #ifdef QCP_OPENGL_FBO //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPaintBufferGlFbo //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPPaintBufferGlFbo \brief A paint buffer based on OpenGL frame buffers objects, using hardware accelerated rendering This paint buffer is one of the OpenGL paint buffers which facilitate hardware accelerated plot rendering. It is based on OpenGL frame buffer objects (fbo) and is used in Qt versions 5.0 and higher. (See \ref QCPPaintBufferGlPbuffer used in older Qt versions.) The OpenGL paint buffers are used if \ref QCustomPlot::setOpenGl is set to true, and if they are supported by the system. */ /*! Creates a \ref QCPPaintBufferGlFbo instance with the specified \a size and \a devicePixelRatio, if applicable. All frame buffer objects shall share one OpenGL context and paint device, which need to be set up externally and passed via \a glContext and \a glPaintDevice. The set-up is done in \ref QCustomPlot::setupOpenGl and the context and paint device are managed by the parent QCustomPlot instance. */ QCPPaintBufferGlFbo::QCPPaintBufferGlFbo(const QSize &size, double devicePixelRatio, QWeakPointer glContext, QWeakPointer glPaintDevice) : QCPAbstractPaintBuffer(size, devicePixelRatio), mGlContext(glContext), mGlPaintDevice(glPaintDevice), mGlFrameBuffer(0) { QCPPaintBufferGlFbo::reallocateBuffer(); } QCPPaintBufferGlFbo::~QCPPaintBufferGlFbo() { if (mGlFrameBuffer) delete mGlFrameBuffer; } /* inherits documentation from base class */ QCPPainter *QCPPaintBufferGlFbo::startPainting() { if (mGlPaintDevice.isNull()) { qDebug() << Q_FUNC_INFO << "OpenGL paint device doesn't exist"; return 0; } if (!mGlFrameBuffer) { qDebug() << Q_FUNC_INFO << "OpenGL frame buffer object doesn't exist, reallocateBuffer was not called?"; return 0; } if (QOpenGLContext::currentContext() != mGlContext.data()) mGlContext.data()->makeCurrent(mGlContext.data()->surface()); mGlFrameBuffer->bind(); QCPPainter *result = new QCPPainter(mGlPaintDevice.data()); result->setRenderHint(QPainter::HighQualityAntialiasing); return result; } /* inherits documentation from base class */ void QCPPaintBufferGlFbo::donePainting() { if (mGlFrameBuffer && mGlFrameBuffer->isBound()) mGlFrameBuffer->release(); else qDebug() << Q_FUNC_INFO << "Either OpenGL frame buffer not valid or was not bound"; } /* inherits documentation from base class */ void QCPPaintBufferGlFbo::draw(QCPPainter *painter) const { if (!painter || !painter->isActive()) { qDebug() << Q_FUNC_INFO << "invalid or inactive painter passed"; return; } if (!mGlFrameBuffer) { qDebug() << Q_FUNC_INFO << "OpenGL frame buffer object doesn't exist, reallocateBuffer was not called?"; return; } painter->drawImage(0, 0, mGlFrameBuffer->toImage()); } /* inherits documentation from base class */ void QCPPaintBufferGlFbo::clear(const QColor &color) { if (mGlContext.isNull()) { qDebug() << Q_FUNC_INFO << "OpenGL context doesn't exist"; return; } if (!mGlFrameBuffer) { qDebug() << Q_FUNC_INFO << "OpenGL frame buffer object doesn't exist, reallocateBuffer was not called?"; return; } if (QOpenGLContext::currentContext() != mGlContext.data()) mGlContext.data()->makeCurrent(mGlContext.data()->surface()); mGlFrameBuffer->bind(); glClearColor(color.redF(), color.greenF(), color.blueF(), color.alphaF()); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); mGlFrameBuffer->release(); } /* inherits documentation from base class */ void QCPPaintBufferGlFbo::reallocateBuffer() { // release and delete possibly existing framebuffer: if (mGlFrameBuffer) { if (mGlFrameBuffer->isBound()) mGlFrameBuffer->release(); delete mGlFrameBuffer; mGlFrameBuffer = 0; } if (mGlContext.isNull()) { qDebug() << Q_FUNC_INFO << "OpenGL context doesn't exist"; return; } if (mGlPaintDevice.isNull()) { qDebug() << Q_FUNC_INFO << "OpenGL paint device doesn't exist"; return; } // create new fbo with appropriate size: mGlContext.data()->makeCurrent(mGlContext.data()->surface()); QOpenGLFramebufferObjectFormat frameBufferFormat; frameBufferFormat.setSamples(mGlContext.data()->format().samples()); frameBufferFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil); mGlFrameBuffer = new QOpenGLFramebufferObject(mSize*mDevicePixelRatio, frameBufferFormat); if (mGlPaintDevice.data()->size() != mSize*mDevicePixelRatio) mGlPaintDevice.data()->setSize(mSize*mDevicePixelRatio); #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED mGlPaintDevice.data()->setDevicePixelRatio(mDevicePixelRatio); #endif } #endif // QCP_OPENGL_FBO /* end of 'src/paintbuffer.cpp' */ /* including file 'src/layer.cpp', size 37064 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPLayer //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPLayer \brief A layer that may contain objects, to control the rendering order The Layering system of QCustomPlot is the mechanism to control the rendering order of the elements inside the plot. It is based on the two classes QCPLayer and QCPLayerable. QCustomPlot holds an ordered list of one or more instances of QCPLayer (see QCustomPlot::addLayer, QCustomPlot::layer, QCustomPlot::moveLayer, etc.). When replotting, QCustomPlot goes through the list of layers bottom to top and successively draws the layerables of the layers into the paint buffer(s). A QCPLayer contains an ordered list of QCPLayerable instances. QCPLayerable is an abstract base class from which almost all visible objects derive, like axes, grids, graphs, items, etc. \section qcplayer-defaultlayers Default layers Initially, QCustomPlot has six layers: "background", "grid", "main", "axes", "legend" and "overlay" (in that order). On top is the "overlay" layer, which only contains the QCustomPlot's selection rect (\ref QCustomPlot::selectionRect). The next two layers "axes" and "legend" contain the default axes and legend, so they will be drawn above plottables. In the middle, there is the "main" layer. It is initially empty and set as the current layer (see QCustomPlot::setCurrentLayer). This means, all new plottables, items etc. are created on this layer by default. Then comes the "grid" layer which contains the QCPGrid instances (which belong tightly to QCPAxis, see \ref QCPAxis::grid). The Axis rect background shall be drawn behind everything else, thus the default QCPAxisRect instance is placed on the "background" layer. Of course, the layer affiliation of the individual objects can be changed as required (\ref QCPLayerable::setLayer). \section qcplayer-ordering Controlling the rendering order via layers Controlling the ordering of layerables in the plot is easy: Create a new layer in the position you want the layerable to be in, e.g. above "main", with \ref QCustomPlot::addLayer. Then set the current layer with \ref QCustomPlot::setCurrentLayer to that new layer and finally create the objects normally. They will be placed on the new layer automatically, due to the current layer setting. Alternatively you could have also ignored the current layer setting and just moved the objects with \ref QCPLayerable::setLayer to the desired layer after creating them. It is also possible to move whole layers. For example, If you want the grid to be shown in front of all plottables/items on the "main" layer, just move it above "main" with QCustomPlot::moveLayer. The rendering order within one layer is simply by order of creation or insertion. The item created last (or added last to the layer), is drawn on top of all other objects on that layer. When a layer is deleted, the objects on it are not deleted with it, but fall on the layer below the deleted layer, see QCustomPlot::removeLayer. \section qcplayer-buffering Replotting only a specific layer If the layer mode (\ref setMode) is set to \ref lmBuffered, you can replot only this specific layer by calling \ref replot. In certain situations this can provide better replot performance, compared with a full replot of all layers. Upon creation of a new layer, the layer mode is initialized to \ref lmLogical. The only layer that is set to \ref lmBuffered in a new \ref QCustomPlot instance is the "overlay" layer, containing the selection rect. */ /* start documentation of inline functions */ /*! \fn QList QCPLayer::children() const Returns a list of all layerables on this layer. The order corresponds to the rendering order: layerables with higher indices are drawn above layerables with lower indices. */ /*! \fn int QCPLayer::index() const Returns the index this layer has in the QCustomPlot. The index is the integer number by which this layer can be accessed via \ref QCustomPlot::layer. Layers with higher indices will be drawn above layers with lower indices. */ /* end documentation of inline functions */ /*! Creates a new QCPLayer instance. Normally you shouldn't directly instantiate layers, use \ref QCustomPlot::addLayer instead. \warning It is not checked that \a layerName is actually a unique layer name in \a parentPlot. This check is only performed by \ref QCustomPlot::addLayer. */ QCPLayer::QCPLayer(QCustomPlot *parentPlot, const QString &layerName) : QObject(parentPlot), mParentPlot(parentPlot), mName(layerName), mIndex(-1), // will be set to a proper value by the QCustomPlot layer creation function mVisible(true), mMode(lmLogical) { // Note: no need to make sure layerName is unique, because layer // management is done with QCustomPlot functions. } QCPLayer::~QCPLayer() { // If child layerables are still on this layer, detach them, so they don't try to reach back to this // then invalid layer once they get deleted/moved themselves. This only happens when layers are deleted // directly, like in the QCustomPlot destructor. (The regular layer removal procedure for the user is to // call QCustomPlot::removeLayer, which moves all layerables off this layer before deleting it.) while (!mChildren.isEmpty()) mChildren.last()->setLayer(0); // removes itself from mChildren via removeChild() if (mParentPlot->currentLayer() == this) qDebug() << Q_FUNC_INFO << "The parent plot's mCurrentLayer will be a dangling pointer. Should have been set to a valid layer or 0 beforehand."; } /*! Sets whether this layer is visible or not. If \a visible is set to false, all layerables on this layer will be invisible. This function doesn't change the visibility property of the layerables (\ref QCPLayerable::setVisible), but the \ref QCPLayerable::realVisibility of each layerable takes the visibility of the parent layer into account. */ void QCPLayer::setVisible(bool visible) { mVisible = visible; } /*! Sets the rendering mode of this layer. If \a mode is set to \ref lmBuffered for a layer, it will be given a dedicated paint buffer by the parent QCustomPlot instance. This means it may be replotted individually by calling \ref QCPLayer::replot, without needing to replot all other layers. Layers which are set to \ref lmLogical (the default) are used only to define the rendering order and can't be replotted individually. Note that each layer which is set to \ref lmBuffered requires additional paint buffers for the layers below, above and for the layer itself. This increases the memory consumption and (slightly) decreases the repainting speed because multiple paint buffers need to be joined. So you should carefully choose which layers benefit from having their own paint buffer. A typical example would be a layer which contains certain layerables (e.g. items) that need to be changed and thus replotted regularly, while all other layerables on other layers stay static. By default, only the topmost layer called "overlay" is in mode \ref lmBuffered, and contains the selection rect. \see replot */ void QCPLayer::setMode(QCPLayer::LayerMode mode) { if (mMode != mode) { mMode = mode; if (!mPaintBuffer.isNull()) mPaintBuffer.data()->setInvalidated(); } } /*! \internal Draws the contents of this layer with the provided \a painter. \see replot, drawToPaintBuffer */ void QCPLayer::draw(QCPPainter *painter) { foreach (QCPLayerable *child, mChildren) { if (child->realVisibility()) { painter->save(); painter->setClipRect(child->clipRect().translated(0, -1)); child->applyDefaultAntialiasingHint(painter); child->draw(painter); painter->restore(); } } } /*! \internal Draws the contents of this layer into the paint buffer which is associated with this layer. The association is established by the parent QCustomPlot, which manages all paint buffers (see \ref QCustomPlot::setupPaintBuffers). \see draw */ void QCPLayer::drawToPaintBuffer() { if (!mPaintBuffer.isNull()) { if (QCPPainter *painter = mPaintBuffer.data()->startPainting()) { if (painter->isActive()) draw(painter); else qDebug() << Q_FUNC_INFO << "paint buffer returned inactive painter"; delete painter; mPaintBuffer.data()->donePainting(); } else qDebug() << Q_FUNC_INFO << "paint buffer returned zero painter"; } else qDebug() << Q_FUNC_INFO << "no valid paint buffer associated with this layer"; } /*! If the layer mode (\ref setMode) is set to \ref lmBuffered, this method allows replotting only the layerables on this specific layer, without the need to replot all other layers (as a call to \ref QCustomPlot::replot would do). If the layer mode is \ref lmLogical however, this method simply calls \ref QCustomPlot::replot on the parent QCustomPlot instance. QCustomPlot also makes sure to replot all layers instead of only this one, if the layer ordering has changed since the last full replot and the other paint buffers were thus invalidated. \see draw */ void QCPLayer::replot() { if (mMode == lmBuffered && !mParentPlot->hasInvalidatedPaintBuffers()) { if (!mPaintBuffer.isNull()) { mPaintBuffer.data()->clear(Qt::transparent); drawToPaintBuffer(); mPaintBuffer.data()->setInvalidated(false); mParentPlot->update(); } else qDebug() << Q_FUNC_INFO << "no valid paint buffer associated with this layer"; } else if (mMode == lmLogical) mParentPlot->replot(); } /*! \internal Adds the \a layerable to the list of this layer. If \a prepend is set to true, the layerable will be prepended to the list, i.e. be drawn beneath the other layerables already in the list. This function does not change the \a mLayer member of \a layerable to this layer. (Use QCPLayerable::setLayer to change the layer of an object, not this function.) \see removeChild */ void QCPLayer::addChild(QCPLayerable *layerable, bool prepend) { if (!mChildren.contains(layerable)) { if (prepend) mChildren.prepend(layerable); else mChildren.append(layerable); if (!mPaintBuffer.isNull()) mPaintBuffer.data()->setInvalidated(); } else qDebug() << Q_FUNC_INFO << "layerable is already child of this layer" << reinterpret_cast(layerable); } /*! \internal Removes the \a layerable from the list of this layer. This function does not change the \a mLayer member of \a layerable. (Use QCPLayerable::setLayer to change the layer of an object, not this function.) \see addChild */ void QCPLayer::removeChild(QCPLayerable *layerable) { if (mChildren.removeOne(layerable)) { if (!mPaintBuffer.isNull()) mPaintBuffer.data()->setInvalidated(); } else qDebug() << Q_FUNC_INFO << "layerable is not child of this layer" << reinterpret_cast(layerable); } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPLayerable //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPLayerable \brief Base class for all drawable objects This is the abstract base class most visible objects derive from, e.g. plottables, axes, grid etc. Every layerable is on a layer (QCPLayer) which allows controlling the rendering order by stacking the layers accordingly. For details about the layering mechanism, see the QCPLayer documentation. */ /* start documentation of inline functions */ /*! \fn QCPLayerable *QCPLayerable::parentLayerable() const Returns the parent layerable of this layerable. The parent layerable is used to provide visibility hierarchies in conjunction with the method \ref realVisibility. This way, layerables only get drawn if their parent layerables are visible, too. Note that a parent layerable is not necessarily also the QObject parent for memory management. Further, a layerable doesn't always have a parent layerable, so this function may return 0. A parent layerable is set implicitly when placed inside layout elements and doesn't need to be set manually by the user. */ /* end documentation of inline functions */ /* start documentation of pure virtual functions */ /*! \fn virtual void QCPLayerable::applyDefaultAntialiasingHint(QCPPainter *painter) const = 0 \internal This function applies the default antialiasing setting to the specified \a painter, using the function \ref applyAntialiasingHint. It is the antialiasing state the painter is put in, when \ref draw is called on the layerable. If the layerable has multiple entities whose antialiasing setting may be specified individually, this function should set the antialiasing state of the most prominent entity. In this case however, the \ref draw function usually calls the specialized versions of this function before drawing each entity, effectively overriding the setting of the default antialiasing hint. First example: QCPGraph has multiple entities that have an antialiasing setting: The graph line, fills and scatters. Those can be configured via QCPGraph::setAntialiased, QCPGraph::setAntialiasedFill and QCPGraph::setAntialiasedScatters. Consequently, there isn't only the QCPGraph::applyDefaultAntialiasingHint function (which corresponds to the graph line's antialiasing), but specialized ones like QCPGraph::applyFillAntialiasingHint and QCPGraph::applyScattersAntialiasingHint. So before drawing one of those entities, QCPGraph::draw calls the respective specialized applyAntialiasingHint function. Second example: QCPItemLine consists only of a line so there is only one antialiasing setting which can be controlled with QCPItemLine::setAntialiased. (This function is inherited by all layerables. The specialized functions, as seen on QCPGraph, must be added explicitly to the respective layerable subclass.) Consequently it only has the normal QCPItemLine::applyDefaultAntialiasingHint. The \ref QCPItemLine::draw function doesn't need to care about setting any antialiasing states, because the default antialiasing hint is already set on the painter when the \ref draw function is called, and that's the state it wants to draw the line with. */ /*! \fn virtual void QCPLayerable::draw(QCPPainter *painter) const = 0 \internal This function draws the layerable with the specified \a painter. It is only called by QCustomPlot, if the layerable is visible (\ref setVisible). Before this function is called, the painter's antialiasing state is set via \ref applyDefaultAntialiasingHint, see the documentation there. Further, the clipping rectangle was set to \ref clipRect. */ /* end documentation of pure virtual functions */ /* start documentation of signals */ /*! \fn void QCPLayerable::layerChanged(QCPLayer *newLayer); This signal is emitted when the layer of this layerable changes, i.e. this layerable is moved to a different layer. \see setLayer */ /* end documentation of signals */ /*! Creates a new QCPLayerable instance. Since QCPLayerable is an abstract base class, it can't be instantiated directly. Use one of the derived classes. If \a plot is provided, it automatically places itself on the layer named \a targetLayer. If \a targetLayer is an empty string, it places itself on the current layer of the plot (see \ref QCustomPlot::setCurrentLayer). It is possible to provide 0 as \a plot. In that case, you should assign a parent plot at a later time with \ref initializeParentPlot. The layerable's parent layerable is set to \a parentLayerable, if provided. Direct layerable parents are mainly used to control visibility in a hierarchy of layerables. This means a layerable is only drawn, if all its ancestor layerables are also visible. Note that \a parentLayerable does not become the QObject-parent (for memory management) of this layerable, \a plot does. It is not uncommon to set the QObject-parent to something else in the constructors of QCPLayerable subclasses, to guarantee a working destruction hierarchy. */ QCPLayerable::QCPLayerable(QCustomPlot *plot, QString targetLayer, QCPLayerable *parentLayerable) : QObject(plot), mVisible(true), mParentPlot(plot), mParentLayerable(parentLayerable), mLayer(0), mAntialiased(true) { if (mParentPlot) { if (targetLayer.isEmpty()) setLayer(mParentPlot->currentLayer()); else if (!setLayer(targetLayer)) qDebug() << Q_FUNC_INFO << "setting QCPlayerable initial layer to" << targetLayer << "failed."; } } QCPLayerable::~QCPLayerable() { if (mLayer) { mLayer->removeChild(this); mLayer = 0; } } /*! Sets the visibility of this layerable object. If an object is not visible, it will not be drawn on the QCustomPlot surface, and user interaction with it (e.g. click and selection) is not possible. */ void QCPLayerable::setVisible(bool on) { mVisible = on; } /*! Sets the \a layer of this layerable object. The object will be placed on top of the other objects already on \a layer. If \a layer is 0, this layerable will not be on any layer and thus not appear in the plot (or interact/receive events). Returns true if the layer of this layerable was successfully changed to \a layer. */ bool QCPLayerable::setLayer(QCPLayer *layer) { return moveToLayer(layer, false); } /*! \overload Sets the layer of this layerable object by name Returns true on success, i.e. if \a layerName is a valid layer name. */ bool QCPLayerable::setLayer(const QString &layerName) { if (!mParentPlot) { qDebug() << Q_FUNC_INFO << "no parent QCustomPlot set"; return false; } if (QCPLayer *layer = mParentPlot->layer(layerName)) { return setLayer(layer); } else { qDebug() << Q_FUNC_INFO << "there is no layer with name" << layerName; return false; } } /*! Sets whether this object will be drawn antialiased or not. Note that antialiasing settings may be overridden by QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements. */ void QCPLayerable::setAntialiased(bool enabled) { mAntialiased = enabled; } /*! Returns whether this layerable is visible, taking the visibility of the layerable parent and the visibility of this layerable's layer into account. This is the method that is consulted to decide whether a layerable shall be drawn or not. If this layerable has a direct layerable parent (usually set via hierarchies implemented in subclasses, like in the case of \ref QCPLayoutElement), this function returns true only if this layerable has its visibility set to true and the parent layerable's \ref realVisibility returns true. */ bool QCPLayerable::realVisibility() const { return mVisible && (!mLayer || mLayer->visible()) && (!mParentLayerable || mParentLayerable.data()->realVisibility()); } /*! This function is used to decide whether a click hits a layerable object or not. \a pos is a point in pixel coordinates on the QCustomPlot surface. This function returns the shortest pixel distance of this point to the object. If the object is either invisible or the distance couldn't be determined, -1.0 is returned. Further, if \a onlySelectable is true and the object is not selectable, -1.0 is returned, too. If the object is represented not by single lines but by an area like a \ref QCPItemText or the bars of a \ref QCPBars plottable, a click inside the area should also be considered a hit. In these cases this function thus returns a constant value greater zero but still below the parent plot's selection tolerance. (typically the selectionTolerance multiplied by 0.99). Providing a constant value for area objects allows selecting line objects even when they are obscured by such area objects, by clicking close to the lines (i.e. closer than 0.99*selectionTolerance). The actual setting of the selection state is not done by this function. This is handled by the parent QCustomPlot when the mouseReleaseEvent occurs, and the finally selected object is notified via the \ref selectEvent/\ref deselectEvent methods. \a details is an optional output parameter. Every layerable subclass may place any information in \a details. This information will be passed to \ref selectEvent when the parent QCustomPlot decides on the basis of this selectTest call, that the object was successfully selected. The subsequent call to \ref selectEvent will carry the \a details. This is useful for multi-part objects (like QCPAxis). This way, a possibly complex calculation to decide which part was clicked is only done once in \ref selectTest. The result (i.e. the actually clicked part) can then be placed in \a details. So in the subsequent \ref selectEvent, the decision which part was selected doesn't have to be done a second time for a single selection operation. You may pass 0 as \a details to indicate that you are not interested in those selection details. \see selectEvent, deselectEvent, mousePressEvent, wheelEvent, QCustomPlot::setInteractions */ double QCPLayerable::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(pos) Q_UNUSED(onlySelectable) Q_UNUSED(details) return -1.0; } /*! \internal Sets the parent plot of this layerable. Use this function once to set the parent plot if you have passed 0 in the constructor. It can not be used to move a layerable from one QCustomPlot to another one. Note that, unlike when passing a non-null parent plot in the constructor, this function does not make \a parentPlot the QObject-parent of this layerable. If you want this, call QObject::setParent(\a parentPlot) in addition to this function. Further, you will probably want to set a layer (\ref setLayer) after calling this function, to make the layerable appear on the QCustomPlot. The parent plot change will be propagated to subclasses via a call to \ref parentPlotInitialized so they can react accordingly (e.g. also initialize the parent plot of child layerables, like QCPLayout does). */ void QCPLayerable::initializeParentPlot(QCustomPlot *parentPlot) { if (mParentPlot) { qDebug() << Q_FUNC_INFO << "called with mParentPlot already initialized"; return; } if (!parentPlot) qDebug() << Q_FUNC_INFO << "called with parentPlot zero"; mParentPlot = parentPlot; parentPlotInitialized(mParentPlot); } /*! \internal Sets the parent layerable of this layerable to \a parentLayerable. Note that \a parentLayerable does not become the QObject-parent (for memory management) of this layerable. The parent layerable has influence on the return value of the \ref realVisibility method. Only layerables with a fully visible parent tree will return true for \ref realVisibility, and thus be drawn. \see realVisibility */ void QCPLayerable::setParentLayerable(QCPLayerable *parentLayerable) { mParentLayerable = parentLayerable; } /*! \internal Moves this layerable object to \a layer. If \a prepend is true, this object will be prepended to the new layer's list, i.e. it will be drawn below the objects already on the layer. If it is false, the object will be appended. Returns true on success, i.e. if \a layer is a valid layer. */ bool QCPLayerable::moveToLayer(QCPLayer *layer, bool prepend) { if (layer && !mParentPlot) { qDebug() << Q_FUNC_INFO << "no parent QCustomPlot set"; return false; } if (layer && layer->parentPlot() != mParentPlot) { qDebug() << Q_FUNC_INFO << "layer" << layer->name() << "is not in same QCustomPlot as this layerable"; return false; } QCPLayer *oldLayer = mLayer; if (mLayer) mLayer->removeChild(this); mLayer = layer; if (mLayer) mLayer->addChild(this, prepend); if (mLayer != oldLayer) emit layerChanged(mLayer); return true; } /*! \internal Sets the QCPainter::setAntialiasing state on the provided \a painter, depending on the \a localAntialiased value as well as the overrides \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. Which override enum this function takes into account is controlled via \a overrideElement. */ void QCPLayerable::applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const { if (mParentPlot && mParentPlot->notAntialiasedElements().testFlag(overrideElement)) painter->setAntialiasing(false); else if (mParentPlot && mParentPlot->antialiasedElements().testFlag(overrideElement)) painter->setAntialiasing(true); else painter->setAntialiasing(localAntialiased); } /*! \internal This function is called by \ref initializeParentPlot, to allow subclasses to react on the setting of a parent plot. This is the case when 0 was passed as parent plot in the constructor, and the parent plot is set at a later time. For example, QCPLayoutElement/QCPLayout hierarchies may be created independently of any QCustomPlot at first. When they are then added to a layout inside the QCustomPlot, the top level element of the hierarchy gets its parent plot initialized with \ref initializeParentPlot. To propagate the parent plot to all the children of the hierarchy, the top level element then uses this function to pass the parent plot on to its child elements. The default implementation does nothing. \see initializeParentPlot */ void QCPLayerable::parentPlotInitialized(QCustomPlot *parentPlot) { Q_UNUSED(parentPlot) } /*! \internal Returns the selection category this layerable shall belong to. The selection category is used in conjunction with \ref QCustomPlot::setInteractions to control which objects are selectable and which aren't. Subclasses that don't fit any of the normal \ref QCP::Interaction values can use \ref QCP::iSelectOther. This is what the default implementation returns. \see QCustomPlot::setInteractions */ QCP::Interaction QCPLayerable::selectionCategory() const { return QCP::iSelectOther; } /*! \internal Returns the clipping rectangle of this layerable object. By default, this is the viewport of the parent QCustomPlot. Specific subclasses may reimplement this function to provide different clipping rects. The returned clipping rect is set on the painter before the draw function of the respective object is called. */ QRect QCPLayerable::clipRect() const { if (mParentPlot) return mParentPlot->viewport(); else return QRect(); } /*! \internal This event is called when the layerable shall be selected, as a consequence of a click by the user. Subclasses should react to it by setting their selection state appropriately. The default implementation does nothing. \a event is the mouse event that caused the selection. \a additive indicates, whether the user was holding the multi-select-modifier while performing the selection (see \ref QCustomPlot::setMultiSelectModifier). if \a additive is true, the selection state must be toggled (i.e. become selected when unselected and unselected when selected). Every selectEvent is preceded by a call to \ref selectTest, which has returned positively (i.e. returned a value greater than 0 and less than the selection tolerance of the parent QCustomPlot). The \a details data you output from \ref selectTest is fed back via \a details here. You may use it to transport any kind of information from the selectTest to the possibly subsequent selectEvent. Usually \a details is used to transfer which part was clicked, if it is a layerable that has multiple individually selectable parts (like QCPAxis). This way selectEvent doesn't need to do the calculation again to find out which part was actually clicked. \a selectionStateChanged is an output parameter. If the pointer is non-null, this function must set the value either to true or false, depending on whether the selection state of this layerable was actually changed. For layerables that only are selectable as a whole and not in parts, this is simple: if \a additive is true, \a selectionStateChanged must also be set to true, because the selection toggles. If \a additive is false, \a selectionStateChanged is only set to true, if the layerable was previously unselected and now is switched to the selected state. \see selectTest, deselectEvent */ void QCPLayerable::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) { Q_UNUSED(event) Q_UNUSED(additive) Q_UNUSED(details) Q_UNUSED(selectionStateChanged) } /*! \internal This event is called when the layerable shall be deselected, either as consequence of a user interaction or a call to \ref QCustomPlot::deselectAll. Subclasses should react to it by unsetting their selection appropriately. just as in \ref selectEvent, the output parameter \a selectionStateChanged (if non-null), must return true or false when the selection state of this layerable has changed or not changed, respectively. \see selectTest, selectEvent */ void QCPLayerable::deselectEvent(bool *selectionStateChanged) { Q_UNUSED(selectionStateChanged) } /*! This event gets called when the user presses a mouse button while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to \ref selectTest. The current pixel position of the cursor on the QCustomPlot widget is accessible via \c event->pos(). The parameter \a details contains layerable-specific details about the hit, which were generated in the previous call to \ref selectTest. For example, One-dimensional plottables like \ref QCPGraph or \ref QCPBars convey the clicked data point in the \a details parameter, as \ref QCPDataSelection packed as QVariant. Multi-part objects convey the specific \c SelectablePart that was hit (e.g. \ref QCPAxis::SelectablePart in the case of axes). QCustomPlot uses an event propagation system that works the same as Qt's system. If your layerable doesn't reimplement the \ref mousePressEvent or explicitly calls \c event->ignore() in its reimplementation, the event will be propagated to the next layerable in the stacking order. Once a layerable has accepted the \ref mousePressEvent, it is considered the mouse grabber and will receive all following calls to \ref mouseMoveEvent or \ref mouseReleaseEvent for this mouse interaction (a "mouse interaction" in this context ends with the release). The default implementation does nothing except explicitly ignoring the event with \c event->ignore(). \see mouseMoveEvent, mouseReleaseEvent, mouseDoubleClickEvent, wheelEvent */ void QCPLayerable::mousePressEvent(QMouseEvent *event, const QVariant &details) { Q_UNUSED(details) event->ignore(); } /*! This event gets called when the user moves the mouse while holding a mouse button, after this layerable has become the mouse grabber by accepting the preceding \ref mousePressEvent. The current pixel position of the cursor on the QCustomPlot widget is accessible via \c event->pos(). The parameter \a startPos indicates the position where the initial \ref mousePressEvent occured, that started the mouse interaction. The default implementation does nothing. \see mousePressEvent, mouseReleaseEvent, mouseDoubleClickEvent, wheelEvent */ void QCPLayerable::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) { Q_UNUSED(startPos) event->ignore(); } /*! This event gets called when the user releases the mouse button, after this layerable has become the mouse grabber by accepting the preceding \ref mousePressEvent. The current pixel position of the cursor on the QCustomPlot widget is accessible via \c event->pos(). The parameter \a startPos indicates the position where the initial \ref mousePressEvent occured, that started the mouse interaction. The default implementation does nothing. \see mousePressEvent, mouseMoveEvent, mouseDoubleClickEvent, wheelEvent */ void QCPLayerable::mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) { Q_UNUSED(startPos) event->ignore(); } /*! This event gets called when the user presses the mouse button a second time in a double-click, while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to \ref selectTest. The \ref mouseDoubleClickEvent is called instead of the second \ref mousePressEvent. So in the case of a double-click, the event succession is pressEvent – releaseEvent – doubleClickEvent – releaseEvent. The current pixel position of the cursor on the QCustomPlot widget is accessible via \c event->pos(). The parameter \a details contains layerable-specific details about the hit, which were generated in the previous call to \ref selectTest. For example, One-dimensional plottables like \ref QCPGraph or \ref QCPBars convey the clicked data point in the \a details parameter, as \ref QCPDataSelection packed as QVariant. Multi-part objects convey the specific \c SelectablePart that was hit (e.g. \ref QCPAxis::SelectablePart in the case of axes). Similarly to \ref mousePressEvent, once a layerable has accepted the \ref mouseDoubleClickEvent, it is considered the mouse grabber and will receive all following calls to \ref mouseMoveEvent and \ref mouseReleaseEvent for this mouse interaction (a "mouse interaction" in this context ends with the release). The default implementation does nothing except explicitly ignoring the event with \c event->ignore(). \see mousePressEvent, mouseMoveEvent, mouseReleaseEvent, wheelEvent */ void QCPLayerable::mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) { Q_UNUSED(details) event->ignore(); } /*! This event gets called when the user turns the mouse scroll wheel while the cursor is over the layerable. Whether a cursor is over the layerable is decided by a preceding call to \ref selectTest. The current pixel position of the cursor on the QCustomPlot widget is accessible via \c event->pos(). The \c event->delta() indicates how far the mouse wheel was turned, which is usually +/- 120 for single rotation steps. However, if the mouse wheel is turned rapidly, multiple steps may accumulate to one event, making \c event->delta() larger. On the other hand, if the wheel has very smooth steps or none at all, the delta may be smaller. The default implementation does nothing. \see mousePressEvent, mouseMoveEvent, mouseReleaseEvent, mouseDoubleClickEvent */ void QCPLayerable::wheelEvent(QWheelEvent *event) { event->ignore(); } /* end of 'src/layer.cpp' */ /* including file 'src/axis/range.cpp', size 12221 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPRange //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPRange \brief Represents the range an axis is encompassing. contains a \a lower and \a upper double value and provides convenience input, output and modification functions. \see QCPAxis::setRange */ /* start of documentation of inline functions */ /*! \fn double QCPRange::size() const Returns the size of the range, i.e. \a upper-\a lower */ /*! \fn double QCPRange::center() const Returns the center of the range, i.e. (\a upper+\a lower)*0.5 */ /*! \fn void QCPRange::normalize() Makes sure \a lower is numerically smaller than \a upper. If this is not the case, the values are swapped. */ /*! \fn bool QCPRange::contains(double value) const Returns true when \a value lies within or exactly on the borders of the range. */ /*! \fn QCPRange &QCPRange::operator+=(const double& value) Adds \a value to both boundaries of the range. */ /*! \fn QCPRange &QCPRange::operator-=(const double& value) Subtracts \a value from both boundaries of the range. */ /*! \fn QCPRange &QCPRange::operator*=(const double& value) Multiplies both boundaries of the range by \a value. */ /*! \fn QCPRange &QCPRange::operator/=(const double& value) Divides both boundaries of the range by \a value. */ /* end of documentation of inline functions */ /*! Minimum range size (\a upper - \a lower) the range changing functions will accept. Smaller intervals would cause errors due to the 11-bit exponent of double precision numbers, corresponding to a minimum magnitude of roughly 1e-308. \warning Do not use this constant to indicate "arbitrarily small" values in plotting logic (as values that will appear in the plot)! It is intended only as a bound to compare against, e.g. to prevent axis ranges from obtaining underflowing ranges. \see validRange, maxRange */ const double QCPRange::minRange = 1e-280; /*! Maximum values (negative and positive) the range will accept in range-changing functions. Larger absolute values would cause errors due to the 11-bit exponent of double precision numbers, corresponding to a maximum magnitude of roughly 1e308. \warning Do not use this constant to indicate "arbitrarily large" values in plotting logic (as values that will appear in the plot)! It is intended only as a bound to compare against, e.g. to prevent axis ranges from obtaining overflowing ranges. \see validRange, minRange */ const double QCPRange::maxRange = 1e250; /*! Constructs a range with \a lower and \a upper set to zero. */ QCPRange::QCPRange() : lower(0), upper(0) { } /*! \overload Constructs a range with the specified \a lower and \a upper values. The resulting range will be normalized (see \ref normalize), so if \a lower is not numerically smaller than \a upper, they will be swapped. */ QCPRange::QCPRange(double lower, double upper) : lower(lower), upper(upper) { normalize(); } /*! \overload Expands this range such that \a otherRange is contained in the new range. It is assumed that both this range and \a otherRange are normalized (see \ref normalize). If this range contains NaN as lower or upper bound, it will be replaced by the respective bound of \a otherRange. If \a otherRange is already inside the current range, this function does nothing. \see expanded */ void QCPRange::expand(const QCPRange &otherRange) { if (lower > otherRange.lower || qIsNaN(lower)) lower = otherRange.lower; if (upper < otherRange.upper || qIsNaN(upper)) upper = otherRange.upper; } /*! \overload Expands this range such that \a includeCoord is contained in the new range. It is assumed that this range is normalized (see \ref normalize). If this range contains NaN as lower or upper bound, the respective bound will be set to \a includeCoord. If \a includeCoord is already inside the current range, this function does nothing. \see expand */ void QCPRange::expand(double includeCoord) { if (lower > includeCoord || qIsNaN(lower)) lower = includeCoord; if (upper < includeCoord || qIsNaN(upper)) upper = includeCoord; } /*! \overload Returns an expanded range that contains this and \a otherRange. It is assumed that both this range and \a otherRange are normalized (see \ref normalize). If this range contains NaN as lower or upper bound, the returned range's bound will be taken from \a otherRange. \see expand */ QCPRange QCPRange::expanded(const QCPRange &otherRange) const { QCPRange result = *this; result.expand(otherRange); return result; } /*! \overload Returns an expanded range that includes the specified \a includeCoord. It is assumed that this range is normalized (see \ref normalize). If this range contains NaN as lower or upper bound, the returned range's bound will be set to \a includeCoord. \see expand */ QCPRange QCPRange::expanded(double includeCoord) const { QCPRange result = *this; result.expand(includeCoord); return result; } /*! Returns this range, possibly modified to not exceed the bounds provided as \a lowerBound and \a upperBound. If possible, the size of the current range is preserved in the process. If the range shall only be bounded at the lower side, you can set \a upperBound to \ref QCPRange::maxRange. If it shall only be bounded at the upper side, set \a lowerBound to -\ref QCPRange::maxRange. */ QCPRange QCPRange::bounded(double lowerBound, double upperBound) const { if (lowerBound > upperBound) qSwap(lowerBound, upperBound); QCPRange result(lower, upper); if (result.lower < lowerBound) { result.lower = lowerBound; result.upper = lowerBound + size(); if (result.upper > upperBound || qFuzzyCompare(size(), upperBound-lowerBound)) result.upper = upperBound; } else if (result.upper > upperBound) { result.upper = upperBound; result.lower = upperBound - size(); if (result.lower < lowerBound || qFuzzyCompare(size(), upperBound-lowerBound)) result.lower = lowerBound; } return result; } /*! Returns a sanitized version of the range. Sanitized means for logarithmic scales, that the range won't span the positive and negative sign domain, i.e. contain zero. Further \a lower will always be numerically smaller (or equal) to \a upper. If the original range does span positive and negative sign domains or contains zero, the returned range will try to approximate the original range as good as possible. If the positive interval of the original range is wider than the negative interval, the returned range will only contain the positive interval, with lower bound set to \a rangeFac or \a rangeFac *\a upper, whichever is closer to zero. Same procedure is used if the negative interval is wider than the positive interval, this time by changing the \a upper bound. */ QCPRange QCPRange::sanitizedForLogScale() const { double rangeFac = 1e-3; QCPRange sanitizedRange(lower, upper); sanitizedRange.normalize(); // can't have range spanning negative and positive values in log plot, so change range to fix it //if (qFuzzyCompare(sanitizedRange.lower+1, 1) && !qFuzzyCompare(sanitizedRange.upper+1, 1)) if (sanitizedRange.lower == 0.0 && sanitizedRange.upper != 0.0) { // case lower is 0 if (rangeFac < sanitizedRange.upper*rangeFac) sanitizedRange.lower = rangeFac; else sanitizedRange.lower = sanitizedRange.upper*rangeFac; } //else if (!qFuzzyCompare(lower+1, 1) && qFuzzyCompare(upper+1, 1)) else if (sanitizedRange.lower != 0.0 && sanitizedRange.upper == 0.0) { // case upper is 0 if (-rangeFac > sanitizedRange.lower*rangeFac) sanitizedRange.upper = -rangeFac; else sanitizedRange.upper = sanitizedRange.lower*rangeFac; } else if (sanitizedRange.lower < 0 && sanitizedRange.upper > 0) { // find out whether negative or positive interval is wider to decide which sign domain will be chosen if (-sanitizedRange.lower > sanitizedRange.upper) { // negative is wider, do same as in case upper is 0 if (-rangeFac > sanitizedRange.lower*rangeFac) sanitizedRange.upper = -rangeFac; else sanitizedRange.upper = sanitizedRange.lower*rangeFac; } else { // positive is wider, do same as in case lower is 0 if (rangeFac < sanitizedRange.upper*rangeFac) sanitizedRange.lower = rangeFac; else sanitizedRange.lower = sanitizedRange.upper*rangeFac; } } // due to normalization, case lower>0 && upper<0 should never occur, because that implies upper -maxRange && upper < maxRange && qAbs(lower-upper) > minRange && qAbs(lower-upper) < maxRange && !(lower > 0 && qIsInf(upper/lower)) && !(upper < 0 && qIsInf(lower/upper))); } /*! \overload Checks, whether the specified range is within valid bounds, which are defined as QCPRange::maxRange and QCPRange::minRange. A valid range means: \li range bounds within -maxRange and maxRange \li range size above minRange \li range size below maxRange */ bool QCPRange::validRange(const QCPRange &range) { return (range.lower > -maxRange && range.upper < maxRange && qAbs(range.lower-range.upper) > minRange && qAbs(range.lower-range.upper) < maxRange && !(range.lower > 0 && qIsInf(range.upper/range.lower)) && !(range.upper < 0 && qIsInf(range.lower/range.upper))); } /* end of 'src/axis/range.cpp' */ /* including file 'src/selection.cpp', size 21898 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPDataRange //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPDataRange \brief Describes a data range given by begin and end index QCPDataRange holds two integers describing the begin (\ref setBegin) and end (\ref setEnd) index of a contiguous set of data points. The end index points to the data point above the last data point that's part of the data range, similarly to the nomenclature used in standard iterators. Data Ranges are not bound to a certain plottable, thus they can be freely exchanged, created and modified. If a non-contiguous data set shall be described, the class \ref QCPDataSelection is used, which holds and manages multiple instances of \ref QCPDataRange. In most situations, \ref QCPDataSelection is thus used. Both \ref QCPDataRange and \ref QCPDataSelection offer convenience methods to work with them, e.g. \ref bounded, \ref expanded, \ref intersects, \ref intersection, \ref adjusted, \ref contains. Further, addition and subtraction operators (defined in \ref QCPDataSelection) can be used to join/subtract data ranges and data selections (or mixtures), to retrieve a corresponding \ref QCPDataSelection. %QCustomPlot's \ref dataselection "data selection mechanism" is based on \ref QCPDataSelection and QCPDataRange. \note Do not confuse \ref QCPDataRange with \ref QCPRange. A \ref QCPRange describes an interval in floating point plot coordinates, e.g. the current axis range. */ /* start documentation of inline functions */ /*! \fn int QCPDataRange::size() const Returns the number of data points described by this data range. This is equal to the end index minus the begin index. \see length */ /*! \fn int QCPDataRange::length() const Returns the number of data points described by this data range. Equivalent to \ref size. */ /*! \fn void QCPDataRange::setBegin(int begin) Sets the begin of this data range. The \a begin index points to the first data point that is part of the data range. No checks or corrections are made to ensure the resulting range is valid (\ref isValid). \see setEnd */ /*! \fn void QCPDataRange::setEnd(int end) Sets the end of this data range. The \a end index points to the data point just above the last data point that is part of the data range. No checks or corrections are made to ensure the resulting range is valid (\ref isValid). \see setBegin */ /*! \fn bool QCPDataRange::isValid() const Returns whether this range is valid. A valid range has a begin index greater or equal to 0, and an end index greater or equal to the begin index. \note Invalid ranges should be avoided and are never the result of any of QCustomPlot's methods (unless they are themselves fed with invalid ranges). Do not pass invalid ranges to QCustomPlot's methods. The invalid range is not inherently prevented in QCPDataRange, to allow temporary invalid begin/end values while manipulating the range. An invalid range is not necessarily empty (\ref isEmpty), since its \ref length can be negative and thus non-zero. */ /*! \fn bool QCPDataRange::isEmpty() const Returns whether this range is empty, i.e. whether its begin index equals its end index. \see size, length */ /*! \fn QCPDataRange QCPDataRange::adjusted(int changeBegin, int changeEnd) const Returns a data range where \a changeBegin and \a changeEnd were added to the begin and end indices, respectively. */ /* end documentation of inline functions */ /*! Creates an empty QCPDataRange, with begin and end set to 0. */ QCPDataRange::QCPDataRange() : mBegin(0), mEnd(0) { } /*! Creates a QCPDataRange, initialized with the specified \a begin and \a end. No checks or corrections are made to ensure the resulting range is valid (\ref isValid). */ QCPDataRange::QCPDataRange(int begin, int end) : mBegin(begin), mEnd(end) { } /*! Returns a data range that matches this data range, except that parts exceeding \a other are excluded. This method is very similar to \ref intersection, with one distinction: If this range and the \a other range share no intersection, the returned data range will be empty with begin and end set to the respective boundary side of \a other, at which this range is residing. (\ref intersection would just return a range with begin and end set to 0.) */ QCPDataRange QCPDataRange::bounded(const QCPDataRange &other) const { QCPDataRange result(intersection(other)); if (result.isEmpty()) // no intersection, preserve respective bounding side of otherRange as both begin and end of return value { if (mEnd <= other.mBegin) result = QCPDataRange(other.mBegin, other.mBegin); else result = QCPDataRange(other.mEnd, other.mEnd); } return result; } /*! Returns a data range that contains both this data range as well as \a other. */ QCPDataRange QCPDataRange::expanded(const QCPDataRange &other) const { return QCPDataRange(qMin(mBegin, other.mBegin), qMax(mEnd, other.mEnd)); } /*! Returns the data range which is contained in both this data range and \a other. This method is very similar to \ref bounded, with one distinction: If this range and the \a other range share no intersection, the returned data range will be empty with begin and end set to 0. (\ref bounded would return a range with begin and end set to one of the boundaries of \a other, depending on which side this range is on.) \see QCPDataSelection::intersection */ QCPDataRange QCPDataRange::intersection(const QCPDataRange &other) const { QCPDataRange result(qMax(mBegin, other.mBegin), qMin(mEnd, other.mEnd)); if (result.isValid()) return result; else return QCPDataRange(); } /*! Returns whether this data range and \a other share common data points. \see intersection, contains */ bool QCPDataRange::intersects(const QCPDataRange &other) const { return !( (mBegin > other.mBegin && mBegin >= other.mEnd) || (mEnd <= other.mBegin && mEnd < other.mEnd) ); } /*! Returns whether all data points described by this data range are also in \a other. \see intersects */ bool QCPDataRange::contains(const QCPDataRange &other) const { return mBegin <= other.mBegin && mEnd >= other.mEnd; } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPDataSelection //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPDataSelection \brief Describes a data set by holding multiple QCPDataRange instances QCPDataSelection manages multiple instances of QCPDataRange in order to represent any (possibly disjoint) set of data selection. The data selection can be modified with addition and subtraction operators which take QCPDataSelection and QCPDataRange instances, as well as methods such as \ref addDataRange and \ref clear. Read access is provided by \ref dataRange, \ref dataRanges, \ref dataRangeCount, etc. The method \ref simplify is used to join directly adjacent or even overlapping QCPDataRange instances. QCPDataSelection automatically simplifies when using the addition/subtraction operators. The only case when \ref simplify is left to the user, is when calling \ref addDataRange, with the parameter \a simplify explicitly set to false. This is useful if many data ranges will be added to the selection successively and the overhead for simplifying after each iteration shall be avoided. In this case, you should make sure to call \ref simplify after completing the operation. Use \ref enforceType to bring the data selection into a state complying with the constraints for selections defined in \ref QCP::SelectionType. %QCustomPlot's \ref dataselection "data selection mechanism" is based on QCPDataSelection and QCPDataRange. \section qcpdataselection-iterating Iterating over a data selection As an example, the following code snippet calculates the average value of a graph's data \ref QCPAbstractPlottable::selection "selection": \snippet documentation/doc-code-snippets/mainwindow.cpp qcpdataselection-iterating-1 */ /* start documentation of inline functions */ /*! \fn int QCPDataSelection::dataRangeCount() const Returns the number of ranges that make up the data selection. The ranges can be accessed by \ref dataRange via their index. \see dataRange, dataPointCount */ /*! \fn QList QCPDataSelection::dataRanges() const Returns all data ranges that make up the data selection. If the data selection is simplified (the usual state of the selection, see \ref simplify), the ranges are sorted by ascending data point index. \see dataRange */ /*! \fn bool QCPDataSelection::isEmpty() const Returns true if there are no data ranges, and thus no data points, in this QCPDataSelection instance. \see dataRangeCount */ /* end documentation of inline functions */ /*! Creates an empty QCPDataSelection. */ QCPDataSelection::QCPDataSelection() { } /*! Creates a QCPDataSelection containing the provided \a range. */ QCPDataSelection::QCPDataSelection(const QCPDataRange &range) { mDataRanges.append(range); } /*! Returns true if this selection is identical (contains the same data ranges with the same begin and end indices) to \a other. Note that both data selections must be in simplified state (the usual state of the selection, see \ref simplify) for this operator to return correct results. */ bool QCPDataSelection::operator==(const QCPDataSelection &other) const { if (mDataRanges.size() != other.mDataRanges.size()) return false; for (int i=0; i= other.end()) break; // since data ranges are sorted after the simplify() call, no ranges which contain other will come after this if (thisEnd > other.begin()) // ranges which don't fulfill this are entirely before other and can be ignored { if (thisBegin >= other.begin()) // range leading segment is encompassed { if (thisEnd <= other.end()) // range fully encompassed, remove completely { mDataRanges.removeAt(i); continue; } else // only leading segment is encompassed, trim accordingly mDataRanges[i].setBegin(other.end()); } else // leading segment is not encompassed { if (thisEnd <= other.end()) // only trailing segment is encompassed, trim accordingly { mDataRanges[i].setEnd(other.begin()); } else // other lies inside this range, so split range { mDataRanges[i].setEnd(other.begin()); mDataRanges.insert(i+1, QCPDataRange(other.end(), thisEnd)); break; // since data ranges are sorted (and don't overlap) after simplify() call, we're done here } } } ++i; } return *this; } /*! Returns the total number of data points contained in all data ranges that make up this data selection. */ int QCPDataSelection::dataPointCount() const { int result = 0; for (int i=0; i= 0 && index < mDataRanges.size()) { return mDataRanges.at(index); } else { qDebug() << Q_FUNC_INFO << "index out of range:" << index; return QCPDataRange(); } } /*! Returns a \ref QCPDataRange which spans the entire data selection, including possible intermediate segments which are not part of the original data selection. */ QCPDataRange QCPDataSelection::span() const { if (isEmpty()) return QCPDataRange(); else return QCPDataRange(mDataRanges.first().begin(), mDataRanges.last().end()); } /*! Adds the given \a dataRange to this data selection. This is equivalent to the += operator but allows disabling immediate simplification by setting \a simplify to false. This can improve performance if adding a very large amount of data ranges successively. In this case, make sure to call \ref simplify manually, after the operation. */ void QCPDataSelection::addDataRange(const QCPDataRange &dataRange, bool simplify) { mDataRanges.append(dataRange); if (simplify) this->simplify(); } /*! Removes all data ranges. The data selection then contains no data points. \ref isEmpty */ void QCPDataSelection::clear() { mDataRanges.clear(); } /*! Sorts all data ranges by range begin index in ascending order, and then joins directly adjacent or overlapping ranges. This can reduce the number of individual data ranges in the selection, and prevents possible double-counting when iterating over the data points held by the data ranges. This method is automatically called when using the addition/subtraction operators. The only case when \ref simplify is left to the user, is when calling \ref addDataRange, with the parameter \a simplify explicitly set to false. */ void QCPDataSelection::simplify() { // remove any empty ranges: for (int i=mDataRanges.size()-1; i>=0; --i) { if (mDataRanges.at(i).isEmpty()) mDataRanges.removeAt(i); } if (mDataRanges.isEmpty()) return; // sort ranges by starting value, ascending: std::sort(mDataRanges.begin(), mDataRanges.end(), lessThanDataRangeBegin); // join overlapping/contiguous ranges: int i = 1; while (i < mDataRanges.size()) { if (mDataRanges.at(i-1).end() >= mDataRanges.at(i).begin()) // range i overlaps/joins with i-1, so expand range i-1 appropriately and remove range i from list { mDataRanges[i-1].setEnd(qMax(mDataRanges.at(i-1).end(), mDataRanges.at(i).end())); mDataRanges.removeAt(i); } else ++i; } } /*! Makes sure this data selection conforms to the specified \a type selection type. Before the type is enforced, \ref simplify is called. Depending on \a type, enforcing means adding new data points that were previously not part of the selection, or removing data points from the selection. If the current selection already conforms to \a type, the data selection is not changed. \see QCP::SelectionType */ void QCPDataSelection::enforceType(QCP::SelectionType type) { simplify(); switch (type) { case QCP::stNone: { mDataRanges.clear(); break; } case QCP::stWhole: { // whole selection isn't defined by data range, so don't change anything (is handled in plottable methods) break; } case QCP::stSingleData: { // reduce all data ranges to the single first data point: if (!mDataRanges.isEmpty()) { if (mDataRanges.size() > 1) mDataRanges = QList() << mDataRanges.first(); if (mDataRanges.first().length() > 1) mDataRanges.first().setEnd(mDataRanges.first().begin()+1); } break; } case QCP::stDataRange: { mDataRanges = QList() << span(); break; } case QCP::stMultipleDataRanges: { // this is the selection type that allows all concievable combinations of ranges, so do nothing break; } } } /*! Returns true if the data selection \a other is contained entirely in this data selection, i.e. all data point indices that are in \a other are also in this data selection. \see QCPDataRange::contains */ bool QCPDataSelection::contains(const QCPDataSelection &other) const { if (other.isEmpty()) return false; int otherIndex = 0; int thisIndex = 0; while (thisIndex < mDataRanges.size() && otherIndex < other.mDataRanges.size()) { if (mDataRanges.at(thisIndex).contains(other.mDataRanges.at(otherIndex))) ++otherIndex; else ++thisIndex; } return thisIndex < mDataRanges.size(); // if thisIndex ran all the way to the end to find a containing range for the current otherIndex, other is not contained in this } /*! Returns a data selection containing the points which are both in this data selection and in the data range \a other. A common use case is to limit an unknown data selection to the valid range of a data container, using \ref QCPDataContainer::dataRange as \a other. One can then safely iterate over the returned data selection without exceeding the data container's bounds. */ QCPDataSelection QCPDataSelection::intersection(const QCPDataRange &other) const { QCPDataSelection result; for (int i=0; iorientation() == Qt::Horizontal) return QCPRange(axis->pixelToCoord(mRect.left()), axis->pixelToCoord(mRect.left()+mRect.width())); else return QCPRange(axis->pixelToCoord(mRect.top()+mRect.height()), axis->pixelToCoord(mRect.top())); } else { qDebug() << Q_FUNC_INFO << "called with axis zero"; return QCPRange(); } } /*! Sets the pen that will be used to draw the selection rect outline. \see setBrush */ void QCPSelectionRect::setPen(const QPen &pen) { mPen = pen; } /*! Sets the brush that will be used to fill the selection rect. By default the selection rect is not filled, i.e. \a brush is Qt::NoBrush. \see setPen */ void QCPSelectionRect::setBrush(const QBrush &brush) { mBrush = brush; } /*! If there is currently a selection interaction going on (\ref isActive), the interaction is canceled. The selection rect will emit the \ref canceled signal. */ void QCPSelectionRect::cancel() { if (mActive) { mActive = false; emit canceled(mRect, 0); } } /*! \internal This method is called by QCustomPlot to indicate that a selection rect interaction was initiated. The default implementation sets the selection rect to active, initializes the selection rect geometry and emits the \ref started signal. */ void QCPSelectionRect::startSelection(QMouseEvent *event) { mActive = true; mRect = QRect(event->pos(), event->pos()); emit started(event); } /*! \internal This method is called by QCustomPlot to indicate that an ongoing selection rect interaction needs to update its geometry. The default implementation updates the rect and emits the \ref changed signal. */ void QCPSelectionRect::moveSelection(QMouseEvent *event) { mRect.setBottomRight(event->pos()); emit changed(mRect, event); layer()->replot(); } /*! \internal This method is called by QCustomPlot to indicate that an ongoing selection rect interaction has finished by the user releasing the mouse button. The default implementation deactivates the selection rect and emits the \ref accepted signal. */ void QCPSelectionRect::endSelection(QMouseEvent *event) { mRect.setBottomRight(event->pos()); mActive = false; emit accepted(mRect, event); } /*! \internal This method is called by QCustomPlot when a key has been pressed by the user while the selection rect interaction is active. The default implementation allows to \ref cancel the interaction by hitting the escape key. */ void QCPSelectionRect::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key_Escape && mActive) { mActive = false; emit canceled(mRect, event); } } /* inherits documentation from base class */ void QCPSelectionRect::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aeOther); } /*! \internal If the selection rect is active (\ref isActive), draws the selection rect defined by \a mRect. \seebaseclassmethod */ void QCPSelectionRect::draw(QCPPainter *painter) { if (mActive) { painter->setPen(mPen); painter->setBrush(mBrush); painter->drawRect(mRect); } } /* end of 'src/selectionrect.cpp' */ /* including file 'src/layout.cpp', size 74302 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPMarginGroup //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPMarginGroup \brief A margin group allows synchronization of margin sides if working with multiple layout elements. QCPMarginGroup allows you to tie a margin side of two or more layout elements together, such that they will all have the same size, based on the largest required margin in the group. \n \image html QCPMarginGroup.png "Demonstration of QCPMarginGroup" \n In certain situations it is desirable that margins at specific sides are synchronized across layout elements. For example, if one QCPAxisRect is below another one in a grid layout, it will provide a cleaner look to the user if the left and right margins of the two axis rects are of the same size. The left axis of the top axis rect will then be at the same horizontal position as the left axis of the lower axis rect, making them appear aligned. The same applies for the right axes. This is what QCPMarginGroup makes possible. To add/remove a specific side of a layout element to/from a margin group, use the \ref QCPLayoutElement::setMarginGroup method. To completely break apart the margin group, either call \ref clear, or just delete the margin group. \section QCPMarginGroup-example Example First create a margin group: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpmargingroup-creation-1 Then set this group on the layout element sides: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpmargingroup-creation-2 Here, we've used the first two axis rects of the plot and synchronized their left margins with each other and their right margins with each other. */ /* start documentation of inline functions */ /*! \fn QList QCPMarginGroup::elements(QCP::MarginSide side) const Returns a list of all layout elements that have their margin \a side associated with this margin group. */ /* end documentation of inline functions */ /*! Creates a new QCPMarginGroup instance in \a parentPlot. */ QCPMarginGroup::QCPMarginGroup(QCustomPlot *parentPlot) : QObject(parentPlot), mParentPlot(parentPlot) { mChildren.insert(QCP::msLeft, QList()); mChildren.insert(QCP::msRight, QList()); mChildren.insert(QCP::msTop, QList()); mChildren.insert(QCP::msBottom, QList()); } QCPMarginGroup::~QCPMarginGroup() { clear(); } /*! Returns whether this margin group is empty. If this function returns true, no layout elements use this margin group to synchronize margin sides. */ bool QCPMarginGroup::isEmpty() const { QHashIterator > it(mChildren); while (it.hasNext()) { it.next(); if (!it.value().isEmpty()) return false; } return true; } /*! Clears this margin group. The synchronization of the margin sides that use this margin group is lifted and they will use their individual margin sizes again. */ void QCPMarginGroup::clear() { // make all children remove themselves from this margin group: QHashIterator > it(mChildren); while (it.hasNext()) { it.next(); const QList elements = it.value(); for (int i=elements.size()-1; i>=0; --i) elements.at(i)->setMarginGroup(it.key(), 0); // removes itself from mChildren via removeChild } } /*! \internal Returns the synchronized common margin for \a side. This is the margin value that will be used by the layout element on the respective side, if it is part of this margin group. The common margin is calculated by requesting the automatic margin (\ref QCPLayoutElement::calculateAutoMargin) of each element associated with \a side in this margin group, and choosing the largest returned value. (QCPLayoutElement::minimumMargins is taken into account, too.) */ int QCPMarginGroup::commonMargin(QCP::MarginSide side) const { // query all automatic margins of the layout elements in this margin group side and find maximum: int result = 0; const QList elements = mChildren.value(side); for (int i=0; iautoMargins().testFlag(side)) continue; int m = qMax(elements.at(i)->calculateAutoMargin(side), QCP::getMarginValue(elements.at(i)->minimumMargins(), side)); if (m > result) result = m; } return result; } /*! \internal Adds \a element to the internal list of child elements, for the margin \a side. This function does not modify the margin group property of \a element. */ void QCPMarginGroup::addChild(QCP::MarginSide side, QCPLayoutElement *element) { if (!mChildren[side].contains(element)) mChildren[side].append(element); else qDebug() << Q_FUNC_INFO << "element is already child of this margin group side" << reinterpret_cast(element); } /*! \internal Removes \a element from the internal list of child elements, for the margin \a side. This function does not modify the margin group property of \a element. */ void QCPMarginGroup::removeChild(QCP::MarginSide side, QCPLayoutElement *element) { if (!mChildren[side].removeOne(element)) qDebug() << Q_FUNC_INFO << "element is not child of this margin group side" << reinterpret_cast(element); } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPLayoutElement //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPLayoutElement \brief The abstract base class for all objects that form \ref thelayoutsystem "the layout system". This is an abstract base class. As such, it can't be instantiated directly, rather use one of its subclasses. A Layout element is a rectangular object which can be placed in layouts. It has an outer rect (QCPLayoutElement::outerRect) and an inner rect (\ref QCPLayoutElement::rect). The difference between outer and inner rect is called its margin. The margin can either be set to automatic or manual (\ref setAutoMargins) on a per-side basis. If a side is set to manual, that margin can be set explicitly with \ref setMargins and will stay fixed at that value. If it's set to automatic, the layout element subclass will control the value itself (via \ref calculateAutoMargin). Layout elements can be placed in layouts (base class QCPLayout) like QCPLayoutGrid. The top level layout is reachable via \ref QCustomPlot::plotLayout, and is a \ref QCPLayoutGrid. Since \ref QCPLayout itself derives from \ref QCPLayoutElement, layouts can be nested. Thus in QCustomPlot one can divide layout elements into two categories: The ones that are invisible by themselves, because they don't draw anything. Their only purpose is to manage the position and size of other layout elements. This category of layout elements usually use QCPLayout as base class. Then there is the category of layout elements which actually draw something. For example, QCPAxisRect, QCPLegend and QCPTextElement are of this category. This does not necessarily mean that the latter category can't have child layout elements. QCPLegend for instance, actually derives from QCPLayoutGrid and the individual legend items are child layout elements in the grid layout. */ /* start documentation of inline functions */ /*! \fn QCPLayout *QCPLayoutElement::layout() const Returns the parent layout of this layout element. */ /*! \fn QRect QCPLayoutElement::rect() const Returns the inner rect of this layout element. The inner rect is the outer rect (\ref setOuterRect) shrinked by the margins (\ref setMargins, \ref setAutoMargins). In some cases, the area between outer and inner rect is left blank. In other cases the margin area is used to display peripheral graphics while the main content is in the inner rect. This is where automatic margin calculation becomes interesting because it allows the layout element to adapt the margins to the peripheral graphics it wants to draw. For example, \ref QCPAxisRect draws the axis labels and tick labels in the margin area, thus needs to adjust the margins (if \ref setAutoMargins is enabled) according to the space required by the labels of the axes. */ /* end documentation of inline functions */ /*! Creates an instance of QCPLayoutElement and sets default values. */ QCPLayoutElement::QCPLayoutElement(QCustomPlot *parentPlot) : QCPLayerable(parentPlot), // parenthood is changed as soon as layout element gets inserted into a layout (except for top level layout) mParentLayout(0), mMinimumSize(), mMaximumSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX), mRect(0, 0, 0, 0), mOuterRect(0, 0, 0, 0), mMargins(0, 0, 0, 0), mMinimumMargins(0, 0, 0, 0), mAutoMargins(QCP::msAll) { } QCPLayoutElement::~QCPLayoutElement() { setMarginGroup(QCP::msAll, 0); // unregister at margin groups, if there are any // unregister at layout: if (qobject_cast(mParentLayout)) // the qobject_cast is just a safeguard in case the layout forgets to call clear() in its dtor and this dtor is called by QObject dtor mParentLayout->take(this); } /*! Sets the outer rect of this layout element. If the layout element is inside a layout, the layout sets the position and size of this layout element using this function. Calling this function externally has no effect, since the layout will overwrite any changes to the outer rect upon the next replot. The layout element will adapt its inner \ref rect by applying the margins inward to the outer rect. \see rect */ void QCPLayoutElement::setOuterRect(const QRect &rect) { if (mOuterRect != rect) { mOuterRect = rect; mRect = mOuterRect.adjusted(mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom()); } } /*! Sets the margins of this layout element. If \ref setAutoMargins is disabled for some or all sides, this function is used to manually set the margin on those sides. Sides that are still set to be handled automatically are ignored and may have any value in \a margins. The margin is the distance between the outer rect (controlled by the parent layout via \ref setOuterRect) and the inner \ref rect (which usually contains the main content of this layout element). \see setAutoMargins */ void QCPLayoutElement::setMargins(const QMargins &margins) { if (mMargins != margins) { mMargins = margins; mRect = mOuterRect.adjusted(mMargins.left(), mMargins.top(), -mMargins.right(), -mMargins.bottom()); } } /*! If \ref setAutoMargins is enabled on some or all margins, this function is used to provide minimum values for those margins. The minimum values are not enforced on margin sides that were set to be under manual control via \ref setAutoMargins. \see setAutoMargins */ void QCPLayoutElement::setMinimumMargins(const QMargins &margins) { if (mMinimumMargins != margins) { mMinimumMargins = margins; } } /*! Sets on which sides the margin shall be calculated automatically. If a side is calculated automatically, a minimum margin value may be provided with \ref setMinimumMargins. If a side is set to be controlled manually, the value may be specified with \ref setMargins. Margin sides that are under automatic control may participate in a \ref QCPMarginGroup (see \ref setMarginGroup), to synchronize (align) it with other layout elements in the plot. \see setMinimumMargins, setMargins, QCP::MarginSide */ void QCPLayoutElement::setAutoMargins(QCP::MarginSides sides) { mAutoMargins = sides; } /*! Sets the minimum size for the inner \ref rect of this layout element. A parent layout tries to respect the \a size here by changing row/column sizes in the layout accordingly. If the parent layout size is not sufficient to satisfy all minimum size constraints of its child layout elements, the layout may set a size that is actually smaller than \a size. QCustomPlot propagates the layout's size constraints to the outside by setting its own minimum QWidget size accordingly, so violations of \a size should be exceptions. */ void QCPLayoutElement::setMinimumSize(const QSize &size) { if (mMinimumSize != size) { mMinimumSize = size; if (mParentLayout) mParentLayout->sizeConstraintsChanged(); } } /*! \overload Sets the minimum size for the inner \ref rect of this layout element. */ void QCPLayoutElement::setMinimumSize(int width, int height) { setMinimumSize(QSize(width, height)); } /*! Sets the maximum size for the inner \ref rect of this layout element. A parent layout tries to respect the \a size here by changing row/column sizes in the layout accordingly. */ void QCPLayoutElement::setMaximumSize(const QSize &size) { if (mMaximumSize != size) { mMaximumSize = size; if (mParentLayout) mParentLayout->sizeConstraintsChanged(); } } /*! \overload Sets the maximum size for the inner \ref rect of this layout element. */ void QCPLayoutElement::setMaximumSize(int width, int height) { setMaximumSize(QSize(width, height)); } /*! Sets the margin \a group of the specified margin \a sides. Margin groups allow synchronizing specified margins across layout elements, see the documentation of \ref QCPMarginGroup. To unset the margin group of \a sides, set \a group to 0. Note that margin groups only work for margin sides that are set to automatic (\ref setAutoMargins). \see QCP::MarginSide */ void QCPLayoutElement::setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group) { QVector sideVector; if (sides.testFlag(QCP::msLeft)) sideVector.append(QCP::msLeft); if (sides.testFlag(QCP::msRight)) sideVector.append(QCP::msRight); if (sides.testFlag(QCP::msTop)) sideVector.append(QCP::msTop); if (sides.testFlag(QCP::msBottom)) sideVector.append(QCP::msBottom); for (int i=0; iremoveChild(side, this); if (!group) // if setting to 0, remove hash entry. Else set hash entry to new group and register there { mMarginGroups.remove(side); } else // setting to a new group { mMarginGroups[side] = group; group->addChild(side, this); } } } } /*! Updates the layout element and sub-elements. This function is automatically called before every replot by the parent layout element. It is called multiple times, once for every \ref UpdatePhase. The phases are run through in the order of the enum values. For details about what happens at the different phases, see the documentation of \ref UpdatePhase. Layout elements that have child elements should call the \ref update method of their child elements, and pass the current \a phase unchanged. The default implementation executes the automatic margin mechanism in the \ref upMargins phase. Subclasses should make sure to call the base class implementation. */ void QCPLayoutElement::update(UpdatePhase phase) { if (phase == upMargins) { if (mAutoMargins != QCP::msNone) { // set the margins of this layout element according to automatic margin calculation, either directly or via a margin group: QMargins newMargins = mMargins; QList allMarginSides = QList() << QCP::msLeft << QCP::msRight << QCP::msTop << QCP::msBottom; foreach (QCP::MarginSide side, allMarginSides) { if (mAutoMargins.testFlag(side)) // this side's margin shall be calculated automatically { if (mMarginGroups.contains(side)) QCP::setMarginValue(newMargins, side, mMarginGroups[side]->commonMargin(side)); // this side is part of a margin group, so get the margin value from that group else QCP::setMarginValue(newMargins, side, calculateAutoMargin(side)); // this side is not part of a group, so calculate the value directly // apply minimum margin restrictions: if (QCP::getMarginValue(newMargins, side) < QCP::getMarginValue(mMinimumMargins, side)) QCP::setMarginValue(newMargins, side, QCP::getMarginValue(mMinimumMargins, side)); } } setMargins(newMargins); } } } /*! Returns the minimum size this layout element (the inner \ref rect) may be compressed to. if a minimum size (\ref setMinimumSize) was not set manually, parent layouts consult this function to determine the minimum allowed size of this layout element. (A manual minimum size is considered set if it is non-zero.) */ QSize QCPLayoutElement::minimumSizeHint() const { return mMinimumSize; } /*! Returns the maximum size this layout element (the inner \ref rect) may be expanded to. if a maximum size (\ref setMaximumSize) was not set manually, parent layouts consult this function to determine the maximum allowed size of this layout element. (A manual maximum size is considered set if it is smaller than Qt's QWIDGETSIZE_MAX.) */ QSize QCPLayoutElement::maximumSizeHint() const { return mMaximumSize; } /*! Returns a list of all child elements in this layout element. If \a recursive is true, all sub-child elements are included in the list, too. \warning There may be entries with value 0 in the returned list. (For example, QCPLayoutGrid may have empty cells which yield 0 at the respective index.) */ QList QCPLayoutElement::elements(bool recursive) const { Q_UNUSED(recursive) return QList(); } /*! Layout elements are sensitive to events inside their outer rect. If \a pos is within the outer rect, this method returns a value corresponding to 0.99 times the parent plot's selection tolerance. However, layout elements are not selectable by default. So if \a onlySelectable is true, -1.0 is returned. See \ref QCPLayerable::selectTest for a general explanation of this virtual method. QCPLayoutElement subclasses may reimplement this method to provide more specific selection test behaviour. */ double QCPLayoutElement::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable) return -1; if (QRectF(mOuterRect).contains(pos)) { if (mParentPlot) return mParentPlot->selectionTolerance()*0.99; else { qDebug() << Q_FUNC_INFO << "parent plot not defined"; return -1; } } else return -1; } /*! \internal propagates the parent plot initialization to all child elements, by calling \ref QCPLayerable::initializeParentPlot on them. */ void QCPLayoutElement::parentPlotInitialized(QCustomPlot *parentPlot) { foreach (QCPLayoutElement* el, elements(false)) { if (!el->parentPlot()) el->initializeParentPlot(parentPlot); } } /*! \internal Returns the margin size for this \a side. It is used if automatic margins is enabled for this \a side (see \ref setAutoMargins). If a minimum margin was set with \ref setMinimumMargins, the returned value will not be smaller than the specified minimum margin. The default implementation just returns the respective manual margin (\ref setMargins) or the minimum margin, whichever is larger. */ int QCPLayoutElement::calculateAutoMargin(QCP::MarginSide side) { return qMax(QCP::getMarginValue(mMargins, side), QCP::getMarginValue(mMinimumMargins, side)); } /*! \internal This virtual method is called when this layout element was moved to a different QCPLayout, or when this layout element has changed its logical position (e.g. row and/or column) within the same QCPLayout. Subclasses may use this to react accordingly. Since this method is called after the completion of the move, you can access the new parent layout via \ref layout(). The default implementation does nothing. */ void QCPLayoutElement::layoutChanged() { } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPLayout //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPLayout \brief The abstract base class for layouts This is an abstract base class for layout elements whose main purpose is to define the position and size of other child layout elements. In most cases, layouts don't draw anything themselves (but there are exceptions to this, e.g. QCPLegend). QCPLayout derives from QCPLayoutElement, and thus can itself be nested in other layouts. QCPLayout introduces a common interface for accessing and manipulating the child elements. Those functions are most notably \ref elementCount, \ref elementAt, \ref takeAt, \ref take, \ref simplify, \ref removeAt, \ref remove and \ref clear. Individual subclasses may add more functions to this interface which are more specialized to the form of the layout. For example, \ref QCPLayoutGrid adds functions that take row and column indices to access cells of the layout grid more conveniently. Since this is an abstract base class, you can't instantiate it directly. Rather use one of its subclasses like QCPLayoutGrid or QCPLayoutInset. For a general introduction to the layout system, see the dedicated documentation page \ref thelayoutsystem "The Layout System". */ /* start documentation of pure virtual functions */ /*! \fn virtual int QCPLayout::elementCount() const = 0 Returns the number of elements/cells in the layout. \see elements, elementAt */ /*! \fn virtual QCPLayoutElement* QCPLayout::elementAt(int index) const = 0 Returns the element in the cell with the given \a index. If \a index is invalid, returns 0. Note that even if \a index is valid, the respective cell may be empty in some layouts (e.g. QCPLayoutGrid), so this function may return 0 in those cases. You may use this function to check whether a cell is empty or not. \see elements, elementCount, takeAt */ /*! \fn virtual QCPLayoutElement* QCPLayout::takeAt(int index) = 0 Removes the element with the given \a index from the layout and returns it. If the \a index is invalid or the cell with that index is empty, returns 0. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use \ref simplify. \see elementAt, take */ /*! \fn virtual bool QCPLayout::take(QCPLayoutElement* element) = 0 Removes the specified \a element from the layout and returns true on success. If the \a element isn't in this layout, returns false. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use \ref simplify. \see takeAt */ /* end documentation of pure virtual functions */ /*! Creates an instance of QCPLayout and sets default values. Note that since QCPLayout is an abstract base class, it can't be instantiated directly. */ QCPLayout::QCPLayout() { } /*! First calls the QCPLayoutElement::update base class implementation to update the margins on this layout. Then calls \ref updateLayout which subclasses reimplement to reposition and resize their cells. Finally, \ref update is called on all child elements. */ void QCPLayout::update(UpdatePhase phase) { QCPLayoutElement::update(phase); // set child element rects according to layout: if (phase == upLayout) updateLayout(); // propagate update call to child elements: const int elCount = elementCount(); for (int i=0; iupdate(phase); } } /* inherits documentation from base class */ QList QCPLayout::elements(bool recursive) const { const int c = elementCount(); QList result; #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) result.reserve(c); #endif for (int i=0; ielements(recursive); } } return result; } /*! Simplifies the layout by collapsing empty cells. The exact behavior depends on subclasses, the default implementation does nothing. Not all layouts need simplification. For example, QCPLayoutInset doesn't use explicit simplification while QCPLayoutGrid does. */ void QCPLayout::simplify() { } /*! Removes and deletes the element at the provided \a index. Returns true on success. If \a index is invalid or points to an empty cell, returns false. This function internally uses \ref takeAt to remove the element from the layout and then deletes the returned element. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use \ref simplify. \see remove, takeAt */ bool QCPLayout::removeAt(int index) { if (QCPLayoutElement *el = takeAt(index)) { delete el; return true; } else return false; } /*! Removes and deletes the provided \a element. Returns true on success. If \a element is not in the layout, returns false. This function internally uses \ref takeAt to remove the element from the layout and then deletes the element. Note that some layouts don't remove the respective cell right away but leave an empty cell after successful removal of the layout element. To collapse empty cells, use \ref simplify. \see removeAt, take */ bool QCPLayout::remove(QCPLayoutElement *element) { if (take(element)) { delete element; return true; } else return false; } /*! Removes and deletes all layout elements in this layout. Finally calls \ref simplify to make sure all empty cells are collapsed. \see remove, removeAt */ void QCPLayout::clear() { for (int i=elementCount()-1; i>=0; --i) { if (elementAt(i)) removeAt(i); } simplify(); } /*! Subclasses call this method to report changed (minimum/maximum) size constraints. If the parent of this layout is again a QCPLayout, forwards the call to the parent's \ref sizeConstraintsChanged. If the parent is a QWidget (i.e. is the \ref QCustomPlot::plotLayout of QCustomPlot), calls QWidget::updateGeometry, so if the QCustomPlot widget is inside a Qt QLayout, it may update itself and resize cells accordingly. */ void QCPLayout::sizeConstraintsChanged() const { if (QWidget *w = qobject_cast(parent())) w->updateGeometry(); else if (QCPLayout *l = qobject_cast(parent())) l->sizeConstraintsChanged(); } /*! \internal Subclasses reimplement this method to update the position and sizes of the child elements/cells via calling their \ref QCPLayoutElement::setOuterRect. The default implementation does nothing. The geometry used as a reference is the inner \ref rect of this layout. Child elements should stay within that rect. \ref getSectionSizes may help with the reimplementation of this function. \see update */ void QCPLayout::updateLayout() { } /*! \internal Associates \a el with this layout. This is done by setting the \ref QCPLayoutElement::layout, the \ref QCPLayerable::parentLayerable and the QObject parent to this layout. Further, if \a el didn't previously have a parent plot, calls \ref QCPLayerable::initializeParentPlot on \a el to set the paret plot. This method is used by subclass specific methods that add elements to the layout. Note that this method only changes properties in \a el. The removal from the old layout and the insertion into the new layout must be done additionally. */ void QCPLayout::adoptElement(QCPLayoutElement *el) { if (el) { el->mParentLayout = this; el->setParentLayerable(this); el->setParent(this); if (!el->parentPlot()) el->initializeParentPlot(mParentPlot); el->layoutChanged(); } else qDebug() << Q_FUNC_INFO << "Null element passed"; } /*! \internal Disassociates \a el from this layout. This is done by setting the \ref QCPLayoutElement::layout and the \ref QCPLayerable::parentLayerable to zero. The QObject parent is set to the parent QCustomPlot. This method is used by subclass specific methods that remove elements from the layout (e.g. \ref take or \ref takeAt). Note that this method only changes properties in \a el. The removal from the old layout must be done additionally. */ void QCPLayout::releaseElement(QCPLayoutElement *el) { if (el) { el->mParentLayout = 0; el->setParentLayerable(0); el->setParent(mParentPlot); // Note: Don't initializeParentPlot(0) here, because layout element will stay in same parent plot } else qDebug() << Q_FUNC_INFO << "Null element passed"; } /*! \internal This is a helper function for the implementation of \ref updateLayout in subclasses. It calculates the sizes of one-dimensional sections with provided constraints on maximum section sizes, minimum section sizes, relative stretch factors and the final total size of all sections. The QVector entries refer to the sections. Thus all QVectors must have the same size. \a maxSizes gives the maximum allowed size of each section. If there shall be no maximum size imposed, set all vector values to Qt's QWIDGETSIZE_MAX. \a minSizes gives the minimum allowed size of each section. If there shall be no minimum size imposed, set all vector values to zero. If the \a minSizes entries add up to a value greater than \a totalSize, sections will be scaled smaller than the proposed minimum sizes. (In other words, not exceeding the allowed total size is taken to be more important than not going below minimum section sizes.) \a stretchFactors give the relative proportions of the sections to each other. If all sections shall be scaled equally, set all values equal. If the first section shall be double the size of each individual other section, set the first number of \a stretchFactors to double the value of the other individual values (e.g. {2, 1, 1, 1}). \a totalSize is the value that the final section sizes will add up to. Due to rounding, the actual sum may differ slightly. If you want the section sizes to sum up to exactly that value, you could distribute the remaining difference on the sections. The return value is a QVector containing the section sizes. */ QVector QCPLayout::getSectionSizes(QVector maxSizes, QVector minSizes, QVector stretchFactors, int totalSize) const { if (maxSizes.size() != minSizes.size() || minSizes.size() != stretchFactors.size()) { qDebug() << Q_FUNC_INFO << "Passed vector sizes aren't equal:" << maxSizes << minSizes << stretchFactors; return QVector(); } if (stretchFactors.isEmpty()) return QVector(); int sectionCount = stretchFactors.size(); QVector sectionSizes(sectionCount); // if provided total size is forced smaller than total minimum size, ignore minimum sizes (squeeze sections): int minSizeSum = 0; for (int i=0; i minimumLockedSections; QList unfinishedSections; for (int i=0; i result(sectionCount); for (int i=0; i= 0 && row < mElements.size()) { if (column >= 0 && column < mElements.first().size()) { if (QCPLayoutElement *result = mElements.at(row).at(column)) return result; else qDebug() << Q_FUNC_INFO << "Requested cell is empty. Row:" << row << "Column:" << column; } else qDebug() << Q_FUNC_INFO << "Invalid column. Row:" << row << "Column:" << column; } else qDebug() << Q_FUNC_INFO << "Invalid row. Row:" << row << "Column:" << column; return 0; } /*! \overload Adds the \a element to cell with \a row and \a column. If \a element is already in a layout, it is first removed from there. If \a row or \a column don't exist yet, the layout is expanded accordingly. Returns true if the element was added successfully, i.e. if the cell at \a row and \a column didn't already have an element. Use the overload of this method without explicit row/column index to place the element according to the configured fill order and wrapping settings. \see element, hasElement, take, remove */ bool QCPLayoutGrid::addElement(int row, int column, QCPLayoutElement *element) { if (!hasElement(row, column)) { if (element && element->layout()) // remove from old layout first element->layout()->take(element); expandTo(row+1, column+1); mElements[row][column] = element; if (element) adoptElement(element); return true; } else qDebug() << Q_FUNC_INFO << "There is already an element in the specified row/column:" << row << column; return false; } /*! \overload Adds the \a element to the next empty cell according to the current fill order (\ref setFillOrder) and wrapping (\ref setWrap). If \a element is already in a layout, it is first removed from there. If necessary, the layout is expanded to hold the new element. Returns true if the element was added successfully. \see setFillOrder, setWrap, element, hasElement, take, remove */ bool QCPLayoutGrid::addElement(QCPLayoutElement *element) { int rowIndex = 0; int colIndex = 0; if (mFillOrder == foColumnsFirst) { while (hasElement(rowIndex, colIndex)) { ++colIndex; if (colIndex >= mWrap && mWrap > 0) { colIndex = 0; ++rowIndex; } } } else { while (hasElement(rowIndex, colIndex)) { ++rowIndex; if (rowIndex >= mWrap && mWrap > 0) { rowIndex = 0; ++colIndex; } } } return addElement(rowIndex, colIndex, element); } /*! Returns whether the cell at \a row and \a column exists and contains a valid element, i.e. isn't empty. \see element */ bool QCPLayoutGrid::hasElement(int row, int column) { if (row >= 0 && row < rowCount() && column >= 0 && column < columnCount()) return mElements.at(row).at(column); else return false; } /*! Sets the stretch \a factor of \a column. Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights (\ref QCPLayoutElement::setMinimumSize, \ref QCPLayoutElement::setMaximumSize), regardless of the stretch factor. The default stretch factor of newly created rows/columns is 1. \see setColumnStretchFactors, setRowStretchFactor */ void QCPLayoutGrid::setColumnStretchFactor(int column, double factor) { if (column >= 0 && column < columnCount()) { if (factor > 0) mColumnStretchFactors[column] = factor; else qDebug() << Q_FUNC_INFO << "Invalid stretch factor, must be positive:" << factor; } else qDebug() << Q_FUNC_INFO << "Invalid column:" << column; } /*! Sets the stretch \a factors of all columns. \a factors must have the size \ref columnCount. Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights (\ref QCPLayoutElement::setMinimumSize, \ref QCPLayoutElement::setMaximumSize), regardless of the stretch factor. The default stretch factor of newly created rows/columns is 1. \see setColumnStretchFactor, setRowStretchFactors */ void QCPLayoutGrid::setColumnStretchFactors(const QList &factors) { if (factors.size() == mColumnStretchFactors.size()) { mColumnStretchFactors = factors; for (int i=0; i= 0 && row < rowCount()) { if (factor > 0) mRowStretchFactors[row] = factor; else qDebug() << Q_FUNC_INFO << "Invalid stretch factor, must be positive:" << factor; } else qDebug() << Q_FUNC_INFO << "Invalid row:" << row; } /*! Sets the stretch \a factors of all rows. \a factors must have the size \ref rowCount. Stretch factors control the relative sizes of rows and columns. Cells will not be resized beyond their minimum and maximum widths/heights (\ref QCPLayoutElement::setMinimumSize, \ref QCPLayoutElement::setMaximumSize), regardless of the stretch factor. The default stretch factor of newly created rows/columns is 1. \see setRowStretchFactor, setColumnStretchFactors */ void QCPLayoutGrid::setRowStretchFactors(const QList &factors) { if (factors.size() == mRowStretchFactors.size()) { mRowStretchFactors = factors; for (int i=0; i tempElements; if (rearrange) { tempElements.reserve(elCount); for (int i=0; i()); mRowStretchFactors.append(1); } // go through rows and expand columns as necessary: int newColCount = qMax(columnCount(), newColumnCount); for (int i=0; i rowCount()) newIndex = rowCount(); mRowStretchFactors.insert(newIndex, 1); QList newRow; for (int col=0; col columnCount()) newIndex = columnCount(); mColumnStretchFactors.insert(newIndex, 1); for (int row=0; row= 0 && row < rowCount()) { if (column >= 0 && column < columnCount()) { switch (mFillOrder) { case foRowsFirst: return column*rowCount() + row; case foColumnsFirst: return row*columnCount() + column; } } else qDebug() << Q_FUNC_INFO << "row index out of bounds:" << row; } else qDebug() << Q_FUNC_INFO << "column index out of bounds:" << column; return 0; } /*! Converts the linear index to row and column indices and writes the result to \a row and \a column. The way the cells are indexed depends on \ref setFillOrder. If it is \ref foRowsFirst, the indices increase left to right and then top to bottom. If it is \ref foColumnsFirst, the indices increase top to bottom and then left to right. If there are no cells (i.e. column or row count is zero), sets \a row and \a column to -1. For the retrieved \a row and \a column to be valid, the passed \a index must be valid itself, i.e. greater or equal to zero and smaller than the current \ref elementCount. \see rowColToIndex */ void QCPLayoutGrid::indexToRowCol(int index, int &row, int &column) const { row = -1; column = -1; if (columnCount() == 0 || rowCount() == 0) return; if (index < 0 || index >= elementCount()) { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return; } switch (mFillOrder) { case foRowsFirst: { column = index / rowCount(); row = index % rowCount(); break; } case foColumnsFirst: { row = index / columnCount(); column = index % columnCount(); break; } } } /* inherits documentation from base class */ void QCPLayoutGrid::updateLayout() { QVector minColWidths, minRowHeights, maxColWidths, maxRowHeights; getMinimumRowColSizes(&minColWidths, &minRowHeights); getMaximumRowColSizes(&maxColWidths, &maxRowHeights); int totalRowSpacing = (rowCount()-1) * mRowSpacing; int totalColSpacing = (columnCount()-1) * mColumnSpacing; QVector colWidths = getSectionSizes(maxColWidths, minColWidths, mColumnStretchFactors.toVector(), mRect.width()-totalColSpacing); QVector rowHeights = getSectionSizes(maxRowHeights, minRowHeights, mRowStretchFactors.toVector(), mRect.height()-totalRowSpacing); // go through cells and set rects accordingly: int yOffset = mRect.top(); for (int row=0; row 0) yOffset += rowHeights.at(row-1)+mRowSpacing; int xOffset = mRect.left(); for (int col=0; col 0) xOffset += colWidths.at(col-1)+mColumnSpacing; if (mElements.at(row).at(col)) mElements.at(row).at(col)->setOuterRect(QRect(xOffset, yOffset, colWidths.at(col), rowHeights.at(row))); } } } /*! \seebaseclassmethod Note that the association of the linear \a index to the row/column based cells depends on the current setting of \ref setFillOrder. \see rowColToIndex */ QCPLayoutElement *QCPLayoutGrid::elementAt(int index) const { if (index >= 0 && index < elementCount()) { int row, col; indexToRowCol(index, row, col); return mElements.at(row).at(col); } else return 0; } /*! \seebaseclassmethod Note that the association of the linear \a index to the row/column based cells depends on the current setting of \ref setFillOrder. \see rowColToIndex */ QCPLayoutElement *QCPLayoutGrid::takeAt(int index) { if (QCPLayoutElement *el = elementAt(index)) { releaseElement(el); int row, col; indexToRowCol(index, row, col); mElements[row][col] = 0; return el; } else { qDebug() << Q_FUNC_INFO << "Attempt to take invalid index:" << index; return 0; } } /* inherits documentation from base class */ bool QCPLayoutGrid::take(QCPLayoutElement *element) { if (element) { for (int i=0; i QCPLayoutGrid::elements(bool recursive) const { QList result; const int elCount = elementCount(); #if QT_VERSION >= QT_VERSION_CHECK(4, 7, 0) result.reserve(elCount); #endif for (int i=0; ielements(recursive); } } return result; } /*! Simplifies the layout by collapsing rows and columns which only contain empty cells. */ void QCPLayoutGrid::simplify() { // remove rows with only empty cells: for (int row=rowCount()-1; row>=0; --row) { bool hasElements = false; for (int col=0; col=0; --col) { bool hasElements = false; for (int row=0; row minColWidths, minRowHeights; getMinimumRowColSizes(&minColWidths, &minRowHeights); QSize result(0, 0); for (int i=0; i maxColWidths, maxRowHeights; getMaximumRowColSizes(&maxColWidths, &maxRowHeights); QSize result(0, 0); for (int i=0; i *minColWidths, QVector *minRowHeights) const { *minColWidths = QVector(columnCount(), 0); *minRowHeights = QVector(rowCount(), 0); for (int row=0; rowminimumSizeHint(); QSize min = mElements.at(row).at(col)->minimumSize(); QSize final(min.width() > 0 ? min.width() : minHint.width(), min.height() > 0 ? min.height() : minHint.height()); if (minColWidths->at(col) < final.width()) (*minColWidths)[col] = final.width(); if (minRowHeights->at(row) < final.height()) (*minRowHeights)[row] = final.height(); } } } } /*! \internal Places the maximum column widths and row heights into \a maxColWidths and \a maxRowHeights respectively. The maximum height of a row is the smallest maximum height of any element in that row. The maximum width of a column is the smallest maximum width of any element in that column. This is a helper function for \ref updateLayout. \see getMinimumRowColSizes */ void QCPLayoutGrid::getMaximumRowColSizes(QVector *maxColWidths, QVector *maxRowHeights) const { *maxColWidths = QVector(columnCount(), QWIDGETSIZE_MAX); *maxRowHeights = QVector(rowCount(), QWIDGETSIZE_MAX); for (int row=0; rowmaximumSizeHint(); QSize max = mElements.at(row).at(col)->maximumSize(); QSize final(max.width() < QWIDGETSIZE_MAX ? max.width() : maxHint.width(), max.height() < QWIDGETSIZE_MAX ? max.height() : maxHint.height()); if (maxColWidths->at(col) > final.width()) (*maxColWidths)[col] = final.width(); if (maxRowHeights->at(row) > final.height()) (*maxRowHeights)[row] = final.height(); } } } } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPLayoutInset //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPLayoutInset \brief A layout that places child elements aligned to the border or arbitrarily positioned Elements are placed either aligned to the border or at arbitrary position in the area of the layout. Which placement applies is controlled with the \ref InsetPlacement (\ref setInsetPlacement). Elements are added via \ref addElement(QCPLayoutElement *element, Qt::Alignment alignment) or addElement(QCPLayoutElement *element, const QRectF &rect). If the first method is used, the inset placement will default to \ref ipBorderAligned and the element will be aligned according to the \a alignment parameter. The second method defaults to \ref ipFree and allows placing elements at arbitrary position and size, defined by \a rect. The alignment or rect can be set via \ref setInsetAlignment or \ref setInsetRect, respectively. This is the layout that every QCPAxisRect has as \ref QCPAxisRect::insetLayout. */ /* start documentation of inline functions */ /*! \fn virtual void QCPLayoutInset::simplify() The QCPInsetLayout does not need simplification since it can never have empty cells due to its linear index structure. This method does nothing. */ /* end documentation of inline functions */ /*! Creates an instance of QCPLayoutInset and sets default values. */ QCPLayoutInset::QCPLayoutInset() { } QCPLayoutInset::~QCPLayoutInset() { // clear all child layout elements. This is important because only the specific layouts know how // to handle removing elements (clear calls virtual removeAt method to do that). clear(); } /*! Returns the placement type of the element with the specified \a index. */ QCPLayoutInset::InsetPlacement QCPLayoutInset::insetPlacement(int index) const { if (elementAt(index)) return mInsetPlacement.at(index); else { qDebug() << Q_FUNC_INFO << "Invalid element index:" << index; return ipFree; } } /*! Returns the alignment of the element with the specified \a index. The alignment only has a meaning, if the inset placement (\ref setInsetPlacement) is \ref ipBorderAligned. */ Qt::Alignment QCPLayoutInset::insetAlignment(int index) const { if (elementAt(index)) return mInsetAlignment.at(index); else { qDebug() << Q_FUNC_INFO << "Invalid element index:" << index; return 0; } } /*! Returns the rect of the element with the specified \a index. The rect only has a meaning, if the inset placement (\ref setInsetPlacement) is \ref ipFree. */ QRectF QCPLayoutInset::insetRect(int index) const { if (elementAt(index)) return mInsetRect.at(index); else { qDebug() << Q_FUNC_INFO << "Invalid element index:" << index; return QRectF(); } } /*! Sets the inset placement type of the element with the specified \a index to \a placement. \see InsetPlacement */ void QCPLayoutInset::setInsetPlacement(int index, QCPLayoutInset::InsetPlacement placement) { if (elementAt(index)) mInsetPlacement[index] = placement; else qDebug() << Q_FUNC_INFO << "Invalid element index:" << index; } /*! If the inset placement (\ref setInsetPlacement) is \ref ipBorderAligned, this function is used to set the alignment of the element with the specified \a index to \a alignment. \a alignment is an or combination of the following alignment flags: Qt::AlignLeft, Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other alignment flags will be ignored. */ void QCPLayoutInset::setInsetAlignment(int index, Qt::Alignment alignment) { if (elementAt(index)) mInsetAlignment[index] = alignment; else qDebug() << Q_FUNC_INFO << "Invalid element index:" << index; } /*! If the inset placement (\ref setInsetPlacement) is \ref ipFree, this function is used to set the position and size of the element with the specified \a index to \a rect. \a rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1) will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right corner of the layout, with 35% width and height of the parent layout. Note that the minimum and maximum sizes of the embedded element (\ref QCPLayoutElement::setMinimumSize, \ref QCPLayoutElement::setMaximumSize) are enforced. */ void QCPLayoutInset::setInsetRect(int index, const QRectF &rect) { if (elementAt(index)) mInsetRect[index] = rect; else qDebug() << Q_FUNC_INFO << "Invalid element index:" << index; } /* inherits documentation from base class */ void QCPLayoutInset::updateLayout() { for (int i=0; iminimumSizeHint(); QSize maxSizeHint = mElements.at(i)->maximumSizeHint(); finalMinSize.setWidth(mElements.at(i)->minimumSize().width() > 0 ? mElements.at(i)->minimumSize().width() : minSizeHint.width()); finalMinSize.setHeight(mElements.at(i)->minimumSize().height() > 0 ? mElements.at(i)->minimumSize().height() : minSizeHint.height()); finalMaxSize.setWidth(mElements.at(i)->maximumSize().width() < QWIDGETSIZE_MAX ? mElements.at(i)->maximumSize().width() : maxSizeHint.width()); finalMaxSize.setHeight(mElements.at(i)->maximumSize().height() < QWIDGETSIZE_MAX ? mElements.at(i)->maximumSize().height() : maxSizeHint.height()); if (mInsetPlacement.at(i) == ipFree) { insetRect = QRect(rect().x()+rect().width()*mInsetRect.at(i).x(), rect().y()+rect().height()*mInsetRect.at(i).y(), rect().width()*mInsetRect.at(i).width(), rect().height()*mInsetRect.at(i).height()); if (insetRect.size().width() < finalMinSize.width()) insetRect.setWidth(finalMinSize.width()); if (insetRect.size().height() < finalMinSize.height()) insetRect.setHeight(finalMinSize.height()); if (insetRect.size().width() > finalMaxSize.width()) insetRect.setWidth(finalMaxSize.width()); if (insetRect.size().height() > finalMaxSize.height()) insetRect.setHeight(finalMaxSize.height()); } else if (mInsetPlacement.at(i) == ipBorderAligned) { insetRect.setSize(finalMinSize); Qt::Alignment al = mInsetAlignment.at(i); if (al.testFlag(Qt::AlignLeft)) insetRect.moveLeft(rect().x()); else if (al.testFlag(Qt::AlignRight)) insetRect.moveRight(rect().x()+rect().width()); else insetRect.moveLeft(rect().x()+rect().width()*0.5-finalMinSize.width()*0.5); // default to Qt::AlignHCenter if (al.testFlag(Qt::AlignTop)) insetRect.moveTop(rect().y()); else if (al.testFlag(Qt::AlignBottom)) insetRect.moveBottom(rect().y()+rect().height()); else insetRect.moveTop(rect().y()+rect().height()*0.5-finalMinSize.height()*0.5); // default to Qt::AlignVCenter } mElements.at(i)->setOuterRect(insetRect); } } /* inherits documentation from base class */ int QCPLayoutInset::elementCount() const { return mElements.size(); } /* inherits documentation from base class */ QCPLayoutElement *QCPLayoutInset::elementAt(int index) const { if (index >= 0 && index < mElements.size()) return mElements.at(index); else return 0; } /* inherits documentation from base class */ QCPLayoutElement *QCPLayoutInset::takeAt(int index) { if (QCPLayoutElement *el = elementAt(index)) { releaseElement(el); mElements.removeAt(index); mInsetPlacement.removeAt(index); mInsetAlignment.removeAt(index); mInsetRect.removeAt(index); return el; } else { qDebug() << Q_FUNC_INFO << "Attempt to take invalid index:" << index; return 0; } } /* inherits documentation from base class */ bool QCPLayoutInset::take(QCPLayoutElement *element) { if (element) { for (int i=0; irealVisibility() && mElements.at(i)->selectTest(pos, onlySelectable) >= 0) return mParentPlot->selectionTolerance()*0.99; } return -1; } /*! Adds the specified \a element to the layout as an inset aligned at the border (\ref setInsetAlignment is initialized with \ref ipBorderAligned). The alignment is set to \a alignment. \a alignment is an or combination of the following alignment flags: Qt::AlignLeft, Qt::AlignHCenter, Qt::AlighRight, Qt::AlignTop, Qt::AlignVCenter, Qt::AlignBottom. Any other alignment flags will be ignored. \see addElement(QCPLayoutElement *element, const QRectF &rect) */ void QCPLayoutInset::addElement(QCPLayoutElement *element, Qt::Alignment alignment) { if (element) { if (element->layout()) // remove from old layout first element->layout()->take(element); mElements.append(element); mInsetPlacement.append(ipBorderAligned); mInsetAlignment.append(alignment); mInsetRect.append(QRectF(0.6, 0.6, 0.4, 0.4)); adoptElement(element); } else qDebug() << Q_FUNC_INFO << "Can't add null element"; } /*! Adds the specified \a element to the layout as an inset with free positioning/sizing (\ref setInsetAlignment is initialized with \ref ipFree). The position and size is set to \a rect. \a rect is given in fractions of the whole inset layout rect. So an inset with rect (0, 0, 1, 1) will span the entire layout. An inset with rect (0.6, 0.1, 0.35, 0.35) will be in the top right corner of the layout, with 35% width and height of the parent layout. \see addElement(QCPLayoutElement *element, Qt::Alignment alignment) */ void QCPLayoutInset::addElement(QCPLayoutElement *element, const QRectF &rect) { if (element) { if (element->layout()) // remove from old layout first element->layout()->take(element); mElements.append(element); mInsetPlacement.append(ipFree); mInsetAlignment.append(Qt::AlignRight|Qt::AlignTop); mInsetRect.append(rect); adoptElement(element); } else qDebug() << Q_FUNC_INFO << "Can't add null element"; } /* end of 'src/layout.cpp' */ /* including file 'src/lineending.cpp', size 11536 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPLineEnding //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPLineEnding \brief Handles the different ending decorations for line-like items \image html QCPLineEnding.png "The various ending styles currently supported" For every ending a line-like item has, an instance of this class exists. For example, QCPItemLine has two endings which can be set with QCPItemLine::setHead and QCPItemLine::setTail. The styles themselves are defined via the enum QCPLineEnding::EndingStyle. Most decorations can be modified regarding width and length, see \ref setWidth and \ref setLength. The direction of the ending decoration (e.g. direction an arrow is pointing) is controlled by the line-like item. For example, when both endings of a QCPItemLine are set to be arrows, they will point to opposite directions, e.g. "outward". This can be changed by \ref setInverted, which would make the respective arrow point inward. Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle where actually a QCPLineEnding is expected, e.g. \snippet documentation/doc-code-snippets/mainwindow.cpp qcplineending-sethead */ /*! Creates a QCPLineEnding instance with default values (style \ref esNone). */ QCPLineEnding::QCPLineEnding() : mStyle(esNone), mWidth(8), mLength(10), mInverted(false) { } /*! Creates a QCPLineEnding instance with the specified values. */ QCPLineEnding::QCPLineEnding(QCPLineEnding::EndingStyle style, double width, double length, bool inverted) : mStyle(style), mWidth(width), mLength(length), mInverted(inverted) { } /*! Sets the style of the ending decoration. */ void QCPLineEnding::setStyle(QCPLineEnding::EndingStyle style) { mStyle = style; } /*! Sets the width of the ending decoration, if the style supports it. On arrows, for example, the width defines the size perpendicular to the arrow's pointing direction. \see setLength */ void QCPLineEnding::setWidth(double width) { mWidth = width; } /*! Sets the length of the ending decoration, if the style supports it. On arrows, for example, the length defines the size in pointing direction. \see setWidth */ void QCPLineEnding::setLength(double length) { mLength = length; } /*! Sets whether the ending decoration shall be inverted. For example, an arrow decoration will point inward when \a inverted is set to true. Note that also the \a width direction is inverted. For symmetrical ending styles like arrows or discs, this doesn't make a difference. However, asymmetric styles like \ref esHalfBar are affected by it, which can be used to control to which side the half bar points to. */ void QCPLineEnding::setInverted(bool inverted) { mInverted = inverted; } /*! \internal Returns the maximum pixel radius the ending decoration might cover, starting from the position the decoration is drawn at (typically a line ending/\ref QCPItemPosition of an item). This is relevant for clipping. Only omit painting of the decoration when the position where the decoration is supposed to be drawn is farther away from the clipping rect than the returned distance. */ double QCPLineEnding::boundingDistance() const { switch (mStyle) { case esNone: return 0; case esFlatArrow: case esSpikeArrow: case esLineArrow: case esSkewedBar: return qSqrt(mWidth*mWidth+mLength*mLength); // items that have width and length case esDisc: case esSquare: case esDiamond: case esBar: case esHalfBar: return mWidth*1.42; // items that only have a width -> width*sqrt(2) } return 0; } /*! Starting from the origin of this line ending (which is style specific), returns the length covered by the line ending symbol, in backward direction. For example, the \ref esSpikeArrow has a shorter real length than a \ref esFlatArrow, even if both have the same \ref setLength value, because the spike arrow has an inward curved back, which reduces the length along its center axis (the drawing origin for arrows is at the tip). This function is used for precise, style specific placement of line endings, for example in QCPAxes. */ double QCPLineEnding::realLength() const { switch (mStyle) { case esNone: case esLineArrow: case esSkewedBar: case esBar: case esHalfBar: return 0; case esFlatArrow: return mLength; case esDisc: case esSquare: case esDiamond: return mWidth*0.5; case esSpikeArrow: return mLength*0.8; } return 0; } /*! \internal Draws the line ending with the specified \a painter at the position \a pos. The direction of the line ending is controlled with \a dir. */ void QCPLineEnding::draw(QCPPainter *painter, const QCPVector2D &pos, const QCPVector2D &dir) const { if (mStyle == esNone) return; QCPVector2D lengthVec = dir.normalized() * mLength*(mInverted ? -1 : 1); if (lengthVec.isNull()) lengthVec = QCPVector2D(1, 0); QCPVector2D widthVec = dir.normalized().perpendicular() * mWidth*0.5*(mInverted ? -1 : 1); QPen penBackup = painter->pen(); QBrush brushBackup = painter->brush(); QPen miterPen = penBackup; miterPen.setJoinStyle(Qt::MiterJoin); // to make arrow heads spikey QBrush brush(painter->pen().color(), Qt::SolidPattern); switch (mStyle) { case esNone: break; case esFlatArrow: { QPointF points[3] = {pos.toPointF(), (pos-lengthVec+widthVec).toPointF(), (pos-lengthVec-widthVec).toPointF() }; painter->setPen(miterPen); painter->setBrush(brush); painter->drawConvexPolygon(points, 3); painter->setBrush(brushBackup); painter->setPen(penBackup); break; } case esSpikeArrow: { QPointF points[4] = {pos.toPointF(), (pos-lengthVec+widthVec).toPointF(), (pos-lengthVec*0.8).toPointF(), (pos-lengthVec-widthVec).toPointF() }; painter->setPen(miterPen); painter->setBrush(brush); painter->drawConvexPolygon(points, 4); painter->setBrush(brushBackup); painter->setPen(penBackup); break; } case esLineArrow: { QPointF points[3] = {(pos-lengthVec+widthVec).toPointF(), pos.toPointF(), (pos-lengthVec-widthVec).toPointF() }; painter->setPen(miterPen); painter->drawPolyline(points, 3); painter->setPen(penBackup); break; } case esDisc: { painter->setBrush(brush); painter->drawEllipse(pos.toPointF(), mWidth*0.5, mWidth*0.5); painter->setBrush(brushBackup); break; } case esSquare: { QCPVector2D widthVecPerp = widthVec.perpendicular(); QPointF points[4] = {(pos-widthVecPerp+widthVec).toPointF(), (pos-widthVecPerp-widthVec).toPointF(), (pos+widthVecPerp-widthVec).toPointF(), (pos+widthVecPerp+widthVec).toPointF() }; painter->setPen(miterPen); painter->setBrush(brush); painter->drawConvexPolygon(points, 4); painter->setBrush(brushBackup); painter->setPen(penBackup); break; } case esDiamond: { QCPVector2D widthVecPerp = widthVec.perpendicular(); QPointF points[4] = {(pos-widthVecPerp).toPointF(), (pos-widthVec).toPointF(), (pos+widthVecPerp).toPointF(), (pos+widthVec).toPointF() }; painter->setPen(miterPen); painter->setBrush(brush); painter->drawConvexPolygon(points, 4); painter->setBrush(brushBackup); painter->setPen(penBackup); break; } case esBar: { painter->drawLine((pos+widthVec).toPointF(), (pos-widthVec).toPointF()); break; } case esHalfBar: { painter->drawLine((pos+widthVec).toPointF(), pos.toPointF()); break; } case esSkewedBar: { if (qFuzzyIsNull(painter->pen().widthF()) && !painter->modes().testFlag(QCPPainter::pmNonCosmetic)) { // if drawing with cosmetic pen (perfectly thin stroke, happens only in vector exports), draw bar exactly on tip of line painter->drawLine((pos+widthVec+lengthVec*0.2*(mInverted?-1:1)).toPointF(), (pos-widthVec-lengthVec*0.2*(mInverted?-1:1)).toPointF()); } else { // if drawing with thick (non-cosmetic) pen, shift bar a little in line direction to prevent line from sticking through bar slightly painter->drawLine((pos+widthVec+lengthVec*0.2*(mInverted?-1:1)+dir.normalized()*qMax(1.0f, (float)painter->pen().widthF())*0.5f).toPointF(), (pos-widthVec-lengthVec*0.2*(mInverted?-1:1)+dir.normalized()*qMax(1.0f, (float)painter->pen().widthF())*0.5f).toPointF()); } break; } } } /*! \internal \overload Draws the line ending. The direction is controlled with the \a angle parameter in radians. */ void QCPLineEnding::draw(QCPPainter *painter, const QCPVector2D &pos, double angle) const { draw(painter, pos, QCPVector2D(qCos(angle), qSin(angle))); } /* end of 'src/lineending.cpp' */ /* including file 'src/axis/axisticker.cpp', size 18664 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisTicker //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisTicker \brief The base class tick generator used by QCPAxis to create tick positions and tick labels Each QCPAxis has an internal QCPAxisTicker (or a subclass) in order to generate tick positions and tick labels for the current axis range. The ticker of an axis can be set via \ref QCPAxis::setTicker. Since that method takes a QSharedPointer, multiple axes can share the same ticker instance. This base class generates normal tick coordinates and numeric labels for linear axes. It picks a reasonable tick step (the separation between ticks) which results in readable tick labels. The number of ticks that should be approximately generated can be set via \ref setTickCount. Depending on the current tick step strategy (\ref setTickStepStrategy), the algorithm either sacrifices readability to better match the specified tick count (\ref QCPAxisTicker::tssMeetTickCount) or relaxes the tick count in favor of better tick steps (\ref QCPAxisTicker::tssReadability), which is the default. The following more specialized axis ticker subclasses are available, see details in the respective class documentation:

QCPAxisTickerFixed\image html axisticker-fixed.png
QCPAxisTickerLog\image html axisticker-log.png
QCPAxisTickerPi\image html axisticker-pi.png
QCPAxisTickerText\image html axisticker-text.png
QCPAxisTickerDateTime\image html axisticker-datetime.png
QCPAxisTickerTime\image html axisticker-time.png \image html axisticker-time2.png
\section axisticker-subclassing Creating own axis tickers Creating own axis tickers can be achieved very easily by sublassing QCPAxisTicker and reimplementing some or all of the available virtual methods. In the simplest case you might wish to just generate different tick steps than the other tickers, so you only reimplement the method \ref getTickStep. If you additionally want control over the string that will be shown as tick label, reimplement \ref getTickLabel. If you wish to have complete control, you can generate the tick vectors and tick label vectors yourself by reimplementing \ref createTickVector and \ref createLabelVector. The default implementations use the previously mentioned virtual methods \ref getTickStep and \ref getTickLabel, but your reimplementations don't necessarily need to do so. For example in the case of unequal tick steps, the method \ref getTickStep loses its usefulness and can be ignored. The sub tick count between major ticks can be controlled with \ref getSubTickCount. Full sub tick placement control is obtained by reimplementing \ref createSubTickVector. See the documentation of all these virtual methods in QCPAxisTicker for detailed information about the parameters and expected return values. */ /*! Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker. */ QCPAxisTicker::QCPAxisTicker() : mTickStepStrategy(tssReadability), mTickCount(5), mTickOrigin(0) { } QCPAxisTicker::~QCPAxisTicker() { } /*! Sets which strategy the axis ticker follows when choosing the size of the tick step. For the available strategies, see \ref TickStepStrategy. */ void QCPAxisTicker::setTickStepStrategy(QCPAxisTicker::TickStepStrategy strategy) { mTickStepStrategy = strategy; } /*! Sets how many ticks this ticker shall aim to generate across the axis range. Note that \a count is not guaranteed to be matched exactly, as generating readable tick intervals may conflict with the requested number of ticks. Whether the readability has priority over meeting the requested \a count can be specified with \ref setTickStepStrategy. */ void QCPAxisTicker::setTickCount(int count) { if (count > 0) mTickCount = count; else qDebug() << Q_FUNC_INFO << "tick count must be greater than zero:" << count; } /*! Sets the mathematical coordinate (or "offset") of the zeroth tick. This tick coordinate is just a concept and doesn't need to be inside the currently visible axis range. By default \a origin is zero, which for example yields ticks {-5, 0, 5, 10, 15,...} when the tick step is five. If \a origin is now set to 1 instead, the correspondingly generated ticks would be {-4, 1, 6, 11, 16,...}. */ void QCPAxisTicker::setTickOrigin(double origin) { mTickOrigin = origin; } /*! This is the method called by QCPAxis in order to actually generate tick coordinates (\a ticks), tick label strings (\a tickLabels) and sub tick coordinates (\a subTicks). The ticks are generated for the specified \a range. The generated labels typically follow the specified \a locale, \a formatChar and number \a precision, however this might be different (or even irrelevant) for certain QCPAxisTicker subclasses. The output parameter \a ticks is filled with the generated tick positions in axis coordinates. The output parameters \a subTicks and \a tickLabels are optional (set them to 0 if not needed) and are respectively filled with sub tick coordinates, and tick label strings belonging to \a ticks by index. */ void QCPAxisTicker::generate(const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector &ticks, QVector *subTicks, QVector *tickLabels) { // generate (major) ticks: double tickStep = getTickStep(range); ticks = createTickVector(tickStep, range); trimTicks(range, ticks, true); // trim ticks to visible range plus one outer tick on each side (incase a subclass createTickVector creates more) // generate sub ticks between major ticks: if (subTicks) { if (ticks.size() > 0) { *subTicks = createSubTickVector(getSubTickCount(tickStep), ticks); trimTicks(range, *subTicks, false); } else *subTicks = QVector(); } // finally trim also outliers (no further clipping happens in axis drawing): trimTicks(range, ticks, false); // generate labels for visible ticks if requested: if (tickLabels) *tickLabels = createLabelVector(ticks, locale, formatChar, precision); } /*! \internal Takes the entire currently visible axis range and returns a sensible tick step in order to provide readable tick labels as well as a reasonable number of tick counts (see \ref setTickCount, \ref setTickStepStrategy). If a QCPAxisTicker subclass only wants a different tick step behaviour than the default implementation, it should reimplement this method. See \ref cleanMantissa for a possible helper function. */ double QCPAxisTicker::getTickStep(const QCPRange &range) { double exactStep = range.size()/(double)(mTickCount+1e-10); // mTickCount ticks on average, the small addition is to prevent jitter on exact integers return cleanMantissa(exactStep); } /*! \internal Takes the \a tickStep, i.e. the distance between two consecutive ticks, and returns an appropriate number of sub ticks for that specific tick step. Note that a returned sub tick count of e.g. 4 will split each tick interval into 5 sections. */ int QCPAxisTicker::getSubTickCount(double tickStep) { int result = 1; // default to 1, if no proper value can be found // separate integer and fractional part of mantissa: double epsilon = 0.01; double intPartf; int intPart; double fracPart = modf(getMantissa(tickStep), &intPartf); intPart = intPartf; // handle cases with (almost) integer mantissa: if (fracPart < epsilon || 1.0-fracPart < epsilon) { if (1.0-fracPart < epsilon) ++intPart; switch (intPart) { case 1: result = 4; break; // 1.0 -> 0.2 substep case 2: result = 3; break; // 2.0 -> 0.5 substep case 3: result = 2; break; // 3.0 -> 1.0 substep case 4: result = 3; break; // 4.0 -> 1.0 substep case 5: result = 4; break; // 5.0 -> 1.0 substep case 6: result = 2; break; // 6.0 -> 2.0 substep case 7: result = 6; break; // 7.0 -> 1.0 substep case 8: result = 3; break; // 8.0 -> 2.0 substep case 9: result = 2; break; // 9.0 -> 3.0 substep } } else { // handle cases with significantly fractional mantissa: if (qAbs(fracPart-0.5) < epsilon) // *.5 mantissa { switch (intPart) { case 1: result = 2; break; // 1.5 -> 0.5 substep case 2: result = 4; break; // 2.5 -> 0.5 substep case 3: result = 4; break; // 3.5 -> 0.7 substep case 4: result = 2; break; // 4.5 -> 1.5 substep case 5: result = 4; break; // 5.5 -> 1.1 substep (won't occur with default getTickStep from here on) case 6: result = 4; break; // 6.5 -> 1.3 substep case 7: result = 2; break; // 7.5 -> 2.5 substep case 8: result = 4; break; // 8.5 -> 1.7 substep case 9: result = 4; break; // 9.5 -> 1.9 substep } } // if mantissa fraction isn't 0.0 or 0.5, don't bother finding good sub tick marks, leave default } return result; } /*! \internal This method returns the tick label string as it should be printed under the \a tick coordinate. If a textual number is returned, it should respect the provided \a locale, \a formatChar and \a precision. If the returned value contains exponentials of the form "2e5" and beautifully typeset powers is enabled in the QCPAxis number format (\ref QCPAxis::setNumberFormat), the exponential part will be formatted accordingly using multiplication symbol and superscript during rendering of the label automatically. */ QString QCPAxisTicker::getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) { return locale.toString(tick, formatChar.toLatin1(), precision); } /*! \internal Returns a vector containing all coordinates of sub ticks that should be drawn. It generates \a subTickCount sub ticks between each tick pair given in \a ticks. If a QCPAxisTicker subclass needs maximal control over the generated sub ticks, it should reimplement this method. Depending on the purpose of the subclass it doesn't necessarily need to base its result on \a subTickCount or \a ticks. */ QVector QCPAxisTicker::createSubTickVector(int subTickCount, const QVector &ticks) { QVector result; if (subTickCount <= 0 || ticks.size() < 2) return result; result.reserve((ticks.size()-1)*subTickCount); for (int i=1; i QCPAxisTicker::createTickVector(double tickStep, const QCPRange &range) { QVector result; // Generate tick positions according to tickStep: qint64 firstStep = floor((range.lower-mTickOrigin)/tickStep); // do not use qFloor here, or we'll lose 64 bit precision qint64 lastStep = ceil((range.upper-mTickOrigin)/tickStep); // do not use qCeil here, or we'll lose 64 bit precision int tickcount = lastStep-firstStep+1; if (tickcount < 0) tickcount = 0; result.resize(tickcount); for (int i=0; i QCPAxisTicker::createLabelVector(const QVector &ticks, const QLocale &locale, QChar formatChar, int precision) { QVector result; result.reserve(ticks.size()); for (int i=0; i &ticks, bool keepOneOutlier) const { bool lowFound = false; bool highFound = false; int lowIndex = 0; int highIndex = -1; for (int i=0; i < ticks.size(); ++i) { if (ticks.at(i) >= range.lower) { lowFound = true; lowIndex = i; break; } } for (int i=ticks.size()-1; i >= 0; --i) { if (ticks.at(i) <= range.upper) { highFound = true; highIndex = i; break; } } if (highFound && lowFound) { int trimFront = qMax(0, lowIndex-(keepOneOutlier ? 1 : 0)); int trimBack = qMax(0, ticks.size()-(keepOneOutlier ? 2 : 1)-highIndex); if (trimFront > 0 || trimBack > 0) ticks = ticks.mid(trimFront, ticks.size()-trimFront-trimBack); } else // all ticks are either all below or all above the range ticks.clear(); } /*! \internal Returns the coordinate contained in \a candidates which is closest to the provided \a target. This method assumes \a candidates is not empty and sorted in ascending order. */ double QCPAxisTicker::pickClosest(double target, const QVector &candidates) const { if (candidates.size() == 1) return candidates.first(); QVector::const_iterator it = std::lower_bound(candidates.constBegin(), candidates.constEnd(), target); if (it == candidates.constEnd()) return *(it-1); else if (it == candidates.constBegin()) return *it; else return target-*(it-1) < *it-target ? *(it-1) : *it; } /*! \internal Returns the decimal mantissa of \a input. Optionally, if \a magnitude is not set to zero, it also returns the magnitude of \a input as a power of 10. For example, an input of 142.6 will return a mantissa of 1.426 and a magnitude of 100. */ double QCPAxisTicker::getMantissa(double input, double *magnitude) const { const double mag = qPow(10.0, qFloor(qLn(input)/qLn(10.0))); if (magnitude) *magnitude = mag; return input/mag; } /*! \internal Returns a number that is close to \a input but has a clean, easier human readable mantissa. How strongly the mantissa is altered, and thus how strong the result deviates from the original \a input, depends on the current tick step strategy (see \ref setTickStepStrategy). */ double QCPAxisTicker::cleanMantissa(double input) const { double magnitude; const double mantissa = getMantissa(input, &magnitude); switch (mTickStepStrategy) { case tssReadability: { return pickClosest(mantissa, QVector() << 1.0 << 2.0 << 2.5 << 5.0 << 10.0)*magnitude; } case tssMeetTickCount: { // this gives effectively a mantissa of 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 8.0, 10.0 if (mantissa <= 5.0) return (int)(mantissa*2)/2.0*magnitude; // round digit after decimal point to 0.5 else return (int)(mantissa/2.0)*2.0*magnitude; // round to first digit in multiples of 2 } } return input; } /* end of 'src/axis/axisticker.cpp' */ /* including file 'src/axis/axistickerdatetime.cpp', size 14443 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisTickerDateTime //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisTickerDateTime \brief Specialized axis ticker for calendar dates and times as axis ticks \image html axisticker-datetime.png This QCPAxisTicker subclass generates ticks that correspond to real calendar dates and times. The plot axis coordinate is interpreted as Unix Time, so seconds since Epoch (January 1, 1970, 00:00 UTC). This is also used for example by QDateTime in the toTime_t()/setTime_t() methods with a precision of one second. Since Qt 4.7, millisecond accuracy can be obtained from QDateTime by using QDateTime::fromMSecsSinceEpoch()/1000.0. The static methods \ref dateTimeToKey and \ref keyToDateTime conveniently perform this conversion achieving a precision of one millisecond on all Qt versions. The format of the date/time display in the tick labels is controlled with \ref setDateTimeFormat. If a different time spec (time zone) shall be used, see \ref setDateTimeSpec. This ticker produces unequal tick spacing in order to provide intuitive date and time-of-day ticks. For example, if the axis range spans a few years such that there is one tick per year, ticks will be positioned on 1. January of every year. This is intuitive but, due to leap years, will result in slightly unequal tick intervals (visually unnoticeable). The same can be seen in the image above: even though the number of days varies month by month, this ticker generates ticks on the same day of each month. If you would like to change the date/time that is used as a (mathematical) starting date for the ticks, use the \ref setTickOrigin(const QDateTime &origin) method overload, which takes a QDateTime. If you pass 15. July, 9:45 to this method, the yearly ticks will end up on 15. July at 9:45 of every year. The ticker can be created and assigned to an axis like this: \snippet documentation/doc-image-generator/mainwindow.cpp axistickerdatetime-creation \note If you rather wish to display relative times in terms of days, hours, minutes, seconds and milliseconds, and are not interested in the intricacies of real calendar dates with months and (leap) years, have a look at QCPAxisTickerTime instead. */ /*! Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker. */ QCPAxisTickerDateTime::QCPAxisTickerDateTime() : mDateTimeFormat(QLatin1String("hh:mm:ss\ndd.MM.yy")), mDateTimeSpec(Qt::LocalTime), mDateStrategy(dsNone) { setTickCount(4); } /*! Sets the format in which dates and times are displayed as tick labels. For details about the \a format string, see the documentation of QDateTime::toString(). Newlines can be inserted with "\n". \see setDateTimeSpec */ void QCPAxisTickerDateTime::setDateTimeFormat(const QString &format) { mDateTimeFormat = format; } /*! Sets the time spec that is used for creating the tick labels from corresponding dates/times. The default value of QDateTime objects (and also QCPAxisTickerDateTime) is Qt::LocalTime. However, if the date time values passed to QCustomPlot (e.g. in the form of axis ranges or keys of a plottable) are given in the UTC spec, set \a spec to Qt::UTC to get the correct axis labels. \see setDateTimeFormat */ void QCPAxisTickerDateTime::setDateTimeSpec(Qt::TimeSpec spec) { mDateTimeSpec = spec; } /*! Sets the tick origin (see \ref QCPAxisTicker::setTickOrigin) in seconds since Epoch (1. Jan 1970, 00:00 UTC). For the date time ticker it might be more intuitive to use the overload which directly takes a QDateTime, see \ref setTickOrigin(const QDateTime &origin). This is useful to define the month/day/time recurring at greater tick interval steps. For example, If you pass 15. July, 9:45 to this method and the tick interval happens to be one tick per year, the ticks will end up on 15. July at 9:45 of every year. */ void QCPAxisTickerDateTime::setTickOrigin(double origin) { QCPAxisTicker::setTickOrigin(origin); } /*! Sets the tick origin (see \ref QCPAxisTicker::setTickOrigin) as a QDateTime \a origin. This is useful to define the month/day/time recurring at greater tick interval steps. For example, If you pass 15. July, 9:45 to this method and the tick interval happens to be one tick per year, the ticks will end up on 15. July at 9:45 of every year. */ void QCPAxisTickerDateTime::setTickOrigin(const QDateTime &origin) { setTickOrigin(dateTimeToKey(origin)); } /*! \internal Returns a sensible tick step with intervals appropriate for a date-time-display, such as weekly, monthly, bi-monthly, etc. Note that this tick step isn't used exactly when generating the tick vector in \ref createTickVector, but only as a guiding value requiring some correction for each individual tick interval. Otherwise this would lead to unintuitive date displays, e.g. jumping between first day in the month to the last day in the previous month from tick to tick, due to the non-uniform length of months. The same problem arises with leap years. \seebaseclassmethod */ double QCPAxisTickerDateTime::getTickStep(const QCPRange &range) { double result = range.size()/(double)(mTickCount+1e-10); // mTickCount ticks on average, the small addition is to prevent jitter on exact integers mDateStrategy = dsNone; if (result < 1) // ideal tick step is below 1 second -> use normal clean mantissa algorithm in units of seconds { result = cleanMantissa(result); } else if (result < 86400*30.4375*12) // below a year { result = pickClosest(result, QVector() << 1 << 2.5 << 5 << 10 << 15 << 30 << 60 << 2.5*60 << 5*60 << 10*60 << 15*60 << 30*60 << 60*60 // second, minute, hour range << 3600*2 << 3600*3 << 3600*6 << 3600*12 << 3600*24 // hour to day range << 86400*2 << 86400*5 << 86400*7 << 86400*14 << 86400*30.4375 << 86400*30.4375*2 << 86400*30.4375*3 << 86400*30.4375*6 << 86400*30.4375*12); // day, week, month range (avg. days per month includes leap years) if (result > 86400*30.4375-1) // month tick intervals or larger mDateStrategy = dsUniformDayInMonth; else if (result > 3600*24-1) // day tick intervals or larger mDateStrategy = dsUniformTimeInDay; } else // more than a year, go back to normal clean mantissa algorithm but in units of years { const double secondsPerYear = 86400*30.4375*12; // average including leap years result = cleanMantissa(result/secondsPerYear)*secondsPerYear; mDateStrategy = dsUniformDayInMonth; } return result; } /*! \internal Returns a sensible sub tick count with intervals appropriate for a date-time-display, such as weekly, monthly, bi-monthly, etc. \seebaseclassmethod */ int QCPAxisTickerDateTime::getSubTickCount(double tickStep) { int result = QCPAxisTicker::getSubTickCount(tickStep); switch (qRound(tickStep)) // hand chosen subticks for specific minute/hour/day/week/month range (as specified in getTickStep) { case 5*60: result = 4; break; case 10*60: result = 1; break; case 15*60: result = 2; break; case 30*60: result = 1; break; case 60*60: result = 3; break; case 3600*2: result = 3; break; case 3600*3: result = 2; break; case 3600*6: result = 1; break; case 3600*12: result = 3; break; case 3600*24: result = 3; break; case 86400*2: result = 1; break; case 86400*5: result = 4; break; case 86400*7: result = 6; break; case 86400*14: result = 1; break; case (int)(86400*30.4375+0.5): result = 3; break; case (int)(86400*30.4375*2+0.5): result = 1; break; case (int)(86400*30.4375*3+0.5): result = 2; break; case (int)(86400*30.4375*6+0.5): result = 5; break; case (int)(86400*30.4375*12+0.5): result = 3; break; } return result; } /*! \internal Generates a date/time tick label for tick coordinate \a tick, based on the currently set format (\ref setDateTimeFormat) and time spec (\ref setDateTimeSpec). \seebaseclassmethod */ QString QCPAxisTickerDateTime::getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) { Q_UNUSED(precision) Q_UNUSED(formatChar) return locale.toString(keyToDateTime(tick).toTimeSpec(mDateTimeSpec), mDateTimeFormat); } /*! \internal Uses the passed \a tickStep as a guiding value and applies corrections in order to obtain non-uniform tick intervals but intuitive tick labels, e.g. falling on the same day of each month. \seebaseclassmethod */ QVector QCPAxisTickerDateTime::createTickVector(double tickStep, const QCPRange &range) { QVector result = QCPAxisTicker::createTickVector(tickStep, range); if (!result.isEmpty()) { if (mDateStrategy == dsUniformTimeInDay) { QDateTime uniformDateTime = keyToDateTime(mTickOrigin); // the time of this datetime will be set for all other ticks, if possible QDateTime tickDateTime; for (int i=0; i 15) // with leap years involved, date month may jump backwards or forwards, and needs to be corrected before setting day tickDateTime = tickDateTime.addMonths(-1); tickDateTime.setDate(QDate(tickDateTime.date().year(), tickDateTime.date().month(), thisUniformDay)); result[i] = dateTimeToKey(tickDateTime); } } } return result; } /*! A convenience method which turns \a key (in seconds since Epoch 1. Jan 1970, 00:00 UTC) into a QDateTime object. This can be used to turn axis coordinates to actual QDateTimes. The accuracy achieved by this method is one millisecond, irrespective of the used Qt version (it works around the lack of a QDateTime::fromMSecsSinceEpoch in Qt 4.6) \see dateTimeToKey */ QDateTime QCPAxisTickerDateTime::keyToDateTime(double key) { # if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) return QDateTime::fromTime_t(key).addMSecs((key-(qint64)key)*1000); # else return QDateTime::fromMSecsSinceEpoch(key*1000.0); # endif } /*! \overload A convenience method which turns a QDateTime object into a double value that corresponds to seconds since Epoch (1. Jan 1970, 00:00 UTC). This is the format used as axis coordinates by QCPAxisTickerDateTime. The accuracy achieved by this method is one millisecond, irrespective of the used Qt version (it works around the lack of a QDateTime::toMSecsSinceEpoch in Qt 4.6) \see keyToDateTime */ double QCPAxisTickerDateTime::dateTimeToKey(const QDateTime dateTime) { # if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) return dateTime.toTime_t()+dateTime.time().msec()/1000.0; # else return dateTime.toMSecsSinceEpoch()/1000.0; # endif } /*! \overload A convenience method which turns a QDate object into a double value that corresponds to seconds since Epoch (1. Jan 1970, 00:00 UTC). This is the format used as axis coordinates by QCPAxisTickerDateTime. \see keyToDateTime */ double QCPAxisTickerDateTime::dateTimeToKey(const QDate date) { # if QT_VERSION < QT_VERSION_CHECK(4, 7, 0) return QDateTime(date).toTime_t(); # else return QDateTime(date).toMSecsSinceEpoch()/1000.0; # endif } /* end of 'src/axis/axistickerdatetime.cpp' */ /* including file 'src/axis/axistickertime.cpp', size 11747 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisTickerTime //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisTickerTime \brief Specialized axis ticker for time spans in units of milliseconds to days \image html axisticker-time.png This QCPAxisTicker subclass generates ticks that corresponds to time intervals. The format of the time display in the tick labels is controlled with \ref setTimeFormat and \ref setFieldWidth. The time coordinate is in the unit of seconds with respect to the time coordinate zero. Unlike with QCPAxisTickerDateTime, the ticks don't correspond to a specific calendar date and time. The time can be displayed in milliseconds, seconds, minutes, hours and days. Depending on the largest available unit in the format specified with \ref setTimeFormat, any time spans above will be carried in that largest unit. So for example if the format string is "%m:%s" and a tick at coordinate value 7815 (being 2 hours, 10 minutes and 15 seconds) is created, the resulting tick label will show "130:15" (130 minutes, 15 seconds). If the format string is "%h:%m:%s", the hour unit will be used and the label will thus be "02:10:15". Negative times with respect to the axis zero will carry a leading minus sign. The ticker can be created and assigned to an axis like this: \snippet documentation/doc-image-generator/mainwindow.cpp axistickertime-creation Here is an example of a time axis providing time information in days, hours and minutes. Due to the axis range spanning a few days and the wanted tick count (\ref setTickCount), the ticker decided to use tick steps of 12 hours: \image html axisticker-time2.png The format string for this example is \snippet documentation/doc-image-generator/mainwindow.cpp axistickertime-creation-2 \note If you rather wish to display calendar dates and times, have a look at QCPAxisTickerDateTime instead. */ /*! Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker. */ QCPAxisTickerTime::QCPAxisTickerTime() : mTimeFormat(QLatin1String("%h:%m:%s")), mSmallestUnit(tuSeconds), mBiggestUnit(tuHours) { setTickCount(4); mFieldWidth[tuMilliseconds] = 3; mFieldWidth[tuSeconds] = 2; mFieldWidth[tuMinutes] = 2; mFieldWidth[tuHours] = 2; mFieldWidth[tuDays] = 1; mFormatPattern[tuMilliseconds] = QLatin1String("%z"); mFormatPattern[tuSeconds] = QLatin1String("%s"); mFormatPattern[tuMinutes] = QLatin1String("%m"); mFormatPattern[tuHours] = QLatin1String("%h"); mFormatPattern[tuDays] = QLatin1String("%d"); } /*! Sets the format that will be used to display time in the tick labels. The available patterns are: - %%z for milliseconds - %%s for seconds - %%m for minutes - %%h for hours - %%d for days The field width (zero padding) can be controlled for each unit with \ref setFieldWidth. The largest unit that appears in \a format will carry all the remaining time of a certain tick coordinate, even if it overflows the natural limit of the unit. For example, if %%m is the largest unit it might become larger than 59 in order to consume larger time values. If on the other hand %%h is available, the minutes will wrap around to zero after 59 and the time will carry to the hour digit. */ void QCPAxisTickerTime::setTimeFormat(const QString &format) { mTimeFormat = format; // determine smallest and biggest unit in format, to optimize unit replacement and allow biggest // unit to consume remaining time of a tick value and grow beyond its modulo (e.g. min > 59) mSmallestUnit = tuMilliseconds; mBiggestUnit = tuMilliseconds; bool hasSmallest = false; for (int i = tuMilliseconds; i <= tuDays; ++i) { TimeUnit unit = static_cast(i); if (mTimeFormat.contains(mFormatPattern.value(unit))) { if (!hasSmallest) { mSmallestUnit = unit; hasSmallest = true; } mBiggestUnit = unit; } } } /*! Sets the field widh of the specified \a unit to be \a width digits, when displayed in the tick label. If the number for the specific unit is shorter than \a width, it will be padded with an according number of zeros to the left in order to reach the field width. \see setTimeFormat */ void QCPAxisTickerTime::setFieldWidth(QCPAxisTickerTime::TimeUnit unit, int width) { mFieldWidth[unit] = qMax(width, 1); } /*! \internal Returns the tick step appropriate for time displays, depending on the provided \a range and the smallest available time unit in the current format (\ref setTimeFormat). For example if the unit of seconds isn't available in the format, this method will not generate steps (like 2.5 minutes) that require sub-minute precision to be displayed correctly. \seebaseclassmethod */ double QCPAxisTickerTime::getTickStep(const QCPRange &range) { double result = range.size()/(double)(mTickCount+1e-10); // mTickCount ticks on average, the small addition is to prevent jitter on exact integers if (result < 1) // ideal tick step is below 1 second -> use normal clean mantissa algorithm in units of seconds { if (mSmallestUnit == tuMilliseconds) result = qMax(cleanMantissa(result), 0.001); // smallest tick step is 1 millisecond else // have no milliseconds available in format, so stick with 1 second tickstep result = 1.0; } else if (result < 3600*24) // below a day { // the filling of availableSteps seems a bit contorted but it fills in a sorted fashion and thus saves a post-fill sorting run QVector availableSteps; // seconds range: if (mSmallestUnit <= tuSeconds) availableSteps << 1; if (mSmallestUnit == tuMilliseconds) availableSteps << 2.5; // only allow half second steps if milliseconds are there to display it else if (mSmallestUnit == tuSeconds) availableSteps << 2; if (mSmallestUnit <= tuSeconds) availableSteps << 5 << 10 << 15 << 30; // minutes range: if (mSmallestUnit <= tuMinutes) availableSteps << 1*60; if (mSmallestUnit <= tuSeconds) availableSteps << 2.5*60; // only allow half minute steps if seconds are there to display it else if (mSmallestUnit == tuMinutes) availableSteps << 2*60; if (mSmallestUnit <= tuMinutes) availableSteps << 5*60 << 10*60 << 15*60 << 30*60; // hours range: if (mSmallestUnit <= tuHours) availableSteps << 1*3600 << 2*3600 << 3*3600 << 6*3600 << 12*3600 << 24*3600; // pick available step that is most appropriate to approximate ideal step: result = pickClosest(result, availableSteps); } else // more than a day, go back to normal clean mantissa algorithm but in units of days { const double secondsPerDay = 3600*24; result = cleanMantissa(result/secondsPerDay)*secondsPerDay; } return result; } /*! \internal Returns the sub tick count appropriate for the provided \a tickStep and time displays. \seebaseclassmethod */ int QCPAxisTickerTime::getSubTickCount(double tickStep) { int result = QCPAxisTicker::getSubTickCount(tickStep); switch (qRound(tickStep)) // hand chosen subticks for specific minute/hour/day range (as specified in getTickStep) { case 5*60: result = 4; break; case 10*60: result = 1; break; case 15*60: result = 2; break; case 30*60: result = 1; break; case 60*60: result = 3; break; case 3600*2: result = 3; break; case 3600*3: result = 2; break; case 3600*6: result = 1; break; case 3600*12: result = 3; break; case 3600*24: result = 3; break; } return result; } /*! \internal Returns the tick label corresponding to the provided \a tick and the configured format and field widths (\ref setTimeFormat, \ref setFieldWidth). \seebaseclassmethod */ QString QCPAxisTickerTime::getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) { Q_UNUSED(precision) Q_UNUSED(formatChar) Q_UNUSED(locale) bool negative = tick < 0; if (negative) tick *= -1; double values[tuDays+1]; // contains the msec/sec/min/... value with its respective modulo (e.g. minute 0..59) double restValues[tuDays+1]; // contains the msec/sec/min/... value as if it's the largest available unit and thus consumes the remaining time restValues[tuMilliseconds] = tick*1000; values[tuMilliseconds] = modf(restValues[tuMilliseconds]/1000, &restValues[tuSeconds])*1000; values[tuSeconds] = modf(restValues[tuSeconds]/60, &restValues[tuMinutes])*60; values[tuMinutes] = modf(restValues[tuMinutes]/60, &restValues[tuHours])*60; values[tuHours] = modf(restValues[tuHours]/24, &restValues[tuDays])*24; // no need to set values[tuDays] because days are always a rest value (there is no higher unit so it consumes all remaining time) QString result = mTimeFormat; for (int i = mSmallestUnit; i <= mBiggestUnit; ++i) { TimeUnit iUnit = static_cast(i); replaceUnit(result, iUnit, qRound(iUnit == mBiggestUnit ? restValues[iUnit] : values[iUnit])); } if (negative) result.prepend(QLatin1Char('-')); return result; } /*! \internal Replaces all occurrences of the format pattern belonging to \a unit in \a text with the specified \a value, using the field width as specified with \ref setFieldWidth for the \a unit. */ void QCPAxisTickerTime::replaceUnit(QString &text, QCPAxisTickerTime::TimeUnit unit, int value) const { QString valueStr = QString::number(value); while (valueStr.size() < mFieldWidth.value(unit)) valueStr.prepend(QLatin1Char('0')); text.replace(mFormatPattern.value(unit), valueStr); } /* end of 'src/axis/axistickertime.cpp' */ /* including file 'src/axis/axistickerfixed.cpp', size 5583 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisTickerFixed //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisTickerFixed \brief Specialized axis ticker with a fixed tick step \image html axisticker-fixed.png This QCPAxisTicker subclass generates ticks with a fixed tick step set with \ref setTickStep. It is also possible to allow integer multiples and integer powers of the specified tick step with \ref setScaleStrategy. A typical application of this ticker is to make an axis only display integers, by setting the tick step of the ticker to 1.0 and the scale strategy to \ref ssMultiples. Another case is when a certain number has a special meaning and axis ticks should only appear at multiples of that value. In this case you might also want to consider \ref QCPAxisTickerPi because despite the name it is not limited to only pi symbols/values. The ticker can be created and assigned to an axis like this: \snippet documentation/doc-image-generator/mainwindow.cpp axistickerfixed-creation */ /*! Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker. */ QCPAxisTickerFixed::QCPAxisTickerFixed() : mTickStep(1.0), mScaleStrategy(ssNone) { } /*! Sets the fixed tick interval to \a step. The axis ticker will only use this tick step when generating axis ticks. This might cause a very high tick density and overlapping labels if the axis range is zoomed out. Using \ref setScaleStrategy it is possible to relax the fixed step and also allow multiples or powers of \a step. This will enable the ticker to reduce the number of ticks to a reasonable amount (see \ref setTickCount). */ void QCPAxisTickerFixed::setTickStep(double step) { if (step > 0) mTickStep = step; else qDebug() << Q_FUNC_INFO << "tick step must be greater than zero:" << step; } /*! Sets whether the specified tick step (\ref setTickStep) is absolutely fixed or whether modifications may be applied to it before calculating the finally used tick step, such as permitting multiples or powers. See \ref ScaleStrategy for details. The default strategy is \ref ssNone, which means the tick step is absolutely fixed. */ void QCPAxisTickerFixed::setScaleStrategy(QCPAxisTickerFixed::ScaleStrategy strategy) { mScaleStrategy = strategy; } /*! \internal Determines the actually used tick step from the specified tick step and scale strategy (\ref setTickStep, \ref setScaleStrategy). This method either returns the specified tick step exactly, or, if the scale strategy is not \ref ssNone, a modification of it to allow varying the number of ticks in the current axis range. \seebaseclassmethod */ double QCPAxisTickerFixed::getTickStep(const QCPRange &range) { switch (mScaleStrategy) { case ssNone: { return mTickStep; } case ssMultiples: { double exactStep = range.size()/(double)(mTickCount+1e-10); // mTickCount ticks on average, the small addition is to prevent jitter on exact integers if (exactStep < mTickStep) return mTickStep; else return (qint64)(cleanMantissa(exactStep/mTickStep)+0.5)*mTickStep; } case ssPowers: { double exactStep = range.size()/(double)(mTickCount+1e-10); // mTickCount ticks on average, the small addition is to prevent jitter on exact integers return qPow(mTickStep, (int)(qLn(exactStep)/qLn(mTickStep)+0.5)); } } return mTickStep; } /* end of 'src/axis/axistickerfixed.cpp' */ /* including file 'src/axis/axistickertext.cpp', size 8653 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisTickerText //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisTickerText \brief Specialized axis ticker which allows arbitrary labels at specified coordinates \image html axisticker-text.png This QCPAxisTicker subclass generates ticks which can be directly specified by the user as coordinates and associated strings. They can be passed as a whole with \ref setTicks or one at a time with \ref addTick. Alternatively you can directly access the internal storage via \ref ticks and modify the tick/label data there. This is useful for cases where the axis represents categories rather than numerical values. If you are updating the ticks of this ticker regularly and in a dynamic fasion (e.g. dependent on the axis range), it is a sign that you should probably create an own ticker by subclassing QCPAxisTicker, instead of using this one. The ticker can be created and assigned to an axis like this: \snippet documentation/doc-image-generator/mainwindow.cpp axistickertext-creation */ /* start of documentation of inline functions */ /*! \fn QMap &QCPAxisTickerText::ticks() Returns a non-const reference to the internal map which stores the tick coordinates and their labels. You can access the map directly in order to add, remove or manipulate ticks, as an alternative to using the methods provided by QCPAxisTickerText, such as \ref setTicks and \ref addTick. */ /* end of documentation of inline functions */ /*! Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker. */ QCPAxisTickerText::QCPAxisTickerText() : mSubTickCount(0) { } /*! \overload Sets the ticks that shall appear on the axis. The map key of \a ticks corresponds to the axis coordinate, and the map value is the string that will appear as tick label. An alternative to manipulate ticks is to directly access the internal storage with the \ref ticks getter. \see addTicks, addTick, clear */ void QCPAxisTickerText::setTicks(const QMap &ticks) { mTicks = ticks; } /*! \overload Sets the ticks that shall appear on the axis. The entries of \a positions correspond to the axis coordinates, and the entries of \a labels are the respective strings that will appear as tick labels. \see addTicks, addTick, clear */ void QCPAxisTickerText::setTicks(const QVector &positions, const QVector labels) { clear(); addTicks(positions, labels); } /*! Sets the number of sub ticks that shall appear between ticks. For QCPAxisTickerText, there is no automatic sub tick count calculation. So if sub ticks are needed, they must be configured with this method. */ void QCPAxisTickerText::setSubTickCount(int subTicks) { if (subTicks >= 0) mSubTickCount = subTicks; else qDebug() << Q_FUNC_INFO << "sub tick count can't be negative:" << subTicks; } /*! Clears all ticks. An alternative to manipulate ticks is to directly access the internal storage with the \ref ticks getter. \see setTicks, addTicks, addTick */ void QCPAxisTickerText::clear() { mTicks.clear(); } /*! Adds a single tick to the axis at the given axis coordinate \a position, with the provided tick \a label. \see addTicks, setTicks, clear */ void QCPAxisTickerText::addTick(double position, QString label) { mTicks.insert(position, label); } /*! \overload Adds the provided \a ticks to the ones already existing. The map key of \a ticks corresponds to the axis coordinate, and the map value is the string that will appear as tick label. An alternative to manipulate ticks is to directly access the internal storage with the \ref ticks getter. \see addTick, setTicks, clear */ void QCPAxisTickerText::addTicks(const QMap &ticks) { mTicks.unite(ticks); } /*! \overload Adds the provided ticks to the ones already existing. The entries of \a positions correspond to the axis coordinates, and the entries of \a labels are the respective strings that will appear as tick labels. An alternative to manipulate ticks is to directly access the internal storage with the \ref ticks getter. \see addTick, setTicks, clear */ void QCPAxisTickerText::addTicks(const QVector &positions, const QVector &labels) { if (positions.size() != labels.size()) qDebug() << Q_FUNC_INFO << "passed unequal length vectors for positions and labels:" << positions.size() << labels.size(); int n = qMin(positions.size(), labels.size()); for (int i=0; i QCPAxisTickerText::createTickVector(double tickStep, const QCPRange &range) { Q_UNUSED(tickStep) QVector result; if (mTicks.isEmpty()) return result; QMap::const_iterator start = mTicks.lowerBound(range.lower); QMap::const_iterator end = mTicks.upperBound(range.upper); // this method should try to give one tick outside of range so proper subticks can be generated: if (start != mTicks.constBegin()) --start; if (end != mTicks.constEnd()) ++end; for (QMap::const_iterator it = start; it != end; ++it) result.append(it.key()); return result; } /* end of 'src/axis/axistickertext.cpp' */ /* including file 'src/axis/axistickerpi.cpp', size 11170 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisTickerPi //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisTickerPi \brief Specialized axis ticker to display ticks in units of an arbitrary constant, for example pi \image html axisticker-pi.png This QCPAxisTicker subclass generates ticks that are expressed with respect to a given symbolic constant with a numerical value specified with \ref setPiValue and an appearance in the tick labels specified with \ref setPiSymbol. Ticks may be generated at fractions of the symbolic constant. How these fractions appear in the tick label can be configured with \ref setFractionStyle. The ticker can be created and assigned to an axis like this: \snippet documentation/doc-image-generator/mainwindow.cpp axistickerpi-creation */ /*! Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker. */ QCPAxisTickerPi::QCPAxisTickerPi() : mPiSymbol(QLatin1String(" ")+QChar(0x03C0)), mPiValue(M_PI), mPeriodicity(0), mFractionStyle(fsUnicodeFractions), mPiTickStep(0) { setTickCount(4); } /*! Sets how the symbol part (which is always a suffix to the number) shall appear in the axis tick label. If a space shall appear between the number and the symbol, make sure the space is contained in \a symbol. */ void QCPAxisTickerPi::setPiSymbol(QString symbol) { mPiSymbol = symbol; } /*! Sets the numerical value that the symbolic constant has. This will be used to place the appropriate fractions of the symbol at the respective axis coordinates. */ void QCPAxisTickerPi::setPiValue(double pi) { mPiValue = pi; } /*! Sets whether the axis labels shall appear periodicly and if so, at which multiplicity of the symbolic constant. To disable periodicity, set \a multiplesOfPi to zero. For example, an axis that identifies 0 with 2pi would set \a multiplesOfPi to two. */ void QCPAxisTickerPi::setPeriodicity(int multiplesOfPi) { mPeriodicity = qAbs(multiplesOfPi); } /*! Sets how the numerical/fractional part preceding the symbolic constant is displayed in tick labels. See \ref FractionStyle for the various options. */ void QCPAxisTickerPi::setFractionStyle(QCPAxisTickerPi::FractionStyle style) { mFractionStyle = style; } /*! \internal Returns the tick step, using the constant's value (\ref setPiValue) as base unit. In consequence the numerical/fractional part preceding the symbolic constant is made to have a readable mantissa. \seebaseclassmethod */ double QCPAxisTickerPi::getTickStep(const QCPRange &range) { mPiTickStep = range.size()/mPiValue/(double)(mTickCount+1e-10); // mTickCount ticks on average, the small addition is to prevent jitter on exact integers mPiTickStep = cleanMantissa(mPiTickStep); return mPiTickStep*mPiValue; } /*! \internal Returns the sub tick count, using the constant's value (\ref setPiValue) as base unit. In consequence the sub ticks divide the numerical/fractional part preceding the symbolic constant reasonably, and not the total tick coordinate. \seebaseclassmethod */ int QCPAxisTickerPi::getSubTickCount(double tickStep) { return QCPAxisTicker::getSubTickCount(tickStep/mPiValue); } /*! \internal Returns the tick label as a fractional/numerical part and a symbolic string as suffix. The formatting of the fraction is done according to the specified \ref setFractionStyle. The appended symbol is specified with \ref setPiSymbol. \seebaseclassmethod */ QString QCPAxisTickerPi::getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) { double tickInPis = tick/mPiValue; if (mPeriodicity > 0) tickInPis = fmod(tickInPis, mPeriodicity); if (mFractionStyle != fsFloatingPoint && mPiTickStep > 0.09 && mPiTickStep < 50) { // simply construct fraction from decimal like 1.234 -> 1234/1000 and then simplify fraction, smaller digits are irrelevant due to mPiTickStep conditional above int denominator = 1000; int numerator = qRound(tickInPis*denominator); simplifyFraction(numerator, denominator); if (qAbs(numerator) == 1 && denominator == 1) return (numerator < 0 ? QLatin1String("-") : QLatin1String("")) + mPiSymbol.trimmed(); else if (numerator == 0) return QLatin1String("0"); else return fractionToString(numerator, denominator) + mPiSymbol; } else { if (qFuzzyIsNull(tickInPis)) return QLatin1String("0"); else if (qFuzzyCompare(qAbs(tickInPis), 1.0)) return (tickInPis < 0 ? QLatin1String("-") : QLatin1String("")) + mPiSymbol.trimmed(); else return QCPAxisTicker::getTickLabel(tickInPis, locale, formatChar, precision) + mPiSymbol; } } /*! \internal Takes the fraction given by \a numerator and \a denominator and modifies the values to make sure the fraction is in irreducible form, i.e. numerator and denominator don't share any common factors which could be cancelled. */ void QCPAxisTickerPi::simplifyFraction(int &numerator, int &denominator) const { if (numerator == 0 || denominator == 0) return; int num = numerator; int denom = denominator; while (denom != 0) // euclidean gcd algorithm { int oldDenom = denom; denom = num % denom; num = oldDenom; } // num is now gcd of numerator and denominator numerator /= num; denominator /= num; } /*! \internal Takes the fraction given by \a numerator and \a denominator and returns a string representation. The result depends on the configured fraction style (\ref setFractionStyle). This method is used to format the numerical/fractional part when generating tick labels. It simplifies the passed fraction to an irreducible form using \ref simplifyFraction and factors out any integer parts of the fraction (e.g. "10/4" becomes "2 1/2"). */ QString QCPAxisTickerPi::fractionToString(int numerator, int denominator) const { if (denominator == 0) { qDebug() << Q_FUNC_INFO << "called with zero denominator"; return QString(); } if (mFractionStyle == fsFloatingPoint) // should never be the case when calling this function { qDebug() << Q_FUNC_INFO << "shouldn't be called with fraction style fsDecimal"; return QString::number(numerator/(double)denominator); // failsafe } int sign = numerator*denominator < 0 ? -1 : 1; numerator = qAbs(numerator); denominator = qAbs(denominator); if (denominator == 1) { return QString::number(sign*numerator); } else { int integerPart = numerator/denominator; int remainder = numerator%denominator; if (remainder == 0) { return QString::number(sign*integerPart); } else { if (mFractionStyle == fsAsciiFractions) { return QString(QLatin1String("%1%2%3/%4")) .arg(sign == -1 ? QLatin1String("-") : QLatin1String("")) .arg(integerPart > 0 ? QString::number(integerPart)+QLatin1String(" ") : QLatin1String("")) .arg(remainder) .arg(denominator); } else if (mFractionStyle == fsUnicodeFractions) { return QString(QLatin1String("%1%2%3")) .arg(sign == -1 ? QLatin1String("-") : QLatin1String("")) .arg(integerPart > 0 ? QString::number(integerPart) : QLatin1String("")) .arg(unicodeFraction(remainder, denominator)); } } } return QString(); } /*! \internal Returns the unicode string representation of the fraction given by \a numerator and \a denominator. This is the representation used in \ref fractionToString when the fraction style (\ref setFractionStyle) is \ref fsUnicodeFractions. This method doesn't use the single-character common fractions but builds each fraction from a superscript unicode number, the unicode fraction character, and a subscript unicode number. */ QString QCPAxisTickerPi::unicodeFraction(int numerator, int denominator) const { return unicodeSuperscript(numerator)+QChar(0x2044)+unicodeSubscript(denominator); } /*! \internal Returns the unicode string representing \a number as superscript. This is used to build unicode fractions in \ref unicodeFraction. */ QString QCPAxisTickerPi::unicodeSuperscript(int number) const { if (number == 0) return QString(QChar(0x2070)); QString result; while (number > 0) { const int digit = number%10; switch (digit) { case 1: { result.prepend(QChar(0x00B9)); break; } case 2: { result.prepend(QChar(0x00B2)); break; } case 3: { result.prepend(QChar(0x00B3)); break; } default: { result.prepend(QChar(0x2070+digit)); break; } } number /= 10; } return result; } /*! \internal Returns the unicode string representing \a number as subscript. This is used to build unicode fractions in \ref unicodeFraction. */ QString QCPAxisTickerPi::unicodeSubscript(int number) const { if (number == 0) return QString(QChar(0x2080)); QString result; while (number > 0) { result.prepend(QChar(0x2080+number%10)); number /= 10; } return result; } /* end of 'src/axis/axistickerpi.cpp' */ /* including file 'src/axis/axistickerlog.cpp', size 7106 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisTickerLog //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisTickerLog \brief Specialized axis ticker suited for logarithmic axes \image html axisticker-log.png This QCPAxisTicker subclass generates ticks with unequal tick intervals suited for logarithmic axis scales. The ticks are placed at powers of the specified log base (\ref setLogBase). Especially in the case of a log base equal to 10 (the default), it might be desirable to have tick labels in the form of powers of ten without mantissa display. To achieve this, set the number precision (\ref QCPAxis::setNumberPrecision) to zero and the number format (\ref QCPAxis::setNumberFormat) to scientific (exponential) display with beautifully typeset decimal powers, so a format string of "eb". This will result in the following axis tick labels: \image html axisticker-log-powers.png The ticker can be created and assigned to an axis like this: \snippet documentation/doc-image-generator/mainwindow.cpp axistickerlog-creation */ /*! Constructs the ticker and sets reasonable default values. Axis tickers are commonly created managed by a QSharedPointer, which then can be passed to QCPAxis::setTicker. */ QCPAxisTickerLog::QCPAxisTickerLog() : mLogBase(10.0), mSubTickCount(8), // generates 10 intervals mLogBaseLnInv(1.0/qLn(mLogBase)) { } /*! Sets the logarithm base used for tick coordinate generation. The ticks will be placed at integer powers of \a base. */ void QCPAxisTickerLog::setLogBase(double base) { if (base > 0) { mLogBase = base; mLogBaseLnInv = 1.0/qLn(mLogBase); } else qDebug() << Q_FUNC_INFO << "log base has to be greater than zero:" << base; } /*! Sets the number of sub ticks in a tick interval. Within each interval, the sub ticks are spaced linearly to provide a better visual guide, so the sub tick density increases toward the higher tick. Note that \a subTicks is the number of sub ticks (not sub intervals) in one tick interval. So in the case of logarithm base 10 an intuitive sub tick spacing would be achieved with eight sub ticks (the default). This means e.g. between the ticks 10 and 100 there will be eight ticks, namely at 20, 30, 40, 50, 60, 70, 80 and 90. */ void QCPAxisTickerLog::setSubTickCount(int subTicks) { if (subTicks >= 0) mSubTickCount = subTicks; else qDebug() << Q_FUNC_INFO << "sub tick count can't be negative:" << subTicks; } /*! \internal Since logarithmic tick steps are necessarily different for each tick interval, this method does nothing in the case of QCPAxisTickerLog \seebaseclassmethod */ double QCPAxisTickerLog::getTickStep(const QCPRange &range) { // Logarithmic axis ticker has unequal tick spacing, so doesn't need this method Q_UNUSED(range) return 1.0; } /*! \internal Returns the sub tick count specified in \ref setSubTickCount. For QCPAxisTickerLog, there is no automatic sub tick count calculation necessary. \seebaseclassmethod */ int QCPAxisTickerLog::getSubTickCount(double tickStep) { Q_UNUSED(tickStep) return mSubTickCount; } /*! \internal Creates ticks with a spacing given by the logarithm base and an increasing integer power in the provided \a range. The step in which the power increases tick by tick is chosen in order to keep the total number of ticks as close as possible to the tick count (\ref setTickCount). The parameter \a tickStep is ignored for QCPAxisTickerLog \seebaseclassmethod */ QVector QCPAxisTickerLog::createTickVector(double tickStep, const QCPRange &range) { Q_UNUSED(tickStep) QVector result; if (range.lower > 0 && range.upper > 0) // positive range { double exactPowerStep = qLn(range.upper/range.lower)*mLogBaseLnInv/(double)(mTickCount+1e-10); double newLogBase = qPow(mLogBase, qMax((int)cleanMantissa(exactPowerStep), 1)); double currentTick = qPow(newLogBase, qFloor(qLn(range.lower)/qLn(newLogBase))); result.append(currentTick); while (currentTick < range.upper && currentTick > 0) // currentMag might be zero for ranges ~1e-300, just cancel in that case { currentTick *= newLogBase; result.append(currentTick); } } else if (range.lower < 0 && range.upper < 0) // negative range { double exactPowerStep = qLn(range.lower/range.upper)*mLogBaseLnInv/(double)(mTickCount+1e-10); double newLogBase = qPow(mLogBase, qMax((int)cleanMantissa(exactPowerStep), 1)); double currentTick = -qPow(newLogBase, qCeil(qLn(-range.lower)/qLn(newLogBase))); result.append(currentTick); while (currentTick < range.upper && currentTick < 0) // currentMag might be zero for ranges ~1e-300, just cancel in that case { currentTick /= newLogBase; result.append(currentTick); } } else // invalid range for logarithmic scale, because lower and upper have different sign { qDebug() << Q_FUNC_INFO << "Invalid range for logarithmic plot: " << range.lower << ".." << range.upper; } return result; } /* end of 'src/axis/axistickerlog.cpp' */ /* including file 'src/axis/axis.cpp', size 94458 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPGrid //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPGrid \brief Responsible for drawing the grid of a QCPAxis. This class is tightly bound to QCPAxis. Every axis owns a grid instance and uses it to draw the grid lines, sub grid lines and zero-line. You can interact with the grid of an axis via \ref QCPAxis::grid. Normally, you don't need to create an instance of QCPGrid yourself. The axis and grid drawing was split into two classes to allow them to be placed on different layers (both QCPAxis and QCPGrid inherit from QCPLayerable). Thus it is possible to have the grid in the background and the axes in the foreground, and any plottables/items in between. This described situation is the default setup, see the QCPLayer documentation. */ /*! Creates a QCPGrid instance and sets default values. You shouldn't instantiate grids on their own, since every QCPAxis brings its own QCPGrid. */ QCPGrid::QCPGrid(QCPAxis *parentAxis) : QCPLayerable(parentAxis->parentPlot(), QString(), parentAxis), mParentAxis(parentAxis) { // warning: this is called in QCPAxis constructor, so parentAxis members should not be accessed/called setParent(parentAxis); setPen(QPen(QColor(200,200,200), 0, Qt::DotLine)); setSubGridPen(QPen(QColor(220,220,220), 0, Qt::DotLine)); setZeroLinePen(QPen(QColor(200,200,200), 0, Qt::SolidLine)); setSubGridVisible(false); setAntialiased(false); setAntialiasedSubGrid(false); setAntialiasedZeroLine(false); } /*! Sets whether grid lines at sub tick marks are drawn. \see setSubGridPen */ void QCPGrid::setSubGridVisible(bool visible) { mSubGridVisible = visible; } /*! Sets whether sub grid lines are drawn antialiased. */ void QCPGrid::setAntialiasedSubGrid(bool enabled) { mAntialiasedSubGrid = enabled; } /*! Sets whether zero lines are drawn antialiased. */ void QCPGrid::setAntialiasedZeroLine(bool enabled) { mAntialiasedZeroLine = enabled; } /*! Sets the pen with which (major) grid lines are drawn. */ void QCPGrid::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen with which sub grid lines are drawn. */ void QCPGrid::setSubGridPen(const QPen &pen) { mSubGridPen = pen; } /*! Sets the pen with which zero lines are drawn. Zero lines are lines at value coordinate 0 which may be drawn with a different pen than other grid lines. To disable zero lines and just draw normal grid lines at zero, set \a pen to Qt::NoPen. */ void QCPGrid::setZeroLinePen(const QPen &pen) { mZeroLinePen = pen; } /*! \internal A convenience function to easily set the QPainter::Antialiased hint on the provided \a painter before drawing the major grid lines. This is the antialiasing state the painter passed to the \ref draw method is in by default. This function takes into account the local setting of the antialiasing flag as well as the overrides set with \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. \see setAntialiased */ void QCPGrid::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aeGrid); } /*! \internal Draws grid lines and sub grid lines at the positions of (sub) ticks of the parent axis, spanning over the complete axis rect. Also draws the zero line, if appropriate (\ref setZeroLinePen). */ void QCPGrid::draw(QCPPainter *painter) { if (!mParentAxis) { qDebug() << Q_FUNC_INFO << "invalid parent axis"; return; } if (mParentAxis->subTicks() && mSubGridVisible) drawSubGridLines(painter); drawGridLines(painter); } /*! \internal Draws the main grid lines and possibly a zero line with the specified painter. This is a helper function called by \ref draw. */ void QCPGrid::drawGridLines(QCPPainter *painter) const { if (!mParentAxis) { qDebug() << Q_FUNC_INFO << "invalid parent axis"; return; } const int tickCount = mParentAxis->mTickVector.size(); double t; // helper variable, result of coordinate-to-pixel transforms if (mParentAxis->orientation() == Qt::Horizontal) { // draw zeroline: int zeroLineIndex = -1; if (mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 && mParentAxis->mRange.upper > 0) { applyAntialiasingHint(painter, mAntialiasedZeroLine, QCP::aeZeroLine); painter->setPen(mZeroLinePen); double epsilon = mParentAxis->range().size()*1E-6; // for comparing double to zero for (int i=0; imTickVector.at(i)) < epsilon) { zeroLineIndex = i; t = mParentAxis->coordToPixel(mParentAxis->mTickVector.at(i)); // x painter->drawLine(QLineF(t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top())); break; } } } // draw grid lines: applyDefaultAntialiasingHint(painter); painter->setPen(mPen); for (int i=0; icoordToPixel(mParentAxis->mTickVector.at(i)); // x painter->drawLine(QLineF(t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top())); } } else { // draw zeroline: int zeroLineIndex = -1; if (mZeroLinePen.style() != Qt::NoPen && mParentAxis->mRange.lower < 0 && mParentAxis->mRange.upper > 0) { applyAntialiasingHint(painter, mAntialiasedZeroLine, QCP::aeZeroLine); painter->setPen(mZeroLinePen); double epsilon = mParentAxis->mRange.size()*1E-6; // for comparing double to zero for (int i=0; imTickVector.at(i)) < epsilon) { zeroLineIndex = i; t = mParentAxis->coordToPixel(mParentAxis->mTickVector.at(i)); // y painter->drawLine(QLineF(mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t)); break; } } } // draw grid lines: applyDefaultAntialiasingHint(painter); painter->setPen(mPen); for (int i=0; icoordToPixel(mParentAxis->mTickVector.at(i)); // y painter->drawLine(QLineF(mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t)); } } } /*! \internal Draws the sub grid lines with the specified painter. This is a helper function called by \ref draw. */ void QCPGrid::drawSubGridLines(QCPPainter *painter) const { if (!mParentAxis) { qDebug() << Q_FUNC_INFO << "invalid parent axis"; return; } applyAntialiasingHint(painter, mAntialiasedSubGrid, QCP::aeSubGrid); double t; // helper variable, result of coordinate-to-pixel transforms painter->setPen(mSubGridPen); if (mParentAxis->orientation() == Qt::Horizontal) { for (int i=0; imSubTickVector.size(); ++i) { t = mParentAxis->coordToPixel(mParentAxis->mSubTickVector.at(i)); // x painter->drawLine(QLineF(t, mParentAxis->mAxisRect->bottom(), t, mParentAxis->mAxisRect->top())); } } else { for (int i=0; imSubTickVector.size(); ++i) { t = mParentAxis->coordToPixel(mParentAxis->mSubTickVector.at(i)); // y painter->drawLine(QLineF(mParentAxis->mAxisRect->left(), t, mParentAxis->mAxisRect->right(), t)); } } } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxis //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxis \brief Manages a single axis inside a QCustomPlot. Usually doesn't need to be instantiated externally. Access %QCustomPlot's default four axes via QCustomPlot::xAxis (bottom), QCustomPlot::yAxis (left), QCustomPlot::xAxis2 (top) and QCustomPlot::yAxis2 (right). Axes are always part of an axis rect, see QCPAxisRect. \image html AxisNamesOverview.png
Naming convention of axis parts
\n \image html AxisRectSpacingOverview.png
Overview of the spacings and paddings that define the geometry of an axis. The dashed gray line on the left represents the QCustomPlot widget border.
Each axis holds an instance of QCPAxisTicker which is used to generate the tick coordinates and tick labels. You can access the currently installed \ref ticker or set a new one (possibly one of the specialized subclasses, or your own subclass) via \ref setTicker. For details, see the documentation of QCPAxisTicker. */ /* start of documentation of inline functions */ /*! \fn Qt::Orientation QCPAxis::orientation() const Returns the orientation of this axis. The axis orientation (horizontal or vertical) is deduced from the axis type (left, top, right or bottom). \see orientation(AxisType type), pixelOrientation */ /*! \fn QCPGrid *QCPAxis::grid() const Returns the \ref QCPGrid instance belonging to this axis. Access it to set details about the way the grid is displayed. */ /*! \fn static Qt::Orientation QCPAxis::orientation(AxisType type) Returns the orientation of the specified axis type \see orientation(), pixelOrientation */ /*! \fn int QCPAxis::pixelOrientation() const Returns which direction points towards higher coordinate values/keys, in pixel space. This method returns either 1 or -1. If it returns 1, then going in the positive direction along the orientation of the axis in pixels corresponds to going from lower to higher axis coordinates. On the other hand, if this method returns -1, going to smaller pixel values corresponds to going from lower to higher axis coordinates. For example, this is useful to easily shift axis coordinates by a certain amount given in pixels, without having to care about reversed or vertically aligned axes: \code double newKey = keyAxis->pixelToCoord(keyAxis->coordToPixel(oldKey)+10*keyAxis->pixelOrientation()); \endcode \a newKey will then contain a key that is ten pixels towards higher keys, starting from \a oldKey. */ /*! \fn QSharedPointer QCPAxis::ticker() const Returns a modifiable shared pointer to the currently installed axis ticker. The axis ticker is responsible for generating the tick positions and tick labels of this axis. You can access the \ref QCPAxisTicker with this method and modify basic properties such as the approximate tick count (\ref QCPAxisTicker::setTickCount). You can gain more control over the axis ticks by setting a different \ref QCPAxisTicker subclass, see the documentation there. A new axis ticker can be set with \ref setTicker. Since the ticker is stored in the axis as a shared pointer, multiple axes may share the same axis ticker simply by passing the same shared pointer to multiple axes. \see setTicker */ /* end of documentation of inline functions */ /* start of documentation of signals */ /*! \fn void QCPAxis::rangeChanged(const QCPRange &newRange) This signal is emitted when the range of this axis has changed. You can connect it to the \ref setRange slot of another axis to communicate the new range to the other axis, in order for it to be synchronized. You may also manipulate/correct the range with \ref setRange in a slot connected to this signal. This is useful if for example a maximum range span shall not be exceeded, or if the lower/upper range shouldn't go beyond certain values (see \ref QCPRange::bounded). For example, the following slot would limit the x axis to ranges between 0 and 10: \code customPlot->xAxis->setRange(newRange.bounded(0, 10)) \endcode */ /*! \fn void QCPAxis::rangeChanged(const QCPRange &newRange, const QCPRange &oldRange) \overload Additionally to the new range, this signal also provides the previous range held by the axis as \a oldRange. */ /*! \fn void QCPAxis::scaleTypeChanged(QCPAxis::ScaleType scaleType); This signal is emitted when the scale type changes, by calls to \ref setScaleType */ /*! \fn void QCPAxis::selectionChanged(QCPAxis::SelectableParts selection) This signal is emitted when the selection state of this axis has changed, either by user interaction or by a direct call to \ref setSelectedParts. */ /*! \fn void QCPAxis::selectableChanged(const QCPAxis::SelectableParts &parts); This signal is emitted when the selectability changes, by calls to \ref setSelectableParts */ /* end of documentation of signals */ /*! Constructs an Axis instance of Type \a type for the axis rect \a parent. Usually it isn't necessary to instantiate axes directly, because you can let QCustomPlot create them for you with \ref QCPAxisRect::addAxis. If you want to use own QCPAxis-subclasses however, create them manually and then inject them also via \ref QCPAxisRect::addAxis. */ QCPAxis::QCPAxis(QCPAxisRect *parent, AxisType type) : QCPLayerable(parent->parentPlot(), QString(), parent), // axis base: mAxisType(type), mAxisRect(parent), mPadding(5), mOrientation(orientation(type)), mSelectableParts(spAxis | spTickLabels | spAxisLabel), mSelectedParts(spNone), mBasePen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), mSelectedBasePen(QPen(Qt::blue, 2)), // axis label: mLabel(), mLabelFont(mParentPlot->font()), mSelectedLabelFont(QFont(mLabelFont.family(), mLabelFont.pointSize(), QFont::Bold)), mLabelColor(Qt::black), mSelectedLabelColor(Qt::blue), // tick labels: mTickLabels(true), mTickLabelFont(mParentPlot->font()), mSelectedTickLabelFont(QFont(mTickLabelFont.family(), mTickLabelFont.pointSize(), QFont::Bold)), mTickLabelColor(Qt::black), mSelectedTickLabelColor(Qt::blue), mNumberPrecision(6), mNumberFormatChar('g'), mNumberBeautifulPowers(true), // ticks and subticks: mTicks(true), mSubTicks(true), mTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), mSelectedTickPen(QPen(Qt::blue, 2)), mSubTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), mSelectedSubTickPen(QPen(Qt::blue, 2)), // scale and range: mRange(0, 5), mRangeReversed(false), mScaleType(stLinear), // internal members: mGrid(new QCPGrid(this)), mAxisPainter(new QCPAxisPainterPrivate(parent->parentPlot())), mTicker(new QCPAxisTicker), mCachedMarginValid(false), mCachedMargin(0) { setParent(parent); mGrid->setVisible(false); setAntialiased(false); setLayer(mParentPlot->currentLayer()); // it's actually on that layer already, but we want it in front of the grid, so we place it on there again if (type == atTop) { setTickLabelPadding(3); setLabelPadding(6); } else if (type == atRight) { setTickLabelPadding(7); setLabelPadding(12); } else if (type == atBottom) { setTickLabelPadding(3); setLabelPadding(3); } else if (type == atLeft) { setTickLabelPadding(5); setLabelPadding(10); } } QCPAxis::~QCPAxis() { delete mAxisPainter; delete mGrid; // delete grid here instead of via parent ~QObject for better defined deletion order } /* No documentation as it is a property getter */ int QCPAxis::tickLabelPadding() const { return mAxisPainter->tickLabelPadding; } /* No documentation as it is a property getter */ double QCPAxis::tickLabelRotation() const { return mAxisPainter->tickLabelRotation; } /* No documentation as it is a property getter */ QCPAxis::LabelSide QCPAxis::tickLabelSide() const { return mAxisPainter->tickLabelSide; } /* No documentation as it is a property getter */ QString QCPAxis::numberFormat() const { QString result; result.append(mNumberFormatChar); if (mNumberBeautifulPowers) { result.append(QLatin1Char('b')); if (mAxisPainter->numberMultiplyCross) result.append(QLatin1Char('c')); } return result; } /* No documentation as it is a property getter */ int QCPAxis::tickLengthIn() const { return mAxisPainter->tickLengthIn; } /* No documentation as it is a property getter */ int QCPAxis::tickLengthOut() const { return mAxisPainter->tickLengthOut; } /* No documentation as it is a property getter */ int QCPAxis::subTickLengthIn() const { return mAxisPainter->subTickLengthIn; } /* No documentation as it is a property getter */ int QCPAxis::subTickLengthOut() const { return mAxisPainter->subTickLengthOut; } /* No documentation as it is a property getter */ int QCPAxis::labelPadding() const { return mAxisPainter->labelPadding; } /* No documentation as it is a property getter */ int QCPAxis::offset() const { return mAxisPainter->offset; } /* No documentation as it is a property getter */ QCPLineEnding QCPAxis::lowerEnding() const { return mAxisPainter->lowerEnding; } /* No documentation as it is a property getter */ QCPLineEnding QCPAxis::upperEnding() const { return mAxisPainter->upperEnding; } /*! Sets whether the axis uses a linear scale or a logarithmic scale. Note that this method controls the coordinate transformation. You will likely also want to use a logarithmic tick spacing and labeling, which can be achieved by setting an instance of \ref QCPAxisTickerLog via \ref setTicker. See the documentation of \ref QCPAxisTickerLog about the details of logarithmic axis tick creation. \ref setNumberPrecision */ void QCPAxis::setScaleType(QCPAxis::ScaleType type) { if (mScaleType != type) { mScaleType = type; if (mScaleType == stLogarithmic) setRange(mRange.sanitizedForLogScale()); mCachedMarginValid = false; emit scaleTypeChanged(mScaleType); } } /*! Sets the range of the axis. This slot may be connected with the \ref rangeChanged signal of another axis so this axis is always synchronized with the other axis range, when it changes. To invert the direction of an axis, use \ref setRangeReversed. */ void QCPAxis::setRange(const QCPRange &range) { if (range.lower == mRange.lower && range.upper == mRange.upper) return; if (!QCPRange::validRange(range)) return; QCPRange oldRange = mRange; if (mScaleType == stLogarithmic) { mRange = range.sanitizedForLogScale(); } else { mRange = range.sanitizedForLinScale(); } emit rangeChanged(mRange); emit rangeChanged(mRange, oldRange); } /*! Sets whether the user can (de-)select the parts in \a selectable by clicking on the QCustomPlot surface. (When \ref QCustomPlot::setInteractions contains iSelectAxes.) However, even when \a selectable is set to a value not allowing the selection of a specific part, it is still possible to set the selection of this part manually, by calling \ref setSelectedParts directly. \see SelectablePart, setSelectedParts */ void QCPAxis::setSelectableParts(const SelectableParts &selectable) { if (mSelectableParts != selectable) { mSelectableParts = selectable; emit selectableChanged(mSelectableParts); } } /*! Sets the selected state of the respective axis parts described by \ref SelectablePart. When a part is selected, it uses a different pen/font. The entire selection mechanism for axes is handled automatically when \ref QCustomPlot::setInteractions contains iSelectAxes. You only need to call this function when you wish to change the selection state manually. This function can change the selection state of a part, independent of the \ref setSelectableParts setting. emits the \ref selectionChanged signal when \a selected is different from the previous selection state. \see SelectablePart, setSelectableParts, selectTest, setSelectedBasePen, setSelectedTickPen, setSelectedSubTickPen, setSelectedTickLabelFont, setSelectedLabelFont, setSelectedTickLabelColor, setSelectedLabelColor */ void QCPAxis::setSelectedParts(const SelectableParts &selected) { if (mSelectedParts != selected) { mSelectedParts = selected; emit selectionChanged(mSelectedParts); } } /*! \overload Sets the lower and upper bound of the axis range. To invert the direction of an axis, use \ref setRangeReversed. There is also a slot to set a range, see \ref setRange(const QCPRange &range). */ void QCPAxis::setRange(double lower, double upper) { if (lower == mRange.lower && upper == mRange.upper) return; if (!QCPRange::validRange(lower, upper)) return; QCPRange oldRange = mRange; mRange.lower = lower; mRange.upper = upper; if (mScaleType == stLogarithmic) { mRange = mRange.sanitizedForLogScale(); } else { mRange = mRange.sanitizedForLinScale(); } emit rangeChanged(mRange); emit rangeChanged(mRange, oldRange); } /*! \overload Sets the range of the axis. The \a position coordinate indicates together with the \a alignment parameter, where the new range will be positioned. \a size defines the size of the new axis range. \a alignment may be Qt::AlignLeft, Qt::AlignRight or Qt::AlignCenter. This will cause the left border, right border, or center of the range to be aligned with \a position. Any other values of \a alignment will default to Qt::AlignCenter. */ void QCPAxis::setRange(double position, double size, Qt::AlignmentFlag alignment) { if (alignment == Qt::AlignLeft) setRange(position, position+size); else if (alignment == Qt::AlignRight) setRange(position-size, position); else // alignment == Qt::AlignCenter setRange(position-size/2.0, position+size/2.0); } /*! Sets the lower bound of the axis range. The upper bound is not changed. \see setRange */ void QCPAxis::setRangeLower(double lower) { if (mRange.lower == lower) return; QCPRange oldRange = mRange; mRange.lower = lower; if (mScaleType == stLogarithmic) { mRange = mRange.sanitizedForLogScale(); } else { mRange = mRange.sanitizedForLinScale(); } emit rangeChanged(mRange); emit rangeChanged(mRange, oldRange); } /*! Sets the upper bound of the axis range. The lower bound is not changed. \see setRange */ void QCPAxis::setRangeUpper(double upper) { if (mRange.upper == upper) return; QCPRange oldRange = mRange; mRange.upper = upper; if (mScaleType == stLogarithmic) { mRange = mRange.sanitizedForLogScale(); } else { mRange = mRange.sanitizedForLinScale(); } emit rangeChanged(mRange); emit rangeChanged(mRange, oldRange); } /*! Sets whether the axis range (direction) is displayed reversed. Normally, the values on horizontal axes increase left to right, on vertical axes bottom to top. When \a reversed is set to true, the direction of increasing values is inverted. Note that the range and data interface stays the same for reversed axes, e.g. the \a lower part of the \ref setRange interface will still reference the mathematically smaller number than the \a upper part. */ void QCPAxis::setRangeReversed(bool reversed) { mRangeReversed = reversed; } /*! The axis ticker is responsible for generating the tick positions and tick labels. See the documentation of QCPAxisTicker for details on how to work with axis tickers. You can change the tick positioning/labeling behaviour of this axis by setting a different QCPAxisTicker subclass using this method. If you only wish to modify the currently installed axis ticker, access it via \ref ticker. Since the ticker is stored in the axis as a shared pointer, multiple axes may share the same axis ticker simply by passing the same shared pointer to multiple axes. \see ticker */ void QCPAxis::setTicker(QSharedPointer ticker) { if (ticker) mTicker = ticker; else qDebug() << Q_FUNC_INFO << "can not set 0 as axis ticker"; // no need to invalidate margin cache here because produced tick labels are checked for changes in setupTickVector } /*! Sets whether tick marks are displayed. Note that setting \a show to false does not imply that tick labels are invisible, too. To achieve that, see \ref setTickLabels. \see setSubTicks */ void QCPAxis::setTicks(bool show) { if (mTicks != show) { mTicks = show; mCachedMarginValid = false; } } /*! Sets whether tick labels are displayed. Tick labels are the numbers drawn next to tick marks. */ void QCPAxis::setTickLabels(bool show) { if (mTickLabels != show) { mTickLabels = show; mCachedMarginValid = false; if (!mTickLabels) mTickVectorLabels.clear(); } } /*! Sets the distance between the axis base line (including any outward ticks) and the tick labels. \see setLabelPadding, setPadding */ void QCPAxis::setTickLabelPadding(int padding) { if (mAxisPainter->tickLabelPadding != padding) { mAxisPainter->tickLabelPadding = padding; mCachedMarginValid = false; } } /*! Sets the font of the tick labels. \see setTickLabels, setTickLabelColor */ void QCPAxis::setTickLabelFont(const QFont &font) { if (font != mTickLabelFont) { mTickLabelFont = font; mCachedMarginValid = false; } } /*! Sets the color of the tick labels. \see setTickLabels, setTickLabelFont */ void QCPAxis::setTickLabelColor(const QColor &color) { mTickLabelColor = color; } /*! Sets the rotation of the tick labels. If \a degrees is zero, the labels are drawn normally. Else, the tick labels are drawn rotated by \a degrees clockwise. The specified angle is bound to values from -90 to 90 degrees. If \a degrees is exactly -90, 0 or 90, the tick labels are centered on the tick coordinate. For other angles, the label is drawn with an offset such that it seems to point toward or away from the tick mark. */ void QCPAxis::setTickLabelRotation(double degrees) { if (!qFuzzyIsNull(degrees-mAxisPainter->tickLabelRotation)) { mAxisPainter->tickLabelRotation = qBound(-90.0, degrees, 90.0); mCachedMarginValid = false; } } /*! Sets whether the tick labels (numbers) shall appear inside or outside the axis rect. The usual and default setting is \ref lsOutside. Very compact plots sometimes require tick labels to be inside the axis rect, to save space. If \a side is set to \ref lsInside, the tick labels appear on the inside are additionally clipped to the axis rect. */ void QCPAxis::setTickLabelSide(LabelSide side) { mAxisPainter->tickLabelSide = side; mCachedMarginValid = false; } /*! Sets the number format for the numbers in tick labels. This \a formatCode is an extended version of the format code used e.g. by QString::number() and QLocale::toString(). For reference about that, see the "Argument Formats" section in the detailed description of the QString class. \a formatCode is a string of one, two or three characters. The first character is identical to the normal format code used by Qt. In short, this means: 'e'/'E' scientific format, 'f' fixed format, 'g'/'G' scientific or fixed, whichever is shorter. The second and third characters are optional and specific to QCustomPlot:\n If the first char was 'e' or 'g', numbers are/might be displayed in the scientific format, e.g. "5.5e9", which is ugly in a plot. So when the second char of \a formatCode is set to 'b' (for "beautiful"), those exponential numbers are formatted in a more natural way, i.e. "5.5 [multiplication sign] 10 [superscript] 9". By default, the multiplication sign is a centered dot. If instead a cross should be shown (as is usual in the USA), the third char of \a formatCode can be set to 'c'. The inserted multiplication signs are the UTF-8 characters 215 (0xD7) for the cross and 183 (0xB7) for the dot. Examples for \a formatCode: \li \c g normal format code behaviour. If number is small, fixed format is used, if number is large, normal scientific format is used \li \c gb If number is small, fixed format is used, if number is large, scientific format is used with beautifully typeset decimal powers and a dot as multiplication sign \li \c ebc All numbers are in scientific format with beautifully typeset decimal power and a cross as multiplication sign \li \c fb illegal format code, since fixed format doesn't support (or need) beautifully typeset decimal powers. Format code will be reduced to 'f'. \li \c hello illegal format code, since first char is not 'e', 'E', 'f', 'g' or 'G'. Current format code will not be changed. */ void QCPAxis::setNumberFormat(const QString &formatCode) { if (formatCode.isEmpty()) { qDebug() << Q_FUNC_INFO << "Passed formatCode is empty"; return; } mCachedMarginValid = false; // interpret first char as number format char: QString allowedFormatChars(QLatin1String("eEfgG")); if (allowedFormatChars.contains(formatCode.at(0))) { mNumberFormatChar = QLatin1Char(formatCode.at(0).toLatin1()); } else { qDebug() << Q_FUNC_INFO << "Invalid number format code (first char not in 'eEfgG'):" << formatCode; return; } if (formatCode.length() < 2) { mNumberBeautifulPowers = false; mAxisPainter->numberMultiplyCross = false; return; } // interpret second char as indicator for beautiful decimal powers: if (formatCode.at(1) == QLatin1Char('b') && (mNumberFormatChar == QLatin1Char('e') || mNumberFormatChar == QLatin1Char('g'))) { mNumberBeautifulPowers = true; } else { qDebug() << Q_FUNC_INFO << "Invalid number format code (second char not 'b' or first char neither 'e' nor 'g'):" << formatCode; return; } if (formatCode.length() < 3) { mAxisPainter->numberMultiplyCross = false; return; } // interpret third char as indicator for dot or cross multiplication symbol: if (formatCode.at(2) == QLatin1Char('c')) { mAxisPainter->numberMultiplyCross = true; } else if (formatCode.at(2) == QLatin1Char('d')) { mAxisPainter->numberMultiplyCross = false; } else { qDebug() << Q_FUNC_INFO << "Invalid number format code (third char neither 'c' nor 'd'):" << formatCode; return; } } /*! Sets the precision of the tick label numbers. See QLocale::toString(double i, char f, int prec) for details. The effect of precisions are most notably for number Formats starting with 'e', see \ref setNumberFormat */ void QCPAxis::setNumberPrecision(int precision) { if (mNumberPrecision != precision) { mNumberPrecision = precision; mCachedMarginValid = false; } } /*! Sets the length of the ticks in pixels. \a inside is the length the ticks will reach inside the plot and \a outside is the length they will reach outside the plot. If \a outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks. \see setSubTickLength, setTickLengthIn, setTickLengthOut */ void QCPAxis::setTickLength(int inside, int outside) { setTickLengthIn(inside); setTickLengthOut(outside); } /*! Sets the length of the inward ticks in pixels. \a inside is the length the ticks will reach inside the plot. \see setTickLengthOut, setTickLength, setSubTickLength */ void QCPAxis::setTickLengthIn(int inside) { if (mAxisPainter->tickLengthIn != inside) { mAxisPainter->tickLengthIn = inside; } } /*! Sets the length of the outward ticks in pixels. \a outside is the length the ticks will reach outside the plot. If \a outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks. \see setTickLengthIn, setTickLength, setSubTickLength */ void QCPAxis::setTickLengthOut(int outside) { if (mAxisPainter->tickLengthOut != outside) { mAxisPainter->tickLengthOut = outside; mCachedMarginValid = false; // only outside tick length can change margin } } /*! Sets whether sub tick marks are displayed. Sub ticks are only potentially visible if (major) ticks are also visible (see \ref setTicks) \see setTicks */ void QCPAxis::setSubTicks(bool show) { if (mSubTicks != show) { mSubTicks = show; mCachedMarginValid = false; } } /*! Sets the length of the subticks in pixels. \a inside is the length the subticks will reach inside the plot and \a outside is the length they will reach outside the plot. If \a outside is greater than zero, the tick labels and axis label will increase their distance to the axis accordingly, so they won't collide with the ticks. \see setTickLength, setSubTickLengthIn, setSubTickLengthOut */ void QCPAxis::setSubTickLength(int inside, int outside) { setSubTickLengthIn(inside); setSubTickLengthOut(outside); } /*! Sets the length of the inward subticks in pixels. \a inside is the length the subticks will reach inside the plot. \see setSubTickLengthOut, setSubTickLength, setTickLength */ void QCPAxis::setSubTickLengthIn(int inside) { if (mAxisPainter->subTickLengthIn != inside) { mAxisPainter->subTickLengthIn = inside; } } /*! Sets the length of the outward subticks in pixels. \a outside is the length the subticks will reach outside the plot. If \a outside is greater than zero, the tick labels will increase their distance to the axis accordingly, so they won't collide with the ticks. \see setSubTickLengthIn, setSubTickLength, setTickLength */ void QCPAxis::setSubTickLengthOut(int outside) { if (mAxisPainter->subTickLengthOut != outside) { mAxisPainter->subTickLengthOut = outside; mCachedMarginValid = false; // only outside tick length can change margin } } /*! Sets the pen, the axis base line is drawn with. \see setTickPen, setSubTickPen */ void QCPAxis::setBasePen(const QPen &pen) { mBasePen = pen; } /*! Sets the pen, tick marks will be drawn with. \see setTickLength, setBasePen */ void QCPAxis::setTickPen(const QPen &pen) { mTickPen = pen; } /*! Sets the pen, subtick marks will be drawn with. \see setSubTickCount, setSubTickLength, setBasePen */ void QCPAxis::setSubTickPen(const QPen &pen) { mSubTickPen = pen; } /*! Sets the font of the axis label. \see setLabelColor */ void QCPAxis::setLabelFont(const QFont &font) { if (mLabelFont != font) { mLabelFont = font; mCachedMarginValid = false; } } /*! Sets the color of the axis label. \see setLabelFont */ void QCPAxis::setLabelColor(const QColor &color) { mLabelColor = color; } /*! Sets the text of the axis label that will be shown below/above or next to the axis, depending on its orientation. To disable axis labels, pass an empty string as \a str. */ void QCPAxis::setLabel(const QString &str) { if (mLabel != str) { mLabel = str; mCachedMarginValid = false; } } /*! Sets the distance between the tick labels and the axis label. \see setTickLabelPadding, setPadding */ void QCPAxis::setLabelPadding(int padding) { if (mAxisPainter->labelPadding != padding) { mAxisPainter->labelPadding = padding; mCachedMarginValid = false; } } /*! Sets the padding of the axis. When \ref QCPAxisRect::setAutoMargins is enabled, the padding is the additional outer most space, that is left blank. The axis padding has no meaning if \ref QCPAxisRect::setAutoMargins is disabled. \see setLabelPadding, setTickLabelPadding */ void QCPAxis::setPadding(int padding) { if (mPadding != padding) { mPadding = padding; mCachedMarginValid = false; } } /*! Sets the offset the axis has to its axis rect side. If an axis rect side has multiple axes and automatic margin calculation is enabled for that side, only the offset of the inner most axis has meaning (even if it is set to be invisible). The offset of the other, outer axes is controlled automatically, to place them at appropriate positions. */ void QCPAxis::setOffset(int offset) { mAxisPainter->offset = offset; } /*! Sets the font that is used for tick labels when they are selected. \see setTickLabelFont, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions */ void QCPAxis::setSelectedTickLabelFont(const QFont &font) { if (font != mSelectedTickLabelFont) { mSelectedTickLabelFont = font; // don't set mCachedMarginValid to false here because margin calculation is always done with non-selected fonts } } /*! Sets the font that is used for the axis label when it is selected. \see setLabelFont, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions */ void QCPAxis::setSelectedLabelFont(const QFont &font) { mSelectedLabelFont = font; // don't set mCachedMarginValid to false here because margin calculation is always done with non-selected fonts } /*! Sets the color that is used for tick labels when they are selected. \see setTickLabelColor, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions */ void QCPAxis::setSelectedTickLabelColor(const QColor &color) { if (color != mSelectedTickLabelColor) { mSelectedTickLabelColor = color; } } /*! Sets the color that is used for the axis label when it is selected. \see setLabelColor, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions */ void QCPAxis::setSelectedLabelColor(const QColor &color) { mSelectedLabelColor = color; } /*! Sets the pen that is used to draw the axis base line when selected. \see setBasePen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions */ void QCPAxis::setSelectedBasePen(const QPen &pen) { mSelectedBasePen = pen; } /*! Sets the pen that is used to draw the (major) ticks when selected. \see setTickPen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions */ void QCPAxis::setSelectedTickPen(const QPen &pen) { mSelectedTickPen = pen; } /*! Sets the pen that is used to draw the subticks when selected. \see setSubTickPen, setSelectableParts, setSelectedParts, QCustomPlot::setInteractions */ void QCPAxis::setSelectedSubTickPen(const QPen &pen) { mSelectedSubTickPen = pen; } /*! Sets the style for the lower axis ending. See the documentation of QCPLineEnding for available styles. For horizontal axes, this method refers to the left ending, for vertical axes the bottom ending. Note that this meaning does not change when the axis range is reversed with \ref setRangeReversed. \see setUpperEnding */ void QCPAxis::setLowerEnding(const QCPLineEnding &ending) { mAxisPainter->lowerEnding = ending; } /*! Sets the style for the upper axis ending. See the documentation of QCPLineEnding for available styles. For horizontal axes, this method refers to the right ending, for vertical axes the top ending. Note that this meaning does not change when the axis range is reversed with \ref setRangeReversed. \see setLowerEnding */ void QCPAxis::setUpperEnding(const QCPLineEnding &ending) { mAxisPainter->upperEnding = ending; } /*! If the scale type (\ref setScaleType) is \ref stLinear, \a diff is added to the lower and upper bounds of the range. The range is simply moved by \a diff. If the scale type is \ref stLogarithmic, the range bounds are multiplied by \a diff. This corresponds to an apparent "linear" move in logarithmic scaling by a distance of log(diff). */ void QCPAxis::moveRange(double diff) { QCPRange oldRange = mRange; if (mScaleType == stLinear) { mRange.lower += diff; mRange.upper += diff; } else // mScaleType == stLogarithmic { mRange.lower *= diff; mRange.upper *= diff; } emit rangeChanged(mRange); emit rangeChanged(mRange, oldRange); } /*! Scales the range of this axis by \a factor around the center of the current axis range. For example, if \a factor is 2.0, then the axis range will double its size, and the point at the axis range center won't have changed its position in the QCustomPlot widget (i.e. coordinates around the center will have moved symmetrically closer). If you wish to scale around a different coordinate than the current axis range center, use the overload \ref scaleRange(double factor, double center). */ void QCPAxis::scaleRange(double factor) { scaleRange(factor, range().center()); } /*! \overload Scales the range of this axis by \a factor around the coordinate \a center. For example, if \a factor is 2.0, \a center is 1.0, then the axis range will double its size, and the point at coordinate 1.0 won't have changed its position in the QCustomPlot widget (i.e. coordinates around 1.0 will have moved symmetrically closer to 1.0). \see scaleRange(double factor) */ void QCPAxis::scaleRange(double factor, double center) { QCPRange oldRange = mRange; if (mScaleType == stLinear) { QCPRange newRange; newRange.lower = (mRange.lower-center)*factor + center; newRange.upper = (mRange.upper-center)*factor + center; if (QCPRange::validRange(newRange)) mRange = newRange.sanitizedForLinScale(); } else // mScaleType == stLogarithmic { if ((mRange.upper < 0 && center < 0) || (mRange.upper > 0 && center > 0)) // make sure center has same sign as range { QCPRange newRange; newRange.lower = qPow(mRange.lower/center, factor)*center; newRange.upper = qPow(mRange.upper/center, factor)*center; if (QCPRange::validRange(newRange)) mRange = newRange.sanitizedForLogScale(); } else qDebug() << Q_FUNC_INFO << "Center of scaling operation doesn't lie in same logarithmic sign domain as range:" << center; } emit rangeChanged(mRange); emit rangeChanged(mRange, oldRange); } /*! Scales the range of this axis to have a certain scale \a ratio to \a otherAxis. The scaling will be done around the center of the current axis range. For example, if \a ratio is 1, this axis is the \a yAxis and \a otherAxis is \a xAxis, graphs plotted with those axes will appear in a 1:1 aspect ratio, independent of the aspect ratio the axis rect has. This is an operation that changes the range of this axis once, it doesn't fix the scale ratio indefinitely. Note that calling this function in the constructor of the QCustomPlot's parent won't have the desired effect, since the widget dimensions aren't defined yet, and a resizeEvent will follow. */ void QCPAxis::setScaleRatio(const QCPAxis *otherAxis, double ratio) { int otherPixelSize, ownPixelSize; if (otherAxis->orientation() == Qt::Horizontal) otherPixelSize = otherAxis->axisRect()->width(); else otherPixelSize = otherAxis->axisRect()->height(); if (orientation() == Qt::Horizontal) ownPixelSize = axisRect()->width(); else ownPixelSize = axisRect()->height(); double newRangeSize = ratio*otherAxis->range().size()*ownPixelSize/(double)otherPixelSize; setRange(range().center(), newRangeSize, Qt::AlignCenter); } /*! Changes the axis range such that all plottables associated with this axis are fully visible in that dimension. \see QCPAbstractPlottable::rescaleAxes, QCustomPlot::rescaleAxes */ void QCPAxis::rescale(bool onlyVisiblePlottables) { QList p = plottables(); QCPRange newRange; bool haveRange = false; for (int i=0; irealVisibility() && onlyVisiblePlottables) continue; QCPRange plottableRange; bool currentFoundRange; QCP::SignDomain signDomain = QCP::sdBoth; if (mScaleType == stLogarithmic) signDomain = (mRange.upper < 0 ? QCP::sdNegative : QCP::sdPositive); if (p.at(i)->keyAxis() == this) plottableRange = p.at(i)->getKeyRange(currentFoundRange, signDomain); else plottableRange = p.at(i)->getValueRange(currentFoundRange, signDomain); if (currentFoundRange) { if (!haveRange) newRange = plottableRange; else newRange.expand(plottableRange); haveRange = true; } } if (haveRange) { if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this axis dimension), shift current range to at least center the plottable { double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason if (mScaleType == stLinear) { newRange.lower = center-mRange.size()/2.0; newRange.upper = center+mRange.size()/2.0; } else // mScaleType == stLogarithmic { newRange.lower = center/qSqrt(mRange.upper/mRange.lower); newRange.upper = center*qSqrt(mRange.upper/mRange.lower); } } setRange(newRange); } } /*! Transforms \a value, in pixel coordinates of the QCustomPlot widget, to axis coordinates. */ double QCPAxis::pixelToCoord(double value) const { if (orientation() == Qt::Horizontal) { if (mScaleType == stLinear) { if (!mRangeReversed) return (value-mAxisRect->left())/(double)mAxisRect->width()*mRange.size()+mRange.lower; else return -(value-mAxisRect->left())/(double)mAxisRect->width()*mRange.size()+mRange.upper; } else // mScaleType == stLogarithmic { if (!mRangeReversed) return qPow(mRange.upper/mRange.lower, (value-mAxisRect->left())/(double)mAxisRect->width())*mRange.lower; else return qPow(mRange.upper/mRange.lower, (mAxisRect->left()-value)/(double)mAxisRect->width())*mRange.upper; } } else // orientation() == Qt::Vertical { if (mScaleType == stLinear) { if (!mRangeReversed) return (mAxisRect->bottom()-value)/(double)mAxisRect->height()*mRange.size()+mRange.lower; else return -(mAxisRect->bottom()-value)/(double)mAxisRect->height()*mRange.size()+mRange.upper; } else // mScaleType == stLogarithmic { if (!mRangeReversed) return qPow(mRange.upper/mRange.lower, (mAxisRect->bottom()-value)/(double)mAxisRect->height())*mRange.lower; else return qPow(mRange.upper/mRange.lower, (value-mAxisRect->bottom())/(double)mAxisRect->height())*mRange.upper; } } } /*! Transforms \a value, in coordinates of the axis, to pixel coordinates of the QCustomPlot widget. */ double QCPAxis::coordToPixel(double value) const { if (orientation() == Qt::Horizontal) { if (mScaleType == stLinear) { if (!mRangeReversed) return (value-mRange.lower)/mRange.size()*mAxisRect->width()+mAxisRect->left(); else return (mRange.upper-value)/mRange.size()*mAxisRect->width()+mAxisRect->left(); } else // mScaleType == stLogarithmic { if (value >= 0 && mRange.upper < 0) // invalid value for logarithmic scale, just draw it outside visible range return !mRangeReversed ? mAxisRect->right()+200 : mAxisRect->left()-200; else if (value <= 0 && mRange.upper > 0) // invalid value for logarithmic scale, just draw it outside visible range return !mRangeReversed ? mAxisRect->left()-200 : mAxisRect->right()+200; else { if (!mRangeReversed) return qLn(value/mRange.lower)/qLn(mRange.upper/mRange.lower)*mAxisRect->width()+mAxisRect->left(); else return qLn(mRange.upper/value)/qLn(mRange.upper/mRange.lower)*mAxisRect->width()+mAxisRect->left(); } } } else // orientation() == Qt::Vertical { if (mScaleType == stLinear) { if (!mRangeReversed) return mAxisRect->bottom()-(value-mRange.lower)/mRange.size()*mAxisRect->height(); else return mAxisRect->bottom()-(mRange.upper-value)/mRange.size()*mAxisRect->height(); } else // mScaleType == stLogarithmic { if (value >= 0 && mRange.upper < 0) // invalid value for logarithmic scale, just draw it outside visible range return !mRangeReversed ? mAxisRect->top()-200 : mAxisRect->bottom()+200; else if (value <= 0 && mRange.upper > 0) // invalid value for logarithmic scale, just draw it outside visible range return !mRangeReversed ? mAxisRect->bottom()+200 : mAxisRect->top()-200; else { if (!mRangeReversed) return mAxisRect->bottom()-qLn(value/mRange.lower)/qLn(mRange.upper/mRange.lower)*mAxisRect->height(); else return mAxisRect->bottom()-qLn(mRange.upper/value)/qLn(mRange.upper/mRange.lower)*mAxisRect->height(); } } } } /*! Returns the part of the axis that is hit by \a pos (in pixels). The return value of this function is independent of the user-selectable parts defined with \ref setSelectableParts. Further, this function does not change the current selection state of the axis. If the axis is not visible (\ref setVisible), this function always returns \ref spNone. \see setSelectedParts, setSelectableParts, QCustomPlot::setInteractions */ QCPAxis::SelectablePart QCPAxis::getPartAt(const QPointF &pos) const { if (!mVisible) return spNone; if (mAxisPainter->axisSelectionBox().contains(pos.toPoint())) return spAxis; else if (mAxisPainter->tickLabelsSelectionBox().contains(pos.toPoint())) return spTickLabels; else if (mAxisPainter->labelSelectionBox().contains(pos.toPoint())) return spAxisLabel; else return spNone; } /* inherits documentation from base class */ double QCPAxis::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { if (!mParentPlot) return -1; SelectablePart part = getPartAt(pos); if ((onlySelectable && !mSelectableParts.testFlag(part)) || part == spNone) return -1; if (details) details->setValue(part); return mParentPlot->selectionTolerance()*0.99; } /*! Returns a list of all the plottables that have this axis as key or value axis. If you are only interested in plottables of type QCPGraph, see \ref graphs. \see graphs, items */ QList QCPAxis::plottables() const { QList result; if (!mParentPlot) return result; for (int i=0; imPlottables.size(); ++i) { if (mParentPlot->mPlottables.at(i)->keyAxis() == this ||mParentPlot->mPlottables.at(i)->valueAxis() == this) result.append(mParentPlot->mPlottables.at(i)); } return result; } /*! Returns a list of all the graphs that have this axis as key or value axis. \see plottables, items */ QList QCPAxis::graphs() const { QList result; if (!mParentPlot) return result; for (int i=0; imGraphs.size(); ++i) { if (mParentPlot->mGraphs.at(i)->keyAxis() == this || mParentPlot->mGraphs.at(i)->valueAxis() == this) result.append(mParentPlot->mGraphs.at(i)); } return result; } /*! Returns a list of all the items that are associated with this axis. An item is considered associated with an axis if at least one of its positions uses the axis as key or value axis. \see plottables, graphs */ QList QCPAxis::items() const { QList result; if (!mParentPlot) return result; for (int itemId=0; itemIdmItems.size(); ++itemId) { QList positions = mParentPlot->mItems.at(itemId)->positions(); for (int posId=0; posIdkeyAxis() == this || positions.at(posId)->valueAxis() == this) { result.append(mParentPlot->mItems.at(itemId)); break; } } } return result; } /*! Transforms a margin side to the logically corresponding axis type. (QCP::msLeft to QCPAxis::atLeft, QCP::msRight to QCPAxis::atRight, etc.) */ QCPAxis::AxisType QCPAxis::marginSideToAxisType(QCP::MarginSide side) { switch (side) { case QCP::msLeft: return atLeft; case QCP::msRight: return atRight; case QCP::msTop: return atTop; case QCP::msBottom: return atBottom; default: break; } qDebug() << Q_FUNC_INFO << "Invalid margin side passed:" << (int)side; return atLeft; } /*! Returns the axis type that describes the opposite axis of an axis with the specified \a type. */ QCPAxis::AxisType QCPAxis::opposite(QCPAxis::AxisType type) { switch (type) { case atLeft: return atRight; break; case atRight: return atLeft; break; case atBottom: return atTop; break; case atTop: return atBottom; break; default: qDebug() << Q_FUNC_INFO << "invalid axis type"; return atLeft; break; } } /* inherits documentation from base class */ void QCPAxis::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) { Q_UNUSED(event) SelectablePart part = details.value(); if (mSelectableParts.testFlag(part)) { SelectableParts selBefore = mSelectedParts; setSelectedParts(additive ? mSelectedParts^part : part); if (selectionStateChanged) *selectionStateChanged = mSelectedParts != selBefore; } } /* inherits documentation from base class */ void QCPAxis::deselectEvent(bool *selectionStateChanged) { SelectableParts selBefore = mSelectedParts; setSelectedParts(mSelectedParts & ~mSelectableParts); if (selectionStateChanged) *selectionStateChanged = mSelectedParts != selBefore; } /*! \internal A convenience function to easily set the QPainter::Antialiased hint on the provided \a painter before drawing axis lines. This is the antialiasing state the painter passed to the \ref draw method is in by default. This function takes into account the local setting of the antialiasing flag as well as the overrides set with \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. \seebaseclassmethod \see setAntialiased */ void QCPAxis::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aeAxes); } /*! \internal Draws the axis with the specified \a painter, using the internal QCPAxisPainterPrivate instance. \seebaseclassmethod */ void QCPAxis::draw(QCPPainter *painter) { QVector subTickPositions; // the final coordToPixel transformed vector passed to QCPAxisPainter QVector tickPositions; // the final coordToPixel transformed vector passed to QCPAxisPainter QVector tickLabels; // the final vector passed to QCPAxisPainter tickPositions.reserve(mTickVector.size()); tickLabels.reserve(mTickVector.size()); subTickPositions.reserve(mSubTickVector.size()); if (mTicks) { for (int i=0; itype = mAxisType; mAxisPainter->basePen = getBasePen(); mAxisPainter->labelFont = getLabelFont(); mAxisPainter->labelColor = getLabelColor(); mAxisPainter->label = mLabel; mAxisPainter->substituteExponent = mNumberBeautifulPowers; mAxisPainter->tickPen = getTickPen(); mAxisPainter->subTickPen = getSubTickPen(); mAxisPainter->tickLabelFont = getTickLabelFont(); mAxisPainter->tickLabelColor = getTickLabelColor(); mAxisPainter->axisRect = mAxisRect->rect(); mAxisPainter->viewportRect = mParentPlot->viewport(); mAxisPainter->abbreviateDecimalPowers = mScaleType == stLogarithmic; mAxisPainter->reversedEndings = mRangeReversed; mAxisPainter->tickPositions = tickPositions; mAxisPainter->tickLabels = tickLabels; mAxisPainter->subTickPositions = subTickPositions; mAxisPainter->draw(painter); } /*! \internal Prepares the internal tick vector, sub tick vector and tick label vector. This is done by calling QCPAxisTicker::generate on the currently installed ticker. If a change in the label text/count is detected, the cached axis margin is invalidated to make sure the next margin calculation recalculates the label sizes and returns an up-to-date value. */ void QCPAxis::setupTickVectors() { if (!mParentPlot) return; if ((!mTicks && !mTickLabels && !mGrid->visible()) || mRange.size() <= 0) return; QVector oldLabels = mTickVectorLabels; mTicker->generate(mRange, mParentPlot->locale(), mNumberFormatChar, mNumberPrecision, mTickVector, mSubTicks ? &mSubTickVector : 0, mTickLabels ? &mTickVectorLabels : 0); mCachedMarginValid &= mTickVectorLabels == oldLabels; // if labels have changed, margin might have changed, too } /*! \internal Returns the pen that is used to draw the axis base line. Depending on the selection state, this is either mSelectedBasePen or mBasePen. */ QPen QCPAxis::getBasePen() const { return mSelectedParts.testFlag(spAxis) ? mSelectedBasePen : mBasePen; } /*! \internal Returns the pen that is used to draw the (major) ticks. Depending on the selection state, this is either mSelectedTickPen or mTickPen. */ QPen QCPAxis::getTickPen() const { return mSelectedParts.testFlag(spAxis) ? mSelectedTickPen : mTickPen; } /*! \internal Returns the pen that is used to draw the subticks. Depending on the selection state, this is either mSelectedSubTickPen or mSubTickPen. */ QPen QCPAxis::getSubTickPen() const { return mSelectedParts.testFlag(spAxis) ? mSelectedSubTickPen : mSubTickPen; } /*! \internal Returns the font that is used to draw the tick labels. Depending on the selection state, this is either mSelectedTickLabelFont or mTickLabelFont. */ QFont QCPAxis::getTickLabelFont() const { return mSelectedParts.testFlag(spTickLabels) ? mSelectedTickLabelFont : mTickLabelFont; } /*! \internal Returns the font that is used to draw the axis label. Depending on the selection state, this is either mSelectedLabelFont or mLabelFont. */ QFont QCPAxis::getLabelFont() const { return mSelectedParts.testFlag(spAxisLabel) ? mSelectedLabelFont : mLabelFont; } /*! \internal Returns the color that is used to draw the tick labels. Depending on the selection state, this is either mSelectedTickLabelColor or mTickLabelColor. */ QColor QCPAxis::getTickLabelColor() const { return mSelectedParts.testFlag(spTickLabels) ? mSelectedTickLabelColor : mTickLabelColor; } /*! \internal Returns the color that is used to draw the axis label. Depending on the selection state, this is either mSelectedLabelColor or mLabelColor. */ QColor QCPAxis::getLabelColor() const { return mSelectedParts.testFlag(spAxisLabel) ? mSelectedLabelColor : mLabelColor; } /*! \internal Returns the appropriate outward margin for this axis. It is needed if \ref QCPAxisRect::setAutoMargins is set to true on the parent axis rect. An axis with axis type \ref atLeft will return an appropriate left margin, \ref atBottom will return an appropriate bottom margin and so forth. For the calculation, this function goes through similar steps as \ref draw, so changing one function likely requires the modification of the other one as well. The margin consists of the outward tick length, tick label padding, tick label size, label padding, label size, and padding. The margin is cached internally, so repeated calls while leaving the axis range, fonts, etc. unchanged are very fast. */ int QCPAxis::calculateMargin() { if (!mVisible) // if not visible, directly return 0, don't cache 0 because we can't react to setVisible in QCPAxis return 0; if (mCachedMarginValid) return mCachedMargin; // run through similar steps as QCPAxis::draw, and calculate margin needed to fit axis and its labels int margin = 0; QVector tickPositions; // the final coordToPixel transformed vector passed to QCPAxisPainter QVector tickLabels; // the final vector passed to QCPAxisPainter tickPositions.reserve(mTickVector.size()); tickLabels.reserve(mTickVector.size()); if (mTicks) { for (int i=0; itype = mAxisType; mAxisPainter->labelFont = getLabelFont(); mAxisPainter->label = mLabel; mAxisPainter->tickLabelFont = mTickLabelFont; mAxisPainter->axisRect = mAxisRect->rect(); mAxisPainter->viewportRect = mParentPlot->viewport(); mAxisPainter->tickPositions = tickPositions; mAxisPainter->tickLabels = tickLabels; margin += mAxisPainter->size(); margin += mPadding; mCachedMargin = margin; mCachedMarginValid = true; return margin; } /* inherits documentation from base class */ QCP::Interaction QCPAxis::selectionCategory() const { return QCP::iSelectAxes; } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisPainterPrivate //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisPainterPrivate \internal \brief (Private) This is a private class and not part of the public QCustomPlot interface. It is used by QCPAxis to do the low-level drawing of axis backbone, tick marks, tick labels and axis label. It also buffers the labels to reduce replot times. The parameters are configured by directly accessing the public member variables. */ /*! Constructs a QCPAxisPainterPrivate instance. Make sure to not create a new instance on every redraw, to utilize the caching mechanisms. */ QCPAxisPainterPrivate::QCPAxisPainterPrivate(QCustomPlot *parentPlot) : type(QCPAxis::atLeft), basePen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), lowerEnding(QCPLineEnding::esNone), upperEnding(QCPLineEnding::esNone), labelPadding(0), tickLabelPadding(0), tickLabelRotation(0), tickLabelSide(QCPAxis::lsOutside), substituteExponent(true), numberMultiplyCross(false), tickLengthIn(5), tickLengthOut(0), subTickLengthIn(2), subTickLengthOut(0), tickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), subTickPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::SquareCap)), offset(0), abbreviateDecimalPowers(false), reversedEndings(false), mParentPlot(parentPlot), mLabelCache(16) // cache at most 16 (tick) labels { } QCPAxisPainterPrivate::~QCPAxisPainterPrivate() { } /*! \internal Draws the axis with the specified \a painter. The selection boxes (mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox) are set here, too. */ void QCPAxisPainterPrivate::draw(QCPPainter *painter) { QByteArray newHash = generateLabelParameterHash(); if (newHash != mLabelParameterHash) { mLabelCache.clear(); mLabelParameterHash = newHash; } QPoint origin; switch (type) { case QCPAxis::atLeft: origin = axisRect.bottomLeft() +QPoint(-offset, 0); break; case QCPAxis::atRight: origin = axisRect.bottomRight()+QPoint(+offset, 0); break; case QCPAxis::atTop: origin = axisRect.topLeft() +QPoint(0, -offset); break; case QCPAxis::atBottom: origin = axisRect.bottomLeft() +QPoint(0, +offset); break; } double xCor = 0, yCor = 0; // paint system correction, for pixel exact matches (affects baselines and ticks of top/right axes) switch (type) { case QCPAxis::atTop: yCor = -1; break; case QCPAxis::atRight: xCor = 1; break; default: break; } int margin = 0; // draw baseline: QLineF baseLine; painter->setPen(basePen); if (QCPAxis::orientation(type) == Qt::Horizontal) baseLine.setPoints(origin+QPointF(xCor, yCor), origin+QPointF(axisRect.width()+xCor, yCor)); else baseLine.setPoints(origin+QPointF(xCor, yCor), origin+QPointF(xCor, -axisRect.height()+yCor)); if (reversedEndings) baseLine = QLineF(baseLine.p2(), baseLine.p1()); // won't make a difference for line itself, but for line endings later painter->drawLine(baseLine); // draw ticks: if (!tickPositions.isEmpty()) { painter->setPen(tickPen); int tickDir = (type == QCPAxis::atBottom || type == QCPAxis::atRight) ? -1 : 1; // direction of ticks ("inward" is right for left axis and left for right axis) if (QCPAxis::orientation(type) == Qt::Horizontal) { for (int i=0; idrawLine(QLineF(tickPositions.at(i)+xCor, origin.y()-tickLengthOut*tickDir+yCor, tickPositions.at(i)+xCor, origin.y()+tickLengthIn*tickDir+yCor)); } else { for (int i=0; idrawLine(QLineF(origin.x()-tickLengthOut*tickDir+xCor, tickPositions.at(i)+yCor, origin.x()+tickLengthIn*tickDir+xCor, tickPositions.at(i)+yCor)); } } // draw subticks: if (!subTickPositions.isEmpty()) { painter->setPen(subTickPen); // direction of ticks ("inward" is right for left axis and left for right axis) int tickDir = (type == QCPAxis::atBottom || type == QCPAxis::atRight) ? -1 : 1; if (QCPAxis::orientation(type) == Qt::Horizontal) { for (int i=0; idrawLine(QLineF(subTickPositions.at(i)+xCor, origin.y()-subTickLengthOut*tickDir+yCor, subTickPositions.at(i)+xCor, origin.y()+subTickLengthIn*tickDir+yCor)); } else { for (int i=0; idrawLine(QLineF(origin.x()-subTickLengthOut*tickDir+xCor, subTickPositions.at(i)+yCor, origin.x()+subTickLengthIn*tickDir+xCor, subTickPositions.at(i)+yCor)); } } margin += qMax(0, qMax(tickLengthOut, subTickLengthOut)); // draw axis base endings: bool antialiasingBackup = painter->antialiasing(); painter->setAntialiasing(true); // always want endings to be antialiased, even if base and ticks themselves aren't painter->setBrush(QBrush(basePen.color())); QCPVector2D baseLineVector(baseLine.dx(), baseLine.dy()); if (lowerEnding.style() != QCPLineEnding::esNone) lowerEnding.draw(painter, QCPVector2D(baseLine.p1())-baseLineVector.normalized()*lowerEnding.realLength()*(lowerEnding.inverted()?-1:1), -baseLineVector); if (upperEnding.style() != QCPLineEnding::esNone) upperEnding.draw(painter, QCPVector2D(baseLine.p2())+baseLineVector.normalized()*upperEnding.realLength()*(upperEnding.inverted()?-1:1), baseLineVector); painter->setAntialiasing(antialiasingBackup); // tick labels: QRect oldClipRect; if (tickLabelSide == QCPAxis::lsInside) // if using inside labels, clip them to the axis rect { oldClipRect = painter->clipRegion().boundingRect(); painter->setClipRect(axisRect); } QSize tickLabelsSize(0, 0); // size of largest tick label, for offset calculation of axis label if (!tickLabels.isEmpty()) { if (tickLabelSide == QCPAxis::lsOutside) margin += tickLabelPadding; painter->setFont(tickLabelFont); painter->setPen(QPen(tickLabelColor)); const int maxLabelIndex = qMin(tickPositions.size(), tickLabels.size()); int distanceToAxis = margin; if (tickLabelSide == QCPAxis::lsInside) distanceToAxis = -(qMax(tickLengthIn, subTickLengthIn)+tickLabelPadding); for (int i=0; isetClipRect(oldClipRect); // axis label: QRect labelBounds; if (!label.isEmpty()) { margin += labelPadding; painter->setFont(labelFont); painter->setPen(QPen(labelColor)); labelBounds = painter->fontMetrics().boundingRect(0, 0, 0, 0, Qt::TextDontClip, label); if (type == QCPAxis::atLeft) { QTransform oldTransform = painter->transform(); painter->translate((origin.x()-margin-labelBounds.height()), origin.y()); painter->rotate(-90); painter->drawText(0, 0, axisRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label); painter->setTransform(oldTransform); } else if (type == QCPAxis::atRight) { QTransform oldTransform = painter->transform(); painter->translate((origin.x()+margin+labelBounds.height()), origin.y()-axisRect.height()); painter->rotate(90); painter->drawText(0, 0, axisRect.height(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label); painter->setTransform(oldTransform); } else if (type == QCPAxis::atTop) painter->drawText(origin.x(), origin.y()-margin-labelBounds.height(), axisRect.width(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label); else if (type == QCPAxis::atBottom) painter->drawText(origin.x(), origin.y()+margin, axisRect.width(), labelBounds.height(), Qt::TextDontClip | Qt::AlignCenter, label); } // set selection boxes: int selectionTolerance = 0; if (mParentPlot) selectionTolerance = mParentPlot->selectionTolerance(); else qDebug() << Q_FUNC_INFO << "mParentPlot is null"; int selAxisOutSize = qMax(qMax(tickLengthOut, subTickLengthOut), selectionTolerance); int selAxisInSize = selectionTolerance; int selTickLabelSize; int selTickLabelOffset; if (tickLabelSide == QCPAxis::lsOutside) { selTickLabelSize = (QCPAxis::orientation(type) == Qt::Horizontal ? tickLabelsSize.height() : tickLabelsSize.width()); selTickLabelOffset = qMax(tickLengthOut, subTickLengthOut)+tickLabelPadding; } else { selTickLabelSize = -(QCPAxis::orientation(type) == Qt::Horizontal ? tickLabelsSize.height() : tickLabelsSize.width()); selTickLabelOffset = -(qMax(tickLengthIn, subTickLengthIn)+tickLabelPadding); } int selLabelSize = labelBounds.height(); int selLabelOffset = qMax(tickLengthOut, subTickLengthOut)+(!tickLabels.isEmpty() && tickLabelSide == QCPAxis::lsOutside ? tickLabelPadding+selTickLabelSize : 0)+labelPadding; if (type == QCPAxis::atLeft) { mAxisSelectionBox.setCoords(origin.x()-selAxisOutSize, axisRect.top(), origin.x()+selAxisInSize, axisRect.bottom()); mTickLabelsSelectionBox.setCoords(origin.x()-selTickLabelOffset-selTickLabelSize, axisRect.top(), origin.x()-selTickLabelOffset, axisRect.bottom()); mLabelSelectionBox.setCoords(origin.x()-selLabelOffset-selLabelSize, axisRect.top(), origin.x()-selLabelOffset, axisRect.bottom()); } else if (type == QCPAxis::atRight) { mAxisSelectionBox.setCoords(origin.x()-selAxisInSize, axisRect.top(), origin.x()+selAxisOutSize, axisRect.bottom()); mTickLabelsSelectionBox.setCoords(origin.x()+selTickLabelOffset+selTickLabelSize, axisRect.top(), origin.x()+selTickLabelOffset, axisRect.bottom()); mLabelSelectionBox.setCoords(origin.x()+selLabelOffset+selLabelSize, axisRect.top(), origin.x()+selLabelOffset, axisRect.bottom()); } else if (type == QCPAxis::atTop) { mAxisSelectionBox.setCoords(axisRect.left(), origin.y()-selAxisOutSize, axisRect.right(), origin.y()+selAxisInSize); mTickLabelsSelectionBox.setCoords(axisRect.left(), origin.y()-selTickLabelOffset-selTickLabelSize, axisRect.right(), origin.y()-selTickLabelOffset); mLabelSelectionBox.setCoords(axisRect.left(), origin.y()-selLabelOffset-selLabelSize, axisRect.right(), origin.y()-selLabelOffset); } else if (type == QCPAxis::atBottom) { mAxisSelectionBox.setCoords(axisRect.left(), origin.y()-selAxisInSize, axisRect.right(), origin.y()+selAxisOutSize); mTickLabelsSelectionBox.setCoords(axisRect.left(), origin.y()+selTickLabelOffset+selTickLabelSize, axisRect.right(), origin.y()+selTickLabelOffset); mLabelSelectionBox.setCoords(axisRect.left(), origin.y()+selLabelOffset+selLabelSize, axisRect.right(), origin.y()+selLabelOffset); } mAxisSelectionBox = mAxisSelectionBox.normalized(); mTickLabelsSelectionBox = mTickLabelsSelectionBox.normalized(); mLabelSelectionBox = mLabelSelectionBox.normalized(); // draw hitboxes for debug purposes: //painter->setBrush(Qt::NoBrush); //painter->drawRects(QVector() << mAxisSelectionBox << mTickLabelsSelectionBox << mLabelSelectionBox); } /*! \internal Returns the size ("margin" in QCPAxisRect context, so measured perpendicular to the axis backbone direction) needed to fit the axis. */ int QCPAxisPainterPrivate::size() const { int result = 0; // get length of tick marks pointing outwards: if (!tickPositions.isEmpty()) result += qMax(0, qMax(tickLengthOut, subTickLengthOut)); // calculate size of tick labels: if (tickLabelSide == QCPAxis::lsOutside) { QSize tickLabelsSize(0, 0); if (!tickLabels.isEmpty()) { for (int i=0; ibufferDevicePixelRatio())); result.append(QByteArray::number(tickLabelRotation)); result.append(QByteArray::number((int)tickLabelSide)); result.append(QByteArray::number((int)substituteExponent)); result.append(QByteArray::number((int)numberMultiplyCross)); result.append(tickLabelColor.name().toLatin1()+QByteArray::number(tickLabelColor.alpha(), 16)); result.append(tickLabelFont.toString().toLatin1()); return result; } /*! \internal Draws a single tick label with the provided \a painter, utilizing the internal label cache to significantly speed up drawing of labels that were drawn in previous calls. The tick label is always bound to an axis, the distance to the axis is controllable via \a distanceToAxis in pixels. The pixel position in the axis direction is passed in the \a position parameter. Hence for the bottom axis, \a position would indicate the horizontal pixel position (not coordinate), at which the label should be drawn. In order to later draw the axis label in a place that doesn't overlap with the tick labels, the largest tick label size is needed. This is acquired by passing a \a tickLabelsSize to the \ref drawTickLabel calls during the process of drawing all tick labels of one axis. In every call, \a tickLabelsSize is expanded, if the drawn label exceeds the value \a tickLabelsSize currently holds. The label is drawn with the font and pen that are currently set on the \a painter. To draw superscripted powers, the font is temporarily made smaller by a fixed factor (see \ref getTickLabelData). */ void QCPAxisPainterPrivate::placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize) { // warning: if you change anything here, also adapt getMaxTickLabelSize() accordingly! if (text.isEmpty()) return; QSize finalSize; QPointF labelAnchor; switch (type) { case QCPAxis::atLeft: labelAnchor = QPointF(axisRect.left()-distanceToAxis-offset, position); break; case QCPAxis::atRight: labelAnchor = QPointF(axisRect.right()+distanceToAxis+offset, position); break; case QCPAxis::atTop: labelAnchor = QPointF(position, axisRect.top()-distanceToAxis-offset); break; case QCPAxis::atBottom: labelAnchor = QPointF(position, axisRect.bottom()+distanceToAxis+offset); break; } if (mParentPlot->plottingHints().testFlag(QCP::phCacheLabels) && !painter->modes().testFlag(QCPPainter::pmNoCaching)) // label caching enabled { CachedLabel *cachedLabel = mLabelCache.take(text); // attempt to get label from cache if (!cachedLabel) // no cached label existed, create it { cachedLabel = new CachedLabel; TickLabelData labelData = getTickLabelData(painter->font(), text); cachedLabel->offset = getTickLabelDrawOffset(labelData)+labelData.rotatedTotalBounds.topLeft(); if (!qFuzzyCompare(1.0, mParentPlot->bufferDevicePixelRatio())) { cachedLabel->pixmap = QPixmap(labelData.rotatedTotalBounds.size()*mParentPlot->bufferDevicePixelRatio()); #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED cachedLabel->pixmap.setDevicePixelRatio(mParentPlot->devicePixelRatio()); #endif } else cachedLabel->pixmap = QPixmap(labelData.rotatedTotalBounds.size()); cachedLabel->pixmap = QPixmap(labelData.rotatedTotalBounds.size()); cachedLabel->pixmap.fill(Qt::transparent); QCPPainter cachePainter(&cachedLabel->pixmap); cachePainter.setPen(painter->pen()); drawTickLabel(&cachePainter, -labelData.rotatedTotalBounds.topLeft().x(), -labelData.rotatedTotalBounds.topLeft().y(), labelData); } // if label would be partly clipped by widget border on sides, don't draw it (only for outside tick labels): bool labelClippedByBorder = false; if (tickLabelSide == QCPAxis::lsOutside) { if (QCPAxis::orientation(type) == Qt::Horizontal) labelClippedByBorder = labelAnchor.x()+cachedLabel->offset.x()+cachedLabel->pixmap.width()/mParentPlot->bufferDevicePixelRatio() > viewportRect.right() || labelAnchor.x()+cachedLabel->offset.x() < viewportRect.left(); else labelClippedByBorder = labelAnchor.y()+cachedLabel->offset.y()+cachedLabel->pixmap.height()/mParentPlot->bufferDevicePixelRatio() > viewportRect.bottom() || labelAnchor.y()+cachedLabel->offset.y() < viewportRect.top(); } if (!labelClippedByBorder) { painter->drawPixmap(labelAnchor+cachedLabel->offset, cachedLabel->pixmap); finalSize = cachedLabel->pixmap.size()/mParentPlot->bufferDevicePixelRatio(); } mLabelCache.insert(text, cachedLabel); // return label to cache or insert for the first time if newly created } else // label caching disabled, draw text directly on surface: { TickLabelData labelData = getTickLabelData(painter->font(), text); QPointF finalPosition = labelAnchor + getTickLabelDrawOffset(labelData); // if label would be partly clipped by widget border on sides, don't draw it (only for outside tick labels): bool labelClippedByBorder = false; if (tickLabelSide == QCPAxis::lsOutside) { if (QCPAxis::orientation(type) == Qt::Horizontal) labelClippedByBorder = finalPosition.x()+(labelData.rotatedTotalBounds.width()+labelData.rotatedTotalBounds.left()) > viewportRect.right() || finalPosition.x()+labelData.rotatedTotalBounds.left() < viewportRect.left(); else labelClippedByBorder = finalPosition.y()+(labelData.rotatedTotalBounds.height()+labelData.rotatedTotalBounds.top()) > viewportRect.bottom() || finalPosition.y()+labelData.rotatedTotalBounds.top() < viewportRect.top(); } if (!labelClippedByBorder) { drawTickLabel(painter, finalPosition.x(), finalPosition.y(), labelData); finalSize = labelData.rotatedTotalBounds.size(); } } // expand passed tickLabelsSize if current tick label is larger: if (finalSize.width() > tickLabelsSize->width()) tickLabelsSize->setWidth(finalSize.width()); if (finalSize.height() > tickLabelsSize->height()) tickLabelsSize->setHeight(finalSize.height()); } /*! \internal This is a \ref placeTickLabel helper function. Draws the tick label specified in \a labelData with \a painter at the pixel positions \a x and \a y. This function is used by \ref placeTickLabel to create new tick labels for the cache, or to directly draw the labels on the QCustomPlot surface when label caching is disabled, i.e. when QCP::phCacheLabels plotting hint is not set. */ void QCPAxisPainterPrivate::drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const { // backup painter settings that we're about to change: QTransform oldTransform = painter->transform(); QFont oldFont = painter->font(); // transform painter to position/rotation: painter->translate(x, y); if (!qFuzzyIsNull(tickLabelRotation)) painter->rotate(tickLabelRotation); // draw text: if (!labelData.expPart.isEmpty()) // indicator that beautiful powers must be used { painter->setFont(labelData.baseFont); painter->drawText(0, 0, 0, 0, Qt::TextDontClip, labelData.basePart); if (!labelData.suffixPart.isEmpty()) painter->drawText(labelData.baseBounds.width()+1+labelData.expBounds.width(), 0, 0, 0, Qt::TextDontClip, labelData.suffixPart); painter->setFont(labelData.expFont); painter->drawText(labelData.baseBounds.width()+1, 0, labelData.expBounds.width(), labelData.expBounds.height(), Qt::TextDontClip, labelData.expPart); } else { painter->setFont(labelData.baseFont); painter->drawText(0, 0, labelData.totalBounds.width(), labelData.totalBounds.height(), Qt::TextDontClip | Qt::AlignHCenter, labelData.basePart); } // reset painter settings to what it was before: painter->setTransform(oldTransform); painter->setFont(oldFont); } /*! \internal This is a \ref placeTickLabel helper function. Transforms the passed \a text and \a font to a tickLabelData structure that can then be further processed by \ref getTickLabelDrawOffset and \ref drawTickLabel. It splits the text into base and exponent if necessary (member substituteExponent) and calculates appropriate bounding boxes. */ QCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData(const QFont &font, const QString &text) const { TickLabelData result; // determine whether beautiful decimal powers should be used bool useBeautifulPowers = false; int ePos = -1; // first index of exponent part, text before that will be basePart, text until eLast will be expPart int eLast = -1; // last index of exponent part, rest of text after this will be suffixPart if (substituteExponent) { ePos = text.indexOf(QLatin1Char('e')); if (ePos > 0 && text.at(ePos-1).isDigit()) { eLast = ePos; while (eLast+1 < text.size() && (text.at(eLast+1) == QLatin1Char('+') || text.at(eLast+1) == QLatin1Char('-') || text.at(eLast+1).isDigit())) ++eLast; if (eLast > ePos) // only if also to right of 'e' is a digit/+/- interpret it as beautifiable power useBeautifulPowers = true; } } // calculate text bounding rects and do string preparation for beautiful decimal powers: result.baseFont = font; if (result.baseFont.pointSizeF() > 0) // might return -1 if specified with setPixelSize, in that case we can't do correction in next line result.baseFont.setPointSizeF(result.baseFont.pointSizeF()+0.05); // QFontMetrics.boundingRect has a bug for exact point sizes that make the results oscillate due to internal rounding if (useBeautifulPowers) { // split text into parts of number/symbol that will be drawn normally and part that will be drawn as exponent: result.basePart = text.left(ePos); result.suffixPart = text.mid(eLast+1); // also drawn normally but after exponent // in log scaling, we want to turn "1*10^n" into "10^n", else add multiplication sign and decimal base: if (abbreviateDecimalPowers && result.basePart == QLatin1String("1")) result.basePart = QLatin1String("10"); else result.basePart += (numberMultiplyCross ? QString(QChar(215)) : QString(QChar(183))) + QLatin1String("10"); result.expPart = text.mid(ePos+1, eLast-ePos); // clip "+" and leading zeros off expPart: while (result.expPart.length() > 2 && result.expPart.at(1) == QLatin1Char('0')) // length > 2 so we leave one zero when numberFormatChar is 'e' result.expPart.remove(1, 1); if (!result.expPart.isEmpty() && result.expPart.at(0) == QLatin1Char('+')) result.expPart.remove(0, 1); // prepare smaller font for exponent: result.expFont = font; if (result.expFont.pointSize() > 0) result.expFont.setPointSize(result.expFont.pointSize()*0.75); else result.expFont.setPixelSize(result.expFont.pixelSize()*0.75); // calculate bounding rects of base part(s), exponent part and total one: result.baseBounds = QFontMetrics(result.baseFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip, result.basePart); result.expBounds = QFontMetrics(result.expFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip, result.expPart); if (!result.suffixPart.isEmpty()) result.suffixBounds = QFontMetrics(result.baseFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip, result.suffixPart); result.totalBounds = result.baseBounds.adjusted(0, 0, result.expBounds.width()+result.suffixBounds.width()+2, 0); // +2 consists of the 1 pixel spacing between base and exponent (see drawTickLabel) and an extra pixel to include AA } else // useBeautifulPowers == false { result.basePart = text; result.totalBounds = QFontMetrics(result.baseFont).boundingRect(0, 0, 0, 0, Qt::TextDontClip | Qt::AlignHCenter, result.basePart); } result.totalBounds.moveTopLeft(QPoint(0, 0)); // want bounding box aligned top left at origin, independent of how it was created, to make further processing simpler // calculate possibly different bounding rect after rotation: result.rotatedTotalBounds = result.totalBounds; if (!qFuzzyIsNull(tickLabelRotation)) { QTransform transform; transform.rotate(tickLabelRotation); result.rotatedTotalBounds = transform.mapRect(result.rotatedTotalBounds); } return result; } /*! \internal This is a \ref placeTickLabel helper function. Calculates the offset at which the top left corner of the specified tick label shall be drawn. The offset is relative to a point right next to the tick the label belongs to. This function is thus responsible for e.g. centering tick labels under ticks and positioning them appropriately when they are rotated. */ QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset(const TickLabelData &labelData) const { /* calculate label offset from base point at tick (non-trivial, for best visual appearance): short explanation for bottom axis: The anchor, i.e. the point in the label that is placed horizontally under the corresponding tick is always on the label side that is closer to the axis (e.g. the left side of the text when we're rotating clockwise). On that side, the height is halved and the resulting point is defined the anchor. This way, a 90 degree rotated text will be centered under the tick (i.e. displaced horizontally by half its height). At the same time, a 45 degree rotated text will "point toward" its tick, as is typical for rotated tick labels. */ bool doRotation = !qFuzzyIsNull(tickLabelRotation); bool flip = qFuzzyCompare(qAbs(tickLabelRotation), 90.0); // perfect +/-90 degree flip. Indicates vertical label centering on vertical axes. double radians = tickLabelRotation/180.0*M_PI; int x=0, y=0; if ((type == QCPAxis::atLeft && tickLabelSide == QCPAxis::lsOutside) || (type == QCPAxis::atRight && tickLabelSide == QCPAxis::lsInside)) // Anchor at right side of tick label { if (doRotation) { if (tickLabelRotation > 0) { x = -qCos(radians)*labelData.totalBounds.width(); y = flip ? -labelData.totalBounds.width()/2.0 : -qSin(radians)*labelData.totalBounds.width()-qCos(radians)*labelData.totalBounds.height()/2.0; } else { x = -qCos(-radians)*labelData.totalBounds.width()-qSin(-radians)*labelData.totalBounds.height(); y = flip ? +labelData.totalBounds.width()/2.0 : +qSin(-radians)*labelData.totalBounds.width()-qCos(-radians)*labelData.totalBounds.height()/2.0; } } else { x = -labelData.totalBounds.width(); y = -labelData.totalBounds.height()/2.0; } } else if ((type == QCPAxis::atRight && tickLabelSide == QCPAxis::lsOutside) || (type == QCPAxis::atLeft && tickLabelSide == QCPAxis::lsInside)) // Anchor at left side of tick label { if (doRotation) { if (tickLabelRotation > 0) { x = +qSin(radians)*labelData.totalBounds.height(); y = flip ? -labelData.totalBounds.width()/2.0 : -qCos(radians)*labelData.totalBounds.height()/2.0; } else { x = 0; y = flip ? +labelData.totalBounds.width()/2.0 : -qCos(-radians)*labelData.totalBounds.height()/2.0; } } else { x = 0; y = -labelData.totalBounds.height()/2.0; } } else if ((type == QCPAxis::atTop && tickLabelSide == QCPAxis::lsOutside) || (type == QCPAxis::atBottom && tickLabelSide == QCPAxis::lsInside)) // Anchor at bottom side of tick label { if (doRotation) { if (tickLabelRotation > 0) { x = -qCos(radians)*labelData.totalBounds.width()+qSin(radians)*labelData.totalBounds.height()/2.0; y = -qSin(radians)*labelData.totalBounds.width()-qCos(radians)*labelData.totalBounds.height(); } else { x = -qSin(-radians)*labelData.totalBounds.height()/2.0; y = -qCos(-radians)*labelData.totalBounds.height(); } } else { x = -labelData.totalBounds.width()/2.0; y = -labelData.totalBounds.height(); } } else if ((type == QCPAxis::atBottom && tickLabelSide == QCPAxis::lsOutside) || (type == QCPAxis::atTop && tickLabelSide == QCPAxis::lsInside)) // Anchor at top side of tick label { if (doRotation) { if (tickLabelRotation > 0) { x = +qSin(radians)*labelData.totalBounds.height()/2.0; y = 0; } else { x = -qCos(-radians)*labelData.totalBounds.width()-qSin(-radians)*labelData.totalBounds.height()/2.0; y = +qSin(-radians)*labelData.totalBounds.width(); } } else { x = -labelData.totalBounds.width()/2.0; y = 0; } } return QPointF(x, y); } /*! \internal Simulates the steps done by \ref placeTickLabel by calculating bounding boxes of the text label to be drawn, depending on number format etc. Since only the largest tick label is wanted for the margin calculation, the passed \a tickLabelsSize is only expanded, if it's currently set to a smaller width/height. */ void QCPAxisPainterPrivate::getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const { // note: this function must return the same tick label sizes as the placeTickLabel function. QSize finalSize; if (mParentPlot->plottingHints().testFlag(QCP::phCacheLabels) && mLabelCache.contains(text)) // label caching enabled and have cached label { const CachedLabel *cachedLabel = mLabelCache.object(text); finalSize = cachedLabel->pixmap.size()/mParentPlot->bufferDevicePixelRatio(); } else // label caching disabled or no label with this text cached: { TickLabelData labelData = getTickLabelData(font, text); finalSize = labelData.rotatedTotalBounds.size(); } // expand passed tickLabelsSize if current tick label is larger: if (finalSize.width() > tickLabelsSize->width()) tickLabelsSize->setWidth(finalSize.width()); if (finalSize.height() > tickLabelsSize->height()) tickLabelsSize->setHeight(finalSize.height()); } /* end of 'src/axis/axis.cpp' */ /* including file 'src/scatterstyle.cpp', size 17420 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPScatterStyle //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPScatterStyle \brief Represents the visual appearance of scatter points This class holds information about shape, color and size of scatter points. In plottables like QCPGraph it is used to store how scatter points shall be drawn. For example, \ref QCPGraph::setScatterStyle takes a QCPScatterStyle instance. A scatter style consists of a shape (\ref setShape), a line color (\ref setPen) and possibly a fill (\ref setBrush), if the shape provides a fillable area. Further, the size of the shape can be controlled with \ref setSize. \section QCPScatterStyle-defining Specifying a scatter style You can set all these configurations either by calling the respective functions on an instance: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpscatterstyle-creation-1 Or you can use one of the various constructors that take different parameter combinations, making it easy to specify a scatter style in a single call, like so: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpscatterstyle-creation-2 \section QCPScatterStyle-undefinedpen Leaving the color/pen up to the plottable There are two constructors which leave the pen undefined: \ref QCPScatterStyle() and \ref QCPScatterStyle(ScatterShape shape, double size). If those constructors are used, a call to \ref isPenDefined will return false. It leads to scatter points that inherit the pen from the plottable that uses the scatter style. Thus, if such a scatter style is passed to QCPGraph, the line color of the graph (\ref QCPGraph::setPen) will be used by the scatter points. This makes it very convenient to set up typical scatter settings: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpscatterstyle-shortcreation Notice that it wasn't even necessary to explicitly call a QCPScatterStyle constructor. This works because QCPScatterStyle provides a constructor that can transform a \ref ScatterShape directly into a QCPScatterStyle instance (that's the \ref QCPScatterStyle(ScatterShape shape, double size) constructor with a default for \a size). In those cases, C++ allows directly supplying a \ref ScatterShape, where actually a QCPScatterStyle is expected. \section QCPScatterStyle-custompath-and-pixmap Custom shapes and pixmaps QCPScatterStyle supports drawing custom shapes and arbitrary pixmaps as scatter points. For custom shapes, you can provide a QPainterPath with the desired shape to the \ref setCustomPath function or call the constructor that takes a painter path. The scatter shape will automatically be set to \ref ssCustom. For pixmaps, you call \ref setPixmap with the desired QPixmap. Alternatively you can use the constructor that takes a QPixmap. The scatter shape will automatically be set to \ref ssPixmap. Note that \ref setSize does not influence the appearance of the pixmap. */ /* start documentation of inline functions */ /*! \fn bool QCPScatterStyle::isNone() const Returns whether the scatter shape is \ref ssNone. \see setShape */ /*! \fn bool QCPScatterStyle::isPenDefined() const Returns whether a pen has been defined for this scatter style. The pen is undefined if a constructor is called that does not carry \a pen as parameter. Those are \ref QCPScatterStyle() and \ref QCPScatterStyle(ScatterShape shape, double size). If the pen is undefined, the pen of the respective plottable will be used for drawing scatters. If a pen was defined for this scatter style instance, and you now wish to undefine the pen, call \ref undefinePen. \see setPen */ /* end documentation of inline functions */ /*! Creates a new QCPScatterStyle instance with size set to 6. No shape, pen or brush is defined. Since the pen is undefined (\ref isPenDefined returns false), the scatter color will be inherited from the plottable that uses this scatter style. */ QCPScatterStyle::QCPScatterStyle() : mSize(6), mShape(ssNone), mPen(Qt::NoPen), mBrush(Qt::NoBrush), mPenDefined(false) { } /*! Creates a new QCPScatterStyle instance with shape set to \a shape and size to \a size. No pen or brush is defined. Since the pen is undefined (\ref isPenDefined returns false), the scatter color will be inherited from the plottable that uses this scatter style. */ QCPScatterStyle::QCPScatterStyle(ScatterShape shape, double size) : mSize(size), mShape(shape), mPen(Qt::NoPen), mBrush(Qt::NoBrush), mPenDefined(false) { } /*! Creates a new QCPScatterStyle instance with shape set to \a shape, the pen color set to \a color, and size to \a size. No brush is defined, i.e. the scatter point will not be filled. */ QCPScatterStyle::QCPScatterStyle(ScatterShape shape, const QColor &color, double size) : mSize(size), mShape(shape), mPen(QPen(color)), mBrush(Qt::NoBrush), mPenDefined(true) { } /*! Creates a new QCPScatterStyle instance with shape set to \a shape, the pen color set to \a color, the brush color to \a fill (with a solid pattern), and size to \a size. */ QCPScatterStyle::QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size) : mSize(size), mShape(shape), mPen(QPen(color)), mBrush(QBrush(fill)), mPenDefined(true) { } /*! Creates a new QCPScatterStyle instance with shape set to \a shape, the pen set to \a pen, the brush to \a brush, and size to \a size. \warning In some cases it might be tempting to directly use a pen style like Qt::NoPen as \a pen and a color like Qt::blue as \a brush. Notice however, that the corresponding call\n QCPScatterStyle(QCPScatterShape::ssCircle, Qt::NoPen, Qt::blue, 5)\n doesn't necessarily lead C++ to use this constructor in some cases, but might mistake Qt::NoPen for a QColor and use the \ref QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size) constructor instead (which will lead to an unexpected look of the scatter points). To prevent this, be more explicit with the parameter types. For example, use QBrush(Qt::blue) instead of just Qt::blue, to clearly point out to the compiler that this constructor is wanted. */ QCPScatterStyle::QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size) : mSize(size), mShape(shape), mPen(pen), mBrush(brush), mPenDefined(pen.style() != Qt::NoPen) { } /*! Creates a new QCPScatterStyle instance which will show the specified \a pixmap. The scatter shape is set to \ref ssPixmap. */ QCPScatterStyle::QCPScatterStyle(const QPixmap &pixmap) : mSize(5), mShape(ssPixmap), mPen(Qt::NoPen), mBrush(Qt::NoBrush), mPixmap(pixmap), mPenDefined(false) { } /*! Creates a new QCPScatterStyle instance with a custom shape that is defined via \a customPath. The scatter shape is set to \ref ssCustom. The custom shape line will be drawn with \a pen and filled with \a brush. The size has a slightly different meaning than for built-in scatter points: The custom path will be drawn scaled by a factor of \a size/6.0. Since the default \a size is 6, the custom path will appear at a its natural size by default. To double the size of the path for example, set \a size to 12. */ QCPScatterStyle::QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush, double size) : mSize(size), mShape(ssCustom), mPen(pen), mBrush(brush), mCustomPath(customPath), mPenDefined(pen.style() != Qt::NoPen) { } /*! Copies the specified \a properties from the \a other scatter style to this scatter style. */ void QCPScatterStyle::setFromOther(const QCPScatterStyle &other, ScatterProperties properties) { if (properties.testFlag(spPen)) { setPen(other.pen()); if (!other.isPenDefined()) undefinePen(); } if (properties.testFlag(spBrush)) setBrush(other.brush()); if (properties.testFlag(spSize)) setSize(other.size()); if (properties.testFlag(spShape)) { setShape(other.shape()); if (other.shape() == ssPixmap) setPixmap(other.pixmap()); else if (other.shape() == ssCustom) setCustomPath(other.customPath()); } } /*! Sets the size (pixel diameter) of the drawn scatter points to \a size. \see setShape */ void QCPScatterStyle::setSize(double size) { mSize = size; } /*! Sets the shape to \a shape. Note that the calls \ref setPixmap and \ref setCustomPath automatically set the shape to \ref ssPixmap and \ref ssCustom, respectively. \see setSize */ void QCPScatterStyle::setShape(QCPScatterStyle::ScatterShape shape) { mShape = shape; } /*! Sets the pen that will be used to draw scatter points to \a pen. If the pen was previously undefined (see \ref isPenDefined), the pen is considered defined after a call to this function, even if \a pen is Qt::NoPen. If you have defined a pen previously by calling this function and now wish to undefine the pen, call \ref undefinePen. \see setBrush */ void QCPScatterStyle::setPen(const QPen &pen) { mPenDefined = true; mPen = pen; } /*! Sets the brush that will be used to fill scatter points to \a brush. Note that not all scatter shapes have fillable areas. For example, \ref ssPlus does not while \ref ssCircle does. \see setPen */ void QCPScatterStyle::setBrush(const QBrush &brush) { mBrush = brush; } /*! Sets the pixmap that will be drawn as scatter point to \a pixmap. Note that \ref setSize does not influence the appearance of the pixmap. The scatter shape is automatically set to \ref ssPixmap. */ void QCPScatterStyle::setPixmap(const QPixmap &pixmap) { setShape(ssPixmap); mPixmap = pixmap; } /*! Sets the custom shape that will be drawn as scatter point to \a customPath. The scatter shape is automatically set to \ref ssCustom. */ void QCPScatterStyle::setCustomPath(const QPainterPath &customPath) { setShape(ssCustom); mCustomPath = customPath; } /*! Sets this scatter style to have an undefined pen (see \ref isPenDefined for what an undefined pen implies). A call to \ref setPen will define a pen. */ void QCPScatterStyle::undefinePen() { mPenDefined = false; } /*! Applies the pen and the brush of this scatter style to \a painter. If this scatter style has an undefined pen (\ref isPenDefined), sets the pen of \a painter to \a defaultPen instead. This function is used by plottables (or any class that wants to draw scatters) just before a number of scatters with this style shall be drawn with the \a painter. \see drawShape */ void QCPScatterStyle::applyTo(QCPPainter *painter, const QPen &defaultPen) const { painter->setPen(mPenDefined ? mPen : defaultPen); painter->setBrush(mBrush); } /*! Draws the scatter shape with \a painter at position \a pos. This function does not modify the pen or the brush on the painter, as \ref applyTo is meant to be called before scatter points are drawn with \ref drawShape. \see applyTo */ void QCPScatterStyle::drawShape(QCPPainter *painter, const QPointF &pos) const { drawShape(painter, pos.x(), pos.y()); } /*! \overload Draws the scatter shape with \a painter at position \a x and \a y. */ void QCPScatterStyle::drawShape(QCPPainter *painter, double x, double y) const { double w = mSize/2.0; switch (mShape) { case ssNone: break; case ssDot: { painter->drawLine(QPointF(x, y), QPointF(x+0.0001, y)); break; } case ssCross: { painter->drawLine(QLineF(x-w, y-w, x+w, y+w)); painter->drawLine(QLineF(x-w, y+w, x+w, y-w)); break; } case ssPlus: { painter->drawLine(QLineF(x-w, y, x+w, y)); painter->drawLine(QLineF( x, y+w, x, y-w)); break; } case ssCircle: { painter->drawEllipse(QPointF(x , y), w, w); break; } case ssDisc: { QBrush b = painter->brush(); painter->setBrush(painter->pen().color()); painter->drawEllipse(QPointF(x , y), w, w); painter->setBrush(b); break; } case ssSquare: { painter->drawRect(QRectF(x-w, y-w, mSize, mSize)); break; } case ssDiamond: { painter->drawLine(QLineF(x-w, y, x, y-w)); painter->drawLine(QLineF( x, y-w, x+w, y)); painter->drawLine(QLineF(x+w, y, x, y+w)); painter->drawLine(QLineF( x, y+w, x-w, y)); break; } case ssStar: { painter->drawLine(QLineF(x-w, y, x+w, y)); painter->drawLine(QLineF( x, y+w, x, y-w)); painter->drawLine(QLineF(x-w*0.707, y-w*0.707, x+w*0.707, y+w*0.707)); painter->drawLine(QLineF(x-w*0.707, y+w*0.707, x+w*0.707, y-w*0.707)); break; } case ssTriangle: { painter->drawLine(QLineF(x-w, y+0.755*w, x+w, y+0.755*w)); painter->drawLine(QLineF(x+w, y+0.755*w, x, y-0.977*w)); painter->drawLine(QLineF( x, y-0.977*w, x-w, y+0.755*w)); break; } case ssTriangleInverted: { painter->drawLine(QLineF(x-w, y-0.755*w, x+w, y-0.755*w)); painter->drawLine(QLineF(x+w, y-0.755*w, x, y+0.977*w)); painter->drawLine(QLineF( x, y+0.977*w, x-w, y-0.755*w)); break; } case ssCrossSquare: { painter->drawLine(QLineF(x-w, y-w, x+w*0.95, y+w*0.95)); painter->drawLine(QLineF(x-w, y+w*0.95, x+w*0.95, y-w)); painter->drawRect(QRectF(x-w, y-w, mSize, mSize)); break; } case ssPlusSquare: { painter->drawLine(QLineF(x-w, y, x+w*0.95, y)); painter->drawLine(QLineF( x, y+w, x, y-w)); painter->drawRect(QRectF(x-w, y-w, mSize, mSize)); break; } case ssCrossCircle: { painter->drawLine(QLineF(x-w*0.707, y-w*0.707, x+w*0.670, y+w*0.670)); painter->drawLine(QLineF(x-w*0.707, y+w*0.670, x+w*0.670, y-w*0.707)); painter->drawEllipse(QPointF(x, y), w, w); break; } case ssPlusCircle: { painter->drawLine(QLineF(x-w, y, x+w, y)); painter->drawLine(QLineF( x, y+w, x, y-w)); painter->drawEllipse(QPointF(x, y), w, w); break; } case ssPeace: { painter->drawLine(QLineF(x, y-w, x, y+w)); painter->drawLine(QLineF(x, y, x-w*0.707, y+w*0.707)); painter->drawLine(QLineF(x, y, x+w*0.707, y+w*0.707)); painter->drawEllipse(QPointF(x, y), w, w); break; } case ssPixmap: { const double widthHalf = mPixmap.width()*0.5; const double heightHalf = mPixmap.height()*0.5; #if QT_VERSION < QT_VERSION_CHECK(4, 8, 0) const QRectF clipRect = painter->clipRegion().boundingRect().adjusted(-widthHalf, -heightHalf, widthHalf, heightHalf); #else const QRectF clipRect = painter->clipBoundingRect().adjusted(-widthHalf, -heightHalf, widthHalf, heightHalf); #endif if (clipRect.contains(x, y)) painter->drawPixmap(x-widthHalf, y-heightHalf, mPixmap); break; } case ssCustom: { QTransform oldTransform = painter->transform(); painter->translate(x, y); painter->scale(mSize/6.0, mSize/6.0); painter->drawPath(mCustomPath); painter->setTransform(oldTransform); break; } } } /* end of 'src/scatterstyle.cpp' */ //amalgamation: add datacontainer.cpp /* including file 'src/plottable.cpp', size 38861 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPSelectionDecorator //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPSelectionDecorator \brief Controls how a plottable's data selection is drawn Each \ref QCPAbstractPlottable instance has one \ref QCPSelectionDecorator (accessible via \ref QCPAbstractPlottable::selectionDecorator) and uses it when drawing selected segments of its data. The selection decorator controls both pen (\ref setPen) and brush (\ref setBrush), as well as the scatter style (\ref setScatterStyle) if the plottable draws scatters. Since a \ref QCPScatterStyle is itself composed of different properties such as color shape and size, the decorator allows specifying exactly which of those properties shall be used for the selected data point, via \ref setUsedScatterProperties. A \ref QCPSelectionDecorator subclass instance can be passed to a plottable via \ref QCPAbstractPlottable::setSelectionDecorator, allowing greater customizability of the appearance of selected segments. Use \ref copyFrom to easily transfer the settings of one decorator to another one. This is especially useful since plottables take ownership of the passed selection decorator, and thus the same decorator instance can not be passed to multiple plottables. Selection decorators can also themselves perform drawing operations by reimplementing \ref drawDecoration, which is called by the plottable's draw method. The base class \ref QCPSelectionDecorator does not make use of this however. For example, \ref QCPSelectionDecoratorBracket draws brackets around selected data segments. */ /*! Creates a new QCPSelectionDecorator instance with default values */ QCPSelectionDecorator::QCPSelectionDecorator() : mPen(QColor(80, 80, 255), 2.5), mBrush(Qt::NoBrush), mScatterStyle(QCPScatterStyle::ssNone, QPen(Qt::blue, 2), Qt::NoBrush, 6.0), mUsedScatterProperties(QCPScatterStyle::spPen), mPlottable(0) { } QCPSelectionDecorator::~QCPSelectionDecorator() { } /*! Sets the pen that will be used by the parent plottable to draw selected data segments. */ void QCPSelectionDecorator::setPen(const QPen &pen) { mPen = pen; } /*! Sets the brush that will be used by the parent plottable to draw selected data segments. */ void QCPSelectionDecorator::setBrush(const QBrush &brush) { mBrush = brush; } /*! Sets the scatter style that will be used by the parent plottable to draw scatters in selected data segments. \a usedProperties specifies which parts of the passed \a scatterStyle will be used by the plottable. The used properties can also be changed via \ref setUsedScatterProperties. */ void QCPSelectionDecorator::setScatterStyle(const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties) { mScatterStyle = scatterStyle; setUsedScatterProperties(usedProperties); } /*! Use this method to define which properties of the scatter style (set via \ref setScatterStyle) will be used for selected data segments. All properties of the scatter style that are not specified in \a properties will remain as specified in the plottable's original scatter style. */ void QCPSelectionDecorator::setUsedScatterProperties(const QCPScatterStyle::ScatterProperties &properties) { mUsedScatterProperties = properties; } /*! Sets the pen of \a painter to the pen of this selection decorator. \see applyBrush, getFinalScatterStyle */ void QCPSelectionDecorator::applyPen(QCPPainter *painter) const { painter->setPen(mPen); } /*! Sets the brush of \a painter to the brush of this selection decorator. \see applyPen, getFinalScatterStyle */ void QCPSelectionDecorator::applyBrush(QCPPainter *painter) const { painter->setBrush(mBrush); } /*! Returns the scatter style that the parent plottable shall use for selected scatter points. The plottable's original (unselected) scatter style must be passed as \a unselectedStyle. Depending on the setting of \ref setUsedScatterProperties, the returned scatter style is a mixture of this selecion decorator's scatter style (\ref setScatterStyle), and \a unselectedStyle. \see applyPen, applyBrush, setScatterStyle */ QCPScatterStyle QCPSelectionDecorator::getFinalScatterStyle(const QCPScatterStyle &unselectedStyle) const { QCPScatterStyle result(unselectedStyle); result.setFromOther(mScatterStyle, mUsedScatterProperties); // if style shall inherit pen from plottable (has no own pen defined), give it the selected // plottable pen explicitly, so it doesn't use the unselected plottable pen when used in the // plottable: if (!result.isPenDefined()) result.setPen(mPen); return result; } /*! Copies all properties (e.g. color, fill, scatter style) of the \a other selection decorator to this selection decorator. */ void QCPSelectionDecorator::copyFrom(const QCPSelectionDecorator *other) { setPen(other->pen()); setBrush(other->brush()); setScatterStyle(other->scatterStyle(), other->usedScatterProperties()); } /*! This method is called by all plottables' draw methods to allow custom selection decorations to be drawn. Use the passed \a painter to perform the drawing operations. \a selection carries the data selection for which the decoration shall be drawn. The default base class implementation of \ref QCPSelectionDecorator has no special decoration, so this method does nothing. */ void QCPSelectionDecorator::drawDecoration(QCPPainter *painter, QCPDataSelection selection) { Q_UNUSED(painter) Q_UNUSED(selection) } /*! \internal This method is called as soon as a selection decorator is associated with a plottable, by a call to \ref QCPAbstractPlottable::setSelectionDecorator. This way the selection decorator can obtain a pointer to the plottable that uses it (e.g. to access data points via the \ref QCPAbstractPlottable::interface1D interface). If the selection decorator was already added to a different plottable before, this method aborts the registration and returns false. */ bool QCPSelectionDecorator::registerWithPlottable(QCPAbstractPlottable *plottable) { if (!mPlottable) { mPlottable = plottable; return true; } else { qDebug() << Q_FUNC_INFO << "This selection decorator is already registered with plottable:" << reinterpret_cast(mPlottable); return false; } } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAbstractPlottable //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAbstractPlottable \brief The abstract base class for all data representing objects in a plot. It defines a very basic interface like name, pen, brush, visibility etc. Since this class is abstract, it can't be instantiated. Use one of the subclasses or create a subclass yourself to create new ways of displaying data (see "Creating own plottables" below). Plottables that display one-dimensional data (i.e. data points have a single key dimension and one or multiple values at each key) are based off of the template subclass \ref QCPAbstractPlottable1D, see details there. All further specifics are in the subclasses, for example: \li A normal graph with possibly a line and/or scatter points \ref QCPGraph (typically created with \ref QCustomPlot::addGraph) \li A parametric curve: \ref QCPCurve \li A bar chart: \ref QCPBars \li A statistical box plot: \ref QCPStatisticalBox \li A color encoded two-dimensional map: \ref QCPColorMap \li An OHLC/Candlestick chart: \ref QCPFinancial \section plottables-subclassing Creating own plottables Subclassing directly from QCPAbstractPlottable is only recommended if you wish to display two-dimensional data like \ref QCPColorMap, i.e. two logical key dimensions and one (or more) data dimensions. If you want to display data with only one logical key dimension, you should rather derive from \ref QCPAbstractPlottable1D. If subclassing QCPAbstractPlottable directly, these are the pure virtual functions you must implement: \li \ref selectTest \li \ref draw \li \ref drawLegendIcon \li \ref getKeyRange \li \ref getValueRange See the documentation of those functions for what they need to do. For drawing your plot, you can use the \ref coordsToPixels functions to translate a point in plot coordinates to pixel coordinates. This function is quite convenient, because it takes the orientation of the key and value axes into account for you (x and y are swapped when the key axis is vertical and the value axis horizontal). If you are worried about performance (i.e. you need to translate many points in a loop like QCPGraph), you can directly use \ref QCPAxis::coordToPixel. However, you must then take care about the orientation of the axis yourself. Here are some important members you inherit from QCPAbstractPlottable:
QCustomPlot *\b mParentPlot A pointer to the parent QCustomPlot instance. The parent plot is inferred from the axes that are passed in the constructor.
QString \b mName The name of the plottable.
QPen \b mPen The generic pen of the plottable. You should use this pen for the most prominent data representing lines in the plottable (e.g QCPGraph uses this pen for its graph lines and scatters)
QBrush \b mBrush The generic brush of the plottable. You should use this brush for the most prominent fillable structures in the plottable (e.g. QCPGraph uses this brush to control filling under the graph)
QPointer<\ref QCPAxis> \b mKeyAxis, \b mValueAxis The key and value axes this plottable is attached to. Call their QCPAxis::coordToPixel functions to translate coordinates to pixels in either the key or value dimension. Make sure to check whether the pointer is null before using it. If one of the axes is null, don't draw the plottable.
\ref QCPSelectionDecorator \b mSelectionDecorator The currently set selection decorator which specifies how selected data of the plottable shall be drawn and decorated. When drawing your data, you must consult this decorator for the appropriate pen/brush before drawing unselected/selected data segments. Finally, you should call its \ref QCPSelectionDecorator::drawDecoration method at the end of your \ref draw implementation.
\ref QCP::SelectionType \b mSelectable In which composition, if at all, this plottable's data may be selected. Enforcing this setting on the data selection is done by QCPAbstractPlottable automatically.
\ref QCPDataSelection \b mSelection Holds the current selection state of the plottable's data, i.e. the selected data ranges (\ref QCPDataRange).
*/ /* start of documentation of inline functions */ /*! \fn QCPSelectionDecorator *QCPAbstractPlottable::selectionDecorator() const Provides access to the selection decorator of this plottable. The selection decorator controls how selected data ranges are drawn (e.g. their pen color and fill), see \ref QCPSelectionDecorator for details. If you wish to use an own \ref QCPSelectionDecorator subclass, pass an instance of it to \ref setSelectionDecorator. */ /*! \fn bool QCPAbstractPlottable::selected() const Returns true if there are any data points of the plottable currently selected. Use \ref selection to retrieve the current \ref QCPDataSelection. */ /*! \fn QCPDataSelection QCPAbstractPlottable::selection() const Returns a \ref QCPDataSelection encompassing all the data points that are currently selected on this plottable. \see selected, setSelection, setSelectable */ /*! \fn virtual QCPPlottableInterface1D *QCPAbstractPlottable::interface1D() If this plottable is a one-dimensional plottable, i.e. it implements the \ref QCPPlottableInterface1D, returns the \a this pointer with that type. Otherwise (e.g. in the case of a \ref QCPColorMap) returns zero. You can use this method to gain read access to data coordinates while holding a pointer to the abstract base class only. */ /* end of documentation of inline functions */ /* start of documentation of pure virtual functions */ /*! \fn void QCPAbstractPlottable::drawLegendIcon(QCPPainter *painter, const QRect &rect) const = 0 \internal called by QCPLegend::draw (via QCPPlottableLegendItem::draw) to create a graphical representation of this plottable inside \a rect, next to the plottable name. The passed \a painter has its cliprect set to \a rect, so painting outside of \a rect won't appear outside the legend icon border. */ /*! \fn QCPRange QCPAbstractPlottable::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const = 0 Returns the coordinate range that all data in this plottable span in the key axis dimension. For logarithmic plots, one can set \a inSignDomain to either \ref QCP::sdNegative or \ref QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set \a inSignDomain to \ref QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set \a inSignDomain to \ref QCP::sdBoth (default). \a foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data). Note that \a foundRange is not the same as \ref QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case \a foundRange would return true, but the returned range is not a valid range in terms of \ref QCPRange::validRange. \see rescaleAxes, getValueRange */ /*! \fn QCPRange QCPAbstractPlottable::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const = 0 Returns the coordinate range that the data points in the specified key range (\a inKeyRange) span in the value axis dimension. For logarithmic plots, one can set \a inSignDomain to either \ref QCP::sdNegative or \ref QCP::sdPositive in order to restrict the returned range to that sign domain. E.g. when only negative range is wanted, set \a inSignDomain to \ref QCP::sdNegative and all positive points will be ignored for range calculation. For no restriction, just set \a inSignDomain to \ref QCP::sdBoth (default). \a foundRange is an output parameter that indicates whether a range could be found or not. If this is false, you shouldn't use the returned range (e.g. no points in data). If \a inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys. Note that \a foundRange is not the same as \ref QCPRange::validRange, since the range returned by this function may have size zero (e.g. when there is only one data point). In this case \a foundRange would return true, but the returned range is not a valid range in terms of \ref QCPRange::validRange. \see rescaleAxes, getKeyRange */ /* end of documentation of pure virtual functions */ /* start of documentation of signals */ /*! \fn void QCPAbstractPlottable::selectionChanged(bool selected) This signal is emitted when the selection state of this plottable has changed, either by user interaction or by a direct call to \ref setSelection. The parameter \a selected indicates whether there are any points selected or not. \see selectionChanged(const QCPDataSelection &selection) */ /*! \fn void QCPAbstractPlottable::selectionChanged(const QCPDataSelection &selection) This signal is emitted when the selection state of this plottable has changed, either by user interaction or by a direct call to \ref setSelection. The parameter \a selection holds the currently selected data ranges. \see selectionChanged(bool selected) */ /*! \fn void QCPAbstractPlottable::selectableChanged(QCP::SelectionType selectable); This signal is emitted when the selectability of this plottable has changed. \see setSelectable */ /* end of documentation of signals */ /*! Constructs an abstract plottable which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and have perpendicular orientations. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. Since QCPAbstractPlottable is an abstract class that defines the basic interface to plottables, it can't be directly instantiated. You probably want one of the subclasses like \ref QCPGraph or \ref QCPCurve instead. */ QCPAbstractPlottable::QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPLayerable(keyAxis->parentPlot(), QString(), keyAxis->axisRect()), mName(), mAntialiasedFill(true), mAntialiasedScatters(true), mPen(Qt::black), mBrush(Qt::NoBrush), mKeyAxis(keyAxis), mValueAxis(valueAxis), mSelectable(QCP::stWhole), mSelectionDecorator(0) { if (keyAxis->parentPlot() != valueAxis->parentPlot()) qDebug() << Q_FUNC_INFO << "Parent plot of keyAxis is not the same as that of valueAxis."; if (keyAxis->orientation() == valueAxis->orientation()) qDebug() << Q_FUNC_INFO << "keyAxis and valueAxis must be orthogonal to each other."; mParentPlot->registerPlottable(this); setSelectionDecorator(new QCPSelectionDecorator); } QCPAbstractPlottable::~QCPAbstractPlottable() { if (mSelectionDecorator) { delete mSelectionDecorator; mSelectionDecorator = 0; } } /*! The name is the textual representation of this plottable as it is displayed in the legend (\ref QCPLegend). It may contain any UTF-8 characters, including newlines. */ void QCPAbstractPlottable::setName(const QString &name) { mName = name; } /*! Sets whether fills of this plottable are drawn antialiased or not. Note that this setting may be overridden by \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. */ void QCPAbstractPlottable::setAntialiasedFill(bool enabled) { mAntialiasedFill = enabled; } /*! Sets whether the scatter symbols of this plottable are drawn antialiased or not. Note that this setting may be overridden by \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. */ void QCPAbstractPlottable::setAntialiasedScatters(bool enabled) { mAntialiasedScatters = enabled; } /*! The pen is used to draw basic lines that make up the plottable representation in the plot. For example, the \ref QCPGraph subclass draws its graph lines with this pen. \see setBrush */ void QCPAbstractPlottable::setPen(const QPen &pen) { mPen = pen; } /*! The brush is used to draw basic fills of the plottable representation in the plot. The Fill can be a color, gradient or texture, see the usage of QBrush. For example, the \ref QCPGraph subclass draws the fill under the graph with this brush, when it's not set to Qt::NoBrush. \see setPen */ void QCPAbstractPlottable::setBrush(const QBrush &brush) { mBrush = brush; } /*! The key axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to the plottable's value axis. This function performs no checks to make sure this is the case. The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and the y-axis (QCustomPlot::yAxis) as value axis. Normally, the key and value axes are set in the constructor of the plottable (or \ref QCustomPlot::addGraph when working with QCPGraphs through the dedicated graph interface). \see setValueAxis */ void QCPAbstractPlottable::setKeyAxis(QCPAxis *axis) { mKeyAxis = axis; } /*! The value axis of a plottable can be set to any axis of a QCustomPlot, as long as it is orthogonal to the plottable's key axis. This function performs no checks to make sure this is the case. The typical mathematical choice is to use the x-axis (QCustomPlot::xAxis) as key axis and the y-axis (QCustomPlot::yAxis) as value axis. Normally, the key and value axes are set in the constructor of the plottable (or \ref QCustomPlot::addGraph when working with QCPGraphs through the dedicated graph interface). \see setKeyAxis */ void QCPAbstractPlottable::setValueAxis(QCPAxis *axis) { mValueAxis = axis; } /*! Sets which data ranges of this plottable are selected. Selected data ranges are drawn differently (e.g. color) in the plot. This can be controlled via the selection decorator (see \ref selectionDecorator). The entire selection mechanism for plottables is handled automatically when \ref QCustomPlot::setInteractions contains iSelectPlottables. You only need to call this function when you wish to change the selection state programmatically. Using \ref setSelectable you can further specify for each plottable whether and to which granularity it is selectable. If \a selection is not compatible with the current \ref QCP::SelectionType set via \ref setSelectable, the resulting selection will be adjusted accordingly (see \ref QCPDataSelection::enforceType). emits the \ref selectionChanged signal when \a selected is different from the previous selection state. \see setSelectable, selectTest */ void QCPAbstractPlottable::setSelection(QCPDataSelection selection) { selection.enforceType(mSelectable); if (mSelection != selection) { mSelection = selection; emit selectionChanged(selected()); emit selectionChanged(mSelection); } } /*! Use this method to set an own QCPSelectionDecorator (subclass) instance. This allows you to customize the visual representation of selected data ranges further than by using the default QCPSelectionDecorator. The plottable takes ownership of the \a decorator. The currently set decorator can be accessed via \ref selectionDecorator. */ void QCPAbstractPlottable::setSelectionDecorator(QCPSelectionDecorator *decorator) { if (decorator) { if (decorator->registerWithPlottable(this)) { if (mSelectionDecorator) // delete old decorator if necessary delete mSelectionDecorator; mSelectionDecorator = decorator; } } else if (mSelectionDecorator) // just clear decorator { delete mSelectionDecorator; mSelectionDecorator = 0; } } /*! Sets whether and to which granularity this plottable can be selected. A selection can happen by clicking on the QCustomPlot surface (When \ref QCustomPlot::setInteractions contains \ref QCP::iSelectPlottables), by dragging a selection rect (When \ref QCustomPlot::setSelectionRectMode is \ref QCP::srmSelect), or programmatically by calling \ref setSelection. \see setSelection, QCP::SelectionType */ void QCPAbstractPlottable::setSelectable(QCP::SelectionType selectable) { if (mSelectable != selectable) { mSelectable = selectable; QCPDataSelection oldSelection = mSelection; mSelection.enforceType(mSelectable); emit selectableChanged(mSelectable); if (mSelection != oldSelection) { emit selectionChanged(selected()); emit selectionChanged(mSelection); } } } /*! Convenience function for transforming a key/value pair to pixels on the QCustomPlot surface, taking the orientations of the axes associated with this plottable into account (e.g. whether key represents x or y). \a key and \a value are transformed to the coodinates in pixels and are written to \a x and \a y. \see pixelsToCoords, QCPAxis::coordToPixel */ void QCPAbstractPlottable::coordsToPixels(double key, double value, double &x, double &y) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (keyAxis->orientation() == Qt::Horizontal) { x = keyAxis->coordToPixel(key); y = valueAxis->coordToPixel(value); } else { y = keyAxis->coordToPixel(key); x = valueAxis->coordToPixel(value); } } /*! \overload Transforms the given \a key and \a value to pixel coordinates and returns them in a QPointF. */ const QPointF QCPAbstractPlottable::coordsToPixels(double key, double value) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); } if (keyAxis->orientation() == Qt::Horizontal) return QPointF(keyAxis->coordToPixel(key), valueAxis->coordToPixel(value)); else return QPointF(valueAxis->coordToPixel(value), keyAxis->coordToPixel(key)); } /*! Convenience function for transforming a x/y pixel pair on the QCustomPlot surface to plot coordinates, taking the orientations of the axes associated with this plottable into account (e.g. whether key represents x or y). \a x and \a y are transformed to the plot coodinates and are written to \a key and \a value. \see coordsToPixels, QCPAxis::coordToPixel */ void QCPAbstractPlottable::pixelsToCoords(double x, double y, double &key, double &value) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (keyAxis->orientation() == Qt::Horizontal) { key = keyAxis->pixelToCoord(x); value = valueAxis->pixelToCoord(y); } else { key = keyAxis->pixelToCoord(y); value = valueAxis->pixelToCoord(x); } } /*! \overload Returns the pixel input \a pixelPos as plot coordinates \a key and \a value. */ void QCPAbstractPlottable::pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const { pixelsToCoords(pixelPos.x(), pixelPos.y(), key, value); } /*! Rescales the key and value axes associated with this plottable to contain all displayed data, so the whole plottable is visible. If the scaling of an axis is logarithmic, rescaleAxes will make sure not to rescale to an illegal range i.e. a range containing different signs and/or zero. Instead it will stay in the current sign domain and ignore all parts of the plottable that lie outside of that domain. \a onlyEnlarge makes sure the ranges are only expanded, never reduced. So it's possible to show multiple plottables in their entirety by multiple calls to rescaleAxes where the first call has \a onlyEnlarge set to false (the default), and all subsequent set to true. \see rescaleKeyAxis, rescaleValueAxis, QCustomPlot::rescaleAxes, QCPAxis::rescale */ void QCPAbstractPlottable::rescaleAxes(bool onlyEnlarge) const { rescaleKeyAxis(onlyEnlarge); rescaleValueAxis(onlyEnlarge); } /*! Rescales the key axis of the plottable so the whole plottable is visible. See \ref rescaleAxes for detailed behaviour. */ void QCPAbstractPlottable::rescaleKeyAxis(bool onlyEnlarge) const { QCPAxis *keyAxis = mKeyAxis.data(); if (!keyAxis) { qDebug() << Q_FUNC_INFO << "invalid key axis"; return; } QCP::SignDomain signDomain = QCP::sdBoth; if (keyAxis->scaleType() == QCPAxis::stLogarithmic) signDomain = (keyAxis->range().upper < 0 ? QCP::sdNegative : QCP::sdPositive); bool foundRange; QCPRange newRange = getKeyRange(foundRange, signDomain); if (foundRange) { if (onlyEnlarge) newRange.expand(keyAxis->range()); if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this axis dimension), shift current range to at least center the plottable { double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason if (keyAxis->scaleType() == QCPAxis::stLinear) { newRange.lower = center-keyAxis->range().size()/2.0; newRange.upper = center+keyAxis->range().size()/2.0; } else // scaleType() == stLogarithmic { newRange.lower = center/qSqrt(keyAxis->range().upper/keyAxis->range().lower); newRange.upper = center*qSqrt(keyAxis->range().upper/keyAxis->range().lower); } } keyAxis->setRange(newRange); } } /*! Rescales the value axis of the plottable so the whole plottable is visible. If \a inKeyRange is set to true, only the data points which are in the currently visible key axis range are considered. Returns true if the axis was actually scaled. This might not be the case if this plottable has an invalid range, e.g. because it has no data points. See \ref rescaleAxes for detailed behaviour. */ void QCPAbstractPlottable::rescaleValueAxis(bool onlyEnlarge, bool inKeyRange) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } QCP::SignDomain signDomain = QCP::sdBoth; if (valueAxis->scaleType() == QCPAxis::stLogarithmic) signDomain = (valueAxis->range().upper < 0 ? QCP::sdNegative : QCP::sdPositive); bool foundRange; QCPRange newRange = getValueRange(foundRange, signDomain, inKeyRange ? keyAxis->range() : QCPRange()); if (foundRange) { if (onlyEnlarge) newRange.expand(valueAxis->range()); if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this axis dimension), shift current range to at least center the plottable { double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason if (valueAxis->scaleType() == QCPAxis::stLinear) { newRange.lower = center-valueAxis->range().size()/2.0; newRange.upper = center+valueAxis->range().size()/2.0; } else // scaleType() == stLogarithmic { newRange.lower = center/qSqrt(valueAxis->range().upper/valueAxis->range().lower); newRange.upper = center*qSqrt(valueAxis->range().upper/valueAxis->range().lower); } } valueAxis->setRange(newRange); } } /*! \overload Adds this plottable to the specified \a legend. Creates a QCPPlottableLegendItem which is inserted into the legend. Returns true on success, i.e. when the legend exists and a legend item associated with this plottable isn't already in the legend. If the plottable needs a more specialized representation in the legend, you can create a corresponding subclass of \ref QCPPlottableLegendItem and add it to the legend manually instead of calling this method. \see removeFromLegend, QCPLegend::addItem */ bool QCPAbstractPlottable::addToLegend(QCPLegend *legend) { if (!legend) { qDebug() << Q_FUNC_INFO << "passed legend is null"; return false; } if (legend->parentPlot() != mParentPlot) { qDebug() << Q_FUNC_INFO << "passed legend isn't in the same QCustomPlot as this plottable"; return false; } if (!legend->hasItemWithPlottable(this)) { legend->addItem(new QCPPlottableLegendItem(legend, this)); return true; } else return false; } /*! \overload Adds this plottable to the legend of the parent QCustomPlot (\ref QCustomPlot::legend). \see removeFromLegend */ bool QCPAbstractPlottable::addToLegend() { if (!mParentPlot || !mParentPlot->legend) return false; else return addToLegend(mParentPlot->legend); } /*! \overload Removes the plottable from the specifed \a legend. This means the \ref QCPPlottableLegendItem that is associated with this plottable is removed. Returns true on success, i.e. if the legend exists and a legend item associated with this plottable was found and removed. \see addToLegend, QCPLegend::removeItem */ bool QCPAbstractPlottable::removeFromLegend(QCPLegend *legend) const { if (!legend) { qDebug() << Q_FUNC_INFO << "passed legend is null"; return false; } if (QCPPlottableLegendItem *lip = legend->itemWithPlottable(this)) return legend->removeItem(lip); else return false; } /*! \overload Removes the plottable from the legend of the parent QCustomPlot. \see addToLegend */ bool QCPAbstractPlottable::removeFromLegend() const { if (!mParentPlot || !mParentPlot->legend) return false; else return removeFromLegend(mParentPlot->legend); } /* inherits documentation from base class */ QRect QCPAbstractPlottable::clipRect() const { if (mKeyAxis && mValueAxis) return mKeyAxis.data()->axisRect()->rect() & mValueAxis.data()->axisRect()->rect(); else return QRect(); } /* inherits documentation from base class */ QCP::Interaction QCPAbstractPlottable::selectionCategory() const { return QCP::iSelectPlottables; } /*! \internal A convenience function to easily set the QPainter::Antialiased hint on the provided \a painter before drawing plottable lines. This is the antialiasing state the painter passed to the \ref draw method is in by default. This function takes into account the local setting of the antialiasing flag as well as the overrides set with \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. \seebaseclassmethod \see setAntialiased, applyFillAntialiasingHint, applyScattersAntialiasingHint */ void QCPAbstractPlottable::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aePlottables); } /*! \internal A convenience function to easily set the QPainter::Antialiased hint on the provided \a painter before drawing plottable fills. This function takes into account the local setting of the antialiasing flag as well as the overrides set with \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. \see setAntialiased, applyDefaultAntialiasingHint, applyScattersAntialiasingHint */ void QCPAbstractPlottable::applyFillAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiasedFill, QCP::aeFills); } /*! \internal A convenience function to easily set the QPainter::Antialiased hint on the provided \a painter before drawing plottable scatter points. This function takes into account the local setting of the antialiasing flag as well as the overrides set with \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. \see setAntialiased, applyFillAntialiasingHint, applyDefaultAntialiasingHint */ void QCPAbstractPlottable::applyScattersAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiasedScatters, QCP::aeScatters); } /* inherits documentation from base class */ void QCPAbstractPlottable::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) { Q_UNUSED(event) if (mSelectable != QCP::stNone) { QCPDataSelection newSelection = details.value(); QCPDataSelection selectionBefore = mSelection; if (additive) { if (mSelectable == QCP::stWhole) // in whole selection mode, we toggle to no selection even if currently unselected point was hit { if (selected()) setSelection(QCPDataSelection()); else setSelection(newSelection); } else // in all other selection modes we toggle selections of homogeneously selected/unselected segments { if (mSelection.contains(newSelection)) // if entire newSelection is already selected, toggle selection setSelection(mSelection-newSelection); else setSelection(mSelection+newSelection); } } else setSelection(newSelection); if (selectionStateChanged) *selectionStateChanged = mSelection != selectionBefore; } } /* inherits documentation from base class */ void QCPAbstractPlottable::deselectEvent(bool *selectionStateChanged) { if (mSelectable != QCP::stNone) { QCPDataSelection selectionBefore = mSelection; setSelection(QCPDataSelection()); if (selectionStateChanged) *selectionStateChanged = mSelection != selectionBefore; } } /* end of 'src/plottable.cpp' */ /* including file 'src/item.cpp', size 49269 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemAnchor //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemAnchor \brief An anchor of an item to which positions can be attached to. An item (QCPAbstractItem) may have one or more anchors. Unlike QCPItemPosition, an anchor doesn't control anything on its item, but provides a way to tie other items via their positions to the anchor. For example, a QCPItemRect is defined by its positions \a topLeft and \a bottomRight. Additionally it has various anchors like \a top, \a topRight or \a bottomLeft etc. So you can attach the \a start (which is a QCPItemPosition) of a QCPItemLine to one of the anchors by calling QCPItemPosition::setParentAnchor on \a start, passing the wanted anchor of the QCPItemRect. This way the start of the line will now always follow the respective anchor location on the rect item. Note that QCPItemPosition derives from QCPItemAnchor, so every position can also serve as an anchor to other positions. To learn how to provide anchors in your own item subclasses, see the subclassing section of the QCPAbstractItem documentation. */ /* start documentation of inline functions */ /*! \fn virtual QCPItemPosition *QCPItemAnchor::toQCPItemPosition() Returns 0 if this instance is merely a QCPItemAnchor, and a valid pointer of type QCPItemPosition* if it actually is a QCPItemPosition (which is a subclass of QCPItemAnchor). This safe downcast functionality could also be achieved with a dynamic_cast. However, QCustomPlot avoids dynamic_cast to work with projects that don't have RTTI support enabled (e.g. -fno-rtti flag with gcc compiler). */ /* end documentation of inline functions */ /*! Creates a new QCPItemAnchor. You shouldn't create QCPItemAnchor instances directly, even if you want to make a new item subclass. Use \ref QCPAbstractItem::createAnchor instead, as explained in the subclassing section of the QCPAbstractItem documentation. */ QCPItemAnchor::QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId) : mName(name), mParentPlot(parentPlot), mParentItem(parentItem), mAnchorId(anchorId) { } QCPItemAnchor::~QCPItemAnchor() { // unregister as parent at children: foreach (QCPItemPosition *child, mChildrenX.toList()) { if (child->parentAnchorX() == this) child->setParentAnchorX(0); // this acts back on this anchor and child removes itself from mChildrenX } foreach (QCPItemPosition *child, mChildrenY.toList()) { if (child->parentAnchorY() == this) child->setParentAnchorY(0); // this acts back on this anchor and child removes itself from mChildrenY } } /*! Returns the final absolute pixel position of the QCPItemAnchor on the QCustomPlot surface. The pixel information is internally retrieved via QCPAbstractItem::anchorPixelPosition of the parent item, QCPItemAnchor is just an intermediary. */ QPointF QCPItemAnchor::pixelPosition() const { if (mParentItem) { if (mAnchorId > -1) { return mParentItem->anchorPixelPosition(mAnchorId); } else { qDebug() << Q_FUNC_INFO << "no valid anchor id set:" << mAnchorId; return QPointF(); } } else { qDebug() << Q_FUNC_INFO << "no parent item set"; return QPointF(); } } /*! \internal Adds \a pos to the childX list of this anchor, which keeps track of which children use this anchor as parent anchor for the respective coordinate. This is necessary to notify the children prior to destruction of the anchor. Note that this function does not change the parent setting in \a pos. */ void QCPItemAnchor::addChildX(QCPItemPosition *pos) { if (!mChildrenX.contains(pos)) mChildrenX.insert(pos); else qDebug() << Q_FUNC_INFO << "provided pos is child already" << reinterpret_cast(pos); } /*! \internal Removes \a pos from the childX list of this anchor. Note that this function does not change the parent setting in \a pos. */ void QCPItemAnchor::removeChildX(QCPItemPosition *pos) { if (!mChildrenX.remove(pos)) qDebug() << Q_FUNC_INFO << "provided pos isn't child" << reinterpret_cast(pos); } /*! \internal Adds \a pos to the childY list of this anchor, which keeps track of which children use this anchor as parent anchor for the respective coordinate. This is necessary to notify the children prior to destruction of the anchor. Note that this function does not change the parent setting in \a pos. */ void QCPItemAnchor::addChildY(QCPItemPosition *pos) { if (!mChildrenY.contains(pos)) mChildrenY.insert(pos); else qDebug() << Q_FUNC_INFO << "provided pos is child already" << reinterpret_cast(pos); } /*! \internal Removes \a pos from the childY list of this anchor. Note that this function does not change the parent setting in \a pos. */ void QCPItemAnchor::removeChildY(QCPItemPosition *pos) { if (!mChildrenY.remove(pos)) qDebug() << Q_FUNC_INFO << "provided pos isn't child" << reinterpret_cast(pos); } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemPosition //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemPosition \brief Manages the position of an item. Every item has at least one public QCPItemPosition member pointer which provides ways to position the item on the QCustomPlot surface. Some items have multiple positions, for example QCPItemRect has two: \a topLeft and \a bottomRight. QCPItemPosition has a type (\ref PositionType) that can be set with \ref setType. This type defines how coordinates passed to \ref setCoords are to be interpreted, e.g. as absolute pixel coordinates, as plot coordinates of certain axes, etc. For more advanced plots it is also possible to assign different types per X/Y coordinate of the position (see \ref setTypeX, \ref setTypeY). This way an item could be positioned at a fixed pixel distance from the top in the Y direction, while following a plot coordinate in the X direction. A QCPItemPosition may have a parent QCPItemAnchor, see \ref setParentAnchor. This way you can tie multiple items together. If the QCPItemPosition has a parent, its coordinates (\ref setCoords) are considered to be absolute pixels in the reference frame of the parent anchor, where (0, 0) means directly ontop of the parent anchor. For example, You could attach the \a start position of a QCPItemLine to the \a bottom anchor of a QCPItemText to make the starting point of the line always be centered under the text label, no matter where the text is moved to. For more advanced plots, it is possible to assign different parent anchors per X/Y coordinate of the position, see \ref setParentAnchorX, \ref setParentAnchorY. This way an item could follow another item in the X direction but stay at a fixed position in the Y direction. Or even follow item A in X, and item B in Y. Note that every QCPItemPosition inherits from QCPItemAnchor and thus can itself be used as parent anchor for other positions. To set the apparent pixel position on the QCustomPlot surface directly, use \ref setPixelPosition. This works no matter what type this QCPItemPosition is or what parent-child situation it is in, as \ref setPixelPosition transforms the coordinates appropriately, to make the position appear at the specified pixel values. */ /* start documentation of inline functions */ /*! \fn QCPItemPosition::PositionType *QCPItemPosition::type() const Returns the current position type. If different types were set for X and Y (\ref setTypeX, \ref setTypeY), this method returns the type of the X coordinate. In that case rather use \a typeX() and \a typeY(). \see setType */ /*! \fn QCPItemAnchor *QCPItemPosition::parentAnchor() const Returns the current parent anchor. If different parent anchors were set for X and Y (\ref setParentAnchorX, \ref setParentAnchorY), this method returns the parent anchor of the Y coordinate. In that case rather use \a parentAnchorX() and \a parentAnchorY(). \see setParentAnchor */ /* end documentation of inline functions */ /*! Creates a new QCPItemPosition. You shouldn't create QCPItemPosition instances directly, even if you want to make a new item subclass. Use \ref QCPAbstractItem::createPosition instead, as explained in the subclassing section of the QCPAbstractItem documentation. */ QCPItemPosition::QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name) : QCPItemAnchor(parentPlot, parentItem, name), mPositionTypeX(ptAbsolute), mPositionTypeY(ptAbsolute), mKey(0), mValue(0), mParentAnchorX(0), mParentAnchorY(0) { } QCPItemPosition::~QCPItemPosition() { // unregister as parent at children: // Note: this is done in ~QCPItemAnchor again, but it's important QCPItemPosition does it itself, because only then // the setParentAnchor(0) call the correct QCPItemPosition::pixelPosition function instead of QCPItemAnchor::pixelPosition foreach (QCPItemPosition *child, mChildrenX.toList()) { if (child->parentAnchorX() == this) child->setParentAnchorX(0); // this acts back on this anchor and child removes itself from mChildrenX } foreach (QCPItemPosition *child, mChildrenY.toList()) { if (child->parentAnchorY() == this) child->setParentAnchorY(0); // this acts back on this anchor and child removes itself from mChildrenY } // unregister as child in parent: if (mParentAnchorX) mParentAnchorX->removeChildX(this); if (mParentAnchorY) mParentAnchorY->removeChildY(this); } /* can't make this a header inline function, because QPointer breaks with forward declared types, see QTBUG-29588 */ QCPAxisRect *QCPItemPosition::axisRect() const { return mAxisRect.data(); } /*! Sets the type of the position. The type defines how the coordinates passed to \ref setCoords should be handled and how the QCPItemPosition should behave in the plot. The possible values for \a type can be separated in two main categories: \li The position is regarded as a point in plot coordinates. This corresponds to \ref ptPlotCoords and requires two axes that define the plot coordinate system. They can be specified with \ref setAxes. By default, the QCustomPlot's x- and yAxis are used. \li The position is fixed on the QCustomPlot surface, i.e. independent of axis ranges. This corresponds to all other types, i.e. \ref ptAbsolute, \ref ptViewportRatio and \ref ptAxisRectRatio. They differ only in the way the absolute position is described, see the documentation of \ref PositionType for details. For \ref ptAxisRectRatio, note that you can specify the axis rect with \ref setAxisRect. By default this is set to the main axis rect. Note that the position type \ref ptPlotCoords is only available (and sensible) when the position has no parent anchor (\ref setParentAnchor). If the type is changed, the apparent pixel position on the plot is preserved. This means the coordinates as retrieved with coords() and set with \ref setCoords may change in the process. This method sets the type for both X and Y directions. It is also possible to set different types for X and Y, see \ref setTypeX, \ref setTypeY. */ void QCPItemPosition::setType(QCPItemPosition::PositionType type) { setTypeX(type); setTypeY(type); } /*! This method sets the position type of the X coordinate to \a type. For a detailed description of what a position type is, see the documentation of \ref setType. \see setType, setTypeY */ void QCPItemPosition::setTypeX(QCPItemPosition::PositionType type) { if (mPositionTypeX != type) { // if switching from or to coordinate type that isn't valid (e.g. because axes or axis rect // were deleted), don't try to recover the pixelPosition() because it would output a qDebug warning. bool retainPixelPosition = true; if ((mPositionTypeX == ptPlotCoords || type == ptPlotCoords) && (!mKeyAxis || !mValueAxis)) retainPixelPosition = false; if ((mPositionTypeX == ptAxisRectRatio || type == ptAxisRectRatio) && (!mAxisRect)) retainPixelPosition = false; QPointF pixel; if (retainPixelPosition) pixel = pixelPosition(); mPositionTypeX = type; if (retainPixelPosition) setPixelPosition(pixel); } } /*! This method sets the position type of the Y coordinate to \a type. For a detailed description of what a position type is, see the documentation of \ref setType. \see setType, setTypeX */ void QCPItemPosition::setTypeY(QCPItemPosition::PositionType type) { if (mPositionTypeY != type) { // if switching from or to coordinate type that isn't valid (e.g. because axes or axis rect // were deleted), don't try to recover the pixelPosition() because it would output a qDebug warning. bool retainPixelPosition = true; if ((mPositionTypeY == ptPlotCoords || type == ptPlotCoords) && (!mKeyAxis || !mValueAxis)) retainPixelPosition = false; if ((mPositionTypeY == ptAxisRectRatio || type == ptAxisRectRatio) && (!mAxisRect)) retainPixelPosition = false; QPointF pixel; if (retainPixelPosition) pixel = pixelPosition(); mPositionTypeY = type; if (retainPixelPosition) setPixelPosition(pixel); } } /*! Sets the parent of this QCPItemPosition to \a parentAnchor. This means the position will now follow any position changes of the anchor. The local coordinate system of positions with a parent anchor always is absolute pixels, with (0, 0) being exactly on top of the parent anchor. (Hence the type shouldn't be set to \ref ptPlotCoords for positions with parent anchors.) if \a keepPixelPosition is true, the current pixel position of the QCPItemPosition is preserved during reparenting. If it's set to false, the coordinates are set to (0, 0), i.e. the position will be exactly on top of the parent anchor. To remove this QCPItemPosition from any parent anchor, set \a parentAnchor to 0. If the QCPItemPosition previously had no parent and the type is \ref ptPlotCoords, the type is set to \ref ptAbsolute, to keep the position in a valid state. This method sets the parent anchor for both X and Y directions. It is also possible to set different parents for X and Y, see \ref setParentAnchorX, \ref setParentAnchorY. */ bool QCPItemPosition::setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition) { bool successX = setParentAnchorX(parentAnchor, keepPixelPosition); bool successY = setParentAnchorY(parentAnchor, keepPixelPosition); return successX && successY; } /*! This method sets the parent anchor of the X coordinate to \a parentAnchor. For a detailed description of what a parent anchor is, see the documentation of \ref setParentAnchor. \see setParentAnchor, setParentAnchorY */ bool QCPItemPosition::setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition) { // make sure self is not assigned as parent: if (parentAnchor == this) { qDebug() << Q_FUNC_INFO << "can't set self as parent anchor" << reinterpret_cast(parentAnchor); return false; } // make sure no recursive parent-child-relationships are created: QCPItemAnchor *currentParent = parentAnchor; while (currentParent) { if (QCPItemPosition *currentParentPos = currentParent->toQCPItemPosition()) { // is a QCPItemPosition, might have further parent, so keep iterating if (currentParentPos == this) { qDebug() << Q_FUNC_INFO << "can't create recursive parent-child-relationship" << reinterpret_cast(parentAnchor); return false; } currentParent = currentParentPos->parentAnchorX(); } else { // is a QCPItemAnchor, can't have further parent. Now make sure the parent items aren't the // same, to prevent a position being child of an anchor which itself depends on the position, // because they're both on the same item: if (currentParent->mParentItem == mParentItem) { qDebug() << Q_FUNC_INFO << "can't set parent to be an anchor which itself depends on this position" << reinterpret_cast(parentAnchor); return false; } break; } } // if previously no parent set and PosType is still ptPlotCoords, set to ptAbsolute: if (!mParentAnchorX && mPositionTypeX == ptPlotCoords) setTypeX(ptAbsolute); // save pixel position: QPointF pixelP; if (keepPixelPosition) pixelP = pixelPosition(); // unregister at current parent anchor: if (mParentAnchorX) mParentAnchorX->removeChildX(this); // register at new parent anchor: if (parentAnchor) parentAnchor->addChildX(this); mParentAnchorX = parentAnchor; // restore pixel position under new parent: if (keepPixelPosition) setPixelPosition(pixelP); else setCoords(0, coords().y()); return true; } /*! This method sets the parent anchor of the Y coordinate to \a parentAnchor. For a detailed description of what a parent anchor is, see the documentation of \ref setParentAnchor. \see setParentAnchor, setParentAnchorX */ bool QCPItemPosition::setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition) { // make sure self is not assigned as parent: if (parentAnchor == this) { qDebug() << Q_FUNC_INFO << "can't set self as parent anchor" << reinterpret_cast(parentAnchor); return false; } // make sure no recursive parent-child-relationships are created: QCPItemAnchor *currentParent = parentAnchor; while (currentParent) { if (QCPItemPosition *currentParentPos = currentParent->toQCPItemPosition()) { // is a QCPItemPosition, might have further parent, so keep iterating if (currentParentPos == this) { qDebug() << Q_FUNC_INFO << "can't create recursive parent-child-relationship" << reinterpret_cast(parentAnchor); return false; } currentParent = currentParentPos->parentAnchorY(); } else { // is a QCPItemAnchor, can't have further parent. Now make sure the parent items aren't the // same, to prevent a position being child of an anchor which itself depends on the position, // because they're both on the same item: if (currentParent->mParentItem == mParentItem) { qDebug() << Q_FUNC_INFO << "can't set parent to be an anchor which itself depends on this position" << reinterpret_cast(parentAnchor); return false; } break; } } // if previously no parent set and PosType is still ptPlotCoords, set to ptAbsolute: if (!mParentAnchorY && mPositionTypeY == ptPlotCoords) setTypeY(ptAbsolute); // save pixel position: QPointF pixelP; if (keepPixelPosition) pixelP = pixelPosition(); // unregister at current parent anchor: if (mParentAnchorY) mParentAnchorY->removeChildY(this); // register at new parent anchor: if (parentAnchor) parentAnchor->addChildY(this); mParentAnchorY = parentAnchor; // restore pixel position under new parent: if (keepPixelPosition) setPixelPosition(pixelP); else setCoords(coords().x(), 0); return true; } /*! Sets the coordinates of this QCPItemPosition. What the coordinates mean, is defined by the type (\ref setType, \ref setTypeX, \ref setTypeY). For example, if the type is \ref ptAbsolute, \a key and \a value mean the x and y pixel position on the QCustomPlot surface. In that case the origin (0, 0) is in the top left corner of the QCustomPlot viewport. If the type is \ref ptPlotCoords, \a key and \a value mean a point in the plot coordinate system defined by the axes set by \ref setAxes. By default those are the QCustomPlot's xAxis and yAxis. See the documentation of \ref setType for other available coordinate types and their meaning. If different types were configured for X and Y (\ref setTypeX, \ref setTypeY), \a key and \a value must also be provided in the different coordinate systems. Here, the X type refers to \a key, and the Y type refers to \a value. \see setPixelPosition */ void QCPItemPosition::setCoords(double key, double value) { mKey = key; mValue = value; } /*! \overload Sets the coordinates as a QPointF \a pos where pos.x has the meaning of \a key and pos.y the meaning of \a value of the \ref setCoords(double key, double value) method. */ void QCPItemPosition::setCoords(const QPointF &pos) { setCoords(pos.x(), pos.y()); } /*! Returns the final absolute pixel position of the QCPItemPosition on the QCustomPlot surface. It includes all effects of type (\ref setType) and possible parent anchors (\ref setParentAnchor). \see setPixelPosition */ QPointF QCPItemPosition::pixelPosition() const { QPointF result; // determine X: switch (mPositionTypeX) { case ptAbsolute: { result.rx() = mKey; if (mParentAnchorX) result.rx() += mParentAnchorX->pixelPosition().x(); break; } case ptViewportRatio: { result.rx() = mKey*mParentPlot->viewport().width(); if (mParentAnchorX) result.rx() += mParentAnchorX->pixelPosition().x(); else result.rx() += mParentPlot->viewport().left(); break; } case ptAxisRectRatio: { if (mAxisRect) { result.rx() = mKey*mAxisRect.data()->width(); if (mParentAnchorX) result.rx() += mParentAnchorX->pixelPosition().x(); else result.rx() += mAxisRect.data()->left(); } else qDebug() << Q_FUNC_INFO << "Item position type x is ptAxisRectRatio, but no axis rect was defined"; break; } case ptPlotCoords: { if (mKeyAxis && mKeyAxis.data()->orientation() == Qt::Horizontal) result.rx() = mKeyAxis.data()->coordToPixel(mKey); else if (mValueAxis && mValueAxis.data()->orientation() == Qt::Horizontal) result.rx() = mValueAxis.data()->coordToPixel(mValue); else qDebug() << Q_FUNC_INFO << "Item position type x is ptPlotCoords, but no axes were defined"; break; } } // determine Y: switch (mPositionTypeY) { case ptAbsolute: { result.ry() = mValue; if (mParentAnchorY) result.ry() += mParentAnchorY->pixelPosition().y(); break; } case ptViewportRatio: { result.ry() = mValue*mParentPlot->viewport().height(); if (mParentAnchorY) result.ry() += mParentAnchorY->pixelPosition().y(); else result.ry() += mParentPlot->viewport().top(); break; } case ptAxisRectRatio: { if (mAxisRect) { result.ry() = mValue*mAxisRect.data()->height(); if (mParentAnchorY) result.ry() += mParentAnchorY->pixelPosition().y(); else result.ry() += mAxisRect.data()->top(); } else qDebug() << Q_FUNC_INFO << "Item position type y is ptAxisRectRatio, but no axis rect was defined"; break; } case ptPlotCoords: { if (mKeyAxis && mKeyAxis.data()->orientation() == Qt::Vertical) result.ry() = mKeyAxis.data()->coordToPixel(mKey); else if (mValueAxis && mValueAxis.data()->orientation() == Qt::Vertical) result.ry() = mValueAxis.data()->coordToPixel(mValue); else qDebug() << Q_FUNC_INFO << "Item position type y is ptPlotCoords, but no axes were defined"; break; } } return result; } /*! When \ref setType is \ref ptPlotCoords, this function may be used to specify the axes the coordinates set with \ref setCoords relate to. By default they are set to the initial xAxis and yAxis of the QCustomPlot. */ void QCPItemPosition::setAxes(QCPAxis *keyAxis, QCPAxis *valueAxis) { mKeyAxis = keyAxis; mValueAxis = valueAxis; } /*! When \ref setType is \ref ptAxisRectRatio, this function may be used to specify the axis rect the coordinates set with \ref setCoords relate to. By default this is set to the main axis rect of the QCustomPlot. */ void QCPItemPosition::setAxisRect(QCPAxisRect *axisRect) { mAxisRect = axisRect; } /*! Sets the apparent pixel position. This works no matter what type (\ref setType) this QCPItemPosition is or what parent-child situation it is in, as coordinates are transformed appropriately, to make the position finally appear at the specified pixel values. Only if the type is \ref ptAbsolute and no parent anchor is set, this function's effect is identical to that of \ref setCoords. \see pixelPosition, setCoords */ void QCPItemPosition::setPixelPosition(const QPointF &pixelPosition) { double x = pixelPosition.x(); double y = pixelPosition.y(); switch (mPositionTypeX) { case ptAbsolute: { if (mParentAnchorX) x -= mParentAnchorX->pixelPosition().x(); break; } case ptViewportRatio: { if (mParentAnchorX) x -= mParentAnchorX->pixelPosition().x(); else x -= mParentPlot->viewport().left(); x /= (double)mParentPlot->viewport().width(); break; } case ptAxisRectRatio: { if (mAxisRect) { if (mParentAnchorX) x -= mParentAnchorX->pixelPosition().x(); else x -= mAxisRect.data()->left(); x /= (double)mAxisRect.data()->width(); } else qDebug() << Q_FUNC_INFO << "Item position type x is ptAxisRectRatio, but no axis rect was defined"; break; } case ptPlotCoords: { if (mKeyAxis && mKeyAxis.data()->orientation() == Qt::Horizontal) x = mKeyAxis.data()->pixelToCoord(x); else if (mValueAxis && mValueAxis.data()->orientation() == Qt::Horizontal) y = mValueAxis.data()->pixelToCoord(x); else qDebug() << Q_FUNC_INFO << "Item position type x is ptPlotCoords, but no axes were defined"; break; } } switch (mPositionTypeY) { case ptAbsolute: { if (mParentAnchorY) y -= mParentAnchorY->pixelPosition().y(); break; } case ptViewportRatio: { if (mParentAnchorY) y -= mParentAnchorY->pixelPosition().y(); else y -= mParentPlot->viewport().top(); y /= (double)mParentPlot->viewport().height(); break; } case ptAxisRectRatio: { if (mAxisRect) { if (mParentAnchorY) y -= mParentAnchorY->pixelPosition().y(); else y -= mAxisRect.data()->top(); y /= (double)mAxisRect.data()->height(); } else qDebug() << Q_FUNC_INFO << "Item position type y is ptAxisRectRatio, but no axis rect was defined"; break; } case ptPlotCoords: { if (mKeyAxis && mKeyAxis.data()->orientation() == Qt::Vertical) x = mKeyAxis.data()->pixelToCoord(y); else if (mValueAxis && mValueAxis.data()->orientation() == Qt::Vertical) y = mValueAxis.data()->pixelToCoord(y); else qDebug() << Q_FUNC_INFO << "Item position type y is ptPlotCoords, but no axes were defined"; break; } } setCoords(x, y); } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAbstractItem //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAbstractItem \brief The abstract base class for all items in a plot. In QCustomPlot, items are supplemental graphical elements that are neither plottables (QCPAbstractPlottable) nor axes (QCPAxis). While plottables are always tied to two axes and thus plot coordinates, items can also be placed in absolute coordinates independent of any axes. Each specific item has at least one QCPItemPosition member which controls the positioning. Some items are defined by more than one coordinate and thus have two or more QCPItemPosition members (For example, QCPItemRect has \a topLeft and \a bottomRight). This abstract base class defines a very basic interface like visibility and clipping. Since this class is abstract, it can't be instantiated. Use one of the subclasses or create a subclass yourself to create new items. The built-in items are:
QCPItemLineA line defined by a start and an end point. May have different ending styles on each side (e.g. arrows).
QCPItemStraightLineA straight line defined by a start and a direction point. Unlike QCPItemLine, the straight line is infinitely long and has no endings.
QCPItemCurveA curve defined by start, end and two intermediate control points. May have different ending styles on each side (e.g. arrows).
QCPItemRectA rectangle
QCPItemEllipseAn ellipse
QCPItemPixmapAn arbitrary pixmap
QCPItemTextA text label
QCPItemBracketA bracket which may be used to reference/highlight certain parts in the plot.
QCPItemTracerAn item that can be attached to a QCPGraph and sticks to its data points, given a key coordinate.
\section items-clipping Clipping Items are by default clipped to the main axis rect (they are only visible inside the axis rect). To make an item visible outside that axis rect, disable clipping via \ref setClipToAxisRect "setClipToAxisRect(false)". On the other hand if you want the item to be clipped to a different axis rect, specify it via \ref setClipAxisRect. This clipAxisRect property of an item is only used for clipping behaviour, and in principle is independent of the coordinate axes the item might be tied to via its position members (\ref QCPItemPosition::setAxes). However, it is common that the axis rect for clipping also contains the axes used for the item positions. \section items-using Using items First you instantiate the item you want to use and add it to the plot: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpitemline-creation-1 by default, the positions of the item are bound to the x- and y-Axis of the plot. So we can just set the plot coordinates where the line should start/end: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpitemline-creation-2 If we don't want the line to be positioned in plot coordinates but a different coordinate system, e.g. absolute pixel positions on the QCustomPlot surface, we need to change the position type like this: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpitemline-creation-3 Then we can set the coordinates, this time in pixels: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpitemline-creation-4 and make the line visible on the entire QCustomPlot, by disabling clipping to the axis rect: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpitemline-creation-5 For more advanced plots, it is even possible to set different types and parent anchors per X/Y coordinate of an item position, using for example \ref QCPItemPosition::setTypeX or \ref QCPItemPosition::setParentAnchorX. For details, see the documentation of \ref QCPItemPosition. \section items-subclassing Creating own items To create an own item, you implement a subclass of QCPAbstractItem. These are the pure virtual functions, you must implement: \li \ref selectTest \li \ref draw See the documentation of those functions for what they need to do. \subsection items-positioning Allowing the item to be positioned As mentioned, item positions are represented by QCPItemPosition members. Let's assume the new item shall have only one point as its position (as opposed to two like a rect or multiple like a polygon). You then add a public member of type QCPItemPosition like so: \code QCPItemPosition * const myPosition;\endcode the const makes sure the pointer itself can't be modified from the user of your new item (the QCPItemPosition instance it points to, can be modified, of course). The initialization of this pointer is made easy with the \ref createPosition function. Just assign the return value of this function to each QCPItemPosition in the constructor of your item. \ref createPosition takes a string which is the name of the position, typically this is identical to the variable name. For example, the constructor of QCPItemExample could look like this: \code QCPItemExample::QCPItemExample(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), myPosition(createPosition("myPosition")) { // other constructor code } \endcode \subsection items-drawing The draw function To give your item a visual representation, reimplement the \ref draw function and use the passed QCPPainter to draw the item. You can retrieve the item position in pixel coordinates from the position member(s) via \ref QCPItemPosition::pixelPosition. To optimize performance you should calculate a bounding rect first (don't forget to take the pen width into account), check whether it intersects the \ref clipRect, and only draw the item at all if this is the case. \subsection items-selection The selectTest function Your implementation of the \ref selectTest function may use the helpers \ref QCPVector2D::distanceSquaredToLine and \ref rectDistance. With these, the implementation of the selection test becomes significantly simpler for most items. See the documentation of \ref selectTest for what the function parameters mean and what the function should return. \subsection anchors Providing anchors Providing anchors (QCPItemAnchor) starts off like adding a position. First you create a public member, e.g. \code QCPItemAnchor * const bottom;\endcode and create it in the constructor with the \ref createAnchor function, assigning it a name and an anchor id (an integer enumerating all anchors on the item, you may create an own enum for this). Since anchors can be placed anywhere, relative to the item's position(s), your item needs to provide the position of every anchor with the reimplementation of the \ref anchorPixelPosition(int anchorId) function. In essence the QCPItemAnchor is merely an intermediary that itself asks your item for the pixel position when anything attached to the anchor needs to know the coordinates. */ /* start of documentation of inline functions */ /*! \fn QList QCPAbstractItem::positions() const Returns all positions of the item in a list. \see anchors, position */ /*! \fn QList QCPAbstractItem::anchors() const Returns all anchors of the item in a list. Note that since a position (QCPItemPosition) is always also an anchor, the list will also contain the positions of this item. \see positions, anchor */ /* end of documentation of inline functions */ /* start documentation of pure virtual functions */ /*! \fn void QCPAbstractItem::draw(QCPPainter *painter) = 0 \internal Draws this item with the provided \a painter. The cliprect of the provided painter is set to the rect returned by \ref clipRect before this function is called. The clipRect depends on the clipping settings defined by \ref setClipToAxisRect and \ref setClipAxisRect. */ /* end documentation of pure virtual functions */ /* start documentation of signals */ /*! \fn void QCPAbstractItem::selectionChanged(bool selected) This signal is emitted when the selection state of this item has changed, either by user interaction or by a direct call to \ref setSelected. */ /* end documentation of signals */ /*! Base class constructor which initializes base class members. */ QCPAbstractItem::QCPAbstractItem(QCustomPlot *parentPlot) : QCPLayerable(parentPlot), mClipToAxisRect(false), mSelectable(true), mSelected(false) { parentPlot->registerItem(this); QList rects = parentPlot->axisRects(); if (rects.size() > 0) { setClipToAxisRect(true); setClipAxisRect(rects.first()); } } QCPAbstractItem::~QCPAbstractItem() { // don't delete mPositions because every position is also an anchor and thus in mAnchors qDeleteAll(mAnchors); } /* can't make this a header inline function, because QPointer breaks with forward declared types, see QTBUG-29588 */ QCPAxisRect *QCPAbstractItem::clipAxisRect() const { return mClipAxisRect.data(); } /*! Sets whether the item shall be clipped to an axis rect or whether it shall be visible on the entire QCustomPlot. The axis rect can be set with \ref setClipAxisRect. \see setClipAxisRect */ void QCPAbstractItem::setClipToAxisRect(bool clip) { mClipToAxisRect = clip; if (mClipToAxisRect) setParentLayerable(mClipAxisRect.data()); } /*! Sets the clip axis rect. It defines the rect that will be used to clip the item when \ref setClipToAxisRect is set to true. \see setClipToAxisRect */ void QCPAbstractItem::setClipAxisRect(QCPAxisRect *rect) { mClipAxisRect = rect; if (mClipToAxisRect) setParentLayerable(mClipAxisRect.data()); } /*! Sets whether the user can (de-)select this item by clicking on the QCustomPlot surface. (When \ref QCustomPlot::setInteractions contains QCustomPlot::iSelectItems.) However, even when \a selectable was set to false, it is possible to set the selection manually, by calling \ref setSelected. \see QCustomPlot::setInteractions, setSelected */ void QCPAbstractItem::setSelectable(bool selectable) { if (mSelectable != selectable) { mSelectable = selectable; emit selectableChanged(mSelectable); } } /*! Sets whether this item is selected or not. When selected, it might use a different visual appearance (e.g. pen and brush), this depends on the specific item though. The entire selection mechanism for items is handled automatically when \ref QCustomPlot::setInteractions contains QCustomPlot::iSelectItems. You only need to call this function when you wish to change the selection state manually. This function can change the selection state even when \ref setSelectable was set to false. emits the \ref selectionChanged signal when \a selected is different from the previous selection state. \see setSelectable, selectTest */ void QCPAbstractItem::setSelected(bool selected) { if (mSelected != selected) { mSelected = selected; emit selectionChanged(mSelected); } } /*! Returns the QCPItemPosition with the specified \a name. If this item doesn't have a position by that name, returns 0. This function provides an alternative way to access item positions. Normally, you access positions direcly by their member pointers (which typically have the same variable name as \a name). \see positions, anchor */ QCPItemPosition *QCPAbstractItem::position(const QString &name) const { for (int i=0; iname() == name) return mPositions.at(i); } qDebug() << Q_FUNC_INFO << "position with name not found:" << name; return 0; } /*! Returns the QCPItemAnchor with the specified \a name. If this item doesn't have an anchor by that name, returns 0. This function provides an alternative way to access item anchors. Normally, you access anchors direcly by their member pointers (which typically have the same variable name as \a name). \see anchors, position */ QCPItemAnchor *QCPAbstractItem::anchor(const QString &name) const { for (int i=0; iname() == name) return mAnchors.at(i); } qDebug() << Q_FUNC_INFO << "anchor with name not found:" << name; return 0; } /*! Returns whether this item has an anchor with the specified \a name. Note that you can check for positions with this function, too. This is because every position is also an anchor (QCPItemPosition inherits from QCPItemAnchor). \see anchor, position */ bool QCPAbstractItem::hasAnchor(const QString &name) const { for (int i=0; iname() == name) return true; } return false; } /*! \internal Returns the rect the visual representation of this item is clipped to. This depends on the current setting of \ref setClipToAxisRect as well as the axis rect set with \ref setClipAxisRect. If the item is not clipped to an axis rect, QCustomPlot's viewport rect is returned. \see draw */ QRect QCPAbstractItem::clipRect() const { if (mClipToAxisRect && mClipAxisRect) return mClipAxisRect.data()->rect(); else return mParentPlot->viewport(); } /*! \internal A convenience function to easily set the QPainter::Antialiased hint on the provided \a painter before drawing item lines. This is the antialiasing state the painter passed to the \ref draw method is in by default. This function takes into account the local setting of the antialiasing flag as well as the overrides set with \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. \see setAntialiased */ void QCPAbstractItem::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aeItems); } /*! \internal A convenience function which returns the selectTest value for a specified \a rect and a specified click position \a pos. \a filledRect defines whether a click inside the rect should also be considered a hit or whether only the rect border is sensitive to hits. This function may be used to help with the implementation of the \ref selectTest function for specific items. For example, if your item consists of four rects, call this function four times, once for each rect, in your \ref selectTest reimplementation. Finally, return the minimum (non -1) of all four returned values. */ double QCPAbstractItem::rectDistance(const QRectF &rect, const QPointF &pos, bool filledRect) const { double result = -1; // distance to border: QList lines; lines << QLineF(rect.topLeft(), rect.topRight()) << QLineF(rect.bottomLeft(), rect.bottomRight()) << QLineF(rect.topLeft(), rect.bottomLeft()) << QLineF(rect.topRight(), rect.bottomRight()); double minDistSqr = std::numeric_limits::max(); for (int i=0; i mParentPlot->selectionTolerance()*0.99) { if (rect.contains(pos)) result = mParentPlot->selectionTolerance()*0.99; } return result; } /*! \internal Returns the pixel position of the anchor with Id \a anchorId. This function must be reimplemented in item subclasses if they want to provide anchors (QCPItemAnchor). For example, if the item has two anchors with id 0 and 1, this function takes one of these anchor ids and returns the respective pixel points of the specified anchor. \see createAnchor */ QPointF QCPAbstractItem::anchorPixelPosition(int anchorId) const { qDebug() << Q_FUNC_INFO << "called on item which shouldn't have any anchors (this method not reimplemented). anchorId" << anchorId; return QPointF(); } /*! \internal Creates a QCPItemPosition, registers it with this item and returns a pointer to it. The specified \a name must be a unique string that is usually identical to the variable name of the position member (This is needed to provide the name-based \ref position access to positions). Don't delete positions created by this function manually, as the item will take care of it. Use this function in the constructor (initialization list) of the specific item subclass to create each position member. Don't create QCPItemPositions with \b new yourself, because they won't be registered with the item properly. \see createAnchor */ QCPItemPosition *QCPAbstractItem::createPosition(const QString &name) { if (hasAnchor(name)) qDebug() << Q_FUNC_INFO << "anchor/position with name exists already:" << name; QCPItemPosition *newPosition = new QCPItemPosition(mParentPlot, this, name); mPositions.append(newPosition); mAnchors.append(newPosition); // every position is also an anchor newPosition->setAxes(mParentPlot->xAxis, mParentPlot->yAxis); newPosition->setType(QCPItemPosition::ptPlotCoords); if (mParentPlot->axisRect()) newPosition->setAxisRect(mParentPlot->axisRect()); newPosition->setCoords(0, 0); return newPosition; } /*! \internal Creates a QCPItemAnchor, registers it with this item and returns a pointer to it. The specified \a name must be a unique string that is usually identical to the variable name of the anchor member (This is needed to provide the name based \ref anchor access to anchors). The \a anchorId must be a number identifying the created anchor. It is recommended to create an enum (e.g. "AnchorIndex") for this on each item that uses anchors. This id is used by the anchor to identify itself when it calls QCPAbstractItem::anchorPixelPosition. That function then returns the correct pixel coordinates for the passed anchor id. Don't delete anchors created by this function manually, as the item will take care of it. Use this function in the constructor (initialization list) of the specific item subclass to create each anchor member. Don't create QCPItemAnchors with \b new yourself, because then they won't be registered with the item properly. \see createPosition */ QCPItemAnchor *QCPAbstractItem::createAnchor(const QString &name, int anchorId) { if (hasAnchor(name)) qDebug() << Q_FUNC_INFO << "anchor/position with name exists already:" << name; QCPItemAnchor *newAnchor = new QCPItemAnchor(mParentPlot, this, name, anchorId); mAnchors.append(newAnchor); return newAnchor; } /* inherits documentation from base class */ void QCPAbstractItem::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) { Q_UNUSED(event) Q_UNUSED(details) if (mSelectable) { bool selBefore = mSelected; setSelected(additive ? !mSelected : true); if (selectionStateChanged) *selectionStateChanged = mSelected != selBefore; } } /* inherits documentation from base class */ void QCPAbstractItem::deselectEvent(bool *selectionStateChanged) { if (mSelectable) { bool selBefore = mSelected; setSelected(false); if (selectionStateChanged) *selectionStateChanged = mSelected != selBefore; } } /* inherits documentation from base class */ QCP::Interaction QCPAbstractItem::selectionCategory() const { return QCP::iSelectItems; } /* end of 'src/item.cpp' */ /* including file 'src/core.cpp', size 124243 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCustomPlot //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCustomPlot \brief The central class of the library. This is the QWidget which displays the plot and interacts with the user. For tutorials on how to use QCustomPlot, see the website\n http://www.qcustomplot.com/ */ /* start of documentation of inline functions */ /*! \fn QCPSelectionRect *QCustomPlot::selectionRect() const Allows access to the currently used QCPSelectionRect instance (or subclass thereof), that is used to handle and draw selection rect interactions (see \ref setSelectionRectMode). \see setSelectionRect */ /*! \fn QCPLayoutGrid *QCustomPlot::plotLayout() const Returns the top level layout of this QCustomPlot instance. It is a \ref QCPLayoutGrid, initially containing just one cell with the main QCPAxisRect inside. */ /* end of documentation of inline functions */ /* start of documentation of signals */ /*! \fn void QCustomPlot::mouseDoubleClick(QMouseEvent *event) This signal is emitted when the QCustomPlot receives a mouse double click event. */ /*! \fn void QCustomPlot::mousePress(QMouseEvent *event) This signal is emitted when the QCustomPlot receives a mouse press event. It is emitted before QCustomPlot handles any other mechanism like range dragging. So a slot connected to this signal can still influence the behaviour e.g. with \ref QCPAxisRect::setRangeDrag or \ref QCPAxisRect::setRangeDragAxes. */ /*! \fn void QCustomPlot::mouseMove(QMouseEvent *event) This signal is emitted when the QCustomPlot receives a mouse move event. It is emitted before QCustomPlot handles any other mechanism like range dragging. So a slot connected to this signal can still influence the behaviour e.g. with \ref QCPAxisRect::setRangeDrag or \ref QCPAxisRect::setRangeDragAxes. \warning It is discouraged to change the drag-axes with \ref QCPAxisRect::setRangeDragAxes here, because the dragging starting point was saved the moment the mouse was pressed. Thus it only has a meaning for the range drag axes that were set at that moment. If you want to change the drag axes, consider doing this in the \ref mousePress signal instead. */ /*! \fn void QCustomPlot::mouseRelease(QMouseEvent *event) This signal is emitted when the QCustomPlot receives a mouse release event. It is emitted before QCustomPlot handles any other mechanisms like object selection. So a slot connected to this signal can still influence the behaviour e.g. with \ref setInteractions or \ref QCPAbstractPlottable::setSelectable. */ /*! \fn void QCustomPlot::mouseWheel(QMouseEvent *event) This signal is emitted when the QCustomPlot receives a mouse wheel event. It is emitted before QCustomPlot handles any other mechanisms like range zooming. So a slot connected to this signal can still influence the behaviour e.g. with \ref QCPAxisRect::setRangeZoom, \ref QCPAxisRect::setRangeZoomAxes or \ref QCPAxisRect::setRangeZoomFactor. */ /*! \fn void QCustomPlot::plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event) This signal is emitted when a plottable is clicked. \a event is the mouse event that caused the click and \a plottable is the plottable that received the click. The parameter \a dataIndex indicates the data point that was closest to the click position. \see plottableDoubleClick */ /*! \fn void QCustomPlot::plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event) This signal is emitted when a plottable is double clicked. \a event is the mouse event that caused the click and \a plottable is the plottable that received the click. The parameter \a dataIndex indicates the data point that was closest to the click position. \see plottableClick */ /*! \fn void QCustomPlot::itemClick(QCPAbstractItem *item, QMouseEvent *event) This signal is emitted when an item is clicked. \a event is the mouse event that caused the click and \a item is the item that received the click. \see itemDoubleClick */ /*! \fn void QCustomPlot::itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event) This signal is emitted when an item is double clicked. \a event is the mouse event that caused the click and \a item is the item that received the click. \see itemClick */ /*! \fn void QCustomPlot::axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event) This signal is emitted when an axis is clicked. \a event is the mouse event that caused the click, \a axis is the axis that received the click and \a part indicates the part of the axis that was clicked. \see axisDoubleClick */ /*! \fn void QCustomPlot::axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event) This signal is emitted when an axis is double clicked. \a event is the mouse event that caused the click, \a axis is the axis that received the click and \a part indicates the part of the axis that was clicked. \see axisClick */ /*! \fn void QCustomPlot::legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event) This signal is emitted when a legend (item) is clicked. \a event is the mouse event that caused the click, \a legend is the legend that received the click and \a item is the legend item that received the click. If only the legend and no item is clicked, \a item is 0. This happens for a click inside the legend padding or the space between two items. \see legendDoubleClick */ /*! \fn void QCustomPlot::legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event) This signal is emitted when a legend (item) is double clicked. \a event is the mouse event that caused the click, \a legend is the legend that received the click and \a item is the legend item that received the click. If only the legend and no item is clicked, \a item is 0. This happens for a click inside the legend padding or the space between two items. \see legendClick */ /*! \fn void QCustomPlot::selectionChangedByUser() This signal is emitted after the user has changed the selection in the QCustomPlot, e.g. by clicking. It is not emitted when the selection state of an object has changed programmatically by a direct call to setSelected()/setSelection() on an object or by calling \ref deselectAll. In addition to this signal, selectable objects also provide individual signals, for example \ref QCPAxis::selectionChanged or \ref QCPAbstractPlottable::selectionChanged. Note that those signals are emitted even if the selection state is changed programmatically. See the documentation of \ref setInteractions for details about the selection mechanism. \see selectedPlottables, selectedGraphs, selectedItems, selectedAxes, selectedLegends */ /*! \fn void QCustomPlot::beforeReplot() This signal is emitted immediately before a replot takes place (caused by a call to the slot \ref replot). It is safe to mutually connect the replot slot with this signal on two QCustomPlots to make them replot synchronously, it won't cause an infinite recursion. \see replot, afterReplot */ /*! \fn void QCustomPlot::afterReplot() This signal is emitted immediately after a replot has taken place (caused by a call to the slot \ref replot). It is safe to mutually connect the replot slot with this signal on two QCustomPlots to make them replot synchronously, it won't cause an infinite recursion. \see replot, beforeReplot */ /* end of documentation of signals */ /* start of documentation of public members */ /*! \var QCPAxis *QCustomPlot::xAxis A pointer to the primary x Axis (bottom) of the main axis rect of the plot. QCustomPlot offers convenient pointers to the axes (\ref xAxis, \ref yAxis, \ref xAxis2, \ref yAxis2) and the \ref legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use \link thelayoutsystem the layout system\endlink to add multiple axis rects or multiple axes to one side, use the \ref QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0. If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the \ref legend convenience pointer will be reset if a legend is added after the main legend was removed before. */ /*! \var QCPAxis *QCustomPlot::yAxis A pointer to the primary y Axis (left) of the main axis rect of the plot. QCustomPlot offers convenient pointers to the axes (\ref xAxis, \ref yAxis, \ref xAxis2, \ref yAxis2) and the \ref legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use \link thelayoutsystem the layout system\endlink to add multiple axis rects or multiple axes to one side, use the \ref QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0. If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the \ref legend convenience pointer will be reset if a legend is added after the main legend was removed before. */ /*! \var QCPAxis *QCustomPlot::xAxis2 A pointer to the secondary x Axis (top) of the main axis rect of the plot. Secondary axes are invisible by default. Use QCPAxis::setVisible to change this (or use \ref QCPAxisRect::setupFullAxesBox). QCustomPlot offers convenient pointers to the axes (\ref xAxis, \ref yAxis, \ref xAxis2, \ref yAxis2) and the \ref legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use \link thelayoutsystem the layout system\endlink to add multiple axis rects or multiple axes to one side, use the \ref QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0. If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the \ref legend convenience pointer will be reset if a legend is added after the main legend was removed before. */ /*! \var QCPAxis *QCustomPlot::yAxis2 A pointer to the secondary y Axis (right) of the main axis rect of the plot. Secondary axes are invisible by default. Use QCPAxis::setVisible to change this (or use \ref QCPAxisRect::setupFullAxesBox). QCustomPlot offers convenient pointers to the axes (\ref xAxis, \ref yAxis, \ref xAxis2, \ref yAxis2) and the \ref legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use \link thelayoutsystem the layout system\endlink to add multiple axis rects or multiple axes to one side, use the \ref QCPAxisRect::axis interface to access the new axes. If one of the four default axes or the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointers become 0. If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the \ref legend convenience pointer will be reset if a legend is added after the main legend was removed before. */ /*! \var QCPLegend *QCustomPlot::legend A pointer to the default legend of the main axis rect. The legend is invisible by default. Use QCPLegend::setVisible to change this. QCustomPlot offers convenient pointers to the axes (\ref xAxis, \ref yAxis, \ref xAxis2, \ref yAxis2) and the \ref legend. They make it very easy working with plots that only have a single axis rect and at most one axis at each axis rect side. If you use \link thelayoutsystem the layout system\endlink to add multiple legends to the plot, use the layout system interface to access the new legend. For example, legends can be placed inside an axis rect's \ref QCPAxisRect::insetLayout "inset layout", and must then also be accessed via the inset layout. If the default legend is removed due to manipulation of the layout system (e.g. by removing the main axis rect), the corresponding pointer becomes 0. If an axis convenience pointer is currently zero and a new axis rect or a corresponding axis is added in the place of the main axis rect, QCustomPlot resets the convenience pointers to the according new axes. Similarly the \ref legend convenience pointer will be reset if a legend is added after the main legend was removed before. */ /* end of documentation of public members */ /*! Constructs a QCustomPlot and sets reasonable default values. */ QCustomPlot::QCustomPlot(QWidget *parent) : QWidget(parent), xAxis(0), yAxis(0), xAxis2(0), yAxis2(0), legend(0), mBufferDevicePixelRatio(1.0), // will be adapted to primary screen below mPlotLayout(0), mAutoAddPlottableToLegend(true), mAntialiasedElements(QCP::aeNone), mNotAntialiasedElements(QCP::aeNone), mInteractions(0), mSelectionTolerance(8), mNoAntialiasingOnDrag(false), mBackgroundBrush(Qt::white, Qt::SolidPattern), mBackgroundScaled(true), mBackgroundScaledMode(Qt::KeepAspectRatioByExpanding), mCurrentLayer(0), mPlottingHints(QCP::phCacheLabels|QCP::phImmediateRefresh), mMultiSelectModifier(Qt::ControlModifier), mSelectionRectMode(QCP::srmNone), mSelectionRect(0), mOpenGl(false), mMouseHasMoved(false), mMouseEventLayerable(0), mReplotting(false), mReplotQueued(false), mOpenGlMultisamples(16), mOpenGlAntialiasedElementsBackup(QCP::aeNone), mOpenGlCacheLabelsBackup(true) { setAttribute(Qt::WA_NoMousePropagation); setAttribute(Qt::WA_OpaquePaintEvent); setFocusPolicy(Qt::ClickFocus); setMouseTracking(true); QLocale currentLocale = locale(); currentLocale.setNumberOptions(QLocale::OmitGroupSeparator); setLocale(currentLocale); #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED setBufferDevicePixelRatio(QWidget::devicePixelRatio()); #endif mOpenGlAntialiasedElementsBackup = mAntialiasedElements; mOpenGlCacheLabelsBackup = mPlottingHints.testFlag(QCP::phCacheLabels); // create initial layers: mLayers.append(new QCPLayer(this, QLatin1String("background"))); mLayers.append(new QCPLayer(this, QLatin1String("grid"))); mLayers.append(new QCPLayer(this, QLatin1String("main"))); mLayers.append(new QCPLayer(this, QLatin1String("axes"))); mLayers.append(new QCPLayer(this, QLatin1String("legend"))); mLayers.append(new QCPLayer(this, QLatin1String("overlay"))); updateLayerIndices(); setCurrentLayer(QLatin1String("main")); layer(QLatin1String("overlay"))->setMode(QCPLayer::lmBuffered); // create initial layout, axis rect and legend: mPlotLayout = new QCPLayoutGrid; mPlotLayout->initializeParentPlot(this); mPlotLayout->setParent(this); // important because if parent is QWidget, QCPLayout::sizeConstraintsChanged will call QWidget::updateGeometry mPlotLayout->setLayer(QLatin1String("main")); QCPAxisRect *defaultAxisRect = new QCPAxisRect(this, true); mPlotLayout->addElement(0, 0, defaultAxisRect); xAxis = defaultAxisRect->axis(QCPAxis::atBottom); yAxis = defaultAxisRect->axis(QCPAxis::atLeft); xAxis2 = defaultAxisRect->axis(QCPAxis::atTop); yAxis2 = defaultAxisRect->axis(QCPAxis::atRight); legend = new QCPLegend; legend->setVisible(false); defaultAxisRect->insetLayout()->addElement(legend, Qt::AlignRight|Qt::AlignTop); defaultAxisRect->insetLayout()->setMargins(QMargins(12, 12, 12, 12)); defaultAxisRect->setLayer(QLatin1String("background")); xAxis->setLayer(QLatin1String("axes")); yAxis->setLayer(QLatin1String("axes")); xAxis2->setLayer(QLatin1String("axes")); yAxis2->setLayer(QLatin1String("axes")); xAxis->grid()->setLayer(QLatin1String("grid")); yAxis->grid()->setLayer(QLatin1String("grid")); xAxis2->grid()->setLayer(QLatin1String("grid")); yAxis2->grid()->setLayer(QLatin1String("grid")); legend->setLayer(QLatin1String("legend")); // create selection rect instance: mSelectionRect = new QCPSelectionRect(this); mSelectionRect->setLayer(QLatin1String("overlay")); setViewport(rect()); // needs to be called after mPlotLayout has been created replot(rpQueuedReplot); } QCustomPlot::~QCustomPlot() { clearPlottables(); clearItems(); if (mPlotLayout) { delete mPlotLayout; mPlotLayout = 0; } mCurrentLayer = 0; qDeleteAll(mLayers); // don't use removeLayer, because it would prevent the last layer to be removed mLayers.clear(); } /*! Sets which elements are forcibly drawn antialiased as an \a or combination of QCP::AntialiasedElement. This overrides the antialiasing settings for whole element groups, normally controlled with the \a setAntialiasing function on the individual elements. If an element is neither specified in \ref setAntialiasedElements nor in \ref setNotAntialiasedElements, the antialiasing setting on each individual element instance is used. For example, if \a antialiasedElements contains \ref QCP::aePlottables, all plottables will be drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set to. if an element in \a antialiasedElements is already set in \ref setNotAntialiasedElements, it is removed from there. \see setNotAntialiasedElements */ void QCustomPlot::setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements) { mAntialiasedElements = antialiasedElements; // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously: if ((mNotAntialiasedElements & mAntialiasedElements) != 0) mNotAntialiasedElements |= ~mAntialiasedElements; } /*! Sets whether the specified \a antialiasedElement is forcibly drawn antialiased. See \ref setAntialiasedElements for details. \see setNotAntialiasedElement */ void QCustomPlot::setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled) { if (!enabled && mAntialiasedElements.testFlag(antialiasedElement)) mAntialiasedElements &= ~antialiasedElement; else if (enabled && !mAntialiasedElements.testFlag(antialiasedElement)) mAntialiasedElements |= antialiasedElement; // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously: if ((mNotAntialiasedElements & mAntialiasedElements) != 0) mNotAntialiasedElements |= ~mAntialiasedElements; } /*! Sets which elements are forcibly drawn not antialiased as an \a or combination of QCP::AntialiasedElement. This overrides the antialiasing settings for whole element groups, normally controlled with the \a setAntialiasing function on the individual elements. If an element is neither specified in \ref setAntialiasedElements nor in \ref setNotAntialiasedElements, the antialiasing setting on each individual element instance is used. For example, if \a notAntialiasedElements contains \ref QCP::aePlottables, no plottables will be drawn antialiased, no matter what the specific QCPAbstractPlottable::setAntialiased value was set to. if an element in \a notAntialiasedElements is already set in \ref setAntialiasedElements, it is removed from there. \see setAntialiasedElements */ void QCustomPlot::setNotAntialiasedElements(const QCP::AntialiasedElements ¬AntialiasedElements) { mNotAntialiasedElements = notAntialiasedElements; // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously: if ((mNotAntialiasedElements & mAntialiasedElements) != 0) mAntialiasedElements |= ~mNotAntialiasedElements; } /*! Sets whether the specified \a notAntialiasedElement is forcibly drawn not antialiased. See \ref setNotAntialiasedElements for details. \see setAntialiasedElement */ void QCustomPlot::setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled) { if (!enabled && mNotAntialiasedElements.testFlag(notAntialiasedElement)) mNotAntialiasedElements &= ~notAntialiasedElement; else if (enabled && !mNotAntialiasedElements.testFlag(notAntialiasedElement)) mNotAntialiasedElements |= notAntialiasedElement; // make sure elements aren't in mNotAntialiasedElements and mAntialiasedElements simultaneously: if ((mNotAntialiasedElements & mAntialiasedElements) != 0) mAntialiasedElements |= ~mNotAntialiasedElements; } /*! If set to true, adding a plottable (e.g. a graph) to the QCustomPlot automatically also adds the plottable to the legend (QCustomPlot::legend). \see addGraph, QCPLegend::addItem */ void QCustomPlot::setAutoAddPlottableToLegend(bool on) { mAutoAddPlottableToLegend = on; } /*! Sets the possible interactions of this QCustomPlot as an or-combination of \ref QCP::Interaction enums. There are the following types of interactions: Axis range manipulation is controlled via \ref QCP::iRangeDrag and \ref QCP::iRangeZoom. When the respective interaction is enabled, the user may drag axes ranges and zoom with the mouse wheel. For details how to control which axes the user may drag/zoom and in what orientations, see \ref QCPAxisRect::setRangeDrag, \ref QCPAxisRect::setRangeZoom, \ref QCPAxisRect::setRangeDragAxes, \ref QCPAxisRect::setRangeZoomAxes. Plottable data selection is controlled by \ref QCP::iSelectPlottables. If \ref QCP::iSelectPlottables is set, the user may select plottables (graphs, curves, bars,...) and their data by clicking on them or in their vicinity (\ref setSelectionTolerance). Whether the user can actually select a plottable and its data can further be restricted with the \ref QCPAbstractPlottable::setSelectable method on the specific plottable. For details, see the special page about the \ref dataselection "data selection mechanism". To retrieve a list of all currently selected plottables, call \ref selectedPlottables. If you're only interested in QCPGraphs, you may use the convenience function \ref selectedGraphs. Item selection is controlled by \ref QCP::iSelectItems. If \ref QCP::iSelectItems is set, the user may select items (QCPItemLine, QCPItemText,...) by clicking on them or in their vicinity. To find out whether a specific item is selected, call QCPAbstractItem::selected(). To retrieve a list of all currently selected items, call \ref selectedItems. Axis selection is controlled with \ref QCP::iSelectAxes. If \ref QCP::iSelectAxes is set, the user may select parts of the axes by clicking on them. What parts exactly (e.g. Axis base line, tick labels, axis label) are selectable can be controlled via \ref QCPAxis::setSelectableParts for each axis. To retrieve a list of all axes that currently contain selected parts, call \ref selectedAxes. Which parts of an axis are selected, can be retrieved with QCPAxis::selectedParts(). Legend selection is controlled with \ref QCP::iSelectLegend. If this is set, the user may select the legend itself or individual items by clicking on them. What parts exactly are selectable can be controlled via \ref QCPLegend::setSelectableParts. To find out whether the legend or any of its child items are selected, check the value of QCPLegend::selectedParts. To find out which child items are selected, call \ref QCPLegend::selectedItems. All other selectable elements The selection of all other selectable objects (e.g. QCPTextElement, or your own layerable subclasses) is controlled with \ref QCP::iSelectOther. If set, the user may select those objects by clicking on them. To find out which are currently selected, you need to check their selected state explicitly. If the selection state has changed by user interaction, the \ref selectionChangedByUser signal is emitted. Each selectable object additionally emits an individual selectionChanged signal whenever their selection state has changed, i.e. not only by user interaction. To allow multiple objects to be selected by holding the selection modifier (\ref setMultiSelectModifier), set the flag \ref QCP::iMultiSelect. \note In addition to the selection mechanism presented here, QCustomPlot always emits corresponding signals, when an object is clicked or double clicked. see \ref plottableClick and \ref plottableDoubleClick for example. \see setInteraction, setSelectionTolerance */ void QCustomPlot::setInteractions(const QCP::Interactions &interactions) { mInteractions = interactions; } /*! Sets the single \a interaction of this QCustomPlot to \a enabled. For details about the interaction system, see \ref setInteractions. \see setInteractions */ void QCustomPlot::setInteraction(const QCP::Interaction &interaction, bool enabled) { if (!enabled && mInteractions.testFlag(interaction)) mInteractions &= ~interaction; else if (enabled && !mInteractions.testFlag(interaction)) mInteractions |= interaction; } /*! Sets the tolerance that is used to decide whether a click selects an object (e.g. a plottable) or not. If the user clicks in the vicinity of the line of e.g. a QCPGraph, it's only regarded as a potential selection when the minimum distance between the click position and the graph line is smaller than \a pixels. Objects that are defined by an area (e.g. QCPBars) only react to clicks directly inside the area and ignore this selection tolerance. In other words, it only has meaning for parts of objects that are too thin to exactly hit with a click and thus need such a tolerance. \see setInteractions, QCPLayerable::selectTest */ void QCustomPlot::setSelectionTolerance(int pixels) { mSelectionTolerance = pixels; } /*! Sets whether antialiasing is disabled for this QCustomPlot while the user is dragging axes ranges. If many objects, especially plottables, are drawn antialiased, this greatly improves performance during dragging. Thus it creates a more responsive user experience. As soon as the user stops dragging, the last replot is done with normal antialiasing, to restore high image quality. \see setAntialiasedElements, setNotAntialiasedElements */ void QCustomPlot::setNoAntialiasingOnDrag(bool enabled) { mNoAntialiasingOnDrag = enabled; } /*! Sets the plotting hints for this QCustomPlot instance as an \a or combination of QCP::PlottingHint. \see setPlottingHint */ void QCustomPlot::setPlottingHints(const QCP::PlottingHints &hints) { mPlottingHints = hints; } /*! Sets the specified plotting \a hint to \a enabled. \see setPlottingHints */ void QCustomPlot::setPlottingHint(QCP::PlottingHint hint, bool enabled) { QCP::PlottingHints newHints = mPlottingHints; if (!enabled) newHints &= ~hint; else newHints |= hint; if (newHints != mPlottingHints) setPlottingHints(newHints); } /*! Sets the keyboard modifier that will be recognized as multi-select-modifier. If \ref QCP::iMultiSelect is specified in \ref setInteractions, the user may select multiple objects (or data points) by clicking on them one after the other while holding down \a modifier. By default the multi-select-modifier is set to Qt::ControlModifier. \see setInteractions */ void QCustomPlot::setMultiSelectModifier(Qt::KeyboardModifier modifier) { mMultiSelectModifier = modifier; } /*! Sets how QCustomPlot processes mouse click-and-drag interactions by the user. If \a mode is \ref QCP::srmNone, the mouse drag is forwarded to the underlying objects. For example, QCPAxisRect may process a mouse drag by dragging axis ranges, see \ref QCPAxisRect::setRangeDrag. If \a mode is not \ref QCP::srmNone, the current selection rect (\ref selectionRect) becomes activated and allows e.g. rect zooming and data point selection. If you wish to provide your user both with axis range dragging and data selection/range zooming, use this method to switch between the modes just before the interaction is processed, e.g. in reaction to the \ref mousePress or \ref mouseMove signals. For example you could check whether the user is holding a certain keyboard modifier, and then decide which \a mode shall be set. If a selection rect interaction is currently active, and \a mode is set to \ref QCP::srmNone, the interaction is canceled (\ref QCPSelectionRect::cancel). Switching between any of the other modes will keep the selection rect active. Upon completion of the interaction, the behaviour is as defined by the currently set \a mode, not the mode that was set when the interaction started. \see setInteractions, setSelectionRect, QCPSelectionRect */ void QCustomPlot::setSelectionRectMode(QCP::SelectionRectMode mode) { if (mSelectionRect) { if (mode == QCP::srmNone) mSelectionRect->cancel(); // when switching to none, we immediately want to abort a potentially active selection rect // disconnect old connections: if (mSelectionRectMode == QCP::srmSelect) disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); else if (mSelectionRectMode == QCP::srmZoom) disconnect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); // establish new ones: if (mode == QCP::srmSelect) connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); else if (mode == QCP::srmZoom) connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); } mSelectionRectMode = mode; } /*! Sets the \ref QCPSelectionRect instance that QCustomPlot will use if \a mode is not \ref QCP::srmNone and the user performs a click-and-drag interaction. QCustomPlot takes ownership of the passed \a selectionRect. It can be accessed later via \ref selectionRect. This method is useful if you wish to replace the default QCPSelectionRect instance with an instance of a QCPSelectionRect subclass, to introduce custom behaviour of the selection rect. \see setSelectionRectMode */ void QCustomPlot::setSelectionRect(QCPSelectionRect *selectionRect) { if (mSelectionRect) delete mSelectionRect; mSelectionRect = selectionRect; if (mSelectionRect) { // establish connections with new selection rect: if (mSelectionRectMode == QCP::srmSelect) connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectSelection(QRect,QMouseEvent*))); else if (mSelectionRectMode == QCP::srmZoom) connect(mSelectionRect, SIGNAL(accepted(QRect,QMouseEvent*)), this, SLOT(processRectZoom(QRect,QMouseEvent*))); } } /*! This method allows to enable OpenGL plot rendering, for increased plotting performance of graphically demanding plots (thick lines, translucent fills, etc.). If \a enabled is set to true, QCustomPlot will try to initialize OpenGL and, if successful, continue plotting with hardware acceleration. The parameter \a multisampling controls how many samples will be used per pixel, it essentially controls the antialiasing quality. If \a multisampling is set too high for the current graphics hardware, the maximum allowed value will be used. You can test whether switching to OpenGL rendering was successful by checking whether the according getter \a QCustomPlot::openGl() returns true. If the OpenGL initialization fails, rendering continues with the regular software rasterizer, and an according qDebug output is generated. If switching to OpenGL was successful, this method disables label caching (\ref setPlottingHint "setPlottingHint(QCP::phCacheLabels, false)") and turns on QCustomPlot's antialiasing override for all elements (\ref setAntialiasedElements "setAntialiasedElements(QCP::aeAll)"), leading to a higher quality output. The antialiasing override allows for pixel-grid aligned drawing in the OpenGL paint device. As stated before, in OpenGL rendering the actual antialiasing of the plot is controlled with \a multisampling. If \a enabled is set to false, the antialiasing/label caching settings are restored to what they were before OpenGL was enabled, if they weren't altered in the meantime. \note OpenGL support is only enabled if QCustomPlot is compiled with the macro \c QCUSTOMPLOT_USE_OPENGL defined. This define must be set before including the QCustomPlot header both during compilation of the QCustomPlot library as well as when compiling your application. It is best to just include the line DEFINES += QCUSTOMPLOT_USE_OPENGL in the respective qmake project files. \note If you are using a Qt version before 5.0, you must also add the module "opengl" to your \c QT variable in the qmake project files. For Qt versions 5.0 and higher, QCustomPlot switches to a newer OpenGL interface which is already in the "gui" module. */ void QCustomPlot::setOpenGl(bool enabled, int multisampling) { mOpenGlMultisamples = qMax(0, multisampling); #ifdef QCUSTOMPLOT_USE_OPENGL mOpenGl = enabled; if (mOpenGl) { if (setupOpenGl()) { // backup antialiasing override and labelcaching setting so we can restore upon disabling OpenGL mOpenGlAntialiasedElementsBackup = mAntialiasedElements; mOpenGlCacheLabelsBackup = mPlottingHints.testFlag(QCP::phCacheLabels); // set antialiasing override to antialias all (aligns gl pixel grid properly), and disable label caching (would use software rasterizer for pixmap caches): setAntialiasedElements(QCP::aeAll); setPlottingHint(QCP::phCacheLabels, false); } else { qDebug() << Q_FUNC_INFO << "Failed to enable OpenGL, continuing plotting without hardware acceleration."; mOpenGl = false; } } else { // restore antialiasing override and labelcaching to what it was before enabling OpenGL, if nobody changed it in the meantime: if (mAntialiasedElements == QCP::aeAll) setAntialiasedElements(mOpenGlAntialiasedElementsBackup); if (!mPlottingHints.testFlag(QCP::phCacheLabels)) setPlottingHint(QCP::phCacheLabels, mOpenGlCacheLabelsBackup); freeOpenGl(); } // recreate all paint buffers: mPaintBuffers.clear(); setupPaintBuffers(); #else Q_UNUSED(enabled) qDebug() << Q_FUNC_INFO << "QCustomPlot can't use OpenGL because QCUSTOMPLOT_USE_OPENGL was not defined during compilation (add 'DEFINES += QCUSTOMPLOT_USE_OPENGL' to your qmake .pro file)"; #endif } /*! Sets the viewport of this QCustomPlot. Usually users of QCustomPlot don't need to change the viewport manually. The viewport is the area in which the plot is drawn. All mechanisms, e.g. margin caluclation take the viewport to be the outer border of the plot. The viewport normally is the rect() of the QCustomPlot widget, i.e. a rect with top left (0, 0) and size of the QCustomPlot widget. Don't confuse the viewport with the axis rect (QCustomPlot::axisRect). An axis rect is typically an area enclosed by four axes, where the graphs/plottables are drawn in. The viewport is larger and contains also the axes themselves, their tick numbers, their labels, or even additional axis rects, color scales and other layout elements. This function is used to allow arbitrary size exports with \ref toPixmap, \ref savePng, \ref savePdf, etc. by temporarily changing the viewport size. */ void QCustomPlot::setViewport(const QRect &rect) { mViewport = rect; if (mPlotLayout) mPlotLayout->setOuterRect(mViewport); } /*! Sets the device pixel ratio used by the paint buffers of this QCustomPlot instance. Normally, this doesn't need to be set manually, because it is initialized with the regular \a QWidget::devicePixelRatio which is configured by Qt to fit the display device (e.g. 1 for normal displays, 2 for High-DPI displays). Device pixel ratios are supported by Qt only for Qt versions since 5.4. If this method is called when QCustomPlot is being used with older Qt versions, outputs an according qDebug message and leaves the internal buffer device pixel ratio at 1.0. */ void QCustomPlot::setBufferDevicePixelRatio(double ratio) { if (!qFuzzyCompare(ratio, mBufferDevicePixelRatio)) { #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED mBufferDevicePixelRatio = ratio; for (int i=0; isetDevicePixelRatio(mBufferDevicePixelRatio); // Note: axis label cache has devicePixelRatio as part of cache hash, so no need to manually clear cache here #else qDebug() << Q_FUNC_INFO << "Device pixel ratios not supported for Qt versions before 5.4"; mBufferDevicePixelRatio = 1.0; #endif } } /*! Sets \a pm as the viewport background pixmap (see \ref setViewport). The pixmap is always drawn below all other objects in the plot. For cases where the provided pixmap doesn't have the same size as the viewport, scaling can be enabled with \ref setBackgroundScaled and the scaling mode (whether and how the aspect ratio is preserved) can be set with \ref setBackgroundScaledMode. To set all these options in one call, consider using the overloaded version of this function. If a background brush was set with \ref setBackground(const QBrush &brush), the viewport will first be filled with that brush, before drawing the background pixmap. This can be useful for background pixmaps with translucent areas. \see setBackgroundScaled, setBackgroundScaledMode */ void QCustomPlot::setBackground(const QPixmap &pm) { mBackgroundPixmap = pm; mScaledBackgroundPixmap = QPixmap(); } /*! Sets the background brush of the viewport (see \ref setViewport). Before drawing everything else, the background is filled with \a brush. If a background pixmap was set with \ref setBackground(const QPixmap &pm), this brush will be used to fill the viewport before the background pixmap is drawn. This can be useful for background pixmaps with translucent areas. Set \a brush to Qt::NoBrush or Qt::Transparent to leave background transparent. This can be useful for exporting to image formats which support transparency, e.g. \ref savePng. \see setBackgroundScaled, setBackgroundScaledMode */ void QCustomPlot::setBackground(const QBrush &brush) { mBackgroundBrush = brush; } /*! \overload Allows setting the background pixmap of the viewport, whether it shall be scaled and how it shall be scaled in one call. \see setBackground(const QPixmap &pm), setBackgroundScaled, setBackgroundScaledMode */ void QCustomPlot::setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode) { mBackgroundPixmap = pm; mScaledBackgroundPixmap = QPixmap(); mBackgroundScaled = scaled; mBackgroundScaledMode = mode; } /*! Sets whether the viewport background pixmap shall be scaled to fit the viewport. If \a scaled is set to true, control whether and how the aspect ratio of the original pixmap is preserved with \ref setBackgroundScaledMode. Note that the scaled version of the original pixmap is buffered, so there is no performance penalty on replots. (Except when the viewport dimensions are changed continuously.) \see setBackground, setBackgroundScaledMode */ void QCustomPlot::setBackgroundScaled(bool scaled) { mBackgroundScaled = scaled; } /*! If scaling of the viewport background pixmap is enabled (\ref setBackgroundScaled), use this function to define whether and how the aspect ratio of the original pixmap is preserved. \see setBackground, setBackgroundScaled */ void QCustomPlot::setBackgroundScaledMode(Qt::AspectRatioMode mode) { mBackgroundScaledMode = mode; } /*! Returns the plottable with \a index. If the index is invalid, returns 0. There is an overloaded version of this function with no parameter which returns the last added plottable, see QCustomPlot::plottable() \see plottableCount */ QCPAbstractPlottable *QCustomPlot::plottable(int index) { if (index >= 0 && index < mPlottables.size()) { return mPlottables.at(index); } else { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return 0; } } /*! \overload Returns the last plottable that was added to the plot. If there are no plottables in the plot, returns 0. \see plottableCount */ QCPAbstractPlottable *QCustomPlot::plottable() { if (!mPlottables.isEmpty()) { return mPlottables.last(); } else return 0; } /*! Removes the specified plottable from the plot and deletes it. If necessary, the corresponding legend item is also removed from the default legend (QCustomPlot::legend). Returns true on success. \see clearPlottables */ bool QCustomPlot::removePlottable(QCPAbstractPlottable *plottable) { if (!mPlottables.contains(plottable)) { qDebug() << Q_FUNC_INFO << "plottable not in list:" << reinterpret_cast(plottable); return false; } // remove plottable from legend: plottable->removeFromLegend(); // special handling for QCPGraphs to maintain the simple graph interface: if (QCPGraph *graph = qobject_cast(plottable)) mGraphs.removeOne(graph); // remove plottable: delete plottable; mPlottables.removeOne(plottable); return true; } /*! \overload Removes and deletes the plottable by its \a index. */ bool QCustomPlot::removePlottable(int index) { if (index >= 0 && index < mPlottables.size()) return removePlottable(mPlottables[index]); else { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return false; } } /*! Removes all plottables from the plot and deletes them. Corresponding legend items are also removed from the default legend (QCustomPlot::legend). Returns the number of plottables removed. \see removePlottable */ int QCustomPlot::clearPlottables() { int c = mPlottables.size(); for (int i=c-1; i >= 0; --i) removePlottable(mPlottables[i]); return c; } /*! Returns the number of currently existing plottables in the plot \see plottable */ int QCustomPlot::plottableCount() const { return mPlottables.size(); } /*! Returns a list of the selected plottables. If no plottables are currently selected, the list is empty. There is a convenience function if you're only interested in selected graphs, see \ref selectedGraphs. \see setInteractions, QCPAbstractPlottable::setSelectable, QCPAbstractPlottable::setSelection */ QList QCustomPlot::selectedPlottables() const { QList result; foreach (QCPAbstractPlottable *plottable, mPlottables) { if (plottable->selected()) result.append(plottable); } return result; } /*! Returns the plottable at the pixel position \a pos. Plottables that only consist of single lines (like graphs) have a tolerance band around them, see \ref setSelectionTolerance. If multiple plottables come into consideration, the one closest to \a pos is returned. If \a onlySelectable is true, only plottables that are selectable (QCPAbstractPlottable::setSelectable) are considered. If there is no plottable at \a pos, the return value is 0. \see itemAt, layoutElementAt */ QCPAbstractPlottable *QCustomPlot::plottableAt(const QPointF &pos, bool onlySelectable) const { QCPAbstractPlottable *resultPlottable = 0; double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value foreach (QCPAbstractPlottable *plottable, mPlottables) { if (onlySelectable && !plottable->selectable()) // we could have also passed onlySelectable to the selectTest function, but checking here is faster, because we have access to QCPabstractPlottable::selectable continue; if ((plottable->keyAxis()->axisRect()->rect() & plottable->valueAxis()->axisRect()->rect()).contains(pos.toPoint())) // only consider clicks inside the rect that is spanned by the plottable's key/value axes { double currentDistance = plottable->selectTest(pos, false); if (currentDistance >= 0 && currentDistance < resultDistance) { resultPlottable = plottable; resultDistance = currentDistance; } } } return resultPlottable; } /*! Returns whether this QCustomPlot instance contains the \a plottable. */ bool QCustomPlot::hasPlottable(QCPAbstractPlottable *plottable) const { return mPlottables.contains(plottable); } /*! Returns the graph with \a index. If the index is invalid, returns 0. There is an overloaded version of this function with no parameter which returns the last created graph, see QCustomPlot::graph() \see graphCount, addGraph */ QCPGraph *QCustomPlot::graph(int index) const { if (index >= 0 && index < mGraphs.size()) { return mGraphs.at(index); } else { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return 0; } } /*! \overload Returns the last graph, that was created with \ref addGraph. If there are no graphs in the plot, returns 0. \see graphCount, addGraph */ QCPGraph *QCustomPlot::graph() const { if (!mGraphs.isEmpty()) { return mGraphs.last(); } else return 0; } /*! Creates a new graph inside the plot. If \a keyAxis and \a valueAxis are left unspecified (0), the bottom (xAxis) is used as key and the left (yAxis) is used as value axis. If specified, \a keyAxis and \a valueAxis must reside in this QCustomPlot. \a keyAxis will be used as key axis (typically "x") and \a valueAxis as value axis (typically "y") for the graph. Returns a pointer to the newly created graph, or 0 if adding the graph failed. \see graph, graphCount, removeGraph, clearGraphs */ QCPGraph *QCustomPlot::addGraph(QCPAxis *keyAxis, QCPAxis *valueAxis) { if (!keyAxis) keyAxis = xAxis; if (!valueAxis) valueAxis = yAxis; if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "can't use default QCustomPlot xAxis or yAxis, because at least one is invalid (has been deleted)"; return 0; } if (keyAxis->parentPlot() != this || valueAxis->parentPlot() != this) { qDebug() << Q_FUNC_INFO << "passed keyAxis or valueAxis doesn't have this QCustomPlot as parent"; return 0; } QCPGraph *newGraph = new QCPGraph(keyAxis, valueAxis); newGraph->setName(QLatin1String("Graph ")+QString::number(mGraphs.size())); return newGraph; } /*! Removes the specified \a graph from the plot and deletes it. If necessary, the corresponding legend item is also removed from the default legend (QCustomPlot::legend). If any other graphs in the plot have a channel fill set towards the removed graph, the channel fill property of those graphs is reset to zero (no channel fill). Returns true on success. \see clearGraphs */ bool QCustomPlot::removeGraph(QCPGraph *graph) { return removePlottable(graph); } /*! \overload Removes and deletes the graph by its \a index. */ bool QCustomPlot::removeGraph(int index) { if (index >= 0 && index < mGraphs.size()) return removeGraph(mGraphs[index]); else return false; } /*! Removes all graphs from the plot and deletes them. Corresponding legend items are also removed from the default legend (QCustomPlot::legend). Returns the number of graphs removed. \see removeGraph */ int QCustomPlot::clearGraphs() { int c = mGraphs.size(); for (int i=c-1; i >= 0; --i) removeGraph(mGraphs[i]); return c; } /*! Returns the number of currently existing graphs in the plot \see graph, addGraph */ int QCustomPlot::graphCount() const { return mGraphs.size(); } /*! Returns a list of the selected graphs. If no graphs are currently selected, the list is empty. If you are not only interested in selected graphs but other plottables like QCPCurve, QCPBars, etc., use \ref selectedPlottables. \see setInteractions, selectedPlottables, QCPAbstractPlottable::setSelectable, QCPAbstractPlottable::setSelection */ QList QCustomPlot::selectedGraphs() const { QList result; foreach (QCPGraph *graph, mGraphs) { if (graph->selected()) result.append(graph); } return result; } /*! Returns the item with \a index. If the index is invalid, returns 0. There is an overloaded version of this function with no parameter which returns the last added item, see QCustomPlot::item() \see itemCount */ QCPAbstractItem *QCustomPlot::item(int index) const { if (index >= 0 && index < mItems.size()) { return mItems.at(index); } else { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return 0; } } /*! \overload Returns the last item that was added to this plot. If there are no items in the plot, returns 0. \see itemCount */ QCPAbstractItem *QCustomPlot::item() const { if (!mItems.isEmpty()) { return mItems.last(); } else return 0; } /*! Removes the specified item from the plot and deletes it. Returns true on success. \see clearItems */ bool QCustomPlot::removeItem(QCPAbstractItem *item) { if (mItems.contains(item)) { delete item; mItems.removeOne(item); return true; } else { qDebug() << Q_FUNC_INFO << "item not in list:" << reinterpret_cast(item); return false; } } /*! \overload Removes and deletes the item by its \a index. */ bool QCustomPlot::removeItem(int index) { if (index >= 0 && index < mItems.size()) return removeItem(mItems[index]); else { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return false; } } /*! Removes all items from the plot and deletes them. Returns the number of items removed. \see removeItem */ int QCustomPlot::clearItems() { int c = mItems.size(); for (int i=c-1; i >= 0; --i) removeItem(mItems[i]); return c; } /*! Returns the number of currently existing items in the plot \see item */ int QCustomPlot::itemCount() const { return mItems.size(); } /*! Returns a list of the selected items. If no items are currently selected, the list is empty. \see setInteractions, QCPAbstractItem::setSelectable, QCPAbstractItem::setSelected */ QList QCustomPlot::selectedItems() const { QList result; foreach (QCPAbstractItem *item, mItems) { if (item->selected()) result.append(item); } return result; } /*! Returns the item at the pixel position \a pos. Items that only consist of single lines (e.g. \ref QCPItemLine or \ref QCPItemCurve) have a tolerance band around them, see \ref setSelectionTolerance. If multiple items come into consideration, the one closest to \a pos is returned. If \a onlySelectable is true, only items that are selectable (QCPAbstractItem::setSelectable) are considered. If there is no item at \a pos, the return value is 0. \see plottableAt, layoutElementAt */ QCPAbstractItem *QCustomPlot::itemAt(const QPointF &pos, bool onlySelectable) const { QCPAbstractItem *resultItem = 0; double resultDistance = mSelectionTolerance; // only regard clicks with distances smaller than mSelectionTolerance as selections, so initialize with that value foreach (QCPAbstractItem *item, mItems) { if (onlySelectable && !item->selectable()) // we could have also passed onlySelectable to the selectTest function, but checking here is faster, because we have access to QCPAbstractItem::selectable continue; if (!item->clipToAxisRect() || item->clipRect().contains(pos.toPoint())) // only consider clicks inside axis cliprect of the item if actually clipped to it { double currentDistance = item->selectTest(pos, false); if (currentDistance >= 0 && currentDistance < resultDistance) { resultItem = item; resultDistance = currentDistance; } } } return resultItem; } /*! Returns whether this QCustomPlot contains the \a item. \see item */ bool QCustomPlot::hasItem(QCPAbstractItem *item) const { return mItems.contains(item); } /*! Returns the layer with the specified \a name. If there is no layer with the specified name, 0 is returned. Layer names are case-sensitive. \see addLayer, moveLayer, removeLayer */ QCPLayer *QCustomPlot::layer(const QString &name) const { foreach (QCPLayer *layer, mLayers) { if (layer->name() == name) return layer; } return 0; } /*! \overload Returns the layer by \a index. If the index is invalid, 0 is returned. \see addLayer, moveLayer, removeLayer */ QCPLayer *QCustomPlot::layer(int index) const { if (index >= 0 && index < mLayers.size()) { return mLayers.at(index); } else { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return 0; } } /*! Returns the layer that is set as current layer (see \ref setCurrentLayer). */ QCPLayer *QCustomPlot::currentLayer() const { return mCurrentLayer; } /*! Sets the layer with the specified \a name to be the current layer. All layerables (\ref QCPLayerable), e.g. plottables and items, are created on the current layer. Returns true on success, i.e. if there is a layer with the specified \a name in the QCustomPlot. Layer names are case-sensitive. \see addLayer, moveLayer, removeLayer, QCPLayerable::setLayer */ bool QCustomPlot::setCurrentLayer(const QString &name) { if (QCPLayer *newCurrentLayer = layer(name)) { return setCurrentLayer(newCurrentLayer); } else { qDebug() << Q_FUNC_INFO << "layer with name doesn't exist:" << name; return false; } } /*! \overload Sets the provided \a layer to be the current layer. Returns true on success, i.e. when \a layer is a valid layer in the QCustomPlot. \see addLayer, moveLayer, removeLayer */ bool QCustomPlot::setCurrentLayer(QCPLayer *layer) { if (!mLayers.contains(layer)) { qDebug() << Q_FUNC_INFO << "layer not a layer of this QCustomPlot:" << reinterpret_cast(layer); return false; } mCurrentLayer = layer; return true; } /*! Returns the number of currently existing layers in the plot \see layer, addLayer */ int QCustomPlot::layerCount() const { return mLayers.size(); } /*! Adds a new layer to this QCustomPlot instance. The new layer will have the name \a name, which must be unique. Depending on \a insertMode, it is positioned either below or above \a otherLayer. Returns true on success, i.e. if there is no other layer named \a name and \a otherLayer is a valid layer inside this QCustomPlot. If \a otherLayer is 0, the highest layer in the QCustomPlot will be used. For an explanation of what layers are in QCustomPlot, see the documentation of \ref QCPLayer. \see layer, moveLayer, removeLayer */ bool QCustomPlot::addLayer(const QString &name, QCPLayer *otherLayer, QCustomPlot::LayerInsertMode insertMode) { if (!otherLayer) otherLayer = mLayers.last(); if (!mLayers.contains(otherLayer)) { qDebug() << Q_FUNC_INFO << "otherLayer not a layer of this QCustomPlot:" << reinterpret_cast(otherLayer); return false; } if (layer(name)) { qDebug() << Q_FUNC_INFO << "A layer exists already with the name" << name; return false; } QCPLayer *newLayer = new QCPLayer(this, name); mLayers.insert(otherLayer->index() + (insertMode==limAbove ? 1:0), newLayer); updateLayerIndices(); setupPaintBuffers(); // associates new layer with the appropriate paint buffer return true; } /*! Removes the specified \a layer and returns true on success. All layerables (e.g. plottables and items) on the removed layer will be moved to the layer below \a layer. If \a layer is the bottom layer, the layerables are moved to the layer above. In both cases, the total rendering order of all layerables in the QCustomPlot is preserved. If \a layer is the current layer (\ref setCurrentLayer), the layer below (or above, if bottom layer) becomes the new current layer. It is not possible to remove the last layer of the plot. \see layer, addLayer, moveLayer */ bool QCustomPlot::removeLayer(QCPLayer *layer) { if (!mLayers.contains(layer)) { qDebug() << Q_FUNC_INFO << "layer not a layer of this QCustomPlot:" << reinterpret_cast(layer); return false; } if (mLayers.size() < 2) { qDebug() << Q_FUNC_INFO << "can't remove last layer"; return false; } // append all children of this layer to layer below (if this is lowest layer, prepend to layer above) int removedIndex = layer->index(); bool isFirstLayer = removedIndex==0; QCPLayer *targetLayer = isFirstLayer ? mLayers.at(removedIndex+1) : mLayers.at(removedIndex-1); QList children = layer->children(); if (isFirstLayer) // prepend in reverse order (so order relative to each other stays the same) { for (int i=children.size()-1; i>=0; --i) children.at(i)->moveToLayer(targetLayer, true); } else // append normally { for (int i=0; imoveToLayer(targetLayer, false); } // if removed layer is current layer, change current layer to layer below/above: if (layer == mCurrentLayer) setCurrentLayer(targetLayer); // invalidate the paint buffer that was responsible for this layer: if (!layer->mPaintBuffer.isNull()) layer->mPaintBuffer.data()->setInvalidated(); // remove layer: delete layer; mLayers.removeOne(layer); updateLayerIndices(); return true; } /*! Moves the specified \a layer either above or below \a otherLayer. Whether it's placed above or below is controlled with \a insertMode. Returns true on success, i.e. when both \a layer and \a otherLayer are valid layers in the QCustomPlot. \see layer, addLayer, moveLayer */ bool QCustomPlot::moveLayer(QCPLayer *layer, QCPLayer *otherLayer, QCustomPlot::LayerInsertMode insertMode) { if (!mLayers.contains(layer)) { qDebug() << Q_FUNC_INFO << "layer not a layer of this QCustomPlot:" << reinterpret_cast(layer); return false; } if (!mLayers.contains(otherLayer)) { qDebug() << Q_FUNC_INFO << "otherLayer not a layer of this QCustomPlot:" << reinterpret_cast(otherLayer); return false; } if (layer->index() > otherLayer->index()) mLayers.move(layer->index(), otherLayer->index() + (insertMode==limAbove ? 1:0)); else if (layer->index() < otherLayer->index()) mLayers.move(layer->index(), otherLayer->index() + (insertMode==limAbove ? 0:-1)); // invalidate the paint buffers that are responsible for the layers: if (!layer->mPaintBuffer.isNull()) layer->mPaintBuffer.data()->setInvalidated(); if (!otherLayer->mPaintBuffer.isNull()) otherLayer->mPaintBuffer.data()->setInvalidated(); updateLayerIndices(); return true; } /*! Returns the number of axis rects in the plot. All axis rects can be accessed via QCustomPlot::axisRect(). Initially, only one axis rect exists in the plot. \see axisRect, axisRects */ int QCustomPlot::axisRectCount() const { return axisRects().size(); } /*! Returns the axis rect with \a index. Initially, only one axis rect (with index 0) exists in the plot. If multiple axis rects were added, all of them may be accessed with this function in a linear fashion (even when they are nested in a layout hierarchy or inside other axis rects via QCPAxisRect::insetLayout). \see axisRectCount, axisRects */ QCPAxisRect *QCustomPlot::axisRect(int index) const { const QList rectList = axisRects(); if (index >= 0 && index < rectList.size()) { return rectList.at(index); } else { qDebug() << Q_FUNC_INFO << "invalid axis rect index" << index; return 0; } } /*! Returns all axis rects in the plot. \see axisRectCount, axisRect */ QList QCustomPlot::axisRects() const { QList result; QStack elementStack; if (mPlotLayout) elementStack.push(mPlotLayout); while (!elementStack.isEmpty()) { foreach (QCPLayoutElement *element, elementStack.pop()->elements(false)) { if (element) { elementStack.push(element); if (QCPAxisRect *ar = qobject_cast(element)) result.append(ar); } } } return result; } /*! Returns the layout element at pixel position \a pos. If there is no element at that position, returns 0. Only visible elements are used. If \ref QCPLayoutElement::setVisible on the element itself or on any of its parent elements is set to false, it will not be considered. \see itemAt, plottableAt */ QCPLayoutElement *QCustomPlot::layoutElementAt(const QPointF &pos) const { QCPLayoutElement *currentElement = mPlotLayout; bool searchSubElements = true; while (searchSubElements && currentElement) { searchSubElements = false; foreach (QCPLayoutElement *subElement, currentElement->elements(false)) { if (subElement && subElement->realVisibility() && subElement->selectTest(pos, false) >= 0) { currentElement = subElement; searchSubElements = true; break; } } } return currentElement; } /*! Returns the layout element of type \ref QCPAxisRect at pixel position \a pos. This method ignores other layout elements even if they are visually in front of the axis rect (e.g. a \ref QCPLegend). If there is no axis rect at that position, returns 0. Only visible axis rects are used. If \ref QCPLayoutElement::setVisible on the axis rect itself or on any of its parent elements is set to false, it will not be considered. \see layoutElementAt */ QCPAxisRect *QCustomPlot::axisRectAt(const QPointF &pos) const { QCPAxisRect *result = 0; QCPLayoutElement *currentElement = mPlotLayout; bool searchSubElements = true; while (searchSubElements && currentElement) { searchSubElements = false; foreach (QCPLayoutElement *subElement, currentElement->elements(false)) { if (subElement && subElement->realVisibility() && subElement->selectTest(pos, false) >= 0) { currentElement = subElement; searchSubElements = true; if (QCPAxisRect *ar = qobject_cast(currentElement)) result = ar; break; } } } return result; } /*! Returns the axes that currently have selected parts, i.e. whose selection state is not \ref QCPAxis::spNone. \see selectedPlottables, selectedLegends, setInteractions, QCPAxis::setSelectedParts, QCPAxis::setSelectableParts */ QList QCustomPlot::selectedAxes() const { QList result, allAxes; foreach (QCPAxisRect *rect, axisRects()) allAxes << rect->axes(); foreach (QCPAxis *axis, allAxes) { if (axis->selectedParts() != QCPAxis::spNone) result.append(axis); } return result; } /*! Returns the legends that currently have selected parts, i.e. whose selection state is not \ref QCPLegend::spNone. \see selectedPlottables, selectedAxes, setInteractions, QCPLegend::setSelectedParts, QCPLegend::setSelectableParts, QCPLegend::selectedItems */ QList QCustomPlot::selectedLegends() const { QList result; QStack elementStack; if (mPlotLayout) elementStack.push(mPlotLayout); while (!elementStack.isEmpty()) { foreach (QCPLayoutElement *subElement, elementStack.pop()->elements(false)) { if (subElement) { elementStack.push(subElement); if (QCPLegend *leg = qobject_cast(subElement)) { if (leg->selectedParts() != QCPLegend::spNone) result.append(leg); } } } } return result; } /*! Deselects all layerables (plottables, items, axes, legends,...) of the QCustomPlot. Since calling this function is not a user interaction, this does not emit the \ref selectionChangedByUser signal. The individual selectionChanged signals are emitted though, if the objects were previously selected. \see setInteractions, selectedPlottables, selectedItems, selectedAxes, selectedLegends */ void QCustomPlot::deselectAll() { foreach (QCPLayer *layer, mLayers) { foreach (QCPLayerable *layerable, layer->children()) layerable->deselectEvent(0); } } /*! Causes a complete replot into the internal paint buffer(s). Finally, the widget surface is refreshed with the new buffer contents. This is the method that must be called to make changes to the plot, e.g. on the axis ranges or data points of graphs, visible. The parameter \a refreshPriority can be used to fine-tune the timing of the replot. For example if your application calls \ref replot very quickly in succession (e.g. multiple independent functions change some aspects of the plot and each wants to make sure the change gets replotted), it is advisable to set \a refreshPriority to \ref QCustomPlot::rpQueuedReplot. This way, the actual replotting is deferred to the next event loop iteration. Multiple successive calls of \ref replot with this priority will only cause a single replot, avoiding redundant replots and improving performance. Under a few circumstances, QCustomPlot causes a replot by itself. Those are resize events of the QCustomPlot widget and user interactions (object selection and range dragging/zooming). Before the replot happens, the signal \ref beforeReplot is emitted. After the replot, \ref afterReplot is emitted. It is safe to mutually connect the replot slot with any of those two signals on two QCustomPlots to make them replot synchronously, it won't cause an infinite recursion. If a layer is in mode \ref QCPLayer::lmBuffered (\ref QCPLayer::setMode), it is also possible to replot only that specific layer via \ref QCPLayer::replot. See the documentation there for details. */ void QCustomPlot::replot(QCustomPlot::RefreshPriority refreshPriority) { if (refreshPriority == QCustomPlot::rpQueuedReplot) { if (!mReplotQueued) { mReplotQueued = true; QTimer::singleShot(0, this, SLOT(replot())); } return; } if (mReplotting) // incase signals loop back to replot slot return; mReplotting = true; mReplotQueued = false; emit beforeReplot(); updateLayout(); // draw all layered objects (grid, axes, plottables, items, legend,...) into their buffers: setupPaintBuffers(); foreach (QCPLayer *layer, mLayers) layer->drawToPaintBuffer(); for (int i=0; isetInvalidated(false); if ((refreshPriority == rpRefreshHint && mPlottingHints.testFlag(QCP::phImmediateRefresh)) || refreshPriority==rpImmediateRefresh) repaint(); else update(); emit afterReplot(); mReplotting = false; } /*! Rescales the axes such that all plottables (like graphs) in the plot are fully visible. if \a onlyVisiblePlottables is set to true, only the plottables that have their visibility set to true (QCPLayerable::setVisible), will be used to rescale the axes. \see QCPAbstractPlottable::rescaleAxes, QCPAxis::rescale */ void QCustomPlot::rescaleAxes(bool onlyVisiblePlottables) { QList allAxes; foreach (QCPAxisRect *rect, axisRects()) allAxes << rect->axes(); foreach (QCPAxis *axis, allAxes) axis->rescale(onlyVisiblePlottables); } /*! Saves a PDF with the vectorized plot to the file \a fileName. The axis ratio as well as the scale of texts and lines will be derived from the specified \a width and \a height. This means, the output will look like the normal on-screen output of a QCustomPlot widget with the corresponding pixel width and height. If either \a width or \a height is zero, the exported image will have the same dimensions as the QCustomPlot widget currently has. Setting \a exportPen to \ref QCP::epNoCosmetic allows to disable the use of cosmetic pens when drawing to the PDF file. Cosmetic pens are pens with numerical width 0, which are always drawn as a one pixel wide line, no matter what zoom factor is set in the PDF-Viewer. For more information about cosmetic pens, see the QPainter and QPen documentation. The objects of the plot will appear in the current selection state. If you don't want any selected objects to be painted in their selected look, deselect everything with \ref deselectAll before calling this function. Returns true on success. \warning \li If you plan on editing the exported PDF file with a vector graphics editor like Inkscape, it is advised to set \a exportPen to \ref QCP::epNoCosmetic to avoid losing those cosmetic lines (which might be quite many, because cosmetic pens are the default for e.g. axes and tick marks). \li If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave \a width or \a height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights. \a pdfCreator and \a pdfTitle may be used to set the according metadata fields in the resulting PDF file. \note On Android systems, this method does nothing and issues an according qDebug warning message. This is also the case if for other reasons the define flag \c QT_NO_PRINTER is set. \see savePng, saveBmp, saveJpg, saveRastered */ bool QCustomPlot::savePdf(const QString &fileName, int width, int height, QCP::ExportPen exportPen, const QString &pdfCreator, const QString &pdfTitle) { bool success = false; #ifdef QT_NO_PRINTER Q_UNUSED(fileName) Q_UNUSED(exportPen) Q_UNUSED(width) Q_UNUSED(height) Q_UNUSED(pdfCreator) Q_UNUSED(pdfTitle) qDebug() << Q_FUNC_INFO << "Qt was built without printer support (QT_NO_PRINTER). PDF not created."; #else int newWidth, newHeight; if (width == 0 || height == 0) { newWidth = this->width(); newHeight = this->height(); } else { newWidth = width; newHeight = height; } QPrinter printer(QPrinter::ScreenResolution); printer.setOutputFileName(fileName); printer.setOutputFormat(QPrinter::PdfFormat); printer.setColorMode(QPrinter::Color); printer.printEngine()->setProperty(QPrintEngine::PPK_Creator, pdfCreator); printer.printEngine()->setProperty(QPrintEngine::PPK_DocumentName, pdfTitle); QRect oldViewport = viewport(); setViewport(QRect(0, 0, newWidth, newHeight)); #if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) printer.setFullPage(true); printer.setPaperSize(viewport().size(), QPrinter::DevicePixel); #else QPageLayout pageLayout; pageLayout.setMode(QPageLayout::FullPageMode); pageLayout.setOrientation(QPageLayout::Portrait); pageLayout.setMargins(QMarginsF(0, 0, 0, 0)); pageLayout.setPageSize(QPageSize(viewport().size(), QPageSize::Point, QString(), QPageSize::ExactMatch)); printer.setPageLayout(pageLayout); #endif QCPPainter printpainter; if (printpainter.begin(&printer)) { printpainter.setMode(QCPPainter::pmVectorized); printpainter.setMode(QCPPainter::pmNoCaching); printpainter.setMode(QCPPainter::pmNonCosmetic, exportPen==QCP::epNoCosmetic); printpainter.setWindow(mViewport); if (mBackgroundBrush.style() != Qt::NoBrush && mBackgroundBrush.color() != Qt::white && mBackgroundBrush.color() != Qt::transparent && mBackgroundBrush.color().alpha() > 0) // draw pdf background color if not white/transparent printpainter.fillRect(viewport(), mBackgroundBrush); draw(&printpainter); printpainter.end(); success = true; } setViewport(oldViewport); #endif // QT_NO_PRINTER return success; } /*! Saves a PNG image file to \a fileName on disc. The output plot will have the dimensions \a width and \a height in pixels, multiplied by \a scale. If either \a width or \a height is zero, the current width and height of the QCustomPlot widget is used instead. Line widths and texts etc. are not scaled up when larger widths/heights are used. If you want that effect, use the \a scale parameter. For example, if you set both \a width and \a height to 100 and \a scale to 2, you will end up with an image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths, texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full 200*200 pixel resolution. If you use a high scaling factor, it is recommended to enable antialiasing for all elements by temporarily setting \ref QCustomPlot::setAntialiasedElements to \ref QCP::aeAll as this allows QCustomPlot to place objects with sub-pixel accuracy. image compression can be controlled with the \a quality parameter which must be between 0 and 100 or -1 to use the default setting. The \a resolution will be written to the image file header and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units \a resolution is given, by setting \a resolutionUnit. The \a resolution is converted to the format's expected resolution unit internally. Returns true on success. If this function fails, most likely the PNG format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats(). The objects of the plot will appear in the current selection state. If you don't want any selected objects to be painted in their selected look, deselect everything with \ref deselectAll before calling this function. If you want the PNG to have a transparent background, call \ref setBackground(const QBrush &brush) with no brush (Qt::NoBrush) or a transparent color (Qt::transparent), before saving. \warning If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave \a width or \a height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights. \see savePdf, saveBmp, saveJpg, saveRastered */ bool QCustomPlot::savePng(const QString &fileName, int width, int height, double scale, int quality, int resolution, QCP::ResolutionUnit resolutionUnit) { return saveRastered(fileName, width, height, scale, "PNG", quality, resolution, resolutionUnit); } /*! Saves a JPEG image file to \a fileName on disc. The output plot will have the dimensions \a width and \a height in pixels, multiplied by \a scale. If either \a width or \a height is zero, the current width and height of the QCustomPlot widget is used instead. Line widths and texts etc. are not scaled up when larger widths/heights are used. If you want that effect, use the \a scale parameter. For example, if you set both \a width and \a height to 100 and \a scale to 2, you will end up with an image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths, texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full 200*200 pixel resolution. If you use a high scaling factor, it is recommended to enable antialiasing for all elements by temporarily setting \ref QCustomPlot::setAntialiasedElements to \ref QCP::aeAll as this allows QCustomPlot to place objects with sub-pixel accuracy. image compression can be controlled with the \a quality parameter which must be between 0 and 100 or -1 to use the default setting. The \a resolution will be written to the image file header and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units \a resolution is given, by setting \a resolutionUnit. The \a resolution is converted to the format's expected resolution unit internally. Returns true on success. If this function fails, most likely the JPEG format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats(). The objects of the plot will appear in the current selection state. If you don't want any selected objects to be painted in their selected look, deselect everything with \ref deselectAll before calling this function. \warning If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave \a width or \a height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights. \see savePdf, savePng, saveBmp, saveRastered */ bool QCustomPlot::saveJpg(const QString &fileName, int width, int height, double scale, int quality, int resolution, QCP::ResolutionUnit resolutionUnit) { return saveRastered(fileName, width, height, scale, "JPG", quality, resolution, resolutionUnit); } /*! Saves a BMP image file to \a fileName on disc. The output plot will have the dimensions \a width and \a height in pixels, multiplied by \a scale. If either \a width or \a height is zero, the current width and height of the QCustomPlot widget is used instead. Line widths and texts etc. are not scaled up when larger widths/heights are used. If you want that effect, use the \a scale parameter. For example, if you set both \a width and \a height to 100 and \a scale to 2, you will end up with an image file of size 200*200 in which all graphical elements are scaled up by factor 2 (line widths, texts, etc.). This scaling is not done by stretching a 100*100 image, the result will have full 200*200 pixel resolution. If you use a high scaling factor, it is recommended to enable antialiasing for all elements by temporarily setting \ref QCustomPlot::setAntialiasedElements to \ref QCP::aeAll as this allows QCustomPlot to place objects with sub-pixel accuracy. The \a resolution will be written to the image file header and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units \a resolution is given, by setting \a resolutionUnit. The \a resolution is converted to the format's expected resolution unit internally. Returns true on success. If this function fails, most likely the BMP format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats(). The objects of the plot will appear in the current selection state. If you don't want any selected objects to be painted in their selected look, deselect everything with \ref deselectAll before calling this function. \warning If calling this function inside the constructor of the parent of the QCustomPlot widget (i.e. the MainWindow constructor, if QCustomPlot is inside the MainWindow), always provide explicit non-zero widths and heights. If you leave \a width or \a height as 0 (default), this function uses the current width and height of the QCustomPlot widget. However, in Qt, these aren't defined yet inside the constructor, so you would get an image that has strange widths/heights. \see savePdf, savePng, saveJpg, saveRastered */ bool QCustomPlot::saveBmp(const QString &fileName, int width, int height, double scale, int resolution, QCP::ResolutionUnit resolutionUnit) { return saveRastered(fileName, width, height, scale, "BMP", -1, resolution, resolutionUnit); } /*! \internal Returns a minimum size hint that corresponds to the minimum size of the top level layout (\ref plotLayout). To prevent QCustomPlot from being collapsed to size/width zero, set a minimum size (setMinimumSize) either on the whole QCustomPlot or on any layout elements inside the plot. This is especially important, when placed in a QLayout where other components try to take in as much space as possible (e.g. QMdiArea). */ QSize QCustomPlot::minimumSizeHint() const { return mPlotLayout->minimumSizeHint(); } /*! \internal Returns a size hint that is the same as \ref minimumSizeHint. */ QSize QCustomPlot::sizeHint() const { return mPlotLayout->minimumSizeHint(); } /*! \internal Event handler for when the QCustomPlot widget needs repainting. This does not cause a \ref replot, but draws the internal buffer on the widget surface. */ void QCustomPlot::paintEvent(QPaintEvent *event) { Q_UNUSED(event); QCPPainter painter(this); if (painter.isActive()) { painter.setRenderHint(QPainter::HighQualityAntialiasing); // to make Antialiasing look good if using the OpenGL graphicssystem if (mBackgroundBrush.style() != Qt::NoBrush) painter.fillRect(mViewport, mBackgroundBrush); drawBackground(&painter); for (int bufferIndex = 0; bufferIndex < mPaintBuffers.size(); ++bufferIndex) mPaintBuffers.at(bufferIndex)->draw(&painter); } } /*! \internal Event handler for a resize of the QCustomPlot widget. The viewport (which becomes the outer rect of mPlotLayout) is resized appropriately. Finally a \ref replot is performed. */ void QCustomPlot::resizeEvent(QResizeEvent *event) { Q_UNUSED(event) // resize and repaint the buffer: setViewport(rect()); replot(rpQueuedRefresh); // queued refresh is important here, to prevent painting issues in some contexts (e.g. MDI subwindow) } /*! \internal Event handler for when a double click occurs. Emits the \ref mouseDoubleClick signal, then determines the layerable under the cursor and forwards the event to it. Finally, emits the specialized signals when certain objecs are clicked (e.g. \ref plottableDoubleClick, \ref axisDoubleClick, etc.). \see mousePressEvent, mouseReleaseEvent */ void QCustomPlot::mouseDoubleClickEvent(QMouseEvent *event) { emit mouseDoubleClick(event); mMouseHasMoved = false; mMousePressPos = event->pos(); // determine layerable under the cursor (this event is called instead of the second press event in a double-click): QList details; QList candidates = layerableListAt(mMousePressPos, false, &details); for (int i=0; iaccept(); // default impl of QCPLayerable's mouse events ignore the event, in that case propagate to next candidate in list candidates.at(i)->mouseDoubleClickEvent(event, details.at(i)); if (event->isAccepted()) { mMouseEventLayerable = candidates.at(i); mMouseEventLayerableDetails = details.at(i); break; } } // emit specialized object double click signals: if (!candidates.isEmpty()) { if (QCPAbstractPlottable *ap = qobject_cast(candidates.first())) { int dataIndex = 0; if (!details.first().value().isEmpty()) dataIndex = details.first().value().dataRange().begin(); emit plottableDoubleClick(ap, dataIndex, event); } else if (QCPAxis *ax = qobject_cast(candidates.first())) emit axisDoubleClick(ax, details.first().value(), event); else if (QCPAbstractItem *ai = qobject_cast(candidates.first())) emit itemDoubleClick(ai, event); else if (QCPLegend *lg = qobject_cast(candidates.first())) emit legendDoubleClick(lg, 0, event); else if (QCPAbstractLegendItem *li = qobject_cast(candidates.first())) emit legendDoubleClick(li->parentLegend(), li, event); } event->accept(); // in case QCPLayerable reimplementation manipulates event accepted state. In QWidget event system, QCustomPlot wants to accept the event. } /*! \internal Event handler for when a mouse button is pressed. Emits the mousePress signal. If the current \ref setSelectionRectMode is not \ref QCP::srmNone, passes the event to the selection rect. Otherwise determines the layerable under the cursor and forwards the event to it. \see mouseMoveEvent, mouseReleaseEvent */ void QCustomPlot::mousePressEvent(QMouseEvent *event) { emit mousePress(event); // save some state to tell in releaseEvent whether it was a click: mMouseHasMoved = false; mMousePressPos = event->pos(); if (mSelectionRect && mSelectionRectMode != QCP::srmNone) { if (mSelectionRectMode != QCP::srmZoom || qobject_cast(axisRectAt(mMousePressPos))) // in zoom mode only activate selection rect if on an axis rect mSelectionRect->startSelection(event); } else { // no selection rect interaction, so forward event to layerable under the cursor: QList details; QList candidates = layerableListAt(mMousePressPos, false, &details); for (int i=0; iaccept(); // default impl of QCPLayerable's mouse events ignore the event, in that case propagate to next candidate in list candidates.at(i)->mousePressEvent(event, details.at(i)); if (event->isAccepted()) { mMouseEventLayerable = candidates.at(i); mMouseEventLayerableDetails = details.at(i); break; } } } event->accept(); // in case QCPLayerable reimplementation manipulates event accepted state. In QWidget event system, QCustomPlot wants to accept the event. } /*! \internal Event handler for when the cursor is moved. Emits the \ref mouseMove signal. If the selection rect (\ref setSelectionRect) is currently active, the event is forwarded to it in order to update the rect geometry. Otherwise, if a layout element has mouse capture focus (a mousePressEvent happened on top of the layout element before), the mouseMoveEvent is forwarded to that element. \see mousePressEvent, mouseReleaseEvent */ void QCustomPlot::mouseMoveEvent(QMouseEvent *event) { emit mouseMove(event); if (!mMouseHasMoved && (mMousePressPos-event->pos()).manhattanLength() > 3) mMouseHasMoved = true; // moved too far from mouse press position, don't handle as click on mouse release if (mSelectionRect && mSelectionRect->isActive()) mSelectionRect->moveSelection(event); else if (mMouseEventLayerable) // call event of affected layerable: mMouseEventLayerable->mouseMoveEvent(event, mMousePressPos); event->accept(); // in case QCPLayerable reimplementation manipulates event accepted state. In QWidget event system, QCustomPlot wants to accept the event. } /*! \internal Event handler for when a mouse button is released. Emits the \ref mouseRelease signal. If the mouse was moved less than a certain threshold in any direction since the \ref mousePressEvent, it is considered a click which causes the selection mechanism (if activated via \ref setInteractions) to possibly change selection states accordingly. Further, specialized mouse click signals are emitted (e.g. \ref plottableClick, \ref axisClick, etc.) If a layerable is the mouse capturer (a \ref mousePressEvent happened on top of the layerable before), the \ref mouseReleaseEvent is forwarded to that element. \see mousePressEvent, mouseMoveEvent */ void QCustomPlot::mouseReleaseEvent(QMouseEvent *event) { emit mouseRelease(event); if (!mMouseHasMoved) // mouse hasn't moved (much) between press and release, so handle as click { if (mSelectionRect && mSelectionRect->isActive()) // a simple click shouldn't successfully finish a selection rect, so cancel it here mSelectionRect->cancel(); if (event->button() == Qt::LeftButton) processPointSelection(event); // emit specialized click signals of QCustomPlot instance: if (QCPAbstractPlottable *ap = qobject_cast(mMouseEventLayerable)) { int dataIndex = 0; if (!mMouseEventLayerableDetails.value().isEmpty()) dataIndex = mMouseEventLayerableDetails.value().dataRange().begin(); emit plottableClick(ap, dataIndex, event); } else if (QCPAxis *ax = qobject_cast(mMouseEventLayerable)) emit axisClick(ax, mMouseEventLayerableDetails.value(), event); else if (QCPAbstractItem *ai = qobject_cast(mMouseEventLayerable)) emit itemClick(ai, event); else if (QCPLegend *lg = qobject_cast(mMouseEventLayerable)) emit legendClick(lg, 0, event); else if (QCPAbstractLegendItem *li = qobject_cast(mMouseEventLayerable)) emit legendClick(li->parentLegend(), li, event); } if (mSelectionRect && mSelectionRect->isActive()) // Note: if a click was detected above, the selection rect is canceled there { // finish selection rect, the appropriate action will be taken via signal-slot connection: mSelectionRect->endSelection(event); } else { // call event of affected layerable: if (mMouseEventLayerable) { mMouseEventLayerable->mouseReleaseEvent(event, mMousePressPos); mMouseEventLayerable = 0; } } if (noAntialiasingOnDrag()) replot(rpQueuedReplot); event->accept(); // in case QCPLayerable reimplementation manipulates event accepted state. In QWidget event system, QCustomPlot wants to accept the event. } /*! \internal Event handler for mouse wheel events. First, the \ref mouseWheel signal is emitted. Then determines the affected layerable and forwards the event to it. */ void QCustomPlot::wheelEvent(QWheelEvent *event) { emit mouseWheel(event); // forward event to layerable under cursor: QList candidates = layerableListAt(event->pos(), false); for (int i=0; iaccept(); // default impl of QCPLayerable's mouse events ignore the event, in that case propagate to next candidate in list candidates.at(i)->wheelEvent(event); if (event->isAccepted()) break; } event->accept(); // in case QCPLayerable reimplementation manipulates event accepted state. In QWidget event system, QCustomPlot wants to accept the event. } /*! \internal This function draws the entire plot, including background pixmap, with the specified \a painter. It does not make use of the paint buffers like \ref replot, so this is the function typically used by saving/exporting methods such as \ref savePdf or \ref toPainter. Note that it does not fill the background with the background brush (as the user may specify with \ref setBackground(const QBrush &brush)), this is up to the respective functions calling this method. */ void QCustomPlot::draw(QCPPainter *painter) { updateLayout(); // draw viewport background pixmap: drawBackground(painter); // draw all layered objects (grid, axes, plottables, items, legend,...): foreach (QCPLayer *layer, mLayers) layer->draw(painter); /* Debug code to draw all layout element rects foreach (QCPLayoutElement* el, findChildren()) { painter->setBrush(Qt::NoBrush); painter->setPen(QPen(QColor(0, 0, 0, 100), 0, Qt::DashLine)); painter->drawRect(el->rect()); painter->setPen(QPen(QColor(255, 0, 0, 100), 0, Qt::DashLine)); painter->drawRect(el->outerRect()); } */ } /*! \internal Performs the layout update steps defined by \ref QCPLayoutElement::UpdatePhase, by calling \ref QCPLayoutElement::update on the main plot layout. Here, the layout elements calculate their positions and margins, and prepare for the following draw call. */ void QCustomPlot::updateLayout() { // run through layout phases: mPlotLayout->update(QCPLayoutElement::upPreparation); mPlotLayout->update(QCPLayoutElement::upMargins); mPlotLayout->update(QCPLayoutElement::upLayout); } /*! \internal Draws the viewport background pixmap of the plot. If a pixmap was provided via \ref setBackground, this function buffers the scaled version depending on \ref setBackgroundScaled and \ref setBackgroundScaledMode and then draws it inside the viewport with the provided \a painter. The scaled version is buffered in mScaledBackgroundPixmap to prevent expensive rescaling at every redraw. It is only updated, when the axis rect has changed in a way that requires a rescale of the background pixmap (this is dependent on the \ref setBackgroundScaledMode), or when a differend axis background pixmap was set. Note that this function does not draw a fill with the background brush (\ref setBackground(const QBrush &brush)) beneath the pixmap. \see setBackground, setBackgroundScaled, setBackgroundScaledMode */ void QCustomPlot::drawBackground(QCPPainter *painter) { // Note: background color is handled in individual replot/save functions // draw background pixmap (on top of fill, if brush specified): if (!mBackgroundPixmap.isNull()) { if (mBackgroundScaled) { // check whether mScaledBackground needs to be updated: QSize scaledSize(mBackgroundPixmap.size()); scaledSize.scale(mViewport.size(), mBackgroundScaledMode); if (mScaledBackgroundPixmap.size() != scaledSize) mScaledBackgroundPixmap = mBackgroundPixmap.scaled(mViewport.size(), mBackgroundScaledMode, Qt::SmoothTransformation); painter->drawPixmap(mViewport.topLeft(), mScaledBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height()) & mScaledBackgroundPixmap.rect()); } else { painter->drawPixmap(mViewport.topLeft(), mBackgroundPixmap, QRect(0, 0, mViewport.width(), mViewport.height())); } } } /*! \internal Goes through the layers and makes sure this QCustomPlot instance holds the correct number of paint buffers and that they have the correct configuration (size, pixel ratio, etc.). Allocations, reallocations and deletions of paint buffers are performed as necessary. It also associates the paint buffers with the layers, so they draw themselves into the right buffer when \ref QCPLayer::drawToPaintBuffer is called. This means it associates adjacent \ref QCPLayer::lmLogical layers to a mutual paint buffer and creates dedicated paint buffers for layers in \ref QCPLayer::lmBuffered mode. This method uses \ref createPaintBuffer to create new paint buffers. After this method, the paint buffers are empty (filled with \c Qt::transparent) and invalidated (so an attempt to replot only a single buffered layer causes a full replot). This method is called in every \ref replot call, prior to actually drawing the layers (into their associated paint buffer). If the paint buffers don't need changing/reallocating, this method basically leaves them alone and thus finishes very fast. */ void QCustomPlot::setupPaintBuffers() { int bufferIndex = 0; if (mPaintBuffers.isEmpty()) mPaintBuffers.append(QSharedPointer(createPaintBuffer())); for (int layerIndex = 0; layerIndex < mLayers.size(); ++layerIndex) { QCPLayer *layer = mLayers.at(layerIndex); if (layer->mode() == QCPLayer::lmLogical) { layer->mPaintBuffer = mPaintBuffers.at(bufferIndex).toWeakRef(); } else if (layer->mode() == QCPLayer::lmBuffered) { ++bufferIndex; if (bufferIndex >= mPaintBuffers.size()) mPaintBuffers.append(QSharedPointer(createPaintBuffer())); layer->mPaintBuffer = mPaintBuffers.at(bufferIndex).toWeakRef(); if (layerIndex < mLayers.size()-1 && mLayers.at(layerIndex+1)->mode() == QCPLayer::lmLogical) // not last layer, and next one is logical, so prepare another buffer for next layerables { ++bufferIndex; if (bufferIndex >= mPaintBuffers.size()) mPaintBuffers.append(QSharedPointer(createPaintBuffer())); } } } // remove unneeded buffers: while (mPaintBuffers.size()-1 > bufferIndex) mPaintBuffers.removeLast(); // resize buffers to viewport size and clear contents: for (int i=0; isetSize(viewport().size()); // won't do anything if already correct size mPaintBuffers.at(i)->clear(Qt::transparent); mPaintBuffers.at(i)->setInvalidated(); } } /*! \internal This method is used by \ref setupPaintBuffers when it needs to create new paint buffers. Depending on the current setting of \ref setOpenGl, and the current Qt version, different backends (subclasses of \ref QCPAbstractPaintBuffer) are created, initialized with the proper size and device pixel ratio, and returned. */ QCPAbstractPaintBuffer *QCustomPlot::createPaintBuffer() { if (mOpenGl) { #if defined(QCP_OPENGL_FBO) return new QCPPaintBufferGlFbo(viewport().size(), mBufferDevicePixelRatio, mGlContext, mGlPaintDevice); #elif defined(QCP_OPENGL_PBUFFER) return new QCPPaintBufferGlPbuffer(viewport().size(), mBufferDevicePixelRatio, mOpenGlMultisamples); #else qDebug() << Q_FUNC_INFO << "OpenGL enabled even though no support for it compiled in, this shouldn't have happened. Falling back to pixmap paint buffer."; return new QCPPaintBufferPixmap(viewport().size(), mBufferDevicePixelRatio); #endif } else return new QCPPaintBufferPixmap(viewport().size(), mBufferDevicePixelRatio); } /*! This method returns whether any of the paint buffers held by this QCustomPlot instance are invalidated. If any buffer is invalidated, a partial replot (\ref QCPLayer::replot) is not allowed and always causes a full replot (\ref QCustomPlot::replot) of all layers. This is the case when for example the layer order has changed, new layers were added, layers were removed, or layer modes were changed (\ref QCPLayer::setMode). \see QCPAbstractPaintBuffer::setInvalidated */ bool QCustomPlot::hasInvalidatedPaintBuffers() { for (int i=0; iinvalidated()) return true; } return false; } /*! \internal When \ref setOpenGl is set to true, this method is used to initialize OpenGL (create a context, surface, paint device). Returns true on success. If this method is successful, all paint buffers should be deleted and then reallocated by calling \ref setupPaintBuffers, so the OpenGL-based paint buffer subclasses (\ref QCPPaintBufferGlPbuffer, \ref QCPPaintBufferGlFbo) are used for subsequent replots. \see freeOpenGl */ bool QCustomPlot::setupOpenGl() { #ifdef QCP_OPENGL_FBO freeOpenGl(); QSurfaceFormat proposedSurfaceFormat; proposedSurfaceFormat.setSamples(mOpenGlMultisamples); #ifdef QCP_OPENGL_OFFSCREENSURFACE QOffscreenSurface *surface = new QOffscreenSurface; #else QWindow *surface = new QWindow; surface->setSurfaceType(QSurface::OpenGLSurface); #endif surface->setFormat(proposedSurfaceFormat); surface->create(); mGlSurface = QSharedPointer(surface); mGlContext = QSharedPointer(new QOpenGLContext); mGlContext->setFormat(mGlSurface->format()); if (!mGlContext->create()) { qDebug() << Q_FUNC_INFO << "Failed to create OpenGL context"; mGlContext.clear(); mGlSurface.clear(); return false; } if (!mGlContext->makeCurrent(mGlSurface.data())) // context needs to be current to create paint device { qDebug() << Q_FUNC_INFO << "Failed to make opengl context current"; mGlContext.clear(); mGlSurface.clear(); return false; } if (!QOpenGLFramebufferObject::hasOpenGLFramebufferObjects()) { qDebug() << Q_FUNC_INFO << "OpenGL of this system doesn't support frame buffer objects"; mGlContext.clear(); mGlSurface.clear(); return false; } mGlPaintDevice = QSharedPointer(new QOpenGLPaintDevice); return true; #elif defined(QCP_OPENGL_PBUFFER) return QGLFormat::hasOpenGL(); #else return false; #endif } /*! \internal When \ref setOpenGl is set to false, this method is used to deinitialize OpenGL (releases the context and frees resources). After OpenGL is disabled, all paint buffers should be deleted and then reallocated by calling \ref setupPaintBuffers, so the standard software rendering paint buffer subclass (\ref QCPPaintBufferPixmap) is used for subsequent replots. \see setupOpenGl */ void QCustomPlot::freeOpenGl() { #ifdef QCP_OPENGL_FBO mGlPaintDevice.clear(); mGlContext.clear(); mGlSurface.clear(); #endif } /*! \internal This method is used by \ref QCPAxisRect::removeAxis to report removed axes to the QCustomPlot so it may clear its QCustomPlot::xAxis, yAxis, xAxis2 and yAxis2 members accordingly. */ void QCustomPlot::axisRemoved(QCPAxis *axis) { if (xAxis == axis) xAxis = 0; if (xAxis2 == axis) xAxis2 = 0; if (yAxis == axis) yAxis = 0; if (yAxis2 == axis) yAxis2 = 0; // Note: No need to take care of range drag axes and range zoom axes, because they are stored in smart pointers } /*! \internal This method is used by the QCPLegend destructor to report legend removal to the QCustomPlot so it may clear its QCustomPlot::legend member accordingly. */ void QCustomPlot::legendRemoved(QCPLegend *legend) { if (this->legend == legend) this->legend = 0; } /*! \internal This slot is connected to the selection rect's \ref QCPSelectionRect::accepted signal when \ref setSelectionRectMode is set to \ref QCP::srmSelect. First, it determines which axis rect was the origin of the selection rect judging by the starting point of the selection. Then it goes through the plottables (\ref QCPAbstractPlottable1D to be precise) associated with that axis rect and finds the data points that are in \a rect. It does this by querying their \ref QCPAbstractPlottable1D::selectTestRect method. Then, the actual selection is done by calling the plottables' \ref QCPAbstractPlottable::selectEvent, placing the found selected data points in the \a details parameter as QVariant(\ref QCPDataSelection). All plottables that weren't touched by \a rect receive a \ref QCPAbstractPlottable::deselectEvent. \see processRectZoom */ void QCustomPlot::processRectSelection(QRect rect, QMouseEvent *event) { bool selectionStateChanged = false; if (mInteractions.testFlag(QCP::iSelectPlottables)) { QMap > potentialSelections; // map key is number of selected data points, so we have selections sorted by size QRectF rectF(rect.normalized()); if (QCPAxisRect *affectedAxisRect = axisRectAt(rectF.topLeft())) { // determine plottables that were hit by the rect and thus are candidates for selection: foreach (QCPAbstractPlottable *plottable, affectedAxisRect->plottables()) { if (QCPPlottableInterface1D *plottableInterface = plottable->interface1D()) { QCPDataSelection dataSel = plottableInterface->selectTestRect(rectF, true); if (!dataSel.isEmpty()) potentialSelections.insertMulti(dataSel.dataPointCount(), QPair(plottable, dataSel)); } } if (!mInteractions.testFlag(QCP::iMultiSelect)) { // only leave plottable with most selected points in map, since we will only select a single plottable: if (!potentialSelections.isEmpty()) { QMap >::iterator it = potentialSelections.begin(); while (it != potentialSelections.end()-1) // erase all except last element it = potentialSelections.erase(it); } } bool additive = event->modifiers().testFlag(mMultiSelectModifier); // deselect all other layerables if not additive selection: if (!additive) { // emit deselection except to those plottables who will be selected afterwards: foreach (QCPLayer *layer, mLayers) { foreach (QCPLayerable *layerable, layer->children()) { if ((potentialSelections.isEmpty() || potentialSelections.constBegin()->first != layerable) && mInteractions.testFlag(layerable->selectionCategory())) { bool selChanged = false; layerable->deselectEvent(&selChanged); selectionStateChanged |= selChanged; } } } } // go through selections in reverse (largest selection first) and emit select events: QMap >::const_iterator it = potentialSelections.constEnd(); while (it != potentialSelections.constBegin()) { --it; if (mInteractions.testFlag(it.value().first->selectionCategory())) { bool selChanged = false; it.value().first->selectEvent(event, additive, QVariant::fromValue(it.value().second), &selChanged); selectionStateChanged |= selChanged; } } } } if (selectionStateChanged) { emit selectionChangedByUser(); replot(rpQueuedReplot); } else if (mSelectionRect) mSelectionRect->layer()->replot(); } /*! \internal This slot is connected to the selection rect's \ref QCPSelectionRect::accepted signal when \ref setSelectionRectMode is set to \ref QCP::srmZoom. It determines which axis rect was the origin of the selection rect judging by the starting point of the selection, and then zooms the axes defined via \ref QCPAxisRect::setRangeZoomAxes to the provided \a rect (see \ref QCPAxisRect::zoom). \see processRectSelection */ void QCustomPlot::processRectZoom(QRect rect, QMouseEvent *event) { Q_UNUSED(event) if (QCPAxisRect *axisRect = axisRectAt(rect.topLeft())) { QList affectedAxes = QList() << axisRect->rangeZoomAxes(Qt::Horizontal) << axisRect->rangeZoomAxes(Qt::Vertical); affectedAxes.removeAll(static_cast(0)); axisRect->zoom(QRectF(rect), affectedAxes); } replot(rpQueuedReplot); // always replot to make selection rect disappear } /*! \internal This method is called when a simple left mouse click was detected on the QCustomPlot surface. It first determines the layerable that was hit by the click, and then calls its \ref QCPLayerable::selectEvent. All other layerables receive a QCPLayerable::deselectEvent (unless the multi-select modifier was pressed, see \ref setMultiSelectModifier). In this method the hit layerable is determined a second time using \ref layerableAt (after the one in \ref mousePressEvent), because we want \a onlySelectable set to true this time. This implies that the mouse event grabber (mMouseEventLayerable) may be a different one from the clicked layerable determined here. For example, if a non-selectable layerable is in front of a selectable layerable at the click position, the front layerable will receive mouse events but the selectable one in the back will receive the \ref QCPLayerable::selectEvent. \see processRectSelection, QCPLayerable::selectTest */ void QCustomPlot::processPointSelection(QMouseEvent *event) { QVariant details; QCPLayerable *clickedLayerable = layerableAt(event->pos(), true, &details); bool selectionStateChanged = false; bool additive = mInteractions.testFlag(QCP::iMultiSelect) && event->modifiers().testFlag(mMultiSelectModifier); // deselect all other layerables if not additive selection: if (!additive) { foreach (QCPLayer *layer, mLayers) { foreach (QCPLayerable *layerable, layer->children()) { if (layerable != clickedLayerable && mInteractions.testFlag(layerable->selectionCategory())) { bool selChanged = false; layerable->deselectEvent(&selChanged); selectionStateChanged |= selChanged; } } } } if (clickedLayerable && mInteractions.testFlag(clickedLayerable->selectionCategory())) { // a layerable was actually clicked, call its selectEvent: bool selChanged = false; clickedLayerable->selectEvent(event, additive, details, &selChanged); selectionStateChanged |= selChanged; } if (selectionStateChanged) { emit selectionChangedByUser(); replot(rpQueuedReplot); } } /*! \internal Registers the specified plottable with this QCustomPlot and, if \ref setAutoAddPlottableToLegend is enabled, adds it to the legend (QCustomPlot::legend). QCustomPlot takes ownership of the plottable. Returns true on success, i.e. when \a plottable isn't already in this plot and the parent plot of \a plottable is this QCustomPlot. This method is called automatically in the QCPAbstractPlottable base class constructor. */ bool QCustomPlot::registerPlottable(QCPAbstractPlottable *plottable) { if (mPlottables.contains(plottable)) { qDebug() << Q_FUNC_INFO << "plottable already added to this QCustomPlot:" << reinterpret_cast(plottable); return false; } if (plottable->parentPlot() != this) { qDebug() << Q_FUNC_INFO << "plottable not created with this QCustomPlot as parent:" << reinterpret_cast(plottable); return false; } mPlottables.append(plottable); // possibly add plottable to legend: if (mAutoAddPlottableToLegend) plottable->addToLegend(); if (!plottable->layer()) // usually the layer is already set in the constructor of the plottable (via QCPLayerable constructor) plottable->setLayer(currentLayer()); return true; } /*! \internal In order to maintain the simplified graph interface of QCustomPlot, this method is called by the QCPGraph constructor to register itself with this QCustomPlot's internal graph list. Returns true on success, i.e. if \a graph is valid and wasn't already registered with this QCustomPlot. This graph specific registration happens in addition to the call to \ref registerPlottable by the QCPAbstractPlottable base class. */ bool QCustomPlot::registerGraph(QCPGraph *graph) { if (!graph) { qDebug() << Q_FUNC_INFO << "passed graph is zero"; return false; } if (mGraphs.contains(graph)) { qDebug() << Q_FUNC_INFO << "graph already registered with this QCustomPlot"; return false; } mGraphs.append(graph); return true; } /*! \internal Registers the specified item with this QCustomPlot. QCustomPlot takes ownership of the item. Returns true on success, i.e. when \a item wasn't already in the plot and the parent plot of \a item is this QCustomPlot. This method is called automatically in the QCPAbstractItem base class constructor. */ bool QCustomPlot::registerItem(QCPAbstractItem *item) { if (mItems.contains(item)) { qDebug() << Q_FUNC_INFO << "item already added to this QCustomPlot:" << reinterpret_cast(item); return false; } if (item->parentPlot() != this) { qDebug() << Q_FUNC_INFO << "item not created with this QCustomPlot as parent:" << reinterpret_cast(item); return false; } mItems.append(item); if (!item->layer()) // usually the layer is already set in the constructor of the item (via QCPLayerable constructor) item->setLayer(currentLayer()); return true; } /*! \internal Assigns all layers their index (QCPLayer::mIndex) in the mLayers list. This method is thus called after every operation that changes the layer indices, like layer removal, layer creation, layer moving. */ void QCustomPlot::updateLayerIndices() const { for (int i=0; imIndex = i; } /*! \internal Returns the top-most layerable at pixel position \a pos. If \a onlySelectable is set to true, only those layerables that are selectable will be considered. (Layerable subclasses communicate their selectability via the QCPLayerable::selectTest method, by returning -1.) \a selectionDetails is an output parameter that contains selection specifics of the affected layerable. This is useful if the respective layerable shall be given a subsequent QCPLayerable::selectEvent (like in \ref mouseReleaseEvent). \a selectionDetails usually contains information about which part of the layerable was hit, in multi-part layerables (e.g. QCPAxis::SelectablePart). If the layerable is a plottable, \a selectionDetails contains a \ref QCPDataSelection instance with the single data point which is closest to \a pos. \see layerableListAt, layoutElementAt, axisRectAt */ QCPLayerable *QCustomPlot::layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails) const { QList details; QList candidates = layerableListAt(pos, onlySelectable, selectionDetails ? &details : 0); if (selectionDetails && !details.isEmpty()) *selectionDetails = details.first(); if (!candidates.isEmpty()) return candidates.first(); else return 0; } /*! \internal Returns the layerables at pixel position \a pos. If \a onlySelectable is set to true, only those layerables that are selectable will be considered. (Layerable subclasses communicate their selectability via the QCPLayerable::selectTest method, by returning -1.) The returned list is sorted by the layerable/drawing order. If you only need to know the top-most layerable, rather use \ref layerableAt. \a selectionDetails is an output parameter that contains selection specifics of the affected layerable. This is useful if the respective layerable shall be given a subsequent QCPLayerable::selectEvent (like in \ref mouseReleaseEvent). \a selectionDetails usually contains information about which part of the layerable was hit, in multi-part layerables (e.g. QCPAxis::SelectablePart). If the layerable is a plottable, \a selectionDetails contains a \ref QCPDataSelection instance with the single data point which is closest to \a pos. \see layerableAt, layoutElementAt, axisRectAt */ QList QCustomPlot::layerableListAt(const QPointF &pos, bool onlySelectable, QList *selectionDetails) const { QList result; for (int layerIndex=mLayers.size()-1; layerIndex>=0; --layerIndex) { const QList layerables = mLayers.at(layerIndex)->children(); for (int i=layerables.size()-1; i>=0; --i) { if (!layerables.at(i)->realVisibility()) continue; QVariant details; double dist = layerables.at(i)->selectTest(pos, onlySelectable, selectionDetails ? &details : 0); if (dist >= 0 && dist < selectionTolerance()) { result.append(layerables.at(i)); if (selectionDetails) selectionDetails->append(details); } } } return result; } /*! Saves the plot to a rastered image file \a fileName in the image format \a format. The plot is sized to \a width and \a height in pixels and scaled with \a scale. (width 100 and scale 2.0 lead to a full resolution file with width 200.) If the \a format supports compression, \a quality may be between 0 and 100 to control it. Returns true on success. If this function fails, most likely the given \a format isn't supported by the system, see Qt docs about QImageWriter::supportedImageFormats(). The \a resolution will be written to the image file header (if the file format supports this) and has no direct consequence for the quality or the pixel size. However, if opening the image with a tool which respects the metadata, it will be able to scale the image to match either a given size in real units of length (inch, centimeters, etc.), or the target display DPI. You can specify in which units \a resolution is given, by setting \a resolutionUnit. The \a resolution is converted to the format's expected resolution unit internally. \see saveBmp, saveJpg, savePng, savePdf */ bool QCustomPlot::saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality, int resolution, QCP::ResolutionUnit resolutionUnit) { QImage buffer = toPixmap(width, height, scale).toImage(); int dotsPerMeter = 0; switch (resolutionUnit) { case QCP::ruDotsPerMeter: dotsPerMeter = resolution; break; case QCP::ruDotsPerCentimeter: dotsPerMeter = resolution*100; break; case QCP::ruDotsPerInch: dotsPerMeter = resolution/0.0254; break; } buffer.setDotsPerMeterX(dotsPerMeter); // this is saved together with some image formats, e.g. PNG, and is relevant when opening image in other tools buffer.setDotsPerMeterY(dotsPerMeter); // this is saved together with some image formats, e.g. PNG, and is relevant when opening image in other tools if (!buffer.isNull()) return buffer.save(fileName, format, quality); else return false; } /*! Renders the plot to a pixmap and returns it. The plot is sized to \a width and \a height in pixels and scaled with \a scale. (width 100 and scale 2.0 lead to a full resolution pixmap with width 200.) \see toPainter, saveRastered, saveBmp, savePng, saveJpg, savePdf */ QPixmap QCustomPlot::toPixmap(int width, int height, double scale) { // this method is somewhat similar to toPainter. Change something here, and a change in toPainter might be necessary, too. int newWidth, newHeight; if (width == 0 || height == 0) { newWidth = this->width(); newHeight = this->height(); } else { newWidth = width; newHeight = height; } int scaledWidth = qRound(scale*newWidth); int scaledHeight = qRound(scale*newHeight); QPixmap result(scaledWidth, scaledHeight); result.fill(mBackgroundBrush.style() == Qt::SolidPattern ? mBackgroundBrush.color() : Qt::transparent); // if using non-solid pattern, make transparent now and draw brush pattern later QCPPainter painter; painter.begin(&result); if (painter.isActive()) { QRect oldViewport = viewport(); setViewport(QRect(0, 0, newWidth, newHeight)); painter.setMode(QCPPainter::pmNoCaching); if (!qFuzzyCompare(scale, 1.0)) { if (scale > 1.0) // for scale < 1 we always want cosmetic pens where possible, because else lines might disappear for very small scales painter.setMode(QCPPainter::pmNonCosmetic); painter.scale(scale, scale); } if (mBackgroundBrush.style() != Qt::SolidPattern && mBackgroundBrush.style() != Qt::NoBrush) // solid fills were done a few lines above with QPixmap::fill painter.fillRect(mViewport, mBackgroundBrush); draw(&painter); setViewport(oldViewport); painter.end(); } else // might happen if pixmap has width or height zero { qDebug() << Q_FUNC_INFO << "Couldn't activate painter on pixmap"; return QPixmap(); } return result; } /*! Renders the plot using the passed \a painter. The plot is sized to \a width and \a height in pixels. If the \a painter's scale is not 1.0, the resulting plot will appear scaled accordingly. \note If you are restricted to using a QPainter (instead of QCPPainter), create a temporary QPicture and open a QCPPainter on it. Then call \ref toPainter with this QCPPainter. After ending the paint operation on the picture, draw it with the QPainter. This will reproduce the painter actions the QCPPainter took, with a QPainter. \see toPixmap */ void QCustomPlot::toPainter(QCPPainter *painter, int width, int height) { // this method is somewhat similar to toPixmap. Change something here, and a change in toPixmap might be necessary, too. int newWidth, newHeight; if (width == 0 || height == 0) { newWidth = this->width(); newHeight = this->height(); } else { newWidth = width; newHeight = height; } if (painter->isActive()) { QRect oldViewport = viewport(); setViewport(QRect(0, 0, newWidth, newHeight)); painter->setMode(QCPPainter::pmNoCaching); if (mBackgroundBrush.style() != Qt::NoBrush) // unlike in toPixmap, we can't do QPixmap::fill for Qt::SolidPattern brush style, so we also draw solid fills with fillRect here painter->fillRect(mViewport, mBackgroundBrush); draw(painter); setViewport(oldViewport); } else qDebug() << Q_FUNC_INFO << "Passed painter is not active"; } /* end of 'src/core.cpp' */ //amalgamation: add plottable1d.cpp /* including file 'src/colorgradient.cpp', size 24646 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPColorGradient //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPColorGradient \brief Defines a color gradient for use with e.g. \ref QCPColorMap This class describes a color gradient which can be used to encode data with color. For example, QCPColorMap and QCPColorScale have \ref QCPColorMap::setGradient "setGradient" methods which take an instance of this class. Colors are set with \ref setColorStopAt(double position, const QColor &color) with a \a position from 0 to 1. In between these defined color positions, the color will be interpolated linearly either in RGB or HSV space, see \ref setColorInterpolation. Alternatively, load one of the preset color gradients shown in the image below, with \ref loadPreset, or by directly specifying the preset in the constructor. Apart from red, green and blue components, the gradient also interpolates the alpha values of the configured color stops. This allows to display some portions of the data range as transparent in the plot. \image html QCPColorGradient.png The \ref QCPColorGradient(GradientPreset preset) constructor allows directly converting a \ref GradientPreset to a QCPColorGradient. This means that you can directly pass \ref GradientPreset to all the \a setGradient methods, e.g.: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcolorgradient-setgradient The total number of levels used in the gradient can be set with \ref setLevelCount. Whether the color gradient shall be applied periodically (wrapping around) to data values that lie outside the data range specified on the plottable instance can be controlled with \ref setPeriodic. */ /*! Constructs a new, empty QCPColorGradient with no predefined color stops. You can add own color stops with \ref setColorStopAt. The color level count is initialized to 350. */ QCPColorGradient::QCPColorGradient() : mLevelCount(350), mColorInterpolation(ciRGB), mPeriodic(false), mColorBufferInvalidated(true) { mColorBuffer.fill(qRgb(0, 0, 0), mLevelCount); } /*! Constructs a new QCPColorGradient initialized with the colors and color interpolation according to \a preset. The color level count is initialized to 350. */ QCPColorGradient::QCPColorGradient(GradientPreset preset) : mLevelCount(350), mColorInterpolation(ciRGB), mPeriodic(false), mColorBufferInvalidated(true) { mColorBuffer.fill(qRgb(0, 0, 0), mLevelCount); loadPreset(preset); } /* undocumented operator */ bool QCPColorGradient::operator==(const QCPColorGradient &other) const { return ((other.mLevelCount == this->mLevelCount) && (other.mColorInterpolation == this->mColorInterpolation) && (other.mPeriodic == this->mPeriodic) && (other.mColorStops == this->mColorStops)); } /*! Sets the number of discretization levels of the color gradient to \a n. The default is 350 which is typically enough to create a smooth appearance. The minimum number of levels is 2. \image html QCPColorGradient-levelcount.png */ void QCPColorGradient::setLevelCount(int n) { if (n < 2) { qDebug() << Q_FUNC_INFO << "n must be greater or equal 2 but was" << n; n = 2; } if (n != mLevelCount) { mLevelCount = n; mColorBufferInvalidated = true; } } /*! Sets at which positions from 0 to 1 which color shall occur. The positions are the keys, the colors are the values of the passed QMap \a colorStops. In between these color stops, the color is interpolated according to \ref setColorInterpolation. A more convenient way to create a custom gradient may be to clear all color stops with \ref clearColorStops (or creating a new, empty QCPColorGradient) and then adding them one by one with \ref setColorStopAt. \see clearColorStops */ void QCPColorGradient::setColorStops(const QMap &colorStops) { mColorStops = colorStops; mColorBufferInvalidated = true; } /*! Sets the \a color the gradient will have at the specified \a position (from 0 to 1). In between these color stops, the color is interpolated according to \ref setColorInterpolation. \see setColorStops, clearColorStops */ void QCPColorGradient::setColorStopAt(double position, const QColor &color) { mColorStops.insert(position, color); mColorBufferInvalidated = true; } /*! Sets whether the colors in between the configured color stops (see \ref setColorStopAt) shall be interpolated linearly in RGB or in HSV color space. For example, a sweep in RGB space from red to green will have a muddy brown intermediate color, whereas in HSV space the intermediate color is yellow. */ void QCPColorGradient::setColorInterpolation(QCPColorGradient::ColorInterpolation interpolation) { if (interpolation != mColorInterpolation) { mColorInterpolation = interpolation; mColorBufferInvalidated = true; } } /*! Sets whether data points that are outside the configured data range (e.g. \ref QCPColorMap::setDataRange) are colored by periodically repeating the color gradient or whether they all have the same color, corresponding to the respective gradient boundary color. \image html QCPColorGradient-periodic.png As shown in the image above, gradients that have the same start and end color are especially suitable for a periodic gradient mapping, since they produce smooth color transitions throughout the color map. A preset that has this property is \ref gpHues. In practice, using periodic color gradients makes sense when the data corresponds to a periodic dimension, such as an angle or a phase. If this is not the case, the color encoding might become ambiguous, because multiple different data values are shown as the same color. */ void QCPColorGradient::setPeriodic(bool enabled) { mPeriodic = enabled; } /*! \overload This method is used to quickly convert a \a data array to colors. The colors will be output in the array \a scanLine. Both \a data and \a scanLine must have the length \a n when passed to this function. The data range that shall be used for mapping the data value to the gradient is passed in \a range. \a logarithmic indicates whether the data values shall be mapped to colors logarithmically. if \a data actually contains 2D-data linearized via [row*columnCount + column], you can set \a dataIndexFactor to columnCount to convert a column instead of a row of the data array, in \a scanLine. \a scanLine will remain a regular (1D) array. This works because \a data is addressed data[i*dataIndexFactor]. Use the overloaded method to additionally provide alpha map data. The QRgb values that are placed in \a scanLine have their r, g and b components premultiplied with alpha (see QImage::Format_ARGB32_Premultiplied). */ void QCPColorGradient::colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor, bool logarithmic) { // If you change something here, make sure to also adapt color() and the other colorize() overload if (!data) { qDebug() << Q_FUNC_INFO << "null pointer given as data"; return; } if (!scanLine) { qDebug() << Q_FUNC_INFO << "null pointer given as scanLine"; return; } if (mColorBufferInvalidated) updateColorBuffer(); if (!logarithmic) { const double posToIndexFactor = (mLevelCount-1)/range.size(); if (mPeriodic) { for (int i=0; i= mLevelCount) index = mLevelCount-1; scanLine[i] = mColorBuffer.at(index); } } } else // logarithmic == true { if (mPeriodic) { for (int i=0; i= mLevelCount) index = mLevelCount-1; scanLine[i] = mColorBuffer.at(index); } } } } /*! \overload Additionally to the other overload of \ref colorize, this method takes the array \a alpha, which has the same size and structure as \a data and encodes the alpha information per data point. The QRgb values that are placed in \a scanLine have their r, g and b components premultiplied with alpha (see QImage::Format_ARGB32_Premultiplied). */ void QCPColorGradient::colorize(const double *data, const unsigned char *alpha, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor, bool logarithmic) { // If you change something here, make sure to also adapt color() and the other colorize() overload if (!data) { qDebug() << Q_FUNC_INFO << "null pointer given as data"; return; } if (!alpha) { qDebug() << Q_FUNC_INFO << "null pointer given as alpha"; return; } if (!scanLine) { qDebug() << Q_FUNC_INFO << "null pointer given as scanLine"; return; } if (mColorBufferInvalidated) updateColorBuffer(); if (!logarithmic) { const double posToIndexFactor = (mLevelCount-1)/range.size(); if (mPeriodic) { for (int i=0; i= mLevelCount) index = mLevelCount-1; if (alpha[dataIndexFactor*i] == 255) { scanLine[i] = mColorBuffer.at(index); } else { const QRgb rgb = mColorBuffer.at(index); const float alphaF = alpha[dataIndexFactor*i]/255.0f; scanLine[i] = qRgba(qRed(rgb)*alphaF, qGreen(rgb)*alphaF, qBlue(rgb)*alphaF, qAlpha(rgb)*alphaF); } } } } else // logarithmic == true { if (mPeriodic) { for (int i=0; i= mLevelCount) index = mLevelCount-1; if (alpha[dataIndexFactor*i] == 255) { scanLine[i] = mColorBuffer.at(index); } else { const QRgb rgb = mColorBuffer.at(index); const float alphaF = alpha[dataIndexFactor*i]/255.0f; scanLine[i] = qRgba(qRed(rgb)*alphaF, qGreen(rgb)*alphaF, qBlue(rgb)*alphaF, qAlpha(rgb)*alphaF); } } } } } /*! \internal This method is used to colorize a single data value given in \a position, to colors. The data range that shall be used for mapping the data value to the gradient is passed in \a range. \a logarithmic indicates whether the data value shall be mapped to a color logarithmically. If an entire array of data values shall be converted, rather use \ref colorize, for better performance. The returned QRgb has its r, g and b components premultiplied with alpha (see QImage::Format_ARGB32_Premultiplied). */ QRgb QCPColorGradient::color(double position, const QCPRange &range, bool logarithmic) { // If you change something here, make sure to also adapt ::colorize() if (mColorBufferInvalidated) updateColorBuffer(); int index = 0; if (!logarithmic) index = (position-range.lower)*(mLevelCount-1)/range.size(); else index = qLn(position/range.lower)/qLn(range.upper/range.lower)*(mLevelCount-1); if (mPeriodic) { index = index % mLevelCount; if (index < 0) index += mLevelCount; } else { if (index < 0) index = 0; else if (index >= mLevelCount) index = mLevelCount-1; } return mColorBuffer.at(index); } /*! Clears the current color stops and loads the specified \a preset. A preset consists of predefined color stops and the corresponding color interpolation method. The available presets are: \image html QCPColorGradient.png */ void QCPColorGradient::loadPreset(GradientPreset preset) { clearColorStops(); switch (preset) { case gpGrayscale: setColorInterpolation(ciRGB); setColorStopAt(0, Qt::black); setColorStopAt(1, Qt::white); break; case gpHot: setColorInterpolation(ciRGB); setColorStopAt(0, QColor(50, 0, 0)); setColorStopAt(0.2, QColor(180, 10, 0)); setColorStopAt(0.4, QColor(245, 50, 0)); setColorStopAt(0.6, QColor(255, 150, 10)); setColorStopAt(0.8, QColor(255, 255, 50)); setColorStopAt(1, QColor(255, 255, 255)); break; case gpCold: setColorInterpolation(ciRGB); setColorStopAt(0, QColor(0, 0, 50)); setColorStopAt(0.2, QColor(0, 10, 180)); setColorStopAt(0.4, QColor(0, 50, 245)); setColorStopAt(0.6, QColor(10, 150, 255)); setColorStopAt(0.8, QColor(50, 255, 255)); setColorStopAt(1, QColor(255, 255, 255)); break; case gpNight: setColorInterpolation(ciHSV); setColorStopAt(0, QColor(10, 20, 30)); setColorStopAt(1, QColor(250, 255, 250)); break; case gpCandy: setColorInterpolation(ciHSV); setColorStopAt(0, QColor(0, 0, 255)); setColorStopAt(1, QColor(255, 250, 250)); break; case gpGeography: setColorInterpolation(ciRGB); setColorStopAt(0, QColor(70, 170, 210)); setColorStopAt(0.20, QColor(90, 160, 180)); setColorStopAt(0.25, QColor(45, 130, 175)); setColorStopAt(0.30, QColor(100, 140, 125)); setColorStopAt(0.5, QColor(100, 140, 100)); setColorStopAt(0.6, QColor(130, 145, 120)); setColorStopAt(0.7, QColor(140, 130, 120)); setColorStopAt(0.9, QColor(180, 190, 190)); setColorStopAt(1, QColor(210, 210, 230)); break; case gpIon: setColorInterpolation(ciHSV); setColorStopAt(0, QColor(50, 10, 10)); setColorStopAt(0.45, QColor(0, 0, 255)); setColorStopAt(0.8, QColor(0, 255, 255)); setColorStopAt(1, QColor(0, 255, 0)); break; case gpThermal: setColorInterpolation(ciRGB); setColorStopAt(0, QColor(0, 0, 50)); setColorStopAt(0.15, QColor(20, 0, 120)); setColorStopAt(0.33, QColor(200, 30, 140)); setColorStopAt(0.6, QColor(255, 100, 0)); setColorStopAt(0.85, QColor(255, 255, 40)); setColorStopAt(1, QColor(255, 255, 255)); break; case gpPolar: setColorInterpolation(ciRGB); setColorStopAt(0, QColor(50, 255, 255)); setColorStopAt(0.18, QColor(10, 70, 255)); setColorStopAt(0.28, QColor(10, 10, 190)); setColorStopAt(0.5, QColor(0, 0, 0)); setColorStopAt(0.72, QColor(190, 10, 10)); setColorStopAt(0.82, QColor(255, 70, 10)); setColorStopAt(1, QColor(255, 255, 50)); break; case gpSpectrum: setColorInterpolation(ciHSV); setColorStopAt(0, QColor(50, 0, 50)); setColorStopAt(0.15, QColor(0, 0, 255)); setColorStopAt(0.35, QColor(0, 255, 255)); setColorStopAt(0.6, QColor(255, 255, 0)); setColorStopAt(0.75, QColor(255, 30, 0)); setColorStopAt(1, QColor(50, 0, 0)); break; case gpJet: setColorInterpolation(ciRGB); setColorStopAt(0, QColor(0, 0, 100)); setColorStopAt(0.15, QColor(0, 50, 255)); setColorStopAt(0.35, QColor(0, 255, 255)); setColorStopAt(0.65, QColor(255, 255, 0)); setColorStopAt(0.85, QColor(255, 30, 0)); setColorStopAt(1, QColor(100, 0, 0)); break; case gpHues: setColorInterpolation(ciHSV); setColorStopAt(0, QColor(255, 0, 0)); setColorStopAt(1.0/3.0, QColor(0, 0, 255)); setColorStopAt(2.0/3.0, QColor(0, 255, 0)); setColorStopAt(1, QColor(255, 0, 0)); break; } } /*! Clears all color stops. \see setColorStops, setColorStopAt */ void QCPColorGradient::clearColorStops() { mColorStops.clear(); mColorBufferInvalidated = true; } /*! Returns an inverted gradient. The inverted gradient has all properties as this \ref QCPColorGradient, but the order of the color stops is inverted. \see setColorStops, setColorStopAt */ QCPColorGradient QCPColorGradient::inverted() const { QCPColorGradient result(*this); result.clearColorStops(); for (QMap::const_iterator it=mColorStops.constBegin(); it!=mColorStops.constEnd(); ++it) result.setColorStopAt(1.0-it.key(), it.value()); return result; } /*! \internal Returns true if the color gradient uses transparency, i.e. if any of the configured color stops has an alpha value below 255. */ bool QCPColorGradient::stopsUseAlpha() const { for (QMap::const_iterator it=mColorStops.constBegin(); it!=mColorStops.constEnd(); ++it) { if (it.value().alpha() < 255) return true; } return false; } /*! \internal Updates the internal color buffer which will be used by \ref colorize and \ref color, to quickly convert positions to colors. This is where the interpolation between color stops is calculated. */ void QCPColorGradient::updateColorBuffer() { if (mColorBuffer.size() != mLevelCount) mColorBuffer.resize(mLevelCount); if (mColorStops.size() > 1) { double indexToPosFactor = 1.0/(double)(mLevelCount-1); const bool useAlpha = stopsUseAlpha(); for (int i=0; i::const_iterator it = mColorStops.lowerBound(position); if (it == mColorStops.constEnd()) // position is on or after last stop, use color of last stop { mColorBuffer[i] = (it-1).value().rgba(); } else if (it == mColorStops.constBegin()) // position is on or before first stop, use color of first stop { mColorBuffer[i] = it.value().rgba(); } else // position is in between stops (or on an intermediate stop), interpolate color { QMap::const_iterator high = it; QMap::const_iterator low = it-1; double t = (position-low.key())/(high.key()-low.key()); // interpolation factor 0..1 switch (mColorInterpolation) { case ciRGB: { if (useAlpha) { const int alpha = (1-t)*low.value().alpha() + t*high.value().alpha(); const float alphaPremultiplier = alpha/255.0f; // since we use QImage::Format_ARGB32_Premultiplied mColorBuffer[i] = qRgba(((1-t)*low.value().red() + t*high.value().red())*alphaPremultiplier, ((1-t)*low.value().green() + t*high.value().green())*alphaPremultiplier, ((1-t)*low.value().blue() + t*high.value().blue())*alphaPremultiplier, alpha); } else { mColorBuffer[i] = qRgb(((1-t)*low.value().red() + t*high.value().red()), ((1-t)*low.value().green() + t*high.value().green()), ((1-t)*low.value().blue() + t*high.value().blue())); } break; } case ciHSV: { QColor lowHsv = low.value().toHsv(); QColor highHsv = high.value().toHsv(); double hue = 0; double hueDiff = highHsv.hueF()-lowHsv.hueF(); if (hueDiff > 0.5) hue = lowHsv.hueF() - t*(1.0-hueDiff); else if (hueDiff < -0.5) hue = lowHsv.hueF() + t*(1.0+hueDiff); else hue = lowHsv.hueF() + t*hueDiff; if (hue < 0) hue += 1.0; else if (hue >= 1.0) hue -= 1.0; if (useAlpha) { const QRgb rgb = QColor::fromHsvF(hue, (1-t)*lowHsv.saturationF() + t*highHsv.saturationF(), (1-t)*lowHsv.valueF() + t*highHsv.valueF()).rgb(); const float alpha = (1-t)*lowHsv.alphaF() + t*highHsv.alphaF(); mColorBuffer[i] = qRgba(qRed(rgb)*alpha, qGreen(rgb)*alpha, qBlue(rgb)*alpha, 255*alpha); } else { mColorBuffer[i] = QColor::fromHsvF(hue, (1-t)*lowHsv.saturationF() + t*highHsv.saturationF(), (1-t)*lowHsv.valueF() + t*highHsv.valueF()).rgb(); } break; } } } } } else if (mColorStops.size() == 1) { const QRgb rgb = mColorStops.constBegin().value().rgb(); const float alpha = mColorStops.constBegin().value().alphaF(); mColorBuffer.fill(qRgba(qRed(rgb)*alpha, qGreen(rgb)*alpha, qBlue(rgb)*alpha, 255*alpha)); } else // mColorStops is empty, fill color buffer with black { mColorBuffer.fill(qRgb(0, 0, 0)); } mColorBufferInvalidated = false; } /* end of 'src/colorgradient.cpp' */ /* including file 'src/selectiondecorator-bracket.cpp', size 12313 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPSelectionDecoratorBracket //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPSelectionDecoratorBracket \brief A selection decorator which draws brackets around each selected data segment Additionally to the regular highlighting of selected segments via color, fill and scatter style, this \ref QCPSelectionDecorator subclass draws markers at the begin and end of each selected data segment of the plottable. The shape of the markers can be controlled with \ref setBracketStyle, \ref setBracketWidth and \ref setBracketHeight. The color/fill can be controlled with \ref setBracketPen and \ref setBracketBrush. To introduce custom bracket styles, it is only necessary to sublcass \ref QCPSelectionDecoratorBracket and reimplement \ref drawBracket. The rest will be managed by the base class. */ /*! Creates a new QCPSelectionDecoratorBracket instance with default values. */ QCPSelectionDecoratorBracket::QCPSelectionDecoratorBracket() : mBracketPen(QPen(Qt::black)), mBracketBrush(Qt::NoBrush), mBracketWidth(5), mBracketHeight(50), mBracketStyle(bsSquareBracket), mTangentToData(false), mTangentAverage(2) { } QCPSelectionDecoratorBracket::~QCPSelectionDecoratorBracket() { } /*! Sets the pen that will be used to draw the brackets at the beginning and end of each selected data segment. */ void QCPSelectionDecoratorBracket::setBracketPen(const QPen &pen) { mBracketPen = pen; } /*! Sets the brush that will be used to draw the brackets at the beginning and end of each selected data segment. */ void QCPSelectionDecoratorBracket::setBracketBrush(const QBrush &brush) { mBracketBrush = brush; } /*! Sets the width of the drawn bracket. The width dimension is always parallel to the key axis of the data, or the tangent direction of the current data slope, if \ref setTangentToData is enabled. */ void QCPSelectionDecoratorBracket::setBracketWidth(int width) { mBracketWidth = width; } /*! Sets the height of the drawn bracket. The height dimension is always perpendicular to the key axis of the data, or the tangent direction of the current data slope, if \ref setTangentToData is enabled. */ void QCPSelectionDecoratorBracket::setBracketHeight(int height) { mBracketHeight = height; } /*! Sets the shape that the bracket/marker will have. \see setBracketWidth, setBracketHeight */ void QCPSelectionDecoratorBracket::setBracketStyle(QCPSelectionDecoratorBracket::BracketStyle style) { mBracketStyle = style; } /*! Sets whether the brackets will be rotated such that they align with the slope of the data at the position that they appear in. For noisy data, it might be more visually appealing to average the slope over multiple data points. This can be configured via \ref setTangentAverage. */ void QCPSelectionDecoratorBracket::setTangentToData(bool enabled) { mTangentToData = enabled; } /*! Controls over how many data points the slope shall be averaged, when brackets shall be aligned with the data (if \ref setTangentToData is true). From the position of the bracket, \a pointCount points towards the selected data range will be taken into account. The smallest value of \a pointCount is 1, which is effectively equivalent to disabling \ref setTangentToData. */ void QCPSelectionDecoratorBracket::setTangentAverage(int pointCount) { mTangentAverage = pointCount; if (mTangentAverage < 1) mTangentAverage = 1; } /*! Draws the bracket shape with \a painter. The parameter \a direction is either -1 or 1 and indicates whether the bracket shall point to the left or the right (i.e. is a closing or opening bracket, respectively). The passed \a painter already contains all transformations that are necessary to position and rotate the bracket appropriately. Painting operations can be performed as if drawing upright brackets on flat data with horizontal key axis, with (0, 0) being the center of the bracket. If you wish to sublcass \ref QCPSelectionDecoratorBracket in order to provide custom bracket shapes (see \ref QCPSelectionDecoratorBracket::bsUserStyle), this is the method you should reimplement. */ void QCPSelectionDecoratorBracket::drawBracket(QCPPainter *painter, int direction) const { switch (mBracketStyle) { case bsSquareBracket: { painter->drawLine(QLineF(mBracketWidth*direction, -mBracketHeight*0.5, 0, -mBracketHeight*0.5)); painter->drawLine(QLineF(mBracketWidth*direction, mBracketHeight*0.5, 0, mBracketHeight*0.5)); painter->drawLine(QLineF(0, -mBracketHeight*0.5, 0, mBracketHeight*0.5)); break; } case bsHalfEllipse: { painter->drawArc(-mBracketWidth*0.5, -mBracketHeight*0.5, mBracketWidth, mBracketHeight, -90*16, -180*16*direction); break; } case bsEllipse: { painter->drawEllipse(-mBracketWidth*0.5, -mBracketHeight*0.5, mBracketWidth, mBracketHeight); break; } case bsPlus: { painter->drawLine(QLineF(0, -mBracketHeight*0.5, 0, mBracketHeight*0.5)); painter->drawLine(QLineF(-mBracketWidth*0.5, 0, mBracketWidth*0.5, 0)); break; } default: { qDebug() << Q_FUNC_INFO << "unknown/custom bracket style can't be handeld by default implementation:" << static_cast(mBracketStyle); break; } } } /*! Draws the bracket decoration on the data points at the begin and end of each selected data segment given in \a seletion. It uses the method \ref drawBracket to actually draw the shapes. \seebaseclassmethod */ void QCPSelectionDecoratorBracket::drawDecoration(QCPPainter *painter, QCPDataSelection selection) { if (!mPlottable || selection.isEmpty()) return; if (QCPPlottableInterface1D *interface1d = mPlottable->interface1D()) { foreach (const QCPDataRange &dataRange, selection.dataRanges()) { // determine position and (if tangent mode is enabled) angle of brackets: int openBracketDir = (mPlottable->keyAxis() && !mPlottable->keyAxis()->rangeReversed()) ? 1 : -1; int closeBracketDir = -openBracketDir; QPointF openBracketPos = getPixelCoordinates(interface1d, dataRange.begin()); QPointF closeBracketPos = getPixelCoordinates(interface1d, dataRange.end()-1); double openBracketAngle = 0; double closeBracketAngle = 0; if (mTangentToData) { openBracketAngle = getTangentAngle(interface1d, dataRange.begin(), openBracketDir); closeBracketAngle = getTangentAngle(interface1d, dataRange.end()-1, closeBracketDir); } // draw opening bracket: QTransform oldTransform = painter->transform(); painter->setPen(mBracketPen); painter->setBrush(mBracketBrush); painter->translate(openBracketPos); painter->rotate(openBracketAngle/M_PI*180.0); drawBracket(painter, openBracketDir); painter->setTransform(oldTransform); // draw closing bracket: painter->setPen(mBracketPen); painter->setBrush(mBracketBrush); painter->translate(closeBracketPos); painter->rotate(closeBracketAngle/M_PI*180.0); drawBracket(painter, closeBracketDir); painter->setTransform(oldTransform); } } } /*! \internal If \ref setTangentToData is enabled, brackets need to be rotated according to the data slope. This method returns the angle in radians by which a bracket at the given \a dataIndex must be rotated. The parameter \a direction must be set to either -1 or 1, representing whether it is an opening or closing bracket. Since for slope calculation multiple data points are required, this defines the direction in which the algorithm walks, starting at \a dataIndex, to average those data points. (see \ref setTangentToData and \ref setTangentAverage) \a interface1d is the interface to the plottable's data which is used to query data coordinates. */ double QCPSelectionDecoratorBracket::getTangentAngle(const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const { if (!interface1d || dataIndex < 0 || dataIndex >= interface1d->dataCount()) return 0; direction = direction < 0 ? -1 : 1; // enforce direction is either -1 or 1 // how many steps we can actually go from index in the given direction without exceeding data bounds: int averageCount; if (direction < 0) averageCount = qMin(mTangentAverage, dataIndex); else averageCount = qMin(mTangentAverage, interface1d->dataCount()-1-dataIndex); qDebug() << averageCount; // calculate point average of averageCount points: QVector points(averageCount); QPointF pointsAverage; int currentIndex = dataIndex; for (int i=0; ikeyAxis(); QCPAxis *valueAxis = mPlottable->valueAxis(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(0, 0); } if (keyAxis->orientation() == Qt::Horizontal) return QPointF(keyAxis->coordToPixel(interface1d->dataMainKey(dataIndex)), valueAxis->coordToPixel(interface1d->dataMainValue(dataIndex))); else return QPointF(valueAxis->coordToPixel(interface1d->dataMainValue(dataIndex)), keyAxis->coordToPixel(interface1d->dataMainKey(dataIndex))); } /* end of 'src/selectiondecorator-bracket.cpp' */ /* including file 'src/layoutelements/layoutelement-axisrect.cpp', size 47509 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAxisRect //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAxisRect \brief Holds multiple axes and arranges them in a rectangular shape. This class represents an axis rect, a rectangular area that is bounded on all sides with an arbitrary number of axes. Initially QCustomPlot has one axis rect, accessible via QCustomPlot::axisRect(). However, the layout system allows to have multiple axis rects, e.g. arranged in a grid layout (QCustomPlot::plotLayout). By default, QCPAxisRect comes with four axes, at bottom, top, left and right. They can be accessed via \ref axis by providing the respective axis type (\ref QCPAxis::AxisType) and index. If you need all axes in the axis rect, use \ref axes. The top and right axes are set to be invisible initially (QCPAxis::setVisible). To add more axes to a side, use \ref addAxis or \ref addAxes. To remove an axis, use \ref removeAxis. The axis rect layerable itself only draws a background pixmap or color, if specified (\ref setBackground). It is placed on the "background" layer initially (see \ref QCPLayer for an explanation of the QCustomPlot layer system). The axes that are held by the axis rect can be placed on other layers, independently of the axis rect. Every axis rect has a child layout of type \ref QCPLayoutInset. It is accessible via \ref insetLayout and can be used to have other layout elements (or even other layouts with multiple elements) hovering inside the axis rect. If an axis rect is clicked and dragged, it processes this by moving certain axis ranges. The behaviour can be controlled with \ref setRangeDrag and \ref setRangeDragAxes. If the mouse wheel is scrolled while the cursor is on the axis rect, certain axes are scaled. This is controllable via \ref setRangeZoom, \ref setRangeZoomAxes and \ref setRangeZoomFactor. These interactions are only enabled if \ref QCustomPlot::setInteractions contains \ref QCP::iRangeDrag and \ref QCP::iRangeZoom. \image html AxisRectSpacingOverview.png
Overview of the spacings and paddings that define the geometry of an axis. The dashed line on the far left indicates the viewport/widget border.
*/ /* start documentation of inline functions */ /*! \fn QCPLayoutInset *QCPAxisRect::insetLayout() const Returns the inset layout of this axis rect. It can be used to place other layout elements (or even layouts with multiple other elements) inside/on top of an axis rect. \see QCPLayoutInset */ /*! \fn int QCPAxisRect::left() const Returns the pixel position of the left border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn int QCPAxisRect::right() const Returns the pixel position of the right border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn int QCPAxisRect::top() const Returns the pixel position of the top border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn int QCPAxisRect::bottom() const Returns the pixel position of the bottom border of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn int QCPAxisRect::width() const Returns the pixel width of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn int QCPAxisRect::height() const Returns the pixel height of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn QSize QCPAxisRect::size() const Returns the pixel size of this axis rect. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn QPoint QCPAxisRect::topLeft() const Returns the top left corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn QPoint QCPAxisRect::topRight() const Returns the top right corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn QPoint QCPAxisRect::bottomLeft() const Returns the bottom left corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn QPoint QCPAxisRect::bottomRight() const Returns the bottom right corner of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /*! \fn QPoint QCPAxisRect::center() const Returns the center of this axis rect in pixels. Margins are not taken into account here, so the returned value is with respect to the inner \ref rect. */ /* end documentation of inline functions */ /*! Creates a QCPAxisRect instance and sets default values. An axis is added for each of the four sides, the top and right axes are set invisible initially. */ QCPAxisRect::QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes) : QCPLayoutElement(parentPlot), mBackgroundBrush(Qt::NoBrush), mBackgroundScaled(true), mBackgroundScaledMode(Qt::KeepAspectRatioByExpanding), mInsetLayout(new QCPLayoutInset), mRangeDrag(Qt::Horizontal|Qt::Vertical), mRangeZoom(Qt::Horizontal|Qt::Vertical), mRangeZoomFactorHorz(0.85), mRangeZoomFactorVert(0.85), mDragging(false) { mInsetLayout->initializeParentPlot(mParentPlot); mInsetLayout->setParentLayerable(this); mInsetLayout->setParent(this); setMinimumSize(50, 50); setMinimumMargins(QMargins(15, 15, 15, 15)); mAxes.insert(QCPAxis::atLeft, QList()); mAxes.insert(QCPAxis::atRight, QList()); mAxes.insert(QCPAxis::atTop, QList()); mAxes.insert(QCPAxis::atBottom, QList()); if (setupDefaultAxes) { QCPAxis *xAxis = addAxis(QCPAxis::atBottom); QCPAxis *yAxis = addAxis(QCPAxis::atLeft); QCPAxis *xAxis2 = addAxis(QCPAxis::atTop); QCPAxis *yAxis2 = addAxis(QCPAxis::atRight); setRangeDragAxes(xAxis, yAxis); setRangeZoomAxes(xAxis, yAxis); xAxis2->setVisible(false); yAxis2->setVisible(false); xAxis->grid()->setVisible(true); yAxis->grid()->setVisible(true); xAxis2->grid()->setVisible(false); yAxis2->grid()->setVisible(false); xAxis2->grid()->setZeroLinePen(Qt::NoPen); yAxis2->grid()->setZeroLinePen(Qt::NoPen); xAxis2->grid()->setVisible(false); yAxis2->grid()->setVisible(false); } } QCPAxisRect::~QCPAxisRect() { delete mInsetLayout; mInsetLayout = 0; QList axesList = axes(); for (int i=0; i ax(mAxes.value(type)); if (index >= 0 && index < ax.size()) { return ax.at(index); } else { qDebug() << Q_FUNC_INFO << "Axis index out of bounds:" << index; return 0; } } /*! Returns all axes on the axis rect sides specified with \a types. \a types may be a single \ref QCPAxis::AxisType or an or-combination, to get the axes of multiple sides. \see axis */ QList QCPAxisRect::axes(QCPAxis::AxisTypes types) const { QList result; if (types.testFlag(QCPAxis::atLeft)) result << mAxes.value(QCPAxis::atLeft); if (types.testFlag(QCPAxis::atRight)) result << mAxes.value(QCPAxis::atRight); if (types.testFlag(QCPAxis::atTop)) result << mAxes.value(QCPAxis::atTop); if (types.testFlag(QCPAxis::atBottom)) result << mAxes.value(QCPAxis::atBottom); return result; } /*! \overload Returns all axes of this axis rect. */ QList QCPAxisRect::axes() const { QList result; QHashIterator > it(mAxes); while (it.hasNext()) { it.next(); result << it.value(); } return result; } /*! Adds a new axis to the axis rect side specified with \a type, and returns it. If \a axis is 0, a new QCPAxis instance is created internally. QCustomPlot owns the returned axis, so if you want to remove an axis, use \ref removeAxis instead of deleting it manually. You may inject QCPAxis instances (or sublasses of QCPAxis) by setting \a axis to an axis that was previously created outside QCustomPlot. It is important to note that QCustomPlot takes ownership of the axis, so you may not delete it afterwards. Further, the \a axis must have been created with this axis rect as parent and with the same axis type as specified in \a type. If this is not the case, a debug output is generated, the axis is not added, and the method returns 0. This method can not be used to move \a axis between axis rects. The same \a axis instance must not be added multiple times to the same or different axis rects. If an axis rect side already contains one or more axes, the lower and upper endings of the new axis (\ref QCPAxis::setLowerEnding, \ref QCPAxis::setUpperEnding) are set to \ref QCPLineEnding::esHalfBar. \see addAxes, setupFullAxesBox */ QCPAxis *QCPAxisRect::addAxis(QCPAxis::AxisType type, QCPAxis *axis) { QCPAxis *newAxis = axis; if (!newAxis) { newAxis = new QCPAxis(this, type); } else // user provided existing axis instance, do some sanity checks { if (newAxis->axisType() != type) { qDebug() << Q_FUNC_INFO << "passed axis has different axis type than specified in type parameter"; return 0; } if (newAxis->axisRect() != this) { qDebug() << Q_FUNC_INFO << "passed axis doesn't have this axis rect as parent axis rect"; return 0; } if (axes().contains(newAxis)) { qDebug() << Q_FUNC_INFO << "passed axis is already owned by this axis rect"; return 0; } } if (mAxes[type].size() > 0) // multiple axes on one side, add half-bar axis ending to additional axes with offset { bool invert = (type == QCPAxis::atRight) || (type == QCPAxis::atBottom); newAxis->setLowerEnding(QCPLineEnding(QCPLineEnding::esHalfBar, 6, 10, !invert)); newAxis->setUpperEnding(QCPLineEnding(QCPLineEnding::esHalfBar, 6, 10, invert)); } mAxes[type].append(newAxis); // reset convenience axis pointers on parent QCustomPlot if they are unset: if (mParentPlot && mParentPlot->axisRectCount() > 0 && mParentPlot->axisRect(0) == this) { switch (type) { case QCPAxis::atBottom: { if (!mParentPlot->xAxis) mParentPlot->xAxis = newAxis; break; } case QCPAxis::atLeft: { if (!mParentPlot->yAxis) mParentPlot->yAxis = newAxis; break; } case QCPAxis::atTop: { if (!mParentPlot->xAxis2) mParentPlot->xAxis2 = newAxis; break; } case QCPAxis::atRight: { if (!mParentPlot->yAxis2) mParentPlot->yAxis2 = newAxis; break; } } } return newAxis; } /*! Adds a new axis with \ref addAxis to each axis rect side specified in \a types. This may be an or-combination of QCPAxis::AxisType, so axes can be added to multiple sides at once. Returns a list of the added axes. \see addAxis, setupFullAxesBox */ QList QCPAxisRect::addAxes(QCPAxis::AxisTypes types) { QList result; if (types.testFlag(QCPAxis::atLeft)) result << addAxis(QCPAxis::atLeft); if (types.testFlag(QCPAxis::atRight)) result << addAxis(QCPAxis::atRight); if (types.testFlag(QCPAxis::atTop)) result << addAxis(QCPAxis::atTop); if (types.testFlag(QCPAxis::atBottom)) result << addAxis(QCPAxis::atBottom); return result; } /*! Removes the specified \a axis from the axis rect and deletes it. Returns true on success, i.e. if \a axis was a valid axis in this axis rect. \see addAxis */ bool QCPAxisRect::removeAxis(QCPAxis *axis) { // don't access axis->axisType() to provide safety when axis is an invalid pointer, rather go through all axis containers: QHashIterator > it(mAxes); while (it.hasNext()) { it.next(); if (it.value().contains(axis)) { mAxes[it.key()].removeOne(axis); if (qobject_cast(parentPlot())) // make sure this isn't called from QObject dtor when QCustomPlot is already destructed (happens when the axis rect is not in any layout and thus QObject-child of QCustomPlot) parentPlot()->axisRemoved(axis); delete axis; return true; } } qDebug() << Q_FUNC_INFO << "Axis isn't in axis rect:" << reinterpret_cast(axis); return false; } /*! Zooms in (or out) to the passed rectangular region \a pixelRect, given in pixel coordinates. All axes of this axis rect will have their range zoomed accordingly. If you only wish to zoom specific axes, use the overloaded version of this method. \see QCustomPlot::setSelectionRectMode */ void QCPAxisRect::zoom(const QRectF &pixelRect) { zoom(pixelRect, axes()); } /*! \overload Zooms in (or out) to the passed rectangular region \a pixelRect, given in pixel coordinates. Only the axes passed in \a affectedAxes will have their ranges zoomed accordingly. \see QCustomPlot::setSelectionRectMode */ void QCPAxisRect::zoom(const QRectF &pixelRect, const QList &affectedAxes) { foreach (QCPAxis *axis, affectedAxes) { if (!axis) { qDebug() << Q_FUNC_INFO << "a passed axis was zero"; continue; } QCPRange pixelRange; if (axis->orientation() == Qt::Horizontal) pixelRange = QCPRange(pixelRect.left(), pixelRect.right()); else pixelRange = QCPRange(pixelRect.top(), pixelRect.bottom()); axis->setRange(axis->pixelToCoord(pixelRange.lower), axis->pixelToCoord(pixelRange.upper)); } } /*! Convenience function to create an axis on each side that doesn't have any axes yet and set their visibility to true. Further, the top/right axes are assigned the following properties of the bottom/left axes: \li range (\ref QCPAxis::setRange) \li range reversed (\ref QCPAxis::setRangeReversed) \li scale type (\ref QCPAxis::setScaleType) \li tick visibility (\ref QCPAxis::setTicks) \li number format (\ref QCPAxis::setNumberFormat) \li number precision (\ref QCPAxis::setNumberPrecision) \li tick count of ticker (\ref QCPAxisTicker::setTickCount) \li tick origin of ticker (\ref QCPAxisTicker::setTickOrigin) Tick label visibility (\ref QCPAxis::setTickLabels) of the right and top axes are set to false. If \a connectRanges is true, the \ref QCPAxis::rangeChanged "rangeChanged" signals of the bottom and left axes are connected to the \ref QCPAxis::setRange slots of the top and right axes. */ void QCPAxisRect::setupFullAxesBox(bool connectRanges) { QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2; if (axisCount(QCPAxis::atBottom) == 0) xAxis = addAxis(QCPAxis::atBottom); else xAxis = axis(QCPAxis::atBottom); if (axisCount(QCPAxis::atLeft) == 0) yAxis = addAxis(QCPAxis::atLeft); else yAxis = axis(QCPAxis::atLeft); if (axisCount(QCPAxis::atTop) == 0) xAxis2 = addAxis(QCPAxis::atTop); else xAxis2 = axis(QCPAxis::atTop); if (axisCount(QCPAxis::atRight) == 0) yAxis2 = addAxis(QCPAxis::atRight); else yAxis2 = axis(QCPAxis::atRight); xAxis->setVisible(true); yAxis->setVisible(true); xAxis2->setVisible(true); yAxis2->setVisible(true); xAxis2->setTickLabels(false); yAxis2->setTickLabels(false); xAxis2->setRange(xAxis->range()); xAxis2->setRangeReversed(xAxis->rangeReversed()); xAxis2->setScaleType(xAxis->scaleType()); xAxis2->setTicks(xAxis->ticks()); xAxis2->setNumberFormat(xAxis->numberFormat()); xAxis2->setNumberPrecision(xAxis->numberPrecision()); xAxis2->ticker()->setTickCount(xAxis->ticker()->tickCount()); xAxis2->ticker()->setTickOrigin(xAxis->ticker()->tickOrigin()); yAxis2->setRange(yAxis->range()); yAxis2->setRangeReversed(yAxis->rangeReversed()); yAxis2->setScaleType(yAxis->scaleType()); yAxis2->setTicks(yAxis->ticks()); yAxis2->setNumberFormat(yAxis->numberFormat()); yAxis2->setNumberPrecision(yAxis->numberPrecision()); yAxis2->ticker()->setTickCount(yAxis->ticker()->tickCount()); yAxis2->ticker()->setTickOrigin(yAxis->ticker()->tickOrigin()); if (connectRanges) { connect(xAxis, SIGNAL(rangeChanged(QCPRange)), xAxis2, SLOT(setRange(QCPRange))); connect(yAxis, SIGNAL(rangeChanged(QCPRange)), yAxis2, SLOT(setRange(QCPRange))); } } /*! Returns a list of all the plottables that are associated with this axis rect. A plottable is considered associated with an axis rect if its key or value axis (or both) is in this axis rect. \see graphs, items */ QList QCPAxisRect::plottables() const { // Note: don't append all QCPAxis::plottables() into a list, because we might get duplicate entries QList result; for (int i=0; imPlottables.size(); ++i) { if (mParentPlot->mPlottables.at(i)->keyAxis()->axisRect() == this || mParentPlot->mPlottables.at(i)->valueAxis()->axisRect() == this) result.append(mParentPlot->mPlottables.at(i)); } return result; } /*! Returns a list of all the graphs that are associated with this axis rect. A graph is considered associated with an axis rect if its key or value axis (or both) is in this axis rect. \see plottables, items */ QList QCPAxisRect::graphs() const { // Note: don't append all QCPAxis::graphs() into a list, because we might get duplicate entries QList result; for (int i=0; imGraphs.size(); ++i) { if (mParentPlot->mGraphs.at(i)->keyAxis()->axisRect() == this || mParentPlot->mGraphs.at(i)->valueAxis()->axisRect() == this) result.append(mParentPlot->mGraphs.at(i)); } return result; } /*! Returns a list of all the items that are associated with this axis rect. An item is considered associated with an axis rect if any of its positions has key or value axis set to an axis that is in this axis rect, or if any of its positions has \ref QCPItemPosition::setAxisRect set to the axis rect, or if the clip axis rect (\ref QCPAbstractItem::setClipAxisRect) is set to this axis rect. \see plottables, graphs */ QList QCPAxisRect::items() const { // Note: don't just append all QCPAxis::items() into a list, because we might get duplicate entries // and miss those items that have this axis rect as clipAxisRect. QList result; for (int itemId=0; itemIdmItems.size(); ++itemId) { if (mParentPlot->mItems.at(itemId)->clipAxisRect() == this) { result.append(mParentPlot->mItems.at(itemId)); continue; } QList positions = mParentPlot->mItems.at(itemId)->positions(); for (int posId=0; posIdaxisRect() == this || positions.at(posId)->keyAxis()->axisRect() == this || positions.at(posId)->valueAxis()->axisRect() == this) { result.append(mParentPlot->mItems.at(itemId)); break; } } } return result; } /*! This method is called automatically upon replot and doesn't need to be called by users of QCPAxisRect. Calls the base class implementation to update the margins (see \ref QCPLayoutElement::update), and finally passes the \ref rect to the inset layout (\ref insetLayout) and calls its QCPInsetLayout::update function. \seebaseclassmethod */ void QCPAxisRect::update(UpdatePhase phase) { QCPLayoutElement::update(phase); switch (phase) { case upPreparation: { QList allAxes = axes(); for (int i=0; isetupTickVectors(); break; } case upLayout: { mInsetLayout->setOuterRect(rect()); break; } default: break; } // pass update call on to inset layout (doesn't happen automatically, because QCPAxisRect doesn't derive from QCPLayout): mInsetLayout->update(phase); } /* inherits documentation from base class */ QList QCPAxisRect::elements(bool recursive) const { QList result; if (mInsetLayout) { result << mInsetLayout; if (recursive) result << mInsetLayout->elements(recursive); } return result; } /* inherits documentation from base class */ void QCPAxisRect::applyDefaultAntialiasingHint(QCPPainter *painter) const { painter->setAntialiasing(false); } /* inherits documentation from base class */ void QCPAxisRect::draw(QCPPainter *painter) { drawBackground(painter); } /*! Sets \a pm as the axis background pixmap. The axis background pixmap will be drawn inside the axis rect. Since axis rects place themselves on the "background" layer by default, the axis rect backgrounds are usually drawn below everything else. For cases where the provided pixmap doesn't have the same size as the axis rect, scaling can be enabled with \ref setBackgroundScaled and the scaling mode (i.e. whether and how the aspect ratio is preserved) can be set with \ref setBackgroundScaledMode. To set all these options in one call, consider using the overloaded version of this function. Below the pixmap, the axis rect may be optionally filled with a brush, if specified with \ref setBackground(const QBrush &brush). \see setBackgroundScaled, setBackgroundScaledMode, setBackground(const QBrush &brush) */ void QCPAxisRect::setBackground(const QPixmap &pm) { mBackgroundPixmap = pm; mScaledBackgroundPixmap = QPixmap(); } /*! \overload Sets \a brush as the background brush. The axis rect background will be filled with this brush. Since axis rects place themselves on the "background" layer by default, the axis rect backgrounds are usually drawn below everything else. The brush will be drawn before (under) any background pixmap, which may be specified with \ref setBackground(const QPixmap &pm). To disable drawing of a background brush, set \a brush to Qt::NoBrush. \see setBackground(const QPixmap &pm) */ void QCPAxisRect::setBackground(const QBrush &brush) { mBackgroundBrush = brush; } /*! \overload Allows setting the background pixmap of the axis rect, whether it shall be scaled and how it shall be scaled in one call. \see setBackground(const QPixmap &pm), setBackgroundScaled, setBackgroundScaledMode */ void QCPAxisRect::setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode) { mBackgroundPixmap = pm; mScaledBackgroundPixmap = QPixmap(); mBackgroundScaled = scaled; mBackgroundScaledMode = mode; } /*! Sets whether the axis background pixmap shall be scaled to fit the axis rect or not. If \a scaled is set to true, you may control whether and how the aspect ratio of the original pixmap is preserved with \ref setBackgroundScaledMode. Note that the scaled version of the original pixmap is buffered, so there is no performance penalty on replots. (Except when the axis rect dimensions are changed continuously.) \see setBackground, setBackgroundScaledMode */ void QCPAxisRect::setBackgroundScaled(bool scaled) { mBackgroundScaled = scaled; } /*! If scaling of the axis background pixmap is enabled (\ref setBackgroundScaled), use this function to define whether and how the aspect ratio of the original pixmap passed to \ref setBackground is preserved. \see setBackground, setBackgroundScaled */ void QCPAxisRect::setBackgroundScaledMode(Qt::AspectRatioMode mode) { mBackgroundScaledMode = mode; } /*! Returns the range drag axis of the \a orientation provided. If multiple axes were set, returns the first one (use \ref rangeDragAxes to retrieve a list with all set axes). \see setRangeDragAxes */ QCPAxis *QCPAxisRect::rangeDragAxis(Qt::Orientation orientation) { if (orientation == Qt::Horizontal) return mRangeDragHorzAxis.isEmpty() ? 0 : mRangeDragHorzAxis.first().data(); else return mRangeDragVertAxis.isEmpty() ? 0 : mRangeDragVertAxis.first().data(); } /*! Returns the range zoom axis of the \a orientation provided. If multiple axes were set, returns the first one (use \ref rangeZoomAxes to retrieve a list with all set axes). \see setRangeZoomAxes */ QCPAxis *QCPAxisRect::rangeZoomAxis(Qt::Orientation orientation) { if (orientation == Qt::Horizontal) return mRangeZoomHorzAxis.isEmpty() ? 0 : mRangeZoomHorzAxis.first().data(); else return mRangeZoomVertAxis.isEmpty() ? 0 : mRangeZoomVertAxis.first().data(); } /*! Returns all range drag axes of the \a orientation provided. \see rangeZoomAxis, setRangeZoomAxes */ QList QCPAxisRect::rangeDragAxes(Qt::Orientation orientation) { QList result; if (orientation == Qt::Horizontal) { for (int i=0; i QCPAxisRect::rangeZoomAxes(Qt::Orientation orientation) { QList result; if (orientation == Qt::Horizontal) { for (int i=0; iQt::Horizontal | Qt::Vertical as \a orientations. In addition to setting \a orientations to a non-zero value, make sure \ref QCustomPlot::setInteractions contains \ref QCP::iRangeDrag to enable the range dragging interaction. \see setRangeZoom, setRangeDragAxes, QCustomPlot::setNoAntialiasingOnDrag */ void QCPAxisRect::setRangeDrag(Qt::Orientations orientations) { mRangeDrag = orientations; } /*! Sets which axis orientation may be zoomed by the user with the mouse wheel. What orientation corresponds to which specific axis can be set with \ref setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical). By default, the horizontal axis is the bottom axis (xAxis) and the vertical axis is the left axis (yAxis). To disable range zooming entirely, pass 0 as \a orientations or remove \ref QCP::iRangeZoom from \ref QCustomPlot::setInteractions. To enable range zooming for both directions, pass Qt::Horizontal | Qt::Vertical as \a orientations. In addition to setting \a orientations to a non-zero value, make sure \ref QCustomPlot::setInteractions contains \ref QCP::iRangeZoom to enable the range zooming interaction. \see setRangeZoomFactor, setRangeZoomAxes, setRangeDrag */ void QCPAxisRect::setRangeZoom(Qt::Orientations orientations) { mRangeZoom = orientations; } /*! \overload Sets the axes whose range will be dragged when \ref setRangeDrag enables mouse range dragging on the QCustomPlot widget. Pass 0 if no axis shall be dragged in the respective orientation. Use the overload taking a list of axes, if multiple axes (more than one per orientation) shall react to dragging interactions. \see setRangeZoomAxes */ void QCPAxisRect::setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical) { QList horz, vert; if (horizontal) horz.append(horizontal); if (vertical) vert.append(vertical); setRangeDragAxes(horz, vert); } /*! \overload This method allows to set up multiple axes to react to horizontal and vertical dragging. The drag orientation that the respective axis will react to is deduced from its orientation (\ref QCPAxis::orientation). In the unusual case that you wish to e.g. drag a vertically oriented axis with a horizontal drag motion, use the overload taking two separate lists for horizontal and vertical dragging. */ void QCPAxisRect::setRangeDragAxes(QList axes) { QList horz, vert; foreach (QCPAxis *ax, axes) { if (ax->orientation() == Qt::Horizontal) horz.append(ax); else vert.append(ax); } setRangeDragAxes(horz, vert); } /*! \overload This method allows to set multiple axes up to react to horizontal and vertical dragging, and define specifically which axis reacts to which drag orientation (irrespective of the axis orientation). */ void QCPAxisRect::setRangeDragAxes(QList horizontal, QList vertical) { mRangeDragHorzAxis.clear(); foreach (QCPAxis *ax, horizontal) { QPointer axPointer(ax); if (!axPointer.isNull()) mRangeDragHorzAxis.append(axPointer); else qDebug() << Q_FUNC_INFO << "invalid axis passed in horizontal list:" << reinterpret_cast(ax); } mRangeDragVertAxis.clear(); foreach (QCPAxis *ax, vertical) { QPointer axPointer(ax); if (!axPointer.isNull()) mRangeDragVertAxis.append(axPointer); else qDebug() << Q_FUNC_INFO << "invalid axis passed in vertical list:" << reinterpret_cast(ax); } } /*! Sets the axes whose range will be zoomed when \ref setRangeZoom enables mouse wheel zooming on the QCustomPlot widget. Pass 0 if no axis shall be zoomed in the respective orientation. The two axes can be zoomed with different strengths, when different factors are passed to \ref setRangeZoomFactor(double horizontalFactor, double verticalFactor). Use the overload taking a list of axes, if multiple axes (more than one per orientation) shall react to zooming interactions. \see setRangeDragAxes */ void QCPAxisRect::setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical) { QList horz, vert; if (horizontal) horz.append(horizontal); if (vertical) vert.append(vertical); setRangeZoomAxes(horz, vert); } /*! \overload This method allows to set up multiple axes to react to horizontal and vertical range zooming. The zoom orientation that the respective axis will react to is deduced from its orientation (\ref QCPAxis::orientation). In the unusual case that you wish to e.g. zoom a vertically oriented axis with a horizontal zoom interaction, use the overload taking two separate lists for horizontal and vertical zooming. */ void QCPAxisRect::setRangeZoomAxes(QList axes) { QList horz, vert; foreach (QCPAxis *ax, axes) { if (ax->orientation() == Qt::Horizontal) horz.append(ax); else vert.append(ax); } setRangeZoomAxes(horz, vert); } /*! \overload This method allows to set multiple axes up to react to horizontal and vertical zooming, and define specifically which axis reacts to which zoom orientation (irrespective of the axis orientation). */ void QCPAxisRect::setRangeZoomAxes(QList horizontal, QList vertical) { mRangeZoomHorzAxis.clear(); foreach (QCPAxis *ax, horizontal) { QPointer axPointer(ax); if (!axPointer.isNull()) mRangeZoomHorzAxis.append(axPointer); else qDebug() << Q_FUNC_INFO << "invalid axis passed in horizontal list:" << reinterpret_cast(ax); } mRangeZoomVertAxis.clear(); foreach (QCPAxis *ax, vertical) { QPointer axPointer(ax); if (!axPointer.isNull()) mRangeZoomVertAxis.append(axPointer); else qDebug() << Q_FUNC_INFO << "invalid axis passed in vertical list:" << reinterpret_cast(ax); } } /*! Sets how strong one rotation step of the mouse wheel zooms, when range zoom was activated with \ref setRangeZoom. The two parameters \a horizontalFactor and \a verticalFactor provide a way to let the horizontal axis zoom at different rates than the vertical axis. Which axis is horizontal and which is vertical, can be set with \ref setRangeZoomAxes. When the zoom factor is greater than one, scrolling the mouse wheel backwards (towards the user) will zoom in (make the currently visible range smaller). For zoom factors smaller than one, the same scrolling direction will zoom out. */ void QCPAxisRect::setRangeZoomFactor(double horizontalFactor, double verticalFactor) { mRangeZoomFactorHorz = horizontalFactor; mRangeZoomFactorVert = verticalFactor; } /*! \overload Sets both the horizontal and vertical zoom \a factor. */ void QCPAxisRect::setRangeZoomFactor(double factor) { mRangeZoomFactorHorz = factor; mRangeZoomFactorVert = factor; } /*! \internal Draws the background of this axis rect. It may consist of a background fill (a QBrush) and a pixmap. If a brush was given via \ref setBackground(const QBrush &brush), this function first draws an according filling inside the axis rect with the provided \a painter. Then, if a pixmap was provided via \ref setBackground, this function buffers the scaled version depending on \ref setBackgroundScaled and \ref setBackgroundScaledMode and then draws it inside the axis rect with the provided \a painter. The scaled version is buffered in mScaledBackgroundPixmap to prevent expensive rescaling at every redraw. It is only updated, when the axis rect has changed in a way that requires a rescale of the background pixmap (this is dependent on the \ref setBackgroundScaledMode), or when a differend axis background pixmap was set. \see setBackground, setBackgroundScaled, setBackgroundScaledMode */ void QCPAxisRect::drawBackground(QCPPainter *painter) { // draw background fill: if (mBackgroundBrush != Qt::NoBrush) painter->fillRect(mRect, mBackgroundBrush); // draw background pixmap (on top of fill, if brush specified): if (!mBackgroundPixmap.isNull()) { if (mBackgroundScaled) { // check whether mScaledBackground needs to be updated: QSize scaledSize(mBackgroundPixmap.size()); scaledSize.scale(mRect.size(), mBackgroundScaledMode); if (mScaledBackgroundPixmap.size() != scaledSize) mScaledBackgroundPixmap = mBackgroundPixmap.scaled(mRect.size(), mBackgroundScaledMode, Qt::SmoothTransformation); painter->drawPixmap(mRect.topLeft()+QPoint(0, -1), mScaledBackgroundPixmap, QRect(0, 0, mRect.width(), mRect.height()) & mScaledBackgroundPixmap.rect()); } else { painter->drawPixmap(mRect.topLeft()+QPoint(0, -1), mBackgroundPixmap, QRect(0, 0, mRect.width(), mRect.height())); } } } /*! \internal This function makes sure multiple axes on the side specified with \a type don't collide, but are distributed according to their respective space requirement (QCPAxis::calculateMargin). It does this by setting an appropriate offset (\ref QCPAxis::setOffset) on all axes except the one with index zero. This function is called by \ref calculateAutoMargin. */ void QCPAxisRect::updateAxesOffset(QCPAxis::AxisType type) { const QList axesList = mAxes.value(type); if (axesList.isEmpty()) return; bool isFirstVisible = !axesList.first()->visible(); // if the first axis is visible, the second axis (which is where the loop starts) isn't the first visible axis, so initialize with false for (int i=1; ioffset() + axesList.at(i-1)->calculateMargin(); if (axesList.at(i)->visible()) // only add inner tick length to offset if this axis is visible and it's not the first visible one (might happen if true first axis is invisible) { if (!isFirstVisible) offset += axesList.at(i)->tickLengthIn(); isFirstVisible = false; } axesList.at(i)->setOffset(offset); } } /* inherits documentation from base class */ int QCPAxisRect::calculateAutoMargin(QCP::MarginSide side) { if (!mAutoMargins.testFlag(side)) qDebug() << Q_FUNC_INFO << "Called with side that isn't specified as auto margin"; updateAxesOffset(QCPAxis::marginSideToAxisType(side)); // note: only need to look at the last (outer most) axis to determine the total margin, due to updateAxisOffset call const QList axesList = mAxes.value(QCPAxis::marginSideToAxisType(side)); if (axesList.size() > 0) return axesList.last()->offset() + axesList.last()->calculateMargin(); else return 0; } /*! \internal Reacts to a change in layout to potentially set the convenience axis pointers \ref QCustomPlot::xAxis, \ref QCustomPlot::yAxis, etc. of the parent QCustomPlot to the respective axes of this axis rect. This is only done if the respective convenience pointer is currently zero and if there is no QCPAxisRect at position (0, 0) of the plot layout. This automation makes it simpler to replace the main axis rect with a newly created one, without the need to manually reset the convenience pointers. */ void QCPAxisRect::layoutChanged() { if (mParentPlot && mParentPlot->axisRectCount() > 0 && mParentPlot->axisRect(0) == this) { if (axisCount(QCPAxis::atBottom) > 0 && !mParentPlot->xAxis) mParentPlot->xAxis = axis(QCPAxis::atBottom); if (axisCount(QCPAxis::atLeft) > 0 && !mParentPlot->yAxis) mParentPlot->yAxis = axis(QCPAxis::atLeft); if (axisCount(QCPAxis::atTop) > 0 && !mParentPlot->xAxis2) mParentPlot->xAxis2 = axis(QCPAxis::atTop); if (axisCount(QCPAxis::atRight) > 0 && !mParentPlot->yAxis2) mParentPlot->yAxis2 = axis(QCPAxis::atRight); } } /*! \internal Event handler for when a mouse button is pressed on the axis rect. If the left mouse button is pressed, the range dragging interaction is initialized (the actual range manipulation happens in the \ref mouseMoveEvent). The mDragging flag is set to true and some anchor points are set that are needed to determine the distance the mouse was dragged in the mouse move/release events later. \see mouseMoveEvent, mouseReleaseEvent */ void QCPAxisRect::mousePressEvent(QMouseEvent *event, const QVariant &details) { Q_UNUSED(details) mDragStart = event->pos(); // need this even when not LeftButton is pressed, to determine in releaseEvent whether it was a full click (no position change between press and release) if (event->buttons() & Qt::LeftButton) { mDragging = true; // initialize antialiasing backup in case we start dragging: if (mParentPlot->noAntialiasingOnDrag()) { mAADragBackup = mParentPlot->antialiasedElements(); mNotAADragBackup = mParentPlot->notAntialiasedElements(); } // Mouse range dragging interaction: if (mParentPlot->interactions().testFlag(QCP::iRangeDrag)) { mDragStartHorzRange.clear(); for (int i=0; irange()); mDragStartVertRange.clear(); for (int i=0; irange()); } } } /*! \internal Event handler for when the mouse is moved on the axis rect. If range dragging was activated in a preceding \ref mousePressEvent, the range is moved accordingly. \see mousePressEvent, mouseReleaseEvent */ void QCPAxisRect::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) { Q_UNUSED(startPos) // Mouse range dragging interaction: if (mDragging && mParentPlot->interactions().testFlag(QCP::iRangeDrag)) { if (mRangeDrag.testFlag(Qt::Horizontal)) { for (int i=0; i= mDragStartHorzRange.size()) break; if (ax->mScaleType == QCPAxis::stLinear) { double diff = ax->pixelToCoord(mDragStart.x()) - ax->pixelToCoord(event->pos().x()); ax->setRange(mDragStartHorzRange.at(i).lower+diff, mDragStartHorzRange.at(i).upper+diff); } else if (ax->mScaleType == QCPAxis::stLogarithmic) { double diff = ax->pixelToCoord(mDragStart.x()) / ax->pixelToCoord(event->pos().x()); ax->setRange(mDragStartHorzRange.at(i).lower*diff, mDragStartHorzRange.at(i).upper*diff); } } } if (mRangeDrag.testFlag(Qt::Vertical)) { for (int i=0; i= mDragStartVertRange.size()) break; if (ax->mScaleType == QCPAxis::stLinear) { double diff = ax->pixelToCoord(mDragStart.y()) - ax->pixelToCoord(event->pos().y()); ax->setRange(mDragStartVertRange.at(i).lower+diff, mDragStartVertRange.at(i).upper+diff); } else if (ax->mScaleType == QCPAxis::stLogarithmic) { double diff = ax->pixelToCoord(mDragStart.y()) / ax->pixelToCoord(event->pos().y()); ax->setRange(mDragStartVertRange.at(i).lower*diff, mDragStartVertRange.at(i).upper*diff); } } } if (mRangeDrag != 0) // if either vertical or horizontal drag was enabled, do a replot { if (mParentPlot->noAntialiasingOnDrag()) mParentPlot->setNotAntialiasedElements(QCP::aeAll); mParentPlot->replot(); } } } /* inherits documentation from base class */ void QCPAxisRect::mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) { Q_UNUSED(event) Q_UNUSED(startPos) mDragging = false; if (mParentPlot->noAntialiasingOnDrag()) { mParentPlot->setAntialiasedElements(mAADragBackup); mParentPlot->setNotAntialiasedElements(mNotAADragBackup); } } /*! \internal Event handler for mouse wheel events. If rangeZoom is Qt::Horizontal, Qt::Vertical or both, the ranges of the axes defined as rangeZoomHorzAxis and rangeZoomVertAxis are scaled. The center of the scaling operation is the current cursor position inside the axis rect. The scaling factor is dependent on the mouse wheel delta (which direction the wheel was rotated) to provide a natural zooming feel. The Strength of the zoom can be controlled via \ref setRangeZoomFactor. Note, that event->delta() is usually +/-120 for single rotation steps. However, if the mouse wheel is turned rapidly, many steps may bunch up to one event, so the event->delta() may then be multiples of 120. This is taken into account here, by calculating \a wheelSteps and using it as exponent of the range zoom factor. This takes care of the wheel direction automatically, by inverting the factor, when the wheel step is negative (f^-1 = 1/f). */ void QCPAxisRect::wheelEvent(QWheelEvent *event) { // Mouse range zooming interaction: if (mParentPlot->interactions().testFlag(QCP::iRangeZoom)) { if (mRangeZoom != 0) { double factor; double wheelSteps = event->delta()/120.0; // a single step delta is +/-120 usually if (mRangeZoom.testFlag(Qt::Horizontal)) { factor = qPow(mRangeZoomFactorHorz, wheelSteps); for (int i=0; iscaleRange(factor, mRangeZoomHorzAxis.at(i)->pixelToCoord(event->pos().x())); } } if (mRangeZoom.testFlag(Qt::Vertical)) { factor = qPow(mRangeZoomFactorVert, wheelSteps); for (int i=0; iscaleRange(factor, mRangeZoomVertAxis.at(i)->pixelToCoord(event->pos().y())); } } mParentPlot->replot(); } } } /* end of 'src/layoutelements/layoutelement-axisrect.cpp' */ /* including file 'src/layoutelements/layoutelement-legend.cpp', size 30933 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAbstractLegendItem //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAbstractLegendItem \brief The abstract base class for all entries in a QCPLegend. It defines a very basic interface for entries in a QCPLegend. For representing plottables in the legend, the subclass \ref QCPPlottableLegendItem is more suitable. Only derive directly from this class when you need absolute freedom (e.g. a custom legend entry that's not even associated with a plottable). You must implement the following pure virtual functions: \li \ref draw (from QCPLayerable) You inherit the following members you may use:
QCPLegend *\b mParentLegend A pointer to the parent QCPLegend.
QFont \b mFont The generic font of the item. You should use this font for all or at least the most prominent text of the item.
*/ /* start of documentation of signals */ /*! \fn void QCPAbstractLegendItem::selectionChanged(bool selected) This signal is emitted when the selection state of this legend item has changed, either by user interaction or by a direct call to \ref setSelected. */ /* end of documentation of signals */ /*! Constructs a QCPAbstractLegendItem and associates it with the QCPLegend \a parent. This does not cause the item to be added to \a parent, so \ref QCPLegend::addItem must be called separately. */ QCPAbstractLegendItem::QCPAbstractLegendItem(QCPLegend *parent) : QCPLayoutElement(parent->parentPlot()), mParentLegend(parent), mFont(parent->font()), mTextColor(parent->textColor()), mSelectedFont(parent->selectedFont()), mSelectedTextColor(parent->selectedTextColor()), mSelectable(true), mSelected(false) { setLayer(QLatin1String("legend")); setMargins(QMargins(0, 0, 0, 0)); } /*! Sets the default font of this specific legend item to \a font. \see setTextColor, QCPLegend::setFont */ void QCPAbstractLegendItem::setFont(const QFont &font) { mFont = font; } /*! Sets the default text color of this specific legend item to \a color. \see setFont, QCPLegend::setTextColor */ void QCPAbstractLegendItem::setTextColor(const QColor &color) { mTextColor = color; } /*! When this legend item is selected, \a font is used to draw generic text, instead of the normal font set with \ref setFont. \see setFont, QCPLegend::setSelectedFont */ void QCPAbstractLegendItem::setSelectedFont(const QFont &font) { mSelectedFont = font; } /*! When this legend item is selected, \a color is used to draw generic text, instead of the normal color set with \ref setTextColor. \see setTextColor, QCPLegend::setSelectedTextColor */ void QCPAbstractLegendItem::setSelectedTextColor(const QColor &color) { mSelectedTextColor = color; } /*! Sets whether this specific legend item is selectable. \see setSelectedParts, QCustomPlot::setInteractions */ void QCPAbstractLegendItem::setSelectable(bool selectable) { if (mSelectable != selectable) { mSelectable = selectable; emit selectableChanged(mSelectable); } } /*! Sets whether this specific legend item is selected. It is possible to set the selection state of this item by calling this function directly, even if setSelectable is set to false. \see setSelectableParts, QCustomPlot::setInteractions */ void QCPAbstractLegendItem::setSelected(bool selected) { if (mSelected != selected) { mSelected = selected; emit selectionChanged(mSelected); } } /* inherits documentation from base class */ double QCPAbstractLegendItem::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (!mParentPlot) return -1; if (onlySelectable && (!mSelectable || !mParentLegend->selectableParts().testFlag(QCPLegend::spItems))) return -1; if (mRect.contains(pos.toPoint())) return mParentPlot->selectionTolerance()*0.99; else return -1; } /* inherits documentation from base class */ void QCPAbstractLegendItem::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aeLegendItems); } /* inherits documentation from base class */ QRect QCPAbstractLegendItem::clipRect() const { return mOuterRect; } /* inherits documentation from base class */ void QCPAbstractLegendItem::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) { Q_UNUSED(event) Q_UNUSED(details) if (mSelectable && mParentLegend->selectableParts().testFlag(QCPLegend::spItems)) { bool selBefore = mSelected; setSelected(additive ? !mSelected : true); if (selectionStateChanged) *selectionStateChanged = mSelected != selBefore; } } /* inherits documentation from base class */ void QCPAbstractLegendItem::deselectEvent(bool *selectionStateChanged) { if (mSelectable && mParentLegend->selectableParts().testFlag(QCPLegend::spItems)) { bool selBefore = mSelected; setSelected(false); if (selectionStateChanged) *selectionStateChanged = mSelected != selBefore; } } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPlottableLegendItem //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPPlottableLegendItem \brief A legend item representing a plottable with an icon and the plottable name. This is the standard legend item for plottables. It displays an icon of the plottable next to the plottable name. The icon is drawn by the respective plottable itself (\ref QCPAbstractPlottable::drawLegendIcon), and tries to give an intuitive symbol for the plottable. For example, the QCPGraph draws a centered horizontal line and/or a single scatter point in the middle. Legend items of this type are always associated with one plottable (retrievable via the plottable() function and settable with the constructor). You may change the font of the plottable name with \ref setFont. Icon padding and border pen is taken from the parent QCPLegend, see \ref QCPLegend::setIconBorderPen and \ref QCPLegend::setIconTextPadding. The function \ref QCPAbstractPlottable::addToLegend/\ref QCPAbstractPlottable::removeFromLegend creates/removes legend items of this type in the default implementation. However, these functions may be reimplemented such that a different kind of legend item (e.g a direct subclass of QCPAbstractLegendItem) is used for that plottable. Since QCPLegend is based on QCPLayoutGrid, a legend item itself is just a subclass of QCPLayoutElement. While it could be added to a legend (or any other layout) via the normal layout interface, QCPLegend has specialized functions for handling legend items conveniently, see the documentation of \ref QCPLegend. */ /*! Creates a new legend item associated with \a plottable. Once it's created, it can be added to the legend via \ref QCPLegend::addItem. A more convenient way of adding/removing a plottable to/from the legend is via the functions \ref QCPAbstractPlottable::addToLegend and \ref QCPAbstractPlottable::removeFromLegend. */ QCPPlottableLegendItem::QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable) : QCPAbstractLegendItem(parent), mPlottable(plottable) { setAntialiased(false); } /*! \internal Returns the pen that shall be used to draw the icon border, taking into account the selection state of this item. */ QPen QCPPlottableLegendItem::getIconBorderPen() const { return mSelected ? mParentLegend->selectedIconBorderPen() : mParentLegend->iconBorderPen(); } /*! \internal Returns the text color that shall be used to draw text, taking into account the selection state of this item. */ QColor QCPPlottableLegendItem::getTextColor() const { return mSelected ? mSelectedTextColor : mTextColor; } /*! \internal Returns the font that shall be used to draw text, taking into account the selection state of this item. */ QFont QCPPlottableLegendItem::getFont() const { return mSelected ? mSelectedFont : mFont; } /*! \internal Draws the item with \a painter. The size and position of the drawn legend item is defined by the parent layout (typically a \ref QCPLegend) and the \ref minimumSizeHint and \ref maximumSizeHint of this legend item. */ void QCPPlottableLegendItem::draw(QCPPainter *painter) { if (!mPlottable) return; painter->setFont(getFont()); painter->setPen(QPen(getTextColor())); QSizeF iconSize = mParentLegend->iconSize(); QRectF textRect = painter->fontMetrics().boundingRect(0, 0, 0, iconSize.height(), Qt::TextDontClip, mPlottable->name()); QRectF iconRect(mRect.topLeft(), iconSize); int textHeight = qMax(textRect.height(), iconSize.height()); // if text has smaller height than icon, center text vertically in icon height, else align tops painter->drawText(mRect.x()+iconSize.width()+mParentLegend->iconTextPadding(), mRect.y(), textRect.width(), textHeight, Qt::TextDontClip, mPlottable->name()); // draw icon: painter->save(); painter->setClipRect(iconRect, Qt::IntersectClip); mPlottable->drawLegendIcon(painter, iconRect); painter->restore(); // draw icon border: if (getIconBorderPen().style() != Qt::NoPen) { painter->setPen(getIconBorderPen()); painter->setBrush(Qt::NoBrush); int halfPen = qCeil(painter->pen().widthF()*0.5)+1; painter->setClipRect(mOuterRect.adjusted(-halfPen, -halfPen, halfPen, halfPen)); // extend default clip rect so thicker pens (especially during selection) are not clipped painter->drawRect(iconRect); } } /*! \internal Calculates and returns the size of this item. This includes the icon, the text and the padding in between. \seebaseclassmethod */ QSize QCPPlottableLegendItem::minimumSizeHint() const { if (!mPlottable) return QSize(); QSize result(0, 0); QRect textRect; QFontMetrics fontMetrics(getFont()); QSize iconSize = mParentLegend->iconSize(); textRect = fontMetrics.boundingRect(0, 0, 0, iconSize.height(), Qt::TextDontClip, mPlottable->name()); result.setWidth(iconSize.width() + mParentLegend->iconTextPadding() + textRect.width() + mMargins.left() + mMargins.right()); result.setHeight(qMax(textRect.height(), iconSize.height()) + mMargins.top() + mMargins.bottom()); return result; } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPLegend //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPLegend \brief Manages a legend inside a QCustomPlot. A legend is a small box somewhere in the plot which lists plottables with their name and icon. Normally, the legend is populated by calling \ref QCPAbstractPlottable::addToLegend. The respective legend item can be removed with \ref QCPAbstractPlottable::removeFromLegend. However, QCPLegend also offers an interface to add and manipulate legend items directly: \ref item, \ref itemWithPlottable, \ref itemCount, \ref addItem, \ref removeItem, etc. Since \ref QCPLegend derives from \ref QCPLayoutGrid, it can be placed in any position a \ref QCPLayoutElement may be positioned. The legend items are themselves \ref QCPLayoutElement "QCPLayoutElements" which are placed in the grid layout of the legend. \ref QCPLegend only adds an interface specialized for handling child elements of type \ref QCPAbstractLegendItem, as mentioned above. In principle, any other layout elements may also be added to a legend via the normal \ref QCPLayoutGrid interface. See the special page about \link thelayoutsystem The Layout System\endlink for examples on how to add other elements to the legend and move it outside the axis rect. Use the methods \ref setFillOrder and \ref setWrap inherited from \ref QCPLayoutGrid to control in which order (column first or row first) the legend is filled up when calling \ref addItem, and at which column or row wrapping occurs. By default, every QCustomPlot has one legend (\ref QCustomPlot::legend) which is placed in the inset layout of the main axis rect (\ref QCPAxisRect::insetLayout). To move the legend to another position inside the axis rect, use the methods of the \ref QCPLayoutInset. To move the legend outside of the axis rect, place it anywhere else with the \ref QCPLayout/\ref QCPLayoutElement interface. */ /* start of documentation of signals */ /*! \fn void QCPLegend::selectionChanged(QCPLegend::SelectableParts selection); This signal is emitted when the selection state of this legend has changed. \see setSelectedParts, setSelectableParts */ /* end of documentation of signals */ /*! Constructs a new QCPLegend instance with default values. Note that by default, QCustomPlot already contains a legend ready to be used as \ref QCustomPlot::legend */ QCPLegend::QCPLegend() { setFillOrder(QCPLayoutGrid::foRowsFirst); setWrap(0); setRowSpacing(3); setColumnSpacing(8); setMargins(QMargins(7, 5, 7, 4)); setAntialiased(false); setIconSize(32, 18); setIconTextPadding(7); setSelectableParts(spLegendBox | spItems); setSelectedParts(spNone); setBorderPen(QPen(Qt::black, 0)); setSelectedBorderPen(QPen(Qt::blue, 2)); setIconBorderPen(Qt::NoPen); setSelectedIconBorderPen(QPen(Qt::blue, 2)); setBrush(Qt::white); setSelectedBrush(Qt::white); setTextColor(Qt::black); setSelectedTextColor(Qt::blue); } QCPLegend::~QCPLegend() { clearItems(); if (qobject_cast(mParentPlot)) // make sure this isn't called from QObject dtor when QCustomPlot is already destructed (happens when the legend is not in any layout and thus QObject-child of QCustomPlot) mParentPlot->legendRemoved(this); } /* no doc for getter, see setSelectedParts */ QCPLegend::SelectableParts QCPLegend::selectedParts() const { // check whether any legend elements selected, if yes, add spItems to return value bool hasSelectedItems = false; for (int i=0; iselected()) { hasSelectedItems = true; break; } } if (hasSelectedItems) return mSelectedParts | spItems; else return mSelectedParts & ~spItems; } /*! Sets the pen, the border of the entire legend is drawn with. */ void QCPLegend::setBorderPen(const QPen &pen) { mBorderPen = pen; } /*! Sets the brush of the legend background. */ void QCPLegend::setBrush(const QBrush &brush) { mBrush = brush; } /*! Sets the default font of legend text. Legend items that draw text (e.g. the name of a graph) will use this font by default. However, a different font can be specified on a per-item-basis by accessing the specific legend item. This function will also set \a font on all already existing legend items. \see QCPAbstractLegendItem::setFont */ void QCPLegend::setFont(const QFont &font) { mFont = font; for (int i=0; isetFont(mFont); } } /*! Sets the default color of legend text. Legend items that draw text (e.g. the name of a graph) will use this color by default. However, a different colors can be specified on a per-item-basis by accessing the specific legend item. This function will also set \a color on all already existing legend items. \see QCPAbstractLegendItem::setTextColor */ void QCPLegend::setTextColor(const QColor &color) { mTextColor = color; for (int i=0; isetTextColor(color); } } /*! Sets the size of legend icons. Legend items that draw an icon (e.g. a visual representation of the graph) will use this size by default. */ void QCPLegend::setIconSize(const QSize &size) { mIconSize = size; } /*! \overload */ void QCPLegend::setIconSize(int width, int height) { mIconSize.setWidth(width); mIconSize.setHeight(height); } /*! Sets the horizontal space in pixels between the legend icon and the text next to it. Legend items that draw an icon (e.g. a visual representation of the graph) and text (e.g. the name of the graph) will use this space by default. */ void QCPLegend::setIconTextPadding(int padding) { mIconTextPadding = padding; } /*! Sets the pen used to draw a border around each legend icon. Legend items that draw an icon (e.g. a visual representation of the graph) will use this pen by default. If no border is wanted, set this to \a Qt::NoPen. */ void QCPLegend::setIconBorderPen(const QPen &pen) { mIconBorderPen = pen; } /*! Sets whether the user can (de-)select the parts in \a selectable by clicking on the QCustomPlot surface. (When \ref QCustomPlot::setInteractions contains \ref QCP::iSelectLegend.) However, even when \a selectable is set to a value not allowing the selection of a specific part, it is still possible to set the selection of this part manually, by calling \ref setSelectedParts directly. \see SelectablePart, setSelectedParts */ void QCPLegend::setSelectableParts(const SelectableParts &selectable) { if (mSelectableParts != selectable) { mSelectableParts = selectable; emit selectableChanged(mSelectableParts); } } /*! Sets the selected state of the respective legend parts described by \ref SelectablePart. When a part is selected, it uses a different pen/font and brush. If some legend items are selected and \a selected doesn't contain \ref spItems, those items become deselected. The entire selection mechanism is handled automatically when \ref QCustomPlot::setInteractions contains iSelectLegend. You only need to call this function when you wish to change the selection state manually. This function can change the selection state of a part even when \ref setSelectableParts was set to a value that actually excludes the part. emits the \ref selectionChanged signal when \a selected is different from the previous selection state. Note that it doesn't make sense to set the selected state \ref spItems here when it wasn't set before, because there's no way to specify which exact items to newly select. Do this by calling \ref QCPAbstractLegendItem::setSelected directly on the legend item you wish to select. \see SelectablePart, setSelectableParts, selectTest, setSelectedBorderPen, setSelectedIconBorderPen, setSelectedBrush, setSelectedFont */ void QCPLegend::setSelectedParts(const SelectableParts &selected) { SelectableParts newSelected = selected; mSelectedParts = this->selectedParts(); // update mSelectedParts in case item selection changed if (mSelectedParts != newSelected) { if (!mSelectedParts.testFlag(spItems) && newSelected.testFlag(spItems)) // attempt to set spItems flag (can't do that) { qDebug() << Q_FUNC_INFO << "spItems flag can not be set, it can only be unset with this function"; newSelected &= ~spItems; } if (mSelectedParts.testFlag(spItems) && !newSelected.testFlag(spItems)) // spItems flag was unset, so clear item selection { for (int i=0; isetSelected(false); } } mSelectedParts = newSelected; emit selectionChanged(mSelectedParts); } } /*! When the legend box is selected, this pen is used to draw the border instead of the normal pen set via \ref setBorderPen. \see setSelectedParts, setSelectableParts, setSelectedBrush */ void QCPLegend::setSelectedBorderPen(const QPen &pen) { mSelectedBorderPen = pen; } /*! Sets the pen legend items will use to draw their icon borders, when they are selected. \see setSelectedParts, setSelectableParts, setSelectedFont */ void QCPLegend::setSelectedIconBorderPen(const QPen &pen) { mSelectedIconBorderPen = pen; } /*! When the legend box is selected, this brush is used to draw the legend background instead of the normal brush set via \ref setBrush. \see setSelectedParts, setSelectableParts, setSelectedBorderPen */ void QCPLegend::setSelectedBrush(const QBrush &brush) { mSelectedBrush = brush; } /*! Sets the default font that is used by legend items when they are selected. This function will also set \a font on all already existing legend items. \see setFont, QCPAbstractLegendItem::setSelectedFont */ void QCPLegend::setSelectedFont(const QFont &font) { mSelectedFont = font; for (int i=0; isetSelectedFont(font); } } /*! Sets the default text color that is used by legend items when they are selected. This function will also set \a color on all already existing legend items. \see setTextColor, QCPAbstractLegendItem::setSelectedTextColor */ void QCPLegend::setSelectedTextColor(const QColor &color) { mSelectedTextColor = color; for (int i=0; isetSelectedTextColor(color); } } /*! Returns the item with index \a i. Note that the linear index depends on the current fill order (\ref setFillOrder). \see itemCount, addItem, itemWithPlottable */ QCPAbstractLegendItem *QCPLegend::item(int index) const { return qobject_cast(elementAt(index)); } /*! Returns the QCPPlottableLegendItem which is associated with \a plottable (e.g. a \ref QCPGraph*). If such an item isn't in the legend, returns 0. \see hasItemWithPlottable */ QCPPlottableLegendItem *QCPLegend::itemWithPlottable(const QCPAbstractPlottable *plottable) const { for (int i=0; i(item(i))) { if (pli->plottable() == plottable) return pli; } } return 0; } /*! Returns the number of items currently in the legend. Note that if empty cells are in the legend (e.g. by calling methods of the \ref QCPLayoutGrid base class which allows creating empty cells), they are included in the returned count. \see item */ int QCPLegend::itemCount() const { return elementCount(); } /*! Returns whether the legend contains \a item. \see hasItemWithPlottable */ bool QCPLegend::hasItem(QCPAbstractLegendItem *item) const { for (int i=0; iitem(i)) return true; } return false; } /*! Returns whether the legend contains a QCPPlottableLegendItem which is associated with \a plottable (e.g. a \ref QCPGraph*). If such an item isn't in the legend, returns false. \see itemWithPlottable */ bool QCPLegend::hasItemWithPlottable(const QCPAbstractPlottable *plottable) const { return itemWithPlottable(plottable); } /*! Adds \a item to the legend, if it's not present already. The element is arranged according to the current fill order (\ref setFillOrder) and wrapping (\ref setWrap). Returns true on sucess, i.e. if the item wasn't in the list already and has been successfuly added. The legend takes ownership of the item. \see removeItem, item, hasItem */ bool QCPLegend::addItem(QCPAbstractLegendItem *item) { return addElement(item); } /*! \overload Removes the item with the specified \a index from the legend and deletes it. After successful removal, the legend is reordered according to the current fill order (\ref setFillOrder) and wrapping (\ref setWrap), so no empty cell remains where the removed \a item was. If you don't want this, rather use the raw element interface of \ref QCPLayoutGrid. Returns true, if successful. Unlike \ref QCPLayoutGrid::removeAt, this method only removes elements derived from \ref QCPAbstractLegendItem. \see itemCount, clearItems */ bool QCPLegend::removeItem(int index) { if (QCPAbstractLegendItem *ali = item(index)) { bool success = remove(ali); if (success) setFillOrder(fillOrder(), true); // gets rid of empty cell by reordering return success; } else return false; } /*! \overload Removes \a item from the legend and deletes it. After successful removal, the legend is reordered according to the current fill order (\ref setFillOrder) and wrapping (\ref setWrap), so no empty cell remains where the removed \a item was. If you don't want this, rather use the raw element interface of \ref QCPLayoutGrid. Returns true, if successful. \see clearItems */ bool QCPLegend::removeItem(QCPAbstractLegendItem *item) { bool success = remove(item); if (success) setFillOrder(fillOrder(), true); // gets rid of empty cell by reordering return success; } /*! Removes all items from the legend. */ void QCPLegend::clearItems() { for (int i=itemCount()-1; i>=0; --i) removeItem(i); } /*! Returns the legend items that are currently selected. If no items are selected, the list is empty. \see QCPAbstractLegendItem::setSelected, setSelectable */ QList QCPLegend::selectedItems() const { QList result; for (int i=0; iselected()) result.append(ali); } } return result; } /*! \internal A convenience function to easily set the QPainter::Antialiased hint on the provided \a painter before drawing main legend elements. This is the antialiasing state the painter passed to the \ref draw method is in by default. This function takes into account the local setting of the antialiasing flag as well as the overrides set with \ref QCustomPlot::setAntialiasedElements and \ref QCustomPlot::setNotAntialiasedElements. \seebaseclassmethod \see setAntialiased */ void QCPLegend::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aeLegend); } /*! \internal Returns the pen used to paint the border of the legend, taking into account the selection state of the legend box. */ QPen QCPLegend::getBorderPen() const { return mSelectedParts.testFlag(spLegendBox) ? mSelectedBorderPen : mBorderPen; } /*! \internal Returns the brush used to paint the background of the legend, taking into account the selection state of the legend box. */ QBrush QCPLegend::getBrush() const { return mSelectedParts.testFlag(spLegendBox) ? mSelectedBrush : mBrush; } /*! \internal Draws the legend box with the provided \a painter. The individual legend items are layerables themselves, thus are drawn independently. */ void QCPLegend::draw(QCPPainter *painter) { // draw background rect: painter->setBrush(getBrush()); painter->setPen(getBorderPen()); painter->drawRect(mOuterRect); } /* inherits documentation from base class */ double QCPLegend::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { if (!mParentPlot) return -1; if (onlySelectable && !mSelectableParts.testFlag(spLegendBox)) return -1; if (mOuterRect.contains(pos.toPoint())) { if (details) details->setValue(spLegendBox); return mParentPlot->selectionTolerance()*0.99; } return -1; } /* inherits documentation from base class */ void QCPLegend::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) { Q_UNUSED(event) mSelectedParts = selectedParts(); // in case item selection has changed if (details.value() == spLegendBox && mSelectableParts.testFlag(spLegendBox)) { SelectableParts selBefore = mSelectedParts; setSelectedParts(additive ? mSelectedParts^spLegendBox : mSelectedParts|spLegendBox); // no need to unset spItems in !additive case, because they will be deselected by QCustomPlot (they're normal QCPLayerables with own deselectEvent) if (selectionStateChanged) *selectionStateChanged = mSelectedParts != selBefore; } } /* inherits documentation from base class */ void QCPLegend::deselectEvent(bool *selectionStateChanged) { mSelectedParts = selectedParts(); // in case item selection has changed if (mSelectableParts.testFlag(spLegendBox)) { SelectableParts selBefore = mSelectedParts; setSelectedParts(selectedParts() & ~spLegendBox); if (selectionStateChanged) *selectionStateChanged = mSelectedParts != selBefore; } } /* inherits documentation from base class */ QCP::Interaction QCPLegend::selectionCategory() const { return QCP::iSelectLegend; } /* inherits documentation from base class */ QCP::Interaction QCPAbstractLegendItem::selectionCategory() const { return QCP::iSelectLegend; } /* inherits documentation from base class */ void QCPLegend::parentPlotInitialized(QCustomPlot *parentPlot) { if (parentPlot && !parentPlot->legend) parentPlot->legend = this; } /* end of 'src/layoutelements/layoutelement-legend.cpp' */ /* including file 'src/layoutelements/layoutelement-textelement.cpp', size 12759 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPTextElement //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPTextElement \brief A layout element displaying a text The text may be specified with \ref setText, the formatting can be controlled with \ref setFont, \ref setTextColor, and \ref setTextFlags. A text element can be added as follows: \snippet documentation/doc-code-snippets/mainwindow.cpp qcptextelement-creation */ /* start documentation of signals */ /*! \fn void QCPTextElement::selectionChanged(bool selected) This signal is emitted when the selection state has changed to \a selected, either by user interaction or by a direct call to \ref setSelected. \see setSelected, setSelectable */ /*! \fn void QCPTextElement::clicked(QMouseEvent *event) This signal is emitted when the text element is clicked. \see doubleClicked, selectTest */ /*! \fn void QCPTextElement::doubleClicked(QMouseEvent *event) This signal is emitted when the text element is double clicked. \see clicked, selectTest */ /* end documentation of signals */ /*! \overload Creates a new QCPTextElement instance and sets default values. The initial text is empty (\ref setText). */ QCPTextElement::QCPTextElement(QCustomPlot *parentPlot) : QCPLayoutElement(parentPlot), mText(), mTextFlags(Qt::AlignCenter|Qt::TextWordWrap), mFont(QFont(QLatin1String("sans serif"), 12)), // will be taken from parentPlot if available, see below mTextColor(Qt::black), mSelectedFont(QFont(QLatin1String("sans serif"), 12)), // will be taken from parentPlot if available, see below mSelectedTextColor(Qt::blue), mSelectable(false), mSelected(false) { if (parentPlot) { mFont = parentPlot->font(); mSelectedFont = parentPlot->font(); } setMargins(QMargins(2, 2, 2, 2)); } /*! \overload Creates a new QCPTextElement instance and sets default values. The initial text is set to \a text. */ QCPTextElement::QCPTextElement(QCustomPlot *parentPlot, const QString &text) : QCPLayoutElement(parentPlot), mText(text), mTextFlags(Qt::AlignCenter|Qt::TextWordWrap), mFont(QFont(QLatin1String("sans serif"), 12)), // will be taken from parentPlot if available, see below mTextColor(Qt::black), mSelectedFont(QFont(QLatin1String("sans serif"), 12)), // will be taken from parentPlot if available, see below mSelectedTextColor(Qt::blue), mSelectable(false), mSelected(false) { if (parentPlot) { mFont = parentPlot->font(); mSelectedFont = parentPlot->font(); } setMargins(QMargins(2, 2, 2, 2)); } /*! \overload Creates a new QCPTextElement instance and sets default values. The initial text is set to \a text with \a pointSize. */ QCPTextElement::QCPTextElement(QCustomPlot *parentPlot, const QString &text, double pointSize) : QCPLayoutElement(parentPlot), mText(text), mTextFlags(Qt::AlignCenter|Qt::TextWordWrap), mFont(QFont(QLatin1String("sans serif"), pointSize)), // will be taken from parentPlot if available, see below mTextColor(Qt::black), mSelectedFont(QFont(QLatin1String("sans serif"), pointSize)), // will be taken from parentPlot if available, see below mSelectedTextColor(Qt::blue), mSelectable(false), mSelected(false) { if (parentPlot) { mFont = parentPlot->font(); mFont.setPointSizeF(pointSize); mSelectedFont = parentPlot->font(); mSelectedFont.setPointSizeF(pointSize); } setMargins(QMargins(2, 2, 2, 2)); } /*! \overload Creates a new QCPTextElement instance and sets default values. The initial text is set to \a text with \a pointSize and the specified \a fontFamily. */ QCPTextElement::QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QString &fontFamily, double pointSize) : QCPLayoutElement(parentPlot), mText(text), mTextFlags(Qt::AlignCenter|Qt::TextWordWrap), mFont(QFont(fontFamily, pointSize)), mTextColor(Qt::black), mSelectedFont(QFont(fontFamily, pointSize)), mSelectedTextColor(Qt::blue), mSelectable(false), mSelected(false) { setMargins(QMargins(2, 2, 2, 2)); } /*! \overload Creates a new QCPTextElement instance and sets default values. The initial text is set to \a text with the specified \a font. */ QCPTextElement::QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QFont &font) : QCPLayoutElement(parentPlot), mText(text), mTextFlags(Qt::AlignCenter|Qt::TextWordWrap), mFont(font), mTextColor(Qt::black), mSelectedFont(font), mSelectedTextColor(Qt::blue), mSelectable(false), mSelected(false) { setMargins(QMargins(2, 2, 2, 2)); } /*! Sets the text that will be displayed to \a text. Multiple lines can be created by insertion of "\n". \see setFont, setTextColor, setTextFlags */ void QCPTextElement::setText(const QString &text) { mText = text; } /*! Sets options for text alignment and wrapping behaviour. \a flags is a bitwise OR-combination of \c Qt::AlignmentFlag and \c Qt::TextFlag enums. Possible enums are: - Qt::AlignLeft - Qt::AlignRight - Qt::AlignHCenter - Qt::AlignJustify - Qt::AlignTop - Qt::AlignBottom - Qt::AlignVCenter - Qt::AlignCenter - Qt::TextDontClip - Qt::TextSingleLine - Qt::TextExpandTabs - Qt::TextShowMnemonic - Qt::TextWordWrap - Qt::TextIncludeTrailingSpaces */ void QCPTextElement::setTextFlags(int flags) { mTextFlags = flags; } /*! Sets the \a font of the text. \see setTextColor, setSelectedFont */ void QCPTextElement::setFont(const QFont &font) { mFont = font; } /*! Sets the \a color of the text. \see setFont, setSelectedTextColor */ void QCPTextElement::setTextColor(const QColor &color) { mTextColor = color; } /*! Sets the \a font of the text that will be used if the text element is selected (\ref setSelected). \see setFont */ void QCPTextElement::setSelectedFont(const QFont &font) { mSelectedFont = font; } /*! Sets the \a color of the text that will be used if the text element is selected (\ref setSelected). \see setTextColor */ void QCPTextElement::setSelectedTextColor(const QColor &color) { mSelectedTextColor = color; } /*! Sets whether the user may select this text element. Note that even when \a selectable is set to false, the selection state may be changed programmatically via \ref setSelected. */ void QCPTextElement::setSelectable(bool selectable) { if (mSelectable != selectable) { mSelectable = selectable; emit selectableChanged(mSelectable); } } /*! Sets the selection state of this text element to \a selected. If the selection has changed, \ref selectionChanged is emitted. Note that this function can change the selection state independently of the current \ref setSelectable state. */ void QCPTextElement::setSelected(bool selected) { if (mSelected != selected) { mSelected = selected; emit selectionChanged(mSelected); } } /* inherits documentation from base class */ void QCPTextElement::applyDefaultAntialiasingHint(QCPPainter *painter) const { applyAntialiasingHint(painter, mAntialiased, QCP::aeOther); } /* inherits documentation from base class */ void QCPTextElement::draw(QCPPainter *painter) { painter->setFont(mainFont()); painter->setPen(QPen(mainTextColor())); painter->drawText(mRect, Qt::AlignCenter, mText, &mTextBoundingRect); } /* inherits documentation from base class */ QSize QCPTextElement::minimumSizeHint() const { QFontMetrics metrics(mFont); QSize result = metrics.boundingRect(0, 0, 0, 0, Qt::AlignCenter, mText).size(); result.rwidth() += mMargins.left() + mMargins.right(); result.rheight() += mMargins.top() + mMargins.bottom(); return result; } /* inherits documentation from base class */ QSize QCPTextElement::maximumSizeHint() const { QFontMetrics metrics(mFont); QSize result = metrics.boundingRect(0, 0, 0, 0, Qt::AlignCenter, mText).size(); result.rheight() += mMargins.top() + mMargins.bottom(); result.setWidth(QWIDGETSIZE_MAX); return result; } /* inherits documentation from base class */ void QCPTextElement::selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) { Q_UNUSED(event) Q_UNUSED(details) if (mSelectable) { bool selBefore = mSelected; setSelected(additive ? !mSelected : true); if (selectionStateChanged) *selectionStateChanged = mSelected != selBefore; } } /* inherits documentation from base class */ void QCPTextElement::deselectEvent(bool *selectionStateChanged) { if (mSelectable) { bool selBefore = mSelected; setSelected(false); if (selectionStateChanged) *selectionStateChanged = mSelected != selBefore; } } /*! Returns 0.99*selectionTolerance (see \ref QCustomPlot::setSelectionTolerance) when \a pos is within the bounding box of the text element's text. Note that this bounding box is updated in the draw call. If \a pos is outside the text's bounding box or if \a onlySelectable is true and this text element is not selectable (\ref setSelectable), returns -1. \seebaseclassmethod */ double QCPTextElement::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; if (mTextBoundingRect.contains(pos.toPoint())) return mParentPlot->selectionTolerance()*0.99; else return -1; } /*! Accepts the mouse event in order to emit the according click signal in the \ref mouseReleaseEvent. \seebaseclassmethod */ void QCPTextElement::mousePressEvent(QMouseEvent *event, const QVariant &details) { Q_UNUSED(details) event->accept(); } /*! Emits the \ref clicked signal if the cursor hasn't moved by more than a few pixels since the \ref mousePressEvent. \seebaseclassmethod */ void QCPTextElement::mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) { if ((QPointF(event->pos())-startPos).manhattanLength() <= 3) emit clicked(event); } /*! Emits the \ref doubleClicked signal. \seebaseclassmethod */ void QCPTextElement::mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) { Q_UNUSED(details) emit doubleClicked(event); } /*! \internal Returns the main font to be used. This is mSelectedFont if \ref setSelected is set to true, else mFont is returned. */ QFont QCPTextElement::mainFont() const { return mSelected ? mSelectedFont : mFont; } /*! \internal Returns the main color to be used. This is mSelectedTextColor if \ref setSelected is set to true, else mTextColor is returned. */ QColor QCPTextElement::mainTextColor() const { return mSelected ? mSelectedTextColor : mTextColor; } /* end of 'src/layoutelements/layoutelement-textelement.cpp' */ /* including file 'src/layoutelements/layoutelement-colorscale.cpp', size 25910 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPColorScale //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPColorScale \brief A color scale for use with color coding data such as QCPColorMap This layout element can be placed on the plot to correlate a color gradient with data values. It is usually used in combination with one or multiple \ref QCPColorMap "QCPColorMaps". \image html QCPColorScale.png The color scale can be either horizontal or vertical, as shown in the image above. The orientation and the side where the numbers appear is controlled with \ref setType. Use \ref QCPColorMap::setColorScale to connect a color map with a color scale. Once they are connected, they share their gradient, data range and data scale type (\ref setGradient, \ref setDataRange, \ref setDataScaleType). Multiple color maps may be associated with a single color scale, to make them all synchronize these properties. To have finer control over the number display and axis behaviour, you can directly access the \ref axis. See the documentation of QCPAxis for details about configuring axes. For example, if you want to change the number of automatically generated ticks, call \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcolorscale-tickcount Placing a color scale next to the main axis rect works like with any other layout element: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcolorscale-creation In this case we have placed it to the right of the default axis rect, so it wasn't necessary to call \ref setType, since \ref QCPAxis::atRight is already the default. The text next to the color scale can be set with \ref setLabel. For optimum appearance (like in the image above), it may be desirable to line up the axis rect and the borders of the color scale. Use a \ref QCPMarginGroup to achieve this: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcolorscale-margingroup Color scales are initialized with a non-zero minimum top and bottom margin (\ref setMinimumMargins), because vertical color scales are most common and the minimum top/bottom margin makes sure it keeps some distance to the top/bottom widget border. So if you change to a horizontal color scale by setting \ref setType to \ref QCPAxis::atBottom or \ref QCPAxis::atTop, you might want to also change the minimum margins accordingly, e.g. setMinimumMargins(QMargins(6, 0, 6, 0)). */ /* start documentation of inline functions */ /*! \fn QCPAxis *QCPColorScale::axis() const Returns the internal \ref QCPAxis instance of this color scale. You can access it to alter the appearance and behaviour of the axis. \ref QCPColorScale duplicates some properties in its interface for convenience. Those are \ref setDataRange (\ref QCPAxis::setRange), \ref setDataScaleType (\ref QCPAxis::setScaleType), and the method \ref setLabel (\ref QCPAxis::setLabel). As they each are connected, it does not matter whether you use the method on the QCPColorScale or on its QCPAxis. If the type of the color scale is changed with \ref setType, the axis returned by this method will change, too, to either the left, right, bottom or top axis, depending on which type was set. */ /* end documentation of signals */ /* start documentation of signals */ /*! \fn void QCPColorScale::dataRangeChanged(const QCPRange &newRange); This signal is emitted when the data range changes. \see setDataRange */ /*! \fn void QCPColorScale::dataScaleTypeChanged(QCPAxis::ScaleType scaleType); This signal is emitted when the data scale type changes. \see setDataScaleType */ /*! \fn void QCPColorScale::gradientChanged(const QCPColorGradient &newGradient); This signal is emitted when the gradient changes. \see setGradient */ /* end documentation of signals */ /*! Constructs a new QCPColorScale. */ QCPColorScale::QCPColorScale(QCustomPlot *parentPlot) : QCPLayoutElement(parentPlot), mType(QCPAxis::atTop), // set to atTop such that setType(QCPAxis::atRight) below doesn't skip work because it thinks it's already atRight mDataScaleType(QCPAxis::stLinear), mBarWidth(20), mAxisRect(new QCPColorScaleAxisRectPrivate(this)) { setMinimumMargins(QMargins(0, 6, 0, 6)); // for default right color scale types, keep some room at bottom and top (important if no margin group is used) setType(QCPAxis::atRight); setDataRange(QCPRange(0, 6)); } QCPColorScale::~QCPColorScale() { delete mAxisRect; } /* undocumented getter */ QString QCPColorScale::label() const { if (!mColorAxis) { qDebug() << Q_FUNC_INFO << "internal color axis undefined"; return QString(); } return mColorAxis.data()->label(); } /* undocumented getter */ bool QCPColorScale::rangeDrag() const { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return false; } return mAxisRect.data()->rangeDrag().testFlag(QCPAxis::orientation(mType)) && mAxisRect.data()->rangeDragAxis(QCPAxis::orientation(mType)) && mAxisRect.data()->rangeDragAxis(QCPAxis::orientation(mType))->orientation() == QCPAxis::orientation(mType); } /* undocumented getter */ bool QCPColorScale::rangeZoom() const { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return false; } return mAxisRect.data()->rangeZoom().testFlag(QCPAxis::orientation(mType)) && mAxisRect.data()->rangeZoomAxis(QCPAxis::orientation(mType)) && mAxisRect.data()->rangeZoomAxis(QCPAxis::orientation(mType))->orientation() == QCPAxis::orientation(mType); } /*! Sets at which side of the color scale the axis is placed, and thus also its orientation. Note that after setting \a type to a different value, the axis returned by \ref axis() will be a different one. The new axis will adopt the following properties from the previous axis: The range, scale type, label and ticker (the latter will be shared and not copied). */ void QCPColorScale::setType(QCPAxis::AxisType type) { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } if (mType != type) { mType = type; QCPRange rangeTransfer(0, 6); QString labelTransfer; QSharedPointer tickerTransfer; // transfer/revert some settings on old axis if it exists: bool doTransfer = (bool)mColorAxis; if (doTransfer) { rangeTransfer = mColorAxis.data()->range(); labelTransfer = mColorAxis.data()->label(); tickerTransfer = mColorAxis.data()->ticker(); mColorAxis.data()->setLabel(QString()); disconnect(mColorAxis.data(), SIGNAL(rangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange))); disconnect(mColorAxis.data(), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType))); } QList allAxisTypes = QList() << QCPAxis::atLeft << QCPAxis::atRight << QCPAxis::atBottom << QCPAxis::atTop; foreach (QCPAxis::AxisType atype, allAxisTypes) { mAxisRect.data()->axis(atype)->setTicks(atype == mType); mAxisRect.data()->axis(atype)->setTickLabels(atype== mType); } // set new mColorAxis pointer: mColorAxis = mAxisRect.data()->axis(mType); // transfer settings to new axis: if (doTransfer) { mColorAxis.data()->setRange(rangeTransfer); // range transfer necessary if axis changes from vertical to horizontal or vice versa (axes with same orientation are synchronized via signals) mColorAxis.data()->setLabel(labelTransfer); mColorAxis.data()->setTicker(tickerTransfer); } connect(mColorAxis.data(), SIGNAL(rangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange))); connect(mColorAxis.data(), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType))); mAxisRect.data()->setRangeDragAxes(QList() << mColorAxis.data()); } } /*! Sets the range spanned by the color gradient and that is shown by the axis in the color scale. It is equivalent to calling QCPColorMap::setDataRange on any of the connected color maps. It is also equivalent to directly accessing the \ref axis and setting its range with \ref QCPAxis::setRange. \see setDataScaleType, setGradient, rescaleDataRange */ void QCPColorScale::setDataRange(const QCPRange &dataRange) { if (mDataRange.lower != dataRange.lower || mDataRange.upper != dataRange.upper) { mDataRange = dataRange; if (mColorAxis) mColorAxis.data()->setRange(mDataRange); emit dataRangeChanged(mDataRange); } } /*! Sets the scale type of the color scale, i.e. whether values are linearly associated with colors or logarithmically. It is equivalent to calling QCPColorMap::setDataScaleType on any of the connected color maps. It is also equivalent to directly accessing the \ref axis and setting its scale type with \ref QCPAxis::setScaleType. \see setDataRange, setGradient */ void QCPColorScale::setDataScaleType(QCPAxis::ScaleType scaleType) { if (mDataScaleType != scaleType) { mDataScaleType = scaleType; if (mColorAxis) mColorAxis.data()->setScaleType(mDataScaleType); if (mDataScaleType == QCPAxis::stLogarithmic) setDataRange(mDataRange.sanitizedForLogScale()); emit dataScaleTypeChanged(mDataScaleType); } } /*! Sets the color gradient that will be used to represent data values. It is equivalent to calling QCPColorMap::setGradient on any of the connected color maps. \see setDataRange, setDataScaleType */ void QCPColorScale::setGradient(const QCPColorGradient &gradient) { if (mGradient != gradient) { mGradient = gradient; if (mAxisRect) mAxisRect.data()->mGradientImageInvalidated = true; emit gradientChanged(mGradient); } } /*! Sets the axis label of the color scale. This is equivalent to calling \ref QCPAxis::setLabel on the internal \ref axis. */ void QCPColorScale::setLabel(const QString &str) { if (!mColorAxis) { qDebug() << Q_FUNC_INFO << "internal color axis undefined"; return; } mColorAxis.data()->setLabel(str); } /*! Sets the width (or height, for horizontal color scales) the bar where the gradient is displayed will have. */ void QCPColorScale::setBarWidth(int width) { mBarWidth = width; } /*! Sets whether the user can drag the data range (\ref setDataRange). Note that \ref QCP::iRangeDrag must be in the QCustomPlot's interactions (\ref QCustomPlot::setInteractions) to allow range dragging. */ void QCPColorScale::setRangeDrag(bool enabled) { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } if (enabled) mAxisRect.data()->setRangeDrag(QCPAxis::orientation(mType)); else mAxisRect.data()->setRangeDrag(0); } /*! Sets whether the user can zoom the data range (\ref setDataRange) by scrolling the mouse wheel. Note that \ref QCP::iRangeZoom must be in the QCustomPlot's interactions (\ref QCustomPlot::setInteractions) to allow range dragging. */ void QCPColorScale::setRangeZoom(bool enabled) { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } if (enabled) mAxisRect.data()->setRangeZoom(QCPAxis::orientation(mType)); else mAxisRect.data()->setRangeZoom(0); } /*! Returns a list of all the color maps associated with this color scale. */ QList QCPColorScale::colorMaps() const { QList result; for (int i=0; iplottableCount(); ++i) { if (QCPColorMap *cm = qobject_cast(mParentPlot->plottable(i))) if (cm->colorScale() == this) result.append(cm); } return result; } /*! Changes the data range such that all color maps associated with this color scale are fully mapped to the gradient in the data dimension. \see setDataRange */ void QCPColorScale::rescaleDataRange(bool onlyVisibleMaps) { QList maps = colorMaps(); QCPRange newRange; bool haveRange = false; QCP::SignDomain sign = QCP::sdBoth; if (mDataScaleType == QCPAxis::stLogarithmic) sign = (mDataRange.upper < 0 ? QCP::sdNegative : QCP::sdPositive); for (int i=0; irealVisibility() && onlyVisibleMaps) continue; QCPRange mapRange; if (maps.at(i)->colorScale() == this) { bool currentFoundRange = true; mapRange = maps.at(i)->data()->dataBounds(); if (sign == QCP::sdPositive) { if (mapRange.lower <= 0 && mapRange.upper > 0) mapRange.lower = mapRange.upper*1e-3; else if (mapRange.lower <= 0 && mapRange.upper <= 0) currentFoundRange = false; } else if (sign == QCP::sdNegative) { if (mapRange.upper >= 0 && mapRange.lower < 0) mapRange.upper = mapRange.lower*1e-3; else if (mapRange.upper >= 0 && mapRange.lower >= 0) currentFoundRange = false; } if (currentFoundRange) { if (!haveRange) newRange = mapRange; else newRange.expand(mapRange); haveRange = true; } } } if (haveRange) { if (!QCPRange::validRange(newRange)) // likely due to range being zero (plottable has only constant data in this dimension), shift current range to at least center the data { double center = (newRange.lower+newRange.upper)*0.5; // upper and lower should be equal anyway, but just to make sure, incase validRange returned false for other reason if (mDataScaleType == QCPAxis::stLinear) { newRange.lower = center-mDataRange.size()/2.0; newRange.upper = center+mDataRange.size()/2.0; } else // mScaleType == stLogarithmic { newRange.lower = center/qSqrt(mDataRange.upper/mDataRange.lower); newRange.upper = center*qSqrt(mDataRange.upper/mDataRange.lower); } } setDataRange(newRange); } } /* inherits documentation from base class */ void QCPColorScale::update(UpdatePhase phase) { QCPLayoutElement::update(phase); if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } mAxisRect.data()->update(phase); switch (phase) { case upMargins: { if (mType == QCPAxis::atBottom || mType == QCPAxis::atTop) { setMaximumSize(QWIDGETSIZE_MAX, mBarWidth+mAxisRect.data()->margins().top()+mAxisRect.data()->margins().bottom()+margins().top()+margins().bottom()); setMinimumSize(0, mBarWidth+mAxisRect.data()->margins().top()+mAxisRect.data()->margins().bottom()+margins().top()+margins().bottom()); } else { setMaximumSize(mBarWidth+mAxisRect.data()->margins().left()+mAxisRect.data()->margins().right()+margins().left()+margins().right(), QWIDGETSIZE_MAX); setMinimumSize(mBarWidth+mAxisRect.data()->margins().left()+mAxisRect.data()->margins().right()+margins().left()+margins().right(), 0); } break; } case upLayout: { mAxisRect.data()->setOuterRect(rect()); break; } default: break; } } /* inherits documentation from base class */ void QCPColorScale::applyDefaultAntialiasingHint(QCPPainter *painter) const { painter->setAntialiasing(false); } /* inherits documentation from base class */ void QCPColorScale::mousePressEvent(QMouseEvent *event, const QVariant &details) { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } mAxisRect.data()->mousePressEvent(event, details); } /* inherits documentation from base class */ void QCPColorScale::mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } mAxisRect.data()->mouseMoveEvent(event, startPos); } /* inherits documentation from base class */ void QCPColorScale::mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } mAxisRect.data()->mouseReleaseEvent(event, startPos); } /* inherits documentation from base class */ void QCPColorScale::wheelEvent(QWheelEvent *event) { if (!mAxisRect) { qDebug() << Q_FUNC_INFO << "internal axis rect was deleted"; return; } mAxisRect.data()->wheelEvent(event); } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPColorScaleAxisRectPrivate //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPColorScaleAxisRectPrivate \internal \brief An axis rect subclass for use in a QCPColorScale This is a private class and not part of the public QCustomPlot interface. It provides the axis rect functionality for the QCPColorScale class. */ /*! Creates a new instance, as a child of \a parentColorScale. */ QCPColorScaleAxisRectPrivate::QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale) : QCPAxisRect(parentColorScale->parentPlot(), true), mParentColorScale(parentColorScale), mGradientImageInvalidated(true) { setParentLayerable(parentColorScale); setMinimumMargins(QMargins(0, 0, 0, 0)); QList allAxisTypes = QList() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight; foreach (QCPAxis::AxisType type, allAxisTypes) { axis(type)->setVisible(true); axis(type)->grid()->setVisible(false); axis(type)->setPadding(0); connect(axis(type), SIGNAL(selectionChanged(QCPAxis::SelectableParts)), this, SLOT(axisSelectionChanged(QCPAxis::SelectableParts))); connect(axis(type), SIGNAL(selectableChanged(QCPAxis::SelectableParts)), this, SLOT(axisSelectableChanged(QCPAxis::SelectableParts))); } connect(axis(QCPAxis::atLeft), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atRight), SLOT(setRange(QCPRange))); connect(axis(QCPAxis::atRight), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atLeft), SLOT(setRange(QCPRange))); connect(axis(QCPAxis::atBottom), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atTop), SLOT(setRange(QCPRange))); connect(axis(QCPAxis::atTop), SIGNAL(rangeChanged(QCPRange)), axis(QCPAxis::atBottom), SLOT(setRange(QCPRange))); connect(axis(QCPAxis::atLeft), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atRight), SLOT(setScaleType(QCPAxis::ScaleType))); connect(axis(QCPAxis::atRight), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atLeft), SLOT(setScaleType(QCPAxis::ScaleType))); connect(axis(QCPAxis::atBottom), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atTop), SLOT(setScaleType(QCPAxis::ScaleType))); connect(axis(QCPAxis::atTop), SIGNAL(scaleTypeChanged(QCPAxis::ScaleType)), axis(QCPAxis::atBottom), SLOT(setScaleType(QCPAxis::ScaleType))); // make layer transfers of color scale transfer to axis rect and axes // the axes must be set after axis rect, such that they appear above color gradient drawn by axis rect: connect(parentColorScale, SIGNAL(layerChanged(QCPLayer*)), this, SLOT(setLayer(QCPLayer*))); foreach (QCPAxis::AxisType type, allAxisTypes) connect(parentColorScale, SIGNAL(layerChanged(QCPLayer*)), axis(type), SLOT(setLayer(QCPLayer*))); } /*! \internal Updates the color gradient image if necessary, by calling \ref updateGradientImage, then draws it. Then the axes are drawn by calling the \ref QCPAxisRect::draw base class implementation. \seebaseclassmethod */ void QCPColorScaleAxisRectPrivate::draw(QCPPainter *painter) { if (mGradientImageInvalidated) updateGradientImage(); bool mirrorHorz = false; bool mirrorVert = false; if (mParentColorScale->mColorAxis) { mirrorHorz = mParentColorScale->mColorAxis.data()->rangeReversed() && (mParentColorScale->type() == QCPAxis::atBottom || mParentColorScale->type() == QCPAxis::atTop); mirrorVert = mParentColorScale->mColorAxis.data()->rangeReversed() && (mParentColorScale->type() == QCPAxis::atLeft || mParentColorScale->type() == QCPAxis::atRight); } painter->drawImage(rect().adjusted(0, -1, 0, -1), mGradientImage.mirrored(mirrorHorz, mirrorVert)); QCPAxisRect::draw(painter); } /*! \internal Uses the current gradient of the parent \ref QCPColorScale (specified in the constructor) to generate a gradient image. This gradient image will be used in the \ref draw method. */ void QCPColorScaleAxisRectPrivate::updateGradientImage() { if (rect().isEmpty()) return; const QImage::Format format = QImage::Format_ARGB32_Premultiplied; int n = mParentColorScale->mGradient.levelCount(); int w, h; QVector data(n); for (int i=0; imType == QCPAxis::atBottom || mParentColorScale->mType == QCPAxis::atTop) { w = n; h = rect().height(); mGradientImage = QImage(w, h, format); QVector pixels; for (int y=0; y(mGradientImage.scanLine(y))); mParentColorScale->mGradient.colorize(data.constData(), QCPRange(0, n-1), pixels.first(), n); for (int y=1; y(mGradientImage.scanLine(y)); const QRgb lineColor = mParentColorScale->mGradient.color(data[h-1-y], QCPRange(0, n-1)); for (int x=0; x allAxisTypes = QList() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight; foreach (QCPAxis::AxisType type, allAxisTypes) { if (QCPAxis *senderAxis = qobject_cast(sender())) if (senderAxis->axisType() == type) continue; if (axis(type)->selectableParts().testFlag(QCPAxis::spAxis)) { if (selectedParts.testFlag(QCPAxis::spAxis)) axis(type)->setSelectedParts(axis(type)->selectedParts() | QCPAxis::spAxis); else axis(type)->setSelectedParts(axis(type)->selectedParts() & ~QCPAxis::spAxis); } } } /*! \internal This slot is connected to the selectableChanged signals of the four axes in the constructor. It synchronizes the selectability of the axes. */ void QCPColorScaleAxisRectPrivate::axisSelectableChanged(QCPAxis::SelectableParts selectableParts) { // synchronize axis base selectability: QList allAxisTypes = QList() << QCPAxis::atBottom << QCPAxis::atTop << QCPAxis::atLeft << QCPAxis::atRight; foreach (QCPAxis::AxisType type, allAxisTypes) { if (QCPAxis *senderAxis = qobject_cast(sender())) if (senderAxis->axisType() == type) continue; if (axis(type)->selectableParts().testFlag(QCPAxis::spAxis)) { if (selectableParts.testFlag(QCPAxis::spAxis)) axis(type)->setSelectableParts(axis(type)->selectableParts() | QCPAxis::spAxis); else axis(type)->setSelectableParts(axis(type)->selectableParts() & ~QCPAxis::spAxis); } } } /* end of 'src/layoutelements/layoutelement-colorscale.cpp' */ /* including file 'src/plottables/plottable-graph.cpp', size 72363 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPGraphData //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPGraphData \brief Holds the data of one single data point for QCPGraph. The stored data is: \li \a key: coordinate on the key axis of this data point (this is the \a mainKey and the \a sortKey) \li \a value: coordinate on the value axis of this data point (this is the \a mainValue) The container for storing multiple data points is \ref QCPGraphDataContainer. It is a typedef for \ref QCPDataContainer with \ref QCPGraphData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods. \see QCPGraphDataContainer */ /* start documentation of inline functions */ /*! \fn double QCPGraphData::sortKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static QCPGraphData QCPGraphData::fromSortKey(double sortKey) Returns a data point with the specified \a sortKey. All other members are set to zero. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static static bool QCPGraphData::sortKeyIsMainKey() Since the member \a key is both the data point key coordinate and the data ordering parameter, this method returns true. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPGraphData::mainKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPGraphData::mainValue() const Returns the \a value member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn QCPRange QCPGraphData::valueRange() const Returns a QCPRange with both lower and upper boundary set to \a value of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /* end documentation of inline functions */ /*! Constructs a data point with key and value set to zero. */ QCPGraphData::QCPGraphData() : key(0), value(0) { } /*! Constructs a data point with the specified \a key and \a value. */ QCPGraphData::QCPGraphData(double key, double value) : key(key), value(value) { } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPGraph //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPGraph \brief A plottable representing a graph in a plot. \image html QCPGraph.png Usually you create new graphs by calling QCustomPlot::addGraph. The resulting instance can be accessed via QCustomPlot::graph. To plot data, assign it with the \ref setData or \ref addData functions. Alternatively, you can also access and modify the data via the \ref data method, which returns a pointer to the internal \ref QCPGraphDataContainer. Graphs are used to display single-valued data. Single-valued means that there should only be one data point per unique key coordinate. In other words, the graph can't have \a loops. If you do want to plot non-single-valued curves, rather use the QCPCurve plottable. Gaps in the graph line can be created by adding data points with NaN as value (qQNaN() or std::numeric_limits::quiet_NaN()) in between the two data points that shall be separated. \section qcpgraph-appearance Changing the appearance The appearance of the graph is mainly determined by the line style, scatter style, brush and pen of the graph (\ref setLineStyle, \ref setScatterStyle, \ref setBrush, \ref setPen). \subsection filling Filling under or between graphs QCPGraph knows two types of fills: Normal graph fills towards the zero-value-line parallel to the key axis of the graph, and fills between two graphs, called channel fills. To enable a fill, just set a brush with \ref setBrush which is neither Qt::NoBrush nor fully transparent. By default, a normal fill towards the zero-value-line will be drawn. To set up a channel fill between this graph and another one, call \ref setChannelFillGraph with the other graph as parameter. \see QCustomPlot::addGraph, QCustomPlot::graph */ /* start of documentation of inline functions */ /*! \fn QSharedPointer QCPGraph::data() const Returns a shared pointer to the internal data storage of type \ref QCPGraphDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular \ref setData or \ref addData methods. */ /* end of documentation of inline functions */ /*! Constructs a graph which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. The created QCPGraph is automatically registered with the QCustomPlot instance inferred from \a keyAxis. This QCustomPlot instance takes ownership of the QCPGraph, so do not delete it manually but use QCustomPlot::removePlottable() instead. To directly create a graph inside a plot, you can also use the simpler QCustomPlot::addGraph function. */ QCPGraph::QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable1D(keyAxis, valueAxis) { // special handling for QCPGraphs to maintain the simple graph interface: mParentPlot->registerGraph(this); setPen(QPen(Qt::blue, 0)); setBrush(Qt::NoBrush); setLineStyle(lsLine); setScatterSkip(0); setChannelFillGraph(0); setAdaptiveSampling(true); } QCPGraph::~QCPGraph() { } /*! \overload Replaces the current data container with the provided \a data container. Since a QSharedPointer is used, multiple QCPGraphs may share the same data container safely. Modifying the data in the container will then affect all graphs that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpgraph-datasharing-1 If you do not wish to share containers, but create a copy from an existing container, rather use the \ref QCPDataContainer::set method on the graph's data container directly: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpgraph-datasharing-2 \see addData */ void QCPGraph::setData(QSharedPointer data) { mDataContainer = data; } /*! \overload Replaces the current data with the provided points in \a keys and \a values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. \see addData */ void QCPGraph::setData(const QVector &keys, const QVector &values, bool alreadySorted) { mDataContainer->clear(); addData(keys, values, alreadySorted); } /*! Sets how the single data points are connected in the plot. For scatter-only plots, set \a ls to \ref lsNone and \ref setScatterStyle to the desired scatter style. \see setScatterStyle */ void QCPGraph::setLineStyle(LineStyle ls) { mLineStyle = ls; } /*! Sets the visual appearance of single data points in the plot. If set to \ref QCPScatterStyle::ssNone, no scatter points are drawn (e.g. for line-only-plots with appropriate line style). \see QCPScatterStyle, setLineStyle */ void QCPGraph::setScatterStyle(const QCPScatterStyle &style) { mScatterStyle = style; } /*! If scatters are displayed (scatter style not \ref QCPScatterStyle::ssNone), \a skip number of scatter points are skipped/not drawn after every drawn scatter point. This can be used to make the data appear sparser while for example still having a smooth line, and to improve performance for very high density plots. If \a skip is set to 0 (default), all scatter points are drawn. \see setScatterStyle */ void QCPGraph::setScatterSkip(int skip) { mScatterSkip = qMax(0, skip); } /*! Sets the target graph for filling the area between this graph and \a targetGraph with the current brush (\ref setBrush). When \a targetGraph is set to 0, a normal graph fill to the zero-value-line will be shown. To disable any filling, set the brush to Qt::NoBrush. \see setBrush */ void QCPGraph::setChannelFillGraph(QCPGraph *targetGraph) { // prevent setting channel target to this graph itself: if (targetGraph == this) { qDebug() << Q_FUNC_INFO << "targetGraph is this graph itself"; mChannelFillGraph = 0; return; } // prevent setting channel target to a graph not in the plot: if (targetGraph && targetGraph->mParentPlot != mParentPlot) { qDebug() << Q_FUNC_INFO << "targetGraph not in same plot"; mChannelFillGraph = 0; return; } mChannelFillGraph = targetGraph; } /*! Sets whether adaptive sampling shall be used when plotting this graph. QCustomPlot's adaptive sampling technique can drastically improve the replot performance for graphs with a larger number of points (e.g. above 10,000), without notably changing the appearance of the graph. By default, adaptive sampling is enabled. Even if enabled, QCustomPlot decides whether adaptive sampling shall actually be used on a per-graph basis. So leaving adaptive sampling enabled has no disadvantage in almost all cases. \image html adaptive-sampling-line.png "A line plot of 500,000 points without and with adaptive sampling" As can be seen, line plots experience no visual degradation from adaptive sampling. Outliers are reproduced reliably, as well as the overall shape of the data set. The replot time reduces dramatically though. This allows QCustomPlot to display large amounts of data in realtime. \image html adaptive-sampling-scatter.png "A scatter plot of 100,000 points without and with adaptive sampling" Care must be taken when using high-density scatter plots in combination with adaptive sampling. The adaptive sampling algorithm treats scatter plots more carefully than line plots which still gives a significant reduction of replot times, but not quite as much as for line plots. This is because scatter plots inherently need more data points to be preserved in order to still resemble the original, non-adaptive-sampling plot. As shown above, the results still aren't quite identical, as banding occurs for the outer data points. This is in fact intentional, such that the boundaries of the data cloud stay visible to the viewer. How strong the banding appears, depends on the point density, i.e. the number of points in the plot. For some situations with scatter plots it might thus be desirable to manually turn adaptive sampling off. For example, when saving the plot to disk. This can be achieved by setting \a enabled to false before issuing a command like \ref QCustomPlot::savePng, and setting \a enabled back to true afterwards. */ void QCPGraph::setAdaptiveSampling(bool enabled) { mAdaptiveSampling = enabled; } /*! \overload Adds the provided points in \a keys and \a values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPGraph::addData(const QVector &keys, const QVector &values, bool alreadySorted) { if (keys.size() != values.size()) qDebug() << Q_FUNC_INFO << "keys and values have different sizes:" << keys.size() << values.size(); const int n = qMin(keys.size(), values.size()); QVector tempData(n); QVector::iterator it = tempData.begin(); const QVector::iterator itEnd = tempData.end(); int i = 0; while (it != itEnd) { it->key = keys[i]; it->value = values[i]; ++it; ++i; } mDataContainer->add(tempData, alreadySorted); // don't modify tempData beyond this to prevent copy on write } /*! \overload Adds the provided data point as \a key and \a value to the current data. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPGraph::addData(double key, double value) { mDataContainer->add(QCPGraphData(key, value)); } /* inherits documentation from base class */ double QCPGraph::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint())) { QCPGraphDataContainer::const_iterator closestDataPoint = mDataContainer->constEnd(); double result = pointDistance(pos, closestDataPoint); if (details) { int pointIndex = closestDataPoint-mDataContainer->constBegin(); details->setValue(QCPDataSelection(QCPDataRange(pointIndex, pointIndex+1))); } return result; } else return -1; } /* inherits documentation from base class */ QCPRange QCPGraph::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const { return mDataContainer->keyRange(foundRange, inSignDomain); } /* inherits documentation from base class */ QCPRange QCPGraph::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const { return mDataContainer->valueRange(foundRange, inSignDomain, inKeyRange); } /* inherits documentation from base class */ void QCPGraph::draw(QCPPainter *painter) { if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (mKeyAxis.data()->range().size() <= 0 || mDataContainer->isEmpty()) return; if (mLineStyle == lsNone && mScatterStyle.isNone()) return; QVector lines, scatters; // line and (if necessary) scatter pixel coordinates will be stored here while iterating over segments // loop over and draw segments of unselected/selected data: QList selectedSegments, unselectedSegments, allSegments; getDataSegments(selectedSegments, unselectedSegments); allSegments << unselectedSegments << selectedSegments; for (int i=0; i= unselectedSegments.size(); // get line pixel points appropriate to line style: QCPDataRange lineDataRange = isSelectedSegment ? allSegments.at(i) : allSegments.at(i).adjusted(-1, 1); // unselected segments extend lines to bordering selected data point (safe to exceed total data bounds in first/last segment, getLines takes care) getLines(&lines, lineDataRange); // check data validity if flag set: #ifdef QCUSTOMPLOT_CHECK_DATA QCPGraphDataContainer::const_iterator it; for (it = mDataContainer->constBegin(); it != mDataContainer->constEnd(); ++it) { if (QCP::isInvalidData(it->key, it->value)) qDebug() << Q_FUNC_INFO << "Data point at" << it->key << "invalid." << "Plottable name:" << name(); } #endif // draw fill of graph: if (isSelectedSegment && mSelectionDecorator) mSelectionDecorator->applyBrush(painter); else painter->setBrush(mBrush); painter->setPen(Qt::NoPen); drawFill(painter, &lines); // draw line: if (mLineStyle != lsNone) { if (isSelectedSegment && mSelectionDecorator) mSelectionDecorator->applyPen(painter); else painter->setPen(mPen); painter->setBrush(Qt::NoBrush); if (mLineStyle == lsImpulse) drawImpulsePlot(painter, lines); else drawLinePlot(painter, lines); // also step plots can be drawn as a line plot } // draw scatters: QCPScatterStyle finalScatterStyle = mScatterStyle; if (isSelectedSegment && mSelectionDecorator) finalScatterStyle = mSelectionDecorator->getFinalScatterStyle(mScatterStyle); if (!finalScatterStyle.isNone()) { getScatters(&scatters, allSegments.at(i)); drawScatterPlot(painter, scatters, finalScatterStyle); } } // draw other selection decoration that isn't just line/scatter pens and brushes: if (mSelectionDecorator) mSelectionDecorator->drawDecoration(painter, selection()); } /* inherits documentation from base class */ void QCPGraph::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const { // draw fill: if (mBrush.style() != Qt::NoBrush) { applyFillAntialiasingHint(painter); painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0), mBrush); } // draw line vertically centered: if (mLineStyle != lsNone) { applyDefaultAntialiasingHint(painter); painter->setPen(mPen); painter->drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0)); // +5 on x2 else last segment is missing from dashed/dotted pens } // draw scatter symbol: if (!mScatterStyle.isNone()) { applyScattersAntialiasingHint(painter); // scale scatter pixmap if it's too large to fit in legend icon rect: if (mScatterStyle.shape() == QCPScatterStyle::ssPixmap && (mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height())) { QCPScatterStyle scaledStyle(mScatterStyle); scaledStyle.setPixmap(scaledStyle.pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); scaledStyle.applyTo(painter, mPen); scaledStyle.drawShape(painter, QRectF(rect).center()); } else { mScatterStyle.applyTo(painter, mPen); mScatterStyle.drawShape(painter, QRectF(rect).center()); } } } /*! \internal This method retrieves an optimized set of data points via \ref getOptimizedLineData, an branches out to the line style specific functions such as \ref dataToLines, \ref dataToStepLeftLines, etc. according to the line style of the graph. \a lines will be filled with points in pixel coordinates, that can be drawn with the according draw functions like \ref drawLinePlot and \ref drawImpulsePlot. The points returned in \a lines aren't necessarily the original data points. For example, step line styles require additional points to form the steps when drawn. If the line style of the graph is \ref lsNone, the \a lines vector will be empty. \a dataRange specifies the beginning and ending data indices that will be taken into account for conversion. In this function, the specified range may exceed the total data bounds without harm: a correspondingly trimmed data range will be used. This takes the burden off the user of this function to check for valid indices in \a dataRange, e.g. when extending ranges coming from \ref getDataSegments. \see getScatters */ void QCPGraph::getLines(QVector *lines, const QCPDataRange &dataRange) const { if (!lines) return; QCPGraphDataContainer::const_iterator begin, end; getVisibleDataBounds(begin, end, dataRange); if (begin == end) { lines->clear(); return; } QVector lineData; if (mLineStyle != lsNone) getOptimizedLineData(&lineData, begin, end); switch (mLineStyle) { case lsNone: lines->clear(); break; case lsLine: *lines = dataToLines(lineData); break; case lsStepLeft: *lines = dataToStepLeftLines(lineData); break; case lsStepRight: *lines = dataToStepRightLines(lineData); break; case lsStepCenter: *lines = dataToStepCenterLines(lineData); break; case lsImpulse: *lines = dataToImpulseLines(lineData); break; } } /*! \internal This method retrieves an optimized set of data points via \ref getOptimizedScatterData and then converts them to pixel coordinates. The resulting points are returned in \a scatters, and can be passed to \ref drawScatterPlot. \a dataRange specifies the beginning and ending data indices that will be taken into account for conversion. In this function, the specified range may exceed the total data bounds without harm: a correspondingly trimmed data range will be used. This takes the burden off the user of this function to check for valid indices in \a dataRange, e.g. when extending ranges coming from \ref getDataSegments. */ void QCPGraph::getScatters(QVector *scatters, const QCPDataRange &dataRange) const { if (!scatters) return; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; scatters->clear(); return; } QCPGraphDataContainer::const_iterator begin, end; getVisibleDataBounds(begin, end, dataRange); if (begin == end) { scatters->clear(); return; } QVector data; getOptimizedScatterData(&data, begin, end); scatters->resize(data.size()); if (keyAxis->orientation() == Qt::Vertical) { for (int i=0; icoordToPixel(data.at(i).value)); (*scatters)[i].setY(keyAxis->coordToPixel(data.at(i).key)); } } } else { for (int i=0; icoordToPixel(data.at(i).key)); (*scatters)[i].setY(valueAxis->coordToPixel(data.at(i).value)); } } } } /*! \internal Takes raw data points in plot coordinates as \a data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style \ref lsLine. The source of \a data is usually \ref getOptimizedLineData, and this method is called in \a getLines if the line style is set accordingly. \see dataToStepLeftLines, dataToStepRightLines, dataToStepCenterLines, dataToImpulseLines, getLines, drawLinePlot */ QVector QCPGraph::dataToLines(const QVector &data) const { QVector result; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return result; } result.reserve(data.size()+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill result.resize(data.size()); // transform data points to pixels: if (keyAxis->orientation() == Qt::Vertical) { for (int i=0; icoordToPixel(data.at(i).value)); result[i].setY(keyAxis->coordToPixel(data.at(i).key)); } } else // key axis is horizontal { for (int i=0; icoordToPixel(data.at(i).key)); result[i].setY(valueAxis->coordToPixel(data.at(i).value)); } } return result; } /*! \internal Takes raw data points in plot coordinates as \a data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style \ref lsStepLeft. The source of \a data is usually \ref getOptimizedLineData, and this method is called in \a getLines if the line style is set accordingly. \see dataToLines, dataToStepRightLines, dataToStepCenterLines, dataToImpulseLines, getLines, drawLinePlot */ QVector QCPGraph::dataToStepLeftLines(const QVector &data) const { QVector result; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return result; } result.reserve(data.size()*2+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill result.resize(data.size()*2); // calculate steps from data and transform to pixel coordinates: if (keyAxis->orientation() == Qt::Vertical) { double lastValue = valueAxis->coordToPixel(data.first().value); for (int i=0; icoordToPixel(data.at(i).key); result[i*2+0].setX(lastValue); result[i*2+0].setY(key); lastValue = valueAxis->coordToPixel(data.at(i).value); result[i*2+1].setX(lastValue); result[i*2+1].setY(key); } } else // key axis is horizontal { double lastValue = valueAxis->coordToPixel(data.first().value); for (int i=0; icoordToPixel(data.at(i).key); result[i*2+0].setX(key); result[i*2+0].setY(lastValue); lastValue = valueAxis->coordToPixel(data.at(i).value); result[i*2+1].setX(key); result[i*2+1].setY(lastValue); } } return result; } /*! \internal Takes raw data points in plot coordinates as \a data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style \ref lsStepRight. The source of \a data is usually \ref getOptimizedLineData, and this method is called in \a getLines if the line style is set accordingly. \see dataToLines, dataToStepLeftLines, dataToStepCenterLines, dataToImpulseLines, getLines, drawLinePlot */ QVector QCPGraph::dataToStepRightLines(const QVector &data) const { QVector result; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return result; } result.reserve(data.size()*2+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill result.resize(data.size()*2); // calculate steps from data and transform to pixel coordinates: if (keyAxis->orientation() == Qt::Vertical) { double lastKey = keyAxis->coordToPixel(data.first().key); for (int i=0; icoordToPixel(data.at(i).value); result[i*2+0].setX(value); result[i*2+0].setY(lastKey); lastKey = keyAxis->coordToPixel(data.at(i).key); result[i*2+1].setX(value); result[i*2+1].setY(lastKey); } } else // key axis is horizontal { double lastKey = keyAxis->coordToPixel(data.first().key); for (int i=0; icoordToPixel(data.at(i).value); result[i*2+0].setX(lastKey); result[i*2+0].setY(value); lastKey = keyAxis->coordToPixel(data.at(i).key); result[i*2+1].setX(lastKey); result[i*2+1].setY(value); } } return result; } /*! \internal Takes raw data points in plot coordinates as \a data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style \ref lsStepCenter. The source of \a data is usually \ref getOptimizedLineData, and this method is called in \a getLines if the line style is set accordingly. \see dataToLines, dataToStepLeftLines, dataToStepRightLines, dataToImpulseLines, getLines, drawLinePlot */ QVector QCPGraph::dataToStepCenterLines(const QVector &data) const { QVector result; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return result; } result.reserve(data.size()*2+2); // added 2 to reserve memory for lower/upper fill base points that might be needed for fill result.resize(data.size()*2); // calculate steps from data and transform to pixel coordinates: if (keyAxis->orientation() == Qt::Vertical) { double lastKey = keyAxis->coordToPixel(data.first().key); double lastValue = valueAxis->coordToPixel(data.first().value); result[0].setX(lastValue); result[0].setY(lastKey); for (int i=1; icoordToPixel(data.at(i).key)+lastKey)*0.5; result[i*2-1].setX(lastValue); result[i*2-1].setY(key); lastValue = valueAxis->coordToPixel(data.at(i).value); lastKey = keyAxis->coordToPixel(data.at(i).key); result[i*2+0].setX(lastValue); result[i*2+0].setY(key); } result[data.size()*2-1].setX(lastValue); result[data.size()*2-1].setY(lastKey); } else // key axis is horizontal { double lastKey = keyAxis->coordToPixel(data.first().key); double lastValue = valueAxis->coordToPixel(data.first().value); result[0].setX(lastKey); result[0].setY(lastValue); for (int i=1; icoordToPixel(data.at(i).key)+lastKey)*0.5; result[i*2-1].setX(key); result[i*2-1].setY(lastValue); lastValue = valueAxis->coordToPixel(data.at(i).value); lastKey = keyAxis->coordToPixel(data.at(i).key); result[i*2+0].setX(key); result[i*2+0].setY(lastValue); } result[data.size()*2-1].setX(lastKey); result[data.size()*2-1].setY(lastValue); } return result; } /*! \internal Takes raw data points in plot coordinates as \a data, and returns a vector containing pixel coordinate points which are suitable for drawing the line style \ref lsImpulse. The source of \a data is usually \ref getOptimizedLineData, and this method is called in \a getLines if the line style is set accordingly. \see dataToLines, dataToStepLeftLines, dataToStepRightLines, dataToStepCenterLines, getLines, drawImpulsePlot */ QVector QCPGraph::dataToImpulseLines(const QVector &data) const { QVector result; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return result; } result.resize(data.size()*2); // no need to reserve 2 extra points because impulse plot has no fill // transform data points to pixels: if (keyAxis->orientation() == Qt::Vertical) { for (int i=0; icoordToPixel(data.at(i).key); result[i*2+0].setX(valueAxis->coordToPixel(0)); result[i*2+0].setY(key); result[i*2+1].setX(valueAxis->coordToPixel(data.at(i).value)); result[i*2+1].setY(key); } } else // key axis is horizontal { for (int i=0; icoordToPixel(data.at(i).key); result[i*2+0].setX(key); result[i*2+0].setY(valueAxis->coordToPixel(0)); result[i*2+1].setX(key); result[i*2+1].setY(valueAxis->coordToPixel(data.at(i).value)); } } return result; } /*! \internal Draws the fill of the graph using the specified \a painter, with the currently set brush. \a lines contains the points of the graph line, in pixel coordinates. If the fill is a normal fill towards the zero-value-line, only the points in \a lines are required and two extra points at the zero-value-line, which are added by \ref addFillBasePoints and removed by \ref removeFillBasePoints after the fill drawing is done. On the other hand if the fill is a channel fill between this QCPGraph and another QCPGraph (\a mChannelFillGraph), the more complex polygon is calculated with the \ref getChannelFillPolygon function, and then drawn. \see drawLinePlot, drawImpulsePlot, drawScatterPlot */ void QCPGraph::drawFill(QCPPainter *painter, QVector *lines) const { if (mLineStyle == lsImpulse) return; // fill doesn't make sense for impulse plot if (painter->brush().style() == Qt::NoBrush || painter->brush().color().alpha() == 0) return; applyFillAntialiasingHint(painter); if (!mChannelFillGraph) { // draw base fill under graph, fill goes all the way to the zero-value-line: addFillBasePoints(lines); painter->drawPolygon(QPolygonF(*lines)); removeFillBasePoints(lines); } else { // draw channel fill between this graph and mChannelFillGraph: painter->drawPolygon(getChannelFillPolygon(lines)); } } /*! \internal Draws scatter symbols at every point passed in \a scatters, given in pixel coordinates. The scatters will be drawn with \a painter and have the appearance as specified in \a style. \see drawLinePlot, drawImpulsePlot */ void QCPGraph::drawScatterPlot(QCPPainter *painter, const QVector &scatters, const QCPScatterStyle &style) const { applyScattersAntialiasingHint(painter); style.applyTo(painter, mPen); for (int i=0; i &lines) const { if (painter->pen().style() != Qt::NoPen && painter->pen().color().alpha() != 0) { applyDefaultAntialiasingHint(painter); drawPolyline(painter, lines); } } /*! \internal Draws impulses from the provided data, i.e. it connects all line pairs in \a lines, given in pixel coordinates. The \a lines necessary for impulses are generated by \ref dataToImpulseLines from the regular graph data points. \see drawLinePlot, drawScatterPlot */ void QCPGraph::drawImpulsePlot(QCPPainter *painter, const QVector &lines) const { if (painter->pen().style() != Qt::NoPen && painter->pen().color().alpha() != 0) { applyDefaultAntialiasingHint(painter); QPen oldPen = painter->pen(); QPen newPen = painter->pen(); newPen.setCapStyle(Qt::FlatCap); // so impulse line doesn't reach beyond zero-line painter->setPen(newPen); painter->drawLines(lines); painter->setPen(oldPen); } } /*! \internal Returns via \a lineData the data points that need to be visualized for this graph when plotting graph lines, taking into consideration the currently visible axis ranges and, if \ref setAdaptiveSampling is enabled, local point densities. The considered data can be restricted further by \a begin and \a end, e.g. to only plot a certain segment of the data (see \ref getDataSegments). This method is used by \ref getLines to retrieve the basic working set of data. \see getOptimizedScatterData */ void QCPGraph::getOptimizedLineData(QVector *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const { if (!lineData) return; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (begin == end) return; int dataCount = end-begin; int maxCount = std::numeric_limits::max(); if (mAdaptiveSampling) { double keyPixelSpan = qAbs(keyAxis->coordToPixel(begin->key)-keyAxis->coordToPixel((end-1)->key)); if (2*keyPixelSpan+2 < (double)std::numeric_limits::max()) maxCount = 2*keyPixelSpan+2; } if (mAdaptiveSampling && dataCount >= maxCount) // use adaptive sampling only if there are at least two points per pixel on average { QCPGraphDataContainer::const_iterator it = begin; double minValue = it->value; double maxValue = it->value; QCPGraphDataContainer::const_iterator currentIntervalFirstPoint = it; int reversedFactor = keyAxis->pixelOrientation(); // is used to calculate keyEpsilon pixel into the correct direction int reversedRound = reversedFactor==-1 ? 1 : 0; // is used to switch between floor (normal) and ceil (reversed) rounding of currentIntervalStartKey double currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(begin->key)+reversedRound)); double lastIntervalEndKey = currentIntervalStartKey; double keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor)); // interval of one pixel on screen when mapped to plot key coordinates bool keyEpsilonVariable = keyAxis->scaleType() == QCPAxis::stLogarithmic; // indicates whether keyEpsilon needs to be updated after every interval (for log axes) int intervalDataCount = 1; ++it; // advance iterator to second data point because adaptive sampling works in 1 point retrospect while (it != end) { if (it->key < currentIntervalStartKey+keyEpsilon) // data point is still within same pixel, so skip it and expand value span of this cluster if necessary { if (it->value < minValue) minValue = it->value; else if (it->value > maxValue) maxValue = it->value; ++intervalDataCount; } else // new pixel interval started { if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them to a cluster { if (lastIntervalEndKey < currentIntervalStartKey-keyEpsilon) // last point is further away, so first point of this cluster must be at a real data point lineData->append(QCPGraphData(currentIntervalStartKey+keyEpsilon*0.2, currentIntervalFirstPoint->value)); lineData->append(QCPGraphData(currentIntervalStartKey+keyEpsilon*0.25, minValue)); lineData->append(QCPGraphData(currentIntervalStartKey+keyEpsilon*0.75, maxValue)); if (it->key > currentIntervalStartKey+keyEpsilon*2) // new pixel started further away from previous cluster, so make sure the last point of the cluster is at a real data point lineData->append(QCPGraphData(currentIntervalStartKey+keyEpsilon*0.8, (it-1)->value)); } else lineData->append(QCPGraphData(currentIntervalFirstPoint->key, currentIntervalFirstPoint->value)); lastIntervalEndKey = (it-1)->key; minValue = it->value; maxValue = it->value; currentIntervalFirstPoint = it; currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(it->key)+reversedRound)); if (keyEpsilonVariable) keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor)); intervalDataCount = 1; } ++it; } // handle last interval: if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them to a cluster { if (lastIntervalEndKey < currentIntervalStartKey-keyEpsilon) // last point wasn't a cluster, so first point of this cluster must be at a real data point lineData->append(QCPGraphData(currentIntervalStartKey+keyEpsilon*0.2, currentIntervalFirstPoint->value)); lineData->append(QCPGraphData(currentIntervalStartKey+keyEpsilon*0.25, minValue)); lineData->append(QCPGraphData(currentIntervalStartKey+keyEpsilon*0.75, maxValue)); } else lineData->append(QCPGraphData(currentIntervalFirstPoint->key, currentIntervalFirstPoint->value)); } else // don't use adaptive sampling algorithm, transfer points one-to-one from the data container into the output { QCPGraphDataContainer::const_iterator it = begin; lineData->reserve(dataCount+2); // +2 for possible fill end points while (it != end) { lineData->append(*it); ++it; } } } /*! \internal Returns via \a scatterData the data points that need to be visualized for this graph when plotting scatter points, taking into consideration the currently visible axis ranges and, if \ref setAdaptiveSampling is enabled, local point densities. The considered data can be restricted further by \a begin and \a end, e.g. to only plot a certain segment of the data (see \ref getDataSegments). This method is used by \ref getScatters to retrieve the basic working set of data. \see getOptimizedLineData */ void QCPGraph::getOptimizedScatterData(QVector *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const { if (!scatterData) return; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } const int scatterModulo = mScatterSkip+1; const bool doScatterSkip = mScatterSkip > 0; int beginIndex = begin-mDataContainer->constBegin(); int endIndex = end-mDataContainer->constBegin(); while (doScatterSkip && begin != end && beginIndex % scatterModulo != 0) // advance begin iterator to first non-skipped scatter { ++beginIndex; ++begin; } if (begin == end) return; int dataCount = end-begin; int maxCount = std::numeric_limits::max(); if (mAdaptiveSampling) { int keyPixelSpan = qAbs(keyAxis->coordToPixel(begin->key)-keyAxis->coordToPixel((end-1)->key)); maxCount = 2*keyPixelSpan+2; } if (mAdaptiveSampling && dataCount >= maxCount) // use adaptive sampling only if there are at least two points per pixel on average { double valueMaxRange = valueAxis->range().upper; double valueMinRange = valueAxis->range().lower; QCPGraphDataContainer::const_iterator it = begin; int itIndex = beginIndex; double minValue = it->value; double maxValue = it->value; QCPGraphDataContainer::const_iterator minValueIt = it; QCPGraphDataContainer::const_iterator maxValueIt = it; QCPGraphDataContainer::const_iterator currentIntervalStart = it; int reversedFactor = keyAxis->pixelOrientation(); // is used to calculate keyEpsilon pixel into the correct direction int reversedRound = reversedFactor==-1 ? 1 : 0; // is used to switch between floor (normal) and ceil (reversed) rounding of currentIntervalStartKey double currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(begin->key)+reversedRound)); double keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor)); // interval of one pixel on screen when mapped to plot key coordinates bool keyEpsilonVariable = keyAxis->scaleType() == QCPAxis::stLogarithmic; // indicates whether keyEpsilon needs to be updated after every interval (for log axes) int intervalDataCount = 1; // advance iterator to second (non-skipped) data point because adaptive sampling works in 1 point retrospect: if (!doScatterSkip) ++it; else { itIndex += scatterModulo; if (itIndex < endIndex) // make sure we didn't jump over end it += scatterModulo; else { it = end; itIndex = endIndex; } } // main loop over data points: while (it != end) { if (it->key < currentIntervalStartKey+keyEpsilon) // data point is still within same pixel, so skip it and expand value span of this pixel if necessary { if (it->value < minValue && it->value > valueMinRange && it->value < valueMaxRange) { minValue = it->value; minValueIt = it; } else if (it->value > maxValue && it->value > valueMinRange && it->value < valueMaxRange) { maxValue = it->value; maxValueIt = it; } ++intervalDataCount; } else // new pixel started { if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them { // determine value pixel span and add as many points in interval to maintain certain vertical data density (this is specific to scatter plot): double valuePixelSpan = qAbs(valueAxis->coordToPixel(minValue)-valueAxis->coordToPixel(maxValue)); int dataModulo = qMax(1, qRound(intervalDataCount/(valuePixelSpan/4.0))); // approximately every 4 value pixels one data point on average QCPGraphDataContainer::const_iterator intervalIt = currentIntervalStart; int c = 0; while (intervalIt != it) { if ((c % dataModulo == 0 || intervalIt == minValueIt || intervalIt == maxValueIt) && intervalIt->value > valueMinRange && intervalIt->value < valueMaxRange) scatterData->append(*intervalIt); ++c; if (!doScatterSkip) ++intervalIt; else intervalIt += scatterModulo; // since we know indices of "currentIntervalStart", "intervalIt" and "it" are multiples of scatterModulo, we can't accidentally jump over "it" here } } else if (currentIntervalStart->value > valueMinRange && currentIntervalStart->value < valueMaxRange) scatterData->append(*currentIntervalStart); minValue = it->value; maxValue = it->value; currentIntervalStart = it; currentIntervalStartKey = keyAxis->pixelToCoord((int)(keyAxis->coordToPixel(it->key)+reversedRound)); if (keyEpsilonVariable) keyEpsilon = qAbs(currentIntervalStartKey-keyAxis->pixelToCoord(keyAxis->coordToPixel(currentIntervalStartKey)+1.0*reversedFactor)); intervalDataCount = 1; } // advance to next data point: if (!doScatterSkip) ++it; else { itIndex += scatterModulo; if (itIndex < endIndex) // make sure we didn't jump over end it += scatterModulo; else { it = end; itIndex = endIndex; } } } // handle last interval: if (intervalDataCount >= 2) // last pixel had multiple data points, consolidate them { // determine value pixel span and add as many points in interval to maintain certain vertical data density (this is specific to scatter plot): double valuePixelSpan = qAbs(valueAxis->coordToPixel(minValue)-valueAxis->coordToPixel(maxValue)); int dataModulo = qMax(1, qRound(intervalDataCount/(valuePixelSpan/4.0))); // approximately every 4 value pixels one data point on average QCPGraphDataContainer::const_iterator intervalIt = currentIntervalStart; int intervalItIndex = intervalIt-mDataContainer->constBegin(); int c = 0; while (intervalIt != it) { if ((c % dataModulo == 0 || intervalIt == minValueIt || intervalIt == maxValueIt) && intervalIt->value > valueMinRange && intervalIt->value < valueMaxRange) scatterData->append(*intervalIt); ++c; if (!doScatterSkip) ++intervalIt; else // here we can't guarantee that adding scatterModulo doesn't exceed "it" (because "it" is equal to "end" here, and "end" isn't scatterModulo-aligned), so check via index comparison: { intervalItIndex += scatterModulo; if (intervalItIndex < itIndex) intervalIt += scatterModulo; else { intervalIt = it; intervalItIndex = itIndex; } } } } else if (currentIntervalStart->value > valueMinRange && currentIntervalStart->value < valueMaxRange) scatterData->append(*currentIntervalStart); } else // don't use adaptive sampling algorithm, transfer points one-to-one from the data container into the output { QCPGraphDataContainer::const_iterator it = begin; int itIndex = beginIndex; scatterData->reserve(dataCount); while (it != end) { scatterData->append(*it); // advance to next data point: if (!doScatterSkip) ++it; else { itIndex += scatterModulo; if (itIndex < endIndex) it += scatterModulo; else { it = end; itIndex = endIndex; } } } } } /*! This method outputs the currently visible data range via \a begin and \a end. The returned range will also never exceed \a rangeRestriction. This method takes into account that the drawing of data lines at the axis rect border always requires the points just outside the visible axis range. So \a begin and \a end may actually indicate a range that contains one additional data point to the left and right of the visible axis range. */ void QCPGraph::getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const { if (rangeRestriction.isEmpty()) { end = mDataContainer->constEnd(); begin = end; } else { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } // get visible data range: begin = mDataContainer->findBegin(keyAxis->range().lower); end = mDataContainer->findEnd(keyAxis->range().upper); // limit lower/upperEnd to rangeRestriction: mDataContainer->limitIteratorsToDataRange(begin, end, rangeRestriction); // this also ensures rangeRestriction outside data bounds doesn't break anything } } /*! \internal The line vector generated by e.g. \ref getLines describes only the line that connects the data points. If the graph needs to be filled, two additional points need to be added at the value-zero-line in the lower and upper key positions of the graph. This function calculates these points and adds them to the end of \a lineData. Since the fill is typically drawn before the line stroke, these added points need to be removed again after the fill is done, with the removeFillBasePoints function. The expanding of \a lines by two points will not cause unnecessary memory reallocations, because the data vector generation functions (e.g. \ref getLines) reserve two extra points when they allocate memory for \a lines. \see removeFillBasePoints, lowerFillBasePoint, upperFillBasePoint */ void QCPGraph::addFillBasePoints(QVector *lines) const { if (!mKeyAxis) { qDebug() << Q_FUNC_INFO << "invalid key axis"; return; } if (!lines) { qDebug() << Q_FUNC_INFO << "passed null as lineData"; return; } if (lines->isEmpty()) return; // append points that close the polygon fill at the key axis: if (mKeyAxis.data()->orientation() == Qt::Vertical) { *lines << upperFillBasePoint(lines->last().y()); *lines << lowerFillBasePoint(lines->first().y()); } else { *lines << upperFillBasePoint(lines->last().x()); *lines << lowerFillBasePoint(lines->first().x()); } } /*! \internal removes the two points from \a lines that were added by \ref addFillBasePoints. \see addFillBasePoints, lowerFillBasePoint, upperFillBasePoint */ void QCPGraph::removeFillBasePoints(QVector *lines) const { if (!lines) { qDebug() << Q_FUNC_INFO << "passed null as lineData"; return; } if (lines->isEmpty()) return; lines->remove(lines->size()-2, 2); } /*! \internal called by \ref addFillBasePoints to conveniently assign the point which closes the fill polygon on the lower side of the zero-value-line parallel to the key axis. The logarithmic axis scale case is a bit special, since the zero-value-line in pixel coordinates is in positive or negative infinity. So this case is handled separately by just closing the fill polygon on the axis which lies in the direction towards the zero value. \a lowerKey will be the the key (in pixels) of the returned point. Depending on whether the key axis is horizontal or vertical, \a lowerKey will end up as the x or y value of the returned point, respectively. \see upperFillBasePoint, addFillBasePoints */ QPointF QCPGraph::lowerFillBasePoint(double lowerKey) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); } QPointF point; if (valueAxis->scaleType() == QCPAxis::stLinear) { if (keyAxis->axisType() == QCPAxis::atLeft) { point.setX(valueAxis->coordToPixel(0)); point.setY(lowerKey); } else if (keyAxis->axisType() == QCPAxis::atRight) { point.setX(valueAxis->coordToPixel(0)); point.setY(lowerKey); } else if (keyAxis->axisType() == QCPAxis::atTop) { point.setX(lowerKey); point.setY(valueAxis->coordToPixel(0)); } else if (keyAxis->axisType() == QCPAxis::atBottom) { point.setX(lowerKey); point.setY(valueAxis->coordToPixel(0)); } } else // valueAxis->mScaleType == QCPAxis::stLogarithmic { // In logarithmic scaling we can't just draw to value zero so we just fill all the way // to the axis which is in the direction towards zero if (keyAxis->orientation() == Qt::Vertical) { if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) || (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis point.setX(keyAxis->axisRect()->right()); else point.setX(keyAxis->axisRect()->left()); point.setY(lowerKey); } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom) { point.setX(lowerKey); if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) || (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis point.setY(keyAxis->axisRect()->top()); else point.setY(keyAxis->axisRect()->bottom()); } } return point; } /*! \internal called by \ref addFillBasePoints to conveniently assign the point which closes the fill polygon on the upper side of the zero-value-line parallel to the key axis. The logarithmic axis scale case is a bit special, since the zero-value-line in pixel coordinates is in positive or negative infinity. So this case is handled separately by just closing the fill polygon on the axis which lies in the direction towards the zero value. \a upperKey will be the the key (in pixels) of the returned point. Depending on whether the key axis is horizontal or vertical, \a upperKey will end up as the x or y value of the returned point, respectively. \see lowerFillBasePoint, addFillBasePoints */ QPointF QCPGraph::upperFillBasePoint(double upperKey) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); } QPointF point; if (valueAxis->scaleType() == QCPAxis::stLinear) { if (keyAxis->axisType() == QCPAxis::atLeft) { point.setX(valueAxis->coordToPixel(0)); point.setY(upperKey); } else if (keyAxis->axisType() == QCPAxis::atRight) { point.setX(valueAxis->coordToPixel(0)); point.setY(upperKey); } else if (keyAxis->axisType() == QCPAxis::atTop) { point.setX(upperKey); point.setY(valueAxis->coordToPixel(0)); } else if (keyAxis->axisType() == QCPAxis::atBottom) { point.setX(upperKey); point.setY(valueAxis->coordToPixel(0)); } } else // valueAxis->mScaleType == QCPAxis::stLogarithmic { // In logarithmic scaling we can't just draw to value 0 so we just fill all the way // to the axis which is in the direction towards 0 if (keyAxis->orientation() == Qt::Vertical) { if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) || (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis point.setX(keyAxis->axisRect()->right()); else point.setX(keyAxis->axisRect()->left()); point.setY(upperKey); } else if (keyAxis->axisType() == QCPAxis::atTop || keyAxis->axisType() == QCPAxis::atBottom) { point.setX(upperKey); if ((valueAxis->range().upper < 0 && !valueAxis->rangeReversed()) || (valueAxis->range().upper > 0 && valueAxis->rangeReversed())) // if range is negative, zero is on opposite side of key axis point.setY(keyAxis->axisRect()->top()); else point.setY(keyAxis->axisRect()->bottom()); } } return point; } /*! \internal Generates the polygon needed for drawing channel fills between this graph and the graph specified in \a mChannelFillGraph (see \ref setChannelFillGraph). The data points representing the line of this graph in pixel coordinates must be passed in \a lines, the corresponding points of the other graph are generated by calling its \ref getLines method. This method may return an empty polygon if the key ranges of the two graphs have no overlap of if they don't have the same orientation (e.g. one key axis vertical, the other horizontal). For increased performance (due to implicit sharing), it is recommended to keep the returned QPolygonF const. */ const QPolygonF QCPGraph::getChannelFillPolygon(const QVector *lines) const { if (!mChannelFillGraph) return QPolygonF(); QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPolygonF(); } if (!mChannelFillGraph.data()->mKeyAxis) { qDebug() << Q_FUNC_INFO << "channel fill target key axis invalid"; return QPolygonF(); } if (mChannelFillGraph.data()->mKeyAxis.data()->orientation() != keyAxis->orientation()) return QPolygonF(); // don't have same axis orientation, can't fill that (Note: if keyAxis fits, valueAxis will fit too, because it's always orthogonal to keyAxis) if (lines->isEmpty()) return QPolygonF(); QVector otherData; mChannelFillGraph.data()->getLines(&otherData, QCPDataRange(0, mChannelFillGraph.data()->dataCount())); if (otherData.isEmpty()) return QPolygonF(); QVector thisData; thisData.reserve(lines->size()+otherData.size()); // because we will join both vectors at end of this function for (int i=0; isize(); ++i) // don't use the vector<<(vector), it squeezes internally, which ruins the performance tuning with reserve() thisData << lines->at(i); // pointers to be able to swap them, depending which data range needs cropping: QVector *staticData = &thisData; QVector *croppedData = &otherData; // crop both vectors to ranges in which the keys overlap (which coord is key, depends on axisType): if (keyAxis->orientation() == Qt::Horizontal) { // x is key // if an axis range is reversed, the data point keys will be descending. Reverse them, since following algorithm assumes ascending keys: if (staticData->first().x() > staticData->last().x()) { int size = staticData->size(); for (int i=0; ifirst().x() > croppedData->last().x()) { int size = croppedData->size(); for (int i=0; ifirst().x() < croppedData->first().x()) // other one must be cropped qSwap(staticData, croppedData); int lowBound = findIndexBelowX(croppedData, staticData->first().x()); if (lowBound == -1) return QPolygonF(); // key ranges have no overlap croppedData->remove(0, lowBound); // set lowest point of cropped data to fit exactly key position of first static data // point via linear interpolation: if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation double slope; if (croppedData->at(1).x()-croppedData->at(0).x() != 0) slope = (croppedData->at(1).y()-croppedData->at(0).y())/(croppedData->at(1).x()-croppedData->at(0).x()); else slope = 0; (*croppedData)[0].setY(croppedData->at(0).y()+slope*(staticData->first().x()-croppedData->at(0).x())); (*croppedData)[0].setX(staticData->first().x()); // crop upper bound: if (staticData->last().x() > croppedData->last().x()) // other one must be cropped qSwap(staticData, croppedData); int highBound = findIndexAboveX(croppedData, staticData->last().x()); if (highBound == -1) return QPolygonF(); // key ranges have no overlap croppedData->remove(highBound+1, croppedData->size()-(highBound+1)); // set highest point of cropped data to fit exactly key position of last static data // point via linear interpolation: if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation int li = croppedData->size()-1; // last index if (croppedData->at(li).x()-croppedData->at(li-1).x() != 0) slope = (croppedData->at(li).y()-croppedData->at(li-1).y())/(croppedData->at(li).x()-croppedData->at(li-1).x()); else slope = 0; (*croppedData)[li].setY(croppedData->at(li-1).y()+slope*(staticData->last().x()-croppedData->at(li-1).x())); (*croppedData)[li].setX(staticData->last().x()); } else // mKeyAxis->orientation() == Qt::Vertical { // y is key // similar to "x is key" but switched x,y. Further, lower/upper meaning is inverted compared to x, // because in pixel coordinates, y increases from top to bottom, not bottom to top like data coordinate. // if an axis range is reversed, the data point keys will be descending. Reverse them, since following algorithm assumes ascending keys: if (staticData->first().y() < staticData->last().y()) { int size = staticData->size(); for (int i=0; ifirst().y() < croppedData->last().y()) { int size = croppedData->size(); for (int i=0; ifirst().y() > croppedData->first().y()) // other one must be cropped qSwap(staticData, croppedData); int lowBound = findIndexAboveY(croppedData, staticData->first().y()); if (lowBound == -1) return QPolygonF(); // key ranges have no overlap croppedData->remove(0, lowBound); // set lowest point of cropped data to fit exactly key position of first static data // point via linear interpolation: if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation double slope; if (croppedData->at(1).y()-croppedData->at(0).y() != 0) // avoid division by zero in step plots slope = (croppedData->at(1).x()-croppedData->at(0).x())/(croppedData->at(1).y()-croppedData->at(0).y()); else slope = 0; (*croppedData)[0].setX(croppedData->at(0).x()+slope*(staticData->first().y()-croppedData->at(0).y())); (*croppedData)[0].setY(staticData->first().y()); // crop upper bound: if (staticData->last().y() < croppedData->last().y()) // other one must be cropped qSwap(staticData, croppedData); int highBound = findIndexBelowY(croppedData, staticData->last().y()); if (highBound == -1) return QPolygonF(); // key ranges have no overlap croppedData->remove(highBound+1, croppedData->size()-(highBound+1)); // set highest point of cropped data to fit exactly key position of last static data // point via linear interpolation: if (croppedData->size() < 2) return QPolygonF(); // need at least two points for interpolation int li = croppedData->size()-1; // last index if (croppedData->at(li).y()-croppedData->at(li-1).y() != 0) // avoid division by zero in step plots slope = (croppedData->at(li).x()-croppedData->at(li-1).x())/(croppedData->at(li).y()-croppedData->at(li-1).y()); else slope = 0; (*croppedData)[li].setX(croppedData->at(li-1).x()+slope*(staticData->last().y()-croppedData->at(li-1).y())); (*croppedData)[li].setY(staticData->last().y()); } // return joined: for (int i=otherData.size()-1; i>=0; --i) // insert reversed, otherwise the polygon will be twisted thisData << otherData.at(i); return QPolygonF(thisData); } /*! \internal Finds the smallest index of \a data, whose points x value is just above \a x. Assumes x values in \a data points are ordered ascending, as is the case when plotting with horizontal key axis. Used to calculate the channel fill polygon, see \ref getChannelFillPolygon. */ int QCPGraph::findIndexAboveX(const QVector *data, double x) const { for (int i=data->size()-1; i>=0; --i) { if (data->at(i).x() < x) { if (isize()-1) return i+1; else return data->size()-1; } } return -1; } /*! \internal Finds the highest index of \a data, whose points x value is just below \a x. Assumes x values in \a data points are ordered ascending, as is the case when plotting with horizontal key axis. Used to calculate the channel fill polygon, see \ref getChannelFillPolygon. */ int QCPGraph::findIndexBelowX(const QVector *data, double x) const { for (int i=0; isize(); ++i) { if (data->at(i).x() > x) { if (i>0) return i-1; else return 0; } } return -1; } /*! \internal Finds the smallest index of \a data, whose points y value is just above \a y. Assumes y values in \a data points are ordered descending, as is the case when plotting with vertical key axis. Used to calculate the channel fill polygon, see \ref getChannelFillPolygon. */ int QCPGraph::findIndexAboveY(const QVector *data, double y) const { for (int i=0; isize(); ++i) { if (data->at(i).y() < y) { if (i>0) return i-1; else return 0; } } return -1; } /*! \internal Calculates the minimum distance in pixels the graph's representation has from the given \a pixelPoint. This is used to determine whether the graph was clicked or not, e.g. in \ref selectTest. The closest data point to \a pixelPoint is returned in \a closestData. Note that if the graph has a line representation, the returned distance may be smaller than the distance to the \a closestData point, since the distance to the graph line is also taken into account. If either the graph has no data or if the line style is \ref lsNone and the scatter style's shape is \ref QCPScatterStyle::ssNone (i.e. there is no visual representation of the graph), returns -1.0. */ double QCPGraph::pointDistance(const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const { closestData = mDataContainer->constEnd(); if (mDataContainer->isEmpty()) return -1.0; if (mLineStyle == lsNone && mScatterStyle.isNone()) return -1.0; // calculate minimum distances to graph data points and find closestData iterator: double minDistSqr = std::numeric_limits::max(); // determine which key range comes into question, taking selection tolerance around pos into account: double posKeyMin, posKeyMax, dummy; pixelsToCoords(pixelPoint-QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMin, dummy); pixelsToCoords(pixelPoint+QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMax, dummy); if (posKeyMin > posKeyMax) qSwap(posKeyMin, posKeyMax); // iterate over found data points and then choose the one with the shortest distance to pos: QCPGraphDataContainer::const_iterator begin = mDataContainer->findBegin(posKeyMin, true); QCPGraphDataContainer::const_iterator end = mDataContainer->findEnd(posKeyMax, true); for (QCPGraphDataContainer::const_iterator it=begin; it!=end; ++it) { const double currentDistSqr = QCPVector2D(coordsToPixels(it->key, it->value)-pixelPoint).lengthSquared(); if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; closestData = it; } } // calculate distance to graph line if there is one (if so, will probably be smaller than distance to closest data point): if (mLineStyle != lsNone) { // line displayed, calculate distance to line segments: QVector lineData; getLines(&lineData, QCPDataRange(0, dataCount())); QCPVector2D p(pixelPoint); const int step = mLineStyle==lsImpulse ? 2 : 1; // impulse plot differs from other line styles in that the lineData points are only pairwise connected for (int i=0; i *data, double y) const { for (int i=data->size()-1; i>=0; --i) { if (data->at(i).y() > y) { if (isize()-1) return i+1; else return data->size()-1; } } return -1; } /* end of 'src/plottables/plottable-graph.cpp' */ /* including file 'src/plottables/plottable-curve.cpp', size 60009 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPCurveData //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPCurveData \brief Holds the data of one single data point for QCPCurve. The stored data is: \li \a t: the free ordering parameter of this curve point, like in the mathematical vector (x(t), y(t)). (This is the \a sortKey) \li \a key: coordinate on the key axis of this curve point (this is the \a mainKey) \li \a value: coordinate on the value axis of this curve point (this is the \a mainValue) The container for storing multiple data points is \ref QCPCurveDataContainer. It is a typedef for \ref QCPDataContainer with \ref QCPCurveData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods. \see QCPCurveDataContainer */ /* start documentation of inline functions */ /*! \fn double QCPCurveData::sortKey() const Returns the \a t member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static QCPCurveData QCPCurveData::fromSortKey(double sortKey) Returns a data point with the specified \a sortKey (assigned to the data point's \a t member). All other members are set to zero. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static static bool QCPCurveData::sortKeyIsMainKey() Since the member \a key is the data point key coordinate and the member \a t is the data ordering parameter, this method returns false. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPCurveData::mainKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPCurveData::mainValue() const Returns the \a value member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn QCPRange QCPCurveData::valueRange() const Returns a QCPRange with both lower and upper boundary set to \a value of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /* end documentation of inline functions */ /*! Constructs a curve data point with t, key and value set to zero. */ QCPCurveData::QCPCurveData() : t(0), key(0), value(0) { } /*! Constructs a curve data point with the specified \a t, \a key and \a value. */ QCPCurveData::QCPCurveData(double t, double key, double value) : t(t), key(key), value(value) { } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPCurve //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPCurve \brief A plottable representing a parametric curve in a plot. \image html QCPCurve.png Unlike QCPGraph, plottables of this type may have multiple points with the same key coordinate, so their visual representation can have \a loops. This is realized by introducing a third coordinate \a t, which defines the order of the points described by the other two coordinates \a x and \a y. To plot data, assign it with the \ref setData or \ref addData functions. Alternatively, you can also access and modify the curve's data via the \ref data method, which returns a pointer to the internal \ref QCPCurveDataContainer. Gaps in the curve can be created by adding data points with NaN as key and value (qQNaN() or std::numeric_limits::quiet_NaN()) in between the two data points that shall be separated. \section qcpcurve-appearance Changing the appearance The appearance of the curve is determined by the pen and the brush (\ref setPen, \ref setBrush). \section qcpcurve-usage Usage Like all data representing objects in QCustomPlot, the QCPCurve is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.) Usually, you first create an instance: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcurve-creation-1 which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcurve-creation-2 */ /* start of documentation of inline functions */ /*! \fn QSharedPointer QCPCurve::data() const Returns a shared pointer to the internal data storage of type \ref QCPCurveDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular \ref setData or \ref addData methods. */ /* end of documentation of inline functions */ /*! Constructs a curve which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. The created QCPCurve is automatically registered with the QCustomPlot instance inferred from \a keyAxis. This QCustomPlot instance takes ownership of the QCPCurve, so do not delete it manually but use QCustomPlot::removePlottable() instead. */ QCPCurve::QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable1D(keyAxis, valueAxis) { // modify inherited properties from abstract plottable: setPen(QPen(Qt::blue, 0)); setBrush(Qt::NoBrush); setScatterStyle(QCPScatterStyle()); setLineStyle(lsLine); } QCPCurve::~QCPCurve() { } /*! \overload Replaces the current data container with the provided \a data container. Since a QSharedPointer is used, multiple QCPCurves may share the same data container safely. Modifying the data in the container will then affect all curves that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcurve-datasharing-1 If you do not wish to share containers, but create a copy from an existing container, rather use the \ref QCPDataContainer::set method on the curve's data container directly: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpcurve-datasharing-2 \see addData */ void QCPCurve::setData(QSharedPointer data) { mDataContainer = data; } /*! \overload Replaces the current data with the provided points in \a t, \a keys and \a values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a t in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. \see addData */ void QCPCurve::setData(const QVector &t, const QVector &keys, const QVector &values, bool alreadySorted) { mDataContainer->clear(); addData(t, keys, values, alreadySorted); } /*! \overload Replaces the current data with the provided points in \a keys and \a values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. The t parameter of each data point will be set to the integer index of the respective key/value pair. \see addData */ void QCPCurve::setData(const QVector &keys, const QVector &values) { mDataContainer->clear(); addData(keys, values); } /*! Sets the visual appearance of single data points in the plot. If set to \ref QCPScatterStyle::ssNone, no scatter points are drawn (e.g. for line-only plots with appropriate line style). \see QCPScatterStyle, setLineStyle */ void QCPCurve::setScatterStyle(const QCPScatterStyle &style) { mScatterStyle = style; } /*! If scatters are displayed (scatter style not \ref QCPScatterStyle::ssNone), \a skip number of scatter points are skipped/not drawn after every drawn scatter point. This can be used to make the data appear sparser while for example still having a smooth line, and to improve performance for very high density plots. If \a skip is set to 0 (default), all scatter points are drawn. \see setScatterStyle */ void QCPCurve::setScatterSkip(int skip) { mScatterSkip = qMax(0, skip); } /*! Sets how the single data points are connected in the plot or how they are represented visually apart from the scatter symbol. For scatter-only plots, set \a style to \ref lsNone and \ref setScatterStyle to the desired scatter style. \see setScatterStyle */ void QCPCurve::setLineStyle(QCPCurve::LineStyle style) { mLineStyle = style; } /*! \overload Adds the provided points in \a t, \a keys and \a values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPCurve::addData(const QVector &t, const QVector &keys, const QVector &values, bool alreadySorted) { if (t.size() != keys.size() || t.size() != values.size()) qDebug() << Q_FUNC_INFO << "ts, keys and values have different sizes:" << t.size() << keys.size() << values.size(); const int n = qMin(qMin(t.size(), keys.size()), values.size()); QVector tempData(n); QVector::iterator it = tempData.begin(); const QVector::iterator itEnd = tempData.end(); int i = 0; while (it != itEnd) { it->t = t[i]; it->key = keys[i]; it->value = values[i]; ++it; ++i; } mDataContainer->add(tempData, alreadySorted); // don't modify tempData beyond this to prevent copy on write } /*! \overload Adds the provided points in \a keys and \a values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. The t parameter of each data point will be set to the integer index of the respective key/value pair. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPCurve::addData(const QVector &keys, const QVector &values) { if (keys.size() != values.size()) qDebug() << Q_FUNC_INFO << "keys and values have different sizes:" << keys.size() << values.size(); const int n = qMin(keys.size(), values.size()); double tStart; if (!mDataContainer->isEmpty()) tStart = (mDataContainer->constEnd()-1)->t + 1.0; else tStart = 0; QVector tempData(n); QVector::iterator it = tempData.begin(); const QVector::iterator itEnd = tempData.end(); int i = 0; while (it != itEnd) { it->t = tStart + i; it->key = keys[i]; it->value = values[i]; ++it; ++i; } mDataContainer->add(tempData, true); // don't modify tempData beyond this to prevent copy on write } /*! \overload Adds the provided data point as \a t, \a key and \a value to the current data. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPCurve::addData(double t, double key, double value) { mDataContainer->add(QCPCurveData(t, key, value)); } /*! \overload Adds the provided data point as \a key and \a value to the current data. The t parameter is generated automatically by increments of 1 for each point, starting at the highest t of previously existing data or 0, if the curve data is empty. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPCurve::addData(double key, double value) { if (!mDataContainer->isEmpty()) mDataContainer->add(QCPCurveData((mDataContainer->constEnd()-1)->t + 1.0, key, value)); else mDataContainer->add(QCPCurveData(0.0, key, value)); } /* inherits documentation from base class */ double QCPCurve::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint())) { QCPCurveDataContainer::const_iterator closestDataPoint = mDataContainer->constEnd(); double result = pointDistance(pos, closestDataPoint); if (details) { int pointIndex = closestDataPoint-mDataContainer->constBegin(); details->setValue(QCPDataSelection(QCPDataRange(pointIndex, pointIndex+1))); } return result; } else return -1; } /* inherits documentation from base class */ QCPRange QCPCurve::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const { return mDataContainer->keyRange(foundRange, inSignDomain); } /* inherits documentation from base class */ QCPRange QCPCurve::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const { return mDataContainer->valueRange(foundRange, inSignDomain, inKeyRange); } /* inherits documentation from base class */ void QCPCurve::draw(QCPPainter *painter) { if (mDataContainer->isEmpty()) return; // allocate line vector: QVector lines, scatters; // loop over and draw segments of unselected/selected data: QList selectedSegments, unselectedSegments, allSegments; getDataSegments(selectedSegments, unselectedSegments); allSegments << unselectedSegments << selectedSegments; for (int i=0; i= unselectedSegments.size(); // fill with curve data: QPen finalCurvePen = mPen; // determine the final pen already here, because the line optimization depends on its stroke width if (isSelectedSegment && mSelectionDecorator) finalCurvePen = mSelectionDecorator->pen(); QCPDataRange lineDataRange = isSelectedSegment ? allSegments.at(i) : allSegments.at(i).adjusted(-1, 1); // unselected segments extend lines to bordering selected data point (safe to exceed total data bounds in first/last segment, getCurveLines takes care) getCurveLines(&lines, lineDataRange, finalCurvePen.widthF()); // check data validity if flag set: #ifdef QCUSTOMPLOT_CHECK_DATA for (QCPCurveDataContainer::const_iterator it = mDataContainer->constBegin(); it != mDataContainer->constEnd(); ++it) { if (QCP::isInvalidData(it->t) || QCP::isInvalidData(it->key, it->value)) qDebug() << Q_FUNC_INFO << "Data point at" << it->key << "invalid." << "Plottable name:" << name(); } #endif // draw curve fill: applyFillAntialiasingHint(painter); if (isSelectedSegment && mSelectionDecorator) mSelectionDecorator->applyBrush(painter); else painter->setBrush(mBrush); painter->setPen(Qt::NoPen); if (painter->brush().style() != Qt::NoBrush && painter->brush().color().alpha() != 0) painter->drawPolygon(QPolygonF(lines)); // draw curve line: if (mLineStyle != lsNone) { painter->setPen(finalCurvePen); painter->setBrush(Qt::NoBrush); drawCurveLine(painter, lines); } // draw scatters: QCPScatterStyle finalScatterStyle = mScatterStyle; if (isSelectedSegment && mSelectionDecorator) finalScatterStyle = mSelectionDecorator->getFinalScatterStyle(mScatterStyle); if (!finalScatterStyle.isNone()) { getScatters(&scatters, allSegments.at(i), finalScatterStyle.size()); drawScatterPlot(painter, scatters, finalScatterStyle); } } // draw other selection decoration that isn't just line/scatter pens and brushes: if (mSelectionDecorator) mSelectionDecorator->drawDecoration(painter, selection()); } /* inherits documentation from base class */ void QCPCurve::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const { // draw fill: if (mBrush.style() != Qt::NoBrush) { applyFillAntialiasingHint(painter); painter->fillRect(QRectF(rect.left(), rect.top()+rect.height()/2.0, rect.width(), rect.height()/3.0), mBrush); } // draw line vertically centered: if (mLineStyle != lsNone) { applyDefaultAntialiasingHint(painter); painter->setPen(mPen); painter->drawLine(QLineF(rect.left(), rect.top()+rect.height()/2.0, rect.right()+5, rect.top()+rect.height()/2.0)); // +5 on x2 else last segment is missing from dashed/dotted pens } // draw scatter symbol: if (!mScatterStyle.isNone()) { applyScattersAntialiasingHint(painter); // scale scatter pixmap if it's too large to fit in legend icon rect: if (mScatterStyle.shape() == QCPScatterStyle::ssPixmap && (mScatterStyle.pixmap().size().width() > rect.width() || mScatterStyle.pixmap().size().height() > rect.height())) { QCPScatterStyle scaledStyle(mScatterStyle); scaledStyle.setPixmap(scaledStyle.pixmap().scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation)); scaledStyle.applyTo(painter, mPen); scaledStyle.drawShape(painter, QRectF(rect).center()); } else { mScatterStyle.applyTo(painter, mPen); mScatterStyle.drawShape(painter, QRectF(rect).center()); } } } /*! \internal Draws lines between the points in \a lines, given in pixel coordinates. \see drawScatterPlot, getCurveLines */ void QCPCurve::drawCurveLine(QCPPainter *painter, const QVector &lines) const { if (painter->pen().style() != Qt::NoPen && painter->pen().color().alpha() != 0) { applyDefaultAntialiasingHint(painter); drawPolyline(painter, lines); } } /*! \internal Draws scatter symbols at every point passed in \a points, given in pixel coordinates. The scatters will be drawn with \a painter and have the appearance as specified in \a style. \see drawCurveLine, getCurveLines */ void QCPCurve::drawScatterPlot(QCPPainter *painter, const QVector &points, const QCPScatterStyle &style) const { // draw scatter point symbols: applyScattersAntialiasingHint(painter); style.applyTo(painter, mPen); for (int i=0; i *lines, const QCPDataRange &dataRange, double penWidth) const { if (!lines) return; lines->clear(); QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } // add margins to rect to compensate for stroke width const double strokeMargin = qMax(qreal(1.0), qreal(penWidth*0.75)); // stroke radius + 50% safety const double keyMin = keyAxis->pixelToCoord(keyAxis->coordToPixel(keyAxis->range().lower)-strokeMargin*keyAxis->pixelOrientation()); const double keyMax = keyAxis->pixelToCoord(keyAxis->coordToPixel(keyAxis->range().upper)+strokeMargin*keyAxis->pixelOrientation()); const double valueMin = valueAxis->pixelToCoord(valueAxis->coordToPixel(valueAxis->range().lower)-strokeMargin*valueAxis->pixelOrientation()); const double valueMax = valueAxis->pixelToCoord(valueAxis->coordToPixel(valueAxis->range().upper)+strokeMargin*valueAxis->pixelOrientation()); QCPCurveDataContainer::const_iterator itBegin = mDataContainer->constBegin(); QCPCurveDataContainer::const_iterator itEnd = mDataContainer->constEnd(); mDataContainer->limitIteratorsToDataRange(itBegin, itEnd, dataRange); if (itBegin == itEnd) return; QCPCurveDataContainer::const_iterator it = itBegin; QCPCurveDataContainer::const_iterator prevIt = itEnd-1; int prevRegion = getRegion(prevIt->key, prevIt->value, keyMin, valueMax, keyMax, valueMin); QVector trailingPoints; // points that must be applied after all other points (are generated only when handling first point to get virtual segment between last and first point right) while (it != itEnd) { const int currentRegion = getRegion(it->key, it->value, keyMin, valueMax, keyMax, valueMin); if (currentRegion != prevRegion) // changed region, possibly need to add some optimized edge points or original points if entering R { if (currentRegion != 5) // segment doesn't end in R, so it's a candidate for removal { QPointF crossA, crossB; if (prevRegion == 5) // we're coming from R, so add this point optimized { lines->append(getOptimizedPoint(currentRegion, it->key, it->value, prevIt->key, prevIt->value, keyMin, valueMax, keyMax, valueMin)); // in the situations 5->1/7/9/3 the segment may leave R and directly cross through two outer regions. In these cases we need to add an additional corner point *lines << getOptimizedCornerPoints(prevRegion, currentRegion, prevIt->key, prevIt->value, it->key, it->value, keyMin, valueMax, keyMax, valueMin); } else if (mayTraverse(prevRegion, currentRegion) && getTraverse(prevIt->key, prevIt->value, it->key, it->value, keyMin, valueMax, keyMax, valueMin, crossA, crossB)) { // add the two cross points optimized if segment crosses R and if segment isn't virtual zeroth segment between last and first curve point: QVector beforeTraverseCornerPoints, afterTraverseCornerPoints; getTraverseCornerPoints(prevRegion, currentRegion, keyMin, valueMax, keyMax, valueMin, beforeTraverseCornerPoints, afterTraverseCornerPoints); if (it != itBegin) { *lines << beforeTraverseCornerPoints; lines->append(crossA); lines->append(crossB); *lines << afterTraverseCornerPoints; } else { lines->append(crossB); *lines << afterTraverseCornerPoints; trailingPoints << beforeTraverseCornerPoints << crossA ; } } else // doesn't cross R, line is just moving around in outside regions, so only need to add optimized point(s) at the boundary corner(s) { *lines << getOptimizedCornerPoints(prevRegion, currentRegion, prevIt->key, prevIt->value, it->key, it->value, keyMin, valueMax, keyMax, valueMin); } } else // segment does end in R, so we add previous point optimized and this point at original position { if (it == itBegin) // it is first point in curve and prevIt is last one. So save optimized point for adding it to the lineData in the end trailingPoints << getOptimizedPoint(prevRegion, prevIt->key, prevIt->value, it->key, it->value, keyMin, valueMax, keyMax, valueMin); else lines->append(getOptimizedPoint(prevRegion, prevIt->key, prevIt->value, it->key, it->value, keyMin, valueMax, keyMax, valueMin)); lines->append(coordsToPixels(it->key, it->value)); } } else // region didn't change { if (currentRegion == 5) // still in R, keep adding original points { lines->append(coordsToPixels(it->key, it->value)); } else // still outside R, no need to add anything { // see how this is not doing anything? That's the main optimization... } } prevIt = it; prevRegion = currentRegion; ++it; } *lines << trailingPoints; } /*! \internal Called by \ref draw to generate points in pixel coordinates which represent the scatters of the curve. If a scatter skip is configured (\ref setScatterSkip), the returned points are accordingly sparser. Scatters that aren't visible in the current axis rect are optimized away. \a scatters will be filled with points in pixel coordinates, that can be drawn with \ref drawScatterPlot. \a dataRange specifies the beginning and ending data indices that will be taken into account for conversion. \a scatterWidth specifies the scatter width that will be used to later draw the scatters at pixel coordinates generated by this function. This is needed here to calculate an accordingly wider margin around the axis rect when performing the data point reduction. \see draw, drawScatterPlot */ void QCPCurve::getScatters(QVector *scatters, const QCPDataRange &dataRange, double scatterWidth) const { if (!scatters) return; scatters->clear(); QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } QCPCurveDataContainer::const_iterator begin = mDataContainer->constBegin(); QCPCurveDataContainer::const_iterator end = mDataContainer->constEnd(); mDataContainer->limitIteratorsToDataRange(begin, end, dataRange); if (begin == end) return; const int scatterModulo = mScatterSkip+1; const bool doScatterSkip = mScatterSkip > 0; int endIndex = end-mDataContainer->constBegin(); QCPRange keyRange = keyAxis->range(); QCPRange valueRange = valueAxis->range(); // extend range to include width of scatter symbols: keyRange.lower = keyAxis->pixelToCoord(keyAxis->coordToPixel(keyRange.lower)-scatterWidth*keyAxis->pixelOrientation()); keyRange.upper = keyAxis->pixelToCoord(keyAxis->coordToPixel(keyRange.upper)+scatterWidth*keyAxis->pixelOrientation()); valueRange.lower = valueAxis->pixelToCoord(valueAxis->coordToPixel(valueRange.lower)-scatterWidth*valueAxis->pixelOrientation()); valueRange.upper = valueAxis->pixelToCoord(valueAxis->coordToPixel(valueRange.upper)+scatterWidth*valueAxis->pixelOrientation()); QCPCurveDataContainer::const_iterator it = begin; int itIndex = begin-mDataContainer->constBegin(); while (doScatterSkip && it != end && itIndex % scatterModulo != 0) // advance begin iterator to first non-skipped scatter { ++itIndex; ++it; } if (keyAxis->orientation() == Qt::Vertical) { while (it != end) { if (!qIsNaN(it->value) && keyRange.contains(it->key) && valueRange.contains(it->value)) scatters->append(QPointF(valueAxis->coordToPixel(it->value), keyAxis->coordToPixel(it->key))); // advance iterator to next (non-skipped) data point: if (!doScatterSkip) ++it; else { itIndex += scatterModulo; if (itIndex < endIndex) // make sure we didn't jump over end it += scatterModulo; else { it = end; itIndex = endIndex; } } } } else { while (it != end) { if (!qIsNaN(it->value) && keyRange.contains(it->key) && valueRange.contains(it->value)) scatters->append(QPointF(keyAxis->coordToPixel(it->key), valueAxis->coordToPixel(it->value))); // advance iterator to next (non-skipped) data point: if (!doScatterSkip) ++it; else { itIndex += scatterModulo; if (itIndex < endIndex) // make sure we didn't jump over end it += scatterModulo; else { it = end; itIndex = endIndex; } } } } } /*! \internal This function is part of the curve optimization algorithm of \ref getCurveLines. It returns the region of the given point (\a key, \a value) with respect to a rectangle defined by \a keyMin, \a keyMax, \a valueMin, and \a valueMax. The regions are enumerated from top to bottom (\a valueMin to \a valueMax) and left to right (\a keyMin to \a keyMax):
147
258
369
With the rectangle being region 5, and the outer regions extending infinitely outwards. In the curve optimization algorithm, region 5 is considered to be the visible portion of the plot. */ int QCPCurve::getRegion(double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const { if (key < keyMin) // region 123 { if (value > valueMax) return 1; else if (value < valueMin) return 3; else return 2; } else if (key > keyMax) // region 789 { if (value > valueMax) return 7; else if (value < valueMin) return 9; else return 8; } else // region 456 { if (value > valueMax) return 4; else if (value < valueMin) return 6; else return 5; } } /*! \internal This function is part of the curve optimization algorithm of \ref getCurveLines. This method is used in case the current segment passes from inside the visible rect (region 5, see \ref getRegion) to any of the outer regions (\a otherRegion). The current segment is given by the line connecting (\a key, \a value) with (\a otherKey, \a otherValue). It returns the intersection point of the segment with the border of region 5. For this function it doesn't matter whether (\a key, \a value) is the point inside region 5 or whether it's (\a otherKey, \a otherValue), i.e. whether the segment is coming from region 5 or leaving it. It is important though that \a otherRegion correctly identifies the other region not equal to 5. */ QPointF QCPCurve::getOptimizedPoint(int otherRegion, double otherKey, double otherValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const { double intersectKey = keyMin; // initial value is just fail-safe double intersectValue = valueMax; // initial value is just fail-safe switch (otherRegion) { case 1: // top and left edge { intersectValue = valueMax; intersectKey = otherKey + (key-otherKey)/(value-otherValue)*(intersectValue-otherValue); if (intersectKey < keyMin || intersectKey > keyMax) // doesn't intersect, so must intersect other: { intersectKey = keyMin; intersectValue = otherValue + (value-otherValue)/(key-otherKey)*(intersectKey-otherKey); } break; } case 2: // left edge { intersectKey = keyMin; intersectValue = otherValue + (value-otherValue)/(key-otherKey)*(intersectKey-otherKey); break; } case 3: // bottom and left edge { intersectValue = valueMin; intersectKey = otherKey + (key-otherKey)/(value-otherValue)*(intersectValue-otherValue); if (intersectKey < keyMin || intersectKey > keyMax) // doesn't intersect, so must intersect other: { intersectKey = keyMin; intersectValue = otherValue + (value-otherValue)/(key-otherKey)*(intersectKey-otherKey); } break; } case 4: // top edge { intersectValue = valueMax; intersectKey = otherKey + (key-otherKey)/(value-otherValue)*(intersectValue-otherValue); break; } case 5: { break; // case 5 shouldn't happen for this function but we add it anyway to prevent potential discontinuity in branch table } case 6: // bottom edge { intersectValue = valueMin; intersectKey = otherKey + (key-otherKey)/(value-otherValue)*(intersectValue-otherValue); break; } case 7: // top and right edge { intersectValue = valueMax; intersectKey = otherKey + (key-otherKey)/(value-otherValue)*(intersectValue-otherValue); if (intersectKey < keyMin || intersectKey > keyMax) // doesn't intersect, so must intersect other: { intersectKey = keyMax; intersectValue = otherValue + (value-otherValue)/(key-otherKey)*(intersectKey-otherKey); } break; } case 8: // right edge { intersectKey = keyMax; intersectValue = otherValue + (value-otherValue)/(key-otherKey)*(intersectKey-otherKey); break; } case 9: // bottom and right edge { intersectValue = valueMin; intersectKey = otherKey + (key-otherKey)/(value-otherValue)*(intersectValue-otherValue); if (intersectKey < keyMin || intersectKey > keyMax) // doesn't intersect, so must intersect other: { intersectKey = keyMax; intersectValue = otherValue + (value-otherValue)/(key-otherKey)*(intersectKey-otherKey); } break; } } return coordsToPixels(intersectKey, intersectValue); } /*! \internal This function is part of the curve optimization algorithm of \ref getCurveLines. In situations where a single segment skips over multiple regions it might become necessary to add extra points at the corners of region 5 (see \ref getRegion) such that the optimized segment doesn't unintentionally cut through the visible area of the axis rect and create plot artifacts. This method provides these points that must be added, assuming the original segment doesn't start, end, or traverse region 5. (Corner points where region 5 is traversed are calculated by \ref getTraverseCornerPoints.) For example, consider a segment which directly goes from region 4 to 2 but originally is far out to the top left such that it doesn't cross region 5. Naively optimizing these points by projecting them on the top and left borders of region 5 will create a segment that surely crosses 5, creating a visual artifact in the plot. This method prevents this by providing extra points at the top left corner, making the optimized curve correctly pass from region 4 to 1 to 2 without traversing 5. */ QVector QCPCurve::getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const { QVector result; switch (prevRegion) { case 1: { switch (currentRegion) { case 2: { result << coordsToPixels(keyMin, valueMax); break; } case 4: { result << coordsToPixels(keyMin, valueMax); break; } case 3: { result << coordsToPixels(keyMin, valueMax) << coordsToPixels(keyMin, valueMin); break; } case 7: { result << coordsToPixels(keyMin, valueMax) << coordsToPixels(keyMax, valueMax); break; } case 6: { result << coordsToPixels(keyMin, valueMax) << coordsToPixels(keyMin, valueMin); result.append(result.last()); break; } case 8: { result << coordsToPixels(keyMin, valueMax) << coordsToPixels(keyMax, valueMax); result.append(result.last()); break; } case 9: { // in this case we need another distinction of cases: segment may pass below or above rect, requiring either bottom right or top left corner points if ((value-prevValue)/(key-prevKey)*(keyMin-key)+value < valueMin) // segment passes below R { result << coordsToPixels(keyMin, valueMax) << coordsToPixels(keyMin, valueMin); result.append(result.last()); result << coordsToPixels(keyMax, valueMin); } else { result << coordsToPixels(keyMin, valueMax) << coordsToPixels(keyMax, valueMax); result.append(result.last()); result << coordsToPixels(keyMax, valueMin); } break; } } break; } case 2: { switch (currentRegion) { case 1: { result << coordsToPixels(keyMin, valueMax); break; } case 3: { result << coordsToPixels(keyMin, valueMin); break; } case 4: { result << coordsToPixels(keyMin, valueMax); result.append(result.last()); break; } case 6: { result << coordsToPixels(keyMin, valueMin); result.append(result.last()); break; } case 7: { result << coordsToPixels(keyMin, valueMax); result.append(result.last()); result << coordsToPixels(keyMax, valueMax); break; } case 9: { result << coordsToPixels(keyMin, valueMin); result.append(result.last()); result << coordsToPixels(keyMax, valueMin); break; } } break; } case 3: { switch (currentRegion) { case 2: { result << coordsToPixels(keyMin, valueMin); break; } case 6: { result << coordsToPixels(keyMin, valueMin); break; } case 1: { result << coordsToPixels(keyMin, valueMin) << coordsToPixels(keyMin, valueMax); break; } case 9: { result << coordsToPixels(keyMin, valueMin) << coordsToPixels(keyMax, valueMin); break; } case 4: { result << coordsToPixels(keyMin, valueMin) << coordsToPixels(keyMin, valueMax); result.append(result.last()); break; } case 8: { result << coordsToPixels(keyMin, valueMin) << coordsToPixels(keyMax, valueMin); result.append(result.last()); break; } case 7: { // in this case we need another distinction of cases: segment may pass below or above rect, requiring either bottom right or top left corner points if ((value-prevValue)/(key-prevKey)*(keyMax-key)+value < valueMin) // segment passes below R { result << coordsToPixels(keyMin, valueMin) << coordsToPixels(keyMax, valueMin); result.append(result.last()); result << coordsToPixels(keyMax, valueMax); } else { result << coordsToPixels(keyMin, valueMin) << coordsToPixels(keyMin, valueMax); result.append(result.last()); result << coordsToPixels(keyMax, valueMax); } break; } } break; } case 4: { switch (currentRegion) { case 1: { result << coordsToPixels(keyMin, valueMax); break; } case 7: { result << coordsToPixels(keyMax, valueMax); break; } case 2: { result << coordsToPixels(keyMin, valueMax); result.append(result.last()); break; } case 8: { result << coordsToPixels(keyMax, valueMax); result.append(result.last()); break; } case 3: { result << coordsToPixels(keyMin, valueMax); result.append(result.last()); result << coordsToPixels(keyMin, valueMin); break; } case 9: { result << coordsToPixels(keyMax, valueMax); result.append(result.last()); result << coordsToPixels(keyMax, valueMin); break; } } break; } case 5: { switch (currentRegion) { case 1: { result << coordsToPixels(keyMin, valueMax); break; } case 7: { result << coordsToPixels(keyMax, valueMax); break; } case 9: { result << coordsToPixels(keyMax, valueMin); break; } case 3: { result << coordsToPixels(keyMin, valueMin); break; } } break; } case 6: { switch (currentRegion) { case 3: { result << coordsToPixels(keyMin, valueMin); break; } case 9: { result << coordsToPixels(keyMax, valueMin); break; } case 2: { result << coordsToPixels(keyMin, valueMin); result.append(result.last()); break; } case 8: { result << coordsToPixels(keyMax, valueMin); result.append(result.last()); break; } case 1: { result << coordsToPixels(keyMin, valueMin); result.append(result.last()); result << coordsToPixels(keyMin, valueMax); break; } case 7: { result << coordsToPixels(keyMax, valueMin); result.append(result.last()); result << coordsToPixels(keyMax, valueMax); break; } } break; } case 7: { switch (currentRegion) { case 4: { result << coordsToPixels(keyMax, valueMax); break; } case 8: { result << coordsToPixels(keyMax, valueMax); break; } case 1: { result << coordsToPixels(keyMax, valueMax) << coordsToPixels(keyMin, valueMax); break; } case 9: { result << coordsToPixels(keyMax, valueMax) << coordsToPixels(keyMax, valueMin); break; } case 2: { result << coordsToPixels(keyMax, valueMax) << coordsToPixels(keyMin, valueMax); result.append(result.last()); break; } case 6: { result << coordsToPixels(keyMax, valueMax) << coordsToPixels(keyMax, valueMin); result.append(result.last()); break; } case 3: { // in this case we need another distinction of cases: segment may pass below or above rect, requiring either bottom right or top left corner points if ((value-prevValue)/(key-prevKey)*(keyMax-key)+value < valueMin) // segment passes below R { result << coordsToPixels(keyMax, valueMax) << coordsToPixels(keyMax, valueMin); result.append(result.last()); result << coordsToPixels(keyMin, valueMin); } else { result << coordsToPixels(keyMax, valueMax) << coordsToPixels(keyMin, valueMax); result.append(result.last()); result << coordsToPixels(keyMin, valueMin); } break; } } break; } case 8: { switch (currentRegion) { case 7: { result << coordsToPixels(keyMax, valueMax); break; } case 9: { result << coordsToPixels(keyMax, valueMin); break; } case 4: { result << coordsToPixels(keyMax, valueMax); result.append(result.last()); break; } case 6: { result << coordsToPixels(keyMax, valueMin); result.append(result.last()); break; } case 1: { result << coordsToPixels(keyMax, valueMax); result.append(result.last()); result << coordsToPixels(keyMin, valueMax); break; } case 3: { result << coordsToPixels(keyMax, valueMin); result.append(result.last()); result << coordsToPixels(keyMin, valueMin); break; } } break; } case 9: { switch (currentRegion) { case 6: { result << coordsToPixels(keyMax, valueMin); break; } case 8: { result << coordsToPixels(keyMax, valueMin); break; } case 3: { result << coordsToPixels(keyMax, valueMin) << coordsToPixels(keyMin, valueMin); break; } case 7: { result << coordsToPixels(keyMax, valueMin) << coordsToPixels(keyMax, valueMax); break; } case 2: { result << coordsToPixels(keyMax, valueMin) << coordsToPixels(keyMin, valueMin); result.append(result.last()); break; } case 4: { result << coordsToPixels(keyMax, valueMin) << coordsToPixels(keyMax, valueMax); result.append(result.last()); break; } case 1: { // in this case we need another distinction of cases: segment may pass below or above rect, requiring either bottom right or top left corner points if ((value-prevValue)/(key-prevKey)*(keyMin-key)+value < valueMin) // segment passes below R { result << coordsToPixels(keyMax, valueMin) << coordsToPixels(keyMin, valueMin); result.append(result.last()); result << coordsToPixels(keyMin, valueMax); } else { result << coordsToPixels(keyMax, valueMin) << coordsToPixels(keyMax, valueMax); result.append(result.last()); result << coordsToPixels(keyMin, valueMax); } break; } } break; } } return result; } /*! \internal This function is part of the curve optimization algorithm of \ref getCurveLines. This method returns whether a segment going from \a prevRegion to \a currentRegion (see \ref getRegion) may traverse the visible region 5. This function assumes that neither \a prevRegion nor \a currentRegion is 5 itself. If this method returns false, the segment for sure doesn't pass region 5. If it returns true, the segment may or may not pass region 5 and a more fine-grained calculation must be used (\ref getTraverse). */ bool QCPCurve::mayTraverse(int prevRegion, int currentRegion) const { switch (prevRegion) { case 1: { switch (currentRegion) { case 4: case 7: case 2: case 3: return false; default: return true; } } case 2: { switch (currentRegion) { case 1: case 3: return false; default: return true; } } case 3: { switch (currentRegion) { case 1: case 2: case 6: case 9: return false; default: return true; } } case 4: { switch (currentRegion) { case 1: case 7: return false; default: return true; } } case 5: return false; // should never occur case 6: { switch (currentRegion) { case 3: case 9: return false; default: return true; } } case 7: { switch (currentRegion) { case 1: case 4: case 8: case 9: return false; default: return true; } } case 8: { switch (currentRegion) { case 7: case 9: return false; default: return true; } } case 9: { switch (currentRegion) { case 3: case 6: case 8: case 7: return false; default: return true; } } default: return true; } } /*! \internal This function is part of the curve optimization algorithm of \ref getCurveLines. This method assumes that the \ref mayTraverse test has returned true, so there is a chance the segment defined by (\a prevKey, \a prevValue) and (\a key, \a value) goes through the visible region 5. The return value of this method indicates whether the segment actually traverses region 5 or not. If the segment traverses 5, the output parameters \a crossA and \a crossB indicate the entry and exit points of region 5. They will become the optimized points for that segment. */ bool QCPCurve::getTraverse(double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin, QPointF &crossA, QPointF &crossB) const { QList intersections; // x of QPointF corresponds to key and y to value if (qFuzzyIsNull(key-prevKey)) // line is parallel to value axis { // due to region filter in mayTraverseR(), if line is parallel to value or key axis, R is traversed here intersections.append(QPointF(key, valueMin)); // direction will be taken care of at end of method intersections.append(QPointF(key, valueMax)); } else if (qFuzzyIsNull(value-prevValue)) // line is parallel to key axis { // due to region filter in mayTraverseR(), if line is parallel to value or key axis, R is traversed here intersections.append(QPointF(keyMin, value)); // direction will be taken care of at end of method intersections.append(QPointF(keyMax, value)); } else // line is skewed { double gamma; double keyPerValue = (key-prevKey)/(value-prevValue); // check top of rect: gamma = prevKey + (valueMax-prevValue)*keyPerValue; if (gamma >= keyMin && gamma <= keyMax) intersections.append(QPointF(gamma, valueMax)); // check bottom of rect: gamma = prevKey + (valueMin-prevValue)*keyPerValue; if (gamma >= keyMin && gamma <= keyMax) intersections.append(QPointF(gamma, valueMin)); double valuePerKey = 1.0/keyPerValue; // check left of rect: gamma = prevValue + (keyMin-prevKey)*valuePerKey; if (gamma >= valueMin && gamma <= valueMax) intersections.append(QPointF(keyMin, gamma)); // check right of rect: gamma = prevValue + (keyMax-prevKey)*valuePerKey; if (gamma >= valueMin && gamma <= valueMax) intersections.append(QPointF(keyMax, gamma)); } // handle cases where found points isn't exactly 2: if (intersections.size() > 2) { // line probably goes through corner of rect, and we got duplicate points there. single out the point pair with greatest distance in between: double distSqrMax = 0; QPointF pv1, pv2; for (int i=0; i distSqrMax) { pv1 = intersections.at(i); pv2 = intersections.at(k); distSqrMax = distSqr; } } } intersections = QList() << pv1 << pv2; } else if (intersections.size() != 2) { // one or even zero points found (shouldn't happen unless line perfectly tangent to corner), no need to draw segment return false; } // possibly re-sort points so optimized point segment has same direction as original segment: if ((key-prevKey)*(intersections.at(1).x()-intersections.at(0).x()) + (value-prevValue)*(intersections.at(1).y()-intersections.at(0).y()) < 0) // scalar product of both segments < 0 -> opposite direction intersections.move(0, 1); crossA = coordsToPixels(intersections.at(0).x(), intersections.at(0).y()); crossB = coordsToPixels(intersections.at(1).x(), intersections.at(1).y()); return true; } /*! \internal This function is part of the curve optimization algorithm of \ref getCurveLines. This method assumes that the \ref getTraverse test has returned true, so the segment definitely traverses the visible region 5 when going from \a prevRegion to \a currentRegion. In certain situations it is not sufficient to merely generate the entry and exit points of the segment into/out of region 5, as \ref getTraverse provides. It may happen that a single segment, in addition to traversing region 5, skips another region outside of region 5, which makes it necessary to add an optimized corner point there (very similar to the job \ref getOptimizedCornerPoints does for segments that are completely in outside regions and don't traverse 5). As an example, consider a segment going from region 1 to region 6, traversing the lower left corner of region 5. In this configuration, the segment additionally crosses the border between region 1 and 2 before entering region 5. This makes it necessary to add an additional point in the top left corner, before adding the optimized traverse points. So in this case, the output parameter \a beforeTraverse will contain the top left corner point, and \a afterTraverse will be empty. In some cases, such as when going from region 1 to 9, it may even be necessary to add additional corner points before and after the traverse. Then both \a beforeTraverse and \a afterTraverse return the respective corner points. */ void QCPCurve::getTraverseCornerPoints(int prevRegion, int currentRegion, double keyMin, double valueMax, double keyMax, double valueMin, QVector &beforeTraverse, QVector &afterTraverse) const { switch (prevRegion) { case 1: { switch (currentRegion) { case 6: { beforeTraverse << coordsToPixels(keyMin, valueMax); break; } case 9: { beforeTraverse << coordsToPixels(keyMin, valueMax); afterTraverse << coordsToPixels(keyMax, valueMin); break; } case 8: { beforeTraverse << coordsToPixels(keyMin, valueMax); break; } } break; } case 2: { switch (currentRegion) { case 7: { afterTraverse << coordsToPixels(keyMax, valueMax); break; } case 9: { afterTraverse << coordsToPixels(keyMax, valueMin); break; } } break; } case 3: { switch (currentRegion) { case 4: { beforeTraverse << coordsToPixels(keyMin, valueMin); break; } case 7: { beforeTraverse << coordsToPixels(keyMin, valueMin); afterTraverse << coordsToPixels(keyMax, valueMax); break; } case 8: { beforeTraverse << coordsToPixels(keyMin, valueMin); break; } } break; } case 4: { switch (currentRegion) { case 3: { afterTraverse << coordsToPixels(keyMin, valueMin); break; } case 9: { afterTraverse << coordsToPixels(keyMax, valueMin); break; } } break; } case 5: { break; } // shouldn't happen because this method only handles full traverses case 6: { switch (currentRegion) { case 1: { afterTraverse << coordsToPixels(keyMin, valueMax); break; } case 7: { afterTraverse << coordsToPixels(keyMax, valueMax); break; } } break; } case 7: { switch (currentRegion) { case 2: { beforeTraverse << coordsToPixels(keyMax, valueMax); break; } case 3: { beforeTraverse << coordsToPixels(keyMax, valueMax); afterTraverse << coordsToPixels(keyMin, valueMin); break; } case 6: { beforeTraverse << coordsToPixels(keyMax, valueMax); break; } } break; } case 8: { switch (currentRegion) { case 1: { afterTraverse << coordsToPixels(keyMin, valueMax); break; } case 3: { afterTraverse << coordsToPixels(keyMin, valueMin); break; } } break; } case 9: { switch (currentRegion) { case 2: { beforeTraverse << coordsToPixels(keyMax, valueMin); break; } case 1: { beforeTraverse << coordsToPixels(keyMax, valueMin); afterTraverse << coordsToPixels(keyMin, valueMax); break; } case 4: { beforeTraverse << coordsToPixels(keyMax, valueMin); break; } } break; } } } /*! \internal Calculates the (minimum) distance (in pixels) the curve's representation has from the given \a pixelPoint in pixels. This is used to determine whether the curve was clicked or not, e.g. in \ref selectTest. The closest data point to \a pixelPoint is returned in \a closestData. Note that if the curve has a line representation, the returned distance may be smaller than the distance to the \a closestData point, since the distance to the curve line is also taken into account. If either the curve has no data or if the line style is \ref lsNone and the scatter style's shape is \ref QCPScatterStyle::ssNone (i.e. there is no visual representation of the curve), returns -1.0. */ double QCPCurve::pointDistance(const QPointF &pixelPoint, QCPCurveDataContainer::const_iterator &closestData) const { closestData = mDataContainer->constEnd(); if (mDataContainer->isEmpty()) return -1.0; if (mLineStyle == lsNone && mScatterStyle.isNone()) return -1.0; if (mDataContainer->size() == 1) { QPointF dataPoint = coordsToPixels(mDataContainer->constBegin()->key, mDataContainer->constBegin()->value); closestData = mDataContainer->constBegin(); return QCPVector2D(dataPoint-pixelPoint).length(); } // calculate minimum distances to curve data points and find closestData iterator: double minDistSqr = std::numeric_limits::max(); // iterate over found data points and then choose the one with the shortest distance to pos: QCPCurveDataContainer::const_iterator begin = mDataContainer->constBegin(); QCPCurveDataContainer::const_iterator end = mDataContainer->constEnd(); for (QCPCurveDataContainer::const_iterator it=begin; it!=end; ++it) { const double currentDistSqr = QCPVector2D(coordsToPixels(it->key, it->value)-pixelPoint).lengthSquared(); if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; closestData = it; } } // calculate distance to line if there is one (if so, will probably be smaller than distance to closest data point): if (mLineStyle != lsNone) { QVector lines; getCurveLines(&lines, QCPDataRange(0, dataCount()), mParentPlot->selectionTolerance()*1.2); // optimized lines outside axis rect shouldn't respond to clicks at the edge, so use 1.2*tolerance as pen width for (int i=0; i QCPBarsGroup::bars() const Returns all bars currently in this group. \see bars(int index) */ /*! \fn int QCPBarsGroup::size() const Returns the number of QCPBars plottables that are part of this group. */ /*! \fn bool QCPBarsGroup::isEmpty() const Returns whether this bars group is empty. \see size */ /*! \fn bool QCPBarsGroup::contains(QCPBars *bars) Returns whether the specified \a bars plottable is part of this group. */ /* end of documentation of inline functions */ /*! Constructs a new bars group for the specified QCustomPlot instance. */ QCPBarsGroup::QCPBarsGroup(QCustomPlot *parentPlot) : QObject(parentPlot), mParentPlot(parentPlot), mSpacingType(stAbsolute), mSpacing(4) { } QCPBarsGroup::~QCPBarsGroup() { clear(); } /*! Sets how the spacing between adjacent bars is interpreted. See \ref SpacingType. The actual spacing can then be specified with \ref setSpacing. \see setSpacing */ void QCPBarsGroup::setSpacingType(SpacingType spacingType) { mSpacingType = spacingType; } /*! Sets the spacing between adjacent bars. What the number passed as \a spacing actually means, is defined by the current \ref SpacingType, which can be set with \ref setSpacingType. \see setSpacingType */ void QCPBarsGroup::setSpacing(double spacing) { mSpacing = spacing; } /*! Returns the QCPBars instance with the specified \a index in this group. If no such QCPBars exists, returns 0. \see bars(), size */ QCPBars *QCPBarsGroup::bars(int index) const { if (index >= 0 && index < mBars.size()) { return mBars.at(index); } else { qDebug() << Q_FUNC_INFO << "index out of bounds:" << index; return 0; } } /*! Removes all QCPBars plottables from this group. \see isEmpty */ void QCPBarsGroup::clear() { foreach (QCPBars *bars, mBars) // since foreach takes a copy, removing bars in the loop is okay bars->setBarsGroup(0); // removes itself via removeBars } /*! Adds the specified \a bars plottable to this group. Alternatively, you can also use \ref QCPBars::setBarsGroup on the \a bars instance. \see insert, remove */ void QCPBarsGroup::append(QCPBars *bars) { if (!bars) { qDebug() << Q_FUNC_INFO << "bars is 0"; return; } if (!mBars.contains(bars)) bars->setBarsGroup(this); else qDebug() << Q_FUNC_INFO << "bars plottable is already in this bars group:" << reinterpret_cast(bars); } /*! Inserts the specified \a bars plottable into this group at the specified index position \a i. This gives you full control over the ordering of the bars. \a bars may already be part of this group. In that case, \a bars is just moved to the new index position. \see append, remove */ void QCPBarsGroup::insert(int i, QCPBars *bars) { if (!bars) { qDebug() << Q_FUNC_INFO << "bars is 0"; return; } // first append to bars list normally: if (!mBars.contains(bars)) bars->setBarsGroup(this); // then move to according position: mBars.move(mBars.indexOf(bars), qBound(0, i, mBars.size()-1)); } /*! Removes the specified \a bars plottable from this group. \see contains, clear */ void QCPBarsGroup::remove(QCPBars *bars) { if (!bars) { qDebug() << Q_FUNC_INFO << "bars is 0"; return; } if (mBars.contains(bars)) bars->setBarsGroup(0); else qDebug() << Q_FUNC_INFO << "bars plottable is not in this bars group:" << reinterpret_cast(bars); } /*! \internal Adds the specified \a bars to the internal mBars list of bars. This method does not change the barsGroup property on \a bars. \see unregisterBars */ void QCPBarsGroup::registerBars(QCPBars *bars) { if (!mBars.contains(bars)) mBars.append(bars); } /*! \internal Removes the specified \a bars from the internal mBars list of bars. This method does not change the barsGroup property on \a bars. \see registerBars */ void QCPBarsGroup::unregisterBars(QCPBars *bars) { mBars.removeOne(bars); } /*! \internal Returns the pixel offset in the key dimension the specified \a bars plottable should have at the given key coordinate \a keyCoord. The offset is relative to the pixel position of the key coordinate \a keyCoord. */ double QCPBarsGroup::keyPixelOffset(const QCPBars *bars, double keyCoord) { // find list of all base bars in case some mBars are stacked: QList baseBars; foreach (const QCPBars *b, mBars) { while (b->barBelow()) b = b->barBelow(); if (!baseBars.contains(b)) baseBars.append(b); } // find base bar this "bars" is stacked on: const QCPBars *thisBase = bars; while (thisBase->barBelow()) thisBase = thisBase->barBelow(); // determine key pixel offset of this base bars considering all other base bars in this barsgroup: double result = 0; int index = baseBars.indexOf(thisBase); if (index >= 0) { if (baseBars.size() % 2 == 1 && index == (baseBars.size()-1)/2) // is center bar (int division on purpose) { return result; } else { double lowerPixelWidth, upperPixelWidth; int startIndex; int dir = (index <= (baseBars.size()-1)/2) ? -1 : 1; // if bar is to lower keys of center, dir is negative if (baseBars.size() % 2 == 0) // even number of bars { startIndex = baseBars.size()/2 + (dir < 0 ? -1 : 0); result += getPixelSpacing(baseBars.at(startIndex), keyCoord)*0.5; // half of middle spacing } else // uneven number of bars { startIndex = (baseBars.size()-1)/2+dir; baseBars.at((baseBars.size()-1)/2)->getPixelWidth(keyCoord, lowerPixelWidth, upperPixelWidth); result += qAbs(upperPixelWidth-lowerPixelWidth)*0.5; // half of center bar result += getPixelSpacing(baseBars.at((baseBars.size()-1)/2), keyCoord); // center bar spacing } for (int i = startIndex; i != index; i += dir) // add widths and spacings of bars in between center and our bars { baseBars.at(i)->getPixelWidth(keyCoord, lowerPixelWidth, upperPixelWidth); result += qAbs(upperPixelWidth-lowerPixelWidth); result += getPixelSpacing(baseBars.at(i), keyCoord); } // finally half of our bars width: baseBars.at(index)->getPixelWidth(keyCoord, lowerPixelWidth, upperPixelWidth); result += qAbs(upperPixelWidth-lowerPixelWidth)*0.5; // correct sign of result depending on orientation and direction of key axis: result *= dir*thisBase->keyAxis()->pixelOrientation(); } } return result; } /*! \internal Returns the spacing in pixels which is between this \a bars and the following one, both at the key coordinate \a keyCoord. \note Typically the returned value doesn't depend on \a bars or \a keyCoord. \a bars is only needed to get access to the key axis transformation and axis rect for the modes \ref stAxisRectRatio and \ref stPlotCoords. The \a keyCoord is only relevant for spacings given in \ref stPlotCoords on a logarithmic axis. */ double QCPBarsGroup::getPixelSpacing(const QCPBars *bars, double keyCoord) { switch (mSpacingType) { case stAbsolute: { return mSpacing; } case stAxisRectRatio: { if (bars->keyAxis()->orientation() == Qt::Horizontal) return bars->keyAxis()->axisRect()->width()*mSpacing; else return bars->keyAxis()->axisRect()->height()*mSpacing; } case stPlotCoords: { double keyPixel = bars->keyAxis()->coordToPixel(keyCoord); return qAbs(bars->keyAxis()->coordToPixel(keyCoord+mSpacing)-keyPixel); } } return 0; } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPBarsData //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPBarsData \brief Holds the data of one single data point (one bar) for QCPBars. The stored data is: \li \a key: coordinate on the key axis of this bar (this is the \a mainKey and the \a sortKey) \li \a value: height coordinate on the value axis of this bar (this is the \a mainValue) The container for storing multiple data points is \ref QCPBarsDataContainer. It is a typedef for \ref QCPDataContainer with \ref QCPBarsData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods. \see QCPBarsDataContainer */ /* start documentation of inline functions */ /*! \fn double QCPBarsData::sortKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static QCPBarsData QCPBarsData::fromSortKey(double sortKey) Returns a data point with the specified \a sortKey. All other members are set to zero. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static static bool QCPBarsData::sortKeyIsMainKey() Since the member \a key is both the data point key coordinate and the data ordering parameter, this method returns true. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPBarsData::mainKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPBarsData::mainValue() const Returns the \a value member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn QCPRange QCPBarsData::valueRange() const Returns a QCPRange with both lower and upper boundary set to \a value of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /* end documentation of inline functions */ /*! Constructs a bar data point with key and value set to zero. */ QCPBarsData::QCPBarsData() : key(0), value(0) { } /*! Constructs a bar data point with the specified \a key and \a value. */ QCPBarsData::QCPBarsData(double key, double value) : key(key), value(value) { } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPBars //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPBars \brief A plottable representing a bar chart in a plot. \image html QCPBars.png To plot data, assign it with the \ref setData or \ref addData functions. \section qcpbars-appearance Changing the appearance The appearance of the bars is determined by the pen and the brush (\ref setPen, \ref setBrush). The width of the individual bars can be controlled with \ref setWidthType and \ref setWidth. Bar charts are stackable. This means, two QCPBars plottables can be placed on top of each other (see \ref QCPBars::moveAbove). So when two bars are at the same key position, they will appear stacked. If you would like to group multiple QCPBars plottables together so they appear side by side as shown below, use QCPBarsGroup. \image html QCPBarsGroup.png \section qcpbars-usage Usage Like all data representing objects in QCustomPlot, the QCPBars is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.) Usually, you first create an instance: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpbars-creation-1 which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpbars-creation-2 */ /* start of documentation of inline functions */ /*! \fn QSharedPointer QCPBars::data() const Returns a shared pointer to the internal data storage of type \ref QCPBarsDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular \ref setData or \ref addData methods. */ /*! \fn QCPBars *QCPBars::barBelow() const Returns the bars plottable that is directly below this bars plottable. If there is no such plottable, returns 0. \see barAbove, moveBelow, moveAbove */ /*! \fn QCPBars *QCPBars::barAbove() const Returns the bars plottable that is directly above this bars plottable. If there is no such plottable, returns 0. \see barBelow, moveBelow, moveAbove */ /* end of documentation of inline functions */ /*! Constructs a bar chart which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. The created QCPBars is automatically registered with the QCustomPlot instance inferred from \a keyAxis. This QCustomPlot instance takes ownership of the QCPBars, so do not delete it manually but use QCustomPlot::removePlottable() instead. */ QCPBars::QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable1D(keyAxis, valueAxis), mWidth(0.75), mWidthType(wtPlotCoords), mBarsGroup(0), mBaseValue(0), mStackingGap(0) { // modify inherited properties from abstract plottable: mPen.setColor(Qt::blue); mPen.setStyle(Qt::SolidLine); mBrush.setColor(QColor(40, 50, 255, 30)); mBrush.setStyle(Qt::SolidPattern); mSelectionDecorator->setBrush(QBrush(QColor(160, 160, 255))); } QCPBars::~QCPBars() { setBarsGroup(0); if (mBarBelow || mBarAbove) connectBars(mBarBelow.data(), mBarAbove.data()); // take this bar out of any stacking } /*! \overload Replaces the current data container with the provided \a data container. Since a QSharedPointer is used, multiple QCPBars may share the same data container safely. Modifying the data in the container will then affect all bars that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpbars-datasharing-1 If you do not wish to share containers, but create a copy from an existing container, rather use the \ref QCPDataContainer::set method on the bar's data container directly: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpbars-datasharing-2 \see addData */ void QCPBars::setData(QSharedPointer data) { mDataContainer = data; } /*! \overload Replaces the current data with the provided points in \a keys and \a values. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. \see addData */ void QCPBars::setData(const QVector &keys, const QVector &values, bool alreadySorted) { mDataContainer->clear(); addData(keys, values, alreadySorted); } /*! Sets the width of the bars. How the number passed as \a width is interpreted (e.g. screen pixels, plot coordinates,...), depends on the currently set width type, see \ref setWidthType and \ref WidthType. */ void QCPBars::setWidth(double width) { mWidth = width; } /*! Sets how the width of the bars is defined. See the documentation of \ref WidthType for an explanation of the possible values for \a widthType. The default value is \ref wtPlotCoords. \see setWidth */ void QCPBars::setWidthType(QCPBars::WidthType widthType) { mWidthType = widthType; } /*! Sets to which QCPBarsGroup this QCPBars instance belongs to. Alternatively, you can also use \ref QCPBarsGroup::append. To remove this QCPBars from any group, set \a barsGroup to 0. */ void QCPBars::setBarsGroup(QCPBarsGroup *barsGroup) { // deregister at old group: if (mBarsGroup) mBarsGroup->unregisterBars(this); mBarsGroup = barsGroup; // register at new group: if (mBarsGroup) mBarsGroup->registerBars(this); } /*! Sets the base value of this bars plottable. The base value defines where on the value coordinate the bars start. How far the bars extend from the base value is given by their individual value data. For example, if the base value is set to 1, a bar with data value 2 will have its lowest point at value coordinate 1 and highest point at 3. For stacked bars, only the base value of the bottom-most QCPBars has meaning. The default base value is 0. */ void QCPBars::setBaseValue(double baseValue) { mBaseValue = baseValue; } /*! If this bars plottable is stacked on top of another bars plottable (\ref moveAbove), this method allows specifying a distance in \a pixels, by which the drawn bar rectangles will be separated by the bars below it. */ void QCPBars::setStackingGap(double pixels) { mStackingGap = pixels; } /*! \overload Adds the provided points in \a keys and \a values to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPBars::addData(const QVector &keys, const QVector &values, bool alreadySorted) { if (keys.size() != values.size()) qDebug() << Q_FUNC_INFO << "keys and values have different sizes:" << keys.size() << values.size(); const int n = qMin(keys.size(), values.size()); QVector tempData(n); QVector::iterator it = tempData.begin(); const QVector::iterator itEnd = tempData.end(); int i = 0; while (it != itEnd) { it->key = keys[i]; it->value = values[i]; ++it; ++i; } mDataContainer->add(tempData, alreadySorted); // don't modify tempData beyond this to prevent copy on write } /*! \overload Adds the provided data point as \a key and \a value to the current data. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPBars::addData(double key, double value) { mDataContainer->add(QCPBarsData(key, value)); } /*! Moves this bars plottable below \a bars. In other words, the bars of this plottable will appear below the bars of \a bars. The move target \a bars must use the same key and value axis as this plottable. Inserting into and removing from existing bar stacking is handled gracefully. If \a bars already has a bars object below itself, this bars object is inserted between the two. If this bars object is already between two other bars, the two other bars will be stacked on top of each other after the operation. To remove this bars plottable from any stacking, set \a bars to 0. \see moveBelow, barAbove, barBelow */ void QCPBars::moveBelow(QCPBars *bars) { if (bars == this) return; if (bars && (bars->keyAxis() != mKeyAxis.data() || bars->valueAxis() != mValueAxis.data())) { qDebug() << Q_FUNC_INFO << "passed QCPBars* doesn't have same key and value axis as this QCPBars"; return; } // remove from stacking: connectBars(mBarBelow.data(), mBarAbove.data()); // Note: also works if one (or both) of them is 0 // if new bar given, insert this bar below it: if (bars) { if (bars->mBarBelow) connectBars(bars->mBarBelow.data(), this); connectBars(this, bars); } } /*! Moves this bars plottable above \a bars. In other words, the bars of this plottable will appear above the bars of \a bars. The move target \a bars must use the same key and value axis as this plottable. Inserting into and removing from existing bar stacking is handled gracefully. If \a bars already has a bars object above itself, this bars object is inserted between the two. If this bars object is already between two other bars, the two other bars will be stacked on top of each other after the operation. To remove this bars plottable from any stacking, set \a bars to 0. \see moveBelow, barBelow, barAbove */ void QCPBars::moveAbove(QCPBars *bars) { if (bars == this) return; if (bars && (bars->keyAxis() != mKeyAxis.data() || bars->valueAxis() != mValueAxis.data())) { qDebug() << Q_FUNC_INFO << "passed QCPBars* doesn't have same key and value axis as this QCPBars"; return; } // remove from stacking: connectBars(mBarBelow.data(), mBarAbove.data()); // Note: also works if one (or both) of them is 0 // if new bar given, insert this bar above it: if (bars) { if (bars->mBarAbove) connectBars(this, bars->mBarAbove.data()); connectBars(bars, this); } } /*! \copydoc QCPPlottableInterface1D::selectTestRect */ QCPDataSelection QCPBars::selectTestRect(const QRectF &rect, bool onlySelectable) const { QCPDataSelection result; if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return result; if (!mKeyAxis || !mValueAxis) return result; QCPBarsDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd); for (QCPBarsDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) { if (rect.intersects(getBarRect(it->key, it->value))) result.addDataRange(QCPDataRange(it-mDataContainer->constBegin(), it-mDataContainer->constBegin()+1), false); } result.simplify(); return result; } /* inherits documentation from base class */ double QCPBars::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint())) { // get visible data range: QCPBarsDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd); for (QCPBarsDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) { if (getBarRect(it->key, it->value).contains(pos)) { if (details) { int pointIndex = it-mDataContainer->constBegin(); details->setValue(QCPDataSelection(QCPDataRange(pointIndex, pointIndex+1))); } return mParentPlot->selectionTolerance()*0.99; } } } return -1; } /* inherits documentation from base class */ QCPRange QCPBars::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const { /* Note: If this QCPBars uses absolute pixels as width (or is in a QCPBarsGroup with spacing in absolute pixels), using this method to adapt the key axis range to fit the bars into the currently visible axis range will not work perfectly. Because in the moment the axis range is changed to the new range, the fixed pixel widths/spacings will represent different coordinate spans than before, which in turn would require a different key range to perfectly fit, and so on. The only solution would be to iteratively approach the perfect fitting axis range, but the mismatch isn't large enough in most applications, to warrant this here. If a user does need a better fit, he should call the corresponding axis rescale multiple times in a row. */ QCPRange range; range = mDataContainer->keyRange(foundRange, inSignDomain); // determine exact range of bars by including bar width and barsgroup offset: if (foundRange && mKeyAxis) { double lowerPixelWidth, upperPixelWidth, keyPixel; // lower range bound: getPixelWidth(range.lower, lowerPixelWidth, upperPixelWidth); keyPixel = mKeyAxis.data()->coordToPixel(range.lower) + lowerPixelWidth; if (mBarsGroup) keyPixel += mBarsGroup->keyPixelOffset(this, range.lower); const double lowerCorrected = mKeyAxis.data()->pixelToCoord(keyPixel); if (!qIsNaN(lowerCorrected) && qIsFinite(lowerCorrected) && range.lower > lowerCorrected) range.lower = lowerCorrected; // upper range bound: getPixelWidth(range.upper, lowerPixelWidth, upperPixelWidth); keyPixel = mKeyAxis.data()->coordToPixel(range.upper) + upperPixelWidth; if (mBarsGroup) keyPixel += mBarsGroup->keyPixelOffset(this, range.upper); const double upperCorrected = mKeyAxis.data()->pixelToCoord(keyPixel); if (!qIsNaN(upperCorrected) && qIsFinite(upperCorrected) && range.upper < upperCorrected) range.upper = upperCorrected; } return range; } /* inherits documentation from base class */ QCPRange QCPBars::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const { // Note: can't simply use mDataContainer->valueRange here because we need to // take into account bar base value and possible stacking of multiple bars QCPRange range; range.lower = mBaseValue; range.upper = mBaseValue; bool haveLower = true; // set to true, because baseValue should always be visible in bar charts bool haveUpper = true; // set to true, because baseValue should always be visible in bar charts QCPBarsDataContainer::const_iterator itBegin = mDataContainer->constBegin(); QCPBarsDataContainer::const_iterator itEnd = mDataContainer->constEnd(); if (inKeyRange != QCPRange()) { itBegin = mDataContainer->findBegin(inKeyRange.lower); itEnd = mDataContainer->findEnd(inKeyRange.upper); } for (QCPBarsDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { const double current = it->value + getStackedBaseValue(it->key, it->value >= 0); if (qIsNaN(current)) continue; if (inSignDomain == QCP::sdBoth || (inSignDomain == QCP::sdNegative && current < 0) || (inSignDomain == QCP::sdPositive && current > 0)) { if (current < range.lower || !haveLower) { range.lower = current; haveLower = true; } if (current > range.upper || !haveUpper) { range.upper = current; haveUpper = true; } } } foundRange = true; // return true because bar charts always have the 0-line visible return range; } /* inherits documentation from base class */ QPointF QCPBars::dataPixelPosition(int index) const { if (index >= 0 && index < mDataContainer->size()) { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QPointF(); } const QCPDataContainer::const_iterator it = mDataContainer->constBegin()+index; const double valuePixel = valueAxis->coordToPixel(getStackedBaseValue(it->key, it->value >= 0) + it->value); const double keyPixel = keyAxis->coordToPixel(it->key) + (mBarsGroup ? mBarsGroup->keyPixelOffset(this, it->key) : 0); if (keyAxis->orientation() == Qt::Horizontal) return QPointF(keyPixel, valuePixel); else return QPointF(valuePixel, keyPixel); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return QPointF(); } } /* inherits documentation from base class */ void QCPBars::draw(QCPPainter *painter) { if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (mDataContainer->isEmpty()) return; QCPBarsDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd); // loop over and draw segments of unselected/selected data: QList selectedSegments, unselectedSegments, allSegments; getDataSegments(selectedSegments, unselectedSegments); allSegments << unselectedSegments << selectedSegments; for (int i=0; i= unselectedSegments.size(); QCPBarsDataContainer::const_iterator begin = visibleBegin; QCPBarsDataContainer::const_iterator end = visibleEnd; mDataContainer->limitIteratorsToDataRange(begin, end, allSegments.at(i)); if (begin == end) continue; for (QCPBarsDataContainer::const_iterator it=begin; it!=end; ++it) { // check data validity if flag set: #ifdef QCUSTOMPLOT_CHECK_DATA if (QCP::isInvalidData(it->key, it->value)) qDebug() << Q_FUNC_INFO << "Data point at" << it->key << "of drawn range invalid." << "Plottable name:" << name(); #endif // draw bar: if (isSelectedSegment && mSelectionDecorator) { mSelectionDecorator->applyBrush(painter); mSelectionDecorator->applyPen(painter); } else { painter->setBrush(mBrush); painter->setPen(mPen); } applyDefaultAntialiasingHint(painter); painter->drawPolygon(getBarRect(it->key, it->value)); } } // draw other selection decoration that isn't just line/scatter pens and brushes: if (mSelectionDecorator) mSelectionDecorator->drawDecoration(painter, selection()); } /* inherits documentation from base class */ void QCPBars::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const { // draw filled rect: applyDefaultAntialiasingHint(painter); painter->setBrush(mBrush); painter->setPen(mPen); QRectF r = QRectF(0, 0, rect.width()*0.67, rect.height()*0.67); r.moveCenter(rect.center()); painter->drawRect(r); } /*! \internal called by \ref draw to determine which data (key) range is visible at the current key axis range setting, so only that needs to be processed. It also takes into account the bar width. \a begin returns an iterator to the lowest data point that needs to be taken into account when plotting. Note that in order to get a clean plot all the way to the edge of the axis rect, \a lower may still be just outside the visible range. \a end returns an iterator one higher than the highest visible data point. Same as before, \a end may also lie just outside of the visible range. if the plottable contains no data, both \a begin and \a end point to constEnd. */ void QCPBars::getVisibleDataBounds(QCPBarsDataContainer::const_iterator &begin, QCPBarsDataContainer::const_iterator &end) const { if (!mKeyAxis) { qDebug() << Q_FUNC_INFO << "invalid key axis"; begin = mDataContainer->constEnd(); end = mDataContainer->constEnd(); return; } if (mDataContainer->isEmpty()) { begin = mDataContainer->constEnd(); end = mDataContainer->constEnd(); return; } // get visible data range as QMap iterators begin = mDataContainer->findBegin(mKeyAxis.data()->range().lower); end = mDataContainer->findEnd(mKeyAxis.data()->range().upper); double lowerPixelBound = mKeyAxis.data()->coordToPixel(mKeyAxis.data()->range().lower); double upperPixelBound = mKeyAxis.data()->coordToPixel(mKeyAxis.data()->range().upper); bool isVisible = false; // walk left from begin to find lower bar that actually is completely outside visible pixel range: QCPBarsDataContainer::const_iterator it = begin; while (it != mDataContainer->constBegin()) { --it; const QRectF barRect = getBarRect(it->key, it->value); if (mKeyAxis.data()->orientation() == Qt::Horizontal) isVisible = ((!mKeyAxis.data()->rangeReversed() && barRect.right() >= lowerPixelBound) || (mKeyAxis.data()->rangeReversed() && barRect.left() <= lowerPixelBound)); else // keyaxis is vertical isVisible = ((!mKeyAxis.data()->rangeReversed() && barRect.top() <= lowerPixelBound) || (mKeyAxis.data()->rangeReversed() && barRect.bottom() >= lowerPixelBound)); if (isVisible) begin = it; else break; } // walk right from ubound to find upper bar that actually is completely outside visible pixel range: it = end; while (it != mDataContainer->constEnd()) { const QRectF barRect = getBarRect(it->key, it->value); if (mKeyAxis.data()->orientation() == Qt::Horizontal) isVisible = ((!mKeyAxis.data()->rangeReversed() && barRect.left() <= upperPixelBound) || (mKeyAxis.data()->rangeReversed() && barRect.right() >= upperPixelBound)); else // keyaxis is vertical isVisible = ((!mKeyAxis.data()->rangeReversed() && barRect.bottom() >= upperPixelBound) || (mKeyAxis.data()->rangeReversed() && barRect.top() <= upperPixelBound)); if (isVisible) end = it+1; else break; ++it; } } /*! \internal Returns the rect in pixel coordinates of a single bar with the specified \a key and \a value. The rect is shifted according to the bar stacking (see \ref moveAbove) and base value (see \ref setBaseValue), and to have non-overlapping border lines with the bars stacked below. */ QRectF QCPBars::getBarRect(double key, double value) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QRectF(); } double lowerPixelWidth, upperPixelWidth; getPixelWidth(key, lowerPixelWidth, upperPixelWidth); double base = getStackedBaseValue(key, value >= 0); double basePixel = valueAxis->coordToPixel(base); double valuePixel = valueAxis->coordToPixel(base+value); double keyPixel = keyAxis->coordToPixel(key); if (mBarsGroup) keyPixel += mBarsGroup->keyPixelOffset(this, key); double bottomOffset = (mBarBelow && mPen != Qt::NoPen ? 1 : 0)*(mPen.isCosmetic() ? 1 : mPen.widthF()); bottomOffset += mBarBelow ? mStackingGap : 0; bottomOffset *= (value<0 ? -1 : 1)*valueAxis->pixelOrientation(); if (qAbs(valuePixel-basePixel) <= qAbs(bottomOffset)) bottomOffset = valuePixel-basePixel; if (keyAxis->orientation() == Qt::Horizontal) { return QRectF(QPointF(keyPixel+lowerPixelWidth, valuePixel), QPointF(keyPixel+upperPixelWidth, basePixel+bottomOffset)).normalized(); } else { return QRectF(QPointF(basePixel+bottomOffset, keyPixel+lowerPixelWidth), QPointF(valuePixel, keyPixel+upperPixelWidth)).normalized(); } } /*! \internal This function is used to determine the width of the bar at coordinate \a key, according to the specified width (\ref setWidth) and width type (\ref setWidthType). The output parameters \a lower and \a upper return the number of pixels the bar extends to lower and higher keys, relative to the \a key coordinate (so with a non-reversed horizontal axis, \a lower is negative and \a upper positive). */ void QCPBars::getPixelWidth(double key, double &lower, double &upper) const { lower = 0; upper = 0; switch (mWidthType) { case wtAbsolute: { upper = mWidth*0.5*mKeyAxis.data()->pixelOrientation(); lower = -upper; break; } case wtAxisRectRatio: { if (mKeyAxis && mKeyAxis.data()->axisRect()) { if (mKeyAxis.data()->orientation() == Qt::Horizontal) upper = mKeyAxis.data()->axisRect()->width()*mWidth*0.5*mKeyAxis.data()->pixelOrientation(); else upper = mKeyAxis.data()->axisRect()->height()*mWidth*0.5*mKeyAxis.data()->pixelOrientation(); lower = -upper; } else qDebug() << Q_FUNC_INFO << "No key axis or axis rect defined"; break; } case wtPlotCoords: { if (mKeyAxis) { double keyPixel = mKeyAxis.data()->coordToPixel(key); upper = mKeyAxis.data()->coordToPixel(key+mWidth*0.5)-keyPixel; lower = mKeyAxis.data()->coordToPixel(key-mWidth*0.5)-keyPixel; // no need to qSwap(lower, higher) when range reversed, because higher/lower are gained by // coordinate transform which includes range direction } else qDebug() << Q_FUNC_INFO << "No key axis defined"; break; } } } /*! \internal This function is called to find at which value to start drawing the base of a bar at \a key, when it is stacked on top of another QCPBars (e.g. with \ref moveAbove). positive and negative bars are separated per stack (positive are stacked above baseValue upwards, negative are stacked below baseValue downwards). This can be indicated with \a positive. So if the bar for which we need the base value is negative, set \a positive to false. */ double QCPBars::getStackedBaseValue(double key, bool positive) const { if (mBarBelow) { double max = 0; // don't initialize with mBaseValue here because only base value of bottom-most bar has meaning in a bar stack // find bars of mBarBelow that are approximately at key and find largest one: double epsilon = qAbs(key)*(sizeof(key)==4 ? 1e-6 : 1e-14); // should be safe even when changed to use float at some point if (key == 0) epsilon = (sizeof(key)==4 ? 1e-6 : 1e-14); QCPBarsDataContainer::const_iterator it = mBarBelow.data()->mDataContainer->findBegin(key-epsilon); QCPBarsDataContainer::const_iterator itEnd = mBarBelow.data()->mDataContainer->findEnd(key+epsilon); while (it != itEnd) { if (it->key > key-epsilon && it->key < key+epsilon) { if ((positive && it->value > max) || (!positive && it->value < max)) max = it->value; } ++it; } // recurse down the bar-stack to find the total height: return max + mBarBelow.data()->getStackedBaseValue(key, positive); } else return mBaseValue; } /*! \internal Connects \a below and \a above to each other via their mBarAbove/mBarBelow properties. The bar(s) currently above lower and below upper will become disconnected to lower/upper. If lower is zero, upper will be disconnected at the bottom. If upper is zero, lower will be disconnected at the top. */ void QCPBars::connectBars(QCPBars *lower, QCPBars *upper) { if (!lower && !upper) return; if (!lower) // disconnect upper at bottom { // disconnect old bar below upper: if (upper->mBarBelow && upper->mBarBelow.data()->mBarAbove.data() == upper) upper->mBarBelow.data()->mBarAbove = 0; upper->mBarBelow = 0; } else if (!upper) // disconnect lower at top { // disconnect old bar above lower: if (lower->mBarAbove && lower->mBarAbove.data()->mBarBelow.data() == lower) lower->mBarAbove.data()->mBarBelow = 0; lower->mBarAbove = 0; } else // connect lower and upper { // disconnect old bar above lower: if (lower->mBarAbove && lower->mBarAbove.data()->mBarBelow.data() == lower) lower->mBarAbove.data()->mBarBelow = 0; // disconnect old bar below upper: if (upper->mBarBelow && upper->mBarBelow.data()->mBarAbove.data() == upper) upper->mBarBelow.data()->mBarAbove = 0; lower->mBarAbove = upper; upper->mBarBelow = lower; } } /* end of 'src/plottables/plottable-bars.cpp' */ /* including file 'src/plottables/plottable-statisticalbox.cpp', size 28622 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPStatisticalBoxData //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPStatisticalBoxData \brief Holds the data of one single data point for QCPStatisticalBox. The stored data is: \li \a key: coordinate on the key axis of this data point (this is the \a mainKey and the \a sortKey) \li \a minimum: the position of the lower whisker, typically the minimum measurement of the sample that's not considered an outlier. \li \a lowerQuartile: the lower end of the box. The lower and the upper quartiles are the two statistical quartiles around the median of the sample, they should contain 50% of the sample data. \li \a median: the value of the median mark inside the quartile box. The median separates the sample data in half (50% of the sample data is below/above the median). (This is the \a mainValue) \li \a upperQuartile: the upper end of the box. The lower and the upper quartiles are the two statistical quartiles around the median of the sample, they should contain 50% of the sample data. \li \a maximum: the position of the upper whisker, typically the maximum measurement of the sample that's not considered an outlier. \li \a outliers: a QVector of outlier values that will be drawn as scatter points at the \a key coordinate of this data point (see \ref QCPStatisticalBox::setOutlierStyle) The container for storing multiple data points is \ref QCPStatisticalBoxDataContainer. It is a typedef for \ref QCPDataContainer with \ref QCPStatisticalBoxData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods. \see QCPStatisticalBoxDataContainer */ /* start documentation of inline functions */ /*! \fn double QCPStatisticalBoxData::sortKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static QCPStatisticalBoxData QCPStatisticalBoxData::fromSortKey(double sortKey) Returns a data point with the specified \a sortKey. All other members are set to zero. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static static bool QCPStatisticalBoxData::sortKeyIsMainKey() Since the member \a key is both the data point key coordinate and the data ordering parameter, this method returns true. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPStatisticalBoxData::mainKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPStatisticalBoxData::mainValue() const Returns the \a median member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn QCPRange QCPStatisticalBoxData::valueRange() const Returns a QCPRange spanning from the \a minimum to the \a maximum member of this statistical box data point, possibly further expanded by outliers. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /* end documentation of inline functions */ /*! Constructs a data point with key and all values set to zero. */ QCPStatisticalBoxData::QCPStatisticalBoxData() : key(0), minimum(0), lowerQuartile(0), median(0), upperQuartile(0), maximum(0) { } /*! Constructs a data point with the specified \a key, \a minimum, \a lowerQuartile, \a median, \a upperQuartile, \a maximum and optionally a number of \a outliers. */ QCPStatisticalBoxData::QCPStatisticalBoxData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector &outliers) : key(key), minimum(minimum), lowerQuartile(lowerQuartile), median(median), upperQuartile(upperQuartile), maximum(maximum), outliers(outliers) { } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPStatisticalBox //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPStatisticalBox \brief A plottable representing a single statistical box in a plot. \image html QCPStatisticalBox.png To plot data, assign it with the \ref setData or \ref addData functions. Alternatively, you can also access and modify the data via the \ref data method, which returns a pointer to the internal \ref QCPStatisticalBoxDataContainer. Additionally each data point can itself have a list of outliers, drawn as scatter points at the key coordinate of the respective statistical box data point. They can either be set by using the respective \ref addData(double,double,double,double,double,double,const QVector&) "addData" method or accessing the individual data points through \ref data, and setting the QVector outliers of the data points directly. \section qcpstatisticalbox-appearance Changing the appearance The appearance of each data point box, ranging from the lower to the upper quartile, is controlled via \ref setPen and \ref setBrush. You may change the width of the boxes with \ref setWidth in plot coordinates. Each data point's visual representation also consists of two whiskers. Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum. The appearance of the whiskers can be modified with: \ref setWhiskerPen, \ref setWhiskerBarPen, \ref setWhiskerWidth. The whisker width is the width of the bar perpendicular to the whisker at the top (for maximum) and bottom (for minimum). If the whisker pen is changed, make sure to set the \c capStyle to \c Qt::FlatCap. Otherwise the backbone line might exceed the whisker bars by a few pixels due to the pen cap being not perfectly flat. The median indicator line inside the box has its own pen, \ref setMedianPen. The outlier data points are drawn as normal scatter points. Their look can be controlled with \ref setOutlierStyle \section qcpstatisticalbox-usage Usage Like all data representing objects in QCustomPlot, the QCPStatisticalBox is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.) Usually, you first create an instance: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpstatisticalbox-creation-1 which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpstatisticalbox-creation-2 */ /* start documentation of inline functions */ /*! \fn QSharedPointer QCPStatisticalBox::data() const Returns a shared pointer to the internal data storage of type \ref QCPStatisticalBoxDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular \ref setData or \ref addData methods. */ /* end documentation of inline functions */ /*! Constructs a statistical box which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. The created QCPStatisticalBox is automatically registered with the QCustomPlot instance inferred from \a keyAxis. This QCustomPlot instance takes ownership of the QCPStatisticalBox, so do not delete it manually but use QCustomPlot::removePlottable() instead. */ QCPStatisticalBox::QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable1D(keyAxis, valueAxis), mWidth(0.5), mWhiskerWidth(0.2), mWhiskerPen(Qt::black, 0, Qt::DashLine, Qt::FlatCap), mWhiskerBarPen(Qt::black), mWhiskerAntialiased(false), mMedianPen(Qt::black, 3, Qt::SolidLine, Qt::FlatCap), mOutlierStyle(QCPScatterStyle::ssCircle, Qt::blue, 6) { setPen(QPen(Qt::black)); setBrush(Qt::NoBrush); } /*! \overload Replaces the current data container with the provided \a data container. Since a QSharedPointer is used, multiple QCPStatisticalBoxes may share the same data container safely. Modifying the data in the container will then affect all statistical boxes that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpstatisticalbox-datasharing-1 If you do not wish to share containers, but create a copy from an existing container, rather use the \ref QCPDataContainer::set method on the statistical box data container directly: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpstatisticalbox-datasharing-2 \see addData */ void QCPStatisticalBox::setData(QSharedPointer data) { mDataContainer = data; } /*! \overload Replaces the current data with the provided points in \a keys, \a minimum, \a lowerQuartile, \a median, \a upperQuartile and \a maximum. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. \see addData */ void QCPStatisticalBox::setData(const QVector &keys, const QVector &minimum, const QVector &lowerQuartile, const QVector &median, const QVector &upperQuartile, const QVector &maximum, bool alreadySorted) { mDataContainer->clear(); addData(keys, minimum, lowerQuartile, median, upperQuartile, maximum, alreadySorted); } /*! Sets the width of the boxes in key coordinates. \see setWhiskerWidth */ void QCPStatisticalBox::setWidth(double width) { mWidth = width; } /*! Sets the width of the whiskers in key coordinates. Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum. \see setWidth */ void QCPStatisticalBox::setWhiskerWidth(double width) { mWhiskerWidth = width; } /*! Sets the pen used for drawing the whisker backbone. Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum. Make sure to set the \c capStyle of the passed \a pen to \c Qt::FlatCap. Otherwise the backbone line might exceed the whisker bars by a few pixels due to the pen cap being not perfectly flat. \see setWhiskerBarPen */ void QCPStatisticalBox::setWhiskerPen(const QPen &pen) { mWhiskerPen = pen; } /*! Sets the pen used for drawing the whisker bars. Those are the lines parallel to the key axis at each end of the whisker backbone. Whiskers are the lines which reach from the upper quartile to the maximum, and from the lower quartile to the minimum. \see setWhiskerPen */ void QCPStatisticalBox::setWhiskerBarPen(const QPen &pen) { mWhiskerBarPen = pen; } /*! Sets whether the statistical boxes whiskers are drawn with antialiasing or not. Note that antialiasing settings may be overridden by QCustomPlot::setAntialiasedElements and QCustomPlot::setNotAntialiasedElements. */ void QCPStatisticalBox::setWhiskerAntialiased(bool enabled) { mWhiskerAntialiased = enabled; } /*! Sets the pen used for drawing the median indicator line inside the statistical boxes. */ void QCPStatisticalBox::setMedianPen(const QPen &pen) { mMedianPen = pen; } /*! Sets the appearance of the outlier data points. Outliers can be specified with the method \ref addData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector &outliers) */ void QCPStatisticalBox::setOutlierStyle(const QCPScatterStyle &style) { mOutlierStyle = style; } /*! \overload Adds the provided points in \a keys, \a minimum, \a lowerQuartile, \a median, \a upperQuartile and \a maximum to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPStatisticalBox::addData(const QVector &keys, const QVector &minimum, const QVector &lowerQuartile, const QVector &median, const QVector &upperQuartile, const QVector &maximum, bool alreadySorted) { if (keys.size() != minimum.size() || minimum.size() != lowerQuartile.size() || lowerQuartile.size() != median.size() || median.size() != upperQuartile.size() || upperQuartile.size() != maximum.size() || maximum.size() != keys.size()) qDebug() << Q_FUNC_INFO << "keys, minimum, lowerQuartile, median, upperQuartile, maximum have different sizes:" << keys.size() << minimum.size() << lowerQuartile.size() << median.size() << upperQuartile.size() << maximum.size(); const int n = qMin(keys.size(), qMin(minimum.size(), qMin(lowerQuartile.size(), qMin(median.size(), qMin(upperQuartile.size(), maximum.size()))))); QVector tempData(n); QVector::iterator it = tempData.begin(); const QVector::iterator itEnd = tempData.end(); int i = 0; while (it != itEnd) { it->key = keys[i]; it->minimum = minimum[i]; it->lowerQuartile = lowerQuartile[i]; it->median = median[i]; it->upperQuartile = upperQuartile[i]; it->maximum = maximum[i]; ++it; ++i; } mDataContainer->add(tempData, alreadySorted); // don't modify tempData beyond this to prevent copy on write } /*! \overload Adds the provided data point as \a key, \a minimum, \a lowerQuartile, \a median, \a upperQuartile and \a maximum to the current data. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. */ void QCPStatisticalBox::addData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector &outliers) { mDataContainer->add(QCPStatisticalBoxData(key, minimum, lowerQuartile, median, upperQuartile, maximum, outliers)); } /*! \copydoc QCPPlottableInterface1D::selectTestRect */ QCPDataSelection QCPStatisticalBox::selectTestRect(const QRectF &rect, bool onlySelectable) const { QCPDataSelection result; if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return result; if (!mKeyAxis || !mValueAxis) return result; QCPStatisticalBoxDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd); for (QCPStatisticalBoxDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) { if (rect.intersects(getQuartileBox(it))) result.addDataRange(QCPDataRange(it-mDataContainer->constBegin(), it-mDataContainer->constBegin()+1), false); } result.simplify(); return result; } /* inherits documentation from base class */ double QCPStatisticalBox::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; if (mKeyAxis->axisRect()->rect().contains(pos.toPoint())) { // get visible data range: QCPStatisticalBoxDataContainer::const_iterator visibleBegin, visibleEnd; QCPStatisticalBoxDataContainer::const_iterator closestDataPoint = mDataContainer->constEnd(); getVisibleDataBounds(visibleBegin, visibleEnd); double minDistSqr = std::numeric_limits::max(); for (QCPStatisticalBoxDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) { if (getQuartileBox(it).contains(pos)) // quartile box { double currentDistSqr = mParentPlot->selectionTolerance()*0.99 * mParentPlot->selectionTolerance()*0.99; if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; closestDataPoint = it; } } else // whiskers { const QVector whiskerBackbones(getWhiskerBackboneLines(it)); for (int i=0; iconstBegin(); details->setValue(QCPDataSelection(QCPDataRange(pointIndex, pointIndex+1))); } return qSqrt(minDistSqr); } return -1; } /* inherits documentation from base class */ QCPRange QCPStatisticalBox::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const { QCPRange range = mDataContainer->keyRange(foundRange, inSignDomain); // determine exact range by including width of bars/flags: if (foundRange) { if (inSignDomain != QCP::sdPositive || range.lower-mWidth*0.5 > 0) range.lower -= mWidth*0.5; if (inSignDomain != QCP::sdNegative || range.upper+mWidth*0.5 < 0) range.upper += mWidth*0.5; } return range; } /* inherits documentation from base class */ QCPRange QCPStatisticalBox::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const { return mDataContainer->valueRange(foundRange, inSignDomain, inKeyRange); } /* inherits documentation from base class */ void QCPStatisticalBox::draw(QCPPainter *painter) { if (mDataContainer->isEmpty()) return; QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } QCPStatisticalBoxDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd); // loop over and draw segments of unselected/selected data: QList selectedSegments, unselectedSegments, allSegments; getDataSegments(selectedSegments, unselectedSegments); allSegments << unselectedSegments << selectedSegments; for (int i=0; i= unselectedSegments.size(); QCPStatisticalBoxDataContainer::const_iterator begin = visibleBegin; QCPStatisticalBoxDataContainer::const_iterator end = visibleEnd; mDataContainer->limitIteratorsToDataRange(begin, end, allSegments.at(i)); if (begin == end) continue; for (QCPStatisticalBoxDataContainer::const_iterator it=begin; it!=end; ++it) { // check data validity if flag set: # ifdef QCUSTOMPLOT_CHECK_DATA if (QCP::isInvalidData(it->key, it->minimum) || QCP::isInvalidData(it->lowerQuartile, it->median) || QCP::isInvalidData(it->upperQuartile, it->maximum)) qDebug() << Q_FUNC_INFO << "Data point at" << it->key << "of drawn range has invalid data." << "Plottable name:" << name(); for (int i=0; ioutliers.size(); ++i) if (QCP::isInvalidData(it->outliers.at(i))) qDebug() << Q_FUNC_INFO << "Data point outlier at" << it->key << "of drawn range invalid." << "Plottable name:" << name(); # endif if (isSelectedSegment && mSelectionDecorator) { mSelectionDecorator->applyPen(painter); mSelectionDecorator->applyBrush(painter); } else { painter->setPen(mPen); painter->setBrush(mBrush); } QCPScatterStyle finalOutlierStyle = mOutlierStyle; if (isSelectedSegment && mSelectionDecorator) finalOutlierStyle = mSelectionDecorator->getFinalScatterStyle(mOutlierStyle); drawStatisticalBox(painter, it, finalOutlierStyle); } } // draw other selection decoration that isn't just line/scatter pens and brushes: if (mSelectionDecorator) mSelectionDecorator->drawDecoration(painter, selection()); } /* inherits documentation from base class */ void QCPStatisticalBox::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const { // draw filled rect: applyDefaultAntialiasingHint(painter); painter->setPen(mPen); painter->setBrush(mBrush); QRectF r = QRectF(0, 0, rect.width()*0.67, rect.height()*0.67); r.moveCenter(rect.center()); painter->drawRect(r); } /*! Draws the graphical representation of a single statistical box with the data given by the iterator \a it with the provided \a painter. If the statistical box has a set of outlier data points, they are drawn with \a outlierStyle. \see getQuartileBox, getWhiskerBackboneLines, getWhiskerBarLines */ void QCPStatisticalBox::drawStatisticalBox(QCPPainter *painter, QCPStatisticalBoxDataContainer::const_iterator it, const QCPScatterStyle &outlierStyle) const { // draw quartile box: applyDefaultAntialiasingHint(painter); const QRectF quartileBox = getQuartileBox(it); painter->drawRect(quartileBox); // draw median line with cliprect set to quartile box: painter->save(); painter->setClipRect(quartileBox, Qt::IntersectClip); painter->setPen(mMedianPen); painter->drawLine(QLineF(coordsToPixels(it->key-mWidth*0.5, it->median), coordsToPixels(it->key+mWidth*0.5, it->median))); painter->restore(); // draw whisker lines: applyAntialiasingHint(painter, mWhiskerAntialiased, QCP::aePlottables); painter->setPen(mWhiskerPen); painter->drawLines(getWhiskerBackboneLines(it)); painter->setPen(mWhiskerBarPen); painter->drawLines(getWhiskerBarLines(it)); // draw outliers: applyScattersAntialiasingHint(painter); outlierStyle.applyTo(painter, mPen); for (int i=0; ioutliers.size(); ++i) outlierStyle.drawShape(painter, coordsToPixels(it->key, it->outliers.at(i))); } /*! \internal called by \ref draw to determine which data (key) range is visible at the current key axis range setting, so only that needs to be processed. It also takes into account the bar width. \a begin returns an iterator to the lowest data point that needs to be taken into account when plotting. Note that in order to get a clean plot all the way to the edge of the axis rect, \a lower may still be just outside the visible range. \a end returns an iterator one higher than the highest visible data point. Same as before, \a end may also lie just outside of the visible range. if the plottable contains no data, both \a begin and \a end point to constEnd. */ void QCPStatisticalBox::getVisibleDataBounds(QCPStatisticalBoxDataContainer::const_iterator &begin, QCPStatisticalBoxDataContainer::const_iterator &end) const { if (!mKeyAxis) { qDebug() << Q_FUNC_INFO << "invalid key axis"; begin = mDataContainer->constEnd(); end = mDataContainer->constEnd(); return; } begin = mDataContainer->findBegin(mKeyAxis.data()->range().lower-mWidth*0.5); // subtract half width of box to include partially visible data points end = mDataContainer->findEnd(mKeyAxis.data()->range().upper+mWidth*0.5); // add half width of box to include partially visible data points } /*! \internal Returns the box in plot coordinates (keys in x, values in y of the returned rect) that covers the value range from the lower to the upper quartile, of the data given by \a it. \see drawStatisticalBox, getWhiskerBackboneLines, getWhiskerBarLines */ QRectF QCPStatisticalBox::getQuartileBox(QCPStatisticalBoxDataContainer::const_iterator it) const { QRectF result; result.setTopLeft(coordsToPixels(it->key-mWidth*0.5, it->upperQuartile)); result.setBottomRight(coordsToPixels(it->key+mWidth*0.5, it->lowerQuartile)); return result; } /*! \internal Returns the whisker backbones (keys in x, values in y of the returned lines) that cover the value range from the minimum to the lower quartile, and from the upper quartile to the maximum of the data given by \a it. \see drawStatisticalBox, getQuartileBox, getWhiskerBarLines */ QVector QCPStatisticalBox::getWhiskerBackboneLines(QCPStatisticalBoxDataContainer::const_iterator it) const { QVector result(2); result[0].setPoints(coordsToPixels(it->key, it->lowerQuartile), coordsToPixels(it->key, it->minimum)); // min backbone result[1].setPoints(coordsToPixels(it->key, it->upperQuartile), coordsToPixels(it->key, it->maximum)); // max backbone return result; } /*! \internal Returns the whisker bars (keys in x, values in y of the returned lines) that are placed at the end of the whisker backbones, at the minimum and maximum of the data given by \a it. \see drawStatisticalBox, getQuartileBox, getWhiskerBackboneLines */ QVector QCPStatisticalBox::getWhiskerBarLines(QCPStatisticalBoxDataContainer::const_iterator it) const { QVector result(2); result[0].setPoints(coordsToPixels(it->key-mWhiskerWidth*0.5, it->minimum), coordsToPixels(it->key+mWhiskerWidth*0.5, it->minimum)); // min bar result[1].setPoints(coordsToPixels(it->key-mWhiskerWidth*0.5, it->maximum), coordsToPixels(it->key+mWhiskerWidth*0.5, it->maximum)); // max bar return result; } /* end of 'src/plottables/plottable-statisticalbox.cpp' */ /* including file 'src/plottables/plottable-colormap.cpp', size 47531 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPColorMapData //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPColorMapData \brief Holds the two-dimensional data of a QCPColorMap plottable. This class is a data storage for \ref QCPColorMap. It holds a two-dimensional array, which \ref QCPColorMap then displays as a 2D image in the plot, where the array values are represented by a color, depending on the value. The size of the array can be controlled via \ref setSize (or \ref setKeySize, \ref setValueSize). Which plot coordinates these cells correspond to can be configured with \ref setRange (or \ref setKeyRange, \ref setValueRange). The data cells can be accessed in two ways: They can be directly addressed by an integer index with \ref setCell. This is the fastest method. Alternatively, they can be addressed by their plot coordinate with \ref setData. plot coordinate to cell index transformations and vice versa are provided by the functions \ref coordToCell and \ref cellToCoord. A \ref QCPColorMapData also holds an on-demand two-dimensional array of alpha values which (if allocated) has the same size as the data map. It can be accessed via \ref setAlpha, \ref fillAlpha and \ref clearAlpha. The memory for the alpha map is only allocated if needed, i.e. on the first call of \ref setAlpha. \ref clearAlpha restores full opacity and frees the alpha map. This class also buffers the minimum and maximum values that are in the data set, to provide QCPColorMap::rescaleDataRange with the necessary information quickly. Setting a cell to a value that is greater than the current maximum increases this maximum to the new value. However, setting the cell that currently holds the maximum value to a smaller value doesn't decrease the maximum again, because finding the true new maximum would require going through the entire data array, which might be time consuming. The same holds for the data minimum. This functionality is given by \ref recalculateDataBounds, such that you can decide when it is sensible to find the true current minimum and maximum. The method QCPColorMap::rescaleDataRange offers a convenience parameter \a recalculateDataBounds which may be set to true to automatically call \ref recalculateDataBounds internally. */ /* start of documentation of inline functions */ /*! \fn bool QCPColorMapData::isEmpty() const Returns whether this instance carries no data. This is equivalent to having a size where at least one of the dimensions is 0 (see \ref setSize). */ /* end of documentation of inline functions */ /*! Constructs a new QCPColorMapData instance. The instance has \a keySize cells in the key direction and \a valueSize cells in the value direction. These cells will be displayed by the \ref QCPColorMap at the coordinates \a keyRange and \a valueRange. \see setSize, setKeySize, setValueSize, setRange, setKeyRange, setValueRange */ QCPColorMapData::QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange) : mKeySize(0), mValueSize(0), mKeyRange(keyRange), mValueRange(valueRange), mIsEmpty(true), mData(0), mAlpha(0), mDataModified(true) { setSize(keySize, valueSize); fill(0); } QCPColorMapData::~QCPColorMapData() { if (mData) delete[] mData; if (mAlpha) delete[] mAlpha; } /*! Constructs a new QCPColorMapData instance copying the data and range of \a other. */ QCPColorMapData::QCPColorMapData(const QCPColorMapData &other) : mKeySize(0), mValueSize(0), mIsEmpty(true), mData(0), mAlpha(0), mDataModified(true) { *this = other; } /*! Overwrites this color map data instance with the data stored in \a other. The alpha map state is transferred, too. */ QCPColorMapData &QCPColorMapData::operator=(const QCPColorMapData &other) { if (&other != this) { const int keySize = other.keySize(); const int valueSize = other.valueSize(); if (!other.mAlpha && mAlpha) clearAlpha(); setSize(keySize, valueSize); if (other.mAlpha && !mAlpha) createAlpha(false); setRange(other.keyRange(), other.valueRange()); if (!isEmpty()) { memcpy(mData, other.mData, sizeof(mData[0])*keySize*valueSize); if (mAlpha) memcpy(mAlpha, other.mAlpha, sizeof(mAlpha[0])*keySize*valueSize); } mDataBounds = other.mDataBounds; mDataModified = true; } return *this; } /* undocumented getter */ double QCPColorMapData::data(double key, double value) { int keyCell = (key-mKeyRange.lower)/(mKeyRange.upper-mKeyRange.lower)*(mKeySize-1)+0.5; int valueCell = (value-mValueRange.lower)/(mValueRange.upper-mValueRange.lower)*(mValueSize-1)+0.5; if (keyCell >= 0 && keyCell < mKeySize && valueCell >= 0 && valueCell < mValueSize) return mData[valueCell*mKeySize + keyCell]; else return 0; } /* undocumented getter */ double QCPColorMapData::cell(int keyIndex, int valueIndex) { if (keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex < mValueSize) return mData[valueIndex*mKeySize + keyIndex]; else return 0; } /*! Returns the alpha map value of the cell with the indices \a keyIndex and \a valueIndex. If this color map data doesn't have an alpha map (because \ref setAlpha was never called after creation or after a call to \ref clearAlpha), returns 255, which corresponds to full opacity. \see setAlpha */ unsigned char QCPColorMapData::alpha(int keyIndex, int valueIndex) { if (mAlpha && keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex < mValueSize) return mAlpha[valueIndex*mKeySize + keyIndex]; else return 255; } /*! Resizes the data array to have \a keySize cells in the key dimension and \a valueSize cells in the value dimension. The current data is discarded and the map cells are set to 0, unless the map had already the requested size. Setting at least one of \a keySize or \a valueSize to zero frees the internal data array and \ref isEmpty returns true. \see setRange, setKeySize, setValueSize */ void QCPColorMapData::setSize(int keySize, int valueSize) { if (keySize != mKeySize || valueSize != mValueSize) { mKeySize = keySize; mValueSize = valueSize; if (mData) delete[] mData; mIsEmpty = mKeySize == 0 || mValueSize == 0; if (!mIsEmpty) { #ifdef __EXCEPTIONS try { // 2D arrays get memory intensive fast. So if the allocation fails, at least output debug message #endif mData = new double[mKeySize*mValueSize]; #ifdef __EXCEPTIONS } catch (...) { mData = 0; } #endif if (mData) fill(0); else qDebug() << Q_FUNC_INFO << "out of memory for data dimensions "<< mKeySize << "*" << mValueSize; } else mData = 0; if (mAlpha) // if we had an alpha map, recreate it with new size createAlpha(); mDataModified = true; } } /*! Resizes the data array to have \a keySize cells in the key dimension. The current data is discarded and the map cells are set to 0, unless the map had already the requested size. Setting \a keySize to zero frees the internal data array and \ref isEmpty returns true. \see setKeyRange, setSize, setValueSize */ void QCPColorMapData::setKeySize(int keySize) { setSize(keySize, mValueSize); } /*! Resizes the data array to have \a valueSize cells in the value dimension. The current data is discarded and the map cells are set to 0, unless the map had already the requested size. Setting \a valueSize to zero frees the internal data array and \ref isEmpty returns true. \see setValueRange, setSize, setKeySize */ void QCPColorMapData::setValueSize(int valueSize) { setSize(mKeySize, valueSize); } /*! Sets the coordinate ranges the data shall be distributed over. This defines the rectangular area covered by the color map in plot coordinates. The outer cells will be centered on the range boundaries given to this function. For example, if the key size (\ref setKeySize) is 3 and \a keyRange is set to QCPRange(2, 3) there will be cells centered on the key coordinates 2, 2.5 and 3. \see setSize */ void QCPColorMapData::setRange(const QCPRange &keyRange, const QCPRange &valueRange) { setKeyRange(keyRange); setValueRange(valueRange); } /*! Sets the coordinate range the data shall be distributed over in the key dimension. Together with the value range, This defines the rectangular area covered by the color map in plot coordinates. The outer cells will be centered on the range boundaries given to this function. For example, if the key size (\ref setKeySize) is 3 and \a keyRange is set to QCPRange(2, 3) there will be cells centered on the key coordinates 2, 2.5 and 3. \see setRange, setValueRange, setSize */ void QCPColorMapData::setKeyRange(const QCPRange &keyRange) { mKeyRange = keyRange; } /*! Sets the coordinate range the data shall be distributed over in the value dimension. Together with the key range, This defines the rectangular area covered by the color map in plot coordinates. The outer cells will be centered on the range boundaries given to this function. For example, if the value size (\ref setValueSize) is 3 and \a valueRange is set to QCPRange(2, 3) there will be cells centered on the value coordinates 2, 2.5 and 3. \see setRange, setKeyRange, setSize */ void QCPColorMapData::setValueRange(const QCPRange &valueRange) { mValueRange = valueRange; } /*! Sets the data of the cell, which lies at the plot coordinates given by \a key and \a value, to \a z. \note The QCPColorMap always displays the data at equal key/value intervals, even if the key or value axis is set to a logarithmic scaling. If you want to use QCPColorMap with logarithmic axes, you shouldn't use the \ref QCPColorMapData::setData method as it uses a linear transformation to determine the cell index. Rather directly access the cell index with \ref QCPColorMapData::setCell. \see setCell, setRange */ void QCPColorMapData::setData(double key, double value, double z) { int keyCell = (key-mKeyRange.lower)/(mKeyRange.upper-mKeyRange.lower)*(mKeySize-1)+0.5; int valueCell = (value-mValueRange.lower)/(mValueRange.upper-mValueRange.lower)*(mValueSize-1)+0.5; if (keyCell >= 0 && keyCell < mKeySize && valueCell >= 0 && valueCell < mValueSize) { mData[valueCell*mKeySize + keyCell] = z; if (z < mDataBounds.lower) mDataBounds.lower = z; if (z > mDataBounds.upper) mDataBounds.upper = z; mDataModified = true; } } /*! Sets the data of the cell with indices \a keyIndex and \a valueIndex to \a z. The indices enumerate the cells starting from zero, up to the map's size-1 in the respective dimension (see \ref setSize). In the standard plot configuration (horizontal key axis and vertical value axis, both not range-reversed), the cell with indices (0, 0) is in the bottom left corner and the cell with indices (keySize-1, valueSize-1) is in the top right corner of the color map. \see setData, setSize */ void QCPColorMapData::setCell(int keyIndex, int valueIndex, double z) { if (keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex < mValueSize) { mData[valueIndex*mKeySize + keyIndex] = z; if (z < mDataBounds.lower) mDataBounds.lower = z; if (z > mDataBounds.upper) mDataBounds.upper = z; mDataModified = true; } else qDebug() << Q_FUNC_INFO << "index out of bounds:" << keyIndex << valueIndex; } /*! Sets the alpha of the color map cell given by \a keyIndex and \a valueIndex to \a alpha. A value of 0 for \a alpha results in a fully transparent cell, and a value of 255 results in a fully opaque cell. If an alpha map doesn't exist yet for this color map data, it will be created here. If you wish to restore full opacity and free any allocated memory of the alpha map, call \ref clearAlpha. Note that the cell-wise alpha which can be configured here is independent of any alpha configured in the color map's gradient (\ref QCPColorGradient). If a cell is affected both by the cell-wise and gradient alpha, the alpha values will be blended accordingly during rendering of the color map. \see fillAlpha, clearAlpha */ void QCPColorMapData::setAlpha(int keyIndex, int valueIndex, unsigned char alpha) { if (keyIndex >= 0 && keyIndex < mKeySize && valueIndex >= 0 && valueIndex < mValueSize) { if (mAlpha || createAlpha()) { mAlpha[valueIndex*mKeySize + keyIndex] = alpha; mDataModified = true; } } else qDebug() << Q_FUNC_INFO << "index out of bounds:" << keyIndex << valueIndex; } /*! Goes through the data and updates the buffered minimum and maximum data values. Calling this method is only advised if you are about to call \ref QCPColorMap::rescaleDataRange and can not guarantee that the cells holding the maximum or minimum data haven't been overwritten with a smaller or larger value respectively, since the buffered maximum/minimum values have been updated the last time. Why this is the case is explained in the class description (\ref QCPColorMapData). Note that the method \ref QCPColorMap::rescaleDataRange provides a parameter \a recalculateDataBounds for convenience. Setting this to true will call this method for you, before doing the rescale. */ void QCPColorMapData::recalculateDataBounds() { if (mKeySize > 0 && mValueSize > 0) { double minHeight = mData[0]; double maxHeight = mData[0]; const int dataCount = mValueSize*mKeySize; for (int i=0; i maxHeight) maxHeight = mData[i]; if (mData[i] < minHeight) minHeight = mData[i]; } mDataBounds.lower = minHeight; mDataBounds.upper = maxHeight; } } /*! Frees the internal data memory. This is equivalent to calling \ref setSize "setSize(0, 0)". */ void QCPColorMapData::clear() { setSize(0, 0); } /*! Frees the internal alpha map. The color map will have full opacity again. */ void QCPColorMapData::clearAlpha() { if (mAlpha) { delete[] mAlpha; mAlpha = 0; mDataModified = true; } } /*! Sets all cells to the value \a z. */ void QCPColorMapData::fill(double z) { const int dataCount = mValueSize*mKeySize; for (int i=0; i(data); return; } if (copy) { *mMapData = *data; } else { delete mMapData; mMapData = data; } mMapImageInvalidated = true; } /*! Sets the data range of this color map to \a dataRange. The data range defines which data values are mapped to the color gradient. To make the data range span the full range of the data set, use \ref rescaleDataRange. \see QCPColorScale::setDataRange */ void QCPColorMap::setDataRange(const QCPRange &dataRange) { if (!QCPRange::validRange(dataRange)) return; if (mDataRange.lower != dataRange.lower || mDataRange.upper != dataRange.upper) { if (mDataScaleType == QCPAxis::stLogarithmic) mDataRange = dataRange.sanitizedForLogScale(); else mDataRange = dataRange.sanitizedForLinScale(); mMapImageInvalidated = true; emit dataRangeChanged(mDataRange); } } /*! Sets whether the data is correlated with the color gradient linearly or logarithmically. \see QCPColorScale::setDataScaleType */ void QCPColorMap::setDataScaleType(QCPAxis::ScaleType scaleType) { if (mDataScaleType != scaleType) { mDataScaleType = scaleType; mMapImageInvalidated = true; emit dataScaleTypeChanged(mDataScaleType); if (mDataScaleType == QCPAxis::stLogarithmic) setDataRange(mDataRange.sanitizedForLogScale()); } } /*! Sets the color gradient that is used to represent the data. For more details on how to create an own gradient or use one of the preset gradients, see \ref QCPColorGradient. The colors defined by the gradient will be used to represent data values in the currently set data range, see \ref setDataRange. Data points that are outside this data range will either be colored uniformly with the respective gradient boundary color, or the gradient will repeat, depending on \ref QCPColorGradient::setPeriodic. \see QCPColorScale::setGradient */ void QCPColorMap::setGradient(const QCPColorGradient &gradient) { if (mGradient != gradient) { mGradient = gradient; mMapImageInvalidated = true; emit gradientChanged(mGradient); } } /*! Sets whether the color map image shall use bicubic interpolation when displaying the color map shrinked or expanded, and not at a 1:1 pixel-to-data scale. \image html QCPColorMap-interpolate.png "A 10*10 color map, with interpolation and without interpolation enabled" */ void QCPColorMap::setInterpolate(bool enabled) { mInterpolate = enabled; mMapImageInvalidated = true; // because oversampling factors might need to change } /*! Sets whether the outer most data rows and columns are clipped to the specified key and value range (see \ref QCPColorMapData::setKeyRange, \ref QCPColorMapData::setValueRange). if \a enabled is set to false, the data points at the border of the color map are drawn with the same width and height as all other data points. Since the data points are represented by rectangles of one color centered on the data coordinate, this means that the shown color map extends by half a data point over the specified key/value range in each direction. \image html QCPColorMap-tightboundary.png "A color map, with tight boundary enabled and disabled" */ void QCPColorMap::setTightBoundary(bool enabled) { mTightBoundary = enabled; } /*! Associates the color scale \a colorScale with this color map. This means that both the color scale and the color map synchronize their gradient, data range and data scale type (\ref setGradient, \ref setDataRange, \ref setDataScaleType). Multiple color maps can be associated with one single color scale. This causes the color maps to also synchronize those properties, via the mutual color scale. This function causes the color map to adopt the current color gradient, data range and data scale type of \a colorScale. After this call, you may change these properties at either the color map or the color scale, and the setting will be applied to both. Pass 0 as \a colorScale to disconnect the color scale from this color map again. */ void QCPColorMap::setColorScale(QCPColorScale *colorScale) { if (mColorScale) // unconnect signals from old color scale { disconnect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange))); disconnect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType))); disconnect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient))); disconnect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange))); disconnect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient))); disconnect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType))); } mColorScale = colorScale; if (mColorScale) // connect signals to new color scale { setGradient(mColorScale.data()->gradient()); setDataRange(mColorScale.data()->dataRange()); setDataScaleType(mColorScale.data()->dataScaleType()); connect(this, SIGNAL(dataRangeChanged(QCPRange)), mColorScale.data(), SLOT(setDataRange(QCPRange))); connect(this, SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), mColorScale.data(), SLOT(setDataScaleType(QCPAxis::ScaleType))); connect(this, SIGNAL(gradientChanged(QCPColorGradient)), mColorScale.data(), SLOT(setGradient(QCPColorGradient))); connect(mColorScale.data(), SIGNAL(dataRangeChanged(QCPRange)), this, SLOT(setDataRange(QCPRange))); connect(mColorScale.data(), SIGNAL(gradientChanged(QCPColorGradient)), this, SLOT(setGradient(QCPColorGradient))); connect(mColorScale.data(), SIGNAL(dataScaleTypeChanged(QCPAxis::ScaleType)), this, SLOT(setDataScaleType(QCPAxis::ScaleType))); } } /*! Sets the data range (\ref setDataRange) to span the minimum and maximum values that occur in the current data set. This corresponds to the \ref rescaleKeyAxis or \ref rescaleValueAxis methods, only for the third data dimension of the color map. The minimum and maximum values of the data set are buffered in the internal QCPColorMapData instance (\ref data). As data is updated via its \ref QCPColorMapData::setCell or \ref QCPColorMapData::setData, the buffered minimum and maximum values are updated, too. For performance reasons, however, they are only updated in an expanding fashion. So the buffered maximum can only increase and the buffered minimum can only decrease. In consequence, changes to the data that actually lower the maximum of the data set (by overwriting the cell holding the current maximum with a smaller value), aren't recognized and the buffered maximum overestimates the true maximum of the data set. The same happens for the buffered minimum. To recalculate the true minimum and maximum by explicitly looking at each cell, the method QCPColorMapData::recalculateDataBounds can be used. For convenience, setting the parameter \a recalculateDataBounds calls this method before setting the data range to the buffered minimum and maximum. \see setDataRange */ void QCPColorMap::rescaleDataRange(bool recalculateDataBounds) { if (recalculateDataBounds) mMapData->recalculateDataBounds(); setDataRange(mMapData->dataBounds()); } /*! Takes the current appearance of the color map and updates the legend icon, which is used to represent this color map in the legend (see \ref QCPLegend). The \a transformMode specifies whether the rescaling is done by a faster, low quality image scaling algorithm (Qt::FastTransformation) or by a slower, higher quality algorithm (Qt::SmoothTransformation). The current color map appearance is scaled down to \a thumbSize. Ideally, this should be equal to the size of the legend icon (see \ref QCPLegend::setIconSize). If it isn't exactly the configured legend icon size, the thumb will be rescaled during drawing of the legend item. \see setDataRange */ void QCPColorMap::updateLegendIcon(Qt::TransformationMode transformMode, const QSize &thumbSize) { if (mMapImage.isNull() && !data()->isEmpty()) updateMapImage(); // try to update map image if it's null (happens if no draw has happened yet) if (!mMapImage.isNull()) // might still be null, e.g. if data is empty, so check here again { bool mirrorX = (keyAxis()->orientation() == Qt::Horizontal ? keyAxis() : valueAxis())->rangeReversed(); bool mirrorY = (valueAxis()->orientation() == Qt::Vertical ? valueAxis() : keyAxis())->rangeReversed(); mLegendIcon = QPixmap::fromImage(mMapImage.mirrored(mirrorX, mirrorY)).scaled(thumbSize, Qt::KeepAspectRatio, transformMode); } } /* inherits documentation from base class */ double QCPColorMap::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if ((onlySelectable && mSelectable == QCP::stNone) || mMapData->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint())) { double posKey, posValue; pixelsToCoords(pos, posKey, posValue); if (mMapData->keyRange().contains(posKey) && mMapData->valueRange().contains(posValue)) { if (details) details->setValue(QCPDataSelection(QCPDataRange(0, 1))); // temporary solution, to facilitate whole-plottable selection. Replace in future version with segmented 2D selection. return mParentPlot->selectionTolerance()*0.99; } } return -1; } /* inherits documentation from base class */ QCPRange QCPColorMap::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const { foundRange = true; QCPRange result = mMapData->keyRange(); result.normalize(); if (inSignDomain == QCP::sdPositive) { if (result.lower <= 0 && result.upper > 0) result.lower = result.upper*1e-3; else if (result.lower <= 0 && result.upper <= 0) foundRange = false; } else if (inSignDomain == QCP::sdNegative) { if (result.upper >= 0 && result.lower < 0) result.upper = result.lower*1e-3; else if (result.upper >= 0 && result.lower >= 0) foundRange = false; } return result; } /* inherits documentation from base class */ QCPRange QCPColorMap::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const { if (inKeyRange != QCPRange()) { if (mMapData->keyRange().upper < inKeyRange.lower || mMapData->keyRange().lower > inKeyRange.upper) { foundRange = false; return QCPRange(); } } foundRange = true; QCPRange result = mMapData->valueRange(); result.normalize(); if (inSignDomain == QCP::sdPositive) { if (result.lower <= 0 && result.upper > 0) result.lower = result.upper*1e-3; else if (result.lower <= 0 && result.upper <= 0) foundRange = false; } else if (inSignDomain == QCP::sdNegative) { if (result.upper >= 0 && result.lower < 0) result.upper = result.lower*1e-3; else if (result.upper >= 0 && result.lower >= 0) foundRange = false; } return result; } /*! \internal Updates the internal map image buffer by going through the internal \ref QCPColorMapData and turning the data values into color pixels with \ref QCPColorGradient::colorize. This method is called by \ref QCPColorMap::draw if either the data has been modified or the map image has been invalidated for a different reason (e.g. a change of the data range with \ref setDataRange). If the map cell count is low, the image created will be oversampled in order to avoid a QPainter::drawImage bug which makes inner pixel boundaries jitter when stretch-drawing images without smooth transform enabled. Accordingly, oversampling isn't performed if \ref setInterpolate is true. */ void QCPColorMap::updateMapImage() { QCPAxis *keyAxis = mKeyAxis.data(); if (!keyAxis) return; if (mMapData->isEmpty()) return; const QImage::Format format = QImage::Format_ARGB32_Premultiplied; const int keySize = mMapData->keySize(); const int valueSize = mMapData->valueSize(); int keyOversamplingFactor = mInterpolate ? 1 : (int)(1.0+100.0/(double)keySize); // make mMapImage have at least size 100, factor becomes 1 if size > 200 or interpolation is on int valueOversamplingFactor = mInterpolate ? 1 : (int)(1.0+100.0/(double)valueSize); // make mMapImage have at least size 100, factor becomes 1 if size > 200 or interpolation is on // resize mMapImage to correct dimensions including possible oversampling factors, according to key/value axes orientation: if (keyAxis->orientation() == Qt::Horizontal && (mMapImage.width() != keySize*keyOversamplingFactor || mMapImage.height() != valueSize*valueOversamplingFactor)) mMapImage = QImage(QSize(keySize*keyOversamplingFactor, valueSize*valueOversamplingFactor), format); else if (keyAxis->orientation() == Qt::Vertical && (mMapImage.width() != valueSize*valueOversamplingFactor || mMapImage.height() != keySize*keyOversamplingFactor)) mMapImage = QImage(QSize(valueSize*valueOversamplingFactor, keySize*keyOversamplingFactor), format); QImage *localMapImage = &mMapImage; // this is the image on which the colorization operates. Either the final mMapImage, or if we need oversampling, mUndersampledMapImage if (keyOversamplingFactor > 1 || valueOversamplingFactor > 1) { // resize undersampled map image to actual key/value cell sizes: if (keyAxis->orientation() == Qt::Horizontal && (mUndersampledMapImage.width() != keySize || mUndersampledMapImage.height() != valueSize)) mUndersampledMapImage = QImage(QSize(keySize, valueSize), format); else if (keyAxis->orientation() == Qt::Vertical && (mUndersampledMapImage.width() != valueSize || mUndersampledMapImage.height() != keySize)) mUndersampledMapImage = QImage(QSize(valueSize, keySize), format); localMapImage = &mUndersampledMapImage; // make the colorization run on the undersampled image } else if (!mUndersampledMapImage.isNull()) mUndersampledMapImage = QImage(); // don't need oversampling mechanism anymore (map size has changed) but mUndersampledMapImage still has nonzero size, free it const double *rawData = mMapData->mData; const unsigned char *rawAlpha = mMapData->mAlpha; if (keyAxis->orientation() == Qt::Horizontal) { const int lineCount = valueSize; const int rowCount = keySize; for (int line=0; line(localMapImage->scanLine(lineCount-1-line)); // invert scanline index because QImage counts scanlines from top, but our vertical index counts from bottom (mathematical coordinate system) if (rawAlpha) mGradient.colorize(rawData+line*rowCount, rawAlpha+line*rowCount, mDataRange, pixels, rowCount, 1, mDataScaleType==QCPAxis::stLogarithmic); else mGradient.colorize(rawData+line*rowCount, mDataRange, pixels, rowCount, 1, mDataScaleType==QCPAxis::stLogarithmic); } } else // keyAxis->orientation() == Qt::Vertical { const int lineCount = keySize; const int rowCount = valueSize; for (int line=0; line(localMapImage->scanLine(lineCount-1-line)); // invert scanline index because QImage counts scanlines from top, but our vertical index counts from bottom (mathematical coordinate system) if (rawAlpha) mGradient.colorize(rawData+line, rawAlpha+line, mDataRange, pixels, rowCount, lineCount, mDataScaleType==QCPAxis::stLogarithmic); else mGradient.colorize(rawData+line, mDataRange, pixels, rowCount, lineCount, mDataScaleType==QCPAxis::stLogarithmic); } } if (keyOversamplingFactor > 1 || valueOversamplingFactor > 1) { if (keyAxis->orientation() == Qt::Horizontal) mMapImage = mUndersampledMapImage.scaled(keySize*keyOversamplingFactor, valueSize*valueOversamplingFactor, Qt::IgnoreAspectRatio, Qt::FastTransformation); else mMapImage = mUndersampledMapImage.scaled(valueSize*valueOversamplingFactor, keySize*keyOversamplingFactor, Qt::IgnoreAspectRatio, Qt::FastTransformation); } mMapData->mDataModified = false; mMapImageInvalidated = false; } /* inherits documentation from base class */ void QCPColorMap::draw(QCPPainter *painter) { if (mMapData->isEmpty()) return; if (!mKeyAxis || !mValueAxis) return; applyDefaultAntialiasingHint(painter); if (mMapData->mDataModified || mMapImageInvalidated) updateMapImage(); // use buffer if painting vectorized (PDF): const bool useBuffer = painter->modes().testFlag(QCPPainter::pmVectorized); QCPPainter *localPainter = painter; // will be redirected to paint on mapBuffer if painting vectorized QRectF mapBufferTarget; // the rect in absolute widget coordinates where the visible map portion/buffer will end up in QPixmap mapBuffer; if (useBuffer) { const double mapBufferPixelRatio = 3; // factor by which DPI is increased in embedded bitmaps mapBufferTarget = painter->clipRegion().boundingRect(); mapBuffer = QPixmap((mapBufferTarget.size()*mapBufferPixelRatio).toSize()); mapBuffer.fill(Qt::transparent); localPainter = new QCPPainter(&mapBuffer); localPainter->scale(mapBufferPixelRatio, mapBufferPixelRatio); localPainter->translate(-mapBufferTarget.topLeft()); } QRectF imageRect = QRectF(coordsToPixels(mMapData->keyRange().lower, mMapData->valueRange().lower), coordsToPixels(mMapData->keyRange().upper, mMapData->valueRange().upper)).normalized(); // extend imageRect to contain outer halves/quarters of bordering/cornering pixels (cells are centered on map range boundary): double halfCellWidth = 0; // in pixels double halfCellHeight = 0; // in pixels if (keyAxis()->orientation() == Qt::Horizontal) { if (mMapData->keySize() > 1) halfCellWidth = 0.5*imageRect.width()/(double)(mMapData->keySize()-1); if (mMapData->valueSize() > 1) halfCellHeight = 0.5*imageRect.height()/(double)(mMapData->valueSize()-1); } else // keyAxis orientation is Qt::Vertical { if (mMapData->keySize() > 1) halfCellHeight = 0.5*imageRect.height()/(double)(mMapData->keySize()-1); if (mMapData->valueSize() > 1) halfCellWidth = 0.5*imageRect.width()/(double)(mMapData->valueSize()-1); } imageRect.adjust(-halfCellWidth, -halfCellHeight, halfCellWidth, halfCellHeight); const bool mirrorX = (keyAxis()->orientation() == Qt::Horizontal ? keyAxis() : valueAxis())->rangeReversed(); const bool mirrorY = (valueAxis()->orientation() == Qt::Vertical ? valueAxis() : keyAxis())->rangeReversed(); const bool smoothBackup = localPainter->renderHints().testFlag(QPainter::SmoothPixmapTransform); localPainter->setRenderHint(QPainter::SmoothPixmapTransform, mInterpolate); QRegion clipBackup; if (mTightBoundary) { clipBackup = localPainter->clipRegion(); QRectF tightClipRect = QRectF(coordsToPixels(mMapData->keyRange().lower, mMapData->valueRange().lower), coordsToPixels(mMapData->keyRange().upper, mMapData->valueRange().upper)).normalized(); localPainter->setClipRect(tightClipRect, Qt::IntersectClip); } localPainter->drawImage(imageRect, mMapImage.mirrored(mirrorX, mirrorY)); if (mTightBoundary) localPainter->setClipRegion(clipBackup); localPainter->setRenderHint(QPainter::SmoothPixmapTransform, smoothBackup); if (useBuffer) // localPainter painted to mapBuffer, so now draw buffer with original painter { delete localPainter; painter->drawPixmap(mapBufferTarget.toRect(), mapBuffer); } } /* inherits documentation from base class */ void QCPColorMap::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const { applyDefaultAntialiasingHint(painter); // draw map thumbnail: if (!mLegendIcon.isNull()) { QPixmap scaledIcon = mLegendIcon.scaled(rect.size().toSize(), Qt::KeepAspectRatio, Qt::FastTransformation); QRectF iconRect = QRectF(0, 0, scaledIcon.width(), scaledIcon.height()); iconRect.moveCenter(rect.center()); painter->drawPixmap(iconRect.topLeft(), scaledIcon); } /* // draw frame: painter->setBrush(Qt::NoBrush); painter->setPen(Qt::black); painter->drawRect(rect.adjusted(1, 1, 0, 0)); */ } /* end of 'src/plottables/plottable-colormap.cpp' */ /* including file 'src/plottables/plottable-financial.cpp', size 42610 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPFinancialData //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPFinancialData \brief Holds the data of one single data point for QCPFinancial. The stored data is: \li \a key: coordinate on the key axis of this data point (this is the \a mainKey and the \a sortKey) \li \a open: The opening value at the data point (this is the \a mainValue) \li \a high: The high/maximum value at the data point \li \a low: The low/minimum value at the data point \li \a close: The closing value at the data point The container for storing multiple data points is \ref QCPFinancialDataContainer. It is a typedef for \ref QCPDataContainer with \ref QCPFinancialData as the DataType template parameter. See the documentation there for an explanation regarding the data type's generic methods. \see QCPFinancialDataContainer */ /* start documentation of inline functions */ /*! \fn double QCPFinancialData::sortKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static QCPFinancialData QCPFinancialData::fromSortKey(double sortKey) Returns a data point with the specified \a sortKey. All other members are set to zero. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn static static bool QCPFinancialData::sortKeyIsMainKey() Since the member \a key is both the data point key coordinate and the data ordering parameter, this method returns true. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPFinancialData::mainKey() const Returns the \a key member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn double QCPFinancialData::mainValue() const Returns the \a open member of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /*! \fn QCPRange QCPFinancialData::valueRange() const Returns a QCPRange spanning from the \a low to the \a high value of this data point. For a general explanation of what this method is good for in the context of the data container, see the documentation of \ref QCPDataContainer. */ /* end documentation of inline functions */ /*! Constructs a data point with key and all values set to zero. */ QCPFinancialData::QCPFinancialData() : key(0), open(0), high(0), low(0), close(0) { } /*! Constructs a data point with the specified \a key and OHLC values. */ QCPFinancialData::QCPFinancialData(double key, double open, double high, double low, double close) : key(key), open(open), high(high), low(low), close(close) { } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPFinancial //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPFinancial \brief A plottable representing a financial stock chart \image html QCPFinancial.png This plottable represents time series data binned to certain intervals, mainly used for stock charts. The two common representations OHLC (Open-High-Low-Close) bars and Candlesticks can be set via \ref setChartStyle. The data is passed via \ref setData as a set of open/high/low/close values at certain keys (typically times). This means the data must be already binned appropriately. If data is only available as a series of values (e.g. \a price against \a time), you can use the static convenience function \ref timeSeriesToOhlc to generate binned OHLC-data which can then be passed to \ref setData. The width of the OHLC bars/candlesticks can be controlled with \ref setWidth and \ref setWidthType. A typical choice is to set the width type to \ref wtPlotCoords (the default) and the width to (or slightly less than) one time bin interval width. \section qcpfinancial-appearance Changing the appearance Charts can be either single- or two-colored (\ref setTwoColored). If set to be single-colored, lines are drawn with the plottable's pen (\ref setPen) and fills with the brush (\ref setBrush). If set to two-colored, positive changes of the value during an interval (\a close >= \a open) are represented with a different pen and brush than negative changes (\a close < \a open). These can be configured with \ref setPenPositive, \ref setPenNegative, \ref setBrushPositive, and \ref setBrushNegative. In two-colored mode, the normal plottable pen/brush is ignored. Upon selection however, the normal selected pen/brush (provided by the \ref selectionDecorator) is used, irrespective of whether the chart is single- or two-colored. \section qcpfinancial-usage Usage Like all data representing objects in QCustomPlot, the QCPFinancial is a plottable (QCPAbstractPlottable). So the plottable-interface of QCustomPlot applies (QCustomPlot::plottable, QCustomPlot::removePlottable, etc.) Usually, you first create an instance: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpfinancial-creation-1 which registers it with the QCustomPlot instance of the passed axes. Note that this QCustomPlot instance takes ownership of the plottable, so do not delete it manually but use QCustomPlot::removePlottable() instead. The newly created plottable can be modified, e.g.: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpfinancial-creation-2 Here we have used the static helper method \ref timeSeriesToOhlc, to turn a time-price data series into a 24-hour binned open-high-low-close data series as QCPFinancial uses. */ /* start of documentation of inline functions */ /*! \fn QCPFinancialDataContainer *QCPFinancial::data() const Returns a pointer to the internal data storage of type \ref QCPFinancialDataContainer. You may use it to directly manipulate the data, which may be more convenient and faster than using the regular \ref setData or \ref addData methods, in certain situations. */ /* end of documentation of inline functions */ /*! Constructs a financial chart which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. The created QCPFinancial is automatically registered with the QCustomPlot instance inferred from \a keyAxis. This QCustomPlot instance takes ownership of the QCPFinancial, so do not delete it manually but use QCustomPlot::removePlottable() instead. */ QCPFinancial::QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable1D(keyAxis, valueAxis), mChartStyle(csCandlestick), mWidth(0.5), mWidthType(wtPlotCoords), mTwoColored(true), mBrushPositive(QBrush(QColor(50, 160, 0))), mBrushNegative(QBrush(QColor(180, 0, 15))), mPenPositive(QPen(QColor(40, 150, 0))), mPenNegative(QPen(QColor(170, 5, 5))) { mSelectionDecorator->setBrush(QBrush(QColor(160, 160, 255))); } QCPFinancial::~QCPFinancial() { } /*! \overload Replaces the current data container with the provided \a data container. Since a QSharedPointer is used, multiple QCPFinancials may share the same data container safely. Modifying the data in the container will then affect all financials that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpfinancial-datasharing-1 If you do not wish to share containers, but create a copy from an existing container, rather use the \ref QCPDataContainer::set method on the financial's data container directly: \snippet documentation/doc-code-snippets/mainwindow.cpp qcpfinancial-datasharing-2 \see addData, timeSeriesToOhlc */ void QCPFinancial::setData(QSharedPointer data) { mDataContainer = data; } /*! \overload Replaces the current data with the provided points in \a keys, \a open, \a high, \a low and \a close. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. \see addData, timeSeriesToOhlc */ void QCPFinancial::setData(const QVector &keys, const QVector &open, const QVector &high, const QVector &low, const QVector &close, bool alreadySorted) { mDataContainer->clear(); addData(keys, open, high, low, close, alreadySorted); } /*! Sets which representation style shall be used to display the OHLC data. */ void QCPFinancial::setChartStyle(QCPFinancial::ChartStyle style) { mChartStyle = style; } /*! Sets the width of the individual bars/candlesticks to \a width in plot key coordinates. A typical choice is to set it to (or slightly less than) one bin interval width. */ void QCPFinancial::setWidth(double width) { mWidth = width; } /*! Sets how the width of the financial bars is defined. See the documentation of \ref WidthType for an explanation of the possible values for \a widthType. The default value is \ref wtPlotCoords. \see setWidth */ void QCPFinancial::setWidthType(QCPFinancial::WidthType widthType) { mWidthType = widthType; } /*! Sets whether this chart shall contrast positive from negative trends per data point by using two separate colors to draw the respective bars/candlesticks. If \a twoColored is false, the normal plottable's pen and brush are used (\ref setPen, \ref setBrush). \see setPenPositive, setPenNegative, setBrushPositive, setBrushNegative */ void QCPFinancial::setTwoColored(bool twoColored) { mTwoColored = twoColored; } /*! If \ref setTwoColored is set to true, this function controls the brush that is used to draw fills of data points with a positive trend (i.e. bars/candlesticks with close >= open). If \a twoColored is false, the normal plottable's pen and brush are used (\ref setPen, \ref setBrush). \see setBrushNegative, setPenPositive, setPenNegative */ void QCPFinancial::setBrushPositive(const QBrush &brush) { mBrushPositive = brush; } /*! If \ref setTwoColored is set to true, this function controls the brush that is used to draw fills of data points with a negative trend (i.e. bars/candlesticks with close < open). If \a twoColored is false, the normal plottable's pen and brush are used (\ref setPen, \ref setBrush). \see setBrushPositive, setPenNegative, setPenPositive */ void QCPFinancial::setBrushNegative(const QBrush &brush) { mBrushNegative = brush; } /*! If \ref setTwoColored is set to true, this function controls the pen that is used to draw outlines of data points with a positive trend (i.e. bars/candlesticks with close >= open). If \a twoColored is false, the normal plottable's pen and brush are used (\ref setPen, \ref setBrush). \see setPenNegative, setBrushPositive, setBrushNegative */ void QCPFinancial::setPenPositive(const QPen &pen) { mPenPositive = pen; } /*! If \ref setTwoColored is set to true, this function controls the pen that is used to draw outlines of data points with a negative trend (i.e. bars/candlesticks with close < open). If \a twoColored is false, the normal plottable's pen and brush are used (\ref setPen, \ref setBrush). \see setPenPositive, setBrushNegative, setBrushPositive */ void QCPFinancial::setPenNegative(const QPen &pen) { mPenNegative = pen; } /*! \overload Adds the provided points in \a keys, \a open, \a high, \a low and \a close to the current data. The provided vectors should have equal length. Else, the number of added points will be the size of the smallest vector. If you can guarantee that the passed data points are sorted by \a keys in ascending order, you can set \a alreadySorted to true, to improve performance by saving a sorting run. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. \see timeSeriesToOhlc */ void QCPFinancial::addData(const QVector &keys, const QVector &open, const QVector &high, const QVector &low, const QVector &close, bool alreadySorted) { if (keys.size() != open.size() || open.size() != high.size() || high.size() != low.size() || low.size() != close.size() || close.size() != keys.size()) qDebug() << Q_FUNC_INFO << "keys, open, high, low, close have different sizes:" << keys.size() << open.size() << high.size() << low.size() << close.size(); const int n = qMin(keys.size(), qMin(open.size(), qMin(high.size(), qMin(low.size(), close.size())))); QVector tempData(n); QVector::iterator it = tempData.begin(); const QVector::iterator itEnd = tempData.end(); int i = 0; while (it != itEnd) { it->key = keys[i]; it->open = open[i]; it->high = high[i]; it->low = low[i]; it->close = close[i]; ++it; ++i; } mDataContainer->add(tempData, alreadySorted); // don't modify tempData beyond this to prevent copy on write } /*! \overload Adds the provided data point as \a key, \a open, \a high, \a low and \a close to the current data. Alternatively, you can also access and modify the data directly via the \ref data method, which returns a pointer to the internal data container. \see timeSeriesToOhlc */ void QCPFinancial::addData(double key, double open, double high, double low, double close) { mDataContainer->add(QCPFinancialData(key, open, high, low, close)); } /*! \copydoc QCPPlottableInterface1D::selectTestRect */ QCPDataSelection QCPFinancial::selectTestRect(const QRectF &rect, bool onlySelectable) const { QCPDataSelection result; if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return result; if (!mKeyAxis || !mValueAxis) return result; QCPFinancialDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd); for (QCPFinancialDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) { if (rect.intersects(selectionHitBox(it))) result.addDataRange(QCPDataRange(it-mDataContainer->constBegin(), it-mDataContainer->constBegin()+1), false); } result.simplify(); return result; } /* inherits documentation from base class */ double QCPFinancial::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint())) { // get visible data range: QCPFinancialDataContainer::const_iterator visibleBegin, visibleEnd; QCPFinancialDataContainer::const_iterator closestDataPoint = mDataContainer->constEnd(); getVisibleDataBounds(visibleBegin, visibleEnd); // perform select test according to configured style: double result = -1; switch (mChartStyle) { case QCPFinancial::csOhlc: result = ohlcSelectTest(pos, visibleBegin, visibleEnd, closestDataPoint); break; case QCPFinancial::csCandlestick: result = candlestickSelectTest(pos, visibleBegin, visibleEnd, closestDataPoint); break; } if (details) { int pointIndex = closestDataPoint-mDataContainer->constBegin(); details->setValue(QCPDataSelection(QCPDataRange(pointIndex, pointIndex+1))); } return result; } return -1; } /* inherits documentation from base class */ QCPRange QCPFinancial::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const { QCPRange range = mDataContainer->keyRange(foundRange, inSignDomain); // determine exact range by including width of bars/flags: if (foundRange) { if (inSignDomain != QCP::sdPositive || range.lower-mWidth*0.5 > 0) range.lower -= mWidth*0.5; if (inSignDomain != QCP::sdNegative || range.upper+mWidth*0.5 < 0) range.upper += mWidth*0.5; } return range; } /* inherits documentation from base class */ QCPRange QCPFinancial::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const { return mDataContainer->valueRange(foundRange, inSignDomain, inKeyRange); } /*! A convenience function that converts time series data (\a value against \a time) to OHLC binned data points. The return value can then be passed on to \ref QCPFinancialDataContainer::set(const QCPFinancialDataContainer&). The size of the bins can be controlled with \a timeBinSize in the same units as \a time is given. For example, if the unit of \a time is seconds and single OHLC/Candlesticks should span an hour each, set \a timeBinSize to 3600. \a timeBinOffset allows to control precisely at what \a time coordinate a bin should start. The value passed as \a timeBinOffset doesn't need to be in the range encompassed by the \a time keys. It merely defines the mathematical offset/phase of the bins that will be used to process the data. */ QCPFinancialDataContainer QCPFinancial::timeSeriesToOhlc(const QVector &time, const QVector &value, double timeBinSize, double timeBinOffset) { QCPFinancialDataContainer data; int count = qMin(time.size(), value.size()); if (count == 0) return QCPFinancialDataContainer(); QCPFinancialData currentBinData(0, value.first(), value.first(), value.first(), value.first()); int currentBinIndex = qFloor((time.first()-timeBinOffset)/timeBinSize+0.5); for (int i=0; i currentBinData.high) currentBinData.high = value.at(i); if (i == count-1) // last data point is in current bin, finalize bin: { currentBinData.close = value.at(i); currentBinData.key = timeBinOffset+(index)*timeBinSize; data.add(currentBinData); } } else // data point not anymore in current bin, set close of old and open of new bin, and add old to map: { // finalize current bin: currentBinData.close = value.at(i-1); currentBinData.key = timeBinOffset+(index-1)*timeBinSize; data.add(currentBinData); // start next bin: currentBinIndex = index; currentBinData.open = value.at(i); currentBinData.high = value.at(i); currentBinData.low = value.at(i); } } return data; } /* inherits documentation from base class */ void QCPFinancial::draw(QCPPainter *painter) { // get visible data range: QCPFinancialDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd); // loop over and draw segments of unselected/selected data: QList selectedSegments, unselectedSegments, allSegments; getDataSegments(selectedSegments, unselectedSegments); allSegments << unselectedSegments << selectedSegments; for (int i=0; i= unselectedSegments.size(); QCPFinancialDataContainer::const_iterator begin = visibleBegin; QCPFinancialDataContainer::const_iterator end = visibleEnd; mDataContainer->limitIteratorsToDataRange(begin, end, allSegments.at(i)); if (begin == end) continue; // draw data segment according to configured style: switch (mChartStyle) { case QCPFinancial::csOhlc: drawOhlcPlot(painter, begin, end, isSelectedSegment); break; case QCPFinancial::csCandlestick: drawCandlestickPlot(painter, begin, end, isSelectedSegment); break; } } // draw other selection decoration that isn't just line/scatter pens and brushes: if (mSelectionDecorator) mSelectionDecorator->drawDecoration(painter, selection()); } /* inherits documentation from base class */ void QCPFinancial::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const { painter->setAntialiasing(false); // legend icon especially of csCandlestick looks better without antialiasing if (mChartStyle == csOhlc) { if (mTwoColored) { // draw upper left half icon with positive color: painter->setBrush(mBrushPositive); painter->setPen(mPenPositive); painter->setClipRegion(QRegion(QPolygon() << rect.bottomLeft().toPoint() << rect.topRight().toPoint() << rect.topLeft().toPoint())); painter->drawLine(QLineF(0, rect.height()*0.5, rect.width(), rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.2, rect.height()*0.3, rect.width()*0.2, rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.8, rect.height()*0.5, rect.width()*0.8, rect.height()*0.7).translated(rect.topLeft())); // draw bottom right half icon with negative color: painter->setBrush(mBrushNegative); painter->setPen(mPenNegative); painter->setClipRegion(QRegion(QPolygon() << rect.bottomLeft().toPoint() << rect.topRight().toPoint() << rect.bottomRight().toPoint())); painter->drawLine(QLineF(0, rect.height()*0.5, rect.width(), rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.2, rect.height()*0.3, rect.width()*0.2, rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.8, rect.height()*0.5, rect.width()*0.8, rect.height()*0.7).translated(rect.topLeft())); } else { painter->setBrush(mBrush); painter->setPen(mPen); painter->drawLine(QLineF(0, rect.height()*0.5, rect.width(), rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.2, rect.height()*0.3, rect.width()*0.2, rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.8, rect.height()*0.5, rect.width()*0.8, rect.height()*0.7).translated(rect.topLeft())); } } else if (mChartStyle == csCandlestick) { if (mTwoColored) { // draw upper left half icon with positive color: painter->setBrush(mBrushPositive); painter->setPen(mPenPositive); painter->setClipRegion(QRegion(QPolygon() << rect.bottomLeft().toPoint() << rect.topRight().toPoint() << rect.topLeft().toPoint())); painter->drawLine(QLineF(0, rect.height()*0.5, rect.width()*0.25, rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.75, rect.height()*0.5, rect.width(), rect.height()*0.5).translated(rect.topLeft())); painter->drawRect(QRectF(rect.width()*0.25, rect.height()*0.25, rect.width()*0.5, rect.height()*0.5).translated(rect.topLeft())); // draw bottom right half icon with negative color: painter->setBrush(mBrushNegative); painter->setPen(mPenNegative); painter->setClipRegion(QRegion(QPolygon() << rect.bottomLeft().toPoint() << rect.topRight().toPoint() << rect.bottomRight().toPoint())); painter->drawLine(QLineF(0, rect.height()*0.5, rect.width()*0.25, rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.75, rect.height()*0.5, rect.width(), rect.height()*0.5).translated(rect.topLeft())); painter->drawRect(QRectF(rect.width()*0.25, rect.height()*0.25, rect.width()*0.5, rect.height()*0.5).translated(rect.topLeft())); } else { painter->setBrush(mBrush); painter->setPen(mPen); painter->drawLine(QLineF(0, rect.height()*0.5, rect.width()*0.25, rect.height()*0.5).translated(rect.topLeft())); painter->drawLine(QLineF(rect.width()*0.75, rect.height()*0.5, rect.width(), rect.height()*0.5).translated(rect.topLeft())); painter->drawRect(QRectF(rect.width()*0.25, rect.height()*0.25, rect.width()*0.5, rect.height()*0.5).translated(rect.topLeft())); } } } /*! \internal Draws the data from \a begin to \a end-1 as OHLC bars with the provided \a painter. This method is a helper function for \ref draw. It is used when the chart style is \ref csOhlc. */ void QCPFinancial::drawOhlcPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected) { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (keyAxis->orientation() == Qt::Horizontal) { for (QCPFinancialDataContainer::const_iterator it = begin; it != end; ++it) { if (isSelected && mSelectionDecorator) mSelectionDecorator->applyPen(painter); else if (mTwoColored) painter->setPen(it->close >= it->open ? mPenPositive : mPenNegative); else painter->setPen(mPen); double keyPixel = keyAxis->coordToPixel(it->key); double openPixel = valueAxis->coordToPixel(it->open); double closePixel = valueAxis->coordToPixel(it->close); // draw backbone: painter->drawLine(QPointF(keyPixel, valueAxis->coordToPixel(it->high)), QPointF(keyPixel, valueAxis->coordToPixel(it->low))); // draw open: double pixelWidth = getPixelWidth(it->key, keyPixel); // sign of this makes sure open/close are on correct sides painter->drawLine(QPointF(keyPixel-pixelWidth, openPixel), QPointF(keyPixel, openPixel)); // draw close: painter->drawLine(QPointF(keyPixel, closePixel), QPointF(keyPixel+pixelWidth, closePixel)); } } else { for (QCPFinancialDataContainer::const_iterator it = begin; it != end; ++it) { if (isSelected && mSelectionDecorator) mSelectionDecorator->applyPen(painter); else if (mTwoColored) painter->setPen(it->close >= it->open ? mPenPositive : mPenNegative); else painter->setPen(mPen); double keyPixel = keyAxis->coordToPixel(it->key); double openPixel = valueAxis->coordToPixel(it->open); double closePixel = valueAxis->coordToPixel(it->close); // draw backbone: painter->drawLine(QPointF(valueAxis->coordToPixel(it->high), keyPixel), QPointF(valueAxis->coordToPixel(it->low), keyPixel)); // draw open: double pixelWidth = getPixelWidth(it->key, keyPixel); // sign of this makes sure open/close are on correct sides painter->drawLine(QPointF(openPixel, keyPixel-pixelWidth), QPointF(openPixel, keyPixel)); // draw close: painter->drawLine(QPointF(closePixel, keyPixel), QPointF(closePixel, keyPixel+pixelWidth)); } } } /*! \internal Draws the data from \a begin to \a end-1 as Candlesticks with the provided \a painter. This method is a helper function for \ref draw. It is used when the chart style is \ref csCandlestick. */ void QCPFinancial::drawCandlestickPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected) { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (keyAxis->orientation() == Qt::Horizontal) { for (QCPFinancialDataContainer::const_iterator it = begin; it != end; ++it) { if (isSelected && mSelectionDecorator) { mSelectionDecorator->applyPen(painter); mSelectionDecorator->applyBrush(painter); } else if (mTwoColored) { painter->setPen(it->close >= it->open ? mPenPositive : mPenNegative); painter->setBrush(it->close >= it->open ? mBrushPositive : mBrushNegative); } else { painter->setPen(mPen); painter->setBrush(mBrush); } double keyPixel = keyAxis->coordToPixel(it->key); double openPixel = valueAxis->coordToPixel(it->open); double closePixel = valueAxis->coordToPixel(it->close); // draw high: painter->drawLine(QPointF(keyPixel, valueAxis->coordToPixel(it->high)), QPointF(keyPixel, valueAxis->coordToPixel(qMax(it->open, it->close)))); // draw low: painter->drawLine(QPointF(keyPixel, valueAxis->coordToPixel(it->low)), QPointF(keyPixel, valueAxis->coordToPixel(qMin(it->open, it->close)))); // draw open-close box: double pixelWidth = getPixelWidth(it->key, keyPixel); painter->drawRect(QRectF(QPointF(keyPixel-pixelWidth, closePixel), QPointF(keyPixel+pixelWidth, openPixel))); } } else // keyAxis->orientation() == Qt::Vertical { for (QCPFinancialDataContainer::const_iterator it = begin; it != end; ++it) { if (isSelected && mSelectionDecorator) { mSelectionDecorator->applyPen(painter); mSelectionDecorator->applyBrush(painter); } else if (mTwoColored) { painter->setPen(it->close >= it->open ? mPenPositive : mPenNegative); painter->setBrush(it->close >= it->open ? mBrushPositive : mBrushNegative); } else { painter->setPen(mPen); painter->setBrush(mBrush); } double keyPixel = keyAxis->coordToPixel(it->key); double openPixel = valueAxis->coordToPixel(it->open); double closePixel = valueAxis->coordToPixel(it->close); // draw high: painter->drawLine(QPointF(valueAxis->coordToPixel(it->high), keyPixel), QPointF(valueAxis->coordToPixel(qMax(it->open, it->close)), keyPixel)); // draw low: painter->drawLine(QPointF(valueAxis->coordToPixel(it->low), keyPixel), QPointF(valueAxis->coordToPixel(qMin(it->open, it->close)), keyPixel)); // draw open-close box: double pixelWidth = getPixelWidth(it->key, keyPixel); painter->drawRect(QRectF(QPointF(closePixel, keyPixel-pixelWidth), QPointF(openPixel, keyPixel+pixelWidth))); } } } /*! \internal This function is used to determine the width of the bar at coordinate \a key, according to the specified width (\ref setWidth) and width type (\ref setWidthType). Provide the pixel position of \a key in \a keyPixel (because usually this was already calculated via \ref QCPAxis::coordToPixel when this function is called). It returns the number of pixels the bar extends to higher keys, relative to the \a key coordinate. So with a non-reversed horizontal axis, the return value is positive. With a reversed horizontal axis, the return value is negative. This is important so the open/close flags on the \ref csOhlc bar are drawn to the correct side. */ double QCPFinancial::getPixelWidth(double key, double keyPixel) const { double result = 0; switch (mWidthType) { case wtAbsolute: { if (mKeyAxis) result = mWidth*0.5*mKeyAxis.data()->pixelOrientation(); break; } case wtAxisRectRatio: { if (mKeyAxis && mKeyAxis.data()->axisRect()) { if (mKeyAxis.data()->orientation() == Qt::Horizontal) result = mKeyAxis.data()->axisRect()->width()*mWidth*0.5*mKeyAxis.data()->pixelOrientation(); else result = mKeyAxis.data()->axisRect()->height()*mWidth*0.5*mKeyAxis.data()->pixelOrientation(); } else qDebug() << Q_FUNC_INFO << "No key axis or axis rect defined"; break; } case wtPlotCoords: { if (mKeyAxis) result = mKeyAxis.data()->coordToPixel(key+mWidth*0.5)-keyPixel; else qDebug() << Q_FUNC_INFO << "No key axis defined"; break; } } return result; } /*! \internal This method is a helper function for \ref selectTest. It is used to test for selection when the chart style is \ref csOhlc. It only tests against the data points between \a begin and \a end. Like \ref selectTest, this method returns the shortest distance of \a pos to the graphical representation of the plottable, and \a closestDataPoint will point to the respective data point. */ double QCPFinancial::ohlcSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const { closestDataPoint = mDataContainer->constEnd(); QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return -1; } double minDistSqr = std::numeric_limits::max(); if (keyAxis->orientation() == Qt::Horizontal) { for (QCPFinancialDataContainer::const_iterator it=begin; it!=end; ++it) { double keyPixel = keyAxis->coordToPixel(it->key); // calculate distance to backbone: double currentDistSqr = QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(keyPixel, valueAxis->coordToPixel(it->high)), QCPVector2D(keyPixel, valueAxis->coordToPixel(it->low))); if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; closestDataPoint = it; } } } else // keyAxis->orientation() == Qt::Vertical { for (QCPFinancialDataContainer::const_iterator it=begin; it!=end; ++it) { double keyPixel = keyAxis->coordToPixel(it->key); // calculate distance to backbone: double currentDistSqr = QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(valueAxis->coordToPixel(it->high), keyPixel), QCPVector2D(valueAxis->coordToPixel(it->low), keyPixel)); if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; closestDataPoint = it; } } } return qSqrt(minDistSqr); } /*! \internal This method is a helper function for \ref selectTest. It is used to test for selection when the chart style is \ref csCandlestick. It only tests against the data points between \a begin and \a end. Like \ref selectTest, this method returns the shortest distance of \a pos to the graphical representation of the plottable, and \a closestDataPoint will point to the respective data point. */ double QCPFinancial::candlestickSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const { closestDataPoint = mDataContainer->constEnd(); QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return -1; } double minDistSqr = std::numeric_limits::max(); if (keyAxis->orientation() == Qt::Horizontal) { for (QCPFinancialDataContainer::const_iterator it=begin; it!=end; ++it) { double currentDistSqr; // determine whether pos is in open-close-box: QCPRange boxKeyRange(it->key-mWidth*0.5, it->key+mWidth*0.5); QCPRange boxValueRange(it->close, it->open); double posKey, posValue; pixelsToCoords(pos, posKey, posValue); if (boxKeyRange.contains(posKey) && boxValueRange.contains(posValue)) // is in open-close-box { currentDistSqr = mParentPlot->selectionTolerance()*0.99 * mParentPlot->selectionTolerance()*0.99; } else { // calculate distance to high/low lines: double keyPixel = keyAxis->coordToPixel(it->key); double highLineDistSqr = QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(keyPixel, valueAxis->coordToPixel(it->high)), QCPVector2D(keyPixel, valueAxis->coordToPixel(qMax(it->open, it->close)))); double lowLineDistSqr = QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(keyPixel, valueAxis->coordToPixel(it->low)), QCPVector2D(keyPixel, valueAxis->coordToPixel(qMin(it->open, it->close)))); currentDistSqr = qMin(highLineDistSqr, lowLineDistSqr); } if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; closestDataPoint = it; } } } else // keyAxis->orientation() == Qt::Vertical { for (QCPFinancialDataContainer::const_iterator it=begin; it!=end; ++it) { double currentDistSqr; // determine whether pos is in open-close-box: QCPRange boxKeyRange(it->key-mWidth*0.5, it->key+mWidth*0.5); QCPRange boxValueRange(it->close, it->open); double posKey, posValue; pixelsToCoords(pos, posKey, posValue); if (boxKeyRange.contains(posKey) && boxValueRange.contains(posValue)) // is in open-close-box { currentDistSqr = mParentPlot->selectionTolerance()*0.99 * mParentPlot->selectionTolerance()*0.99; } else { // calculate distance to high/low lines: double keyPixel = keyAxis->coordToPixel(it->key); double highLineDistSqr = QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(valueAxis->coordToPixel(it->high), keyPixel), QCPVector2D(valueAxis->coordToPixel(qMax(it->open, it->close)), keyPixel)); double lowLineDistSqr = QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(valueAxis->coordToPixel(it->low), keyPixel), QCPVector2D(valueAxis->coordToPixel(qMin(it->open, it->close)), keyPixel)); currentDistSqr = qMin(highLineDistSqr, lowLineDistSqr); } if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; closestDataPoint = it; } } } return qSqrt(minDistSqr); } /*! \internal called by the drawing methods to determine which data (key) range is visible at the current key axis range setting, so only that needs to be processed. \a begin returns an iterator to the lowest data point that needs to be taken into account when plotting. Note that in order to get a clean plot all the way to the edge of the axis rect, \a begin may still be just outside the visible range. \a end returns the iterator just above the highest data point that needs to be taken into account. Same as before, \a end may also lie just outside of the visible range if the plottable contains no data, both \a begin and \a end point to \c constEnd. */ void QCPFinancial::getVisibleDataBounds(QCPFinancialDataContainer::const_iterator &begin, QCPFinancialDataContainer::const_iterator &end) const { if (!mKeyAxis) { qDebug() << Q_FUNC_INFO << "invalid key axis"; begin = mDataContainer->constEnd(); end = mDataContainer->constEnd(); return; } begin = mDataContainer->findBegin(mKeyAxis.data()->range().lower-mWidth*0.5); // subtract half width of ohlc/candlestick to include partially visible data points end = mDataContainer->findEnd(mKeyAxis.data()->range().upper+mWidth*0.5); // add half width of ohlc/candlestick to include partially visible data points } /*! \internal Returns the hit box in pixel coordinates that will be used for data selection with the selection rect (\ref selectTestRect), of the data point given by \a it. */ QRectF QCPFinancial::selectionHitBox(QCPFinancialDataContainer::const_iterator it) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return QRectF(); } double keyPixel = keyAxis->coordToPixel(it->key); double highPixel = valueAxis->coordToPixel(it->high); double lowPixel = valueAxis->coordToPixel(it->low); double keyWidthPixels = keyPixel-keyAxis->coordToPixel(it->key-mWidth*0.5); if (keyAxis->orientation() == Qt::Horizontal) return QRectF(keyPixel-keyWidthPixels, highPixel, keyWidthPixels*2, lowPixel-highPixel).normalized(); else return QRectF(highPixel, keyPixel-keyWidthPixels, lowPixel-highPixel, keyWidthPixels*2).normalized(); } /* end of 'src/plottables/plottable-financial.cpp' */ /* including file 'src/plottables/plottable-errorbar.cpp', size 37210 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPErrorBarsData //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPErrorBarsData \brief Holds the data of one single error bar for QCPErrorBars. The stored data is: \li \a errorMinus: how much the error bar extends towards negative coordinates from the data point position \li \a errorPlus: how much the error bar extends towards positive coordinates from the data point position The container for storing the error bar information is \ref QCPErrorBarsDataContainer. It is a typedef for QVector<\ref QCPErrorBarsData>. \see QCPErrorBarsDataContainer */ /*! Constructs an error bar with errors set to zero. */ QCPErrorBarsData::QCPErrorBarsData() : errorMinus(0), errorPlus(0) { } /*! Constructs an error bar with equal \a error in both negative and positive direction. */ QCPErrorBarsData::QCPErrorBarsData(double error) : errorMinus(error), errorPlus(error) { } /*! Constructs an error bar with negative and positive errors set to \a errorMinus and \a errorPlus, respectively. */ QCPErrorBarsData::QCPErrorBarsData(double errorMinus, double errorPlus) : errorMinus(errorMinus), errorPlus(errorPlus) { } //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPErrorBars //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPErrorBars \brief A plottable that adds a set of error bars to other plottables. \image html QCPErrorBars.png The \ref QCPErrorBars plottable can be attached to other one-dimensional plottables (e.g. \ref QCPGraph, \ref QCPCurve, \ref QCPBars, etc.) and equips them with error bars. Use \ref setDataPlottable to define for which plottable the \ref QCPErrorBars shall display the error bars. The orientation of the error bars can be controlled with \ref setErrorType. By using \ref setData, you can supply the actual error data, either as symmetric error or plus/minus asymmetric errors. \ref QCPErrorBars only stores the error data. The absolute key/value position of each error bar will be adopted from the configured data plottable. The error data of the \ref QCPErrorBars are associated one-to-one via their index to the data points of the data plottable. You can directly access and manipulate the error bar data via \ref data. Set either of the plus/minus errors to NaN (qQNaN() or std::numeric_limits::quiet_NaN()) to not show the respective error bar on the data point at that index. \section qcperrorbars-appearance Changing the appearance The appearance of the error bars is defined by the pen (\ref setPen), and the width of the whiskers (\ref setWhiskerWidth). Further, the error bar backbones may leave a gap around the data point center to prevent that error bars are drawn too close to or even through scatter points. This gap size can be controlled via \ref setSymbolGap. */ /* start of documentation of inline functions */ /*! \fn QSharedPointer QCPErrorBars::data() const Returns a shared pointer to the internal data storage of type \ref QCPErrorBarsDataContainer. You may use it to directly manipulate the error values, which may be more convenient and faster than using the regular \ref setData methods. */ /* end of documentation of inline functions */ /*! Constructs an error bars plottable which uses \a keyAxis as its key axis ("x") and \a valueAxis as its value axis ("y"). \a keyAxis and \a valueAxis must reside in the same QCustomPlot instance and not have the same orientation. If either of these restrictions is violated, a corresponding message is printed to the debug output (qDebug), the construction is not aborted, though. It is also important that the \a keyAxis and \a valueAxis are the same for the error bars plottable and the data plottable that the error bars shall be drawn on (\ref setDataPlottable). The created \ref QCPErrorBars is automatically registered with the QCustomPlot instance inferred from \a keyAxis. This QCustomPlot instance takes ownership of the \ref QCPErrorBars, so do not delete it manually but use \ref QCustomPlot::removePlottable() instead. */ QCPErrorBars::QCPErrorBars(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable(keyAxis, valueAxis), mDataContainer(new QVector), mErrorType(etValueError), mWhiskerWidth(9), mSymbolGap(10) { setPen(QPen(Qt::black, 0)); setBrush(Qt::NoBrush); } QCPErrorBars::~QCPErrorBars() { } /*! \overload Replaces the current data container with the provided \a data container. Since a QSharedPointer is used, multiple \ref QCPErrorBars instances may share the same data container safely. Modifying the data in the container will then affect all \ref QCPErrorBars instances that share the container. Sharing can be achieved by simply exchanging the data containers wrapped in shared pointers: \snippet documentation/doc-code-snippets/mainwindow.cpp qcperrorbars-datasharing-1 If you do not wish to share containers, but create a copy from an existing container, assign the data containers directly: \snippet documentation/doc-code-snippets/mainwindow.cpp qcperrorbars-datasharing-2 (This uses different notation compared with other plottables, because the \ref QCPErrorBars uses a \c QVector as its data container, instead of a \ref QCPDataContainer.) \see addData */ void QCPErrorBars::setData(QSharedPointer data) { mDataContainer = data; } /*! \overload Sets symmetrical error values as specified in \a error. The errors will be associated one-to-one by the data point index to the associated data plottable (\ref setDataPlottable). You can directly access and manipulate the error bar data via \ref data. \see addData */ void QCPErrorBars::setData(const QVector &error) { mDataContainer->clear(); addData(error); } /*! \overload Sets asymmetrical errors as specified in \a errorMinus and \a errorPlus. The errors will be associated one-to-one by the data point index to the associated data plottable (\ref setDataPlottable). You can directly access and manipulate the error bar data via \ref data. \see addData */ void QCPErrorBars::setData(const QVector &errorMinus, const QVector &errorPlus) { mDataContainer->clear(); addData(errorMinus, errorPlus); } /*! Sets the data plottable to which the error bars will be applied. The error values specified e.g. via \ref setData will be associated one-to-one by the data point index to the data points of \a plottable. This means that the error bars will adopt the key/value coordinates of the data point with the same index. The passed \a plottable must be a one-dimensional plottable, i.e. it must implement the \ref QCPPlottableInterface1D. Further, it must not be a \ref QCPErrorBars instance itself. If either of these restrictions is violated, a corresponding qDebug output is generated, and the data plottable of this \ref QCPErrorBars instance is set to zero. For proper display, care must also be taken that the key and value axes of the \a plottable match those configured for this \ref QCPErrorBars instance. */ void QCPErrorBars::setDataPlottable(QCPAbstractPlottable *plottable) { if (plottable && qobject_cast(plottable)) { mDataPlottable = 0; qDebug() << Q_FUNC_INFO << "can't set another QCPErrorBars instance as data plottable"; return; } if (plottable && !plottable->interface1D()) { mDataPlottable = 0; qDebug() << Q_FUNC_INFO << "passed plottable doesn't implement 1d interface, can't associate with QCPErrorBars"; return; } mDataPlottable = plottable; } /*! Sets in which orientation the error bars shall appear on the data points. If your data needs both error dimensions, create two \ref QCPErrorBars with different \a type. */ void QCPErrorBars::setErrorType(ErrorType type) { mErrorType = type; } /*! Sets the width of the whiskers (the short bars at the end of the actual error bar backbones) to \a pixels. */ void QCPErrorBars::setWhiskerWidth(double pixels) { mWhiskerWidth = pixels; } /*! Sets the gap diameter around the data points that will be left out when drawing the error bar backbones. This gap prevents that error bars are drawn too close to or even through scatter points. */ void QCPErrorBars::setSymbolGap(double pixels) { mSymbolGap = pixels; } /*! \overload Adds symmetrical error values as specified in \a error. The errors will be associated one-to-one by the data point index to the associated data plottable (\ref setDataPlottable). You can directly access and manipulate the error bar data via \ref data. \see setData */ void QCPErrorBars::addData(const QVector &error) { addData(error, error); } /*! \overload Adds asymmetrical errors as specified in \a errorMinus and \a errorPlus. The errors will be associated one-to-one by the data point index to the associated data plottable (\ref setDataPlottable). You can directly access and manipulate the error bar data via \ref data. \see setData */ void QCPErrorBars::addData(const QVector &errorMinus, const QVector &errorPlus) { if (errorMinus.size() != errorPlus.size()) qDebug() << Q_FUNC_INFO << "minus and plus error vectors have different sizes:" << errorMinus.size() << errorPlus.size(); const int n = qMin(errorMinus.size(), errorPlus.size()); mDataContainer->reserve(n); for (int i=0; iappend(QCPErrorBarsData(errorMinus.at(i), errorPlus.at(i))); } /*! \overload Adds a single symmetrical error bar as specified in \a error. The errors will be associated one-to-one by the data point index to the associated data plottable (\ref setDataPlottable). You can directly access and manipulate the error bar data via \ref data. \see setData */ void QCPErrorBars::addData(double error) { mDataContainer->append(QCPErrorBarsData(error)); } /*! \overload Adds a single asymmetrical error bar as specified in \a errorMinus and \a errorPlus. The errors will be associated one-to-one by the data point index to the associated data plottable (\ref setDataPlottable). You can directly access and manipulate the error bar data via \ref data. \see setData */ void QCPErrorBars::addData(double errorMinus, double errorPlus) { mDataContainer->append(QCPErrorBarsData(errorMinus, errorPlus)); } /* inherits documentation from base class */ int QCPErrorBars::dataCount() const { return mDataContainer->size(); } /* inherits documentation from base class */ double QCPErrorBars::dataMainKey(int index) const { if (mDataPlottable) return mDataPlottable->interface1D()->dataMainKey(index); else qDebug() << Q_FUNC_INFO << "no data plottable set"; return 0; } /* inherits documentation from base class */ double QCPErrorBars::dataSortKey(int index) const { if (mDataPlottable) return mDataPlottable->interface1D()->dataSortKey(index); else qDebug() << Q_FUNC_INFO << "no data plottable set"; return 0; } /* inherits documentation from base class */ double QCPErrorBars::dataMainValue(int index) const { if (mDataPlottable) return mDataPlottable->interface1D()->dataMainValue(index); else qDebug() << Q_FUNC_INFO << "no data plottable set"; return 0; } /* inherits documentation from base class */ QCPRange QCPErrorBars::dataValueRange(int index) const { if (mDataPlottable) { const double value = mDataPlottable->interface1D()->dataMainValue(index); if (index >= 0 && index < mDataContainer->size() && mErrorType == etValueError) return QCPRange(value-mDataContainer->at(index).errorMinus, value+mDataContainer->at(index).errorPlus); else return QCPRange(value, value); } else { qDebug() << Q_FUNC_INFO << "no data plottable set"; return QCPRange(); } } /* inherits documentation from base class */ QPointF QCPErrorBars::dataPixelPosition(int index) const { if (mDataPlottable) return mDataPlottable->interface1D()->dataPixelPosition(index); else qDebug() << Q_FUNC_INFO << "no data plottable set"; return QPointF(); } /* inherits documentation from base class */ bool QCPErrorBars::sortKeyIsMainKey() const { if (mDataPlottable) { return mDataPlottable->interface1D()->sortKeyIsMainKey(); } else { qDebug() << Q_FUNC_INFO << "no data plottable set"; return true; } } /*! \copydoc QCPPlottableInterface1D::selectTestRect */ QCPDataSelection QCPErrorBars::selectTestRect(const QRectF &rect, bool onlySelectable) const { QCPDataSelection result; if (!mDataPlottable) return result; if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return result; if (!mKeyAxis || !mValueAxis) return result; QCPErrorBarsDataContainer::const_iterator visibleBegin, visibleEnd; getVisibleDataBounds(visibleBegin, visibleEnd, QCPDataRange(0, dataCount())); QVector backbones, whiskers; for (QCPErrorBarsDataContainer::const_iterator it=visibleBegin; it!=visibleEnd; ++it) { backbones.clear(); whiskers.clear(); getErrorBarLines(it, backbones, whiskers); for (int i=0; iconstBegin(), it-mDataContainer->constBegin()+1), false); break; } } } result.simplify(); return result; } /* inherits documentation from base class */ int QCPErrorBars::findBegin(double sortKey, bool expandedRange) const { if (mDataPlottable) { if (mDataContainer->isEmpty()) return 0; int beginIndex = mDataPlottable->interface1D()->findBegin(sortKey, expandedRange); if (beginIndex >= mDataContainer->size()) beginIndex = mDataContainer->size()-1; return beginIndex; } else qDebug() << Q_FUNC_INFO << "no data plottable set"; return 0; } /* inherits documentation from base class */ int QCPErrorBars::findEnd(double sortKey, bool expandedRange) const { if (mDataPlottable) { if (mDataContainer->isEmpty()) return 0; int endIndex = mDataPlottable->interface1D()->findEnd(sortKey, expandedRange); if (endIndex > mDataContainer->size()) endIndex = mDataContainer->size(); return endIndex; } else qDebug() << Q_FUNC_INFO << "no data plottable set"; return 0; } /* inherits documentation from base class */ double QCPErrorBars::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { if (!mDataPlottable) return -1; if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; if (mKeyAxis.data()->axisRect()->rect().contains(pos.toPoint())) { QCPErrorBarsDataContainer::const_iterator closestDataPoint = mDataContainer->constEnd(); double result = pointDistance(pos, closestDataPoint); if (details) { int pointIndex = closestDataPoint-mDataContainer->constBegin(); details->setValue(QCPDataSelection(QCPDataRange(pointIndex, pointIndex+1))); } return result; } else return -1; } /* inherits documentation from base class */ void QCPErrorBars::draw(QCPPainter *painter) { if (!mDataPlottable) return; if (!mKeyAxis || !mValueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; return; } if (mKeyAxis.data()->range().size() <= 0 || mDataContainer->isEmpty()) return; // if the sort key isn't the main key, we must check the visibility for each data point/error bar individually // (getVisibleDataBounds applies range restriction, but otherwise can only return full data range): bool checkPointVisibility = !mDataPlottable->interface1D()->sortKeyIsMainKey(); // check data validity if flag set: #ifdef QCUSTOMPLOT_CHECK_DATA QCPErrorBarsDataContainer::const_iterator it; for (it = mDataContainer->constBegin(); it != mDataContainer->constEnd(); ++it) { if (QCP::isInvalidData(it->errorMinus, it->errorPlus)) qDebug() << Q_FUNC_INFO << "Data point at index" << it-mDataContainer->constBegin() << "invalid." << "Plottable name:" << name(); } #endif applyDefaultAntialiasingHint(painter); painter->setBrush(Qt::NoBrush); // loop over and draw segments of unselected/selected data: QList selectedSegments, unselectedSegments, allSegments; getDataSegments(selectedSegments, unselectedSegments); allSegments << unselectedSegments << selectedSegments; QVector backbones, whiskers; for (int i=0; i= unselectedSegments.size(); if (isSelectedSegment && mSelectionDecorator) mSelectionDecorator->applyPen(painter); else painter->setPen(mPen); if (painter->pen().capStyle() == Qt::SquareCap) { QPen capFixPen(painter->pen()); capFixPen.setCapStyle(Qt::FlatCap); painter->setPen(capFixPen); } backbones.clear(); whiskers.clear(); for (QCPErrorBarsDataContainer::const_iterator it=begin; it!=end; ++it) { if (!checkPointVisibility || errorBarVisible(it-mDataContainer->constBegin())) getErrorBarLines(it, backbones, whiskers); } painter->drawLines(backbones); painter->drawLines(whiskers); } // draw other selection decoration that isn't just line/scatter pens and brushes: if (mSelectionDecorator) mSelectionDecorator->drawDecoration(painter, selection()); } /* inherits documentation from base class */ void QCPErrorBars::drawLegendIcon(QCPPainter *painter, const QRectF &rect) const { applyDefaultAntialiasingHint(painter); painter->setPen(mPen); if (mErrorType == etValueError && mValueAxis && mValueAxis->orientation() == Qt::Vertical) { painter->drawLine(QLineF(rect.center().x(), rect.top()+2, rect.center().x(), rect.bottom()-1)); painter->drawLine(QLineF(rect.center().x()-4, rect.top()+2, rect.center().x()+4, rect.top()+2)); painter->drawLine(QLineF(rect.center().x()-4, rect.bottom()-1, rect.center().x()+4, rect.bottom()-1)); } else { painter->drawLine(QLineF(rect.left()+2, rect.center().y(), rect.right()-2, rect.center().y())); painter->drawLine(QLineF(rect.left()+2, rect.center().y()-4, rect.left()+2, rect.center().y()+4)); painter->drawLine(QLineF(rect.right()-2, rect.center().y()-4, rect.right()-2, rect.center().y()+4)); } } /* inherits documentation from base class */ QCPRange QCPErrorBars::getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain) const { if (!mDataPlottable) { foundRange = false; return QCPRange(); } QCPRange range; bool haveLower = false; bool haveUpper = false; QCPErrorBarsDataContainer::const_iterator it; for (it = mDataContainer->constBegin(); it != mDataContainer->constEnd(); ++it) { if (mErrorType == etValueError) { // error bar doesn't extend in key dimension (except whisker but we ignore that here), so only use data point center const double current = mDataPlottable->interface1D()->dataMainKey(it-mDataContainer->constBegin()); if (qIsNaN(current)) continue; if (inSignDomain == QCP::sdBoth || (inSignDomain == QCP::sdNegative && current < 0) || (inSignDomain == QCP::sdPositive && current > 0)) { if (current < range.lower || !haveLower) { range.lower = current; haveLower = true; } if (current > range.upper || !haveUpper) { range.upper = current; haveUpper = true; } } } else // mErrorType == etKeyError { const double dataKey = mDataPlottable->interface1D()->dataMainKey(it-mDataContainer->constBegin()); if (qIsNaN(dataKey)) continue; // plus error: double current = dataKey + (qIsNaN(it->errorPlus) ? 0 : it->errorPlus); if (inSignDomain == QCP::sdBoth || (inSignDomain == QCP::sdNegative && current < 0) || (inSignDomain == QCP::sdPositive && current > 0)) { if (current > range.upper || !haveUpper) { range.upper = current; haveUpper = true; } } // minus error: current = dataKey - (qIsNaN(it->errorMinus) ? 0 : it->errorMinus); if (inSignDomain == QCP::sdBoth || (inSignDomain == QCP::sdNegative && current < 0) || (inSignDomain == QCP::sdPositive && current > 0)) { if (current < range.lower || !haveLower) { range.lower = current; haveLower = true; } } } } if (haveUpper && !haveLower) { range.lower = range.upper; haveLower = true; } else if (haveLower && !haveUpper) { range.upper = range.lower; haveUpper = true; } foundRange = haveLower && haveUpper; return range; } /* inherits documentation from base class */ QCPRange QCPErrorBars::getValueRange(bool &foundRange, QCP::SignDomain inSignDomain, const QCPRange &inKeyRange) const { if (!mDataPlottable) { foundRange = false; return QCPRange(); } QCPRange range; const bool restrictKeyRange = inKeyRange != QCPRange(); bool haveLower = false; bool haveUpper = false; QCPErrorBarsDataContainer::const_iterator itBegin = mDataContainer->constBegin(); QCPErrorBarsDataContainer::const_iterator itEnd = mDataContainer->constEnd(); if (mDataPlottable->interface1D()->sortKeyIsMainKey() && restrictKeyRange) { itBegin = mDataContainer->constBegin()+findBegin(inKeyRange.lower); itEnd = mDataContainer->constBegin()+findEnd(inKeyRange.upper); } for (QCPErrorBarsDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { if (restrictKeyRange) { const double dataKey = mDataPlottable->interface1D()->dataMainKey(it-mDataContainer->constBegin()); if (dataKey < inKeyRange.lower || dataKey > inKeyRange.upper) continue; } if (mErrorType == etValueError) { const double dataValue = mDataPlottable->interface1D()->dataMainValue(it-mDataContainer->constBegin()); if (qIsNaN(dataValue)) continue; // plus error: double current = dataValue + (qIsNaN(it->errorPlus) ? 0 : it->errorPlus); if (inSignDomain == QCP::sdBoth || (inSignDomain == QCP::sdNegative && current < 0) || (inSignDomain == QCP::sdPositive && current > 0)) { if (current > range.upper || !haveUpper) { range.upper = current; haveUpper = true; } } // minus error: current = dataValue - (qIsNaN(it->errorMinus) ? 0 : it->errorMinus); if (inSignDomain == QCP::sdBoth || (inSignDomain == QCP::sdNegative && current < 0) || (inSignDomain == QCP::sdPositive && current > 0)) { if (current < range.lower || !haveLower) { range.lower = current; haveLower = true; } } } else // mErrorType == etKeyError { // error bar doesn't extend in value dimension (except whisker but we ignore that here), so only use data point center const double current = mDataPlottable->interface1D()->dataMainValue(it-mDataContainer->constBegin()); if (qIsNaN(current)) continue; if (inSignDomain == QCP::sdBoth || (inSignDomain == QCP::sdNegative && current < 0) || (inSignDomain == QCP::sdPositive && current > 0)) { if (current < range.lower || !haveLower) { range.lower = current; haveLower = true; } if (current > range.upper || !haveUpper) { range.upper = current; haveUpper = true; } } } } if (haveUpper && !haveLower) { range.lower = range.upper; haveLower = true; } else if (haveLower && !haveUpper) { range.upper = range.lower; haveUpper = true; } foundRange = haveLower && haveUpper; return range; } /*! \internal Calculates the lines that make up the error bar belonging to the data point \a it. The resulting lines are added to \a backbones and \a whiskers. The vectors are not cleared, so calling this method with different \a it but the same \a backbones and \a whiskers allows to accumulate lines for multiple data points. This method assumes that \a it is a valid iterator within the bounds of this \ref QCPErrorBars instance and within the bounds of the associated data plottable. */ void QCPErrorBars::getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it, QVector &backbones, QVector &whiskers) const { if (!mDataPlottable) return; int index = it-mDataContainer->constBegin(); QPointF centerPixel = mDataPlottable->interface1D()->dataPixelPosition(index); if (qIsNaN(centerPixel.x()) || qIsNaN(centerPixel.y())) return; QCPAxis *errorAxis = mErrorType == etValueError ? mValueAxis : mKeyAxis; QCPAxis *orthoAxis = mErrorType == etValueError ? mKeyAxis : mValueAxis; const double centerErrorAxisPixel = errorAxis->orientation() == Qt::Horizontal ? centerPixel.x() : centerPixel.y(); const double centerOrthoAxisPixel = orthoAxis->orientation() == Qt::Horizontal ? centerPixel.x() : centerPixel.y(); const double centerErrorAxisCoord = errorAxis->pixelToCoord(centerErrorAxisPixel); // depending on plottable, this might be different from just mDataPlottable->interface1D()->dataMainKey/Value const double symbolGap = mSymbolGap*0.5*errorAxis->pixelOrientation(); // plus error: double errorStart, errorEnd; if (!qIsNaN(it->errorPlus)) { errorStart = centerErrorAxisPixel+symbolGap; errorEnd = errorAxis->coordToPixel(centerErrorAxisCoord+it->errorPlus); if (errorAxis->orientation() == Qt::Vertical) { if ((errorStart > errorEnd) != errorAxis->rangeReversed()) backbones.append(QLineF(centerOrthoAxisPixel, errorStart, centerOrthoAxisPixel, errorEnd)); whiskers.append(QLineF(centerOrthoAxisPixel-mWhiskerWidth*0.5, errorEnd, centerOrthoAxisPixel+mWhiskerWidth*0.5, errorEnd)); } else { if ((errorStart < errorEnd) != errorAxis->rangeReversed()) backbones.append(QLineF(errorStart, centerOrthoAxisPixel, errorEnd, centerOrthoAxisPixel)); whiskers.append(QLineF(errorEnd, centerOrthoAxisPixel-mWhiskerWidth*0.5, errorEnd, centerOrthoAxisPixel+mWhiskerWidth*0.5)); } } // minus error: if (!qIsNaN(it->errorMinus)) { errorStart = centerErrorAxisPixel-symbolGap; errorEnd = errorAxis->coordToPixel(centerErrorAxisCoord-it->errorMinus); if (errorAxis->orientation() == Qt::Vertical) { if ((errorStart < errorEnd) != errorAxis->rangeReversed()) backbones.append(QLineF(centerOrthoAxisPixel, errorStart, centerOrthoAxisPixel, errorEnd)); whiskers.append(QLineF(centerOrthoAxisPixel-mWhiskerWidth*0.5, errorEnd, centerOrthoAxisPixel+mWhiskerWidth*0.5, errorEnd)); } else { if ((errorStart > errorEnd) != errorAxis->rangeReversed()) backbones.append(QLineF(errorStart, centerOrthoAxisPixel, errorEnd, centerOrthoAxisPixel)); whiskers.append(QLineF(errorEnd, centerOrthoAxisPixel-mWhiskerWidth*0.5, errorEnd, centerOrthoAxisPixel+mWhiskerWidth*0.5)); } } } /*! \internal This method outputs the currently visible data range via \a begin and \a end. The returned range will also never exceed \a rangeRestriction. Since error bars with type \ref etKeyError may extend to arbitrarily positive and negative key coordinates relative to their data point key, this method checks all outer error bars whether they truly don't reach into the visible portion of the axis rect, by calling \ref errorBarVisible. On the other hand error bars with type \ref etValueError that are associated with data plottables whose sort key is equal to the main key (see \ref qcpdatacontainer-datatype "QCPDataContainer DataType") can be handled very efficiently by finding the visible range of error bars through binary search (\ref QCPPlottableInterface1D::findBegin and \ref QCPPlottableInterface1D::findEnd). If the plottable's sort key is not equal to the main key, this method returns the full data range, only restricted by \a rangeRestriction. Drawing optimization then has to be done on a point-by-point basis in the \ref draw method. */ void QCPErrorBars::getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const { QCPAxis *keyAxis = mKeyAxis.data(); QCPAxis *valueAxis = mValueAxis.data(); if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "invalid key or value axis"; end = mDataContainer->constEnd(); begin = end; return; } if (!mDataPlottable || rangeRestriction.isEmpty()) { end = mDataContainer->constEnd(); begin = end; return; } if (!mDataPlottable->interface1D()->sortKeyIsMainKey()) { // if the sort key isn't the main key, it's not possible to find a contiguous range of visible // data points, so this method then only applies the range restriction and otherwise returns // the full data range. Visibility checks must be done on a per-datapoin-basis during drawing QCPDataRange dataRange(0, mDataContainer->size()); dataRange = dataRange.bounded(rangeRestriction); begin = mDataContainer->constBegin()+dataRange.begin(); end = mDataContainer->constBegin()+dataRange.end(); return; } // get visible data range via interface from data plottable, and then restrict to available error data points: const int n = qMin(mDataContainer->size(), mDataPlottable->interface1D()->dataCount()); int beginIndex = mDataPlottable->interface1D()->findBegin(keyAxis->range().lower); int endIndex = mDataPlottable->interface1D()->findEnd(keyAxis->range().upper); int i = beginIndex; while (i > 0 && i < n && i > rangeRestriction.begin()) { if (errorBarVisible(i)) beginIndex = i; --i; } i = endIndex; while (i >= 0 && i < n && i < rangeRestriction.end()) { if (errorBarVisible(i)) endIndex = i+1; ++i; } QCPDataRange dataRange(beginIndex, endIndex); dataRange = dataRange.bounded(rangeRestriction.bounded(QCPDataRange(0, mDataContainer->size()))); begin = mDataContainer->constBegin()+dataRange.begin(); end = mDataContainer->constBegin()+dataRange.end(); } /*! \internal Calculates the minimum distance in pixels the error bars' representation has from the given \a pixelPoint. This is used to determine whether the error bar was clicked or not, e.g. in \ref selectTest. The closest data point to \a pixelPoint is returned in \a closestData. */ double QCPErrorBars::pointDistance(const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const { closestData = mDataContainer->constEnd(); if (!mDataPlottable || mDataContainer->isEmpty()) return -1.0; QCPErrorBarsDataContainer::const_iterator begin, end; getVisibleDataBounds(begin, end, QCPDataRange(0, dataCount())); // calculate minimum distances to error backbones (whiskers are ignored for speed) and find closestData iterator: double minDistSqr = std::numeric_limits::max(); QVector backbones, whiskers; for (QCPErrorBarsDataContainer::const_iterator it=begin; it!=end; ++it) { getErrorBarLines(it, backbones, whiskers); for (int i=0; i &selectedSegments, QList &unselectedSegments) const { selectedSegments.clear(); unselectedSegments.clear(); if (mSelectable == QCP::stWhole) // stWhole selection type draws the entire plottable with selected style if mSelection isn't empty { if (selected()) selectedSegments << QCPDataRange(0, dataCount()); else unselectedSegments << QCPDataRange(0, dataCount()); } else { QCPDataSelection sel(selection()); sel.simplify(); selectedSegments = sel.dataRanges(); unselectedSegments = sel.inverse(QCPDataRange(0, dataCount())).dataRanges(); } } /*! \internal Returns whether the error bar at the specified \a index is visible within the current key axis range. This method assumes for performance reasons without checking that the key axis, the value axis, and the data plottable (\ref setDataPlottable) are not zero and that \a index is within valid bounds of this \ref QCPErrorBars instance and the bounds of the data plottable. */ bool QCPErrorBars::errorBarVisible(int index) const { QPointF centerPixel = mDataPlottable->interface1D()->dataPixelPosition(index); const double centerKeyPixel = mKeyAxis->orientation() == Qt::Horizontal ? centerPixel.x() : centerPixel.y(); if (qIsNaN(centerKeyPixel)) return false; double keyMin, keyMax; if (mErrorType == etKeyError) { const double centerKey = mKeyAxis->pixelToCoord(centerKeyPixel); const double errorPlus = mDataContainer->at(index).errorPlus; const double errorMinus = mDataContainer->at(index).errorMinus; keyMax = centerKey+(qIsNaN(errorPlus) ? 0 : errorPlus); keyMin = centerKey-(qIsNaN(errorMinus) ? 0 : errorMinus); } else // mErrorType == etValueError { keyMax = mKeyAxis->pixelToCoord(centerKeyPixel+mWhiskerWidth*0.5*mKeyAxis->pixelOrientation()); keyMin = mKeyAxis->pixelToCoord(centerKeyPixel-mWhiskerWidth*0.5*mKeyAxis->pixelOrientation()); } return ((keyMax > mKeyAxis->range().lower) && (keyMin < mKeyAxis->range().upper)); } /*! \internal Returns whether \a line intersects (or is contained in) \a pixelRect. \a line is assumed to be either perfectly horizontal or perfectly vertical, as is the case for error bar lines. */ bool QCPErrorBars::rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const { if (pixelRect.left() > line.x1() && pixelRect.left() > line.x2()) return false; else if (pixelRect.right() < line.x1() && pixelRect.right() < line.x2()) return false; else if (pixelRect.top() > line.y1() && pixelRect.top() > line.y2()) return false; else if (pixelRect.bottom() < line.y1() && pixelRect.bottom() < line.y2()) return false; else return true; } /* end of 'src/plottables/plottable-errorbar.cpp' */ /* including file 'src/items/item-straightline.cpp', size 7592 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemStraightLine //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemStraightLine \brief A straight line that spans infinitely in both directions \image html QCPItemStraightLine.png "Straight line example. Blue dotted circles are anchors, solid blue discs are positions." It has two positions, \a point1 and \a point2, which define the straight line. */ /*! Creates a straight line item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemStraightLine::QCPItemStraightLine(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), point1(createPosition(QLatin1String("point1"))), point2(createPosition(QLatin1String("point2"))) { point1->setCoords(0, 0); point2->setCoords(1, 1); setPen(QPen(Qt::black)); setSelectedPen(QPen(Qt::blue,2)); } QCPItemStraightLine::~QCPItemStraightLine() { } /*! Sets the pen that will be used to draw the line \see setSelectedPen */ void QCPItemStraightLine::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw the line when selected \see setPen, setSelected */ void QCPItemStraightLine::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /* inherits documentation from base class */ double QCPItemStraightLine::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; return QCPVector2D(pos).distanceToStraightLine(point1->pixelPosition(), point2->pixelPosition()-point1->pixelPosition()); } /* inherits documentation from base class */ void QCPItemStraightLine::draw(QCPPainter *painter) { QCPVector2D start(point1->pixelPosition()); QCPVector2D end(point2->pixelPosition()); // get visible segment of straight line inside clipRect: double clipPad = mainPen().widthF(); QLineF line = getRectClippedStraightLine(start, end-start, clipRect().adjusted(-clipPad, -clipPad, clipPad, clipPad)); // paint visible segment, if existent: if (!line.isNull()) { painter->setPen(mainPen()); painter->drawLine(line); } } /*! \internal Returns the section of the straight line defined by \a base and direction vector \a vec, that is visible in the specified \a rect. This is a helper function for \ref draw. */ QLineF QCPItemStraightLine::getRectClippedStraightLine(const QCPVector2D &base, const QCPVector2D &vec, const QRect &rect) const { double bx, by; double gamma; QLineF result; if (vec.x() == 0 && vec.y() == 0) return result; if (qFuzzyIsNull(vec.x())) // line is vertical { // check top of rect: bx = rect.left(); by = rect.top(); gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y(); if (gamma >= 0 && gamma <= rect.width()) result.setLine(bx+gamma, rect.top(), bx+gamma, rect.bottom()); // no need to check bottom because we know line is vertical } else if (qFuzzyIsNull(vec.y())) // line is horizontal { // check left of rect: bx = rect.left(); by = rect.top(); gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x(); if (gamma >= 0 && gamma <= rect.height()) result.setLine(rect.left(), by+gamma, rect.right(), by+gamma); // no need to check right because we know line is horizontal } else // line is skewed { QList pointVectors; // check top of rect: bx = rect.left(); by = rect.top(); gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y(); if (gamma >= 0 && gamma <= rect.width()) pointVectors.append(QCPVector2D(bx+gamma, by)); // check bottom of rect: bx = rect.left(); by = rect.bottom(); gamma = base.x()-bx + (by-base.y())*vec.x()/vec.y(); if (gamma >= 0 && gamma <= rect.width()) pointVectors.append(QCPVector2D(bx+gamma, by)); // check left of rect: bx = rect.left(); by = rect.top(); gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x(); if (gamma >= 0 && gamma <= rect.height()) pointVectors.append(QCPVector2D(bx, by+gamma)); // check right of rect: bx = rect.right(); by = rect.top(); gamma = base.y()-by + (bx-base.x())*vec.y()/vec.x(); if (gamma >= 0 && gamma <= rect.height()) pointVectors.append(QCPVector2D(bx, by+gamma)); // evaluate points: if (pointVectors.size() == 2) { result.setPoints(pointVectors.at(0).toPointF(), pointVectors.at(1).toPointF()); } else if (pointVectors.size() > 2) { // line probably goes through corner of rect, and we got two points there. single out the point pair with greatest distance: double distSqrMax = 0; QCPVector2D pv1, pv2; for (int i=0; i distSqrMax) { pv1 = pointVectors.at(i); pv2 = pointVectors.at(k); distSqrMax = distSqr; } } } result.setPoints(pv1.toPointF(), pv2.toPointF()); } } return result; } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemStraightLine::mainPen() const { return mSelected ? mSelectedPen : mPen; } /* end of 'src/items/item-straightline.cpp' */ /* including file 'src/items/item-line.cpp', size 8498 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemLine //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemLine \brief A line from one point to another \image html QCPItemLine.png "Line example. Blue dotted circles are anchors, solid blue discs are positions." It has two positions, \a start and \a end, which define the end points of the line. With \ref setHead and \ref setTail you may set different line ending styles, e.g. to create an arrow. */ /*! Creates a line item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemLine::QCPItemLine(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), start(createPosition(QLatin1String("start"))), end(createPosition(QLatin1String("end"))) { start->setCoords(0, 0); end->setCoords(1, 1); setPen(QPen(Qt::black)); setSelectedPen(QPen(Qt::blue,2)); } QCPItemLine::~QCPItemLine() { } /*! Sets the pen that will be used to draw the line \see setSelectedPen */ void QCPItemLine::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw the line when selected \see setPen, setSelected */ void QCPItemLine::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /*! Sets the line ending style of the head. The head corresponds to the \a end position. Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g. \code setHead(QCPLineEnding::esSpikeArrow) \endcode \see setTail */ void QCPItemLine::setHead(const QCPLineEnding &head) { mHead = head; } /*! Sets the line ending style of the tail. The tail corresponds to the \a start position. Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g. \code setTail(QCPLineEnding::esSpikeArrow) \endcode \see setHead */ void QCPItemLine::setTail(const QCPLineEnding &tail) { mTail = tail; } /* inherits documentation from base class */ double QCPItemLine::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; return qSqrt(QCPVector2D(pos).distanceSquaredToLine(start->pixelPosition(), end->pixelPosition())); } /* inherits documentation from base class */ void QCPItemLine::draw(QCPPainter *painter) { QCPVector2D startVec(start->pixelPosition()); QCPVector2D endVec(end->pixelPosition()); if (qFuzzyIsNull((startVec-endVec).lengthSquared())) return; // get visible segment of straight line inside clipRect: double clipPad = qMax(mHead.boundingDistance(), mTail.boundingDistance()); clipPad = qMax(clipPad, (double)mainPen().widthF()); QLineF line = getRectClippedLine(startVec, endVec, clipRect().adjusted(-clipPad, -clipPad, clipPad, clipPad)); // paint visible segment, if existent: if (!line.isNull()) { painter->setPen(mainPen()); painter->drawLine(line); painter->setBrush(Qt::SolidPattern); if (mTail.style() != QCPLineEnding::esNone) mTail.draw(painter, startVec, startVec-endVec); if (mHead.style() != QCPLineEnding::esNone) mHead.draw(painter, endVec, endVec-startVec); } } /*! \internal Returns the section of the line defined by \a start and \a end, that is visible in the specified \a rect. This is a helper function for \ref draw. */ QLineF QCPItemLine::getRectClippedLine(const QCPVector2D &start, const QCPVector2D &end, const QRect &rect) const { bool containsStart = rect.contains(start.x(), start.y()); bool containsEnd = rect.contains(end.x(), end.y()); if (containsStart && containsEnd) return QLineF(start.toPointF(), end.toPointF()); QCPVector2D base = start; QCPVector2D vec = end-start; double bx, by; double gamma, mu; QLineF result; QList pointVectors; if (!qFuzzyIsNull(vec.y())) // line is not horizontal { // check top of rect: bx = rect.left(); by = rect.top(); mu = (by-base.y())/vec.y(); if (mu >= 0 && mu <= 1) { gamma = base.x()-bx + mu*vec.x(); if (gamma >= 0 && gamma <= rect.width()) pointVectors.append(QCPVector2D(bx+gamma, by)); } // check bottom of rect: bx = rect.left(); by = rect.bottom(); mu = (by-base.y())/vec.y(); if (mu >= 0 && mu <= 1) { gamma = base.x()-bx + mu*vec.x(); if (gamma >= 0 && gamma <= rect.width()) pointVectors.append(QCPVector2D(bx+gamma, by)); } } if (!qFuzzyIsNull(vec.x())) // line is not vertical { // check left of rect: bx = rect.left(); by = rect.top(); mu = (bx-base.x())/vec.x(); if (mu >= 0 && mu <= 1) { gamma = base.y()-by + mu*vec.y(); if (gamma >= 0 && gamma <= rect.height()) pointVectors.append(QCPVector2D(bx, by+gamma)); } // check right of rect: bx = rect.right(); by = rect.top(); mu = (bx-base.x())/vec.x(); if (mu >= 0 && mu <= 1) { gamma = base.y()-by + mu*vec.y(); if (gamma >= 0 && gamma <= rect.height()) pointVectors.append(QCPVector2D(bx, by+gamma)); } } if (containsStart) pointVectors.append(start); if (containsEnd) pointVectors.append(end); // evaluate points: if (pointVectors.size() == 2) { result.setPoints(pointVectors.at(0).toPointF(), pointVectors.at(1).toPointF()); } else if (pointVectors.size() > 2) { // line probably goes through corner of rect, and we got two points there. single out the point pair with greatest distance: double distSqrMax = 0; QCPVector2D pv1, pv2; for (int i=0; i distSqrMax) { pv1 = pointVectors.at(i); pv2 = pointVectors.at(k); distSqrMax = distSqr; } } } result.setPoints(pv1.toPointF(), pv2.toPointF()); } return result; } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemLine::mainPen() const { return mSelected ? mSelectedPen : mPen; } /* end of 'src/items/item-line.cpp' */ /* including file 'src/items/item-curve.cpp', size 7159 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemCurve //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemCurve \brief A curved line from one point to another \image html QCPItemCurve.png "Curve example. Blue dotted circles are anchors, solid blue discs are positions." It has four positions, \a start and \a end, which define the end points of the line, and two control points which define the direction the line exits from the start and the direction from which it approaches the end: \a startDir and \a endDir. With \ref setHead and \ref setTail you may set different line ending styles, e.g. to create an arrow. Often it is desirable for the control points to stay at fixed relative positions to the start/end point. This can be achieved by setting the parent anchor e.g. of \a startDir simply to \a start, and then specify the desired pixel offset with QCPItemPosition::setCoords on \a startDir. */ /*! Creates a curve item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemCurve::QCPItemCurve(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), start(createPosition(QLatin1String("start"))), startDir(createPosition(QLatin1String("startDir"))), endDir(createPosition(QLatin1String("endDir"))), end(createPosition(QLatin1String("end"))) { start->setCoords(0, 0); startDir->setCoords(0.5, 0); endDir->setCoords(0, 0.5); end->setCoords(1, 1); setPen(QPen(Qt::black)); setSelectedPen(QPen(Qt::blue,2)); } QCPItemCurve::~QCPItemCurve() { } /*! Sets the pen that will be used to draw the line \see setSelectedPen */ void QCPItemCurve::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw the line when selected \see setPen, setSelected */ void QCPItemCurve::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /*! Sets the line ending style of the head. The head corresponds to the \a end position. Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g. \code setHead(QCPLineEnding::esSpikeArrow) \endcode \see setTail */ void QCPItemCurve::setHead(const QCPLineEnding &head) { mHead = head; } /*! Sets the line ending style of the tail. The tail corresponds to the \a start position. Note that due to the overloaded QCPLineEnding constructor, you may directly specify a QCPLineEnding::EndingStyle here, e.g. \code setTail(QCPLineEnding::esSpikeArrow) \endcode \see setHead */ void QCPItemCurve::setTail(const QCPLineEnding &tail) { mTail = tail; } /* inherits documentation from base class */ double QCPItemCurve::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; QPointF startVec(start->pixelPosition()); QPointF startDirVec(startDir->pixelPosition()); QPointF endDirVec(endDir->pixelPosition()); QPointF endVec(end->pixelPosition()); QPainterPath cubicPath(startVec); cubicPath.cubicTo(startDirVec, endDirVec, endVec); QPolygonF polygon = cubicPath.toSubpathPolygons().first(); QCPVector2D p(pos); double minDistSqr = std::numeric_limits::max(); for (int i=1; ipixelPosition()); QCPVector2D startDirVec(startDir->pixelPosition()); QCPVector2D endDirVec(endDir->pixelPosition()); QCPVector2D endVec(end->pixelPosition()); if ((endVec-startVec).length() > 1e10) // too large curves cause crash return; QPainterPath cubicPath(startVec.toPointF()); cubicPath.cubicTo(startDirVec.toPointF(), endDirVec.toPointF(), endVec.toPointF()); // paint visible segment, if existent: QRect clip = clipRect().adjusted(-mainPen().widthF(), -mainPen().widthF(), mainPen().widthF(), mainPen().widthF()); QRect cubicRect = cubicPath.controlPointRect().toRect(); if (cubicRect.isEmpty()) // may happen when start and end exactly on same x or y position cubicRect.adjust(0, 0, 1, 1); if (clip.intersects(cubicRect)) { painter->setPen(mainPen()); painter->drawPath(cubicPath); painter->setBrush(Qt::SolidPattern); if (mTail.style() != QCPLineEnding::esNone) mTail.draw(painter, startVec, M_PI-cubicPath.angleAtPercent(0)/180.0*M_PI); if (mHead.style() != QCPLineEnding::esNone) mHead.draw(painter, endVec, -cubicPath.angleAtPercent(1)/180.0*M_PI); } } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemCurve::mainPen() const { return mSelected ? mSelectedPen : mPen; } /* end of 'src/items/item-curve.cpp' */ /* including file 'src/items/item-rect.cpp', size 6479 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemRect //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemRect \brief A rectangle \image html QCPItemRect.png "Rectangle example. Blue dotted circles are anchors, solid blue discs are positions." It has two positions, \a topLeft and \a bottomRight, which define the rectangle. */ /*! Creates a rectangle item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemRect::QCPItemRect(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), topLeft(createPosition(QLatin1String("topLeft"))), bottomRight(createPosition(QLatin1String("bottomRight"))), top(createAnchor(QLatin1String("top"), aiTop)), topRight(createAnchor(QLatin1String("topRight"), aiTopRight)), right(createAnchor(QLatin1String("right"), aiRight)), bottom(createAnchor(QLatin1String("bottom"), aiBottom)), bottomLeft(createAnchor(QLatin1String("bottomLeft"), aiBottomLeft)), left(createAnchor(QLatin1String("left"), aiLeft)) { topLeft->setCoords(0, 1); bottomRight->setCoords(1, 0); setPen(QPen(Qt::black)); setSelectedPen(QPen(Qt::blue,2)); setBrush(Qt::NoBrush); setSelectedBrush(Qt::NoBrush); } QCPItemRect::~QCPItemRect() { } /*! Sets the pen that will be used to draw the line of the rectangle \see setSelectedPen, setBrush */ void QCPItemRect::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw the line of the rectangle when selected \see setPen, setSelected */ void QCPItemRect::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /*! Sets the brush that will be used to fill the rectangle. To disable filling, set \a brush to Qt::NoBrush. \see setSelectedBrush, setPen */ void QCPItemRect::setBrush(const QBrush &brush) { mBrush = brush; } /*! Sets the brush that will be used to fill the rectangle when selected. To disable filling, set \a brush to Qt::NoBrush. \see setBrush */ void QCPItemRect::setSelectedBrush(const QBrush &brush) { mSelectedBrush = brush; } /* inherits documentation from base class */ double QCPItemRect::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; QRectF rect = QRectF(topLeft->pixelPosition(), bottomRight->pixelPosition()).normalized(); bool filledRect = mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0; return rectDistance(rect, pos, filledRect); } /* inherits documentation from base class */ void QCPItemRect::draw(QCPPainter *painter) { QPointF p1 = topLeft->pixelPosition(); QPointF p2 = bottomRight->pixelPosition(); if (p1.toPoint() == p2.toPoint()) return; QRectF rect = QRectF(p1, p2).normalized(); double clipPad = mainPen().widthF(); QRectF boundingRect = rect.adjusted(-clipPad, -clipPad, clipPad, clipPad); if (boundingRect.intersects(clipRect())) // only draw if bounding rect of rect item is visible in cliprect { painter->setPen(mainPen()); painter->setBrush(mainBrush()); painter->drawRect(rect); } } /* inherits documentation from base class */ QPointF QCPItemRect::anchorPixelPosition(int anchorId) const { QRectF rect = QRectF(topLeft->pixelPosition(), bottomRight->pixelPosition()); switch (anchorId) { case aiTop: return (rect.topLeft()+rect.topRight())*0.5; case aiTopRight: return rect.topRight(); case aiRight: return (rect.topRight()+rect.bottomRight())*0.5; case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5; case aiBottomLeft: return rect.bottomLeft(); case aiLeft: return (rect.topLeft()+rect.bottomLeft())*0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; return QPointF(); } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemRect::mainPen() const { return mSelected ? mSelectedPen : mPen; } /*! \internal Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is. */ QBrush QCPItemRect::mainBrush() const { return mSelected ? mSelectedBrush : mBrush; } /* end of 'src/items/item-rect.cpp' */ /* including file 'src/items/item-text.cpp', size 13338 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemText //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemText \brief A text label \image html QCPItemText.png "Text example. Blue dotted circles are anchors, solid blue discs are positions." Its position is defined by the member \a position and the setting of \ref setPositionAlignment. The latter controls which part of the text rect shall be aligned with \a position. The text alignment itself (i.e. left, center, right) can be controlled with \ref setTextAlignment. The text may be rotated around the \a position point with \ref setRotation. */ /*! Creates a text item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemText::QCPItemText(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), position(createPosition(QLatin1String("position"))), topLeft(createAnchor(QLatin1String("topLeft"), aiTopLeft)), top(createAnchor(QLatin1String("top"), aiTop)), topRight(createAnchor(QLatin1String("topRight"), aiTopRight)), right(createAnchor(QLatin1String("right"), aiRight)), bottomRight(createAnchor(QLatin1String("bottomRight"), aiBottomRight)), bottom(createAnchor(QLatin1String("bottom"), aiBottom)), bottomLeft(createAnchor(QLatin1String("bottomLeft"), aiBottomLeft)), left(createAnchor(QLatin1String("left"), aiLeft)), mText(QLatin1String("text")), mPositionAlignment(Qt::AlignCenter), mTextAlignment(Qt::AlignTop|Qt::AlignHCenter), mRotation(0) { position->setCoords(0, 0); setPen(Qt::NoPen); setSelectedPen(Qt::NoPen); setBrush(Qt::NoBrush); setSelectedBrush(Qt::NoBrush); setColor(Qt::black); setSelectedColor(Qt::blue); } QCPItemText::~QCPItemText() { } /*! Sets the color of the text. */ void QCPItemText::setColor(const QColor &color) { mColor = color; } /*! Sets the color of the text that will be used when the item is selected. */ void QCPItemText::setSelectedColor(const QColor &color) { mSelectedColor = color; } /*! Sets the pen that will be used do draw a rectangular border around the text. To disable the border, set \a pen to Qt::NoPen. \see setSelectedPen, setBrush, setPadding */ void QCPItemText::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used do draw a rectangular border around the text, when the item is selected. To disable the border, set \a pen to Qt::NoPen. \see setPen */ void QCPItemText::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /*! Sets the brush that will be used do fill the background of the text. To disable the background, set \a brush to Qt::NoBrush. \see setSelectedBrush, setPen, setPadding */ void QCPItemText::setBrush(const QBrush &brush) { mBrush = brush; } /*! Sets the brush that will be used do fill the background of the text, when the item is selected. To disable the background, set \a brush to Qt::NoBrush. \see setBrush */ void QCPItemText::setSelectedBrush(const QBrush &brush) { mSelectedBrush = brush; } /*! Sets the font of the text. \see setSelectedFont, setColor */ void QCPItemText::setFont(const QFont &font) { mFont = font; } /*! Sets the font of the text that will be used when the item is selected. \see setFont */ void QCPItemText::setSelectedFont(const QFont &font) { mSelectedFont = font; } /*! Sets the text that will be displayed. Multi-line texts are supported by inserting a line break character, e.g. '\n'. \see setFont, setColor, setTextAlignment */ void QCPItemText::setText(const QString &text) { mText = text; } /*! Sets which point of the text rect shall be aligned with \a position. Examples: \li If \a alignment is Qt::AlignHCenter | Qt::AlignTop, the text will be positioned such that the top of the text rect will be horizontally centered on \a position. \li If \a alignment is Qt::AlignLeft | Qt::AlignBottom, \a position will indicate the bottom left corner of the text rect. If you want to control the alignment of (multi-lined) text within the text rect, use \ref setTextAlignment. */ void QCPItemText::setPositionAlignment(Qt::Alignment alignment) { mPositionAlignment = alignment; } /*! Controls how (multi-lined) text is aligned inside the text rect (typically Qt::AlignLeft, Qt::AlignCenter or Qt::AlignRight). */ void QCPItemText::setTextAlignment(Qt::Alignment alignment) { mTextAlignment = alignment; } /*! Sets the angle in degrees by which the text (and the text rectangle, if visible) will be rotated around \a position. */ void QCPItemText::setRotation(double degrees) { mRotation = degrees; } /*! Sets the distance between the border of the text rectangle and the text. The appearance (and visibility) of the text rectangle can be controlled with \ref setPen and \ref setBrush. */ void QCPItemText::setPadding(const QMargins &padding) { mPadding = padding; } /* inherits documentation from base class */ double QCPItemText::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; // The rect may be rotated, so we transform the actual clicked pos to the rotated // coordinate system, so we can use the normal rectDistance function for non-rotated rects: QPointF positionPixels(position->pixelPosition()); QTransform inputTransform; inputTransform.translate(positionPixels.x(), positionPixels.y()); inputTransform.rotate(-mRotation); inputTransform.translate(-positionPixels.x(), -positionPixels.y()); QPointF rotatedPos = inputTransform.map(pos); QFontMetrics fontMetrics(mFont); QRect textRect = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip|mTextAlignment, mText); QRect textBoxRect = textRect.adjusted(-mPadding.left(), -mPadding.top(), mPadding.right(), mPadding.bottom()); QPointF textPos = getTextDrawPoint(positionPixels, textBoxRect, mPositionAlignment); textBoxRect.moveTopLeft(textPos.toPoint()); return rectDistance(textBoxRect, rotatedPos, true); } /* inherits documentation from base class */ void QCPItemText::draw(QCPPainter *painter) { QPointF pos(position->pixelPosition()); QTransform transform = painter->transform(); transform.translate(pos.x(), pos.y()); if (!qFuzzyIsNull(mRotation)) transform.rotate(mRotation); painter->setFont(mainFont()); QRect textRect = painter->fontMetrics().boundingRect(0, 0, 0, 0, Qt::TextDontClip|mTextAlignment, mText); QRect textBoxRect = textRect.adjusted(-mPadding.left(), -mPadding.top(), mPadding.right(), mPadding.bottom()); QPointF textPos = getTextDrawPoint(QPointF(0, 0), textBoxRect, mPositionAlignment); // 0, 0 because the transform does the translation textRect.moveTopLeft(textPos.toPoint()+QPoint(mPadding.left(), mPadding.top())); textBoxRect.moveTopLeft(textPos.toPoint()); double clipPad = mainPen().widthF(); QRect boundingRect = textBoxRect.adjusted(-clipPad, -clipPad, clipPad, clipPad); if (transform.mapRect(boundingRect).intersects(painter->transform().mapRect(clipRect()))) { painter->setTransform(transform); if ((mainBrush().style() != Qt::NoBrush && mainBrush().color().alpha() != 0) || (mainPen().style() != Qt::NoPen && mainPen().color().alpha() != 0)) { painter->setPen(mainPen()); painter->setBrush(mainBrush()); painter->drawRect(textBoxRect); } painter->setBrush(Qt::NoBrush); painter->setPen(QPen(mainColor())); painter->drawText(textRect, Qt::TextDontClip|mTextAlignment, mText); } } /* inherits documentation from base class */ QPointF QCPItemText::anchorPixelPosition(int anchorId) const { // get actual rect points (pretty much copied from draw function): QPointF pos(position->pixelPosition()); QTransform transform; transform.translate(pos.x(), pos.y()); if (!qFuzzyIsNull(mRotation)) transform.rotate(mRotation); QFontMetrics fontMetrics(mainFont()); QRect textRect = fontMetrics.boundingRect(0, 0, 0, 0, Qt::TextDontClip|mTextAlignment, mText); QRectF textBoxRect = textRect.adjusted(-mPadding.left(), -mPadding.top(), mPadding.right(), mPadding.bottom()); QPointF textPos = getTextDrawPoint(QPointF(0, 0), textBoxRect, mPositionAlignment); // 0, 0 because the transform does the translation textBoxRect.moveTopLeft(textPos.toPoint()); QPolygonF rectPoly = transform.map(QPolygonF(textBoxRect)); switch (anchorId) { case aiTopLeft: return rectPoly.at(0); case aiTop: return (rectPoly.at(0)+rectPoly.at(1))*0.5; case aiTopRight: return rectPoly.at(1); case aiRight: return (rectPoly.at(1)+rectPoly.at(2))*0.5; case aiBottomRight: return rectPoly.at(2); case aiBottom: return (rectPoly.at(2)+rectPoly.at(3))*0.5; case aiBottomLeft: return rectPoly.at(3); case aiLeft: return (rectPoly.at(3)+rectPoly.at(0))*0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; return QPointF(); } /*! \internal Returns the point that must be given to the QPainter::drawText function (which expects the top left point of the text rect), according to the position \a pos, the text bounding box \a rect and the requested \a positionAlignment. For example, if \a positionAlignment is Qt::AlignLeft | Qt::AlignBottom the returned point will be shifted upward by the height of \a rect, starting from \a pos. So if the text is finally drawn at that point, the lower left corner of the resulting text rect is at \a pos. */ QPointF QCPItemText::getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const { if (positionAlignment == 0 || positionAlignment == (Qt::AlignLeft|Qt::AlignTop)) return pos; QPointF result = pos; // start at top left if (positionAlignment.testFlag(Qt::AlignHCenter)) result.rx() -= rect.width()/2.0; else if (positionAlignment.testFlag(Qt::AlignRight)) result.rx() -= rect.width(); if (positionAlignment.testFlag(Qt::AlignVCenter)) result.ry() -= rect.height()/2.0; else if (positionAlignment.testFlag(Qt::AlignBottom)) result.ry() -= rect.height(); return result; } /*! \internal Returns the font that should be used for drawing text. Returns mFont when the item is not selected and mSelectedFont when it is. */ QFont QCPItemText::mainFont() const { return mSelected ? mSelectedFont : mFont; } /*! \internal Returns the color that should be used for drawing text. Returns mColor when the item is not selected and mSelectedColor when it is. */ QColor QCPItemText::mainColor() const { return mSelected ? mSelectedColor : mColor; } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemText::mainPen() const { return mSelected ? mSelectedPen : mPen; } /*! \internal Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is. */ QBrush QCPItemText::mainBrush() const { return mSelected ? mSelectedBrush : mBrush; } /* end of 'src/items/item-text.cpp' */ /* including file 'src/items/item-ellipse.cpp', size 7863 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemEllipse //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemEllipse \brief An ellipse \image html QCPItemEllipse.png "Ellipse example. Blue dotted circles are anchors, solid blue discs are positions." It has two positions, \a topLeft and \a bottomRight, which define the rect the ellipse will be drawn in. */ /*! Creates an ellipse item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemEllipse::QCPItemEllipse(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), topLeft(createPosition(QLatin1String("topLeft"))), bottomRight(createPosition(QLatin1String("bottomRight"))), topLeftRim(createAnchor(QLatin1String("topLeftRim"), aiTopLeftRim)), top(createAnchor(QLatin1String("top"), aiTop)), topRightRim(createAnchor(QLatin1String("topRightRim"), aiTopRightRim)), right(createAnchor(QLatin1String("right"), aiRight)), bottomRightRim(createAnchor(QLatin1String("bottomRightRim"), aiBottomRightRim)), bottom(createAnchor(QLatin1String("bottom"), aiBottom)), bottomLeftRim(createAnchor(QLatin1String("bottomLeftRim"), aiBottomLeftRim)), left(createAnchor(QLatin1String("left"), aiLeft)), center(createAnchor(QLatin1String("center"), aiCenter)) { topLeft->setCoords(0, 1); bottomRight->setCoords(1, 0); setPen(QPen(Qt::black)); setSelectedPen(QPen(Qt::blue, 2)); setBrush(Qt::NoBrush); setSelectedBrush(Qt::NoBrush); } QCPItemEllipse::~QCPItemEllipse() { } /*! Sets the pen that will be used to draw the line of the ellipse \see setSelectedPen, setBrush */ void QCPItemEllipse::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw the line of the ellipse when selected \see setPen, setSelected */ void QCPItemEllipse::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /*! Sets the brush that will be used to fill the ellipse. To disable filling, set \a brush to Qt::NoBrush. \see setSelectedBrush, setPen */ void QCPItemEllipse::setBrush(const QBrush &brush) { mBrush = brush; } /*! Sets the brush that will be used to fill the ellipse when selected. To disable filling, set \a brush to Qt::NoBrush. \see setBrush */ void QCPItemEllipse::setSelectedBrush(const QBrush &brush) { mSelectedBrush = brush; } /* inherits documentation from base class */ double QCPItemEllipse::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; QPointF p1 = topLeft->pixelPosition(); QPointF p2 = bottomRight->pixelPosition(); QPointF center((p1+p2)/2.0); double a = qAbs(p1.x()-p2.x())/2.0; double b = qAbs(p1.y()-p2.y())/2.0; double x = pos.x()-center.x(); double y = pos.y()-center.y(); // distance to border: double c = 1.0/qSqrt(x*x/(a*a)+y*y/(b*b)); double result = qAbs(c-1)*qSqrt(x*x+y*y); // filled ellipse, allow click inside to count as hit: if (result > mParentPlot->selectionTolerance()*0.99 && mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0) { if (x*x/(a*a) + y*y/(b*b) <= 1) result = mParentPlot->selectionTolerance()*0.99; } return result; } /* inherits documentation from base class */ void QCPItemEllipse::draw(QCPPainter *painter) { QPointF p1 = topLeft->pixelPosition(); QPointF p2 = bottomRight->pixelPosition(); if (p1.toPoint() == p2.toPoint()) return; QRectF ellipseRect = QRectF(p1, p2).normalized(); QRect clip = clipRect().adjusted(-mainPen().widthF(), -mainPen().widthF(), mainPen().widthF(), mainPen().widthF()); if (ellipseRect.intersects(clip)) // only draw if bounding rect of ellipse is visible in cliprect { painter->setPen(mainPen()); painter->setBrush(mainBrush()); #ifdef __EXCEPTIONS try // drawEllipse sometimes throws exceptions if ellipse is too big { #endif painter->drawEllipse(ellipseRect); #ifdef __EXCEPTIONS } catch (...) { qDebug() << Q_FUNC_INFO << "Item too large for memory, setting invisible"; setVisible(false); } #endif } } /* inherits documentation from base class */ QPointF QCPItemEllipse::anchorPixelPosition(int anchorId) const { QRectF rect = QRectF(topLeft->pixelPosition(), bottomRight->pixelPosition()); switch (anchorId) { case aiTopLeftRim: return rect.center()+(rect.topLeft()-rect.center())*1/qSqrt(2); case aiTop: return (rect.topLeft()+rect.topRight())*0.5; case aiTopRightRim: return rect.center()+(rect.topRight()-rect.center())*1/qSqrt(2); case aiRight: return (rect.topRight()+rect.bottomRight())*0.5; case aiBottomRightRim: return rect.center()+(rect.bottomRight()-rect.center())*1/qSqrt(2); case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5; case aiBottomLeftRim: return rect.center()+(rect.bottomLeft()-rect.center())*1/qSqrt(2); case aiLeft: return (rect.topLeft()+rect.bottomLeft())*0.5; case aiCenter: return (rect.topLeft()+rect.bottomRight())*0.5; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; return QPointF(); } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemEllipse::mainPen() const { return mSelected ? mSelectedPen : mPen; } /*! \internal Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is. */ QBrush QCPItemEllipse::mainBrush() const { return mSelected ? mSelectedBrush : mBrush; } /* end of 'src/items/item-ellipse.cpp' */ /* including file 'src/items/item-pixmap.cpp', size 10615 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemPixmap //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemPixmap \brief An arbitrary pixmap \image html QCPItemPixmap.png "Pixmap example. Blue dotted circles are anchors, solid blue discs are positions." It has two positions, \a topLeft and \a bottomRight, which define the rectangle the pixmap will be drawn in. Depending on the scale setting (\ref setScaled), the pixmap will be either scaled to fit the rectangle or be drawn aligned to the topLeft position. If scaling is enabled and \a topLeft is further to the bottom/right than \a bottomRight (as shown on the right side of the example image), the pixmap will be flipped in the respective orientations. */ /*! Creates a rectangle item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemPixmap::QCPItemPixmap(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), topLeft(createPosition(QLatin1String("topLeft"))), bottomRight(createPosition(QLatin1String("bottomRight"))), top(createAnchor(QLatin1String("top"), aiTop)), topRight(createAnchor(QLatin1String("topRight"), aiTopRight)), right(createAnchor(QLatin1String("right"), aiRight)), bottom(createAnchor(QLatin1String("bottom"), aiBottom)), bottomLeft(createAnchor(QLatin1String("bottomLeft"), aiBottomLeft)), left(createAnchor(QLatin1String("left"), aiLeft)), mScaled(false), mScaledPixmapInvalidated(true), mAspectRatioMode(Qt::KeepAspectRatio), mTransformationMode(Qt::SmoothTransformation) { topLeft->setCoords(0, 1); bottomRight->setCoords(1, 0); setPen(Qt::NoPen); setSelectedPen(QPen(Qt::blue)); } QCPItemPixmap::~QCPItemPixmap() { } /*! Sets the pixmap that will be displayed. */ void QCPItemPixmap::setPixmap(const QPixmap &pixmap) { mPixmap = pixmap; mScaledPixmapInvalidated = true; if (mPixmap.isNull()) qDebug() << Q_FUNC_INFO << "pixmap is null"; } /*! Sets whether the pixmap will be scaled to fit the rectangle defined by the \a topLeft and \a bottomRight positions. */ void QCPItemPixmap::setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformationMode) { mScaled = scaled; mAspectRatioMode = aspectRatioMode; mTransformationMode = transformationMode; mScaledPixmapInvalidated = true; } /*! Sets the pen that will be used to draw a border around the pixmap. \see setSelectedPen, setBrush */ void QCPItemPixmap::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw a border around the pixmap when selected \see setPen, setSelected */ void QCPItemPixmap::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /* inherits documentation from base class */ double QCPItemPixmap::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; return rectDistance(getFinalRect(), pos, true); } /* inherits documentation from base class */ void QCPItemPixmap::draw(QCPPainter *painter) { bool flipHorz = false; bool flipVert = false; QRect rect = getFinalRect(&flipHorz, &flipVert); double clipPad = mainPen().style() == Qt::NoPen ? 0 : mainPen().widthF(); QRect boundingRect = rect.adjusted(-clipPad, -clipPad, clipPad, clipPad); if (boundingRect.intersects(clipRect())) { updateScaledPixmap(rect, flipHorz, flipVert); painter->drawPixmap(rect.topLeft(), mScaled ? mScaledPixmap : mPixmap); QPen pen = mainPen(); if (pen.style() != Qt::NoPen) { painter->setPen(pen); painter->setBrush(Qt::NoBrush); painter->drawRect(rect); } } } /* inherits documentation from base class */ QPointF QCPItemPixmap::anchorPixelPosition(int anchorId) const { bool flipHorz; bool flipVert; QRect rect = getFinalRect(&flipHorz, &flipVert); // we actually want denormal rects (negative width/height) here, so restore // the flipped state: if (flipHorz) rect.adjust(rect.width(), 0, -rect.width(), 0); if (flipVert) rect.adjust(0, rect.height(), 0, -rect.height()); switch (anchorId) { case aiTop: return (rect.topLeft()+rect.topRight())*0.5; case aiTopRight: return rect.topRight(); case aiRight: return (rect.topRight()+rect.bottomRight())*0.5; case aiBottom: return (rect.bottomLeft()+rect.bottomRight())*0.5; case aiBottomLeft: return rect.bottomLeft(); case aiLeft: return (rect.topLeft()+rect.bottomLeft())*0.5;; } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; return QPointF(); } /*! \internal Creates the buffered scaled image (\a mScaledPixmap) to fit the specified \a finalRect. The parameters \a flipHorz and \a flipVert control whether the resulting image shall be flipped horizontally or vertically. (This is used when \a topLeft is further to the bottom/right than \a bottomRight.) This function only creates the scaled pixmap when the buffered pixmap has a different size than the expected result, so calling this function repeatedly, e.g. in the \ref draw function, does not cause expensive rescaling every time. If scaling is disabled, sets mScaledPixmap to a null QPixmap. */ void QCPItemPixmap::updateScaledPixmap(QRect finalRect, bool flipHorz, bool flipVert) { if (mPixmap.isNull()) return; if (mScaled) { #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED double devicePixelRatio = mPixmap.devicePixelRatio(); #else double devicePixelRatio = 1.0; #endif if (finalRect.isNull()) finalRect = getFinalRect(&flipHorz, &flipVert); if (mScaledPixmapInvalidated || finalRect.size() != mScaledPixmap.size()/devicePixelRatio) { mScaledPixmap = mPixmap.scaled(finalRect.size()*devicePixelRatio, mAspectRatioMode, mTransformationMode); if (flipHorz || flipVert) mScaledPixmap = QPixmap::fromImage(mScaledPixmap.toImage().mirrored(flipHorz, flipVert)); #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED mScaledPixmap.setDevicePixelRatio(devicePixelRatio); #endif } } else if (!mScaledPixmap.isNull()) mScaledPixmap = QPixmap(); mScaledPixmapInvalidated = false; } /*! \internal Returns the final (tight) rect the pixmap is drawn in, depending on the current item positions and scaling settings. The output parameters \a flippedHorz and \a flippedVert return whether the pixmap should be drawn flipped horizontally or vertically in the returned rect. (The returned rect itself is always normalized, i.e. the top left corner of the rect is actually further to the top/left than the bottom right corner). This is the case when the item position \a topLeft is further to the bottom/right than \a bottomRight. If scaling is disabled, returns a rect with size of the original pixmap and the top left corner aligned with the item position \a topLeft. The position \a bottomRight is ignored. */ QRect QCPItemPixmap::getFinalRect(bool *flippedHorz, bool *flippedVert) const { QRect result; bool flipHorz = false; bool flipVert = false; QPoint p1 = topLeft->pixelPosition().toPoint(); QPoint p2 = bottomRight->pixelPosition().toPoint(); if (p1 == p2) return QRect(p1, QSize(0, 0)); if (mScaled) { QSize newSize = QSize(p2.x()-p1.x(), p2.y()-p1.y()); QPoint topLeft = p1; if (newSize.width() < 0) { flipHorz = true; newSize.rwidth() *= -1; topLeft.setX(p2.x()); } if (newSize.height() < 0) { flipVert = true; newSize.rheight() *= -1; topLeft.setY(p2.y()); } QSize scaledSize = mPixmap.size(); #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED scaledSize /= mPixmap.devicePixelRatio(); scaledSize.scale(newSize*mPixmap.devicePixelRatio(), mAspectRatioMode); #else scaledSize.scale(newSize, mAspectRatioMode); #endif result = QRect(topLeft, scaledSize); } else { #ifdef QCP_DEVICEPIXELRATIO_SUPPORTED result = QRect(p1, mPixmap.size()/mPixmap.devicePixelRatio()); #else result = QRect(p1, mPixmap.size()); #endif } if (flippedHorz) *flippedHorz = flipHorz; if (flippedVert) *flippedVert = flipVert; return result; } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemPixmap::mainPen() const { return mSelected ? mSelectedPen : mPen; } /* end of 'src/items/item-pixmap.cpp' */ /* including file 'src/items/item-tracer.cpp', size 14624 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemTracer //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemTracer \brief Item that sticks to QCPGraph data points \image html QCPItemTracer.png "Tracer example. Blue dotted circles are anchors, solid blue discs are positions." The tracer can be connected with a QCPGraph via \ref setGraph. Then it will automatically adopt the coordinate axes of the graph and update its \a position to be on the graph's data. This means the key stays controllable via \ref setGraphKey, but the value will follow the graph data. If a QCPGraph is connected, note that setting the coordinates of the tracer item directly via \a position will have no effect because they will be overriden in the next redraw (this is when the coordinate update happens). If the specified key in \ref setGraphKey is outside the key bounds of the graph, the tracer will stay at the corresponding end of the graph. With \ref setInterpolating you may specify whether the tracer may only stay exactly on data points or whether it interpolates data points linearly, if given a key that lies between two data points of the graph. The tracer has different visual styles, see \ref setStyle. It is also possible to make the tracer have no own visual appearance (set the style to \ref tsNone), and just connect other item positions to the tracer \a position (used as an anchor) via \ref QCPItemPosition::setParentAnchor. \note The tracer position is only automatically updated upon redraws. So when the data of the graph changes and immediately afterwards (without a redraw) the position coordinates of the tracer are retrieved, they will not reflect the updated data of the graph. In this case \ref updatePosition must be called manually, prior to reading the tracer coordinates. */ /*! Creates a tracer item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemTracer::QCPItemTracer(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), position(createPosition(QLatin1String("position"))), mSize(6), mStyle(tsCrosshair), mGraph(0), mGraphKey(0), mInterpolating(false) { position->setCoords(0, 0); setBrush(Qt::NoBrush); setSelectedBrush(Qt::NoBrush); setPen(QPen(Qt::black)); setSelectedPen(QPen(Qt::blue, 2)); } QCPItemTracer::~QCPItemTracer() { } /*! Sets the pen that will be used to draw the line of the tracer \see setSelectedPen, setBrush */ void QCPItemTracer::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw the line of the tracer when selected \see setPen, setSelected */ void QCPItemTracer::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /*! Sets the brush that will be used to draw any fills of the tracer \see setSelectedBrush, setPen */ void QCPItemTracer::setBrush(const QBrush &brush) { mBrush = brush; } /*! Sets the brush that will be used to draw any fills of the tracer, when selected. \see setBrush, setSelected */ void QCPItemTracer::setSelectedBrush(const QBrush &brush) { mSelectedBrush = brush; } /*! Sets the size of the tracer in pixels, if the style supports setting a size (e.g. \ref tsSquare does, \ref tsCrosshair does not). */ void QCPItemTracer::setSize(double size) { mSize = size; } /*! Sets the style/visual appearance of the tracer. If you only want to use the tracer \a position as an anchor for other items, set \a style to \ref tsNone. */ void QCPItemTracer::setStyle(QCPItemTracer::TracerStyle style) { mStyle = style; } /*! Sets the QCPGraph this tracer sticks to. The tracer \a position will be set to type QCPItemPosition::ptPlotCoords and the axes will be set to the axes of \a graph. To free the tracer from any graph, set \a graph to 0. The tracer \a position can then be placed freely like any other item position. This is the state the tracer will assume when its graph gets deleted while still attached to it. \see setGraphKey */ void QCPItemTracer::setGraph(QCPGraph *graph) { if (graph) { if (graph->parentPlot() == mParentPlot) { position->setType(QCPItemPosition::ptPlotCoords); position->setAxes(graph->keyAxis(), graph->valueAxis()); mGraph = graph; updatePosition(); } else qDebug() << Q_FUNC_INFO << "graph isn't in same QCustomPlot instance as this item"; } else { mGraph = 0; } } /*! Sets the key of the graph's data point the tracer will be positioned at. This is the only free coordinate of a tracer when attached to a graph. Depending on \ref setInterpolating, the tracer will be either positioned on the data point closest to \a key, or will stay exactly at \a key and interpolate the value linearly. \see setGraph, setInterpolating */ void QCPItemTracer::setGraphKey(double key) { mGraphKey = key; } /*! Sets whether the value of the graph's data points shall be interpolated, when positioning the tracer. If \a enabled is set to false and a key is given with \ref setGraphKey, the tracer is placed on the data point of the graph which is closest to the key, but which is not necessarily exactly there. If \a enabled is true, the tracer will be positioned exactly at the specified key, and the appropriate value will be interpolated from the graph's data points linearly. \see setGraph, setGraphKey */ void QCPItemTracer::setInterpolating(bool enabled) { mInterpolating = enabled; } /* inherits documentation from base class */ double QCPItemTracer::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; QPointF center(position->pixelPosition()); double w = mSize/2.0; QRect clip = clipRect(); switch (mStyle) { case tsNone: return -1; case tsPlus: { if (clipRect().intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect())) return qSqrt(qMin(QCPVector2D(pos).distanceSquaredToLine(center+QPointF(-w, 0), center+QPointF(w, 0)), QCPVector2D(pos).distanceSquaredToLine(center+QPointF(0, -w), center+QPointF(0, w)))); break; } case tsCrosshair: { return qSqrt(qMin(QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(clip.left(), center.y()), QCPVector2D(clip.right(), center.y())), QCPVector2D(pos).distanceSquaredToLine(QCPVector2D(center.x(), clip.top()), QCPVector2D(center.x(), clip.bottom())))); } case tsCircle: { if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect())) { // distance to border: double centerDist = QCPVector2D(center-pos).length(); double circleLine = w; double result = qAbs(centerDist-circleLine); // filled ellipse, allow click inside to count as hit: if (result > mParentPlot->selectionTolerance()*0.99 && mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0) { if (centerDist <= circleLine) result = mParentPlot->selectionTolerance()*0.99; } return result; } break; } case tsSquare: { if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect())) { QRectF rect = QRectF(center-QPointF(w, w), center+QPointF(w, w)); bool filledRect = mBrush.style() != Qt::NoBrush && mBrush.color().alpha() != 0; return rectDistance(rect, pos, filledRect); } break; } } return -1; } /* inherits documentation from base class */ void QCPItemTracer::draw(QCPPainter *painter) { updatePosition(); if (mStyle == tsNone) return; painter->setPen(mainPen()); painter->setBrush(mainBrush()); QPointF center(position->pixelPosition()); double w = mSize/2.0; QRect clip = clipRect(); switch (mStyle) { case tsNone: return; case tsPlus: { if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect())) { painter->drawLine(QLineF(center+QPointF(-w, 0), center+QPointF(w, 0))); painter->drawLine(QLineF(center+QPointF(0, -w), center+QPointF(0, w))); } break; } case tsCrosshair: { if (center.y() > clip.top() && center.y() < clip.bottom()) painter->drawLine(QLineF(clip.left(), center.y(), clip.right(), center.y())); if (center.x() > clip.left() && center.x() < clip.right()) painter->drawLine(QLineF(center.x(), clip.top(), center.x(), clip.bottom())); break; } case tsCircle: { if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect())) painter->drawEllipse(center, w, w); break; } case tsSquare: { if (clip.intersects(QRectF(center-QPointF(w, w), center+QPointF(w, w)).toRect())) painter->drawRect(QRectF(center-QPointF(w, w), center+QPointF(w, w))); break; } } } /*! If the tracer is connected with a graph (\ref setGraph), this function updates the tracer's \a position to reside on the graph data, depending on the configured key (\ref setGraphKey). It is called automatically on every redraw and normally doesn't need to be called manually. One exception is when you want to read the tracer coordinates via \a position and are not sure that the graph's data (or the tracer key with \ref setGraphKey) hasn't changed since the last redraw. In that situation, call this function before accessing \a position, to make sure you don't get out-of-date coordinates. If there is no graph set on this tracer, this function does nothing. */ void QCPItemTracer::updatePosition() { if (mGraph) { if (mParentPlot->hasPlottable(mGraph)) { if (mGraph->data()->size() > 1) { QCPGraphDataContainer::const_iterator first = mGraph->data()->constBegin(); QCPGraphDataContainer::const_iterator last = mGraph->data()->constEnd()-1; if (mGraphKey <= first->key) position->setCoords(first->key, first->value); else if (mGraphKey >= last->key) position->setCoords(last->key, last->value); else { QCPGraphDataContainer::const_iterator it = mGraph->data()->findBegin(mGraphKey); if (it != mGraph->data()->constEnd()) // mGraphKey is not exactly on last iterator, but somewhere between iterators { QCPGraphDataContainer::const_iterator prevIt = it; ++it; // won't advance to constEnd because we handled that case (mGraphKey >= last->key) before if (mInterpolating) { // interpolate between iterators around mGraphKey: double slope = 0; if (!qFuzzyCompare((double)it->key, (double)prevIt->key)) slope = (it->value-prevIt->value)/(it->key-prevIt->key); position->setCoords(mGraphKey, (mGraphKey-prevIt->key)*slope+prevIt->value); } else { // find iterator with key closest to mGraphKey: if (mGraphKey < (prevIt->key+it->key)*0.5) position->setCoords(prevIt->key, prevIt->value); else position->setCoords(it->key, it->value); } } else // mGraphKey is exactly on last iterator (should actually be caught when comparing first/last keys, but this is a failsafe for fp uncertainty) position->setCoords(it->key, it->value); } } else if (mGraph->data()->size() == 1) { QCPGraphDataContainer::const_iterator it = mGraph->data()->constBegin(); position->setCoords(it->key, it->value); } else qDebug() << Q_FUNC_INFO << "graph has no data"; } else qDebug() << Q_FUNC_INFO << "graph not contained in QCustomPlot instance (anymore)"; } } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemTracer::mainPen() const { return mSelected ? mSelectedPen : mPen; } /*! \internal Returns the brush that should be used for drawing fills of the item. Returns mBrush when the item is not selected and mSelectedBrush when it is. */ QBrush QCPItemTracer::mainBrush() const { return mSelected ? mSelectedBrush : mBrush; } /* end of 'src/items/item-tracer.cpp' */ /* including file 'src/items/item-bracket.cpp', size 10687 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPItemBracket //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPItemBracket \brief A bracket for referencing/highlighting certain parts in the plot. \image html QCPItemBracket.png "Bracket example. Blue dotted circles are anchors, solid blue discs are positions." It has two positions, \a left and \a right, which define the span of the bracket. If \a left is actually farther to the left than \a right, the bracket is opened to the bottom, as shown in the example image. The bracket supports multiple styles via \ref setStyle. The length, i.e. how far the bracket stretches away from the embraced span, can be controlled with \ref setLength. \image html QCPItemBracket-length.png
Demonstrating the effect of different values for \ref setLength, for styles \ref bsCalligraphic and \ref bsSquare. Anchors and positions are displayed for reference.
It provides an anchor \a center, to allow connection of other items, e.g. an arrow (QCPItemLine or QCPItemCurve) or a text label (QCPItemText), to the bracket. */ /*! Creates a bracket item and sets default values. The created item is automatically registered with \a parentPlot. This QCustomPlot instance takes ownership of the item, so do not delete it manually but use QCustomPlot::removeItem() instead. */ QCPItemBracket::QCPItemBracket(QCustomPlot *parentPlot) : QCPAbstractItem(parentPlot), left(createPosition(QLatin1String("left"))), right(createPosition(QLatin1String("right"))), center(createAnchor(QLatin1String("center"), aiCenter)), mLength(8), mStyle(bsCalligraphic) { left->setCoords(0, 0); right->setCoords(1, 1); setPen(QPen(Qt::black)); setSelectedPen(QPen(Qt::blue, 2)); } QCPItemBracket::~QCPItemBracket() { } /*! Sets the pen that will be used to draw the bracket. Note that when the style is \ref bsCalligraphic, only the color will be taken from the pen, the stroke and width are ignored. To change the apparent stroke width of a calligraphic bracket, use \ref setLength, which has a similar effect. \see setSelectedPen */ void QCPItemBracket::setPen(const QPen &pen) { mPen = pen; } /*! Sets the pen that will be used to draw the bracket when selected \see setPen, setSelected */ void QCPItemBracket::setSelectedPen(const QPen &pen) { mSelectedPen = pen; } /*! Sets the \a length in pixels how far the bracket extends in the direction towards the embraced span of the bracket (i.e. perpendicular to the left-right-direction) \image html QCPItemBracket-length.png
Demonstrating the effect of different values for \ref setLength, for styles \ref bsCalligraphic and \ref bsSquare. Anchors and positions are displayed for reference.
*/ void QCPItemBracket::setLength(double length) { mLength = length; } /*! Sets the style of the bracket, i.e. the shape/visual appearance. \see setPen */ void QCPItemBracket::setStyle(QCPItemBracket::BracketStyle style) { mStyle = style; } /* inherits documentation from base class */ double QCPItemBracket::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { Q_UNUSED(details) if (onlySelectable && !mSelectable) return -1; QCPVector2D p(pos); QCPVector2D leftVec(left->pixelPosition()); QCPVector2D rightVec(right->pixelPosition()); if (leftVec.toPoint() == rightVec.toPoint()) return -1; QCPVector2D widthVec = (rightVec-leftVec)*0.5; QCPVector2D lengthVec = widthVec.perpendicular().normalized()*mLength; QCPVector2D centerVec = (rightVec+leftVec)*0.5-lengthVec; switch (mStyle) { case QCPItemBracket::bsSquare: case QCPItemBracket::bsRound: { double a = p.distanceSquaredToLine(centerVec-widthVec, centerVec+widthVec); double b = p.distanceSquaredToLine(centerVec-widthVec+lengthVec, centerVec-widthVec); double c = p.distanceSquaredToLine(centerVec+widthVec+lengthVec, centerVec+widthVec); return qSqrt(qMin(qMin(a, b), c)); } case QCPItemBracket::bsCurly: case QCPItemBracket::bsCalligraphic: { double a = p.distanceSquaredToLine(centerVec-widthVec*0.75+lengthVec*0.15, centerVec+lengthVec*0.3); double b = p.distanceSquaredToLine(centerVec-widthVec+lengthVec*0.7, centerVec-widthVec*0.75+lengthVec*0.15); double c = p.distanceSquaredToLine(centerVec+widthVec*0.75+lengthVec*0.15, centerVec+lengthVec*0.3); double d = p.distanceSquaredToLine(centerVec+widthVec+lengthVec*0.7, centerVec+widthVec*0.75+lengthVec*0.15); return qSqrt(qMin(qMin(a, b), qMin(c, d))); } } return -1; } /* inherits documentation from base class */ void QCPItemBracket::draw(QCPPainter *painter) { QCPVector2D leftVec(left->pixelPosition()); QCPVector2D rightVec(right->pixelPosition()); if (leftVec.toPoint() == rightVec.toPoint()) return; QCPVector2D widthVec = (rightVec-leftVec)*0.5; QCPVector2D lengthVec = widthVec.perpendicular().normalized()*mLength; QCPVector2D centerVec = (rightVec+leftVec)*0.5-lengthVec; QPolygon boundingPoly; boundingPoly << leftVec.toPoint() << rightVec.toPoint() << (rightVec-lengthVec).toPoint() << (leftVec-lengthVec).toPoint(); QRect clip = clipRect().adjusted(-mainPen().widthF(), -mainPen().widthF(), mainPen().widthF(), mainPen().widthF()); if (clip.intersects(boundingPoly.boundingRect())) { painter->setPen(mainPen()); switch (mStyle) { case bsSquare: { painter->drawLine((centerVec+widthVec).toPointF(), (centerVec-widthVec).toPointF()); painter->drawLine((centerVec+widthVec).toPointF(), (centerVec+widthVec+lengthVec).toPointF()); painter->drawLine((centerVec-widthVec).toPointF(), (centerVec-widthVec+lengthVec).toPointF()); break; } case bsRound: { painter->setBrush(Qt::NoBrush); QPainterPath path; path.moveTo((centerVec+widthVec+lengthVec).toPointF()); path.cubicTo((centerVec+widthVec).toPointF(), (centerVec+widthVec).toPointF(), centerVec.toPointF()); path.cubicTo((centerVec-widthVec).toPointF(), (centerVec-widthVec).toPointF(), (centerVec-widthVec+lengthVec).toPointF()); painter->drawPath(path); break; } case bsCurly: { painter->setBrush(Qt::NoBrush); QPainterPath path; path.moveTo((centerVec+widthVec+lengthVec).toPointF()); path.cubicTo((centerVec+widthVec-lengthVec*0.8).toPointF(), (centerVec+0.4*widthVec+lengthVec).toPointF(), centerVec.toPointF()); path.cubicTo((centerVec-0.4*widthVec+lengthVec).toPointF(), (centerVec-widthVec-lengthVec*0.8).toPointF(), (centerVec-widthVec+lengthVec).toPointF()); painter->drawPath(path); break; } case bsCalligraphic: { painter->setPen(Qt::NoPen); painter->setBrush(QBrush(mainPen().color())); QPainterPath path; path.moveTo((centerVec+widthVec+lengthVec).toPointF()); path.cubicTo((centerVec+widthVec-lengthVec*0.8).toPointF(), (centerVec+0.4*widthVec+0.8*lengthVec).toPointF(), centerVec.toPointF()); path.cubicTo((centerVec-0.4*widthVec+0.8*lengthVec).toPointF(), (centerVec-widthVec-lengthVec*0.8).toPointF(), (centerVec-widthVec+lengthVec).toPointF()); path.cubicTo((centerVec-widthVec-lengthVec*0.5).toPointF(), (centerVec-0.2*widthVec+1.2*lengthVec).toPointF(), (centerVec+lengthVec*0.2).toPointF()); path.cubicTo((centerVec+0.2*widthVec+1.2*lengthVec).toPointF(), (centerVec+widthVec-lengthVec*0.5).toPointF(), (centerVec+widthVec+lengthVec).toPointF()); painter->drawPath(path); break; } } } } /* inherits documentation from base class */ QPointF QCPItemBracket::anchorPixelPosition(int anchorId) const { QCPVector2D leftVec(left->pixelPosition()); QCPVector2D rightVec(right->pixelPosition()); if (leftVec.toPoint() == rightVec.toPoint()) return leftVec.toPointF(); QCPVector2D widthVec = (rightVec-leftVec)*0.5; QCPVector2D lengthVec = widthVec.perpendicular().normalized()*mLength; QCPVector2D centerVec = (rightVec+leftVec)*0.5-lengthVec; switch (anchorId) { case aiCenter: return centerVec.toPointF(); } qDebug() << Q_FUNC_INFO << "invalid anchorId" << anchorId; return QPointF(); } /*! \internal Returns the pen that should be used for drawing lines. Returns mPen when the item is not selected and mSelectedPen when it is. */ QPen QCPItemBracket::mainPen() const { return mSelected ? mSelectedPen : mPen; } /* end of 'src/items/item-bracket.cpp' */ sqlitebrowser-3.10.1/libs/qcustomplot-source/qcustomplot.h000066400000000000000000010032361316047212700240750ustar00rootroot00000000000000/*************************************************************************** ** ** ** QCustomPlot, an easy to use, modern plotting widget for Qt ** ** Copyright (C) 2011-2016 Emanuel Eichhammer ** ** ** ** 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 http://www.gnu.org/licenses/. ** ** ** **************************************************************************** ** Author: Emanuel Eichhammer ** ** Website/Contact: http://www.qcustomplot.com/ ** ** Date: 13.09.16 ** ** Version: 2.0.0-beta ** ****************************************************************************/ #ifndef QCUSTOMPLOT_H #define QCUSTOMPLOT_H #include // some Qt version/configuration dependent macros to include or exclude certain code paths: #ifdef QCUSTOMPLOT_USE_OPENGL # if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) # define QCP_OPENGL_PBUFFER # else # define QCP_OPENGL_FBO # endif # if QT_VERSION >= QT_VERSION_CHECK(5, 3, 0) # define QCP_OPENGL_OFFSCREENSURFACE # endif #endif #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0) #define QCP_DEVICEPIXELRATIO_SUPPORTED #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef QCP_OPENGL_FBO # include # include # ifdef QCP_OPENGL_OFFSCREENSURFACE # include # else # include # endif #endif #ifdef QCP_OPENGL_PBUFFER # include #endif #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) # include # include # include # include #else # include # include # include #endif class QCPPainter; class QCustomPlot; class QCPLayerable; class QCPLayoutElement; class QCPLayout; class QCPAxis; class QCPAxisRect; class QCPAxisPainterPrivate; class QCPAbstractPlottable; class QCPGraph; class QCPAbstractItem; class QCPPlottableInterface1D; class QCPLegend; class QCPItemPosition; class QCPLayer; class QCPAbstractLegendItem; class QCPSelectionRect; class QCPColorMap; class QCPColorScale; class QCPBars; /* including file 'src/global.h', size 16131 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ // decl definitions for shared library compilation/usage: #if defined(QCUSTOMPLOT_COMPILE_LIBRARY) # define QCP_LIB_DECL Q_DECL_EXPORT #elif defined(QCUSTOMPLOT_USE_LIBRARY) # define QCP_LIB_DECL Q_DECL_IMPORT #else # define QCP_LIB_DECL #endif // define empty macro for Q_DECL_OVERRIDE if it doesn't exist (Qt < 5) #ifndef Q_DECL_OVERRIDE # define Q_DECL_OVERRIDE #endif /*! The QCP Namespace contains general enums, QFlags and functions used throughout the QCustomPlot library. It provides QMetaObject-based reflection of its enums and flags via \a QCP::staticMetaObject. */ #ifndef Q_MOC_RUN namespace QCP { #else class QCP { // when in moc-run, make it look like a class, so we get Q_GADGET, Q_ENUMS/Q_FLAGS features in namespace Q_GADGET Q_ENUMS(ExportPen) Q_ENUMS(ResolutionUnit) Q_ENUMS(SignDomain) Q_ENUMS(MarginSide) Q_FLAGS(MarginSides) Q_ENUMS(AntialiasedElement) Q_FLAGS(AntialiasedElements) Q_ENUMS(PlottingHint) Q_FLAGS(PlottingHints) Q_ENUMS(Interaction) Q_FLAGS(Interactions) Q_ENUMS(SelectionRectMode) Q_ENUMS(SelectionType) public: #endif /*! Defines the different units in which the image resolution can be specified in the export functions. \see QCustomPlot::savePng, QCustomPlot::saveJpg, QCustomPlot::saveBmp, QCustomPlot::saveRastered */ enum ResolutionUnit { ruDotsPerMeter ///< Resolution is given in dots per meter (dpm) ,ruDotsPerCentimeter ///< Resolution is given in dots per centimeter (dpcm) ,ruDotsPerInch ///< Resolution is given in dots per inch (DPI/PPI) }; /*! Defines how cosmetic pens (pens with numerical width 0) are handled during export. \see QCustomPlot::savePdf */ enum ExportPen { epNoCosmetic ///< Cosmetic pens are converted to pens with pixel width 1 when exporting ,epAllowCosmetic ///< Cosmetic pens are exported normally (e.g. in PDF exports, cosmetic pens always appear as 1 pixel on screen, independent of viewer zoom level) }; /*! Represents negative and positive sign domain, e.g. for passing to \ref QCPAbstractPlottable::getKeyRange and \ref QCPAbstractPlottable::getValueRange. This is primarily needed when working with logarithmic axis scales, since only one of the sign domains can be visible at a time. */ enum SignDomain { sdNegative ///< The negative sign domain, i.e. numbers smaller than zero ,sdBoth ///< Both sign domains, including zero, i.e. all numbers ,sdPositive ///< The positive sign domain, i.e. numbers greater than zero }; /*! Defines the sides of a rectangular entity to which margins can be applied. \see QCPLayoutElement::setAutoMargins, QCPAxisRect::setAutoMargins */ enum MarginSide { msLeft = 0x01 ///< 0x01 left margin ,msRight = 0x02 ///< 0x02 right margin ,msTop = 0x04 ///< 0x04 top margin ,msBottom = 0x08 ///< 0x08 bottom margin ,msAll = 0xFF ///< 0xFF all margins ,msNone = 0x00 ///< 0x00 no margin }; Q_DECLARE_FLAGS(MarginSides, MarginSide) /*! Defines what objects of a plot can be forcibly drawn antialiased/not antialiased. If an object is neither forcibly drawn antialiased nor forcibly drawn not antialiased, it is up to the respective element how it is drawn. Typically it provides a \a setAntialiased function for this. \c AntialiasedElements is a flag of or-combined elements of this enum type. \see QCustomPlot::setAntialiasedElements, QCustomPlot::setNotAntialiasedElements */ enum AntialiasedElement { aeAxes = 0x0001 ///< 0x0001 Axis base line and tick marks ,aeGrid = 0x0002 ///< 0x0002 Grid lines ,aeSubGrid = 0x0004 ///< 0x0004 Sub grid lines ,aeLegend = 0x0008 ///< 0x0008 Legend box ,aeLegendItems = 0x0010 ///< 0x0010 Legend items ,aePlottables = 0x0020 ///< 0x0020 Main lines of plottables ,aeItems = 0x0040 ///< 0x0040 Main lines of items ,aeScatters = 0x0080 ///< 0x0080 Scatter symbols of plottables (excluding scatter symbols of type ssPixmap) ,aeFills = 0x0100 ///< 0x0100 Borders of fills (e.g. under or between graphs) ,aeZeroLine = 0x0200 ///< 0x0200 Zero-lines, see \ref QCPGrid::setZeroLinePen ,aeOther = 0x8000 ///< 0x8000 Other elements that don't fit into any of the existing categories ,aeAll = 0xFFFF ///< 0xFFFF All elements ,aeNone = 0x0000 ///< 0x0000 No elements }; Q_DECLARE_FLAGS(AntialiasedElements, AntialiasedElement) /*! Defines plotting hints that control various aspects of the quality and speed of plotting. \see QCustomPlot::setPlottingHints */ enum PlottingHint { phNone = 0x000 ///< 0x000 No hints are set ,phFastPolylines = 0x001 ///< 0x001 Graph/Curve lines are drawn with a faster method. This reduces the quality especially of the line segment ///< joins, thus is most effective for pen sizes larger than 1. It is only used for solid line pens. ,phImmediateRefresh = 0x002 ///< 0x002 causes an immediate repaint() instead of a soft update() when QCustomPlot::replot() is called with parameter \ref QCustomPlot::rpRefreshHint. ///< This is set by default to prevent the plot from freezing on fast consecutive replots (e.g. user drags ranges with mouse). ,phCacheLabels = 0x004 ///< 0x004 axis (tick) labels will be cached as pixmaps, increasing replot performance. }; Q_DECLARE_FLAGS(PlottingHints, PlottingHint) /*! Defines the mouse interactions possible with QCustomPlot. \c Interactions is a flag of or-combined elements of this enum type. \see QCustomPlot::setInteractions */ enum Interaction { iRangeDrag = 0x001 ///< 0x001 Axis ranges are draggable (see \ref QCPAxisRect::setRangeDrag, \ref QCPAxisRect::setRangeDragAxes) ,iRangeZoom = 0x002 ///< 0x002 Axis ranges are zoomable with the mouse wheel (see \ref QCPAxisRect::setRangeZoom, \ref QCPAxisRect::setRangeZoomAxes) ,iMultiSelect = 0x004 ///< 0x004 The user can select multiple objects by holding the modifier set by \ref QCustomPlot::setMultiSelectModifier while clicking ,iSelectPlottables = 0x008 ///< 0x008 Plottables are selectable (e.g. graphs, curves, bars,... see QCPAbstractPlottable) ,iSelectAxes = 0x010 ///< 0x010 Axes are selectable (or parts of them, see QCPAxis::setSelectableParts) ,iSelectLegend = 0x020 ///< 0x020 Legends are selectable (or their child items, see QCPLegend::setSelectableParts) ,iSelectItems = 0x040 ///< 0x040 Items are selectable (Rectangles, Arrows, Textitems, etc. see \ref QCPAbstractItem) ,iSelectOther = 0x080 ///< 0x080 All other objects are selectable (e.g. your own derived layerables, other layout elements,...) }; Q_DECLARE_FLAGS(Interactions, Interaction) /*! Defines the behaviour of the selection rect. \see QCustomPlot::setSelectionRectMode, QCustomPlot::selectionRect, QCPSelectionRect */ enum SelectionRectMode { srmNone ///< The selection rect is disabled, and all mouse events are forwarded to the underlying objects, e.g. for axis range dragging ,srmZoom ///< When dragging the mouse, a selection rect becomes active. Upon releasing, the axes that are currently set as range zoom axes (\ref QCPAxisRect::setRangeZoomAxes) will have their ranges zoomed accordingly. ,srmSelect ///< When dragging the mouse, a selection rect becomes active. Upon releasing, plottable data points that were within the selection rect are selected, if the plottable's selectability setting permits. (See \ref dataselection "data selection mechanism" for details.) ,srmCustom ///< When dragging the mouse, a selection rect becomes active. It is the programmer's responsibility to connect according slots to the selection rect's signals (e.g. \ref QCPSelectionRect::accepted) in order to process the user interaction. }; /*! Defines the different ways a plottable can be selected. These images show the effect of the different selection types, when the indicated selection rect was dragged:
\image html selectiontype-none.png stNone \image html selectiontype-whole.png stWhole \image html selectiontype-singledata.png stSingleData \image html selectiontype-datarange.png stDataRange \image html selectiontype-multipledataranges.png stMultipleDataRanges
\see QCPAbstractPlottable::setSelectable, QCPDataSelection::enforceType */ enum SelectionType { stNone ///< The plottable is not selectable ,stWhole ///< Selection behaves like \ref stMultipleDataRanges, but if there are any data points selected, the entire plottable is drawn as selected. ,stSingleData ///< One individual data point can be selected at a time ,stDataRange ///< Multiple contiguous data points (a data range) can be selected ,stMultipleDataRanges ///< Any combination of data points/ranges can be selected }; /*! \internal Returns whether the specified \a value is considered an invalid data value for plottables (i.e. is \e nan or \e +/-inf). This function is used to check data validity upon replots, when the compiler flag \c QCUSTOMPLOT_CHECK_DATA is set. */ inline bool isInvalidData(double value) { return qIsNaN(value) || qIsInf(value); } /*! \internal \overload Checks two arguments instead of one. */ inline bool isInvalidData(double value1, double value2) { return isInvalidData(value1) || isInvalidData(value2); } /*! \internal Sets the specified \a side of \a margins to \a value \see getMarginValue */ inline void setMarginValue(QMargins &margins, QCP::MarginSide side, int value) { switch (side) { case QCP::msLeft: margins.setLeft(value); break; case QCP::msRight: margins.setRight(value); break; case QCP::msTop: margins.setTop(value); break; case QCP::msBottom: margins.setBottom(value); break; case QCP::msAll: margins = QMargins(value, value, value, value); break; default: break; } } /*! \internal Returns the value of the specified \a side of \a margins. If \a side is \ref QCP::msNone or \ref QCP::msAll, returns 0. \see setMarginValue */ inline int getMarginValue(const QMargins &margins, QCP::MarginSide side) { switch (side) { case QCP::msLeft: return margins.left(); case QCP::msRight: return margins.right(); case QCP::msTop: return margins.top(); case QCP::msBottom: return margins.bottom(); default: break; } return 0; } extern const QMetaObject staticMetaObject; // in moc-run we create a static meta object for QCP "fake" object. This line is the link to it via QCP::staticMetaObject in normal operation as namespace } // end of namespace QCP Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::AntialiasedElements) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::PlottingHints) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::MarginSides) Q_DECLARE_OPERATORS_FOR_FLAGS(QCP::Interactions) Q_DECLARE_METATYPE(QCP::ExportPen) Q_DECLARE_METATYPE(QCP::ResolutionUnit) Q_DECLARE_METATYPE(QCP::SignDomain) Q_DECLARE_METATYPE(QCP::MarginSide) Q_DECLARE_METATYPE(QCP::AntialiasedElement) Q_DECLARE_METATYPE(QCP::PlottingHint) Q_DECLARE_METATYPE(QCP::Interaction) Q_DECLARE_METATYPE(QCP::SelectionRectMode) Q_DECLARE_METATYPE(QCP::SelectionType) /* end of 'src/global.h' */ /* including file 'src/vector2d.h', size 4928 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPVector2D { public: QCPVector2D(); QCPVector2D(double x, double y); QCPVector2D(const QPoint &point); QCPVector2D(const QPointF &point); // getters: double x() const { return mX; } double y() const { return mY; } double &rx() { return mX; } double &ry() { return mY; } // setters: void setX(double x) { mX = x; } void setY(double y) { mY = y; } // non-virtual methods: double length() const { return qSqrt(mX*mX+mY*mY); } double lengthSquared() const { return mX*mX+mY*mY; } QPoint toPoint() const { return QPoint(mX, mY); } QPointF toPointF() const { return QPointF(mX, mY); } bool isNull() const { return qIsNull(mX) && qIsNull(mY); } void normalize(); QCPVector2D normalized() const; QCPVector2D perpendicular() const { return QCPVector2D(-mY, mX); } double dot(const QCPVector2D &vec) const { return mX*vec.mX+mY*vec.mY; } double distanceSquaredToLine(const QCPVector2D &start, const QCPVector2D &end) const; double distanceSquaredToLine(const QLineF &line) const; double distanceToStraightLine(const QCPVector2D &base, const QCPVector2D &direction) const; QCPVector2D &operator*=(double factor); QCPVector2D &operator/=(double divisor); QCPVector2D &operator+=(const QCPVector2D &vector); QCPVector2D &operator-=(const QCPVector2D &vector); private: // property members: double mX, mY; friend inline const QCPVector2D operator*(double factor, const QCPVector2D &vec); friend inline const QCPVector2D operator*(const QCPVector2D &vec, double factor); friend inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor); friend inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2); friend inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2); friend inline const QCPVector2D operator-(const QCPVector2D &vec); }; Q_DECLARE_TYPEINFO(QCPVector2D, Q_MOVABLE_TYPE); inline const QCPVector2D operator*(double factor, const QCPVector2D &vec) { return QCPVector2D(vec.mX*factor, vec.mY*factor); } inline const QCPVector2D operator*(const QCPVector2D &vec, double factor) { return QCPVector2D(vec.mX*factor, vec.mY*factor); } inline const QCPVector2D operator/(const QCPVector2D &vec, double divisor) { return QCPVector2D(vec.mX/divisor, vec.mY/divisor); } inline const QCPVector2D operator+(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX+vec2.mX, vec1.mY+vec2.mY); } inline const QCPVector2D operator-(const QCPVector2D &vec1, const QCPVector2D &vec2) { return QCPVector2D(vec1.mX-vec2.mX, vec1.mY-vec2.mY); } inline const QCPVector2D operator-(const QCPVector2D &vec) { return QCPVector2D(-vec.mX, -vec.mY); } /*! \relates QCPVector2D Prints \a vec in a human readable format to the qDebug output. */ inline QDebug operator<< (QDebug d, const QCPVector2D &vec) { d.nospace() << "QCPVector2D(" << vec.x() << ", " << vec.y() << ")"; return d.space(); } /* end of 'src/vector2d.h' */ /* including file 'src/painter.h', size 4035 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPPainter : public QPainter { Q_GADGET public: /*! Defines special modes the painter can operate in. They disable or enable certain subsets of features/fixes/workarounds, depending on whether they are wanted on the respective output device. */ enum PainterMode { pmDefault = 0x00 ///< 0x00 Default mode for painting on screen devices ,pmVectorized = 0x01 ///< 0x01 Mode for vectorized painting (e.g. PDF export). For example, this prevents some antialiasing fixes. ,pmNoCaching = 0x02 ///< 0x02 Mode for all sorts of exports (e.g. PNG, PDF,...). For example, this prevents using cached pixmap labels ,pmNonCosmetic = 0x04 ///< 0x04 Turns pen widths 0 to 1, i.e. disables cosmetic pens. (A cosmetic pen is always drawn with width 1 pixel in the vector image/pdf viewer, independent of zoom.) }; Q_ENUMS(PainterMode) Q_FLAGS(PainterModes) Q_DECLARE_FLAGS(PainterModes, PainterMode) QCPPainter(); explicit QCPPainter(QPaintDevice *device); // getters: bool antialiasing() const { return testRenderHint(QPainter::Antialiasing); } PainterModes modes() const { return mModes; } // setters: void setAntialiasing(bool enabled); void setMode(PainterMode mode, bool enabled=true); void setModes(PainterModes modes); // methods hiding non-virtual base class functions (QPainter bug workarounds): bool begin(QPaintDevice *device); void setPen(const QPen &pen); void setPen(const QColor &color); void setPen(Qt::PenStyle penStyle); void drawLine(const QLineF &line); void drawLine(const QPointF &p1, const QPointF &p2) {drawLine(QLineF(p1, p2));} void save(); void restore(); // non-virtual methods: void makeNonCosmetic(); protected: // property members: PainterModes mModes; bool mIsAntialiasing; // non-property members: QStack mAntialiasingStack; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QCPPainter::PainterModes) Q_DECLARE_METATYPE(QCPPainter::PainterMode) /* end of 'src/painter.h' */ /* including file 'src/paintbuffer.h', size 4958 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAbstractPaintBuffer { public: explicit QCPAbstractPaintBuffer(const QSize &size, double devicePixelRatio); virtual ~QCPAbstractPaintBuffer(); // getters: QSize size() const { return mSize; } bool invalidated() const { return mInvalidated; } double devicePixelRatio() const { return mDevicePixelRatio; } // setters: void setSize(const QSize &size); void setInvalidated(bool invalidated=true); void setDevicePixelRatio(double ratio); // introduced virtual methods: virtual QCPPainter *startPainting() = 0; virtual void donePainting() {} virtual void draw(QCPPainter *painter) const = 0; virtual void clear(const QColor &color) = 0; protected: // property members: QSize mSize; double mDevicePixelRatio; // non-property members: bool mInvalidated; // introduced virtual methods: virtual void reallocateBuffer() = 0; }; class QCP_LIB_DECL QCPPaintBufferPixmap : public QCPAbstractPaintBuffer { public: explicit QCPPaintBufferPixmap(const QSize &size, double devicePixelRatio); virtual ~QCPPaintBufferPixmap(); // reimplemented virtual methods: virtual QCPPainter *startPainting() Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE; void clear(const QColor &color) Q_DECL_OVERRIDE; protected: // non-property members: QPixmap mBuffer; // reimplemented virtual methods: virtual void reallocateBuffer() Q_DECL_OVERRIDE; }; #ifdef QCP_OPENGL_PBUFFER class QCP_LIB_DECL QCPPaintBufferGlPbuffer : public QCPAbstractPaintBuffer { public: explicit QCPPaintBufferGlPbuffer(const QSize &size, double devicePixelRatio, int multisamples); virtual ~QCPPaintBufferGlPbuffer(); // reimplemented virtual methods: virtual QCPPainter *startPainting() Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE; void clear(const QColor &color) Q_DECL_OVERRIDE; protected: // non-property members: QGLPixelBuffer *mGlPBuffer; int mMultisamples; // reimplemented virtual methods: virtual void reallocateBuffer() Q_DECL_OVERRIDE; }; #endif // QCP_OPENGL_PBUFFER #ifdef QCP_OPENGL_FBO class QCP_LIB_DECL QCPPaintBufferGlFbo : public QCPAbstractPaintBuffer { public: explicit QCPPaintBufferGlFbo(const QSize &size, double devicePixelRatio, QWeakPointer glContext, QWeakPointer glPaintDevice); virtual ~QCPPaintBufferGlFbo(); // reimplemented virtual methods: virtual QCPPainter *startPainting() Q_DECL_OVERRIDE; virtual void donePainting() Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) const Q_DECL_OVERRIDE; void clear(const QColor &color) Q_DECL_OVERRIDE; protected: // non-property members: QWeakPointer mGlContext; QWeakPointer mGlPaintDevice; QOpenGLFramebufferObject *mGlFrameBuffer; // reimplemented virtual methods: virtual void reallocateBuffer() Q_DECL_OVERRIDE; }; #endif // QCP_OPENGL_FBO /* end of 'src/paintbuffer.h' */ /* including file 'src/layer.h', size 6885 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPLayer : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot) Q_PROPERTY(QString name READ name) Q_PROPERTY(int index READ index) Q_PROPERTY(QList children READ children) Q_PROPERTY(bool visible READ visible WRITE setVisible) Q_PROPERTY(LayerMode mode READ mode WRITE setMode) /// \endcond public: /*! Defines the different rendering modes of a layer. Depending on the mode, certain layers can be replotted individually, without the need to replot (possibly complex) layerables on other layers. \see setMode */ enum LayerMode { lmLogical ///< Layer is used only for rendering order, and shares paint buffer with all other adjacent logical layers. ,lmBuffered ///< Layer has its own paint buffer and may be replotted individually (see \ref replot). }; Q_ENUMS(LayerMode) QCPLayer(QCustomPlot* parentPlot, const QString &layerName); virtual ~QCPLayer(); // getters: QCustomPlot *parentPlot() const { return mParentPlot; } QString name() const { return mName; } int index() const { return mIndex; } QList children() const { return mChildren; } bool visible() const { return mVisible; } LayerMode mode() const { return mMode; } // setters: void setVisible(bool visible); void setMode(LayerMode mode); // non-virtual methods: void replot(); protected: // property members: QCustomPlot *mParentPlot; QString mName; int mIndex; QList mChildren; bool mVisible; LayerMode mMode; // non-property members: QWeakPointer mPaintBuffer; // non-virtual methods: void draw(QCPPainter *painter); void drawToPaintBuffer(); void addChild(QCPLayerable *layerable, bool prepend); void removeChild(QCPLayerable *layerable); private: Q_DISABLE_COPY(QCPLayer) friend class QCustomPlot; friend class QCPLayerable; }; Q_DECLARE_METATYPE(QCPLayer::LayerMode) class QCP_LIB_DECL QCPLayerable : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(bool visible READ visible WRITE setVisible) Q_PROPERTY(QCustomPlot* parentPlot READ parentPlot) Q_PROPERTY(QCPLayerable* parentLayerable READ parentLayerable) Q_PROPERTY(QCPLayer* layer READ layer WRITE setLayer NOTIFY layerChanged) Q_PROPERTY(bool antialiased READ antialiased WRITE setAntialiased) /// \endcond public: QCPLayerable(QCustomPlot *plot, QString targetLayer=QString(), QCPLayerable *parentLayerable=0); virtual ~QCPLayerable(); // getters: bool visible() const { return mVisible; } QCustomPlot *parentPlot() const { return mParentPlot; } QCPLayerable *parentLayerable() const { return mParentLayerable.data(); } QCPLayer *layer() const { return mLayer; } bool antialiased() const { return mAntialiased; } // setters: void setVisible(bool on); Q_SLOT bool setLayer(QCPLayer *layer); bool setLayer(const QString &layerName); void setAntialiased(bool enabled); // introduced virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const; // non-property methods: bool realVisibility() const; signals: void layerChanged(QCPLayer *newLayer); protected: // property members: bool mVisible; QCustomPlot *mParentPlot; QPointer mParentLayerable; QCPLayer *mLayer; bool mAntialiased; // introduced virtual methods: virtual void parentPlotInitialized(QCustomPlot *parentPlot); virtual QCP::Interaction selectionCategory() const; virtual QRect clipRect() const; virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const = 0; virtual void draw(QCPPainter *painter) = 0; // selection events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged); virtual void deselectEvent(bool *selectionStateChanged); // low-level mouse events: virtual void mousePressEvent(QMouseEvent *event, const QVariant &details); virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos); virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos); virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details); virtual void wheelEvent(QWheelEvent *event); // non-property methods: void initializeParentPlot(QCustomPlot *parentPlot); void setParentLayerable(QCPLayerable* parentLayerable); bool moveToLayer(QCPLayer *layer, bool prepend); void applyAntialiasingHint(QCPPainter *painter, bool localAntialiased, QCP::AntialiasedElement overrideElement) const; private: Q_DISABLE_COPY(QCPLayerable) friend class QCustomPlot; friend class QCPLayer; friend class QCPAxisRect; }; /* end of 'src/layer.h' */ /* including file 'src/axis/range.h', size 5280 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPRange { public: double lower, upper; QCPRange(); QCPRange(double lower, double upper); bool operator==(const QCPRange& other) const { return lower == other.lower && upper == other.upper; } bool operator!=(const QCPRange& other) const { return !(*this == other); } QCPRange &operator+=(const double& value) { lower+=value; upper+=value; return *this; } QCPRange &operator-=(const double& value) { lower-=value; upper-=value; return *this; } QCPRange &operator*=(const double& value) { lower*=value; upper*=value; return *this; } QCPRange &operator/=(const double& value) { lower/=value; upper/=value; return *this; } friend inline const QCPRange operator+(const QCPRange&, double); friend inline const QCPRange operator+(double, const QCPRange&); friend inline const QCPRange operator-(const QCPRange& range, double value); friend inline const QCPRange operator*(const QCPRange& range, double value); friend inline const QCPRange operator*(double value, const QCPRange& range); friend inline const QCPRange operator/(const QCPRange& range, double value); double size() const { return upper-lower; } double center() const { return (upper+lower)*0.5; } void normalize() { if (lower > upper) qSwap(lower, upper); } void expand(const QCPRange &otherRange); void expand(double includeCoord); QCPRange expanded(const QCPRange &otherRange) const; QCPRange expanded(double includeCoord) const; QCPRange bounded(double lowerBound, double upperBound) const; QCPRange sanitizedForLogScale() const; QCPRange sanitizedForLinScale() const; bool contains(double value) const { return value >= lower && value <= upper; } static bool validRange(double lower, double upper); static bool validRange(const QCPRange &range); static const double minRange; static const double maxRange; }; Q_DECLARE_TYPEINFO(QCPRange, Q_MOVABLE_TYPE); /*! \relates QCPRange Prints \a range in a human readable format to the qDebug output. */ inline QDebug operator<< (QDebug d, const QCPRange &range) { d.nospace() << "QCPRange(" << range.lower << ", " << range.upper << ")"; return d.space(); } /*! Adds \a value to both boundaries of the range. */ inline const QCPRange operator+(const QCPRange& range, double value) { QCPRange result(range); result += value; return result; } /*! Adds \a value to both boundaries of the range. */ inline const QCPRange operator+(double value, const QCPRange& range) { QCPRange result(range); result += value; return result; } /*! Subtracts \a value from both boundaries of the range. */ inline const QCPRange operator-(const QCPRange& range, double value) { QCPRange result(range); result -= value; return result; } /*! Multiplies both boundaries of the range by \a value. */ inline const QCPRange operator*(const QCPRange& range, double value) { QCPRange result(range); result *= value; return result; } /*! Multiplies both boundaries of the range by \a value. */ inline const QCPRange operator*(double value, const QCPRange& range) { QCPRange result(range); result *= value; return result; } /*! Divides both boundaries of the range by \a value. */ inline const QCPRange operator/(const QCPRange& range, double value) { QCPRange result(range); result /= value; return result; } /* end of 'src/axis/range.h' */ /* including file 'src/selection.h', size 8579 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPDataRange { public: QCPDataRange(); QCPDataRange(int begin, int end); bool operator==(const QCPDataRange& other) const { return mBegin == other.mBegin && mEnd == other.mEnd; } bool operator!=(const QCPDataRange& other) const { return !(*this == other); } // getters: int begin() const { return mBegin; } int end() const { return mEnd; } int size() const { return mEnd-mBegin; } int length() const { return size(); } // setters: void setBegin(int begin) { mBegin = begin; } void setEnd(int end) { mEnd = end; } // non-property methods: bool isValid() const { return (mEnd >= mBegin) && (mBegin >= 0); } bool isEmpty() const { return length() == 0; } QCPDataRange bounded(const QCPDataRange &other) const; QCPDataRange expanded(const QCPDataRange &other) const; QCPDataRange intersection(const QCPDataRange &other) const; QCPDataRange adjusted(int changeBegin, int changeEnd) const { return QCPDataRange(mBegin+changeBegin, mEnd+changeEnd); } bool intersects(const QCPDataRange &other) const; bool contains(const QCPDataRange &other) const; private: // property members: int mBegin, mEnd; }; Q_DECLARE_TYPEINFO(QCPDataRange, Q_MOVABLE_TYPE); class QCP_LIB_DECL QCPDataSelection { public: explicit QCPDataSelection(); explicit QCPDataSelection(const QCPDataRange &range); bool operator==(const QCPDataSelection& other) const; bool operator!=(const QCPDataSelection& other) const { return !(*this == other); } QCPDataSelection &operator+=(const QCPDataSelection& other); QCPDataSelection &operator+=(const QCPDataRange& other); QCPDataSelection &operator-=(const QCPDataSelection& other); QCPDataSelection &operator-=(const QCPDataRange& other); friend inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataSelection& b); friend inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataSelection& b); friend inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataRange& b); friend inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataRange& b); friend inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataSelection& b); friend inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataSelection& b); friend inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataRange& b); friend inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataRange& b); // getters: int dataRangeCount() const { return mDataRanges.size(); } int dataPointCount() const; QCPDataRange dataRange(int index=0) const; QList dataRanges() const { return mDataRanges; } QCPDataRange span() const; // non-property methods: void addDataRange(const QCPDataRange &dataRange, bool simplify=true); void clear(); bool isEmpty() const { return mDataRanges.isEmpty(); } void simplify(); void enforceType(QCP::SelectionType type); bool contains(const QCPDataSelection &other) const; QCPDataSelection intersection(const QCPDataRange &other) const; QCPDataSelection intersection(const QCPDataSelection &other) const; QCPDataSelection inverse(const QCPDataRange &outerRange) const; private: // property members: QList mDataRanges; inline static bool lessThanDataRangeBegin(const QCPDataRange &a, const QCPDataRange &b) { return a.begin() < b.begin(); } }; Q_DECLARE_METATYPE(QCPDataSelection) /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataSelection& b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataSelection& b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataSelection& a, const QCPDataRange& b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points in \a a joined with the data points in \a b. The resulting data selection is already simplified (see \ref QCPDataSelection::simplify). */ inline const QCPDataSelection operator+(const QCPDataRange& a, const QCPDataRange& b) { QCPDataSelection result(a); result += b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataSelection& b) { QCPDataSelection result(a); result -= b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataSelection& b) { QCPDataSelection result(a); result -= b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataSelection& a, const QCPDataRange& b) { QCPDataSelection result(a); result -= b; return result; } /*! Return a \ref QCPDataSelection with the data points which are in \a a but not in \a b. */ inline const QCPDataSelection operator-(const QCPDataRange& a, const QCPDataRange& b) { QCPDataSelection result(a); result -= b; return result; } /*! \relates QCPDataRange Prints \a dataRange in a human readable format to the qDebug output. */ inline QDebug operator<< (QDebug d, const QCPDataRange &dataRange) { d.nospace() << "[" << dataRange.begin() << ".." << dataRange.end()-1 << "]"; return d.space(); } /*! \relates QCPDataSelection Prints \a selection in a human readable format to the qDebug output. */ inline QDebug operator<< (QDebug d, const QCPDataSelection &selection) { d.nospace() << "QCPDataSelection("; for (int i=0; i elements(QCP::MarginSide side) const { return mChildren.value(side); } bool isEmpty() const; void clear(); protected: // non-property members: QCustomPlot *mParentPlot; QHash > mChildren; // introduced virtual methods: virtual int commonMargin(QCP::MarginSide side) const; // non-virtual methods: void addChild(QCP::MarginSide side, QCPLayoutElement *element); void removeChild(QCP::MarginSide side, QCPLayoutElement *element); private: Q_DISABLE_COPY(QCPMarginGroup) friend class QCPLayoutElement; }; class QCP_LIB_DECL QCPLayoutElement : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPLayout* layout READ layout) Q_PROPERTY(QRect rect READ rect) Q_PROPERTY(QRect outerRect READ outerRect WRITE setOuterRect) Q_PROPERTY(QMargins margins READ margins WRITE setMargins) Q_PROPERTY(QMargins minimumMargins READ minimumMargins WRITE setMinimumMargins) Q_PROPERTY(QSize minimumSize READ minimumSize WRITE setMinimumSize) Q_PROPERTY(QSize maximumSize READ maximumSize WRITE setMaximumSize) /// \endcond public: /*! Defines the phases of the update process, that happens just before a replot. At each phase, \ref update is called with the according UpdatePhase value. */ enum UpdatePhase { upPreparation ///< Phase used for any type of preparation that needs to be done before margin calculation and layout ,upMargins ///< Phase in which the margins are calculated and set ,upLayout ///< Final phase in which the layout system places the rects of the elements }; Q_ENUMS(UpdatePhase) explicit QCPLayoutElement(QCustomPlot *parentPlot=0); virtual ~QCPLayoutElement(); // getters: QCPLayout *layout() const { return mParentLayout; } QRect rect() const { return mRect; } QRect outerRect() const { return mOuterRect; } QMargins margins() const { return mMargins; } QMargins minimumMargins() const { return mMinimumMargins; } QCP::MarginSides autoMargins() const { return mAutoMargins; } QSize minimumSize() const { return mMinimumSize; } QSize maximumSize() const { return mMaximumSize; } QCPMarginGroup *marginGroup(QCP::MarginSide side) const { return mMarginGroups.value(side, (QCPMarginGroup*)0); } QHash marginGroups() const { return mMarginGroups; } // setters: void setOuterRect(const QRect &rect); void setMargins(const QMargins &margins); void setMinimumMargins(const QMargins &margins); void setAutoMargins(QCP::MarginSides sides); void setMinimumSize(const QSize &size); void setMinimumSize(int width, int height); void setMaximumSize(const QSize &size); void setMaximumSize(int width, int height); void setMarginGroup(QCP::MarginSides sides, QCPMarginGroup *group); // introduced virtual methods: virtual void update(UpdatePhase phase); virtual QSize minimumSizeHint() const; virtual QSize maximumSizeHint() const; virtual QList elements(bool recursive) const; // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; protected: // property members: QCPLayout *mParentLayout; QSize mMinimumSize, mMaximumSize; QRect mRect, mOuterRect; QMargins mMargins, mMinimumMargins; QCP::MarginSides mAutoMargins; QHash mMarginGroups; // introduced virtual methods: virtual int calculateAutoMargin(QCP::MarginSide side); virtual void layoutChanged(); // reimplemented virtual methods: virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE { Q_UNUSED(painter) } virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE { Q_UNUSED(painter) } virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QCPLayoutElement) friend class QCustomPlot; friend class QCPLayout; friend class QCPMarginGroup; }; Q_DECLARE_METATYPE(QCPLayoutElement::UpdatePhase) class QCP_LIB_DECL QCPLayout : public QCPLayoutElement { Q_OBJECT public: explicit QCPLayout(); // reimplemented virtual methods: virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE; virtual QList elements(bool recursive) const Q_DECL_OVERRIDE; // introduced virtual methods: virtual int elementCount() const = 0; virtual QCPLayoutElement* elementAt(int index) const = 0; virtual QCPLayoutElement* takeAt(int index) = 0; virtual bool take(QCPLayoutElement* element) = 0; virtual void simplify(); // non-virtual methods: bool removeAt(int index); bool remove(QCPLayoutElement* element); void clear(); protected: // introduced virtual methods: virtual void updateLayout(); // non-virtual methods: void sizeConstraintsChanged() const; void adoptElement(QCPLayoutElement *el); void releaseElement(QCPLayoutElement *el); QVector getSectionSizes(QVector maxSizes, QVector minSizes, QVector stretchFactors, int totalSize) const; private: Q_DISABLE_COPY(QCPLayout) friend class QCPLayoutElement; }; class QCP_LIB_DECL QCPLayoutGrid : public QCPLayout { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(int rowCount READ rowCount) Q_PROPERTY(int columnCount READ columnCount) Q_PROPERTY(QList columnStretchFactors READ columnStretchFactors WRITE setColumnStretchFactors) Q_PROPERTY(QList rowStretchFactors READ rowStretchFactors WRITE setRowStretchFactors) Q_PROPERTY(int columnSpacing READ columnSpacing WRITE setColumnSpacing) Q_PROPERTY(int rowSpacing READ rowSpacing WRITE setRowSpacing) Q_PROPERTY(FillOrder fillOrder READ fillOrder WRITE setFillOrder) Q_PROPERTY(int wrap READ wrap WRITE setWrap) /// \endcond public: /*! Defines in which direction the grid is filled when using \ref addElement(QCPLayoutElement*). The column/row at which wrapping into the next row/column occurs can be specified with \ref setWrap. \see setFillOrder */ enum FillOrder { foRowsFirst ///< Rows are filled first, and a new element is wrapped to the next column if the row count would exceed \ref setWrap. ,foColumnsFirst ///< Columns are filled first, and a new element is wrapped to the next row if the column count would exceed \ref setWrap. }; Q_ENUMS(FillOrder) explicit QCPLayoutGrid(); virtual ~QCPLayoutGrid(); // getters: int rowCount() const { return mElements.size(); } int columnCount() const { return mElements.size() > 0 ? mElements.first().size() : 0; } QList columnStretchFactors() const { return mColumnStretchFactors; } QList rowStretchFactors() const { return mRowStretchFactors; } int columnSpacing() const { return mColumnSpacing; } int rowSpacing() const { return mRowSpacing; } int wrap() const { return mWrap; } FillOrder fillOrder() const { return mFillOrder; } // setters: void setColumnStretchFactor(int column, double factor); void setColumnStretchFactors(const QList &factors); void setRowStretchFactor(int row, double factor); void setRowStretchFactors(const QList &factors); void setColumnSpacing(int pixels); void setRowSpacing(int pixels); void setWrap(int count); void setFillOrder(FillOrder order, bool rearrange=true); // reimplemented virtual methods: virtual void updateLayout() Q_DECL_OVERRIDE; virtual int elementCount() const Q_DECL_OVERRIDE { return rowCount()*columnCount(); } virtual QCPLayoutElement* elementAt(int index) const Q_DECL_OVERRIDE; virtual QCPLayoutElement* takeAt(int index) Q_DECL_OVERRIDE; virtual bool take(QCPLayoutElement* element) Q_DECL_OVERRIDE; virtual QList elements(bool recursive) const Q_DECL_OVERRIDE; virtual void simplify() Q_DECL_OVERRIDE; virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; virtual QSize maximumSizeHint() const Q_DECL_OVERRIDE; // non-virtual methods: QCPLayoutElement *element(int row, int column) const; bool addElement(int row, int column, QCPLayoutElement *element); bool addElement(QCPLayoutElement *element); bool hasElement(int row, int column); void expandTo(int newRowCount, int newColumnCount); void insertRow(int newIndex); void insertColumn(int newIndex); int rowColToIndex(int row, int column) const; void indexToRowCol(int index, int &row, int &column) const; protected: // property members: QList > mElements; QList mColumnStretchFactors; QList mRowStretchFactors; int mColumnSpacing, mRowSpacing; int mWrap; FillOrder mFillOrder; // non-virtual methods: void getMinimumRowColSizes(QVector *minColWidths, QVector *minRowHeights) const; void getMaximumRowColSizes(QVector *maxColWidths, QVector *maxRowHeights) const; private: Q_DISABLE_COPY(QCPLayoutGrid) }; Q_DECLARE_METATYPE(QCPLayoutGrid::FillOrder) class QCP_LIB_DECL QCPLayoutInset : public QCPLayout { Q_OBJECT public: /*! Defines how the placement and sizing is handled for a certain element in a QCPLayoutInset. */ enum InsetPlacement { ipFree ///< The element may be positioned/sized arbitrarily, see \ref setInsetRect ,ipBorderAligned ///< The element is aligned to one of the layout sides, see \ref setInsetAlignment }; Q_ENUMS(InsetPlacement) explicit QCPLayoutInset(); virtual ~QCPLayoutInset(); // getters: InsetPlacement insetPlacement(int index) const; Qt::Alignment insetAlignment(int index) const; QRectF insetRect(int index) const; // setters: void setInsetPlacement(int index, InsetPlacement placement); void setInsetAlignment(int index, Qt::Alignment alignment); void setInsetRect(int index, const QRectF &rect); // reimplemented virtual methods: virtual void updateLayout() Q_DECL_OVERRIDE; virtual int elementCount() const Q_DECL_OVERRIDE; virtual QCPLayoutElement* elementAt(int index) const Q_DECL_OVERRIDE; virtual QCPLayoutElement* takeAt(int index) Q_DECL_OVERRIDE; virtual bool take(QCPLayoutElement* element) Q_DECL_OVERRIDE; virtual void simplify() Q_DECL_OVERRIDE {} virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; // non-virtual methods: void addElement(QCPLayoutElement *element, Qt::Alignment alignment); void addElement(QCPLayoutElement *element, const QRectF &rect); protected: // property members: QList mElements; QList mInsetPlacement; QList mInsetAlignment; QList mInsetRect; private: Q_DISABLE_COPY(QCPLayoutInset) }; Q_DECLARE_METATYPE(QCPLayoutInset::InsetPlacement) /* end of 'src/layout.h' */ /* including file 'src/lineending.h', size 4426 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPLineEnding { Q_GADGET public: /*! Defines the type of ending decoration for line-like items, e.g. an arrow. \image html QCPLineEnding.png The width and length of these decorations can be controlled with the functions \ref setWidth and \ref setLength. Some decorations like \ref esDisc, \ref esSquare, \ref esDiamond and \ref esBar only support a width, the length property is ignored. \see QCPItemLine::setHead, QCPItemLine::setTail, QCPItemCurve::setHead, QCPItemCurve::setTail, QCPAxis::setLowerEnding, QCPAxis::setUpperEnding */ enum EndingStyle { esNone ///< No ending decoration ,esFlatArrow ///< A filled arrow head with a straight/flat back (a triangle) ,esSpikeArrow ///< A filled arrow head with an indented back ,esLineArrow ///< A non-filled arrow head with open back ,esDisc ///< A filled circle ,esSquare ///< A filled square ,esDiamond ///< A filled diamond (45 degrees rotated square) ,esBar ///< A bar perpendicular to the line ,esHalfBar ///< A bar perpendicular to the line, pointing out to only one side (to which side can be changed with \ref setInverted) ,esSkewedBar ///< A bar that is skewed (skew controllable via \ref setLength) }; Q_ENUMS(EndingStyle) QCPLineEnding(); QCPLineEnding(EndingStyle style, double width=8, double length=10, bool inverted=false); // getters: EndingStyle style() const { return mStyle; } double width() const { return mWidth; } double length() const { return mLength; } bool inverted() const { return mInverted; } // setters: void setStyle(EndingStyle style); void setWidth(double width); void setLength(double length); void setInverted(bool inverted); // non-property methods: double boundingDistance() const; double realLength() const; void draw(QCPPainter *painter, const QCPVector2D &pos, const QCPVector2D &dir) const; void draw(QCPPainter *painter, const QCPVector2D &pos, double angle) const; protected: // property members: EndingStyle mStyle; double mWidth, mLength; bool mInverted; }; Q_DECLARE_TYPEINFO(QCPLineEnding, Q_MOVABLE_TYPE); Q_DECLARE_METATYPE(QCPLineEnding::EndingStyle) /* end of 'src/lineending.h' */ /* including file 'src/axis/axisticker.h', size 4177 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTicker { Q_GADGET public: /*! Defines the strategies that the axis ticker may follow when choosing the size of the tick step. \see setTickStepStrategy */ enum TickStepStrategy { tssReadability ///< A nicely readable tick step is prioritized over matching the requested number of ticks (see \ref setTickCount) ,tssMeetTickCount ///< Less readable tick steps are allowed which in turn facilitates getting closer to the requested tick count }; Q_ENUMS(TickStepStrategy) QCPAxisTicker(); virtual ~QCPAxisTicker(); // getters: TickStepStrategy tickStepStrategy() const { return mTickStepStrategy; } int tickCount() const { return mTickCount; } double tickOrigin() const { return mTickOrigin; } // setters: void setTickStepStrategy(TickStepStrategy strategy); void setTickCount(int count); void setTickOrigin(double origin); // introduced virtual methods: virtual void generate(const QCPRange &range, const QLocale &locale, QChar formatChar, int precision, QVector &ticks, QVector *subTicks, QVector *tickLabels); protected: // property members: TickStepStrategy mTickStepStrategy; int mTickCount; double mTickOrigin; // introduced virtual methods: virtual double getTickStep(const QCPRange &range); virtual int getSubTickCount(double tickStep); virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision); virtual QVector createTickVector(double tickStep, const QCPRange &range); virtual QVector createSubTickVector(int subTickCount, const QVector &ticks); virtual QVector createLabelVector(const QVector &ticks, const QLocale &locale, QChar formatChar, int precision); // non-virtual methods: void trimTicks(const QCPRange &range, QVector &ticks, bool keepOneOutlier) const; double pickClosest(double target, const QVector &candidates) const; double getMantissa(double input, double *magnitude=0) const; double cleanMantissa(double input) const; }; Q_DECLARE_METATYPE(QCPAxisTicker::TickStepStrategy) Q_DECLARE_METATYPE(QSharedPointer) /* end of 'src/axis/axisticker.h' */ /* including file 'src/axis/axistickerdatetime.h', size 3289 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerDateTime : public QCPAxisTicker { public: QCPAxisTickerDateTime(); // getters: QString dateTimeFormat() const { return mDateTimeFormat; } Qt::TimeSpec dateTimeSpec() const { return mDateTimeSpec; } // setters: void setDateTimeFormat(const QString &format); void setDateTimeSpec(Qt::TimeSpec spec); void setTickOrigin(double origin); // hides base class method but calls baseclass implementation ("using" throws off IDEs and doxygen) void setTickOrigin(const QDateTime &origin); // static methods: static QDateTime keyToDateTime(double key); static double dateTimeToKey(const QDateTime dateTime); static double dateTimeToKey(const QDate date); protected: // property members: QString mDateTimeFormat; Qt::TimeSpec mDateTimeSpec; // non-property members: enum DateStrategy {dsNone, dsUniformTimeInDay, dsUniformDayInMonth} mDateStrategy; // reimplemented virtual methods: virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; virtual QVector createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE; }; /* end of 'src/axis/axistickerdatetime.h' */ /* including file 'src/axis/axistickertime.h', size 3288 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerTime : public QCPAxisTicker { Q_GADGET public: /*! Defines the logical units in which fractions of time spans can be expressed. \see setFieldWidth, setTimeFormat */ enum TimeUnit { tuMilliseconds ,tuSeconds ,tuMinutes ,tuHours ,tuDays }; Q_ENUMS(TimeUnit) QCPAxisTickerTime(); // getters: QString timeFormat() const { return mTimeFormat; } int fieldWidth(TimeUnit unit) const { return mFieldWidth.value(unit); } // setters: void setTimeFormat(const QString &format); void setFieldWidth(TimeUnit unit, int width); protected: // property members: QString mTimeFormat; QHash mFieldWidth; // non-property members: TimeUnit mSmallestUnit, mBiggestUnit; QHash mFormatPattern; // reimplemented virtual methods: virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; // non-virtual methods: void replaceUnit(QString &text, TimeUnit unit, int value) const; }; Q_DECLARE_METATYPE(QCPAxisTickerTime::TimeUnit) /* end of 'src/axis/axistickertime.h' */ /* including file 'src/axis/axistickerfixed.h', size 3308 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerFixed : public QCPAxisTicker { Q_GADGET public: /*! Defines how the axis ticker may modify the specified tick step (\ref setTickStep) in order to control the number of ticks in the axis range. \see setScaleStrategy */ enum ScaleStrategy { ssNone ///< Modifications are not allowed, the specified tick step is absolutely fixed. This might cause a high tick density and overlapping labels if the axis range is zoomed out. ,ssMultiples ///< An integer multiple of the specified tick step is allowed. The used factor follows the base class properties of \ref setTickStepStrategy and \ref setTickCount. ,ssPowers ///< An integer power of the specified tick step is allowed. }; Q_ENUMS(ScaleStrategy) QCPAxisTickerFixed(); // getters: double tickStep() const { return mTickStep; } ScaleStrategy scaleStrategy() const { return mScaleStrategy; } // setters: void setTickStep(double step); void setScaleStrategy(ScaleStrategy strategy); protected: // property members: double mTickStep; ScaleStrategy mScaleStrategy; // reimplemented virtual methods: virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; }; Q_DECLARE_METATYPE(QCPAxisTickerFixed::ScaleStrategy) /* end of 'src/axis/axistickerfixed.h' */ /* including file 'src/axis/axistickertext.h', size 3085 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerText : public QCPAxisTicker { public: QCPAxisTickerText(); // getters: QMap &ticks() { return mTicks; } int subTickCount() const { return mSubTickCount; } // setters: void setTicks(const QMap &ticks); void setTicks(const QVector &positions, const QVector labels); void setSubTickCount(int subTicks); // non-virtual methods: void clear(); void addTick(double position, QString label); void addTicks(const QMap &ticks); void addTicks(const QVector &positions, const QVector &labels); protected: // property members: QMap mTicks; int mSubTickCount; // reimplemented virtual methods: virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; virtual QVector createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE; }; /* end of 'src/axis/axistickertext.h' */ /* including file 'src/axis/axistickerpi.h', size 3911 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerPi : public QCPAxisTicker { Q_GADGET public: /*! Defines how fractions should be displayed in tick labels. \see setFractionStyle */ enum FractionStyle { fsFloatingPoint ///< Fractions are displayed as regular decimal floating point numbers, e.g. "0.25" or "0.125". ,fsAsciiFractions ///< Fractions are written as rationals using ASCII characters only, e.g. "1/4" or "1/8" ,fsUnicodeFractions ///< Fractions are written using sub- and superscript UTF-8 digits and the fraction symbol. }; Q_ENUMS(FractionStyle) QCPAxisTickerPi(); // getters: QString piSymbol() const { return mPiSymbol; } double piValue() const { return mPiValue; } bool periodicity() const { return mPeriodicity; } FractionStyle fractionStyle() const { return mFractionStyle; } // setters: void setPiSymbol(QString symbol); void setPiValue(double pi); void setPeriodicity(int multiplesOfPi); void setFractionStyle(FractionStyle style); protected: // property members: QString mPiSymbol; double mPiValue; int mPeriodicity; FractionStyle mFractionStyle; // non-property members: double mPiTickStep; // size of one tick step in units of mPiValue // reimplemented virtual methods: virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; virtual QString getTickLabel(double tick, const QLocale &locale, QChar formatChar, int precision) Q_DECL_OVERRIDE; // non-virtual methods: void simplifyFraction(int &numerator, int &denominator) const; QString fractionToString(int numerator, int denominator) const; QString unicodeFraction(int numerator, int denominator) const; QString unicodeSuperscript(int number) const; QString unicodeSubscript(int number) const; }; Q_DECLARE_METATYPE(QCPAxisTickerPi::FractionStyle) /* end of 'src/axis/axistickerpi.h' */ /* including file 'src/axis/axistickerlog.h', size 2663 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisTickerLog : public QCPAxisTicker { public: QCPAxisTickerLog(); // getters: double logBase() const { return mLogBase; } int subTickCount() const { return mSubTickCount; } // setters: void setLogBase(double base); void setSubTickCount(int subTicks); protected: // property members: double mLogBase; int mSubTickCount; // non-property members: double mLogBaseLnInv; // reimplemented virtual methods: virtual double getTickStep(const QCPRange &range) Q_DECL_OVERRIDE; virtual int getSubTickCount(double tickStep) Q_DECL_OVERRIDE; virtual QVector createTickVector(double tickStep, const QCPRange &range) Q_DECL_OVERRIDE; }; /* end of 'src/axis/axistickerlog.h' */ /* including file 'src/axis/axis.h', size 20230 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPGrid :public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(bool subGridVisible READ subGridVisible WRITE setSubGridVisible) Q_PROPERTY(bool antialiasedSubGrid READ antialiasedSubGrid WRITE setAntialiasedSubGrid) Q_PROPERTY(bool antialiasedZeroLine READ antialiasedZeroLine WRITE setAntialiasedZeroLine) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen subGridPen READ subGridPen WRITE setSubGridPen) Q_PROPERTY(QPen zeroLinePen READ zeroLinePen WRITE setZeroLinePen) /// \endcond public: explicit QCPGrid(QCPAxis *parentAxis); // getters: bool subGridVisible() const { return mSubGridVisible; } bool antialiasedSubGrid() const { return mAntialiasedSubGrid; } bool antialiasedZeroLine() const { return mAntialiasedZeroLine; } QPen pen() const { return mPen; } QPen subGridPen() const { return mSubGridPen; } QPen zeroLinePen() const { return mZeroLinePen; } // setters: void setSubGridVisible(bool visible); void setAntialiasedSubGrid(bool enabled); void setAntialiasedZeroLine(bool enabled); void setPen(const QPen &pen); void setSubGridPen(const QPen &pen); void setZeroLinePen(const QPen &pen); protected: // property members: bool mSubGridVisible; bool mAntialiasedSubGrid, mAntialiasedZeroLine; QPen mPen, mSubGridPen, mZeroLinePen; // non-property members: QCPAxis *mParentAxis; // reimplemented virtual methods: virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; // non-virtual methods: void drawGridLines(QCPPainter *painter) const; void drawSubGridLines(QCPPainter *painter) const; friend class QCPAxis; }; class QCP_LIB_DECL QCPAxis : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(AxisType axisType READ axisType) Q_PROPERTY(QCPAxisRect* axisRect READ axisRect) Q_PROPERTY(ScaleType scaleType READ scaleType WRITE setScaleType NOTIFY scaleTypeChanged) Q_PROPERTY(QCPRange range READ range WRITE setRange NOTIFY rangeChanged) Q_PROPERTY(bool rangeReversed READ rangeReversed WRITE setRangeReversed) Q_PROPERTY(QSharedPointer ticker READ ticker WRITE setTicker) Q_PROPERTY(bool ticks READ ticks WRITE setTicks) Q_PROPERTY(bool tickLabels READ tickLabels WRITE setTickLabels) Q_PROPERTY(int tickLabelPadding READ tickLabelPadding WRITE setTickLabelPadding) Q_PROPERTY(QFont tickLabelFont READ tickLabelFont WRITE setTickLabelFont) Q_PROPERTY(QColor tickLabelColor READ tickLabelColor WRITE setTickLabelColor) Q_PROPERTY(double tickLabelRotation READ tickLabelRotation WRITE setTickLabelRotation) Q_PROPERTY(LabelSide tickLabelSide READ tickLabelSide WRITE setTickLabelSide) Q_PROPERTY(QString numberFormat READ numberFormat WRITE setNumberFormat) Q_PROPERTY(int numberPrecision READ numberPrecision WRITE setNumberPrecision) Q_PROPERTY(QVector tickVector READ tickVector) Q_PROPERTY(QVector tickVectorLabels READ tickVectorLabels) Q_PROPERTY(int tickLengthIn READ tickLengthIn WRITE setTickLengthIn) Q_PROPERTY(int tickLengthOut READ tickLengthOut WRITE setTickLengthOut) Q_PROPERTY(bool subTicks READ subTicks WRITE setSubTicks) Q_PROPERTY(int subTickLengthIn READ subTickLengthIn WRITE setSubTickLengthIn) Q_PROPERTY(int subTickLengthOut READ subTickLengthOut WRITE setSubTickLengthOut) Q_PROPERTY(QPen basePen READ basePen WRITE setBasePen) Q_PROPERTY(QPen tickPen READ tickPen WRITE setTickPen) Q_PROPERTY(QPen subTickPen READ subTickPen WRITE setSubTickPen) Q_PROPERTY(QFont labelFont READ labelFont WRITE setLabelFont) Q_PROPERTY(QColor labelColor READ labelColor WRITE setLabelColor) Q_PROPERTY(QString label READ label WRITE setLabel) Q_PROPERTY(int labelPadding READ labelPadding WRITE setLabelPadding) Q_PROPERTY(int padding READ padding WRITE setPadding) Q_PROPERTY(int offset READ offset WRITE setOffset) Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectionChanged) Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectableChanged) Q_PROPERTY(QFont selectedTickLabelFont READ selectedTickLabelFont WRITE setSelectedTickLabelFont) Q_PROPERTY(QFont selectedLabelFont READ selectedLabelFont WRITE setSelectedLabelFont) Q_PROPERTY(QColor selectedTickLabelColor READ selectedTickLabelColor WRITE setSelectedTickLabelColor) Q_PROPERTY(QColor selectedLabelColor READ selectedLabelColor WRITE setSelectedLabelColor) Q_PROPERTY(QPen selectedBasePen READ selectedBasePen WRITE setSelectedBasePen) Q_PROPERTY(QPen selectedTickPen READ selectedTickPen WRITE setSelectedTickPen) Q_PROPERTY(QPen selectedSubTickPen READ selectedSubTickPen WRITE setSelectedSubTickPen) Q_PROPERTY(QCPLineEnding lowerEnding READ lowerEnding WRITE setLowerEnding) Q_PROPERTY(QCPLineEnding upperEnding READ upperEnding WRITE setUpperEnding) Q_PROPERTY(QCPGrid* grid READ grid) /// \endcond public: /*! Defines at which side of the axis rect the axis will appear. This also affects how the tick marks are drawn, on which side the labels are placed etc. */ enum AxisType { atLeft = 0x01 ///< 0x01 Axis is vertical and on the left side of the axis rect ,atRight = 0x02 ///< 0x02 Axis is vertical and on the right side of the axis rect ,atTop = 0x04 ///< 0x04 Axis is horizontal and on the top side of the axis rect ,atBottom = 0x08 ///< 0x08 Axis is horizontal and on the bottom side of the axis rect }; Q_ENUMS(AxisType) Q_FLAGS(AxisTypes) Q_DECLARE_FLAGS(AxisTypes, AxisType) /*! Defines on which side of the axis the tick labels (numbers) shall appear. \see setTickLabelSide */ enum LabelSide { lsInside ///< Tick labels will be displayed inside the axis rect and clipped to the inner axis rect ,lsOutside ///< Tick labels will be displayed outside the axis rect }; Q_ENUMS(LabelSide) /*! Defines the scale of an axis. \see setScaleType */ enum ScaleType { stLinear ///< Linear scaling ,stLogarithmic ///< Logarithmic scaling with correspondingly transformed axis coordinates (possibly also \ref setTicker to a \ref QCPAxisTickerLog instance). }; Q_ENUMS(ScaleType) /*! Defines the selectable parts of an axis. \see setSelectableParts, setSelectedParts */ enum SelectablePart { spNone = 0 ///< None of the selectable parts ,spAxis = 0x001 ///< The axis backbone and tick marks ,spTickLabels = 0x002 ///< Tick labels (numbers) of this axis (as a whole, not individually) ,spAxisLabel = 0x004 ///< The axis label }; Q_ENUMS(SelectablePart) Q_FLAGS(SelectableParts) Q_DECLARE_FLAGS(SelectableParts, SelectablePart) explicit QCPAxis(QCPAxisRect *parent, AxisType type); virtual ~QCPAxis(); // getters: AxisType axisType() const { return mAxisType; } QCPAxisRect *axisRect() const { return mAxisRect; } ScaleType scaleType() const { return mScaleType; } const QCPRange range() const { return mRange; } bool rangeReversed() const { return mRangeReversed; } QSharedPointer ticker() const { return mTicker; } bool ticks() const { return mTicks; } bool tickLabels() const { return mTickLabels; } int tickLabelPadding() const; QFont tickLabelFont() const { return mTickLabelFont; } QColor tickLabelColor() const { return mTickLabelColor; } double tickLabelRotation() const; LabelSide tickLabelSide() const; QString numberFormat() const; int numberPrecision() const { return mNumberPrecision; } QVector tickVector() const { return mTickVector; } QVector tickVectorLabels() const { return mTickVectorLabels; } int tickLengthIn() const; int tickLengthOut() const; bool subTicks() const { return mSubTicks; } int subTickLengthIn() const; int subTickLengthOut() const; QPen basePen() const { return mBasePen; } QPen tickPen() const { return mTickPen; } QPen subTickPen() const { return mSubTickPen; } QFont labelFont() const { return mLabelFont; } QColor labelColor() const { return mLabelColor; } QString label() const { return mLabel; } int labelPadding() const; int padding() const { return mPadding; } int offset() const; SelectableParts selectedParts() const { return mSelectedParts; } SelectableParts selectableParts() const { return mSelectableParts; } QFont selectedTickLabelFont() const { return mSelectedTickLabelFont; } QFont selectedLabelFont() const { return mSelectedLabelFont; } QColor selectedTickLabelColor() const { return mSelectedTickLabelColor; } QColor selectedLabelColor() const { return mSelectedLabelColor; } QPen selectedBasePen() const { return mSelectedBasePen; } QPen selectedTickPen() const { return mSelectedTickPen; } QPen selectedSubTickPen() const { return mSelectedSubTickPen; } QCPLineEnding lowerEnding() const; QCPLineEnding upperEnding() const; QCPGrid *grid() const { return mGrid; } // setters: Q_SLOT void setScaleType(QCPAxis::ScaleType type); Q_SLOT void setRange(const QCPRange &range); void setRange(double lower, double upper); void setRange(double position, double size, Qt::AlignmentFlag alignment); void setRangeLower(double lower); void setRangeUpper(double upper); void setRangeReversed(bool reversed); void setTicker(QSharedPointer ticker); void setTicks(bool show); void setTickLabels(bool show); void setTickLabelPadding(int padding); void setTickLabelFont(const QFont &font); void setTickLabelColor(const QColor &color); void setTickLabelRotation(double degrees); void setTickLabelSide(LabelSide side); void setNumberFormat(const QString &formatCode); void setNumberPrecision(int precision); void setTickLength(int inside, int outside=0); void setTickLengthIn(int inside); void setTickLengthOut(int outside); void setSubTicks(bool show); void setSubTickLength(int inside, int outside=0); void setSubTickLengthIn(int inside); void setSubTickLengthOut(int outside); void setBasePen(const QPen &pen); void setTickPen(const QPen &pen); void setSubTickPen(const QPen &pen); void setLabelFont(const QFont &font); void setLabelColor(const QColor &color); void setLabel(const QString &str); void setLabelPadding(int padding); void setPadding(int padding); void setOffset(int offset); void setSelectedTickLabelFont(const QFont &font); void setSelectedLabelFont(const QFont &font); void setSelectedTickLabelColor(const QColor &color); void setSelectedLabelColor(const QColor &color); void setSelectedBasePen(const QPen &pen); void setSelectedTickPen(const QPen &pen); void setSelectedSubTickPen(const QPen &pen); Q_SLOT void setSelectableParts(const QCPAxis::SelectableParts &selectableParts); Q_SLOT void setSelectedParts(const QCPAxis::SelectableParts &selectedParts); void setLowerEnding(const QCPLineEnding &ending); void setUpperEnding(const QCPLineEnding &ending); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; // non-property methods: Qt::Orientation orientation() const { return mOrientation; } int pixelOrientation() const { return rangeReversed() != (orientation()==Qt::Vertical) ? -1 : 1; } void moveRange(double diff); void scaleRange(double factor); void scaleRange(double factor, double center); void setScaleRatio(const QCPAxis *otherAxis, double ratio=1.0); void rescale(bool onlyVisiblePlottables=false); double pixelToCoord(double value) const; double coordToPixel(double value) const; SelectablePart getPartAt(const QPointF &pos) const; QList plottables() const; QList graphs() const; QList items() const; static AxisType marginSideToAxisType(QCP::MarginSide side); static Qt::Orientation orientation(AxisType type) { return type==atBottom||type==atTop ? Qt::Horizontal : Qt::Vertical; } static AxisType opposite(AxisType type); signals: void rangeChanged(const QCPRange &newRange); void rangeChanged(const QCPRange &newRange, const QCPRange &oldRange); void scaleTypeChanged(QCPAxis::ScaleType scaleType); void selectionChanged(const QCPAxis::SelectableParts &parts); void selectableChanged(const QCPAxis::SelectableParts &parts); protected: // property members: // axis base: AxisType mAxisType; QCPAxisRect *mAxisRect; //int mOffset; // in QCPAxisPainter int mPadding; Qt::Orientation mOrientation; SelectableParts mSelectableParts, mSelectedParts; QPen mBasePen, mSelectedBasePen; //QCPLineEnding mLowerEnding, mUpperEnding; // in QCPAxisPainter // axis label: //int mLabelPadding; // in QCPAxisPainter QString mLabel; QFont mLabelFont, mSelectedLabelFont; QColor mLabelColor, mSelectedLabelColor; // tick labels: //int mTickLabelPadding; // in QCPAxisPainter bool mTickLabels; //double mTickLabelRotation; // in QCPAxisPainter QFont mTickLabelFont, mSelectedTickLabelFont; QColor mTickLabelColor, mSelectedTickLabelColor; int mNumberPrecision; QLatin1Char mNumberFormatChar; bool mNumberBeautifulPowers; //bool mNumberMultiplyCross; // QCPAxisPainter // ticks and subticks: bool mTicks; bool mSubTicks; //int mTickLengthIn, mTickLengthOut, mSubTickLengthIn, mSubTickLengthOut; // QCPAxisPainter QPen mTickPen, mSelectedTickPen; QPen mSubTickPen, mSelectedSubTickPen; // scale and range: QCPRange mRange; bool mRangeReversed; ScaleType mScaleType; // non-property members: QCPGrid *mGrid; QCPAxisPainterPrivate *mAxisPainter; QSharedPointer mTicker; QVector mTickVector; QVector mTickVectorLabels; QVector mSubTickVector; bool mCachedMarginValid; int mCachedMargin; // introduced virtual methods: virtual int calculateMargin(); // reimplemented virtual methods: virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; // events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE; virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; // non-virtual methods: void setupTickVectors(); QPen getBasePen() const; QPen getTickPen() const; QPen getSubTickPen() const; QFont getTickLabelFont() const; QFont getLabelFont() const; QColor getTickLabelColor() const; QColor getLabelColor() const; private: Q_DISABLE_COPY(QCPAxis) friend class QCustomPlot; friend class QCPGrid; friend class QCPAxisRect; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::SelectableParts) Q_DECLARE_OPERATORS_FOR_FLAGS(QCPAxis::AxisTypes) Q_DECLARE_METATYPE(QCPAxis::AxisType) Q_DECLARE_METATYPE(QCPAxis::LabelSide) Q_DECLARE_METATYPE(QCPAxis::ScaleType) Q_DECLARE_METATYPE(QCPAxis::SelectablePart) class QCPAxisPainterPrivate { public: explicit QCPAxisPainterPrivate(QCustomPlot *parentPlot); virtual ~QCPAxisPainterPrivate(); virtual void draw(QCPPainter *painter); virtual int size() const; void clearCache(); QRect axisSelectionBox() const { return mAxisSelectionBox; } QRect tickLabelsSelectionBox() const { return mTickLabelsSelectionBox; } QRect labelSelectionBox() const { return mLabelSelectionBox; } // public property members: QCPAxis::AxisType type; QPen basePen; QCPLineEnding lowerEnding, upperEnding; // directly accessed by QCPAxis setters/getters int labelPadding; // directly accessed by QCPAxis setters/getters QFont labelFont; QColor labelColor; QString label; int tickLabelPadding; // directly accessed by QCPAxis setters/getters double tickLabelRotation; // directly accessed by QCPAxis setters/getters QCPAxis::LabelSide tickLabelSide; // directly accessed by QCPAxis setters/getters bool substituteExponent; bool numberMultiplyCross; // directly accessed by QCPAxis setters/getters int tickLengthIn, tickLengthOut, subTickLengthIn, subTickLengthOut; // directly accessed by QCPAxis setters/getters QPen tickPen, subTickPen; QFont tickLabelFont; QColor tickLabelColor; QRect axisRect, viewportRect; double offset; // directly accessed by QCPAxis setters/getters bool abbreviateDecimalPowers; bool reversedEndings; QVector subTickPositions; QVector tickPositions; QVector tickLabels; protected: struct CachedLabel { QPointF offset; QPixmap pixmap; }; struct TickLabelData { QString basePart, expPart, suffixPart; QRect baseBounds, expBounds, suffixBounds, totalBounds, rotatedTotalBounds; QFont baseFont, expFont; }; QCustomPlot *mParentPlot; QByteArray mLabelParameterHash; // to determine whether mLabelCache needs to be cleared due to changed parameters QCache mLabelCache; QRect mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox; virtual QByteArray generateLabelParameterHash() const; virtual void placeTickLabel(QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize); virtual void drawTickLabel(QCPPainter *painter, double x, double y, const TickLabelData &labelData) const; virtual TickLabelData getTickLabelData(const QFont &font, const QString &text) const; virtual QPointF getTickLabelDrawOffset(const TickLabelData &labelData) const; virtual void getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const; }; /* end of 'src/axis/axis.h' */ /* including file 'src/scatterstyle.h', size 7275 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPScatterStyle { Q_GADGET public: /*! Represents the various properties of a scatter style instance. For example, this enum is used to specify which properties of \ref QCPSelectionDecorator::setScatterStyle will be used when highlighting selected data points. Specific scatter properties can be transferred between \ref QCPScatterStyle instances via \ref setFromOther. */ enum ScatterProperty { spNone = 0x00 ///< 0x00 None ,spPen = 0x01 ///< 0x01 The pen property, see \ref setPen ,spBrush = 0x02 ///< 0x02 The brush property, see \ref setBrush ,spSize = 0x04 ///< 0x04 The size property, see \ref setSize ,spShape = 0x08 ///< 0x08 The shape property, see \ref setShape ,spAll = 0xFF ///< 0xFF All properties }; Q_ENUMS(ScatterProperty) Q_FLAGS(ScatterProperties) Q_DECLARE_FLAGS(ScatterProperties, ScatterProperty) /*! Defines the shape used for scatter points. On plottables/items that draw scatters, the sizes of these visualizations (with exception of \ref ssDot and \ref ssPixmap) can be controlled with the \ref setSize function. Scatters are drawn with the pen and brush specified with \ref setPen and \ref setBrush. */ enum ScatterShape { ssNone ///< no scatter symbols are drawn (e.g. in QCPGraph, data only represented with lines) ,ssDot ///< \enumimage{ssDot.png} a single pixel (use \ref ssDisc or \ref ssCircle if you want a round shape with a certain radius) ,ssCross ///< \enumimage{ssCross.png} a cross ,ssPlus ///< \enumimage{ssPlus.png} a plus ,ssCircle ///< \enumimage{ssCircle.png} a circle ,ssDisc ///< \enumimage{ssDisc.png} a circle which is filled with the pen's color (not the brush as with ssCircle) ,ssSquare ///< \enumimage{ssSquare.png} a square ,ssDiamond ///< \enumimage{ssDiamond.png} a diamond ,ssStar ///< \enumimage{ssStar.png} a star with eight arms, i.e. a combination of cross and plus ,ssTriangle ///< \enumimage{ssTriangle.png} an equilateral triangle, standing on baseline ,ssTriangleInverted ///< \enumimage{ssTriangleInverted.png} an equilateral triangle, standing on corner ,ssCrossSquare ///< \enumimage{ssCrossSquare.png} a square with a cross inside ,ssPlusSquare ///< \enumimage{ssPlusSquare.png} a square with a plus inside ,ssCrossCircle ///< \enumimage{ssCrossCircle.png} a circle with a cross inside ,ssPlusCircle ///< \enumimage{ssPlusCircle.png} a circle with a plus inside ,ssPeace ///< \enumimage{ssPeace.png} a circle, with one vertical and two downward diagonal lines ,ssPixmap ///< a custom pixmap specified by \ref setPixmap, centered on the data point coordinates ,ssCustom ///< custom painter operations are performed per scatter (As QPainterPath, see \ref setCustomPath) }; Q_ENUMS(ScatterShape) QCPScatterStyle(); QCPScatterStyle(ScatterShape shape, double size=6); QCPScatterStyle(ScatterShape shape, const QColor &color, double size); QCPScatterStyle(ScatterShape shape, const QColor &color, const QColor &fill, double size); QCPScatterStyle(ScatterShape shape, const QPen &pen, const QBrush &brush, double size); QCPScatterStyle(const QPixmap &pixmap); QCPScatterStyle(const QPainterPath &customPath, const QPen &pen, const QBrush &brush=Qt::NoBrush, double size=6); // getters: double size() const { return mSize; } ScatterShape shape() const { return mShape; } QPen pen() const { return mPen; } QBrush brush() const { return mBrush; } QPixmap pixmap() const { return mPixmap; } QPainterPath customPath() const { return mCustomPath; } // setters: void setFromOther(const QCPScatterStyle &other, ScatterProperties properties); void setSize(double size); void setShape(ScatterShape shape); void setPen(const QPen &pen); void setBrush(const QBrush &brush); void setPixmap(const QPixmap &pixmap); void setCustomPath(const QPainterPath &customPath); // non-property methods: bool isNone() const { return mShape == ssNone; } bool isPenDefined() const { return mPenDefined; } void undefinePen(); void applyTo(QCPPainter *painter, const QPen &defaultPen) const; void drawShape(QCPPainter *painter, const QPointF &pos) const; void drawShape(QCPPainter *painter, double x, double y) const; protected: // property members: double mSize; ScatterShape mShape; QPen mPen; QBrush mBrush; QPixmap mPixmap; QPainterPath mCustomPath; // non-property members: bool mPenDefined; }; Q_DECLARE_TYPEINFO(QCPScatterStyle, Q_MOVABLE_TYPE); Q_DECLARE_OPERATORS_FOR_FLAGS(QCPScatterStyle::ScatterProperties) Q_DECLARE_METATYPE(QCPScatterStyle::ScatterProperty) Q_DECLARE_METATYPE(QCPScatterStyle::ScatterShape) /* end of 'src/scatterstyle.h' */ /* including file 'src/datacontainer.h', size 4535 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ /*! \relates QCPDataContainer Returns whether the sort key of \a a is less than the sort key of \a b. \see QCPDataContainer::sort */ template inline bool qcpLessThanSortKey(const DataType &a, const DataType &b) { return a.sortKey() < b.sortKey(); } template class QCP_LIB_DECL QCPDataContainer { public: typedef typename QVector::const_iterator const_iterator; typedef typename QVector::iterator iterator; QCPDataContainer(); // getters: int size() const { return mData.size()-mPreallocSize; } bool isEmpty() const { return size() == 0; } bool autoSqueeze() const { return mAutoSqueeze; } // setters: void setAutoSqueeze(bool enabled); // non-virtual methods: void set(const QCPDataContainer &data); void set(const QVector &data, bool alreadySorted=false); void add(const QCPDataContainer &data); void add(const QVector &data, bool alreadySorted=false); void add(const DataType &data); void removeBefore(double sortKey); void removeAfter(double sortKey); void remove(double sortKeyFrom, double sortKeyTo); void remove(double sortKey); void clear(); void sort(); void squeeze(bool preAllocation=true, bool postAllocation=true); const_iterator constBegin() const { return mData.constBegin()+mPreallocSize; } const_iterator constEnd() const { return mData.constEnd(); } iterator begin() { return mData.begin()+mPreallocSize; } iterator end() { return mData.end(); } const_iterator findBegin(double sortKey, bool expandedRange=true) const; const_iterator findEnd(double sortKey, bool expandedRange=true) const; const_iterator at(int index) const { return constBegin()+qBound(0, index, size()); } QCPRange keyRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth); QCPRange valueRange(bool &foundRange, QCP::SignDomain signDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()); QCPDataRange dataRange() const { return QCPDataRange(0, size()); } void limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const; protected: // property members: bool mAutoSqueeze; // non-property memebers: QVector mData; int mPreallocSize; int mPreallocIteration; // non-virtual methods: void preallocateGrow(int minimumPreallocSize); void performAutoSqueeze(); }; // include implementation in header since it is a class template: /* including file 'src/datacontainer.cpp', size 31224 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPDataContainer //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPDataContainer \brief The generic data container for one-dimensional plottables This class template provides a fast container for data storage of one-dimensional data. The data type is specified as template parameter (called \a DataType in the following) and must provide some methods as described in the \ref qcpdatacontainer-datatype "next section". The data is stored in a sorted fashion, which allows very quick lookups by the sorted key as well as retrieval of ranges (see \ref findBegin, \ref findEnd, \ref keyRange) using binary search. The container uses a preallocation and a postallocation scheme, such that appending and prepending data (with respect to the sort key) is very fast and minimizes reallocations. If data is added which needs to be inserted between existing keys, the merge usually can be done quickly too, using the fact that existing data is always sorted. The user can further improve performance by specifying that added data is already itself sorted by key, if he can guarantee that this is the case (see for example \ref add(const QVector &data, bool alreadySorted)). The data can be accessed with the provided const iterators (\ref constBegin, \ref constEnd). If it is necessary to alter existing data in-place, the non-const iterators can be used (\ref begin, \ref end). Changing data members that are not the sort key (for most data types called \a key) is safe from the container's perspective. Great care must be taken however if the sort key is modified through the non-const iterators. For performance reasons, the iterators don't automatically cause a re-sorting upon their manipulation. It is thus the responsibility of the user to leave the container in a sorted state when finished with the data manipulation, before calling any other methods on the container. A complete re-sort (e.g. after finishing all sort key manipulation) can be done by calling \ref sort. Failing to do so can not be detected by the container efficiently and will cause both rendering artifacts and potential data loss. Implementing one-dimensional plottables that make use of a \ref QCPDataContainer is usually done by subclassing from \ref QCPAbstractPlottable1D "QCPAbstractPlottable1D", which introduces an according \a mDataContainer member and some convenience methods. \section qcpdatacontainer-datatype Requirements for the DataType template parameter The template parameter DataType is the type of the stored data points. It must be trivially copyable and have the following public methods, preferably inline: \li double sortKey() const\n Returns the member variable of this data point that is the sort key, defining the ordering in the container. Often this variable is simply called \a key. \li static DataType fromSortKey(double sortKey)\n Returns a new instance of the data type initialized with its sort key set to \a sortKey. \li static bool sortKeyIsMainKey()\n Returns true if the sort key is equal to the main key (see method \c mainKey below). For most plottables this is the case. It is not the case for example for \ref QCPCurve, which uses \a t as sort key and \a key as main key. This is the reason why QCPCurve unlike QCPGraph can display parametric curves with loops. \li double mainKey() const\n Returns the variable of this data point considered the main key. This is commonly the variable that is used as the coordinate of this data point on the key axis of the plottable. This method is used for example when determining the automatic axis rescaling of key axes (\ref QCPAxis::rescale). \li double mainValue() const\n Returns the variable of this data point considered the main value. This is commonly the variable that is used as the coordinate of this data point on the value axis of the plottable. \li QCPRange valueRange() const\n Returns the range this data point spans in the value axis coordinate. If the data is single-valued (e.g. QCPGraphData), this is simply a range with both lower and upper set to the main data point value. However if the data points can represent multiple values at once (e.g QCPFinancialData with its \a high, \a low, \a open and \a close values at each \a key) this method should return the range those values span. This method is used for example when determining the automatic axis rescaling of value axes (\ref QCPAxis::rescale). */ /* start documentation of inline functions */ /*! \fn int QCPDataContainer::size() const Returns the number of data points in the container. */ /*! \fn bool QCPDataContainer::isEmpty() const Returns whether this container holds no data points. */ /*! \fn QCPDataContainer::const_iterator QCPDataContainer::constBegin() const Returns a const iterator to the first data point in this container. */ /*! \fn QCPDataContainer::const_iterator QCPDataContainer::constEnd() const Returns a const iterator to the element past the last data point in this container. */ /*! \fn QCPDataContainer::iterator QCPDataContainer::begin() const Returns a non-const iterator to the first data point in this container. You can manipulate the data points in-place through the non-const iterators, but great care must be taken when manipulating the sort key of a data point, see \ref sort, or the detailed description of this class. */ /*! \fn QCPDataContainer::iterator QCPDataContainer::end() const Returns a non-const iterator to the element past the last data point in this container. You can manipulate the data points in-place through the non-const iterators, but great care must be taken when manipulating the sort key of a data point, see \ref sort, or the detailed description of this class. */ /*! \fn QCPDataContainer::const_iterator QCPDataContainer::at(int index) const Returns a const iterator to the element with the specified \a index. If \a index points beyond the available elements in this container, returns \ref constEnd, i.e. an iterator past the last valid element. You can use this method to easily obtain iterators from a \ref QCPDataRange, see the \ref dataselection-accessing "data selection page" for an example. */ /*! \fn QCPDataRange QCPDataContainer::dataRange() const Returns a \ref QCPDataRange encompassing the entire data set of this container. This means the begin index of the returned range is 0, and the end index is \ref size. */ /* end documentation of inline functions */ /*! Constructs a QCPDataContainer used for plottable classes that represent a series of key-sorted data */ template QCPDataContainer::QCPDataContainer() : mAutoSqueeze(true), mPreallocSize(0), mPreallocIteration(0) { } /*! Sets whether the container automatically decides when to release memory from its post- and preallocation pools when data points are removed. By default this is enabled and for typical applications shouldn't be changed. If auto squeeze is disabled, you can manually decide when to release pre-/postallocation with \ref squeeze. */ template void QCPDataContainer::setAutoSqueeze(bool enabled) { if (mAutoSqueeze != enabled) { mAutoSqueeze = enabled; if (mAutoSqueeze) performAutoSqueeze(); } } /*! \overload Replaces the current data in this container with the provided \a data. \see add, remove */ template void QCPDataContainer::set(const QCPDataContainer &data) { clear(); add(data); } /*! \overload Replaces the current data in this container with the provided \a data If you can guarantee that the data points in \a data have ascending order with respect to the DataType's sort key, set \a alreadySorted to true to avoid an unnecessary sorting run. \see add, remove */ template void QCPDataContainer::set(const QVector &data, bool alreadySorted) { mData = data; mPreallocSize = 0; mPreallocIteration = 0; if (!alreadySorted) sort(); } /*! \overload Adds the provided \a data to the current data in this container. \see set, remove */ template void QCPDataContainer::add(const QCPDataContainer &data) { if (data.isEmpty()) return; const int n = data.size(); const int oldSize = size(); if (oldSize > 0 && !qcpLessThanSortKey(*constBegin(), *(data.constEnd()-1))) // prepend if new data keys are all smaller than or equal to existing ones { if (mPreallocSize < n) preallocateGrow(n); mPreallocSize -= n; std::copy(data.constBegin(), data.constEnd(), begin()); } else // don't need to prepend, so append and merge if necessary { mData.resize(mData.size()+n); std::copy(data.constBegin(), data.constEnd(), end()-n); if (oldSize > 0 && !qcpLessThanSortKey(*(constEnd()-n-1), *(constEnd()-n))) // if appended range keys aren't all greater than existing ones, merge the two partitions std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey); } } /*! Adds the provided data points in \a data to the current data. If you can guarantee that the data points in \a data have ascending order with respect to the DataType's sort key, set \a alreadySorted to true to avoid an unnecessary sorting run. \see set, remove */ template void QCPDataContainer::add(const QVector &data, bool alreadySorted) { if (data.isEmpty()) return; if (isEmpty()) { set(data, alreadySorted); return; } const int n = data.size(); const int oldSize = size(); if (alreadySorted && oldSize > 0 && !qcpLessThanSortKey(*constBegin(), *(data.constEnd()-1))) // prepend if new data is sorted and keys are all smaller than or equal to existing ones { if (mPreallocSize < n) preallocateGrow(n); mPreallocSize -= n; std::copy(data.constBegin(), data.constEnd(), begin()); } else // don't need to prepend, so append and then sort and merge if necessary { mData.resize(mData.size()+n); std::copy(data.constBegin(), data.constEnd(), end()-n); if (!alreadySorted) // sort appended subrange if it wasn't already sorted std::sort(end()-n, end(), qcpLessThanSortKey); if (oldSize > 0 && !qcpLessThanSortKey(*(constEnd()-n-1), *(constEnd()-n))) // if appended range keys aren't all greater than existing ones, merge the two partitions std::inplace_merge(begin(), end()-n, end(), qcpLessThanSortKey); } } /*! \overload Adds the provided single data point to the current data. \see remove */ template void QCPDataContainer::add(const DataType &data) { if (isEmpty() || !qcpLessThanSortKey(data, *(constEnd()-1))) // quickly handle appends if new data key is greater or equal to existing ones { mData.append(data); } else if (qcpLessThanSortKey(data, *constBegin())) // quickly handle prepends using preallocated space { if (mPreallocSize < 1) preallocateGrow(1); --mPreallocSize; *begin() = data; } else // handle inserts, maintaining sorted keys { QCPDataContainer::iterator insertionPoint = std::lower_bound(begin(), end(), data, qcpLessThanSortKey); mData.insert(insertionPoint, data); } } /*! Removes all data points with (sort-)keys smaller than or equal to \a sortKey. \see removeAfter, remove, clear */ template void QCPDataContainer::removeBefore(double sortKey) { QCPDataContainer::iterator it = begin(); QCPDataContainer::iterator itEnd = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); mPreallocSize += itEnd-it; // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it) if (mAutoSqueeze) performAutoSqueeze(); } /*! Removes all data points with (sort-)keys greater than or equal to \a sortKey. \see removeBefore, remove, clear */ template void QCPDataContainer::removeAfter(double sortKey) { QCPDataContainer::iterator it = std::upper_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); QCPDataContainer::iterator itEnd = end(); mData.erase(it, itEnd); // typically adds it to the postallocated block if (mAutoSqueeze) performAutoSqueeze(); } /*! Removes all data points with (sort-)keys between \a sortKeyFrom and \a sortKeyTo. if \a sortKeyFrom is greater or equal to \a sortKeyTo, the function does nothing. To remove a single data point with known (sort-)key, use \ref remove(double sortKey). \see removeBefore, removeAfter, clear */ template void QCPDataContainer::remove(double sortKeyFrom, double sortKeyTo) { if (sortKeyFrom >= sortKeyTo || isEmpty()) return; QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKeyFrom), qcpLessThanSortKey); QCPDataContainer::iterator itEnd = std::upper_bound(it, end(), DataType::fromSortKey(sortKeyTo), qcpLessThanSortKey); mData.erase(it, itEnd); if (mAutoSqueeze) performAutoSqueeze(); } /*! \overload Removes a single data point at \a sortKey. If the position is not known with absolute (binary) precision, consider using \ref remove(double sortKeyFrom, double sortKeyTo) with a small fuzziness interval around the suspected position, depeding on the precision with which the (sort-)key is known. \see removeBefore, removeAfter, clear */ template void QCPDataContainer::remove(double sortKey) { QCPDataContainer::iterator it = std::lower_bound(begin(), end(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); if (it != end() && it->sortKey() == sortKey) { if (it == begin()) ++mPreallocSize; // don't actually delete, just add it to the preallocated block (if it gets too large, squeeze will take care of it) else mData.erase(it); } if (mAutoSqueeze) performAutoSqueeze(); } /*! Removes all data points. \see remove, removeAfter, removeBefore */ template void QCPDataContainer::clear() { mData.clear(); mPreallocIteration = 0; mPreallocSize = 0; } /*! Re-sorts all data points in the container by their sort key. When setting, adding or removing points using the QCPDataContainer interface (\ref set, \ref add, \ref remove, etc.), the container makes sure to always stay in a sorted state such that a full resort is never necessary. However, if you choose to directly manipulate the sort key on data points by accessing and modifying it through the non-const iterators (\ref begin, \ref end), it is your responsibility to bring the container back into a sorted state before any other methods are called on it. This can be achieved by calling this method immediately after finishing the sort key manipulation. */ template void QCPDataContainer::sort() { std::sort(begin(), end(), qcpLessThanSortKey); } /*! Frees all unused memory that is currently in the preallocation and postallocation pools. Note that QCPDataContainer automatically decides whether squeezing is necessary, if \ref setAutoSqueeze is left enabled. It should thus not be necessary to use this method for typical applications. The parameters \a preAllocation and \a postAllocation control whether pre- and/or post allocation should be freed, respectively. */ template void QCPDataContainer::squeeze(bool preAllocation, bool postAllocation) { if (preAllocation) { if (mPreallocSize > 0) { std::copy(begin(), end(), mData.begin()); mData.resize(size()); mPreallocSize = 0; } mPreallocIteration = 0; } if (postAllocation) mData.squeeze(); } /*! Returns an iterator to the data point with a (sort-)key that is equal to, just below, or just above \a sortKey. If \a expandedRange is true, the data point just below \a sortKey will be considered, otherwise the one just above. This can be used in conjunction with \ref findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range. If \a expandedRange is true but there are no data points below \a sortKey, \ref constBegin is returned. If the container is empty, returns \ref constEnd. \see findEnd, QCPPlottableInterface1D::findBegin */ template typename QCPDataContainer::const_iterator QCPDataContainer::findBegin(double sortKey, bool expandedRange) const { if (isEmpty()) return constEnd(); QCPDataContainer::const_iterator it = std::lower_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); if (expandedRange && it != constBegin()) // also covers it == constEnd case, and we know --constEnd is valid because mData isn't empty --it; return it; } /*! Returns an iterator to the element after the data point with a (sort-)key that is equal to, just above or just below \a sortKey. If \a expandedRange is true, the data point just above \a sortKey will be considered, otherwise the one just below. This can be used in conjunction with \ref findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range. If \a expandedRange is true but there are no data points above \a sortKey, \ref constEnd is returned. If the container is empty, \ref constEnd is returned. \see findBegin, QCPPlottableInterface1D::findEnd */ template typename QCPDataContainer::const_iterator QCPDataContainer::findEnd(double sortKey, bool expandedRange) const { if (isEmpty()) return constEnd(); QCPDataContainer::const_iterator it = std::upper_bound(constBegin(), constEnd(), DataType::fromSortKey(sortKey), qcpLessThanSortKey); if (expandedRange && it != constEnd()) ++it; return it; } /*! Returns the range encompassed by the (main-)key coordinate of all data points. The output parameter \a foundRange indicates whether a sensible range was found. If this is false, you should not use the returned QCPRange (e.g. the data container is empty or all points have the same key). Use \a signDomain to control which sign of the key coordinates should be considered. This is relevant e.g. for logarithmic plots which can mathematically only display one sign domain at a time. If the DataType reports that its main key is equal to the sort key (\a sortKeyIsMainKey), as is the case for most plottables, this method uses this fact and finds the range very quickly. \see valueRange */ template QCPRange QCPDataContainer::keyRange(bool &foundRange, QCP::SignDomain signDomain) { if (isEmpty()) { foundRange = false; return QCPRange(); } QCPRange range; bool haveLower = false; bool haveUpper = false; double current; QCPDataContainer::const_iterator it = constBegin(); QCPDataContainer::const_iterator itEnd = constEnd(); if (signDomain == QCP::sdBoth) // range may be anywhere { if (DataType::sortKeyIsMainKey()) // if DataType is sorted by main key (e.g. QCPGraph, but not QCPCurve), use faster algorithm by finding just first and last key with non-NaN value { while (it != itEnd) // find first non-nan going up from left { if (!qIsNaN(it->mainValue())) { range.lower = it->mainKey(); haveLower = true; break; } ++it; } it = itEnd; while (it != constBegin()) // find first non-nan going down from right { --it; if (!qIsNaN(it->mainValue())) { range.upper = it->mainKey(); haveUpper = true; break; } } } else // DataType is not sorted by main key, go through all data points and accordingly expand range { while (it != itEnd) { if (!qIsNaN(it->mainValue())) { current = it->mainKey(); if (current < range.lower || !haveLower) { range.lower = current; haveLower = true; } if (current > range.upper || !haveUpper) { range.upper = current; haveUpper = true; } } ++it; } } } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain { while (it != itEnd) { if (!qIsNaN(it->mainValue())) { current = it->mainKey(); if ((current < range.lower || !haveLower) && current < 0) { range.lower = current; haveLower = true; } if ((current > range.upper || !haveUpper) && current < 0) { range.upper = current; haveUpper = true; } } ++it; } } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain { while (it != itEnd) { if (!qIsNaN(it->mainValue())) { current = it->mainKey(); if ((current < range.lower || !haveLower) && current > 0) { range.lower = current; haveLower = true; } if ((current > range.upper || !haveUpper) && current > 0) { range.upper = current; haveUpper = true; } } ++it; } } foundRange = haveLower && haveUpper; return range; } /*! Returns the range encompassed by the value coordinates of the data points in the specified key range (\a inKeyRange), using the full \a DataType::valueRange reported by the data points. The output parameter \a foundRange indicates whether a sensible range was found. If this is false, you should not use the returned QCPRange (e.g. the data container is empty or all points have the same value). If \a inKeyRange has both lower and upper bound set to zero (is equal to QCPRange()), all data points are considered, without any restriction on the keys. Use \a signDomain to control which sign of the value coordinates should be considered. This is relevant e.g. for logarithmic plots which can mathematically only display one sign domain at a time. \see keyRange */ template QCPRange QCPDataContainer::valueRange(bool &foundRange, QCP::SignDomain signDomain, const QCPRange &inKeyRange) { if (isEmpty()) { foundRange = false; return QCPRange(); } QCPRange range; const bool restrictKeyRange = inKeyRange != QCPRange(); bool haveLower = false; bool haveUpper = false; QCPRange current; QCPDataContainer::const_iterator itBegin = constBegin(); QCPDataContainer::const_iterator itEnd = constEnd(); if (DataType::sortKeyIsMainKey() && restrictKeyRange) { itBegin = findBegin(inKeyRange.lower); itEnd = findEnd(inKeyRange.upper); } if (signDomain == QCP::sdBoth) // range may be anywhere { for (QCPDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper)) continue; current = it->valueRange(); if ((current.lower < range.lower || !haveLower) && !qIsNaN(current.lower)) { range.lower = current.lower; haveLower = true; } if ((current.upper > range.upper || !haveUpper) && !qIsNaN(current.upper)) { range.upper = current.upper; haveUpper = true; } } } else if (signDomain == QCP::sdNegative) // range may only be in the negative sign domain { for (QCPDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper)) continue; current = it->valueRange(); if ((current.lower < range.lower || !haveLower) && current.lower < 0 && !qIsNaN(current.lower)) { range.lower = current.lower; haveLower = true; } if ((current.upper > range.upper || !haveUpper) && current.upper < 0 && !qIsNaN(current.upper)) { range.upper = current.upper; haveUpper = true; } } } else if (signDomain == QCP::sdPositive) // range may only be in the positive sign domain { for (QCPDataContainer::const_iterator it = itBegin; it != itEnd; ++it) { if (restrictKeyRange && (it->mainKey() < inKeyRange.lower || it->mainKey() > inKeyRange.upper)) continue; current = it->valueRange(); if ((current.lower < range.lower || !haveLower) && current.lower > 0 && !qIsNaN(current.lower)) { range.lower = current.lower; haveLower = true; } if ((current.upper > range.upper || !haveUpper) && current.upper > 0 && !qIsNaN(current.upper)) { range.upper = current.upper; haveUpper = true; } } } foundRange = haveLower && haveUpper; return range; } /*! Makes sure \a begin and \a end mark a data range that is both within the bounds of this data container's data, as well as within the specified \a dataRange. This function doesn't require for \a dataRange to be within the bounds of this data container's valid range. */ template void QCPDataContainer::limitIteratorsToDataRange(const_iterator &begin, const_iterator &end, const QCPDataRange &dataRange) const { QCPDataRange iteratorRange(begin-constBegin(), end-constBegin()); iteratorRange = iteratorRange.bounded(dataRange.bounded(this->dataRange())); begin = constBegin()+iteratorRange.begin(); end = constBegin()+iteratorRange.end(); } /*! \internal Increases the preallocation pool to have a size of at least \a minimumPreallocSize. Depending on the preallocation history, the container will grow by more than requested, to speed up future consecutive size increases. if \a minimumPreallocSize is smaller than or equal to the current preallocation pool size, this method does nothing. */ template void QCPDataContainer::preallocateGrow(int minimumPreallocSize) { if (minimumPreallocSize <= mPreallocSize) return; int newPreallocSize = minimumPreallocSize; newPreallocSize += (1u< void QCPDataContainer::performAutoSqueeze() { const int totalAlloc = mData.capacity(); const int postAllocSize = totalAlloc-mData.size(); const int usedSize = size(); bool shrinkPostAllocation = false; bool shrinkPreAllocation = false; if (totalAlloc > 650000) // if allocation is larger, shrink earlier with respect to total used size { shrinkPostAllocation = postAllocSize > usedSize*1.5; // QVector grow strategy is 2^n for static data. Watch out not to oscillate! shrinkPreAllocation = mPreallocSize*10 > usedSize; } else if (totalAlloc > 1000) // below 10 MiB raw data be generous with preallocated memory, below 1k points don't even bother { shrinkPostAllocation = postAllocSize > usedSize*5; shrinkPreAllocation = mPreallocSize > usedSize*1.5; // preallocation can grow into postallocation, so can be smaller } if (shrinkPreAllocation || shrinkPostAllocation) squeeze(shrinkPreAllocation, shrinkPostAllocation); } /* end of 'src/datacontainer.cpp' */ /* end of 'src/datacontainer.h' */ /* including file 'src/plottable.h', size 8312 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPSelectionDecorator { Q_GADGET public: QCPSelectionDecorator(); virtual ~QCPSelectionDecorator(); // getters: QPen pen() const { return mPen; } QBrush brush() const { return mBrush; } QCPScatterStyle scatterStyle() const { return mScatterStyle; } QCPScatterStyle::ScatterProperties usedScatterProperties() const { return mUsedScatterProperties; } // setters: void setPen(const QPen &pen); void setBrush(const QBrush &brush); void setScatterStyle(const QCPScatterStyle &scatterStyle, QCPScatterStyle::ScatterProperties usedProperties=QCPScatterStyle::spPen); void setUsedScatterProperties(const QCPScatterStyle::ScatterProperties &properties); // non-virtual methods: void applyPen(QCPPainter *painter) const; void applyBrush(QCPPainter *painter) const; QCPScatterStyle getFinalScatterStyle(const QCPScatterStyle &unselectedStyle) const; // introduced virtual methods: virtual void copyFrom(const QCPSelectionDecorator *other); virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection); protected: // property members: QPen mPen; QBrush mBrush; QCPScatterStyle mScatterStyle; QCPScatterStyle::ScatterProperties mUsedScatterProperties; // non-property members: QCPAbstractPlottable *mPlottable; // introduced virtual methods: virtual bool registerWithPlottable(QCPAbstractPlottable *plottable); private: Q_DISABLE_COPY(QCPSelectionDecorator) friend class QCPAbstractPlottable; }; Q_DECLARE_METATYPE(QCPSelectionDecorator*) class QCP_LIB_DECL QCPAbstractPlottable : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QString name READ name WRITE setName) Q_PROPERTY(bool antialiasedFill READ antialiasedFill WRITE setAntialiasedFill) Q_PROPERTY(bool antialiasedScatters READ antialiasedScatters WRITE setAntialiasedScatters) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QCPAxis* keyAxis READ keyAxis WRITE setKeyAxis) Q_PROPERTY(QCPAxis* valueAxis READ valueAxis WRITE setValueAxis) Q_PROPERTY(QCP::SelectionType selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) Q_PROPERTY(QCPDataSelection selection READ selection WRITE setSelection NOTIFY selectionChanged) Q_PROPERTY(QCPSelectionDecorator* selectionDecorator READ selectionDecorator WRITE setSelectionDecorator) /// \endcond public: QCPAbstractPlottable(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPAbstractPlottable(); // getters: QString name() const { return mName; } bool antialiasedFill() const { return mAntialiasedFill; } bool antialiasedScatters() const { return mAntialiasedScatters; } QPen pen() const { return mPen; } QBrush brush() const { return mBrush; } QCPAxis *keyAxis() const { return mKeyAxis.data(); } QCPAxis *valueAxis() const { return mValueAxis.data(); } QCP::SelectionType selectable() const { return mSelectable; } bool selected() const { return !mSelection.isEmpty(); } QCPDataSelection selection() const { return mSelection; } QCPSelectionDecorator *selectionDecorator() const { return mSelectionDecorator; } // setters: void setName(const QString &name); void setAntialiasedFill(bool enabled); void setAntialiasedScatters(bool enabled); void setPen(const QPen &pen); void setBrush(const QBrush &brush); void setKeyAxis(QCPAxis *axis); void setValueAxis(QCPAxis *axis); Q_SLOT void setSelectable(QCP::SelectionType selectable); Q_SLOT void setSelection(QCPDataSelection selection); void setSelectionDecorator(QCPSelectionDecorator *decorator); // introduced virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const = 0; virtual QCPPlottableInterface1D *interface1D() { return 0; } virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const = 0; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const = 0; // non-property methods: void coordsToPixels(double key, double value, double &x, double &y) const; const QPointF coordsToPixels(double key, double value) const; void pixelsToCoords(double x, double y, double &key, double &value) const; void pixelsToCoords(const QPointF &pixelPos, double &key, double &value) const; void rescaleAxes(bool onlyEnlarge=false) const; void rescaleKeyAxis(bool onlyEnlarge=false) const; void rescaleValueAxis(bool onlyEnlarge=false, bool inKeyRange=false) const; bool addToLegend(QCPLegend *legend); bool addToLegend(); bool removeFromLegend(QCPLegend *legend) const; bool removeFromLegend() const; signals: void selectionChanged(bool selected); void selectionChanged(const QCPDataSelection &selection); void selectableChanged(QCP::SelectionType selectable); protected: // property members: QString mName; bool mAntialiasedFill, mAntialiasedScatters; QPen mPen; QBrush mBrush; QPointer mKeyAxis, mValueAxis; QCP::SelectionType mSelectable; QCPDataSelection mSelection; QCPSelectionDecorator *mSelectionDecorator; // reimplemented virtual methods: virtual QRect clipRect() const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0; virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; // events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE; virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; // introduced virtual methods: virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const = 0; // non-virtual methods: void applyFillAntialiasingHint(QCPPainter *painter) const; void applyScattersAntialiasingHint(QCPPainter *painter) const; private: Q_DISABLE_COPY(QCPAbstractPlottable) friend class QCustomPlot; friend class QCPAxis; friend class QCPPlottableLegendItem; }; /* end of 'src/plottable.h' */ /* including file 'src/item.h', size 9368 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemAnchor { Q_GADGET public: QCPItemAnchor(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name, int anchorId=-1); virtual ~QCPItemAnchor(); // getters: QString name() const { return mName; } virtual QPointF pixelPosition() const; protected: // property members: QString mName; // non-property members: QCustomPlot *mParentPlot; QCPAbstractItem *mParentItem; int mAnchorId; QSet mChildrenX, mChildrenY; // introduced virtual methods: virtual QCPItemPosition *toQCPItemPosition() { return 0; } // non-virtual methods: void addChildX(QCPItemPosition* pos); // called from pos when this anchor is set as parent void removeChildX(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted void addChildY(QCPItemPosition* pos); // called from pos when this anchor is set as parent void removeChildY(QCPItemPosition *pos); // called from pos when its parent anchor is reset or pos deleted private: Q_DISABLE_COPY(QCPItemAnchor) friend class QCPItemPosition; }; class QCP_LIB_DECL QCPItemPosition : public QCPItemAnchor { Q_GADGET public: /*! Defines the ways an item position can be specified. Thus it defines what the numbers passed to \ref setCoords actually mean. \see setType */ enum PositionType { ptAbsolute ///< Static positioning in pixels, starting from the top left corner of the viewport/widget. ,ptViewportRatio ///< Static positioning given by a fraction of the viewport size. For example, if you call setCoords(0, 0), the position will be at the top ///< left corner of the viewport/widget. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and ///< vertically at the top of the viewport/widget, etc. ,ptAxisRectRatio ///< Static positioning given by a fraction of the axis rect size (see \ref setAxisRect). For example, if you call setCoords(0, 0), the position will be at the top ///< left corner of the axis rect. setCoords(1, 1) will be at the bottom right corner, setCoords(0.5, 0) will be horizontally centered and ///< vertically at the top of the axis rect, etc. You can also go beyond the axis rect by providing negative coordinates or coordinates larger than 1. ,ptPlotCoords ///< Dynamic positioning at a plot coordinate defined by two axes (see \ref setAxes). }; Q_ENUMS(PositionType) QCPItemPosition(QCustomPlot *parentPlot, QCPAbstractItem *parentItem, const QString &name); virtual ~QCPItemPosition(); // getters: PositionType type() const { return typeX(); } PositionType typeX() const { return mPositionTypeX; } PositionType typeY() const { return mPositionTypeY; } QCPItemAnchor *parentAnchor() const { return parentAnchorX(); } QCPItemAnchor *parentAnchorX() const { return mParentAnchorX; } QCPItemAnchor *parentAnchorY() const { return mParentAnchorY; } double key() const { return mKey; } double value() const { return mValue; } QPointF coords() const { return QPointF(mKey, mValue); } QCPAxis *keyAxis() const { return mKeyAxis.data(); } QCPAxis *valueAxis() const { return mValueAxis.data(); } QCPAxisRect *axisRect() const; virtual QPointF pixelPosition() const; // setters: void setType(PositionType type); void setTypeX(PositionType type); void setTypeY(PositionType type); bool setParentAnchor(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false); bool setParentAnchorX(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false); bool setParentAnchorY(QCPItemAnchor *parentAnchor, bool keepPixelPosition=false); void setCoords(double key, double value); void setCoords(const QPointF &coords); void setAxes(QCPAxis* keyAxis, QCPAxis* valueAxis); void setAxisRect(QCPAxisRect *axisRect); void setPixelPosition(const QPointF &pixelPosition); protected: // property members: PositionType mPositionTypeX, mPositionTypeY; QPointer mKeyAxis, mValueAxis; QPointer mAxisRect; double mKey, mValue; QCPItemAnchor *mParentAnchorX, *mParentAnchorY; // reimplemented virtual methods: virtual QCPItemPosition *toQCPItemPosition() Q_DECL_OVERRIDE { return this; } private: Q_DISABLE_COPY(QCPItemPosition) }; Q_DECLARE_METATYPE(QCPItemPosition::PositionType) class QCP_LIB_DECL QCPAbstractItem : public QCPLayerable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(bool clipToAxisRect READ clipToAxisRect WRITE setClipToAxisRect) Q_PROPERTY(QCPAxisRect* clipAxisRect READ clipAxisRect WRITE setClipAxisRect) Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged) /// \endcond public: explicit QCPAbstractItem(QCustomPlot *parentPlot); virtual ~QCPAbstractItem(); // getters: bool clipToAxisRect() const { return mClipToAxisRect; } QCPAxisRect *clipAxisRect() const; bool selectable() const { return mSelectable; } bool selected() const { return mSelected; } // setters: void setClipToAxisRect(bool clip); void setClipAxisRect(QCPAxisRect *rect); Q_SLOT void setSelectable(bool selectable); Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE = 0; // non-virtual methods: QList positions() const { return mPositions; } QList anchors() const { return mAnchors; } QCPItemPosition *position(const QString &name) const; QCPItemAnchor *anchor(const QString &name) const; bool hasAnchor(const QString &name) const; signals: void selectionChanged(bool selected); void selectableChanged(bool selectable); protected: // property members: bool mClipToAxisRect; QPointer mClipAxisRect; QList mPositions; QList mAnchors; bool mSelectable, mSelected; // reimplemented virtual methods: virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; virtual QRect clipRect() const Q_DECL_OVERRIDE; virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0; // events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE; virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; // introduced virtual methods: virtual QPointF anchorPixelPosition(int anchorId) const; // non-virtual methods: double rectDistance(const QRectF &rect, const QPointF &pos, bool filledRect) const; QCPItemPosition *createPosition(const QString &name); QCPItemAnchor *createAnchor(const QString &name, int anchorId); private: Q_DISABLE_COPY(QCPAbstractItem) friend class QCustomPlot; friend class QCPItemAnchor; }; /* end of 'src/item.h' */ /* including file 'src/core.h', size 14797 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCustomPlot : public QWidget { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QRect viewport READ viewport WRITE setViewport) Q_PROPERTY(QPixmap background READ background WRITE setBackground) Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled) Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode) Q_PROPERTY(QCPLayoutGrid* plotLayout READ plotLayout) Q_PROPERTY(bool autoAddPlottableToLegend READ autoAddPlottableToLegend WRITE setAutoAddPlottableToLegend) Q_PROPERTY(int selectionTolerance READ selectionTolerance WRITE setSelectionTolerance) Q_PROPERTY(bool noAntialiasingOnDrag READ noAntialiasingOnDrag WRITE setNoAntialiasingOnDrag) Q_PROPERTY(Qt::KeyboardModifier multiSelectModifier READ multiSelectModifier WRITE setMultiSelectModifier) Q_PROPERTY(bool openGl READ openGl WRITE setOpenGl) /// \endcond public: /*! Defines how a layer should be inserted relative to an other layer. \see addLayer, moveLayer */ enum LayerInsertMode { limBelow ///< Layer is inserted below other layer ,limAbove ///< Layer is inserted above other layer }; Q_ENUMS(LayerInsertMode) /*! Defines with what timing the QCustomPlot surface is refreshed after a replot. \see replot */ enum RefreshPriority { rpImmediateRefresh ///< Replots immediately and repaints the widget immediately by calling QWidget::repaint() after the replot ,rpQueuedRefresh ///< Replots immediately, but queues the widget repaint, by calling QWidget::update() after the replot. This way multiple redundant widget repaints can be avoided. ,rpRefreshHint ///< Whether to use immediate or queued refresh depends on whether the plotting hint \ref QCP::phImmediateRefresh is set, see \ref setPlottingHints. ,rpQueuedReplot ///< Queues the entire replot for the next event loop iteration. This way multiple redundant replots can be avoided. The actual replot is then done with \ref rpRefreshHint priority. }; Q_ENUMS(RefreshPriority) explicit QCustomPlot(QWidget *parent = 0); virtual ~QCustomPlot(); // getters: QRect viewport() const { return mViewport; } double bufferDevicePixelRatio() const { return mBufferDevicePixelRatio; } QPixmap background() const { return mBackgroundPixmap; } bool backgroundScaled() const { return mBackgroundScaled; } Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; } QCPLayoutGrid *plotLayout() const { return mPlotLayout; } QCP::AntialiasedElements antialiasedElements() const { return mAntialiasedElements; } QCP::AntialiasedElements notAntialiasedElements() const { return mNotAntialiasedElements; } bool autoAddPlottableToLegend() const { return mAutoAddPlottableToLegend; } const QCP::Interactions interactions() const { return mInteractions; } int selectionTolerance() const { return mSelectionTolerance; } bool noAntialiasingOnDrag() const { return mNoAntialiasingOnDrag; } QCP::PlottingHints plottingHints() const { return mPlottingHints; } Qt::KeyboardModifier multiSelectModifier() const { return mMultiSelectModifier; } QCP::SelectionRectMode selectionRectMode() const { return mSelectionRectMode; } QCPSelectionRect *selectionRect() const { return mSelectionRect; } bool openGl() const { return mOpenGl; } // setters: void setViewport(const QRect &rect); void setBufferDevicePixelRatio(double ratio); void setBackground(const QPixmap &pm); void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding); void setBackground(const QBrush &brush); void setBackgroundScaled(bool scaled); void setBackgroundScaledMode(Qt::AspectRatioMode mode); void setAntialiasedElements(const QCP::AntialiasedElements &antialiasedElements); void setAntialiasedElement(QCP::AntialiasedElement antialiasedElement, bool enabled=true); void setNotAntialiasedElements(const QCP::AntialiasedElements ¬AntialiasedElements); void setNotAntialiasedElement(QCP::AntialiasedElement notAntialiasedElement, bool enabled=true); void setAutoAddPlottableToLegend(bool on); void setInteractions(const QCP::Interactions &interactions); void setInteraction(const QCP::Interaction &interaction, bool enabled=true); void setSelectionTolerance(int pixels); void setNoAntialiasingOnDrag(bool enabled); void setPlottingHints(const QCP::PlottingHints &hints); void setPlottingHint(QCP::PlottingHint hint, bool enabled=true); void setMultiSelectModifier(Qt::KeyboardModifier modifier); void setSelectionRectMode(QCP::SelectionRectMode mode); void setSelectionRect(QCPSelectionRect *selectionRect); void setOpenGl(bool enabled, int multisampling=16); // non-property methods: // plottable interface: QCPAbstractPlottable *plottable(int index); QCPAbstractPlottable *plottable(); bool removePlottable(QCPAbstractPlottable *plottable); bool removePlottable(int index); int clearPlottables(); int plottableCount() const; QList selectedPlottables() const; QCPAbstractPlottable *plottableAt(const QPointF &pos, bool onlySelectable=false) const; bool hasPlottable(QCPAbstractPlottable *plottable) const; // specialized interface for QCPGraph: QCPGraph *graph(int index) const; QCPGraph *graph() const; QCPGraph *addGraph(QCPAxis *keyAxis=0, QCPAxis *valueAxis=0); bool removeGraph(QCPGraph *graph); bool removeGraph(int index); int clearGraphs(); int graphCount() const; QList selectedGraphs() const; // item interface: QCPAbstractItem *item(int index) const; QCPAbstractItem *item() const; bool removeItem(QCPAbstractItem *item); bool removeItem(int index); int clearItems(); int itemCount() const; QList selectedItems() const; QCPAbstractItem *itemAt(const QPointF &pos, bool onlySelectable=false) const; bool hasItem(QCPAbstractItem *item) const; // layer interface: QCPLayer *layer(const QString &name) const; QCPLayer *layer(int index) const; QCPLayer *currentLayer() const; bool setCurrentLayer(const QString &name); bool setCurrentLayer(QCPLayer *layer); int layerCount() const; bool addLayer(const QString &name, QCPLayer *otherLayer=0, LayerInsertMode insertMode=limAbove); bool removeLayer(QCPLayer *layer); bool moveLayer(QCPLayer *layer, QCPLayer *otherLayer, LayerInsertMode insertMode=limAbove); // axis rect/layout interface: int axisRectCount() const; QCPAxisRect* axisRect(int index=0) const; QList axisRects() const; QCPLayoutElement* layoutElementAt(const QPointF &pos) const; QCPAxisRect* axisRectAt(const QPointF &pos) const; Q_SLOT void rescaleAxes(bool onlyVisiblePlottables=false); QList selectedAxes() const; QList selectedLegends() const; Q_SLOT void deselectAll(); bool savePdf(const QString &fileName, int width=0, int height=0, QCP::ExportPen exportPen=QCP::epAllowCosmetic, const QString &pdfCreator=QString(), const QString &pdfTitle=QString()); bool savePng(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch); bool saveJpg(const QString &fileName, int width=0, int height=0, double scale=1.0, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch); bool saveBmp(const QString &fileName, int width=0, int height=0, double scale=1.0, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch); bool saveRastered(const QString &fileName, int width, int height, double scale, const char *format, int quality=-1, int resolution=96, QCP::ResolutionUnit resolutionUnit=QCP::ruDotsPerInch); QPixmap toPixmap(int width=0, int height=0, double scale=1.0); void toPainter(QCPPainter *painter, int width=0, int height=0); Q_SLOT void replot(QCustomPlot::RefreshPriority refreshPriority=QCustomPlot::rpRefreshHint); QCPAxis *xAxis, *yAxis, *xAxis2, *yAxis2; QCPLegend *legend; signals: void mouseDoubleClick(QMouseEvent *event); void mousePress(QMouseEvent *event); void mouseMove(QMouseEvent *event); void mouseRelease(QMouseEvent *event); void mouseWheel(QWheelEvent *event); void plottableClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event); void plottableDoubleClick(QCPAbstractPlottable *plottable, int dataIndex, QMouseEvent *event); void itemClick(QCPAbstractItem *item, QMouseEvent *event); void itemDoubleClick(QCPAbstractItem *item, QMouseEvent *event); void axisClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event); void axisDoubleClick(QCPAxis *axis, QCPAxis::SelectablePart part, QMouseEvent *event); void legendClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event); void legendDoubleClick(QCPLegend *legend, QCPAbstractLegendItem *item, QMouseEvent *event); void selectionChangedByUser(); void beforeReplot(); void afterReplot(); protected: // property members: QRect mViewport; double mBufferDevicePixelRatio; QCPLayoutGrid *mPlotLayout; bool mAutoAddPlottableToLegend; QList mPlottables; QList mGraphs; // extra list of plottables also in mPlottables that are of type QCPGraph QList mItems; QList mLayers; QCP::AntialiasedElements mAntialiasedElements, mNotAntialiasedElements; QCP::Interactions mInteractions; int mSelectionTolerance; bool mNoAntialiasingOnDrag; QBrush mBackgroundBrush; QPixmap mBackgroundPixmap; QPixmap mScaledBackgroundPixmap; bool mBackgroundScaled; Qt::AspectRatioMode mBackgroundScaledMode; QCPLayer *mCurrentLayer; QCP::PlottingHints mPlottingHints; Qt::KeyboardModifier mMultiSelectModifier; QCP::SelectionRectMode mSelectionRectMode; QCPSelectionRect *mSelectionRect; bool mOpenGl; // non-property members: QList > mPaintBuffers; QPoint mMousePressPos; bool mMouseHasMoved; QPointer mMouseEventLayerable; QVariant mMouseEventLayerableDetails; bool mReplotting; bool mReplotQueued; int mOpenGlMultisamples; QCP::AntialiasedElements mOpenGlAntialiasedElementsBackup; bool mOpenGlCacheLabelsBackup; #ifdef QCP_OPENGL_FBO QSharedPointer mGlContext; QSharedPointer mGlSurface; QSharedPointer mGlPaintDevice; #endif // reimplemented virtual methods: virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; virtual QSize sizeHint() const Q_DECL_OVERRIDE; virtual void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; virtual void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; virtual void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE; virtual void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE; virtual void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; virtual void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; // introduced virtual methods: virtual void draw(QCPPainter *painter); virtual void updateLayout(); virtual void axisRemoved(QCPAxis *axis); virtual void legendRemoved(QCPLegend *legend); Q_SLOT virtual void processRectSelection(QRect rect, QMouseEvent *event); Q_SLOT virtual void processRectZoom(QRect rect, QMouseEvent *event); Q_SLOT virtual void processPointSelection(QMouseEvent *event); // non-virtual methods: bool registerPlottable(QCPAbstractPlottable *plottable); bool registerGraph(QCPGraph *graph); bool registerItem(QCPAbstractItem* item); void updateLayerIndices() const; QCPLayerable *layerableAt(const QPointF &pos, bool onlySelectable, QVariant *selectionDetails=0) const; QList layerableListAt(const QPointF &pos, bool onlySelectable, QList *selectionDetails=0) const; void drawBackground(QCPPainter *painter); void setupPaintBuffers(); QCPAbstractPaintBuffer *createPaintBuffer(); bool hasInvalidatedPaintBuffers(); bool setupOpenGl(); void freeOpenGl(); friend class QCPLegend; friend class QCPAxis; friend class QCPLayer; friend class QCPAxisRect; friend class QCPAbstractPlottable; friend class QCPGraph; friend class QCPAbstractItem; }; Q_DECLARE_METATYPE(QCustomPlot::LayerInsertMode) Q_DECLARE_METATYPE(QCustomPlot::RefreshPriority) /* end of 'src/core.h' */ /* including file 'src/plottable1d.h', size 4250 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPPlottableInterface1D { public: // introduced pure virtual methods: virtual int dataCount() const = 0; virtual double dataMainKey(int index) const = 0; virtual double dataSortKey(int index) const = 0; virtual double dataMainValue(int index) const = 0; virtual QCPRange dataValueRange(int index) const = 0; virtual QPointF dataPixelPosition(int index) const = 0; virtual bool sortKeyIsMainKey() const = 0; virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const = 0; virtual int findBegin(double sortKey, bool expandedRange=true) const = 0; virtual int findEnd(double sortKey, bool expandedRange=true) const = 0; }; template class QCP_LIB_DECL QCPAbstractPlottable1D : public QCPAbstractPlottable, public QCPPlottableInterface1D { // No Q_OBJECT macro due to template class public: QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPAbstractPlottable1D(); // virtual methods of 1d plottable interface: virtual int dataCount() const; virtual double dataMainKey(int index) const; virtual double dataSortKey(int index) const; virtual double dataMainValue(int index) const; virtual QCPRange dataValueRange(int index) const; virtual QPointF dataPixelPosition(int index) const; virtual bool sortKeyIsMainKey() const; virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const; virtual int findBegin(double sortKey, bool expandedRange=true) const; virtual int findEnd(double sortKey, bool expandedRange=true) const; // virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const; virtual QCPPlottableInterface1D *interface1D() { return this; } protected: // property members: QSharedPointer > mDataContainer; // helpers for subclasses: void getDataSegments(QList &selectedSegments, QList &unselectedSegments) const; void drawPolyline(QCPPainter *painter, const QVector &lineData) const; private: Q_DISABLE_COPY(QCPAbstractPlottable1D) }; // include implementation in header since it is a class template: /* including file 'src/plottable1d.cpp', size 22240 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPPlottableInterface1D //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPPlottableInterface1D \brief Defines an abstract interface for one-dimensional plottables This class contains only pure virtual methods which define a common interface to the data of one-dimensional plottables. For example, it is implemented by the template class \ref QCPAbstractPlottable1D (the preferred base class for one-dimensional plottables). So if you use that template class as base class of your one-dimensional plottable, you won't have to care about implementing the 1d interface yourself. If your plottable doesn't derive from \ref QCPAbstractPlottable1D but still wants to provide a 1d interface (e.g. like \ref QCPErrorBars does), you should inherit from both \ref QCPAbstractPlottable and \ref QCPPlottableInterface1D and accordingly reimplement the pure virtual methods of the 1d interface, matching your data container. Also, reimplement \ref QCPAbstractPlottable::interface1D to return the \c this pointer. If you have a \ref QCPAbstractPlottable pointer, you can check whether it implements this interface by calling \ref QCPAbstractPlottable::interface1D and testing it for a non-zero return value. If it indeed implements this interface, you may use it to access the plottable's data without needing to know the exact type of the plottable or its data point type. */ /* start documentation of pure virtual functions */ /*! \fn virtual int QCPPlottableInterface1D::dataCount() const = 0; Returns the number of data points of the plottable. */ /*! \fn virtual QCPDataSelection QCPPlottableInterface1D::selectTestRect(const QRectF &rect, bool onlySelectable) const = 0; Returns a data selection containing all the data points of this plottable which are contained (or hit by) \a rect. This is used mainly in the selection rect interaction for data selection (\ref dataselection "data selection mechanism"). If \a onlySelectable is true, an empty QCPDataSelection is returned if this plottable is not selectable (i.e. if \ref QCPAbstractPlottable::setSelectable is \ref QCP::stNone). \note \a rect must be a normalized rect (positive or zero width and height). This is especially important when using the rect of \ref QCPSelectionRect::accepted, which is not necessarily normalized. Use QRect::normalized() when passing a rect which might not be normalized. */ /*! \fn virtual double QCPPlottableInterface1D::dataMainKey(int index) const = 0 Returns the main key of the data point at the given \a index. What the main key is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual double QCPPlottableInterface1D::dataSortKey(int index) const = 0 Returns the sort key of the data point at the given \a index. What the sort key is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual double QCPPlottableInterface1D::dataMainValue(int index) const = 0 Returns the main value of the data point at the given \a index. What the main value is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual QCPRange QCPPlottableInterface1D::dataValueRange(int index) const = 0 Returns the value range of the data point at the given \a index. What the value range is, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual QPointF QCPPlottableInterface1D::dataPixelPosition(int index) const = 0 Returns the pixel position on the widget surface at which the data point at the given \a index appears. Usually this corresponds to the point of \ref dataMainKey/\ref dataMainValue, in pixel coordinates. However, depending on the plottable, this might be a different apparent position than just a coord-to-pixel transform of those values. For example, \ref QCPBars apparent data values can be shifted depending on their stacking, bar grouping or configured base value. */ /*! \fn virtual bool QCPPlottableInterface1D::sortKeyIsMainKey() const = 0 Returns whether the sort key (\ref dataSortKey) is identical to the main key (\ref dataMainKey). What the sort and main keys are, is defined by the plottable's data type. See the \ref qcpdatacontainer-datatype "QCPDataContainer DataType" documentation for details about this naming convention. */ /*! \fn virtual int QCPPlottableInterface1D::findBegin(double sortKey, bool expandedRange) const = 0 Returns the index of the data point with a (sort-)key that is equal to, just below, or just above \a sortKey. If \a expandedRange is true, the data point just below \a sortKey will be considered, otherwise the one just above. This can be used in conjunction with \ref findEnd to iterate over data points within a given key range, including or excluding the bounding data points that are just beyond the specified range. If \a expandedRange is true but there are no data points below \a sortKey, 0 is returned. If the container is empty, returns 0 (in that case, \ref findEnd will also return 0, so a loop using these methods will not iterate over the index 0). \see findEnd, QCPDataContainer::findBegin */ /*! \fn virtual int QCPPlottableInterface1D::findEnd(double sortKey, bool expandedRange) const = 0 Returns the index one after the data point with a (sort-)key that is equal to, just above, or just below \a sortKey. If \a expandedRange is true, the data point just above \a sortKey will be considered, otherwise the one just below. This can be used in conjunction with \ref findBegin to iterate over data points within a given key range, including the bounding data points that are just below and above the specified range. If \a expandedRange is true but there are no data points above \a sortKey, the index just above the highest data point is returned. If the container is empty, returns 0. \see findBegin, QCPDataContainer::findEnd */ /* end documentation of pure virtual functions */ //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////// QCPAbstractPlottable1D //////////////////////////////////////////////////////////////////////////////////////////////////// /*! \class QCPAbstractPlottable1D \brief A template base class for plottables with one-dimensional data This template class derives from \ref QCPAbstractPlottable and from the abstract interface \ref QCPPlottableInterface1D. It serves as a base class for all one-dimensional data (i.e. data with one key dimension), such as \ref QCPGraph and QCPCurve. The template parameter \a DataType is the type of the data points of this plottable (e.g. \ref QCPGraphData or \ref QCPCurveData). The main purpose of this base class is to provide the member \a mDataContainer (a shared pointer to a \ref QCPDataContainer "QCPDataContainer") and implement the according virtual methods of the \ref QCPPlottableInterface1D, such that most subclassed plottables don't need to worry about this anymore. Further, it provides a convenience method for retrieving selected/unselected data segments via \ref getDataSegments. This is useful when subclasses implement their \ref draw method and need to draw selected segments with a different pen/brush than unselected segments (also see \ref QCPSelectionDecorator). This class implements basic functionality of \ref QCPAbstractPlottable::selectTest and \ref QCPPlottableInterface1D::selectTestRect, assuming point-like data points, based on the 1D data interface. In spite of that, most plottable subclasses will want to reimplement those methods again, to provide a more accurate hit test based on their specific data visualization geometry. */ /* start documentation of inline functions */ /*! \fn QCPPlottableInterface1D *QCPAbstractPlottable1D::interface1D() Returns a \ref QCPPlottableInterface1D pointer to this plottable, providing access to its 1D interface. \seebaseclassmethod */ /* end documentation of inline functions */ /*! Forwards \a keyAxis and \a valueAxis to the \ref QCPAbstractPlottable::QCPAbstractPlottable "QCPAbstractPlottable" constructor and allocates the \a mDataContainer. */ template QCPAbstractPlottable1D::QCPAbstractPlottable1D(QCPAxis *keyAxis, QCPAxis *valueAxis) : QCPAbstractPlottable(keyAxis, valueAxis), mDataContainer(new QCPDataContainer) { } template QCPAbstractPlottable1D::~QCPAbstractPlottable1D() { } /*! \copydoc QCPPlottableInterface1D::dataCount */ template int QCPAbstractPlottable1D::dataCount() const { return mDataContainer->size(); } /*! \copydoc QCPPlottableInterface1D::dataMainKey */ template double QCPAbstractPlottable1D::dataMainKey(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin()+index)->mainKey(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return 0; } } /*! \copydoc QCPPlottableInterface1D::dataSortKey */ template double QCPAbstractPlottable1D::dataSortKey(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin()+index)->sortKey(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return 0; } } /*! \copydoc QCPPlottableInterface1D::dataMainValue */ template double QCPAbstractPlottable1D::dataMainValue(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin()+index)->mainValue(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return 0; } } /*! \copydoc QCPPlottableInterface1D::dataValueRange */ template QCPRange QCPAbstractPlottable1D::dataValueRange(int index) const { if (index >= 0 && index < mDataContainer->size()) { return (mDataContainer->constBegin()+index)->valueRange(); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return QCPRange(0, 0); } } /*! \copydoc QCPPlottableInterface1D::dataPixelPosition */ template QPointF QCPAbstractPlottable1D::dataPixelPosition(int index) const { if (index >= 0 && index < mDataContainer->size()) { const typename QCPDataContainer::const_iterator it = mDataContainer->constBegin()+index; return coordsToPixels(it->mainKey(), it->mainValue()); } else { qDebug() << Q_FUNC_INFO << "Index out of bounds" << index; return QPointF(); } } /*! \copydoc QCPPlottableInterface1D::sortKeyIsMainKey */ template bool QCPAbstractPlottable1D::sortKeyIsMainKey() const { return DataType::sortKeyIsMainKey(); } /*! Implements a rect-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry. \seebaseclassmethod */ template QCPDataSelection QCPAbstractPlottable1D::selectTestRect(const QRectF &rect, bool onlySelectable) const { QCPDataSelection result; if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return result; if (!mKeyAxis || !mValueAxis) return result; // convert rect given in pixels to ranges given in plot coordinates: double key1, value1, key2, value2; pixelsToCoords(rect.topLeft(), key1, value1); pixelsToCoords(rect.bottomRight(), key2, value2); QCPRange keyRange(key1, key2); // QCPRange normalizes internally so we don't have to care about whether key1 < key2 QCPRange valueRange(value1, value2); typename QCPDataContainer::const_iterator begin = mDataContainer->constBegin(); typename QCPDataContainer::const_iterator end = mDataContainer->constEnd(); if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval: { begin = mDataContainer->findBegin(keyRange.lower, false); end = mDataContainer->findEnd(keyRange.upper, false); } if (begin == end) return result; int currentSegmentBegin = -1; // -1 means we're currently not in a segment that's contained in rect for (typename QCPDataContainer::const_iterator it=begin; it!=end; ++it) { if (currentSegmentBegin == -1) { if (valueRange.contains(it->mainValue()) && keyRange.contains(it->mainKey())) // start segment currentSegmentBegin = it-mDataContainer->constBegin(); } else if (!valueRange.contains(it->mainValue()) || !keyRange.contains(it->mainKey())) // segment just ended { result.addDataRange(QCPDataRange(currentSegmentBegin, it-mDataContainer->constBegin()), false); currentSegmentBegin = -1; } } // process potential last segment: if (currentSegmentBegin != -1) result.addDataRange(QCPDataRange(currentSegmentBegin, end-mDataContainer->constBegin()), false); result.simplify(); return result; } /*! \copydoc QCPPlottableInterface1D::findBegin */ template int QCPAbstractPlottable1D::findBegin(double sortKey, bool expandedRange) const { return mDataContainer->findBegin(sortKey, expandedRange)-mDataContainer->constBegin(); } /*! \copydoc QCPPlottableInterface1D::findEnd */ template int QCPAbstractPlottable1D::findEnd(double sortKey, bool expandedRange) const { return mDataContainer->findEnd(sortKey, expandedRange)-mDataContainer->constBegin(); } /*! Implements a point-selection algorithm assuming the data (accessed via the 1D data interface) is point-like. Most subclasses will want to reimplement this method again, to provide a more accurate hit test based on the true data visualization geometry. \seebaseclassmethod */ template double QCPAbstractPlottable1D::selectTest(const QPointF &pos, bool onlySelectable, QVariant *details) const { if ((onlySelectable && mSelectable == QCP::stNone) || mDataContainer->isEmpty()) return -1; if (!mKeyAxis || !mValueAxis) return -1; QCPDataSelection selectionResult; double minDistSqr = std::numeric_limits::max(); int minDistIndex = mDataContainer->size(); typename QCPDataContainer::const_iterator begin = mDataContainer->constBegin(); typename QCPDataContainer::const_iterator end = mDataContainer->constEnd(); if (DataType::sortKeyIsMainKey()) // we can assume that data is sorted by main key, so can reduce the searched key interval: { // determine which key range comes into question, taking selection tolerance around pos into account: double posKeyMin, posKeyMax, dummy; pixelsToCoords(pos-QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMin, dummy); pixelsToCoords(pos+QPointF(mParentPlot->selectionTolerance(), mParentPlot->selectionTolerance()), posKeyMax, dummy); if (posKeyMin > posKeyMax) qSwap(posKeyMin, posKeyMax); begin = mDataContainer->findBegin(posKeyMin, true); end = mDataContainer->findEnd(posKeyMax, true); } if (begin == end) return -1; QCPRange keyRange(mKeyAxis->range()); QCPRange valueRange(mValueAxis->range()); for (typename QCPDataContainer::const_iterator it=begin; it!=end; ++it) { const double mainKey = it->mainKey(); const double mainValue = it->mainValue(); if (keyRange.contains(mainKey) && valueRange.contains(mainValue)) // make sure data point is inside visible range, for speedup in cases where sort key isn't main key and we iterate over all points { const double currentDistSqr = QCPVector2D(coordsToPixels(mainKey, mainValue)-pos).lengthSquared(); if (currentDistSqr < minDistSqr) { minDistSqr = currentDistSqr; minDistIndex = it-mDataContainer->constBegin(); } } } if (minDistIndex != mDataContainer->size()) selectionResult.addDataRange(QCPDataRange(minDistIndex, minDistIndex+1), false); selectionResult.simplify(); if (details) details->setValue(selectionResult); return qSqrt(minDistSqr); } /*! Splits all data into selected and unselected segments and outputs them via \a selectedSegments and \a unselectedSegments, respectively. This is useful when subclasses implement their \ref draw method and need to draw selected segments with a different pen/brush than unselected segments (also see \ref QCPSelectionDecorator). \see setSelection */ template void QCPAbstractPlottable1D::getDataSegments(QList &selectedSegments, QList &unselectedSegments) const { selectedSegments.clear(); unselectedSegments.clear(); if (mSelectable == QCP::stWhole) // stWhole selection type draws the entire plottable with selected style if mSelection isn't empty { if (selected()) selectedSegments << QCPDataRange(0, dataCount()); else unselectedSegments << QCPDataRange(0, dataCount()); } else { QCPDataSelection sel(selection()); sel.simplify(); selectedSegments = sel.dataRanges(); unselectedSegments = sel.inverse(QCPDataRange(0, dataCount())).dataRanges(); } } /*! A helper method which draws a line with the passed \a painter, according to the pixel data in \a lineData. NaN points create gaps in the line, as expected from QCustomPlot's plottables (this is the main difference to QPainter's regular drawPolyline, which handles NaNs by lagging or crashing). Further it uses a faster line drawing technique based on \ref QCPPainter::drawLine rather than \c QPainter::drawPolyline if the configured \ref QCustomPlot::setPlottingHints() and \a painter style allows. */ template void QCPAbstractPlottable1D::drawPolyline(QCPPainter *painter, const QVector &lineData) const { // if drawing solid line and not in PDF, use much faster line drawing instead of polyline: if (mParentPlot->plottingHints().testFlag(QCP::phFastPolylines) && painter->pen().style() == Qt::SolidLine && !painter->modes().testFlag(QCPPainter::pmVectorized) && !painter->modes().testFlag(QCPPainter::pmNoCaching)) { int i = 0; bool lastIsNan = false; const int lineDataSize = lineData.size(); while (i < lineDataSize && (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()))) // make sure first point is not NaN ++i; ++i; // because drawing works in 1 point retrospect while (i < lineDataSize) { if (!qIsNaN(lineData.at(i).y()) && !qIsNaN(lineData.at(i).x())) // NaNs create a gap in the line { if (!lastIsNan) painter->drawLine(lineData.at(i-1), lineData.at(i)); else lastIsNan = false; } else lastIsNan = true; ++i; } } else { int segmentStart = 0; int i = 0; const int lineDataSize = lineData.size(); while (i < lineDataSize) { if (qIsNaN(lineData.at(i).y()) || qIsNaN(lineData.at(i).x()) || qIsInf(lineData.at(i).y())) // NaNs create a gap in the line. Also filter Infs which make drawPolyline block { painter->drawPolyline(lineData.constData()+segmentStart, i-segmentStart); // i, because we don't want to include the current NaN point segmentStart = i+1; } ++i; } // draw last segment: painter->drawPolyline(lineData.constData()+segmentStart, lineDataSize-segmentStart); } } /* end of 'src/plottable1d.cpp' */ /* end of 'src/plottable1d.h' */ /* including file 'src/colorgradient.h', size 6243 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPColorGradient { Q_GADGET public: /*! Defines the color spaces in which color interpolation between gradient stops can be performed. \see setColorInterpolation */ enum ColorInterpolation { ciRGB ///< Color channels red, green and blue are linearly interpolated ,ciHSV ///< Color channels hue, saturation and value are linearly interpolated (The hue is interpolated over the shortest angle distance) }; Q_ENUMS(ColorInterpolation) /*! Defines the available presets that can be loaded with \ref loadPreset. See the documentation there for an image of the presets. */ enum GradientPreset { gpGrayscale ///< Continuous lightness from black to white (suited for non-biased data representation) ,gpHot ///< Continuous lightness from black over firey colors to white (suited for non-biased data representation) ,gpCold ///< Continuous lightness from black over icey colors to white (suited for non-biased data representation) ,gpNight ///< Continuous lightness from black over weak blueish colors to white (suited for non-biased data representation) ,gpCandy ///< Blue over pink to white ,gpGeography ///< Colors suitable to represent different elevations on geographical maps ,gpIon ///< Half hue spectrum from black over purple to blue and finally green (creates banding illusion but allows more precise magnitude estimates) ,gpThermal ///< Colors suitable for thermal imaging, ranging from dark blue over purple to orange, yellow and white ,gpPolar ///< Colors suitable to emphasize polarity around the center, with blue for negative, black in the middle and red for positive values ,gpSpectrum ///< An approximation of the visible light spectrum (creates banding illusion but allows more precise magnitude estimates) ,gpJet ///< Hue variation similar to a spectrum, often used in numerical visualization (creates banding illusion but allows more precise magnitude estimates) ,gpHues ///< Full hue cycle, with highest and lowest color red (suitable for periodic data, such as angles and phases, see \ref setPeriodic) }; Q_ENUMS(GradientPreset) QCPColorGradient(); QCPColorGradient(GradientPreset preset); bool operator==(const QCPColorGradient &other) const; bool operator!=(const QCPColorGradient &other) const { return !(*this == other); } // getters: int levelCount() const { return mLevelCount; } QMap colorStops() const { return mColorStops; } ColorInterpolation colorInterpolation() const { return mColorInterpolation; } bool periodic() const { return mPeriodic; } // setters: void setLevelCount(int n); void setColorStops(const QMap &colorStops); void setColorStopAt(double position, const QColor &color); void setColorInterpolation(ColorInterpolation interpolation); void setPeriodic(bool enabled); // non-property methods: void colorize(const double *data, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false); void colorize(const double *data, const unsigned char *alpha, const QCPRange &range, QRgb *scanLine, int n, int dataIndexFactor=1, bool logarithmic=false); QRgb color(double position, const QCPRange &range, bool logarithmic=false); void loadPreset(GradientPreset preset); void clearColorStops(); QCPColorGradient inverted() const; protected: // property members: int mLevelCount; QMap mColorStops; ColorInterpolation mColorInterpolation; bool mPeriodic; // non-property members: QVector mColorBuffer; // have colors premultiplied with alpha (for usage with QImage::Format_ARGB32_Premultiplied) bool mColorBufferInvalidated; // non-virtual methods: bool stopsUseAlpha() const; void updateColorBuffer(); }; Q_DECLARE_METATYPE(QCPColorGradient::ColorInterpolation) Q_DECLARE_METATYPE(QCPColorGradient::GradientPreset) /* end of 'src/colorgradient.h' */ /* including file 'src/selectiondecorator-bracket.h', size 4426 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPSelectionDecoratorBracket : public QCPSelectionDecorator { Q_GADGET public: /*! Defines which shape is drawn at the boundaries of selected data ranges. Some of the bracket styles further allow specifying a height and/or width, see \ref setBracketHeight and \ref setBracketWidth. */ enum BracketStyle { bsSquareBracket ///< A square bracket is drawn. ,bsHalfEllipse ///< A half ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. ,bsEllipse ///< An ellipse is drawn. The size of the ellipse is given by the bracket width/height properties. ,bsPlus ///< A plus is drawn. ,bsUserStyle ///< Start custom bracket styles at this index when subclassing and reimplementing \ref drawBracket. }; Q_ENUMS(BracketStyle) QCPSelectionDecoratorBracket(); virtual ~QCPSelectionDecoratorBracket(); // getters: QPen bracketPen() const { return mBracketPen; } QBrush bracketBrush() const { return mBracketBrush; } int bracketWidth() const { return mBracketWidth; } int bracketHeight() const { return mBracketHeight; } BracketStyle bracketStyle() const { return mBracketStyle; } bool tangentToData() const { return mTangentToData; } int tangentAverage() const { return mTangentAverage; } // setters: void setBracketPen(const QPen &pen); void setBracketBrush(const QBrush &brush); void setBracketWidth(int width); void setBracketHeight(int height); void setBracketStyle(BracketStyle style); void setTangentToData(bool enabled); void setTangentAverage(int pointCount); // introduced virtual methods: virtual void drawBracket(QCPPainter *painter, int direction) const; // virtual methods: virtual void drawDecoration(QCPPainter *painter, QCPDataSelection selection); protected: // property members: QPen mBracketPen; QBrush mBracketBrush; int mBracketWidth; int mBracketHeight; BracketStyle mBracketStyle; bool mTangentToData; int mTangentAverage; // non-virtual methods: double getTangentAngle(const QCPPlottableInterface1D *interface1d, int dataIndex, int direction) const; QPointF getPixelCoordinates(const QCPPlottableInterface1D *interface1d, int dataIndex) const; }; Q_DECLARE_METATYPE(QCPSelectionDecoratorBracket::BracketStyle) /* end of 'src/selectiondecorator-bracket.h' */ /* including file 'src/layoutelements/layoutelement-axisrect.h', size 7528 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAxisRect : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPixmap background READ background WRITE setBackground) Q_PROPERTY(bool backgroundScaled READ backgroundScaled WRITE setBackgroundScaled) Q_PROPERTY(Qt::AspectRatioMode backgroundScaledMode READ backgroundScaledMode WRITE setBackgroundScaledMode) Q_PROPERTY(Qt::Orientations rangeDrag READ rangeDrag WRITE setRangeDrag) Q_PROPERTY(Qt::Orientations rangeZoom READ rangeZoom WRITE setRangeZoom) /// \endcond public: explicit QCPAxisRect(QCustomPlot *parentPlot, bool setupDefaultAxes=true); virtual ~QCPAxisRect(); // getters: QPixmap background() const { return mBackgroundPixmap; } QBrush backgroundBrush() const { return mBackgroundBrush; } bool backgroundScaled() const { return mBackgroundScaled; } Qt::AspectRatioMode backgroundScaledMode() const { return mBackgroundScaledMode; } Qt::Orientations rangeDrag() const { return mRangeDrag; } Qt::Orientations rangeZoom() const { return mRangeZoom; } QCPAxis *rangeDragAxis(Qt::Orientation orientation); QCPAxis *rangeZoomAxis(Qt::Orientation orientation); QList rangeDragAxes(Qt::Orientation orientation); QList rangeZoomAxes(Qt::Orientation orientation); double rangeZoomFactor(Qt::Orientation orientation); // setters: void setBackground(const QPixmap &pm); void setBackground(const QPixmap &pm, bool scaled, Qt::AspectRatioMode mode=Qt::KeepAspectRatioByExpanding); void setBackground(const QBrush &brush); void setBackgroundScaled(bool scaled); void setBackgroundScaledMode(Qt::AspectRatioMode mode); void setRangeDrag(Qt::Orientations orientations); void setRangeZoom(Qt::Orientations orientations); void setRangeDragAxes(QCPAxis *horizontal, QCPAxis *vertical); void setRangeDragAxes(QList axes); void setRangeDragAxes(QList horizontal, QList vertical); void setRangeZoomAxes(QCPAxis *horizontal, QCPAxis *vertical); void setRangeZoomAxes(QList axes); void setRangeZoomAxes(QList horizontal, QList vertical); void setRangeZoomFactor(double horizontalFactor, double verticalFactor); void setRangeZoomFactor(double factor); // non-property methods: int axisCount(QCPAxis::AxisType type) const; QCPAxis *axis(QCPAxis::AxisType type, int index=0) const; QList axes(QCPAxis::AxisTypes types) const; QList axes() const; QCPAxis *addAxis(QCPAxis::AxisType type, QCPAxis *axis=0); QList addAxes(QCPAxis::AxisTypes types); bool removeAxis(QCPAxis *axis); QCPLayoutInset *insetLayout() const { return mInsetLayout; } void zoom(const QRectF &pixelRect); void zoom(const QRectF &pixelRect, const QList &affectedAxes); void setupFullAxesBox(bool connectRanges=false); QList plottables() const; QList graphs() const; QList items() const; // read-only interface imitating a QRect: int left() const { return mRect.left(); } int right() const { return mRect.right(); } int top() const { return mRect.top(); } int bottom() const { return mRect.bottom(); } int width() const { return mRect.width(); } int height() const { return mRect.height(); } QSize size() const { return mRect.size(); } QPoint topLeft() const { return mRect.topLeft(); } QPoint topRight() const { return mRect.topRight(); } QPoint bottomLeft() const { return mRect.bottomLeft(); } QPoint bottomRight() const { return mRect.bottomRight(); } QPoint center() const { return mRect.center(); } // reimplemented virtual methods: virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE; virtual QList elements(bool recursive) const Q_DECL_OVERRIDE; protected: // property members: QBrush mBackgroundBrush; QPixmap mBackgroundPixmap; QPixmap mScaledBackgroundPixmap; bool mBackgroundScaled; Qt::AspectRatioMode mBackgroundScaledMode; QCPLayoutInset *mInsetLayout; Qt::Orientations mRangeDrag, mRangeZoom; QList > mRangeDragHorzAxis, mRangeDragVertAxis; QList > mRangeZoomHorzAxis, mRangeZoomVertAxis; double mRangeZoomFactorHorz, mRangeZoomFactorVert; // non-property members: QList mDragStartHorzRange, mDragStartVertRange; QCP::AntialiasedElements mAADragBackup, mNotAADragBackup; QPoint mDragStart; bool mDragging; QHash > mAxes; // reimplemented virtual methods: virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual int calculateAutoMargin(QCP::MarginSide side) Q_DECL_OVERRIDE; virtual void layoutChanged() Q_DECL_OVERRIDE; // events: virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; // non-property methods: void drawBackground(QCPPainter *painter); void updateAxesOffset(QCPAxis::AxisType type); private: Q_DISABLE_COPY(QCPAxisRect) friend class QCustomPlot; }; /* end of 'src/layoutelements/layoutelement-axisrect.h' */ /* including file 'src/layoutelements/layoutelement-legend.h', size 10392 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPAbstractLegendItem : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPLegend* parentLegend READ parentLegend) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectionChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectableChanged) /// \endcond public: explicit QCPAbstractLegendItem(QCPLegend *parent); // getters: QCPLegend *parentLegend() const { return mParentLegend; } QFont font() const { return mFont; } QColor textColor() const { return mTextColor; } QFont selectedFont() const { return mSelectedFont; } QColor selectedTextColor() const { return mSelectedTextColor; } bool selectable() const { return mSelectable; } bool selected() const { return mSelected; } // setters: void setFont(const QFont &font); void setTextColor(const QColor &color); void setSelectedFont(const QFont &font); void setSelectedTextColor(const QColor &color); Q_SLOT void setSelectable(bool selectable); Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; signals: void selectionChanged(bool selected); void selectableChanged(bool selectable); protected: // property members: QCPLegend *mParentLegend; QFont mFont; QColor mTextColor; QFont mSelectedFont; QColor mSelectedTextColor; bool mSelectable, mSelected; // reimplemented virtual methods: virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; virtual QRect clipRect() const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE = 0; // events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE; virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QCPAbstractLegendItem) friend class QCPLegend; }; class QCP_LIB_DECL QCPPlottableLegendItem : public QCPAbstractLegendItem { Q_OBJECT public: QCPPlottableLegendItem(QCPLegend *parent, QCPAbstractPlottable *plottable); // getters: QCPAbstractPlottable *plottable() { return mPlottable; } protected: // property members: QCPAbstractPlottable *mPlottable; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; // non-virtual methods: QPen getIconBorderPen() const; QColor getTextColor() const; QFont getFont() const; }; class QCP_LIB_DECL QCPLegend : public QCPLayoutGrid { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen borderPen READ borderPen WRITE setBorderPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) Q_PROPERTY(int iconTextPadding READ iconTextPadding WRITE setIconTextPadding) Q_PROPERTY(QPen iconBorderPen READ iconBorderPen WRITE setIconBorderPen) Q_PROPERTY(SelectableParts selectableParts READ selectableParts WRITE setSelectableParts NOTIFY selectionChanged) Q_PROPERTY(SelectableParts selectedParts READ selectedParts WRITE setSelectedParts NOTIFY selectableChanged) Q_PROPERTY(QPen selectedBorderPen READ selectedBorderPen WRITE setSelectedBorderPen) Q_PROPERTY(QPen selectedIconBorderPen READ selectedIconBorderPen WRITE setSelectedIconBorderPen) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) /// \endcond public: /*! Defines the selectable parts of a legend \see setSelectedParts, setSelectableParts */ enum SelectablePart { spNone = 0x000 ///< 0x000 None ,spLegendBox = 0x001 ///< 0x001 The legend box (frame) ,spItems = 0x002 ///< 0x002 Legend items individually (see \ref selectedItems) }; Q_ENUMS(SelectablePart) Q_FLAGS(SelectableParts) Q_DECLARE_FLAGS(SelectableParts, SelectablePart) explicit QCPLegend(); virtual ~QCPLegend(); // getters: QPen borderPen() const { return mBorderPen; } QBrush brush() const { return mBrush; } QFont font() const { return mFont; } QColor textColor() const { return mTextColor; } QSize iconSize() const { return mIconSize; } int iconTextPadding() const { return mIconTextPadding; } QPen iconBorderPen() const { return mIconBorderPen; } SelectableParts selectableParts() const { return mSelectableParts; } SelectableParts selectedParts() const; QPen selectedBorderPen() const { return mSelectedBorderPen; } QPen selectedIconBorderPen() const { return mSelectedIconBorderPen; } QBrush selectedBrush() const { return mSelectedBrush; } QFont selectedFont() const { return mSelectedFont; } QColor selectedTextColor() const { return mSelectedTextColor; } // setters: void setBorderPen(const QPen &pen); void setBrush(const QBrush &brush); void setFont(const QFont &font); void setTextColor(const QColor &color); void setIconSize(const QSize &size); void setIconSize(int width, int height); void setIconTextPadding(int padding); void setIconBorderPen(const QPen &pen); Q_SLOT void setSelectableParts(const SelectableParts &selectableParts); Q_SLOT void setSelectedParts(const SelectableParts &selectedParts); void setSelectedBorderPen(const QPen &pen); void setSelectedIconBorderPen(const QPen &pen); void setSelectedBrush(const QBrush &brush); void setSelectedFont(const QFont &font); void setSelectedTextColor(const QColor &color); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; // non-virtual methods: QCPAbstractLegendItem *item(int index) const; QCPPlottableLegendItem *itemWithPlottable(const QCPAbstractPlottable *plottable) const; int itemCount() const; bool hasItem(QCPAbstractLegendItem *item) const; bool hasItemWithPlottable(const QCPAbstractPlottable *plottable) const; bool addItem(QCPAbstractLegendItem *item); bool removeItem(int index); bool removeItem(QCPAbstractLegendItem *item); void clearItems(); QList selectedItems() const; signals: void selectionChanged(QCPLegend::SelectableParts parts); void selectableChanged(QCPLegend::SelectableParts parts); protected: // property members: QPen mBorderPen, mIconBorderPen; QBrush mBrush; QFont mFont; QColor mTextColor; QSize mIconSize; int mIconTextPadding; SelectableParts mSelectedParts, mSelectableParts; QPen mSelectedBorderPen, mSelectedIconBorderPen; QBrush mSelectedBrush; QFont mSelectedFont; QColor mSelectedTextColor; // reimplemented virtual methods: virtual void parentPlotInitialized(QCustomPlot *parentPlot) Q_DECL_OVERRIDE; virtual QCP::Interaction selectionCategory() const Q_DECL_OVERRIDE; virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; // events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE; virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; // non-virtual methods: QPen getBorderPen() const; QBrush getBrush() const; private: Q_DISABLE_COPY(QCPLegend) friend class QCustomPlot; friend class QCPAbstractLegendItem; }; Q_DECLARE_OPERATORS_FOR_FLAGS(QCPLegend::SelectableParts) Q_DECLARE_METATYPE(QCPLegend::SelectablePart) /* end of 'src/layoutelements/layoutelement-legend.h' */ /* including file 'src/layoutelements/layoutelement-textelement.h', size 5343 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPTextElement : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QString text READ text WRITE setText) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QColor textColor READ textColor WRITE setTextColor) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor) Q_PROPERTY(bool selectable READ selectable WRITE setSelectable NOTIFY selectableChanged) Q_PROPERTY(bool selected READ selected WRITE setSelected NOTIFY selectionChanged) /// \endcond public: explicit QCPTextElement(QCustomPlot *parentPlot); QCPTextElement(QCustomPlot *parentPlot, const QString &text); QCPTextElement(QCustomPlot *parentPlot, const QString &text, double pointSize); QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QString &fontFamily, double pointSize); QCPTextElement(QCustomPlot *parentPlot, const QString &text, const QFont &font); // getters: QString text() const { return mText; } int textFlags() const { return mTextFlags; } QFont font() const { return mFont; } QColor textColor() const { return mTextColor; } QFont selectedFont() const { return mSelectedFont; } QColor selectedTextColor() const { return mSelectedTextColor; } bool selectable() const { return mSelectable; } bool selected() const { return mSelected; } // setters: void setText(const QString &text); void setTextFlags(int flags); void setFont(const QFont &font); void setTextColor(const QColor &color); void setSelectedFont(const QFont &font); void setSelectedTextColor(const QColor &color); Q_SLOT void setSelectable(bool selectable); Q_SLOT void setSelected(bool selected); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; virtual void mouseDoubleClickEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; signals: void selectionChanged(bool selected); void selectableChanged(bool selectable); void clicked(QMouseEvent *event); void doubleClicked(QMouseEvent *event); protected: // property members: QString mText; int mTextFlags; QFont mFont; QColor mTextColor; QFont mSelectedFont; QColor mSelectedTextColor; QRect mTextBoundingRect; bool mSelectable, mSelected; // reimplemented virtual methods: virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QSize minimumSizeHint() const Q_DECL_OVERRIDE; virtual QSize maximumSizeHint() const Q_DECL_OVERRIDE; // events: virtual void selectEvent(QMouseEvent *event, bool additive, const QVariant &details, bool *selectionStateChanged) Q_DECL_OVERRIDE; virtual void deselectEvent(bool *selectionStateChanged) Q_DECL_OVERRIDE; // non-virtual methods: QFont mainFont() const; QColor mainTextColor() const; private: Q_DISABLE_COPY(QCPTextElement) }; /* end of 'src/layoutelements/layoutelement-textelement.h' */ /* including file 'src/layoutelements/layoutelement-colorscale.h', size 5907 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCPColorScaleAxisRectPrivate : public QCPAxisRect { Q_OBJECT public: explicit QCPColorScaleAxisRectPrivate(QCPColorScale *parentColorScale); protected: QCPColorScale *mParentColorScale; QImage mGradientImage; bool mGradientImageInvalidated; // re-using some methods of QCPAxisRect to make them available to friend class QCPColorScale using QCPAxisRect::calculateAutoMargin; using QCPAxisRect::mousePressEvent; using QCPAxisRect::mouseMoveEvent; using QCPAxisRect::mouseReleaseEvent; using QCPAxisRect::wheelEvent; using QCPAxisRect::update; virtual void draw(QCPPainter *painter); void updateGradientImage(); Q_SLOT void axisSelectionChanged(QCPAxis::SelectableParts selectedParts); Q_SLOT void axisSelectableChanged(QCPAxis::SelectableParts selectableParts); friend class QCPColorScale; }; class QCP_LIB_DECL QCPColorScale : public QCPLayoutElement { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPAxis::AxisType type READ type WRITE setType) Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged) Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged) Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged) Q_PROPERTY(QString label READ label WRITE setLabel) Q_PROPERTY(int barWidth READ barWidth WRITE setBarWidth) Q_PROPERTY(bool rangeDrag READ rangeDrag WRITE setRangeDrag) Q_PROPERTY(bool rangeZoom READ rangeZoom WRITE setRangeZoom) /// \endcond public: explicit QCPColorScale(QCustomPlot *parentPlot); virtual ~QCPColorScale(); // getters: QCPAxis *axis() const { return mColorAxis.data(); } QCPAxis::AxisType type() const { return mType; } QCPRange dataRange() const { return mDataRange; } QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; } QCPColorGradient gradient() const { return mGradient; } QString label() const; int barWidth () const { return mBarWidth; } bool rangeDrag() const; bool rangeZoom() const; // setters: void setType(QCPAxis::AxisType type); Q_SLOT void setDataRange(const QCPRange &dataRange); Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType); Q_SLOT void setGradient(const QCPColorGradient &gradient); void setLabel(const QString &str); void setBarWidth(int width); void setRangeDrag(bool enabled); void setRangeZoom(bool enabled); // non-property methods: QList colorMaps() const; void rescaleDataRange(bool onlyVisibleMaps); // reimplemented virtual methods: virtual void update(UpdatePhase phase) Q_DECL_OVERRIDE; signals: void dataRangeChanged(const QCPRange &newRange); void dataScaleTypeChanged(QCPAxis::ScaleType scaleType); void gradientChanged(const QCPColorGradient &newGradient); protected: // property members: QCPAxis::AxisType mType; QCPRange mDataRange; QCPAxis::ScaleType mDataScaleType; QCPColorGradient mGradient; int mBarWidth; // non-property members: QPointer mAxisRect; QPointer mColorAxis; // reimplemented virtual methods: virtual void applyDefaultAntialiasingHint(QCPPainter *painter) const Q_DECL_OVERRIDE; // events: virtual void mousePressEvent(QMouseEvent *event, const QVariant &details) Q_DECL_OVERRIDE; virtual void mouseMoveEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; virtual void mouseReleaseEvent(QMouseEvent *event, const QPointF &startPos) Q_DECL_OVERRIDE; virtual void wheelEvent(QWheelEvent *event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(QCPColorScale) friend class QCPColorScaleAxisRectPrivate; }; /* end of 'src/layoutelements/layoutelement-colorscale.h' */ /* including file 'src/plottables/plottable-graph.h', size 8826 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPGraphData { public: QCPGraphData(); QCPGraphData(double key, double value); inline double sortKey() const { return key; } inline static QCPGraphData fromSortKey(double sortKey) { return QCPGraphData(sortKey, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return value; } inline QCPRange valueRange() const { return QCPRange(value, value); } double key, value; }; Q_DECLARE_TYPEINFO(QCPGraphData, Q_PRIMITIVE_TYPE); /*! \typedef QCPGraphDataContainer Container for storing \ref QCPGraphData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPGraph holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPGraphData, QCPGraph::setData */ typedef QCPDataContainer QCPGraphDataContainer; class QCP_LIB_DECL QCPGraph : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle) Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle) Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip) Q_PROPERTY(QCPGraph* channelFillGraph READ channelFillGraph WRITE setChannelFillGraph) Q_PROPERTY(bool adaptiveSampling READ adaptiveSampling WRITE setAdaptiveSampling) /// \endcond public: /*! Defines how the graph's line is represented visually in the plot. The line is drawn with the current pen of the graph (\ref setPen). \see setLineStyle */ enum LineStyle { lsNone ///< data points are not connected with any lines (e.g. data only represented ///< with symbols according to the scatter style, see \ref setScatterStyle) ,lsLine ///< data points are connected by a straight line ,lsStepLeft ///< line is drawn as steps where the step height is the value of the left data point ,lsStepRight ///< line is drawn as steps where the step height is the value of the right data point ,lsStepCenter ///< line is drawn as steps where the step is in between two data points ,lsImpulse ///< each data point is represented by a line parallel to the value axis, which reaches from the data point to the zero-value-line }; Q_ENUMS(LineStyle) explicit QCPGraph(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPGraph(); // getters: QSharedPointer data() const { return mDataContainer; } LineStyle lineStyle() const { return mLineStyle; } QCPScatterStyle scatterStyle() const { return mScatterStyle; } int scatterSkip() const { return mScatterSkip; } QCPGraph *channelFillGraph() const { return mChannelFillGraph.data(); } bool adaptiveSampling() const { return mAdaptiveSampling; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &values, bool alreadySorted=false); void setLineStyle(LineStyle ls); void setScatterStyle(const QCPScatterStyle &style); void setScatterSkip(int skip); void setChannelFillGraph(QCPGraph *targetGraph); void setAdaptiveSampling(bool enabled); // non-property methods: void addData(const QVector &keys, const QVector &values, bool alreadySorted=false); void addData(double key, double value); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE; protected: // property members: LineStyle mLineStyle; QCPScatterStyle mScatterStyle; int mScatterSkip; QPointer mChannelFillGraph; bool mAdaptiveSampling; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; // introduced virtual methods: virtual void drawFill(QCPPainter *painter, QVector *lines) const; virtual void drawScatterPlot(QCPPainter *painter, const QVector &scatters, const QCPScatterStyle &style) const; virtual void drawLinePlot(QCPPainter *painter, const QVector &lines) const; virtual void drawImpulsePlot(QCPPainter *painter, const QVector &lines) const; virtual void getOptimizedLineData(QVector *lineData, const QCPGraphDataContainer::const_iterator &begin, const QCPGraphDataContainer::const_iterator &end) const; virtual void getOptimizedScatterData(QVector *scatterData, QCPGraphDataContainer::const_iterator begin, QCPGraphDataContainer::const_iterator end) const; // non-virtual methods: void getVisibleDataBounds(QCPGraphDataContainer::const_iterator &begin, QCPGraphDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const; void getLines(QVector *lines, const QCPDataRange &dataRange) const; void getScatters(QVector *scatters, const QCPDataRange &dataRange) const; QVector dataToLines(const QVector &data) const; QVector dataToStepLeftLines(const QVector &data) const; QVector dataToStepRightLines(const QVector &data) const; QVector dataToStepCenterLines(const QVector &data) const; QVector dataToImpulseLines(const QVector &data) const; void addFillBasePoints(QVector *lines) const; void removeFillBasePoints(QVector *lines) const; QPointF lowerFillBasePoint(double lowerKey) const; QPointF upperFillBasePoint(double upperKey) const; const QPolygonF getChannelFillPolygon(const QVector *lines) const; int findIndexBelowX(const QVector *data, double x) const; int findIndexAboveX(const QVector *data, double x) const; int findIndexBelowY(const QVector *data, double y) const; int findIndexAboveY(const QVector *data, double y) const; double pointDistance(const QPointF &pixelPoint, QCPGraphDataContainer::const_iterator &closestData) const; friend class QCustomPlot; friend class QCPLegend; }; Q_DECLARE_METATYPE(QCPGraph::LineStyle) /* end of 'src/plottables/plottable-graph.h' */ /* including file 'src/plottables/plottable-curve.h', size 7409 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPCurveData { public: QCPCurveData(); QCPCurveData(double t, double key, double value); inline double sortKey() const { return t; } inline static QCPCurveData fromSortKey(double sortKey) { return QCPCurveData(sortKey, 0, 0); } inline static bool sortKeyIsMainKey() { return false; } inline double mainKey() const { return key; } inline double mainValue() const { return value; } inline QCPRange valueRange() const { return QCPRange(value, value); } double t, key, value; }; Q_DECLARE_TYPEINFO(QCPCurveData, Q_PRIMITIVE_TYPE); /*! \typedef QCPCurveDataContainer Container for storing \ref QCPCurveData points. The data is stored sorted by \a t, so the \a sortKey() (returning \a t) is different from \a mainKey() (returning \a key). This template instantiation is the container in which QCPCurve holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPCurveData, QCPCurve::setData */ typedef QCPDataContainer QCPCurveDataContainer; class QCP_LIB_DECL QCPCurve : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPScatterStyle scatterStyle READ scatterStyle WRITE setScatterStyle) Q_PROPERTY(int scatterSkip READ scatterSkip WRITE setScatterSkip) Q_PROPERTY(LineStyle lineStyle READ lineStyle WRITE setLineStyle) /// \endcond public: /*! Defines how the curve's line is represented visually in the plot. The line is drawn with the current pen of the curve (\ref setPen). \see setLineStyle */ enum LineStyle { lsNone ///< No line is drawn between data points (e.g. only scatters) ,lsLine ///< Data points are connected with a straight line }; Q_ENUMS(LineStyle) explicit QCPCurve(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPCurve(); // getters: QSharedPointer data() const { return mDataContainer; } QCPScatterStyle scatterStyle() const { return mScatterStyle; } int scatterSkip() const { return mScatterSkip; } LineStyle lineStyle() const { return mLineStyle; } // setters: void setData(QSharedPointer data); void setData(const QVector &t, const QVector &keys, const QVector &values, bool alreadySorted=false); void setData(const QVector &keys, const QVector &values); void setScatterStyle(const QCPScatterStyle &style); void setScatterSkip(int skip); void setLineStyle(LineStyle style); // non-property methods: void addData(const QVector &t, const QVector &keys, const QVector &values, bool alreadySorted=false); void addData(const QVector &keys, const QVector &values); void addData(double t, double key, double value); void addData(double key, double value); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE; protected: // property members: QCPScatterStyle mScatterStyle; int mScatterSkip; LineStyle mLineStyle; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; // introduced virtual methods: virtual void drawCurveLine(QCPPainter *painter, const QVector &lines) const; virtual void drawScatterPlot(QCPPainter *painter, const QVector &points, const QCPScatterStyle &style) const; // non-virtual methods: void getCurveLines(QVector *lines, const QCPDataRange &dataRange, double penWidth) const; void getScatters(QVector *scatters, const QCPDataRange &dataRange, double scatterWidth) const; int getRegion(double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const; QPointF getOptimizedPoint(int prevRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const; QVector getOptimizedCornerPoints(int prevRegion, int currentRegion, double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin) const; bool mayTraverse(int prevRegion, int currentRegion) const; bool getTraverse(double prevKey, double prevValue, double key, double value, double keyMin, double valueMax, double keyMax, double valueMin, QPointF &crossA, QPointF &crossB) const; void getTraverseCornerPoints(int prevRegion, int currentRegion, double keyMin, double valueMax, double keyMax, double valueMin, QVector &beforeTraverse, QVector &afterTraverse) const; double pointDistance(const QPointF &pixelPoint, QCPCurveDataContainer::const_iterator &closestData) const; friend class QCustomPlot; friend class QCPLegend; }; Q_DECLARE_METATYPE(QCPCurve::LineStyle) /* end of 'src/plottables/plottable-curve.h' */ /* including file 'src/plottables/plottable-bars.h', size 8924 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPBarsGroup : public QObject { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(SpacingType spacingType READ spacingType WRITE setSpacingType) Q_PROPERTY(double spacing READ spacing WRITE setSpacing) /// \endcond public: /*! Defines the ways the spacing between bars in the group can be specified. Thus it defines what the number passed to \ref setSpacing actually means. \see setSpacingType, setSpacing */ enum SpacingType { stAbsolute ///< Bar spacing is in absolute pixels ,stAxisRectRatio ///< Bar spacing is given by a fraction of the axis rect size ,stPlotCoords ///< Bar spacing is in key coordinates and thus scales with the key axis range }; Q_ENUMS(SpacingType) QCPBarsGroup(QCustomPlot *parentPlot); virtual ~QCPBarsGroup(); // getters: SpacingType spacingType() const { return mSpacingType; } double spacing() const { return mSpacing; } // setters: void setSpacingType(SpacingType spacingType); void setSpacing(double spacing); // non-virtual methods: QList bars() const { return mBars; } QCPBars* bars(int index) const; int size() const { return mBars.size(); } bool isEmpty() const { return mBars.isEmpty(); } void clear(); bool contains(QCPBars *bars) const { return mBars.contains(bars); } void append(QCPBars *bars); void insert(int i, QCPBars *bars); void remove(QCPBars *bars); protected: // non-property members: QCustomPlot *mParentPlot; SpacingType mSpacingType; double mSpacing; QList mBars; // non-virtual methods: void registerBars(QCPBars *bars); void unregisterBars(QCPBars *bars); // virtual methods: double keyPixelOffset(const QCPBars *bars, double keyCoord); double getPixelSpacing(const QCPBars *bars, double keyCoord); private: Q_DISABLE_COPY(QCPBarsGroup) friend class QCPBars; }; Q_DECLARE_METATYPE(QCPBarsGroup::SpacingType) class QCP_LIB_DECL QCPBarsData { public: QCPBarsData(); QCPBarsData(double key, double value); inline double sortKey() const { return key; } inline static QCPBarsData fromSortKey(double sortKey) { return QCPBarsData(sortKey, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return value; } inline QCPRange valueRange() const { return QCPRange(value, value); } // note that bar base value isn't held in each QCPBarsData and thus can't/shouldn't be returned here double key, value; }; Q_DECLARE_TYPEINFO(QCPBarsData, Q_PRIMITIVE_TYPE); /*! \typedef QCPBarsDataContainer Container for storing \ref QCPBarsData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPBars holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPBarsData, QCPBars::setData */ typedef QCPDataContainer QCPBarsDataContainer; class QCP_LIB_DECL QCPBars : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(double width READ width WRITE setWidth) Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType) Q_PROPERTY(QCPBarsGroup* barsGroup READ barsGroup WRITE setBarsGroup) Q_PROPERTY(double baseValue READ baseValue WRITE setBaseValue) Q_PROPERTY(double stackingGap READ stackingGap WRITE setStackingGap) Q_PROPERTY(QCPBars* barBelow READ barBelow) Q_PROPERTY(QCPBars* barAbove READ barAbove) /// \endcond public: /*! Defines the ways the width of the bar can be specified. Thus it defines what the number passed to \ref setWidth actually means. \see setWidthType, setWidth */ enum WidthType { wtAbsolute ///< Bar width is in absolute pixels ,wtAxisRectRatio ///< Bar width is given by a fraction of the axis rect size ,wtPlotCoords ///< Bar width is in key coordinates and thus scales with the key axis range }; Q_ENUMS(WidthType) explicit QCPBars(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPBars(); // getters: double width() const { return mWidth; } WidthType widthType() const { return mWidthType; } QCPBarsGroup *barsGroup() const { return mBarsGroup; } double baseValue() const { return mBaseValue; } double stackingGap() const { return mStackingGap; } QCPBars *barBelow() const { return mBarBelow.data(); } QCPBars *barAbove() const { return mBarAbove.data(); } QSharedPointer data() const { return mDataContainer; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &values, bool alreadySorted=false); void setWidth(double width); void setWidthType(WidthType widthType); void setBarsGroup(QCPBarsGroup *barsGroup); void setBaseValue(double baseValue); void setStackingGap(double pixels); // non-property methods: void addData(const QVector &keys, const QVector &values, bool alreadySorted=false); void addData(double key, double value); void moveBelow(QCPBars *bars); void moveAbove(QCPBars *bars); // reimplemented virtual methods: virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE; virtual QPointF dataPixelPosition(int index) const Q_DECL_OVERRIDE; protected: // property members: double mWidth; WidthType mWidthType; QCPBarsGroup *mBarsGroup; double mBaseValue; double mStackingGap; QPointer mBarBelow, mBarAbove; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; // non-virtual methods: void getVisibleDataBounds(QCPBarsDataContainer::const_iterator &begin, QCPBarsDataContainer::const_iterator &end) const; QRectF getBarRect(double key, double value) const; void getPixelWidth(double key, double &lower, double &upper) const; double getStackedBaseValue(double key, bool positive) const; static void connectBars(QCPBars* lower, QCPBars* upper); friend class QCustomPlot; friend class QCPLegend; friend class QCPBarsGroup; }; Q_DECLARE_METATYPE(QCPBars::WidthType) /* end of 'src/plottables/plottable-bars.h' */ /* including file 'src/plottables/plottable-statisticalbox.h', size 7516 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPStatisticalBoxData { public: QCPStatisticalBoxData(); QCPStatisticalBoxData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector& outliers=QVector()); inline double sortKey() const { return key; } inline static QCPStatisticalBoxData fromSortKey(double sortKey) { return QCPStatisticalBoxData(sortKey, 0, 0, 0, 0, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return median; } inline QCPRange valueRange() const { QCPRange result(minimum, maximum); for (QVector::const_iterator it = outliers.constBegin(); it != outliers.constEnd(); ++it) result.expand(*it); return result; } double key, minimum, lowerQuartile, median, upperQuartile, maximum; QVector outliers; }; Q_DECLARE_TYPEINFO(QCPStatisticalBoxData, Q_MOVABLE_TYPE); /*! \typedef QCPStatisticalBoxDataContainer Container for storing \ref QCPStatisticalBoxData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPStatisticalBox holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPStatisticalBoxData, QCPStatisticalBox::setData */ typedef QCPDataContainer QCPStatisticalBoxDataContainer; class QCP_LIB_DECL QCPStatisticalBox : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(double width READ width WRITE setWidth) Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth) Q_PROPERTY(QPen whiskerPen READ whiskerPen WRITE setWhiskerPen) Q_PROPERTY(QPen whiskerBarPen READ whiskerBarPen WRITE setWhiskerBarPen) Q_PROPERTY(bool whiskerAntialiased READ whiskerAntialiased WRITE setWhiskerAntialiased) Q_PROPERTY(QPen medianPen READ medianPen WRITE setMedianPen) Q_PROPERTY(QCPScatterStyle outlierStyle READ outlierStyle WRITE setOutlierStyle) /// \endcond public: explicit QCPStatisticalBox(QCPAxis *keyAxis, QCPAxis *valueAxis); // getters: QSharedPointer data() const { return mDataContainer; } double width() const { return mWidth; } double whiskerWidth() const { return mWhiskerWidth; } QPen whiskerPen() const { return mWhiskerPen; } QPen whiskerBarPen() const { return mWhiskerBarPen; } bool whiskerAntialiased() const { return mWhiskerAntialiased; } QPen medianPen() const { return mMedianPen; } QCPScatterStyle outlierStyle() const { return mOutlierStyle; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &minimum, const QVector &lowerQuartile, const QVector &median, const QVector &upperQuartile, const QVector &maximum, bool alreadySorted=false); void setWidth(double width); void setWhiskerWidth(double width); void setWhiskerPen(const QPen &pen); void setWhiskerBarPen(const QPen &pen); void setWhiskerAntialiased(bool enabled); void setMedianPen(const QPen &pen); void setOutlierStyle(const QCPScatterStyle &style); // non-property methods: void addData(const QVector &keys, const QVector &minimum, const QVector &lowerQuartile, const QVector &median, const QVector &upperQuartile, const QVector &maximum, bool alreadySorted=false); void addData(double key, double minimum, double lowerQuartile, double median, double upperQuartile, double maximum, const QVector &outliers=QVector()); // reimplemented virtual methods: virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE; protected: // property members: double mWidth; double mWhiskerWidth; QPen mWhiskerPen, mWhiskerBarPen; bool mWhiskerAntialiased; QPen mMedianPen; QCPScatterStyle mOutlierStyle; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; // introduced virtual methods: virtual void drawStatisticalBox(QCPPainter *painter, QCPStatisticalBoxDataContainer::const_iterator it, const QCPScatterStyle &outlierStyle) const; // non-virtual methods: void getVisibleDataBounds(QCPStatisticalBoxDataContainer::const_iterator &begin, QCPStatisticalBoxDataContainer::const_iterator &end) const; QRectF getQuartileBox(QCPStatisticalBoxDataContainer::const_iterator it) const; QVector getWhiskerBackboneLines(QCPStatisticalBoxDataContainer::const_iterator it) const; QVector getWhiskerBarLines(QCPStatisticalBoxDataContainer::const_iterator it) const; friend class QCustomPlot; friend class QCPLegend; }; /* end of 'src/plottables/plottable-statisticalbox.h' */ /* including file 'src/plottables/plottable-colormap.h', size 7070 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPColorMapData { public: QCPColorMapData(int keySize, int valueSize, const QCPRange &keyRange, const QCPRange &valueRange); ~QCPColorMapData(); QCPColorMapData(const QCPColorMapData &other); QCPColorMapData &operator=(const QCPColorMapData &other); // getters: int keySize() const { return mKeySize; } int valueSize() const { return mValueSize; } QCPRange keyRange() const { return mKeyRange; } QCPRange valueRange() const { return mValueRange; } QCPRange dataBounds() const { return mDataBounds; } double data(double key, double value); double cell(int keyIndex, int valueIndex); unsigned char alpha(int keyIndex, int valueIndex); // setters: void setSize(int keySize, int valueSize); void setKeySize(int keySize); void setValueSize(int valueSize); void setRange(const QCPRange &keyRange, const QCPRange &valueRange); void setKeyRange(const QCPRange &keyRange); void setValueRange(const QCPRange &valueRange); void setData(double key, double value, double z); void setCell(int keyIndex, int valueIndex, double z); void setAlpha(int keyIndex, int valueIndex, unsigned char alpha); // non-property methods: void recalculateDataBounds(); void clear(); void clearAlpha(); void fill(double z); void fillAlpha(unsigned char alpha); bool isEmpty() const { return mIsEmpty; } void coordToCell(double key, double value, int *keyIndex, int *valueIndex) const; void cellToCoord(int keyIndex, int valueIndex, double *key, double *value) const; protected: // property members: int mKeySize, mValueSize; QCPRange mKeyRange, mValueRange; bool mIsEmpty; // non-property members: double *mData; unsigned char *mAlpha; QCPRange mDataBounds; bool mDataModified; bool createAlpha(bool initializeOpaque=true); friend class QCPColorMap; }; class QCP_LIB_DECL QCPColorMap : public QCPAbstractPlottable { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QCPRange dataRange READ dataRange WRITE setDataRange NOTIFY dataRangeChanged) Q_PROPERTY(QCPAxis::ScaleType dataScaleType READ dataScaleType WRITE setDataScaleType NOTIFY dataScaleTypeChanged) Q_PROPERTY(QCPColorGradient gradient READ gradient WRITE setGradient NOTIFY gradientChanged) Q_PROPERTY(bool interpolate READ interpolate WRITE setInterpolate) Q_PROPERTY(bool tightBoundary READ tightBoundary WRITE setTightBoundary) Q_PROPERTY(QCPColorScale* colorScale READ colorScale WRITE setColorScale) /// \endcond public: explicit QCPColorMap(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPColorMap(); // getters: QCPColorMapData *data() const { return mMapData; } QCPRange dataRange() const { return mDataRange; } QCPAxis::ScaleType dataScaleType() const { return mDataScaleType; } bool interpolate() const { return mInterpolate; } bool tightBoundary() const { return mTightBoundary; } QCPColorGradient gradient() const { return mGradient; } QCPColorScale *colorScale() const { return mColorScale.data(); } // setters: void setData(QCPColorMapData *data, bool copy=false); Q_SLOT void setDataRange(const QCPRange &dataRange); Q_SLOT void setDataScaleType(QCPAxis::ScaleType scaleType); Q_SLOT void setGradient(const QCPColorGradient &gradient); void setInterpolate(bool enabled); void setTightBoundary(bool enabled); void setColorScale(QCPColorScale *colorScale); // non-property methods: void rescaleDataRange(bool recalculateDataBounds=false); Q_SLOT void updateLegendIcon(Qt::TransformationMode transformMode=Qt::SmoothTransformation, const QSize &thumbSize=QSize(32, 18)); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE; signals: void dataRangeChanged(const QCPRange &newRange); void dataScaleTypeChanged(QCPAxis::ScaleType scaleType); void gradientChanged(const QCPColorGradient &newGradient); protected: // property members: QCPRange mDataRange; QCPAxis::ScaleType mDataScaleType; QCPColorMapData *mMapData; QCPColorGradient mGradient; bool mInterpolate; bool mTightBoundary; QPointer mColorScale; // non-property members: QImage mMapImage, mUndersampledMapImage; QPixmap mLegendIcon; bool mMapImageInvalidated; // introduced virtual methods: virtual void updateMapImage(); // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; friend class QCustomPlot; friend class QCPLegend; }; /* end of 'src/plottables/plottable-colormap.h' */ /* including file 'src/plottables/plottable-financial.h', size 8622 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPFinancialData { public: QCPFinancialData(); QCPFinancialData(double key, double open, double high, double low, double close); inline double sortKey() const { return key; } inline static QCPFinancialData fromSortKey(double sortKey) { return QCPFinancialData(sortKey, 0, 0, 0, 0); } inline static bool sortKeyIsMainKey() { return true; } inline double mainKey() const { return key; } inline double mainValue() const { return open; } inline QCPRange valueRange() const { return QCPRange(low, high); } // open and close must lie between low and high, so we don't need to check them double key, open, high, low, close; }; Q_DECLARE_TYPEINFO(QCPFinancialData, Q_PRIMITIVE_TYPE); /*! \typedef QCPFinancialDataContainer Container for storing \ref QCPFinancialData points. The data is stored sorted by \a key. This template instantiation is the container in which QCPFinancial holds its data. For details about the generic container, see the documentation of the class template \ref QCPDataContainer. \see QCPFinancialData, QCPFinancial::setData */ typedef QCPDataContainer QCPFinancialDataContainer; class QCP_LIB_DECL QCPFinancial : public QCPAbstractPlottable1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(ChartStyle chartStyle READ chartStyle WRITE setChartStyle) Q_PROPERTY(double width READ width WRITE setWidth) Q_PROPERTY(WidthType widthType READ widthType WRITE setWidthType) Q_PROPERTY(bool twoColored READ twoColored WRITE setTwoColored) Q_PROPERTY(QBrush brushPositive READ brushPositive WRITE setBrushPositive) Q_PROPERTY(QBrush brushNegative READ brushNegative WRITE setBrushNegative) Q_PROPERTY(QPen penPositive READ penPositive WRITE setPenPositive) Q_PROPERTY(QPen penNegative READ penNegative WRITE setPenNegative) /// \endcond public: /*! Defines the ways the width of the financial bar can be specified. Thus it defines what the number passed to \ref setWidth actually means. \see setWidthType, setWidth */ enum WidthType { wtAbsolute ///< width is in absolute pixels ,wtAxisRectRatio ///< width is given by a fraction of the axis rect size ,wtPlotCoords ///< width is in key coordinates and thus scales with the key axis range }; Q_ENUMS(WidthType) /*! Defines the possible representations of OHLC data in the plot. \see setChartStyle */ enum ChartStyle { csOhlc ///< Open-High-Low-Close bar representation ,csCandlestick ///< Candlestick representation }; Q_ENUMS(ChartStyle) explicit QCPFinancial(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPFinancial(); // getters: QSharedPointer data() const { return mDataContainer; } ChartStyle chartStyle() const { return mChartStyle; } double width() const { return mWidth; } WidthType widthType() const { return mWidthType; } bool twoColored() const { return mTwoColored; } QBrush brushPositive() const { return mBrushPositive; } QBrush brushNegative() const { return mBrushNegative; } QPen penPositive() const { return mPenPositive; } QPen penNegative() const { return mPenNegative; } // setters: void setData(QSharedPointer data); void setData(const QVector &keys, const QVector &open, const QVector &high, const QVector &low, const QVector &close, bool alreadySorted=false); void setChartStyle(ChartStyle style); void setWidth(double width); void setWidthType(WidthType widthType); void setTwoColored(bool twoColored); void setBrushPositive(const QBrush &brush); void setBrushNegative(const QBrush &brush); void setPenPositive(const QPen &pen); void setPenNegative(const QPen &pen); // non-property methods: void addData(const QVector &keys, const QVector &open, const QVector &high, const QVector &low, const QVector &close, bool alreadySorted=false); void addData(double key, double open, double high, double low, double close); // reimplemented virtual methods: virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const Q_DECL_OVERRIDE; virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE; // static methods: static QCPFinancialDataContainer timeSeriesToOhlc(const QVector &time, const QVector &value, double timeBinSize, double timeBinOffset = 0); protected: // property members: ChartStyle mChartStyle; double mWidth; WidthType mWidthType; bool mTwoColored; QBrush mBrushPositive, mBrushNegative; QPen mPenPositive, mPenNegative; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; // non-virtual methods: void drawOhlcPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected); void drawCandlestickPlot(QCPPainter *painter, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, bool isSelected); double getPixelWidth(double key, double keyPixel) const; double ohlcSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const; double candlestickSelectTest(const QPointF &pos, const QCPFinancialDataContainer::const_iterator &begin, const QCPFinancialDataContainer::const_iterator &end, QCPFinancialDataContainer::const_iterator &closestDataPoint) const; void getVisibleDataBounds(QCPFinancialDataContainer::const_iterator &begin, QCPFinancialDataContainer::const_iterator &end) const; QRectF selectionHitBox(QCPFinancialDataContainer::const_iterator it) const; friend class QCustomPlot; friend class QCPLegend; }; Q_DECLARE_METATYPE(QCPFinancial::ChartStyle) /* end of 'src/plottables/plottable-financial.h' */ /* including file 'src/plottables/plottable-errorbar.h', size 7567 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPErrorBarsData { public: QCPErrorBarsData(); explicit QCPErrorBarsData(double error); QCPErrorBarsData(double errorMinus, double errorPlus); double errorMinus, errorPlus; }; Q_DECLARE_TYPEINFO(QCPErrorBarsData, Q_PRIMITIVE_TYPE); /*! \typedef QCPErrorBarsDataContainer Container for storing \ref QCPErrorBarsData points. It is a typedef for QVector<\ref QCPErrorBarsData>. This is the container in which \ref QCPErrorBars holds its data. Unlike most other data containers for plottables, it is not based on \ref QCPDataContainer. This is because the error bars plottable is special in that it doesn't store its own key and value coordinate per error bar. It adopts the key and value from the plottable to which the error bars shall be applied (\ref QCPErrorBars::setDataPlottable). So the stored \ref QCPErrorBarsData doesn't need a sortable key, but merely an index (as \c QVector provides), which maps one-to-one to the indices of the other plottable's data. \see QCPErrorBarsData, QCPErrorBars::setData */ typedef QVector QCPErrorBarsDataContainer; class QCP_LIB_DECL QCPErrorBars : public QCPAbstractPlottable, public QCPPlottableInterface1D { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QSharedPointer data READ data WRITE setData) Q_PROPERTY(QCPAbstractPlottable* dataPlottable READ dataPlottable WRITE setDataPlottable) Q_PROPERTY(ErrorType errorType READ errorType WRITE setErrorType) Q_PROPERTY(double whiskerWidth READ whiskerWidth WRITE setWhiskerWidth) Q_PROPERTY(double symbolGap READ symbolGap WRITE setSymbolGap) /// \endcond public: /*! Defines in which orientation the error bars shall appear. If your data needs both error dimensions, create two \ref QCPErrorBars with different \ref ErrorType. \see setErrorType */ enum ErrorType { etKeyError ///< The errors are for the key dimension (bars appear parallel to the key axis) ,etValueError ///< The errors are for the value dimension (bars appear parallel to the value axis) }; Q_ENUMS(ErrorType) explicit QCPErrorBars(QCPAxis *keyAxis, QCPAxis *valueAxis); virtual ~QCPErrorBars(); // getters: QSharedPointer data() const { return mDataContainer; } QCPAbstractPlottable *dataPlottable() const { return mDataPlottable.data(); } ErrorType errorType() const { return mErrorType; } double whiskerWidth() const { return mWhiskerWidth; } double symbolGap() const { return mSymbolGap; } // setters: void setData(QSharedPointer data); void setData(const QVector &error); void setData(const QVector &errorMinus, const QVector &errorPlus); void setDataPlottable(QCPAbstractPlottable* plottable); void setErrorType(ErrorType type); void setWhiskerWidth(double pixels); void setSymbolGap(double pixels); // non-property methods: void addData(const QVector &error); void addData(const QVector &errorMinus, const QVector &errorPlus); void addData(double error); void addData(double errorMinus, double errorPlus); // virtual methods of 1d plottable interface: virtual int dataCount() const; virtual double dataMainKey(int index) const; virtual double dataSortKey(int index) const; virtual double dataMainValue(int index) const; virtual QCPRange dataValueRange(int index) const; virtual QPointF dataPixelPosition(int index) const; virtual bool sortKeyIsMainKey() const; virtual QCPDataSelection selectTestRect(const QRectF &rect, bool onlySelectable) const; virtual int findBegin(double sortKey, bool expandedRange=true) const; virtual int findEnd(double sortKey, bool expandedRange=true) const; // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; virtual QCPPlottableInterface1D *interface1D() Q_DECL_OVERRIDE { return this; } protected: // property members: QSharedPointer mDataContainer; QPointer mDataPlottable; ErrorType mErrorType; double mWhiskerWidth; double mSymbolGap; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual void drawLegendIcon(QCPPainter *painter, const QRectF &rect) const Q_DECL_OVERRIDE; virtual QCPRange getKeyRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth) const Q_DECL_OVERRIDE; virtual QCPRange getValueRange(bool &foundRange, QCP::SignDomain inSignDomain=QCP::sdBoth, const QCPRange &inKeyRange=QCPRange()) const Q_DECL_OVERRIDE; // non-virtual methods: void getErrorBarLines(QCPErrorBarsDataContainer::const_iterator it, QVector &backbones, QVector &whiskers) const; void getVisibleDataBounds(QCPErrorBarsDataContainer::const_iterator &begin, QCPErrorBarsDataContainer::const_iterator &end, const QCPDataRange &rangeRestriction) const; double pointDistance(const QPointF &pixelPoint, QCPErrorBarsDataContainer::const_iterator &closestData) const; // helpers: void getDataSegments(QList &selectedSegments, QList &unselectedSegments) const; bool errorBarVisible(int index) const; bool rectIntersectsLine(const QRectF &pixelRect, const QLineF &line) const; friend class QCustomPlot; friend class QCPLegend; }; /* end of 'src/plottables/plottable-errorbar.h' */ /* including file 'src/items/item-straightline.h', size 3117 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemStraightLine : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) /// \endcond public: explicit QCPItemStraightLine(QCustomPlot *parentPlot); virtual ~QCPItemStraightLine(); // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const point1; QCPItemPosition * const point2; protected: // property members: QPen mPen, mSelectedPen; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; // non-virtual methods: QLineF getRectClippedStraightLine(const QCPVector2D &point1, const QCPVector2D &vec, const QRect &rect) const; QPen mainPen() const; }; /* end of 'src/items/item-straightline.h' */ /* including file 'src/items/item-line.h', size 3407 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemLine : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QCPLineEnding head READ head WRITE setHead) Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail) /// \endcond public: explicit QCPItemLine(QCustomPlot *parentPlot); virtual ~QCPItemLine(); // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QCPLineEnding head() const { return mHead; } QCPLineEnding tail() const { return mTail; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setHead(const QCPLineEnding &head); void setTail(const QCPLineEnding &tail); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const start; QCPItemPosition * const end; protected: // property members: QPen mPen, mSelectedPen; QCPLineEnding mHead, mTail; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; // non-virtual methods: QLineF getRectClippedLine(const QCPVector2D &start, const QCPVector2D &end, const QRect &rect) const; QPen mainPen() const; }; /* end of 'src/items/item-line.h' */ /* including file 'src/items/item-curve.h', size 3379 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemCurve : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QCPLineEnding head READ head WRITE setHead) Q_PROPERTY(QCPLineEnding tail READ tail WRITE setTail) /// \endcond public: explicit QCPItemCurve(QCustomPlot *parentPlot); virtual ~QCPItemCurve(); // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QCPLineEnding head() const { return mHead; } QCPLineEnding tail() const { return mTail; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setHead(const QCPLineEnding &head); void setTail(const QCPLineEnding &tail); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const start; QCPItemPosition * const startDir; QCPItemPosition * const endDir; QCPItemPosition * const end; protected: // property members: QPen mPen, mSelectedPen; QCPLineEnding mHead, mTail; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; // non-virtual methods: QPen mainPen() const; }; /* end of 'src/items/item-curve.h' */ /* including file 'src/items/item-rect.h', size 3688 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemRect : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) /// \endcond public: explicit QCPItemRect(QCustomPlot *parentPlot); virtual ~QCPItemRect(); // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const topLeft; QCPItemPosition * const bottomRight; QCPItemAnchor * const top; QCPItemAnchor * const topRight; QCPItemAnchor * const right; QCPItemAnchor * const bottom; QCPItemAnchor * const bottomLeft; QCPItemAnchor * const left; protected: enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft}; // property members: QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; // non-virtual methods: QPen mainPen() const; QBrush mainBrush() const; }; /* end of 'src/items/item-rect.h' */ /* including file 'src/items/item-text.h', size 5554 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemText : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(QColor selectedColor READ selectedColor WRITE setSelectedColor) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) Q_PROPERTY(QFont font READ font WRITE setFont) Q_PROPERTY(QFont selectedFont READ selectedFont WRITE setSelectedFont) Q_PROPERTY(QString text READ text WRITE setText) Q_PROPERTY(Qt::Alignment positionAlignment READ positionAlignment WRITE setPositionAlignment) Q_PROPERTY(Qt::Alignment textAlignment READ textAlignment WRITE setTextAlignment) Q_PROPERTY(double rotation READ rotation WRITE setRotation) Q_PROPERTY(QMargins padding READ padding WRITE setPadding) /// \endcond public: explicit QCPItemText(QCustomPlot *parentPlot); virtual ~QCPItemText(); // getters: QColor color() const { return mColor; } QColor selectedColor() const { return mSelectedColor; } QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } QFont font() const { return mFont; } QFont selectedFont() const { return mSelectedFont; } QString text() const { return mText; } Qt::Alignment positionAlignment() const { return mPositionAlignment; } Qt::Alignment textAlignment() const { return mTextAlignment; } double rotation() const { return mRotation; } QMargins padding() const { return mPadding; } // setters; void setColor(const QColor &color); void setSelectedColor(const QColor &color); void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); void setFont(const QFont &font); void setSelectedFont(const QFont &font); void setText(const QString &text); void setPositionAlignment(Qt::Alignment alignment); void setTextAlignment(Qt::Alignment alignment); void setRotation(double degrees); void setPadding(const QMargins &padding); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const position; QCPItemAnchor * const topLeft; QCPItemAnchor * const top; QCPItemAnchor * const topRight; QCPItemAnchor * const right; QCPItemAnchor * const bottomRight; QCPItemAnchor * const bottom; QCPItemAnchor * const bottomLeft; QCPItemAnchor * const left; protected: enum AnchorIndex {aiTopLeft, aiTop, aiTopRight, aiRight, aiBottomRight, aiBottom, aiBottomLeft, aiLeft}; // property members: QColor mColor, mSelectedColor; QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; QFont mFont, mSelectedFont; QString mText; Qt::Alignment mPositionAlignment; Qt::Alignment mTextAlignment; double mRotation; QMargins mPadding; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; // non-virtual methods: QPointF getTextDrawPoint(const QPointF &pos, const QRectF &rect, Qt::Alignment positionAlignment) const; QFont mainFont() const; QColor mainColor() const; QPen mainPen() const; QBrush mainBrush() const; }; /* end of 'src/items/item-text.h' */ /* including file 'src/items/item-ellipse.h', size 3868 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemEllipse : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) /// \endcond public: explicit QCPItemEllipse(QCustomPlot *parentPlot); virtual ~QCPItemEllipse(); // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const topLeft; QCPItemPosition * const bottomRight; QCPItemAnchor * const topLeftRim; QCPItemAnchor * const top; QCPItemAnchor * const topRightRim; QCPItemAnchor * const right; QCPItemAnchor * const bottomRightRim; QCPItemAnchor * const bottom; QCPItemAnchor * const bottomLeftRim; QCPItemAnchor * const left; QCPItemAnchor * const center; protected: enum AnchorIndex {aiTopLeftRim, aiTop, aiTopRightRim, aiRight, aiBottomRightRim, aiBottom, aiBottomLeftRim, aiLeft, aiCenter}; // property members: QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; // non-virtual methods: QPen mainPen() const; QBrush mainBrush() const; }; /* end of 'src/items/item-ellipse.h' */ /* including file 'src/items/item-pixmap.h', size 4373 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemPixmap : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPixmap pixmap READ pixmap WRITE setPixmap) Q_PROPERTY(bool scaled READ scaled WRITE setScaled) Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode) Q_PROPERTY(Qt::TransformationMode transformationMode READ transformationMode) Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) /// \endcond public: explicit QCPItemPixmap(QCustomPlot *parentPlot); virtual ~QCPItemPixmap(); // getters: QPixmap pixmap() const { return mPixmap; } bool scaled() const { return mScaled; } Qt::AspectRatioMode aspectRatioMode() const { return mAspectRatioMode; } Qt::TransformationMode transformationMode() const { return mTransformationMode; } QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } // setters; void setPixmap(const QPixmap &pixmap); void setScaled(bool scaled, Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio, Qt::TransformationMode transformationMode=Qt::SmoothTransformation); void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const topLeft; QCPItemPosition * const bottomRight; QCPItemAnchor * const top; QCPItemAnchor * const topRight; QCPItemAnchor * const right; QCPItemAnchor * const bottom; QCPItemAnchor * const bottomLeft; QCPItemAnchor * const left; protected: enum AnchorIndex {aiTop, aiTopRight, aiRight, aiBottom, aiBottomLeft, aiLeft}; // property members: QPixmap mPixmap; QPixmap mScaledPixmap; bool mScaled; bool mScaledPixmapInvalidated; Qt::AspectRatioMode mAspectRatioMode; Qt::TransformationMode mTransformationMode; QPen mPen, mSelectedPen; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; // non-virtual methods: void updateScaledPixmap(QRect finalRect=QRect(), bool flipHorz=false, bool flipVert=false); QRect getFinalRect(bool *flippedHorz=0, bool *flippedVert=0) const; QPen mainPen() const; }; /* end of 'src/items/item-pixmap.h' */ /* including file 'src/items/item-tracer.h', size 4762 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemTracer : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(QBrush brush READ brush WRITE setBrush) Q_PROPERTY(QBrush selectedBrush READ selectedBrush WRITE setSelectedBrush) Q_PROPERTY(double size READ size WRITE setSize) Q_PROPERTY(TracerStyle style READ style WRITE setStyle) Q_PROPERTY(QCPGraph* graph READ graph WRITE setGraph) Q_PROPERTY(double graphKey READ graphKey WRITE setGraphKey) Q_PROPERTY(bool interpolating READ interpolating WRITE setInterpolating) /// \endcond public: /*! The different visual appearances a tracer item can have. Some styles size may be controlled with \ref setSize. \see setStyle */ enum TracerStyle { tsNone ///< The tracer is not visible ,tsPlus ///< A plus shaped crosshair with limited size ,tsCrosshair ///< A plus shaped crosshair which spans the complete axis rect ,tsCircle ///< A circle ,tsSquare ///< A square }; Q_ENUMS(TracerStyle) explicit QCPItemTracer(QCustomPlot *parentPlot); virtual ~QCPItemTracer(); // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } QBrush brush() const { return mBrush; } QBrush selectedBrush() const { return mSelectedBrush; } double size() const { return mSize; } TracerStyle style() const { return mStyle; } QCPGraph *graph() const { return mGraph; } double graphKey() const { return mGraphKey; } bool interpolating() const { return mInterpolating; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setBrush(const QBrush &brush); void setSelectedBrush(const QBrush &brush); void setSize(double size); void setStyle(TracerStyle style); void setGraph(QCPGraph *graph); void setGraphKey(double key); void setInterpolating(bool enabled); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; // non-virtual methods: void updatePosition(); QCPItemPosition * const position; protected: // property members: QPen mPen, mSelectedPen; QBrush mBrush, mSelectedBrush; double mSize; TracerStyle mStyle; QCPGraph *mGraph; double mGraphKey; bool mInterpolating; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; // non-virtual methods: QPen mainPen() const; QBrush mainBrush() const; }; Q_DECLARE_METATYPE(QCPItemTracer::TracerStyle) /* end of 'src/items/item-tracer.h' */ /* including file 'src/items/item-bracket.h', size 3969 */ /* commit 633339dadc92cb10c58ef3556b55570685fafb99 2016-09-13 23:54:56 +0200 */ class QCP_LIB_DECL QCPItemBracket : public QCPAbstractItem { Q_OBJECT /// \cond INCLUDE_QPROPERTIES Q_PROPERTY(QPen pen READ pen WRITE setPen) Q_PROPERTY(QPen selectedPen READ selectedPen WRITE setSelectedPen) Q_PROPERTY(double length READ length WRITE setLength) Q_PROPERTY(BracketStyle style READ style WRITE setStyle) /// \endcond public: /*! Defines the various visual shapes of the bracket item. The appearance can be further modified by \ref setLength and \ref setPen. \see setStyle */ enum BracketStyle { bsSquare ///< A brace with angled edges ,bsRound ///< A brace with round edges ,bsCurly ///< A curly brace ,bsCalligraphic ///< A curly brace with varying stroke width giving a calligraphic impression }; Q_ENUMS(BracketStyle) explicit QCPItemBracket(QCustomPlot *parentPlot); virtual ~QCPItemBracket(); // getters: QPen pen() const { return mPen; } QPen selectedPen() const { return mSelectedPen; } double length() const { return mLength; } BracketStyle style() const { return mStyle; } // setters; void setPen(const QPen &pen); void setSelectedPen(const QPen &pen); void setLength(double length); void setStyle(BracketStyle style); // reimplemented virtual methods: virtual double selectTest(const QPointF &pos, bool onlySelectable, QVariant *details=0) const Q_DECL_OVERRIDE; QCPItemPosition * const left; QCPItemPosition * const right; QCPItemAnchor * const center; protected: // property members: enum AnchorIndex {aiCenter}; QPen mPen, mSelectedPen; double mLength; BracketStyle mStyle; // reimplemented virtual methods: virtual void draw(QCPPainter *painter) Q_DECL_OVERRIDE; virtual QPointF anchorPixelPosition(int anchorId) const Q_DECL_OVERRIDE; // non-virtual methods: QPen mainPen() const; }; Q_DECLARE_METATYPE(QCPItemBracket::BracketStyle) /* end of 'src/items/item-bracket.h' */ #endif // QCUSTOMPLOT_H sqlitebrowser-3.10.1/libs/qcustomplot-source/qcustomplot.pro000066400000000000000000000003271316047212700244430ustar00rootroot00000000000000TEMPLATE = lib QT += core gui network greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport CONFIG += staticlib CONFIG += debug_and_release HEADERS += \ qcustomplot.h SOURCES += \ qcustomplot.cpp sqlitebrowser-3.10.1/libs/qhexedit/000077500000000000000000000000001316047212700172505ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qhexedit/CMakeLists.txt000066400000000000000000000006541316047212700220150ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.7) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(Qt5Widgets REQUIRED) set(QHEXEDIT_SRC src/qhexedit.cpp src/chunks.cpp src/commands.cpp ) set(QHEXEDIT_HDR src/chunks.h src/commands.h ) set(QHEXEDIT_MOC_HDR src/qhexedit.h src/commands.h ) add_library(qhexedit ${QHEXEDIT_SRC} ${QHEXEDIT_HDR} ${QHEXEDIT_MOC}) qt5_use_modules(qhexedit Widgets) sqlitebrowser-3.10.1/libs/qhexedit/qhexedit.pro000066400000000000000000000003601316047212700216040ustar00rootroot00000000000000TEMPLATE = lib QT += core gui widgets CONFIG += staticlib CONFIG += debug_and_release HEADERS += \ src/qhexedit.h \ src/chunks.h \ src/commands.h SOURCES += \ src/qhexedit.cpp \ src/chunks.cpp \ src/commands.cpp sqlitebrowser-3.10.1/libs/qhexedit/src/000077500000000000000000000000001316047212700200375ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qhexedit/src/chunks.cpp000066400000000000000000000204441316047212700220420ustar00rootroot00000000000000#include "chunks.h" #include #define NORMAL 0 #define HIGHLIGHTED 1 #define BUFFER_SIZE 0x10000 #define CHUNK_SIZE 0x1000 #define READ_CHUNK_MASK Q_INT64_C(0xfffffffffffff000) // ***************************************** Constructors and file settings Chunks::Chunks(QObject *parent): QObject(parent) { QBuffer *buf = new QBuffer(this); setIODevice(*buf); } Chunks::Chunks(QIODevice &ioDevice, QObject *parent): QObject(parent) { setIODevice(ioDevice); } bool Chunks::setIODevice(QIODevice &ioDevice) { _ioDevice = &ioDevice; bool ok = _ioDevice->open(QIODevice::ReadOnly); if (ok) // Try to open IODevice { _size = _ioDevice->size(); _ioDevice->close(); } else // Fallback is an empty buffer { QBuffer *buf = new QBuffer(this); _ioDevice = buf; _size = 0; } _chunks.clear(); _pos = 0; return ok; } // ***************************************** Getting data out of Chunks QByteArray Chunks::data(qint64 pos, qint64 maxSize, QByteArray *highlighted) { qint64 ioDelta = 0; int chunkIdx = 0; Chunk chunk; QByteArray buffer; // Do some checks and some arrangements if (highlighted) highlighted->clear(); if (pos >= _size) return buffer; if (maxSize < 0) maxSize = _size; else if ((pos + maxSize) > _size) maxSize = _size - pos; _ioDevice->open(QIODevice::ReadOnly); while (maxSize > 0) { chunk.absPos = LLONG_MAX; bool chunksLoopOngoing = true; while ((chunkIdx < _chunks.count()) && chunksLoopOngoing) { // In this section, we track changes before our required data and // we take the editdet data, if availible. ioDelta is a difference // counter to justify the read pointer to the original data, if // data in between was deleted or inserted. chunk = _chunks[chunkIdx]; if (chunk.absPos > pos) chunksLoopOngoing = false; else { chunkIdx += 1; qint64 count; qint64 chunkOfs = pos - chunk.absPos; if (maxSize > ((qint64)chunk.data.size() - chunkOfs)) { count = (qint64)chunk.data.size() - chunkOfs; ioDelta += CHUNK_SIZE - chunk.data.size(); } else count = maxSize; if (count > 0) { buffer += chunk.data.mid(chunkOfs, (int)count); maxSize -= count; pos += count; if (highlighted) *highlighted += chunk.dataChanged.mid(chunkOfs, (int)count); } } } if ((maxSize > 0) && (pos < chunk.absPos)) { // In this section, we read data from the original source. This only will // happen, whe no copied data is available qint64 byteCount; QByteArray readBuffer; if ((chunk.absPos - pos) > maxSize) byteCount = maxSize; else byteCount = chunk.absPos - pos; maxSize -= byteCount; _ioDevice->seek(pos + ioDelta); readBuffer = _ioDevice->read(byteCount); buffer += readBuffer; if (highlighted) *highlighted += QByteArray(readBuffer.size(), NORMAL); pos += readBuffer.size(); } } _ioDevice->close(); return buffer; } bool Chunks::write(QIODevice &iODevice, qint64 pos, qint64 count) { if (count == -1) count = _size; bool ok = iODevice.open(QIODevice::WriteOnly); if (ok) { for (qint64 idx=pos; idx < count; idx += BUFFER_SIZE) { QByteArray ba = data(idx, BUFFER_SIZE); iODevice.write(ba); } iODevice.close(); } return ok; } // ***************************************** Set and get highlighting infos void Chunks::setDataChanged(qint64 pos, bool dataChanged) { if ((pos < 0) || (pos >= _size)) return; int chunkIdx = getChunkIndex(pos); qint64 posInBa = pos - _chunks[chunkIdx].absPos; _chunks[chunkIdx].dataChanged[(int)posInBa] = char(dataChanged); } bool Chunks::dataChanged(qint64 pos) { QByteArray highlighted; data(pos, 1, &highlighted); return bool(highlighted.at(0)); } // ***************************************** Search API qint64 Chunks::indexOf(const QByteArray &ba, qint64 from) { qint64 result = -1; QByteArray buffer; for (qint64 pos=from; (pos < _size) && (result < 0); pos += BUFFER_SIZE) { buffer = data(pos, BUFFER_SIZE + ba.size() - 1); int findPos = buffer.indexOf(ba); if (findPos >= 0) result = pos + (qint64)findPos; } return result; } qint64 Chunks::lastIndexOf(const QByteArray &ba, qint64 from) { qint64 result = -1; QByteArray buffer; for (qint64 pos=from; (pos > 0) && (result < 0); pos -= BUFFER_SIZE) { qint64 sPos = pos - BUFFER_SIZE - (qint64)ba.size() + 1; if (sPos < 0) sPos = 0; buffer = data(sPos, pos - sPos); int findPos = buffer.lastIndexOf(ba); if (findPos >= 0) result = sPos + (qint64)findPos; } return result; } // ***************************************** Char manipulations bool Chunks::insert(qint64 pos, char b) { if ((pos < 0) || (pos > _size)) return false; int chunkIdx; if (pos == _size) chunkIdx = getChunkIndex(pos-1); else chunkIdx = getChunkIndex(pos); qint64 posInBa = pos - _chunks[chunkIdx].absPos; _chunks[chunkIdx].data.insert(posInBa, b); _chunks[chunkIdx].dataChanged.insert(posInBa, char(1)); for (int idx=chunkIdx+1; idx < _chunks.size(); idx++) _chunks[idx].absPos += 1; _size += 1; _pos = pos; return true; } bool Chunks::overwrite(qint64 pos, char b) { if ((pos < 0) || (pos >= _size)) return false; int chunkIdx = getChunkIndex(pos); qint64 posInBa = pos - _chunks[chunkIdx].absPos; _chunks[chunkIdx].data[(int)posInBa] = b; _chunks[chunkIdx].dataChanged[(int)posInBa] = char(1); _pos = pos; return true; } bool Chunks::removeAt(qint64 pos) { if ((pos < 0) || (pos >= _size)) return false; int chunkIdx = getChunkIndex(pos); qint64 posInBa = pos - _chunks[chunkIdx].absPos; _chunks[chunkIdx].data.remove(posInBa, 1); _chunks[chunkIdx].dataChanged.remove(posInBa, 1); for (int idx=chunkIdx+1; idx < _chunks.size(); idx++) _chunks[idx].absPos -= 1; _size -= 1; _pos = pos; return true; } // ***************************************** Utility functions char Chunks::operator[](qint64 pos) { return data(pos, 1)[0]; } qint64 Chunks::pos() { return _pos; } qint64 Chunks::size() { return _size; } int Chunks::getChunkIndex(qint64 absPos) { // This routine checks, if there is already a copied chunk available. If os, it // returns a reference to it. If there is no copied chunk available, original // data will be copied into a new chunk. int foundIdx = -1; int insertIdx = 0; qint64 ioDelta = 0; for (int idx=0; idx < _chunks.size(); idx++) { Chunk chunk = _chunks[idx]; if ((absPos >= chunk.absPos) && (absPos < (chunk.absPos + chunk.data.size()))) { foundIdx = idx; break; } if (absPos < chunk.absPos) { insertIdx = idx; break; } ioDelta += chunk.data.size() - CHUNK_SIZE; insertIdx = idx + 1; } if (foundIdx == -1) { Chunk newChunk; qint64 readAbsPos = absPos - ioDelta; qint64 readPos = (readAbsPos & READ_CHUNK_MASK); _ioDevice->open(QIODevice::ReadOnly); _ioDevice->seek(readPos); newChunk.data = _ioDevice->read(CHUNK_SIZE); _ioDevice->close(); newChunk.absPos = absPos - (readAbsPos - readPos); newChunk.dataChanged = QByteArray(newChunk.data.size(), char(0)); _chunks.insert(insertIdx, newChunk); foundIdx = insertIdx; } return foundIdx; } #ifdef MODUL_TEST int Chunks::chunkSize() { return _chunks.size(); } #endif sqlitebrowser-3.10.1/libs/qhexedit/src/chunks.h000066400000000000000000000037451316047212700215140ustar00rootroot00000000000000#ifndef CHUNKS_H #define CHUNKS_H /** \cond docNever */ /*! The Chunks class is the storage backend for QHexEdit. * * When QHexEdit loads data, Chunks access them using a QIODevice interface. When the app uses * a QByteArray interface, QBuffer is used to provide again a QIODevice like interface. No data * will be changed, therefore Chunks opens the QIODevice in QIODevice::ReadOnly mode. After every * access Chunks closes the QIODevice, that's why external applications can overwrite files while * QHexEdit shows them. * * When the the user starts to edit the data, Chunks creates a local copy of a chunk of data (4 * kilobytes) and notes all changes there. Parallel to that chunk, there is a second chunk, * which keep track of which bytes are changed and which not. * */ #include struct Chunk { QByteArray data; QByteArray dataChanged; qint64 absPos; }; class Chunks: public QObject { Q_OBJECT public: // Constructors and file settings Chunks(QObject *parent); Chunks(QIODevice &ioDevice, QObject *parent); bool setIODevice(QIODevice &ioDevice); // Getting data out of Chunks QByteArray data(qint64 pos=0, qint64 count=-1, QByteArray *highlighted=0); bool write(QIODevice &iODevice, qint64 pos=0, qint64 count=-1); // Set and get highlighting infos void setDataChanged(qint64 pos, bool dataChanged); bool dataChanged(qint64 pos); // Search API qint64 indexOf(const QByteArray &ba, qint64 from); qint64 lastIndexOf(const QByteArray &ba, qint64 from); // Char manipulations bool insert(qint64 pos, char b); bool overwrite(qint64 pos, char b); bool removeAt(qint64 pos); // Utility functions char operator[](qint64 pos); qint64 pos(); qint64 size(); private: int getChunkIndex(qint64 absPos); QIODevice * _ioDevice; qint64 _pos; qint64 _size; QList _chunks; #ifdef MODUL_TEST public: int chunkSize(); #endif }; /** \endcond docNever */ #endif // CHUNKS_H sqlitebrowser-3.10.1/libs/qhexedit/src/commands.cpp000066400000000000000000000100411316047212700223400ustar00rootroot00000000000000#include "commands.h" #include // Helper class to store single byte commands class CharCommand : public QUndoCommand { public: enum CCmd {insert, removeAt, overwrite}; CharCommand(Chunks * chunks, CCmd cmd, qint64 charPos, char newChar, QUndoCommand *parent=0); void undo(); void redo(); bool mergeWith(const QUndoCommand *command); int id() const { return 1234; } private: Chunks * _chunks; qint64 _charPos; bool _wasChanged; char _newChar; char _oldChar; CCmd _cmd; }; CharCommand::CharCommand(Chunks * chunks, CCmd cmd, qint64 charPos, char newChar, QUndoCommand *parent) : QUndoCommand(parent) { _chunks = chunks; _charPos = charPos; _newChar = newChar; _cmd = cmd; } bool CharCommand::mergeWith(const QUndoCommand *command) { const CharCommand *nextCommand = static_cast(command); bool result = false; if (_cmd != CharCommand::removeAt) { if (nextCommand->_cmd == overwrite) if (nextCommand->_charPos == _charPos) { _newChar = nextCommand->_newChar; result = true; } } return result; } void CharCommand::undo() { switch (_cmd) { case insert: _chunks->removeAt(_charPos); break; case overwrite: _chunks->overwrite(_charPos, _oldChar); _chunks->setDataChanged(_charPos, _wasChanged); break; case removeAt: _chunks->insert(_charPos, _oldChar); _chunks->setDataChanged(_charPos, _wasChanged); break; } } void CharCommand::redo() { switch (_cmd) { case insert: _chunks->insert(_charPos, _newChar); break; case overwrite: _oldChar = (*_chunks)[_charPos]; _wasChanged = _chunks->dataChanged(_charPos); _chunks->overwrite(_charPos, _newChar); break; case removeAt: _oldChar = (*_chunks)[_charPos]; _wasChanged = _chunks->dataChanged(_charPos); _chunks->removeAt(_charPos); break; } } UndoStack::UndoStack(Chunks * chunks, QObject * parent) : QUndoStack(parent) { _chunks = chunks; _parent = parent; } void UndoStack::insert(qint64 pos, char c) { if ((pos >= 0) && (pos <= _chunks->size())) { QUndoCommand *cc = new CharCommand(_chunks, CharCommand::insert, pos, c); this->push(cc); } } void UndoStack::insert(qint64 pos, const QByteArray &ba) { if ((pos >= 0) && (pos <= _chunks->size())) { QString txt = QString(tr("Inserting %1 bytes")).arg(ba.size()); beginMacro(txt); for (int idx=0; idx < ba.size(); idx++) { QUndoCommand *cc = new CharCommand(_chunks, CharCommand::insert, pos + idx, ba.at(idx)); this->push(cc); } endMacro(); } } void UndoStack::removeAt(qint64 pos, qint64 len) { if ((pos >= 0) && (pos < _chunks->size())) { if (len==1) { QUndoCommand *cc = new CharCommand(_chunks, CharCommand::removeAt, pos, char(0)); this->push(cc); } else { QString txt = QString(tr("Delete %1 chars")).arg(len); beginMacro(txt); for (qint64 cnt=0; cnt= 0) && (pos < _chunks->size())) { QUndoCommand *cc = new CharCommand(_chunks, CharCommand::overwrite, pos, c); this->push(cc); } } void UndoStack::overwrite(qint64 pos, int len, const QByteArray &ba) { if ((pos >= 0) && (pos < _chunks->size())) { QString txt = QString(tr("Overwrite %1 chars")).arg(len); beginMacro(txt); removeAt(pos, len); insert(pos, ba); endMacro(); } } sqlitebrowser-3.10.1/libs/qhexedit/src/commands.h000066400000000000000000000026431316047212700220160ustar00rootroot00000000000000#ifndef COMMANDS_H #define COMMANDS_H /** \cond docNever */ #include #include "chunks.h" /*! CharCommand is a class to provid undo/redo functionality in QHexEdit. A QUndoCommand represents a single editing action on a document. CharCommand is responsable for manipulations on single chars. It can insert. overwrite and remove characters. A manipulation stores allways two actions 1. redo (or do) action 2. undo action. CharCommand also supports command compression via mergeWidht(). This allows the user to execute a undo command contation e.g. 3 steps in a single command. If you for example insert a new byt "34" this means for the editor doing 3 steps: insert a "00", overwrite it with "03" and the overwrite it with "34". These 3 steps are combined into a single step, insert a "34". The byte array oriented commands are just put into a set of single byte commands, which are pooled together with the macroBegin() and macroEnd() functionality of Qt's QUndoStack. */ class UndoStack : public QUndoStack { Q_OBJECT public: UndoStack(Chunks *chunks, QObject * parent=0); void insert(qint64 pos, char c); void insert(qint64 pos, const QByteArray &ba); void removeAt(qint64 pos, qint64 len=1); void overwrite(qint64 pos, char c); void overwrite(qint64 pos, int len, const QByteArray &ba); private: Chunks * _chunks; QObject * _parent; }; /** \endcond docNever */ #endif // COMMANDS_H sqlitebrowser-3.10.1/libs/qhexedit/src/license.txt000066400000000000000000000636411316047212700222340ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, 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 this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), 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 distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser 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 Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "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 LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY 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 LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey 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 library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library 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 Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it!sqlitebrowser-3.10.1/libs/qhexedit/src/qhexedit.cpp000066400000000000000000001000661316047212700223610ustar00rootroot00000000000000#include #include #include #include #include #include "qhexedit.h" #include // ********************************************************************** Constructor, destructor QHexEdit::QHexEdit(QWidget *parent) : QAbstractScrollArea(parent) { _addressArea = true; _addressWidth = 4; _asciiArea = true; _overwriteMode = true; _highlighting = true; _readOnly = false; _cursorPosition = 0; _lastEventSize = 0; _hexCharsInLine = 47; _bytesPerLine = 16; _editAreaIsAscii = false; _hexCaps = false; _dynamicBytesPerLine = false; _chunks = new Chunks(this); _undoStack = new UndoStack(_chunks, this); #ifdef Q_OS_WIN32 setFont(QFont("Courier", 10)); #else setFont(QFont("Monospace", 10)); #endif setAddressAreaColor(this->palette().alternateBase().color()); setHighlightingColor(QColor(0xff, 0xff, 0x99, 0xff)); setSelectionColor(this->palette().highlight().color()); connect(&_cursorTimer, SIGNAL(timeout()), this, SLOT(updateCursor())); connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust())); connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(adjust())); connect(_undoStack, SIGNAL(indexChanged(int)), this, SLOT(dataChangedPrivate(int))); _cursorTimer.setInterval(500); _cursorTimer.start(); setAddressWidth(4); setAddressArea(true); setAsciiArea(true); setOverwriteMode(true); setHighlighting(true); setReadOnly(false); init(); } QHexEdit::~QHexEdit() { } // ********************************************************************** Properties void QHexEdit::setAddressArea(bool addressArea) { _addressArea = addressArea; adjust(); setCursorPosition(_cursorPosition); viewport()->update(); } bool QHexEdit::addressArea() { return _addressArea; } void QHexEdit::setAddressAreaColor(const QColor &color) { _addressAreaColor = color; viewport()->update(); } QColor QHexEdit::addressAreaColor() { return _addressAreaColor; } void QHexEdit::setAddressOffset(qint64 addressOffset) { _addressOffset = addressOffset; adjust(); setCursorPosition(_cursorPosition); viewport()->update(); } qint64 QHexEdit::addressOffset() { return _addressOffset; } void QHexEdit::setAddressWidth(int addressWidth) { _addressWidth = addressWidth; adjust(); setCursorPosition(_cursorPosition); viewport()->update(); } int QHexEdit::addressWidth() { qint64 size = _chunks->size(); int n = 1; if (size > Q_INT64_C(0x100000000)){ n += 8; size /= Q_INT64_C(0x100000000);} if (size > 0x10000){ n += 4; size /= 0x10000;} if (size > 0x100){ n += 2; size /= 0x100;} if (size > 0x10){ n += 1; size /= 0x10;} if (n > _addressWidth) return n; else return _addressWidth; } void QHexEdit::setAsciiArea(bool asciiArea) { if (!asciiArea) _editAreaIsAscii = false; _asciiArea = asciiArea; adjust(); setCursorPosition(_cursorPosition); viewport()->update(); } bool QHexEdit::asciiArea() { return _asciiArea; } void QHexEdit::setBytesPerLine(int count) { _bytesPerLine = count; _hexCharsInLine = count * 3 - 1; adjust(); setCursorPosition(_cursorPosition); viewport()->update(); } int QHexEdit::bytesPerLine() { return _bytesPerLine; } void QHexEdit::setCursorPosition(qint64 position) { // 1. delete old cursor _blink = false; viewport()->update(_cursorRect); // 2. Check, if cursor in range? if (position > (_chunks->size() * 2 - 1)) position = _chunks->size() * 2 - (_overwriteMode ? 1 : 0); if (position < 0) position = 0; // 3. Calc new position of cursor _bPosCurrent = position / 2; _pxCursorY = ((position / 2 - _bPosFirst) / _bytesPerLine + 1) * _pxCharHeight; int x = (position % (2 * _bytesPerLine)); if (_editAreaIsAscii) { _pxCursorX = x / 2 * _pxCharWidth + _pxPosAsciiX; _cursorPosition = position & 0xFFFFFFFFFFFFFFFE; } else { _pxCursorX = (((x / 2) * 3) + (x % 2)) * _pxCharWidth + _pxPosHexX; _cursorPosition = position; } if (_overwriteMode) _cursorRect = QRect(_pxCursorX - horizontalScrollBar()->value(), _pxCursorY + _pxCursorWidth, _pxCharWidth, _pxCursorWidth); else _cursorRect = QRect(_pxCursorX - horizontalScrollBar()->value(), _pxCursorY - _pxCharHeight + 4, _pxCursorWidth, _pxCharHeight); // 4. Immediately draw new cursor _blink = true; viewport()->update(_cursorRect); emit currentAddressChanged(_bPosCurrent); } qint64 QHexEdit::cursorPosition(QPoint pos) { // Calc cursor position depending on a graphical position qint64 result = -1; int posX = pos.x() + horizontalScrollBar()->value(); int posY = pos.y() - 3; if ((posX >= _pxPosHexX) && (posX < (_pxPosHexX + (1 + _hexCharsInLine) * _pxCharWidth))) { _editAreaIsAscii = false; int x = (posX - _pxPosHexX) / _pxCharWidth; x = (x / 3) * 2 + x % 3; int y = (posY / _pxCharHeight) * 2 * _bytesPerLine; result = _bPosFirst * 2 + x + y; } else if (_asciiArea && (posX >= _pxPosAsciiX) && (posX < (_pxPosAsciiX + (1 + _bytesPerLine) * _pxCharWidth))) { _editAreaIsAscii = true; int x = 2 * (posX - _pxPosAsciiX) / _pxCharWidth; int y = (posY / _pxCharHeight) * 2 * _bytesPerLine; result = _bPosFirst * 2 + x + y; } return result; } qint64 QHexEdit::cursorPosition() { return _cursorPosition; } void QHexEdit::setData(const QByteArray &ba) { _data = ba; _bData.setData(_data); setData(_bData); } QByteArray QHexEdit::data() { return _chunks->data(0, -1); } void QHexEdit::setHighlighting(bool highlighting) { _highlighting = highlighting; viewport()->update(); } bool QHexEdit::highlighting() { return _highlighting; } void QHexEdit::setHighlightingColor(const QColor &color) { _brushHighlighted = QBrush(color); _penHighlighted = QPen(viewport()->palette().color(QPalette::WindowText)); viewport()->update(); } QColor QHexEdit::highlightingColor() { return _brushHighlighted.color(); } void QHexEdit::setOverwriteMode(bool overwriteMode) { _overwriteMode = overwriteMode; emit overwriteModeChanged(overwriteMode); } bool QHexEdit::overwriteMode() { return _overwriteMode; } void QHexEdit::setSelectionColor(const QColor &color) { _brushSelection = QBrush(color); _penSelection = QPen(Qt::white); viewport()->update(); } QColor QHexEdit::selectionColor() { return _brushSelection.color(); } bool QHexEdit::isReadOnly() { return _readOnly; } void QHexEdit::setReadOnly(bool readOnly) { _readOnly = readOnly; } void QHexEdit::setHexCaps(const bool isCaps) { if (_hexCaps != isCaps) { _hexCaps = isCaps; viewport()->update(); } } bool QHexEdit::hexCaps() { return _hexCaps; } void QHexEdit::setDynamicBytesPerLine(const bool isDynamic) { _dynamicBytesPerLine = isDynamic; resizeEvent(NULL); } bool QHexEdit::dynamicBytesPerLine() { return _dynamicBytesPerLine; } // ********************************************************************** Access to data of qhexedit bool QHexEdit::setData(QIODevice &iODevice) { bool ok = _chunks->setIODevice(iODevice); init(); dataChangedPrivate(); return ok; } QByteArray QHexEdit::dataAt(qint64 pos, qint64 count) { return _chunks->data(pos, count); } bool QHexEdit::write(QIODevice &iODevice, qint64 pos, qint64 count) { return _chunks->write(iODevice, pos, count); } // ********************************************************************** Char handling void QHexEdit::insert(qint64 index, char ch) { _undoStack->insert(index, ch); refresh(); } void QHexEdit::remove(qint64 index, qint64 len) { _undoStack->removeAt(index, len); refresh(); } void QHexEdit::replace(qint64 index, char ch) { _undoStack->overwrite(index, ch); refresh(); } // ********************************************************************** ByteArray handling void QHexEdit::insert(qint64 pos, const QByteArray &ba) { _undoStack->insert(pos, ba); refresh(); } void QHexEdit::replace(qint64 pos, qint64 len, const QByteArray &ba) { _undoStack->overwrite(pos, len, ba); refresh(); } // ********************************************************************** Utility functions void QHexEdit::ensureVisible() { if (_cursorPosition < (_bPosFirst * 2)) verticalScrollBar()->setValue((int)(_cursorPosition / 2 / _bytesPerLine)); if (_cursorPosition > ((_bPosFirst + (_rowsShown - 1)*_bytesPerLine) * 2)) verticalScrollBar()->setValue((int)(_cursorPosition / 2 / _bytesPerLine) - _rowsShown + 1); if (_pxCursorX < horizontalScrollBar()->value()) horizontalScrollBar()->setValue(_pxCursorX); if ((_pxCursorX + _pxCharWidth) > (horizontalScrollBar()->value() + viewport()->width())) horizontalScrollBar()->setValue(_pxCursorX + _pxCharWidth - viewport()->width()); viewport()->update(); } qint64 QHexEdit::indexOf(const QByteArray &ba, qint64 from) { qint64 pos = _chunks->indexOf(ba, from); if (pos > -1) { qint64 curPos = pos*2; setCursorPosition(curPos + ba.length()*2); resetSelection(curPos); setSelection(curPos + ba.length()*2); ensureVisible(); } return pos; } bool QHexEdit::isModified() { return _modified; } qint64 QHexEdit::lastIndexOf(const QByteArray &ba, qint64 from) { qint64 pos = _chunks->lastIndexOf(ba, from); if (pos > -1) { qint64 curPos = pos*2; setCursorPosition(curPos - 1); resetSelection(curPos); setSelection(curPos + ba.length()*2); ensureVisible(); } return pos; } void QHexEdit::redo() { _undoStack->redo(); setCursorPosition(_chunks->pos()*(_editAreaIsAscii ? 1 : 2)); refresh(); } QString QHexEdit::selectionToReadableString() { QByteArray ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()); return toReadable(ba); } void QHexEdit::setFont(const QFont &font) { QWidget::setFont(font); _pxCharWidth = fontMetrics().width(QLatin1Char('2')); _pxCharHeight = fontMetrics().height(); _pxGapAdr = _pxCharWidth / 2; _pxGapAdrHex = _pxCharWidth; _pxGapHexAscii = 2 * _pxCharWidth; _pxCursorWidth = _pxCharHeight / 7; _pxSelectionSub = _pxCharHeight / 5; viewport()->update(); } QString QHexEdit::toReadableString() { QByteArray ba = _chunks->data(); return toReadable(ba); } void QHexEdit::undo() { _undoStack->undo(); setCursorPosition(_chunks->pos()*(_editAreaIsAscii ? 1 : 2)); refresh(); } // ********************************************************************** Handle events void QHexEdit::keyPressEvent(QKeyEvent *event) { // Cursor movements if (event->matches(QKeySequence::MoveToNextChar)) { qint64 pos = _cursorPosition + 1; if (_editAreaIsAscii) pos += 1; setCursorPosition(pos); resetSelection(pos); } if (event->matches(QKeySequence::MoveToPreviousChar)) { qint64 pos = _cursorPosition - 1; if (_editAreaIsAscii) pos -= 1; setCursorPosition(pos); resetSelection(pos); } if (event->matches(QKeySequence::MoveToEndOfLine)) { qint64 pos = _cursorPosition - (_cursorPosition % (2 * _bytesPerLine)) + (2 * _bytesPerLine) - 1; setCursorPosition(pos); resetSelection(_cursorPosition); } if (event->matches(QKeySequence::MoveToStartOfLine)) { qint64 pos = _cursorPosition - (_cursorPosition % (2 * _bytesPerLine)); setCursorPosition(pos); resetSelection(_cursorPosition); } if (event->matches(QKeySequence::MoveToPreviousLine)) { setCursorPosition(_cursorPosition - (2 * _bytesPerLine)); resetSelection(_cursorPosition); } if (event->matches(QKeySequence::MoveToNextLine)) { setCursorPosition(_cursorPosition + (2 * _bytesPerLine)); resetSelection(_cursorPosition); } if (event->matches(QKeySequence::MoveToNextPage)) { setCursorPosition(_cursorPosition + (((_rowsShown - 1) * 2 * _bytesPerLine))); resetSelection(_cursorPosition); } if (event->matches(QKeySequence::MoveToPreviousPage)) { setCursorPosition(_cursorPosition - (((_rowsShown - 1) * 2 * _bytesPerLine))); resetSelection(_cursorPosition); } if (event->matches(QKeySequence::MoveToEndOfDocument)) { setCursorPosition(_chunks->size() * 2 ); resetSelection(_cursorPosition); } if (event->matches(QKeySequence::MoveToStartOfDocument)) { setCursorPosition(0); resetSelection(_cursorPosition); } // Select commands if (event->matches(QKeySequence::SelectAll)) { resetSelection(0); setSelection(2 * _chunks->size() + 1); } if (event->matches(QKeySequence::SelectNextChar)) { qint64 pos = _cursorPosition + 1; if (_editAreaIsAscii) pos += 1; setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectPreviousChar)) { qint64 pos = _cursorPosition - 1; if (_editAreaIsAscii) pos -= 1; setSelection(pos); setCursorPosition(pos); } if (event->matches(QKeySequence::SelectEndOfLine)) { qint64 pos = _cursorPosition - (_cursorPosition % (2 * _bytesPerLine)) + (2 * _bytesPerLine) - 1; setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectStartOfLine)) { qint64 pos = _cursorPosition - (_cursorPosition % (2 * _bytesPerLine)); setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectPreviousLine)) { qint64 pos = _cursorPosition - (2 * _bytesPerLine); setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectNextLine)) { qint64 pos = _cursorPosition + (2 * _bytesPerLine); setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectNextPage)) { qint64 pos = _cursorPosition + (((viewport()->height() / _pxCharHeight) - 1) * 2 * _bytesPerLine); setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectPreviousPage)) { qint64 pos = _cursorPosition - (((viewport()->height() / _pxCharHeight) - 1) * 2 * _bytesPerLine); setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectEndOfDocument)) { qint64 pos = _chunks->size() * 2; setCursorPosition(pos); setSelection(pos); } if (event->matches(QKeySequence::SelectStartOfDocument)) { qint64 pos = 0; setCursorPosition(pos); setSelection(pos); } // Edit Commands if (!_readOnly) { /* Cut */ if (event->matches(QKeySequence::Cut)) { QByteArray ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()).toHex(); for (qint64 idx = 32; idx < ba.size(); idx +=33) ba.insert(idx, "\n"); QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(ba); if (_overwriteMode) { qint64 len = getSelectionEnd() - getSelectionBegin(); replace(getSelectionBegin(), (int)len, QByteArray((int)len, char(0))); } else { remove(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()); } setCursorPosition(2 * getSelectionBegin()); resetSelection(2 * getSelectionBegin()); } else /* Paste */ if (event->matches(QKeySequence::Paste)) { QClipboard *clipboard = QApplication::clipboard(); QByteArray ba = QByteArray().fromHex(clipboard->text().toLatin1()); if (_overwriteMode) { ba = ba.left(std::min(ba.size(), (_chunks->size() - _bPosCurrent))); replace(_bPosCurrent, ba.size(), ba); } else insert(_bPosCurrent, ba); setCursorPosition(_cursorPosition + 2 * ba.size()); resetSelection(getSelectionBegin()); } else /* Delete char */ if (event->matches(QKeySequence::Delete)) { if (getSelectionBegin() != getSelectionEnd()) { _bPosCurrent = getSelectionBegin(); if (_overwriteMode) { QByteArray ba = QByteArray(getSelectionEnd() - getSelectionBegin(), char(0)); replace(_bPosCurrent, ba.size(), ba); } else { remove(_bPosCurrent, getSelectionEnd() - getSelectionBegin()); } } else { if (_overwriteMode) replace(_bPosCurrent, char(0)); else remove(_bPosCurrent, 1); } setCursorPosition(2 * _bPosCurrent); resetSelection(2 * _bPosCurrent); } else /* Backspace */ if ((event->key() == Qt::Key_Backspace) && (event->modifiers() == Qt::NoModifier)) { if (getSelectionBegin() != getSelectionEnd()) { _bPosCurrent = getSelectionBegin(); setCursorPosition(2 * _bPosCurrent); if (_overwriteMode) { QByteArray ba = QByteArray(getSelectionEnd() - getSelectionBegin(), char(0)); replace(_bPosCurrent, ba.size(), ba); } else { remove(_bPosCurrent, getSelectionEnd() - getSelectionBegin()); } resetSelection(2 * _bPosCurrent); } else { bool behindLastByte = false; if ((_cursorPosition / 2) == _chunks->size()) behindLastByte = true; _bPosCurrent -= 1; if (_overwriteMode) replace(_bPosCurrent, char(0)); else remove(_bPosCurrent, 1); if (!behindLastByte) _bPosCurrent -= 1; setCursorPosition(2 * _bPosCurrent); resetSelection(2 * _bPosCurrent); } } else /* undo */ if (event->matches(QKeySequence::Undo)) { undo(); } else /* redo */ if (event->matches(QKeySequence::Redo)) { redo(); } else if ((QApplication::keyboardModifiers() == Qt::NoModifier) || (QApplication::keyboardModifiers() == Qt::KeypadModifier) || (QApplication::keyboardModifiers() == Qt::ShiftModifier) || (QApplication::keyboardModifiers() == (Qt::AltModifier | Qt::ControlModifier)) || (QApplication::keyboardModifiers() == Qt::GroupSwitchModifier)) { /* Hex and ascii input */ int key; if (_editAreaIsAscii) key = (uchar)event->text()[0].toLatin1(); else key = int(event->text()[0].toLower().toLatin1()); if ((((key >= '0' && key <= '9') || (key >= 'a' && key <= 'f')) && _editAreaIsAscii == false) || (key >= ' ' && _editAreaIsAscii)) { if (getSelectionBegin() != getSelectionEnd()) { if (_overwriteMode) { qint64 len = getSelectionEnd() - getSelectionBegin(); replace(getSelectionBegin(), (int)len, QByteArray((int)len, char(0))); } else { remove(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()); _bPosCurrent = getSelectionBegin(); } setCursorPosition(2 * _bPosCurrent); resetSelection(2 * _bPosCurrent); } // If insert mode, then insert a byte if (_overwriteMode == false) if ((_cursorPosition % 2) == 0) insert(_bPosCurrent, char(0)); // Change content if (_chunks->size() > 0) { char ch = key; if (!_editAreaIsAscii){ QByteArray hexValue = _chunks->data(_bPosCurrent, 1).toHex(); if ((_cursorPosition % 2) == 0) hexValue[0] = key; else hexValue[1] = key; ch = QByteArray().fromHex(hexValue)[0]; } replace(_bPosCurrent, ch); if (_editAreaIsAscii) setCursorPosition(_cursorPosition + 2); else setCursorPosition(_cursorPosition + 1); resetSelection(_cursorPosition); } } } } /* Copy */ if (event->matches(QKeySequence::Copy)) { QByteArray ba = _chunks->data(getSelectionBegin(), getSelectionEnd() - getSelectionBegin()).toHex(); for (qint64 idx = 32; idx < ba.size(); idx +=33) ba.insert(idx, "\n"); QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(ba); } // Switch between insert/overwrite mode if ((event->key() == Qt::Key_Insert) && (event->modifiers() == Qt::NoModifier)) { setOverwriteMode(!overwriteMode()); setCursorPosition(_cursorPosition); } // switch from hex to ascii edit if (event->key() == Qt::Key_Tab && !_editAreaIsAscii){ _editAreaIsAscii = true; setCursorPosition(_cursorPosition); } // switch from ascii to hex edit if (event->key() == Qt::Key_Backtab && _editAreaIsAscii){ _editAreaIsAscii = false; setCursorPosition(_cursorPosition); } refresh(); } void QHexEdit::mouseMoveEvent(QMouseEvent * event) { _blink = false; viewport()->update(); qint64 actPos = cursorPosition(event->pos()); if (actPos >= 0) { setCursorPosition(actPos); setSelection(actPos); } } void QHexEdit::mousePressEvent(QMouseEvent * event) { _blink = false; viewport()->update(); qint64 cPos = cursorPosition(event->pos()); if (cPos >= 0) { resetSelection(cPos); setCursorPosition(cPos); } } void QHexEdit::paintEvent(QPaintEvent *event) { QPainter painter(viewport()); int pxOfsX = horizontalScrollBar()->value(); if (event->rect() != _cursorRect) { int pxPosStartY = _pxCharHeight; // draw some patterns if needed painter.fillRect(event->rect(), viewport()->palette().color(QPalette::Base)); if (_addressArea) painter.fillRect(QRect(-pxOfsX, event->rect().top(), _pxPosHexX - _pxGapAdrHex/2, height()), _addressAreaColor); if (_asciiArea) { int linePos = _pxPosAsciiX - (_pxGapHexAscii / 2); painter.setPen(Qt::gray); painter.drawLine(linePos - pxOfsX, event->rect().top(), linePos - pxOfsX, height()); } painter.setPen(viewport()->palette().color(QPalette::WindowText)); // paint address area if (_addressArea) { QString address; for (int row=0, pxPosY = _pxCharHeight; row <= (_dataShown.size()/_bytesPerLine); row++, pxPosY +=_pxCharHeight) { address = QString("%1").arg(_bPosFirst + row*_bytesPerLine + _addressOffset, _addrDigits, 16, QChar('0')); painter.drawText(_pxPosAdrX - pxOfsX, pxPosY, address); } } // paint hex and ascii area QPen colStandard = QPen(viewport()->palette().color(QPalette::WindowText)); painter.setBackgroundMode(Qt::TransparentMode); for (int row = 0, pxPosY = pxPosStartY; row <= _rowsShown; row++, pxPosY +=_pxCharHeight) { QByteArray hex; int pxPosX = _pxPosHexX - pxOfsX; int pxPosAsciiX2 = _pxPosAsciiX - pxOfsX; qint64 bPosLine = row * _bytesPerLine; for (int colIdx = 0; ((bPosLine + colIdx) < _dataShown.size() && (colIdx < _bytesPerLine)); colIdx++) { QColor c = viewport()->palette().color(QPalette::Base); painter.setPen(colStandard); qint64 posBa = _bPosFirst + bPosLine + colIdx; if ((getSelectionBegin() <= posBa) && (getSelectionEnd() > posBa)) { c = _brushSelection.color(); painter.setPen(_penSelection); } else { if (_highlighting) if (_markedShown.at((int)(posBa - _bPosFirst))) { c = _brushHighlighted.color(); painter.setPen(_penHighlighted); } } // render hex value QRect r; if (colIdx == 0) r.setRect(pxPosX, pxPosY - _pxCharHeight + _pxSelectionSub, 2*_pxCharWidth, _pxCharHeight); else r.setRect(pxPosX - _pxCharWidth, pxPosY - _pxCharHeight + _pxSelectionSub, 3*_pxCharWidth, _pxCharHeight); painter.fillRect(r, c); hex = _hexDataShown.mid((bPosLine + colIdx) * 2, 2); painter.drawText(pxPosX, pxPosY, hexCaps()?hex.toUpper():hex); pxPosX += 3*_pxCharWidth; // render ascii value if (_asciiArea) { int ch = (uchar)_dataShown.at(bPosLine + colIdx); if ( ch < 0x20 ) ch = '.'; r.setRect(pxPosAsciiX2, pxPosY - _pxCharHeight + _pxSelectionSub, _pxCharWidth, _pxCharHeight); painter.fillRect(r, c); painter.drawText(pxPosAsciiX2, pxPosY, QChar(ch)); pxPosAsciiX2 += _pxCharWidth; } } } painter.setBackgroundMode(Qt::TransparentMode); painter.setPen(viewport()->palette().color(QPalette::WindowText)); } // paint cursor if (_blink && !_readOnly && hasFocus()) painter.fillRect(_cursorRect, this->palette().color(QPalette::WindowText)); else { painter.fillRect(QRect(_pxCursorX - pxOfsX, _pxCursorY - _pxCharHeight, _pxCharWidth, _pxCharHeight), viewport()->palette().color(QPalette::Base)); if (_editAreaIsAscii) { QByteArray ba = _dataShown.mid((_cursorPosition - _bPosFirst) / 2, 1); if (ba != "") { if (ba.at(0) <= ' ') ba[0] = '.'; painter.drawText(_pxCursorX - pxOfsX, _pxCursorY, ba); } } else { painter.drawText(_pxCursorX - pxOfsX, _pxCursorY, _hexDataShown.mid(_cursorPosition - _bPosFirst, 1)); } } // emit event, if size has changed if (_lastEventSize != _chunks->size()) { _lastEventSize = _chunks->size(); emit currentSizeChanged(_lastEventSize); } } void QHexEdit::resizeEvent(QResizeEvent *) { if (_dynamicBytesPerLine) { int pxFixGaps = 0; if (_addressArea) pxFixGaps = addressWidth() * _pxCharWidth + _pxGapAdr; pxFixGaps += _pxGapAdrHex; if (_asciiArea) pxFixGaps += _pxGapHexAscii; // +1 because the last hex value do not have space. so it is effective one char more int charWidth = (viewport()->width() - pxFixGaps ) / _pxCharWidth + 1; // 2 hex alfa-digits 1 space 1 ascii per byte = 4; if ascii is disabled then 3 // to prevent devision by zero use the min value 1 setBytesPerLine(std::max(charWidth / (_asciiArea ? 4 : 3),1)); } adjust(); } bool QHexEdit::focusNextPrevChild(bool next) { if (_addressArea) { if ( (next && _editAreaIsAscii) || (!next && !_editAreaIsAscii )) return QWidget::focusNextPrevChild(next); else return false; } else { return QWidget::focusNextPrevChild(next); } } // ********************************************************************** Handle selections void QHexEdit::resetSelection() { _bSelectionBegin = _bSelectionInit; _bSelectionEnd = _bSelectionInit; } void QHexEdit::resetSelection(qint64 pos) { pos = pos / 2 ; if (pos < 0) pos = 0; if (pos > _chunks->size()) pos = _chunks->size(); _bSelectionInit = pos; _bSelectionBegin = pos; _bSelectionEnd = pos; } void QHexEdit::setSelection(qint64 pos) { pos = pos / 2; if (pos < 0) pos = 0; if (pos > _chunks->size()) pos = _chunks->size(); if (pos >= _bSelectionInit) { _bSelectionEnd = pos; _bSelectionBegin = _bSelectionInit; } else { _bSelectionBegin = pos; _bSelectionEnd = _bSelectionInit; } } int QHexEdit::getSelectionBegin() { return _bSelectionBegin; } int QHexEdit::getSelectionEnd() { return _bSelectionEnd; } // ********************************************************************** Private utility functions void QHexEdit::init() { _undoStack->clear(); setAddressOffset(0); resetSelection(0); setCursorPosition(0); verticalScrollBar()->setValue(0); _modified = false; } void QHexEdit::adjust() { // recalc Graphics if (_addressArea) { _addrDigits = addressWidth(); _pxPosHexX = _pxGapAdr + _addrDigits*_pxCharWidth + _pxGapAdrHex; } else _pxPosHexX = _pxGapAdrHex; _pxPosAdrX = _pxGapAdr; _pxPosAsciiX = _pxPosHexX + _hexCharsInLine * _pxCharWidth + _pxGapHexAscii; // set horizontalScrollBar() int pxWidth = _pxPosAsciiX; if (_asciiArea) pxWidth += _bytesPerLine*_pxCharWidth; horizontalScrollBar()->setRange(0, pxWidth - viewport()->width()); horizontalScrollBar()->setPageStep(viewport()->width()); // set verticalScrollbar() _rowsShown = ((viewport()->height()-4)/_pxCharHeight); int lineCount = (int)(_chunks->size() / (qint64)_bytesPerLine) + 1; verticalScrollBar()->setRange(0, lineCount - _rowsShown); verticalScrollBar()->setPageStep(_rowsShown); int value = verticalScrollBar()->value(); _bPosFirst = (qint64)value * _bytesPerLine; _bPosLast = _bPosFirst + (qint64)(_rowsShown * _bytesPerLine) - 1; if (_bPosLast >= _chunks->size()) _bPosLast = _chunks->size() - 1; readBuffers(); setCursorPosition(_cursorPosition); } void QHexEdit::dataChangedPrivate(int) { _modified = _undoStack->index() != 0; adjust(); emit dataChanged(); } void QHexEdit::refresh() { ensureVisible(); readBuffers(); } void QHexEdit::readBuffers() { _dataShown = _chunks->data(_bPosFirst, _bPosLast - _bPosFirst + _bytesPerLine + 1, &_markedShown); _hexDataShown = QByteArray(_dataShown.toHex()); } QString QHexEdit::toReadable(const QByteArray &ba) { QString result; for (int i=0; i < ba.size(); i += 16) { QString addrStr = QString("%1").arg(_addressOffset + i, addressWidth(), 16, QChar('0')); QString hexStr; QString ascStr; for (int j=0; j<16; j++) { if ((i + j) < ba.size()) { hexStr.append(" ").append(ba.mid(i+j, 1).toHex()); char ch = ba[i + j]; if ((ch < 0x20) || (ch > 0x7e)) ch = '.'; ascStr.append(QChar(ch)); } } result += addrStr + " " + QString("%1").arg(hexStr, -48) + " " + QString("%1").arg(ascStr, -17) + "\n"; } return result; } void QHexEdit::updateCursor() { if (_blink) _blink = false; else _blink = true; viewport()->update(_cursorRect); } sqlitebrowser-3.10.1/libs/qhexedit/src/qhexedit.h000066400000000000000000000370641316047212700220350ustar00rootroot00000000000000#ifndef QHEXEDIT_H #define QHEXEDIT_H #include #include #include #include "chunks.h" #include "commands.h" #ifdef QHEXEDIT_EXPORTS #define QHEXEDIT_API Q_DECL_EXPORT #elif QHEXEDIT_IMPORTS #define QHEXEDIT_API Q_DECL_IMPORT #else #define QHEXEDIT_API #endif /** \mainpage QHexEdit is a binary editor widget for Qt. \version Version 0.8.3 \image html qhexedit.png */ /** QHexEdit is a hex editor widget written in C++ for the Qt (Qt4, Qt5) framework. It is a simple editor for binary data, just like QPlainTextEdit is for text data. There are sip configuration files included, so it is easy to create bindings for PyQt and you can use this widget also in python 2 and 3. QHexEdit takes the data of a QByteArray (setData()) and shows it. You can use the mouse or the keyboard to navigate inside the widget. If you hit the keys (0..9, a..f) you will change the data. Changed data is highlighted and can be accessed via data(). Normaly QHexEdit works in the overwrite Mode. You can set overwriteMode(false) and insert data. In this case the size of data() increases. It is also possible to delete bytes (del or backspace), here the size of data decreases. You can select data with keyboard hits or mouse movements. The copy-key will copy the selected data into the clipboard. The cut-key copies also but delets it afterwards. In overwrite mode, the paste function overwrites the content of the (does not change the length) data. In insert mode, clipboard data will be inserted. The clipboard content is expected in ASCII Hex notation. Unknown characters will be ignored. QHexEdit comes with undo/redo functionality. All changes can be undone, by pressing the undo-key (usually ctr-z). They can also be redone afterwards. The undo/redo framework is cleared, when setData() sets up a new content for the editor. You can search data inside the content with indexOf() and lastIndexOf(). The replace() function is to change located subdata. This 'replaced' data can also be undone by the undo/redo framework. QHexEdit is based on QIODevice, that's why QHexEdit can handle big amounts of data. The size of edited data can be more then two gigabytes without any restrictions. */ class QHEXEDIT_API QHexEdit : public QAbstractScrollArea { Q_OBJECT /*! Property address area switch the address area on or off. Set addressArea true (show it), false (hide it). */ Q_PROPERTY(bool addressArea READ addressArea WRITE setAddressArea) /*! Property address area color sets (setAddressAreaColor()) the backgorund color of address areas. You can also read the color (addressaAreaColor()). */ Q_PROPERTY(QColor addressAreaColor READ addressAreaColor WRITE setAddressAreaColor) /*! Property addressOffset is added to the Numbers of the Address Area. A offset in the address area (left side) is sometimes usefull, whe you show only a segment of a complete memory picture. With setAddressOffset() you set this property - with addressOffset() you get the current value. */ Q_PROPERTY(qint64 addressOffset READ addressOffset WRITE setAddressOffset) /*! Set and get the minimum width of the address area, width in characters. */ Q_PROPERTY(int addressWidth READ addressWidth WRITE setAddressWidth) /*! Switch the ascii area on (true, show it) or off (false, hide it). */ Q_PROPERTY(bool asciiArea READ asciiArea WRITE setAsciiArea) /*! Set and get bytes number per line.*/ Q_PROPERTY(int bytesPerLine READ bytesPerLine WRITE setBytesPerLine) /*! Porperty cursorPosition sets or gets the position of the editor cursor in QHexEdit. Every byte in data has to cursor positions: the lower and upper Nibble. Maximum cursor position is factor two of data.size(). */ Q_PROPERTY(qint64 cursorPosition READ cursorPosition WRITE setCursorPosition) /*! Property data holds the content of QHexEdit. Call setData() to set the content of QHexEdit, data() returns the actual content. When calling setData() with a QByteArray as argument, QHexEdit creates a internal copy of the data If you want to edit big files please use setData(), based on QIODevice. */ Q_PROPERTY(QByteArray data READ data WRITE setData NOTIFY dataChanged) /*! That property defines if the hex values looks as a-f if the value is false(default) or A-F if value is true. */ Q_PROPERTY(bool hexCaps READ hexCaps WRITE setHexCaps) /*! Property defines the dynamic calculation of bytesPerLine parameter depends of width of widget. set this property true to avoid horizontal scrollbars and show the maximal possible data. defalut value is false*/ Q_PROPERTY(bool dynamicBytesPerLine READ dynamicBytesPerLine WRITE setDynamicBytesPerLine) /*! Switch the highlighting feature on or of: true (show it), false (hide it). */ Q_PROPERTY(bool highlighting READ highlighting WRITE setHighlighting) /*! Property highlighting color sets (setHighlightingColor()) the backgorund color of highlighted text areas. You can also read the color (highlightingColor()). */ Q_PROPERTY(QColor highlightingColor READ highlightingColor WRITE setHighlightingColor) /*! Porperty overwrite mode sets (setOverwriteMode()) or gets (overwriteMode()) the mode in which the editor works. In overwrite mode the user will overwrite existing data. The size of data will be constant. In insert mode the size will grow, when inserting new data. */ Q_PROPERTY(bool overwriteMode READ overwriteMode WRITE setOverwriteMode) /*! Property selection color sets (setSelectionColor()) the backgorund color of selected text areas. You can also read the color (selectionColor()). */ Q_PROPERTY(QColor selectionColor READ selectionColor WRITE setSelectionColor) /*! Porperty readOnly sets (setReadOnly()) or gets (isReadOnly) the mode in which the editor works. In readonly mode the the user can only navigate through the data and select data; modifying is not possible. This property's default is false. */ Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) /*! Set the font of the widget. Please use fixed width fonts like Mono or Courier.*/ Q_PROPERTY(QFont font READ font WRITE setFont) public: /*! Creates an instance of QHexEdit. \param parent Parent widget of QHexEdit. */ QHexEdit(QWidget *parent=0); // Access to data of qhexedit /*! Sets the data of QHexEdit. The QIODevice will be opend just before reading and closed immediately afterwards. This is to allow other programs to rewrite the file while editing it. */ bool setData(QIODevice &iODevice); /*! Givs back the data as a QByteArray starting at position \param pos and delivering \param count bytes. */ QByteArray dataAt(qint64 pos, qint64 count=-1); /*! Givs back the data into a \param iODevice starting at position \param pos and delivering \param count bytes. */ bool write(QIODevice &iODevice, qint64 pos=0, qint64 count=-1); // Char handling /*! Inserts a char. \param pos Index position, where to insert \param ch Char, which is to insert The char will be inserted and size of data grows. */ void insert(qint64 pos, char ch); /*! Removes len bytes from the content. \param pos Index position, where to remove \param len Amount of bytes to remove */ void remove(qint64 pos, qint64 len=1); /*! Replaces a char. \param pos Index position, where to overwrite \param ch Char, which is to insert The char will be overwritten and size remains constant. */ void replace(qint64 pos, char ch); // ByteArray handling /*! Inserts a byte array. \param pos Index position, where to insert \param ba QByteArray, which is to insert The QByteArray will be inserted and size of data grows. */ void insert(qint64 pos, const QByteArray &ba); /*! Replaces \param len bytes with a byte array \param ba \param pos Index position, where to overwrite \param ba QByteArray, which is inserted \param len count of bytes to overwrite The data is overwritten and size of data may change. */ void replace(qint64 pos, qint64 len, const QByteArray &ba); // Utility functioins /*! Calc cursor position from graphics position * \param point from where the cursor position should be calculated * \return Cursor postioin */ qint64 cursorPosition(QPoint point); /*! Ensure the cursor to be visble */ void ensureVisible(); /*! Find first occurence of ba in QHexEdit data * \param ba Data to find * \param from Point where the search starts * \return pos if fond, else -1 */ qint64 indexOf(const QByteArray &ba, qint64 from); /*! Returns if any changes where done on document * \return true when document is modified else false */ bool isModified(); /*! Find last occurence of ba in QHexEdit data * \param ba Data to find * \param from Point where the search starts * \return pos if fond, else -1 */ qint64 lastIndexOf(const QByteArray &ba, qint64 from); /*! Gives back a formatted image of the selected content of QHexEdit */ QString selectionToReadableString(); /*! Set Font of QHexEdit * \param font */ void setFont(const QFont &font); /*! Gives back a formatted image of the content of QHexEdit */ QString toReadableString(); public slots: /*! Redoes the last operation. If there is no operation to redo, i.e. there is no redo step in the undo/redo history, nothing happens. */ void redo(); /*! Undoes the last operation. If there is no operation to undo, i.e. there is no undo step in the undo/redo history, nothing happens. */ void undo(); signals: /*! Contains the address, where the cursor is located. */ void currentAddressChanged(qint64 address); /*! Contains the size of the data to edit. */ void currentSizeChanged(qint64 size); /*! The signal is emitted every time, the data is changed. */ void dataChanged(); /*! The signal is emitted every time, the overwrite mode is changed. */ void overwriteModeChanged(bool state); /*! \cond docNever */ public: ~QHexEdit(); // Properties bool addressArea(); void setAddressArea(bool addressArea); QColor addressAreaColor(); void setAddressAreaColor(const QColor &color); qint64 addressOffset(); void setAddressOffset(qint64 addressArea); int addressWidth(); void setAddressWidth(int addressWidth); bool asciiArea(); void setAsciiArea(bool asciiArea); int bytesPerLine(); void setBytesPerLine(int count); qint64 cursorPosition(); void setCursorPosition(qint64 position); QByteArray data(); void setData(const QByteArray &ba); void setHexCaps(const bool isCaps); bool hexCaps(); void setDynamicBytesPerLine(const bool isDynamic); bool dynamicBytesPerLine(); bool highlighting(); void setHighlighting(bool mode); QColor highlightingColor(); void setHighlightingColor(const QColor &color); bool overwriteMode(); void setOverwriteMode(bool overwriteMode); bool isReadOnly(); void setReadOnly(bool readOnly); QColor selectionColor(); void setSelectionColor(const QColor &color); protected: // Handle events void keyPressEvent(QKeyEvent *event); void mouseMoveEvent(QMouseEvent * event); void mousePressEvent(QMouseEvent * event); void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent *); virtual bool focusNextPrevChild(bool next); private: // Handle selections void resetSelection(qint64 pos); // set selectionStart and selectionEnd to pos void resetSelection(); // set selectionEnd to selectionStart void setSelection(qint64 pos); // set min (if below init) or max (if greater init) int getSelectionBegin(); int getSelectionEnd(); // Private utility functions void init(); void readBuffers(); QString toReadable(const QByteArray &ba); private slots: void adjust(); // recalc pixel positions void dataChangedPrivate(int idx=0); // emit dataChanged() signal void refresh(); // ensureVisible() and readBuffers() void updateCursor(); // update blinking cursor private: // Name convention: pixel positions start with _px int _pxCharWidth, _pxCharHeight; // char dimensions (dpendend on font) int _pxPosHexX; // X-Pos of HeaxArea int _pxPosAdrX; // X-Pos of Address Area int _pxPosAsciiX; // X-Pos of Ascii Area int _pxGapAdr; // gap left from AddressArea int _pxGapAdrHex; // gap between AddressArea and HexAerea int _pxGapHexAscii; // gap between HexArea and AsciiArea int _pxCursorWidth; // cursor width int _pxSelectionSub; // offset selection rect int _pxCursorX; // current cursor pos int _pxCursorY; // current cursor pos // Name convention: absolute byte positions in chunks start with _b qint64 _bSelectionBegin; // first position of Selection qint64 _bSelectionEnd; // end of Selection qint64 _bSelectionInit; // memory position of Selection qint64 _bPosFirst; // position of first byte shown qint64 _bPosLast; // position of last byte shown qint64 _bPosCurrent; // current position // variables to store the property values bool _addressArea; // left area of QHexEdit QColor _addressAreaColor; int _addressWidth; bool _asciiArea; qint64 _addressOffset; int _bytesPerLine; int _hexCharsInLine; bool _highlighting; bool _overwriteMode; QBrush _brushSelection; QPen _penSelection; QBrush _brushHighlighted; QPen _penHighlighted; bool _readOnly; bool _hexCaps; bool _dynamicBytesPerLine; // other variables bool _editAreaIsAscii; // flag about the ascii mode edited int _addrDigits; // real no of addressdigits, may be > addressWidth bool _blink; // help get cursor blinking QBuffer _bData; // buffer, when setup with QByteArray Chunks *_chunks; // IODevice based access to data QTimer _cursorTimer; // for blinking cursor qint64 _cursorPosition; // absolute positioin of cursor, 1 Byte == 2 tics QRect _cursorRect; // physical dimensions of cursor QByteArray _data; // QHexEdit's data, when setup with QByteArray QByteArray _dataShown; // data in the current View QByteArray _hexDataShown; // data in view, transformed to hex qint64 _lastEventSize; // size, which was emitted last time QByteArray _markedShown; // marked data in view bool _modified; // Is any data in editor modified? int _rowsShown; // lines of text shown UndoStack * _undoStack; // Stack to store edit actions for undo/redo /*! \endcond docNever */ }; #endif // QHEXEDIT_H sqlitebrowser-3.10.1/libs/qhexedit/src/qhexedit.pro000066400000000000000000000004631316047212700223770ustar00rootroot00000000000000 greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TEMPLATE = lib VERSION = 2.1.0 CONFIG += qt warn_on release HEADERS = \ src/qhexedit.h \ src/chunks.h \ src/commands.h SOURCES = \ src/qhexedit.cpp \ src/chunks.cpp \ src/commands.cpp TARGET = qhexedit sqlitebrowser-3.10.1/libs/qscintilla/000077500000000000000000000000001316047212700176005ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/ChangeLog000066400000000000000000006007431316047212700213640ustar00rootroot000000000000002017-02-20 Phil Thompson * NEWS: Released as v2.10. [6c07847b2835] [2.10] * qt/qscintilla_cs.qm, qt/qscintilla_de.qm, qt/qscintilla_es.qm, qt/qscintilla_fr.qm, qt/qscintilla_pt_br.qm: Updated the .qm files. [3b3c5924e746] * qt/qscintilla_fr.ts: Partial updated French translations from Alan Garny. [ca2d6917015e] 2017-02-17 Phil Thompson * Python/sip/qsciscintillabase.sip: Added /Transfer/ to the scroll bar replacement functions. [49cf7181402a] 2017-02-15 Phil Thompson * qt/qscintilla_de.ts: Updated German translations from Detlev. [51cca6073075] 2017-02-14 Phil Thompson * qt/qscintilla_es.ts: Updated Spanish translations from Jaime Seuma. [0e30abdd0907] 2017-02-13 Phil Thompson * designer-Qt4Qt5/designer.pro, example-Qt4Qt5/application.pro, qt/qscintilla.pro: Removed the 'release' option from all CONFIG lines. [0901267a8e49] * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.cpp, qt/qsciscintillabase.h: Added replaceHorizontalScrollBar() and replaceVerticalScrollBar() to QsciScintillaBase. [bb7efd26b8b3] * qt/qscintilla_cs.ts, qt/qscintilla_de.ts, qt/qscintilla_es.ts, qt/qscintilla_fr.ts, qt/qscintilla_pt_br.ts: Updated the translation files. [76c23d751930] 2017-01-21 Phil Thompson * Python/sip/qscilexermarkdown.sip, qt/qscilexerjson.cpp, qt/qscilexermarkdown.cpp, qt/qscilexermarkdown.h: Updated the Markdown lexer with the latest settings from Detlev. [9e9992a4e9f7] 2017-01-17 Phil Thompson * qt/qsciapis.cpp: Fixed problems with auto-completion lists where contexts and image identifiers were getting lost. [039599ba1b85] 2017-01-16 Phil Thompson * designer-Qt4Qt5/designer.pro, example-Qt4Qt5/application.pro: Fixed the example and designer plugin .pro files for the change library name. [d6c564089958] * lib/README.doc: Updated website links to https. [18a7013d4f8b] * qt/qsciabstractapis.h, qt/qsciapis.h, qt/qscicommand.h, qt/qscicommandset.h, qt/qscidocument.h, qt/qsciglobal.h, qt/qscilexer.h, qt/qscilexeravs.h, qt/qscilexerbash.h, qt/qscilexerbatch.h, qt/qscilexercmake.h, qt/qscilexercoffeescript.h, qt/qscilexercpp.h, qt/qscilexercsharp.h, qt/qscilexercss.h, qt/qscilexercustom.h, qt/qscilexerd.h, qt/qscilexerdiff.h, qt/qscilexerfortran.h, qt/qscilexerfortran77.h, qt/qscilexerhtml.h, qt/qscilexeridl.h, qt/qscilexerjava.h, qt/qscilexerjavascript.h, qt/qscilexerjson.h, qt/qscilexerlua.h, qt/qscilexermakefile.h, qt/qscilexermarkdown.h, qt/qscilexermatlab.h, qt/qscilexeroctave.h, qt/qscilexerpascal.h, qt/qscilexerperl.h, qt/qscilexerpo.h, qt/qscilexerpostscript.h, qt/qscilexerpov.h, qt/qscilexerproperties.h, qt/qscilexerpython.h, qt/qscilexerruby.h, qt/qscilexerspice.h, qt/qscilexersql.h, qt/qscilexertcl.h, qt/qscilexertex.h, qt/qscilexerverilog.h, qt/qscilexervhdl.h, qt/qscilexerxml.h, qt/qscilexeryaml.h, qt/qscimacro.h, qt/qsciprinter.h, qt/qsciscintilla.h, qt/qsciscintillabase.h, qt/qscistyle.h, qt/qscistyledtext.h: Removed all the __APPLE__ C++ linkages. [ecd39912cb9b] * NEWS, Python/sip/qscilexer.sip, qt/qscilexer.h: The previously internal methods of QsciLexer are now part of the public API and are exposed to Python. [4791eae227c6] * NEWS, Python/configure.py, qt/features/qscintilla2.prf, qt/features_staticlib/qscintilla2.prf, qt/qscintilla.pro: The name of the library now embeds the major version of Qt so that Qt4 and Qt5 libraries can be installed in the same directory. [b501dcc67049] * NEWS, Python/sip/qsciscintilla.sip, qt/qscilexercustom.h, qt/qsciscintilla.cpp, qt/qsciscintilla.h: Implemented QscScintilla::bytes() and a corresponding text() overload mainly for the use of QsciLexerCustom::styleText() implementations. [ed7a5a072695] 2017-01-15 Phil Thompson * Python/sip/qsciscintillabase.sip: Updated the sub-class convertor code. [ee4e6efa0576] * NEWS, Python/sip/qscilexermarkdown.sip, Python/sip/qscimodcommon.sip, qt/qscilexermarkdown.cpp, qt/qscilexermarkdown.h, qt/qscintilla.pro: Added the QsciLexerMarkdown class. [0b5e03e0b64f] 2017-01-11 Phil Thompson * NEWS, Python/sip/qscilexerjson.sip, Python/sip/qscimodcommon.sip, qt/qscilexerjson.cpp, qt/qscilexerjson.h, qt/qscintilla.pro: Implemented QsciLexerJSON. [bb5118a2b0cb] 2017-01-05 Phil Thompson * NEWS, Python/sip/qscilexercoffeescript.sip, qt/qscilexercoffeescript.cpp, qt/qscilexercoffeescript.h: Added InstanceProperty to QsciLexerCoffeeScript. [2a6987f4c3c3] * NEWS, Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, qt/ScintillaQt.cpp, qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.h: Implemented the new notifications. [12ba81979751] 2017-01-04 Phil Thompson * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: Added the low-level popup options. [6a6fccaf8adf] * NEWS, Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.h: Added support for multiple edge columns. [761b940d39c6] 2017-01-03 Phil Thompson * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: Added the low-level idle styling support. [fe8c747abb81] * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: Added the low-level support for fold text. [3afaaf7830c6] * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: Updates to the low-level target support. [709bfb578a28] * NEWS, Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, qt/qsciscintilla.h, qt/qsciscintillabase.h: Added support for the additional indicators. [fb7bcbfc6c96] * NEWS, Python/sip/qsciscintillabase.sip, qt/qsciscintillabase.h: Added some more low-level constants. [d19d12e79c31] * NEWS, Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.h: Added support for setting the margin background colour. Added support for setting the number of margins. [407db46c80a6] * qt/qscilexercustom.cpp, qt/qscilexercustom.h: Fixed QsciLexerCustom::startStyling() now that the 2nd argument isn't used. [2d4cc3cdb123] * NEWS, Python/sip/qsciscintilla.sip, Python/sip/qsciscintillabase.sip, qt/qsciscintilla.cpp, qt/qsciscintilla.h, qt/qsciscintillabase.h: Added support for visible whitespace in indentations only. Added support for tab drawing modes. [1ef385e510b8] * qt/InputMethod.cpp: Updated the inputMethodEvent() implementation. [f0060458bd73] 2017-01-02 Phil Thompson * qt/InputMethod.cpp, qt/ScintillaQt.cpp, qt/ScintillaQt.h: Fixed compilation bugs with SCI_NAMESPACE defined. [ef072ff5da5e] * lib/README.doc: Minor documentation updates. [f89ceb95b9c5] * qt/qsciscintillabase.cpp: Fixed compilation bugs. [8fdfb9bca00d] * CONTRIBUTING, Python/configure-old.py, Python/configure.py, README, cocoa/PlatCocoa.h, cocoa/PlatCocoa.mm, cocoa/ScintillaCocoa.h, cocoa/ScintillaCocoa.mm, cocoa/ScintillaFramework/Info.plist, cocoa/ ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj, coc oa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspa ce/contents.xcworkspacedata, cocoa/ScintillaFramework/ScintillaFrame work.xcodeproj/xcshareddata/xcschemes/Scintilla.xcscheme, cocoa/ScintillaFramework/module.modulemap, cocoa/ScintillaTest/AppController.h, cocoa/ScintillaTest/AppController.mm, cocoa/ScintillaTest/English.lproj/MainMenu.xib, cocoa/ScintillaTest/Info.plist, cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.pbxproj, cocoa/S cintillaTest/ScintillaTest.xcodeproj/project.xcworkspace/contents.xc workspacedata, cocoa/ScintillaView.h, cocoa/ScintillaView.mm, cocoa/checkbuildosx.sh, cppcheck.suppress, delcvs.bat, designer- Qt4Qt5/designer.pro, doc/Design.html, doc/Icons.html, doc/Lexer.txt, doc/Privacy.html, doc/SciCoding.html, doc/ScintillaDoc.html, doc/ScintillaDownload.html, doc/ScintillaHistory.html, doc/ScintillaRelated.html, doc/ScintillaToDo.html, doc/ScintillaUsage.html, doc/index.html, example- Qt4Qt5/application.pro, gtk/Converter.h, gtk/PlatGTK.cxx, gtk/ScintillaGTK.cxx, gtk/ScintillaGTK.h, gtk/ScintillaGTKAccessible.cxx, gtk/ScintillaGTKAccessible.h, gtk/deps.mak, gtk/makefile, gtk/scintilla-marshal.c, gtk/scintilla- marshal.h, gtk/scintilla-marshal.list, include/ILexer.h, include/Platform.h, include/SciLexer.h, include/Sci_Position.h, include/Scintilla.h, include/Scintilla.iface, include/ScintillaWidget.h, lexers/LexA68k.cxx, lexers/LexAPDL.cxx, lexers/LexASY.cxx, lexers/LexAU3.cxx, lexers/LexAVE.cxx, lexers/LexAVS.cxx, lexers/LexAbaqus.cxx, lexers/LexAda.cxx, lexers/LexAsm.cxx, lexers/LexAsn1.cxx, lexers/LexBaan.cxx, lexers/LexBash.cxx, lexers/LexBasic.cxx, lexers/LexBatch.cxx, lexers/LexBibTeX.cxx, lexers/LexBullant.cxx, lexers/LexCLW.cxx, lexers/LexCOBOL.cxx, lexers/LexCPP.cxx, lexers/LexCSS.cxx, lexers/LexCaml.cxx, lexers/LexCmake.cxx, lexers/LexCoffeeScript.cxx, lexers/LexConf.cxx, lexers/LexCrontab.cxx, lexers/LexCsound.cxx, lexers/LexD.cxx, lexers/LexDMAP.cxx, lexers/LexDMIS.cxx, lexers/LexDiff.cxx, lexers/LexECL.cxx, lexers/LexEDIFACT.cxx, lexers/LexEScript.cxx, lexers/LexEiffel.cxx, lexers/LexErlang.cxx, lexers/LexErrorList.cxx, lexers/LexFlagship.cxx, lexers/LexForth.cxx, lexers/LexFortran.cxx, lexers/LexGAP.cxx, lexers/LexGui4Cli.cxx, lexers/LexHTML.cxx, lexers/LexHaskell.cxx, lexers/LexHex.cxx, lexers/LexInno.cxx, lexers/LexJSON.cxx, lexers/LexKVIrc.cxx, lexers/LexKix.cxx, lexers/LexLaTeX.cxx, lexers/LexLisp.cxx, lexers/LexLout.cxx, lexers/LexLua.cxx, lexers/LexMMIXAL.cxx, lexers/LexMPT.cxx, lexers/LexMSSQL.cxx, lexers/LexMagik.cxx, lexers/LexMake.cxx, lexers/LexMarkdown.cxx, lexers/LexMatlab.cxx, lexers/LexMetapost.cxx, lexers/LexModula.cxx, lexers/LexMySQL.cxx, lexers/LexNimrod.cxx, lexers/LexNsis.cxx, lexers/LexNull.cxx, lexers/LexOScript.cxx, lexers/LexOpal.cxx, lexers/LexOthers.cxx, lexers/LexPB.cxx, lexers/LexPLM.cxx, lexers/LexPO.cxx, lexers/LexPOV.cxx, lexers/LexPS.cxx, lexers/LexPascal.cxx, lexers/LexPerl.cxx, lexers/LexPowerPro.cxx, lexers/LexPowerShell.cxx, lexers/LexProgress.cxx, lexers/LexProps.cxx, lexers/LexPython.cxx, lexers/LexR.cxx, lexers/LexRebol.cxx, lexers/LexRegistry.cxx, lexers/LexRuby.cxx, lexers/LexRust.cxx, lexers/LexSML.cxx, lexers/LexSQL.cxx, lexers/LexSTTXT.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/LexTCMD.cxx, lexers/LexTeX.cxx, lexers/LexTxt2tags.cxx, lexers/LexVB.cxx, lexers/LexVHDL.cxx, lexers/LexVerilog.cxx, lexers/LexVisualProlog.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/StyleContext.cxx, lexlib/StyleContext.h, lexlib/SubStyles.h, lexlib/WordList.cxx, lexlib/WordList.h, qt/qscintilla.pro, scripts/Face.py, scripts/FileGenerator.py, scripts/GenerateCaseConvert.py, scripts/HeaderCheck.py, scripts/HeaderOrder.txt, scripts/LexGen.py, scripts/ScintillaData.py, src/AutoComplete.cxx, src/CallTip.cxx, src/CaseConvert.cxx, src/CaseConvert.h, src/CaseFolder.cxx, src/Catalogue.cxx, src/CellBuffer.cxx, src/CellBuffer.h, src/CharClassify.cxx, src/CharClassify.h, src/ContractionState.cxx, src/ContractionState.h, src/Decoration.cxx, 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/Indicator.cxx, src/Indicator.h, src/KeyMap.cxx, src/KeyMap.h, src/LineMarker.cxx, src/MarginView.cxx, src/PerLine.cxx, src/Position.h, src/PositionCache.cxx, src/PositionCache.h, src/RESearch.cxx, src/RESearch.h, src/RunStyles.cxx, src/ScintillaBase.cxx, src/ScintillaBase.h, src/Selection.cxx, src/Selection.h, src/SparseVector.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, test/ScintillaCallable.py, test/XiteQt.py, test/XiteWin.py, test/examples/perl-test- 5220delta.pl, test/examples/perl-test-5220delta.pl.styled, test/examples/perl-test-sub-prototypes.pl, test/examples/perl-test- sub-prototypes.pl.styled, test/gi/Scintilla-0.1.gir.good, test/gi /Scintilla-filtered.h, test/gi/filter-scintilla-h.py, test/gi/gi- test.py, test/gi/makefile, test/lexTests.py, test/simpleTests.py, test/unit/Sci.natvis, test/unit/UnitTester.cxx, test/unit/UnitTester.vcxproj, test/unit/makefile, test/unit/test.mak, test/unit/testCellBuffer.cxx, test/unit/testContractionState.cxx, test/unit/testDecoration.cxx, test/unit/testPartitioning.cxx, test/unit/testRunStyles.cxx, test/unit/testSparseState.cxx, test/unit/testSparseVector.cxx, test/unit/testSplitVector.cxx, test/unit/testWordList.cxx, version.txt, win32/HanjaDic.cxx, win32/HanjaDic.h, win32/PlatWin.cxx, win32/SciLexer.vcxproj, win32/ScintRes.rc, win32/ScintillaWin.cxx, win32/deps.mak, win32/makefile, win32/scintilla.mak: Initial merge of Scintilla v3.7.2. [abbfc844caaa] * lib/LICENSE.commercial.short, lib/LICENSE.gpl, lib/LICENSE.gpl.short: Updated the copyright notices. [10d2ba70b9d0] * Makefile, build.py: Merged the v2.9 maintenance branch. [8c0c0a19a3c8] 2016-12-25 Phil Thompson * .hgtags: Added tag 2.9.4 for changeset 06e486532f86 [a0e7ce41b57a] <2.9-maint> * NEWS: Released as v2.9.4. [06e486532f86] [2.9.4] <2.9-maint> 2016-12-24 Phil Thompson * qsci/api/python/Python-3.6.api: Added the .api file for Python v3.6. [4af5841ab5d2] <2.9-maint> 2016-11-07 Phil Thompson * qt/qsciscintillabase.cpp: Updated a comment to explain why setting custom scrollbars doesn't work. [757ca3bbc419] <2.9-maint> 2016-10-25 Phil Thompson * Python/configure.py: Fixed configure.py for Python v2. [6d784269a812] <2.9-maint> 2016-10-23 Phil Thompson * Python/sip/qscimod4.sip, Python/sip/qscimod5.sip: Explicitly %Import the QtCore module so that it is imported in the .pyi file. [fec61f546e2b] <2.9-maint> 2016-09-26 Phil Thompson * lib/README.doc: Removed some (possibly out of date) information about installation on macOS. [c793591a8192] <2.9-maint> * qt/InputMethod.cpp: Disable the hack for handling null input method method events on Windows as there are reports that this breaks character composition. [42977285ae81] <2.9-maint> 2016-09-25 Phil Thompson * qt/qsciscintilla.cpp: Fixed a Qt warning about a too large red value in a QColor. [f9af82c24301] <2.9-maint> 2016-09-23 Phil Thompson * rb-product: Added the minimum PyQt5 wheel version to the product file. [11d2fb4dc51a] <2.9-maint> 2016-09-10 Phil Thompson * Python/configure.py, rb-product: Updated the handling of the minimum SIP version. [1e50ffa9dac1] <2.9-maint> 2016-09-09 Phil Thompson * Python/sip/qscimod5.sip: The limited API is now used for the Python bindings. [a2b8118a4483] <2.9-maint> 2016-08-08 Phil Thompson * Makefile, build.py: Removed the old internal build system. [522e8b386eef] <2.9-maint> 2016-07-25 Phil Thompson * METADATA.in: Removed the Obsoletes tag from METADATA. [fbf9aa05d0b4] <2.9-maint> * .hgtags: Added tag 2.9.3 for changeset 19c9752958b7 [fb5cd006685f] <2.9-maint> * NEWS: Released as v2.9.3. [19c9752958b7] [2.9.3] <2.9-maint> 2016-07-19 Phil Thompson * METADATA.in: Updated METADATA. [aa51b27d9baf] <2.9-maint> 2016-06-21 Phil Thompson * build.py, lib/qscintilla.dxy: Simplify the generation of the doxygen documentation. [12575460cd55] <2.9-maint> * rb-product, rbproduct.py: Replaced the product plugin with a product file. [846ad54d791e] <2.9-maint> 2016-06-10 Phil Thompson * qt/ScintillaQt.cpp, qt/qscintilla.pro: Fixed a flicker problem on OS X. [c1482a759dc0] <2.9-maint> 2016-05-12 Phil Thompson * METADATA.in, rbproduct.py: Try to prevent the GPL and commercial versions being installed at the same time. (Although it doesn't seem to work.) [826424d291a2] <2.9-maint> * METADATA.in, rbproduct.py: Configure the PKG-INFO meta-data according to the license. [e3243207aa15] <2.9-maint> 2016-05-10 Phil Thompson * rbproduct.py: More changes to the product plugin required by rbtools. [437e6032e4df] <2.9-maint> 2016-05-09 Phil Thompson * rbproduct.py: Updated the product plugin for the latest rbtools changes. [393cae59af91] <2.9-maint> 2016-04-22 Phil Thompson * METADATA.in: Updated the meta-data now that Linux wheels are available from PyPI. [40f18e066c6f] <2.9-maint> 2016-04-18 Phil Thompson * .hgtags: Added tag 2.9.2 for changeset 15888f3e91ce [5cd132938309] <2.9-maint> * NEWS: Released as v2.9.2. [15888f3e91ce] [2.9.2] <2.9-maint> * Python/sip/qsciscintillabase.sip: Remove all deprecated /DocType/ annotations. [b9d570ab642a] <2.9-maint> 2016-04-17 Phil Thompson * rbproduct.py: Locate the static library on Windows. [dd8c14dace83] <2.9-maint> * rbproduct.py: Fixed a typo. [baf5c942f528] <2.9-maint> * rbproduct.py: Add any pre-installed .api files to the wheel. [cf7b6302ae83] <2.9-maint> * rbproduct.py: Exploit verbose mode in the product plugin. [da743c037880] <2.9-maint> * rbproduct.py: Fixed permissions of the product plugin. [6fac075e0b88] <2.9-maint> 2016-04-16 Phil Thompson * Makefile: Updated the clean target. [692b14f48ade] <2.9-maint> * rbproduct.py: The wheel now includes translations and API files. [bf911094e537] <2.9-maint> * METADATA.in, Makefile, Python/configure.py, build.py, rbproduct.py: Added the initial support for creating wheels. [da0a5d22e864] <2.9-maint> * Makefile, build.py: Added the --omit-license-tag option to build.py. Added the dist- wheel-gpl target to the master Makefile. [a63c245de735] <2.9-maint> 2016-04-15 Phil Thompson * Python/configure-old.py, Python/configure.py, build.py, qt/features/qscintilla2.prf, qt/features_staticlib/qscintilla2.prf, qt/qsciglobal.h, qt/qscintilla.pro: Symbols are now hidden if possible on all platforms. Improved the handling of QSCINTILLA_DLL so it should be completely automatic. Removed the --no-dll option to configure.py. [e35caca29dd6] <2.9-maint> 2016-03-25 Phil Thompson * Python/configure-old.py, build.py: Use the new naming standards for development versions. [21d2f882320a] <2.9-maint> 2016-03-14 Phil Thompson * Python/configure.py, build.py: The configure.py boilerplate code is applied automatically. [848f3fca41c0] <2.9-maint> 2016-03-13 Phil Thompson * Python/configure.py: Updated the configure.py boilerplate. [b3fd404a1134] <2.9-maint> 2016-03-07 Phil Thompson * Python/configure.py: Added support for PEP 484 stub files to configure.py. [9316fed27503] <2.9-maint> 2015-12-15 Phil Thompson * Makefile: Switched the internal build system to Python v3.5. [5215e7f3116e] <2.9-maint> 2015-10-28 Phil Thompson * Python/configure.py: Handle PATH components that are enclosed in quotes. [d0f19b69ce26] <2.9-maint> 2015-10-24 Phil Thompson * .hgtags: Added tag 2.9.1 for changeset 9bd39be91ef8 [c71bd22d6ccf] <2.9-maint> * NEWS: Released as v2.9.1. [9bd39be91ef8] [2.9.1] <2.9-maint> 2015-10-17 Phil Thompson * qt/qsciscintilla.cpp: Fixed the handling of the keypad modifier. [e363cc2c347f] <2.9-maint> 2015-09-18 Phil Thompson * qsci/api/python/Python-3.5.api: Added the .api file for Python v3.5. [5b4e58de4663] <2.9-maint> 2015-09-10 Phil Thompson * Python/sip/qsciabstractapis.sip, Python/sip/qsciapis.sip: Fixed the Python binding for QsciAbstractAPIs::updateAutoCompletionList(). [53f2939a3b29] <2.9-maint> 2015-09-08 Phil Thompson * Python/configure.py: Use win32-msvc2015 for Python v3.5 and later. [2f264662e2c7] <2.9-maint> 2015-09-01 Phil Thompson * qt/qsciscintilla.cpp: Fixed the restyling of a document displayed in multiple editors. [9309f264ab57] <2.9-maint> 2015-08-24 Phil Thompson * qt/qscintilla.pro, qt/qsciscintilla.cpp: Fixed a problem starting a call tip when the auto-completion list is displayed. Bumped the library version. [2ec2115ea4d2] <2.9-maint> 2015-07-12 Phil Thompson * designer-Qt4Qt5/qscintillaplugin.h: Fixed a warning message when compiling against Qt v5.5.0. [3ff05a0ef88d] <2.9-maint> 2015-07-09 Phil Thompson * Python/configure.py: Update QMAKE_RPATHDIR rather than set it. [045c64a7e65c] <2.9-maint> 2015-06-24 Phil Thompson * Python/configure.py: Set QMAKE_RPATHDIR for Qt v5.5 on OS X. [b83394e4a676] <2.9-maint> 2015-05-26 Phil Thompson * Python/configure.py: Fixed the backstop handling in the Python bindings configuration script and bumped the version number. [1ab1dd7ea495] <2.9-maint> 2015-05-02 Phil Thompson * qt/qscintilla.pro: Use QT_HOST_DATA for the .prf destination with Qt v5. Removed all Qt v3 support from the .pro file. [63c0391624a8] <2.9-maint> 2015-04-20 Phil Thompson * .hgtags: Added tag 2.9 for changeset 41ee8162fa81 [9817b0a7a4f7] * 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] 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] sqlitebrowser-3.10.1/libs/qscintilla/LICENSE000066400000000000000000001045131316047212700206110ustar00rootroot00000000000000 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 . sqlitebrowser-3.10.1/libs/qscintilla/NEWS000066400000000000000000000546661316047212700203200ustar00rootroot00000000000000v2.10 20th February 2017 - Based on Scintilla v3.7.2. - Added the QsciLexerJSON class. - Added the QsciLexerMarkdown class. - Added replaceHorizontalScrollBar() and replaceVerticalScrollBar() to QsciScintillaBase. - Added bytes() and a corresponding text() overload to QsciScintilla. - Added EdgeMultipleLines to QsciScintilla::EdgeMode. - Added addEdgeColumn() and clearEdgeColumns() to QsciScintilla. - Added the marginRightClicked() signal to QsciScintilla. - Added SymbolMarginColor to QsciScintilla::MarginType. - Added setMarginBackgroundColor() and marginBackgroundColor() to QsciScintilla. - Added setMargins() and margins() to QsciScintilla. - Added TriangleIndicator and TriangleCharacterIndicator to QsciScintilla::IndicatorStyle. - Added WsVisibleOnlyInIndent to QsciScintilla::WhitespaceVisibility. - Added TabDrawMode, setTabDrawMode() and tabDrawMode() to QsciScintilla. - Added InstanceProperty to QsciLexerCoffeeScript. - Added EDGE_MULTILINE to QsciScintillaBase. - Added INDIC_POINT and INDIC_POINTCHARACTER to QsciScintillaBase. - Added SC_AC_FILLUP, SC_AC_DOUBLECLICK, SC_AC_TAB, SC_AC_NEWLINE and SC_AC_COMMAND to QsciScintillaBase. - Added SC_CASE_CAMEL to QsciScintillaBase. - Added SC_CHARSET_CYRILLIC and SC_CHARSET_OEM866 to QsciScintillaBase. - Added SC_FOLDDISPLAYTEXT_HIDDEN, SC_FOLDDISPLAYTEXT_STANDARD and SC_FOLDDISPLAYTEXT_BOXED to QsciScintillaBase. - Added SC_IDLESTYLING_NONE, SC_IDLESTYLING_TOVISIBLE, SC_IDLESTYLING_AFTERVISIBLE and SC_IDLESTYLING_ALL to QsciScintillaBase. - Added SC_MARGIN_COLOUR to QsciScintillaBase. - Added SC_POPUP_NEVER, SC_POPUP_ALL and SC_POPUP_TEXT to QsciScintillaBase. - Added SCI_FOLDDISPLAYTEXTSETSTYLE and SCI_TOGGLEFOLDSHOWTEXT to QsciScintillaBase. - Added SCI_GETIDLESTYLING and SCI_SETIDLESTYLING to QsciScintillaBase. - Added SCI_GETMARGINBACKN and SCI_SETMARGINBACKN to QsciScintillaBase. - Added SCI_GETMARGINS and SCI_SETMARGINS to QsciScintillaBase. - Added SCI_GETMOUSEWHEELCAPTURES and SCI_SETMOUSEWHEELCAPTURES to QsciScintillaBase. - Added SCI_GETTABDRAWMODE and SCI_SETTABDRAWMODE to QsciScintillaBase. - Added SCI_ISRANGEWORD to QsciScintillaBase. - Added SCI_MULTIEDGEADDLINE and SCI_MULTIEDGECLEARALL to QsciScintillaBase. - Added SCI_MULTIPLESELECTADDNEXT and SCI_MULTIPLESELECTADDEACH to QsciScintillaBase. - Added SCI_TARGETWHOLEDOCUMENT to QsciScintillaBase. - Added SCLEX_JSON and SCLEX_EDIFACT to QsciScintillaBase. - Added SCTD_LONGARROW and SCTD_STRIKEOUT to QsciScintillaBase. - Added SCVS_NOWRAPLINESTART to QsciScintillaBase. - Added SCWS_VISIBLEONLYININDENT to QsciScintillaBase. - Added STYLE_FOLDDISPLAYTEXT to QsciScintillaBase. - Added the SCN_AUTOCCOMPLETED() signal to QsciScintillaBase. - Added the overloaded SCN_AUTOCSELECTION() and SCN_USERLISTSELECTION() signals to QsciScintillaBase. - Added the SCN_MARGINRIGHTCLICK() signal to QsciScintillaBase. - Renamed SCI_GETTARGETRANGE to SCI_GETTARGETTEXT in QsciScintillaBase. - Removed SCI_GETKEYSUNICODE and SCI_SETKEYSUNICODE to QsciScintillaBase. - The autoCompletionFillups(), autoCompletionWordSeparators(), blockEnd(), blockLookback(), blockStart(), blockStartKeyword(), braceStyle(), caseSensitive(), indentationGuideView() and defaultStyle() methods of QsciLexer are no longer marked as internal and are exposed to Python so that they may be used by QsciLexerCustom sub-classes. - The name of the library has been changed to include the major version number of the version of Qt it is built against (ie. 4 or 5). v2.9.4 25th December 2016 - Added the .api file for Python v3.6. - Bug fixes. v2.9.3 25th July 2016 - Bug fixes. v2.9.2 18th April 2016 - Added support for a PEP 484 stub file for the Python extension module. v2.9.1 24th October 2015 - Added the .api file for Python v3.5. - Bug fixes. 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. sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/000077500000000000000000000000001316047212700206425ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/CMakeLists.txt000066400000000000000000000065271316047212700234140ustar00rootroot00000000000000cmake_minimum_required(VERSION 2.8.7) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) find_package(Qt5Widgets REQUIRED) if(APPLE) find_package(Qt5MacExtras) 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 qscilexercustom.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 ./Qsci/qsciglobal.h ./Qsci/qscicommand.h ./Qsci/qscicommandset.h ./Qsci/qscidocument.h ./Qsci/qsciprinter.h ./Qsci/qscistyle.h ./Qsci/qscistyledtext.h ListBoxQt.h SciNamespace.h ../include/ILexer.h ../include/Platform.h ../include/SciLexer.h ../include/Scintilla.h ../include/ScintillaWidget.h ../include/Sci_Position.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 ../src/Position.h ../src/SparseVector.h ) set(QSCINTILLA_MOC_HDR ./Qsci/qsciscintilla.h ./Qsci/qsciscintillabase.h ./Qsci/qsciabstractapis.h ./Qsci/qsciapis.h ./Qsci/qscilexer.h ./Qsci/qscilexercustom.h ./Qsci/qscilexersql.h ./Qsci/qscimacro.h SciClasses.h ScintillaQt.h ) include_directories(. ../include ../lexlib ../src) add_library(qscintilla2 ${QSCINTILLA_SRC} ${QSCINTILLA_HDR} ${QSCINTILLA_MOC_HDR} ${QSCINTILLA_MOC}) if (APPLE) qt5_use_modules(qscintilla2 Widgets PrintSupport MacExtras) else() qt5_use_modules(qscintilla2 Widgets PrintSupport) endif() sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/InputMethod.cpp000066400000000000000000000235511316047212700236140ustar00rootroot00000000000000// Copyright (c) 2017 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 #include #include #include #include #include #include #include #include "SciNamespace.h" #include "Qsci/qsciscintillabase.h" #include "ScintillaQt.h" #define INDIC_INPUTMETHOD 24 #define MAXLENINPUTIME 200 #define SC_INDICATOR_INPUT INDIC_IME #define SC_INDICATOR_TARGET INDIC_IME+1 #define SC_INDICATOR_CONVERTED INDIC_IME+2 #define SC_INDICATOR_UNKNOWN INDIC_IME_MAX static bool IsHangul(const QChar qchar) { int unicode = (int)qchar.unicode(); // Korean character ranges used for preedit chars. // http://www.programminginkorean.com/programming/hangul-in-unicode/ const bool HangulJamo = (0x1100 <= unicode && unicode <= 0x11FF); const bool HangulCompatibleJamo = (0x3130 <= unicode && unicode <= 0x318F); const bool HangulJamoExtendedA = (0xA960 <= unicode && unicode <= 0xA97F); const bool HangulJamoExtendedB = (0xD7B0 <= unicode && unicode <= 0xD7FF); const bool HangulSyllable = (0xAC00 <= unicode && unicode <= 0xD7A3); return HangulJamo || HangulCompatibleJamo || HangulSyllable || HangulJamoExtendedA || HangulJamoExtendedB; } static void MoveImeCarets(QsciScintillaQt *sqt, int offset) { // Move carets relatively by bytes for (size_t r=0; r < sqt->sel.Count(); r++) { int positionInsert = sqt->sel.Range(r).Start().Position(); sqt->sel.Range(r).caret.SetPosition(positionInsert + offset); sqt->sel.Range(r).anchor.SetPosition(positionInsert + offset); } } static void DrawImeIndicator(QsciScintillaQt *sqt, int indicator, int len) { // Emulate the visual style of IME characters with indicators. // Draw an indicator on the character before caret by the character bytes of len // so it should be called after AddCharUTF(). // It does not affect caret positions. if (indicator < 8 || indicator > INDIC_MAX) { return; } sqt->pdoc->decorations.SetCurrentIndicator(indicator); for (size_t r=0; r< sqt-> sel.Count(); r++) { int positionInsert = sqt->sel.Range(r).Start().Position(); sqt->pdoc->DecorationFillRange(positionInsert - len, 1, len); } } static int GetImeCaretPos(QInputMethodEvent *event) { foreach (QInputMethodEvent::Attribute attr, event->attributes()) { if (attr.type == QInputMethodEvent::Cursor) return attr.start; } return 0; } static std::vector MapImeIndicators(QInputMethodEvent *event) { std::vector imeIndicator(event->preeditString().size(), SC_INDICATOR_UNKNOWN); foreach (QInputMethodEvent::Attribute attr, event->attributes()) { if (attr.type == QInputMethodEvent::TextFormat) { QTextFormat format = attr.value.value(); QTextCharFormat charFormat = format.toCharFormat(); int indicator = SC_INDICATOR_UNKNOWN; switch (charFormat.underlineStyle()) { case QTextCharFormat::NoUnderline: // win32, linux indicator = SC_INDICATOR_TARGET; break; case QTextCharFormat::SingleUnderline: // osx case QTextCharFormat::DashUnderline: // win32, linux indicator = SC_INDICATOR_INPUT; break; case QTextCharFormat::DotLine: case QTextCharFormat::DashDotLine: case QTextCharFormat::WaveUnderline: case QTextCharFormat::SpellCheckUnderline: indicator = SC_INDICATOR_CONVERTED; break; default: indicator = SC_INDICATOR_UNKNOWN; } if (format.hasProperty(QTextFormat::BackgroundBrush)) // win32, linux indicator = SC_INDICATOR_TARGET; #ifdef Q_OS_OSX if (charFormat.underlineStyle() == QTextCharFormat::SingleUnderline) { QColor uc = charFormat.underlineColor(); if (uc.lightness() < 2) { // osx indicator = SC_INDICATOR_TARGET; } } #endif for (int i = attr.start; i < attr.start+attr.length; i++) { imeIndicator[i] = indicator; } } } return imeIndicator; } void QsciScintillaBase::inputMethodEvent(QInputMethodEvent *event) { // Copy & paste by johnsonj with a lot of helps of Neil // Great thanks for my forerunners, jiniya and BLUEnLIVE if (sci->pdoc->IsReadOnly() || sci->SelectionContainsProtected()) { // Here, a canceling and/or completing composition function is needed. return; } if (sci->pdoc->TentativeActive()) { sci->pdoc->TentativeUndo(); } else { // No tentative undo means start of this composition so // Fill in any virtual spaces. sci->ClearBeforeTentativeStart(); } sci->view.imeCaretBlockOverride = false; if (!event->commitString().isEmpty()) { const QString commitStr = event->commitString(); const unsigned int commitStrLen = commitStr.length(); for (unsigned int i = 0; i < commitStrLen;) { const unsigned int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1; const QString oneCharUTF16 = commitStr.mid(i, ucWidth); const QByteArray oneChar = textAsBytes(oneCharUTF16); const int oneCharLen = oneChar.length(); sci->AddCharUTF(oneChar.data(), oneCharLen); i += ucWidth; } } else if (!event->preeditString().isEmpty()) { const QString preeditStr = event->preeditString(); const unsigned int preeditStrLen = preeditStr.length(); if ((preeditStrLen == 0) || (preeditStrLen > MAXLENINPUTIME)) { sci->ShowCaretAtCurrentPosition(); return; } sci->pdoc->TentativeStart(); // TentativeActive() from now on. std::vector imeIndicator = MapImeIndicators(event); const bool recording = sci->recordingMacro; sci->recordingMacro = false; for (unsigned int i = 0; i < preeditStrLen;) { const unsigned int ucWidth = preeditStr.at(i).isHighSurrogate() ? 2 : 1; const QString oneCharUTF16 = preeditStr.mid(i, ucWidth); const QByteArray oneChar = textAsBytes(oneCharUTF16); const int oneCharLen = oneChar.length(); sci->AddCharUTF(oneChar.data(), oneCharLen); DrawImeIndicator(sci, imeIndicator[i], oneCharLen); i += ucWidth; } sci->recordingMacro = recording; // Move IME carets. int imeCaretPos = GetImeCaretPos(event); int imeEndToImeCaretU16 = imeCaretPos - preeditStrLen; int imeCaretPosDoc = sci->pdoc->GetRelativePositionUTF16(sci->CurrentPosition(), imeEndToImeCaretU16); MoveImeCarets(sci, - sci->CurrentPosition() + imeCaretPosDoc); if (IsHangul(preeditStr.at(0))) { #ifndef Q_OS_WIN if (imeCaretPos > 0) { int oneCharBefore = sci->pdoc->GetRelativePosition(sci->CurrentPosition(), -1); MoveImeCarets(sci, - sci->CurrentPosition() + oneCharBefore); } #endif sci->view.imeCaretBlockOverride = true; } // Set candidate box position for Qt::ImMicroFocus. preeditPos = sci->CurrentPosition(); sci->EnsureCaretVisible(); updateMicroFocus(); } sci->ShowCaretAtCurrentPosition(); } 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; QSCI_SCI_NAMESPACE(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(); } } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/ListBoxQt.cpp000066400000000000000000000145551316047212700232510ustar00rootroot00000000000000// This module implements the specialisation of QListBox that handles the // Scintilla double-click callback. // // Copyright (c) 2017 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(); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/ListBoxQt.h000066400000000000000000000051761316047212700227150ustar00rootroot00000000000000// This defines the specialisation of QListBox that handles the Scintilla // double-click callback. // // Copyright (c) 2017 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; }; sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/MacPasteboardMime.cpp000066400000000000000000000055721316047212700246740ustar00rootroot00000000000000// 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) 2017 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/PlatQt.cpp000066400000000000000000000606101316047212700225560ustar00rootroot00000000000000// This module implements the portability layer for the Qt port of Scintilla. // // Copyright (c) 2017 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/000077500000000000000000000000001316047212700215415ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qsciabstractapis.h000066400000000000000000000070531316047212700252570ustar00rootroot00000000000000// This module defines interface to the QsciAbstractAPIs class. // // Copyright (c) 2017 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 #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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qsciapis.h000066400000000000000000000201561316047212700235320ustar00rootroot00000000000000// This module defines interface to the QsciAPIs class. // // Copyright (c) 2017 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 #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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscicommand.h000066400000000000000000000346771316047212700242310ustar00rootroot00000000000000// This defines the interface to the QsciCommand class. // // Copyright (c) 2017 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 #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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscicommandset.h000066400000000000000000000053731316047212700247340ustar00rootroot00000000000000// This defines the interface to the QsciCommandSet class. // // Copyright (c) 2017 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 #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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscidocument.h000066400000000000000000000035551316047212700244200ustar00rootroot00000000000000// This defines the interface to the QsciDocument class. // // Copyright (c) 2017 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 #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; }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qsciglobal.h000066400000000000000000000030761316047212700240400ustar00rootroot00000000000000// This module defines various things common to all of the Scintilla Qt port. // // Copyright (c) 2017 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 #include #define QSCINTILLA_VERSION 0x020a00 #define QSCINTILLA_VERSION_STR "2.10" // Define QSCINTILLA_MAKE_DLL to create a QScintilla shared library, or // define QSCINTILLA_DLL to link against a QScintilla shared library, or define // neither to either build or link against a static QScintilla library. #if defined(QSCINTILLA_DLL) #define QSCINTILLA_EXPORT Q_DECL_IMPORT #elif defined(QSCINTILLA_MAKE_DLL) #define QSCINTILLA_EXPORT Q_DECL_EXPORT #else #define QSCINTILLA_EXPORT #endif #if !defined(QT_BEGIN_NAMESPACE) #define QT_BEGIN_NAMESPACE #define QT_END_NAMESPACE #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscilexer.h000066400000000000000000000312541316047212700237160ustar00rootroot00000000000000// This defines the interface to the QsciLexer class. // // Copyright (c) 2017 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 #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; //! Returns the characters that can fill up auto-completion. virtual const char *autoCompletionFillups() const; //! 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(); //! 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; //! Returns the number of lines prior to the current one when determining //! the scope of a block when auto-indenting. virtual int blockLookback() const; //! 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; //! 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; //! Returns the style used for braces for brace matching. virtual int braceStyle() const; //! 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; //! 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; //! 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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscilexercustom.h000066400000000000000000000071071316047212700251510ustar00rootroot00000000000000// This defines the interface to the QsciLexerCustom class. // // Copyright (c) 2017 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 QSCILEXERCUSTOM_H #define QSCILEXERCUSTOM_H #include #include class QsciScintilla; class QsciStyle; //! \brief The QsciLexerCustom class is an abstract class used as a base for //! new language lexers. //! //! The advantage of implementing a new lexer this way (as opposed to adding //! the lexer to the underlying Scintilla code) is that it does not require the //! QScintilla library to be re-compiled. It also makes it possible to //! integrate external lexers. //! //! All that is necessary to implement a new lexer is to define appropriate //! styles and to re-implement the styleText() method. class QSCINTILLA_EXPORT QsciLexerCustom : public QsciLexer { Q_OBJECT public: //! Construct a QsciLexerCustom with parent \a parent. \a parent is //! typically the QsciScintilla instance. QsciLexerCustom(QObject *parent = 0); //! Destroy the QSciLexerCustom. virtual ~QsciLexerCustom(); //! The next \a length characters starting from the current styling //! position have their style set to style number \a style. The current //! styling position is moved. The styling position is initially set by //! calling startStyling(). //! //! \sa startStyling(), styleText() void setStyling(int length, int style); //! The next \a length characters starting from the current styling //! position have their style set to style \a style. The current styling //! position is moved. The styling position is initially set by calling //! startStyling(). //! //! \sa startStyling(), styleText() void setStyling(int length, const QsciStyle &style); //! The styling position is set to \a start. \a styleBits is unused. //! //! \sa setStyling(), styleBitsNeeded(), styleText() void startStyling(int pos, int styleBits = 0); //! This is called when the section of text beginning at position \a start //! and up to position \a end needs to be styled. \a start will always be //! at the start of a line. The text is styled by calling startStyling() //! followed by one or more calls to setStyling(). It must be //! re-implemented by a sub-class. //! //! \sa setStyling(), startStyling(), QsciScintilla::bytes(), //! QsciScintilla::text() virtual void styleText(int start, int end) = 0; //! \reimp virtual void setEditor(QsciScintilla *editor); //! \reimp This re-implementation returns 5 as the number of style bits //! needed. virtual int styleBitsNeeded() const; private slots: void handleStyleNeeded(int pos); private: QsciLexerCustom(const QsciLexerCustom &); QsciLexerCustom &operator=(const QsciLexerCustom &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscilexersql.h000066400000000000000000000212751316047212700244400ustar00rootroot00000000000000// This defines the interface to the QsciLexerSQL class. // // Copyright (c) 2017 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 #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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscimacro.h000066400000000000000000000053421316047212700236770ustar00rootroot00000000000000// This defines the interface to the QsciMacro class. // // Copyright (c) 2017 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 #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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qsciprinter.h000066400000000000000000000075331316047212700242650ustar00rootroot00000000000000// This module defines interface to the QsciPrinter class. // // Copyright (c) 2017 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 // 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 #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h000066400000000000000000002436511316047212700245670ustar00rootroot00000000000000// This module defines the "official" high-level API of the Qt port of // Scintilla. // // Copyright (c) 2017 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 #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, //! Multiple vertical lines are drawn at the columns defined by //! multiple calls to addEdgeColumn(). EdgeMultipleLines = EDGE_MULTILINE, }; //! 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, //! A triangle below the start of the indicator range. TriangleIndicator = INDIC_POINT, //! A triangle below the centre of the first character in the indicator //! range. TriangleCharacterIndicator = INDIC_POINTCHARACTER, }; //! 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, //! The margin contains symbols and uses the color set by //! setMarginBackgroundColor() as its background color. SymbolMarginColor = SC_MARGIN_COLOUR, }; //! 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 how tab characters are drawn when whitespace is //! visible. enum TabDrawMode { //! An arrow stretching to the tab stop. TabLongArrow = SCTD_LONGARROW, //! A horizontal line stretching to the tab stop. TabStrikeOut = SCTD_STRIKEOUT, }; //! 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, //! Whitespace used for indentation is visible. WsVisibleOnlyInIndent = SCWS_VISIBLEONLYININDENT, }; //! 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 encoded text between positions \a start and \a end. This //! is typically used by QsciLexerCustom::styleText(). //! //! \sa text() QByteArray bytes(int start, int end) const; //! 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 the background color of margin \a margin. //! //! \sa setMarginBackgroundColor() QColor marginBackgroundColor(int margin) 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; //! Returns the number of margins. //! //! \sa setMargins() int margins() 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); //! Add \a colnr to the columns which are displayed with a vertical line. //! The edge mode must be set to EdgeMultipleLines. //! //! \sa clearEdgeColumns() void addEdgeColumn(int colnr, const QColor &col); //! Remove any columns added by previous calls to addEdgeColumn(). //! //! \sa addEdgeColumn() void clearEdgeColumns(); //! 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); //! Sets the background color of margin \a margin to \a col. //! //! \sa marginBackgroundColor() void setMarginBackgroundColor(int margin, const QColor &col); //! 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 number of margins to \a margins. //! //! \sa margins() void setMargins(int margins); //! 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(); //! Sets the mode used to draw tab characters when whitespace is visible to //! \a mode. The default is to use an arrow. //! //! \sa tabDrawMode() void setTabDrawMode(TabDrawMode mode); //! 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 the mode used to draw tab characters when whitespace is //! visible. //! //! \sa setTabDrawMode() TabDrawMode tabDrawMode() const; //! 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; //! \overload //! //! Returns the text between positions \a start and \a end. This is //! typically used by QsciLexerCustom::styleText(). //! //! \sa bytes(), setText() QString text(int start, int end) 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 right-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 marginRightClicked(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 handleMarginRightClick(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 &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qsciscintillabase.h000066400000000000000000002477141316047212700254260ustar00rootroot00000000000000// This class defines the "official" low-level API. // // Copyright (c) 2017 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 #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_SETMARGINBACKN = 2250, //! SCI_GETMARGINBACKN = 2251, //! SCI_SETMARGINS = 2252, //! SCI_GETMARGINS = 2253, //! 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_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_GETTARGETTEXT = 2687, //! SCI_MULTIPLESELECTADDNEXT = 2688, //! SCI_MULTIPLESELECTADDEACH = 2689, //! SCI_TARGETWHOLEDOCUMENT = 2690, //! SCI_ISRANGEWORD = 2691, //! SCI_SETIDLESTYLING = 2692, //! SCI_GETIDLESTYLING = 2693, //! SCI_MULTIEDGEADDLINE = 2694, //! SCI_MULTIEDGECLEARALL = 2695, //! SCI_SETMOUSEWHEELCAPTURES = 2696, //! SCI_GETMOUSEWHEELCAPTURES = 2697, //! SCI_GETTABDRAWMODE = 2698, //! SCI_SETTABDRAWMODE = 2699, //! SCI_TOGGLEFOLDSHOWTEXT = 2700, //! SCI_FOLDDISPLAYTEXTSETSTYLE = 2701, //! 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_AC_FILLUP = 1, SC_AC_DOUBLECLICK = 2, SC_AC_TAB = 3, SC_AC_NEWLINE = 4, SC_AC_COMMAND = 5, }; 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_IDLESTYLING_NONE = 0, SC_IDLESTYLING_TOVISIBLE = 1, SC_IDLESTYLING_AFTERVISIBLE = 2, SC_IDLESTYLING_ALL = 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 }; enum { SC_POPUP_NEVER = 0, SC_POPUP_ALL = 1, SC_POPUP_TEXT = 2, }; //! 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 { SCTD_LONGARROW = 0, SCTD_STRIKEOUT = 1, }; enum { SCVS_NONE = 0, SCVS_RECTANGULARSELECTION = 1, SCVS_USERACCESSIBLE = 2, SCVS_NOWRAPLINESTART = 4, }; enum { SCWS_INVISIBLE = 0, SCWS_VISIBLEALWAYS = 1, SCWS_VISIBLEAFTERINDENT = 2, SCWS_VISIBLEONLYININDENT = 3, }; 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, //! The margin's background color will be set to the color set by //! SCI_SETMARGINBACKN. SC_MARGIN_COLOUR = 6, }; enum { STYLE_DEFAULT = 32, STYLE_LINENUMBER = 33, STYLE_BRACELIGHT = 34, STYLE_BRACEBAD = 35, STYLE_CONTROLCHAR = 36, STYLE_INDENTGUIDE = 37, STYLE_CALLTIP = 38, STYLE_FOLDDISPLAYTEXT = 39, 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_OEM866 = 866, SC_CHARSET_CYRILLIC = 1251, 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, SC_CASE_CAMEL = 3, }; //! 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_POINT = 18, INDIC_POINTCHARACTER = 19, 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_FOLDDISPLAYTEXT_HIDDEN = 0, SC_FOLDDISPLAYTEXT_STANDARD = 1, SC_FOLDDISPLAYTEXT_BOXED = 2, }; 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, EDGE_MULTILINE = 3, }; 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, //! Select the JSON hex lexer. SCLEX_JSON = 120, //! Select the EDIFACT lexer. SCLEX_EDIFACT = 121, }; 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(); //! Replaces the existing horizontal scroll bar with \a scrollBar. The //! existing scroll bar is deleted. This should be called instead of //! QAbstractScrollArea::setHorizontalScrollBar(). void replaceHorizontalScrollBar(QScrollBar *scrollBar); //! Replaces the existing vertical scroll bar with \a scrollBar. The //! existing scroll bar is deleted. This should be called instead of //! QAbstractScrollArea::setHorizontalScrollBar(). void replaceVerticalScrollBar(QScrollBar *scrollBar); //! 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 after an auto-completion has inserted its text. //! \a selection is the text of the selection. //! \a position is the start position of the word being completed. //! \a ch is the fillup character that triggered the selection if method is //! SC_AC_FILLUP. //! \a method is the method used to trigger the selection. //! //! \sa SCN_AUTOCCANCELLED(), SCN_AUTOCSELECTION void SCN_AUTOCCOMPLETED(const char *selection, int position, int ch, int method); //! 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. //! \a ch is the fillup character that triggered the selection if method is //! SC_AC_FILLUP. //! \a method is the method used to trigger the selection. //! //! \sa SCN_AUTOCCANCELLED(), SCN_AUTOCCOMPLETED void SCN_AUTOCSELECTION(const char *selection, int position, int ch, int method); //! \overload 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); //! This signal is emitted when the user right-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_MARGINRIGHTCLICK(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, int, int); //! \overload 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 connectHorizontalScrollBar(); void connectVerticalScrollBar(); void acceptAction(QDropEvent *e); QsciScintillaBase(const QsciScintillaBase &); QsciScintillaBase &operator=(const QsciScintillaBase &); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscistyle.h000066400000000000000000000132221316047212700237320ustar00rootroot00000000000000// This module defines interface to the QsciStyle class. // // Copyright (c) 2017 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 #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); }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/Qsci/qscistyledtext.h000066400000000000000000000035521316047212700250100ustar00rootroot00000000000000// This module defines interface to the QsciStyledText class. // // Copyright (c) 2017 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 #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; }; #endif sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/SciClasses.cpp000066400000000000000000000122341316047212700234040ustar00rootroot00000000000000// The implementation of various Qt version independent classes used by the // rest of the port. // // Copyright (c) 2017 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); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/SciClasses.h000066400000000000000000000052521316047212700230530ustar00rootroot00000000000000// The definition of various Qt version independent classes used by the rest of // the port. // // Copyright (c) 2017 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/SciNamespace.h000066400000000000000000000024371316047212700233540ustar00rootroot00000000000000// Support for building the Scintilla code in the Scintilla namespace using the // -DSCI_NAMESPACE compiler flag. // // Copyright (c) 2017 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/ScintillaQt.cpp000066400000000000000000000431121316047212700235760ustar00rootroot00000000000000// The implementation of the Qt specific subclass of ScintillaBase. // // Copyright (c) 2017 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_AUTOCCOMPLETED #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_MARGINRIGHTCLICK #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_AUTOCCOMPLETED = 2030, 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_MARGINRIGHTCLICK = 2031, 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(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_AUTOCCOMPLETED: emit qsb->SCN_AUTOCCOMPLETED(scn.text, scn.lParam, scn.ch, scn.listCompletionMethod); break; case SCN_AUTOCSELECTION: emit qsb->SCN_AUTOCSELECTION(scn.text, scn.lParam, scn.ch, scn.listCompletionMethod); 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_MARGINRIGHTCLICK: emit qsb->SCN_MARGINRIGHTCLICK(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, scn.ch, scn.listCompletionMethod); 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; 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) rcClient = GetClientRectangle(); paintingAllText = rcPaint.Contains(rcClient); sw = QSCI_SCI_NAMESPACE(Surface)::Allocate(SC_TECHNOLOGY_DEFAULT); if (!sw) return; QPainter painter(qsb->viewport()); paintState = painting; 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) { // Do a full re-paint immediately. This may only be needed on OS X (to // avoid flicker). paintingAllText = true; sw = QSCI_SCI_NAMESPACE(Surface)::Allocate(SC_TECHNOLOGY_DEFAULT); if (!sw) return; QPainter painter(qsb->viewport()); paintState = painting; sw->Init(&painter); sw->SetUnicodeMode(CodePage() == SC_CP_UTF8); Paint(sw, rcPaint); delete sw; 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); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/ScintillaQt.h000066400000000000000000000101251316047212700232410ustar00rootroot00000000000000// The definition of the Qt specific subclass of ScintillaBase. // // Copyright (c) 2017 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(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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/features/000077500000000000000000000000001316047212700224605ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/features/qscintilla2.prf000066400000000000000000000011041316047212700254120ustar00rootroot00000000000000greaterThan(QT_MAJOR_VERSION, 4) { QT += widgets printsupport greaterThan(QT_MINOR_VERSION, 1) { macx:QT += macextras } } DEFINES += QSCINTILLA_DLL INCLUDEPATH += $$[QT_INSTALL_HEADERS] LIBS += -L$$[QT_INSTALL_LIBS] CONFIG(debug, debug|release) { mac: { LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}_debug } else { win32: { LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}d } else { LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION} } } } else { LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION} } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qsciabstractapis.cpp000066400000000000000000000025661316047212700247170ustar00rootroot00000000000000// This module implements the QsciAbstractAPIs class. // // Copyright (c) 2017 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) { } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qsciapis.cpp000066400000000000000000000605241316047212700231710ustar00rootroot00000000000000// This module implements the QsciAPIs class. // // Copyright (c) 2017 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 so // mark the unambiguous context as unknown. unambiguous_context = QString(); 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 (allowing for a possible image // identifier). QString noc = with_context[i]; if (unambig) { int op = noc.indexOf(QLatin1String(" (")); if (op >= 0) { int cl = noc.indexOf(QLatin1String(")")); if (cl > op) noc.remove(op, cl - op + 1); else 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, org; if (idx == 0) { api_word = api_words[0] + ' '; org = QString::fromLatin1(""); } else { QStringList orgl = api_words.mid(0, idx); org = orgl.join(wseps.first()); // Add the context (allowing for a possible image identifier). QString w = api_words[idx]; QString type; int type_idx = w.indexOf(QLatin1String("?")); if (type_idx >= 0) { type = w.mid(type_idx); w.truncate(type_idx); } api_word = QString("%1 (%2)%3").arg(w).arg(org).arg(type); } // If the origin is different to the context then the context is // ambiguous. if (unambig) { if (unambiguous_context.isNull()) { 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; } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscicommand.cpp000066400000000000000000000065021316047212700236470ustar00rootroot00000000000000// This module implements the QsciCommand class. // // Copyright (c) 2017 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); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscicommandset.cpp000066400000000000000000000655611316047212700243750ustar00rootroot00000000000000// This module implements the QsciCommandSet class. // // Copyright (c) 2017 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; } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscidocument.cpp000066400000000000000000000073211316047212700240470ustar00rootroot00000000000000// This module implements the QsciDocument class. // // Copyright (c) 2017 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; } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscilexer.cpp000066400000000000000000000407641316047212700233600ustar00rootroot00000000000000// This module implements the QsciLexer class. // // Copyright (c) 2017 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); } } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscilexercustom.cpp000066400000000000000000000051731316047212700246060ustar00rootroot00000000000000// This module implements the QsciLexerCustom class. // // Copyright (c) 2017 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/qscilexercustom.h" #include "Qsci/qsciscintilla.h" #include "Qsci/qsciscintillabase.h" #include "Qsci/qscistyle.h" // The ctor. QsciLexerCustom::QsciLexerCustom(QObject *parent) : QsciLexer(parent) { } // The dtor. QsciLexerCustom::~QsciLexerCustom() { } // Start styling. void QsciLexerCustom::startStyling(int start, int) { if (!editor()) return; editor()->SendScintilla(QsciScintillaBase::SCI_STARTSTYLING, start); } // Set the style for a number of characters. void QsciLexerCustom::setStyling(int length, int style) { if (!editor()) return; editor()->SendScintilla(QsciScintillaBase::SCI_SETSTYLING, length, style); } // Set the style for a number of characters. void QsciLexerCustom::setStyling(int length, const QsciStyle &style) { setStyling(length, style.style()); } // Set the attached editor. void QsciLexerCustom::setEditor(QsciScintilla *new_editor) { if (editor()) disconnect(editor(), SIGNAL(SCN_STYLENEEDED(int)), this, SLOT(handleStyleNeeded(int))); QsciLexer::setEditor(new_editor); if (editor()) connect(editor(), SIGNAL(SCN_STYLENEEDED(int)), this, SLOT(handleStyleNeeded(int))); } // Return the number of style bits needed by the lexer. int QsciLexerCustom::styleBitsNeeded() const { return 5; } // Handle a request to style some text. void QsciLexerCustom::handleStyleNeeded(int pos) { int start = editor()->SendScintilla(QsciScintillaBase::SCI_GETENDSTYLED); int line = editor()->SendScintilla(QsciScintillaBase::SCI_LINEFROMPOSITION, start); start = editor()->SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE, line); if (start != pos) styleText(start, pos); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscilexersql.cpp000066400000000000000000000326211316047212700240710ustar00rootroot00000000000000// This module implements the QsciLexerSQL class. // // Copyright (c) 2017 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")); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscimacro.cpp000066400000000000000000000163671316047212700233440ustar00rootroot00000000000000// This module implements the QsciMacro class. // // Copyright (c) 2017 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; } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla.pro000066400000000000000000000127121316047212700235320ustar00rootroot00000000000000# The project file for the QScintilla library. # # Copyright (c) 2017 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. # 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 = 13.0.0 TEMPLATE = lib TARGET = qscintilla2 CONFIG += qt warn_off thread exceptions hide_symbols staticlib debug_and_release INCLUDEPATH += . ../include ../lexlib ../src !CONFIG(staticlib) { DEFINES += QSCINTILLA_MAKE_DLL } DEFINES += SCINTILLA_QT SCI_LEXER 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 target.path = $$[QT_INSTALL_LIBS] INSTALLS += target header.path = $$[QT_INSTALL_HEADERS] header.files = Qsci INSTALLS += header trans.path = $$[QT_INSTALL_TRANSLATIONS] trans.files = qscintilla_*.qm INSTALLS += trans qsci.path = $$[QT_INSTALL_DATA] qsci.files = ../qsci INSTALLS += qsci greaterThan(QT_MAJOR_VERSION, 4) { features.path = $$[QT_HOST_DATA]/mkspecs/features } else { features.path = $$[QT_INSTALL_DATA]/mkspecs/features } CONFIG(staticlib) { features.files = $$PWD/features_staticlib/qscintilla2.prf } else { 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/qscilexercustom.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/Sci_Position.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/StringCopy.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/EditModel.h \ ../src/Editor.h \ ../src/EditView.h \ ../src/ExternalLexer.h \ ../src/FontQuality.h \ ../src/Indicator.h \ ../src/KeyMap.h \ ../src/LineMarker.h \ ../src/MarginView.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 \ qscilexercustom.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/EditModel.cpp \ ../src/Editor.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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_cs.qm000066400000000000000000001265061316047212700240430ustar00rootroot00000000000000#Nhh2_T9UpuSO<9tWGUB$DRo?UIc4%'[[uAf+l&SI~ŰG 4X`X|z5[0dszq O>vx Z6{ctA  T:A$<L,_?@A3@Ah@Ar$@A@A@B4!@Bi'@BrS@Bl@B@C4|@Ci@Cr@C@CS@Di@D&@DA*\8\8N\8 \8%\8/(\83\886\8c\8g0\8m\8p^\8t\8x\8}\8U\8 \8P\8r\8/\8\8\8r&Xr0]r1vBynzkM5855#5-52857k5e5m5p5s5x&5555+55]55GgGqp9\9\:4J*q9?^tHo_p[}&}/}8d('`.5C<WeȐGȐȐȐ%Ȑ*Ȑ/bȐ3?Ȑ8mȐcȐgaȐjȐmȐpȐt:ȐxȐȐRȐȐ`ȐȐȐKѽ8 ԇZfg ` "I)6%)o6|_uR}d*yd*iyd*z d*z=i*Ew'Rw܌KZ9] _D:&QF*Nv3ggj |^KE"1"e"rlT ~ ~!)~,~k;2cq2aUo^|<2DpO ~ &0' &0'= ?3_? @|U`h o^ @tj E b  ^V   " ) -= 6 l v   2 ~ X$ur =y@ i ,E T` 4PV '4! *S *Su *S} Iq> S~I S d85 d8k d8 d8 d<E d<> d< P d<5R d<6z d<eK d<j> d<l/ d<n d<o& d<u d<|X d<} d<~ d<6 d<{ d< d< d<J d< d< d4!d h k, qeEG $M9 dve R) BA t t~ tx t t! t)\ t, t2 t5 t6 tc% te tj{ tk tlj tn to tr tv< t| t} tT t t t t tA t& t tY zGK ZTP  Z5 _T ?O " (] ;2 ;^B A\ E\ _? cV4 dg dNC ea 4$[ ' F  yl |# |.h |B Bu|* ӕp O O 4E 4z ؗO ES )~ ) ) >V W=~ f* oX ow o 'G } J! $x C 'P x5 Ig'b Ig1y Ig3v Ig9 Igd Ighx Igq Igt IgQ IgR Ig t#J t. t `Su .^ y@Wba cb +' }9 @=eUVWW\O ]gBeTI5hwLirZ&ld;wgY{?O&4H&*09ntv{ B< >)wƦ n L rkCqj602$2N@Am#}w,4+4URΒVD2R)tnE9TYw}Ui ZruaitCancel QsciCommandHVybran text pYevst na mal psmenaConvert selection to lower case QsciCommandJVybran text pYevst na velk psmenaConvert selection to upper case QsciCommand0Koprovat aktuln YdkuCopy current line QsciCommandKoprovat vbrCopy selection QsciCommand,Vyjmout aktuln YdkuCut current line QsciCommandVyjmout vbr Cut selection QsciCommand(Smazat aktuln znakDelete current character QsciCommand*Smazat aktuln YdkuDelete current line QsciCommand&Smazat Ydku dolevaDelete line to left QsciCommand(Smazat Ydku dopravaDelete line to right QsciCommand*Smazat pYedchoz znakDelete previous character QsciCommand&Smazat slovo dolevaDelete word to left QsciCommand(Smazat slovo dopravaDelete word to right QsciCommand Duplikovat vbrDuplicate selection QsciCommandZRozaYit obdlnkov vbr o jednu Ydku dolo*Extend rectangular selection down one line QsciCommandTRozaYit obdlnkov vbr na dala stranu*Extend rectangular selection down one page QsciCommandbRozaYit obdlnkov vbr o jedno psmeno doleva/Extend rectangular selection left one character QsciCommanddRozaYit obdlnkov vbr o jedno psmeno doprava0Extend rectangular selection right one character QsciCommand^RozaYit obdlnkov vbr o jednu Ydku nahoru(Extend rectangular selection up one line QsciCommand\RozaYit obdlnkov vbr na pYedchoz stranu(Extend rectangular selection up one page QsciCommandBRozaYit vbr o jednu Ydku doloExtend selection down one line QsciCommand<RozaYit vbr na dala stranuExtend selection down one page QsciCommandHRozaYit vbr o jeden odstavec dolo#Extend selection down one paragraph QsciCommandJRozaYit vbr o jedno psmeno doleva#Extend selection left one character QsciCommandFRozaYit vbr o jedno slovo dolevaExtend selection left one word QsciCommandDRozaYit vbr o  st slova doleva#Extend selection left one word part QsciCommandLRozaYit vbr o jedno psmeno doprava$Extend selection right one character QsciCommandHRozaYit vbr o jedno slovo dopravaExtend selection right one word QsciCommandFRozaYit vbr o  st slova doprava$Extend selection right one word part QsciCommandFRozaYit vbr o jednu Ydku nahoruExtend selection up one line QsciCommandDRozaYit vbr na pYedchoz stranuExtend selection up one page QsciCommandLRozaYit vbr o jeden odstavec nahoru!Extend selection up one paragraph QsciCommandVysunoutFormfeed QsciCommand,Odsadit o jednu roveHIndent one level QsciCommand0Posun o jednu Ydku doloMove down one line QsciCommand*Posun na dala stranuMove down one page QsciCommand6Posun o jeden odstavec doloMove down one paragraph QsciCommand8Posun o jedno psmeno dolevaMove left one character QsciCommand2Posun o jedno slovo vlevoMove left one word QsciCommand2Posun o  st slova dolevaMove left one word part QsciCommand:Posun o jedno psmeno dopravaMove right one character QsciCommand6Posun o jedno slovo dopravaMove right one word QsciCommand4Posun o  st slova dopravaMove right one word part QsciCommand4Posun o jednu Ydku nahoruMove up one line QsciCommand2Posun na pYedchoz stranuMove up one page QsciCommand:Posun o jeden odstavec nahoruMove up one paragraph QsciCommand Vlo~itPaste QsciCommand8Znovu pou~t posledn pYkazRedo last command QsciCommandBRolovat pohled o jednu Ydku doloScroll view down one line QsciCommandFRolovat pohled o jednu Ydku nahoruScroll view up one line QsciCommand:PYepnout vkldn/pYepisovnToggle insert/overtype QsciCommandZvtaitZoom in QsciCommandZmenaitZoom out QsciCommandDefaultDefault QsciLexerAVS<String ve dvojitch uvozovkchDouble-quoted string QsciLexerAVSIdentifiktor Identifier QsciLexerAVSKl ov slovoKeyword QsciLexerAVS*JednoYdkov komentY Line comment QsciLexerAVS  sloNumber QsciLexerAVSOpertorOperator QsciLexerAVSHString ve tYech dvojitch uvozovkchTriple double-quoted string QsciLexerAVSZptn chod Backticks QsciLexerBashKomentYComment QsciLexerBashDefaultDefault QsciLexerBash<String ve dvojitch uvozovkchDouble-quoted string QsciLexerBash ChybaError QsciLexerBash4Zde je oddlova dokumentuHere document delimiter QsciLexerBashIdentifiktor Identifier QsciLexerBashKl ov slovoKeyword QsciLexerBash  sloNumber QsciLexerBashOpertorOperator QsciLexerBash"Rozklad parametruParameter expansion QsciLexerBash SkalrScalar QsciLexerBashFJednoduch uvozovky zde v dokumentuSingle-quoted here document QsciLexerBash@String v jednoduchch uvozovkchSingle-quoted string QsciLexerBashKomentYCommentQsciLexerBatchDefaultDefaultQsciLexerBatchExtern pYkazExternal commandQsciLexerBatch*Skrt psmeno pYkazuHide command characterQsciLexerBatchKl ov slovoKeywordQsciLexerBatch NadpisLabelQsciLexerBatchOpertorOperatorQsciLexerBatchPromnnVariableQsciLexerBatchKomentYCommentQsciLexerCMakeDefaultDefaultQsciLexerCMake NadpisLabelQsciLexerCMake  sloNumberQsciLexerCMakePromnnVariableQsciLexerCMakeC komentY C comment QsciLexerCPPC++ komentY C++ comment QsciLexerCPPDefaultDefault QsciLexerCPP<String ve dvojitch uvozovkchDouble-quoted string QsciLexerCPP<Globln tYdy a definice typoGlobal classes and typedefs QsciLexerCPPIdentifiktor Identifier QsciLexerCPP*JavaDoc kl ov slovoJavaDoc keyword QsciLexerCPP6JavaDoc kl ov slovo chybyJavaDoc keyword error QsciLexerCPP0JavaDoc styl C komentYeJavaDoc style C comment QsciLexerCPP4JavaDoc styl C++ komentYeJavaDoc style C++ comment QsciLexerCPP2JavaSript regulrn vrazJavaScript regular expression QsciLexerCPPKl ov slovoKeyword QsciLexerCPP  sloNumber QsciLexerCPPOpertorOperator QsciLexerCPP"Pre-procesor blokPre-processor block QsciLexerCPPRSekundrn kl ov slova a identifiktory"Secondary keywords and identifiers QsciLexerCPP@String v jednoduchch uvozovkchSingle-quoted string QsciLexerCPP"NeuzavYen stringUnclosed string QsciLexerCPP@-pravidlo@-rule QsciLexerCSSAtribut Attribute QsciLexerCSSCSS1 vlastnost CSS1 property QsciLexerCSSCSS2 vlastnost CSS2 property QsciLexerCSS(CSS2 vlastnost {3 ?} CSS3 property QsciLexerCSSSelektor tYdyClass selector QsciLexerCSSDefaultDefault QsciLexerCSS<String ve dvojitch uvozovkchDouble-quoted string QsciLexerCSSID selektor ID selector QsciLexerCSSImportant Important QsciLexerCSSOpertorOperator QsciLexerCSSPseudotYda Pseudo-class QsciLexerCSS@String v jednoduchch uvozovkchSingle-quoted string QsciLexerCSSTagTag QsciLexerCSS,Nedefinovan vlastnostUnknown property QsciLexerCSS0Nedefinovan pseudotYdaUnknown pseudo-class QsciLexerCSSHodnotaValue QsciLexerCSSPromnnVariable QsciLexerCSSVerbatim stringQsciLexerCSharpDefaultDefaultQsciLexerCoffeeScript<String ve dvojitch uvozovkchDouble-quoted stringQsciLexerCoffeeScriptIdentifiktor IdentifierQsciLexerCoffeeScript*JavaDoc kl ov slovoJavaDoc keywordQsciLexerCoffeeScript6JavaDoc kl ov slovo chybyJavaDoc keyword errorQsciLexerCoffeeScriptKl ov slovoKeywordQsciLexerCoffeeScript  sloNumberQsciLexerCoffeeScriptOpertorOperatorQsciLexerCoffeeScript"Pre-procesor blokPre-processor blockQsciLexerCoffeeScriptRegulrn vrazRegular expressionQsciLexerCoffeeScriptRSekundrn kl ov slova a identifiktory"Secondary keywords and identifiersQsciLexerCoffeeScript@String v jednoduchch uvozovkchSingle-quoted stringQsciLexerCoffeeScript"NeuzavYen stringUnclosed stringQsciLexerCoffeeScriptZnak Character QsciLexerDDefaultDefault QsciLexerDIdentifiktor Identifier QsciLexerDKl ov slovoKeyword QsciLexerD*JednoYdkov komentY Line comment QsciLexerD  sloNumber QsciLexerDOpertorOperator QsciLexerD"NeuzavYen stringUnclosed string QsciLexerD.Definovno u~ivatelem 1User defined 1 QsciLexerD.Definovno u~ivatelem 2User defined 2 QsciLexerD.Definovno u~ivatelem 3User defined 3 QsciLexerDPYidan Ydka Added line QsciLexerDiff PYkazCommand QsciLexerDiffKomentYComment QsciLexerDiffDefaultDefault QsciLexerDiffHlavi kaHeader QsciLexerDiff PozicePosition QsciLexerDiffOdebran Ydka Removed line QsciLexerDiffKomentYCommentQsciLexerFortran77DefaultDefaultQsciLexerFortran77<String ve dvojitch uvozovkchDouble-quoted stringQsciLexerFortran77Identifiktor IdentifierQsciLexerFortran77Kl ov slovoKeywordQsciLexerFortran77 NadpisLabelQsciLexerFortran77  sloNumberQsciLexerFortran77OpertorOperatorQsciLexerFortran77"Pre-procesor blokPre-processor blockQsciLexerFortran77@String v jednoduchch uvozovkchSingle-quoted stringQsciLexerFortran77"NeuzavYen stringUnclosed stringQsciLexerFortran77.ASP JavaScript komentYASP JavaScript comment QsciLexerHTMLASP JavaScript default QsciLexerHTMLZASP JavaScript string ve dvojitch uvozovkch#ASP JavaScript double-quoted string QsciLexerHTML8ASP JavaScript kl ov slovoASP JavaScript keyword QsciLexerHTMLFASP JavaScript jednoYdkov komenYASP JavaScript line comment QsciLexerHTML(ASP JavaScript  sloASP JavaScript number QsciLexerHTML<ASP JavaScript regulrn vraz!ASP JavaScript regular expression QsciLexerHTMLPASP JavaScript v jednoduchch uvozovkch#ASP JavaScript single-quoted string QsciLexerHTMLASP JavaScript symbol QsciLexerHTML@ASP JavaScript neuzavYen stringASP JavaScript unclosed string QsciLexerHTML(ASP JavaScript slovoASP JavaScript word QsciLexerHTML,ASP Python jmno tYdyASP Python class name QsciLexerHTML&ASP Python komentYASP Python comment QsciLexerHTMLASP Python default QsciLexerHTMLRASP Python string ve dvojitch uvozovkchASP Python double-quoted string QsciLexerHTMLHASP Python jmno funkce nebo metody"ASP Python function or method name QsciLexerHTML0ASP Python identifiktorASP Python identifier QsciLexerHTML0ASP Python kl ov slovoASP Python keyword QsciLexerHTML ASP Python  sloASP Python number QsciLexerHTML&ASP Python opertorASP Python operator QsciLexerHTMLHASP Python v jednoduchch uvozovkchASP Python single-quoted string QsciLexerHTMLPASP Python ve tYech dvojitch uvozovkch&ASP Python triple double-quoted string QsciLexerHTMLVASP Python ve tYech jednoduchch uvozovkch&ASP Python triple single-quoted string QsciLexerHTML*ASP VBScript komentYASP VBScript comment QsciLexerHTMLASP VBScript default QsciLexerHTML4ASP VBScript identifiktorASP VBScript identifier QsciLexerHTML4ASP VBScript kl ov slovoASP VBScript keyword QsciLexerHTML$ASP VBScript  sloASP VBScript number QsciLexerHTMLASP VBScript string QsciLexerHTML<ASP VBScript neuzavYen stringASP VBScript unclosed string QsciLexerHTML&ASP X-Code komentYASP X-Code comment QsciLexerHTMLAtribut Attribute QsciLexerHTMLCDATA QsciLexerHTMLKonec tagu End of a tag QsciLexerHTMLKonec XML  stiEnd of an XML fragment QsciLexerHTML EntitaEntity QsciLexerHTMLNKomentY prvnho parametru SGML pYkazu*First parameter comment of an SGML command QsciLexerHTML:Prvn parametr v SGML pYkazu"First parameter of an SGML command QsciLexerHTMLHTML komentY HTML comment QsciLexerHTML HTML default QsciLexerHTMLBHTML string ve dojtch uvozovkchHTML double-quoted string QsciLexerHTMLHTML  slo HTML number QsciLexerHTMLJHTML string v jednoduchch uvozovkchHTML single-quoted string QsciLexerHTMLHJavaDoc styl ASP JavaScript komentY$JavaDoc style ASP JavaScript comment QsciLexerHTMLBJavaDoc styl JavaScript komentYe JavaDoc style JavaScript comment QsciLexerHTML&JavaScript komentYJavaScript comment QsciLexerHTMLJavaScript default QsciLexerHTMLPJavaSript string ve dvojitch uvozovkchJavaScript double-quoted string QsciLexerHTML.JavaSript kl ov slovoJavaScript keyword QsciLexerHTML@JavaScript jednoYdkov komentYJavaScript line comment QsciLexerHTML JavaScript  sloJavaScript number QsciLexerHTML2JavaSript regulrn vrazJavaScript regular expression QsciLexerHTMLTJavaSript string v jednoduchch uvozovkchJavaScript single-quoted string QsciLexerHTMLJavaScript symbol QsciLexerHTML6JavaSript neuzavYen stringJavaScript unclosed string QsciLexerHTMLJavaSript slovoJavaScript word QsciLexerHTML"Dala text v taguOther text in a tag QsciLexerHTMLPHP komentY PHP comment QsciLexerHTML PHP default QsciLexerHTMLDPHP string ve dvojitch uvozovkchPHP double-quoted string QsciLexerHTMLHPHP promnn ve dvojitch uvozovkchPHP double-quoted variable QsciLexerHTML"PHP kl ov slovo PHP keyword QsciLexerHTML2PHP jednoYdkov komentYPHP line comment QsciLexerHTMLPHP  slo PHP number QsciLexerHTMLPHP opertor PHP operator QsciLexerHTML:PHP v jednoduchch uvozovkchPHP single-quoted string QsciLexerHTMLPHP promnn PHP variable QsciLexerHTML$Python jmno tYdyPython class name QsciLexerHTMLPython komentYPython comment QsciLexerHTMLPython default QsciLexerHTMLFPython string ve dojtch uvozovkchPython double-quoted string QsciLexerHTML>Python jmno funkce nebo metodyPython function or method name QsciLexerHTML(Python identifiktorPython identifier QsciLexerHTML(Python kl ov slovoPython keyword QsciLexerHTMLPython  slo Python number QsciLexerHTMLPython opertorPython operator QsciLexerHTMLNPython string v jednoduchch uvozovkchPython single-quoted string QsciLexerHTMLVPython string ve tYech dvojitch uvozovkch"Python triple double-quoted string QsciLexerHTMLNPython ve tYech jednoduchch uvozovkch"Python triple single-quoted string QsciLexerHTML&SGML defaultn blokSGML block default QsciLexerHTMLSGML pYkaz SGML command QsciLexerHTMLSGML komentY SGML comment QsciLexerHTML SGML default QsciLexerHTMLFSGML string ve dvojitch uvozovkchSGML double-quoted string QsciLexerHTMLSGML chyba SGML error QsciLexerHTMLJSGML string v jednoduchch uvozovkchSGML single-quoted string QsciLexerHTML*SGML speciln entitaSGML special entity QsciLexerHTMLTag skriptu Script tag QsciLexerHTML.Za tek JavaScript kduStart of a JavaScript fragment QsciLexerHTML Za tek PHP kduStart of a PHP fragment QsciLexerHTML&Za tek Python kduStart of a Python fragment QsciLexerHTML*Za tek VBScript kduStart of a VBScript fragment QsciLexerHTML6Za tek ASP JavaScript kdu#Start of an ASP JavaScript fragment QsciLexerHTML.Za tek ASP Python kduStart of an ASP Python fragment QsciLexerHTML2Za tek ASP VBScript kdu!Start of an ASP VBScript fragment QsciLexerHTML Za tek ASP kduStart of an ASP fragment QsciLexerHTML(Za tek ASP kdu s @Start of an ASP fragment with @ QsciLexerHTML"Za tek XML  stiStart of an XML fragment QsciLexerHTMLTag QsciLexerHTML(Nedefinovan atributUnknown attribute QsciLexerHTML Nedefinovan tag Unknown tag QsciLexerHTML2HTML hodnota bez uvozovekUnquoted HTML value QsciLexerHTML"VBScript komentYVBScript comment QsciLexerHTMLVBScript default QsciLexerHTML,VBScript identifiktorVBScript identifier QsciLexerHTML,VBScript kl ov slovoVBScript keyword QsciLexerHTMLVBScript  sloVBScript number QsciLexerHTMLVBScript string QsciLexerHTML4VBScript neuzavYen stringVBScript unclosed string QsciLexerHTMLUUID QsciLexerIDLDefaultDefault QsciLexerJSON*JednoYdkov komentY Line comment QsciLexerJSON  sloNumber QsciLexerJSONOpertorOperator QsciLexerJSON"NeuzavYen stringUnclosed string QsciLexerJSONRegulrn vrazRegular expressionQsciLexerJavaScriptZkladn funkceBasic functions QsciLexerLuaZnak Character QsciLexerLuaKomentYComment QsciLexerLua%Coroutines, i/o and system facilities QsciLexerLuaDefault QsciLexerLuaIdentifiktor Identifier QsciLexerLuaKl ov slovoKeyword QsciLexerLua NadpisLabel QsciLexerLua*JednoYdkov komentY Line comment QsciLexerLuaLiteral string QsciLexerLua  sloNumber QsciLexerLuaOpertorOperator QsciLexerLua Preprocessor QsciLexerLuaString QsciLexerLuaHString, tabulka a matematick funkce!String, table and maths functions QsciLexerLua"NeuzavYen stringUnclosed string QsciLexerLua.Definovno u~ivatelem 1User defined 1 QsciLexerLua.Definovno u~ivatelem 2User defined 2 QsciLexerLua.Definovno u~ivatelem 3User defined 3 QsciLexerLua.Definovno u~ivatelem 4User defined 4 QsciLexerLuaKomentYCommentQsciLexerMakefileDefaultQsciLexerMakefile ChybaErrorQsciLexerMakefileOpertorOperatorQsciLexerMakefile PreprocessorQsciLexerMakefileClTargetQsciLexerMakefilePromnnVariableQsciLexerMakefileDefaultDefaultQsciLexerMarkdown PYkazCommandQsciLexerMatlabKomentYCommentQsciLexerMatlabDefaultDefaultQsciLexerMatlab<String ve dvojitch uvozovkchDouble-quoted stringQsciLexerMatlabIdentifiktor IdentifierQsciLexerMatlabKl ov slovoKeywordQsciLexerMatlab  sloNumberQsciLexerMatlabOpertorOperatorQsciLexerMatlab@String v jednoduchch uvozovkchSingle-quoted stringQsciLexerMatlabKomentYComment QsciLexerPODefaultDefault QsciLexerPO Bad directive QsciLexerPOVKomentYComment QsciLexerPOV*JednoYdkov komentY Comment line QsciLexerPOVDefault QsciLexerPOVDirektiva Directive QsciLexerPOVIdentifiktor Identifier QsciLexerPOV  sloNumber QsciLexerPOVObjects, CSG and appearance QsciLexerPOVOpertorOperator QsciLexerPOVPredefined functions QsciLexerPOVPredefined identifiers QsciLexerPOVString QsciLexerPOVTypes, modifiers and items QsciLexerPOV"NeuzavYen stringUnclosed string QsciLexerPOVUser defined 1 QsciLexerPOVUser defined 2 QsciLexerPOVUser defined 3 QsciLexerPOVZnak CharacterQsciLexerPascalDefaultDefaultQsciLexerPascalIdentifiktor IdentifierQsciLexerPascalKl ov slovoKeywordQsciLexerPascal*JednoYdkov komentY Line commentQsciLexerPascal  sloNumberQsciLexerPascalOpertorOperatorQsciLexerPascal@String v jednoduchch uvozovkchSingle-quoted stringQsciLexerPascal"NeuzavYen stringUnclosed stringQsciLexerPascalPoleArray QsciLexerPerlBacktick here document QsciLexerPerl Backticks QsciLexerPerlKomentYComment QsciLexerPerl Data section QsciLexerPerlDefault QsciLexerPerlNZde je dokument ve dvojitch uvozovkchDouble-quoted here document QsciLexerPerl<String ve dvojitch uvozovkchDouble-quoted string QsciLexerPerl ChybaError QsciLexerPerlHash QsciLexerPerl4Zde je oddlova dokumentuHere document delimiter QsciLexerPerlIdentifiktor Identifier QsciLexerPerlKl ov slovoKeyword QsciLexerPerl  sloNumber QsciLexerPerlOpertorOperator QsciLexerPerlPOD QsciLexerPerl POD verbatim QsciLexerPerlQuoted string (q) QsciLexerPerlQuoted string (qq) QsciLexerPerlQuoted string (qr) QsciLexerPerlQuoted string (qw) QsciLexerPerlQuoted string (qx) QsciLexerPerlRegulrn vrazRegular expression QsciLexerPerl SkalrScalar QsciLexerPerlRZde je dokument v jednoduchch uvozovkchSingle-quoted here document QsciLexerPerl@String v jednoduchch uvozovkchSingle-quoted string QsciLexerPerl Substitution QsciLexerPerl Symbol table QsciLexerPerlKomentYCommentQsciLexerPostScriptDefaultDefaultQsciLexerPostScriptKl ov slovoKeywordQsciLexerPostScript  sloNumberQsciLexerPostScript AssignmentQsciLexerPropertiesCommentQsciLexerPropertiesDefaultQsciLexerProperties Default valueQsciLexerPropertiesSectionQsciLexerPropertiesJmno tYdy Class nameQsciLexerPythonKomentYCommentQsciLexerPythonBlok komentYe Comment blockQsciLexerPythonDekortor DecoratorQsciLexerPythonDefaultQsciLexerPython<String ve dvojitch uvozovkchDouble-quoted stringQsciLexerPython0Jmno funkce nebo metodyFunction or method nameQsciLexerPython0Zvraznn identifiktorHighlighted identifierQsciLexerPythonIdentifiktor IdentifierQsciLexerPythonKl ov slovoKeywordQsciLexerPython  sloNumberQsciLexerPythonOpertorOperatorQsciLexerPython@String v jednoduchch uvozovkchSingle-quoted stringQsciLexerPythonHString ve tYech dvojitch uvozovkchTriple double-quoted stringQsciLexerPythonNString ve tYech jednoduchch uvozovkchTriple single-quoted stringQsciLexerPython"NeuzavYen stringUnclosed stringQsciLexerPython %Q string QsciLexerRuby %q string QsciLexerRuby %r string QsciLexerRuby %w string QsciLexerRuby %x string QsciLexerRuby Backticks QsciLexerRubyJmno tYdy Class name QsciLexerRubyPromnn tYdyClass variable QsciLexerRubyKomentYComment QsciLexerRubyDatov sekce Data section QsciLexerRubyDefault QsciLexerRubyDemoted keyword QsciLexerRuby<String ve dvojitch uvozovkchDouble-quoted string QsciLexerRuby ChybaError QsciLexerRuby0Jmno funkce nebo metodyFunction or method name QsciLexerRubyGlobal QsciLexerRubyZde je dokument Here document QsciLexerRuby4Zde je oddlova dokumentuHere document delimiter QsciLexerRubyIdentifiktor Identifier QsciLexerRuby"Promnn instanceInstance variable QsciLexerRubyKl ov slovoKeyword QsciLexerRubyJmno modulu Module name QsciLexerRuby  sloNumber QsciLexerRubyOpertorOperator QsciLexerRubyPODPOD QsciLexerRubyRegulrn vrazRegular expression QsciLexerRuby@String v jednoduchch uvozovkchSingle-quoted string QsciLexerRubySymbol QsciLexerRubystderr QsciLexerRubystdin QsciLexerRubystdout QsciLexerRuby.# jednoYdkov komentY# comment line QsciLexerSQLKomentYComment QsciLexerSQL*JednoYdkov komentY Comment line QsciLexerSQLDefault QsciLexerSQL<String ve dvojitch uvozovkchDouble-quoted string QsciLexerSQLIdentifiktor Identifier QsciLexerSQL*JavaDoc kl ov slovoJavaDoc keyword QsciLexerSQL6JavaDoc kl ov slovo chybyJavaDoc keyword error QsciLexerSQL*JavaDoc styl komentYJavaDoc style comment QsciLexerSQLKl ov slovoKeyword QsciLexerSQL  sloNumber QsciLexerSQLOpertorOperator QsciLexerSQL"SQL*Plus komentYSQL*Plus comment QsciLexerSQL,SQL*Plus kl ov slovoSQL*Plus keyword QsciLexerSQLSQL*Plus prompt QsciLexerSQL@String v jednoduchch uvozovkchSingle-quoted string QsciLexerSQL.Definovno u~ivatelem 1User defined 1 QsciLexerSQL.Definovno u~ivatelem 2User defined 2 QsciLexerSQL.Definovno u~ivatelem 3User defined 3 QsciLexerSQL.Definovno u~ivatelem 4User defined 4 QsciLexerSQL PYkazCommandQsciLexerSpiceKomentYCommentQsciLexerSpiceDefaultDefaultQsciLexerSpiceIdentifiktor IdentifierQsciLexerSpice  sloNumberQsciLexerSpiceHodnotaValueQsciLexerSpiceKomentYComment QsciLexerTCLBlok komentYe Comment block QsciLexerTCL*JednoYdkov komentY Comment line QsciLexerTCLDefaultDefault QsciLexerTCLIdentifiktor Identifier QsciLexerTCL  sloNumber QsciLexerTCLOpertorOperator QsciLexerTCL.Definovno u~ivatelem 1User defined 1 QsciLexerTCL.Definovno u~ivatelem 2User defined 2 QsciLexerTCL.Definovno u~ivatelem 3User defined 3 QsciLexerTCL.Definovno u~ivatelem 4User defined 4 QsciLexerTCL PYkazCommand QsciLexerTeXDefault QsciLexerTeXSkupinaGroup QsciLexerTeXSpecial QsciLexerTeXSymbol QsciLexerTeXText QsciLexerTeXAtribut Attribute QsciLexerVHDLKomentYComment QsciLexerVHDLBlok komentYe Comment block QsciLexerVHDL*JednoYdkov komentY Comment line QsciLexerVHDLDefaultDefault QsciLexerVHDLIdentifiktor Identifier QsciLexerVHDLKl ov slovoKeyword QsciLexerVHDL  sloNumber QsciLexerVHDLOpertorOperator QsciLexerVHDL"NeuzavYen stringUnclosed string QsciLexerVHDLKomentYCommentQsciLexerVerilogDefaultDefaultQsciLexerVerilogIdentifiktor IdentifierQsciLexerVerilog*JednoYdkov komentY Line commentQsciLexerVerilog  sloNumberQsciLexerVerilogOpertorOperatorQsciLexerVerilogRSekundrn kl ov slova a identifiktory"Secondary keywords and identifiersQsciLexerVerilog"NeuzavYen stringUnclosed stringQsciLexerVerilogKomentYComment QsciLexerYAMLDefaultDefault QsciLexerYAMLIdentifiktor Identifier QsciLexerYAMLKl ov slovoKeyword QsciLexerYAML  sloNumber QsciLexerYAMLOpertorOperator QsciLexerYAMLsqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_cs.ts000066400000000000000000004342311316047212700240510ustar00rootroot00000000000000 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 Instance property 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 QsciLexerJSON Default Default Number Číslo String Unclosed string Neuzavřený string Property Escape sequence Line comment Jednořádkový komentář Block comment Operator Operátor IRI JSON-LD compact IRI JSON keyword JSON-LD keyword Parsing error 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 QsciLexerMarkdown Default Default Special Strong emphasis using double asterisks Strong emphasis using double underscores Emphasis using single asterisks Emphasis using single underscores Level 1 header Level 2 header Level 3 header Level 4 header Level 5 header Level 6 header Pre-char Unordered list item Ordered list item Block quote Strike out Horizontal rule Link Code between backticks Code between double backticks Code block 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_de.qm000066400000000000000000002247521316047212700240300ustar00rootroot00000000000000HVEq|f4~u ڴ2/(ۅH%MooZe*&^s 5'F/>p3:?=ZAFky{R5e2wt3LwtaPwtjwt{-{!stKieb4%"4>^+l"+/Wu0Xmm5mm5>9=Uxgomv ɯx{p'r Ջ".Z[#ZD@U8 }M!6#GNh+QdfIh2 eU}bo_4wLu a9U 2p ӫ ;%dN@s ,u+O*7 k<9tV3WjmDZUD$' Ma0{AGE$lo7Tp*^?313 6$"4%ZQ[[u6f`l&0E dZk GY IcMn[tcr,tc~Ű4:4(T 4IFX|zr'n+h D; z Cvx6م6Xct Tx$<*t[,_~f@Apy@A@AŊ@A{@Am@Bp@Bp@B@B@B@Cq@C@C0@C!@C@D@Dt@DfA^Bo8H[kZ\86<\89\8@\8U\8g\8n\8v\8J\8'\8=\8\8B\8һ\85\8\8\8\8-\8I\8\8 \8k'rWjrhr s6vBӖ{:^|:5459{5EB5e5me5ui555“5585.5s5-5555Z5G@GoG=GGxGG Hʂ9\9\:4ECڧ0tw#'q)n)*8Q?^t]u-(_p3o?C 1}W}h4}vdH('.rE#[Ȑ6kȐ:.Ȑ=ȐUȐ^`ȐgȐnȐvȐzȐVȐȐoȐuȐtȐȐȐȐȐxȐ5Ȑ Ȑ?ѽ8ԇjUjGo1%|^WB^"k$""QlT|~=~AD~`~Iz2cîN.2WOf,7Kl`ݔE d{l2 ~q &0'6 &0' 3 ?3 @|U AP\ DQ f o @t 2N @ O < ^7 V" 4 8i C [ d t < Ϛ  s  J X$ˮ =P $f0 i ,E W?b 5  4y =WQ b Z L " b '4B )J *S7 *S *S +O4I 0 FYo Iq>:h S S ZU/ ^Q d8r d8 d8 d8 d<7 d<; d<= d<r= d<ss d< d<i d< d< d< d<͔ d< d<@ d< d<N d< d< d< d<y d< d< d4B: g$ hY k,a k, qe s(ڗ |C3 $* dN R[q % B t3 t80 t< t>6 tC t[ tc tl trx ts tA t t t t tR t tȌ t t t t t t~ t9 t0 t> tI t t  z ZT  Z5# o _E ?  "1\ $tƃ 'd, ( 85& ;2 ;^ A\ E~ _! cVql d dN eK pCd v]wBz v]wb }TFn 4$ p %Ng ZM " >  . ; y S |ST |f | BuO zDj ӕ ܶ$ OM O 4: 4F ) ؗ E ) )Y ) FB  X > J4 J> J WLܖ W| f] j o9 o o ' ,lg  kO % %y Au GE T r ' u xz  .  . E+ '4,L 15 943 @&4 @*$X _: cbt: t}45 t}4m t}4 t}4s t}4 t}4 R wtRt S \RJ \  ?D| O IgX Igj Igp Igw Ig} Ig Ig, Ig Ig Ig Ig E tR tf tl ut ` . }n w 5 J0 1 yWBH c  _'9 ~=epHIDO VbW\]geThwirldywg.{~ -C4&4N;nW_'iwYʰػ#sBz_jj})w(4hƦcnH٤bLkCķ|js's4 5(t2U2@V"wۭ#}w`'[2^4+4+842b9<3xFky2RΒm%wu@7ku@@u@E$l 2V)t)nE.AT!#%%_9rqi)AbbrechenCancel QsciCommandHAuswahl in Kleinbuchstaben umwandelnConvert selection to lower case QsciCommandFAuswahl in Grobuchstaben umwandelnConvert selection to upper case QsciCommand.Aktuelle Zeile kopierenCopy current line QsciCommand Auswahl kopierenCopy selection QsciCommand6Aktuelle Zeile ausschneidenCut current line QsciCommand(Auswahl ausschneiden Cut selection QsciCommand(Eine Ebene ausrckenDe-indent one level QsciCommand2Aktuelles Zeichen lschenDelete current character QsciCommand,Aktuelle Zeile lschenDelete current line QsciCommand&Zeile links lschenDelete line to left QsciCommand(Zeile rechts lschenDelete line to right QsciCommand*Zeichen links lschenDelete previous character QsciCommandbZeichen links lschen, wenn nicht am Zeilenanfang1Delete previous character if not at start of line QsciCommand^Rechts bis zum Ende des nchsten Wortes lschen Delete right to end of next word QsciCommand$Wort links lschenDelete word to left QsciCommand&Wort rechts lschenDelete word to right QsciCommand&Auswahl duplizierenDuplicate selection QsciCommand4Aktuelle Zeile duplizierenDuplicate the current line QsciCommandlRechteckige Auswahl um eine Zeile nach unten erweitern*Extend rectangular selection down one line QsciCommandlRechteckige Auswahl um eine Seite nach unten erweitern*Extend rectangular selection down one page QsciCommandnRechteckige Auswahl um ein Zeichen nach links erweitern/Extend rectangular selection left one character QsciCommandpRechteckige Auswahl um ein Zeichen nach rechts erweitern0Extend rectangular selection right one character QsciCommandtRechteckige Auswahl zum Ende der Dokumentenzeile erweitern4Extend rectangular selection to end of document line QsciCommandRechteckige Auswahl zum ersten sichtbaren Zeichen der Dokumentzeile erweiternHExtend rectangular selection to first visible character in document line QsciCommandxRechteckige Auswahl zum Beginn der Dokumentenzeile erweitern6Extend rectangular selection to start of document line QsciCommandjRechteckige Auswahl um eine Zeile nach oben erweitern(Extend rectangular selection up one line QsciCommandjRechteckige Auswahl um eine Seite nach oben erweitern(Extend rectangular selection up one page QsciCommandTAuswahl um eine Zeile nach unten erweiternExtend selection down one line QsciCommandTAuswahl um eine Seite nach unten erweiternExtend selection down one page QsciCommandXAuswahl um einen Absatz nach unten erweitern#Extend selection down one paragraph QsciCommandVAuswahl um ein Zeichen nach links erweitern#Extend selection left one character QsciCommandPAuswahl um ein Wort nach links erweiternExtend selection left one word QsciCommand\Auswahl um einen Wortteil nach links erweitern#Extend selection left one word part QsciCommandXAuswahl um ein Zeichen nach rechts erweitern$Extend selection right one character QsciCommandRAuswahl um ein Wort nach rechts erweiternExtend selection right one word QsciCommand^Auswahl um einen Wortteil nach rechts erweitern$Extend selection right one word part QsciCommandVAuswahl zum Ende der Anzeigezeile erweitern'Extend selection to end of display line QsciCommandRechteckige Auswahl zum Ende der Dokumenten- oder Anzeigezeile erweitern3Extend selection to end of display or document line QsciCommandHAuswahl zum Dokumentenende erweitern#Extend selection to end of document QsciCommand\Auswahl zum Ende der Dokumentenzeile erweitern(Extend selection to end of document line QsciCommanddAuswahl bis zum Ende des nchsten Wortes erweitern$Extend selection to end of next word QsciCommandbAuswahl bis zum Ende des vorigen Wortes erweitern(Extend selection to end of previous word QsciCommandAuswahl zum ersten sichtbaren Zeichen der Dokument- oder Anzeigezeile erweiternGExtend selection to first visible character in display or document line QsciCommandAuswahl zum ersten sichtbaren Zeichen der Dokumentzeile erweiternInaktives JavaDoc SchlsselwortInactive JavaDoc keyword QsciLexerCPPJInaktiver JavaDoc SchlsselwortfehlerInactive JavaDoc keyword error QsciLexerCPP:Inaktiver JavaDoc C Kommentar Inactive JavaDoc style C comment QsciLexerCPP>Inaktiver JavaDoc C++ Kommentar"Inactive JavaDoc style C++ comment QsciLexerCPPNInaktiver JavaDoc Prprozessorkommentar,Inactive JavaDoc style pre-processor comment QsciLexerCPPNJavaScript Inaktiver Regulrer Ausdruck&Inactive JavaScript regular expression QsciLexerCPPfInaktive Pike Zeichenkette in '#-Anfhrungszeichen' Inactive Pike hash-quoted string QsciLexerCPPhInaktive Vala Zeichenkette in dreifachen Hochkommata+Inactive Vala triple-quoted verbatim string QsciLexerCPP$Inaktiver StandardInactive default QsciLexerCPPTInaktive Zeichenkette in AnfhrungszeichenInactive double-quoted string QsciLexerCPP.Inaktive Escape-SequenzInactive escape sequence QsciLexerCPPXInaktive globale Klassen und Typdefinitionen$Inactive global classes and typedefs QsciLexerCPP(Inaktiver BezeichnerInactive identifier QsciLexerCPP.Inaktives SchlsselwortInactive keyword QsciLexerCPPInaktive ZahlInactive number QsciLexerCPP$Inaktiver OperatorInactive operator QsciLexerCPPBInaktiver C Prprozessorkommentar Inactive pre-processor C comment QsciLexerCPP6Inaktiver PrprozessorblockInactive pre-processor block QsciLexerCPPbInaktive sekundre Schlusselwrter und Bezeichner+Inactive secondary keywords and identifiers QsciLexerCPPHInaktive Zeichenkette in HochkommataInactive single-quoted string QsciLexerCPP6Inaktive AufgabenmarkierungInactive task marker QsciLexerCPP@Inaktive unbeendete ZeichenketteInactive unclosed string QsciLexerCPPHInaktives Nutzer definiertes LiteralInactive user-defined literal QsciLexerCPP*JavaDoc SchlsselwortJavaDoc keyword QsciLexerCPP6JavaDoc SchlsselwortfehlerJavaDoc keyword error QsciLexerCPP&JavaDoc C KommentarJavaDoc style C comment QsciLexerCPP*JavaDoc C++ KommentarJavaDoc style C++ comment QsciLexerCPP:JavaDoc Prprozessorkommentar#JavaDoc style pre-processor comment QsciLexerCPP:JavaScript Regulrer AusdruckJavaScript regular expression QsciLexerCPPSchlsselwortKeyword QsciLexerCPPZahlNumber QsciLexerCPPOperatorOperator QsciLexerCPPTPike Zeichenkette in '#-Anfhrungszeichen'Pike hash-quoted string QsciLexerCPP.C PrprozessorkommentarPre-processor C comment QsciLexerCPP"PrprozessorblockPre-processor block QsciLexerCPPPSekundre Schlusselwrter und Bezeichner"Secondary keywords and identifiers QsciLexerCPP6Zeichenkette in HochkommataSingle-quoted string QsciLexerCPP$Aufgabenmarkierung Task marker QsciLexerCPP.Unbeendete ZeichenketteUnclosed string QsciLexerCPP4Nutzer definiertes LiteralUser-defined literal QsciLexerCPPVVala Zeichenkette in dreifachen Hochkommata"Vala triple-quoted verbatim string QsciLexerCPP@-Regel@-rule QsciLexerCSSAttribut Attribute QsciLexerCSS CSS1 Eigenschaft CSS1 property QsciLexerCSS CSS2 Eigenschaft CSS2 property QsciLexerCSS CSS3 Eigenschaft CSS3 property QsciLexerCSSKlassenselektorClass selector QsciLexerCSSStandardDefault QsciLexerCSSBZeichenkette in AnfhrungszeichenDouble-quoted string QsciLexerCSS4Erweiterte CSS EigenschaftExtended CSS property QsciLexerCSS.Erweiterte PseudoklasseExtended pseudo-class QsciLexerCSS2Erweitertes PseudoelementExtended pseudo-element QsciLexerCSSID-Selektor ID selector QsciLexerCSSWichtig Important QsciLexerCSSMedienregel Media rule QsciLexerCSSOperatorOperator QsciLexerCSSPseudoklasse Pseudo-class QsciLexerCSSPseudoelementPseudo-element QsciLexerCSS6Zeichenkette in HochkommataSingle-quoted string QsciLexerCSSTagTag QsciLexerCSS,Unbekannte EigenschaftUnknown property QsciLexerCSS.Unbekannte PseudoklasseUnknown pseudo-class QsciLexerCSSWertValue QsciLexerCSSVariableVariable QsciLexerCSS:Uninterpretierte ZeichenketteVerbatim stringQsciLexerCSharpBlockkommentar Block commentQsciLexerCoffeeScript0Regulrer AusdrucksblockBlock regular expressionQsciLexerCoffeeScriptBRegulrer Ausdrucksblockkommentar Block regular expression commentQsciLexerCoffeeScript@Uninterpretierte C# ZeichenketteC# verbatim stringQsciLexerCoffeeScriptC++ KommentarC++-style commentQsciLexerCoffeeScriptC KommentarC-style commentQsciLexerCoffeeScriptStandardDefaultQsciLexerCoffeeScriptBZeichenkette in AnfhrungszeichenDouble-quoted stringQsciLexerCoffeeScriptGlobale KlassenGlobal classesQsciLexerCoffeeScriptIDL UUIDIDL UUIDQsciLexerCoffeeScriptBezeichner IdentifierQsciLexerCoffeeScript&Instanz-EigenschaftInstance propertyQsciLexerCoffeeScript*JavaDoc C++ KommentarJavaDoc C++-style commentQsciLexerCoffeeScript&JavaDoc C KommentarJavaDoc C-style commentQsciLexerCoffeeScript*JavaDoc SchlsselwortJavaDoc keywordQsciLexerCoffeeScript6JavaDoc SchlsselwortfehlerJavaDoc keyword errorQsciLexerCoffeeScriptSchlsselwortKeywordQsciLexerCoffeeScriptZahlNumberQsciLexerCoffeeScriptOperatorOperatorQsciLexerCoffeeScript"PrprozessorblockPre-processor blockQsciLexerCoffeeScript$Regulrer AusdruckRegular expressionQsciLexerCoffeeScriptPSekundre Schlusselwrter und Bezeichner"Secondary keywords and identifiersQsciLexerCoffeeScript6Zeichenkette in HochkommataSingle-quoted stringQsciLexerCoffeeScript.Unbeendete ZeichenketteUnclosed stringQsciLexerCoffeeScriptBZeichenkette in RckwrtsstrichenBackquoted string QsciLexerDBlockkommentar Block comment QsciLexerDZeichen Character QsciLexerD$DDoc Schlsselwort DDoc keyword QsciLexerD0DDoc SchlsselwortfehlerDDoc keyword error QsciLexerD&DDoc BlockkommentarDDoc style block comment QsciLexerD(DDoc ZeilenkommentarDDoc style line comment QsciLexerDStandardDefault QsciLexerD6DokumentationsschlsselwortDocumentation keyword QsciLexerDBezeichner Identifier QsciLexerDSchlsselwortKeyword QsciLexerDZeilenkommentar Line comment QsciLexerD0schachtelbarer KommentarNesting comment QsciLexerDZahlNumber QsciLexerDOperatorOperator QsciLexerD"Rohe Zeichenkette Raw string QsciLexerD0Sekundres SchlsselwortSecondary keyword QsciLexerDZeichenketteString QsciLexerDTypdefinitionType definition QsciLexerD.Unbeendete ZeichenketteUnclosed string QsciLexerD$Nutzer definiert 1User defined 1 QsciLexerD$Nutzer definiert 2User defined 2 QsciLexerD$Nutzer definiert 3User defined 3 QsciLexerD$Hinzugefgte Zeile Added line QsciLexerDiffGenderte Zeile Changed line QsciLexerDiff BefehlCommand QsciLexerDiffKommentarComment QsciLexerDiffStandardDefault QsciLexerDiffKopfzeilenHeader QsciLexerDiffPositionPosition QsciLexerDiffEntfernte Zeile Removed line QsciLexerDiffKommentarCommentQsciLexerFortran77Fortsetzung ContinuationQsciLexerFortran77StandardDefaultQsciLexerFortran77Dotted OperatorDotted operatorQsciLexerFortran77BZeichenkette in AnfhrungszeichenDouble-quoted stringQsciLexerFortran77&Erweiterte FunktionExtended functionQsciLexerFortran77Bezeichner IdentifierQsciLexerFortran77$Intrinsic-FunktionIntrinsic functionQsciLexerFortran77SchlsselwortKeywordQsciLexerFortran77 MarkeLabelQsciLexerFortran77ZahlNumberQsciLexerFortran77OperatorOperatorQsciLexerFortran77"PrprozessorblockPre-processor blockQsciLexerFortran776Zeichenkette in HochkommataSingle-quoted stringQsciLexerFortran77.Unbeendete ZeichenketteUnclosed stringQsciLexerFortran770ASP JavaScript KommentarASP JavaScript comment QsciLexerHTML.ASP JavaScript StandardASP JavaScript default QsciLexerHTML`ASP JavaScript Zeichenkette in Anfhrungszeichen#ASP JavaScript double-quoted string QsciLexerHTML8ASP JavaScript SchlsselwortASP JavaScript keyword QsciLexerHTML<ASP JavaScript ZeilenkommentarASP JavaScript line comment QsciLexerHTML&ASP JavaScript ZahlASP JavaScript number QsciLexerHTMLBASP JavaScript Regulrer Ausdruck!ASP JavaScript regular expression QsciLexerHTMLTASP JavaScript Zeichenkette in Hochkommata#ASP JavaScript single-quoted string QsciLexerHTML*ASP JavaScript SymbolASP JavaScript symbol QsciLexerHTMLLASP JavaScript Unbeendete ZeichenketteASP JavaScript unclosed string QsciLexerHTML&ASP JavaScript WortASP JavaScript word QsciLexerHTML,ASP Python KlassennameASP Python class name QsciLexerHTML(ASP Python KommentarASP Python comment QsciLexerHTML&ASP Python StandardASP Python default QsciLexerHTMLXASP Python Zeichenkette in AnfhrungszeichenASP Python double-quoted string QsciLexerHTMLNASP Python Funktions- oder Methodenname"ASP Python function or method name QsciLexerHTML*ASP Python BezeichnerASP Python identifier QsciLexerHTML0ASP Python SchlsselwortASP Python keyword QsciLexerHTMLASP Python ZahlASP Python number QsciLexerHTML&ASP Python OperatorASP Python operator QsciLexerHTMLLASP Python Zeichenkette in HochkommataASP Python single-quoted string QsciLexerHTMLnASP Python Zeichenkette in dreifachen Anfhrungszeichen&ASP Python triple double-quoted string QsciLexerHTMLbASP Python Zeichenkette in dreifachen Hochkommata&ASP Python triple single-quoted string QsciLexerHTML,ASP VBScript KommentarASP VBScript comment QsciLexerHTML*ASP VBScript StandardASP VBScript default QsciLexerHTML.ASP VBScript BezeichnerASP VBScript identifier QsciLexerHTML4ASP VBScript SchlsselwortASP VBScript keyword QsciLexerHTML"ASP VBScript ZahlASP VBScript number QsciLexerHTML2ASP VBScript ZeichenketteASP VBScript string QsciLexerHTMLHASP VBScript Unbeendete ZeichenketteASP VBScript unclosed string QsciLexerHTML(ASP X-Code KommentarASP X-Code comment QsciLexerHTMLAttribut Attribute QsciLexerHTML CDATACDATA QsciLexerHTMLTagende End of a tag QsciLexerHTML2Ende eines XML FragmentesEnd of an XML fragment QsciLexerHTMLEntittEntity QsciLexerHTMLdKommentar des ersten Parameters eines SGML Befehls*First parameter comment of an SGML command QsciLexerHTMLFErster Parameter eines SGML Befehls"First parameter of an SGML command QsciLexerHTMLHTML Kommentar HTML comment QsciLexerHTMLHTML Standard HTML default QsciLexerHTMLLHTML Zeichenkette in AnfhrungszeichenHTML double-quoted string QsciLexerHTMLHTML Zahl HTML number QsciLexerHTML@HTML Zeichenkette in HochkommataHTML single-quoted string QsciLexerHTML@JavaDoc ASP JavaScript Kommentar$JavaDoc style ASP JavaScript comment QsciLexerHTML8JavaDoc JavaScript Kommentar JavaDoc style JavaScript comment QsciLexerHTML(JavaScript KommentarJavaScript comment QsciLexerHTML&JavaScript StandardJavaScript default QsciLexerHTMLXJavaScript Zeichenkette in AnfhrungszeichenJavaScript double-quoted string QsciLexerHTML0JavaScript SchlsselwortJavaScript keyword QsciLexerHTML4JavaScript ZeilenkommentarJavaScript line comment QsciLexerHTMLJavaScript ZahlJavaScript number QsciLexerHTML:JavaScript Regulrer AusdruckJavaScript regular expression QsciLexerHTMLLJavaScript Zeichenkette in HochkommataJavaScript single-quoted string QsciLexerHTML"JavaScript SymbolJavaScript symbol QsciLexerHTMLDJavaScript Unbeendete ZeichenketteJavaScript unclosed string QsciLexerHTMLJavaScript WortJavaScript word QsciLexerHTML2Anderer Text in einem TagOther text in a tag QsciLexerHTMLPHP Kommentar PHP comment QsciLexerHTMLPHP Standard PHP default QsciLexerHTMLJPHP Zeichenkette in AnfhrungszeichenPHP double-quoted string QsciLexerHTMLBPHP Variable in AnfhrungszeichenPHP double-quoted variable QsciLexerHTML"PHP Schlsselwort PHP keyword QsciLexerHTML&PHP ZeilenkommentarPHP line comment QsciLexerHTMLPHP Zahl PHP number QsciLexerHTMLPHP Operator PHP operator QsciLexerHTML>PHP Zeichenkette in HochkommataPHP single-quoted string QsciLexerHTMLPHP Variable PHP variable QsciLexerHTML$Python KlassennamePython class name QsciLexerHTML Python KommentarPython comment QsciLexerHTMLPython StandardPython default QsciLexerHTMLPPython Zeichenkette in AnfhrungszeichenPython double-quoted string QsciLexerHTMLFPython Funktions- oder MethodennamePython function or method name QsciLexerHTML"Python BezeichnerPython identifier QsciLexerHTML(Python SchlsselwortPython keyword QsciLexerHTMLPython Zahl Python number QsciLexerHTMLPython OperatorPython operator QsciLexerHTMLDPython Zeichenkette in HochkommataPython single-quoted string QsciLexerHTMLfPython Zeichenkette in dreifachen Anfhrungszeichen"Python triple double-quoted string QsciLexerHTMLZPython Zeichenkette in dreifachen Hochkommata"Python triple single-quoted string QsciLexerHTML$SGML StandardblockSGML block default QsciLexerHTMLSGML Befehl SGML command QsciLexerHTMLSGML Kommentar SGML comment QsciLexerHTMLSGML Standard SGML default QsciLexerHTMLLSGML Zeichenkette in AnfhrungszeichenSGML double-quoted string QsciLexerHTMLSGML Fehler SGML error QsciLexerHTML@SGML Zeichenkette in HochkommataSGML single-quoted string QsciLexerHTML,SGML Spezielle EntittSGML special entity QsciLexerHTMLSkript Tag Script tag QsciLexerHTMLDBeginn eines JavaScript FragmentesStart of a JavaScript fragment QsciLexerHTML6Beginn eines PHP FragmentesStart of a PHP fragment QsciLexerHTML<Beginn eines Python FragmentesStart of a Python fragment QsciLexerHTML@Beginn eines VBScript FragmentesStart of a VBScript fragment QsciLexerHTMLLBeginn eines ASP JavaScript Fragmentes#Start of an ASP JavaScript fragment QsciLexerHTMLDBeginn eines ASP Python FragmentesStart of an ASP Python fragment QsciLexerHTMLHBeginn eines ASP VBScript Fragmentes!Start of an ASP VBScript fragment QsciLexerHTML6Beginn eines ASP FragmentesStart of an ASP fragment QsciLexerHTMLBBeginn eines ASP Fragmentes mit @Start of an ASP fragment with @ QsciLexerHTML6Beginn eines XML FragmentesStart of an XML fragment QsciLexerHTMLTagTag QsciLexerHTML(Unbekanntes AttributUnknown attribute QsciLexerHTMLUnbekanntes Tag Unknown tag QsciLexerHTML@HTML Wert ohne AnfhrungszeichenUnquoted HTML value QsciLexerHTML$VBScript KommentarVBScript comment QsciLexerHTML"VBScript StandardVBScript default QsciLexerHTML&VBScript BezeichnerVBScript identifier QsciLexerHTML,VBScript SchlsselwortVBScript keyword QsciLexerHTMLVBScript ZahlVBScript number QsciLexerHTML*VBScript ZeichenketteVBScript string QsciLexerHTML@VBScript Unbeendete ZeichenketteVBScript unclosed string QsciLexerHTMLUUIDUUID QsciLexerIDLBlockkommentar Block comment QsciLexerJSONStandardDefault QsciLexerJSONEscape-SequenzEscape sequence QsciLexerJSONIRIIRI QsciLexerJSON$JSON Schlsselwort JSON keyword QsciLexerJSON*JSON-LD kompaktes IRIJSON-LD compact IRI QsciLexerJSON*JSON-LD SchlsselwortJSON-LD keyword QsciLexerJSONZeilenkommentar Line comment QsciLexerJSONZahlNumber QsciLexerJSONOperatorOperator QsciLexerJSONAnalysefehler Parsing error QsciLexerJSONEigenschaftProperty QsciLexerJSONZeichenketteString QsciLexerJSON.Unbeendete ZeichenketteUnclosed string QsciLexerJSON$Regulrer AusdruckRegular expressionQsciLexerJavaScriptBasisfunktionenBasic functions QsciLexerLuaZeichen Character QsciLexerLuaKommentarComment QsciLexerLuaJKoroutinen, I/O- und Systemfunktionen%Coroutines, i/o and system facilities QsciLexerLuaStandardDefault QsciLexerLuaBezeichner Identifier QsciLexerLuaSchlsselwortKeyword QsciLexerLua MarkeLabel QsciLexerLuaZeilenkommentar Line comment QsciLexerLua:Uninterpretierte ZeichenketteLiteral string QsciLexerLuaZahlNumber QsciLexerLuaOperatorOperator QsciLexerLuaPrprozessor Preprocessor QsciLexerLuaZeichenketteString QsciLexerLuajZeichenketten-, Tabelle- und mathematische Funktionen!String, table and maths functions QsciLexerLua.Unbeendete ZeichenketteUnclosed string QsciLexerLua$Nutzer definiert 1User defined 1 QsciLexerLua$Nutzer definiert 2User defined 2 QsciLexerLua$Nutzer definiert 3User defined 3 QsciLexerLua$Nutzer definiert 4User defined 4 QsciLexerLuaKommentarCommentQsciLexerMakefileStandardDefaultQsciLexerMakefile FehlerErrorQsciLexerMakefileOperatorOperatorQsciLexerMakefilePrprozessor PreprocessorQsciLexerMakefileZielTargetQsciLexerMakefileVariableVariableQsciLexerMakefileBlockzitat Block quoteQsciLexerMarkdown.Code zwischen BackticksCode between backticksQsciLexerMarkdownBCode zwischen doppelten BackticksCode between double backticksQsciLexerMarkdownCodeblock Code blockQsciLexerMarkdownStandardDefaultQsciLexerMarkdownJKursive Schrift mit einfachen SternenEmphasis using single asterisksQsciLexerMarkdownVKursive Schrift mit einfachen Unterstrichen!Emphasis using single underscoresQsciLexerMarkdown"Horizontale LinieHorizontal ruleQsciLexerMarkdown&berschrift Ebene 1Level 1 headerQsciLexerMarkdown&berschrift Ebene 2Level 2 headerQsciLexerMarkdown&berschrift Ebene 3Level 3 headerQsciLexerMarkdown&berschrift Ebene 4Level 4 headerQsciLexerMarkdown&berschrift Ebene 5Level 5 headerQsciLexerMarkdown&berschrift Ebene 6Level 6 headerQsciLexerMarkdownHyperlinkLinkQsciLexerMarkdown4Nummeriertes ListenelementOrdered list itemQsciLexerMarkdown$EinleitungszeichenPre-charQsciLexerMarkdownSpezialSpecialQsciLexerMarkdownDurchgestrichen Strike outQsciLexerMarkdownBFettschrift mit doppelten Sternen&Strong emphasis using double asterisksQsciLexerMarkdownNFettschrift mit doppelten Unterstrichen(Strong emphasis using double underscoresQsciLexerMarkdown@Nicht nummeriertes ListenelementUnordered list itemQsciLexerMarkdown BefehlCommandQsciLexerMatlabKommentarCommentQsciLexerMatlabStandardDefaultQsciLexerMatlabBZeichenkette in AnfhrungszeichenDouble-quoted stringQsciLexerMatlabBezeichner IdentifierQsciLexerMatlabSchlsselwortKeywordQsciLexerMatlabZahlNumberQsciLexerMatlabOperatorOperatorQsciLexerMatlab6Zeichenkette in HochkommataSingle-quoted stringQsciLexerMatlabKommentarComment QsciLexerPOStandardDefault QsciLexerPOMarkierungFlags QsciLexerPO"Unschrfmarkierung Fuzzy flag QsciLexerPOMeldungskontextMessage context QsciLexerPO&MeldungskontexttextMessage context text QsciLexerPO<Meldungskontexttext Zeilenende Message context text end-of-line QsciLexerPO$MeldungsbezeichnerMessage identifier QsciLexerPO,MeldungsbezeichnertextMessage identifier text QsciLexerPOBMeldungsbezeichnertext Zeilenende#Message identifier text end-of-line QsciLexerPO(MeldungszeichenketteMessage string QsciLexerPO2MeldungszeichenkettentextMessage string text QsciLexerPOHMeldungszeichenkettentext ZeilenendeMessage string text end-of-line QsciLexerPO,ProgrammiererkommentarProgrammer comment QsciLexerPOReferenz Reference QsciLexerPO&Ungltige Direktive Bad directive QsciLexerPOVKommentarComment QsciLexerPOVKommentarzeile Comment line QsciLexerPOVStandardDefault QsciLexerPOVDirektive Directive QsciLexerPOVBezeichner Identifier QsciLexerPOVZahlNumber QsciLexerPOV8Objekte, CSG und ErscheinungObjects, CSG and appearance QsciLexerPOVOperatorOperator QsciLexerPOV,Vordefinierte FunktionPredefined functions QsciLexerPOV2Vordefinierter BezeichnerPredefined identifiers QsciLexerPOVZeichenketteString QsciLexerPOV:Typen, Modifizierer und ItemsTypes, modifiers and items QsciLexerPOV.Unbeendete ZeichenketteUnclosed string QsciLexerPOV$Nutzer definiert 1User defined 1 QsciLexerPOV$Nutzer definiert 2User defined 2 QsciLexerPOV$Nutzer definiert 3User defined 3 QsciLexerPOV*'(* ... *)' Kommentar'(* ... *)' style commentQsciLexerPascal<'(*$ ... *)' Prprozessorblock&'(*$ ... *)' style pre-processor blockQsciLexerPascal&'{ ... }' Kommentar'{ ... }' style commentQsciLexerPascal8'{$ ... }' Prprozessorblock$'{$ ... }' style pre-processor blockQsciLexerPascalZeichen CharacterQsciLexerPascalStandardDefaultQsciLexerPascal"Hexadezimale ZahlHexadecimal numberQsciLexerPascalBezeichner IdentifierQsciLexerPascal Inline Assembler Inline asmQsciLexerPascalSchlsselwortKeywordQsciLexerPascalZeilenkommentar Line commentQsciLexerPascalZahlNumberQsciLexerPascalOperatorOperatorQsciLexerPascal6Zeichenkette in HochkommataSingle-quoted stringQsciLexerPascal.Unbeendete ZeichenketteUnclosed stringQsciLexerPascalFeldArray QsciLexerPerl4Here Dokument in BackticksBacktick here document QsciLexerPerlfHere Dokument in Backticks (interpolierte Variable).Backtick here document (interpolated variable) QsciLexerPerlBackticks Backticks QsciLexerPerlDBackticks (interpolierte Variable)!Backticks (interpolated variable) QsciLexerPerlKommentarComment QsciLexerPerlDatensektion Data section QsciLexerPerlStandardDefault QsciLexerPerlDHere Dokument in AnfhrungszeichenDouble-quoted here document QsciLexerPerlvHere Dokument in Anfhrungszeichen (interpolierte Variable)3Double-quoted here document (interpolated variable) QsciLexerPerlBZeichenkette in AnfhrungszeichenDouble-quoted string QsciLexerPerltZeichenkette in Anfhrungszeichen (interpolierte Variable),Double-quoted string (interpolated variable) QsciLexerPerl FehlerError QsciLexerPerlFormatzweig Format body QsciLexerPerl&FormatidentifikatorFormat identifier QsciLexerPerlHashHash QsciLexerPerl.Here Dokument-BegrenzerHere document delimiter QsciLexerPerlBezeichner Identifier QsciLexerPerlSchlsselwortKeyword QsciLexerPerlZahlNumber QsciLexerPerlOperatorOperator QsciLexerPerlPODPOD QsciLexerPerlPOD wrtlich POD verbatim QsciLexerPerl Zeichenkette (q)Quoted string (q) QsciLexerPerl"Zeichenkette (qq)Quoted string (qq) QsciLexerPerlRZeichenkette (qq, interpolierte Variable))Quoted string (qq, interpolated variable) QsciLexerPerl"Zeichenkette (qr)Quoted string (qr) QsciLexerPerlRZeichenkette (qr, interpolierte Variable))Quoted string (qr, interpolated variable) QsciLexerPerl"Zeichenkette (qw)Quoted string (qw) QsciLexerPerl"Zeichenkette (qx)Quoted string (qx) QsciLexerPerlRZeichenkette (qx, interpolierte Variable))Quoted string (qx, interpolated variable) QsciLexerPerl$Regulrer AusdruckRegular expression QsciLexerPerlVRegulrer Ausdruck (interpolierte Variable)*Regular expression (interpolated variable) QsciLexerPerl SkalarScalar QsciLexerPerl8Here Dokument in HochkommataSingle-quoted here document QsciLexerPerl6Zeichenkette in HochkommataSingle-quoted string QsciLexerPerl(Subroutinen PrototypSubroutine prototype QsciLexerPerlErsetzung Substitution QsciLexerPerlDErsetzung (interpolierte Variable)$Substitution (interpolated variable) QsciLexerPerlSymboltabelle Symbol table QsciLexerPerlbersetzung Translation QsciLexerPerlFeldklammernArray parenthesisQsciLexerPostScriptFUngltiges Zeichen fr ZeichenketteBad string characterQsciLexerPostScript&Base85 Zeichenkette Base85 stringQsciLexerPostScriptKommentarCommentQsciLexerPostScriptDSC Kommentar DSC commentQsciLexerPostScript"DSC KommentarwertDSC comment valueQsciLexerPostScriptStandardDefaultQsciLexerPostScript&Dictionary-KlammernDictionary parenthesisQsciLexerPostScript2Hexadezimale ZeichenketteHexadecimal stringQsciLexerPostScript6Direkt ausgefhrtes LiteralImmediately evaluated literalQsciLexerPostScriptSchlsselwortKeywordQsciLexerPostScriptLiteralLiteralQsciLexerPostScriptNameNameQsciLexerPostScriptZahlNumberQsciLexerPostScript ProzedurklammernProcedure parenthesisQsciLexerPostScriptTextTextQsciLexerPostScriptZuweisung AssignmentQsciLexerPropertiesKommentarCommentQsciLexerPropertiesStandardDefaultQsciLexerPropertiesStandardwert Default valueQsciLexerPropertiesSchlsselKeyQsciLexerPropertiesAbschnittSectionQsciLexerPropertiesKlassenname Class nameQsciLexerPythonKommentarCommentQsciLexerPythonKommentarblock Comment blockQsciLexerPythonDekorator DecoratorQsciLexerPythonStandardDefaultQsciLexerPythonBZeichenkette in AnfhrungszeichenDouble-quoted stringQsciLexerPython8Funktions- oder MethodennameFunction or method nameQsciLexerPython4Hervorgehobener BezeichnerHighlighted identifierQsciLexerPythonBezeichner IdentifierQsciLexerPythonSchlsselwortKeywordQsciLexerPythonZahlNumberQsciLexerPythonOperatorOperatorQsciLexerPython6Zeichenkette in HochkommataSingle-quoted stringQsciLexerPythonXZeichenkette in dreifachen AnfhrungszeichenTriple double-quoted stringQsciLexerPythonLZeichenkette in dreifachen HochkommataTriple single-quoted stringQsciLexerPython.Unbeendete ZeichenketteUnclosed stringQsciLexerPython%Q Zeichenkette %Q string QsciLexerRuby%q Zeichenkette %q string QsciLexerRuby%r Zeichenkette %r string QsciLexerRuby%w Zeichenkette %w string QsciLexerRuby%x Zeichenkette %x string QsciLexerRubyBackticks Backticks QsciLexerRubyKlassenname Class name QsciLexerRubyKlassenvariableClass variable QsciLexerRubyKommentarComment QsciLexerRubyDatensektion Data section QsciLexerRubyStandardDefault QsciLexerRuby:zurckgestuftes SchlsselwortDemoted keyword QsciLexerRubyBZeichenkette in AnfhrungszeichenDouble-quoted string QsciLexerRuby FehlerError QsciLexerRuby8Funktions- oder MethodennameFunction or method name QsciLexerRuby GlobalGlobal QsciLexerRubyHere Dokument Here document QsciLexerRuby.Here Dokument-BegrenzerHere document delimiter QsciLexerRubyBezeichner Identifier QsciLexerRubyInstanzvariableInstance variable QsciLexerRubySchlsselwortKeyword QsciLexerRubyModulname Module name QsciLexerRubyZahlNumber QsciLexerRubyOperatorOperator QsciLexerRubyPODPOD QsciLexerRuby$Regulrer AusdruckRegular expression QsciLexerRuby6Zeichenkette in HochkommataSingle-quoted string QsciLexerRuby SymbolSymbol QsciLexerRuby Stderrstderr QsciLexerRuby Stdinstdin QsciLexerRuby Stdoutstdout QsciLexerRuby # Kommentarzeile# comment line QsciLexerSQLKommentarComment QsciLexerSQLKommentarzeile Comment line QsciLexerSQLStandardDefault QsciLexerSQLBZeichenkette in AnfhrungszeichenDouble-quoted string QsciLexerSQLBezeichner Identifier QsciLexerSQL*JavaDoc SchlsselwortJavaDoc keyword QsciLexerSQL6JavaDoc SchlsselwortfehlerJavaDoc keyword error QsciLexerSQL"JavaDoc KommentarJavaDoc style comment QsciLexerSQLSchlsselwortKeyword QsciLexerSQLZahlNumber QsciLexerSQLOperatorOperator QsciLexerSQL>Bezeichner in AnfhrungszeichenQuoted identifier QsciLexerSQL:Operator in AnfhrungszeichenQuoted operator QsciLexerSQL$SQL*Plus KommentarSQL*Plus comment QsciLexerSQL,SQL*Plus SchlsselwortSQL*Plus keyword QsciLexerSQL SQL*Plus EingabeSQL*Plus prompt QsciLexerSQL6Zeichenkette in HochkommataSingle-quoted string QsciLexerSQL$Nutzer definiert 1User defined 1 QsciLexerSQL$Nutzer definiert 2User defined 2 QsciLexerSQL$Nutzer definiert 3User defined 3 QsciLexerSQL$Nutzer definiert 4User defined 4 QsciLexerSQL BefehlCommandQsciLexerSpiceKommentarCommentQsciLexerSpiceStandardDefaultQsciLexerSpiceDelimiter DelimiterQsciLexerSpiceFunktionFunctionQsciLexerSpiceBezeichner IdentifierQsciLexerSpiceZahlNumberQsciLexerSpiceParameter ParameterQsciLexerSpiceWertValueQsciLexerSpice KlammerersetzungBrace substitution QsciLexerTCLKommentarComment QsciLexerTCLKommentarblock Comment block QsciLexerTCLKommentarbox Comment box QsciLexerTCLKommentarzeile Comment line QsciLexerTCLStandardDefault QsciLexerTCL2ErweiterungsschlsselwortExpand keyword QsciLexerTCLBezeichner Identifier QsciLexerTCLModifiziererModifier QsciLexerTCLZahlNumber QsciLexerTCLOperatorOperator QsciLexerTCL2angefhrtes SchlsselwortQuoted keyword QsciLexerTCLZeichenkette Quoted string QsciLexerTCLErsetzung Substitution QsciLexerTCL"TCL Schlsselwort TCL keyword QsciLexerTCLTk Befehl Tk command QsciLexerTCL Tk Schlsselwort Tk keyword QsciLexerTCL$Nutzer definiert 1User defined 1 QsciLexerTCL$Nutzer definiert 2User defined 2 QsciLexerTCL$Nutzer definiert 3User defined 3 QsciLexerTCL$Nutzer definiert 4User defined 4 QsciLexerTCL$iTCL Schlsselwort iTCL keyword QsciLexerTCL BefehlCommand QsciLexerTeXStandardDefault QsciLexerTeX GruppeGroup QsciLexerTeXSpezialSpecial QsciLexerTeX SymbolSymbol QsciLexerTeXTextText QsciLexerTeXAttribut Attribute QsciLexerVHDLKommentarComment QsciLexerVHDLKommentarblock Comment block QsciLexerVHDLKommentarzeile Comment line QsciLexerVHDLStandardDefault QsciLexerVHDLBezeichner Identifier QsciLexerVHDLSchlsselwortKeyword QsciLexerVHDLZahlNumber QsciLexerVHDLOperatorOperator QsciLexerVHDL StandardfunktionStandard function QsciLexerVHDL StandardoperatorStandard operator QsciLexerVHDLStandardpaketStandard package QsciLexerVHDLStandardtyp Standard type QsciLexerVHDLZeichenketteString QsciLexerVHDL.Unbeendete ZeichenketteUnclosed string QsciLexerVHDL Nutzer definiert User defined QsciLexerVHDLBang Kommentar Bang commentQsciLexerVerilogKommentarCommentQsciLexerVerilogStandardDefaultQsciLexerVerilogBezeichner IdentifierQsciLexerVerilog<Inaktive EingabeportdefinitionInactive input port declarationQsciLexerVerilogFInaktive Ein-/Ausgabeportdefinition&Inactive input/output port declarationQsciLexerVerilog@Inaktiver SchlsselwortkommentarInactive keyword commentQsciLexerVerilog<Inaktive Ausgabeportdefinition Inactive output port declarationQsciLexerVerilog.Inaktive PortverbindungInactive port connectionQsciLexerVerilog*EingabeportdefinitionInput port declarationQsciLexerVerilog4Ein-/AusgabeportdefinitionInput/output port declarationQsciLexerVerilog,SchlsselwortkommentarKeyword commentQsciLexerVerilogZeilenkommentar Line commentQsciLexerVerilogZahlNumberQsciLexerVerilogOperatorOperatorQsciLexerVerilog*AusgabeportdefinitionOutput port declarationQsciLexerVerilogPortverbindungPort connectionQsciLexerVerilog"PrprozessorblockPreprocessor blockQsciLexerVerilogLPrimre Schlusselwrter und Bezeichner Primary keywords and identifiersQsciLexerVerilogPSekundre Schlusselwrter und Bezeichner"Secondary keywords and identifiersQsciLexerVerilogZeichenketteStringQsciLexerVerilogSystemtask System taskQsciLexerVerilog.Unbeendete ZeichenketteUnclosed stringQsciLexerVerilogJNutzerdefinierte Tasks und Bezeichner"User defined tasks and identifiersQsciLexerVerilogKommentarComment QsciLexerYAMLStandardDefault QsciLexerYAML"DokumentbegrenzerDocument delimiter QsciLexerYAMLBezeichner Identifier QsciLexerYAMLSchlsselwortKeyword QsciLexerYAMLZahlNumber QsciLexerYAMLOperatorOperator QsciLexerYAMLReferenz Reference QsciLexerYAML.Syntaxfehler MarkierungSyntax error marker QsciLexerYAML(Textblock MarkierungText block marker QsciLexerYAML&Kopieren&Copy QsciScintillaEin&fgen&Paste QsciScintilla"Wieder&herstellen&Redo QsciScintilla&Rckgngig&Undo QsciScintilla&AusschneidenCu&t QsciScintillaLschenDelete QsciScintillaAlle auswhlen Select All QsciScintillasqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_de.ts000066400000000000000000004345621316047212700240430ustar00rootroot00000000000000 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 Instance property Instanz-Eigenschaft 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 QsciLexerJSON Default Standard Number Zahl String Zeichenkette Unclosed string Unbeendete Zeichenkette Property Eigenschaft Escape sequence Escape-Sequenz Line comment Zeilenkommentar Block comment Blockkommentar Operator Operator IRI IRI JSON-LD compact IRI JSON-LD kompaktes IRI JSON keyword JSON Schlüsselwort JSON-LD keyword JSON-LD Schlüsselwort Parsing error Analysefehler 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 QsciLexerMarkdown Default Standard Special Spezial Strong emphasis using double asterisks Fettschrift mit doppelten Sternen Strong emphasis using double underscores Fettschrift mit doppelten Unterstrichen Emphasis using single asterisks Kursive Schrift mit einfachen Sternen Emphasis using single underscores Kursive Schrift mit einfachen Unterstrichen Level 1 header Überschrift Ebene 1 Level 2 header Überschrift Ebene 2 Level 3 header Überschrift Ebene 3 Level 4 header Überschrift Ebene 4 Level 5 header Überschrift Ebene 5 Level 6 header Überschrift Ebene 6 Pre-char Einleitungszeichen Unordered list item Nicht nummeriertes Listenelement Ordered list item Nummeriertes Listenelement Block quote Blockzitat Strike out Durchgestrichen Horizontal rule Horizontale Linie Link Hyperlink Code between backticks Code zwischen Backticks Code between double backticks Code zwischen doppelten Backticks Code block Codeblock 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_es.qm000066400000000000000000002330301316047212700240340ustar00rootroot00000000000000M#VEip4~zڴ1,/,ۅȔ%Qo oe-U&^y 5'Kc/C3\:D=ZFkyߧR5 e6wt7Nwtf<wtp<wtV{1t{#tij|4ŗ%$QA>^l"/WÒu4Dmmmcm 9P> AZtlsX{ѵ@  'ramՋ.\_`_pIE@U6 Q!X# Nh.dufMh2 eU }b _I4wQ 9U pӫ;%/dSV@ ,Bu.[O-7 q<9tV7WmDU4$@"Mf4{FgK$ro7T8`c?J353^$%N4%_Qe[!b[u fe!l&E ZkG^ IcR [thx,th ~ŰV:8(T 4>Iu-X|zx'scnPR H  vx66ct T~$<*t1,_z@Av9@A@A@A}@A@Bv@B@BS@B@Bz@Cv@CG@Cʹ@C?@C@D@D@D <AcBtHn[p\8:R\8>L\8D\8Z\8m\8t;\8|}\8\8\8\8,\8P\8ۃ\8\8e\8V\8\8y\8\8 \8\8Ek*r\trn_rs:vB`{:G^ ?DL59 5=5I5j.5s5{Q5F5r55)555#5525O5 55GE~GuJGGTGGGVʂ9\9\ :4v|Eڧt&'qΒ)n,*g8V<?^t:]u0_p7 o?C3}\}m}|d('.x=#Ȑ:Ȑ>ȐB&ȐZȐc`ȐmTȐtlȐ|ȐȐȐȐ5ȐȐ҆Ȑ۷ȐȐȐȐȐ MȐȐyѽ8Kĝԇ@9Vwb%Z")6%)*yYaa4F5tj6|8 @E%C_ub]zd*d*id*d*Cibm;$LwMwtLYf܌~&k[ED _E6&@''&*+}3gu<.)YFky%KA\^]D>i1KCjjLo1(|^/B"p""QlTh~Ba~F,~e~N; 2cN22BɫS,7P`Iit2 ~U &0': &0'E 3 ?3 @|U- AU DQv f oY @t 2R T A7 ^ [" 88 < H ` i$ z  6     X$Ӷ = $kf i ,EZ WD 5B  4 =WU b 8 |  " '4G )O *S; *S$ *S +O4 0 FYu Iq>> S1 S ZU3 ^V d8w d8M d8 d8 d<< d<@h d<B d<x! d<y_ d<8 d< d< d< d< d< d<j d< d<} d< d< d<9 d< d< i d< d< d4G g$ h k,1 k, qe s( |G $n d R`i % B t7 tL J8 JCf J WL W fb j o=& o] o ' ,q h kT %W % A{  GJ X r '_ u $ x  .A  . E} '4/ 15 943t @&4 @*$ _ cbz0 t}49 t}4s t}4v t}4 t}4 t}4( wtW Xx \R a  ?D S Ig] Igos Igu Ig} Ig Ig3 Ig̠ Ig0 IgA Ig Ig J3 tW tk tT ut? ` .\ }na 9 N 5 yWPBL c X d'9 =eHIO ؠVW\B]geThw irldwg{-CRH&4N,?]d'o}]q#EB_o)w4Ʀgn`٤gLkC%|jys4 5+2Y2>@d"w#}we'[ϱ2c4+4/k846j9<3@Fky4RΒm%wu@;ku@Eu@m$q~2)tnE1T2$I#%(I9r8wiWCancelarCancel QsciCommand@Convertir seleccin a minsculasConvert selection to lower case QsciCommand@Convertir seleccin a maysculasConvert selection to upper case QsciCommand&Copiar lnea actualCopy current line QsciCommand Copiar seleccinCopy selection QsciCommand&Cortar lnea actualCut current line QsciCommand Cortar seleccin Cut selection QsciCommand<Deshacer un nivel de indentadoDe-indent one level QsciCommand2Borrar el carcter actualDelete current character QsciCommand&Borrar lnea actualDelete current line QsciCommand>Borrar lnea hacia la izquierdaDelete line to left QsciCommand:Borrar lnea hacia la derechaDelete line to right QsciCommand0Borrar carcter anteriorDelete previous character QsciCommandzBorrar carcter anterior si no est al principio de una lnea1Delete previous character if not at start of line QsciCommandtBorrar a la derecha hasta el final de la siguiente palabra Delete right to end of next word QsciCommandBBorrar palabra hacia la izquierdaDelete word to left QsciCommand>Borrar palabra hacia la derechaDelete word to right QsciCommand$Duplicar seleccinDuplicate selection QsciCommand*Duplicar lnea actualDuplicate the current line QsciCommandnExtender la seleccin rectangular una lnea hacia abajo*Extend rectangular selection down one line QsciCommandpExtender la seleccin rectangular una pgina hacia abajo*Extend rectangular selection down one page QsciCommandExtender la seleccin rectangular un carcter hacia la izquierda/Extend rectangular selection left one character QsciCommand|Extender la seleccin rectangular un carcter hacia la derecha0Extend rectangular selection right one character QsciCommandExtender seleccin rectangular al final de la lnea del documento4Extend rectangular selection to end of document line QsciCommandExtender seleccin rectangular al primer carcter visible en la lnea del documentoHExtend rectangular selection to first visible character in document line QsciCommandExtender seleccin rectangular al principio de la lnea del documento6Extend rectangular selection to start of document line QsciCommandpExtender la seleccin rectangular una lnea hacia arriba(Extend rectangular selection up one line QsciCommandrExtender la seleccin rectangular hacia arriba una pgina(Extend rectangular selection up one page QsciCommandVExtender la seleccin una lnea hacia abajoExtend selection down one line QsciCommandXExtender la seleccin hacia abajo una pginaExtend selection down one page QsciCommandXExtender la seleccin un prrafo hacia abajo#Extend selection down one paragraph QsciCommandhExtender la seleccin un carcter hacia la izquierda#Extend selection left one character QsciCommand`Extender la seleccin una palabra a la izquierdaExtend selection left one word QsciCommandrExtender la seleccin parte de una palabra a la izquierda#Extend selection left one word part QsciCommanddExtender la seleccin un carcter hacia la derecha$Extend selection right one character QsciCommand\Extender la seleccin una palabra a la derechaExtend selection right one word QsciCommandnExtender la seleccin parte de una palabra a la derecha$Extend selection right one word part QsciCommandfExtender seleccin al final de la lnea visualizada'Extend selection to end of display line QsciCommandExtender seleccin al final de la lnea visualizada o del documento3Extend selection to end of display or document line QsciCommandRExtender seleccin al final del documento#Extend selection to end of document QsciCommandjExtender seleccin al final de la lnea del documento(Extend selection to end of document line QsciCommandxExtender la seleccin hasta el final de la palabra siguiente$Extend selection to end of next word QsciCommanddExtender seleccin al final de la palabra anterior(Extend selection to end of previous word QsciCommandExtender seleccin al primer carcter de lnea visualizada o del documentoGExtend selection to first visible character in display or document line QsciCommandExtender seleccin al primer carcter visible en la lnea del documentoDesplazar una lnea hacia abajoMove down one line QsciCommand8Mover hacia abajo una pginaMove down one page QsciCommand@Desplazar un prrafo hacia abajoMove down one paragraph QsciCommandHMover un carcter hacia la izquierdaMove left one character QsciCommandHMover una palabra hacia la izquierdaMove left one word QsciCommandZMover parte de una palabra hacia la izquierdaMove left one word part QsciCommandDMover un carcter hacia la derechaMove right one character QsciCommandDMover una palabra hacia la derechaMove right one word QsciCommandVMover parte de una palabra hacia la derechaMove right one word part QsciCommandhMover las lneas seleccionadas una lnea hacia abajo!Move selected lines down one line QsciCommandjMover las lneas seleccionadas una lnea hacia arribaMove selected lines up one line QsciCommandLMover al final de la lnea visualizadaMove to end of display line QsciCommandlMover al final de la lnea visualizada o del documento'Move to end of display or document line QsciCommand8Mover al final del documentoMove to end of document QsciCommandPMover al final de la lnea del documentoMove to end of document line QsciCommandLMover al final de la palabra siguienteMove to end of next word QsciCommandDMover al final de palabra anteriorMove to end of previous word QsciCommandtMover al primer carcter visible en la lnea del documento0Move to first visible character in document line QsciCommandExtender seleccin al primer carcter visualizado en la lnea del documento;Move to first visible character of display in document line QsciCommandTMover al principio de la lnea visualizadaMove to start of display line QsciCommandtMover al principio de la lnea visualizada o del documento)Move to start of display or document line QsciCommand@Mover al principio del documentoMove to start of document QsciCommandXMover al principio de la lnea del documentoMove to start of document line QsciCommand@Desplazar una lnea hacia arribaMove up one line QsciCommand:Mover hacia arriba una pginaMove up one page QsciCommandBDesplazar un prrafo hacia arribaMove up one paragraph QsciCommand PegarPaste QsciCommand,Rehacer ltimo comandoRedo last command QsciCommand@Desplazar al final del documentoScroll to end of document QsciCommandHDesplazar al principio del documentoScroll to start of document QsciCommandhDesplazar verticalmente al centro de la lnea actual(Scroll vertically to centre current line QsciCommandPDesplazar la vista una lnea hacia abajoScroll view down one line QsciCommandRDesplazar la vista una lnea hacia arribaScroll view up one line QsciCommand Seleccionar todo Select all QsciCommandrExtender progresivamente seleccin hacia abajo una pgina(Stuttered extend selection down one page QsciCommandtExtender progresivamente seleccin hacia arriba una pgina&Stuttered extend selection up one page QsciCommandXMover progresivamente una pgina hacia abajoStuttered move down one page QsciCommandZMover progresivamente una pgina hacia arribaStuttered move up one page QsciCommand>Conmutar insertar/sobreescribirToggle insert/overtype QsciCommandFTransponer lneas actual y anterior$Transpose current and previous lines QsciCommand.Deshacer ltimo comandoUndo last command QsciCommandAumentar zoomZoom in QsciCommandDisminuir zoomZoom out QsciCommand(Comentario de bloque Block comment QsciLexerAVS(Propiedad de recorte Clip property QsciLexerAVSPor defectoDefault QsciLexerAVS4Cadena con comillas doblesDouble-quoted string QsciLexerAVS FiltroFilter QsciLexerAVSFuncinFunction QsciLexerAVSIdentificador Identifier QsciLexerAVSPalabra claveKeyword QsciLexerAVS&Comentario de lnea Line comment QsciLexerAVS8Comentario de bloque anidadoNested block comment QsciLexerAVS NmeroNumber QsciLexerAVSOperadorOperator QsciLexerAVS PluginPlugin QsciLexerAVS>Cadena con triple comilla dobleTriple double-quoted string QsciLexerAVS.Definido por el usuario User defined QsciLexerAVSComilla inversa Backticks QsciLexerBashComentarioComment QsciLexerBashPor defectoDefault QsciLexerBash4Cadena con comillas doblesDouble-quoted string QsciLexerBash ErrorError QsciLexerBashdDelimitador de documento integrado (here document)Here document delimiter QsciLexerBashIdentificador Identifier QsciLexerBashPalabra claveKeyword QsciLexerBash NmeroNumber QsciLexerBashOperadorOperator QsciLexerBash.Expansin de parmetrosParameter expansion QsciLexerBashEscalarScalar QsciLexerBashlDocumento integrado (here document) con comilla simpleSingle-quoted here document QsciLexerBash6Cadena con comillas simplesSingle-quoted string QsciLexerBashComentarioCommentQsciLexerBatchPor defectoDefaultQsciLexerBatchComando externoExternal commandQsciLexerBatch:Ocultar caracteres de comandoHide command characterQsciLexerBatchPalabra claveKeywordQsciLexerBatchEtiquetaLabelQsciLexerBatchOperadorOperatorQsciLexerBatchVariableVariableQsciLexerBatchComentarioCommentQsciLexerCMakePor defectoDefaultQsciLexerCMakeBloque FOREACH FOREACH blockQsciLexerCMakeFuncinFunctionQsciLexerCMakeBloque IFIF blockQsciLexerCMakeEtiquetaLabelQsciLexerCMakeDCadena con comillas a la izquierdaLeft quoted stringQsciLexerCMakeBloque MACRO MACRO blockQsciLexerCMake NmeroNumberQsciLexerCMake@Cadena con comillas a la derechaRight quoted stringQsciLexerCMake(Cadena de caracteresStringQsciLexerCMake.Definido por el usuario User definedQsciLexerCMakeVariableVariableQsciLexerCMake,Variable en una cadenaVariable within a stringQsciLexerCMakeBloque WHILE WHILE blockQsciLexerCMakeComentario C C comment QsciLexerCPP"Cadena C# textualC# verbatim string QsciLexerCPPComentario C++ C++ comment QsciLexerCPP&Cadena en bruto C++C++ raw string QsciLexerCPPPor defectoDefault QsciLexerCPP4Cadena con comillas doblesDouble-quoted string QsciLexerCPP&Secuencia de escapeEscape sequence QsciLexerCPP4Clases globales y typedefsGlobal classes and typedefs QsciLexerCPPIDL UUIDIDL UUID QsciLexerCPPIdentificador Identifier QsciLexerCPP*Comentario C inactivoInactive C comment QsciLexerCPP4Cadena C# textual inactivaInactive C# verbatim string QsciLexerCPP.Comentario C++ inactivoInactive C++ comment QsciLexerCPP&Cadena inactiva C++Inactive C++ raw string QsciLexerCPP"IDL UUID inactivoInactive IDL UUID QsciLexerCPPBPalabra clave de JavaDoc inactivaInactive JavaDoc keyword QsciLexerCPPTError en palabra clave de Javadoc inactivoInactive JavaDoc keyword error QsciLexerCPPHComentario C estilo JavaDoc inactivo Inactive JavaDoc style C comment QsciLexerCPPLComentario C++ estilo JavaDoc inactivo"Inactive JavaDoc style C++ comment QsciLexerCPPfComentario de preprocesador estilo JavaDoc inactivo,Inactive JavaDoc style pre-processor comment QsciLexerCPPJExpresin regular JavaScript inactiva&Inactive JavaScript regular expression QsciLexerCPPXCadena Pike con hash entrecomillado inactiva Inactive Pike hash-quoted string QsciLexerCPP^Cadena Vala con triple comilla textual inactiva+Inactive Vala triple-quoted verbatim string QsciLexerCPP(Por defecto inactivoInactive default QsciLexerCPPBCadena con doble comilla inactivaInactive double-quoted string QsciLexerCPP8Secuencia de escape inactivaInactive escape sequence QsciLexerCPPHClases globales y typedefs inactivos$Inactive global classes and typedefs QsciLexerCPP,Identificador inactivoInactive identifier QsciLexerCPP,Palabra clave inactivaInactive keyword QsciLexerCPPNmero inactivoInactive number QsciLexerCPP"Operador inactivoInactive operator QsciLexerCPPLComentario C de preprocesador inactivo Inactive pre-processor C comment QsciLexerCPP@Bloque de preprocesador inactivoInactive pre-processor block QsciLexerCPPlIdentificadores y palabras clave secundarios inactivos+Inactive secondary keywords and identifiers QsciLexerCPPDCadena con comilla simple inactivaInactive single-quoted string QsciLexerCPP4Marcador de tarea inactivoInactive task marker QsciLexerCPP4Cadena sin cerrar inactivaInactive unclosed string QsciLexerCPPPLiteral inactivo definido por el usuarioInactive user-defined literal QsciLexerCPP0Palabra clave de JavadocJavaDoc keyword QsciLexerCPPBError en palabra clave de JavadocJavaDoc keyword error QsciLexerCPP<Comentario C de estilo JavaDocJavaDoc style C comment QsciLexerCPP@Comentario C++ de estilo JavaDocJavaDoc style C++ comment QsciLexerCPPTComentario de preprocesador estilo JavaDoc#JavaDoc style pre-processor comment QsciLexerCPP8Expresin regular JavaScriptJavaScript regular expression QsciLexerCPPPalabra claveKeyword QsciLexerCPP NmeroNumber QsciLexerCPPOperadorOperator QsciLexerCPPFCadena Pike con hash entrecomilladoPike hash-quoted string QsciLexerCPP:Comentario C de preprocesadorPre-processor C comment QsciLexerCPP.Bloque de preprocesadorPre-processor block QsciLexerCPPXIdentificadores y palabras clave secundarios"Secondary keywords and identifiers QsciLexerCPP6Cadena con comillas simplesSingle-quoted string QsciLexerCPP"Marcador de tarea Task marker QsciLexerCPP"Cadena sin cerrarUnclosed string QsciLexerCPP>Literal definido por el usuarioUser-defined literal QsciLexerCPPLCadena Vala con triple comilla textual"Vala triple-quoted verbatim string QsciLexerCPPRegla-@@-rule QsciLexerCSSAtributo Attribute QsciLexerCSSPropiedad CSS1 CSS1 property QsciLexerCSSPropiedad CSS2 CSS2 property QsciLexerCSSPropiedad CSS3 CSS3 property QsciLexerCSS"Selector de claseClass selector QsciLexerCSSPor defectoDefault QsciLexerCSS4Cadena con comillas doblesDouble-quoted string QsciLexerCSS.Propiedad CSS extendidaExtended CSS property QsciLexerCSS*Pseudoclase extendidaExtended pseudo-class QsciLexerCSS0Pseudoelemento extendidoExtended pseudo-element QsciLexerCSSSelector de ID ID selector QsciLexerCSSImportante Important QsciLexerCSS"Regla de '@media' Media rule QsciLexerCSSOperadorOperator QsciLexerCSSPseudoclase Pseudo-class QsciLexerCSSPseudoelementoPseudo-element QsciLexerCSS6Cadena con comillas simplesSingle-quoted string QsciLexerCSSEtiquetaTag QsciLexerCSS*Propiedad desconocidaUnknown property QsciLexerCSS.Pseudoclase desconocidaUnknown pseudo-class QsciLexerCSS ValorValue QsciLexerCSSVariableVariable QsciLexerCSSCadena textualVerbatim stringQsciLexerCSharp(Comentario de bloque Block commentQsciLexerCoffeeScript6Expresin regular de bloqueBlock regular expressionQsciLexerCoffeeScriptRComentario de expresin regular de bloque Block regular expression commentQsciLexerCoffeeScript"Cadena C# textualC# verbatim stringQsciLexerCoffeeScript0Comentario de estilo C++C++-style commentQsciLexerCoffeeScript,Comentario de estilo CC-style commentQsciLexerCoffeeScriptPor defectoDefaultQsciLexerCoffeeScript4Cadena con comillas doblesDouble-quoted stringQsciLexerCoffeeScriptClases globalesGlobal classesQsciLexerCoffeeScriptIDL UUIDIDL UUIDQsciLexerCoffeeScriptIdentificador IdentifierQsciLexerCoffeeScript,Propiedad de instanciaInstance propertyQsciLexerCoffeeScript@Comentario de estilo JavaDoc C++JavaDoc C++-style commentQsciLexerCoffeeScript<Comentario de estilo JavaDoc CJavaDoc C-style commentQsciLexerCoffeeScript0Palabra clave de JavaDocJavaDoc keywordQsciLexerCoffeeScriptBError en palabra clave de JavaDocJavaDoc keyword errorQsciLexerCoffeeScriptPalabra claveKeywordQsciLexerCoffeeScript NmeroNumberQsciLexerCoffeeScriptOperadorOperatorQsciLexerCoffeeScript.Bloque de preprocesadorPre-processor blockQsciLexerCoffeeScript"Expresin regularRegular expressionQsciLexerCoffeeScriptXIdentificadores y palabras clave secundarios"Secondary keywords and identifiersQsciLexerCoffeeScript2Cadena con comilla simpleSingle-quoted stringQsciLexerCoffeeScript"Cadena sin cerrarUnclosed stringQsciLexerCoffeeScript>Cadena con comillas hacia atrsBackquoted string QsciLexerD(Comentario de bloque Block comment QsciLexerDCarcter Character QsciLexerD$Palabra clave DDoc DDoc keyword QsciLexerD6Error en palabra clave DDOCDDoc keyword error QsciLexerD@Comentario de bloque estilo DDocDDoc style block comment QsciLexerD>Comentario de lnea estilo DDocDDoc style line comment QsciLexerDPor defectoDefault QsciLexerD<Palabra clave de documentacinDocumentation keyword QsciLexerDIdentificador Identifier QsciLexerDPalabra claveKeyword QsciLexerD&Comentario de lnea Line comment QsciLexerD$Comentario anidadoNesting comment QsciLexerD NmeroNumber QsciLexerDOperadorOperator QsciLexerDCadena en bruto Raw string QsciLexerD0Palabra clave secundariaSecondary keyword QsciLexerD(Cadena de caracteresString QsciLexerD$Definicin de tipoType definition QsciLexerD"Cadena sin cerrarUnclosed string QsciLexerD2Definido por el usuario 1User defined 1 QsciLexerD2Definido por el usuario 2User defined 2 QsciLexerD2Definido por el usuario 3User defined 3 QsciLexerDLnea aadida Added line QsciLexerDiff Lnea modificada Changed line QsciLexerDiffComandoCommand QsciLexerDiffComentarioComment QsciLexerDiffPor defectoDefault QsciLexerDiffEncabezadoHeader QsciLexerDiffPosicinPosition QsciLexerDiffLnea eliminada Removed line QsciLexerDiffComentarioCommentQsciLexerFortran77Continuacin ContinuationQsciLexerFortran77Por defectoDefaultQsciLexerFortran77"Operador punteadoDotted operatorQsciLexerFortran774Cadena con comillas doblesDouble-quoted stringQsciLexerFortran77"Funcin extendidaExtended functionQsciLexerFortran77Identificador IdentifierQsciLexerFortran77$Funcin intrnsecaIntrinsic functionQsciLexerFortran77Palabra claveKeywordQsciLexerFortran77EtiquetaLabelQsciLexerFortran77 NmeroNumberQsciLexerFortran77OperadorOperatorQsciLexerFortran77.Bloque de preprocesadorPre-processor blockQsciLexerFortran776Cadena con comillas simplesSingle-quoted stringQsciLexerFortran77"Cadena sin cerrarUnclosed stringQsciLexerFortran778Comentario de ASP JavaScriptASP JavaScript comment QsciLexerHTML4ASP JavaScript por defectoASP JavaScript default QsciLexerHTMLRCadena ASP JavaScript con comillas dobles#ASP JavaScript double-quoted string QsciLexerHTML8Palabra clave ASP JavaScriptASP JavaScript keyword QsciLexerHTMLJComentario de lnea de ASP JavaScriptASP JavaScript line comment QsciLexerHTML*Nmero ASP JavaScriptASP JavaScript number QsciLexerHTML@Expresin regular ASP JavaScript!ASP JavaScript regular expression QsciLexerHTMLTCadena ASP JavaScript con comillas simples#ASP JavaScript single-quoted string QsciLexerHTML,Smbolo ASP JavaScriptASP JavaScript symbol QsciLexerHTML@Cadena ASP JavaScript sin cerrarASP JavaScript unclosed string QsciLexerHTML,Palabra ASP JavaScriptASP JavaScript word QsciLexerHTML4Nombre de clase ASP PythonASP Python class name QsciLexerHTML*Comentario ASP PythonASP Python comment QsciLexerHTML,ASP Python por defectoASP Python default QsciLexerHTMLJCadena ASP Python con comillas doblesASP Python double-quoted string QsciLexerHTMLJNombre de mtodo o funcin ASP Python"ASP Python function or method name QsciLexerHTML0Identificador ASP PythonASP Python identifier QsciLexerHTML6Palabra clave de ASP PythonASP Python keyword QsciLexerHTML"Nmero ASP PythonASP Python number QsciLexerHTML&Operador ASP PythonASP Python operator QsciLexerHTMLLCadena ASP Python con comillas simplesASP Python single-quoted string QsciLexerHTMLTCadena ASP Python con triple comilla doble&ASP Python triple double-quoted string QsciLexerHTMLVCadena ASP Python con triple comilla simple&ASP Python triple single-quoted string QsciLexerHTML4Comentario de ASP VBScriptASP VBScript comment QsciLexerHTML0ASP VBScript por defectoASP VBScript default QsciLexerHTML4Identificador ASP VBScriptASP VBScript identifier QsciLexerHTML4Palabra clave ASP VBScriptASP VBScript keyword QsciLexerHTML&Nmero ASP VBScriptASP VBScript number QsciLexerHTMLBCadena de caracteres ASP VBScriptASP VBScript string QsciLexerHTML<Cadena ASP VBScript sin cerrarASP VBScript unclosed string QsciLexerHTML*Comentario ASP X-CodeASP X-Code comment QsciLexerHTMLAtributo Attribute QsciLexerHTML CDATACDATA QsciLexerHTML*Final de una etiqueta End of a tag QsciLexerHTML.Fin de un fragmento XMLEnd of an XML fragment QsciLexerHTMLEntidadEntity QsciLexerHTMLbComentario de primer parametro de un comando SGML*First parameter comment of an SGML command QsciLexerHTMLFPrimer parametro de un comando SGML"First parameter of an SGML command QsciLexerHTMLComentario HTML HTML comment QsciLexerHTML HTML por defecto HTML default QsciLexerHTML>Cadena HTML con comillas doblesHTML double-quoted string QsciLexerHTMLNmero HTML HTML number QsciLexerHTML@Cadena HTML con comillas simplesHTML single-quoted string QsciLexerHTMLVComentario ASP JavaScript de estilo JavaDoc$JavaDoc style ASP JavaScript comment QsciLexerHTMLNComentario JavaScript de estilo JavaDoc JavaDoc style JavaScript comment QsciLexerHTML*Comentario JavaScriptJavaScript comment QsciLexerHTML,JavaScript por defectoJavaScript default QsciLexerHTMLJCadena JavaScript con comillas doblesJavaScript double-quoted string QsciLexerHTML0Palabra clave JavaScriptJavaScript keyword QsciLexerHTMLBComentario de lnea de JavaScriptJavaScript line comment QsciLexerHTML"Nmero JavaScriptJavaScript number QsciLexerHTML8Expresin regular JavaScriptJavaScript regular expression QsciLexerHTMLLCadena JavaScript con comillas simplesJavaScript single-quoted string QsciLexerHTML$Smbolo JavaScriptJavaScript symbol QsciLexerHTML8Cadena JavaScript sin cerrarJavaScript unclosed string QsciLexerHTML$Palabra JavaScriptJavaScript word QsciLexerHTML4Otro texto en una etiquetaOther text in a tag QsciLexerHTMLComentario PHP PHP comment QsciLexerHTMLPHP por defecto PHP default QsciLexerHTML<Cadena PHP con comillas doblesPHP double-quoted string QsciLexerHTML@Variable PHP con comillas doblesPHP double-quoted variable QsciLexerHTML"Palabra clave PHP PHP keyword QsciLexerHTML.Comentario de lnea PHPPHP line comment QsciLexerHTMLNmero PHP PHP number QsciLexerHTMLOperador PHP PHP operator QsciLexerHTML>Cadena PHP con comillas simplesPHP single-quoted string QsciLexerHTMLVariable PHP PHP variable QsciLexerHTML,Nombre de clase PythonPython class name QsciLexerHTML"Comentario PythonPython comment QsciLexerHTML$Python por defectoPython default QsciLexerHTMLBCadena Python con comillas doblesPython double-quoted string QsciLexerHTMLBNombre de mtodo o funcin PythonPython function or method name QsciLexerHTML(Identificador PythonPython identifier QsciLexerHTML.Palabra clave de PythonPython keyword QsciLexerHTMLNmero Python Python number QsciLexerHTMLOperador PythonPython operator QsciLexerHTMLDCadena Python con comillas simplesPython single-quoted string QsciLexerHTMLLCadena Python con triple comilla doble"Python triple double-quoted string QsciLexerHTMLNCadena Python con triple comilla simple"Python triple single-quoted string QsciLexerHTML.Bloque SGML por defectoSGML block default QsciLexerHTMLComando SGML SGML command QsciLexerHTMLComentario SGML SGML comment QsciLexerHTML SGML por defecto SGML default QsciLexerHTML>Cadena SGML con comillas doblesSGML double-quoted string QsciLexerHTMLError SGML SGML error QsciLexerHTML@Cadena SGML con comillas simplesSGML single-quoted string QsciLexerHTML*Entidad SGML especialSGML special entity QsciLexerHTML$Etiqueta de script Script tag QsciLexerHTMLBInicio de un fragmento JavaScriptStart of a JavaScript fragment QsciLexerHTML4Inicio de un fragmento PHPStart of a PHP fragment QsciLexerHTML:Inicio de un fragmento PythonStart of a Python fragment QsciLexerHTML>Inicio de un fragmento VBScriptStart of a VBScript fragment QsciLexerHTMLPInicio de un fragmento de ASP JavaScript#Start of an ASP JavaScript fragment QsciLexerHTMLBInicio de un fragmento ASP PythonStart of an ASP Python fragment QsciLexerHTMLLInicio de un fragmento de ASP VBScript!Start of an ASP VBScript fragment QsciLexerHTML4Inicio de un fragmento ASPStart of an ASP fragment QsciLexerHTML@Inicio de un fragmento ASP con @Start of an ASP fragment with @ QsciLexerHTML4Inicio de un fragmento XMLStart of an XML fragment QsciLexerHTMLEtiquetaTag QsciLexerHTML(Atributo desconocidoUnknown attribute QsciLexerHTML(Etiqueta desconocida Unknown tag QsciLexerHTML.Valor HTML sin comillasUnquoted HTML value QsciLexerHTML&Comentario VBScriptVBScript comment QsciLexerHTML(VBScript por defectoVBScript default QsciLexerHTML,Identificador VBScriptVBScript identifier QsciLexerHTML,Palabra clave VBScriptVBScript keyword QsciLexerHTMLNmero VBScriptVBScript number QsciLexerHTML:Cadena de caracteres VBScriptVBScript string QsciLexerHTML4Cadena VBScript sin cerrarVBScript unclosed string QsciLexerHTMLUUIDUUID QsciLexerIDL(Comentario de bloque Block comment QsciLexerJSONPor defectoDefault QsciLexerJSON&Secuencia de escapeEscape sequence QsciLexerJSONIRIIRI QsciLexerJSON$Palabra clave JSON JSON keyword QsciLexerJSON&JSON-LD compact IRIJSON-LD compact IRI QsciLexerJSON*Palabra clave JSON-LDJSON-LD keyword QsciLexerJSON&Comentario de lnea Line comment QsciLexerJSON NmeroNumber QsciLexerJSONOperadorOperator QsciLexerJSON&Error de intrprete Parsing error QsciLexerJSONPropiedadProperty QsciLexerJSON CadenaString QsciLexerJSON"Cadena sin cerrarUnclosed string QsciLexerJSON"Expresin regularRegular expressionQsciLexerJavaScript"Funciones basicasBasic functions QsciLexerLuaCarcter Character QsciLexerLuaComentarioComment QsciLexerLuaNCo-rutinas, e/s y funciones del sistema%Coroutines, i/o and system facilities QsciLexerLuaPor defectoDefault QsciLexerLuaIdentificador Identifier QsciLexerLuaPalabra claveKeyword QsciLexerLuaEtiquetaLabel QsciLexerLua&Comentario de lnea Line comment QsciLexerLuaCadena literalLiteral string QsciLexerLua NmeroNumber QsciLexerLuaOperadorOperator QsciLexerLuaPreprocesador Preprocessor QsciLexerLua(Cadena de caracteresString QsciLexerLuaNFuncines de cadena, tabla y matemticas!String, table and maths functions QsciLexerLua"Cadena sin cerrarUnclosed string QsciLexerLua2Definido por el usuario 1User defined 1 QsciLexerLua2Definido por el usuario 2User defined 2 QsciLexerLua2Definido por el usuario 3User defined 3 QsciLexerLua2Definido por el usuario 4User defined 4 QsciLexerLuaComentarioCommentQsciLexerMakefilePor defectoDefaultQsciLexerMakefile ErrorErrorQsciLexerMakefileOperadorOperatorQsciLexerMakefilePreprocesador PreprocessorQsciLexerMakefileObjetivoTargetQsciLexerMakefileVariableVariableQsciLexerMakefileBloque de cita Block quoteQsciLexerMarkdownBCdigo entre comillas hacia atrsCode between backticksQsciLexerMarkdownPCdigo entre comillas hacia atrs doblesCode between double backticksQsciLexerMarkdown Bloque de cdigo Code blockQsciLexerMarkdownPor defectoDefaultQsciLexerMarkdownBnfasis usando asterisco sencilloEmphasis using single asterisksQsciLexerMarkdownDnfasis usando guin bajo sencillo!Emphasis using single underscoresQsciLexerMarkdown Regla horizontalHorizontal ruleQsciLexerMarkdown*Encabezado de nivel 1Level 1 headerQsciLexerMarkdown*Encabezado de nivel 2Level 2 headerQsciLexerMarkdown*Encabezado de nivel 3Level 3 headerQsciLexerMarkdown*Encabezado de nivel 4Level 4 headerQsciLexerMarkdown*Encabezado de nivel 5Level 5 headerQsciLexerMarkdown*Encabezado de nivel 6Level 6 headerQsciLexerMarkdown EnlaceLinkQsciLexerMarkdown4Elemento de lista ordenadaOrdered list itemQsciLexerMarkdownPre-charPre-charQsciLexerMarkdownEspecialSpecialQsciLexerMarkdown Tachar Strike outQsciLexerMarkdownJnfasis fuerte usando doble asterisco&Strong emphasis using double asterisksQsciLexerMarkdownLnfasis fuerte usando doble guin bajo(Strong emphasis using double underscoresQsciLexerMarkdown:Elemento de lista sin ordenarUnordered list itemQsciLexerMarkdownComandoCommandQsciLexerMatlabComentarioCommentQsciLexerMatlabPor defectoDefaultQsciLexerMatlab4Cadena con comillas doblesDouble-quoted stringQsciLexerMatlabIdentificador IdentifierQsciLexerMatlabPalabra claveKeywordQsciLexerMatlab NmeroNumberQsciLexerMatlabOperadorOperatorQsciLexerMatlab6Cadena con comillas simplesSingle-quoted stringQsciLexerMatlabComentarioComment QsciLexerPOPor defectoDefault QsciLexerPOSealadoresFlags QsciLexerPO Sealador difuso Fuzzy flag QsciLexerPO&Contexto de mensajeMessage context QsciLexerPO8Texto de contexto de mensajeMessage context text QsciLexerPOXFin de lnea de texto de contexto de mensaje Message context text end-of-line QsciLexerPO0Identificador de mensajeMessage identifier QsciLexerPO<Texto identificador de mensajeMessage identifier text QsciLexerPO\Fin de lnea de texto identificador de mensaje#Message identifier text end-of-line QsciLexerPO"Cadena de mensajeMessage string QsciLexerPO4Texto de cadena de mensajeMessage string text QsciLexerPOTFin de lnea de texto de cadena de mensajeMessage string text end-of-line QsciLexerPO2Comentario de programadorProgrammer comment QsciLexerPOReferencia Reference QsciLexerPOMala directiva Bad directive QsciLexerPOVComentarioComment QsciLexerPOV&Lnea de comentario Comment line QsciLexerPOVPor defectoDefault QsciLexerPOVDirectiva Directive QsciLexerPOVIdentificador Identifier QsciLexerPOV NmeroNumber QsciLexerPOV2Objetos, CSG y aparienciaObjects, CSG and appearance QsciLexerPOVOperadorOperator QsciLexerPOV,Funciones predefinidasPredefined functions QsciLexerPOV8Identificadores predefinidosPredefined identifiers QsciLexerPOV(Cadena de caracteresString QsciLexerPOV@Tipos, modificadores y elementosTypes, modifiers and items QsciLexerPOV"Cadena sin cerrarUnclosed string QsciLexerPOV2Definido por el usuario 1User defined 1 QsciLexerPOV2Definido por el usuario 2User defined 2 QsciLexerPOV2Definido por el usuario 3User defined 3 QsciLexerPOV@Comentario de estilo '(* ... *)''(* ... *)' style commentQsciLexerPascal\Bloque de preprocesador de estilo '(*$ ... *)'&'(*$ ... *)' style pre-processor blockQsciLexerPascal>Comentario de estilo '{ ... }' '{ ... }' style commentQsciLexerPascalXBloque de preprocesador de estilo '{$ ... }'$'{$ ... }' style pre-processor blockQsciLexerPascalCarcter CharacterQsciLexerPascalPor defectoDefaultQsciLexerPascal$Nmero hexadecimalHexadecimal numberQsciLexerPascalIdentificador IdentifierQsciLexerPascalasm inline  Inline asmQsciLexerPascalPalabra claveKeywordQsciLexerPascal&Comentario de lnea Line commentQsciLexerPascal NmeroNumberQsciLexerPascalOperadorOperatorQsciLexerPascal6Cadena con comillas simplesSingle-quoted stringQsciLexerPascal"Cadena sin cerrarUnclosed stringQsciLexerPascal ArrayArray QsciLexerPerlnDocumento integrado (here document) con comilla inversaBacktick here document QsciLexerPerlxHere document con comilla hacia atrs (variable interpolada).Backtick here document (interpolated variable) QsciLexerPerlComilla inversa Backticks QsciLexerPerlTComilla hacia atrs (variable interpolada)!Backticks (interpolated variable) QsciLexerPerlComentarioComment QsciLexerPerl Seccin de datos Data section QsciLexerPerlPor defectoDefault QsciLexerPerljDocumento integrado (here document) con comilla dobleDouble-quoted here document QsciLexerPerllHere document con comilla doble (variable interpolada)3Double-quoted here document (interpolated variable) QsciLexerPerl4Cadena con comillas doblesDouble-quoted string QsciLexerPerl^Cadena con doble comilla (variable interpolada),Double-quoted string (interpolated variable) QsciLexerPerl ErrorError QsciLexerPerl"Cuerpo de formato Format body QsciLexerPerl0Identificador de formatoFormat identifier QsciLexerPerlHashHash QsciLexerPerldDelimitador de documento integrado (here document)Here document delimiter QsciLexerPerlIdentificador Identifier QsciLexerPerlPalabra claveKeyword QsciLexerPerl NmeroNumber QsciLexerPerlOperadorOperator QsciLexerPerlPODPOD QsciLexerPerlPOD textual POD verbatim QsciLexerPerl.Cadena con comillas (q)Quoted string (q) QsciLexerPerl0Cadena con comillas (qq)Quoted string (qq) QsciLexerPerl`Cadena entrecomillada (qq, variable interpolada))Quoted string (qq, interpolated variable) QsciLexerPerl0Cadena con comillas (qr)Quoted string (qr) QsciLexerPerl`Cadena entrecomillada (qr, variable interpolada))Quoted string (qr, interpolated variable) QsciLexerPerl0Cadena con comillas (qw)Quoted string (qw) QsciLexerPerl0Cadena con comillas (qx)Quoted string (qx) QsciLexerPerl`Cadena entrecomillada (qx, variable interpolada))Quoted string (qx, interpolated variable) QsciLexerPerl"Expresin regularRegular expression QsciLexerPerlPExpresin regular (variable interpolada)*Regular expression (interpolated variable) QsciLexerPerlEscalarScalar QsciLexerPerllDocumento integrado (here document) con comilla simpleSingle-quoted here document QsciLexerPerl6Cadena con comillas simplesSingle-quoted string QsciLexerPerl,Prototipo de subrutinaSubroutine prototype QsciLexerPerlSustitucin Substitution QsciLexerPerlFSubstitucin (variable interpolada)$Substitution (interpolated variable) QsciLexerPerl"Tabla de smbolos Symbol table QsciLexerPerlTraduccin Translation QsciLexerPerl&Parntesis de arrayArray parenthesisQsciLexerPostScript.Carcter de cadena malaBad string characterQsciLexerPostScriptCadena Base85 Base85 stringQsciLexerPostScriptComentarioCommentQsciLexerPostScriptComentario DSC DSC commentQsciLexerPostScript.Valor de comentario DSCDSC comment valueQsciLexerPostScriptPor defectoDefaultQsciLexerPostScript2Parntesis de diccionarioDictionary parenthesisQsciLexerPostScript$Cadena hexadecimalHexadecimal stringQsciLexerPostScript>Literal de evaluacin inmediataImmediately evaluated literalQsciLexerPostScriptPalabra claveKeywordQsciLexerPostScriptLiteralLiteralQsciLexerPostScript NombreNameQsciLexerPostScript NmeroNumberQsciLexerPostScript6Parntesis de procedimientoProcedure parenthesisQsciLexerPostScript TextoTextQsciLexerPostScriptAsignacin AssignmentQsciLexerPropertiesComentarioCommentQsciLexerPropertiesPor defectoDefaultQsciLexerProperties"Valor por defecto Default valueQsciLexerProperties ClaveKeyQsciLexerPropertiesSeccinSectionQsciLexerPropertiesNombre de clase Class nameQsciLexerPythonComentarioCommentQsciLexerPython(Bloque de comentario Comment blockQsciLexerPythonDecorador DecoratorQsciLexerPythonPor defectoDefaultQsciLexerPython4Cadena con comillas doblesDouble-quoted stringQsciLexerPython4Nombre de mtodo o funcinFunction or method nameQsciLexerPython.Identificador resaltadoHighlighted identifierQsciLexerPythonIdentificador IdentifierQsciLexerPythonPalabra claveKeywordQsciLexerPython NmeroNumberQsciLexerPythonOperadorOperatorQsciLexerPython6Cadena con comillas simplesSingle-quoted stringQsciLexerPython>Cadena con triple comilla dobleTriple double-quoted stringQsciLexerPython@Cadena con triple comilla simpleTriple single-quoted stringQsciLexerPython"Cadena sin cerrarUnclosed stringQsciLexerPythonCadena %Q %Q string QsciLexerRubyCadena %q %q string QsciLexerRubyCadena %r %r string QsciLexerRubyCadena %w %w string QsciLexerRubyCadena %x %x string QsciLexerRubyComilla inversa Backticks QsciLexerRubyNombre de clase Class name QsciLexerRuby"Variable de claseClass variable QsciLexerRubyComentarioComment QsciLexerRuby Seccin de datos Data section QsciLexerRubyPor defectoDefault QsciLexerRuby.Palabra clave degradadaDemoted keyword QsciLexerRuby4Cadena con comillas doblesDouble-quoted string QsciLexerRuby ErrorError QsciLexerRuby4Nombre de mtodo o funcinFunction or method name QsciLexerRuby GlobalGlobal QsciLexerRubyFDocumento integrado (here document) Here document QsciLexerRubydDelimitador de documento integrado (here document)Here document delimiter QsciLexerRubyIdentificador Identifier QsciLexerRuby*Variable de instanciaInstance variable QsciLexerRubyPalabra claveKeyword QsciLexerRuby Nombre de mdulo Module name QsciLexerRuby NmeroNumber QsciLexerRubyOperadorOperator QsciLexerRubyPODPOD QsciLexerRuby"Expresin regularRegular expression QsciLexerRuby6Cadena con comillas simplesSingle-quoted string QsciLexerRubySmboloSymbol QsciLexerRuby stderrstderr QsciLexerRuby stdinstdin QsciLexerRuby stdoutstdout QsciLexerRuby*# lnea de comentario# comment line QsciLexerSQLComentarioComment QsciLexerSQL&Lnea de comentario Comment line QsciLexerSQLPor defectoDefault QsciLexerSQL4Cadena con comillas doblesDouble-quoted string QsciLexerSQLIdentificador Identifier QsciLexerSQL0Palabra clave de JavadocJavaDoc keyword QsciLexerSQLBError en palabra clave de JavadocJavaDoc keyword error QsciLexerSQL8Comentario de estilo JavaDocJavaDoc style comment QsciLexerSQLPalabra claveKeyword QsciLexerSQL NmeroNumber QsciLexerSQLOperadorOperator QsciLexerSQL8Identificador entrecomilladoQuoted identifier QsciLexerSQL.Operador entrecomilladoQuoted operator QsciLexerSQL&Comentario SQL*PlusSQL*Plus comment QsciLexerSQL,Palabra clave SQL*PlusSQL*Plus keyword QsciLexerSQLPrompt SQL*PlusSQL*Plus prompt QsciLexerSQL6Cadena con comillas simplesSingle-quoted string QsciLexerSQL2Definido por el usuario 1User defined 1 QsciLexerSQL2Definido por el usuario 2User defined 2 QsciLexerSQL2Definido por el usuario 3User defined 3 QsciLexerSQL2Definido por el usuario 4User defined 4 QsciLexerSQLComandoCommandQsciLexerSpiceComentarioCommentQsciLexerSpicePor defectoDefaultQsciLexerSpiceDelimitador DelimiterQsciLexerSpiceFuncinFunctionQsciLexerSpiceIdentificador IdentifierQsciLexerSpice NmeroNumberQsciLexerSpiceParmetro ParameterQsciLexerSpice ValorValueQsciLexerSpice0Sustitucin de corchetesBrace substitution QsciLexerTCLComentarioComment QsciLexerTCL(Bloque de comentario Comment block QsciLexerTCL$Caja de comentario Comment box QsciLexerTCL&Lnea de comentario Comment line QsciLexerTCLPor defectoDefault QsciLexerTCL,Expandir palabra claveExpand keyword QsciLexerTCLIdentificador Identifier QsciLexerTCLModificadorModifier QsciLexerTCL NmeroNumber QsciLexerTCLOperadorOperator QsciLexerTCL8Palabra clave entrecomilladaQuoted keyword QsciLexerTCL*Cadena entrecomillada Quoted string QsciLexerTCLSustitucin Substitution QsciLexerTCL"Palabra clave TCL TCL keyword QsciLexerTCLComando Tk Tk command QsciLexerTCL Palabra clave Tk Tk keyword QsciLexerTCL2Definido por el usuario 1User defined 1 QsciLexerTCL2Definido por el usuario 2User defined 2 QsciLexerTCL2Definido por el usuario 3User defined 3 QsciLexerTCL2Definido por el usuario 4User defined 4 QsciLexerTCL$Palabra clave iTCL iTCL keyword QsciLexerTCLComandoCommand QsciLexerTeXPor defectoDefault QsciLexerTeX GrupoGroup QsciLexerTeXEspecialSpecial QsciLexerTeXSmboloSymbol QsciLexerTeX TextoText QsciLexerTeXAtributo Attribute QsciLexerVHDLComentarioComment QsciLexerVHDL(Bloque de comentario Comment block QsciLexerVHDL&Lnea de comentario Comment line QsciLexerVHDLPor defectoDefault QsciLexerVHDLIdentificador Identifier QsciLexerVHDLPalabra claveKeyword QsciLexerVHDL NmeroNumber QsciLexerVHDLOperadorOperator QsciLexerVHDL Funcin estndarStandard function QsciLexerVHDL"Operador estndarStandard operator QsciLexerVHDL Paquete estndarStandard package QsciLexerVHDLTipo estndar Standard type QsciLexerVHDL(Cadena de caracteresString QsciLexerVHDL"Cadena sin cerrarUnclosed string QsciLexerVHDL.Definido por el usuario User defined QsciLexerVHDLComentario'Bang Bang commentQsciLexerVerilogComentarioCommentQsciLexerVerilogPor defectoDefaultQsciLexerVerilogIdentificador IdentifierQsciLexerVerilogNDeclaracin de puerto de input inactivoInactive input port declarationQsciLexerVerilog\Declaracin de puerto de input/output inactivo&Inactive input/output port declarationQsciLexerVerilogHComentario de palabra clave inactivaInactive keyword commentQsciLexerVerilogPDeclaracin de puerto de output inactivo Inactive output port declarationQsciLexerVerilog6Conexin inactiva de puertoInactive port connectionQsciLexerVerilog<Declaracin de puerto de inputInput port declarationQsciLexerVerilog\Declaracin de puerto de input/output inactivoInput/output port declarationQsciLexerVerilog6Comentario de palabra claveKeyword commentQsciLexerVerilog&Comentario de lnea Line commentQsciLexerVerilogNumberQsciLexerVerilogOperadorOperatorQsciLexerVerilog>Declaracin de puerto de outputOutput port declarationQsciLexerVerilog$Conexin de puertoPort connectionQsciLexerVerilog.Bloque de preprocesadorPreprocessor blockQsciLexerVerilogTIdentificadores y palabras clave primarios Primary keywords and identifiersQsciLexerVerilogXPalabras clave e identificadores secundarios"Secondary keywords and identifiersQsciLexerVerilog CadenaStringQsciLexerVerilog Tarea de sistema System taskQsciLexerVerilog"Cadena sin cerrarUnclosed stringQsciLexerVerilogbTareas definidas por el usuario e identificadores"User defined tasks and identifiersQsciLexerVerilogComentarioComment QsciLexerYAMLPor defectoDefault QsciLexerYAML0Delimitador de documentoDocument delimiter QsciLexerYAMLIdentificador Identifier QsciLexerYAMLPalabra claveKeyword QsciLexerYAML NmeroNumber QsciLexerYAMLOperadorOperator QsciLexerYAMLReferencia Reference QsciLexerYAML:Marcador de error de sintaxisSyntax error marker QsciLexerYAML6Marcador de bloque de textoText block marker QsciLexerYAML&Copiar&Copy QsciScintilla &Pegar&Paste QsciScintilla&Rehacer&Redo QsciScintilla&Deshacer&Undo QsciScintillaCor&tarCu&t QsciScintilla BorrarDelete QsciScintilla Seleccionar todo Select All QsciScintillasqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_es.ts000066400000000000000000004376531316047212700240660ustar00rootroot00000000000000 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 Instance property Propiedad de instancia 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 QsciLexerJSON Default Por defecto Number Número String Cadena Unclosed string Cadena sin cerrar Property Propiedad Escape sequence Secuencia de escape Line comment Comentario de línea Block comment Comentario de bloque Operator Operador IRI IRI JSON-LD compact IRI JSON-LD compact IRI JSON keyword Palabra clave JSON JSON-LD keyword Palabra clave JSON-LD Parsing error Error de intérprete 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 QsciLexerMarkdown Default Por defecto Special Especial Strong emphasis using double asterisks Énfasis fuerte usando doble asterisco Strong emphasis using double underscores Énfasis fuerte usando doble guión bajo Emphasis using single asterisks Énfasis usando asterisco sencillo Emphasis using single underscores Énfasis usando guión bajo sencillo Level 1 header Encabezado de nivel 1 Level 2 header Encabezado de nivel 2 Level 3 header Encabezado de nivel 3 Level 4 header Encabezado de nivel 4 Level 5 header Encabezado de nivel 5 Level 6 header Encabezado de nivel 6 Pre-char Pre-char Unordered list item Elemento de lista sin ordenar Ordered list item Elemento de lista ordenada Block quote Bloque de cita Strike out Tachar Horizontal rule Regla horizontal Link Enlace Code between backticks Código entre comillas hacia atrás Code between double backticks Código entre comillas hacia atrás dobles Code block Bloque de código 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_fr.qm000066400000000000000000001474651316047212700240540ustar00rootroot00000000000000FN}+7&B"k44`3-@U4 N$!#Nhh2_g(9U Mp @u*O7 >b<9tWXUf$UGeoi?h9Z4%3]Q-[[uf7l&eMI~ŰX:! 4ktOX|zCFn;z w a,vx 66ctP TI!$<],_OI@A@@AS@A@A@AD@BAI@B@B@B@B@CA@C@Cp@CL@C@Dp@D@DaA6OHxC[>\8#)\8&\8+\80\8:\8?\8F\8y.\8~5\8\8\8\8]\8\8[\8=\8\8\8\8\8\8r1r'O5"W5&U5.^595>5E5|5K55555w55=5J5\558G+G@/Gz)G~G|GKG9\9\tx[*?^tYe]u_p }1i};i}G:d('s.C|SNjȐ#\Ȑ'Ȑ*Ȑ1.Ȑ6Ȑ;%Ȑ?ȐFȐybȐ~hȐȐȐ}ȐȐȐȐqȐȐȐȐȐѽ8'ԇ)fm}  {"[)6%) 6|_udd*d*id*Cd*i5A܌]$n1Hp{ _Tt&c*`,3g5<.j o1|^{VB"="{"lT~*~,F~83~LJ2c2u[qL2T ~D &0'# &0'Y 3 ?3r @|Us fy orD @t Vy vp ) ^i| !d %- -K 5! 9 D    a  y X$p = i f 4bz '4, *S$h *S *S +O4 0M Iq>'D S SM d8B d8 d8 d8 d<$ d<( d<+ d<B d<D d<{ d< d<A d< d< d<1 d<i d<i d< d< d< d<D d<- d<; d<h d<\ d4, k, k,f qeU s(( $^ d R4 BQ t!( t$ t)( t+P t- t4 t8 t> tC tDy tw t| t t t t t t t t t t t$ tC t t t t t t zX+ ZTb  Z5 _f ?a " 5 'd4 (p ;2r ;^Q A\& Ep _ cVB d9 dN eud 4$oL 3 Ws  y |. |:9 | Bu ӕ Oc O 4' 4 ؗb Ef' )? )k )z >i+ J" J WL f5 o% oq o 'W  %' AE [a / T 'c xK  .p  . EsF '4 943| @&4l' @*$k _{N t}4" t}4?r t}4x t}4} t}4p t}45 /[ ?DM Ig2 Ig=j Ig@| IgH= Igzy Ig Ig@ Ig Ig Ig Ig t. t9 tM `e .qm yPrWv cs 7M'9 O=egVjW\`]gReTZ;hw^irmXldJ@wgl{N&4Y(`2d6<GB< 4BK)N)wƦhn!L wkCjC20I2_@Q3#}w8l4+4VRΒhu@2dc)t2nETlu!9ryBIidAnnulerCancel QsciCommandZConversion de la ligne courante en minusculesConvert selection to lower case QsciCommandZConversion de la ligne courante en majusculesConvert selection to upper case QsciCommand0Copier la ligne couranteCopy current line QsciCommand&Copier la slectionCopy selection QsciCommand0Couper la ligne couranteCut current line QsciCommand&Couper la slection Cut selection QsciCommand>Effacement du caractre courantDelete current character QsciCommand@Suppression de la ligne couranteDelete current line QsciCommandHEffacer la partie gauche de la ligneDelete line to left QsciCommandVSuppression de la partie droite de la ligneDelete line to right QsciCommand@Suppression du dernier caractreDelete previous character QsciCommand8Suppression du mot de gaucheDelete word to left QsciCommand8Suppression du mot de droiteDelete word to right QsciCommand~Extension de la slection rectangulaire d'une ligne vers le bas*Extend rectangular selection down one line QsciCommand|Extension de la slection rectangulaire d'une page vers le bas*Extend rectangular selection down one page QsciCommandExtension de la slection rectangulaire d'un caractre vers la gauche/Extend rectangular selection left one character QsciCommandExtension de la slection rectangulaire d'un caractre vers la droite0Extend rectangular selection right one character QsciCommandExtension de la slection rectangulaire d'une ligne vers le haut(Extend rectangular selection up one line QsciCommand~Extension de la slection rectangulaire d'une page vers le haut(Extend rectangular selection up one page QsciCommandbExtension de la slection d'une ligne vers le basExtend selection down one line QsciCommand`Extension de la slection d'une page vers le basExtend selection down one page QsciCommandjExtension de la slection d'un paragraphe vers le bas#Extend selection down one paragraph QsciCommandnExtension de la slection d'un caractre vers la gauche#Extend selection left one character QsciCommandbExtension de la slection d'un mot vers la gaucheExtend selection left one word QsciCommandtExtension de la slection d'une part de mot vers la gauche#Extend selection left one word part QsciCommandnExtension de la slection d'un caractre vers la droite$Extend selection right one character QsciCommandbExtension de la slection d'un mot vers la droiteExtend selection right one word QsciCommandtExtension de la slection d'une part de mot vers la droite$Extend selection right one word part QsciCommandbExtension de la slection vers fin du mot suivant$Extend selection to end of next word QsciCommandfExtension de la slection vers fin du mot prcdent(Extend selection to end of previous word QsciCommandrExtension de la slection vers dbut de ligne du document*Extend selection to start of document line QsciCommanddExtension de la slection d'une ligne vers le hautExtend selection up one line QsciCommandbExtension de la slection d'une page vers le hautExtend selection up one page QsciCommandlExtension de la slection d'un paragraphe vers le haut!Extend selection up one paragraph QsciCommand*Chargement de la pageFormfeed QsciCommand.Indentation d'un niveauIndent one level QsciCommandFDplacement d'une ligne vers le basMove down one line QsciCommandDDplacement d'une page vers le basMove down one page QsciCommandNDplacement d'un paragraphe vers le basMove down one paragraph QsciCommandRDplacement d'un caractre vers la gaucheMove left one character QsciCommandFDplacement d'un mot vers la gaucheMove left one word QsciCommandXDplacement d'une part de mot vers la gaucheMove left one word part QsciCommandRDplacement d'un caractre vers la droiteMove right one character QsciCommandFDplacement d'un mot vers la droiteMove right one word QsciCommandXDplacement d'une part de mot vers la droiteMove right one word part QsciCommandFDplacement vers fin du mot suivantMove to end of next word QsciCommandJDplacement vers fin du mot prcdentMove to end of previous word QsciCommandVDplacement vers dbut de ligne du documentMove to start of document line QsciCommandHDplacement d'une ligne vers le hautMove up one line QsciCommandFDplacement d'une page vers le hautMove up one page QsciCommandPDplacement d'un paragraphe vers le hautMove up one paragraph QsciCommand CollerPaste QsciCommand8Refaire la dernire commandeRedo last command QsciCommand<Descendre la fin du documentScroll to end of document QsciCommand:Remonter au dbut du documentScroll to start of document QsciCommandhDfiler verticalement pour centrer la ligne courante(Scroll vertically to centre current line QsciCommand6Decendre la vue d'une ligneScroll view down one line QsciCommand6Remonter la vue d'une ligneScroll view up one line QsciCommandBBasculement Insertion /EcrasementToggle insert/overtype QsciCommandZoom avantZoom in QsciCommandZoom arrireZoom out QsciCommandPar dfautDefault QsciLexerAVSRChaine de caractres (guillemets doubles)Double-quoted string QsciLexerAVS FiltreFilter QsciLexerAVSFonctionFunction QsciLexerAVSIdentificateur Identifier QsciLexerAVSMot-clKeyword QsciLexerAVS(Commentaire de ligne Line comment QsciLexerAVS NombreNumber QsciLexerAVSOprateurOperator QsciLexerAVSExtensionPlugin QsciLexerAVS\Chaine de caractres HTML (guillemets simples)Triple double-quoted string QsciLexerAVSQuotes inverses Backticks QsciLexerBashCommentaireComment QsciLexerBashPar dfautDefault QsciLexerBashRChaine de caractres (guillemets doubles)Double-quoted string QsciLexerBash ErreurError QsciLexerBash4Ici dlimiteur de documentHere document delimiter QsciLexerBashIdentificateur Identifier QsciLexerBashMot-clKeyword QsciLexerBash NombreNumber QsciLexerBashOprateurOperator QsciLexerBash,Extension de paramtreParameter expansion QsciLexerBashScalaireScalar QsciLexerBashFDocument intgr guillemets simplesSingle-quoted here document QsciLexerBashRChaine de caractres (guillemets simples)Single-quoted string QsciLexerBashCommentaireCommentQsciLexerBatchPar dfautDefaultQsciLexerBatch Commande externeExternal commandQsciLexerBatch<Cacher le caratre de commandeHide command characterQsciLexerBatchMot-clKeywordQsciLexerBatch TitreLabelQsciLexerBatchOprateurOperatorQsciLexerBatchVariableVariableQsciLexerBatchCommentaireCommentQsciLexerCMakePar dfautDefaultQsciLexerCMake TitreLabelQsciLexerCMake NombreNumberQsciLexerCMake(Chane de caractresStringQsciLexerCMakeVariableVariableQsciLexerCMakeCommentaire C C comment QsciLexerCPPCommentaire C++ C++ comment QsciLexerCPPPar dfautDefault QsciLexerCPPRChaine de caractres (guillemets doubles)Double-quoted string QsciLexerCPPPClasses globales et dfinitions de typesGlobal classes and typedefs QsciLexerCPPIdentificateur Identifier QsciLexerCPPMot-cl JavaDocJavaDoc keyword QsciLexerCPP2Erreur de mot-cl JavaDocJavaDoc keyword error QsciLexerCPP<Commentaire C de style JavaDocJavaDoc style C comment QsciLexerCPP@Commentaire C++ de style JavaDocJavaDoc style C++ comment QsciLexerCPP>Expression rgulire JavaScriptJavaScript regular expression QsciLexerCPPMot-clKeyword QsciLexerCPP NombreNumber QsciLexerCPPOprateurOperator QsciLexerCPP<Instructions de pr-processingPre-processor block QsciLexerCPPHSeconds mots-cls et identificateurs"Secondary keywords and identifiers QsciLexerCPPRChaine de caractres (guillemets simples)Single-quoted string QsciLexerCPPBChaine de caractres non refermeUnclosed string QsciLexerCPPrgle-@@-rule QsciLexerCSSAttribut Attribute QsciLexerCSSProprit CSS1 CSS1 property QsciLexerCSSProprit CSS2 CSS2 property QsciLexerCSSProprit CSS3 CSS3 property QsciLexerCSS ClasseClass selector QsciLexerCSSPar dfautDefault QsciLexerCSSRChaine de caractres (guillemets doubles)Double-quoted string QsciLexerCSSID ID selector QsciLexerCSSImportant Important QsciLexerCSSOprateurOperator QsciLexerCSSPseudo-classe Pseudo-class QsciLexerCSSRChaine de caractres (guillemets simples)Single-quoted string QsciLexerCSS BaliseTag QsciLexerCSS$Proprit inconnueUnknown property QsciLexerCSS*Peudo-classe inconnueUnknown pseudo-class QsciLexerCSS ValeurValue QsciLexerCSSVariableVariable QsciLexerCSSChaine verbatimVerbatim stringQsciLexerCSharpPar dfautDefaultQsciLexerCoffeeScriptRChaine de caractres (guillemets doubles)Double-quoted stringQsciLexerCoffeeScriptIdentificateur IdentifierQsciLexerCoffeeScriptMot-cl JavaDocJavaDoc keywordQsciLexerCoffeeScript2Erreur de mot-cl JavaDocJavaDoc keyword errorQsciLexerCoffeeScriptMot-clKeywordQsciLexerCoffeeScript NombreNumberQsciLexerCoffeeScriptOprateurOperatorQsciLexerCoffeeScript<Instructions de pr-processingPre-processor blockQsciLexerCoffeeScript(Expression rgulireRegular expressionQsciLexerCoffeeScriptHSeconds mots-cls et identificateurs"Secondary keywords and identifiersQsciLexerCoffeeScriptRChaine de caractres (guillemets simples)Single-quoted stringQsciLexerCoffeeScriptBChaine de caractres non refermeUnclosed stringQsciLexerCoffeeScriptCaractre Character QsciLexerDMot-cl DDoc DDoc keyword QsciLexerD,Erreur de mot-cl DDocDDoc keyword error QsciLexerDPar dfautDefault QsciLexerDIdentificateur Identifier QsciLexerDMot-clKeyword QsciLexerD(Commentaire de ligne Line comment QsciLexerD NombreNumber QsciLexerDOprateurOperator QsciLexerD(Chane de caractresString QsciLexerDBChaine de caractres non refermeUnclosed string QsciLexerD0Dfinition utilisateur 1User defined 1 QsciLexerD0Dfinition utilisateur 2User defined 2 QsciLexerD0Dfinition utilisateur 3User defined 3 QsciLexerDLigne ajoute Added line QsciLexerDiffLigne change Changed line QsciLexerDiffCommandeCommand QsciLexerDiffCommentaireComment QsciLexerDiffPar dfautDefault QsciLexerDiffEn-tteHeader QsciLexerDiffPositionPosition QsciLexerDiffLigne supprime Removed line QsciLexerDiffCommentaireCommentQsciLexerFortran77 ContinuationQsciLexerFortran77Par dfautDefaultQsciLexerFortran77RChaine de caractres (guillemets doubles)Double-quoted stringQsciLexerFortran77 Fonction tendueExtended functionQsciLexerFortran77Identificateur IdentifierQsciLexerFortran77(Fonction intrinsqueIntrinsic functionQsciLexerFortran77Mot-clKeywordQsciLexerFortran77 TitreLabelQsciLexerFortran77 NombreNumberQsciLexerFortran77OprateurOperatorQsciLexerFortran77<Instructions de pr-processingPre-processor blockQsciLexerFortran77RChaine de caractres (guillemets simples)Single-quoted stringQsciLexerFortran77BChaine de caractres non refermeUnclosed stringQsciLexerFortran774Commentaire JavaScript ASPASP JavaScript comment QsciLexerHTML2JavaScript ASP par dfautASP JavaScript default QsciLexerHTMLpChaine de caractres JavaScript ASP (guillemets doubles)#ASP JavaScript double-quoted string QsciLexerHTML.Mot-cl JavaScript ASP ASP JavaScript keyword QsciLexerHTMLFCommentaire de ligne JavaScript ASPASP JavaScript line comment QsciLexerHTML*Nombre JavaScript ASPASP JavaScript number QsciLexerHTMLFExpression rgulire JavaScript ASP!ASP JavaScript regular expression QsciLexerHTMLpChaine de caractres JavaScript ASP (guillemets simples)#ASP JavaScript single-quoted string QsciLexerHTML,Symbole JavaScript ASPASP JavaScript symbol QsciLexerHTML`Chaine de caractres JavaScript ASP non refermeASP JavaScript unclosed string QsciLexerHTML$Mot JavaScript ASPASP JavaScript word QsciLexerHTML0Nom de classe Python ASPASP Python class name QsciLexerHTML,Commentaire Python ASPASP Python comment QsciLexerHTML*Python ASP par dfautASP Python default QsciLexerHTMLhChaine de caractres Python ASP (guillemets doubles)ASP Python double-quoted string QsciLexerHTML<Mthode ou fonction Python ASP"ASP Python function or method name QsciLexerHTML2Identificateur Python ASPASP Python identifier QsciLexerHTML$Mot-cl Python ASPASP Python keyword QsciLexerHTML"Nombre Python ASPASP Python number QsciLexerHTML(Oprateur Python ASPASP Python operator QsciLexerHTMLhChaine de caractres Python ASP (guillemets simples)ASP Python single-quoted string QsciLexerHTMLxChaine de caractres Python ASP (triples guillemets doubles)&ASP Python triple double-quoted string QsciLexerHTMLxChaine de caractres Python ASP (triples guillemets simples)&ASP Python triple single-quoted string QsciLexerHTML0Commentaire VBScript ASPASP VBScript comment QsciLexerHTML.VBScript ASP par dfautASP VBScript default QsciLexerHTML6Identificateur VBScript ASPASP VBScript identifier QsciLexerHTML*Mot-cl VBScript ASP ASP VBScript keyword QsciLexerHTML&Nombre VBScript ASPASP VBScript number QsciLexerHTMLBChaine de caractres VBScript ASPASP VBScript string QsciLexerHTML\Chaine de caractres VBScript ASP non refermeASP VBScript unclosed string QsciLexerHTML,Commentaire X-Code ASPASP X-Code comment QsciLexerHTMLAttribut Attribute QsciLexerHTML CDATACDATA QsciLexerHTMLBalise fermante End of a tag QsciLexerHTML Fin de block XMLEnd of an XML fragment QsciLexerHTML EntitEntity QsciLexerHTMLbPremier paramtre de commentaire de commande SGML*First parameter comment of an SGML command QsciLexerHTMLDPremier paramtre de commande SGML"First parameter of an SGML command QsciLexerHTML Commentaire HTML HTML comment QsciLexerHTMLHTML par dfaut HTML default QsciLexerHTML\Chaine de caractres HTML (guillemets doubles)HTML double-quoted string QsciLexerHTMLNombre HTML HTML number QsciLexerHTML\Chaine de caractres HTML (guillemets simples)HTML single-quoted string QsciLexerHTMLVCommentaire JavaScript ASP de style JavaDoc$JavaDoc style ASP JavaScript comment QsciLexerHTMLNCommentaire JavaScript de style JavaDoc JavaDoc style JavaScript comment QsciLexerHTML,Commentaire JavaScriptJavaScript comment QsciLexerHTML*JavaScript par dfautJavaScript default QsciLexerHTMLhChaine de caractres JavaScript (guillemets doubles)JavaScript double-quoted string QsciLexerHTML$Mot-cl JavaScriptJavaScript keyword QsciLexerHTML>Commentaire de ligne JavaScriptJavaScript line comment QsciLexerHTML"Nombre JavaScriptJavaScript number QsciLexerHTML>Expression rgulire JavaScriptJavaScript regular expression QsciLexerHTMLhChaine de caractres JavaScript (guillemets simples)JavaScript single-quoted string QsciLexerHTML$Symbole JavaScriptJavaScript symbol QsciLexerHTMLXChaine de caractres JavaScript non refermeJavaScript unclosed string QsciLexerHTMLMot JavaScriptJavaScript word QsciLexerHTML8Autre texte dans les balisesOther text in a tag QsciLexerHTMLCommentaire PHP PHP comment QsciLexerHTMLPHP par dfaut PHP default QsciLexerHTMLZChaine de caractres PHP (guillemets doubles)PHP double-quoted string QsciLexerHTMLBVariable PHP (guillemets doubles)PHP double-quoted variable QsciLexerHTMLMot-cl PHP PHP keyword QsciLexerHTML0Commentaire de ligne PHPPHP line comment QsciLexerHTMLNombre PHP PHP number QsciLexerHTMLOprateur PHP PHP operator QsciLexerHTMLZChaine de caractres PHP (guillemets simples)PHP single-quoted string QsciLexerHTMLVariable PHP PHP variable QsciLexerHTML(Nom de classe PythonPython class name QsciLexerHTML$Commentaire PythonPython comment QsciLexerHTML"Python par dfautPython default QsciLexerHTML`Chaine de caractres Python (guillemets doubles)Python double-quoted string QsciLexerHTML4Mthode ou fonction PythonPython function or method name QsciLexerHTML*Identificateur PythonPython identifier QsciLexerHTMLMot-cl PythonPython keyword QsciLexerHTMLNombre Python Python number QsciLexerHTML Oprateur PythonPython operator QsciLexerHTML`Chaine de caractres Python (guillemets simples)Python single-quoted string QsciLexerHTMLpChaine de caractres Python (triples guillemets doubles)"Python triple double-quoted string QsciLexerHTMLpChaine de caractres Python (triples guillemets simples)"Python triple single-quoted string QsciLexerHTML*Block SGML par dfautSGML block default QsciLexerHTMLCommande SGML SGML command QsciLexerHTML Commentaire SGML SGML comment QsciLexerHTMLSGML par dfaut SGML default QsciLexerHTML\Chaine de caractres SGML (guillemets doubles)SGML double-quoted string QsciLexerHTMLErreur SGML SGML error QsciLexerHTML\Chaine de caractres SGML (guillemets simples)SGML single-quoted string QsciLexerHTML(Entit SGML spcialeSGML special entity QsciLexerHTML Balise de script Script tag QsciLexerHTML2Dbut de block JavaScriptStart of a JavaScript fragment QsciLexerHTML$Dbut de block PHPStart of a PHP fragment QsciLexerHTML*Dbut de block PythonStart of a Python fragment QsciLexerHTML.Dbut de block VBScriptStart of a VBScript fragment QsciLexerHTML:Dbut de block JavaScript ASP#Start of an ASP JavaScript fragment QsciLexerHTML2Dbut de block Python ASPStart of an ASP Python fragment QsciLexerHTML6Dbut de block VBScript ASP!Start of an ASP VBScript fragment QsciLexerHTML$Dbut de block ASPStart of an ASP fragment QsciLexerHTML2Dbut de block ASP avec @Start of an ASP fragment with @ QsciLexerHTML$Dbut de block XMLStart of an XML fragment QsciLexerHTML BaliseTag QsciLexerHTML Attribut inconnuUnknown attribute QsciLexerHTMLBalise inconnue Unknown tag QsciLexerHTML6Valeur HTML sans guillemetsUnquoted HTML value QsciLexerHTML(Commentaire VBScriptVBScript comment QsciLexerHTML&VBScript par dfautVBScript default QsciLexerHTML.Identificateur VBScriptVBScript identifier QsciLexerHTML Mot-cl VBScriptVBScript keyword QsciLexerHTMLNombre VBScriptVBScript number QsciLexerHTML:Chaine de caractres VBScriptVBScript string QsciLexerHTMLTChaine de caractres VBScript non refermeVBScript unclosed string QsciLexerHTMLUUIDUUID QsciLexerIDL*Block de commentaires Block comment QsciLexerJSONPar dfautDefault QsciLexerJSON,Squence d'chappementEscape sequence QsciLexerJSONIRI QsciLexerJSONMot-cl JSON JSON keyword QsciLexerJSONMot-cl JSON-LDJSON-LD keyword QsciLexerJSON(Commentaire de ligne Line comment QsciLexerJSON NombreNumber QsciLexerJSONOprateurOperator QsciLexerJSON Erreur d'analyse Parsing error QsciLexerJSONPropritProperty QsciLexerJSON(Chane de caractresString QsciLexerJSONBChaine de caractres non refermeUnclosed string QsciLexerJSON(Expression rgulireRegular expressionQsciLexerJavaScript"Fonctions de baseBasic functions QsciLexerLuaCaractre Character QsciLexerLuaCommentaireComment QsciLexerLuaHCoroutines, i/o et fonctions systme%Coroutines, i/o and system facilities QsciLexerLuaPar dfautDefault QsciLexerLuaIdentificateur Identifier QsciLexerLuaMot-clKeyword QsciLexerLua TitreLabel QsciLexerLua(Commentaire de ligne Line comment QsciLexerLua Chane littraleLiteral string QsciLexerLua NombreNumber QsciLexerLuaOprateurOperator QsciLexerLuaPrprocessing Preprocessor QsciLexerLua(Chane de caractresString QsciLexerLuafFonctions sur les chaines, tables et fonctions math!String, table and maths functions QsciLexerLuaBChaine de caractres non refermeUnclosed string QsciLexerLua0Dfinition utilisateur 1User defined 1 QsciLexerLua0Dfinition utilisateur 2User defined 2 QsciLexerLua0Dfinition utilisateur 3User defined 3 QsciLexerLua0Dfinition utilisateur 4User defined 4 QsciLexerLuaCommentaireCommentQsciLexerMakefilePar dfautDefaultQsciLexerMakefile ErreurErrorQsciLexerMakefileOprateurOperatorQsciLexerMakefilePrprocessing PreprocessorQsciLexerMakefile CibleTargetQsciLexerMakefileVariableVariableQsciLexerMakefilePar dfautDefaultQsciLexerMarkdownSpcialSpecialQsciLexerMarkdownCommandeCommandQsciLexerMatlabCommentaireCommentQsciLexerMatlabPar dfautDefaultQsciLexerMatlabRChaine de caractres (guillemets doubles)Double-quoted stringQsciLexerMatlabIdentificateur IdentifierQsciLexerMatlabMot-clKeywordQsciLexerMatlab NombreNumberQsciLexerMatlabOprateurOperatorQsciLexerMatlabRChaine de caractres (guillemets simples)Single-quoted stringQsciLexerMatlabCommentaireComment QsciLexerPOPar dfautDefault QsciLexerPO$Mauvaise directive Bad directive QsciLexerPOVCommentaireComment QsciLexerPOVLigne commente Comment line QsciLexerPOVPar dfautDefault QsciLexerPOVDirective Directive QsciLexerPOVIdentificateur Identifier QsciLexerPOV NombreNumber QsciLexerPOV0Objets, CSG et apparenceObjects, CSG and appearance QsciLexerPOVOprateurOperator QsciLexerPOV*Fonctions prdfiniesPredefined functions QsciLexerPOV.Identifiants prdfinisPredefined identifiers QsciLexerPOV(Chane de caractresString QsciLexerPOV:Types, modifieurs et lmentsTypes, modifiers and items QsciLexerPOVBChaine de caractres non refermeUnclosed string QsciLexerPOV0Dfinition utilisateur 1User defined 1 QsciLexerPOV0Dfinition utilisateur 2User defined 2 QsciLexerPOV0Dfinition utilisateur 3User defined 3 QsciLexerPOVCaractre CharacterQsciLexerPascalPar dfautDefaultQsciLexerPascal$Nombre hexadcimalHexadecimal numberQsciLexerPascalIdentificateur IdentifierQsciLexerPascalAsm en ligne Inline asmQsciLexerPascalMot-clKeywordQsciLexerPascal(Commentaire de ligne Line commentQsciLexerPascal NombreNumberQsciLexerPascalOprateurOperatorQsciLexerPascalRChaine de caractres (guillemets simples)Single-quoted stringQsciLexerPascalBChaine de caractres non refermeUnclosed stringQsciLexerPascalTableauArray QsciLexerPerl@Document intgr quotes inversesBacktick here document QsciLexerPerlQuotes inverses Backticks QsciLexerPerlCommentaireComment QsciLexerPerl$Section de donnes Data section QsciLexerPerlPar dfautDefault QsciLexerPerlFDocument intgr guillemets doublesDouble-quoted here document QsciLexerPerlRChaine de caractres (guillemets doubles)Double-quoted string QsciLexerPerl ErreurError QsciLexerPerlHashageHash QsciLexerPerl4Ici dlimiteur de documentHere document delimiter QsciLexerPerlIdentificateur Identifier QsciLexerPerlMot-clKeyword QsciLexerPerl NombreNumber QsciLexerPerlOprateurOperator QsciLexerPerlPODPOD QsciLexerPerlPOD verbatim POD verbatim QsciLexerPerl"Chaine quote (q)Quoted string (q) QsciLexerPerl$Chaine quote (qq)Quoted string (qq) QsciLexerPerl$Chaine quote (qr)Quoted string (qr) QsciLexerPerl$Chaine quote (qw)Quoted string (qw) QsciLexerPerl$Chaine quote (qx)Quoted string (qx) QsciLexerPerl(Expression rgulireRegular expression QsciLexerPerlScalaireScalar QsciLexerPerlFDocument intgr guillemets simplesSingle-quoted here document QsciLexerPerlRChaine de caractres (guillemets simples)Single-quoted string QsciLexerPerlSubstitution Substitution QsciLexerPerl"Table de symboles Symbol table QsciLexerPerlTraduction Translation QsciLexerPerlCommentaireCommentQsciLexerPostScriptCommentaire DSC DSC commentQsciLexerPostScriptPar dfautDefaultQsciLexerPostScriptMot-clKeywordQsciLexerPostScriptNomNameQsciLexerPostScript NombreNumberQsciLexerPostScript TexteTextQsciLexerPostScriptAffectation AssignmentQsciLexerPropertiesCommentaireCommentQsciLexerPropertiesPar dfautDefaultQsciLexerProperties"Valeur par dfaut Default valueQsciLexerPropertiesClKeyQsciLexerPropertiesSectionSectionQsciLexerPropertiesNom de classe Class nameQsciLexerPythonCommentaireCommentQsciLexerPython*Block de commentaires Comment blockQsciLexerPythonPar dfautDefaultQsciLexerPythonRChaine de caractres (guillemets doubles)Double-quoted stringQsciLexerPython:Nom de mthode ou de fonctionFunction or method nameQsciLexerPythonIdentificateur IdentifierQsciLexerPythonMot-clKeywordQsciLexerPython NombreNumberQsciLexerPythonOprateurOperatorQsciLexerPythonRChaine de caractres (guillemets simples)Single-quoted stringQsciLexerPython\Chaine de caractres HTML (guillemets simples)Triple double-quoted stringQsciLexerPython\Chaine de caractres HTML (guillemets simples)Triple single-quoted stringQsciLexerPythonBChaine de caractres non refermeUnclosed stringQsciLexerPythonQuotes inverses Backticks QsciLexerRubyNom de classe Class name QsciLexerRubyCommentaireComment QsciLexerRuby$Section de donnes Data section QsciLexerRubyPar dfautDefault QsciLexerRubyRChaine de caractres (guillemets doubles)Double-quoted string QsciLexerRuby ErreurError QsciLexerRuby:Nom de mthode ou de fonctionFunction or method name QsciLexerRuby GlobalGlobal QsciLexerRubyIci document Here document QsciLexerRuby4Ici dlimiteur de documentHere document delimiter QsciLexerRubyIdentificateur Identifier QsciLexerRubyMot-clKeyword QsciLexerRubyNom de module Module name QsciLexerRuby NombreNumber QsciLexerRubyOprateurOperator QsciLexerRubyPODPOD QsciLexerRuby(Expression rgulireRegular expression QsciLexerRubyRChaine de caractres (guillemets simples)Single-quoted string QsciLexerRubySymboleSymbol QsciLexerRubystderr QsciLexerRubystdin QsciLexerRubystdout QsciLexerRuby"# Ligne commente# comment line QsciLexerSQLCommentaireComment QsciLexerSQLLigne commente Comment line QsciLexerSQLPar dfautDefault QsciLexerSQLRChaine de caractres (guillemets doubles)Double-quoted string QsciLexerSQLIdentificateur Identifier QsciLexerSQLMot-cl JavaDocJavaDoc keyword QsciLexerSQL2Erreur de mot-cl JavaDocJavaDoc keyword error QsciLexerSQL2Commentaire style JavaDocJavaDoc style comment QsciLexerSQLMot-clKeyword QsciLexerSQL NombreNumber QsciLexerSQLOprateurOperator QsciLexerSQL(Commentaire SQL*PlusSQL*Plus comment QsciLexerSQL Mot-cl SQL*PlusSQL*Plus keyword QsciLexerSQLPrompt SQL*PlusSQL*Plus prompt QsciLexerSQLRChaine de caractres (guillemets simples)Single-quoted string QsciLexerSQL0Dfinition utilisateur 1User defined 1 QsciLexerSQL0Dfinition utilisateur 2User defined 2 QsciLexerSQL0Dfinition utilisateur 3User defined 3 QsciLexerSQL0Dfinition utilisateur 4User defined 4 QsciLexerSQLCommandeCommandQsciLexerSpiceCommentaireCommentQsciLexerSpicePar dfautDefaultQsciLexerSpiceDlimiteur DelimiterQsciLexerSpiceFonctionFunctionQsciLexerSpiceIdentificateur IdentifierQsciLexerSpice NombreNumberQsciLexerSpiceParamtre ParameterQsciLexerSpice ValeurValueQsciLexerSpiceCommentaireComment QsciLexerTCL*Block de commentaires Comment block QsciLexerTCLLigne commente Comment line QsciLexerTCLPar dfautDefault QsciLexerTCLIdentificateur Identifier QsciLexerTCL NombreNumber QsciLexerTCLOprateurOperator QsciLexerTCLSubstitution Substitution QsciLexerTCL0Dfinition utilisateur 1User defined 1 QsciLexerTCL0Dfinition utilisateur 2User defined 2 QsciLexerTCL0Dfinition utilisateur 3User defined 3 QsciLexerTCL0Dfinition utilisateur 4User defined 4 QsciLexerTCLCommandeCommand QsciLexerTeXPar dfautDefault QsciLexerTeX GroupeGroup QsciLexerTeXSpcialSpecial QsciLexerTeXSymboleSymbol QsciLexerTeX TexteText QsciLexerTeXAttribut Attribute QsciLexerVHDLCommentaireComment QsciLexerVHDL*Block de commentaires Comment block QsciLexerVHDLLigne commente Comment line QsciLexerVHDLPar dfautDefault QsciLexerVHDLIdentificateur Identifier QsciLexerVHDLMot-clKeyword QsciLexerVHDL NombreNumber QsciLexerVHDLOprateurOperator QsciLexerVHDL(Chane de caractresString QsciLexerVHDLBChaine de caractres non refermeUnclosed string QsciLexerVHDL,Dfinition utilisateur User defined QsciLexerVHDLCommentaireCommentQsciLexerVerilogPar dfautDefaultQsciLexerVerilogIdentificateur IdentifierQsciLexerVerilog(Commentaire de ligne Line commentQsciLexerVerilog NombreNumberQsciLexerVerilogOprateurOperatorQsciLexerVerilogHSeconds mots-cls et identificateurs"Secondary keywords and identifiersQsciLexerVerilog(Chane de caractresStringQsciLexerVerilogBChaine de caractres non refermeUnclosed stringQsciLexerVerilogCommentaireComment QsciLexerYAMLPar dfautDefault QsciLexerYAML,Dlimiteur de documentDocument delimiter QsciLexerYAMLIdentificateur Identifier QsciLexerYAMLMot-clKeyword QsciLexerYAML NombreNumber QsciLexerYAMLOprateurOperator QsciLexerYAMLRfrence Reference QsciLexerYAMLsqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_fr.ts000066400000000000000000004344061316047212700240570ustar00rootroot00000000000000 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 Remonter au début du document Scroll to end of document Descendre à la fin du document Scroll vertically to centre current line Défiler verticalement pour centrer la ligne courante 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 Déplacement vers fin du mot précédent Extend selection to end of previous word Extension de la sélection vers fin du mot précédent Move to end of next word Déplacement vers fin du mot suivant Extend selection to end of next word Extension de la sélection vers fin du mot suivant 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 Déplacement vers début de ligne du document Extend selection to start of document line Extension de la sélection vers début de ligne du document 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 Filtre Plugin Extension Function Fonction 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 Ici délimiteur de document 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é CSS3 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 Instance property 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é DDoc DDoc keyword error Erreur de mot-clé DDoc 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 Ligne changée 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 Fonction intrinsèque Extended function Fonction étendue 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 QsciLexerJSON Default Par défaut Number Nombre String Chaîne de caractères Unclosed string Chaine de caractères non refermée Property Propriété Escape sequence Séquence d'échappement Line comment Commentaire de ligne Block comment Block de commentaires Operator Opérateur IRI JSON-LD compact IRI JSON keyword Mot-clé JSON JSON-LD keyword Mot-clé JSON-LD Parsing error Erreur d'analyse 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 QsciLexerMarkdown Default Par défaut Special Spécial Strong emphasis using double asterisks Strong emphasis using double underscores Emphasis using single asterisks Emphasis using single underscores Level 1 header Level 2 header Level 3 header Level 4 header Level 5 header Level 6 header Pre-char Unordered list item Ordered list item Block quote Strike out Horizontal rule Link Code between backticks Code between double backticks Code block 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 Nombre hexadécimal Unclosed string Chaine de caractères non refermée Character Caractère Inline asm Asm en ligne 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 Ici délimiteur de document 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 Traduction 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 Commentaire DSC DSC comment value Number Nombre Name Nom 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 Clé 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 Global Symbol Symbole Module name Nom de module Instance variable Class variable Backticks Quotes inverses Data section Section de données Here document delimiter Ici délimiteur de document Here document Ici 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 Fonction Parameter Paramètre Number Nombre Delimiter Délimiteur 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 Définition utilisateur 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 Référence Document delimiter Délimiteur de document Text block marker Syntax error marker Operator Opérateur QsciScintilla &Undo &Redo Cu&t &Copy &Paste Delete Select All sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.qm000066400000000000000000001403631316047212700245410ustar00rootroot00000000000000'\8p\8uw\8}\8\80\8E\8\8r\8\8K\8\81\8\8N\8#r)fr4rvB:SzB555%51575=\5t5|u55W55555x5555G#xG8Gq[Gv,GGGa9\9\ T*/?^tQj_p}(}3}>d('l.;K%bȐȐ}Ȑ"%Ȑ(Ȑ.Ȑ3Ȑ8Ȑ>`Ȑq!ȐuȐyȐ}8ȐȐfȐyȐȐHȐ~ȐdȐEȐȐWѽ8ԇ fKu  "S3)6%)N6|_u]&d*Sd*id*d*oi-܌UGf@(ib _LW&[*X]3g{j 2|^7M"6l"r"lT e~"`~#~0J~z|B-2c2n<{jC2LC ~ &0'! &0'| ?3k @|Um okK @tw Nd o !: ^b R  $ , 1C < {      X$ = i _C 4Z '4$F *S *Sr *S? Iq> S S d8: d8{0 d8 d8N d< d< u d<" d<; d<a WDU f- oI o 'O E Sv '\ K '[M xC  .  . El_ 943s> @&4d @*$d _rx t}4l t}48! t}4p t}4t t}4 t}4 & ?DEV Ig* Ig5 Ig9 Ig? Igq Igw- Ig` Ig: Ig Ig Ig t& t2- t `^N .jd yH'WoJ ck /P' 9 G=e`>VcrW\Y]gJYeTRDhwVirf ldAwgej{F&4Q*.5U?}tBBF,)w#ƦnCL kCj;2'2W@H#}w04+4RΒao2\)tnETe_iCancelarCancel QsciCommandDConverter a seleo para minsculaConvert selection to lower case QsciCommandDConverter a seleo para maisculaConvert selection to upper case QsciCommand$Copiar linha atualCopy current line QsciCommandCopiar seleoCopy selection QsciCommand,Configurar linha atualCut current line QsciCommand Recortar seleo Cut selection QsciCommand.Excluir caractere atualDelete current character QsciCommand&Excluir linha atualDelete current line QsciCommand0Excluir linha a esquerdaDelete line to left QsciCommand4Excluir linha para direitaDelete line to right QsciCommand4Excluir caractere anteriorDelete previous character QsciCommand4Excluir palavra a esquerdaDelete word to left QsciCommand8Excluir palavra para direitaDelete word to right QsciCommanddExtender a seleo retangular uma linha para baixo*Extend rectangular selection down one line QsciCommandfExtender a seleo retangular uma pgina para baixo*Extend rectangular selection down one page QsciCommandpExtender a seleo retangular um caractere para esquerda/Extend rectangular selection left one character QsciCommandnExtender a seleo retangular um caractere para direita0Extend rectangular selection right one character QsciCommandbExtender a seleo retangular uma linha para cima(Extend rectangular selection up one line QsciCommanddExtender a seleo retangular uma pgina para cima(Extend rectangular selection up one page QsciCommandNExtender a seleo uma linha para baixoExtend selection down one line QsciCommandPExtender a seleo uma pgina para baixoExtend selection down one page QsciCommandVExtender a seleo um paragrafo para baixo#Extend selection down one paragraph QsciCommandZExtender a seleo um caractere para esquerda#Extend selection left one character QsciCommandXExtender a seleo uma palavra para esquerdaExtend selection left one word QsciCommandjExtender a seleo uma parte de palavra para esquerda#Extend selection left one word part QsciCommandXExtender a seleo um caractere para direita$Extend selection right one character QsciCommandVExtender a seleo uma palavra para direitaExtend selection right one word QsciCommandhExtender a seleo uma parte de palavra para direita$Extend selection right one word part QsciCommandLExtender a seleo uma linha para cimaExtend selection up one line QsciCommandNExtender a seleo uma pgina para cimaExtend selection up one page QsciCommandRExtender a seleo um paragrafo para cima!Extend selection up one paragraph QsciCommand*Alimentao da PginaFormfeed QsciCommand"Indentar um nvelIndent one level QsciCommand4Mover uma linha para baixoMove down one line QsciCommand6Mover uma pgina para baixoMove down one page QsciCommand:Mover um paragrafo para baixoMove down one paragraph QsciCommandDMover um caractere para a esquerdaMove left one character QsciCommand>Mover uma palavra para esquerdaMove left one word QsciCommandPMover uma parte da palavra para esquerdaMove left one word part QsciCommand>Mover um caractere para direitaMove right one character QsciCommand<Mover uma palavra para direitaMove right one word QsciCommandNMover uma parte da palavra para direitaMove right one word part QsciCommand2Mover uma linha para cimaMove up one line QsciCommand4Mover uma pgina para cimaMove up one page QsciCommand8Mover um paragrafo para cimaMove up one paragraph QsciCommand CopiarPaste QsciCommand,Refazer ltimo comandoRedo last command QsciCommandFDescer a viso uma linha para baixoScroll view down one line QsciCommandBSubir a viso uma linha para cimaScroll view up one line QsciCommandXAlternar entre modo de inserir/sobreescreverToggle insert/overtype QsciCommandAumentar zoomZoom in QsciCommandDiminuir zoomZoom out QsciCommand PadroDefault QsciLexerAVS^Cadeia de caracteres envolvida por aspas duplasDouble-quoted string QsciLexerAVSIdentificador Identifier QsciLexerAVSPalavra ChaveKeyword QsciLexerAVSComentar Linha Line comment QsciLexerAVS NmeroNumber QsciLexerAVSOperadorOperator QsciLexerAVShCadeia de caracteres envolvida por trs aspas duplasTriple double-quoted string QsciLexerAVS Aspas Invertidas Backticks QsciLexerBashComentrioComment QsciLexerBash PadroDefault QsciLexerBash^Cadeia de caracteres envolvida por aspas duplasDouble-quoted string QsciLexerBash NmeroError QsciLexerBash>Delimitador de "here documents"Here document delimiter QsciLexerBashIdentificador Identifier QsciLexerBashPalavra ChaveKeyword QsciLexerBash NmeroNumber QsciLexerBashOperadorOperator QsciLexerBash*Parmetro de ExpansoParameter expansion QsciLexerBashEscalarScalar QsciLexerBashV"here document" envolvido por aspas simplesSingle-quoted here document QsciLexerBash`Cadeia de caracteres envolvida por aspas simplesSingle-quoted string QsciLexerBashComentrioCommentQsciLexerBatch PadroDefaultQsciLexerBatchComando externoExternal commandQsciLexerBatch:Esconder caractere de comandoHide command characterQsciLexerBatchPalavra ChaveKeywordQsciLexerBatch RtuloLabelQsciLexerBatchOperadorOperatorQsciLexerBatchVarivelVariableQsciLexerBatchComentrioCommentQsciLexerCMake PadroDefaultQsciLexerCMake RtuloLabelQsciLexerCMake NmeroNumberQsciLexerCMake(Cadeia de CaracteresStringQsciLexerCMakeVarivelVariableQsciLexerCMakeComentrio C C comment QsciLexerCPPComentrio C++ C++ comment QsciLexerCPP PadroDefault QsciLexerCPP^Cadeia de caracteres envolvida por aspas duplasDouble-quoted string QsciLexerCPPHClasses e definies de tipo globaisGlobal classes and typedefs QsciLexerCPPIdentificador Identifier QsciLexerCPP*Palavra chave JavaDocJavaDoc keyword QsciLexerCPP@Erro de palavra chave do JavaDocJavaDoc keyword error QsciLexerCPP6Comentrio JavaDoc estilo CJavaDoc style C comment QsciLexerCPP:Comentrio JavaDoc estilo C++JavaDoc style C++ comment QsciLexerCPP8Expresso regular JavaScriptJavaScript regular expression QsciLexerCPPPalavra ChaveKeyword QsciLexerCPP NmeroNumber QsciLexerCPPOperadorOperator QsciLexerCPP>Instrues de pr-processamentoPre-processor block QsciLexerCPPXIdentificadores e palavras chave secundrias"Secondary keywords and identifiers QsciLexerCPP`Cadeia de caracteres envolvida por aspas simplesSingle-quoted string QsciLexerCPP@Cadeia de caracteres no fechadaUnclosed string QsciLexerCPPregra-@@-rule QsciLexerCSSAtributo Attribute QsciLexerCSS Propriedade CSS1 CSS1 property QsciLexerCSS Propriedade CSS2 CSS2 property QsciLexerCSS,Propriedade CSS2 {3 ?} CSS3 property QsciLexerCSS"Seletor de classeClass selector QsciLexerCSS PadroDefault QsciLexerCSS^Cadeia de caracteres envolvida por aspas duplasDouble-quoted string QsciLexerCSSSeletor de ID ID selector QsciLexerCSSImportante Important QsciLexerCSSOperadorOperator QsciLexerCSSPseudo-classe Pseudo-class QsciLexerCSS`Cadeia de caracteres envolvida por aspas simplesSingle-quoted string QsciLexerCSSMarcadorTag QsciLexerCSS0Propriedade desconhecidaUnknown property QsciLexerCSS4Pseudo-classe desconhecidaUnknown pseudo-class QsciLexerCSS ValorValue QsciLexerCSSVarivelVariable QsciLexerCSSPCadeia de caracteres no formato verbatimVerbatim stringQsciLexerCSharp PadroDefaultQsciLexerCoffeeScript^Cadeia de caracteres envolvida por aspas duplasDouble-quoted stringQsciLexerCoffeeScriptIdentificador IdentifierQsciLexerCoffeeScript*Palavra chave JavaDocJavaDoc keywordQsciLexerCoffeeScript@Erro de palavra chave do JavaDocJavaDoc keyword errorQsciLexerCoffeeScriptPalavra ChaveKeywordQsciLexerCoffeeScript NmeroNumberQsciLexerCoffeeScriptOperadorOperatorQsciLexerCoffeeScript>Instrues de pr-processamentoPre-processor blockQsciLexerCoffeeScript"Expresso RegularRegular expressionQsciLexerCoffeeScriptXIdentificadores e palavras chave secundrias"Secondary keywords and identifiersQsciLexerCoffeeScript`Cadeia de caracteres envolvida por aspas simplesSingle-quoted stringQsciLexerCoffeeScript@Cadeia de caracteres no fechadaUnclosed stringQsciLexerCoffeeScriptCaractere Character QsciLexerD*Palavra chave JavaDoc DDoc keyword QsciLexerD@Erro de palavra chave do JavaDocDDoc keyword error QsciLexerD PadroDefault QsciLexerDIdentificador Identifier QsciLexerDPalavra ChaveKeyword QsciLexerDComentar Linha Line comment QsciLexerD NmeroNumber QsciLexerDOperadorOperator QsciLexerD(Cadeia de CaracteresString QsciLexerD@Cadeia de caracteres no fechadaUnclosed string QsciLexerD,Definio de usurio 1User defined 1 QsciLexerD,Definio de usurio 2User defined 2 QsciLexerD,Definio de usurio 3User defined 3 QsciLexerD Linha Adicionada Added line QsciLexerDiffComandoCommand QsciLexerDiffComentrioComment QsciLexerDiff PadroDefault QsciLexerDiffCabealhoHeader QsciLexerDiffPosioPosition QsciLexerDiffLinha Removida Removed line QsciLexerDiffComentrioCommentQsciLexerFortran77 PadroDefaultQsciLexerFortran77^Cadeia de caracteres envolvida por aspas duplasDouble-quoted stringQsciLexerFortran77Identificador IdentifierQsciLexerFortran77Palavra ChaveKeywordQsciLexerFortran77 RtuloLabelQsciLexerFortran77 NmeroNumberQsciLexerFortran77OperadorOperatorQsciLexerFortran77>Instrues de pr-processamentoPre-processor blockQsciLexerFortran77`Cadeia de caracteres envolvida por aspas simplesSingle-quoted stringQsciLexerFortran77@Cadeia de caracteres no fechadaUnclosed stringQsciLexerFortran772Comentrio JavaScript ASPASP JavaScript comment QsciLexerHTML2JavaScript ASP por padroASP JavaScript default QsciLexerHTML|Cadeia de caracteres JavaScript ASP envolvida por aspas duplas#ASP JavaScript double-quoted string QsciLexerHTML8Palavra chave JavaScript ASPASP JavaScript keyword QsciLexerHTMLDComentrio de linha JavaScript ASPASP JavaScript line comment QsciLexerHTML*Nmero JavaScript ASPASP JavaScript number QsciLexerHTML@Expresso regular JavaScript ASP!ASP JavaScript regular expression QsciLexerHTML~Cadeia de caracteres JavaScript ASP envolvida por aspas simples#ASP JavaScript single-quoted string QsciLexerHTML,Smbolo JavaScript ASPASP JavaScript symbol QsciLexerHTML^Cadeia de caracteres JavaScript ASP no fechadaASP JavaScript unclosed string QsciLexerHTML8Palavra chave JavaScript ASPASP JavaScript word QsciLexerHTML2Nome de classe Python ASPASP Python class name QsciLexerHTML*Comentrio Python ASPASP Python comment QsciLexerHTML*Python ASP por padroASP Python default QsciLexerHTMLtCadeia de caracteres Python ASP envolvida por aspas duplasASP Python double-quoted string QsciLexerHTMLFNome de mtodo ou funo Python ASP"ASP Python function or method name QsciLexerHTML0Identificador Python ASPASP Python identifier QsciLexerHTML0Palavra chave Python ASPASP Python keyword QsciLexerHTML"Nmero Python ASPASP Python number QsciLexerHTML&Operador Python ASPASP Python operator QsciLexerHTMLvCadeia de caracteres Python ASP envolvida por aspas simplesASP Python single-quoted string QsciLexerHTMLCadeia de caracteres Python ASP envolvida por aspas triplas duplas&ASP Python triple double-quoted string QsciLexerHTMLCadeia de caracteres Python ASP envolvida por aspas triplas simples&ASP Python triple single-quoted string QsciLexerHTML.Comentrio VBScript ASPASP VBScript comment QsciLexerHTML.VBScript ASP por padroASP VBScript default QsciLexerHTML4Identificador VBScript ASPASP VBScript identifier QsciLexerHTML4Palavra chave VBScript ASPASP VBScript keyword QsciLexerHTML&Nmero VBScript ASPASP VBScript number QsciLexerHTMLBCadeia de caracteres VBScript ASPASP VBScript string QsciLexerHTMLZCadeia de caracteres VBScript ASP no fechadaASP VBScript unclosed string QsciLexerHTML*Comentrio ASP X-CodeASP X-Code comment QsciLexerHTMLAtributo Attribute QsciLexerHTML CDATACDATA QsciLexerHTML(Final de um marcador End of a tag QsciLexerHTML*Final de um bloco XMLEnd of an XML fragment QsciLexerHTMLEntidadeEntity QsciLexerHTMLhPrimeiro comentrio de parmetro de uma comando SGML*First parameter comment of an SGML command QsciLexerHTMLJPrimeiro parmetro em um comando SGML"First parameter of an SGML command QsciLexerHTMLComentrio HTML HTML comment QsciLexerHTMLHTML por padro HTML default QsciLexerHTMLhCadeia de caracteres HTML envolvida por aspas duplasHTML double-quoted string QsciLexerHTMLNmero HTML HTML number QsciLexerHTMLjCadeia de caracteres HTML envolvida por aspas simplesHTML single-quoted string QsciLexerHTMLVComentrio JavaScript ASP no estilo JavaDoc$JavaDoc style ASP JavaScript comment QsciLexerHTMLNComentrio JavaScript no estilo JavaDoc JavaDoc style JavaScript comment QsciLexerHTML*Comentrio JavaScriptJavaScript comment QsciLexerHTML*JavaScript por padroJavaScript default QsciLexerHTMLtCadeia de caracteres JavaScript envolvida por aspas duplasJavaScript double-quoted string QsciLexerHTML0Palavra chave JavaScriptJavaScript keyword QsciLexerHTML<Comentrio de linha JavaScriptJavaScript line comment QsciLexerHTML"Nmero JavaScriptJavaScript number QsciLexerHTML8Expresso regular JavaScriptJavaScript regular expression QsciLexerHTMLvCadeia de caracteres JavaScript envolvida por aspas simplesJavaScript single-quoted string QsciLexerHTML$Smbolo JavaScriptJavaScript symbol QsciLexerHTMLVCadeia de caracteres JavaScript no fechadaJavaScript unclosed string QsciLexerHTML$Palavra JavaScriptJavaScript word QsciLexerHTML4Outro texto em um marcadorOther text in a tag QsciLexerHTMLComentrio PHP PHP comment QsciLexerHTMLPHP por padro PHP default QsciLexerHTMLfCadeia de caracteres PHP envolvida por aspas duplasPHP double-quoted string QsciLexerHTMLNVarivel PHP envolvida por aspas duplasPHP double-quoted variable QsciLexerHTML"Palavra chave PHP PHP keyword QsciLexerHTML.Comentrio de linha PHPPHP line comment QsciLexerHTMLNmero PHP PHP number QsciLexerHTMLOperador PHP PHP operator QsciLexerHTMLhCadeia de caracteres PHP envolvida por aspas simplesPHP single-quoted string QsciLexerHTMLVarivel PHP PHP variable QsciLexerHTML*Nome de classe PythonPython class name QsciLexerHTML"Comentrio PythonPython comment QsciLexerHTML"Python por padroPython default QsciLexerHTMLlCadeia de caracteres Python envolvida por aspas duplasPython double-quoted string QsciLexerHTML>Nome de mtodo ou funo PythonPython function or method name QsciLexerHTML(Identificador PythonPython identifier QsciLexerHTML(Palavra chave PythonPython keyword QsciLexerHTMLNmero Python Python number QsciLexerHTMLOperador PythonPython operator QsciLexerHTMLnCadeia de caracteres Python envolvida por aspas simplesPython single-quoted string QsciLexerHTML|Cadeia de caracteres Python envolvida por aspas triplas duplas"Python triple double-quoted string QsciLexerHTML~Cadeia de caracteres Python envolvida por aspas triplas simples"Python triple single-quoted string QsciLexerHTML*Bloco SGML por padroSGML block default QsciLexerHTMLComando SGML SGML command QsciLexerHTMLComando SGML SGML comment QsciLexerHTMLSGML por padro SGML default QsciLexerHTMLhCadeia de caracteres SGML envolvida por aspas duplasSGML double-quoted string QsciLexerHTMLErro SGML SGML error QsciLexerHTMLjCadeia de caracteres SGML envolvida por aspas simplesSGML single-quoted string QsciLexerHTML,Entidade especial SGMLSGML special entity QsciLexerHTML$Marcador de script Script tag QsciLexerHTML:Incio de um bloco JavascriptStart of a JavaScript fragment QsciLexerHTML,Incio de um bloco PHPStart of a PHP fragment QsciLexerHTML2Incio de um bloco PythonStart of a Python fragment QsciLexerHTML6Incio de um bloco VBScriptStart of a VBScript fragment QsciLexerHTMLBIncio de um bloco Javascript ASP#Start of an ASP JavaScript fragment QsciLexerHTML:Incio de um bloco Python ASPStart of an ASP Python fragment QsciLexerHTML>Incio de um bloco VBScript ASP!Start of an ASP VBScript fragment QsciLexerHTML,Incio de um bloco ASPStart of an ASP fragment QsciLexerHTML8Incio de um bloco ASP com @Start of an ASP fragment with @ QsciLexerHTML,Incio de um bloco XMLStart of an XML fragment QsciLexerHTMLMarcadorTag QsciLexerHTML*Atributo desconhecidoUnknown attribute QsciLexerHTML*Marcador desconhecido Unknown tag QsciLexerHTMLDValor HTML no envolvido por aspasUnquoted HTML value QsciLexerHTML&Comentrio VBScriptVBScript comment QsciLexerHTML&VBScript por padroVBScript default QsciLexerHTML,Identificador VBScriptVBScript identifier QsciLexerHTML,Palavra chave VBScriptVBScript keyword QsciLexerHTMLNmero VBScriptVBScript number QsciLexerHTML:Cadeia de caracteres VBScriptVBScript string QsciLexerHTMLRCadeia de caracteres VBScript no fechadaVBScript unclosed string QsciLexerHTMLUUIDUUID QsciLexerIDL PadroDefault QsciLexerJSONComentar Linha Line comment QsciLexerJSON NmeroNumber QsciLexerJSONOperadorOperator QsciLexerJSON(Cadeia de CaracteresString QsciLexerJSON@Cadeia de caracteres no fechadaUnclosed string QsciLexerJSON"Expresso RegularRegular expressionQsciLexerJavaScriptFunes bsicasBasic functions QsciLexerLuaCaractere Character QsciLexerLuaComentrioComment QsciLexerLuaVFunes auxiiares, e/s e funes de sistema%Coroutines, i/o and system facilities QsciLexerLua PadroDefault QsciLexerLuaIdentificador Identifier QsciLexerLuaPalavra ChaveKeyword QsciLexerLua RtuloLabel QsciLexerLuaComentar Linha Line comment QsciLexerLua8Cadeia de caracteres literalLiteral string QsciLexerLua NmeroNumber QsciLexerLuaOperadorOperator QsciLexerLuaPreprocessador Preprocessor QsciLexerLua(Cadeia de CaracteresString QsciLexerLuapFunes de cadeia de caracteres e de tabelas matemticas!String, table and maths functions QsciLexerLua@Cadeia de caracteres no fechadaUnclosed string QsciLexerLua,Definio de usurio 1User defined 1 QsciLexerLua,Definio de usurio 2User defined 2 QsciLexerLua,Definio de usurio 3User defined 3 QsciLexerLua,Definio de usurio 4User defined 4 QsciLexerLuaComentrioCommentQsciLexerMakefile PadroDefaultQsciLexerMakefileErroErrorQsciLexerMakefileOperadorOperatorQsciLexerMakefilePreprocessador PreprocessorQsciLexerMakefileDestinoTargetQsciLexerMakefileVarivelVariableQsciLexerMakefile PadroDefaultQsciLexerMarkdownEspecialSpecialQsciLexerMarkdownComandoCommandQsciLexerMatlabComentrioCommentQsciLexerMatlab PadroDefaultQsciLexerMatlab^Cadeia de caracteres envolvida por aspas duplasDouble-quoted stringQsciLexerMatlabIdentificador IdentifierQsciLexerMatlabPalavra ChaveKeywordQsciLexerMatlab NmeroNumberQsciLexerMatlabOperadorOperatorQsciLexerMatlab`Cadeia de caracteres envolvida por aspas simplesSingle-quoted stringQsciLexerMatlabComentrioComment QsciLexerPO PadroDefault QsciLexerPODiretiva ruim Bad directive QsciLexerPOVComentrioComment QsciLexerPOVComentar Linha Comment line QsciLexerPOV PadroDefault QsciLexerPOVDiretiva Directive QsciLexerPOVIdentificador Identifier QsciLexerPOV NmeroNumber QsciLexerPOV0Objetos, CSG e aparnciaObjects, CSG and appearance QsciLexerPOVOperadorOperator QsciLexerPOV(Funes predefinidasPredefined functions QsciLexerPOV8Identificadores predefinidosPredefined identifiers QsciLexerPOV(Cadeia de CaracteresString QsciLexerPOV8Tipos, modificadores e itensTypes, modifiers and items QsciLexerPOV@Cadeia de caracteres no fechadaUnclosed string QsciLexerPOV,Definio de usurio 1User defined 1 QsciLexerPOV,Definio de usurio 2User defined 2 QsciLexerPOV,Definio de usurio 3User defined 3 QsciLexerPOVCaractere CharacterQsciLexerPascal PadroDefaultQsciLexerPascalIdentificador IdentifierQsciLexerPascalPalavra ChaveKeywordQsciLexerPascalComentar Linha Line commentQsciLexerPascal NmeroNumberQsciLexerPascalOperadorOperatorQsciLexerPascal`Cadeia de caracteres envolvida por aspas simplesSingle-quoted stringQsciLexerPascal@Cadeia de caracteres no fechadaUnclosed stringQsciLexerPascal VetorArray QsciLexerPerl\"here document" envolvido por aspas invertidasBacktick here document QsciLexerPerl Aspas Invertidas Backticks QsciLexerPerlComentrioComment QsciLexerPerlSeo de dados Data section QsciLexerPerl PadroDefault QsciLexerPerlT"here document" envolvido por aspas duplasDouble-quoted here document QsciLexerPerl^Cadeia de caracteres envolvida por aspas duplasDouble-quoted string QsciLexerPerlErroError QsciLexerPerlHashHash QsciLexerPerlDelimitador de documentos criados atravs de redicionadores (>> e >)Here document delimiter QsciLexerPerlIdentificador Identifier QsciLexerPerlPalavra ChaveKeyword QsciLexerPerl NmeroNumber QsciLexerPerlOperadorOperator QsciLexerPerlPODPOD QsciLexerPerl.POD em formato verbatim POD verbatim QsciLexerPerlXCadeia de caracteres envolvida por aspas (q)Quoted string (q) QsciLexerPerlZCadeia de caracteres envolvida por aspas (qq)Quoted string (qq) QsciLexerPerlZCadeia de caracteres envolvida por aspas (qr)Quoted string (qr) QsciLexerPerlZCadeia de caracteres envolvida por aspas (qw)Quoted string (qw) QsciLexerPerlZCadeia de caracteres envolvida por aspas (qx)Quoted string (qx) QsciLexerPerl"Expresso RegularRegular expression QsciLexerPerlEscalarScalar QsciLexerPerlV"here document" envolvido por aspas simplesSingle-quoted here document QsciLexerPerl`Cadeia de caracteres envolvida por aspas simplesSingle-quoted string QsciLexerPerlSubstituio Substitution QsciLexerPerl$Tabela de Smbolos Symbol table QsciLexerPerlComentrioCommentQsciLexerPostScript PadroDefaultQsciLexerPostScriptPalavra ChaveKeywordQsciLexerPostScript NmeroNumberQsciLexerPostScript TextoTextQsciLexerPostScriptAtribuio AssignmentQsciLexerPropertiesComentrioCommentQsciLexerProperties PadroDefaultQsciLexerPropertiesValor Padro Default valueQsciLexerProperties SeoSectionQsciLexerPropertiesNome da classe Class nameQsciLexerPythonComentrioCommentQsciLexerPython(Bloco de comentrios Comment blockQsciLexerPython PadroDefaultQsciLexerPython^Cadeia de caracteres envolvida por aspas duplasDouble-quoted stringQsciLexerPython0Nome da funo ou mtodoFunction or method nameQsciLexerPythonIdentificador IdentifierQsciLexerPythonPalavra ChaveKeywordQsciLexerPython NmeroNumberQsciLexerPythonOperadorOperatorQsciLexerPython`Cadeia de caracteres envolvida por aspas simplesSingle-quoted stringQsciLexerPythonhCadeia de caracteres envolvida por trs aspas duplasTriple double-quoted stringQsciLexerPythonjCadeia de caracteres envolvida por trs aspas simplesTriple single-quoted stringQsciLexerPython@Cadeia de caracteres no fechadaUnclosed stringQsciLexerPython Aspas Invertidas Backticks QsciLexerRubyNome da classe Class name QsciLexerRubyComentrioComment QsciLexerRubySeo de dados Data section QsciLexerRuby PadroDefault QsciLexerRuby^Cadeia de caracteres envolvida por aspas duplasDouble-quoted string QsciLexerRuby0Nome da funo ou mtodoFunction or method name QsciLexerRubyIdentificador Identifier QsciLexerRubyPalavra ChaveKeyword QsciLexerRuby NmeroNumber QsciLexerRubyOperadorOperator QsciLexerRubyPODPOD QsciLexerRuby"Expresso RegularRegular expression QsciLexerRuby`Cadeia de caracteres envolvida por aspas simplesSingle-quoted string QsciLexerRubySmboloSymbol QsciLexerRuby8Comentrio de linha usando ## comment line QsciLexerSQLComentrioComment QsciLexerSQL&Comentrio de Linha Comment line QsciLexerSQL PadroDefault QsciLexerSQL^Cadeia de caracteres envolvida por aspas duplasDouble-quoted string QsciLexerSQLIdentificador Identifier QsciLexerSQL*Palavra chave JavaDocJavaDoc keyword QsciLexerSQL@Erro de palavra chave do JavaDocJavaDoc keyword error QsciLexerSQL2Comentrio estilo JavaDocJavaDoc style comment QsciLexerSQLPalavra ChaveKeyword QsciLexerSQL NmeroNumber QsciLexerSQLOperadorOperator QsciLexerSQL,Comentrio do SQL*PlusSQL*Plus comment QsciLexerSQL2Palavra chave do SQL*PlusSQL*Plus keyword QsciLexerSQL$Prompt do SQL*PlusSQL*Plus prompt QsciLexerSQL`Cadeia de caracteres envolvida por aspas simplesSingle-quoted string QsciLexerSQL,Definio de usurio 1User defined 1 QsciLexerSQL,Definio de usurio 2User defined 2 QsciLexerSQL,Definio de usurio 3User defined 3 QsciLexerSQL,Definio de usurio 4User defined 4 QsciLexerSQLComandoCommandQsciLexerSpiceComentrioCommentQsciLexerSpice PadroDefaultQsciLexerSpiceIdentificador IdentifierQsciLexerSpice NmeroNumberQsciLexerSpice ValorValueQsciLexerSpiceComentrioComment QsciLexerTCL(Bloco de comentrios Comment block QsciLexerTCL PadroDefault QsciLexerTCLIdentificador Identifier QsciLexerTCL NmeroNumber QsciLexerTCLOperadorOperator QsciLexerTCLSubstituio Substitution QsciLexerTCL,Definio de usurio 1User defined 1 QsciLexerTCL,Definio de usurio 2User defined 2 QsciLexerTCL,Definio de usurio 3User defined 3 QsciLexerTCL,Definio de usurio 4User defined 4 QsciLexerTCLComandoCommand QsciLexerTeX PadroDefault QsciLexerTeX GrupoGroup QsciLexerTeXEspecialSpecial QsciLexerTeXSmboloSymbol QsciLexerTeX TextoText QsciLexerTeXAtributo Attribute QsciLexerVHDLComentrioComment QsciLexerVHDL(Bloco de comentrios Comment block QsciLexerVHDL PadroDefault QsciLexerVHDLIdentificador Identifier QsciLexerVHDLPalavra ChaveKeyword QsciLexerVHDL NmeroNumber QsciLexerVHDLOperadorOperator QsciLexerVHDL(Cadeia de CaracteresString QsciLexerVHDL@Cadeia de caracteres no fechadaUnclosed string QsciLexerVHDLComentrioCommentQsciLexerVerilog PadroDefaultQsciLexerVerilogIdentificador IdentifierQsciLexerVerilogComentar Linha Line commentQsciLexerVerilog NmeroNumberQsciLexerVerilogOperadorOperatorQsciLexerVerilogXIdentificadores e palavras chave secundrias"Secondary keywords and identifiersQsciLexerVerilog(Cadeia de CaracteresStringQsciLexerVerilog@Cadeia de caracteres no fechadaUnclosed stringQsciLexerVerilogComentrioComment QsciLexerYAML PadroDefault QsciLexerYAMLIdentificador Identifier QsciLexerYAMLPalavra ChaveKeyword QsciLexerYAML NmeroNumber QsciLexerYAMLOperadorOperator QsciLexerYAMLsqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscintilla_pt_br.ts000066400000000000000000004415201316047212700245510ustar00rootroot00000000000000 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 Instance property 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 QsciLexerJSON Default Padrão Number Número String Cadeia de Caracteres Unclosed string Cadeia de caracteres não fechada Property Escape sequence Line comment Comentar Linha Block comment Operator Operador IRI JSON-LD compact IRI JSON keyword JSON-LD keyword Parsing error 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 QsciLexerMarkdown Default Padrão Special Especial Strong emphasis using double asterisks Strong emphasis using double underscores Emphasis using single asterisks Emphasis using single underscores Level 1 header Level 2 header Level 3 header Level 4 header Level 5 header Level 6 header Pre-char Unordered list item Ordered list item Block quote Strike out Horizontal rule Link Code between backticks Code between double backticks Code block 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qsciprinter.cpp000066400000000000000000000112061316047212700237110ustar00rootroot00000000000000// This module implements the QsciPrinter class. // // Copyright (c) 2017 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 sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp000066400000000000000000003317711316047212700242240ustar00rootroot00000000000000// 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) 2017 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"; // Forward declarations. static QColor asQColor(long sci_colour); // 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_MARGINRIGHTCLICK(int,int,int)), SLOT(handleMarginRightClick(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() && 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); } // Add an edge column. void QsciScintilla::addEdgeColumn(int colnr, const QColor &col) { SendScintilla(SCI_MULTIEDGEADDLINE, colnr, col); } // Clear all multi-edge columns. void QsciScintilla::clearEdgeColumns() { SendScintilla(SCI_MULTIEDGECLEARALL); } // Return the edge colour. QColor QsciScintilla::edgeColor() const { return asQColor(SendScintilla(SCI_GETEDGECOLOUR)); } // 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 tab draw mode. QsciScintilla::TabDrawMode QsciScintilla::tabDrawMode() const { return (TabDrawMode)SendScintilla(SCI_GETTABDRAWMODE); } // Set the tab draw mode. void QsciScintilla::setTabDrawMode(TabDrawMode mode) { SendScintilla(SCI_SETTABDRAWMODE, 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_MARGINRIGHTCLICK notification. void QsciScintilla::handleMarginRightClick(int pos, int modifiers, int margin) { int state = mapModifiers(modifiers); int line = SendScintilla(SCI_LINEFROMPOSITION, pos); emit marginRightClicked(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; } // Return the text between two positions. QString QsciScintilla::text(int start, int end) const { char *buf = new char[end - start + 1]; SendScintilla(SCI_GETTEXTRANGE, start, end, buf); QString text = bytesAsText(buf); delete[] buf; return text; } // Return the text as encoded bytes between two positions. QByteArray QsciScintilla::bytes(int start, int end) const { QByteArray bytes(end - start + 1, '\0'); SendScintilla(SCI_GETTEXTRANGE, start, end, bytes.data()); return bytes; } // 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 number of margins. int QsciScintilla::margins() const { return SendScintilla(SCI_GETMARGINS); } // Set the number of margins. void QsciScintilla::setMargins(int margins) { SendScintilla(SCI_SETMARGINS, margins); } // Return the margin background colour. QColor QsciScintilla::marginBackgroundColor(int margin) const { return asQColor(SendScintilla(SCI_GETMARGINBACKN, margin)); } // Set the margin background colour. void QsciScintilla::setMarginBackgroundColor(int margin, const QColor &col) { SendScintilla(SCI_SETMARGINBACKN, margin, col); } // 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); } } // Set the lexer. void QsciScintilla::setLexer(QsciLexer *lexer) { // Detach any current lexer. detachLexer(); // Connect up the new lexer. lex = lexer; if (lex) { SendScintilla(SCI_CLEARDOCUMENTSTYLE); 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, 0L); 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); if (start_pos >= end_pos) return QString(); return text(start_pos, end_pos); } // 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() & ~Qt::KeypadModifier)); 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); } // Convert a Scintilla colour to a QColor. static QColor asQColor(long sci_colour) { return QColor( ((int)sci_colour) & 0x00ff, ((int)(sci_colour >> 8)) & 0x00ff, ((int)(sci_colour >> 16)) & 0x00ff); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qsciscintillabase.cpp000066400000000000000000000504771316047212700250600ustar00rootroot00000000000000// This module implements the "official" low-level API. // // Copyright (c) 2017 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 { connectVerticalScrollBar(); connectHorizontalScrollBar(); 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 { Sci_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 { Sci_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. Note that this means that replacing the scrollbars // with custom versions does not work. 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; } // Connect up the vertical scroll bar. void QsciScintillaBase::connectVerticalScrollBar() { connect(verticalScrollBar(), SIGNAL(valueChanged(int)), SLOT(handleVSb(int))); } // Connect up the horizontal scroll bar. void QsciScintillaBase::connectHorizontalScrollBar() { connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), SLOT(handleHSb(int))); } //! Replace the vertical scroll bar. void QsciScintillaBase::replaceVerticalScrollBar(QScrollBar *scrollBar) { setVerticalScrollBar(scrollBar); connectVerticalScrollBar(); } // Replace the horizontal scroll bar. void QsciScintillaBase::replaceHorizontalScrollBar(QScrollBar *scrollBar) { setHorizontalScrollBar(scrollBar); connectHorizontalScrollBar(); } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscistyle.cpp000066400000000000000000000115221316047212700233670ustar00rootroot00000000000000// This module implements the QsciStyle class. // // Copyright (c) 2017 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() { } sqlitebrowser-3.10.1/libs/qscintilla/Qt4Qt5/qscistyledtext.cpp000066400000000000000000000031241316047212700244370ustar00rootroot00000000000000// This module implements the QsciStyledText class. // // Copyright (c) 2017 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); } sqlitebrowser-3.10.1/libs/qscintilla/README000066400000000000000000000002131316047212700204540ustar00rootroot00000000000000All the documentation for QScintilla for Qt v4 and Qt v5 (including installation instructions) can be found in doc/html-Qt4Qt5/index.html. sqlitebrowser-3.10.1/libs/qscintilla/include/000077500000000000000000000000001316047212700212235ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/include/ILexer.h000066400000000000000000000101171316047212700225640ustar00rootroot00000000000000// 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 #include "Sci_Position.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 Sci_Position SCI_METHOD Length() const = 0; virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0; virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0; virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0; virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0; virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0; virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0; virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0; virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0; virtual void SCI_METHOD StartStyling(Sci_Position position, char mask) = 0; virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0; virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0; virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0; virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0; virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position 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(Sci_Position line) = 0; }; class IDocumentWithLineEnd : public IDocument { public: virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0; virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0; virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *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 Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0; virtual const char * SCI_METHOD DescribeWordListSets() = 0; virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0; virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position 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, Sci_Position length) = 0; virtual void * SCI_METHOD ConvertToDocument() = 0; }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/include/License.txt000066400000000000000000000015441316047212700233520ustar00rootroot00000000000000License 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. sqlitebrowser-3.10.1/libs/qscintilla/include/Platform.h000066400000000000000000000350371316047212700231700ustar00rootroot00000000000000// 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; // 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_; } 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 #endif sqlitebrowser-3.10.1/libs/qscintilla/include/SciLexer.h000066400000000000000000001445641316047212700231300ustar00rootroot00000000000000/* 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_JSON 120 #define SCLEX_EDIFACT 121 #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_ERR_ESCSEQ 23 #define SCE_ERR_ESCSEQ_UNKNOWN 24 #define SCE_ERR_ES_BLACK 40 #define SCE_ERR_ES_RED 41 #define SCE_ERR_ES_GREEN 42 #define SCE_ERR_ES_BROWN 43 #define SCE_ERR_ES_BLUE 44 #define SCE_ERR_ES_MAGENTA 45 #define SCE_ERR_ES_CYAN 46 #define SCE_ERR_ES_GRAY 47 #define SCE_ERR_ES_DARK_GRAY 48 #define SCE_ERR_ES_BRIGHT_RED 49 #define SCE_ERR_ES_BRIGHT_GREEN 50 #define SCE_ERR_ES_YELLOW 51 #define SCE_ERR_ES_BRIGHT_BLUE 52 #define SCE_ERR_ES_BRIGHT_MAGENTA 53 #define SCE_ERR_ES_BRIGHT_CYAN 54 #define SCE_ERR_ES_WHITE 55 #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_BAAN_WORD3 11 #define SCE_BAAN_WORD4 12 #define SCE_BAAN_WORD5 13 #define SCE_BAAN_WORD6 14 #define SCE_BAAN_WORD7 15 #define SCE_BAAN_WORD8 16 #define SCE_BAAN_WORD9 17 #define SCE_BAAN_TABLEDEF 18 #define SCE_BAAN_TABLESQL 19 #define SCE_BAAN_FUNCTION 20 #define SCE_BAAN_DOMDEF 21 #define SCE_BAAN_FUNCDEF 22 #define SCE_BAAN_OBJECTDEF 23 #define SCE_BAAN_DEFINEDEF 24 #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_ABL_DEFAULT 0 #define SCE_ABL_NUMBER 1 #define SCE_ABL_WORD 2 #define SCE_ABL_STRING 3 #define SCE_ABL_CHARACTER 4 #define SCE_ABL_PREPROCESSOR 5 #define SCE_ABL_OPERATOR 6 #define SCE_ABL_IDENTIFIER 7 #define SCE_ABL_BLOCK 8 #define SCE_ABL_END 9 #define SCE_ABL_COMMENT 10 #define SCE_ABL_TASKMARKER 11 #define SCE_ABL_LINECOMMENT 12 #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_COFFEESCRIPT_INSTANCEPROPERTY 25 #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 #define SCE_JSON_DEFAULT 0 #define SCE_JSON_NUMBER 1 #define SCE_JSON_STRING 2 #define SCE_JSON_STRINGEOL 3 #define SCE_JSON_PROPERTYNAME 4 #define SCE_JSON_ESCAPESEQUENCE 5 #define SCE_JSON_LINECOMMENT 6 #define SCE_JSON_BLOCKCOMMENT 7 #define SCE_JSON_OPERATOR 8 #define SCE_JSON_URI 9 #define SCE_JSON_COMPACTIRI 10 #define SCE_JSON_KEYWORD 11 #define SCE_JSON_LDKEYWORD 12 #define SCE_JSON_ERROR 13 #define SCE_EDI_DEFAULT 0 #define SCE_EDI_SEGMENTSTART 1 #define SCE_EDI_SEGMENTEND 2 #define SCE_EDI_SEP_ELEMENT 3 #define SCE_EDI_SEP_COMPOSITE 4 #define SCE_EDI_SEP_RELEASE 5 #define SCE_EDI_UNA 6 #define SCE_EDI_UNH 7 #define SCE_EDI_BADSEGMENT 8 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ #endif sqlitebrowser-3.10.1/libs/qscintilla/include/Sci_Position.h000066400000000000000000000013231316047212700237750ustar00rootroot00000000000000// Scintilla source code edit control /** @file Sci_Position.h ** Define the Sci_Position type used in Scintilla's external interfaces. ** These need to be available to clients written in C so are not in a C++ namespace. **/ // Copyright 2015 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef SCI_POSITION_H #define SCI_POSITION_H // Basic signed type used throughout interface typedef int Sci_Position; // Unsigned variant used for ILexer::Lex and ILexer::Fold typedef unsigned int Sci_PositionU; // For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE typedef long Sci_PositionCR; #endif sqlitebrowser-3.10.1/libs/qscintilla/include/Scintilla.h000066400000000000000000001123621316047212700233230ustar00rootroot00000000000000/* 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 // Include header that defines basic numeric types. #if defined(_MSC_VER) // Older releases of MSVC did not have stdint.h. #include #else #include #endif // Define uptr_t, an unsigned integer type large enough to hold a pointer. typedef uintptr_t uptr_t; // Define sptr_t, a signed integer large enough to hold a pointer. typedef intptr_t sptr_t; #include "Sci_Position.h" 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 SCWS_VISIBLEONLYININDENT 3 #define SCI_GETVIEWWS 2020 #define SCI_SETVIEWWS 2021 #define SCTD_LONGARROW 0 #define SCTD_STRIKEOUT 1 #define SCI_GETTABDRAWMODE 2698 #define SCI_SETTABDRAWMODE 2699 #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 SC_MARGIN_COLOUR 6 #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 SCI_SETMARGINBACKN 2250 #define SCI_GETMARGINBACKN 2251 #define SCI_SETMARGINS 2252 #define SCI_GETMARGINS 2253 #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_FOLDDISPLAYTEXT 39 #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_OEM866 866 #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 SC_CASE_CAMEL 3 #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_POINT 18 #define INDIC_POINTCHARACTER 19 #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_TARGETFROMSELECTION 2287 #define SCI_TARGETWHOLEDOCUMENT 2690 #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 SCI_TOGGLEFOLDSHOWTEXT 2700 #define SC_FOLDDISPLAYTEXT_HIDDEN 0 #define SC_FOLDDISPLAYTEXT_STANDARD 1 #define SC_FOLDDISPLAYTEXT_BOXED 2 #define SCI_FOLDDISPLAYTEXTSETSTYLE 2701 #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 SCI_ISRANGEWORD 2691 #define SC_IDLESTYLING_NONE 0 #define SC_IDLESTYLING_TOVISIBLE 1 #define SC_IDLESTYLING_AFTERVISIBLE 2 #define SC_IDLESTYLING_ALL 3 #define SCI_SETIDLESTYLING 2692 #define SCI_GETIDLESTYLING 2693 #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_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 EDGE_MULTILINE 3 #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_MULTIEDGEADDLINE 2694 #define SCI_MULTIEDGECLEARALL 2695 #define SCI_SEARCHANCHOR 2366 #define SCI_SEARCHNEXT 2367 #define SCI_SEARCHPREV 2368 #define SCI_LINESONSCREEN 2370 #define SC_POPUP_NEVER 0 #define SC_POPUP_ALL 1 #define SC_POPUP_TEXT 2 #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 SCI_SETMOUSEWHEELCAPTURES 2696 #define SCI_GETMOUSEWHEELCAPTURES 2697 #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_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 SCVS_NOWRAPLINESTART 4 #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_MULTIPLESELECTADDNEXT 2688 #define SCI_MULTIPLESELECTADDEACH 2689 #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 SC_AC_FILLUP 1 #define SC_AC_DOUBLECLICK 2 #define SC_AC_TAB 3 #define SC_AC_NEWLINE 4 #define SC_AC_COMMAND 5 #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 #define SCN_AUTOCCOMPLETED 2030 #define SCN_MARGINRIGHTCLICK 2031 /* --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. */ struct Sci_CharacterRange { Sci_PositionCR cpMin; Sci_PositionCR cpMax; }; struct Sci_TextRange { struct Sci_CharacterRange chrg; char *lpstrText; }; struct Sci_TextToFind { struct Sci_CharacterRange chrg; const char *lpstrText; struct Sci_CharacterRange chrgText; }; 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; }; #ifndef __cplusplus /* For the GTK+ platform, g-ir-scanner needs to have these typedefs. This * is not required in C++ code and actually seems to break ScintillaEditPy */ typedef struct Sci_NotifyHeader Sci_NotifyHeader; typedef struct SCNotification SCNotification; #endif 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; }; struct SCNotification { Sci_NotifyHeader nmhdr; Sci_Position 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, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */ /* SCN_USERLISTSELECTION */ 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 */ Sci_Position length; /* SCN_MODIFIED */ Sci_Position linesAdded; /* SCN_MODIFIED */ int message; /* SCN_MACRORECORD */ uptr_t wParam; /* SCN_MACRORECORD */ sptr_t lParam; /* SCN_MACRORECORD */ Sci_Position 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 */ Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ int updated; /* SCN_UPDATEUI */ int listCompletionMethod; /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */ }; #ifdef INCLUDE_DEPRECATED_FEATURES #define SCI_SETKEYSUNICODE 2521 #define SCI_GETKEYSUNICODE 2522 #define CharacterRange Sci_CharacterRange #define TextRange Sci_TextRange #define TextToFind Sci_TextToFind #define RangeToFormat Sci_RangeToFormat #define NotifyHeader Sci_NotifyHeader #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/include/Scintilla.iface000066400000000000000000004374511316047212700241540ustar00rootroot00000000000000## 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. APIs marked as NUL-terminated 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 (not including NUL) 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 start, int lengthDelete) # 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 markerHandle,) # Delete a marker. fun void MarkerDeleteHandle=2018(int markerHandle,) # Is undo history being collected? get bool GetUndoCollection=2019(,) enu WhiteSpace=SCWS_ val SCWS_INVISIBLE=0 val SCWS_VISIBLEALWAYS=1 val SCWS_VISIBLEAFTERINDENT=2 val SCWS_VISIBLEONLYININDENT=3 # 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,) enu TabDrawMode=SCTD_ val SCTD_LONGARROW=0 val SCTD_STRIKEOUT=1 # Retrieve the current tab draw mode. # Returns one of SCTD_* constants. get int GetTabDrawMode=2698(,) # Set how tabs are drawn when visible. set void SetTabDrawMode=2699(int tabDrawMode,) # 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 caret,) # Set the selection anchor to a position. The anchor is the opposite # end of the selection from the caret. set void SetAnchor=2026(position anchor,) # Retrieve the text of the line containing the caret. # Returns the index of the caret on the line. # Result is NUL-terminated. 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 start. # The unused parameter is no longer used and should be set to 0. fun void StartStyling=2032(position start, int unused) # 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 window 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 markerSet) # 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 val SC_MARGIN_COLOUR=6 # 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,) # Set the background colour of a margin. Only visible for SC_MARGIN_COLOUR. set void SetMarginBackN=2250(int margin, colour back) # Retrieve the background colour of a margin get colour GetMarginBackN=2251(int margin,) # Allocate a non-standard number of margins. set void SetMargins=2252(int margins,) # How many margins are there?. get int GetMargins=2253(,) # 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_FOLDDISPLAYTEXT=39 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_OEM866=866 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 eolFilled) # 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 val SC_CASE_CAMEL=3 # 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 # Result is NUL-terminated. 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 caseVisible) 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 sizeHundredthPoints) # 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 keyDefinition is pressed perform sciCommand. fun void AssignCmdKey=2070(keymod keyDefinition, int sciCommand) # When key+modifier combination keyDefinition is pressed do nothing. fun void ClearCmdKey=2071(keymod keyDefinition,) # 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. # Returns 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_POINT=18 val INDIC_POINTCHARACTER=19 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 indicator, int indicatorStyle) # Retrieve the style of an indicator. get int IndicGetStyle=2081(int indicator,) # Set the foreground colour of an indicator. set void IndicSetFore=2082(int indicator, colour fore) # Retrieve the foreground colour of an indicator. get colour IndicGetFore=2083(int indicator,) # Set an indicator to draw under text or over(default). set void IndicSetUnder=2510(int indicator, bool under) # Retrieve whether indicator drawn under or over text. get bool IndicGetUnder=2511(int indicator,) # Set a hover indicator to plain, squiggle or TT. set void IndicSetHoverStyle=2680(int indicator, int indicatorStyle) # Retrieve the hover style of an indicator. get int IndicGetHoverStyle=2681(int indicator,) # Set the foreground hover colour of an indicator. set void IndicSetHoverFore=2682(int indicator, colour fore) # Retrieve the foreground hover colour of an indicator. get colour IndicGetHoverFore=2683(int indicator,) 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 indicator, int flags) # Retrieve the attributes of an indicator. get int IndicGetFlags=2685(int indicator,) # 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 lengthEntered parameter indicates how many characters before # the caret should be used to provide context. fun void AutoCShow=2100(int lengthEntered, 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 select) # 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 indentation) # 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(position start, position end) # Show or hide the horizontal scroll bar. set void SetHScrollBar=2130(bool visible,) # 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 caret,) # Sets the position that starts the selection - this becomes the anchor. set void SetSelectionStart=2142(position anchor,) # Returns the position at the start of the selection. get position GetSelectionStart=2143(,) # Sets the position that ends the selection - this becomes the caret. set void SetSelectionEnd=2144(position caret,) # 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 caret,) # 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 searchFlags, 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 anchor, position caret) # Retrieve the selected text. # Return the length of the text. # Result is NUL-terminated. 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 hide,) # 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. # Result is NUL-terminated. 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 start,) # 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 end,) # 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 text) # Make the target range start and end be the same as the selection range start and end. fun void TargetFromSelection=2287(,) # Sets the target to the whole document. fun void TargetWholeDocument=2690(,) # 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 searchFlags,) # 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 highlightStart, int highlightEnd) # 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 docLine,) # Find the document line of a display line taking hidden lines into account. fun int DocLineFromVisible=2221(int displayLine,) # The number of display lines needed to wrap a document line fun int WrapCount=2235(int docLine,) 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,) # Switch a header line between expanded and contracted and show some text after the line. fun void ToggleFoldShowText=2700(int line, string text) enu foldDisplayTextStyle=SC_FOLDDISPLAYTEXTSTYLE_ val SC_FOLDDISPLAYTEXT_HIDDEN=0 val SC_FOLDDISPLAYTEXT_STANDARD=1 val SC_FOLDDISPLAYTEXT_BOXED=2 # Set the style of fold display text set void FoldDisplayTextSetStyle=2701(int style,) 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) # Is the range start..end considered a word? fun bool IsRangeWord=2691(position start, position end) enu IdleStyling=SC_IDLESTYLING_ val SC_IDLESTYLING_NONE=0 val SC_IDLESTYLING_TOVISIBLE=1 val SC_IDLESTYLING_AFTERVISIBLE=2 val SC_IDLESTYLING_ALL=3 # Sets limits to idle styling. set void SetIdleStyling=2692(int idleStyling,) # Retrieve the limits to idle styling. get int GetIdleStyling=2693(,) 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 wrapMode,) # 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 wrapIndentMode,) # 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 cacheMode,) # 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 visible,) # 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 PhasesDraw=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 displayLine,) 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. # Result is NUL-terminated. get int GetTag=2616(int tagNumber, stringresult tagValue) # 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 one of the colours used as a chequerboard pattern in the fold margin fun void SetFoldMarginColour=2290(bool useSetting, colour back) # Set the other colour used as a chequerboard pattern in the fold margin 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(,) # Like Home but when word-wrap is enabled goes first to start of display line # HomeDisplay, then to start of document line Home. fun void HomeWrap=2349(,) # Like HomeExtend but when word-wrap is enabled extends first to start of display line # HomeDisplayExtend, then to start of document line HomeExtend. fun void HomeWrapExtend=2450(,) # Like LineEnd but when word-wrap is enabled goes first to end of display line # LineEndDisplay, then to start of document line LineEnd. fun void LineEndWrap=2451(,) # Like LineEndExtend but when word-wrap is enabled extends first to end of display line # LineEndDisplayExtend, then to start of document line LineEndExtend. fun void LineEndWrapExtend=2452(,) # Like VCHome but when word-wrap is enabled goes first to start of display line # VCHomeDisplay, then behaves like VCHome. fun void VCHomeWrap=2453(,) # Like VCHomeExtend but when word-wrap is enabled extends first to start of display line # VCHomeDisplayExtend, then behaves like VCHomeExtend. 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 posA, position posB) # Use specified indicator to highlight matching braces instead of changing their style. fun void BraceHighlightIndicator=2498(bool useSetting, 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 useSetting, int indicator) # Find the position of a matching brace or INVALID_POSITION if no match. # The maxReStyle must be 0 for now. It may be defined in a future release. fun position BraceMatch=2353(position pos, int maxReStyle) # 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 doc) # Set which document modification events are sent to the container. set void SetModEventMask=2359(int eventMask,) enu EdgeVisualStyle=EDGE_ val EDGE_NONE=0 val EDGE_LINE=1 val EDGE_BACKGROUND=2 val EDGE_MULTILINE=3 # 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/EDGE_MULTILINE) or by highlighting text that # goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). set void SetEdgeMode=2363(int edgeMode,) # Retrieve the colour used in edge indication. get colour GetEdgeColour=2364(,) # Change the colour used in edge indication. set void SetEdgeColour=2365(colour edgeColour,) # Add a new vertical edge to the view. fun void MultiEdgeAddLine=2694(int column, colour edgeColour) # Clear all vertical edges. fun void MultiEdgeClearAll=2695(,) # 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 searchFlags, 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 searchFlags, string text) # Retrieves the number of lines completely visible. get int LinesOnScreen=2370(,) enu PopUp=SC_POPUP_ val SC_POPUP_NEVER=0 val SC_POPUP_ALL=1 val SC_POPUP_TEXT=2 # Set whether a pop up menu is displayed automatically when the user presses # the wrong mouse button on certain areas. fun void UsePopUp=2371(int popUpMode,) # 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 zoomInPoints,) # 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 status,) # 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(,) # Set whether the mouse wheel can be active outside the window. set void SetMouseWheelCaptures=2696(bool captures,) # Get whether mouse wheel can be active outside the window. get bool GetMouseWheelCaptures=2697(,) 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 xOffset,) 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 beginning 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 wrapMode,) # 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 down one paragraph (delimited by empty lines). fun void ParaDown=2413(,) # Extend selection down one paragraph (delimited by empty lines). fun void ParaDownExtend=2414(,) # Move caret up one paragraph (delimited by empty lines). fun void ParaUp=2415(,) # Extend selection up one paragraph (delimited by empty lines). 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 selectionMode,) # 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 # Result is NUL-terminated. get int AutoCGetCurrentText=2610(, stringresult text) 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(position start, int lengthFill) # Turn a indicator off over a range. fun void IndicatorClearRange=2505(position start, int lengthClear) # Are any indicators present at pos? fun int IndicatorAllOnFor=2506(position pos,) # What value does a particular indicator have at a position? fun int IndicatorValueAt=2507(int indicator, position pos) # Where does a particular indicator start? fun int IndicatorStart=2508(int indicator, position pos) # Where does a particular indicator end? fun int IndicatorEnd=2509(int indicator, position pos) # 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 lengthRange bytes. get int GetRangePointer=2643(position start, int lengthRange) # Return a position which, to avoid performance costs, should not be within # the range of a call to GetRangePointer. get position GetGapPosition=2644(,) # 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 additionalCaretsVisible,) # 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(position caret, position anchor) # Add a selection fun int AddSelection=2573(position caret, position 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 the caret position of the nth selection. set void SetSelectionNCaret=2576(int selection, position caret) # Return the caret position of the nth selection. get position GetSelectionNCaret=2577(int selection,) # Set the anchor position of the nth selection. set void SetSelectionNAnchor=2578(int selection, position anchor) # Return the anchor position of the nth selection. get position GetSelectionNAnchor=2579(int selection,) # Set the virtual space of the caret of the nth selection. set void SetSelectionNCaretVirtualSpace=2580(int selection, int space) # Return the virtual space of the caret of the nth selection. get int GetSelectionNCaretVirtualSpace=2581(int selection,) # Set the virtual space of the anchor of the nth selection. set void SetSelectionNAnchorVirtualSpace=2582(int selection, int space) # Return the virtual space of the anchor of the nth selection. get int GetSelectionNAnchorVirtualSpace=2583(int selection,) # Sets the position that starts the selection - this becomes the anchor. set void SetSelectionNStart=2584(int selection, position anchor) # 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 caret) # Returns the position at the end of the selection. get position GetSelectionNEnd=2587(int selection,) # Set the caret position of the rectangular selection. set void SetRectangularSelectionCaret=2588(position caret,) # Return the caret position of the rectangular selection. get position GetRectangularSelectionCaret=2589(,) # Set the anchor position of the rectangular selection. set void SetRectangularSelectionAnchor=2590(position anchor,) # Return the anchor position of the rectangular selection. get position GetRectangularSelectionAnchor=2591(,) # Set the virtual space of the caret of the rectangular selection. set void SetRectangularSelectionCaretVirtualSpace=2592(int space,) # Return the virtual space of the caret of the rectangular selection. get int GetRectangularSelectionCaretVirtualSpace=2593(,) # Set the virtual space of the anchor of the rectangular selection. set void SetRectangularSelectionAnchorVirtualSpace=2594(int space,) # Return the virtual space of the anchor of the rectangular selection. get int GetRectangularSelectionAnchorVirtualSpace=2595(,) enu VirtualSpace=SCVS_ val SCVS_NONE=0 val SCVS_RECTANGULARSELECTION=1 val SCVS_USERACCESSIBLE=2 val SCVS_NOWRAPLINESTART=4 # Set options for virtual space behaviour. set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,) # Return options for virtual space behaviour. 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(,) # Add the next occurrence of the main selection to the set of selections as main. # If the current selection is empty then select word around caret. fun void MultipleSelectAddNext=2688(,) # Add each occurrence of the main selection in the target to the set of selections. # If the current selection is empty then select word around caret. fun void MultipleSelectAddEach=2689(,) # 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. # Result is NUL-terminated. 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. # Result is NUL-terminated. get int GetProperty=4008(string key, stringresult value) # Retrieve a "property" value previously set with SetProperty, # with "$()" variable replacement on returned buffer. # Result is NUL-terminated. get int GetPropertyExpanded=4009(string key, stringresult value) # Retrieve a "property" value previously set with SetProperty, # interpreted as an int AFTER any "$()" variable replacement. get int GetPropertyInt=4010(string key, int defaultValue) # 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. # Result is NUL-terminated. get int GetLexerLanguage=4012(, stringresult language) # 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. # Result is NUL-terminated. 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. # Result is NUL-terminated. fun int DescribeProperty=4016(string name, stringresult description) # Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. # Result is NUL-terminated. 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 # Result is NUL-terminated. 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 enu CompletionMethods=SC_AC_ val SC_AC_FILLUP=1 val SC_AC_DOUBLECLICK=2 val SC_AC_TAB=3 val SC_AC_NEWLINE=4 val SC_AC_COMMAND=5 ################################################ # 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 val SCLEX_JSON=120 val SCLEX_EDIFACT=121 # 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, SCLEX_BULLANT, SCLEX_COBOL, SCLEX_TACL, SCLEX_TAL lex Cpp=SCLEX_CPP SCE_C_ lex BullAnt=SCLEX_BULLANT SCE_C_ lex COBOL=SCLEX_COBOL SCE_C_ lex TACL=SCLEX_TACL SCE_C_ lex TAL=SCLEX_TAL 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, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC lex VB=SCLEX_VB SCE_B_ lex VBScript=SCLEX_VBSCRIPT SCE_B_ lex PowerBasic=SCLEX_POWERBASIC SCE_B_ lex BlitzBasic=SCLEX_BLITZBASIC SCE_B_ lex PureBasic=SCLEX_PUREBASIC SCE_B_ lex FreeBasic=SCLEX_FREEBASIC 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 val SCE_ERR_ESCSEQ=23 val SCE_ERR_ESCSEQ_UNKNOWN=24 val SCE_ERR_ES_BLACK=40 val SCE_ERR_ES_RED=41 val SCE_ERR_ES_GREEN=42 val SCE_ERR_ES_BROWN=43 val SCE_ERR_ES_BLUE=44 val SCE_ERR_ES_MAGENTA=45 val SCE_ERR_ES_CYAN=46 val SCE_ERR_ES_GRAY=47 val SCE_ERR_ES_DARK_GRAY=48 val SCE_ERR_ES_BRIGHT_RED=49 val SCE_ERR_ES_BRIGHT_GREEN=50 val SCE_ERR_ES_YELLOW=51 val SCE_ERR_ES_BRIGHT_BLUE=52 val SCE_ERR_ES_BRIGHT_MAGENTA=53 val SCE_ERR_ES_BRIGHT_CYAN=54 val SCE_ERR_ES_WHITE=55 # 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 val SCE_BAAN_WORD3=11 val SCE_BAAN_WORD4=12 val SCE_BAAN_WORD5=13 val SCE_BAAN_WORD6=14 val SCE_BAAN_WORD7=15 val SCE_BAAN_WORD8=16 val SCE_BAAN_WORD9=17 val SCE_BAAN_TABLEDEF=18 val SCE_BAAN_TABLESQL=19 val SCE_BAAN_FUNCTION=20 val SCE_BAAN_DOMDEF=21 val SCE_BAAN_FUNCDEF=22 val SCE_BAAN_OBJECTDEF=23 val SCE_BAAN_DEFINEDEF=24 # 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_ABL_ val SCE_ABL_DEFAULT=0 val SCE_ABL_NUMBER=1 val SCE_ABL_WORD=2 val SCE_ABL_STRING=3 val SCE_ABL_CHARACTER=4 val SCE_ABL_PREPROCESSOR=5 val SCE_ABL_OPERATOR=6 val SCE_ABL_IDENTIFIER=7 val SCE_ABL_BLOCK=8 val SCE_ABL_END=9 val SCE_ABL_COMMENT=10 val SCE_ABL_TASKMARKER=11 val SCE_ABL_LINECOMMENT=12 # 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 val SCE_COFFEESCRIPT_INSTANCEPROPERTY=25 # 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_ # Lexical states for SCLEX_JSON lex JSON=SCLEX_JSON SCE_JSON_ val SCE_JSON_DEFAULT=0 val SCE_JSON_NUMBER=1 val SCE_JSON_STRING=2 val SCE_JSON_STRINGEOL=3 val SCE_JSON_PROPERTYNAME=4 val SCE_JSON_ESCAPESEQUENCE=5 val SCE_JSON_LINECOMMENT=6 val SCE_JSON_BLOCKCOMMENT=7 val SCE_JSON_OPERATOR=8 val SCE_JSON_URI=9 val SCE_JSON_COMPACTIRI=10 val SCE_JSON_KEYWORD=11 val SCE_JSON_LDKEYWORD=12 val SCE_JSON_ERROR=13 lex EDIFACT=SCLEX_EDIFACT SCE_EDI_ val SCE_EDI_DEFAULT=0 val SCE_EDI_SEGMENTSTART=1 val SCE_EDI_SEGMENTEND=2 val SCE_EDI_SEP_ELEMENT=3 val SCE_EDI_SEP_COMPOSITE=4 val SCE_EDI_SEP_RELEASE=5 val SCE_EDI_UNA=6 val SCE_EDI_UNH=7 val SCE_EDI_BADSEGMENT=8 # 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 positionint, int ch, CompletionMethods listCompletionMethod) 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, int ch, CompletionMethods listCompletionMethod) 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) evt void AutoCCompleted=2030(string text, int position, int ch, CompletionMethods listCompletionMethod) evt void MarginRightClick=2031(int modifiers, int position, int margin) # There are no provisional APIs currently, but some arguments to SCI_SETTECHNOLOGY are provisional. cat Provisional cat Deprecated # Deprecated in 3.5.5 # Always interpret keyboard input as Unicode set void SetKeysUnicode=2521(bool keysUnicode,) # Are keys always interpreted as Unicode? get bool GetKeysUnicode=2522(,) sqlitebrowser-3.10.1/libs/qscintilla/include/ScintillaWidget.h000066400000000000000000000051261316047212700244660ustar00rootroot00000000000000/* 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. * This comment is not a doc-comment as that causes warnings from g-ir-scanner. */ /* 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 ()) #define SCINTILLA_TYPE_OBJECT (scintilla_object_get_type()) #define SCINTILLA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SCINTILLA_TYPE_OBJECT, ScintillaObject)) #define SCINTILLA_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCINTILLA_TYPE_OBJECT)) #define SCINTILLA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) #define SCINTILLA_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SCINTILLA_TYPE_OBJECT)) #define SCINTILLA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) typedef struct _ScintillaObject ScintillaObject; typedef struct _ScintillaClass ScintillaObjectClass; struct _ScintillaObject { GtkContainer cont; void *pscin; }; struct _ScintillaClass { GtkContainerClass parent_class; void (* command) (ScintillaObject *sci, int cmd, GtkWidget *window); void (* notify) (ScintillaObject *sci, int id, SCNotification *scn); }; GType scintilla_object_get_type (void); GtkWidget* scintilla_object_new (void); gintptr scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam); GType scnotification_get_type (void); #define SCINTILLA_TYPE_NOTIFICATION (scnotification_get_type()) #ifndef G_IR_SCANNING /* The legacy names confuse the g-ir-scanner program */ typedef struct _ScintillaClass ScintillaClass; 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); #endif #define SCINTILLA_NOTIFY "sci-notify" #ifdef __cplusplus } #endif #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexers/000077500000000000000000000000001316047212700211025ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/lexers/LexSQL.cpp000066400000000000000000000745561316047212700227370ustar00rootroot00000000000000//-*- 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, int chPrev) { // 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 == '+') && chPrev < 0x80 && toupper(chPrev) == 'E')); } typedef unsigned int sql_state_t; class SQLStates { public : void Set(Sci_Position 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(Sci_Position 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); } Sci_Position 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(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl); void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position 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 (Sci_Position line, LexAccessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position 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; }; Sci_Position 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; } Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; } } return firstModification; } void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); StyleContext sc(startPos, length, initStyle, styler); int styleBeforeDCKeyword = SCE_SQL_DEFAULT; Sci_Position 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.chPrev)) { 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 (options.sqlBackslashEscapes && 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 (Sci_Position 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.ch == '-' || sc.ch == '+') && IsADigit(sc.chNext) && !IsADigit(sc.chPrev))) { 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(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position 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. '--'). Sci_Position 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 (Sci_Position 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. Sci_PositionU 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 (Sci_PositionU 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); sqlitebrowser-3.10.1/libs/qscintilla/lexers/License.txt000066400000000000000000000015441316047212700232310ustar00rootroot00000000000000License 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. sqlitebrowser-3.10.1/libs/qscintilla/lexlib/000077500000000000000000000000001316047212700210575ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/lexlib/Accessor.cpp000066400000000000000000000043411316047212700233270ustar00rootroot00000000000000// Scintilla source code edit control /** @file Accessor.cxx ** Interfaces between Scintilla and lexers. **/ // 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(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { Sci_Position 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. Sci_Position pos = LineStart(line); char ch = (*this)[pos]; int indent = 0; bool inPrevPrefix = line > 0; Sci_Position 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; } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/Accessor.h000066400000000000000000000015651316047212700230010ustar00rootroot00000000000000// 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, Sci_Position pos, Sci_Position len); class Accessor : public LexAccessor { public: PropSetSimple *pprops; Accessor(IDocument *pAccess_, PropSetSimple *pprops_); int GetPropertyInt(const char *, int defaultValue=0) const; int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexlib/CharacterCategory.cpp000066400000000000000000000663361316047212700251730ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/CharacterCategory.h000066400000000000000000000012721316047212700246240ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/CharacterSet.cpp000066400000000000000000000023711316047212700241360ustar00rootroot00000000000000// 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 = static_cast(MakeUpperCase(*a)); char upperB = static_cast(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 = static_cast(MakeUpperCase(*a)); char upperB = static_cast(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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/CharacterSet.h000066400000000000000000000103171316047212700236020ustar00rootroot00000000000000// 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 int MakeUpperCase(int ch) { if (ch < 'a' || ch > 'z') return ch; else return static_cast(ch - 'a' + 'A'); } inline int MakeLowerCase(int ch) { if (ch < 'A' || ch > 'Z') return ch; else return 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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexAccessor.h000066400000000000000000000125631316047212700234520ustar00rootroot00000000000000// 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]; Sci_Position startPos; Sci_Position endPos; int codePage; enum EncodingType encodingType; Sci_Position lenDoc; char styleBuf[bufferSize]; Sci_Position validLen; Sci_PositionU startSeg; Sci_Position startPosStyling; int documentVersion; void Fill(Sci_Position 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[](Sci_Position 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(Sci_Position 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(Sci_Position pos, const char *s) { for (int i=0; *s; i++) { if (*s != SafeGetCharAt(pos+i)) return false; s++; } return true; } char StyleAt(Sci_Position position) const { return static_cast(pAccess->StyleAt(position)); } Sci_Position GetLine(Sci_Position position) const { return pAccess->LineFromPosition(position); } Sci_Position LineStart(Sci_Position line) const { return pAccess->LineStart(line); } Sci_Position LineEnd(Sci_Position line) { if (documentVersion >= dvLineEnd) { return (static_cast(pAccess))->LineEnd(line); } else { // Old interface means only '\r', '\n' and '\r\n' line ends. Sci_Position 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(Sci_Position line) const { return pAccess->GetLevel(line); } Sci_Position Length() const { return lenDoc; } void Flush() { if (validLen > 0) { pAccess->SetStyles(validLen, styleBuf); startPosStyling += validLen; validLen = 0; } } int GetLineState(Sci_Position line) const { return pAccess->GetLineState(line); } int SetLineState(Sci_Position line, int state) { return pAccess->SetLineState(line, state); } // Style setting void StartAt(Sci_PositionU start) { pAccess->StartStyling(start, '\377'); startPosStyling = start; } Sci_PositionU GetStartSegment() const { return startSeg; } void StartSegment(Sci_PositionU pos) { startSeg = pos; } void ColourTo(Sci_PositionU 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 (Sci_PositionU i = startSeg; i <= pos; i++) { assert((startPosStyling + validLen) < Length()); styleBuf[validLen++] = static_cast(chAttr); } } } startSeg = pos+1; } void SetLevel(Sci_Position line, int level) { pAccess->SetLevel(line, level); } void IndicatorFill(Sci_Position start, Sci_Position end, int indicator, int value) { pAccess->DecorationSetCurrentIndicator(indicator); pAccess->DecorationFillRange(start, value, end - start); } void ChangeLexerState(Sci_Position start, Sci_Position end) { pAccess->ChangeLexerState(start, end); } }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerBase.cpp000066400000000000000000000035461316047212700234450ustar00rootroot00000000000000// 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 ""; } Sci_Position 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 ""; } Sci_Position 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; } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerBase.h000066400000000000000000000024111316047212700231000ustar00rootroot00000000000000// 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); Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); const char * SCI_METHOD DescribeWordListSets(); Sci_Position SCI_METHOD WordListSet(int n, const char *wl); void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; void * SCI_METHOD PrivateCall(int operation, void *pointer); }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerModule.cpp000066400000000000000000000053001316047212700240060ustar00rootroot00000000000000// 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(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const { if (fnLexer) fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); } void LexerModule::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler) const { if (fnFolder) { Sci_Position lineCurrent = styler.GetLine(startPos); // Move back one line in case deletion wrecked current line fold state if (lineCurrent > 0) { lineCurrent--; Sci_Position 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); } } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerModule.h000066400000000000000000000043071316047212700234610ustar00rootroot00000000000000// 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)(Sci_PositionU startPos, Sci_Position 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(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) const; virtual void Fold(Sci_PositionU startPos, Sci_Position 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 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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerNoExceptions.cpp000066400000000000000000000040131316047212700251770ustar00rootroot00000000000000// 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 Sci_Position 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; } Sci_Position 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(Sci_PositionU startPos, Sci_Position 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(Sci_PositionU startPos, Sci_Position 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); } } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerNoExceptions.h000066400000000000000000000022031316047212700246430ustar00rootroot00000000000000// 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 Sci_Position SCI_METHOD PropertySet(const char *key, const char *val); Sci_Position SCI_METHOD WordListSet(int n, const char *wl); void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *); virtual void Lexer(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; virtual void Folder(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerSimple.cpp000066400000000000000000000030061316047212700240130ustar00rootroot00000000000000// 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(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { Accessor astyler(pAccess, &props); module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler); astyler.Flush(); } void SCI_METHOD LexerSimple::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { if (props.GetInt("fold")) { Accessor astyler(pAccess, &props); module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler); astyler.Flush(); } } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/LexerSimple.h000066400000000000000000000015061316047212700234630ustar00rootroot00000000000000// 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(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess); }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexlib/License.txt000066400000000000000000000015441316047212700232060ustar00rootroot00000000000000License 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. sqlitebrowser-3.10.1/libs/qscintilla/lexlib/OptionSet.h000066400000000000000000000066651316047212700231710ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/PropSetSimple.cpp000066400000000000000000000105631316047212700243360ustar00rootroot00000000000000// 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; } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/PropSetSimple.h000066400000000000000000000014151316047212700237770ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/SparseState.h000066400000000000000000000056421316047212700234750ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/lexlib/StringCopy.h000066400000000000000000000016151316047212700233340ustar00rootroot00000000000000// 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" #include "CharacterSet.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif bool StyleContext::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; } static void getRange(Sci_PositionU start, Sci_PositionU end, LexAccessor &styler, char *s, Sci_PositionU len) { Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = styler[start + i]; i++; } s[i] = '\0'; } void StyleContext::GetCurrent(char *s, Sci_PositionU len) { getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); } static void getRangeLowered(Sci_PositionU start, Sci_PositionU end, LexAccessor &styler, char *s, Sci_PositionU len) { Sci_PositionU 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, Sci_PositionU len) { getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/StyleContext.h000066400000000000000000000132601316047212700236770ustar00rootroot00000000000000// 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 // 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; Sci_PositionU endPos; Sci_PositionU lengthDocument; // Used for optimizing GetRelativeCharacter Sci_PositionU posRelative; Sci_PositionU currentPosLastRelative; Sci_Position 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: Sci_PositionU currentPos; Sci_Position currentLine; Sci_Position lineDocEnd; Sci_Position lineStartNext; bool atLineStart; bool atLineEnd; int state; int chPrev; int ch; Sci_Position width; int chNext; Sci_Position widthNext; StyleContext(Sci_PositionU startPos, Sci_PositionU 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(Sci_Position nb) { for (Sci_Position i = 0; i < nb; i++) { Forward(); } } void ForwardBytes(Sci_Position nb) { Sci_PositionU 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_; } Sci_Position LengthCurrent() const { return currentPos - styler.GetStartSegment(); } int GetRelative(Sci_Position n) { return static_cast(styler.SafeGetCharAt(currentPos+n, 0)); } int GetRelativeCharacter(Sci_Position 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; } Sci_Position diffRelative = n - offsetRelative; Sci_Position 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; } // Non-inline bool MatchIgnoreCase(const char *s); void GetCurrent(char *s, Sci_PositionU len); void GetCurrentLowered(char *s, Sci_PositionU len); }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexlib/SubStyles.h000066400000000000000000000077421316047212700231770ustar00rootroot00000000000000// 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 { const int block = BlockFromBaseStyle(baseStyle); return classifiers[block >= 0 ? block : 0]; } }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/lexlib/WordList.cpp000066400000000000000000000156331316047212700233420ustar00rootroot00000000000000// Scintilla source code edit control /** @file WordList.cxx ** Hold a list of words. **/ // 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; } /** similar to InListAbbreviated, but word s can be a abridged version of a keyword. * eg. the keyword is defined as "after.~:". This means the word must have a prefix (begins with) of * "after." and suffix (ends with) of ":" to be a keyword, Hence "after.field:" , "after.form.item:" are valid. * Similarly "~.is.valid" keyword is suffix only... hence "field.is.valid" , "form.is.valid" are valid. * The marker is ~ in this case. * No multiple markers check is done and wont work. */ bool WordList::InListAbridged(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) { const char *a = words[j]; const char *b = s; while (*a && *a == *b) { a++; if (*a == marker) { a++; const size_t suffixLengthA = strlen(a); const size_t suffixLengthB = strlen(b); if (suffixLengthA >= suffixLengthB) break; b = b + suffixLengthB - suffixLengthA - 1; } b++; } if (!*a && !*b) return true; j++; } } j = starts[static_cast(marker)]; if (j >= 0) { while (words[j][0] == marker) { const char *a = words[j] + 1; const char *b = s; const size_t suffixLengthA = strlen(a); const size_t suffixLengthB = strlen(b); if (suffixLengthA > suffixLengthB) { j++; continue; } b = b + suffixLengthB - suffixLengthA; while (*a && *a == *b) { a++; b++; } if (!*a && !*b) return true; j++; } } return false; } const char *WordList::WordAt(int n) const { return words[n]; } sqlitebrowser-3.10.1/libs/qscintilla/lexlib/WordList.h000066400000000000000000000017751316047212700230110ustar00rootroot00000000000000// 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; bool InListAbridged(const char *s, const char marker) const; const char *WordAt(int n) const; }; #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/src/000077500000000000000000000000001316047212700203675ustar00rootroot00000000000000sqlitebrowser-3.10.1/libs/qscintilla/src/AutoComplete.cpp000066400000000000000000000160561316047212700235040ustar00rootroot00000000000000// 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 #include "Platform.h" #include "Scintilla.h" #include "CharacterSet.h" #include "Position.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]; if (wordLen > maxItemLen-2) wordLen = maxItemLen - 2; memcpy(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]); } } sqlitebrowser-3.10.1/libs/qscintilla/src/AutoComplete.h000066400000000000000000000052511316047212700231440ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/CallTip.cpp000066400000000000000000000261461316047212700224340ustar00rootroot00000000000000// 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 #include "Platform.h" #include "Scintilla.h" #include "StringCopy.h" #include "Position.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; } sqlitebrowser-3.10.1/libs/qscintilla/src/CallTip.h000066400000000000000000000053061316047212700220740ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/CaseConvert.cpp000066400000000000000000000453761316047212700233260ustar00rootroot00000000000000// 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 #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); } std::string CaseConvertString(const std::string &s, enum CaseConversion conversion) { std::string retMapped(s.length() * maxExpansionCaseConversion, 0); size_t lenMapped = CaseConvertString(&retMapped[0], retMapped.length(), s.c_str(), s.length(), conversion); retMapped.resize(lenMapped); return retMapped; } #ifdef SCI_NAMESPACE } #endif sqlitebrowser-3.10.1/libs/qscintilla/src/CaseConvert.h000066400000000000000000000031711316047212700227560ustar00rootroot00000000000000// 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); // Converts a mixed case string using a particular conversion. std::string CaseConvertString(const std::string &s, enum CaseConversion conversion); #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/src/CaseFolder.cpp000066400000000000000000000033311316047212700231020ustar00rootroot00000000000000// 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 #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); } } sqlitebrowser-3.10.1/libs/qscintilla/src/CaseFolder.h000066400000000000000000000020471316047212700225520ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Catalogue.cpp000066400000000000000000000041301316047212700227750ustar00rootroot00000000000000// 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 #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; } sqlitebrowser-3.10.1/libs/qscintilla/src/Catalogue.h000066400000000000000000000010611316047212700224420ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/CellBuffer.cpp000066400000000000000000000552441316047212700231160ustar00rootroot00000000000000// 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 "Position.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(); } } bool CellBuffer::ContainsLineEnd(const char *s, int length) const { unsigned char chBeforePrev = 0; unsigned char chPrev = 0; for (int i = 0; i < length; i++) { const unsigned char ch = s[i]; if ((ch == '\r') || (ch == '\n')) { return true; } else if (utf8LineEnds) { unsigned char back3[3] = { chBeforePrev, chPrev, ch }; if (UTF8IsSeparator(back3) || UTF8IsNEL(back3 + 1)) { return true; } } chBeforePrev = chPrev; chPrev = ch; } return false; } 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(); } sqlitebrowser-3.10.1/libs/qscintilla/src/CellBuffer.h000066400000000000000000000133731316047212700225600ustar00rootroot00000000000000// 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); } }; 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_); bool ContainsLineEnd(const char *s, int length) const; 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 sqlitebrowser-3.10.1/libs/qscintilla/src/CharClassify.cpp000066400000000000000000000031041316047212700234440ustar00rootroot00000000000000// 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 #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) const { // 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; } sqlitebrowser-3.10.1/libs/qscintilla/src/CharClassify.h000066400000000000000000000017251316047212700231200ustar00rootroot00000000000000// 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) const; 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 sqlitebrowser-3.10.1/libs/qscintilla/src/ContractionState.cpp000066400000000000000000000165521316047212700243700ustar00rootroot00000000000000// 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 #include #include "Platform.h" #include "Position.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" #include "SparseVector.h" #include "ContractionState.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif ContractionState::ContractionState() : visible(0), expanded(0), heights(0), foldDisplayTexts(0), displayLines(0), linesInDocument(1) { //InsertLine(0); } ContractionState::~ContractionState() { Clear(); } void ContractionState::EnsureData() { if (OneToOne()) { visible = new RunStyles(); expanded = new RunStyles(); heights = new RunStyles(); foldDisplayTexts = new SparseVector(); displayLines = new Partitioning(4); InsertLines(0, linesInDocument); } } void ContractionState::Clear() { delete visible; visible = 0; delete expanded; expanded = 0; delete heights; heights = 0; delete foldDisplayTexts; foldDisplayTexts = 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); foldDisplayTexts->InsertSpace(lineDoc, 1); foldDisplayTexts->SetValueAt(lineDoc, NULL); 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); foldDisplayTexts->DeletePosition(lineDoc); } } 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); } } const char *ContractionState::GetFoldDisplayText(int lineDoc) const { Check(); return foldDisplayTexts->ValueAt(lineDoc); } bool ContractionState::SetFoldDisplayText(int lineDoc, const char *text) { EnsureData(); const char *foldText = foldDisplayTexts->ValueAt(lineDoc); if (!foldText || 0 != strcmp(text, foldText)) { foldDisplayTexts->SetValueAt(lineDoc, text); Check(); return true; } else { Check(); return false; } } 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; } } } bool ContractionState::GetFoldDisplayTextShown(int lineDoc) const { return !GetExpanded(lineDoc) && GetFoldDisplayText(lineDoc); } 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 } sqlitebrowser-3.10.1/libs/qscintilla/src/ContractionState.h000066400000000000000000000035021316047212700240240ustar00rootroot00000000000000// 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 template class SparseVector; /** */ class ContractionState { // These contain 1 element for every document line. RunStyles *visible; RunStyles *expanded; RunStyles *heights; SparseVector *foldDisplayTexts; 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; const char *GetFoldDisplayText(int lineDoc) const; bool SetFoldDisplayText(int lineDoc, const char *text); bool GetExpanded(int lineDoc) const; bool SetExpanded(int lineDoc, bool isExpanded); bool GetFoldDisplayTextShown(int lineDoc) const; 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Decoration.cpp000066400000000000000000000105501316047212700231630ustar00rootroot00000000000000/** @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 #include "Platform.h" #include "Scintilla.h" #include "Position.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; } sqlitebrowser-3.10.1/libs/qscintilla/src/Decoration.h000066400000000000000000000026301316047212700226300ustar00rootroot00000000000000/** @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 sqlitebrowser-3.10.1/libs/qscintilla/src/Document.cpp000066400000000000000000002632301316047212700226570ustar00rootroot00000000000000// 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 #define NOEXCEPT #ifndef NO_CXX11_REGEX #include #if defined(__GLIBCXX__) // If using the GNU implementation of then have 'noexcept' so can use // when defining regex iterators to keep Clang analyze happy. #undef NOEXCEPT #define NOEXCEPT noexcept #endif #endif #include "Platform.h" #include "ILexer.h" #include "Scintilla.h" #include "CharacterSet.h" #include "CharacterCategory.h" #include "Position.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 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; durationStyleOneLine = 0.00001; 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() { if (!TentativeActive()) return; 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); } Sci_Position SCI_METHOD Document::LineStart(Sci_Position line) const { return cb.LineStart(line); } bool Document::IsLineStartPosition(int position) const { return LineStart(LineFromPosition(position)) == position; } Sci_Position SCI_METHOD Document::LineEnd(Sci_Position 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); } } Sci_Position SCI_METHOD Document::LineFromPosition(Sci_Position 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(Sci_Position 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(Sci_Position 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 LevelNumber(levelStart) < LevelNumber(levelTry); } int Document::GetLastChild(int lineParent, int level, int lastLine) { if (level == -1) level = LevelNumber(GetLevel(lineParent)); 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 > LevelNumber(GetLevel(lineMaxSubord + 1))) { // 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 = LevelNumber(GetLevel(line)); int lineLook = line - 1; while ((lineLook > 0) && ( (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || (LevelNumber(GetLevel(lineLook)) >= level)) ) { lineLook--; } if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && (LevelNumber(GetLevel(lineLook)) < 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 = LevelNumber(lookLineLevel); while ((lookLine > 0) && ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= LevelNumber(GetLevel(lookLine + 1)))))) { lookLineLevel = GetLevel(--lookLine); lookLineLevelNum = LevelNumber(lookLineLevel); } 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 = LevelNumber(lookLineLevel); 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) && (LevelNumber(GetLevel(lookLine - 1)) > lookLineLevelNum)) break; lookLineLevel = GetLevel(--lookLine); lookLineLevelNum = LevelNumber(lookLineLevel); } } if (firstChangeableLineBefore == -1) { for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel); lookLine >= beginFoldBlock; lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) { if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > LevelNumber(level))) { firstChangeableLineBefore = lookLine; break; } } } if (firstChangeableLineBefore == -1) firstChangeableLineBefore = beginFoldBlock - 1; int firstChangeableLineAfter = -1; for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel); lookLine <= endFoldBlock; lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) { if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < LevelNumber(GetLevel(lookLine + 1)))) { 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; } } Document::CharacterExtracted Document::CharacterAfter(int position) const { if (position >= Length()) { return CharacterExtracted(unicodeReplacementChar, 0); } const unsigned char leadByte = static_cast(cb.CharAt(position)); if (!dbcsCodePage || UTF8IsAscii(leadByte)) { // Common case: ASCII character return CharacterExtracted(leadByte, 1); } if (SC_CP_UTF8 == dbcsCodePage) { 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); } } else { if (IsDBCSLeadByte(leadByte) && ((position + 1) < Length())) { return CharacterExtracted::DBCS(leadByte, static_cast(cb.CharAt(position + 1))); } else { return CharacterExtracted(leadByte, 1); } } } Document::CharacterExtracted Document::CharacterBefore(int position) const { if (position <= 0) { return CharacterExtracted(unicodeReplacementChar, 0); } const unsigned char previousByte = static_cast(cb.CharAt(position - 1)); if (0 == dbcsCodePage) { return CharacterExtracted(previousByte, 1); } if (SC_CP_UTF8 == dbcsCodePage) { if (UTF8IsAscii(previousByte)) { return CharacterExtracted(previousByte, 1); } position--; // If previousByte is not a trail byte then its invalid if (UTF8IsTrailByte(previousByte)) { // If previousByte is a trail byte in a valid UTF-8 character then find start of character int startUTF = position; int endUTF = position; if (InGoodUTF8(position, startUTF, endUTF)) { const int widthCharBytes = endUTF - startUTF; unsigned char charBytes[UTF8MaxBytes] = { 0, 0, 0, 0 }; for (int b = 0; b(cb.CharAt(startUTF + 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); } } // Else invalid UTF-8 so return position of isolated trail byte } return CharacterExtracted(unicodeReplacementChar, 1); } else { // Moving backwards in DBCS is complex so use NextPosition const int posStartCharacter = NextPosition(position, -1); return CharacterAfter(posStartCharacter); } } // Return -1 on out-of-bounds Sci_Position SCI_METHOD Document::GetRelativePosition(Sci_Position positionStart, Sci_Position 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(Sci_Position position, Sci_Position *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, Sci_Position 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(Sci_Position 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++; 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); } bool Document::IsASCIIWordByte(unsigned char ch) const { if (IsASCII(ch)) { return charClass.GetClass(ch) == CharClassify::ccWord; } else { return false; } } CharClassify::cc Document::WordCharacterClass(unsigned int ch) const { if (dbcsCodePage && (!UTF8IsAscii(ch))) { if (SC_CP_UTF8 == dbcsCodePage) { // Use hard coded Unicode class const CharacterCategory cc = CategoriseCharacter(ch); switch (cc) { // Separator, Line/Paragraph case ccZl: case ccZp: return CharClassify::ccNewLine; // Separator, Space case ccZs: // Other case ccCc: case ccCf: case ccCs: case ccCo: case ccCn: return CharClassify::ccSpace; // Letter case ccLu: case ccLl: case ccLt: case ccLm: case ccLo: // Number case ccNd: case ccNl: case ccNo: // Mark - includes combining diacritics case ccMn: case ccMc: case ccMe: return CharClassify::ccWord; // Punctuation case ccPc: case ccPd: case ccPs: case ccPe: case ccPi: case ccPf: case ccPo: // Symbol case ccSm: case ccSc: case ccSk: case ccSo: return CharClassify::ccPunctuation; } } else { // Asian DBCS return CharClassify::ccWord; } } return charClass.GetClass(static_cast(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) const { CharClassify::cc ccStart = CharClassify::ccWord; if (delta < 0) { if (!onlyWordCharacters) { const CharacterExtracted ce = CharacterBefore(pos); ccStart = WordCharacterClass(ce.character); } while (pos > 0) { const CharacterExtracted ce = CharacterBefore(pos); if (WordCharacterClass(ce.character) != ccStart) break; pos -= ce.widthBytes; } } else { if (!onlyWordCharacters && pos < Length()) { const CharacterExtracted ce = CharacterAfter(pos); ccStart = WordCharacterClass(ce.character); } while (pos < Length()) { const CharacterExtracted ce = CharacterAfter(pos); if (WordCharacterClass(ce.character) != ccStart) break; pos += ce.widthBytes; } } 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) const { if (delta < 0) { while (pos > 0) { const CharacterExtracted ce = CharacterBefore(pos); if (WordCharacterClass(ce.character) != CharClassify::ccSpace) break; pos -= ce.widthBytes; } if (pos > 0) { CharacterExtracted ce = CharacterBefore(pos); const CharClassify::cc ccStart = WordCharacterClass(ce.character); while (pos > 0) { ce = CharacterBefore(pos); if (WordCharacterClass(ce.character) != ccStart) break; pos -= ce.widthBytes; } } } else { CharacterExtracted ce = CharacterAfter(pos); const CharClassify::cc ccStart = WordCharacterClass(ce.character); while (pos < Length()) { ce = CharacterAfter(pos); if (WordCharacterClass(ce.character) != ccStart) break; pos += ce.widthBytes; } while (pos < Length()) { ce = CharacterAfter(pos); if (WordCharacterClass(ce.character) != CharClassify::ccSpace) break; pos += ce.widthBytes; } } 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) const { if (delta < 0) { if (pos > 0) { CharacterExtracted ce = CharacterBefore(pos); CharClassify::cc ccStart = WordCharacterClass(ce.character); if (ccStart != CharClassify::ccSpace) { while (pos > 0) { ce = CharacterBefore(pos); if (WordCharacterClass(ce.character) != ccStart) break; pos -= ce.widthBytes; } } while (pos > 0) { ce = CharacterBefore(pos); if (WordCharacterClass(ce.character) != CharClassify::ccSpace) break; pos -= ce.widthBytes; } } } else { while (pos < Length()) { CharacterExtracted ce = CharacterAfter(pos); if (WordCharacterClass(ce.character) != CharClassify::ccSpace) break; pos += ce.widthBytes; } if (pos < Length()) { CharacterExtracted ce = CharacterAfter(pos); CharClassify::cc ccStart = WordCharacterClass(ce.character); while (pos < Length()) { ce = CharacterAfter(pos); if (WordCharacterClass(ce.character) != ccStart) break; pos += ce.widthBytes; } } } 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 >= Length()) return false; if (pos > 0) { const CharacterExtracted cePos = CharacterAfter(pos); const CharClassify::cc ccPos = WordCharacterClass(cePos.character); const CharacterExtracted cePrev = CharacterBefore(pos); const CharClassify::cc ccPrev = WordCharacterClass(cePrev.character); return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && (ccPos != ccPrev); } 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 <= 0) return false; if (pos < Length()) { const CharacterExtracted cePos = CharacterAfter(pos); const CharClassify::cc ccPos = WordCharacterClass(cePos.character); const CharacterExtracted cePrev = CharacterBefore(pos); const CharClassify::cc ccPrev = WordCharacterClass(cePrev.character); return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && (ccPrev != ccPos); } 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 (start < end) && 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, int flags, int *length) { if (*length <= 0) return minPos; const bool caseSensitive = (flags & SCFIND_MATCHCASE) != 0; const bool word = (flags & SCFIND_WHOLEWORD) != 0; const bool wordStart = (flags & SCFIND_WORDSTART) != 0; const bool regExp = (flags & SCFIND_REGEXP) != 0; 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) const { return charClass.GetCharsOfClass(characterClass, buffer); } void SCI_METHOD Document::StartStyling(Sci_Position position, char) { endStyled = position; } bool SCI_METHOD Document::SetStyleFor(Sci_Position 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(Sci_Position 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::StyleToAdjustingLineDuration(int pos) { // Place bounds on the duration used to avoid glitches spiking it // and so causing slow styling or non-responsive scrolling const double minDurationOneLine = 0.000001; const double maxDurationOneLine = 0.0001; // Alpha value for exponential smoothing. // Most recent value contributes 25% to smoothed value. const double alpha = 0.25; const Sci_Position lineFirst = LineFromPosition(GetEndStyled()); ElapsedTime etStyling; EnsureStyledTo(pos); const double durationStyling = etStyling.Duration(); const Sci_Position lineLast = LineFromPosition(GetEndStyled()); if (lineLast >= lineFirst + 8) { // Only adjust for styling multiple lines to avoid instability const double durationOneLine = durationStyling / (lineLast - lineFirst); durationStyleOneLine = alpha * durationOneLine + (1.0 - alpha) * durationStyleOneLine; if (durationStyleOneLine < minDurationOneLine) { durationStyleOneLine = minDurationOneLine; } else if (durationStyleOneLine > maxDurationOneLine) { durationStyleOneLine = maxDurationOneLine; } } } 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(Sci_Position 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(Sci_Position line) const { return static_cast(perLineData[ldState])->GetLineState(line); } int Document::GetMaxLineState() { return static_cast(perLineData[ldState])->GetMaxLineState(); } void SCI_METHOD Document::ChangeLexerState(Sci_Position start, Sci_Position 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(Sci_Position position, int value, Sci_Position 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); } } // Used for word part navigation. static bool IsASCIIPunctuationCharacter(unsigned int ch) { switch (ch) { case '!': case '"': case '#': case '$': case '%': case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '?': case '@': case '[': case '\\': case ']': case '^': case '_': case '`': case '{': case '|': case '}': case '~': return true; default: return false; } } bool Document::IsWordPartSeparator(unsigned int ch) const { return (WordCharacterClass(ch) == CharClassify::ccWord) && IsASCIIPunctuationCharacter(ch); } int Document::WordPartLeft(int pos) const { if (pos > 0) { pos -= CharacterBefore(pos).widthBytes; CharacterExtracted ceStart = CharacterAfter(pos); if (IsWordPartSeparator(ceStart.character)) { while (pos > 0 && IsWordPartSeparator(CharacterAfter(pos).character)) { pos -= CharacterBefore(pos).widthBytes; } } if (pos > 0) { ceStart = CharacterAfter(pos); pos -= CharacterBefore(pos).widthBytes; if (IsLowerCase(ceStart.character)) { while (pos > 0 && IsLowerCase(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; if (!IsUpperCase(CharacterAfter(pos).character) && !IsLowerCase(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (IsUpperCase(ceStart.character)) { while (pos > 0 && IsUpperCase(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; if (!IsUpperCase(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (IsADigit(ceStart.character)) { while (pos > 0 && IsADigit(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; if (!IsADigit(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (IsASCIIPunctuationCharacter(ceStart.character)) { while (pos > 0 && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; if (!IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (isspacechar(ceStart.character)) { while (pos > 0 && isspacechar(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; if (!isspacechar(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (!IsASCII(ceStart.character)) { while (pos > 0 && !IsASCII(CharacterAfter(pos).character)) pos -= CharacterBefore(pos).widthBytes; if (IsASCII(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else { pos += CharacterAfter(pos).widthBytes; } } } return pos; } int Document::WordPartRight(int pos) const { CharacterExtracted ceStart = CharacterAfter(pos); const int length = Length(); if (IsWordPartSeparator(ceStart.character)) { while (pos < length && IsWordPartSeparator(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; ceStart = CharacterAfter(pos); } if (!IsASCII(ceStart.character)) { while (pos < length && !IsASCII(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (IsLowerCase(ceStart.character)) { while (pos < length && IsLowerCase(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (IsUpperCase(ceStart.character)) { if (IsLowerCase(CharacterAfter(pos + ceStart.widthBytes).character)) { pos += CharacterAfter(pos).widthBytes; while (pos < length && IsLowerCase(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else { while (pos < length && IsUpperCase(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } if (IsLowerCase(CharacterAfter(pos).character) && IsUpperCase(CharacterBefore(pos).character)) pos -= CharacterBefore(pos).widthBytes; } else if (IsADigit(ceStart.character)) { while (pos < length && IsADigit(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (IsASCIIPunctuationCharacter(ceStart.character)) { while (pos < length && IsASCIIPunctuationCharacter(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else if (isspacechar(ceStart.character)) { while (pos < length && isspacechar(CharacterAfter(pos).character)) pos += CharacterAfter(pos).widthBytes; } else { pos += CharacterAfter(pos).widthBytes; } return pos; } static 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; const int styBrace = StyleIndexAt(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); const int styAtPos = StyleIndexAt(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); } }; #ifndef NO_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) NOEXCEPT { 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) NOEXCEPT { 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(); Sci::Position lenMatch = search.eopat[co] - search.bopat[co]; search.pat[co].resize(lenMatch); for (Sci::Position 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) { #ifndef NO_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 sqlitebrowser-3.10.1/libs/qscintilla/src/Document.h000066400000000000000000000425541316047212700223300ustar00rootroot00000000000000// 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; inline int LevelNumber(int level) { return level & SC_FOLDLEVELNUMBERMASK; } 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: struct CharacterExtracted { unsigned int character; unsigned int widthBytes; CharacterExtracted(unsigned int character_, unsigned int widthBytes_) : character(character_), widthBytes(widthBytes_) { } // For DBCS characters turn 2 bytes into an int static CharacterExtracted DBCS(unsigned char lead, unsigned char trail) { return CharacterExtracted((lead << 8) | trail, 2); } }; 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; double durationStyleOneLine; 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); Sci_Position SCI_METHOD LineFromPosition(Sci_Position pos) const; int ClampPositionIntoDocument(int pos) const; bool ContainsLineEnd(const char *s, int length) const { return cb.ContainsLineEnd(s, length); } 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 Document::CharacterExtracted CharacterAfter(int position) const; Document::CharacterExtracted CharacterBefore(int position) const; Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const; int GetRelativePositionUTF16(int positionStart, int characterOffset) const; int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *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, Sci_Position 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(Sci_Position 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, Sci_Position position, Sci_Position lengthRetrieve) const { cb.GetCharRange(buffer, position, lengthRetrieve); } char SCI_METHOD StyleAt(Sci_Position position) const { return cb.StyleAt(position); } int StyleIndexAt(Sci_Position position) const { return static_cast(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); Sci_Position SCI_METHOD LineStart(Sci_Position line) const; bool IsLineStartPosition(int position) const; Sci_Position SCI_METHOD LineEnd(Sci_Position 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(Sci_Position line, int level); int SCI_METHOD GetLevel(Sci_Position 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) const; int NextWordStart(int pos, int delta) const; int NextWordEnd(int pos, int delta) const; Sci_Position SCI_METHOD Length() const { return cb.Length(); } void Allocate(int newSize) { cb.Allocate(newSize); } CharacterExtracted ExtractCharacter(int position) const; bool IsWordStartAt(int pos) const; bool IsWordEndAt(int pos) const; bool IsWordAt(int start, int end) 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, 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) const; void SCI_METHOD StartStyling(Sci_Position position, char mask); bool SCI_METHOD SetStyleFor(Sci_Position length, char style); bool SCI_METHOD SetStyles(Sci_Position length, const char *styles); int GetEndStyled() const { return endStyled; } void EnsureStyledTo(int pos); void StyleToAdjustingLineDuration(int pos); void LexerChanged(); int GetStyleClock() const { return styleClock; } void IncrementStyleClock(); void SCI_METHOD DecorationSetCurrentIndicator(int indicator) { decorations.SetCurrentIndicator(indicator); } void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength); int SCI_METHOD SetLineState(Sci_Position line, int state); int SCI_METHOD GetLineState(Sci_Position line) const; int GetMaxLineState(); void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position 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); bool IsASCIIWordByte(unsigned char ch) const; CharClassify::cc WordCharacterClass(unsigned int ch) const; bool IsWordPartSeparator(unsigned int ch) const; int WordPartLeft(int pos) const; int WordPartRight(int pos) const; 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: 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 sqlitebrowser-3.10.1/libs/qscintilla/src/EditModel.cpp000066400000000000000000000034051316047212700227430ustar00rootroot00000000000000// 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 "Position.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; foldDisplayTextStyle = SC_FOLDDISPLAYTEXT_HIDDEN; hotspot = Range(invalidPosition); hoverIndicatorPos = invalidPosition; wrapWidth = LineLayout::wrapWidthInfinite; pdoc = new Document(); pdoc->AddRef(); } EditModel::~EditModel() { pdoc->Release(); pdoc = 0; } sqlitebrowser-3.10.1/libs/qscintilla/src/EditModel.h000066400000000000000000000025761316047212700224200ustar00rootroot00000000000000// 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 explicit 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; int foldDisplayTextStyle; 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 sqlitebrowser-3.10.1/libs/qscintilla/src/EditView.cpp000066400000000000000000002747211316047212700226300ustar00rootroot00000000000000// Scintilla source code edit control /** @file EditView.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 "CharacterSet.h" #include "Position.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; tabWidthMinimumPixels = 2; // needed for calculating tab stops for fractional proportional fonts 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 + tabWidthMinimumPixels)); if (next > 0) return static_cast(next); return (static_cast((x + tabWidthMinimumPixels) / 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); } static 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"; } } static void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid, const ViewStyle &vsDraw) { 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); // Draw the arrow head if needed if (vsDraw.tabDrawMode == tdLongArrow) { 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; } 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 int styleByte = 0; int numCharsInLine = 0; while (numCharsInLine < lineLength) { int charInDoc = numCharsInLine + posLineStart; char chDoc = model.pdoc->CharAt(charInDoc); styleByte = model.pdoc->StyleIndexAt(charInDoc); allSame = allSame && (ll->styles[numCharsInLine] == 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] == MakeLowerCase(chDoc)); else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper) allSame = allSame && (ll->chars[numCharsInLine] == MakeUpperCase(chDoc)); else { // Style::caseCamel if ((model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine])) && ((numCharsInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[numCharsInLine - 1])))) { allSame = allSame && (ll->chars[numCharsInLine] == MakeUpperCase(chDoc)); } else { allSame = allSame && (ll->chars[numCharsInLine] == MakeLowerCase(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.column); 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(MakeUpperCase(chDoc)); else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseLower) ll->chars[charInLine] = static_cast(MakeLowerCase(chDoc)); else if (vstyle.styles[ll->styles[charInLine]].caseForce == Style::caseCamel) { if ((model.pdoc->IsASCIIWordByte(ll->chars[charInLine])) && ((charInLine == 0) || (!model.pdoc->IsASCIIWordByte(ll->chars[charInLine - 1])))) { ll->chars[charInLine] = static_cast(MakeUpperCase(chDoc)); } else { ll->chars[charInLine] = static_cast(MakeLowerCase(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, PointEnd pe) { Point pt; if (pos.Position() == INVALID_POSITION) return pt; int lineDoc = model.pdoc->LineFromPosition(pos.Position()); int posLineStart = model.pdoc->LineStart(lineDoc); if ((pe & peLineEnd) && (lineDoc > 0) && (pos.Position() == posLineStart)) { // Want point at end of first line lineDoc--; posLineStart = model.pdoc->LineStart(lineDoc); } const int lineVisible = model.cs.DisplayFromDoc(lineDoc); AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc, model)); if (surface && ll) { LayoutLine(model, lineDoc, surface, vs, ll, model.wrapWidth); const int posInLine = pos.Position() - posLineStart; pt = ll->PointFromPosition(posInLine, vs.lineHeight, pe); pt.y += (lineVisible - topLine) * vs.lineHeight; pt.x += vs.textStart - model.xOffset; } pt.x += pos.VirtualSpace() * vs.styles[ll->EndLineStyle()].spaceWidth; return pt; } Range EditView::RangeDisplayLine(Surface *surface, const EditModel &model, int lineVisible, const ViewStyle &vs) { Range rangeSubLine = Range(0,0); if (lineVisible < 0) { return rangeSubLine; } const int lineDoc = model.cs.DocFromDisplay(lineVisible); const int positionLineStart = 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 = lineVisible - lineStartSet; if (subLine < ll->lines) { rangeSubLine = ll->SubLineRange(subLine); if (subLine == ll->lines-1) { rangeSubLine.end = model.pdoc->LineStart(lineDoc + 1) - positionLineStart; } } } rangeSubLine.start += positionLineStart; rangeSubLine.end += positionLineStart; return rangeSubLine; } SelectionPosition EditView::SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument 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(static_cast(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)) && (posInLine <= ll->numCharsBeforeEOL)) { if (start) { posRet = ll->LineStart(subLine) + posLineStart; } else { if (subLine == ll->lines - 1) posRet = ll->numCharsBeforeEOL + 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.theEdge.colour; 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 (rcSegment.Empty()) return; 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 = (lastSubLine == true) ? 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); } } rcSegment.left = rcSegment.right; if (rcSegment.left < rcLine.left) rcSegment.left = rcLine.left; rcSegment.right = rcLine.right; bool fillRemainder = !lastSubLine || model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_HIDDEN || !model.cs.GetFoldDisplayTextShown(line); if (fillRemainder) { // Fill the remainder of the line FillLineRemainder(surface, model, vsDraw, ll, line, rcSegment, subLine); } 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 secondCharacter, 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); PRectangle rcFirstCharacter = rcIndic; // Allow full descent space for character indicators rcFirstCharacter.bottom = rcLine.top + vsDraw.maxAscent + vsDraw.maxDescent; if (secondCharacter >= 0) { rcFirstCharacter.right = ll->positions[secondCharacter] + xStart - subLineStart; } else { // Indicator continued from earlier line so make an empty box and don't draw rcFirstCharacter.right = rcFirstCharacter.left; } vsDraw.indicators[indicNum].Draw(surface, rcIndic, rcLine, rcFirstCharacter, 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))) { const Range rangeRun(deco->rs.StartRun(startPos), deco->rs.EndRun(startPos)); const int endPos = std::min(rangeRun.end, posLineEnd); const bool hover = vsDraw.indicators[deco->indicator].IsDynamic() && rangeRun.ContainsCharacter(hoverIndicatorPos); const int value = deco->rs.ValueAt(startPos); Indicator::DrawState drawState = hover ? Indicator::drawHover : Indicator::drawNormal; const int posSecond = model.pdoc->MovePositionOutsideChar(rangeRun.First() + 1, 1); DrawIndicator(deco->indicator, startPos - posLineStart, endPos - posLineStart, surface, vsDraw, ll, xStart, rcLine, posSecond - posLineStart, 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) { const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[0] + 1, 1) - posLineStart; DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1); } } if (rangeLine.ContainsCharacter(model.braces[1])) { int braceOffset = model.braces[1] - posLineStart; if (braceOffset < ll->numCharsInLine) { const int secondOffset = model.pdoc->MovePositionOutsideChar(model.braces[1] + 1, 1) - posLineStart; DrawIndicator(braceIndicator, braceOffset, braceOffset + 1, surface, vsDraw, ll, xStart, rcLine, secondOffset, subLine, Indicator::drawNormal, 1); } } } } } void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase) { const bool lastSubLine = subLine == (ll->lines - 1); if (!lastSubLine) return; if ((model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_HIDDEN) || !model.cs.GetFoldDisplayTextShown(line)) return; PRectangle rcSegment = rcLine; const char *foldDisplayText = model.cs.GetFoldDisplayText(line); const int lengthFoldDisplayText = static_cast(strlen(foldDisplayText)); FontAlias fontText = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].font; const int widthFoldDisplayText = static_cast(surface->WidthText(fontText, foldDisplayText, lengthFoldDisplayText)); 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; } const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth; XYPOSITION virtualSpace = model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line)) * spaceWidth; rcSegment.left = xStart + static_cast(ll->positions[ll->numCharsInLine] - subLineStart) + spaceWidth + virtualSpace; rcSegment.right = rcSegment.left + static_cast(widthFoldDisplayText); ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); FontAlias textFont = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].font; ColourDesired textFore = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].fore; if (eolInSelection && (vsDraw.selColours.fore.isSet)) { textFore = (eolInSelection == 1) ? vsDraw.selColours.fore : vsDraw.selAdditionalForeground; } ColourDesired textBack = TextBackground(model, vsDraw, ll, background, eolInSelection, false, STYLE_FOLDDISPLAYTEXT, -1); if (model.trackLineWidth) { if (rcSegment.right + 1> lineWidthMaxSeen) { // Fold display text border drawn on rcSegment.right with width 1 is the last visble object of the line lineWidthMaxSeen = static_cast(rcSegment.right + 1); } } if ((phasesDraw != phasesOne) && (phase & drawBack)) { surface->FillRectangle(rcSegment, textBack); // Fill Remainder of the line PRectangle rcRemainder = rcSegment; rcRemainder.left = rcRemainder.right + 1; if (rcRemainder.left < rcLine.left) rcRemainder.left = rcLine.left; rcRemainder.right = rcLine.right; FillLineRemainder(surface, model, vsDraw, ll, line, rcRemainder, subLine); } if (phase & drawText) { if (phasesDraw != phasesOne) { surface->DrawTextTransparent(rcSegment, textFont, rcSegment.top + vsDraw.maxAscent, foldDisplayText, lengthFoldDisplayText, textFore); } else { surface->DrawTextNoClip(rcSegment, textFont, rcSegment.top + vsDraw.maxAscent, foldDisplayText, lengthFoldDisplayText, textFore, textBack); } } if (phase & drawIndicatorsFore) { if (model.foldDisplayTextStyle == SC_FOLDDISPLAYTEXT_BOXED) { surface->PenColour(textFore); 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)); surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.top)); surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.top)); surface->MoveTo(static_cast(rcSegment.left), static_cast(rcSegment.bottom - 1)); surface->LineTo(static_cast(rcSegment.right), static_cast(rcSegment.bottom - 1)); } } if (phase & drawSelectionTranslucent) { 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); } } } 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.Empty() && 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 && vsDraw.WhiteSpaceVisible(inIndentation)) 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) { for (int cpos = 0; cpos <= i - ts.start; cpos++) { if (ll->chars[cpos + ts.start] == ' ') { if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) { 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.column * 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.theEdge.colour); } else if (vsDraw.edgeState == EDGE_MULTILINE) { for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) { if (vsDraw.theMultiEdge[edge].column >= 0) { PRectangle rcSegment = rcLine; int edgeX = static_cast(vsDraw.theMultiEdge[edge].column * 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.theMultiEdge[edge].colour); } } } } // 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); } const int marksOfLine = model.pdoc->GetMark(line); int marksDrawnInText = marksOfLine & vsDraw.maskDrawInText; for (int markBit = 0; (markBit < 32) && marksDrawnInText; markBit++) { if (marksDrawnInText & 1) { if (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) { SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); } else if (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); } } marksDrawnInText >>= 1; } int marksDrawnInLine = marksOfLine & vsDraw.maskInLine; for (int markBit = 0; (markBit < 32) && marksDrawnInLine; markBit++) { if (marksDrawnInLine & 1) { SimpleAlphaRectangle(surface, rcLine, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha); } marksDrawnInLine >>= 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 && vsDraw.WhiteSpaceVisible(inIndentation)) 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 (vsDraw.WhiteSpaceVisible(inIndentation)) { 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), vsDraw); 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 (vsDraw.WhiteSpaceVisible(inIndentation)) { XYPOSITION xmid = (ll->positions[cpos + ts.start] + ll->positions[cpos + ts.start + 1]) / 2; if ((phasesDraw == phasesOne) && drawWhitespaceBackground) { 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); } const int halfDotWidth = vsDraw.whitespaceSize / 2; PRectangle rcDot(xmid + xStart - halfDotWidth - 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); } DrawFoldDisplayText(surface, model, vsDraw, ll, line, xStart, rcLine, subLine, subLineStart, phase); 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) && (LevelNumber(level) < LevelNumber(levelNext))) { // 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 || ((phasesDraw < phasesMultiple) && (*it & drawBack)))) { // Clear the left margin 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.column * vsDraw.spaceWidth); rcBeyondEOF.left = static_cast(edgeX + xStart); rcBeyondEOF.right = rcBeyondEOF.left + 1; surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theEdge.colour); } else if (vsDraw.edgeState == EDGE_MULTILINE) { for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) { if (vsDraw.theMultiEdge[edge].column >= 0) { int edgeX = static_cast(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth); rcBeyondEOF.left = static_cast(edgeX + xStart); rcBeyondEOF.right = rcBeyondEOF.left + 1; surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theMultiEdge[edge].colour); } } } } //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()); } } void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, PRectangle rcArea, int subLine) { 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; } ColourOptional background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret); if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { surface->FillRectangle(rcArea, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)); } else { if (background.isSet) { surface->FillRectangle(rcArea, background); } else if (vsDraw.styles[ll->styles[ll->numCharsInLine]].eolFilled) { surface->FillRectangle(rcArea, vsDraw.styles[ll->styles[ll->numCharsInLine]].back); } else { surface->FillRectangle(rcArea, vsDraw.styles[STYLE_DEFAULT].back); } if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back.isSet && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { SimpleAlphaRectangle(surface, rcArea, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha); } } } // Space (3 space characters) between line numbers and text when printing. #define lineNumberPrintSpace " " static 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 (size_t margin = 0; margin < vs.ms.size(); margin++) { if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) { lineNumberIndex = static_cast(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; } sqlitebrowser-3.10.1/libs/qscintilla/src/EditView.h000066400000000000000000000161361316047212700222670ustar00rootroot00000000000000// 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; int tabWidthMinimumPixels; 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, PointEnd pe); Range RangeDisplayLine(Surface *surface, const EditModel &model, int lineVisible, const ViewStyle &vs); SelectionPosition SPositionFromLocation(Surface *surface, const EditModel &model, PointDocument 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 DrawFoldDisplayText(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, int xStart, PRectangle rcLine, int subLine, XYACCUMULATOR subLineStart, DrawPhase phase); 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); void FillLineRemainder(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, PRectangle rcArea, int subLine); 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Editor.cpp000066400000000000000000007266101316047212700223350ustar00rootroot00000000000000// 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 "Position.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; mouseWheelCaptures = 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; idleStyling = SC_IDLESTYLING_NONE; needIdleStyling = 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); } PointDocument Editor::DocumentPointFromView(Point ptView) const { PointDocument 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 = 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, PointEnd pe) { RefreshStyleData(); AutoSurface surface(this); return view.LocationFromPosition(surface, *this, pos, topLine, vs, pe); } Point Editor::LocationFromPosition(int pos, PointEnd pe) { return LocationFromPosition(SelectionPosition(pos), pe); } 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); } PointDocument ptdoc = DocumentPointFromView(pt); return view.SPositionFromLocation(surface, *this, ptdoc, 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) { const bool markersInText = vs.maskInLine || vs.maskDrawInText; if (!wMargin.GetID() || markersInText) { // May affect text area so may need to abandon and retry if (AbandonPaint()) { return; } } if (wMargin.GetID() && markersInText) { Redraw(); return; } PRectangle rcMarkers = GetClientRectangle(); if (!markersInText) { // Normal case: just draw the margin rcMarkers.right = rcMarkers.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 < rcMarkers.top) rcLine.top = rcMarkers.top; if (rcLine.bottom > rcMarkers.bottom) rcLine.bottom = rcMarkers.bottom; } rcMarkers.top = rcLine.top; if (!allAfter) rcMarkers.bottom = rcLine.bottom; if (rcMarkers.Empty()) return; } if (wMargin.GetID()) { Point ptOrigin = GetVisibleOriginInMain(); rcMarkers.Move(-ptOrigin.x, -ptOrigin.y); wMargin.InvalidateRectangle(rcMarkers); } else { wMain.InvalidateRectangle(rcMarkers); } } 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_)); } void Editor::MultipleSelectAdd(AddNumber addNumber) { if (SelectionEmpty() || !multipleSelection) { // Select word at caret const int startWord = pdoc->ExtendWordSelect(sel.MainCaret(), -1, true); const int endWord = pdoc->ExtendWordSelect(startWord, 1, true); TrimAndSetSelection(endWord, startWord); } else { if (!pdoc->HasCaseFolder()) pdoc->SetCaseFolder(CaseFolderForEncoding()); const Range rangeMainSelection(sel.RangeMain().Start().Position(), sel.RangeMain().End().Position()); const std::string selectedText = RangeText(rangeMainSelection.start, rangeMainSelection.end); const Range rangeTarget(targetStart, targetEnd); std::vector searchRanges; // Search should be over the target range excluding the current selection so // may need to search 2 ranges, after the selection then before the selection. if (rangeTarget.Overlaps(rangeMainSelection)) { // Common case is that the selection is completely within the target but // may also have overlap at start or end. if (rangeMainSelection.end < rangeTarget.end) searchRanges.push_back(Range(rangeMainSelection.end, rangeTarget.end)); if (rangeTarget.start < rangeMainSelection.start) searchRanges.push_back(Range(rangeTarget.start, rangeMainSelection.start)); } else { // No overlap searchRanges.push_back(rangeTarget); } for (std::vector::const_iterator it = searchRanges.begin(); it != searchRanges.end(); ++it) { int searchStart = it->start; const int searchEnd = it->end; for (;;) { int lengthFound = static_cast(selectedText.length()); int pos = static_cast(pdoc->FindText(searchStart, searchEnd, selectedText.c_str(), searchFlags, &lengthFound)); if (pos >= 0) { sel.AddSelection(SelectionRange(pos + lengthFound, pos)); ScrollRange(sel.RangeMain()); Redraw(); if (addNumber == addOne) return; searchStart = pos + lengthFound; } else { break; } } } } } 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->StyleIndexAt(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->StyleIndexAt(pos.Position() - 1)].IsProtected()) { while ((pos.Position() < pdoc->Length()) && (vs.styles[pdoc->StyleIndexAt(pos.Position())].IsProtected())) pos.Add(1); } } else if (moveDir < 0) { if (vs.styles[pdoc->StyleIndexAt(pos.Position())].IsProtected()) { while ((pos.Position() > 0) && (vs.styles[pdoc->StyleIndexAt(pos.Position() - 1)].IsProtected())) pos.Add(-1); } } } return pos; } void Editor::MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible) { const 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 : newPos), xysDefault); if (previousPos.IsValid() && (newXY.xOffset == xOffset)) { // simple vertical scroll then invalidate ScrollTo(newXY.topLine); InvalidateSelection(SelectionRange(previousPos), true); } else { SetXYScroll(newXY); } } ShowCaretAtCurrentPosition(); NotifyCaretMove(); ClaimSelection(); SetHoverIndicatorPosition(sel.MainCaret()); QueueIdleWork(WorkNeeded::workUpdateUI); if (marginView.highlightDelimiter.NeedsDrawing(currentLine)) { RedrawSelMargin(); } } void Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, bool ensureVisible) { const SelectionPosition spCaret = ((sel.Count() == 1) && sel.Empty()) ? sel.Last() : SelectionPosition(INVALID_POSITION); 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); sel.DropAdditionalRanges(); } 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); } MovedCaret(newPos, spCaret, ensureVisible); } void Editor::MovePositionTo(int newPos, Selection::selTypes selt, bool ensureVisible) { 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. StyleAreaBounded(GetClientRectangle(), true); #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; StyleAreaBounded(rcArea, false); 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::RealizeVirtualSpace(int position, unsigned int virtualSpace) { if (virtualSpace > 0) { const int line = pdoc->LineFromPosition(position); const int indent = pdoc->GetLineIndentPosition(line); if (indent == position) { return pdoc->SetLineIndentation(line, pdoc->GetLineIndentation(line) + virtualSpace); } else { std::string spaceText(virtualSpace, ' '); const int lengthInserted = pdoc->InsertString(position, spaceText.c_str(), virtualSpace); position += lengthInserted; } } return position; } SelectionPosition Editor::RealizeVirtualSpace(const SelectionPosition &position) { // Return the new position with no virtual space return SelectionPosition(RealizeVirtualSpace(position.Position(), position.VirtualSpace())); } 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)) { InvalidateWholeSelection(); sel.DropAdditionalRanges(); } } 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 = RealizeVirtualSpace(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::ClearBeforeTentativeStart() { // Make positions for the first composition string. FilterSelections(); UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike); 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(); } } RealizeVirtualSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); sel.Range(r).ClearVirtualSpace(); } } } void Editor::InsertPaste(const char *text, int len) { if (multiPasteMode == SC_MULTIPASTE_ONCE) { SelectionPosition selStart = sel.Start(); selStart = RealizeVirtualSpace(selStart); 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 = RealizeVirtualSpace(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 = RealizeVirtualSpace(sel.RangeMain().caret); 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) { assert(pdoc); 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, bool super) { return (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0) | (meta ? SCI_META : 0) | (super ? SCI_SUPER : 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) { const int marginClicked = vs.MarginFromLocation(pt); 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)); } bool Editor::NotifyMarginRightClick(Point pt, int modifiers) { int marginRightClicked = vs.MarginFromLocation(pt); if ((marginRightClicked >= 0) && vs.ms[marginRightClicked].sensitive) { int position = pdoc->LineStart(LineFromLocation(pt)); SCNotification scn = {}; scn.nmhdr.code = SCN_MARGINRIGHTCLICK; scn.modifiers = modifiers; scn.position = position; scn.margin = marginRightClicked; NotifyParent(scn); return true; } else { return false; } } 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. const int lineOfPos = pdoc->LineFromPosition(mh.position); int endNeedShown = mh.position; if (mh.modificationType & SC_MOD_BEFOREINSERT) { if (pdoc->ContainsLineEnd(mh.text, mh.length) && (mh.position != pdoc->LineStart(lineOfPos))) endNeedShown = pdoc->LineStart(lineOfPos+1); } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { // Extend the need shown area over any folded lines endNeedShown = mh.position + mh.length; int lineLast = pdoc->LineFromPosition(mh.position+mh.length); for (int line = lineOfPos; line <= lineLast; line++) { const int lineMaxSubord = pdoc->GetLastChild(line, -1, -1); if (lineLast < lineMaxSubord) { lineLast = lineMaxSubord; endNeedShown = pdoc->LineEnd(lineLast); } } } NeedShown(mh.position, endNeedShown - mh.position); } 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() { InvalidateWholeSelection(); if (sel.IsRectangular() || !additionalSelectionTyping) { // Remove non-main ranges sel.DropAdditionalRanges(); } UndoGroup ug(pdoc, !sel.Empty() || (sel.Count() > 1)); // Clear each range if (!sel.Empty()) { ClearSelection(); } // Insert each line end size_t countInsertions = 0; for (size_t r = 0; r < sel.Count(); r++) { sel.Range(r).ClearVirtualSpace(); const char *eol = StringFromEOLMode(pdoc->eolMode); const int positionInsert = sel.Range(r).caret.Position(); const int insertLength = pdoc->InsertString(positionInsert, eol, istrlen(eol)); if (insertLength > 0) { sel.Range(r) = SelectionRange(positionInsert + insertLength); countInsertions++; } } // Perform notifications after all the changes as the application may change the // selections in response to the characters. for (size_t i = 0; i < countInsertions; i++) { const char *eol = StringFromEOLMode(pdoc->eolMode); 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(); } SelectionPosition Editor::PositionUpOrDown(SelectionPosition spStart, int direction, int lastX) { const Point pt = LocationFromPosition(spStart); int skipLines = 0; if (vs.annotationVisible) { const int lineDoc = pdoc->LineFromPosition(spStart.Position()); const Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc)); const int subLine = static_cast(pt.y - ptStartLine.y) / vs.lineHeight; if (direction < 0 && subLine == 0) { const 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); } } const int newY = static_cast(pt.y) + (1 + skipLines) * direction * vs.lineHeight; if (lastX < 0) { lastX = static_cast(pt.x) + xOffset; } SelectionPosition posNew = SPositionFromLocation( Point::FromInts(lastX - 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() > spStart.Position()) && (ptNew.y > newY)) { posNew.Add(-1); posNew.SetVirtualSpace(0); ptNew = LocationFromPosition(posNew.Position()); } } return posNew; } 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; } } if (selt == Selection::selRectangle) { const SelectionRange rangeBase = sel.IsRectangular() ? sel.Rectangular() : sel.RangeMain(); if (!sel.IsRectangular()) { InvalidateWholeSelection(); sel.DropAdditionalRanges(); } const SelectionPosition posNew = MovePositionSoVisible( PositionUpOrDown(caretToUse, direction, lastXChosen), direction); sel.selType = Selection::selRectangle; sel.Rectangular() = SelectionRange(posNew, rangeBase.anchor); SetRectangularRange(); MovedCaret(posNew, caretToUse, true); } else { InvalidateWholeSelection(); if (!additionalSelectionTyping || (sel.IsRectangular())) { sel.DropAdditionalRanges(); } sel.selType = Selection::selStream; for (size_t r = 0; r < sel.Count(); r++) { const int lastX = (r == sel.Main()) ? lastXChosen : -1; const SelectionPosition spCaretNow = sel.Range(r).caret; const SelectionPosition posNew = MovePositionSoVisible( PositionUpOrDown(spCaretNow, direction, lastX), direction); sel.Range(r) = selt == Selection::selStream ? SelectionRange(posNew, sel.Range(r).anchor) : SelectionRange(posNew); } sel.RemoveDuplicates(); MovedCaret(sel.RangeMain().caret, caretToUse, true); } } 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)); } Range Editor::RangeDisplayLine(int lineVisible) { RefreshStyleData(); AutoSurface surface(this); return view.RangeDisplayLine(surface, *this, lineVisible, vs); } 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; } } namespace { unsigned int WithExtends(unsigned int iMessage) { switch (iMessage) { case SCI_CHARLEFT: return SCI_CHARLEFTEXTEND; case SCI_CHARRIGHT: return SCI_CHARRIGHTEXTEND; case SCI_WORDLEFT: return SCI_WORDLEFTEXTEND; case SCI_WORDRIGHT: return SCI_WORDRIGHTEXTEND; case SCI_WORDLEFTEND: return SCI_WORDLEFTENDEXTEND; case SCI_WORDRIGHTEND: return SCI_WORDRIGHTENDEXTEND; case SCI_WORDPARTLEFT: return SCI_WORDPARTLEFTEXTEND; case SCI_WORDPARTRIGHT: return SCI_WORDPARTRIGHTEXTEND; case SCI_HOME: return SCI_HOMEEXTEND; case SCI_HOMEDISPLAY: return SCI_HOMEDISPLAYEXTEND; case SCI_HOMEWRAP: return SCI_HOMEWRAPEXTEND; case SCI_VCHOME: return SCI_VCHOMEEXTEND; case SCI_VCHOMEDISPLAY: return SCI_VCHOMEDISPLAYEXTEND; case SCI_VCHOMEWRAP: return SCI_VCHOMEWRAPEXTEND; case SCI_LINEEND: return SCI_LINEENDEXTEND; case SCI_LINEENDDISPLAY: return SCI_LINEENDDISPLAYEXTEND; case SCI_LINEENDWRAP: return SCI_LINEENDWRAPEXTEND; default: return iMessage; } } int NaturalDirection(unsigned int iMessage) { switch (iMessage) { case SCI_CHARLEFT: case SCI_CHARLEFTEXTEND: case SCI_CHARLEFTRECTEXTEND: case SCI_WORDLEFT: case SCI_WORDLEFTEXTEND: case SCI_WORDLEFTEND: case SCI_WORDLEFTENDEXTEND: case SCI_WORDPARTLEFT: case SCI_WORDPARTLEFTEXTEND: case SCI_HOME: case SCI_HOMEEXTEND: case SCI_HOMEDISPLAY: case SCI_HOMEDISPLAYEXTEND: case SCI_HOMEWRAP: case SCI_HOMEWRAPEXTEND: // VC_HOME* mostly goes back case SCI_VCHOME: case SCI_VCHOMEEXTEND: case SCI_VCHOMEDISPLAY: case SCI_VCHOMEDISPLAYEXTEND: case SCI_VCHOMEWRAP: case SCI_VCHOMEWRAPEXTEND: return -1; default: return 1; } } bool IsRectExtend(unsigned int iMessage) { switch (iMessage) { case SCI_CHARLEFTRECTEXTEND: case SCI_CHARRIGHTRECTEXTEND: case SCI_HOMERECTEXTEND: case SCI_VCHOMERECTEXTEND: case SCI_LINEENDRECTEXTEND: return true; default: return false; } } } int Editor::VCHomeDisplayPosition(int position) { const int homePos = pdoc->VCHomePosition(position); const int viewLineStart = StartEndDisplayLine(position, true); if (viewLineStart > homePos) return viewLineStart; else return homePos; } int Editor::VCHomeWrapPosition(int position) { const int homePos = pdoc->VCHomePosition(position); const int viewLineStart = StartEndDisplayLine(position, true); if ((viewLineStart < position) && (viewLineStart > homePos)) return viewLineStart; else return homePos; } int Editor::LineEndWrapPosition(int position) { const int endPos = StartEndDisplayLine(position, false); const int realEndPos = pdoc->LineEndPosition(position); if (endPos > realEndPos // if moved past visible EOLs || position >= endPos) // if at end of display line already return realEndPos; else return endPos; } int Editor::HorizontalMove(unsigned int iMessage) { if (sel.MoveExtends()) { iMessage = WithExtends(iMessage); } if (!multipleSelection && !sel.IsRectangular()) { // Simplify selection down to 1 sel.SetSelection(sel.RangeMain()); } // Invalidate each of the current selections InvalidateWholeSelection(); if (IsRectExtend(iMessage)) { const SelectionRange rangeBase = sel.IsRectangular() ? sel.Rectangular() : sel.RangeMain(); if (!sel.IsRectangular()) { sel.DropAdditionalRanges(); } // Will change to rectangular if not currently rectangular SelectionPosition spCaret = rangeBase.caret; switch (iMessage) { case SCI_CHARLEFTRECTEXTEND: if (pdoc->IsLineEndPosition(spCaret.Position()) && spCaret.VirtualSpace()) { spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); } else if ((virtualSpaceOptions & SCVS_NOWRAPLINESTART) == 0 || pdoc->GetColumn(spCaret.Position()) > 0) { spCaret = SelectionPosition(spCaret.Position() - 1); } break; case SCI_CHARRIGHTRECTEXTEND: if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) && pdoc->IsLineEndPosition(sel.MainCaret())) { spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); } else { spCaret = SelectionPosition(spCaret.Position() + 1); } break; case SCI_HOMERECTEXTEND: spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position()))); break; case SCI_VCHOMERECTEXTEND: spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position())); break; case SCI_LINEENDRECTEXTEND: spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position())); break; } const int directionMove = (spCaret < rangeBase.caret) ? -1 : 1; spCaret = MovePositionSoVisible(spCaret, directionMove); sel.selType = Selection::selRectangle; sel.Rectangular() = SelectionRange(spCaret, rangeBase.anchor); SetRectangularRange(); } else if (sel.IsRectangular()) { // Not a rectangular extension so switch to stream. const SelectionPosition selAtLimit = (NaturalDirection(iMessage) > 0) ? sel.Limits().end : sel.Limits().start; sel.selType = Selection::selStream; sel.SetSelection(SelectionRange(selAtLimit)); } else { if (!additionalSelectionTyping) { InvalidateWholeSelection(); sel.DropAdditionalRanges(); } for (size_t r = 0; r < sel.Count(); r++) { const SelectionPosition spCaretNow = sel.Range(r).caret; SelectionPosition spCaret = spCaretNow; switch (iMessage) { case SCI_CHARLEFT: case SCI_CHARLEFTEXTEND: if (spCaret.VirtualSpace()) { spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); } else if ((virtualSpaceOptions & SCVS_NOWRAPLINESTART) == 0 || pdoc->GetColumn(spCaret.Position()) > 0) { spCaret = SelectionPosition(spCaret.Position() - 1); } break; case SCI_CHARRIGHT: case SCI_CHARRIGHTEXTEND: if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(spCaret.Position())) { spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); } else { spCaret = SelectionPosition(spCaret.Position() + 1); } break; case SCI_WORDLEFT: case SCI_WORDLEFTEXTEND: spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), -1)); break; case SCI_WORDRIGHT: case SCI_WORDRIGHTEXTEND: spCaret = SelectionPosition(pdoc->NextWordStart(spCaret.Position(), 1)); break; case SCI_WORDLEFTEND: case SCI_WORDLEFTENDEXTEND: spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), -1)); break; case SCI_WORDRIGHTEND: case SCI_WORDRIGHTENDEXTEND: spCaret = SelectionPosition(pdoc->NextWordEnd(spCaret.Position(), 1)); break; case SCI_WORDPARTLEFT: case SCI_WORDPARTLEFTEXTEND: spCaret = SelectionPosition(pdoc->WordPartLeft(spCaret.Position())); break; case SCI_WORDPARTRIGHT: case SCI_WORDPARTRIGHTEXTEND: spCaret = SelectionPosition(pdoc->WordPartRight(spCaret.Position())); break; case SCI_HOME: case SCI_HOMEEXTEND: spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position()))); break; case SCI_HOMEDISPLAY: case SCI_HOMEDISPLAYEXTEND: spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), true)); break; case SCI_HOMEWRAP: case SCI_HOMEWRAPEXTEND: spCaret = MovePositionSoVisible(StartEndDisplayLine(spCaret.Position(), true), -1); if (spCaretNow <= spCaret) spCaret = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(spCaret.Position()))); break; case SCI_VCHOME: case SCI_VCHOMEEXTEND: // VCHome alternates between beginning of line and beginning of text so may move back or forwards spCaret = SelectionPosition(pdoc->VCHomePosition(spCaret.Position())); break; case SCI_VCHOMEDISPLAY: case SCI_VCHOMEDISPLAYEXTEND: spCaret = SelectionPosition(VCHomeDisplayPosition(spCaret.Position())); break; case SCI_VCHOMEWRAP: case SCI_VCHOMEWRAPEXTEND: spCaret = SelectionPosition(VCHomeWrapPosition(spCaret.Position())); break; case SCI_LINEEND: case SCI_LINEENDEXTEND: spCaret = SelectionPosition(pdoc->LineEndPosition(spCaret.Position())); break; case SCI_LINEENDDISPLAY: case SCI_LINEENDDISPLAYEXTEND: spCaret = SelectionPosition(StartEndDisplayLine(spCaret.Position(), false)); break; case SCI_LINEENDWRAP: case SCI_LINEENDWRAPEXTEND: spCaret = SelectionPosition(LineEndWrapPosition(spCaret.Position())); break; default: PLATFORM_ASSERT(false); } const int directionMove = (spCaret < spCaretNow) ? -1 : 1; spCaret = MovePositionSoVisible(spCaret, directionMove); // Handle move versus extend, and special behaviour for non-empty left/right switch (iMessage) { case SCI_CHARLEFT: case SCI_CHARRIGHT: if (sel.Range(r).Empty()) { sel.Range(r) = SelectionRange(spCaret); } else { sel.Range(r) = SelectionRange( (iMessage == SCI_CHARLEFT) ? sel.Range(r).Start() : sel.Range(r).End()); } break; case SCI_WORDLEFT: case SCI_WORDRIGHT: case SCI_WORDLEFTEND: case SCI_WORDRIGHTEND: case SCI_WORDPARTLEFT: case SCI_WORDPARTRIGHT: case SCI_HOME: case SCI_HOMEDISPLAY: case SCI_HOMEWRAP: case SCI_VCHOME: case SCI_VCHOMEDISPLAY: case SCI_VCHOMEWRAP: case SCI_LINEEND: case SCI_LINEENDDISPLAY: case SCI_LINEENDWRAP: sel.Range(r) = SelectionRange(spCaret); break; case SCI_CHARLEFTEXTEND: case SCI_CHARRIGHTEXTEND: case SCI_WORDLEFTEXTEND: case SCI_WORDRIGHTEXTEND: case SCI_WORDLEFTENDEXTEND: case SCI_WORDRIGHTENDEXTEND: case SCI_WORDPARTLEFTEXTEND: case SCI_WORDPARTRIGHTEXTEND: case SCI_HOMEEXTEND: case SCI_HOMEDISPLAYEXTEND: case SCI_HOMEWRAPEXTEND: case SCI_VCHOMEEXTEND: case SCI_VCHOMEDISPLAYEXTEND: case SCI_VCHOMEWRAPEXTEND: case SCI_LINEENDEXTEND: case SCI_LINEENDDISPLAYEXTEND: case SCI_LINEENDWRAPEXTEND: { SelectionRange rangeNew = SelectionRange(spCaret, sel.Range(r).anchor); sel.TrimOtherSelections(r, SelectionRange(rangeNew)); sel.Range(r) = rangeNew; } break; default: PLATFORM_ASSERT(false); } } } sel.RemoveDuplicates(); MovedCaret(sel.RangeMain().caret, SelectionPosition(INVALID_POSITION), true); // Invalidate the new state of the selection InvalidateWholeSelection(); SetLastXChosen(); // Need the line moving and so forth from MovePositionTo return 0; } int Editor::DelWordOrLine(unsigned int iMessage) { // Virtual space may be realised for SCI_DELWORDRIGHT or SCI_DELWORDRIGHTEND // which means 2 actions so wrap in an undo group. // Rightwards and leftwards deletions differ in treatment of virtual space. // Clear virtual space for leftwards, realise for rightwards. const bool leftwards = (iMessage == SCI_DELWORDLEFT) || (iMessage == SCI_DELLINELEFT); if (!additionalSelectionTyping) { InvalidateWholeSelection(); sel.DropAdditionalRanges(); } UndoGroup ug0(pdoc, (sel.Count() > 1) || !leftwards); for (size_t r = 0; r < sel.Count(); r++) { if (leftwards) { // Delete to the left so first clear the virtual space. sel.Range(r).ClearVirtualSpace(); } else { // Delete to the right so first realise the virtual space. sel.Range(r) = SelectionRange( RealizeVirtualSpace(sel.Range(r).caret)); } Range rangeDelete; switch (iMessage) { case SCI_DELWORDLEFT: rangeDelete = Range( pdoc->NextWordStart(sel.Range(r).caret.Position(), -1), sel.Range(r).caret.Position()); break; case SCI_DELWORDRIGHT: rangeDelete = Range( sel.Range(r).caret.Position(), pdoc->NextWordStart(sel.Range(r).caret.Position(), 1)); break; case SCI_DELWORDRIGHTEND: rangeDelete = Range( sel.Range(r).caret.Position(), pdoc->NextWordEnd(sel.Range(r).caret.Position(), 1)); break; case SCI_DELLINELEFT: rangeDelete = Range( pdoc->LineStart(pdoc->LineFromPosition(sel.Range(r).caret.Position())), sel.Range(r).caret.Position()); break; case SCI_DELLINERIGHT: rangeDelete = Range( sel.Range(r).caret.Position(), pdoc->LineEnd(pdoc->LineFromPosition(sel.Range(r).caret.Position()))); break; } if (!RangeContainsProtected(rangeDelete.start, rangeDelete.end)) { pdoc->DeleteChars(rangeDelete.start, rangeDelete.end - rangeDelete.start); } } // May need something stronger here: can selections overlap at this point? sel.RemoveDuplicates(); MovedCaret(sel.RangeMain().caret, SelectionPosition(INVALID_POSITION), true); // Invalidate the new state of the selection InvalidateWholeSelection(); SetLastXChosen(); return 0; } int Editor::KeyCommand(unsigned int iMessage) { switch (iMessage) { case SCI_LINEDOWN: CursorUpOrDown(1, Selection::noSel); break; case SCI_LINEDOWNEXTEND: CursorUpOrDown(1, Selection::selStream); break; case SCI_LINEDOWNRECTEXTEND: CursorUpOrDown(1, Selection::selRectangle); break; case SCI_PARADOWN: ParaUpOrDown(1, Selection::noSel); break; case SCI_PARADOWNEXTEND: ParaUpOrDown(1, Selection::selStream); break; case SCI_LINESCROLLDOWN: ScrollTo(topLine + 1); MoveCaretInsideView(false); break; case SCI_LINEUP: CursorUpOrDown(-1, Selection::noSel); break; case SCI_LINEUPEXTEND: CursorUpOrDown(-1, Selection::selStream); break; case SCI_LINEUPRECTEXTEND: CursorUpOrDown(-1, Selection::selRectangle); break; case SCI_PARAUP: ParaUpOrDown(-1, Selection::noSel); break; case SCI_PARAUPEXTEND: ParaUpOrDown(-1, Selection::selStream); break; case SCI_LINESCROLLUP: ScrollTo(topLine - 1); MoveCaretInsideView(false); break; case SCI_CHARLEFT: case SCI_CHARLEFTEXTEND: case SCI_CHARLEFTRECTEXTEND: case SCI_CHARRIGHT: case SCI_CHARRIGHTEXTEND: case SCI_CHARRIGHTRECTEXTEND: 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_WORDPARTLEFT: case SCI_WORDPARTLEFTEXTEND: case SCI_WORDPARTRIGHT: case SCI_WORDPARTRIGHTEXTEND: case SCI_HOME: case SCI_HOMEEXTEND: case SCI_HOMERECTEXTEND: case SCI_HOMEDISPLAY: case SCI_HOMEDISPLAYEXTEND: case SCI_HOMEWRAP: case SCI_HOMEWRAPEXTEND: case SCI_VCHOME: case SCI_VCHOMEEXTEND: case SCI_VCHOMERECTEXTEND: case SCI_VCHOMEDISPLAY: case SCI_VCHOMEDISPLAYEXTEND: case SCI_VCHOMEWRAP: case SCI_VCHOMEWRAPEXTEND: case SCI_LINEEND: case SCI_LINEENDEXTEND: case SCI_LINEENDRECTEXTEND: case SCI_LINEENDDISPLAY: case SCI_LINEENDDISPLAYEXTEND: case SCI_LINEENDWRAP: case SCI_LINEENDWRAPEXTEND: return HorizontalMove(iMessage); 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(); if (sel.Count() > 1) { // Drop additional selections InvalidateWholeSelection(); sel.DropAdditionalRanges(); } 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_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: case SCI_DELWORDRIGHT: case SCI_DELWORDRIGHTEND: case SCI_DELLINELEFT: case SCI_DELLINERIGHT: return DelWordOrLine(iMessage); 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_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 Sci_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, 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, static_cast(wParam), &lengthFound); } else { pos = pdoc->FindText(searchAnchor, 0, txt, 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, &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 = RealizeVirtualSpace(position); 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 (size_t margin = 0; margin < vs.ms.size(); 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) { if (sel.IsRectangular() || (sel.Count() > 1)) { InvalidateWholeSelection(); sel.Clear(); } 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::RightButtonDownWithModifiers(Point pt, unsigned int, int modifiers) { if (NotifyMarginRightClick(pt, modifiers)) return; } 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[pdoc->StyleIndexAt(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) { Redraw(); } } 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); InvalidateWholeSelection(); } 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 needWrap = Wrapping() && wrapPending.NeedsWrap(); if (needWrap) { // Wrap lines during idle. WrapLines(wsIdle); // No more wrapping needWrap = wrapPending.NeedsWrap(); } else if (needIdleStyling) { IdleStyling(); } // 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. const bool idleDone = !needWrap && !needIdleStyling; // && 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; const int styleAtEnd = pdoc->StyleIndexAt(pos-1); pdoc->EnsureStyledTo(pos); if ((endWindow > pos) && (styleAtEnd != pdoc->StyleIndexAt(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); } } int Editor::PositionAfterMaxStyling(int posMax, bool scrolling) const { if ((idleStyling == SC_IDLESTYLING_NONE) || (idleStyling == SC_IDLESTYLING_AFTERVISIBLE)) { // Both states do not limit styling return posMax; } // Try to keep time taken by styling reasonable so interaction remains smooth. // When scrolling, allow less time to ensure responsive const double secondsAllowed = scrolling ? 0.005 : 0.02; const int linesToStyle = Platform::Clamp(static_cast(secondsAllowed / pdoc->durationStyleOneLine), 10, 0x10000); const int stylingMaxLine = std::min( static_cast(pdoc->LineFromPosition(pdoc->GetEndStyled()) + linesToStyle), pdoc->LinesTotal()); return std::min(static_cast(pdoc->LineStart(stylingMaxLine)), posMax); } void Editor::StartIdleStyling(bool truncatedLastStyling) { if ((idleStyling == SC_IDLESTYLING_ALL) || (idleStyling == SC_IDLESTYLING_AFTERVISIBLE)) { if (pdoc->GetEndStyled() < pdoc->Length()) { // Style remainder of document in idle time needIdleStyling = true; } } else if (truncatedLastStyling) { needIdleStyling = true; } if (needIdleStyling) { SetIdle(true); } } // Style for an area but bound the amount of styling to remain responsive void Editor::StyleAreaBounded(PRectangle rcArea, bool scrolling) { const int posAfterArea = PositionAfterArea(rcArea); const int posAfterMax = PositionAfterMaxStyling(posAfterArea, scrolling); if (posAfterMax < posAfterArea) { // Idle styling may be performed before current visible area // Style a bit now then style further in idle time pdoc->StyleToAdjustingLineDuration(posAfterMax); } else { // Can style all wanted now. StyleToPositionInView(posAfterArea); } StartIdleStyling(posAfterMax < posAfterArea); } void Editor::IdleStyling() { const int posAfterArea = PositionAfterArea(GetClientRectangle()); const int endGoal = (idleStyling >= SC_IDLESTYLING_AFTERVISIBLE) ? pdoc->Length() : posAfterArea; const int posAfterMax = PositionAfterMaxStyling(endGoal, false); pdoc->StyleToAdjustingLineDuration(posAfterMax); if (pdoc->GetEndStyled() >= endGoal) { needIdleStyling = false; } } 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); } // Ensure child lines lexed and fold information extracted before // flipping the state. pdoc->GetLastChild(line, LevelNumber(level)); SetFoldExpanded(line, expanding); if (expanding && (cs.HiddenLines() == 0)) // Nothing to do return; int lineMaxSubord = pdoc->GetLastChild(line, LevelNumber(level)); 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 == LevelNumber(level))) { 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) { const int prevLine = line - 1; const int prevLineLevel = pdoc->GetLevel(prevLine); // Combining two blocks where the first block is collapsed (e.g. by deleting the line(s) which separate(s) the two blocks) if ((LevelNumber(prevLineLevel) == LevelNumber(levelNow)) && !cs.GetVisible(prevLine)) FoldLine(pdoc->GetFoldParent(prevLine), SC_FOLDACTION_EXPAND); 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(); } // Combining two blocks where the second one is collapsed (e.g. by adding characters in the line which separates the two blocks) FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev); } } if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && (LevelNumber(levelPrev) > LevelNumber(levelNow))) { 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(); } } } // Combining two blocks where the first one is collapsed (e.g. by adding characters in the line which separates the two blocks) if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && (LevelNumber(levelPrev) < LevelNumber(levelNow))) { if (cs.HiddenLines()) { const int parentLine = pdoc->GetFoldParent(line); if (!cs.GetExpanded(parentLine) && cs.GetExpanded(line)) FoldLine(parentLine, SC_FOLDACTION_EXPAND); } } } 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); } bool Editor::ValidMargin(uptr_t wParam) const { return wParam < vs.ms.size(); } 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; } void Editor::SetSelectionNMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { InvalidateRange(sel.Range(wParam).Start().Position(), sel.Range(wParam).End().Position()); switch (iMessage) { case SCI_SETSELECTIONNCARET: sel.Range(wParam).caret.SetPosition(static_cast(lParam)); break; case SCI_SETSELECTIONNANCHOR: sel.Range(wParam).anchor.SetPosition(static_cast(lParam)); break; case SCI_SETSELECTIONNCARETVIRTUALSPACE: sel.Range(wParam).caret.SetVirtualSpace(static_cast(lParam)); break; case SCI_SETSELECTIONNANCHORVIRTUALSPACE: sel.Range(wParam).anchor.SetVirtualSpace(static_cast(lParam)); break; case SCI_SETSELECTIONNSTART: sel.Range(wParam).anchor.SetPosition(static_cast(lParam)); break; case SCI_SETSELECTIONNEND: sel.Range(wParam).caret.SetPosition(static_cast(lParam)); break; } InvalidateRange(sel.Range(wParam).Start().Position(), sel.Range(wParam).End().Position()); ContainerNeedsUpdate(SC_UPDATE_SELECTION); } 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_TARGETWHOLEDOCUMENT: targetStart = 0; targetEnd = pdoc->Length(); 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_GETTABDRAWMODE: return vs.tabDrawMode; case SCI_SETTABDRAWMODE: vs.tabDrawMode = 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: if (static_cast(wParam) < 0) errorStatus = SC_STATUS_FAILURE; else 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_ISRANGEWORD: return pdoc->IsWordAt(static_cast(wParam), static_cast(lParam)); case SCI_SETIDLESTYLING: idleStyling = static_cast(wParam); break; case SCI_GETIDLESTYLING: return idleStyling; 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: RefreshStyleData(); 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; // 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_SETMARGINBACKN: if (ValidMargin(wParam)) { vs.ms[wParam].back = ColourDesired(static_cast(lParam)); InvalidateStyleRedraw(); } break; case SCI_GETMARGINBACKN: if (ValidMargin(wParam)) return vs.ms[wParam].back.AsLong(); else return 0; case SCI_SETMARGINS: if (wParam < 1000) vs.ms.resize(wParam); break; case SCI_GETMARGINS: return vs.ms.size(); 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_TOGGLEFOLDSHOWTEXT: cs.SetFoldDisplayText(static_cast(wParam), CharPtrFromSPtr(lParam)); FoldLine(static_cast(wParam), SC_FOLDACTION_TOGGLE); break; case SCI_FOLDDISPLAYTEXTSETSTYLE: foldDisplayTextStyle = 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.column; case SCI_SETEDGECOLUMN: vs.theEdge.column = 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.theEdge.colour.AsLong(); case SCI_SETEDGECOLOUR: vs.theEdge.colour = ColourDesired(static_cast(wParam)); InvalidateStyleRedraw(); break; case SCI_MULTIEDGEADDLINE: vs.theMultiEdge.push_back(EdgeProperties(wParam, lParam)); InvalidateStyleRedraw(); break; case SCI_MULTIEDGECLEARALL: std::vector().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible 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; } InvalidateWholeSelection(); 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_SETMOUSEWHEELCAPTURES: mouseWheelCaptures = wParam != 0; break; case SCI_GETMOUSEWHEELCAPTURES: return mouseWheelCaptures; 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(); ContainerNeedsUpdate(SC_UPDATE_SELECTION); 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))); ContainerNeedsUpdate(SC_UPDATE_SELECTION); Redraw(); break; case SCI_DROPSELECTIONN: sel.DropSelection(static_cast(wParam)); ContainerNeedsUpdate(SC_UPDATE_SELECTION); Redraw(); break; case SCI_SETMAINSELECTION: sel.SetMain(static_cast(wParam)); ContainerNeedsUpdate(SC_UPDATE_SELECTION); Redraw(); break; case SCI_GETMAINSELECTION: return sel.Main(); case SCI_SETSELECTIONNCARET: case SCI_SETSELECTIONNANCHOR: case SCI_SETSELECTIONNCARETVIRTUALSPACE: case SCI_SETSELECTIONNANCHORVIRTUALSPACE: case SCI_SETSELECTIONNSTART: case SCI_SETSELECTIONNEND: SetSelectionNMessage(iMessage, wParam, lParam); break; case SCI_GETSELECTIONNCARET: return sel.Range(wParam).caret.Position(); case SCI_GETSELECTIONNANCHOR: return sel.Range(wParam).anchor.Position(); case SCI_GETSELECTIONNCARETVIRTUALSPACE: return sel.Range(wParam).caret.VirtualSpace(); case SCI_GETSELECTIONNANCHORVIRTUALSPACE: return sel.Range(wParam).anchor.VirtualSpace(); case SCI_GETSELECTIONNSTART: return sel.Range(wParam).Start().Position(); 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(); InvalidateWholeSelection(); break; case SCI_SWAPMAINANCHORCARET: InvalidateSelection(sel.RangeMain()); sel.RangeMain().Swap(); break; case SCI_MULTIPLESELECTADDNEXT: MultipleSelectAdd(addOne); break; case SCI_MULTIPLESELECTADDEACH: MultipleSelectAdd(addEach); 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; } sqlitebrowser-3.10.1/libs/qscintilla/src/Editor.h000066400000000000000000000516021316047212700217720ustar00rootroot00000000000000// 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 }; enum workItems items; Position upTo; WorkNeeded() : items(workNone), upTo(0) {} void Reset() { 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 explicit 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; bool mouseWheelCaptures; 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 idleStyling; bool needIdleStyling; 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; PointDocument 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, PointEnd pe=peDefault); Point LocationFromPosition(int pos, PointEnd pe=peDefault); 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 InvalidateWholeSelection(); 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_); enum AddNumber { addOne, addEach }; void MultipleSelectAdd(AddNumber addNumber); 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; void MovedCaret(SelectionPosition newPos, SelectionPosition previousPos, bool ensureVisible); void MovePositionTo(SelectionPosition newPos, Selection::selTypes selt=Selection::noSel, bool ensureVisible=true); void 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 NotifyCaretMove(); 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 RealizeVirtualSpace(int position, unsigned int virtualSpace); SelectionPosition RealizeVirtualSpace(const SelectionPosition &position); void AddChar(char ch); virtual void AddCharUTF(const char *s, unsigned int len, bool treatAsDBCS=false); void ClearBeforeTentativeStart(); 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, bool super=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); bool NotifyMarginRightClick(Point pt, int modifiers); 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(); SelectionPosition PositionUpOrDown(SelectionPosition spStart, int direction, int lastX); void CursorUpOrDown(int direction, Selection::selTypes selt); void ParaUpOrDown(int direction, Selection::selTypes selt); Range RangeDisplayLine(int lineVisible); int StartEndDisplayLine(int pos, bool start); int VCHomeDisplayPosition(int position); int VCHomeWrapPosition(int position); int LineEndWrapPosition(int position); int HorizontalMove(unsigned int iMessage); int DelWordOrLine(unsigned int iMessage); 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 RightButtonDownWithModifiers(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); int PositionAfterMaxStyling(int posMax, bool scrolling) const; void StartIdleStyling(bool truncatedLastStyling); void StyleAreaBounded(PRectangle rcArea, bool scrolling); void IdleStyling(); 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; bool ValidMargin(uptr_t wParam) const; void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void SetSelectionNMessage(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 sqlitebrowser-3.10.1/libs/qscintilla/src/ExternalLexer.cpp000066400000000000000000000101121316047212700236500ustar00rootroot00000000000000// 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 #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; sqlitebrowser-3.10.1/libs/qscintilla/src/ExternalLexer.h000066400000000000000000000044541316047212700233310ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/FontQuality.h000066400000000000000000000015451316047212700230240ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Indicator.cpp000066400000000000000000000165461316047212700230230ustar00rootroot00000000000000// 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 #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, const PRectangle &rcCharacter, 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 if (sacDraw.style == INDIC_POINT || sacDraw.style == INDIC_POINTCHARACTER) { if (rcCharacter.Width() >= 0.1) { const int pixelHeight = static_cast(rc.Height() - 1.0f); // 1 pixel onto next line if multiphase const XYPOSITION x = (sacDraw.style == INDIC_POINT) ? (rcCharacter.left) : ((rcCharacter.right + rcCharacter.left) / 2); const int ix = static_cast(x + 0.5f); const int iy = static_cast(rc.top + 1.0f); Point pts[] = { Point::FromInts(ix - pixelHeight, iy + pixelHeight), // Left Point::FromInts(ix + pixelHeight, iy + pixelHeight), // Right Point::FromInts(ix, iy) // Top }; surface->Polygon(pts, 3, sacDraw.fore, 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_; } sqlitebrowser-3.10.1/libs/qscintilla/src/Indicator.h000066400000000000000000000033021316047212700224520ustar00rootroot00000000000000// 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, const PRectangle &rcCharacter, 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 sqlitebrowser-3.10.1/libs/qscintilla/src/KeyMap.cpp000066400000000000000000000123541316047212700222660ustar00rootroot00000000000000// 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 #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}, }; sqlitebrowser-3.10.1/libs/qscintilla/src/KeyMap.h000066400000000000000000000024531316047212700217320ustar00rootroot00000000000000// 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_SUPER SCMOD_SUPER #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 sqlitebrowser-3.10.1/libs/qscintilla/src/License.txt000066400000000000000000000015441316047212700225160ustar00rootroot00000000000000License 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. sqlitebrowser-3.10.1/libs/qscintilla/src/LineMarker.cpp000066400000000000000000000344151316047212700231330ustar00rootroot00000000000000// 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 #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); } } sqlitebrowser-3.10.1/libs/qscintilla/src/LineMarker.h000066400000000000000000000046571316047212700226050ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/MarginView.cpp000066400000000000000000000406051316047212700231500ustar00rootroot00000000000000// 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 "Position.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 (size_t margin = 0; margin < vs.ms.size(); 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; case SC_MARGIN_COLOUR: colour = vs.ms[margin].back; 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 (LevelNumber(level) < LevelNumber(levelPrev)) 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 = LevelNumber(level); const int levelNextNum = LevelNumber(levelNext); 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 = LevelNumber(model.pdoc->GetLevel(firstFollowupLine + 1)); 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' : '_', LevelNumber(lev), 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 sqlitebrowser-3.10.1/libs/qscintilla/src/MarginView.h000066400000000000000000000030521316047212700226100ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Partitioning.h000066400000000000000000000120031316047212700232030ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/PerLine.cpp000066400000000000000000000322331316047212700224340ustar00rootroot00000000000000// 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 #include "Platform.h" #include "Scintilla.h" #include "Position.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 = &other->root; while (*pmhn) { pmhn = &((*pmhn)->next); } *pmhn = root; root = 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](); 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; } sqlitebrowser-3.10.1/libs/qscintilla/src/PerLine.h000066400000000000000000000064131316047212700221020ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Position.h000066400000000000000000000014311316047212700223430ustar00rootroot00000000000000// Scintilla source code edit control /** @file Position.h ** Defines global type name Position in the Sci internal namespace. **/ // Copyright 2015 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef POSITION_H #define POSITION_H /** * 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. */ namespace Sci { typedef int Position; // A later version (4.x) of this file may: //#if defined(SCI_LARGE_FILE_SUPPORT) //typedef std::ptrdiff_t Position; // or may allow runtime choice between different position sizes. const Position invalidPosition = -1; } #endif sqlitebrowser-3.10.1/libs/qscintilla/src/PositionCache.cpp000066400000000000000000000462631316047212700236360ustar00rootroot00000000000000// 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 "Position.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, PointEnd pe) 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; if (pe & peSubLineEnd) // Return end of first subline not start of next break; } else if ((pe & peLineEnd) && (subLine == (lines-1))) { pt.x = positions[numCharsInLine] - 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'); } /** * A point in document space. * Uses double for sufficient resolution in large (>20,000,000 line) documents. */ class PointDocument { public: double x; double y; explicit PointDocument(double x_ = 0, double y_ = 0) : x(x_), y(y_) { } // Conversion from Point. explicit PointDocument(Point pt) : x(pt.x), y(pt.y) { } }; // There are two points for some positions and this enumeration // can choose between the end of the first line or subline // and the start of the next line or subline. enum PointEnd { peDefault = 0x0, peLineEnd = 0x1, peSubLineEnd = 0x2 }; /** */ 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, PointEnd pe) 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 sqlitebrowser-3.10.1/libs/qscintilla/src/RESearch.cpp000066400000000000000000000635041316047212700225370ustar00rootroot00000000000000// 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 #include "Position.h" #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); } } } static 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; } sqlitebrowser-3.10.1/libs/qscintilla/src/RESearch.h000066400000000000000000000030541316047212700221760ustar00rootroot00000000000000// 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=4096 }; 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 sqlitebrowser-3.10.1/libs/qscintilla/src/RunStyles.cpp000066400000000000000000000164621316047212700230540ustar00rootroot00000000000000/** @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 "Position.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."); } } } sqlitebrowser-3.10.1/libs/qscintilla/src/RunStyles.h000066400000000000000000000025771316047212700225230ustar00rootroot00000000000000/** @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 sqlitebrowser-3.10.1/libs/qscintilla/src/SciTE.properties000066400000000000000000000004611316047212700234550ustar00rootroot00000000000000# 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 sqlitebrowser-3.10.1/libs/qscintilla/src/ScintillaBase.cpp000066400000000000000000000700231316047212700236120ustar00rootroot00000000000000// 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 "Position.h" #include "SplitVector.h" #include "Partitioning.h" #include "RunStyles.h" #include "ContractionState.h" #include "CellBuffer.h" #include "CallTip.h" #include "KeyMap.h" #include "Indicator.h" #include "XPM.h" #include "LineMarker.h" #include "Style.h" #include "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 = SC_POPUP_ALL; 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(0, SC_AC_TAB); return 0; case SCI_NEWLINE: AutoCompleteCompleted(0, SC_AC_NEWLINE); 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(0, SC_AC_DOUBLECLICK); } 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 && // Won't 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)) && // Won't 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(ch, SC_AC_FILLUP); } 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(char ch, unsigned int completionMethod) { 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.ch = ch; scn.listCompletionMethod = completionMethod; 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(); scn.nmhdr.code = SCN_AUTOCCOMPLETED; NotifyParent(scn); } 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); } bool ScintillaBase::ShouldDisplayPopup(Point ptInWindowCoordinates) const { return (displayPopupMenu == SC_POPUP_ALL || (displayPopupMenu == SC_POPUP_TEXT && !PointInSelMargin(ptInWindowCoordinates))); } 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)); } void ScintillaBase::RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers) { CancelModes(); Editor::RightButtonDownWithModifiers(pt, curTime, modifiers); } #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); pdoc->ModifiedAt(0); } } 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(0, SC_AC_COMMAND); 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 = static_cast(wParam); 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; } sqlitebrowser-3.10.1/libs/qscintilla/src/ScintillaBase.h000066400000000000000000000057461316047212700232710ustar00rootroot00000000000000// 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 explicit 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 }; int 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(char ch, unsigned int completionMethod); 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; bool ShouldDisplayPopup(Point ptInWindowCoordinates) const; 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); virtual void RightButtonDownWithModifiers(Point pt, unsigned int curTime, int modifiers); 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Selection.cpp000066400000000000000000000244231316047212700230250ustar00rootroot00000000000000// 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 #include "Platform.h" #include "Scintilla.h" #include "Position.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(); } } void SelectionRange::Swap() { std::swap(caret, anchor); } 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::DropAdditionalRanges() { SetSelection(RangeMain()); } 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(); } sqlitebrowser-3.10.1/libs/qscintilla/src/Selection.h000066400000000000000000000126231316047212700224710ustar00rootroot00000000000000// 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; } void Swap(); 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 TrimOtherSelections(size_t r, SelectionRange range); void SetSelection(SelectionRange range); void AddSelection(SelectionRange range); void AddSelectionWithoutTrim(SelectionRange range); void DropSelection(size_t r); void DropAdditionalRanges(); 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 sqlitebrowser-3.10.1/libs/qscintilla/src/SparseVector.h000066400000000000000000000131031316047212700231560ustar00rootroot00000000000000// Scintilla source code edit control /** @file SparseVector.h ** Hold data sparsely associated with elements in a range. **/ // Copyright 2016 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #ifndef SPARSEVECTOR_H #define SPARSEVECTOR_H #ifdef SCI_NAMESPACE namespace Scintilla { #endif // SparseVector is similar to RunStyles but is more efficient for cases where values occur // for one position instead of over a range of positions. template class SparseVector { private: Partitioning *starts; SplitVector *values; // Private so SparseVector objects can not be copied SparseVector(const SparseVector &); void ClearValue(int partition) { values->SetValueAt(partition, T()); } void CommonSetValueAt(int position, T value) { // Do the work of setting the value to allow for specialization of SetValueAt. assert(position < Length()); const int partition = starts->PartitionFromPosition(position); const int startPartition = starts->PositionFromPartition(partition); if (value == T()) { // Setting the empty value is equivalent to deleting the position if (position == 0) { ClearValue(partition); } else if (position == startPartition) { // Currently an element at this position, so remove ClearValue(partition); starts->RemovePartition(partition); values->Delete(partition); } // Else element remains empty } else { if (position == startPartition) { // Already a value at this position, so replace ClearValue(partition); values->SetValueAt(partition, value); } else { // Insert a new element starts->InsertPartition(partition + 1, position); values->InsertValue(partition + 1, 1, value); } } } public: SparseVector() { starts = new Partitioning(8); values = new SplitVector(); values->InsertValue(0, 2, T()); } ~SparseVector() { delete starts; starts = NULL; // starts dead here but not used by ClearValue. for (int part = 0; part < values->Length(); part++) { ClearValue(part); } delete values; values = NULL; } int Length() const { return starts->PositionFromPartition(starts->Partitions()); } int Elements() const { return starts->Partitions(); } int PositionOfElement(int element) const { return starts->PositionFromPartition(element); } T ValueAt(int position) const { assert(position < Length()); const int partition = starts->PartitionFromPosition(position); const int startPartition = starts->PositionFromPartition(partition); if (startPartition == position) { return values->ValueAt(partition); } else { return T(); } } void SetValueAt(int position, T value) { CommonSetValueAt(position, value); } void InsertSpace(int position, int insertLength) { assert(position <= Length()); // Only operation that works at end. const int partition = starts->PartitionFromPosition(position); const int startPartition = starts->PositionFromPartition(partition); if (startPartition == position) { T valueCurrent = values->ValueAt(partition); // Inserting at start of run so make previous longer if (partition == 0) { // Inserting at start of document so ensure 0 if (valueCurrent != T()) { ClearValue(0); starts->InsertPartition(1, 0); values->InsertValue(1, 1, valueCurrent); starts->InsertText(0, insertLength); } else { starts->InsertText(partition, insertLength); } } else { if (valueCurrent != T()) { starts->InsertText(partition - 1, insertLength); } else { // Insert at end of run so do not extend style starts->InsertText(partition, insertLength); } } } else { starts->InsertText(partition, insertLength); } } void DeletePosition(int position) { assert(position < Length()); int partition = starts->PartitionFromPosition(position); const int startPartition = starts->PositionFromPartition(partition); if (startPartition == position) { if (partition == 0) { ClearValue(0); } else if (partition == starts->Partitions()) { // This should not be possible ClearValue(partition); throw std::runtime_error("SparseVector: deleting end partition."); } else { ClearValue(partition); starts->RemovePartition(partition); values->Delete(partition); // Its the previous partition now that gets smaller partition--; } } starts->InsertText(partition, -1); } void Check() const { if (Length() < 0) { throw std::runtime_error("SparseVector: Length can not be negative."); } if (starts->Partitions() < 1) { throw std::runtime_error("SparseVector: Must always have 1 or more partitions."); } if (starts->Partitions() != values->Length() - 1) { throw std::runtime_error("SparseVector: Partitions and values different lengths."); } // The final element can not be set if (values->ValueAt(values->Length() - 1) != T()) { throw std::runtime_error("SparseVector: Unused style at end changed."); } } }; // The specialization for const char * makes copies and deletes them as needed. template<> inline void SparseVector::ClearValue(int partition) { const char *value = values->ValueAt(partition); delete []value; values->SetValueAt(partition, NULL); } template<> inline void SparseVector::SetValueAt(int position, const char *value) { // Make a copy of the string if (value) { const size_t len = strlen(value); char *valueCopy = new char[len + 1](); std::copy(value, value + len, valueCopy); CommonSetValueAt(position, valueCopy); } else { CommonSetValueAt(position, NULL); } } #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/src/SplitVector.h000066400000000000000000000166671316047212700230360ustar00rootroot00000000000000// 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) { // Moving the gap towards start so moving elements towards end std::copy_backward( body + position, body + part1Length, body + gapLength + part1Length); } else { // position > part1Length // Moving the gap towards end so moving elements towards start std::copy( body + part1Length + gapLength, body + gapLength + position, body + 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 < 0) throw std::runtime_error("SplitVector::ReAllocate: negative size."); if (newSize > size) { // Move the gap to the end GapTo(lengthBody); T *newBody = new T[newSize]; if ((size != 0) && (body != 0)) { std::copy(body, body + lengthBody, newBody); 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); std::copy(s + positionFrom, s + positionFrom + insertLength, body + part1Length); 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; } std::copy(body + position, body + position + range1Length, buffer); buffer += range1Length; position = position + range1Length + gapLength; int range2Length = retrieveLength - range1Length; std::copy(body + position, body + position + range2Length, buffer); } 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 sqlitebrowser-3.10.1/libs/qscintilla/src/Style.cpp000066400000000000000000000103411316047212700221720ustar00rootroot00000000000000// 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 #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_); (FontMeasurements &)(*this) = fm_; } sqlitebrowser-3.10.1/libs/qscintilla/src/Style.h000066400000000000000000000042361316047212700216450ustar00rootroot00000000000000// 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, caseCamel}; 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 sqlitebrowser-3.10.1/libs/qscintilla/src/UniConversion.cpp000066400000000000000000000203261316047212700236770ustar00rootroot00000000000000// 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 #include "UniConversion.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif #ifdef SCI_NAMESPACE namespace Scintilla { #endif 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 sqlitebrowser-3.10.1/libs/qscintilla/src/UniConversion.h000066400000000000000000000042411316047212700233420ustar00rootroot00000000000000// 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 }; enum { SURROGATE_TRAIL_FIRST = 0xDC00 }; enum { SURROGATE_TRAIL_LAST = 0xDFFF }; enum { SUPPLEMENTAL_PLANE_FIRST = 0x10000 }; inline unsigned int UTF16CharLength(wchar_t uch) { return ((uch >= SURROGATE_LEAD_FIRST) && (uch <= SURROGATE_LEAD_LAST)) ? 2 : 1; } #ifdef SCI_NAMESPACE } #endif #endif sqlitebrowser-3.10.1/libs/qscintilla/src/UnicodeFromUTF8.h000066400000000000000000000013561316047212700234260ustar00rootroot00000000000000// 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 sqlitebrowser-3.10.1/libs/qscintilla/src/ViewStyle.cpp000066400000000000000000000447601316047212700230410ustar00rootroot00000000000000// 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 #include "Platform.h" #include "Scintilla.h" #include "Position.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::CalculateMarginWidthAndMask() { fixedColumnWidth = marginInside ? leftMarginWidth : 0; maskInLine = 0xffffffff; int maskDefinedMarkers = 0; for (size_t margin = 0; margin < ms.size(); margin++) { fixedColumnWidth += ms[margin].width; if (ms[margin].width > 0) maskInLine &= ~ms[margin].mask; maskDefinedMarkers |= ms[margin].mask; } maskDrawInText = 0; for (int markBit = 0; markBit < 32; markBit++) { const int maskBit = 1 << markBit; switch (markers[markBit].markType) { case SC_MARK_EMPTY: maskInLine &= ~maskBit; break; case SC_MARK_BACKGROUND: case SC_MARK_UNDERLINE: maskInLine &= ~maskBit; maskDrawInText |= maskDefinedMarkers & maskBit; break; } } } 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; 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.resize(SC_MAX_MARGIN + 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; CalculateMarginWidthAndMask(); textStart = marginInside ? fixedColumnWidth : leftMarginWidth; zoomLevel = 0; viewWhitespace = wsInvisible; tabDrawMode = tdLongArrow; 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; edgeState = EDGE_NONE; theEdge = EdgeProperties(0, ColourDesired(0xc0, 0xc0, 0xc0)); 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)); } CalculateMarginWidthAndMask(); 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; i= x) && (pt.x < x + ms[i].width)) margin = static_cast(i); x += ms[i].width; } return margin; } bool ViewStyle::ValidStyle(size_t styleIndex) const { return styleIndex < styles.size(); } void ViewStyle::CalcLargestMarkerHeight() { largestMarkerHeight = 0; for (int m = 0; m <= MARKER_MAX; ++m) { switch (markers[m].markType) { case SC_MARK_PIXMAP: if (markers[m].pxpm && markers[m].pxpm->GetHeight() > 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].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); } bool ViewStyle::WhiteSpaceVisible(bool inIndent) const { return (!inIndent && viewWhitespace == wsVisibleAfterIndent) || (inIndent && viewWhitespace == wsVisibleOnlyInIndent) || viewWhitespace == wsVisibleAlways; } 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; } } sqlitebrowser-3.10.1/libs/qscintilla/src/ViewStyle.h000066400000000000000000000143351316047212700225010ustar00rootroot00000000000000// 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; ColourDesired back; 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, wsVisibleOnlyInIndent=3}; enum TabDrawMode {tdLongArrow=0, tdStrikeOut=1}; 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; }; struct EdgeProperties { int column; ColourDesired colour; EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) : column(column_), colour(colour_) { } EdgeProperties(uptr_t wParam, sptr_t lParam) : column(static_cast(wParam)), colour(static_cast(lParam)) { } }; /** */ class ViewStyle { FontNames fontNames; FontMap fonts; public: std::vector