├── .github └── workflows │ ├── Linux.yml │ ├── MacOS.yml │ └── Windows.yml ├── QuickScintilla.pro ├── QuickScintillaDemoApp ├── QuickScintillaDemoApp.pro ├── QuickScintillaDemoApp5.pro ├── SimpleScrollBar.qml ├── app.qml ├── app5.qml ├── applicationdata.cpp ├── applicationdata.h ├── main.cpp └── quickscintillademoapp.qrc ├── README.md └── scintilla ├── CONTRIBUTING ├── License.txt ├── README ├── bin ├── __init__.py └── empty.txt ├── call └── ScintillaCall.cxx ├── cocoa ├── InfoBar.h ├── InfoBar.mm ├── InfoBarCommunicator.h ├── PlatCocoa.h ├── PlatCocoa.mm ├── QuartzTextLayout.h ├── QuartzTextStyle.h ├── QuartzTextStyleAttribute.h ├── Scintilla │ ├── Info.plist │ ├── Scintilla.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── module.modulemap ├── ScintillaCocoa.h ├── ScintillaCocoa.mm ├── ScintillaFramework │ └── Scintilla_Prefix.pch ├── ScintillaTest │ ├── AppController.h │ ├── AppController.mm │ ├── Info.plist │ ├── Scintilla-Info.plist │ ├── ScintillaTest.xcodeproj │ │ ├── project.pbxproj │ │ └── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── TestData.sql │ ├── en.lproj │ │ ├── InfoPlist.strings │ │ └── MainMenu.xib │ └── main.m ├── ScintillaView.h ├── ScintillaView.mm ├── checkbuildosx.sh └── res │ ├── info_bar_bg.png │ ├── info_bar_bg@2x.png │ ├── mac_cursor_busy.png │ ├── mac_cursor_busy@2x.png │ ├── mac_cursor_flipped.png │ └── mac_cursor_flipped@2x.png ├── cppcheck.suppress ├── delbin.bat ├── doc ├── AddSource.txt ├── Design.html ├── Icons.html ├── Indicators.png ├── Lexer.txt ├── Markers.png ├── Privacy.html ├── SciBreak.jpg ├── SciCoding.html ├── SciRest.jpg ├── SciTEIco.png ├── SciWord.jpg ├── Scintilla5Migration.html ├── ScintillaDoc.html ├── ScintillaDownload.html ├── ScintillaHistory.html ├── ScintillaRelated.html ├── ScintillaToDo.html ├── ScintillaUsage.html ├── StadiumVariants.png ├── Steps.html ├── StyleMetadata.html ├── annotations.png ├── eolannotation.png ├── index.html └── styledmargin.png ├── gtk ├── Converter.h ├── DepGen.py ├── PlatGTK.cxx ├── ScintillaGTK.cxx ├── ScintillaGTK.h ├── ScintillaGTKAccessible.cxx ├── ScintillaGTKAccessible.h ├── Wrappers.h ├── deps.mak ├── makefile ├── scintilla-marshal.c ├── scintilla-marshal.h └── scintilla-marshal.list ├── include ├── ILexer.h ├── ILoader.h ├── Sci_Position.h ├── Scintilla.h ├── Scintilla.iface ├── ScintillaCall.h ├── ScintillaMessages.h ├── ScintillaStructures.h ├── ScintillaTypes.h └── ScintillaWidget.h ├── qt ├── README ├── ScintillaEdit │ ├── ScintillaDocument.cpp │ ├── ScintillaDocument.h │ ├── ScintillaEdit.cpp.template │ ├── ScintillaEdit.h.template │ ├── ScintillaEdit.pro │ └── WidgetGen.py └── ScintillaEditBase │ ├── Notes.txt │ ├── PlatQt.cpp │ ├── PlatQt.h │ ├── ScintillaEditBase.cpp │ ├── ScintillaEditBase.h │ ├── ScintillaEditBase.pro │ ├── ScintillaQt.cpp │ └── ScintillaQt.h ├── scripts ├── CheckMentioned.py ├── Dependencies.py ├── Face.py ├── FileGenerator.py ├── GenerateCaseConvert.py ├── GenerateCharacterCategory.py ├── HFacer.py ├── HeaderCheck.py ├── HeaderOrder.txt ├── LexGen.py ├── ScintillaAPIFacer.py ├── ScintillaData.py ├── __init__.py └── archive.sh ├── src ├── AutoComplete.cxx ├── AutoComplete.h ├── CallTip.cxx ├── CallTip.h ├── CaseConvert.cxx ├── CaseConvert.h ├── CaseFolder.cxx ├── CaseFolder.h ├── CellBuffer.cxx ├── CellBuffer.h ├── ChangeHistory.cxx ├── ChangeHistory.h ├── CharClassify.cxx ├── CharClassify.h ├── CharacterCategoryMap.cxx ├── CharacterCategoryMap.h ├── CharacterType.cxx ├── CharacterType.h ├── ContractionState.cxx ├── ContractionState.h ├── DBCS.cxx ├── DBCS.h ├── Debugging.h ├── Decoration.cxx ├── Decoration.h ├── Document.cxx ├── Document.h ├── EditModel.cxx ├── EditModel.h ├── EditView.cxx ├── EditView.h ├── Editor.cxx ├── Editor.h ├── ElapsedPeriod.h ├── Geometry.cxx ├── Geometry.h ├── Indicator.cxx ├── Indicator.h ├── KeyMap.cxx ├── KeyMap.h ├── LineMarker.cxx ├── LineMarker.h ├── MarginView.cxx ├── MarginView.h ├── Partitioning.h ├── PerLine.cxx ├── PerLine.h ├── Platform.h ├── Position.h ├── PositionCache.cxx ├── PositionCache.h ├── RESearch.cxx ├── RESearch.h ├── RunStyles.cxx ├── RunStyles.h ├── SciTE.properties ├── ScintillaBase.cxx ├── ScintillaBase.h ├── Selection.cxx ├── Selection.h ├── SparseVector.h ├── SplitVector.h ├── Style.cxx ├── Style.h ├── UniConversion.cxx ├── UniConversion.h ├── UniqueString.cxx ├── UniqueString.h ├── ViewStyle.cxx ├── ViewStyle.h ├── XPM.cxx └── XPM.h ├── test ├── MessageNumbers.py ├── README ├── ScintillaCallable.py ├── XiteMenu.py ├── XiteWin.py ├── gi │ ├── Scintilla-0.1.gir.good │ ├── filter-scintilla-h.py │ ├── gi-test.py │ └── makefile ├── performanceTests.py ├── simpleTests.py ├── unit │ ├── LICENSE_1_0.txt │ ├── README │ ├── Sci.natvis │ ├── SciTE.properties │ ├── UnitTester.cxx │ ├── UnitTester.vcxproj │ ├── catch.hpp │ ├── makefile │ ├── test.mak │ ├── testCellBuffer.cxx │ ├── testCharClassify.cxx │ ├── testCharacterCategoryMap.cxx │ ├── testContractionState.cxx │ ├── testDecoration.cxx │ ├── testDocument.cxx │ ├── testGeometry.cxx │ ├── testPartitioning.cxx │ ├── testPerLine.cxx │ ├── testRESearch.cxx │ ├── testRunStyles.cxx │ ├── testSparseVector.cxx │ ├── testSplitVector.cxx │ ├── testUniConversion.cxx │ └── unitTest.cxx ├── win32Tests.py └── xite.py ├── tgzsrc ├── version.txt ├── win32 ├── DepGen.py ├── HanjaDic.cxx ├── HanjaDic.h ├── PlatWin.cxx ├── PlatWin.h ├── SciLexer.vcxproj ├── SciTE.properties ├── ScintRes.rc ├── Scintilla.def ├── Scintilla.vcxproj ├── ScintillaDLL.cxx ├── ScintillaWin.cxx ├── ScintillaWin.h ├── WinTypes.h ├── deps.mak ├── makefile ├── nmdeps.mak └── scintilla.mak └── zipsrc.bat /QuickScintilla.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = subdirs 2 | 3 | SUBDIRS = scintilla/qt/ScintillaEditBase QuickScintillaDemoApp 4 | 5 | QuickScintillaDemoApp.depends = scintilla/qt/ScintillaEditBase 6 | -------------------------------------------------------------------------------- /QuickScintillaDemoApp/QuickScintillaDemoApp.pro: -------------------------------------------------------------------------------- 1 | QT += quick quickcontrols2 widgets printsupport 2 | greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat 3 | 4 | CONFIG += c++1z 5 | 6 | HEADERS += applicationdata.h 7 | #../scintilla/lexilla/src/Lexilla.h 8 | SOURCES += applicationdata.cpp\ 9 | main.cpp 10 | #../scintilla/lexilla/src/Lexilla.cxx\ 11 | 12 | ARCH_PATH = x86 13 | 14 | android { 15 | # message("hello android !") 16 | 17 | equals(ANDROID_TARGET_ARCH, arm64-v8a) { 18 | ARCH_PATH = arm64 19 | } 20 | equals(ANDROID_TARGET_ARCH, armeabi-v7a) { 21 | ARCH_PATH = arm 22 | } 23 | equals(ANDROID_TARGET_ARCH, armeabi) { 24 | ARCH_PATH = arm 25 | } 26 | equals(ANDROID_TARGET_ARCH, x86) { 27 | ARCH_PATH = x86 28 | } 29 | equals(ANDROID_TARGET_ARCH, x86_64) { 30 | ARCH_PATH = x64 31 | } 32 | equals(ANDROID_TARGET_ARCH, mips) { 33 | ARCH_PATH = mips 34 | } 35 | equals(ANDROID_TARGET_ARCH, mips64) { 36 | ARCH_PATH = mips64 37 | } 38 | } 39 | 40 | INCLUDEPATH += ../scintilla/qt/ScintillaEdit ../scintilla/qt/ScintillaEditBase ../scintilla/include ../scintilla/lexilla/src ../scintilla/lexlib ../scintilla/src 41 | 42 | LIBS += -L$$OUT_PWD/../scintilla/bin-$${ARCH_PATH}/ -lScintillaEditBase 43 | 44 | RESOURCES += quickscintillademoapp.qrc 45 | 46 | #DESTPATH = $$[QT_INSTALL_EXAMPLES]/qml/tutorials/extending-qml/chapter1-basics 47 | #target.path = $$DESTPATH 48 | 49 | #qml.files = *.qml 50 | #qml.path = $$DESTPATH 51 | 52 | #INSTALLS += target qml 53 | 54 | DISTFILES += \ 55 | android/AndroidManifest.xml \ 56 | android/build.gradle \ 57 | android/gradle/wrapper/gradle-wrapper.jar \ 58 | android/gradle/wrapper/gradle-wrapper.properties \ 59 | android/gradlew \ 60 | android/gradlew.bat \ 61 | android/res/values/libs.xml 62 | 63 | ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android 64 | 65 | ANDROID_ABIS = arm64-v8a 66 | -------------------------------------------------------------------------------- /QuickScintillaDemoApp/QuickScintillaDemoApp5.pro: -------------------------------------------------------------------------------- 1 | QT += quick quickcontrols2 widgets printsupport 2 | 3 | CONFIG += c++1z 4 | 5 | HEADERS += applicationdata.h 6 | #../scintilla/lexilla/src/Lexilla.h 7 | SOURCES += applicationdata.cpp\ 8 | #../scintilla/lexilla/src/Lexilla.cxx\ 9 | main.cpp 10 | 11 | ARCH_PATH = x86 12 | 13 | android { 14 | # message("hello android !") 15 | 16 | equals(ANDROID_TARGET_ARCH, arm64-v8a) { 17 | ARCH_PATH = arm64 18 | } 19 | equals(ANDROID_TARGET_ARCH, armeabi-v7a) { 20 | ARCH_PATH = arm 21 | } 22 | equals(ANDROID_TARGET_ARCH, armeabi) { 23 | ARCH_PATH = arm 24 | } 25 | equals(ANDROID_TARGET_ARCH, x86) { 26 | ARCH_PATH = x86 27 | } 28 | equals(ANDROID_TARGET_ARCH, x86_64) { 29 | ARCH_PATH = x64 30 | } 31 | equals(ANDROID_TARGET_ARCH, mips) { 32 | ARCH_PATH = mips 33 | } 34 | equals(ANDROID_TARGET_ARCH, mips64) { 35 | ARCH_PATH = mips64 36 | } 37 | } 38 | 39 | INCLUDEPATH += ../scintilla/qt/ScintillaEdit ../scintilla/qt/ScintillaEditBase ../scintilla/include ../scintilla/lexilla/src ../scintilla/lexlib ../scintilla/src 40 | 41 | LIBS += -L$$OUT_PWD/../scintilla/bin-$${ARCH_PATH}/ -lScintillaEditBase 42 | #LIBS += ../scintilla/bin-$${ARCH_PATH}/ScintillaEditBase.lib 43 | #LIBS += ../scintilla/bin/libScintillaEditBase.a 44 | 45 | RESOURCES += quickscintillademoapp.qrc 46 | 47 | #DESTPATH = $$[QT_INSTALL_EXAMPLES]/qml/tutorials/extending-qml/chapter1-basics 48 | #target.path = $$DESTPATH 49 | 50 | #qml.files = *.qml 51 | #qml.path = $$DESTPATH 52 | 53 | #INSTALLS += target qml 54 | 55 | DISTFILES += \ 56 | android/AndroidManifest.xml \ 57 | android/build.gradle \ 58 | android/gradle/wrapper/gradle-wrapper.jar \ 59 | android/gradle/wrapper/gradle-wrapper.properties \ 60 | android/gradlew \ 61 | android/gradlew.bat \ 62 | android/res/values/libs.xml 63 | 64 | ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android 65 | -------------------------------------------------------------------------------- /QuickScintillaDemoApp/SimpleScrollBar.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2017 The Qt Company Ltd. 4 | ** Contact: https://www.qt.io/licensing/ 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** Commercial License Usage 10 | ** Licensees holding valid commercial Qt licenses may use this file in 11 | ** accordance with the commercial license agreement provided with the 12 | ** Software or, alternatively, in accordance with the terms contained in 13 | ** a written agreement between you and The Qt Company. For licensing terms 14 | ** and conditions see https://www.qt.io/terms-conditions. For further 15 | ** information use the contact form at https://www.qt.io/contact-us. 16 | ** 17 | ** BSD License Usage 18 | ** Alternatively, you may use this file under the terms of the BSD license 19 | ** as follows: 20 | ** 21 | ** "Redistribution and use in source and binary forms, with or without 22 | ** modification, are permitted provided that the following conditions are 23 | ** met: 24 | ** * Redistributions of source code must retain the above copyright 25 | ** notice, this list of conditions and the following disclaimer. 26 | ** * Redistributions in binary form must reproduce the above copyright 27 | ** notice, this list of conditions and the following disclaimer in 28 | ** the documentation and/or other materials provided with the 29 | ** distribution. 30 | ** * Neither the name of The Qt Company Ltd nor the names of its 31 | ** contributors may be used to endorse or promote products derived 32 | ** from this software without specific prior written permission. 33 | ** 34 | ** 35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 46 | ** 47 | ** $QT_END_LICENSE$ 48 | ** 49 | ****************************************************************************/ 50 | 51 | import QtQuick 2.0 52 | 53 | Item { 54 | id: scrollBar 55 | 56 | // The properties that define the scrollbar's state. 57 | // position and pageSize are in the range 0.0 - 1.0. They are relative to the 58 | // height of the page, i.e. a pageSize of 0.5 means that you can see 50% 59 | // of the height of the view. 60 | // orientation can be either Qt.Vertical or Qt.Horizontal 61 | property real position 62 | property real pageSize 63 | property variant orientation : Qt.Vertical 64 | 65 | // A light, semi-transparent background 66 | Rectangle { 67 | id: background 68 | anchors.fill: parent 69 | radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) 70 | color: "green" 71 | opacity: 0.3 72 | } 73 | 74 | // Size the bar to the required size, depending upon the orientation. 75 | Rectangle { 76 | x: orientation == Qt.Vertical ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) 77 | y: orientation == Qt.Vertical ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 78 | width: orientation == Qt.Vertical ? (parent.width-4) : (scrollBar.pageSize * (scrollBar.width-4)) 79 | height: orientation == Qt.Vertical ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) 80 | radius: orientation == Qt.Vertical ? (width/2 - 1) : (height/2 - 1) 81 | color: "black" 82 | opacity: 0.7 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /QuickScintillaDemoApp/applicationdata.cpp: -------------------------------------------------------------------------------- 1 | #include "applicationdata.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | ApplicationData::ApplicationData(QObject *parent) 11 | : QObject(parent) 12 | { 13 | } 14 | 15 | ApplicationData::~ApplicationData() 16 | { 17 | } 18 | 19 | bool IsAndroidStorageFileUrl(const QString & url) 20 | { 21 | return url.startsWith("content:/"); 22 | } 23 | 24 | QString GetTranslatedFileName(const QString & fileName) 25 | { 26 | QString translatedFileName = fileName; 27 | if( IsAndroidStorageFileUrl(fileName) ) 28 | { 29 | // handle android storage urls --> forward content://... to QFile directly 30 | translatedFileName = fileName; 31 | } 32 | else 33 | { 34 | QUrl url(fileName); 35 | if(url.isValid() && url.isLocalFile()) 36 | { 37 | translatedFileName = url.toLocalFile(); 38 | } 39 | } 40 | return translatedFileName; 41 | } 42 | 43 | QString ApplicationData::readFileContent(const QString & fileName) const 44 | { 45 | QString translatedFileName = GetTranslatedFileName(fileName); 46 | 47 | QFile file(translatedFileName); 48 | 49 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) 50 | { 51 | return QString(tr("Error reading ") + fileName); 52 | } 53 | 54 | QTextStream stream(&file); 55 | auto text = stream.readAll(); 56 | 57 | file.close(); 58 | 59 | return text; 60 | } 61 | 62 | bool ApplicationData::writeFileContent(const QString & fileName, const QString & content) 63 | { 64 | QString translatedFileName = GetTranslatedFileName(fileName); 65 | 66 | QFile file(translatedFileName); 67 | 68 | if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) 69 | { 70 | return false; 71 | } 72 | 73 | QTextStream stream(&file); 74 | stream << content; 75 | 76 | file.close(); 77 | 78 | return true; 79 | } 80 | 81 | bool ApplicationData::deleteFile(const QString & fileName) 82 | { 83 | QFile aDir(fileName); 84 | bool ok = aDir.remove(); 85 | return ok; 86 | } 87 | 88 | QString ApplicationData::readLog() const 89 | { 90 | return readFileContent(LOG_NAME); 91 | } 92 | -------------------------------------------------------------------------------- /QuickScintillaDemoApp/applicationdata.h: -------------------------------------------------------------------------------- 1 | #ifndef APPLICATIONDATA_H 2 | #define APPLICATIONDATA_H 3 | 4 | #include 5 | 6 | #ifdef Q_OS_WIN 7 | #define LOG_NAME "c:\\tmp\\mgv_quick_qdebug.log" 8 | #else 9 | //#define LOG_NAME "/sdcard/Texte/mgv_quick_qdebug.log" 10 | #define LOG_NAME "mgv_quick_qdebug.log" 11 | #endif 12 | 13 | // ************************************************************************** 14 | 15 | class ApplicationData : public QObject 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit ApplicationData(QObject *parent); 21 | ~ApplicationData(); 22 | 23 | Q_INVOKABLE QString readFileContent(const QString & fileName) const; 24 | Q_INVOKABLE bool writeFileContent(const QString & fileName, const QString & content); 25 | 26 | Q_INVOKABLE bool deleteFile(const QString & fileName); 27 | 28 | Q_INVOKABLE QString readLog() const; 29 | }; 30 | 31 | #endif // APPLICATIONDATA_H 32 | -------------------------------------------------------------------------------- /QuickScintillaDemoApp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "ScintillaEditBase.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include "applicationdata.h" 10 | 11 | #ifdef Q_OS_ANDROID 12 | #define _WITH_QDEBUG_REDIRECT 13 | #define _WITH_ADD_TO_LOG 14 | #endif 15 | 16 | #include 17 | 18 | static qint64 g_iLastTimeStamp = 0; 19 | 20 | void AddToLog(const QString & msg) 21 | { 22 | #ifdef _WITH_ADD_TO_LOG 23 | QString sFileName(LOG_NAME); 24 | //if( !QDir("/sdcard/Texte").exists() ) 25 | //{ 26 | // sFileName = "mgv_quick_qdebug.log"; 27 | //} 28 | QFile outFile(sFileName); 29 | outFile.open(QIODevice::WriteOnly | QIODevice::Append); 30 | QTextStream ts(&outFile); 31 | qint64 now = QDateTime::currentMSecsSinceEpoch(); 32 | qint64 delta = now - g_iLastTimeStamp; 33 | g_iLastTimeStamp = now; 34 | ts << delta << " "; 35 | ts << msg << endl; 36 | qDebug() << delta << " " << msg << endl; 37 | outFile.flush(); 38 | #else 39 | Q_UNUSED(msg) 40 | #endif 41 | } 42 | 43 | #ifdef _WITH_QDEBUG_REDIRECT 44 | #include 45 | void PrivateMessageHandler(QtMsgType type, const QMessageLogContext & context, const QString & msg) 46 | { 47 | QString txt; 48 | switch (type) { 49 | case QtDebugMsg: 50 | txt = QString("Debug: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function); 51 | break; 52 | case QtWarningMsg: 53 | txt = QString("Warning: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function); 54 | break; 55 | case QtCriticalMsg: 56 | txt = QString("Critical: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function); 57 | break; 58 | case QtFatalMsg: 59 | txt = QString("Fatal: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function); 60 | break; 61 | case QtInfoMsg: 62 | txt = QString("Info: %1 (%2:%3, %4)").arg(msg).arg(context.file).arg(context.line).arg(context.function); 63 | break; 64 | } 65 | AddToLog(txt); 66 | } 67 | #endif 68 | 69 | //#include "ILexer.h" 70 | #include "Scintilla.h" 71 | //#include "SciLexer.h" 72 | //#include "Lexilla.h" 73 | 74 | #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) 75 | #define URL_FOR_QML "qrc:/app5.qml" 76 | #else 77 | #define URL_FOR_QML "qrc:/app.qml" 78 | #endif 79 | 80 | int main(int argc, char *argv[]) 81 | { 82 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 83 | 84 | //TODO Scintilla_LinkLexers(); 85 | //LexillaSetDefault([](const char *name) { 86 | // return CreateLexer(name); 87 | //}); 88 | 89 | // auto pLexer = CreateLexer("cpp"); 90 | 91 | #ifdef _WITH_QDEBUG_REDIRECT 92 | qInstallMessageHandler(PrivateMessageHandler); 93 | #endif 94 | 95 | AddToLog("Start QuickScintilla !!!"); 96 | 97 | QGuiApplication app(argc, argv); 98 | app.setOrganizationName("scintilla.org"); 99 | app.setOrganizationDomain("scintilla.org"); 100 | app.setApplicationName("QuickScintillaDemoApp"); 101 | 102 | ApplicationData data(0); 103 | 104 | qRegisterMetaType("SCNotification"); 105 | qmlRegisterType("Scintilla", 1, 0, "ScintillaEditBase"); 106 | 107 | QQmlApplicationEngine engine; 108 | const QUrl url(QStringLiteral(URL_FOR_QML)); 109 | QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, 110 | &app, [url](QObject *obj, const QUrl &objUrl) { 111 | if (!obj && url == objUrl) 112 | QCoreApplication::exit(-1); 113 | }, Qt::QueuedConnection); 114 | 115 | engine.rootContext()->setContextProperty("applicationData", &data); 116 | engine.load(url); 117 | 118 | return app.exec(); 119 | } 120 | -------------------------------------------------------------------------------- /QuickScintillaDemoApp/quickscintillademoapp.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | app.qml 4 | SimpleScrollBar.qml 5 | app5.qml 6 | 7 | 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # QuickScintilla 2 | 3 | A port of the [scintilla editor control](https://www.scintilla.org/) to the Qt QML/Quick platform, which is optimized for touch devices. Currently Qt Version 5 and 6 are supported. 4 | 5 | Build status: 6 | 7 | [![Linux CI](https://github.com/mneuroth/QuickScintilla/workflows/Linux%20CI/badge.svg)](https://github.com/mneuroth/QuickScintilla/actions) 8 | [![Windows CI](https://github.com/mneuroth/QuickScintilla/workflows/Windows%20CI/badge.svg)](https://github.com/mneuroth/QuickScintilla/actions) 9 | [![MacOS CI](https://github.com/mneuroth/QuickScintilla/workflows/MacOS%20CI/badge.svg)](https://github.com/mneuroth/QuickScintilla/actions) 10 | -------------------------------------------------------------------------------- /scintilla/CONTRIBUTING: -------------------------------------------------------------------------------- 1 | Fixes should be posted to the Bug Tracker 2 | http://sourceforge.net/p/scintilla/bugs/ 3 | 4 | Features should be posted to the Feature Request Tracker 5 | http://sourceforge.net/p/scintilla/feature-requests/ 6 | 7 | Either send unified diffs (or patch files) or zip archives with whole files. 8 | Mercurial patch files are best as they include author information and commit 9 | messages. 10 | 11 | Questions should go to the scintilla-interest mailing list 12 | https://groups.google.com/forum/#!forum/scintilla-interest 13 | 14 | Code should follow the guidelines at 15 | http://www.scintilla.org/SciCoding.html 16 | 17 | Do not use SourceForge's Merge Request mechanism or message sending 18 | feature as no one is monitoring these. 19 | The neilh @ scintilla.org account receives much spam and is only checked 20 | occasionally. Almost all Scintilla mail should go to the mailing list. -------------------------------------------------------------------------------- /scintilla/License.txt: -------------------------------------------------------------------------------- 1 | License for Lexilla, Scintilla, and SciTE 2 | 3 | Copyright 1998-2021 by Neil Hodgson 4 | 5 | All Rights Reserved 6 | 7 | Permission to use, copy, modify, and distribute this software and its 8 | documentation for any purpose and without fee is hereby granted, 9 | provided that the above copyright notice appear in all copies and that 10 | both that copyright notice and this permission notice appear in 11 | supporting documentation. 12 | 13 | NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS 14 | SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 15 | AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY 16 | SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 | WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 18 | WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 19 | TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE 20 | OR PERFORMANCE OF THIS SOFTWARE. -------------------------------------------------------------------------------- /scintilla/README: -------------------------------------------------------------------------------- 1 | README for building of Scintilla, Lexilla, and SciTE 2 | 3 | Scintilla and Lexilla can be built by themselves. 4 | To build SciTE, Scintilla and Lexilla should first be built. 5 | 6 | See lexilla/README for information on building Lexilla. 7 | 8 | *** GTK+/Linux version *** 9 | 10 | You must first have GTK+ 2.24 or later and GCC (7.1 or better) installed. 11 | Clang may be used by adding CLANG=1 to the make command line. 12 | Other C++ compilers may work but may require tweaking the make file. 13 | Either GTK+ 2.x or 3.x may be used with 2.x the default and 3.x 14 | chosen with the make argument GTK3=1. 15 | 16 | To build Scintilla, use the makefile located in the scintilla/gtk directory 17 | cd scintilla/gtk 18 | make 19 | cd ../.. 20 | 21 | To build and install SciTE, use the makefile located in the scite/gtk directory 22 | cd scite/gtk 23 | make 24 | sudo make install 25 | 26 | This installs SciTE into $prefix/bin. The value of $prefix is determined from 27 | the location of Gnome if it is installed. This is usually /usr if installed 28 | with Linux or /usr/local if built from source. If Gnome is not installed 29 | /usr/bin is used as the prefix. The prefix can be overridden on the command 30 | line like "make prefix=/opt" but the same value should be used for both make 31 | and make install as this location is compiled into the executable. The global 32 | properties file is installed at $prefix/share/scite/SciTEGlobal.properties. 33 | The language specific properties files are also installed into this directory. 34 | 35 | To remove SciTE 36 | sudo make uninstall 37 | 38 | To clean the object files which may be needed to change $prefix 39 | make clean 40 | 41 | The current make file supports static and dynamic linking between SciTE, Scintilla, and Lexilla. 42 | 43 | 44 | *** Windows version *** 45 | 46 | A C++ 17 compiler is required. 47 | Visual Studio 2019 is the development system used for most development 48 | although Mingw-w64 9.2 is also supported. 49 | 50 | To build Scintilla, make in the scintilla/win32 directory 51 | cd scintilla\win32 52 | GCC: mingw32-make 53 | Visual C++: nmake -f scintilla.mak 54 | cd ..\.. 55 | 56 | To build SciTE, use the makefiles located in the scite/win32 directory 57 | cd scite\win32 58 | GCC: mingw32-make 59 | Visual C++: nmake -f scite.mak 60 | 61 | An executable SciTE will now be in scite/bin. 62 | 63 | *** GTK+/Windows version *** 64 | 65 | Mingw-w64 is known to work. Other compilers will probably not work. 66 | 67 | Only Scintilla will build with GTK+ on Windows. SciTE will not work. 68 | 69 | Make builds both a static library version of Scintilla with lexers (scintilla.a) and 70 | a shared library without lexers (libscintilla.so or or libscintilla.dll). 71 | 72 | To build Scintilla, make in the scintilla/gtk directory 73 | cd scintilla\gtk 74 | mingw32-make 75 | 76 | *** macOS Cocoa version *** 77 | 78 | Xcode 9.2 or later may be used to build Scintilla on macOS. 79 | 80 | There is no open source version of SciTE for macOS but there is a commercial 81 | version available through the App Store. 82 | 83 | To build Scintilla, run xcodebuild in the scintilla/cocoa/ScintillaFramework or 84 | scintilla/cocoa/Scintilla directory 85 | 86 | cd cocoa/Scintilla 87 | 88 | xcodebuild 89 | 90 | *** Qt version *** 91 | 92 | See the qt/README file to build Scintilla with Qt. 93 | -------------------------------------------------------------------------------- /scintilla/bin/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /scintilla/bin/empty.txt: -------------------------------------------------------------------------------- 1 | This empty files ensures that the directory is created. -------------------------------------------------------------------------------- /scintilla/cocoa/InfoBar.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Scintilla source code edit control 4 | * @file InfoBar.h - Implements special info bar with zoom info, caret position etc. to be used with 5 | * ScintillaView. 6 | * 7 | * Mike Lischke 8 | * 9 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 10 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 11 | */ 12 | 13 | #import 14 | #import "InfoBarCommunicator.h" 15 | 16 | /** 17 | * Extended text cell for vertically aligned text. 18 | */ 19 | @interface VerticallyCenteredTextFieldCell : NSTextFieldCell { 20 | BOOL mIsEditingOrSelecting; 21 | } 22 | 23 | @end 24 | 25 | @interface InfoBar : NSView { 26 | @private 27 | NSImage *mBackground; 28 | IBDisplay mDisplayMask; 29 | 30 | float mScaleFactor; 31 | NSPopUpButton *mZoomPopup; 32 | 33 | int mCurrentCaretX; 34 | int mCurrentCaretY; 35 | NSTextField *mCaretPositionLabel; 36 | NSTextField *mStatusTextLabel; 37 | 38 | id mCallback; 39 | } 40 | 41 | - (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location 42 | value: (float) value; 43 | - (void) setCallback: (id ) callback; 44 | 45 | - (void) createItems; 46 | - (void) positionSubViews; 47 | - (void) setDisplay: (IBDisplay) display; 48 | - (void) zoomItemAction: (id) sender; 49 | - (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag; 50 | - (void) setCaretPosition: (NSPoint) position; 51 | - (void) sizeToFit; 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /scintilla/cocoa/InfoBarCommunicator.h: -------------------------------------------------------------------------------- 1 | /* 2 | * InfoBarCommunicator.h - Definitions of a communication protocol and other data types used for 3 | * the info bar implementation. 4 | * 5 | * Mike Lischke 6 | * 7 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 8 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 9 | */ 10 | 11 | typedef NS_OPTIONS(NSUInteger, IBDisplay) { 12 | IBShowZoom = 0x01, 13 | IBShowCaretPosition = 0x02, 14 | IBShowStatusText = 0x04, 15 | IBShowAll = 0xFF 16 | }; 17 | 18 | /** 19 | * The info bar communicator protocol is used for communication between ScintillaView and its 20 | * information bar component. Using this protocol decouples any potential info target from the main 21 | * ScintillaView implementation. The protocol is used two-way. 22 | */ 23 | 24 | typedef NS_ENUM(NSInteger, NotificationType) { 25 | IBNZoomChanged, // The user selected another zoom value. 26 | IBNCaretChanged, // The caret in the editor changed. 27 | IBNStatusChanged, // The application set a new status message. 28 | }; 29 | 30 | @protocol InfoBarCommunicator 31 | - (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location 32 | value: (float) value; 33 | - (void) setCallback: (id ) callback; 34 | @end 35 | 36 | -------------------------------------------------------------------------------- /scintilla/cocoa/QuartzTextLayout.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QuartzTextLayout.h 3 | * 4 | * Original Code by Evan Jones on Wed Oct 02 2002. 5 | * Contributors: 6 | * Shane Caraveo, ActiveState 7 | * Bernd Paradies, Adobe 8 | * 9 | */ 10 | 11 | #ifndef QUARTZTEXTLAYOUT_H 12 | #define QUARTZTEXTLAYOUT_H 13 | 14 | #include 15 | 16 | #include "QuartzTextStyle.h" 17 | 18 | 19 | class QuartzTextLayout { 20 | public: 21 | /** Create a text layout for drawing. */ 22 | QuartzTextLayout(std::string_view sv, CFStringEncoding encoding, const QuartzTextStyle *r) { 23 | encodingUsed = encoding; 24 | const UInt8 *puiBuffer = reinterpret_cast(sv.data()); 25 | CFStringRef str = CFStringCreateWithBytes(NULL, puiBuffer, sv.length(), encodingUsed, false); 26 | if (!str) { 27 | // Failed to decode bytes into string with given encoding so try 28 | // MacRoman which should accept any byte. 29 | encodingUsed = kCFStringEncodingMacRoman; 30 | str = CFStringCreateWithBytes(NULL, puiBuffer, sv.length(), encodingUsed, false); 31 | } 32 | if (!str) { 33 | return; 34 | } 35 | 36 | stringLength = CFStringGetLength(str); 37 | 38 | CFMutableDictionaryRef stringAttribs = r->getCTStyle(); 39 | 40 | mString = ::CFAttributedStringCreate(NULL, str, stringAttribs); 41 | 42 | mLine = ::CTLineCreateWithAttributedString(mString); 43 | 44 | CFRelease(str); 45 | } 46 | 47 | ~QuartzTextLayout() { 48 | if (mString) { 49 | CFRelease(mString); 50 | mString = NULL; 51 | } 52 | if (mLine) { 53 | CFRelease(mLine); 54 | mLine = NULL; 55 | } 56 | } 57 | 58 | /** Draw the text layout into a CGContext at the specified position. 59 | * @param gc The CGContext in which to draw the text. 60 | * @param x The x axis position to draw the baseline in the current CGContext. 61 | * @param y The y axis position to draw the baseline in the current CGContext. */ 62 | void draw(CGContextRef gc, double x, double y) { 63 | if (!mLine) 64 | return; 65 | 66 | ::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0)); 67 | 68 | // Set the text drawing position. 69 | ::CGContextSetTextPosition(gc, x, y); 70 | 71 | // And finally, draw! 72 | ::CTLineDraw(mLine, gc); 73 | } 74 | 75 | float MeasureStringWidth() { 76 | if (mLine == NULL) 77 | return 0.0f; 78 | 79 | return static_cast(::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL)); 80 | } 81 | 82 | CTLineRef getCTLine() { 83 | return mLine; 84 | } 85 | 86 | CFIndex getStringLength() { 87 | return stringLength; 88 | } 89 | 90 | CFStringEncoding getEncoding() { 91 | return encodingUsed; 92 | } 93 | 94 | private: 95 | CFAttributedStringRef mString = NULL; 96 | CTLineRef mLine = NULL; 97 | CFIndex stringLength = 0; 98 | CFStringEncoding encodingUsed = kCFStringEncodingMacRoman; 99 | }; 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /scintilla/cocoa/QuartzTextStyle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * QuartzTextStyle.h 3 | * 4 | * Created by Evan Jones on Wed Oct 02 2002. 5 | * 6 | */ 7 | 8 | #ifndef QUARTZTEXTSTYLE_H 9 | #define QUARTZTEXTSTYLE_H 10 | 11 | #include "QuartzTextStyleAttribute.h" 12 | 13 | class QuartzTextStyle { 14 | public: 15 | QuartzTextStyle() { 16 | fontRef = NULL; 17 | styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, 18 | &kCFTypeDictionaryKeyCallBacks, 19 | &kCFTypeDictionaryValueCallBacks); 20 | 21 | characterSet = Scintilla::CharacterSet::Ansi; 22 | } 23 | 24 | QuartzTextStyle(const QuartzTextStyle *other) { 25 | // Does not copy font colour attribute 26 | fontRef = static_cast(CFRetain(other->fontRef)); 27 | styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, 28 | &kCFTypeDictionaryKeyCallBacks, 29 | &kCFTypeDictionaryValueCallBacks); 30 | CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); 31 | characterSet = other->characterSet; 32 | } 33 | 34 | ~QuartzTextStyle() { 35 | if (styleDict != NULL) { 36 | CFRelease(styleDict); 37 | styleDict = NULL; 38 | } 39 | 40 | if (fontRef) { 41 | CFRelease(fontRef); 42 | fontRef = NULL; 43 | } 44 | } 45 | 46 | CFMutableDictionaryRef getCTStyle() const { 47 | return styleDict; 48 | } 49 | 50 | void setCTStyleColour(CGColor *inColour) { 51 | CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColour); 52 | } 53 | 54 | float getAscent() const { 55 | return static_cast(::CTFontGetAscent(fontRef)); 56 | } 57 | 58 | float getDescent() const { 59 | return static_cast(::CTFontGetDescent(fontRef)); 60 | } 61 | 62 | float getLeading() const { 63 | return static_cast(::CTFontGetLeading(fontRef)); 64 | } 65 | 66 | void setFontRef(CTFontRef inRef, Scintilla::CharacterSet characterSet_) { 67 | fontRef = inRef; 68 | characterSet = characterSet_; 69 | 70 | if (styleDict != NULL) 71 | CFRelease(styleDict); 72 | 73 | styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2, 74 | &kCFTypeDictionaryKeyCallBacks, 75 | &kCFTypeDictionaryValueCallBacks); 76 | 77 | CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef); 78 | } 79 | 80 | CTFontRef getFontRef() const noexcept { 81 | return fontRef; 82 | } 83 | 84 | Scintilla::CharacterSet getCharacterSet() const noexcept { 85 | return characterSet; 86 | } 87 | 88 | private: 89 | CFMutableDictionaryRef styleDict; 90 | CTFontRef fontRef; 91 | Scintilla::CharacterSet characterSet; 92 | }; 93 | 94 | #endif 95 | 96 | -------------------------------------------------------------------------------- /scintilla/cocoa/QuartzTextStyleAttribute.h: -------------------------------------------------------------------------------- 1 | /** 2 | * QuartzTextStyleAttribute.h 3 | * 4 | * Original Code by Evan Jones on Wed Oct 02 2002. 5 | * Contributors: 6 | * Shane Caraveo, ActiveState 7 | * Bernd Paradies, Adobe 8 | * 9 | */ 10 | 11 | 12 | #ifndef QUARTZTEXTSTYLEATTRIBUTE_H 13 | #define QUARTZTEXTSTYLEATTRIBUTE_H 14 | 15 | class QuartzFont { 16 | public: 17 | /** Create a font style from a name. */ 18 | QuartzFont(const char *name, size_t length, float size, Scintilla::FontWeight weight, bool italic) { 19 | assert(name != NULL && length > 0 && name[length] == '\0'); 20 | 21 | CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman); 22 | assert(fontName != NULL); 23 | bool bold = weight > Scintilla::FontWeight::Normal; 24 | 25 | if (bold || italic) { 26 | CTFontSymbolicTraits desiredTrait = 0; 27 | CTFontSymbolicTraits traitMask = 0; 28 | 29 | // if bold was specified, add the trait 30 | if (bold) { 31 | desiredTrait |= kCTFontBoldTrait; 32 | traitMask |= kCTFontBoldTrait; 33 | } 34 | 35 | // if italic was specified, add the trait 36 | if (italic) { 37 | desiredTrait |= kCTFontItalicTrait; 38 | traitMask |= kCTFontItalicTrait; 39 | } 40 | 41 | // create a font and then a copy of it with the sym traits 42 | CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL); 43 | fontid = ::CTFontCreateCopyWithSymbolicTraits(iFont, size, NULL, desiredTrait, traitMask); 44 | if (fontid) { 45 | CFRelease(iFont); 46 | } else { 47 | // Traits failed so use base font 48 | fontid = iFont; 49 | } 50 | } else { 51 | // create the font, no traits 52 | fontid = ::CTFontCreateWithName(fontName, size, NULL); 53 | } 54 | 55 | if (!fontid) { 56 | // Failed to create requested font so use font always present 57 | fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL); 58 | } 59 | 60 | CFRelease(fontName); 61 | } 62 | 63 | CTFontRef getFontID() { 64 | return fontid; 65 | } 66 | 67 | private: 68 | CTFontRef fontid; 69 | }; 70 | 71 | #endif 72 | 73 | -------------------------------------------------------------------------------- /scintilla/cocoa/Scintilla/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | $(PRODUCT_BUNDLE_PACKAGE_TYPE) 17 | CFBundleShortVersionString 18 | 5.3.2 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2020 Neil Hodgson. All rights reserved. 23 | 24 | 25 | -------------------------------------------------------------------------------- /scintilla/cocoa/Scintilla/Scintilla.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /scintilla/cocoa/Scintilla/Scintilla.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /scintilla/cocoa/Scintilla/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module Scintilla { 2 | umbrella header "ScintillaView.h" 3 | module InfoBar { 4 | header "InfoBar.h" 5 | } 6 | // ILexer.h is not included as Swift doesn't yet interoperate with C++ 7 | exclude header "ILexer.h" 8 | export * 9 | module * { export * } 10 | } 11 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaFramework/Scintilla_Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'Scintilla' target in the 'Scintilla' project. 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/AppController.h: -------------------------------------------------------------------------------- 1 | /** 2 | * AppController.h 3 | * SciTest 4 | * 5 | * Created by Mike Lischke on 01.04.09. 6 | * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 7 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 8 | */ 9 | 10 | #import 11 | 12 | #include 13 | 14 | #import "Scintilla/ILexer.h" 15 | #import "Scintilla/ScintillaView.h" 16 | #import "Scintilla/InfoBar.h" 17 | #include 18 | #include 19 | 20 | @interface AppController : NSObject { 21 | IBOutlet NSBox *mEditHost; 22 | ScintillaView* mEditor; 23 | ScintillaView* sciExtra; // For testing Scintilla tear-down 24 | } 25 | 26 | - (void) awakeFromNib; 27 | - (void) setupEditor; 28 | - (IBAction) searchText: (id) sender; 29 | - (IBAction) addRemoveExtra: (id) sender; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/Scintilla-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.sun.${PRODUCT_NAME:identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | FMWK 15 | CFBundleSignature 16 | ???? 17 | CFBundleVersion 18 | 1.0 19 | 20 | 21 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/ScintillaTest.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/cocoa/ScintillaTest/en.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /scintilla/cocoa/ScintillaTest/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * main.m 3 | * ScintillaTest 4 | * 5 | * Created by Mike Lischke on 02.04.09. 6 | * Copyright Sun Microsystems, Inc 2009. All rights reserved. 7 | * This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt). 8 | */ 9 | 10 | #import 11 | 12 | int main(int argc, char *argv[]) 13 | { 14 | return NSApplicationMain(argc, (const char **) argv); 15 | } 16 | -------------------------------------------------------------------------------- /scintilla/cocoa/checkbuildosx.sh: -------------------------------------------------------------------------------- 1 | # Script to build Scintilla for macOS with most supported build files. 2 | # Current directory should be scintilla/cocoa before running. 3 | 4 | cd ../.. 5 | 6 | # ************************************************************ 7 | # Target 1: Unit tests 8 | 9 | echo Unit tests 10 | 11 | cd scintilla/test/unit 12 | make clean 13 | make test 14 | cd ../../.. 15 | 16 | # ************************************************************ 17 | # Target 2: build framework and test app with Xcode targeting macOS 10.n with n from 9 to 5 18 | # Only SDK versions that are installed will be built 19 | # Clean both then build both -- if perform clean in ScintillaTest, also cleans ScintillaFramework 20 | # which can cause double build 21 | 22 | echo Building Cocoa-native ScintillaFramework and ScintillaTest 23 | for sdk in macosx10.15 macosx10.14 24 | do 25 | xcodebuild -showsdks | grep $sdk 26 | if [ "$(xcodebuild -showsdks | grep $sdk)" != "" ] 27 | then 28 | echo Building with $sdk 29 | cd scintilla/cocoa/ScintillaFramework 30 | xcodebuild clean 31 | cd ../ScintillaTest 32 | xcodebuild clean 33 | cd ../ScintillaFramework 34 | xcodebuild -sdk $sdk 35 | cd ../ScintillaTest 36 | xcodebuild -sdk $sdk 37 | cd ../../.. 38 | else 39 | echo Warning $sdk not available 40 | fi 41 | done 42 | 43 | # ************************************************************ 44 | # Target 3: Qt builds 45 | # Requires Qt development libraries and qmake to be installed 46 | 47 | echo Building Qt and PySide 48 | 49 | cd scintilla/qt 50 | cd ScintillaEditBase 51 | qmake -spec macx-xcode 52 | xcodebuild clean 53 | xcodebuild 54 | cd .. 55 | 56 | cd ScintillaEdit 57 | python3 WidgetGen.py 58 | qmake -spec macx-xcode 59 | xcodebuild clean 60 | xcodebuild 61 | cd .. 62 | 63 | cd ScintillaEditPy 64 | python2 sepbuild.py 65 | cd .. 66 | cd ../.. 67 | -------------------------------------------------------------------------------- /scintilla/cocoa/res/info_bar_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/cocoa/res/info_bar_bg.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/info_bar_bg@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/cocoa/res/info_bar_bg@2x.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_busy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/cocoa/res/mac_cursor_busy.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_busy@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/cocoa/res/mac_cursor_busy@2x.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_flipped.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/cocoa/res/mac_cursor_flipped.png -------------------------------------------------------------------------------- /scintilla/cocoa/res/mac_cursor_flipped@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/cocoa/res/mac_cursor_flipped@2x.png -------------------------------------------------------------------------------- /scintilla/cppcheck.suppress: -------------------------------------------------------------------------------- 1 | // File to suppress cppcheck warnings for files that will not be fixed. 2 | // Does not suppress warnings where an additional occurrence of the warning may be of interest. 3 | 4 | // Coding style is to use assignments in constructor when there are many 5 | // members to initialize or the initialization is complex or has comments. 6 | useInitializationList 7 | 8 | // These may be interesting but its not clear without examining each instance closely 9 | // Would have to ensure that any_of/all_of has same early/late exits as current code and 10 | // produces same result on empty collections 11 | useStlAlgorithm 12 | 13 | // Written with variable for consistency 14 | knownArgument:scintilla/src/SparseVector.h 15 | 16 | // The cast converts from 'unsigned char ' to 'char' so isn't unused. 17 | // Redundant code: Found unused cast of expression 'leadByte' 18 | constStatement:scintilla/src/Document.cxx 19 | 20 | // Some non-explicit constructors are used for conversions or are private to lexers 21 | noExplicitConstructor 22 | 23 | // MarginView access to all bits is safe and is better defined in later versions of C++ 24 | shiftTooManyBitsSigned:scintilla/src/MarginView.cxx 25 | 26 | // DLL entry points are unused inside Scintilla 27 | unusedFunction:scintilla/win32/ScintillaDLL.cxx 28 | 29 | // ScintillaDocument is providing an API and there are no consumers of the API inside Scintilla 30 | unusedFunction:scintilla/qt/ScintillaEdit/ScintillaDocument.cpp 31 | 32 | // Doesn't understand changing dropWentOutside in Editor 33 | knownConditionTrueFalse:scintilla/qt/ScintillaEditBase/ScintillaQt.cpp 34 | knownConditionTrueFalse:scintilla/win32/ScintillaWin.cxx 35 | 36 | // G_DEFINE_TYPE is too complex to pass to cppcheck 37 | unknownMacro:scintilla/gtk/PlatGTK.cxx 38 | 39 | // maskSmooth set depending on preprocessor allowing Wayland definition 40 | badBitmaskCheck:scintilla/gtk/ScintillaGTK.cxx 41 | 42 | // Difficult to test accessibility so don't change 43 | constVariable:scintilla/gtk/ScintillaGTKAccessible.cxx 44 | 45 | // Have no way of testing ScintillaEdit so don't fix even simple warnings 46 | cstyleCast:scintilla/qt/ScintillaEdit/ScintillaEdit.cpp 47 | shadowFunction:scintilla/qt/ScintillaEdit/ScintillaEdit.cpp 48 | 49 | // moc_ files show #error as they are not built with standard context 50 | preprocessorErrorDirective:scintilla/qt/*.cpp 51 | 52 | // moc_ files are not understood by cppcheck 53 | noValidConfiguration 54 | 55 | // The performance cost of by-value passing is often small and using a reference decreases 56 | // code legibility. 57 | passedByValue 58 | 59 | // Suppress everything in catch.hpp as won't be changing 60 | *:scintilla/test/unit/catch.hpp 61 | -------------------------------------------------------------------------------- /scintilla/delbin.bat: -------------------------------------------------------------------------------- 1 | @del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.ipdb *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog *.lastbuildstate >NUL: 2 | -------------------------------------------------------------------------------- /scintilla/doc/AddSource.txt: -------------------------------------------------------------------------------- 1 | Some of the build files adapt to adding and removing source code files but most 2 | must be modified by hand. Here is a list of directories and the build files that 3 | must be modified or possibly need to be modified. 4 | The Cocoa project.pbxproj file is complex and should be modified with Xcode. 5 | The other build files can be edited manually. 6 | 7 | src: 8 | cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj 9 | gtk/makefile 10 | qt/ScintillaEdit/ScintillaEdit.pro 11 | qt/ScintillaEditBase/ScintillaEditBase.pro 12 | win32/makefile 13 | win32/scintilla.mak 14 | -- possibly: 15 | test/unit/makefile 16 | test/unit/test.mak 17 | 18 | cocoa: 19 | cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj 20 | 21 | gtk: 22 | gtk/makefile 23 | 24 | qt: 25 | qt/ScintillaEdit/ScintillaEdit.pro 26 | qt/ScintillaEditBase/ScintillaEditBase.pro 27 | 28 | win32: 29 | win32/makefile 30 | win32/scintilla.mak 31 | -------------------------------------------------------------------------------- /scintilla/doc/Icons.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Scintilla icons 12 | 13 | 14 | 15 | 16 | 17 | 20 | 24 | 25 |
18 | Scintilla icon 19 | 21 | Scintilla 22 | and SciTE 23 |
26 |

27 | Icons 28 |

29 |

30 | These images may be used under the same license as Scintilla. 31 |

32 |

33 | Drawn by Iago Rubio, Philippe Lhoste, and Neil Hodgson. 34 |

35 |

36 | zip format (70K) 37 |

38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
For autocompletion listsFor margin markers
12x1216x1624x2432x32
56 | 57 | 58 | -------------------------------------------------------------------------------- /scintilla/doc/Indicators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/Indicators.png -------------------------------------------------------------------------------- /scintilla/doc/Markers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/Markers.png -------------------------------------------------------------------------------- /scintilla/doc/Privacy.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Privacy Policy 11 | 12 | 13 | 14 | 15 | 16 | 19 | 23 | 24 |
17 | Scintilla icon 18 | 20 | Scintilla 21 | and SciTE 22 |
25 |

26 | Privacy Policy for scintilla.org 27 |

28 |

29 | Information Collected 30 |

31 |

32 | Logs are collected to allow analysis of which pages are viewed. 33 | The advertisements collect viewing information through Google Analytics which is 34 | used by Google and advertisers. 35 | No personally identifiable information is collected by scintilla.org. 36 |

37 |

38 | External Links 39 |

40 |

41 | Other web sites are linked to from this site. 42 | These web sites have their own privacy policies which may differ significantly to those of scintilla.org. 43 |

44 |

45 | Cookies 46 |

47 |

48 | A cookie is a text file placed on the hard drive of a computer by some web pages which is used to remember 49 | when a particular user returns to that site. 50 | The advertisements shown on the main pages may use cookies. 51 |

52 |

53 | Contact 54 |

55 |

56 | This web site is the responsibility of Neil Hodgson. 57 | Most queries about the site contents should go to one of the mailing lists mentioned on the main pages. 58 | Queries about the privacy policy may be sent to neilh @ scintilla.org. 59 |

60 |

61 | Changes to this Policy 62 |

63 |

64 | This policy may change. If it does then this page will be updated and the date at the bottom will change. 65 |

66 |

67 | This policy was last updated 2 June 2015. 68 |

69 | 70 | 71 | -------------------------------------------------------------------------------- /scintilla/doc/SciBreak.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/SciBreak.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciRest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/SciRest.jpg -------------------------------------------------------------------------------- /scintilla/doc/SciTEIco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/SciTEIco.png -------------------------------------------------------------------------------- /scintilla/doc/SciWord.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/SciWord.jpg -------------------------------------------------------------------------------- /scintilla/doc/ScintillaDownload.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Download Scintilla 12 | 13 | 14 | 15 | 16 | 17 | 20 | 24 | 25 |
18 | Scintilla icon 19 | 21 | Download 22 | Scintilla 23 |
26 | 27 | 28 | 35 | 36 |
29 | 30 | Windows   31 | 32 | GTK/Linux   33 | 34 |
37 |

38 | Download. 39 |

40 |

41 | The license for using Scintilla or SciTE is similar to that of Python 42 | containing very few restrictions. 43 |

44 |

45 | Release 5.3.2 46 |

47 |

48 | Source Code 49 |

50 | The source code package contains all of the source code for Scintilla but no binary 51 | executable code and is available in 52 |
    53 |
  • zip format (1.4M) commonly used on Windows
  • 54 |
  • tgz format (1.2M) commonly used on Linux and compatible operating systems
  • 55 |
56 | Instructions for building on both Windows and Linux are included in the readme file. 57 |

58 | Windows Executable Code 59 |

60 | There is no download available containing only the Scintilla DLL. 61 | However, it is included in the SciTE 62 | executable full download as Scintilla.DLL. 63 |

64 | SciTE is a good demonstration of Scintilla. 65 |

66 |

67 | Previous versions can be downloaded from the history 68 | page. 69 |

70 | 71 | 72 | -------------------------------------------------------------------------------- /scintilla/doc/StadiumVariants.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/StadiumVariants.png -------------------------------------------------------------------------------- /scintilla/doc/annotations.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/annotations.png -------------------------------------------------------------------------------- /scintilla/doc/eolannotation.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/eolannotation.png -------------------------------------------------------------------------------- /scintilla/doc/styledmargin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/doc/styledmargin.png -------------------------------------------------------------------------------- /scintilla/gtk/Converter.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | // Converter.h - Encapsulation of iconv 3 | // Copyright 2004 by Neil Hodgson 4 | // The License.txt file describes the conditions under which this software may be distributed. 5 | 6 | #ifndef CONVERTER_H 7 | #define CONVERTER_H 8 | 9 | namespace Scintilla { 10 | 11 | const GIConv iconvhBad = (GIConv)(-1); 12 | const gsize sizeFailure = static_cast(-1); 13 | /** 14 | * Encapsulate g_iconv safely. 15 | */ 16 | class Converter { 17 | GIConv iconvh = iconvhBad; 18 | void OpenHandle(const char *fullDestination, const char *charSetSource) noexcept { 19 | iconvh = g_iconv_open(fullDestination, charSetSource); 20 | } 21 | bool Succeeded() const noexcept { 22 | return iconvh != iconvhBad; 23 | } 24 | public: 25 | Converter() noexcept = default; 26 | Converter(const char *charSetDestination, const char *charSetSource, bool transliterations) { 27 | Open(charSetDestination, charSetSource, transliterations); 28 | } 29 | // Deleted so Converter objects can not be copied. 30 | Converter(const Converter &) = delete; 31 | Converter(Converter &&) = delete; 32 | Converter &operator=(const Converter &) = delete; 33 | Converter &operator=(Converter &&) = delete; 34 | ~Converter() { 35 | Close(); 36 | } 37 | operator bool() const noexcept { 38 | return Succeeded(); 39 | } 40 | void Open(const char *charSetDestination, const char *charSetSource, bool transliterations) { 41 | Close(); 42 | if (*charSetSource) { 43 | // Try allowing approximate transliterations 44 | if (transliterations) { 45 | std::string fullDest(charSetDestination); 46 | fullDest.append("//TRANSLIT"); 47 | OpenHandle(fullDest.c_str(), charSetSource); 48 | } 49 | if (!Succeeded()) { 50 | // Transliterations failed so try basic name 51 | OpenHandle(charSetDestination, charSetSource); 52 | } 53 | } 54 | } 55 | void Close() noexcept { 56 | if (Succeeded()) { 57 | g_iconv_close(iconvh); 58 | iconvh = iconvhBad; 59 | } 60 | } 61 | gsize Convert(char **src, gsize *srcleft, char **dst, gsize *dstleft) const noexcept { 62 | if (!Succeeded()) { 63 | return sizeFailure; 64 | } else { 65 | return g_iconv(iconvh, src, srcleft, dst, dstleft); 66 | } 67 | } 68 | }; 69 | 70 | } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /scintilla/gtk/DepGen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # DepGen.py - produce a make dependencies file for Scintilla 3 | # Copyright 2019 by Neil Hodgson 4 | # The License.txt file describes the conditions under which this software may be distributed. 5 | # Requires Python 3.6 or later 6 | 7 | import sys 8 | 9 | sys.path.append("..") 10 | 11 | from scripts import Dependencies 12 | 13 | topComment = "# Created by DepGen.py. To recreate, run DepGen.py.\n" 14 | 15 | def Generate(): 16 | sources = ["../src/*.cxx"] 17 | includes = ["../include", "../src"] 18 | 19 | deps = Dependencies.FindDependencies(["../gtk/*.cxx"] + sources, ["../gtk"] + includes, ".o", "../gtk/") 20 | Dependencies.UpdateDependencies("../gtk/deps.mak", deps, topComment) 21 | 22 | if __name__ == "__main__": 23 | Generate() -------------------------------------------------------------------------------- /scintilla/gtk/Wrappers.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | // Wrappers.h - Encapsulation of GLib, GObject, Pango, Cairo, GTK, and GDK types 3 | // Copyright 2022 by Neil Hodgson 4 | // The License.txt file describes the conditions under which this software may be distributed. 5 | 6 | #ifndef WRAPPERS_H 7 | #define WRAPPERS_H 8 | 9 | namespace Scintilla::Internal { 10 | 11 | // GLib 12 | 13 | struct GFreeReleaser { 14 | template 15 | void operator()(T *object) noexcept { 16 | g_free(object); 17 | } 18 | }; 19 | 20 | using UniqueStr = std::unique_ptr; 21 | 22 | // GObject 23 | 24 | struct GObjectReleaser { 25 | // Called by unique_ptr to destroy/free the object 26 | template 27 | void operator()(T *object) noexcept { 28 | g_object_unref(object); 29 | } 30 | }; 31 | 32 | // Pango 33 | 34 | using UniquePangoContext = std::unique_ptr; 35 | using UniquePangoLayout = std::unique_ptr; 36 | using UniquePangoFontMap = std::unique_ptr; 37 | 38 | struct FontDescriptionReleaser { 39 | void operator()(PangoFontDescription *fontDescription) noexcept { 40 | pango_font_description_free(fontDescription); 41 | } 42 | }; 43 | 44 | using UniquePangoFontDescription = std::unique_ptr; 45 | 46 | struct FontMetricsReleaser { 47 | void operator()(PangoFontMetrics *metrics) noexcept { 48 | pango_font_metrics_unref(metrics); 49 | } 50 | }; 51 | 52 | using UniquePangoFontMetrics = std::unique_ptr; 53 | 54 | struct LayoutIterReleaser { 55 | // Called by unique_ptr to destroy/free the object 56 | void operator()(PangoLayoutIter *iter) noexcept { 57 | pango_layout_iter_free(iter); 58 | } 59 | }; 60 | 61 | using UniquePangoLayoutIter = std::unique_ptr; 62 | 63 | // Cairo 64 | 65 | struct CairoReleaser { 66 | void operator()(cairo_t *context) noexcept { 67 | cairo_destroy(context); 68 | } 69 | }; 70 | 71 | using UniqueCairo = std::unique_ptr; 72 | 73 | struct CairoSurfaceReleaser { 74 | void operator()(cairo_surface_t *psurf) noexcept { 75 | cairo_surface_destroy(psurf); 76 | } 77 | }; 78 | 79 | using UniqueCairoSurface = std::unique_ptr; 80 | 81 | // GTK 82 | 83 | using UniqueIMContext = std::unique_ptr; 84 | 85 | // GDK 86 | 87 | struct GdkEventReleaser { 88 | void operator()(GdkEvent *ev) noexcept { 89 | gdk_event_free(ev); 90 | } 91 | }; 92 | 93 | using UniqueGdkEvent = std::unique_ptr; 94 | 95 | inline void UnRefCursor(GdkCursor *cursor) noexcept { 96 | #if GTK_CHECK_VERSION(3,0,0) 97 | g_object_unref(cursor); 98 | #else 99 | gdk_cursor_unref(cursor); 100 | #endif 101 | } 102 | 103 | [[nodiscard]] inline GdkWindow *WindowFromWidget(GtkWidget *w) noexcept { 104 | return gtk_widget_get_window(w); 105 | } 106 | 107 | } 108 | 109 | #endif 110 | -------------------------------------------------------------------------------- /scintilla/gtk/scintilla-marshal.h: -------------------------------------------------------------------------------- 1 | /* This file is generated, all changes will be lost */ 2 | #ifndef __SCINTILLA_MARSHAL_MARSHAL_H__ 3 | #define __SCINTILLA_MARSHAL_MARSHAL_H__ 4 | 5 | #include 6 | 7 | G_BEGIN_DECLS 8 | 9 | /* VOID:INT,OBJECT (scintilla-marshal.list:1) */ 10 | extern 11 | void scintilla_marshal_VOID__INT_OBJECT (GClosure *closure, 12 | GValue *return_value, 13 | guint n_param_values, 14 | const GValue *param_values, 15 | gpointer invocation_hint, 16 | gpointer marshal_data); 17 | 18 | /* VOID:INT,BOXED (scintilla-marshal.list:2) */ 19 | extern 20 | void scintilla_marshal_VOID__INT_BOXED (GClosure *closure, 21 | GValue *return_value, 22 | guint n_param_values, 23 | const GValue *param_values, 24 | gpointer invocation_hint, 25 | gpointer marshal_data); 26 | 27 | 28 | G_END_DECLS 29 | 30 | #endif /* __SCINTILLA_MARSHAL_MARSHAL_H__ */ 31 | -------------------------------------------------------------------------------- /scintilla/gtk/scintilla-marshal.list: -------------------------------------------------------------------------------- 1 | VOID:INT,OBJECT 2 | VOID:INT,BOXED 3 | -------------------------------------------------------------------------------- /scintilla/include/ILoader.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ILoader.h 3 | ** Interface for loading into a Scintilla document from a background thread. 4 | **/ 5 | // Copyright 1998-2017 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef ILOADER_H 9 | #define ILOADER_H 10 | 11 | #include "Sci_Position.h" 12 | 13 | namespace Scintilla { 14 | 15 | class ILoader { 16 | public: 17 | virtual int SCI_METHOD Release() = 0; 18 | // Returns a status code from SC_STATUS_* 19 | virtual int SCI_METHOD AddData(const char *data, Sci_Position length) = 0; 20 | virtual void * SCI_METHOD ConvertToDocument() = 0; 21 | }; 22 | 23 | } 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /scintilla/include/Sci_Position.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Sci_Position.h 3 | ** Define the Sci_Position type used in Scintilla's external interfaces. 4 | ** These need to be available to clients written in C so are not in a C++ namespace. 5 | **/ 6 | // Copyright 2015 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef SCI_POSITION_H 10 | #define SCI_POSITION_H 11 | 12 | #include 13 | 14 | // Basic signed type used throughout interface 15 | typedef ptrdiff_t Sci_Position; 16 | 17 | // Unsigned variant used for ILexer::Lex and ILexer::Fold 18 | typedef size_t Sci_PositionU; 19 | 20 | // For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE 21 | typedef long Sci_PositionCR; 22 | 23 | #ifdef _WIN32 24 | #define SCI_METHOD __stdcall 25 | #else 26 | #define SCI_METHOD 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /scintilla/include/ScintillaStructures.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ScintillaStructures.h 3 | ** Structures used to communicate with Scintilla. 4 | ** The same structures are defined for C in Scintilla.h. 5 | ** Uses definitions from ScintillaTypes.h. 6 | **/ 7 | // Copyright 2021 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef SCINTILLASTRUCTURES_H 11 | #define SCINTILLASTRUCTURES_H 12 | 13 | namespace Scintilla { 14 | 15 | using PositionCR = long; 16 | 17 | struct CharacterRange { 18 | PositionCR cpMin; 19 | PositionCR cpMax; 20 | }; 21 | 22 | struct CharacterRangeFull { 23 | Position cpMin; 24 | Position cpMax; 25 | }; 26 | 27 | struct TextRange { 28 | CharacterRange chrg; 29 | char *lpstrText; 30 | }; 31 | 32 | struct TextRangeFull { 33 | CharacterRangeFull chrg; 34 | char *lpstrText; 35 | }; 36 | 37 | struct TextToFind { 38 | CharacterRange chrg; 39 | const char *lpstrText; 40 | CharacterRange chrgText; 41 | }; 42 | 43 | struct TextToFindFull { 44 | CharacterRangeFull chrg; 45 | const char *lpstrText; 46 | CharacterRangeFull chrgText; 47 | }; 48 | 49 | using SurfaceID = void *; 50 | 51 | struct Rectangle { 52 | int left; 53 | int top; 54 | int right; 55 | int bottom; 56 | }; 57 | 58 | /* This structure is used in printing. Not needed by most client code. */ 59 | 60 | struct RangeToFormat { 61 | SurfaceID hdc; 62 | SurfaceID hdcTarget; 63 | Rectangle rc; 64 | Rectangle rcPage; 65 | CharacterRange chrg; 66 | }; 67 | 68 | struct RangeToFormatFull { 69 | SurfaceID hdc; 70 | SurfaceID hdcTarget; 71 | Rectangle rc; 72 | Rectangle rcPage; 73 | CharacterRangeFull chrg; 74 | }; 75 | 76 | struct NotifyHeader { 77 | /* Compatible with Windows NMHDR. 78 | * hwndFrom is really an environment specific window handle or pointer 79 | * but most clients of Scintilla.h do not have this type visible. */ 80 | void *hwndFrom; 81 | uptr_t idFrom; 82 | Notification code; 83 | }; 84 | 85 | enum class Message; // Declare in case ScintillaMessages.h not included 86 | 87 | struct NotificationData { 88 | NotifyHeader nmhdr; 89 | Position position; 90 | /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ 91 | /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ 92 | /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ 93 | /* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ 94 | /* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ 95 | 96 | int ch; 97 | /* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */ 98 | /* SCN_USERLISTSELECTION */ 99 | KeyMod modifiers; 100 | /* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */ 101 | /* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */ 102 | 103 | ModificationFlags modificationType; /* SCN_MODIFIED */ 104 | const char *text; 105 | /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ 106 | 107 | Position length; /* SCN_MODIFIED */ 108 | Position linesAdded; /* SCN_MODIFIED */ 109 | Message message; /* SCN_MACRORECORD */ 110 | uptr_t wParam; /* SCN_MACRORECORD */ 111 | sptr_t lParam; /* SCN_MACRORECORD */ 112 | Position line; /* SCN_MODIFIED */ 113 | FoldLevel foldLevelNow; /* SCN_MODIFIED */ 114 | FoldLevel foldLevelPrev; /* SCN_MODIFIED */ 115 | int margin; /* SCN_MARGINCLICK */ 116 | int listType; /* SCN_USERLISTSELECTION */ 117 | int x; /* SCN_DWELLSTART, SCN_DWELLEND */ 118 | int y; /* SCN_DWELLSTART, SCN_DWELLEND */ 119 | int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ 120 | Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ 121 | Update updated; /* SCN_UPDATEUI */ 122 | CompletionMethods listCompletionMethod; 123 | /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */ 124 | CharacterSource characterSource; /* SCN_CHARADDED */ 125 | }; 126 | 127 | } 128 | 129 | #endif 130 | -------------------------------------------------------------------------------- /scintilla/include/ScintillaWidget.h: -------------------------------------------------------------------------------- 1 | /* Scintilla source code edit control */ 2 | /* @file ScintillaWidget.h 3 | * Definition of Scintilla widget for GTK+. 4 | * Only needed by GTK+ code but is harmless on other platforms. 5 | * This comment is not a doc-comment as that causes warnings from g-ir-scanner. 6 | */ 7 | /* Copyright 1998-2001 by Neil Hodgson 8 | * The License.txt file describes the conditions under which this software may be distributed. */ 9 | 10 | #ifndef SCINTILLAWIDGET_H 11 | #define SCINTILLAWIDGET_H 12 | 13 | #if defined(GTK) 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject) 20 | #define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) 21 | #define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ()) 22 | 23 | #define SCINTILLA_TYPE_OBJECT (scintilla_object_get_type()) 24 | #define SCINTILLA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SCINTILLA_TYPE_OBJECT, ScintillaObject)) 25 | #define SCINTILLA_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCINTILLA_TYPE_OBJECT)) 26 | #define SCINTILLA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) 27 | #define SCINTILLA_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SCINTILLA_TYPE_OBJECT)) 28 | #define SCINTILLA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass)) 29 | 30 | typedef struct _ScintillaObject ScintillaObject; 31 | typedef struct _ScintillaClass ScintillaObjectClass; 32 | 33 | struct _ScintillaObject { 34 | GtkContainer cont; 35 | void *pscin; 36 | }; 37 | 38 | struct _ScintillaClass { 39 | GtkContainerClass parent_class; 40 | 41 | void (* command) (ScintillaObject *sci, int cmd, GtkWidget *window); 42 | void (* notify) (ScintillaObject *sci, int id, SCNotification *scn); 43 | }; 44 | 45 | GType scintilla_object_get_type (void); 46 | GtkWidget* scintilla_object_new (void); 47 | gintptr scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam); 48 | 49 | 50 | GType scnotification_get_type (void); 51 | #define SCINTILLA_TYPE_NOTIFICATION (scnotification_get_type()) 52 | 53 | #ifndef G_IR_SCANNING 54 | /* The legacy names confuse the g-ir-scanner program */ 55 | typedef struct _ScintillaClass ScintillaClass; 56 | 57 | GType scintilla_get_type (void); 58 | GtkWidget* scintilla_new (void); 59 | void scintilla_set_id (ScintillaObject *sci, uptr_t id); 60 | sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); 61 | void scintilla_release_resources(void); 62 | #endif 63 | 64 | #define SCINTILLA_NOTIFY "sci-notify" 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /scintilla/qt/README: -------------------------------------------------------------------------------- 1 | README for building of Scintilla on Qt 2 | 3 | There are two different Scintilla libraries that can be produced: 4 | 5 | ScintillaEditBase 6 | A basic widget callable from C++ which is small and can be used just as is 7 | or with higher level functionality added. 8 | 9 | ScintillaEdit 10 | A more complete C++ widget with a method for every Scintilla API and a 11 | secondary API allowing direct access to document objects. 12 | 13 | Building a library 14 | 15 | ScintillaEditBase can be built without performing any generation steps. 16 | The ScintillaEditBase/ScintillaEditBase.pro project can be loaded into 17 | Qt Creator and the "Build All" command performed. 18 | Alternatively, run "qmake" to build make files and then use the platform 19 | make to build. Most commonly, use "make" on Unix and "nmake" 20 | on Windows. 21 | 22 | On Linux, qmake may be called qmake-qt5 or qmake-qt4. 23 | 24 | ScintillaEdit requires a generation command be run first. From the 25 | ScintillaEdit directory: 26 | 27 | python WidgetGen.py 28 | 29 | After the generation command has run, the ScintillaEdit.h and 30 | ScintillaEdit.cpp files will have been populated with the Scintilla API 31 | methods. 32 | To build, use Qt Creator or qmake and make as for ScintillaEditBase. 33 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaDocument.h: -------------------------------------------------------------------------------- 1 | // @file ScintillaDocument.h 2 | // Wrapper for Scintilla document object so it can be manipulated independently. 3 | // Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware 4 | 5 | #ifndef SCINTILLADOCUMENT_H 6 | #define SCINTILLADOCUMENT_H 7 | 8 | #include 9 | 10 | class WatcherHelper; 11 | 12 | #ifndef EXPORT_IMPORT_API 13 | #ifdef WIN32 14 | #ifdef MAKING_LIBRARY 15 | #define EXPORT_IMPORT_API __declspec(dllexport) 16 | #else 17 | // Defining dllimport upsets moc 18 | #define EXPORT_IMPORT_API __declspec(dllimport) 19 | //#define EXPORT_IMPORT_API 20 | #endif 21 | #else 22 | #define EXPORT_IMPORT_API 23 | #endif 24 | #endif 25 | 26 | class EXPORT_IMPORT_API ScintillaDocument : public QObject 27 | { 28 | Q_OBJECT 29 | 30 | void *pdoc; 31 | WatcherHelper *docWatcher; 32 | 33 | public: 34 | explicit ScintillaDocument(QObject *parent = 0, void *pdoc_=0); 35 | virtual ~ScintillaDocument(); 36 | void *pointer(); 37 | 38 | int line_from_position(int pos); 39 | bool is_cr_lf(int pos); 40 | bool delete_chars(int pos, int len); 41 | int undo(); 42 | int redo(); 43 | bool can_undo(); 44 | bool can_redo(); 45 | void delete_undo_history(); 46 | bool set_undo_collection(bool collect_undo); 47 | bool is_collecting_undo(); 48 | void begin_undo_action(); 49 | void end_undo_action(); 50 | void set_save_point(); 51 | bool is_save_point(); 52 | void set_read_only(bool read_only); 53 | bool is_read_only(); 54 | void insert_string(int position, QByteArray &str); 55 | QByteArray get_char_range(int position, int length); 56 | char style_at(int position); 57 | int line_start(int lineno); 58 | int line_end(int lineno); 59 | int line_end_position(int pos); 60 | int length(); 61 | int lines_total(); 62 | void start_styling(int position); 63 | bool set_style_for(int length, char style); 64 | int get_end_styled(); 65 | void ensure_styled_to(int position); 66 | void set_current_indicator(int indic); 67 | void decoration_fill_range(int position, int value, int fillLength); 68 | int decorations_value_at(int indic, int position); 69 | int decorations_start(int indic, int position); 70 | int decorations_end(int indic, int position); 71 | int get_code_page(); 72 | void set_code_page(int code_page); 73 | int get_eol_mode(); 74 | void set_eol_mode(int eol_mode); 75 | int move_position_outside_char(int pos, int move_dir, bool check_line_end); 76 | 77 | int get_character(int pos); // Calls GetCharacterAndWidth(pos, NULL) 78 | 79 | signals: 80 | void modify_attempt(); 81 | void save_point(bool atSavePoint); 82 | void modified(int position, int modification_type, const QByteArray &text, int length, 83 | int linesAdded, int line, int foldLevelNow, int foldLevelPrev); 84 | void style_needed(int pos); 85 | void error_occurred(int status); 86 | 87 | friend class ::WatcherHelper; 88 | }; 89 | 90 | #endif /* SCINTILLADOCUMENT_H */ 91 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaEdit.cpp.template: -------------------------------------------------------------------------------- 1 | // @file ScintillaEdit.cpp 2 | // Extended version of ScintillaEditBase with a method for each API 3 | // Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware 4 | 5 | #include "ScintillaEdit.h" 6 | 7 | using namespace Scintilla; 8 | 9 | ScintillaEdit::ScintillaEdit(QWidget *parent) : ScintillaEditBase(parent) { 10 | } 11 | 12 | ScintillaEdit::~ScintillaEdit() { 13 | } 14 | 15 | QByteArray ScintillaEdit::TextReturner(int message, uptr_t wParam) const { 16 | // While Scintilla can return strings longer than maximum(int), QByteArray uses int size 17 | const int length = static_cast(send(message, wParam, 0)); 18 | QByteArray ba(length + 1, '\0'); 19 | send(message, wParam, (sptr_t)ba.data()); 20 | // Remove extra NULs 21 | if (ba.at(ba.size()-1) == 0) 22 | ba.chop(1); 23 | return ba; 24 | } 25 | 26 | QPairScintillaEdit::find_text(int flags, const char *text, int cpMin, int cpMax) { 27 | struct Sci_TextToFind ft = {{0, 0}, 0, {0, 0}}; 28 | ft.chrg.cpMin = cpMin; 29 | ft.chrg.cpMax = cpMax; 30 | ft.chrgText.cpMin = cpMin; 31 | ft.chrgText.cpMax = cpMax; 32 | ft.lpstrText = text; 33 | 34 | int start = send(SCI_FINDTEXT, flags, (uptr_t) (&ft)); 35 | 36 | return QPair(start, ft.chrgText.cpMax); 37 | } 38 | 39 | QByteArray ScintillaEdit::get_text_range(int start, int end) { 40 | if (start > end) 41 | start = end; 42 | 43 | int length = end-start; 44 | QByteArray ba(length+1, '\0'); 45 | struct Sci_TextRange tr = {{start, end}, ba.data()}; 46 | 47 | send(SCI_GETTEXTRANGE, 0, (sptr_t)&tr); 48 | ba.chop(1); // Remove extra NUL 49 | 50 | return ba; 51 | } 52 | 53 | ScintillaDocument *ScintillaEdit::get_doc() { 54 | return new ScintillaDocument(0, (void *)send(SCI_GETDOCPOINTER, 0, 0)); 55 | } 56 | 57 | void ScintillaEdit::set_doc(ScintillaDocument *pdoc_) { 58 | send(SCI_SETDOCPOINTER, 0, (sptr_t)(pdoc_->pointer())); 59 | } 60 | 61 | long ScintillaEdit::format_range(bool draw, QPaintDevice* target, QPaintDevice* measure, 62 | const QRect& print_rect, const QRect& page_rect, 63 | long range_start, long range_end) 64 | { 65 | Sci_RangeToFormat to_format; 66 | 67 | to_format.hdc = target; 68 | to_format.hdcTarget = measure; 69 | 70 | to_format.rc.left = print_rect.left(); 71 | to_format.rc.top = print_rect.top(); 72 | to_format.rc.right = print_rect.right(); 73 | to_format.rc.bottom = print_rect.bottom(); 74 | 75 | to_format.rcPage.left = page_rect.left(); 76 | to_format.rcPage.top = page_rect.top(); 77 | to_format.rcPage.right = page_rect.right(); 78 | to_format.rcPage.bottom = page_rect.bottom(); 79 | 80 | to_format.chrg.cpMin = range_start; 81 | to_format.chrg.cpMax = range_end; 82 | 83 | return send(SCI_FORMATRANGE, draw, reinterpret_cast(&to_format)); 84 | } 85 | 86 | /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ 87 | /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ 88 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaEdit.h.template: -------------------------------------------------------------------------------- 1 | // @file ScintillaEdit.h 2 | // Extended version of ScintillaEditBase with a method for each API 3 | // Copyright (c) 2011 Archaeopteryx Software, Inc. d/b/a Wingware 4 | 5 | #ifndef SCINTILLAEDIT_H 6 | #define SCINTILLAEDIT_H 7 | 8 | #include 9 | 10 | #include "ScintillaEditBase.h" 11 | #include "ScintillaDocument.h" 12 | 13 | #ifndef EXPORT_IMPORT_API 14 | #ifdef WIN32 15 | #ifdef MAKING_LIBRARY 16 | #define EXPORT_IMPORT_API __declspec(dllexport) 17 | #else 18 | // Defining dllimport upsets moc 19 | #define EXPORT_IMPORT_API __declspec(dllimport) 20 | //#define EXPORT_IMPORT_API 21 | #endif 22 | #else 23 | #define EXPORT_IMPORT_API 24 | #endif 25 | #endif 26 | 27 | class EXPORT_IMPORT_API ScintillaEdit : public ScintillaEditBase { 28 | Q_OBJECT 29 | 30 | public: 31 | ScintillaEdit(QWidget *parent = 0); 32 | virtual ~ScintillaEdit(); 33 | 34 | QByteArray TextReturner(int message, uptr_t wParam) const; 35 | 36 | QPairfind_text(int flags, const char *text, int cpMin, int cpMax); 37 | QByteArray get_text_range(int start, int end); 38 | ScintillaDocument *get_doc(); 39 | void set_doc(ScintillaDocument *pdoc_); 40 | 41 | // Same as previous two methods but with Qt style names 42 | QPairfindText(int flags, const char *text, int cpMin, int cpMax) { 43 | return find_text(flags, text, cpMin, cpMax); 44 | } 45 | 46 | QByteArray textRange(int start, int end) { 47 | return get_text_range(start, end); 48 | } 49 | 50 | // Exposing the FORMATRANGE api with both underscore & qt style names 51 | long format_range(bool draw, QPaintDevice* target, QPaintDevice* measure, 52 | const QRect& print_rect, const QRect& page_rect, 53 | long range_start, long range_end); 54 | long formatRange(bool draw, QPaintDevice* target, QPaintDevice* measure, 55 | const QRect& print_rect, const QRect& page_rect, 56 | long range_start, long range_end) { 57 | return format_range(draw, target, measure, print_rect, page_rect, 58 | range_start, range_end); 59 | } 60 | 61 | /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ 62 | /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ 63 | 64 | }; 65 | 66 | #if defined(__GNUC__) 67 | #pragma GCC diagnostic ignored "-Wmissing-field-initializers" 68 | #if !defined(__clang__) && (__GNUC__ >= 8) 69 | #pragma GCC diagnostic ignored "-Wcast-function-type" 70 | #endif 71 | #endif 72 | 73 | #endif /* SCINTILLAEDIT_H */ 74 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEdit/ScintillaEdit.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2011-05-05T12:41:23 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += core gui 8 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 9 | equals(QT_MAJOR_VERSION, 6): QT += core5compat 10 | 11 | TARGET = ScintillaEdit 12 | TEMPLATE = lib 13 | CONFIG += lib_bundle 14 | CONFIG += c++1z 15 | 16 | VERSION = 5.3.2 17 | 18 | SOURCES += \ 19 | ScintillaEdit.cpp \ 20 | ScintillaDocument.cpp \ 21 | ../ScintillaEditBase/PlatQt.cpp \ 22 | ../ScintillaEditBase/ScintillaQt.cpp \ 23 | ../ScintillaEditBase/ScintillaEditBase.cpp \ 24 | ../../src/XPM.cxx \ 25 | ../../src/ViewStyle.cxx \ 26 | ../../src/UniqueString.cxx \ 27 | ../../src/UniConversion.cxx \ 28 | ../../src/Style.cxx \ 29 | ../../src/Selection.cxx \ 30 | ../../src/ScintillaBase.cxx \ 31 | ../../src/RunStyles.cxx \ 32 | ../../src/RESearch.cxx \ 33 | ../../src/PositionCache.cxx \ 34 | ../../src/PerLine.cxx \ 35 | ../../src/MarginView.cxx \ 36 | ../../src/LineMarker.cxx \ 37 | ../../src/KeyMap.cxx \ 38 | ../../src/Indicator.cxx \ 39 | ../../src/Geometry.cxx \ 40 | ../../src/EditView.cxx \ 41 | ../../src/Editor.cxx \ 42 | ../../src/EditModel.cxx \ 43 | ../../src/Document.cxx \ 44 | ../../src/Decoration.cxx \ 45 | ../../src/DBCS.cxx \ 46 | ../../src/ContractionState.cxx \ 47 | ../../src/CharClassify.cxx \ 48 | ../../src/CharacterType.cxx \ 49 | ../../src/CharacterCategoryMap.cxx \ 50 | ../../src/CellBuffer.cxx \ 51 | ../../src/CaseFolder.cxx \ 52 | ../../src/CaseConvert.cxx \ 53 | ../../src/CallTip.cxx \ 54 | ../../src/AutoComplete.cxx 55 | 56 | HEADERS += \ 57 | ScintillaEdit.h \ 58 | ScintillaDocument.h \ 59 | ../ScintillaEditBase/ScintillaEditBase.h \ 60 | ../ScintillaEditBase/ScintillaQt.h 61 | 62 | OTHER_FILES += 63 | 64 | INCLUDEPATH += ../ScintillaEditBase ../../include ../../src 65 | 66 | DEFINES += SCINTILLA_QT=1 MAKING_LIBRARY=1 _CRT_SECURE_NO_DEPRECATE=1 67 | CONFIG(release, debug|release) { 68 | DEFINES += NDEBUG=1 69 | } 70 | 71 | DESTDIR = ../../bin 72 | DLLDESTDIR = ../../bin 73 | 74 | macx { 75 | QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/ 76 | } 77 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEditBase/Notes.txt: -------------------------------------------------------------------------------- 1 | 2 | Issues with Scintilla for Qt 3 | 4 | Qt reports character descenders are 1 pixel shorter than they really are. 5 | There is a tweak in the code to add a pixel in. This may have to be reviewed for Qt 5. 6 | There's a comment in the Qt code for Windows: 7 | // ### we subtract 1 to even out the historical +1 in QFontMetrics's 8 | // ### height=asc+desc+1 equation. Fix in Qt5. 9 | 10 | The clocks used aren't great. QTime is a time since midnight clock so wraps around and 11 | is only accurate to, at best, milliseconds. 12 | 13 | On macOS drawing text into a pixmap moves it around 1 pixel to the right compared to drawing 14 | it directly onto a window. Buffered drawing turned off by default to avoid this. 15 | Reported as QTBUG-19483. 16 | 17 | Only one QPainter can be active on any widget at a time. Scintilla only draws into one 18 | widget but reenters for measurement. 19 | -------------------------------------------------------------------------------- /scintilla/qt/ScintillaEditBase/ScintillaEditBase.pro: -------------------------------------------------------------------------------- 1 | #------------------------------------------------- 2 | # 3 | # Project created by QtCreator 2011-05-05T12:41:23 4 | # 5 | #------------------------------------------------- 6 | 7 | QT += qml quick core gui 8 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets 9 | greaterThan(QT_MAJOR_VERSION, 5): QT += core5compat 10 | 11 | TARGET = ScintillaEditBase 12 | TEMPLATE = lib 13 | #CONFIG += lib_bundle # PATCH 14 | CONFIG += staticlib 15 | CONFIG += c++1z 16 | 17 | VERSION = 5.3.2 18 | 19 | ARCH_PATH = x86 20 | 21 | android { 22 | # message("hello android !") 23 | 24 | equals(ANDROID_TARGET_ARCH, arm64-v8a) { 25 | ARCH_PATH = arm64 26 | } 27 | equals(ANDROID_TARGET_ARCH, armeabi-v7a) { 28 | ARCH_PATH = arm 29 | } 30 | equals(ANDROID_TARGET_ARCH, armeabi) { 31 | ARCH_PATH = arm 32 | } 33 | equals(ANDROID_TARGET_ARCH, x86) { 34 | ARCH_PATH = x86 35 | } 36 | equals(ANDROID_TARGET_ARCH, x86_64) { 37 | ARCH_PATH = x64 38 | } 39 | equals(ANDROID_TARGET_ARCH, mips) { 40 | ARCH_PATH = mips 41 | } 42 | equals(ANDROID_TARGET_ARCH, mips64) { 43 | ARCH_PATH = mips64 44 | } 45 | } 46 | 47 | SOURCES += \ 48 | PlatQt.cpp \ 49 | ScintillaQt.cpp \ 50 | ScintillaEditBase.cpp \ 51 | ../../src/XPM.cxx \ 52 | ../../src/ViewStyle.cxx \ 53 | ../../src/UniqueString.cxx \ 54 | ../../src/UniConversion.cxx \ 55 | ../../src/Style.cxx \ 56 | ../../src/Selection.cxx \ 57 | ../../src/ScintillaBase.cxx \ 58 | ../../src/RunStyles.cxx \ 59 | ../../src/RESearch.cxx \ 60 | ../../src/PositionCache.cxx \ 61 | ../../src/PerLine.cxx \ 62 | ../../src/MarginView.cxx \ 63 | ../../src/LineMarker.cxx \ 64 | ../../src/KeyMap.cxx \ 65 | ../../src/Indicator.cxx \ 66 | ../../src/Geometry.cxx \ 67 | ../../src/EditView.cxx \ 68 | ../../src/Editor.cxx \ 69 | ../../src/EditModel.cxx \ 70 | ../../src/Document.cxx \ 71 | ../../src/Decoration.cxx \ 72 | ../../src/DBCS.cxx \ 73 | ../../src/ContractionState.cxx \ 74 | ../../src/CharClassify.cxx \ 75 | ../../src/CharacterType.cxx \ 76 | ../../src/CharacterCategoryMap.cxx \ 77 | ../../src/ChangeHistory.cxx \ 78 | ../../src/CellBuffer.cxx \ 79 | ../../src/CaseFolder.cxx \ 80 | ../../src/CaseConvert.cxx \ 81 | ../../src/CallTip.cxx \ 82 | ../../src/AutoComplete.cxx 83 | 84 | HEADERS += \ 85 | PlatQt.h \ 86 | ScintillaQt.h \ 87 | ScintillaEditBase.h \ 88 | ../../src/XPM.h \ 89 | ../../src/ViewStyle.h \ 90 | ../../src/UniConversion.h \ 91 | ../../src/Style.h \ 92 | ../../src/SplitVector.h \ 93 | ../../src/Selection.h \ 94 | ../../src/ScintillaBase.h \ 95 | ../../src/RunStyles.h \ 96 | ../../src/RESearch.h \ 97 | ../../src/PositionCache.h \ 98 | ../../src/Platform.h \ 99 | ../../src/PerLine.h \ 100 | ../../src/Partitioning.h \ 101 | ../../src/LineMarker.h \ 102 | ../../src/KeyMap.h \ 103 | ../../src/Indicator.h \ 104 | ../../src/Geometry.h \ 105 | ../../src/Editor.h \ 106 | ../../src/Document.h \ 107 | ../../src/Decoration.h \ 108 | ../../src/ContractionState.h \ 109 | ../../src/CharClassify.h \ 110 | ../../src/CharacterType.h \ 111 | ../../src/CharacterCategoryMap.h \ 112 | ../../src/ChangeHistory.h \ 113 | ../../src/CellBuffer.h \ 114 | ../../src/CaseFolder.h \ 115 | ../../src/CaseConvert.h \ 116 | ../../src/CallTip.h \ 117 | ../../src/AutoComplete.h \ 118 | ../../include/Scintilla.h \ 119 | ../../include/ILexer.h \ 120 | 121 | OTHER_FILES += 122 | 123 | INCLUDEPATH += ../../include ../../src 124 | 125 | DEFINES += SCINTILLA_QT_QML=1 MAKING_LIBRARY=1 _CRT_SECURE_NO_DEPRECATE=1 126 | CONFIG(release, debug|release) { 127 | DEFINES += NDEBUG=1 128 | } 129 | 130 | DESTDIR = ../../bin-$${ARCH_PATH} 131 | 132 | macx { 133 | QMAKE_LFLAGS_SONAME = -Wl,-install_name,@executable_path/../Frameworks/ 134 | } 135 | -------------------------------------------------------------------------------- /scintilla/scripts/GenerateCharacterCategory.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # Script to generate scintilla/src/CharacterCategoryMap.cxx and lexilla/lexlib/CharacterCategory.cxx 3 | # from Python's Unicode data 4 | # Should be run rarely when a Python with a new version of Unicode data is available. 5 | # Requires Python 3.3 or later 6 | # Should not be run with old versions of Python. 7 | 8 | import pathlib, platform, sys, unicodedata 9 | 10 | from FileGenerator import Regenerate 11 | 12 | def findCategories(filename): 13 | with filename.open(encoding="UTF-8") as infile: 14 | lines = [x.strip() for x in infile.readlines() if "\tcc" in x] 15 | values = "".join(lines).replace(" ","").split(",") 16 | print("Categrories:", values) 17 | return [v[2:] for v in values] 18 | 19 | def updateCharacterCategory(filename): 20 | values = ["// Created with Python %s, Unicode %s" % ( 21 | platform.python_version(), unicodedata.unidata_version)] 22 | 23 | startRange = 0 24 | category = unicodedata.category(chr(startRange)) 25 | table = [] 26 | for ch in range(sys.maxunicode): 27 | uch = chr(ch) 28 | current = unicodedata.category(uch) 29 | if current != category: 30 | value = startRange * 32 + categories.index(category) 31 | table.append(value) 32 | category = current 33 | startRange = ch 34 | value = startRange * 32 + categories.index(category) 35 | table.append(value) 36 | 37 | # the sentinel value is used to simplify CharacterCategoryMap::Optimize() 38 | category = 'Cn' 39 | value = (sys.maxunicode + 1)*32 + categories.index(category) 40 | table.append(value) 41 | 42 | values.extend(["%d," % value for value in table]) 43 | 44 | Regenerate(filename, "//", values) 45 | 46 | 47 | scintillaDirectory = pathlib.Path(__file__).resolve().parent.parent 48 | 49 | categories = findCategories(scintillaDirectory / "src" / "CharacterCategoryMap.h") 50 | 51 | updateCharacterCategory(scintillaDirectory / "src" / "CharacterCategoryMap.cxx") 52 | 53 | updateCharacterCategory(scintillaDirectory.parent / "lexilla" / "lexlib" / "CharacterCategory.cxx") 54 | -------------------------------------------------------------------------------- /scintilla/scripts/HFacer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface 3 | # definition file. 4 | # Implemented 2000 by Neil Hodgson neilh@scintilla.org 5 | # Requires Python 3.6 or later 6 | 7 | import pathlib 8 | import Face 9 | import FileGenerator 10 | 11 | def printHFile(f): 12 | out = [] 13 | previousCategory = "" 14 | anyProvisional = False 15 | for name in f.order: 16 | v = f.features[name] 17 | if v["Category"] != "Deprecated": 18 | if v["Category"] == "Provisional" and previousCategory != "Provisional": 19 | out.append("#ifndef SCI_DISABLE_PROVISIONAL") 20 | anyProvisional = True 21 | previousCategory = v["Category"] 22 | if v["FeatureType"] in ["fun", "get", "set"]: 23 | featureDefineName = "SCI_" + name.upper() 24 | out.append("#define " + featureDefineName + " " + v["Value"]) 25 | elif v["FeatureType"] in ["evt"]: 26 | featureDefineName = "SCN_" + name.upper() 27 | out.append("#define " + featureDefineName + " " + v["Value"]) 28 | elif v["FeatureType"] in ["val"]: 29 | out.append("#define " + name + " " + v["Value"]) 30 | if anyProvisional: 31 | out.append("#endif") 32 | return out 33 | 34 | showUnused = False 35 | 36 | def RegenerateAll(root, showMaxID): 37 | f = Face.Face() 38 | f.ReadFromFile(root / "include/Scintilla.iface") 39 | FileGenerator.Regenerate(root / "include/Scintilla.h", "/* ", printHFile(f)) 40 | if showMaxID: 41 | valueSet = set(int(x) for x in f.values if int(x) < 3000) 42 | maximumID = max(valueSet) 43 | print("Maximum ID is %d" % maximumID) 44 | if showUnused: 45 | valuesUnused = sorted(x for x in range(2001,maximumID) if x not in valueSet) 46 | print("\nUnused values") 47 | valueToName = {} 48 | for name, feature in f.features.items(): 49 | try: 50 | value = int(feature["Value"]) 51 | valueToName[value] = name 52 | except ValueError: 53 | pass 54 | for v in valuesUnused: 55 | prev = valueToName.get(v-1, "") 56 | print(v, prev) 57 | 58 | if __name__ == "__main__": 59 | RegenerateAll(pathlib.Path(__file__).resolve().parent.parent, True) 60 | -------------------------------------------------------------------------------- /scintilla/scripts/LexGen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org 3 | # Released to the public domain. 4 | 5 | # Update Scintilla files. 6 | # Update version numbers and modification dates in documentation and header files. 7 | # Update make dependencies. 8 | # Requires Python 3.6 or later 9 | 10 | from FileGenerator import UpdateLineInFile, ReplaceREInFile, UpdateLineInPlistFile 11 | import ScintillaData 12 | import HFacer 13 | import os 14 | import pathlib 15 | import sys 16 | 17 | baseDirectory = os.path.dirname(os.path.dirname(ScintillaData.__file__)) 18 | sys.path.append(baseDirectory) 19 | 20 | import win32.DepGen 21 | import gtk.DepGen 22 | 23 | def UpdateVersionNumbers(sci, root): 24 | UpdateLineInFile(root / "win32/ScintRes.rc", "#define VERSION_SCINTILLA", 25 | "#define VERSION_SCINTILLA \"" + sci.versionDotted + "\"") 26 | UpdateLineInFile(root / "win32/ScintRes.rc", "#define VERSION_WORDS", 27 | "#define VERSION_WORDS " + sci.versionCommad) 28 | UpdateLineInFile(root / "qt/ScintillaEditBase/ScintillaEditBase.pro", 29 | "VERSION =", 30 | "VERSION = " + sci.versionDotted) 31 | UpdateLineInFile(root / "qt/ScintillaEdit/ScintillaEdit.pro", 32 | "VERSION =", 33 | "VERSION = " + sci.versionDotted) 34 | UpdateLineInFile(root / "doc/ScintillaDownload.html", " Release", 35 | " Release " + sci.versionDotted) 36 | ReplaceREInFile(root / "doc/ScintillaDownload.html", 37 | r"/www.scintilla.org/([a-zA-Z]+)\d\d\d", 38 | r"/www.scintilla.org/\g<1>" + sci.version, 39 | 0) 40 | UpdateLineInFile(root / "doc/index.html", 41 | ' Release version', 42 | ' Release version ' +\ 43 | sci.versionDotted + '
') 44 | UpdateLineInFile(root / "doc/index.html", 45 | ' Site last modified', 46 | ' Site last modified ' + sci.mdyModified + '
') 47 | UpdateLineInFile(root / "doc/ScintillaHistory.html", 48 | ' Released ', 49 | ' Released ' + sci.dmyModified + '.') 50 | 51 | cocoa = root / "cocoa" 52 | 53 | UpdateLineInPlistFile(cocoa / "Scintilla" / "Info.plist", 54 | "CFBundleShortVersionString", sci.versionDotted) 55 | ReplaceREInFile(cocoa / "Scintilla"/ "Scintilla.xcodeproj" / "project.pbxproj", 56 | "CURRENT_PROJECT_VERSION = [0-9.]+;", 57 | f'CURRENT_PROJECT_VERSION = {sci.versionDotted};', 58 | 0) 59 | 60 | def RegenerateAll(rootDirectory): 61 | 62 | root = pathlib.Path(rootDirectory) 63 | 64 | scintillaBase = root.resolve() 65 | 66 | sci = ScintillaData.ScintillaData(scintillaBase) 67 | 68 | startDir = os.getcwd() 69 | os.chdir(os.path.join(scintillaBase, "win32")) 70 | win32.DepGen.Generate() 71 | os.chdir(os.path.join(scintillaBase, "gtk")) 72 | gtk.DepGen.Generate() 73 | os.chdir(startDir) 74 | 75 | UpdateVersionNumbers(sci, root) 76 | 77 | HFacer.RegenerateAll(root, False) 78 | 79 | if __name__=="__main__": 80 | RegenerateAll(pathlib.Path(__file__).resolve().parent.parent) 81 | -------------------------------------------------------------------------------- /scintilla/scripts/ScintillaData.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # ScintillaData.py - implemented 2013 by Neil Hodgson neilh@scintilla.org 3 | # Released to the public domain. 4 | 5 | # Common code used by Scintilla and SciTE for source file regeneration. 6 | # The ScintillaData object exposes information about Scintilla as properties: 7 | # Version properties 8 | # version 9 | # versionDotted 10 | # versionCommad 11 | # 12 | # Date last modified 13 | # dateModified 14 | # yearModified 15 | # mdyModified 16 | # dmyModified 17 | # myModified 18 | 19 | # This file can be run to see the data it provides. 20 | # Requires Python 3.6 or later 21 | 22 | import datetime, pathlib, sys 23 | 24 | def FindCredits(historyFile, removeLinks=True): 25 | credits = [] 26 | stage = 0 27 | with historyFile.open(encoding="utf-8") as f: 28 | for l in f.readlines(): 29 | l = l.strip() 30 | if stage == 0 and l == "": 31 | stage = 1 32 | elif stage == 1 and l == "
": 33 | stage = 2 34 | if stage == 1 and l.startswith(""): 35 | credit = l[4:-5] 36 | if removeLinks and "") 39 | name = end.split("<")[0] 40 | url = urlplus[1:-1] 41 | credit = title.strip() 42 | if credit: 43 | credit += " " 44 | credit += name + " " + url 45 | credits.append(credit) 46 | return credits 47 | 48 | class ScintillaData: 49 | def __init__(self, scintillaRoot): 50 | # Discover version information 51 | self.version = (scintillaRoot / "version.txt").read_text().strip() 52 | self.versionDotted = self.version[0] + '.' + self.version[1] + '.' + \ 53 | self.version[2] 54 | self.versionCommad = self.versionDotted.replace(".", ", ") + ', 0' 55 | 56 | with (scintillaRoot / "doc" / "index.html").open() as f: 57 | self.dateModified = [l for l in f.readlines() if "Date.Modified" in l]\ 58 | [0].split('\"')[3] 59 | # 20130602 60 | # index.html, SciTE.html 61 | dtModified = datetime.datetime.strptime(self.dateModified, "%Y%m%d") 62 | self.yearModified = self.dateModified[0:4] 63 | monthModified = dtModified.strftime("%B") 64 | dayModified = "%d" % dtModified.day 65 | self.mdyModified = monthModified + " " + dayModified + " " + self.yearModified 66 | # May 22 2013 67 | # index.html, SciTE.html 68 | self.dmyModified = dayModified + " " + monthModified + " " + self.yearModified 69 | # 22 May 2013 70 | # ScintillaHistory.html -- only first should change 71 | self.myModified = monthModified + " " + self.yearModified 72 | 73 | self.credits = FindCredits(scintillaRoot / "doc" / "ScintillaHistory.html") 74 | 75 | if __name__=="__main__": 76 | sci = ScintillaData(pathlib.Path(__file__).resolve().parent.parent) 77 | print("Version %s %s %s" % (sci.version, sci.versionDotted, sci.versionCommad)) 78 | print("Date last modified %s %s %s %s %s" % ( 79 | sci.dateModified, sci.yearModified, sci.mdyModified, sci.dmyModified, sci.myModified)) 80 | print("Credits:") 81 | for c in sci.credits: 82 | sys.stdout.buffer.write(b" " + c.encode("utf-8") + b"\n") 83 | -------------------------------------------------------------------------------- /scintilla/scripts/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mneuroth/QuickScintilla/f7b15988422df8fb9dd6cee5fd96d2b008166d7a/scintilla/scripts/__init__.py -------------------------------------------------------------------------------- /scintilla/scripts/archive.sh: -------------------------------------------------------------------------------- 1 | # Up to parent directory of scintilla 2 | cd ../.. 3 | 4 | # Archive Scintilla to scintilla.tgz 5 | hg archive --repository scintilla scintilla.tgz 6 | -------------------------------------------------------------------------------- /scintilla/src/AutoComplete.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file AutoComplete.h 3 | ** Defines the auto completion list box. 4 | **/ 5 | // Copyright 1998-2003 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef AUTOCOMPLETE_H 9 | #define AUTOCOMPLETE_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | /** 14 | */ 15 | class AutoComplete { 16 | bool active; 17 | std::string stopChars; 18 | std::string fillUpChars; 19 | char separator; 20 | char typesep; // Type separator 21 | enum { maxItemLen=1000 }; 22 | std::vector sortMatrix; 23 | 24 | public: 25 | 26 | bool ignoreCase; 27 | bool chooseSingle; 28 | AutoCompleteOption options; 29 | std::unique_ptr lb; 30 | Sci::Position posStart; 31 | Sci::Position startLen; 32 | /// Should autocompletion be cancelled if editor's currentPos <= startPos? 33 | bool cancelAtStartPos; 34 | bool autoHide; 35 | bool dropRestOfWord; 36 | Scintilla::CaseInsensitiveBehaviour ignoreCaseBehaviour; 37 | int widthLBDefault; 38 | int heightLBDefault; 39 | /** Ordering::PreSorted: Assume the list is presorted; selection will fail if it is not alphabetical
40 | * Ordering::PerformSort: Sort the list alphabetically; start up performance cost for sorting
41 | * Ordering::Custom: Handle non-alphabetical entries; start up performance cost for generating a sorted lookup table 42 | */ 43 | Scintilla::Ordering autoSort; 44 | 45 | AutoComplete(); 46 | // Deleted so AutoComplete objects can not be copied. 47 | AutoComplete(const AutoComplete &) = delete; 48 | AutoComplete(AutoComplete &&) = delete; 49 | AutoComplete &operator=(const AutoComplete &) = delete; 50 | AutoComplete &operator=(AutoComplete &&) = delete; 51 | ~AutoComplete(); 52 | 53 | /// Is the auto completion list displayed? 54 | bool Active() const noexcept; 55 | 56 | /// Display the auto completion list positioned to be near a character position 57 | void Start(Window &parent, int ctrlID, Sci::Position position, Point location, 58 | Sci::Position startLen_, int lineHeight, bool unicodeMode, Scintilla::Technology technology, 59 | ListOptions listOptions); 60 | 61 | /// The stop chars are characters which, when typed, cause the auto completion list to disappear 62 | void SetStopChars(const char *stopChars_); 63 | bool IsStopChar(char ch) const noexcept; 64 | 65 | /// The fillup chars are characters which, when typed, fill up the selected word 66 | void SetFillUpChars(const char *fillUpChars_); 67 | bool IsFillUpChar(char ch) const noexcept; 68 | 69 | /// The separator character is used when interpreting the list in SetList 70 | void SetSeparator(char separator_); 71 | char GetSeparator() const noexcept; 72 | 73 | /// The typesep character is used for separating the word from the type 74 | void SetTypesep(char separator_); 75 | char GetTypesep() const noexcept; 76 | 77 | /// The list string contains a sequence of words separated by the separator character 78 | void SetList(const char *list); 79 | 80 | /// Return the position of the currently selected list item 81 | int GetSelection() const; 82 | 83 | /// Return the value of an item in the list 84 | std::string GetValue(int item) const; 85 | 86 | void Show(bool show); 87 | void Cancel() noexcept; 88 | 89 | /// Move the current list element by delta, scrolling appropriately 90 | void Move(int delta); 91 | 92 | /// Select a list element that starts with word as the current element 93 | void Select(const char *word); 94 | }; 95 | 96 | } 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /scintilla/src/CallTip.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CallTip.h 3 | ** Interface to the call tip control. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CALLTIP_H 9 | #define CALLTIP_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | struct Chunk { 14 | size_t start; 15 | size_t end; 16 | constexpr Chunk(size_t start_=0, size_t end_=0) noexcept : start(start_), end(end_) { 17 | assert(start <= end); 18 | } 19 | size_t Length() const noexcept; 20 | }; 21 | 22 | /** 23 | */ 24 | class CallTip { 25 | Chunk highlight; // character offset to start and end of highlighted text 26 | std::string val; 27 | std::shared_ptr font; 28 | PRectangle rectUp; // rectangle of last up angle in the tip 29 | PRectangle rectDown; // rectangle of last down arrow in the tip 30 | int lineHeight; // vertical line spacing 31 | int offsetMain; // The alignment point of the call tip 32 | int tabSize; // Tab size in pixels, <=0 no TAB expand 33 | bool useStyleCallTip; // if true, StyleCallTip should be used 34 | bool above; // if true, display calltip above text 35 | 36 | int DrawChunk(Surface *surface, int x, std::string_view sv, 37 | int ytext, PRectangle rcClient, bool asHighlight, bool draw); 38 | int PaintContents(Surface *surfaceWindow, bool draw); 39 | bool IsTabCharacter(char ch) const noexcept; 40 | int NextTabPos(int x) const noexcept; 41 | 42 | public: 43 | Window wCallTip; 44 | Window wDraw; 45 | bool inCallTipMode; 46 | Sci::Position posStartCallTip; 47 | ColourRGBA colourBG; 48 | ColourRGBA colourUnSel; 49 | ColourRGBA colourSel; 50 | ColourRGBA colourShade; 51 | ColourRGBA colourLight; 52 | int codePage; 53 | int clickPlace; 54 | 55 | int insetX; // text inset in x from calltip border 56 | int widthArrow; 57 | int borderHeight; 58 | int verticalOffset; // pixel offset up or down of the calltip with respect to the line 59 | 60 | CallTip() noexcept; 61 | // Deleted so CallTip objects can not be copied. 62 | CallTip(const CallTip &) = delete; 63 | CallTip(CallTip &&) = delete; 64 | CallTip &operator=(const CallTip &) = delete; 65 | CallTip &operator=(CallTip &&) = delete; 66 | ~CallTip(); 67 | 68 | void PaintCT(Surface *surfaceWindow); 69 | 70 | void MouseClick(Point pt) noexcept; 71 | 72 | /// Setup the calltip and return a rectangle of the area required. 73 | PRectangle CallTipStart(Sci::Position pos, Point pt, int textHeight, const char *defn, 74 | int codePage_, Surface *surfaceMeasure, std::shared_ptr font_); 75 | 76 | void CallTipCancel() noexcept; 77 | 78 | /// Set a range of characters to be displayed in a highlight style. 79 | /// Commonly used to highlight the current parameter. 80 | void SetHighlight(size_t start, size_t end); 81 | 82 | /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. 83 | void SetTabSize(int tabSz) noexcept; 84 | 85 | /// Set calltip position. 86 | void SetPosition(bool aboveText) noexcept; 87 | 88 | /// Used to determine which STYLE_xxxx to use for call tip information 89 | bool UseStyleCallTip() const noexcept; 90 | 91 | // Modify foreground and background colours 92 | void SetForeBack(ColourRGBA fore, ColourRGBA back) noexcept; 93 | }; 94 | 95 | } 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /scintilla/src/CaseConvert.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | // Encoding: UTF-8 3 | /** @file CaseConvert.h 4 | ** Performs Unicode case conversions. 5 | ** Does not handle locale-sensitive case conversion. 6 | **/ 7 | // Copyright 2013 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef CASECONVERT_H 11 | #define CASECONVERT_H 12 | 13 | namespace Scintilla::Internal { 14 | 15 | enum class CaseConversion { 16 | fold, 17 | upper, 18 | lower 19 | }; 20 | 21 | class ICaseConverter { 22 | public: 23 | virtual size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed) = 0; 24 | }; 25 | 26 | ICaseConverter *ConverterFor(CaseConversion conversion); 27 | 28 | // Returns a UTF-8 string. Empty when no conversion 29 | const char *CaseConvert(int character, CaseConversion conversion); 30 | 31 | // When performing CaseConvertString, the converted value may be up to 3 times longer than the input. 32 | // Ligatures are often decomposed into multiple characters and long cases include: 33 | // ΐ "\xce\x90" folds to ΐ "\xce\xb9\xcc\x88\xcc\x81" 34 | constexpr size_t maxExpansionCaseConversion = 3; 35 | 36 | // Converts a mixed case string using a particular conversion. 37 | // Result may be a different length to input and the length is the return value. 38 | // If there is not enough space then 0 is returned. 39 | size_t CaseConvertString(char *converted, size_t sizeConverted, const char *mixed, size_t lenMixed, CaseConversion conversion); 40 | 41 | // Converts a mixed case string using a particular conversion. 42 | std::string CaseConvertString(const std::string &s, CaseConversion conversion); 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /scintilla/src/CaseFolder.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CaseFolder.cxx 3 | ** Classes for case folding. 4 | **/ 5 | // Copyright 1998-2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "CharacterType.h" 13 | #include "CaseFolder.h" 14 | #include "CaseConvert.h" 15 | 16 | using namespace Scintilla::Internal; 17 | 18 | namespace { 19 | 20 | constexpr unsigned char IndexFromChar(char ch) { 21 | return static_cast(ch); 22 | } 23 | 24 | } 25 | 26 | CaseFolderTable::CaseFolderTable() noexcept : mapping{} { 27 | StandardASCII(); 28 | } 29 | 30 | size_t CaseFolderTable::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 31 | if (lenMixed > sizeFolded) { 32 | return 0; 33 | } 34 | for (size_t i=0; i(MakeLowerCase(iChar)); 47 | } 48 | } 49 | 50 | CaseFolderUnicode::CaseFolderUnicode() { 51 | converter = ConverterFor(CaseConversion::fold); 52 | } 53 | 54 | size_t CaseFolderUnicode::Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) { 55 | if ((lenMixed == 1) && (sizeFolded > 0)) { 56 | folded[0] = mapping[IndexFromChar(mixed[0])]; 57 | return 1; 58 | } else { 59 | return converter->CaseConvertString(folded, sizeFolded, mixed, lenMixed); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /scintilla/src/CaseFolder.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CaseFolder.h 3 | ** Classes for case folding. 4 | **/ 5 | // Copyright 1998-2013 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CASEFOLDER_H 9 | #define CASEFOLDER_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | class CaseFolder { 14 | public: 15 | CaseFolder() = default; 16 | // Deleted so CaseFolder objects can not be copied. 17 | CaseFolder(const CaseFolder &source) = delete; 18 | CaseFolder(CaseFolder &&) = delete; 19 | CaseFolder &operator=(const CaseFolder &) = delete; 20 | CaseFolder &operator=(CaseFolder &&) = delete; 21 | virtual ~CaseFolder() = default; 22 | virtual size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) = 0; 23 | }; 24 | 25 | class CaseFolderTable : public CaseFolder { 26 | protected: 27 | char mapping[256]; 28 | public: 29 | CaseFolderTable() noexcept; 30 | size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; 31 | void SetTranslation(char ch, char chTranslation) noexcept; 32 | void StandardASCII() noexcept; 33 | }; 34 | 35 | class ICaseConverter; 36 | 37 | class CaseFolderUnicode : public CaseFolderTable { 38 | ICaseConverter *converter; 39 | public: 40 | CaseFolderUnicode(); 41 | size_t Fold(char *folded, size_t sizeFolded, const char *mixed, size_t lenMixed) override; 42 | }; 43 | 44 | } 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /scintilla/src/CharClassify.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharClassify.cxx 3 | ** Character classifications used by Document and RESearch. 4 | **/ 5 | // Copyright 2006 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "CharacterType.h" 14 | #include "CharClassify.h" 15 | 16 | using namespace Scintilla::Internal; 17 | 18 | CharClassify::CharClassify() : charClass{} { 19 | SetDefaultCharClasses(true); 20 | } 21 | 22 | void CharClassify::SetDefaultCharClasses(bool includeWordClass) { 23 | // Initialize all char classes to default values 24 | for (int ch = 0; ch < maxChar; ch++) { 25 | if (ch == '\r' || ch == '\n') 26 | charClass[ch] = CharacterClass::newLine; 27 | else if (IsControl(ch) || ch == ' ') 28 | charClass[ch] = CharacterClass::space; 29 | else if (includeWordClass && (ch >= 0x80 || IsAlphaNumeric(ch) || ch == '_')) 30 | charClass[ch] = CharacterClass::word; 31 | else 32 | charClass[ch] = CharacterClass::punctuation; 33 | } 34 | } 35 | 36 | void CharClassify::SetCharClasses(const unsigned char *chars, CharacterClass newCharClass) { 37 | // Apply the newCharClass to the specified chars 38 | if (chars) { 39 | while (*chars) { 40 | charClass[*chars] = newCharClass; 41 | chars++; 42 | } 43 | } 44 | } 45 | 46 | int CharClassify::GetCharsOfClass(CharacterClass characterClass, unsigned char *buffer) const noexcept { 47 | // Get characters belonging to the given char class; return the number 48 | // of characters (if the buffer is NULL, don't write to it). 49 | int count = 0; 50 | for (int ch = maxChar - 1; ch >= 0; --ch) { 51 | if (charClass[ch] == characterClass) { 52 | ++count; 53 | if (buffer) { 54 | *buffer = static_cast(ch); 55 | buffer++; 56 | } 57 | } 58 | } 59 | return count; 60 | } 61 | -------------------------------------------------------------------------------- /scintilla/src/CharClassify.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharClassify.h 3 | ** Character classifications used by Document and RESearch. 4 | **/ 5 | // Copyright 2006-2009 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARCLASSIFY_H 9 | #define CHARCLASSIFY_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | enum class CharacterClass : unsigned char { space, newLine, word, punctuation }; 14 | 15 | class CharClassify { 16 | public: 17 | CharClassify(); 18 | 19 | void SetDefaultCharClasses(bool includeWordClass); 20 | void SetCharClasses(const unsigned char *chars, CharacterClass newCharClass); 21 | int GetCharsOfClass(CharacterClass characterClass, unsigned char *buffer) const noexcept; 22 | CharacterClass GetClass(unsigned char ch) const noexcept { return charClass[ch];} 23 | bool IsWord(unsigned char ch) const noexcept { return charClass[ch] == CharacterClass::word;} 24 | 25 | private: 26 | static constexpr int maxChar=256; 27 | CharacterClass charClass[maxChar]; 28 | }; 29 | 30 | } 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /scintilla/src/CharacterCategoryMap.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterCategoryMap.h 3 | ** Returns the Unicode general category of a character. 4 | ** Similar code to Lexilla's lexilla/lexlib/CharacterCategory.h but renamed 5 | ** to avoid problems with builds that statically include both Scintilla and Lexilla. 6 | **/ 7 | // Copyright 2013 by Neil Hodgson 8 | // The License.txt file describes the conditions under which this software may be distributed. 9 | 10 | #ifndef CHARACTERCATEGORYMAP_H 11 | #define CHARACTERCATEGORYMAP_H 12 | 13 | namespace Scintilla::Internal { 14 | 15 | enum CharacterCategory { 16 | ccLu, ccLl, ccLt, ccLm, ccLo, 17 | ccMn, ccMc, ccMe, 18 | ccNd, ccNl, ccNo, 19 | ccPc, ccPd, ccPs, ccPe, ccPi, ccPf, ccPo, 20 | ccSm, ccSc, ccSk, ccSo, 21 | ccZs, ccZl, ccZp, 22 | ccCc, ccCf, ccCs, ccCo, ccCn 23 | }; 24 | 25 | CharacterCategory CategoriseCharacter(int character); 26 | 27 | // Common definitions of allowable characters in identifiers from UAX #31. 28 | bool IsIdStart(int character); 29 | bool IsIdContinue(int character); 30 | bool IsXidStart(int character); 31 | bool IsXidContinue(int character); 32 | 33 | class CharacterCategoryMap { 34 | private: 35 | std::vector dense; 36 | public: 37 | CharacterCategoryMap(); 38 | CharacterCategory CategoryFor(int character) const { 39 | if (static_cast(character) < dense.size()) { 40 | return static_cast(dense[character]); 41 | } else { 42 | // binary search through ranges 43 | return CategoriseCharacter(character); 44 | } 45 | } 46 | int Size() const noexcept; 47 | void Optimize(int countCharacters); 48 | }; 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /scintilla/src/CharacterType.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterType.cxx 3 | ** Tests for character type and case-insensitive comparisons. 4 | **/ 5 | // Copyright 1998-2010 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | 11 | #include "CharacterType.h" 12 | 13 | using namespace Scintilla::Internal; 14 | 15 | namespace Scintilla::Internal { 16 | 17 | int CompareCaseInsensitive(const char *a, const char *b) noexcept { 18 | while (*a && *b) { 19 | if (*a != *b) { 20 | const char upperA = MakeUpperCase(*a); 21 | const char upperB = MakeUpperCase(*b); 22 | if (upperA != upperB) 23 | return upperA - upperB; 24 | } 25 | a++; 26 | b++; 27 | } 28 | // Either *a or *b is nul 29 | return *a - *b; 30 | } 31 | 32 | int CompareNCaseInsensitive(const char *a, const char *b, size_t len) noexcept { 33 | while (*a && *b && len) { 34 | if (*a != *b) { 35 | const char upperA = MakeUpperCase(*a); 36 | const char upperB = MakeUpperCase(*b); 37 | if (upperA != upperB) 38 | return upperA - upperB; 39 | } 40 | a++; 41 | b++; 42 | len--; 43 | } 44 | if (len == 0) 45 | return 0; 46 | else 47 | // Either *a or *b is nul 48 | return *a - *b; 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /scintilla/src/CharacterType.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file CharacterType.h 3 | ** Tests for character type and case-insensitive comparisons. 4 | **/ 5 | // Copyright 2007 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CHARACTERTYPE_H 9 | #define CHARACTERTYPE_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | // Functions for classifying characters 14 | 15 | /** 16 | * Check if a character is a space. 17 | * This is ASCII specific but is safe with chars >= 0x80. 18 | */ 19 | constexpr bool IsASpace(int ch) noexcept { 20 | return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); 21 | } 22 | 23 | constexpr bool IsSpaceOrTab(int ch) noexcept { 24 | return (ch == ' ') || (ch == '\t'); 25 | } 26 | 27 | constexpr bool IsControl(int ch) noexcept { 28 | return ((ch >= 0) && (ch <= 0x1F)) || (ch == 0x7F); 29 | } 30 | 31 | constexpr bool IsEOLCharacter(int ch) noexcept { 32 | return ch == '\r' || ch == '\n'; 33 | } 34 | 35 | constexpr bool IsBreakSpace(int ch) noexcept { 36 | // used for text breaking, treat C0 control character as space. 37 | // by default C0 control character is handled as special representation, 38 | // so not appears in normal text. 0x7F DEL is omitted to simplify the code. 39 | return ch >= 0 && ch <= ' '; 40 | } 41 | 42 | constexpr bool IsADigit(int ch) noexcept { 43 | return (ch >= '0') && (ch <= '9'); 44 | } 45 | 46 | constexpr bool IsADigit(int ch, int base) noexcept { 47 | if (base <= 10) { 48 | return (ch >= '0') && (ch < '0' + base); 49 | } else { 50 | return ((ch >= '0') && (ch <= '9')) || 51 | ((ch >= 'A') && (ch < 'A' + base - 10)) || 52 | ((ch >= 'a') && (ch < 'a' + base - 10)); 53 | } 54 | } 55 | 56 | constexpr bool IsASCII(int ch) noexcept { 57 | return (ch >= 0) && (ch < 0x80); 58 | } 59 | 60 | constexpr bool IsLowerCase(int ch) noexcept { 61 | return (ch >= 'a') && (ch <= 'z'); 62 | } 63 | 64 | constexpr bool IsUpperCase(int ch) noexcept { 65 | return (ch >= 'A') && (ch <= 'Z'); 66 | } 67 | 68 | constexpr bool IsUpperOrLowerCase(int ch) noexcept { 69 | return IsUpperCase(ch) || IsLowerCase(ch); 70 | } 71 | 72 | constexpr bool IsAlphaNumeric(int ch) noexcept { 73 | return 74 | ((ch >= '0') && (ch <= '9')) || 75 | ((ch >= 'a') && (ch <= 'z')) || 76 | ((ch >= 'A') && (ch <= 'Z')); 77 | } 78 | 79 | constexpr bool IsPunctuation(int ch) noexcept { 80 | switch (ch) { 81 | case '!': 82 | case '"': 83 | case '#': 84 | case '$': 85 | case '%': 86 | case '&': 87 | case '\'': 88 | case '(': 89 | case ')': 90 | case '*': 91 | case '+': 92 | case ',': 93 | case '-': 94 | case '.': 95 | case '/': 96 | case ':': 97 | case ';': 98 | case '<': 99 | case '=': 100 | case '>': 101 | case '?': 102 | case '@': 103 | case '[': 104 | case '\\': 105 | case ']': 106 | case '^': 107 | case '_': 108 | case '`': 109 | case '{': 110 | case '|': 111 | case '}': 112 | case '~': 113 | return true; 114 | default: 115 | return false; 116 | } 117 | } 118 | 119 | // Simple case functions for ASCII supersets. 120 | 121 | template 122 | constexpr T MakeUpperCase(T ch) noexcept { 123 | if (ch < 'a' || ch > 'z') 124 | return ch; 125 | else 126 | return ch - 'a' + 'A'; 127 | } 128 | 129 | template 130 | constexpr T MakeLowerCase(T ch) noexcept { 131 | if (ch < 'A' || ch > 'Z') 132 | return ch; 133 | else 134 | return ch - 'A' + 'a'; 135 | } 136 | 137 | int CompareCaseInsensitive(const char *a, const char *b) noexcept; 138 | int CompareNCaseInsensitive(const char *a, const char *b, size_t len) noexcept; 139 | 140 | } 141 | 142 | #endif 143 | -------------------------------------------------------------------------------- /scintilla/src/ContractionState.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ContractionState.h 3 | ** Manages visibility of lines for folding and wrapping. 4 | **/ 5 | // Copyright 1998-2007 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef CONTRACTIONSTATE_H 9 | #define CONTRACTIONSTATE_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | /** 14 | */ 15 | class IContractionState { 16 | public: 17 | virtual ~IContractionState() {}; 18 | 19 | virtual void Clear()=0; 20 | 21 | virtual Sci::Line LinesInDoc() const noexcept=0; 22 | virtual Sci::Line LinesDisplayed() const noexcept=0; 23 | virtual Sci::Line DisplayFromDoc(Sci::Line lineDoc) const noexcept=0; 24 | virtual Sci::Line DisplayLastFromDoc(Sci::Line lineDoc) const noexcept=0; 25 | virtual Sci::Line DocFromDisplay(Sci::Line lineDisplay) const noexcept=0; 26 | 27 | virtual void InsertLines(Sci::Line lineDoc, Sci::Line lineCount)=0; 28 | virtual void DeleteLines(Sci::Line lineDoc, Sci::Line lineCount)=0; 29 | 30 | virtual bool GetVisible(Sci::Line lineDoc) const noexcept=0; 31 | virtual bool SetVisible(Sci::Line lineDocStart, Sci::Line lineDocEnd, bool isVisible)=0; 32 | virtual bool HiddenLines() const noexcept=0; 33 | 34 | virtual const char *GetFoldDisplayText(Sci::Line lineDoc) const noexcept=0; 35 | virtual bool SetFoldDisplayText(Sci::Line lineDoc, const char *text)=0; 36 | 37 | virtual bool GetExpanded(Sci::Line lineDoc) const noexcept=0; 38 | virtual bool SetExpanded(Sci::Line lineDoc, bool isExpanded)=0; 39 | virtual bool ExpandAll()=0; 40 | virtual Sci::Line ContractedNext(Sci::Line lineDocStart) const noexcept =0; 41 | 42 | virtual int GetHeight(Sci::Line lineDoc) const noexcept=0; 43 | virtual bool SetHeight(Sci::Line lineDoc, int height)=0; 44 | 45 | virtual void ShowAll() noexcept=0; 46 | }; 47 | 48 | std::unique_ptr ContractionStateCreate(bool largeDocument); 49 | 50 | } 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /scintilla/src/DBCS.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file DBCS.cxx 3 | ** Functions to handle DBCS double byte encodings like Shift-JIS. 4 | **/ 5 | // Copyright 2017 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include "DBCS.h" 9 | 10 | using namespace Scintilla::Internal; 11 | 12 | namespace Scintilla::Internal { 13 | 14 | bool DBCSIsLeadByte(int codePage, char ch) noexcept { 15 | // Byte ranges found in Wikipedia articles with relevant search strings in each case 16 | const unsigned char uch = ch; 17 | switch (codePage) { 18 | case 932: 19 | // Shift_jis 20 | return ((uch >= 0x81) && (uch <= 0x9F)) || 21 | ((uch >= 0xE0) && (uch <= 0xFC)); 22 | // Lead bytes F0 to FC may be a Microsoft addition. 23 | case 936: 24 | // GBK 25 | return (uch >= 0x81) && (uch <= 0xFE); 26 | case 949: 27 | // Korean Wansung KS C-5601-1987 28 | return (uch >= 0x81) && (uch <= 0xFE); 29 | case 950: 30 | // Big5 31 | return (uch >= 0x81) && (uch <= 0xFE); 32 | case 1361: 33 | // Korean Johab KS C-5601-1992 34 | return 35 | ((uch >= 0x84) && (uch <= 0xD3)) || 36 | ((uch >= 0xD8) && (uch <= 0xDE)) || 37 | ((uch >= 0xE0) && (uch <= 0xF9)); 38 | } 39 | return false; 40 | } 41 | 42 | bool IsDBCSValidSingleByte(int codePage, int ch) noexcept { 43 | switch (codePage) { 44 | case 932: 45 | return ch == 0x80 46 | || (ch >= 0xA0 && ch <= 0xDF) 47 | || (ch >= 0xFD); 48 | 49 | default: 50 | return false; 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /scintilla/src/DBCS.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file DBCS.h 3 | ** Functions to handle DBCS double byte encodings like Shift-JIS. 4 | **/ 5 | // Copyright 2017 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef DBCS_H 9 | #define DBCS_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | constexpr bool IsDBCSCodePage(int codePage) noexcept { 14 | return codePage == 932 15 | || codePage == 936 16 | || codePage == 949 17 | || codePage == 950 18 | || codePage == 1361; 19 | } 20 | 21 | bool DBCSIsLeadByte(int codePage, char ch) noexcept; 22 | bool IsDBCSValidSingleByte(int codePage, int ch) noexcept; 23 | 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /scintilla/src/Debugging.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Debugging.h 3 | ** Assert and debug trace functions. 4 | ** Implemented in each platform layer. 5 | **/ 6 | // Copyright 1998-2009 by Neil Hodgson 7 | // The License.txt file describes the conditions under which this software may be distributed. 8 | 9 | #ifndef DEBUGGING_H 10 | #define DEBUGGING_H 11 | 12 | namespace Scintilla::Internal { 13 | 14 | #if defined(__clang__) 15 | # if __has_feature(attribute_analyzer_noreturn) 16 | # define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn)) 17 | # else 18 | # define CLANG_ANALYZER_NORETURN 19 | # endif 20 | #else 21 | # define CLANG_ANALYZER_NORETURN 22 | #endif 23 | 24 | /** 25 | * Platform namespace used to segregate debugging functions. 26 | */ 27 | namespace Platform { 28 | 29 | void DebugDisplay(const char *s) noexcept; 30 | void DebugPrintf(const char *format, ...) noexcept; 31 | bool ShowAssertionPopUps(bool assertionPopUps_) noexcept; 32 | void Assert(const char *c, const char *file, int line) noexcept CLANG_ANALYZER_NORETURN; 33 | 34 | } 35 | 36 | #ifdef NDEBUG 37 | #define PLATFORM_ASSERT(c) ((void)0) 38 | #else 39 | #define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Internal::Platform::Assert(#c, __FILE__, __LINE__)) 40 | #endif 41 | 42 | } 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /scintilla/src/Decoration.h: -------------------------------------------------------------------------------- 1 | /** @file Decoration.h 2 | ** Visual elements added over text. 3 | **/ 4 | // Copyright 1998-2007 by Neil Hodgson 5 | // The License.txt file describes the conditions under which this software may be distributed. 6 | 7 | #ifndef DECORATION_H 8 | #define DECORATION_H 9 | 10 | namespace Scintilla::Internal { 11 | 12 | class IDecoration { 13 | public: 14 | virtual ~IDecoration() {} 15 | virtual bool Empty() const noexcept = 0; 16 | virtual int Indicator() const noexcept = 0; 17 | virtual Sci::Position Length() const noexcept = 0; 18 | virtual int ValueAt(Sci::Position position) const noexcept = 0; 19 | virtual Sci::Position StartRun(Sci::Position position) const noexcept = 0; 20 | virtual Sci::Position EndRun(Sci::Position position) const noexcept = 0; 21 | virtual void SetValueAt(Sci::Position position, int value) = 0; 22 | virtual void InsertSpace(Sci::Position position, Sci::Position insertLength) = 0; 23 | virtual Sci::Position Runs() const noexcept = 0; 24 | }; 25 | 26 | class IDecorationList { 27 | public: 28 | virtual ~IDecorationList() {} 29 | 30 | virtual const std::vector &View() const noexcept = 0; 31 | 32 | virtual void SetCurrentIndicator(int indicator) = 0; 33 | virtual int GetCurrentIndicator() const noexcept = 0; 34 | 35 | virtual void SetCurrentValue(int value) noexcept = 0; 36 | virtual int GetCurrentValue() const noexcept = 0; 37 | 38 | // Returns with changed=true if some values may have changed 39 | virtual FillResult FillRange(Sci::Position position, int value, Sci::Position fillLength) = 0; 40 | virtual void InsertSpace(Sci::Position position, Sci::Position insertLength) = 0; 41 | virtual void DeleteRange(Sci::Position position, Sci::Position deleteLength) = 0; 42 | virtual void DeleteLexerDecorations() = 0; 43 | 44 | virtual int AllOnFor(Sci::Position position) const noexcept = 0; 45 | virtual int ValueAt(int indicator, Sci::Position position) noexcept = 0; 46 | virtual Sci::Position Start(int indicator, Sci::Position position) noexcept = 0; 47 | virtual Sci::Position End(int indicator, Sci::Position position) noexcept = 0; 48 | 49 | virtual bool ClickNotified() const noexcept = 0; 50 | virtual void SetClickNotified(bool notified) noexcept = 0; 51 | }; 52 | 53 | std::unique_ptr DecorationCreate(bool largeDocument, int indicator); 54 | 55 | std::unique_ptr DecorationListCreate(bool largeDocument); 56 | 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /scintilla/src/EditModel.cxx: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file EditModel.cxx 3 | ** Defines the editor state that must be visible to EditorView. 4 | **/ 5 | // Copyright 1998-2014 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | #include "ScintillaTypes.h" 26 | #include "ILoader.h" 27 | #include "ILexer.h" 28 | 29 | #include "Debugging.h" 30 | #include "Geometry.h" 31 | #include "Platform.h" 32 | 33 | #include "CharacterCategoryMap.h" 34 | 35 | #include "Position.h" 36 | #include "UniqueString.h" 37 | #include "SplitVector.h" 38 | #include "Partitioning.h" 39 | #include "RunStyles.h" 40 | #include "ContractionState.h" 41 | #include "CellBuffer.h" 42 | #include "Indicator.h" 43 | #include "LineMarker.h" 44 | #include "Style.h" 45 | #include "ViewStyle.h" 46 | #include "CharClassify.h" 47 | #include "Decoration.h" 48 | #include "CaseFolder.h" 49 | #include "Document.h" 50 | #include "UniConversion.h" 51 | #include "Selection.h" 52 | #include "PositionCache.h" 53 | #include "EditModel.h" 54 | 55 | using namespace Scintilla; 56 | using namespace Scintilla::Internal; 57 | 58 | Caret::Caret() noexcept : 59 | active(false), on(false), period(500) {} 60 | 61 | EditModel::EditModel() : braces{} { 62 | inOverstrike = false; 63 | xOffset = 0; 64 | trackLineWidth = false; 65 | posDrag = SelectionPosition(Sci::invalidPosition); 66 | braces[0] = Sci::invalidPosition; 67 | braces[1] = Sci::invalidPosition; 68 | bracesMatchStyle = StyleBraceBad; 69 | highlightGuideColumn = 0; 70 | hasFocus = false; 71 | primarySelection = true; 72 | imeInteraction = IMEInteraction::Windowed; 73 | bidirectional = Bidirectional::Disabled; 74 | foldFlags = FoldFlag::None; 75 | foldDisplayTextStyle = FoldDisplayTextStyle::Hidden; 76 | hotspot = Range(Sci::invalidPosition); 77 | hotspotSingleLine = true; 78 | hoverIndicatorPos = Sci::invalidPosition; 79 | wrapWidth = LineLayout::wrapWidthInfinite; 80 | pdoc = new Document(DocumentOption::Default); 81 | pdoc->AddRef(); 82 | pcs = ContractionStateCreate(pdoc->IsLarge()); 83 | } 84 | 85 | EditModel::~EditModel() { 86 | try { 87 | // This never throws but isn't marked noexcept for compatibility 88 | pdoc->Release(); 89 | } catch (...) { 90 | // Ignore any exception 91 | } 92 | pdoc = nullptr; 93 | } 94 | 95 | bool EditModel::BidirectionalEnabled() const noexcept { 96 | return (bidirectional != Bidirectional::Disabled) && 97 | (CpUtf8 == pdoc->dbcsCodePage); 98 | } 99 | 100 | bool EditModel::BidirectionalR2L() const noexcept { 101 | return bidirectional == Bidirectional::R2L; 102 | } 103 | 104 | SurfaceMode EditModel::CurrentSurfaceMode() const noexcept { 105 | return SurfaceMode(pdoc->dbcsCodePage, BidirectionalR2L()); 106 | } 107 | 108 | void EditModel::SetDefaultFoldDisplayText(const char *text) { 109 | defaultFoldDisplayText = IsNullOrEmpty(text) ? UniqueString() : UniqueStringCopy(text); 110 | } 111 | 112 | const char *EditModel::GetDefaultFoldDisplayText() const noexcept { 113 | return defaultFoldDisplayText.get(); 114 | } 115 | 116 | const char *EditModel::GetFoldDisplayText(Sci::Line lineDoc) const noexcept { 117 | if (foldDisplayTextStyle == FoldDisplayTextStyle::Hidden || pcs->GetExpanded(lineDoc)) { 118 | return nullptr; 119 | } 120 | 121 | const char *text = pcs->GetFoldDisplayText(lineDoc); 122 | return text ? text : defaultFoldDisplayText.get(); 123 | } 124 | 125 | InSelection EditModel::LineEndInSelection(Sci::Line lineDoc) const { 126 | const Sci::Position posAfterLineEnd = pdoc->LineStart(lineDoc + 1); 127 | return sel.InSelectionForEOL(posAfterLineEnd); 128 | } 129 | 130 | int EditModel::GetMark(Sci::Line line) const { 131 | return pdoc->GetMark(line, FlagSet(changeHistoryOption, ChangeHistoryOption::Markers)); 132 | } 133 | -------------------------------------------------------------------------------- /scintilla/src/EditModel.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file EditModel.h 3 | ** Defines the editor state that must be visible to EditorView. 4 | **/ 5 | // Copyright 1998-2014 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef EDITMODEL_H 9 | #define EDITMODEL_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | /** 14 | */ 15 | class Caret { 16 | public: 17 | bool active; 18 | bool on; 19 | int period; 20 | 21 | Caret() noexcept; 22 | }; 23 | 24 | class EditModel { 25 | public: 26 | bool inOverstrike; 27 | int xOffset; ///< Horizontal scrolled amount in pixels 28 | bool trackLineWidth; 29 | 30 | SpecialRepresentations reprs; 31 | Caret caret; 32 | SelectionPosition posDrag; 33 | Sci::Position braces[2]; 34 | int bracesMatchStyle; 35 | int highlightGuideColumn; 36 | bool hasFocus; 37 | Selection sel; 38 | bool primarySelection; 39 | 40 | Scintilla::IMEInteraction imeInteraction; 41 | Scintilla::Bidirectional bidirectional; 42 | 43 | Scintilla::FoldFlag foldFlags; 44 | Scintilla::FoldDisplayTextStyle foldDisplayTextStyle; 45 | UniqueString defaultFoldDisplayText; 46 | std::unique_ptr pcs; 47 | // Hotspot support 48 | Range hotspot; 49 | bool hotspotSingleLine; 50 | Sci::Position hoverIndicatorPos; 51 | 52 | Scintilla::ChangeHistoryOption changeHistoryOption = Scintilla::ChangeHistoryOption::Disabled; 53 | 54 | // Wrapping support 55 | int wrapWidth; 56 | 57 | Document *pdoc; 58 | 59 | EditModel(); 60 | // Deleted so EditModel objects can not be copied. 61 | EditModel(const EditModel &) = delete; 62 | EditModel(EditModel &&) = delete; 63 | EditModel &operator=(const EditModel &) = delete; 64 | EditModel &operator=(EditModel &&) = delete; 65 | virtual ~EditModel(); 66 | virtual Sci::Line TopLineOfMain() const noexcept = 0; 67 | virtual Point GetVisibleOriginInMain() const = 0; 68 | virtual Sci::Line LinesOnScreen() const = 0; 69 | bool BidirectionalEnabled() const noexcept; 70 | bool BidirectionalR2L() const noexcept; 71 | SurfaceMode CurrentSurfaceMode() const noexcept; 72 | void SetDefaultFoldDisplayText(const char *text); 73 | const char *GetDefaultFoldDisplayText() const noexcept; 74 | const char *GetFoldDisplayText(Sci::Line lineDoc) const noexcept; 75 | InSelection LineEndInSelection(Sci::Line lineDoc) const; 76 | [[nodiscard]] int GetMark(Sci::Line line) const; 77 | }; 78 | 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /scintilla/src/ElapsedPeriod.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file ElapsedPeriod.h 3 | ** Encapsulate C++ to simplify use. 4 | **/ 5 | // Copyright 2018 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef ELAPSEDPERIOD_H 9 | #define ELAPSEDPERIOD_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | // Simplified access to high precision timing. 14 | class ElapsedPeriod { 15 | using ElapsedClock = std::chrono::steady_clock; 16 | ElapsedClock::time_point tp; 17 | public: 18 | /// Capture the moment 19 | ElapsedPeriod() noexcept : tp(ElapsedClock::now()) { 20 | } 21 | /// Return duration as floating point seconds 22 | double Duration(bool reset=false) noexcept { 23 | const ElapsedClock::time_point tpNow = ElapsedClock::now(); 24 | const std::chrono::duration duration = 25 | std::chrono::duration_cast>(tpNow - tp); 26 | if (reset) { 27 | tp = tpNow; 28 | } 29 | return duration.count(); 30 | } 31 | }; 32 | 33 | } 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /scintilla/src/Indicator.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Indicator.h 3 | ** Defines the style of indicators which are text decorations such as underlining. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef INDICATOR_H 9 | #define INDICATOR_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | struct StyleAndColour { 14 | Scintilla::IndicatorStyle style; 15 | ColourRGBA fore; 16 | StyleAndColour() noexcept : style(Scintilla::IndicatorStyle::Plain), fore(0, 0, 0) { 17 | } 18 | StyleAndColour(Scintilla::IndicatorStyle style_, ColourRGBA fore_ = ColourRGBA(0, 0, 0)) noexcept : style(style_), fore(fore_) { 19 | } 20 | bool operator==(const StyleAndColour &other) const noexcept { 21 | return (style == other.style) && (fore == other.fore); 22 | } 23 | }; 24 | 25 | /** 26 | */ 27 | class Indicator { 28 | public: 29 | enum class State { normal, hover }; 30 | StyleAndColour sacNormal; 31 | StyleAndColour sacHover; 32 | bool under; 33 | int fillAlpha; 34 | int outlineAlpha; 35 | Scintilla::IndicFlag attributes; 36 | XYPOSITION strokeWidth = 1.0f; 37 | Indicator() noexcept : under(false), fillAlpha(30), outlineAlpha(50), attributes(Scintilla::IndicFlag::None) { 38 | } 39 | Indicator(Scintilla::IndicatorStyle style_, ColourRGBA fore_= ColourRGBA(0,0,0), bool under_=false, int fillAlpha_=30, int outlineAlpha_=50) noexcept : 40 | sacNormal(style_, fore_), sacHover(style_, fore_), under(under_), fillAlpha(fillAlpha_), outlineAlpha(outlineAlpha_), attributes(Scintilla::IndicFlag::None) { 41 | } 42 | void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine, const PRectangle &rcCharacter, State drawState, int value) const; 43 | bool IsDynamic() const noexcept { 44 | return !(sacNormal == sacHover); 45 | } 46 | bool OverridesTextFore() const noexcept { 47 | return sacNormal.style == Scintilla::IndicatorStyle::TextFore || sacHover.style == Scintilla::IndicatorStyle::TextFore; 48 | } 49 | Scintilla::IndicFlag Flags() const noexcept { 50 | return attributes; 51 | } 52 | void SetFlags(Scintilla::IndicFlag attributes_) noexcept; 53 | }; 54 | 55 | } 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /scintilla/src/KeyMap.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file KeyMap.h 3 | ** Defines a mapping between keystrokes and commands. 4 | **/ 5 | // Copyright 1998-2001 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef KEYMAP_H 9 | #define KEYMAP_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | #define SCI_NORM KeyMod::Norm 14 | #define SCI_SHIFT KeyMod::Shift 15 | #define SCI_CTRL KeyMod::Ctrl 16 | #define SCI_ALT KeyMod::Alt 17 | #define SCI_META KeyMod::Meta 18 | #define SCI_SUPER KeyMod::Super 19 | #define SCI_CSHIFT (KeyMod::Ctrl | KeyMod::Shift) 20 | #define SCI_ASHIFT (KeyMod::Alt | KeyMod::Shift) 21 | 22 | /** 23 | */ 24 | class KeyModifiers { 25 | public: 26 | Scintilla::Keys key; 27 | Scintilla::KeyMod modifiers; 28 | KeyModifiers() noexcept : key{}, modifiers(KeyMod::Norm) { 29 | }; 30 | KeyModifiers(Scintilla::Keys key_, Scintilla::KeyMod modifiers_) noexcept : key(key_), modifiers(modifiers_) { 31 | } 32 | bool operator<(const KeyModifiers &other) const noexcept { 33 | if (key == other.key) 34 | return modifiers < other.modifiers; 35 | else 36 | return key < other.key; 37 | } 38 | }; 39 | 40 | /** 41 | */ 42 | class KeyToCommand { 43 | public: 44 | Scintilla::Keys key; 45 | Scintilla::KeyMod modifiers; 46 | Scintilla::Message msg; 47 | }; 48 | 49 | /** 50 | */ 51 | class KeyMap { 52 | std::map kmap; 53 | static const KeyToCommand MapDefault[]; 54 | 55 | public: 56 | KeyMap(); 57 | void Clear() noexcept; 58 | void AssignCmdKey(Scintilla::Keys key, Scintilla::KeyMod modifiers, Scintilla::Message msg); 59 | Scintilla::Message Find(Scintilla::Keys key, Scintilla::KeyMod modifiers) const; // 0 returned on failure 60 | const std::map &GetKeyMap() const noexcept; 61 | }; 62 | 63 | } 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /scintilla/src/LineMarker.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file LineMarker.h 3 | ** Defines the look of a line marker in the margin . 4 | **/ 5 | // Copyright 1998-2011 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef LINEMARKER_H 9 | #define LINEMARKER_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | class XPM; 14 | class RGBAImage; 15 | 16 | typedef void (*DrawLineMarkerFn)(Surface *surface, const PRectangle &rcWhole, const Font *fontForCharacter, int tFold, Scintilla::MarginType marginStyle, const void *lineMarker); 17 | 18 | /** 19 | */ 20 | class LineMarker { 21 | public: 22 | enum class FoldPart { undefined, head, body, tail, headWithTail }; 23 | 24 | Scintilla::MarkerSymbol markType = Scintilla::MarkerSymbol::Circle; 25 | ColourRGBA fore = ColourRGBA(0, 0, 0); 26 | ColourRGBA back = ColourRGBA(0xff, 0xff, 0xff); 27 | ColourRGBA backSelected = ColourRGBA(0xff, 0x00, 0x00); 28 | Scintilla::Layer layer = Scintilla::Layer::Base; 29 | Scintilla::Alpha alpha = Scintilla::Alpha::NoAlpha; 30 | XYPOSITION strokeWidth = 1.0f; 31 | std::unique_ptr pxpm; 32 | std::unique_ptr image; 33 | /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native 34 | * Draw function for drawing line markers. Allow those platforms to override 35 | * it instead of creating a new method(s) in the Surface class that existing 36 | * platforms must implement as empty. */ 37 | DrawLineMarkerFn customDraw = nullptr; 38 | 39 | LineMarker() noexcept = default; 40 | LineMarker(const LineMarker &other); 41 | LineMarker(LineMarker &&) noexcept = default; 42 | LineMarker &operator=(const LineMarker& other); 43 | LineMarker &operator=(LineMarker&&) noexcept = default; 44 | virtual ~LineMarker() = default; 45 | 46 | ColourRGBA BackWithAlpha() const noexcept; 47 | 48 | void SetXPM(const char *textForm); 49 | void SetXPM(const char *const *linesForm); 50 | void SetRGBAImage(Point sizeRGBAImage, float scale, const unsigned char *pixelsRGBAImage); 51 | void AlignedPolygon(Surface *surface, const Point *pts, size_t npts) const; 52 | void Draw(Surface *surface, const PRectangle &rcWhole, const Font *fontForCharacter, FoldPart part, Scintilla::MarginType marginStyle) const; 53 | void DrawFoldingMark(Surface *surface, const PRectangle &rcWhole, FoldPart part) const; 54 | }; 55 | 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /scintilla/src/MarginView.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file MarginView.h 3 | ** Defines the appearance of the editor margin. 4 | **/ 5 | // Copyright 1998-2014 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef MARGINVIEW_H 9 | #define MARGINVIEW_H 10 | 11 | namespace Scintilla::Internal { 12 | 13 | void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourRGBA wrapColour); 14 | 15 | typedef void (*DrawWrapMarkerFn)(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourRGBA wrapColour); 16 | 17 | /** 18 | * MarginView draws the margins. 19 | */ 20 | class MarginView { 21 | public: 22 | std::unique_ptr pixmapSelMargin; 23 | std::unique_ptr pixmapSelPattern; 24 | std::unique_ptr pixmapSelPatternOffset1; 25 | // Highlight current folding block 26 | HighlightDelimiter highlightDelimiter; 27 | 28 | int wrapMarkerPaddingRight; // right-most pixel padding of wrap markers 29 | /** Some platforms, notably PLAT_CURSES, do not support Scintilla's native 30 | * DrawWrapMarker function for drawing wrap markers. Allow those platforms to 31 | * override it instead of creating a new method in the Surface class that 32 | * existing platforms must implement as empty. */ 33 | DrawWrapMarkerFn customDrawWrapMarker; 34 | 35 | MarginView() noexcept; 36 | 37 | void DropGraphics() noexcept; 38 | void RefreshPixMaps(Surface *surfaceWindow, const ViewStyle &vsDraw); 39 | void PaintOneMargin(Surface *surface, PRectangle rc, PRectangle rcOneMargin, const MarginStyle &marginStyle, 40 | const EditModel &model, const ViewStyle &vs) const; 41 | void PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc, PRectangle rcMargin, 42 | const EditModel &model, const ViewStyle &vs); 43 | }; 44 | 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /scintilla/src/Position.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file Position.h 3 | ** Defines global type name Position in the Sci internal namespace. 4 | **/ 5 | // Copyright 2015 by Neil Hodgson 6 | // The License.txt file describes the conditions under which this software may be distributed. 7 | 8 | #ifndef POSITION_H 9 | #define POSITION_H 10 | 11 | /** 12 | * A Position is a position within a document between two characters or at the beginning or end. 13 | * Sometimes used as a character index where it identifies the character after the position. 14 | * A Line is a document or screen line. 15 | */ 16 | 17 | namespace Sci { 18 | 19 | typedef ptrdiff_t Position; 20 | typedef ptrdiff_t Line; 21 | 22 | inline constexpr Position invalidPosition = -1; 23 | 24 | } 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /scintilla/src/RESearch.h: -------------------------------------------------------------------------------- 1 | // Scintilla source code edit control 2 | /** @file RESearch.h 3 | ** Interface to the regular expression search library. 4 | **/ 5 | // Written by Neil Hodgson 6 | // Based on the work of Ozan S. Yigit. 7 | // This file is in the public domain. 8 | 9 | #ifndef RESEARCH_H 10 | #define RESEARCH_H 11 | 12 | namespace Scintilla::Internal { 13 | 14 | class CharacterIndexer { 15 | public: 16 | virtual char CharAt(Sci::Position index) const=0; 17 | virtual ~CharacterIndexer() { 18 | } 19 | }; 20 | 21 | class RESearch { 22 | 23 | public: 24 | explicit RESearch(CharClassify *charClassTable); 25 | // No dynamic allocation so default copy constructor and assignment operator are OK. 26 | void Clear() noexcept; 27 | void GrabMatches(const CharacterIndexer &ci); 28 | const char *Compile(const char *pattern, Sci::Position length, bool caseSensitive, bool posix) noexcept; 29 | int Execute(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp); 30 | 31 | static constexpr int MAXTAG = 10; 32 | static constexpr int NOTFOUND = -1; 33 | 34 | Sci::Position bopat[MAXTAG]; 35 | Sci::Position eopat[MAXTAG]; 36 | std::string pat[MAXTAG]; 37 | 38 | private: 39 | 40 | static constexpr int MAXNFA = 4096; 41 | // The following constants are not meant to be changeable. 42 | // They are for readability only. 43 | static constexpr int MAXCHR = 256; 44 | static constexpr int CHRBIT = 8; 45 | static constexpr int BITBLK = MAXCHR / CHRBIT; 46 | 47 | void ChSet(unsigned char c) noexcept; 48 | void ChSetWithCase(unsigned char c, bool caseSensitive) noexcept; 49 | int GetBackslashExpression(const char *pattern, int &incr) noexcept; 50 | 51 | Sci::Position PMatch(const CharacterIndexer &ci, Sci::Position lp, Sci::Position endp, char *ap); 52 | 53 | Sci::Position bol; 54 | Sci::Position tagstk[MAXTAG]; /* subpat tag stack */ 55 | char nfa[MAXNFA]; /* automaton */ 56 | int sta; 57 | unsigned char bittab[BITBLK]; /* bit table for CCL pre-set bits */ 58 | int failure; 59 | CharClassify *charClass; 60 | bool iswordc(unsigned char x) const noexcept { 61 | return charClass->IsWord(x); 62 | } 63 | }; 64 | 65 | } 66 | 67 | #endif 68 | 69 | -------------------------------------------------------------------------------- /scintilla/src/RunStyles.h: -------------------------------------------------------------------------------- 1 | /** @file RunStyles.h 2 | ** Data structure used to store sparse styles. 3 | **/ 4 | // Copyright 1998-2007 by Neil Hodgson 5 | // The License.txt file describes the conditions under which this software may be distributed. 6 | 7 | /// Styling buffer using one element for each run rather than using 8 | /// a filled buffer. 9 | 10 | #ifndef RUNSTYLES_H 11 | #define RUNSTYLES_H 12 | 13 | namespace Scintilla::Internal { 14 | 15 | // Return for RunStyles::FillRange reports if anything was changed and the 16 | // range that was changed. This may be trimmed from the requested range 17 | // when some of the requested range already had the requested value. 18 | template 19 | struct FillResult { 20 | bool changed; 21 | DISTANCE position; 22 | DISTANCE fillLength; 23 | }; 24 | 25 | template 26 | class RunStyles { 27 | private: 28 | Partitioning starts; 29 | SplitVector