Initial commit: ReclassX structured binary editor

This commit is contained in:
sysadmin
2026-02-01 11:37:32 -07:00
commit 0be67c8396
786 changed files with 473499 additions and 0 deletions

21
third_party/qscintilla/src/.qmake.stash vendored Normal file
View File

@@ -0,0 +1,21 @@
QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 11
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
QMAKE_CXX.COMPILER_MACROS = \
QT_COMPILER_STDCXX \
QMAKE_GCC_MAJOR_VERSION \
QMAKE_GCC_MINOR_VERSION \
QMAKE_GCC_PATCH_VERSION
QMAKE_CXX.INCDIRS = \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++ \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/x86_64-w64-mingw32 \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include/c++/backward \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0/include-fixed \
C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/include
QMAKE_CXX.LIBDIRS = \
C:/Qt/Tools/mingw1120_64/lib/gcc/x86_64-w64-mingw32/11.2.0 \
C:/Qt/Tools/mingw1120_64/lib/gcc \
C:/Qt/Tools/mingw1120_64/x86_64-w64-mingw32/lib \
C:/Qt/Tools/mingw1120_64/lib

View File

@@ -0,0 +1,273 @@
// Copyright (c) 2021 Riverbank Computing Limited
// Copyright (c) 2011 Archaeopteryx Software, Inc.
// Copyright (c) 1990-2011, Scientific Toolworks, Inc.
//
// The License.txt file describes the conditions under which this software may
// be distributed.
#include <qglobal.h>
#include <QColor>
#include <QFont>
#include <QInputMethodEvent>
#include <QRect>
#include <QTextCharFormat>
#include <QTextFormat>
#include <QVariant>
#include <QVarLengthArray>
#include "Qsci/qsciscintillabase.h"
#include "ScintillaQt.h"
#define INDIC_INPUTMETHOD 24
#define MAXLENINPUTIME 200
#define SC_INDICATOR_INPUT INDIC_IME
#define SC_INDICATOR_TARGET INDIC_IME+1
#define SC_INDICATOR_CONVERTED INDIC_IME+2
#define SC_INDICATOR_UNKNOWN INDIC_IME_MAX
static bool IsHangul(const QChar qchar)
{
int unicode = (int)qchar.unicode();
// Korean character ranges used for preedit chars.
// http://www.programminginkorean.com/programming/hangul-in-unicode/
const bool HangulJamo = (0x1100 <= unicode && unicode <= 0x11FF);
const bool HangulCompatibleJamo = (0x3130 <= unicode && unicode <= 0x318F);
const bool HangulJamoExtendedA = (0xA960 <= unicode && unicode <= 0xA97F);
const bool HangulJamoExtendedB = (0xD7B0 <= unicode && unicode <= 0xD7FF);
const bool HangulSyllable = (0xAC00 <= unicode && unicode <= 0xD7A3);
return HangulJamo || HangulCompatibleJamo || HangulSyllable ||
HangulJamoExtendedA || HangulJamoExtendedB;
}
static void MoveImeCarets(QsciScintillaQt *sqt, int offset)
{
// Move carets relatively by bytes
for (size_t r=0; r < sqt->sel.Count(); r++) {
int positionInsert = sqt->sel.Range(r).Start().Position();
sqt->sel.Range(r).caret.SetPosition(positionInsert + offset);
sqt->sel.Range(r).anchor.SetPosition(positionInsert + offset);
}
}
static void DrawImeIndicator(QsciScintillaQt *sqt, int indicator, int len)
{
// Emulate the visual style of IME characters with indicators.
// Draw an indicator on the character before caret by the character bytes of len
// so it should be called after AddCharUTF().
// It does not affect caret positions.
if (indicator < 8 || indicator > INDIC_MAX) {
return;
}
sqt->pdoc->DecorationSetCurrentIndicator(indicator);
for (size_t r=0; r< sqt-> sel.Count(); r++) {
int positionInsert = sqt->sel.Range(r).Start().Position();
sqt->pdoc->DecorationFillRange(positionInsert - len, 1, len);
}
}
static int GetImeCaretPos(QInputMethodEvent *event)
{
foreach (QInputMethodEvent::Attribute attr, event->attributes()) {
if (attr.type == QInputMethodEvent::Cursor)
return attr.start;
}
return 0;
}
static std::vector<int> MapImeIndicators(QInputMethodEvent *event)
{
std::vector<int> imeIndicator(event->preeditString().size(), SC_INDICATOR_UNKNOWN);
foreach (QInputMethodEvent::Attribute attr, event->attributes()) {
if (attr.type == QInputMethodEvent::TextFormat) {
QTextFormat format = attr.value.value<QTextFormat>();
QTextCharFormat charFormat = format.toCharFormat();
int indicator = SC_INDICATOR_UNKNOWN;
switch (charFormat.underlineStyle()) {
case QTextCharFormat::NoUnderline: // win32, linux
indicator = SC_INDICATOR_TARGET;
break;
case QTextCharFormat::SingleUnderline: // osx
case QTextCharFormat::DashUnderline: // win32, linux
indicator = SC_INDICATOR_INPUT;
break;
case QTextCharFormat::DotLine:
case QTextCharFormat::DashDotLine:
case QTextCharFormat::WaveUnderline:
case QTextCharFormat::SpellCheckUnderline:
indicator = SC_INDICATOR_CONVERTED;
break;
default:
indicator = SC_INDICATOR_UNKNOWN;
}
if (format.hasProperty(QTextFormat::BackgroundBrush)) // win32, linux
indicator = SC_INDICATOR_TARGET;
#ifdef Q_OS_OSX
if (charFormat.underlineStyle() == QTextCharFormat::SingleUnderline) {
QColor uc = charFormat.underlineColor();
if (uc.lightness() < 2) { // osx
indicator = SC_INDICATOR_TARGET;
}
}
#endif
for (int i = attr.start; i < attr.start+attr.length; i++) {
imeIndicator[i] = indicator;
}
}
}
return imeIndicator;
}
void QsciScintillaBase::inputMethodEvent(QInputMethodEvent *event)
{
// Copy & paste by johnsonj with a lot of helps of Neil
// Great thanks for my forerunners, jiniya and BLUEnLIVE
if (sci->pdoc->IsReadOnly() || sci->SelectionContainsProtected()) {
// Here, a canceling and/or completing composition function is needed.
return;
}
bool initialCompose = false;
if (sci->pdoc->TentativeActive()) {
sci->pdoc->TentativeUndo();
} else {
// No tentative undo means start of this composition so
// Fill in any virtual spaces.
initialCompose = true;
}
sci->view.imeCaretBlockOverride = false;
if (!event->commitString().isEmpty()) {
const QString commitStr = event->commitString();
const int commitStrLen = commitStr.length();
for (int i = 0; i < commitStrLen;) {
const int ucWidth = commitStr.at(i).isHighSurrogate() ? 2 : 1;
const QString oneCharUTF16 = commitStr.mid(i, ucWidth);
const QByteArray oneChar = textAsBytes(oneCharUTF16);
const int oneCharLen = oneChar.length();
sci->AddCharUTF(oneChar.data(), oneChar.length());
i += ucWidth;
}
} else if (!event->preeditString().isEmpty()) {
const QString preeditStr = event->preeditString();
const int preeditStrLen = preeditStr.length();
if (preeditStrLen == 0) {
sci->ShowCaretAtCurrentPosition();
return;
}
if (initialCompose)
sci->ClearBeforeTentativeStart();
sci->pdoc->TentativeStart(); // TentativeActive() from now on.
std::vector<int> imeIndicator = MapImeIndicators(event);
for (unsigned int i = 0; i < preeditStrLen;) {
const unsigned int ucWidth = preeditStr.at(i).isHighSurrogate() ? 2 : 1;
const QString oneCharUTF16 = preeditStr.mid(i, ucWidth);
const QByteArray oneChar = textAsBytes(oneCharUTF16);
const int oneCharLen = oneChar.length();
sci->AddCharUTF(oneChar.data(), oneCharLen);
DrawImeIndicator(sci, imeIndicator[i], oneCharLen);
i += ucWidth;
}
// Move IME carets.
int imeCaretPos = GetImeCaretPos(event);
int imeEndToImeCaretU16 = imeCaretPos - preeditStrLen;
int imeCaretPosDoc = sci->pdoc->GetRelativePositionUTF16(sci->CurrentPosition(), imeEndToImeCaretU16);
MoveImeCarets(sci, - sci->CurrentPosition() + imeCaretPosDoc);
if (IsHangul(preeditStr.at(0))) {
#ifndef Q_OS_WIN
if (imeCaretPos > 0) {
int oneCharBefore = sci->pdoc->GetRelativePosition(sci->CurrentPosition(), -1);
MoveImeCarets(sci, - sci->CurrentPosition() + oneCharBefore);
}
#endif
sci->view.imeCaretBlockOverride = true;
}
// Set candidate box position for Qt::ImCursorRectangle.
preeditPos = sci->CurrentPosition();
sci->EnsureCaretVisible();
updateMicroFocus();
}
sci->ShowCaretAtCurrentPosition();
}
QVariant QsciScintillaBase::inputMethodQuery(Qt::InputMethodQuery query) const
{
int pos = SendScintilla(SCI_GETCURRENTPOS);
int line = SendScintilla(SCI_LINEFROMPOSITION, pos);
switch (query) {
case Qt::ImHints:
return QWidget::inputMethodQuery(query);
case Qt::ImCursorRectangle:
{
int startPos = (preeditPos >= 0) ? preeditPos : pos;
Scintilla::Point pt = sci->LocationFromPosition(startPos);
int width = SendScintilla(SCI_GETCARETWIDTH);
int height = SendScintilla(SCI_TEXTHEIGHT, line);
return QRect(pt.x, pt.y, width, height);
}
case Qt::ImFont:
{
char fontName[64];
int style = SendScintilla(SCI_GETSTYLEAT, pos);
int len = SendScintilla(SCI_STYLEGETFONT, style, (sptr_t)fontName);
int size = SendScintilla(SCI_STYLEGETSIZE, style);
bool italic = SendScintilla(SCI_STYLEGETITALIC, style);
int weight = SendScintilla(SCI_STYLEGETBOLD, style) ? QFont::Bold : -1;
return QFont(QString::fromUtf8(fontName, len), size, weight, italic);
}
case Qt::ImCursorPosition:
{
int paraStart = sci->pdoc->ParaUp(pos);
return pos - paraStart;
}
case Qt::ImSurroundingText:
{
int paraStart = sci->pdoc->ParaUp(pos);
int paraEnd = sci->pdoc->ParaDown(pos);
QVarLengthArray<char,1024> buffer(paraEnd - paraStart + 1);
SendScintilla(SCI_GETTEXTRANGE, paraStart, paraEnd, buffer.data());
return bytesAsText(buffer.constData(), buffer.size());
}
case Qt::ImCurrentSelection:
{
QVarLengthArray<char,1024> buffer(SendScintilla(SCI_GETSELTEXT) + 1);
SendScintilla(SCI_GETSELTEXT, 0, (sptr_t)buffer.data());
return bytesAsText(buffer.constData(), buffer.size() - 1);
}
default:
return QVariant();
}
}

367
third_party/qscintilla/src/ListBoxQt.cpp vendored Normal file
View File

@@ -0,0 +1,367 @@
// This module implements the specialisation of QListBox that handles the
// Scintilla double-click callback.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "ListBoxQt.h"
#include <stdlib.h>
#include <QApplication>
#include "SciClasses.h"
#include "Qsci/qsciscintilla.h"
QsciListBoxQt::QsciListBoxQt()
: slb(0), visible_rows(5), utf8(false), delegate(0)
{
}
void QsciListBoxQt::SetFont(Scintilla::Font &font)
{
QFont *f = reinterpret_cast<QFont *>(font.GetID());
if (f)
slb->setFont(*f);
}
void QsciListBoxQt::Create(Scintilla::Window &parent, int, Scintilla::Point,
int, bool unicodeMode, int)
{
utf8 = unicodeMode;
// The parent we want is the QsciScintillaBase, not the text area.
wid = slb = new QsciSciListBox(reinterpret_cast<QWidget *>(parent.GetID())->parentWidget(), this);
}
void QsciListBoxQt::SetAverageCharWidth(int)
{
// We rely on sizeHint() for the size of the list box rather than make
// calculations based on the average character width and the number of
// visible rows.
}
void QsciListBoxQt::SetVisibleRows(int vrows)
{
// We only pretend to implement this.
visible_rows = vrows;
}
int QsciListBoxQt::GetVisibleRows() const
{
return visible_rows;
}
Scintilla::PRectangle QsciListBoxQt::GetDesiredRect()
{
Scintilla::PRectangle rc(0, 0, 100, 100);
if (slb)
{
int rows = slb->count();
if (rows == 0 || rows > visible_rows)
rows = visible_rows;
int row_height = slb->sizeHintForRow(0);
int height = (rows * row_height) + (2 * slb->frameWidth());
int width = slb->sizeHintForColumn(0) + (2 * slb->frameWidth());
if (slb->count() > rows)
width += QApplication::style()->pixelMetric(
QStyle::PM_ScrollBarExtent);
rc.right = width;
rc.bottom = height;
}
return rc;
}
int QsciListBoxQt::CaretFromEdge()
{
int dist = 0;
// Find the width of the biggest image.
for (xpmMap::const_iterator it = xset.begin(); it != xset.end(); ++it)
{
int w = it.value().width();
if (dist < w)
dist = w;
}
if (slb)
dist += slb->frameWidth();
// Fudge factor - adjust if required.
dist += 3;
return dist;
}
void QsciListBoxQt::Clear()
{
Q_ASSERT(slb);
slb->clear();
}
void QsciListBoxQt::Append(char *s, int type)
{
Q_ASSERT(slb);
QString qs;
if (utf8)
qs = QString::fromUtf8(s);
else
qs = QString::fromLatin1(s);
xpmMap::const_iterator it;
if (type < 0 || (it = xset.find(type)) == xset.end())
slb->addItem(qs);
else
slb->addItemPixmap(it.value(), qs);
}
int QsciListBoxQt::Length()
{
Q_ASSERT(slb);
return slb->count();
}
void QsciListBoxQt::Select(int n)
{
Q_ASSERT(slb);
slb->setCurrentRow(n);
selectionChanged();
}
int QsciListBoxQt::GetSelection()
{
Q_ASSERT(slb);
return slb->currentRow();
}
int QsciListBoxQt::Find(const char *prefix)
{
Q_ASSERT(slb);
return slb->find(prefix);
}
void QsciListBoxQt::GetValue(int n, char *value, int len)
{
Q_ASSERT(slb);
QString selection = slb->text(n);
bool trim_selection = false;
QObject *sci_obj = slb->parent();
if (sci_obj->inherits("QsciScintilla"))
{
QsciScintilla *sci = static_cast<QsciScintilla *>(sci_obj);
if (sci->isAutoCompletionList())
{
// Save the full selection and trim the value we return.
sci->acSelection = selection;
trim_selection = true;
}
}
if (selection.isEmpty() || len <= 0)
value[0] = '\0';
else
{
const char *s;
int slen;
QByteArray bytes;
if (utf8)
bytes = selection.toUtf8();
else
bytes = selection.toLatin1();
s = bytes.data();
slen = bytes.length();
while (slen-- && len--)
{
if (trim_selection && *s == ' ')
break;
*value++ = *s++;
}
*value = '\0';
}
}
void QsciListBoxQt::Sort()
{
Q_ASSERT(slb);
slb->sortItems();
}
void QsciListBoxQt::RegisterImage(int type, const char *xpm_data)
{
xset.insert(type, *reinterpret_cast<const QPixmap *>(xpm_data));
}
void QsciListBoxQt::RegisterRGBAImage(int type, int, int,
const unsigned char *pixelsImage)
{
QPixmap pm;
pm.convertFromImage(*reinterpret_cast<const QImage *>(pixelsImage));
xset.insert(type, pm);
}
void QsciListBoxQt::ClearRegisteredImages()
{
xset.clear();
}
void QsciListBoxQt::SetDelegate(Scintilla::IListBoxDelegate *lbDelegate)
{
delegate = lbDelegate;
}
void QsciListBoxQt::handleDoubleClick()
{
if (delegate)
{
Scintilla::ListBoxEvent event(
Scintilla::ListBoxEvent::EventType::doubleClick);
delegate->ListNotify(&event);
}
}
void QsciListBoxQt::handleRelease()
{
selectionChanged();
}
void QsciListBoxQt::selectionChanged()
{
if (delegate)
{
Scintilla::ListBoxEvent event(
Scintilla::ListBoxEvent::EventType::selectionChange);
delegate->ListNotify(&event);
}
}
void QsciListBoxQt::SetList(const char *list, char separator, char typesep)
{
char *words;
Clear();
if ((words = qstrdup(list)) != NULL)
{
char *startword = words;
char *numword = NULL;
for (int i = 0; words[i] != '\0'; i++)
{
if (words[i] == separator)
{
words[i] = '\0';
if (numword)
*numword = '\0';
Append(startword, numword ? atoi(numword + 1) : -1);
startword = words + i + 1;
numword = NULL;
}
else if (words[i] == typesep)
{
numword = words + i;
}
}
if (startword)
{
if (numword)
*numword = '\0';
Append(startword, numword ? atoi(numword + 1) : -1);
}
delete[] words;
}
}
// The ListBox methods that need to be implemented explicitly.
Scintilla::ListBox::ListBox() noexcept
{
}
Scintilla::ListBox::~ListBox()
{
}
Scintilla::ListBox *Scintilla::ListBox::Allocate()
{
return new QsciListBoxQt();
}

76
third_party/qscintilla/src/ListBoxQt.h vendored Normal file
View File

@@ -0,0 +1,76 @@
// This defines the specialisation of QListBox that handles the Scintilla
// double-click callback.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <qmap.h>
#include <qpixmap.h>
#include <qstring.h>
#include "Platform.h"
class QsciSciListBox;
// This is an internal class but it is referenced by a public class so it has
// to have a Qsci prefix rather than being put in the Scintilla namespace.
// However the reason for avoiding this no longer applies.
class QsciListBoxQt : public Scintilla::ListBox
{
public:
QsciListBoxQt();
virtual void SetFont(Scintilla::Font &font);
virtual void Create(Scintilla::Window &parent, int, Scintilla::Point, int,
bool unicodeMode, int);
virtual void SetAverageCharWidth(int);
virtual void SetVisibleRows(int);
virtual int GetVisibleRows() const;
virtual Scintilla::PRectangle GetDesiredRect();
virtual int CaretFromEdge();
virtual void Clear();
virtual void Append(char *s, int type = -1);
virtual int Length();
virtual void Select(int n);
virtual int GetSelection();
virtual int Find(const char *prefix);
virtual void GetValue(int n, char *value, int len);
virtual void Sort();
virtual void RegisterImage(int type, const char *xpm_data);
virtual void RegisterRGBAImage(int type, int width, int height,
const unsigned char *pixelsImage);
virtual void ClearRegisteredImages();
virtual void SetDelegate(Scintilla::IListBoxDelegate *lbDelegate);
virtual void SetList(const char *list, char separator, char typesep);
void handleDoubleClick();
void handleRelease();
private:
QsciSciListBox *slb;
int visible_rows;
bool utf8;
Scintilla::IListBoxDelegate *delegate;
typedef QMap<int, QPixmap> xpmMap;
xpmMap xset;
void selectionChanged();
};

View File

@@ -0,0 +1,111 @@
// This module implements part of the support for rectangular selections on
// macOS. It is a separate file to avoid clashes between macOS and Scintilla
// data types.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <qglobal.h>
#if QT_VERSION < 0x060000 && defined(Q_OS_OSX)
#include <QByteArray>
#include <QLatin1String>
#include <QList>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QMacPasteboardMime>
static const QLatin1String mimeRectangular("text/x-qscintilla-rectangular");
static const QLatin1String utiRectangularMac("com.scintilla.utf16-plain-text.rectangular");
class RectangularPasteboardMime : public QMacPasteboardMime
{
public:
RectangularPasteboardMime() : QMacPasteboardMime(MIME_ALL)
{
}
bool canConvert(const QString &mime, QString flav)
{
return mime == mimeRectangular && flav == utiRectangularMac;
}
QList<QByteArray> convertFromMime(const QString &, QVariant data, QString)
{
QList<QByteArray> converted;
converted.append(data.toByteArray());
return converted;
}
QVariant convertToMime(const QString &, QList<QByteArray> data, QString)
{
QByteArray converted;
foreach (QByteArray i, data)
{
converted += i;
}
return QVariant(converted);
}
QString convertorName()
{
return QString("QScintillaRectangular");
}
QString flavorFor(const QString &mime)
{
if (mime == mimeRectangular)
return QString(utiRectangularMac);
return QString();
}
QString mimeFor(QString flav)
{
if (flav == utiRectangularMac)
return QString(mimeRectangular);
return QString();
}
};
// Initialise the singleton instance.
void initialiseRectangularPasteboardMime()
{
static RectangularPasteboardMime *instance = 0;
if (!instance)
{
instance = new RectangularPasteboardMime();
qRegisterDraggedTypes(QStringList(utiRectangularMac));
}
}
#endif

448
third_party/qscintilla/src/Makefile vendored Normal file
View File

@@ -0,0 +1,448 @@
#############################################################################
# Makefile for building: libqscintilla2_qt6
# Generated by qmake (3.1) (Qt 6.5.2)
# Project: qscintilla.pro
# Template: lib
# Command: C:/Qt/6.5.2/mingw_64/bin/qmake.exe -o Makefile qscintilla.pro CONFIG+=staticlib
#############################################################################
MAKEFILE = Makefile
EQ = =
first: release
install: release-install
uninstall: release-uninstall
QMAKE = C:/Qt/6.5.2/mingw_64/bin/qmake.exe
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = cp -f
INSTALL_PROGRAM = cp -f
INSTALL_DIR = cp -f -R
QINSTALL = C:/Qt/6.5.2/mingw_64/bin/qmake.exe -install qinstall
QINSTALL_PROGRAM = C:/Qt/6.5.2/mingw_64/bin/qmake.exe -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = $(QMAKE) -install ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
IDC = idc
IDL = midl
ZIP =
DEF_FILE =
RES_FILE =
SED = sed
MOVE = mv -f
SUBTARGETS = \
release \
debug
release: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Release
release-all: FORCE
$(MAKE) -f $(MAKEFILE).Release all
release-clean: FORCE
$(MAKE) -f $(MAKEFILE).Release clean
release-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Release distclean
release-install: FORCE
$(MAKE) -f $(MAKEFILE).Release install
release-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Release uninstall
debug: FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-make_first: FORCE
$(MAKE) -f $(MAKEFILE).Debug
debug-all: FORCE
$(MAKE) -f $(MAKEFILE).Debug all
debug-clean: FORCE
$(MAKE) -f $(MAKEFILE).Debug clean
debug-distclean: FORCE
$(MAKE) -f $(MAKEFILE).Debug distclean
debug-install: FORCE
$(MAKE) -f $(MAKEFILE).Debug install
debug-uninstall: FORCE
$(MAKE) -f $(MAKEFILE).Debug uninstall
Makefile: qscintilla.pro C:/Qt/6.5.2/mingw_64/mkspecs/win32-g++/qmake.conf C:/Qt/6.5.2/mingw_64/mkspecs/features/spec_pre.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/device_config.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/common/sanitize.conf \
C:/Qt/6.5.2/mingw_64/mkspecs/common/gcc-base.conf \
C:/Qt/6.5.2/mingw_64/mkspecs/common/g++-base.conf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/windows_vulkan_sdk.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/common/windows-vulkan.conf \
C:/Qt/6.5.2/mingw_64/mkspecs/common/g++-win32.conf \
C:/Qt/6.5.2/mingw_64/mkspecs/common/windows-desktop.conf \
C:/Qt/6.5.2/mingw_64/mkspecs/qconfig.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_ext_freetype.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_ext_libjpeg.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_ext_libpng.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_concurrent.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_concurrent_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core5compat.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core5compat_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_dbus.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_dbus_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_designer.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_designer_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_designercomponents_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_entrypoint_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_example_icons_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_fb_support_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_freetype_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_gui.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_gui_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_harfbuzz_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_help.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_help_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_httpserver.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_httpserver_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_jpeg_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsanimation.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsanimation_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsfolderlistmodel.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsfolderlistmodel_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsqmlmodels.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsqmlmodels_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssettings.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssettings_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssharedimage.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssharedimage_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labswavefrontmesh.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labswavefrontmesh_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_linguist.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_linguist_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_network.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_network_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_opengl.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_opengl_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_openglwidgets.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_openglwidgets_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_packetprotocol_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_png_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioning.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioning_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioningquick.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioningquick_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_printsupport.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_printsupport_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qml.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qml_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlcompiler_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlcore.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlcore_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmldebug_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmldom_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlintegration.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlintegration_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmllocalstorage.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmllocalstorage_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlmodels.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlmodels_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmltest.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmltest_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmltyperegistrar_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlworkerscript.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlworkerscript_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlxmllistmodel.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlxmllistmodel_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quick.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quick_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2impl.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2impl_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrolstestutilsprivate_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2quickimpl.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2quickimpl_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2utils.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2utils_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickeffects_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicklayouts.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicklayouts_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickparticles_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickshapes_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktemplates2.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktestutilsprivate_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktimeline.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktimeline_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickwidgets.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickwidgets_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_shadertools.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_shadertools_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_sql.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_sql_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svg.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svg_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svgwidgets.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svgwidgets_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_testlib.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_testlib_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_tools_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_uiplugin.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_uitools.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_uitools_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webchannel.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webchannel_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_websockets.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_websockets_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webview.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webview_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webviewquick.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webviewquick_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_widgets.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_widgets_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_xml.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_xml_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_zlib_private.pri \
C:/Qt/6.5.2/mingw_64/mkspecs/features/qt_functions.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/qt_config.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/win32-g++/qmake.conf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/spec_post.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/exclusive_builds.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/toolchain.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/default_pre.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/default_pre.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/resolve_config.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/exclusive_builds_post.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/default_post.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/exceptions.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/warn_off.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/qt.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/resources_functions.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/resources.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/moc.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/opengl.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/uic.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/entrypoint.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/precompile_header.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/qmake_use.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/file_copies.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/windows.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/testcase_targets.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/yacc.prf \
C:/Qt/6.5.2/mingw_64/mkspecs/features/lex.prf \
qscintilla.pro \
C:/Qt/6.5.2/mingw_64/lib/Qt6PrintSupport.prl \
C:/Qt/6.5.2/mingw_64/lib/Qt6Widgets.prl \
C:/Qt/6.5.2/mingw_64/lib/Qt6Gui.prl \
C:/Qt/6.5.2/mingw_64/lib/Qt6Core.prl \
.qmake.stash \
C:/Qt/6.5.2/mingw_64/mkspecs/features/build_pass.prf
$(QMAKE) -o Makefile qscintilla.pro CONFIG+=staticlib
C:/Qt/6.5.2/mingw_64/mkspecs/features/spec_pre.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/device_config.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/common/sanitize.conf:
C:/Qt/6.5.2/mingw_64/mkspecs/common/gcc-base.conf:
C:/Qt/6.5.2/mingw_64/mkspecs/common/g++-base.conf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/windows_vulkan_sdk.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/common/windows-vulkan.conf:
C:/Qt/6.5.2/mingw_64/mkspecs/common/g++-win32.conf:
C:/Qt/6.5.2/mingw_64/mkspecs/common/windows-desktop.conf:
C:/Qt/6.5.2/mingw_64/mkspecs/qconfig.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_ext_freetype.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_ext_libjpeg.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_ext_libpng.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_concurrent.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_concurrent_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core5compat.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core5compat_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_core_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_dbus.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_dbus_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_designer.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_designer_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_designercomponents_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_devicediscovery_support_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_entrypoint_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_example_icons_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_fb_support_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_freetype_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_gui.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_gui_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_harfbuzz_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_help.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_help_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_httpserver.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_httpserver_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_jpeg_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsanimation.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsanimation_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsfolderlistmodel.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsfolderlistmodel_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsqmlmodels.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labsqmlmodels_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssettings.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssettings_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssharedimage.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labssharedimage_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labswavefrontmesh.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_labswavefrontmesh_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_linguist.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_linguist_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_network.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_network_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_opengl.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_opengl_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_openglwidgets.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_openglwidgets_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_packetprotocol_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_png_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioning.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioning_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioningquick.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_positioningquick_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_printsupport.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_printsupport_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qml.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qml_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlcompiler_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlcore.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlcore_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmldebug_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmldom_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlintegration.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlintegration_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmllocalstorage.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmllocalstorage_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlmodels.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlmodels_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmltest.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmltest_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmltyperegistrar_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlworkerscript.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlworkerscript_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlxmllistmodel.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_qmlxmllistmodel_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quick.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quick_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2impl.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrols2impl_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickcontrolstestutilsprivate_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2quickimpl.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2quickimpl_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2utils.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickdialogs2utils_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickeffects_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicklayouts.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicklayouts_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickparticles_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickshapes_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktemplates2.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktemplates2_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktestutilsprivate_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktimeline.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quicktimeline_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickwidgets.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_quickwidgets_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_shadertools.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_shadertools_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_sql.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_sql_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svg.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svg_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svgwidgets.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_svgwidgets_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_testlib.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_testlib_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_tools_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_uiplugin.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_uitools.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_uitools_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webchannel.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webchannel_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_websockets.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_websockets_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webview.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webview_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webviewquick.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_webviewquick_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_widgets.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_widgets_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_xml.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_xml_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/modules/qt_lib_zlib_private.pri:
C:/Qt/6.5.2/mingw_64/mkspecs/features/qt_functions.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/qt_config.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/win32-g++/qmake.conf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/spec_post.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/exclusive_builds.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/toolchain.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/default_pre.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/default_pre.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/resolve_config.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/exclusive_builds_post.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/default_post.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/exceptions.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/warn_off.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/qt.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/resources_functions.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/resources.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/moc.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/opengl.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/uic.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/entrypoint.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/precompile_header.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/qmake_use.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/file_copies.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/win32/windows.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/testcase_targets.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/yacc.prf:
C:/Qt/6.5.2/mingw_64/mkspecs/features/lex.prf:
qscintilla.pro:
C:/Qt/6.5.2/mingw_64/lib/Qt6PrintSupport.prl:
C:/Qt/6.5.2/mingw_64/lib/Qt6Widgets.prl:
C:/Qt/6.5.2/mingw_64/lib/Qt6Gui.prl:
C:/Qt/6.5.2/mingw_64/lib/Qt6Core.prl:
.qmake.stash:
C:/Qt/6.5.2/mingw_64/mkspecs/features/build_pass.prf:
qmake: FORCE
@$(QMAKE) -o Makefile qscintilla.pro CONFIG+=staticlib
qmake_all: FORCE
make_first: release-make_first debug-make_first FORCE
all: release-all debug-all FORCE
clean: release-clean debug-clean FORCE
distclean: release-distclean debug-distclean FORCE
-$(DEL_FILE) Makefile
-$(DEL_FILE) .qmake.stash
release-mocclean:
$(MAKE) -f $(MAKEFILE).Release mocclean
debug-mocclean:
$(MAKE) -f $(MAKEFILE).Debug mocclean
mocclean: release-mocclean debug-mocclean
release-mocables:
$(MAKE) -f $(MAKEFILE).Release mocables
debug-mocables:
$(MAKE) -f $(MAKEFILE).Debug mocables
mocables: release-mocables debug-mocables
check: first
benchmark: first
FORCE:
.SUFFIXES:
$(MAKEFILE).Release: Makefile
$(MAKEFILE).Debug: Makefile

20755
third_party/qscintilla/src/Makefile.Debug vendored Normal file

File diff suppressed because one or more lines are too long

20755
third_party/qscintilla/src/Makefile.Release vendored Normal file

File diff suppressed because one or more lines are too long

990
third_party/qscintilla/src/PlatQt.cpp vendored Normal file
View File

@@ -0,0 +1,990 @@
// This module implements the portability layer for the Qt port of Scintilla.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <qapplication.h>
#include <qcursor.h>
#include <qdatetime.h>
#include <qfont.h>
#include <qimage.h>
#include <qpainter.h>
#include <qpixmap.h>
#include <qpolygon.h>
#include <qscreen.h>
#include <qstring.h>
#include <qtextlayout.h>
#include <qwidget.h>
#if !defined(Q_OS_WASM)
#include <qlibrary.h>
#endif
#include "Platform.h"
#include "XPM.h"
#include "Qsci/qsciscintillabase.h"
#include "SciClasses.h"
#include "FontQuality.h"
namespace Scintilla {
// Type convertors.
static QFont *PFont(FontID fid)
{
return reinterpret_cast<QFont *>(fid);
}
static QWidget *PWindow(WindowID wid)
{
return reinterpret_cast<QWidget *>(wid);
}
static QsciSciPopup *PMenu(MenuID mid)
{
return reinterpret_cast<QsciSciPopup *>(mid);
}
// Font management.
Font::Font() noexcept : fid(0)
{
}
Font::~Font()
{
}
void Font::Create(const FontParameters &fp)
{
Release();
QFont *f = new QFont();
QFont::StyleStrategy strategy;
switch (fp.extraFontFlag & SC_EFF_QUALITY_MASK)
{
case SC_EFF_QUALITY_NON_ANTIALIASED:
strategy = QFont::NoAntialias;
break;
case SC_EFF_QUALITY_ANTIALIASED:
strategy = QFont::PreferAntialias;
break;
default:
strategy = QFont::PreferDefault;
}
f->setStyleStrategy(strategy);
f->setFamily(fp.faceName);
f->setPointSizeF(fp.size);
f->setItalic(fp.italic);
// Scintilla weights are between 1 and 100, Qt5 weights are between 0 and
// 99, and Qt6 weights match Scintilla. A negative weight is interpreted
// as an explicit Qt weight (ie. the back door).
#if QT_VERSION >= 0x060000
QFont::Weight qt_weight = static_cast<QFont::Weight>(abs(fp.weight));
#else
int qt_weight;
if (fp.weight < 0)
qt_weight = -fp.weight;
else if (fp.weight <= 200)
qt_weight = QFont::Light;
else if (fp.weight <= QsciScintillaBase::SC_WEIGHT_NORMAL)
qt_weight = QFont::Normal;
else if (fp.weight <= 600)
qt_weight = QFont::DemiBold;
else if (fp.weight <= 850)
qt_weight = QFont::Bold;
else
qt_weight = QFont::Black;
#endif
f->setWeight(qt_weight);
fid = f;
}
void Font::Release()
{
if (fid)
{
delete PFont(fid);
fid = 0;
}
}
// A surface abstracts a place to draw.
class SurfaceImpl : public Surface
{
public:
SurfaceImpl();
virtual ~SurfaceImpl();
void Init(WindowID wid);
void Init(SurfaceID sid, WindowID);
void Init(QPainter *p);
void InitPixMap(int width, int height, Surface *sid, WindowID wid);
void Release();
bool Initialised() {return painter;}
void PenColour(ColourDesired fore);
int LogPixelsY() {return pd->logicalDpiY();}
int DeviceHeightFont(int points) {return points;}
void MoveTo(int x_,int y_);
void LineTo(int x_,int y_);
void Polygon(Point *pts, size_t npts, ColourDesired fore,
ColourDesired back);
void RectangleDraw(PRectangle rc, ColourDesired fore,
ColourDesired back);
void FillRectangle(PRectangle rc, ColourDesired back);
void FillRectangle(PRectangle rc, Surface &surfacePattern);
void RoundedRectangle(PRectangle rc, ColourDesired fore,
ColourDesired back);
void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill,
int alphaFill, ColourDesired outline, int alphaOutline,
int flags);
void GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops,
GradientOptions options);
void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage);
void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back);
void Copy(PRectangle rc, Point from, Surface &surfaceSource);
void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore, ColourDesired back);
void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore, ColourDesired back);
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore);
void MeasureWidths(Font &font_, const char *s, int len,
XYPOSITION *positions);
XYPOSITION WidthText(Font &font_, const char *s, int len);
XYPOSITION Ascent(Font &font_);
XYPOSITION Descent(Font &font_);
XYPOSITION InternalLeading(Font &font_) {Q_UNUSED(font_); return 0;}
XYPOSITION Height(Font &font_);
XYPOSITION AverageCharWidth(Font &font_);
void SetClip(PRectangle rc);
void FlushCachedState();
void SetUnicodeMode(bool unicodeMode_) {unicodeMode = unicodeMode_;}
void SetDBCSMode(int codePage) {Q_UNUSED(codePage);}
void DrawXPM(PRectangle rc, const XPM *xpm);
private:
void drawRect(const PRectangle &rc);
void drawText(const PRectangle &rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore);
static QFont convertQFont(Font &font);
QFontMetricsF metrics(Font &font_);
QString convertText(const char *s, int len);
static QColor convertQColor(const ColourDesired &col,
unsigned alpha = 255);
bool unicodeMode;
QPaintDevice *pd;
QPainter *painter;
bool my_resources;
int pen_x, pen_y;
};
Surface *Surface::Allocate(int)
{
return new SurfaceImpl;
}
SurfaceImpl::SurfaceImpl()
: unicodeMode(false), pd(0), painter(0), my_resources(false), pen_x(0),
pen_y(0)
{
}
SurfaceImpl::~SurfaceImpl()
{
Release();
}
void SurfaceImpl::Init(WindowID wid)
{
Release();
pd = reinterpret_cast<QWidget *>(wid);
}
void SurfaceImpl::Init(SurfaceID sid, WindowID)
{
Release();
// This method, and the SurfaceID type, is only used when printing. As it
// is actually a void * we pass (when using SCI_FORMATRANGE) a pointer to a
// QPainter rather than a pointer to a SurfaceImpl as might be expected.
QPainter *p = reinterpret_cast<QPainter *>(sid);
pd = p->device();
painter = p;
}
void SurfaceImpl::Init(QPainter *p)
{
Release();
pd = p->device();
painter = p;
}
void SurfaceImpl::InitPixMap(int width, int height, Surface *sid, WindowID wid)
{
Release();
int dpr = PWindow(wid)->devicePixelRatio();
QPixmap *pixmap = new QPixmap(width * dpr, height * dpr);
pixmap->setDevicePixelRatio(dpr);
pd = pixmap;
painter = new QPainter(pd);
my_resources = true;
SetUnicodeMode(static_cast<SurfaceImpl *>(sid)->unicodeMode);
}
void SurfaceImpl::Release()
{
if (my_resources)
{
if (painter)
delete painter;
if (pd)
delete pd;
my_resources = false;
}
painter = 0;
pd = 0;
}
void SurfaceImpl::MoveTo(int x_, int y_)
{
Q_ASSERT(painter);
pen_x = x_;
pen_y = y_;
}
void SurfaceImpl::LineTo(int x_, int y_)
{
Q_ASSERT(painter);
painter->drawLine(pen_x, pen_y, x_, y_);
pen_x = x_;
pen_y = y_;
}
void SurfaceImpl::PenColour(ColourDesired fore)
{
Q_ASSERT(painter);
painter->setPen(convertQColor(fore));
}
void SurfaceImpl::Polygon(Point *pts, size_t npts, ColourDesired fore,
ColourDesired back)
{
Q_ASSERT(painter);
QPolygonF qpts(npts);
for (size_t i = 0; i < npts; ++i)
qpts[i] = QPointF(pts[i].x, pts[i].y);
painter->setPen(convertQColor(fore));
painter->setBrush(convertQColor(back));
painter->drawPolygon(qpts);
}
void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore,
ColourDesired back)
{
Q_ASSERT(painter);
painter->setPen(convertQColor(fore));
painter->setBrush(convertQColor(back));
drawRect(rc);
}
void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back)
{
Q_ASSERT(painter);
painter->setPen(Qt::NoPen);
painter->setBrush(convertQColor(back));
drawRect(rc);
}
void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern)
{
Q_ASSERT(painter);
SurfaceImpl &si = static_cast<SurfaceImpl &>(surfacePattern);
QPixmap *pm = static_cast<QPixmap *>(si.pd);
if (pm)
{
QBrush brsh(Qt::black, *pm);
painter->setPen(Qt::NoPen);
painter->setBrush(brsh);
drawRect(rc);
}
else
{
FillRectangle(rc, ColourDesired(0));
}
}
void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore,
ColourDesired back)
{
Q_ASSERT(painter);
painter->setPen(convertQColor(fore));
painter->setBrush(convertQColor(back));
painter->drawRoundedRect(
QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top),
25, 25, Qt::RelativeSize);
}
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
ColourDesired fill, int alphaFill, ColourDesired outline,
int alphaOutline, int)
{
Q_ASSERT(painter);
QColor outline_colour = convertQColor(outline, alphaOutline);
QColor fill_colour = convertQColor(fill, alphaFill);
// There was a report of Qt seeming to ignore the alpha value of the pen so
// so we disable the pen if the outline and fill colours are the same.
if (outline_colour == fill_colour)
painter->setPen(Qt::NoPen);
else
painter->setPen(outline_colour);
painter->setBrush(fill_colour);
const int radius = (cornerSize ? 25 : 0);
painter->drawRoundedRect(
QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top),
radius, radius, Qt::RelativeSize);
}
void SurfaceImpl::GradientRectangle(PRectangle rc,
const std::vector<ColourStop> &stops, GradientOptions options)
{
Q_ASSERT(painter);
QLinearGradient gradient;
switch (options)
{
case GradientOptions::leftToRight:
gradient = QLinearGradient(rc.left, rc.top, rc.right, rc.top);
break;
case GradientOptions::topToBottom:
default:
gradient = QLinearGradient(rc.left, rc.top, rc.left, rc.bottom);
}
gradient.setSpread(QGradient::RepeatSpread);
for (const ColourStop &stop : stops)
gradient.setColorAt(stop.position,
convertQColor(stop.colour, stop.colour.GetAlpha()));
painter->fillRect(
QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top),
QBrush(gradient));
}
void SurfaceImpl::drawRect(const PRectangle &rc)
{
painter->drawRect(
QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top));
}
void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore,
ColourDesired back)
{
Q_ASSERT(painter);
painter->setPen(convertQColor(fore));
painter->setBrush(convertQColor(back));
painter->drawEllipse(
QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top));
}
void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource)
{
Q_ASSERT(painter);
SurfaceImpl &si = static_cast<SurfaceImpl &>(surfaceSource);
if (si.pd)
{
QPixmap *pm = static_cast<QPixmap *>(si.pd);
qreal x = from.x;
qreal y = from.y;
qreal width = rc.right - rc.left;
qreal height = rc.bottom - rc.top;
qreal dpr = pm->devicePixelRatio();
x *= dpr;
y *= dpr;
width *= dpr;
height *= dpr;
painter->drawPixmap(QPointF(rc.left, rc.top), *pm,
QRectF(x, y, width, height));
}
}
void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore, ColourDesired back)
{
Q_ASSERT(painter);
FillRectangle(rc, back);
drawText(rc, font_, ybase, s, len, fore);
}
void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore, ColourDesired back)
{
Q_ASSERT(painter);
SetClip(rc);
DrawTextNoClip(rc, font_, ybase, s, len, fore, back);
painter->setClipping(false);
}
void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_,
XYPOSITION ybase, const char *s, int len, ColourDesired fore)
{
// Only draw if there is a non-space.
for (int i = 0; i < len; ++i)
if (s[i] != ' ')
{
drawText(rc, font_, ybase, s, len, fore);
return;
}
}
void SurfaceImpl::drawText(const PRectangle &rc, Font &font_, XYPOSITION ybase,
const char *s, int len, ColourDesired fore)
{
QString qs = convertText(s, len);
QFont *f = PFont(font_.GetID());
if (f)
painter->setFont(*f);
painter->setPen(convertQColor(fore));
painter->drawText(QPointF(rc.left, ybase), qs);
}
void SurfaceImpl::DrawXPM(PRectangle rc, const XPM *xpm)
{
Q_ASSERT(painter);
XYPOSITION x, y;
const QPixmap &qpm = xpm->Pixmap();
x = rc.left + (rc.Width() - qpm.width()) / 2.0;
y = rc.top + (rc.Height() - qpm.height()) / 2.0;
painter->drawPixmap(QPointF(x, y), qpm);
}
void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height,
const unsigned char *pixelsImage)
{
Q_UNUSED(width);
Q_UNUSED(height);
Q_ASSERT(painter);
const QImage *qim = reinterpret_cast<const QImage *>(pixelsImage);
painter->drawImage(QPointF(rc.left, rc.top), *qim);
}
void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len,
XYPOSITION *positions)
{
QString qs = convertText(s, len);
QTextLayout text_layout(qs, convertQFont(font_), pd);
text_layout.beginLayout();
QTextLine text_line = text_layout.createLine();
text_layout.endLayout();
if (unicodeMode)
{
int i_char = 0, i_byte = 0;;
while (i_char < qs.size())
{
unsigned char byte = s[i_byte];
int nbytes, code_units;
// Work out character sizes by looking at the byte stream.
if (byte >= 0xf0)
{
nbytes = 4;
code_units = 2;
}
else
{
if (byte >= 0xe0)
nbytes = 3;
else if (byte >= 0x80)
nbytes = 2;
else
nbytes = 1;
code_units = 1;
}
XYPOSITION position = text_line.cursorToX(i_char + code_units);
// Set the same position for each byte of the character.
for (int i = 0; i < nbytes && i_byte < len; ++i)
positions[i_byte++] = position;
i_char += code_units;
}
// This shouldn't be necessary...
XYPOSITION last_position = ((i_byte > 0) ? positions[i_byte - 1] : 0);
while (i_byte < len)
positions[i_byte++] = last_position;
}
else
{
for (int i = 0; i < len; ++i)
positions[i] = text_line.cursorToX(i + 1);
}
}
XYPOSITION SurfaceImpl::WidthText(Font &font_, const char *s, int len)
{
return metrics(font_).horizontalAdvance(convertText(s, len));
}
XYPOSITION SurfaceImpl::Ascent(Font &font_)
{
return metrics(font_).ascent();
}
XYPOSITION SurfaceImpl::Descent(Font &font_)
{
// Qt doesn't include the baseline in the descent, so add it. Note that
// a descent from Qt4 always seems to be 2 pixels larger (irrespective of
// font or size) than the same descent from Qt3. This means that text is a
// little more spaced out with Qt4 - and will be more noticeable with
// smaller fonts.
return metrics(font_).descent() + 1;
}
XYPOSITION SurfaceImpl::Height(Font &font_)
{
return metrics(font_).height();
}
XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_)
{
return metrics(font_).averageCharWidth();
}
void SurfaceImpl::SetClip(PRectangle rc)
{
Q_ASSERT(painter);
painter->setClipRect(
QRectF(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top));
}
void SurfaceImpl::FlushCachedState()
{
}
// Return the QFont for a Font.
QFont SurfaceImpl::convertQFont(Font &font)
{
QFont *f = PFont(font.GetID());
if (f)
return *f;
return QApplication::font();
}
// Get the metrics for a font.
QFontMetricsF SurfaceImpl::metrics(Font &font_)
{
QFont fnt = convertQFont(font_);
return QFontMetricsF(fnt, pd);
}
// Convert a Scintilla string to a Qt Unicode string.
QString SurfaceImpl::convertText(const char *s, int len)
{
if (unicodeMode)
return QString::fromUtf8(s, len);
return QString::fromLatin1(s, len);
}
// Convert a Scintilla colour, and alpha component, to a Qt QColor.
QColor SurfaceImpl::convertQColor(const ColourDesired &col, unsigned alpha)
{
int c = col.AsInteger();
unsigned r = c & 0xff;
unsigned g = (c >> 8) & 0xff;
unsigned b = (c >> 16) & 0xff;
return QColor(r, g, b, alpha);
}
// Window (widget) management.
Window::~Window()
{
}
void Window::Destroy()
{
QWidget *w = PWindow(wid);
if (w)
{
// Delete the widget next time round the event loop rather than
// straight away. This gets round a problem when auto-completion lists
// are cancelled after an entry has been double-clicked, ie. the list's
// dtor is called from one of the list's slots. There are other ways
// around the problem but this is the simplest and doesn't seem to
// cause problems of its own.
w->deleteLater();
wid = 0;
}
}
PRectangle Window::GetPosition() const
{
QWidget *w = PWindow(wid);
// Before any size allocated pretend its big enough not to be scrolled.
PRectangle rc(0,0,5000,5000);
if (w)
{
const QRect &r = w->geometry();
rc.right = r.right() - r.left() + 1;
rc.bottom = r.bottom() - r.top() + 1;
}
return rc;
}
void Window::SetPosition(PRectangle rc)
{
PWindow(wid)->setGeometry(rc.left, rc.top, rc.right - rc.left,
rc.bottom - rc.top);
}
void Window::SetPositionRelative(PRectangle rc, const Window *relativeTo)
{
QWidget *rel = PWindow(relativeTo->wid);
QPoint pos = rel->mapToGlobal(rel->pos());
int x = pos.x() + rc.left;
int y = pos.y() + rc.top;
PWindow(wid)->setGeometry(x, y, rc.right - rc.left, rc.bottom - rc.top);
}
PRectangle Window::GetClientPosition() const
{
return GetPosition();
}
void Window::Show(bool show)
{
QWidget *w = PWindow(wid);
if (show)
w->show();
else
w->hide();
}
void Window::InvalidateAll()
{
QWidget *w = PWindow(wid);
if (w)
w->update();
}
void Window::InvalidateRectangle(PRectangle rc)
{
QWidget *w = PWindow(wid);
if (w)
w->update(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top);
}
void Window::SetFont(Font &font)
{
PWindow(wid)->setFont(*PFont(font.GetID()));
}
void Window::SetCursor(Cursor curs)
{
Qt::CursorShape qc;
switch (curs)
{
case cursorText:
qc = Qt::IBeamCursor;
break;
case cursorUp:
qc = Qt::UpArrowCursor;
break;
case cursorWait:
qc = Qt::WaitCursor;
break;
case cursorHoriz:
qc = Qt::SizeHorCursor;
break;
case cursorVert:
qc = Qt::SizeVerCursor;
break;
case cursorHand:
qc = Qt::PointingHandCursor;
break;
default:
// Note that Qt doesn't have a standard cursor that could be used to
// implement cursorReverseArrow.
qc = Qt::ArrowCursor;
}
PWindow(wid)->setCursor(qc);
}
PRectangle Window::GetMonitorRect(Point pt)
{
QPoint qpt = PWindow(wid)->mapToGlobal(QPoint(pt.x, pt.y));
QRect qr = QApplication::screenAt(qpt)->availableGeometry();
qpt = PWindow(wid)->mapFromGlobal(qr.topLeft());
return PRectangle(qpt.x(), qpt.y(), qpt.x() + qr.width(), qpt.y() + qr.height());
}
// Menu management.
Menu::Menu() noexcept : mid(0)
{
}
void Menu::CreatePopUp()
{
Destroy();
mid = new QsciSciPopup();
}
void Menu::Destroy()
{
QsciSciPopup *m = PMenu(mid);
if (m)
{
delete m;
mid = 0;
}
}
void Menu::Show(Point pt, Window &)
{
PMenu(mid)->popup(QPoint(pt.x, pt.y));
}
class DynamicLibraryImpl : public DynamicLibrary
{
public:
DynamicLibraryImpl(const char *modulePath)
{
#if !defined(Q_OS_WASM)
m = new QLibrary(modulePath);
m->load();
#endif
}
virtual ~DynamicLibraryImpl()
{
#if !defined(Q_OS_WASM)
if (m)
delete m;
#endif
}
virtual Function FindFunction(const char *name)
{
#if !defined(Q_OS_WASM)
if (m)
return (Function)m->resolve(name);
#endif
return 0;
}
virtual bool IsValid()
{
#if !defined(Q_OS_WASM)
return m && m->isLoaded();
#else
return false;
#endif
}
private:
#if !defined(Q_OS_WASM)
QLibrary* m;
#endif
};
DynamicLibrary *DynamicLibrary::Load(const char *modulePath)
{
return new DynamicLibraryImpl(modulePath);
}
// Manage system wide parameters.
ColourDesired Platform::Chrome()
{
return ColourDesired(0xe0,0xe0,0xe0);
}
ColourDesired Platform::ChromeHighlight()
{
return ColourDesired(0xff,0xff,0xff);
}
const char *Platform::DefaultFont()
{
static QByteArray def_font;
def_font = QApplication::font().family().toLatin1();
return def_font.constData();
}
int Platform::DefaultFontSize()
{
return QApplication::font().pointSize();
}
unsigned int Platform::DoubleClickTime()
{
return QApplication::doubleClickInterval();
}
void Platform::DebugDisplay(const char *s)
{
qDebug("%s", s);
}
//#define TRACE
#ifdef TRACE
void Platform::DebugPrintf(const char *format, ...)
{
char buffer[2000];
va_list pArguments;
va_start(pArguments, format);
vsprintf(buffer, format, pArguments);
va_end(pArguments);
DebugDisplay(buffer);
}
#else
void Platform::DebugPrintf(const char *, ...)
{
}
#endif
static bool assertionPopUps = true;
bool Platform::ShowAssertionPopUps(bool assertionPopUps_)
{
bool ret = assertionPopUps;
assertionPopUps = assertionPopUps_;
return ret;
}
void Platform::Assert(const char *c, const char *file, int line)
{
qFatal("Assertion [%s] failed at %s %d\n", c, file, line);
}
}

View File

@@ -0,0 +1,90 @@
// This module defines interface to the QsciAbstractAPIs class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCIABSTRACTAPIS_H
#define QSCIABSTRACTAPIS_H
#include <QList>
#include <QObject>
#include <QStringList>
#include <Qsci/qsciglobal.h>
#include <Qsci/qsciscintilla.h>
class QsciLexer;
//! \brief The QsciAbstractAPIs class represents the interface to the textual
//! API information used in call tips and for auto-completion. A sub-class
//! will provide the actual implementation of the interface.
//!
//! API information is specific to a particular language lexer but can be
//! shared by multiple instances of the lexer.
class QSCINTILLA_EXPORT QsciAbstractAPIs : public QObject
{
Q_OBJECT
public:
//! Constructs a QsciAbstractAPIs instance attached to lexer \a lexer. \a
//! lexer becomes the instance's parent object although the instance can
//! also be subsequently attached to other lexers.
QsciAbstractAPIs(QsciLexer *lexer);
//! Destroy the QsciAbstractAPIs instance.
virtual ~QsciAbstractAPIs();
//! Return the lexer that the instance is attached to.
QsciLexer *lexer() const;
//! Update the list \a list with API entries derived from \a context. \a
//! context is the list of words in the text preceding the cursor position.
//! The characters that make up a word and the characters that separate
//! words are defined by the lexer. The last word is a partial word and
//! may be empty if the user has just entered a word separator.
virtual void updateAutoCompletionList(const QStringList &context,
QStringList &list) = 0;
//! This is called when the user selects the entry \a selection from the
//! auto-completion list. A sub-class can use this as a hint to provide
//! more specific API entries in future calls to
//! updateAutoCompletionList(). The default implementation does nothing.
virtual void autoCompletionSelected(const QString &selection);
//! Return the call tips valid for the context \a context. (Note that the
//! last word of the context will always be empty.) \a commas is the number
//! of commas the user has typed after the context and before the cursor
//! position. The exact position of the list of call tips can be adjusted
//! by specifying a corresponding left character shift in \a shifts. This
//! is normally done to correct for any displayed context according to \a
//! style.
//!
//! \sa updateAutoCompletionList()
virtual QStringList callTips(const QStringList &context, int commas,
QsciScintilla::CallTipsStyle style, QList<int> &shifts) = 0;
private:
QsciLexer *lex;
QsciAbstractAPIs(const QsciAbstractAPIs &);
QsciAbstractAPIs &operator=(const QsciAbstractAPIs &);
};
#endif

View File

@@ -0,0 +1,213 @@
// This module defines interface to the QsciAPIs class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCIAPIS_H
#define QSCIAPIS_H
#include <QList>
#include <QObject>
#include <QPair>
#include <QStringList>
#include <Qsci/qsciabstractapis.h>
#include <Qsci/qsciglobal.h>
#include <Qsci/qsciscintilla.h>
class QsciAPIsPrepared;
class QsciAPIsWorker;
class QsciLexer;
//! \brief The QsciAPIs class provies an implementation of the textual API
//! information used in call tips and for auto-completion.
//!
//! Raw API information is read from one or more files. Each API function is
//! described by a single line of text comprising the function's name, followed
//! by the function's optional comma separated parameters enclosed in
//! parenthesis, and finally followed by optional explanatory text.
//!
//! A function name may be followed by a `?' and a number. The number is used
//! by auto-completion to display a registered QPixmap with the function name.
//!
//! All function names are used by auto-completion, but only those that include
//! function parameters are used in call tips.
//!
//! QScintilla only deals with prepared API information and not the raw
//! information described above. This is done so that large APIs can be
//! handled while still being responsive to user input. The conversion of raw
//! information to prepared information is time consuming (think tens of
//! seconds) and implemented in a separate thread. Prepared information can
//! be quickly saved to and loaded from files. Such files are portable between
//! different architectures.
//!
//! QScintilla based applications that want to support large APIs would
//! normally provide the user with the ability to specify a set of, possibly
//! project specific, raw API files and convert them to prepared files that are
//! loaded quickly when the application is invoked.
class QSCINTILLA_EXPORT QsciAPIs : public QsciAbstractAPIs
{
Q_OBJECT
public:
//! Constructs a QsciAPIs instance attached to lexer \a lexer. \a lexer
//! becomes the instance's parent object although the instance can also be
//! subsequently attached to other lexers.
QsciAPIs(QsciLexer *lexer);
//! Destroy the QsciAPIs instance.
virtual ~QsciAPIs();
//! Add the single raw API entry \a entry to the current set.
//!
//! \sa clear(), load(), remove()
void add(const QString &entry);
//! Deletes all raw API information.
//!
//! \sa add(), load(), remove()
void clear();
//! Load the API information from the file named \a filename, adding it to
//! the current set. Returns true if successful, otherwise false.
bool load(const QString &filename);
//! Remove the single raw API entry \a entry from the current set.
//!
//! \sa add(), clear(), load()
void remove(const QString &entry);
//! Convert the current raw API information to prepared API information.
//! This is implemented by a separate thread.
//!
//! \sa cancelPreparation()
void prepare();
//! Cancel the conversion of the current raw API information to prepared
//! API information.
//!
//! \sa prepare()
void cancelPreparation();
//! Return the default name of the prepared API information file. It is
//! based on the name of the associated lexer and in the directory defined
//! by the QSCIDIR environment variable. If the environment variable isn't
//! set then $HOME/.qsci is used.
QString defaultPreparedName() const;
//! Check to see is a prepared API information file named \a filename
//! exists. If \a filename is empty then the value returned by
//! defaultPreparedName() is used. Returns true if successful, otherwise
//! false.
//!
//! \sa defaultPreparedName()
bool isPrepared(const QString &filename = QString()) const;
//! Load the prepared API information from the file named \a filename. If
//! \a filename is empty then a name is constructed based on the name of
//! the associated lexer and saved in the directory defined by the QSCIDIR
//! environment variable. If the environment variable isn't set then
//! $HOME/.qsci is used. Returns true if successful, otherwise false.
bool loadPrepared(const QString &filename = QString());
//! Save the prepared API information to the file named \a filename. If
//! \a filename is empty then a name is constructed based on the name of
//! the associated lexer and saved in the directory defined by the QSCIDIR
//! environment variable. If the environment variable isn't set then
//! $HOME/.qsci is used. Returns true if successful, otherwise false.
bool savePrepared(const QString &filename = QString()) const;
//! \reimp
virtual void updateAutoCompletionList(const QStringList &context,
QStringList &list);
//! \reimp
virtual void autoCompletionSelected(const QString &sel);
//! \reimp
virtual QStringList callTips(const QStringList &context, int commas,
QsciScintilla::CallTipsStyle style, QList<int> &shifts);
//! \internal Reimplemented to receive termination events from the worker
//! thread.
virtual bool event(QEvent *e);
//! Return a list of the installed raw API file names for the associated
//! lexer.
QStringList installedAPIFiles() const;
signals:
//! This signal is emitted when the conversion of raw API information to
//! prepared API information has been cancelled.
//!
//! \sa apiPreparationFinished(), apiPreparationStarted()
void apiPreparationCancelled();
//! This signal is emitted when the conversion of raw API information to
//! prepared API information starts and can be used to give some visual
//! feedback to the user.
//!
//! \sa apiPreparationCancelled(), apiPreparationFinished()
void apiPreparationStarted();
//! This signal is emitted when the conversion of raw API information to
//! prepared API information has finished.
//!
//! \sa apiPreparationCancelled(), apiPreparationStarted()
void apiPreparationFinished();
private:
friend class QsciAPIsPrepared;
friend class QsciAPIsWorker;
// This indexes a word in a set of raw APIs. The first part indexes the
// entry in the set, the second part indexes the word within the entry.
typedef QPair<quint32, quint32> WordIndex;
// This is a list of word indexes.
typedef QList<WordIndex> WordIndexList;
QsciAPIsWorker *worker;
QStringList old_context;
QStringList::const_iterator origin;
int origin_len;
QString unambiguous_context;
QStringList apis;
QsciAPIsPrepared *prep;
static bool enoughCommas(const QString &s, int commas);
QStringList positionOrigin(const QStringList &context, QString &path);
bool originStartsWith(const QString &path, const QString &wsep);
const WordIndexList *wordIndexOf(const QString &word) const;
void lastCompleteWord(const QString &word, QStringList &with_context,
bool &unambig);
void lastPartialWord(const QString &word, QStringList &with_context,
bool &unambig);
void addAPIEntries(const WordIndexList &wl, bool complete,
QStringList &with_context, bool &unambig);
QString prepName(const QString &filename, bool mkpath = false) const;
void deleteWorker();
QsciAPIs(const QsciAPIs &);
QsciAPIs &operator=(const QsciAPIs &);
};
#endif

View File

@@ -0,0 +1,408 @@
// This defines the interface to the QsciCommand class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCICOMMAND_H
#define QSCICOMMAND_H
#include <qstring.h>
#include <Qsci/qsciglobal.h>
#include <Qsci/qsciscintillabase.h>
class QsciScintilla;
//! \brief The QsciCommand class represents an internal editor command that may
//! have one or two keys bound to it.
//!
//! Methods are provided to change the keys bound to the command and to remove
//! a key binding. Each command has a user friendly description of the command
//! for use in key mapping dialogs.
class QSCINTILLA_EXPORT QsciCommand
{
public:
//! This enum defines the different commands that can be assigned to a key.
enum Command {
//! Move down one line.
LineDown = QsciScintillaBase::SCI_LINEDOWN,
//! Extend the selection down one line.
LineDownExtend = QsciScintillaBase::SCI_LINEDOWNEXTEND,
//! Extend the rectangular selection down one line.
LineDownRectExtend = QsciScintillaBase::SCI_LINEDOWNRECTEXTEND,
//! Scroll the view down one line.
LineScrollDown = QsciScintillaBase::SCI_LINESCROLLDOWN,
//! Move up one line.
LineUp = QsciScintillaBase::SCI_LINEUP,
//! Extend the selection up one line.
LineUpExtend = QsciScintillaBase::SCI_LINEUPEXTEND,
//! Extend the rectangular selection up one line.
LineUpRectExtend = QsciScintillaBase::SCI_LINEUPRECTEXTEND,
//! Scroll the view up one line.
LineScrollUp = QsciScintillaBase::SCI_LINESCROLLUP,
//! Scroll to the start of the document.
ScrollToStart = QsciScintillaBase::SCI_SCROLLTOSTART,
//! Scroll to the end of the document.
ScrollToEnd = QsciScintillaBase::SCI_SCROLLTOEND,
//! Scroll vertically to centre the current line.
VerticalCentreCaret = QsciScintillaBase::SCI_VERTICALCENTRECARET,
//! Move down one paragraph.
ParaDown = QsciScintillaBase::SCI_PARADOWN,
//! Extend the selection down one paragraph.
ParaDownExtend = QsciScintillaBase::SCI_PARADOWNEXTEND,
//! Move up one paragraph.
ParaUp = QsciScintillaBase::SCI_PARAUP,
//! Extend the selection up one paragraph.
ParaUpExtend = QsciScintillaBase::SCI_PARAUPEXTEND,
//! Move left one character.
CharLeft = QsciScintillaBase::SCI_CHARLEFT,
//! Extend the selection left one character.
CharLeftExtend = QsciScintillaBase::SCI_CHARLEFTEXTEND,
//! Extend the rectangular selection left one character.
CharLeftRectExtend = QsciScintillaBase::SCI_CHARLEFTRECTEXTEND,
//! Move right one character.
CharRight = QsciScintillaBase::SCI_CHARRIGHT,
//! Extend the selection right one character.
CharRightExtend = QsciScintillaBase::SCI_CHARRIGHTEXTEND,
//! Extend the rectangular selection right one character.
CharRightRectExtend = QsciScintillaBase::SCI_CHARRIGHTRECTEXTEND,
//! Move left one word.
WordLeft = QsciScintillaBase::SCI_WORDLEFT,
//! Extend the selection left one word.
WordLeftExtend = QsciScintillaBase::SCI_WORDLEFTEXTEND,
//! Move right one word.
WordRight = QsciScintillaBase::SCI_WORDRIGHT,
//! Extend the selection right one word.
WordRightExtend = QsciScintillaBase::SCI_WORDRIGHTEXTEND,
//! Move to the end of the previous word.
WordLeftEnd = QsciScintillaBase::SCI_WORDLEFTEND,
//! Extend the selection to the end of the previous word.
WordLeftEndExtend = QsciScintillaBase::SCI_WORDLEFTENDEXTEND,
//! Move to the end of the next word.
WordRightEnd = QsciScintillaBase::SCI_WORDRIGHTEND,
//! Extend the selection to the end of the next word.
WordRightEndExtend = QsciScintillaBase::SCI_WORDRIGHTENDEXTEND,
//! Move left one word part.
WordPartLeft = QsciScintillaBase::SCI_WORDPARTLEFT,
//! Extend the selection left one word part.
WordPartLeftExtend = QsciScintillaBase::SCI_WORDPARTLEFTEXTEND,
//! Move right one word part.
WordPartRight = QsciScintillaBase::SCI_WORDPARTRIGHT,
//! Extend the selection right one word part.
WordPartRightExtend = QsciScintillaBase::SCI_WORDPARTRIGHTEXTEND,
//! Move to the start of the document line.
Home = QsciScintillaBase::SCI_HOME,
//! Extend the selection to the start of the document line.
HomeExtend = QsciScintillaBase::SCI_HOMEEXTEND,
//! Extend the rectangular selection to the start of the document line.
HomeRectExtend = QsciScintillaBase::SCI_HOMERECTEXTEND,
//! Move to the start of the displayed line.
HomeDisplay = QsciScintillaBase::SCI_HOMEDISPLAY,
//! Extend the selection to the start of the displayed line.
HomeDisplayExtend = QsciScintillaBase::SCI_HOMEDISPLAYEXTEND,
//! Move to the start of the displayed or document line.
HomeWrap = QsciScintillaBase::SCI_HOMEWRAP,
//! Extend the selection to the start of the displayed or document
//! line.
HomeWrapExtend = QsciScintillaBase::SCI_HOMEWRAPEXTEND,
//! Move to the first visible character in the document line.
VCHome = QsciScintillaBase::SCI_VCHOME,
//! Extend the selection to the first visible character in the document
//! line.
VCHomeExtend = QsciScintillaBase::SCI_VCHOMEEXTEND,
//! Extend the rectangular selection to the first visible character in
//! the document line.
VCHomeRectExtend = QsciScintillaBase::SCI_VCHOMERECTEXTEND,
//! Move to the first visible character of the displayed or document
//! line.
VCHomeWrap = QsciScintillaBase::SCI_VCHOMEWRAP,
//! Extend the selection to the first visible character of the
//! displayed or document line.
VCHomeWrapExtend = QsciScintillaBase::SCI_VCHOMEWRAPEXTEND,
//! Move to the end of the document line.
LineEnd = QsciScintillaBase::SCI_LINEEND,
//! Extend the selection to the end of the document line.
LineEndExtend = QsciScintillaBase::SCI_LINEENDEXTEND,
//! Extend the rectangular selection to the end of the document line.
LineEndRectExtend = QsciScintillaBase::SCI_LINEENDRECTEXTEND,
//! Move to the end of the displayed line.
LineEndDisplay = QsciScintillaBase::SCI_LINEENDDISPLAY,
//! Extend the selection to the end of the displayed line.
LineEndDisplayExtend = QsciScintillaBase::SCI_LINEENDDISPLAYEXTEND,
//! Move to the end of the displayed or document line.
LineEndWrap = QsciScintillaBase::SCI_LINEENDWRAP,
//! Extend the selection to the end of the displayed or document line.
LineEndWrapExtend = QsciScintillaBase::SCI_LINEENDWRAPEXTEND,
//! Move to the start of the document.
DocumentStart = QsciScintillaBase::SCI_DOCUMENTSTART,
//! Extend the selection to the start of the document.
DocumentStartExtend = QsciScintillaBase::SCI_DOCUMENTSTARTEXTEND,
//! Move to the end of the document.
DocumentEnd = QsciScintillaBase::SCI_DOCUMENTEND,
//! Extend the selection to the end of the document.
DocumentEndExtend = QsciScintillaBase::SCI_DOCUMENTENDEXTEND,
//! Move up one page.
PageUp = QsciScintillaBase::SCI_PAGEUP,
//! Extend the selection up one page.
PageUpExtend = QsciScintillaBase::SCI_PAGEUPEXTEND,
//! Extend the rectangular selection up one page.
PageUpRectExtend = QsciScintillaBase::SCI_PAGEUPRECTEXTEND,
//! Move down one page.
PageDown = QsciScintillaBase::SCI_PAGEDOWN,
//! Extend the selection down one page.
PageDownExtend = QsciScintillaBase::SCI_PAGEDOWNEXTEND,
//! Extend the rectangular selection down one page.
PageDownRectExtend = QsciScintillaBase::SCI_PAGEDOWNRECTEXTEND,
//! Stuttered move up one page.
StutteredPageUp = QsciScintillaBase::SCI_STUTTEREDPAGEUP,
//! Stuttered extend the selection up one page.
StutteredPageUpExtend = QsciScintillaBase::SCI_STUTTEREDPAGEUPEXTEND,
//! Stuttered move down one page.
StutteredPageDown = QsciScintillaBase::SCI_STUTTEREDPAGEDOWN,
//! Stuttered extend the selection down one page.
StutteredPageDownExtend = QsciScintillaBase::SCI_STUTTEREDPAGEDOWNEXTEND,
//! Delete the current character.
Delete = QsciScintillaBase::SCI_CLEAR,
//! Delete the previous character.
DeleteBack = QsciScintillaBase::SCI_DELETEBACK,
//! Delete the previous character if not at start of line.
DeleteBackNotLine = QsciScintillaBase::SCI_DELETEBACKNOTLINE,
//! Delete the word to the left.
DeleteWordLeft = QsciScintillaBase::SCI_DELWORDLEFT,
//! Delete the word to the right.
DeleteWordRight = QsciScintillaBase::SCI_DELWORDRIGHT,
//! Delete right to the end of the next word.
DeleteWordRightEnd = QsciScintillaBase::SCI_DELWORDRIGHTEND,
//! Delete the line to the left.
DeleteLineLeft = QsciScintillaBase::SCI_DELLINELEFT,
//! Delete the line to the right.
DeleteLineRight = QsciScintillaBase::SCI_DELLINERIGHT,
//! Delete the current line.
LineDelete = QsciScintillaBase::SCI_LINEDELETE,
//! Cut the current line to the clipboard.
LineCut = QsciScintillaBase::SCI_LINECUT,
//! Copy the current line to the clipboard.
LineCopy = QsciScintillaBase::SCI_LINECOPY,
//! Transpose the current and previous lines.
LineTranspose = QsciScintillaBase::SCI_LINETRANSPOSE,
//! Duplicate the current line.
LineDuplicate = QsciScintillaBase::SCI_LINEDUPLICATE,
//! Select the whole document.
SelectAll = QsciScintillaBase::SCI_SELECTALL,
//! Move the selected lines up one line.
MoveSelectedLinesUp = QsciScintillaBase::SCI_MOVESELECTEDLINESUP,
//! Move the selected lines down one line.
MoveSelectedLinesDown = QsciScintillaBase::SCI_MOVESELECTEDLINESDOWN,
//! Duplicate the selection.
SelectionDuplicate = QsciScintillaBase::SCI_SELECTIONDUPLICATE,
//! Convert the selection to lower case.
SelectionLowerCase = QsciScintillaBase::SCI_LOWERCASE,
//! Convert the selection to upper case.
SelectionUpperCase = QsciScintillaBase::SCI_UPPERCASE,
//! Cut the selection to the clipboard.
SelectionCut = QsciScintillaBase::SCI_CUT,
//! Copy the selection to the clipboard.
SelectionCopy = QsciScintillaBase::SCI_COPY,
//! Paste from the clipboard.
Paste = QsciScintillaBase::SCI_PASTE,
//! Toggle insert/overtype.
EditToggleOvertype = QsciScintillaBase::SCI_EDITTOGGLEOVERTYPE,
//! Insert a platform dependent newline.
Newline = QsciScintillaBase::SCI_NEWLINE,
//! Insert a formfeed.
Formfeed = QsciScintillaBase::SCI_FORMFEED,
//! Indent one level.
Tab = QsciScintillaBase::SCI_TAB,
//! De-indent one level.
Backtab = QsciScintillaBase::SCI_BACKTAB,
//! Cancel any current operation.
Cancel = QsciScintillaBase::SCI_CANCEL,
//! Undo the last command.
Undo = QsciScintillaBase::SCI_UNDO,
//! Redo the last command.
Redo = QsciScintillaBase::SCI_REDO,
//! Zoom in.
ZoomIn = QsciScintillaBase::SCI_ZOOMIN,
//! Zoom out.
ZoomOut = QsciScintillaBase::SCI_ZOOMOUT,
//! Reverse the selected lines.
ReverseLines = QsciScintillaBase::SCI_LINEREVERSE,
};
//! Return the command that will be executed by this instance.
Command command() const {return scicmd;}
//! Execute the command.
void execute();
//! Binds the key \a key to the command. If \a key is 0 then the key
//! binding is removed. If \a key is invalid then the key binding is
//! unchanged. Valid keys are any visible or control character or any
//! of \c Qt::Key_Down, \c Qt::Key_Up, \c Qt::Key_Left, \c Qt::Key_Right,
//! \c Qt::Key_Home, \c Qt::Key_End, \c Qt::Key_PageUp,
//! \c Qt::Key_PageDown, \c Qt::Key_Delete, \c Qt::Key_Insert,
//! \c Qt::Key_Escape, \c Qt::Key_Backspace, \c Qt::Key_Tab,
//! \c Qt::Key_Backtab, \c Qt::Key_Return, \c Qt::Key_Enter,
//! \c Qt::Key_Super_L, \c Qt::Key_Super_R or \c Qt::Key_Menu. Keys may be
//! modified with any combination of \c Qt::ShiftModifier,
//! \c Qt::ControlModifier, \c Qt::AltModifier and \c Qt::MetaModifier.
//!
//! \sa key(), setAlternateKey(), validKey()
void setKey(int key);
//! Binds the alternate key \a altkey to the command. If \a key is 0
//! then the alternate key binding is removed.
//!
//! \sa alternateKey(), setKey(), validKey()
void setAlternateKey(int altkey);
//! The key that is currently bound to the command is returned.
//!
//! \sa setKey(), alternateKey()
int key() const {return qkey;}
//! The alternate key that is currently bound to the command is
//! returned.
//!
//! \sa setAlternateKey(), key()
int alternateKey() const {return qaltkey;}
//! If the key \a key is valid then true is returned.
static bool validKey(int key);
//! The user friendly description of the command is returned.
QString description() const;
private:
friend class QsciCommandSet;
QsciCommand(QsciScintilla *qs, Command cmd, int key, int altkey,
const char *desc);
void bindKey(int key,int &qk,int &scik);
QsciScintilla *qsCmd;
Command scicmd;
int qkey, scikey, qaltkey, scialtkey;
const char *descCmd;
QsciCommand(const QsciCommand &);
QsciCommand &operator=(const QsciCommand &);
};
#endif

View File

@@ -0,0 +1,89 @@
// This defines the interface to the QsciCommandSet class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCICOMMANDSET_H
#define QSCICOMMANDSET_H
#include <qglobal.h>
#include <QList>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscicommand.h>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
class QsciScintilla;
//! \brief The QsciCommandSet class represents the set of all internal editor
//! commands that may have keys bound.
//!
//! Methods are provided to access the individual commands and to read and
//! write the current bindings from and to settings files.
class QSCINTILLA_EXPORT QsciCommandSet
{
public:
//! The key bindings for each command in the set are read from the
//! settings \a qs. \a prefix is prepended to the key of each entry.
//! true is returned if there was no error.
//!
//! \sa writeSettings()
bool readSettings(QSettings &qs, const char *prefix = "/Scintilla");
//! The key bindings for each command in the set are written to the
//! settings \a qs. \a prefix is prepended to the key of each entry.
//! true is returned if there was no error.
//!
//! \sa readSettings()
bool writeSettings(QSettings &qs, const char *prefix = "/Scintilla");
//! The commands in the set are returned as a list.
QList<QsciCommand *> &commands() {return cmds;}
//! The primary keys bindings for all commands are removed.
void clearKeys();
//! The alternate keys bindings for all commands are removed.
void clearAlternateKeys();
// Find the command that is bound to \a key.
QsciCommand *boundTo(int key) const;
// Find a specific command \a command.
QsciCommand *find(QsciCommand::Command command) const;
private:
friend class QsciScintilla;
QsciCommandSet(QsciScintilla *qs);
~QsciCommandSet();
QsciScintilla *qsci;
QList<QsciCommand *> cmds;
QsciCommandSet(const QsciCommandSet &);
QsciCommandSet &operator=(const QsciCommandSet &);
};
#endif

View File

@@ -0,0 +1,61 @@
// This defines the interface to the QsciDocument class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCIDOCUMENT_H
#define QSCIDOCUMENT_H
#include <Qsci/qsciglobal.h>
class QsciScintillaBase;
class QsciDocumentP;
//! \brief The QsciDocument class represents a document to be edited.
//!
//! It is an opaque class that can be attached to multiple instances of
//! QsciScintilla to create different simultaneous views of the same document.
//! QsciDocument uses implicit sharing so that copying class instances is a
//! cheap operation.
class QSCINTILLA_EXPORT QsciDocument
{
public:
//! Create a new unattached document.
QsciDocument();
virtual ~QsciDocument();
QsciDocument(const QsciDocument &);
QsciDocument &operator=(const QsciDocument &);
private:
friend class QsciScintilla;
void attach(const QsciDocument &that);
void detach();
void display(QsciScintillaBase *qsb, const QsciDocument *from);
void undisplay(QsciScintillaBase *qsb);
bool isModified() const;
void setModified(bool m);
QsciDocumentP *pdoc;
};
#endif

View File

@@ -0,0 +1,54 @@
// This module defines various things common to all of the Scintilla Qt port.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCIGLOBAL_H
#define QSCIGLOBAL_H
#include <qglobal.h>
#define QSCINTILLA_VERSION 0x020e01
#define QSCINTILLA_VERSION_STR "2.14.1"
// We only support Qt v5.11 and later.
#if QT_VERSION < 0x050b00
#error "Qt v5.11.0 or later is required"
#endif
// Define QSCINTILLA_MAKE_DLL to create a QScintilla shared library, or
// define QSCINTILLA_DLL to link against a QScintilla shared library, or define
// neither to either build or link against a static QScintilla library.
#if defined(QSCINTILLA_DLL)
#define QSCINTILLA_EXPORT Q_DECL_IMPORT
#elif defined(QSCINTILLA_MAKE_DLL)
#define QSCINTILLA_EXPORT Q_DECL_EXPORT
#else
#define QSCINTILLA_EXPORT
#endif
#if !defined(QT_BEGIN_NAMESPACE)
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE
#endif
#endif

View File

@@ -0,0 +1,356 @@
// This defines the interface to the QsciLexer class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXER_H
#define QSCILEXER_H
#include <QColor>
#include <QFont>
#include <QMap>
#include <QObject>
#include <QString>
#include <Qsci/qsciglobal.h>
QT_BEGIN_NAMESPACE
class QSettings;
QT_END_NAMESPACE
class QsciAbstractAPIs;
class QsciScintilla;
//! \brief The QsciLexer class is an abstract class used as a base for language
//! lexers.
//!
//! A lexer scans the text breaking it up into separate language objects, e.g.
//! keywords, strings, operators. The lexer then uses a different style to
//! draw each object. A style is identified by a style number and has a number
//! of attributes, including colour and font. A specific language lexer will
//! implement appropriate default styles which can be overriden by an
//! application by further sub-classing the specific language lexer.
//!
//! A lexer may provide one or more sets of words to be recognised as keywords.
//! Most lexers only provide one set, but some may support languages embedded
//! in other languages and provide several sets.
//!
//! QsciLexer provides convenience methods for saving and restoring user
//! preferences for fonts and colours.
//!
//! If you want to write a lexer for a new language then you can add it to the
//! underlying Scintilla code and implement a corresponding QsciLexer sub-class
//! to manage the different styles used. Alternatively you can implement a
//! sub-class of QsciLexerCustom.
class QSCINTILLA_EXPORT QsciLexer : public QObject
{
Q_OBJECT
public:
//! Construct a QsciLexer with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexer(QObject *parent = 0);
//! Destroy the QSciLexer.
virtual ~QsciLexer();
//! Returns the name of the language. It must be re-implemented by a
//! sub-class.
virtual const char *language() const = 0;
//! Returns the name of the lexer. If 0 is returned then the lexer's
//! numeric identifier is used. The default implementation returns 0.
//!
//! \sa lexerId()
virtual const char *lexer() const;
//! Returns the identifier (i.e. a QsciScintillaBase::SCLEX_* value) of the
//! lexer. This is only used if lexer() returns 0. The default
//! implementation returns QsciScintillaBase::SCLEX_CONTAINER.
//!
//! \sa lexer()
virtual int lexerId() const;
//! Returns the current API set or 0 if there isn't one.
//!
//! \sa setAPIs()
QsciAbstractAPIs *apis() const;
//! Returns the characters that can fill up auto-completion.
virtual const char *autoCompletionFillups() const;
//! Returns the list of character sequences that can separate
//! auto-completion words. The first in the list is assumed to be the
//! sequence used to separate words in the lexer's API files.
virtual QStringList autoCompletionWordSeparators() const;
//! Returns the auto-indentation style. The default is 0 if the
//! language is block structured, or QsciScintilla::AiMaintain if not.
//!
//! \sa setAutoIndentStyle(), QsciScintilla::AiMaintain,
//! QsciScintilla::AiOpening, QsciScintilla::AiClosing
int autoIndentStyle();
//! Returns a space separated list of words or characters in a particular
//! style that define the end of a block for auto-indentation. The style
//! is returned via \a style.
virtual const char *blockEnd(int *style = 0) const;
//! Returns the number of lines prior to the current one when determining
//! the scope of a block when auto-indenting.
virtual int blockLookback() const;
//! Returns a space separated list of words or characters in a particular
//! style that define the start of a block for auto-indentation. The style
//! is returned via \a style.
virtual const char *blockStart(int *style = 0) const;
//! Returns a space separated list of keywords in a particular style that
//! define the start of a block for auto-indentation. The style is
//! returned via \a style.
virtual const char *blockStartKeyword(int *style = 0) const;
//! Returns the style used for braces for brace matching.
virtual int braceStyle() const;
//! Returns true if the language is case sensitive. The default is true.
virtual bool caseSensitive() const;
//! Returns the foreground colour of the text for style number \a style.
//! The default colour is that returned by defaultColor().
//!
//! \sa defaultColor(), paper()
virtual QColor color(int style) const;
//! Returns the end-of-line for style number \a style. The default is
//! false.
virtual bool eolFill(int style) const;
//! Returns the font for style number \a style. The default font is
//! that returned by defaultFont().
//!
//! \sa defaultFont()
virtual QFont font(int style) const;
//! Returns the view used for indentation guides.
virtual int indentationGuideView() const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string. Keyword sets are numbered
//! from 1. 0 is returned if there is no such set.
virtual const char *keywords(int set) const;
//! Returns the number of the style used for whitespace. The default
//! implementation returns 0 which is the convention adopted by most
//! lexers.
virtual int defaultStyle() const;
//! Returns the descriptive name for style number \a style. For a valid
//! style number for this language a non-empty QString must be returned.
//! If the style number is invalid then an empty QString must be returned.
//! This is intended to be used in user preference dialogs.
virtual QString description(int style) const = 0;
//! Returns the background colour of the text for style number
//! \a style.
//!
//! \sa defaultPaper(), color()
virtual QColor paper(int style) const;
//! Returns the default text colour.
//!
//! \sa setDefaultColor()
QColor defaultColor() const;
//! Returns the default text colour for style number \a style.
virtual QColor defaultColor(int style) const;
//! Returns the default end-of-line for style number \a style. The default
//! is false.
virtual bool defaultEolFill(int style) const;
//! Returns the default font.
//!
//! \sa setDefaultFont()
QFont defaultFont() const;
//! Returns the default font for style number \a style.
virtual QFont defaultFont(int style) const;
//! Returns the default paper colour.
//!
//! \sa setDefaultPaper()
QColor defaultPaper() const;
//! Returns the default paper colour for style number \a style.
virtual QColor defaultPaper(int style) const;
//! Returns the QsciScintilla instance that the lexer is currently attached
//! to or 0 if it is unattached.
QsciScintilla *editor() const {return attached_editor;}
//! The current set of APIs is set to \a apis. If \a apis is 0 then any
//! existing APIs for this lexer are removed.
//!
//! \sa apis()
void setAPIs(QsciAbstractAPIs *apis);
//! The default text colour is set to \a c.
//!
//! \sa defaultColor(), color()
void setDefaultColor(const QColor &c);
//! The default font is set to \a f.
//!
//! \sa defaultFont(), font()
void setDefaultFont(const QFont &f);
//! The default paper colour is set to \a c.
//!
//! \sa defaultPaper(), paper()
void setDefaultPaper(const QColor &c);
//! \internal Set the QsciScintilla instance that the lexer is attached to.
virtual void setEditor(QsciScintilla *editor);
//! The colour, paper, font and end-of-line for each style number, and
//! all lexer specific properties are read from the settings \a qs.
//! \a prefix is prepended to the key of each entry. true is returned
//! if there was no error.
//!
//! \sa writeSettings(), QsciScintilla::setLexer()
bool readSettings(QSettings &qs,const char *prefix = "/Scintilla");
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
virtual void refreshProperties();
//! Returns the number of style bits needed by the lexer. Normally this
//! should only be re-implemented by custom lexers. This is deprecated and
//! no longer has any effect.
virtual int styleBitsNeeded() const;
//! Returns the string of characters that comprise a word. The default is
//! 0 which implies the upper and lower case alphabetic characters and
//! underscore.
virtual const char *wordCharacters() const;
//! The colour, paper, font and end-of-line for each style number, and
//! all lexer specific properties are written to the settings \a qs.
//! \a prefix is prepended to the key of each entry. true is returned
//! if there was no error.
//!
//! \sa readSettings()
bool writeSettings(QSettings &qs,
const char *prefix = "/Scintilla") const;
public slots:
//! The auto-indentation style is set to \a autoindentstyle.
//!
//! \sa autoIndentStyle(), QsciScintilla::AiMaintain,
//! QsciScintilla::AiOpening, QsciScintilla::AiClosing
virtual void setAutoIndentStyle(int autoindentstyle);
//! The foreground colour for style number \a style is set to \a c. If
//! \a style is -1 then the colour is set for all styles.
virtual void setColor(const QColor &c,int style = -1);
//! The end-of-line fill for style number \a style is set to
//! \a eoffill. If \a style is -1 then the fill is set for all styles.
virtual void setEolFill(bool eoffill,int style = -1);
//! The font for style number \a style is set to \a f. If \a style is
//! -1 then the font is set for all styles.
virtual void setFont(const QFont &f,int style = -1);
//! The background colour for style number \a style is set to \a c. If
//! \a style is -1 then the colour is set for all styles.
virtual void setPaper(const QColor &c,int style = -1);
signals:
//! This signal is emitted when the foreground colour of style number
//! \a style has changed. The new colour is \a c.
void colorChanged(const QColor &c,int style);
//! This signal is emitted when the end-of-file fill of style number
//! \a style has changed. The new fill is \a eolfilled.
void eolFillChanged(bool eolfilled,int style);
//! This signal is emitted when the font of style number \a style has
//! changed. The new font is \a f.
void fontChanged(const QFont &f,int style);
//! This signal is emitted when the background colour of style number
//! \a style has changed. The new colour is \a c.
void paperChanged(const QColor &c,int style);
//! This signal is emitted when the value of the lexer property \a prop
//! needs to be changed. The new value is \a val.
void propertyChanged(const char *prop, const char *val);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
virtual bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
virtual bool writeProperties(QSettings &qs,const QString &prefix) const;
//! \internal Convert a QString to encoded bytes.
QByteArray textAsBytes(const QString &text) const;
//! \internal Convert encoded bytes to a QString.
QString bytesAsText(const char *bytes, int size) const;
private:
struct StyleData {
QFont font;
QColor color;
QColor paper;
bool eol_fill;
};
struct StyleDataMap {
bool style_data_set;
QMap<int, StyleData> style_data;
};
StyleDataMap *style_map;
int autoIndStyle;
QFont defFont;
QColor defColor;
QColor defPaper;
QsciAbstractAPIs *apiSet;
QsciScintilla *attached_editor;
void setStyleDefaults() const;
StyleData &styleData(int style) const;
QsciLexer(const QsciLexer &);
QsciLexer &operator=(const QsciLexer &);
};
#endif

View File

@@ -0,0 +1,201 @@
// This defines the interface to the abstract QsciLexerAsm class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERASM_H
#define QSCILEXERASM_H
#include <QObject>
#include <QChar>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The abstract QsciLexerAsm class encapsulates the Scintilla Asm
//! lexer.
class QSCINTILLA_EXPORT QsciLexerAsm : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Asm lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A number.
Number = 2,
//! A double-quoted string.
DoubleQuotedString = 3,
//! An operator.
Operator = 4,
//! An identifier.
Identifier = 5,
//! A CPU instruction.
CPUInstruction = 6,
//! An FPU instruction.
FPUInstruction = 7,
//! A register.
Register = 8,
//! A directive.
Directive = 9,
//! A directive operand.
DirectiveOperand = 11,
//! A block comment.
BlockComment = 12,
//! A single-quoted string.
SingleQuotedString = 13,
//! The end of a line where a string is not closed.
UnclosedString = 14,
//! An extended instruction.
ExtendedInstruction = 16,
//! A comment directive.
CommentDirective = 17,
};
//! Construct a QsciLexerAsm with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerAsm(QObject *parent = 0);
//! Destroys the QsciLexerAsm instance.
virtual ~QsciLexerAsm();
//! Returns the foreground colour of the text for style number \a style.
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string. Set 1 is normally used for
//! CPU instructions. Set 2 is normally used for FPU instructions. Set 3
//! is normally used for register names. Set 4 is normally used for
//! directives. Set 5 is normally used for directive operands. Set 6 is
//! normally used for extended instructions.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
//! Returns the delimiter used by the COMMENT directive.
//!
//! \sa setCommentDelimiter()
QChar commentDelimiter() const;
//! Returns true if syntax-based folding is enabled.
//!
//! \sa setFoldSyntaxBased()
bool foldSyntaxBased() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is true.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
//! \a delimiter is the character used for the COMMENT directive's
//! delimiter. The default is '~'.
//!
//! \sa commentDelimiter()
virtual void setCommentDelimiter(QChar delimeter);
//! If \a syntax_based is true then syntax-based folding is enabled. The
//! default is true.
//!
//! \sa foldSyntaxBased()
virtual void setFoldSyntaxBased(bool syntax_based);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs, const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs, const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setCommentDelimiterProp();
void setSyntaxBasedProp();
bool fold_comments;
bool fold_compact;
QChar comment_delimiter;
bool fold_syntax_based;
QsciLexerAsm(const QsciLexerAsm &);
QsciLexerAsm &operator=(const QsciLexerAsm &);
};
#endif

View File

@@ -0,0 +1,174 @@
// This defines the interface to the QsciLexerAVS class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERAVS_H
#define QSCILEXERAVS_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerAVS class encapsulates the Scintilla AVS lexer.
class QSCINTILLA_EXPORT QsciLexerAVS : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! AVS lexer.
enum {
//! The default.
Default = 0,
//! A block comment.
BlockComment = 1,
//! A nested block comment.
NestedBlockComment = 2,
//! A line comment.
LineComment = 3,
//! A number.
Number = 4,
//! An operator.
Operator = 5,
//! An identifier
Identifier = 6,
//! A string.
String = 7,
//! A triple quoted string.
TripleString = 8,
//! A keyword (as defined by keyword set number 1)..
Keyword = 9,
//! A filter (as defined by keyword set number 2).
Filter = 10,
//! A plugin (as defined by keyword set number 3).
Plugin = 11,
//! A function (as defined by keyword set number 4).
Function = 12,
//! A clip property (as defined by keyword set number 5).
ClipProperty = 13,
//! A keyword defined in keyword set number 6. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet6 = 14
};
//! Construct a QsciLexerAVS with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerAVS(QObject *parent = 0);
//! Destroys the QsciLexerAVS instance.
virtual ~QsciLexerAVS();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
bool fold_comments;
bool fold_compact;
QsciLexerAVS(const QsciLexerAVS &);
QsciLexerAVS &operator=(const QsciLexerAVS &);
};
#endif

View File

@@ -0,0 +1,178 @@
// This defines the interface to the QsciLexerBash class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERBASH_H
#define QSCILEXERBASH_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerBash class encapsulates the Scintilla Bash lexer.
class QSCINTILLA_EXPORT QsciLexerBash : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Bash lexer.
enum {
//! The default.
Default = 0,
//! An error.
Error = 1,
//! A comment.
Comment = 2,
//! A number.
Number = 3,
//! A keyword.
Keyword = 4,
//! A double-quoted string.
DoubleQuotedString = 5,
//! A single-quoted string.
SingleQuotedString = 6,
//! An operator.
Operator = 7,
//! An identifier
Identifier = 8,
//! A scalar.
Scalar = 9,
//! Parameter expansion.
ParameterExpansion = 10,
//! Backticks.
Backticks = 11,
//! A here document delimiter.
HereDocumentDelimiter = 12,
//! A single quoted here document.
SingleQuotedHereDocument = 13
};
//! Construct a QsciLexerBash with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerBash(QObject *parent = 0);
//! Destroys the QsciLexerBash instance.
virtual ~QsciLexerBash();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
bool fold_comments;
bool fold_compact;
QsciLexerBash(const QsciLexerBash &);
QsciLexerBash &operator=(const QsciLexerBash &);
};
#endif

View File

@@ -0,0 +1,115 @@
// This defines the interface to the QsciLexerBatch class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERBATCH_H
#define QSCILEXERBATCH_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerBatch class encapsulates the Scintilla batch file
//! lexer.
class QSCINTILLA_EXPORT QsciLexerBatch : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! batch file lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A keyword.
Keyword = 2,
//! A label.
Label = 3,
//! An hide command character.
HideCommandChar = 4,
//! An external command .
ExternalCommand = 5,
//! A variable.
Variable = 6,
//! An operator
Operator = 7
};
//! Construct a QsciLexerBatch with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerBatch(QObject *parent = 0);
//! Destroys the QsciLexerBatch instance.
virtual ~QsciLexerBatch();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! \internal Returns true if the language is case sensitive.
bool caseSensitive() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerBatch(const QsciLexerBatch &);
QsciLexerBatch &operator=(const QsciLexerBatch &);
};
#endif

View File

@@ -0,0 +1,160 @@
// This defines the interface to the QsciLexerCMake class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERCMAKE_H
#define QSCILEXERCMAKE_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerCMake class encapsulates the Scintilla CMake lexer.
class QSCINTILLA_EXPORT QsciLexerCMake : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! CMake lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A string.
String = 2,
//! A left quoted string.
StringLeftQuote = 3,
//! A right quoted string.
StringRightQuote = 4,
//! A function. (Defined by keyword set number 1.)
Function = 5,
//! A variable. (Defined by keyword set number 2.)
Variable = 6,
//! A label.
Label = 7,
//! A keyword defined in keyword set number 3. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet3 = 8,
//! A WHILE block.
BlockWhile = 9,
//! A FOREACH block.
BlockForeach = 10,
//! An IF block.
BlockIf = 11,
//! A MACRO block.
BlockMacro = 12,
//! A variable within a string.
StringVariable = 13,
//! A number.
Number = 14
};
//! Construct a QsciLexerCMake with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerCMake(QObject *parent = 0);
//! Destroys the QsciLexerCMake instance.
virtual ~QsciLexerCMake();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if ELSE blocks can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const;
public slots:
//! If \a fold is true then ELSE blocks can be folded. The default is
//! false.
//!
//! \sa foldAtElse()
virtual void setFoldAtElse(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setAtElseProp();
bool fold_atelse;
QsciLexerCMake(const QsciLexerCMake &);
QsciLexerCMake &operator=(const QsciLexerCMake &);
};
#endif

View File

@@ -0,0 +1,264 @@
// This defines the interface to the QsciLexerCoffeeScript class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERCOFFEESCRIPT_H
#define QSCILEXERCOFFEESCRIPT_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerCoffeeScript class encapsulates the Scintilla
//! CoffeeScript lexer.
class QSCINTILLA_EXPORT QsciLexerCoffeeScript : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! C++ lexer.
enum {
//! The default.
Default = 0,
//! A C-style comment.
Comment = 1,
//! A C++-style comment line.
CommentLine = 2,
//! A JavaDoc/Doxygen C-style comment.
CommentDoc = 3,
//! A number.
Number = 4,
//! A keyword.
Keyword = 5,
//! A double-quoted string.
DoubleQuotedString = 6,
//! A single-quoted string.
SingleQuotedString = 7,
//! An IDL UUID.
UUID = 8,
//! A pre-processor block.
PreProcessor = 9,
//! An operator.
Operator = 10,
//! An identifier
Identifier = 11,
//! The end of a line where a string is not closed.
UnclosedString = 12,
//! A C# verbatim string.
VerbatimString = 13,
//! A regular expression.
Regex = 14,
//! A JavaDoc/Doxygen C++-style comment line.
CommentLineDoc = 15,
//! A keyword defined in keyword set number 2. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet2 = 16,
//! A JavaDoc/Doxygen keyword.
CommentDocKeyword = 17,
//! A JavaDoc/Doxygen keyword error defined in keyword set number 3.
//! The class must be sub-classed and re-implement keywords() to make
//! use of this style.
CommentDocKeywordError = 18,
//! A global class defined in keyword set number 4. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
GlobalClass = 19,
//! A block comment.
CommentBlock = 22,
//! A block regular expression.
BlockRegex = 23,
//! A block regular expression comment.
BlockRegexComment = 24,
//! An instance property.
InstanceProperty = 25,
};
//! Construct a QsciLexerCoffeeScript with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerCoffeeScript(QObject *parent = 0);
//! Destroys the QsciLexerCoffeeScript instance.
virtual ~QsciLexerCoffeeScript();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the character sequences that can separate
//! auto-completion words.
QStringList autoCompletionWordSeparators() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the end of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockEnd(int *style = 0) const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns a space separated list of keywords in a
//! particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStartKeyword(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string. Set 1 is normally used for
//! primary keywords and identifiers. Set 2 is normally used for secondary
//! keywords and identifiers. Set 3 is normally used for documentation
//! comment keywords. Set 4 is normally used for global classes and
//! typedefs.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if '$' characters are allowed in identifier names.
//!
//! \sa setDollarsAllowed()
bool dollarsAllowed() const {return dollars;}
//! If \a allowed is true then '$' characters are allowed in identifier
//! names. The default is true.
//!
//! \sa dollarsAllowed()
void setDollarsAllowed(bool allowed);
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
void setFoldComments(bool fold);
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
void setFoldCompact(bool fold);
//! Returns true if preprocessor lines (after the preprocessor
//! directive) are styled.
//!
//! \sa setStylePreprocessor()
bool stylePreprocessor() const {return style_preproc;}
//! If \a style is true then preprocessor lines (after the preprocessor
//! directive) are styled. The default is false.
//!
//! \sa stylePreprocessor()
void setStylePreprocessor(bool style);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa writeProperties()
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
//! \sa readProperties()
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setStylePreprocProp();
void setDollarsProp();
bool fold_comments;
bool fold_compact;
bool style_preproc;
bool dollars;
QsciLexerCoffeeScript(const QsciLexerCoffeeScript &);
QsciLexerCoffeeScript &operator=(const QsciLexerCoffeeScript &);
};
#endif

View File

@@ -0,0 +1,398 @@
// This defines the interface to the QsciLexerCPP class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERCPP_H
#define QSCILEXERCPP_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerCPP class encapsulates the Scintilla C++
//! lexer.
class QSCINTILLA_EXPORT QsciLexerCPP : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! C++ lexer.
enum {
//! The default.
Default = 0,
InactiveDefault = Default + 64,
//! A C comment.
Comment = 1,
InactiveComment = Comment + 64,
//! A C++ comment line.
CommentLine = 2,
InactiveCommentLine = CommentLine + 64,
//! A JavaDoc/Doxygen style C comment.
CommentDoc = 3,
InactiveCommentDoc = CommentDoc + 64,
//! A number.
Number = 4,
InactiveNumber = Number + 64,
//! A keyword.
Keyword = 5,
InactiveKeyword = Keyword + 64,
//! A double-quoted string.
DoubleQuotedString = 6,
InactiveDoubleQuotedString = DoubleQuotedString + 64,
//! A single-quoted string.
SingleQuotedString = 7,
InactiveSingleQuotedString = SingleQuotedString + 64,
//! An IDL UUID.
UUID = 8,
InactiveUUID = UUID + 64,
//! A pre-processor block.
PreProcessor = 9,
InactivePreProcessor = PreProcessor + 64,
//! An operator.
Operator = 10,
InactiveOperator = Operator + 64,
//! An identifier
Identifier = 11,
InactiveIdentifier = Identifier + 64,
//! The end of a line where a string is not closed.
UnclosedString = 12,
InactiveUnclosedString = UnclosedString + 64,
//! A C# verbatim string.
VerbatimString = 13,
InactiveVerbatimString = VerbatimString + 64,
//! A JavaScript regular expression.
Regex = 14,
InactiveRegex = Regex + 64,
//! A JavaDoc/Doxygen style C++ comment line.
CommentLineDoc = 15,
InactiveCommentLineDoc = CommentLineDoc + 64,
//! A keyword defined in keyword set number 2. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet2 = 16,
InactiveKeywordSet2 = KeywordSet2 + 64,
//! A JavaDoc/Doxygen keyword.
CommentDocKeyword = 17,
InactiveCommentDocKeyword = CommentDocKeyword + 64,
//! A JavaDoc/Doxygen keyword error.
CommentDocKeywordError = 18,
InactiveCommentDocKeywordError = CommentDocKeywordError + 64,
//! A global class or typedef defined in keyword set number 5. The
//! class must be sub-classed and re-implement keywords() to make use
//! of this style.
GlobalClass = 19,
InactiveGlobalClass = GlobalClass + 64,
//! A C++ raw string.
RawString = 20,
InactiveRawString = RawString + 64,
//! A Vala triple-quoted verbatim string.
TripleQuotedVerbatimString = 21,
InactiveTripleQuotedVerbatimString = TripleQuotedVerbatimString + 64,
//! A Pike hash-quoted string.
HashQuotedString = 22,
InactiveHashQuotedString = HashQuotedString + 64,
//! A pre-processor stream comment.
PreProcessorComment = 23,
InactivePreProcessorComment = PreProcessorComment + 64,
//! A JavaDoc/Doxygen style pre-processor comment.
PreProcessorCommentLineDoc = 24,
InactivePreProcessorCommentLineDoc = PreProcessorCommentLineDoc + 64,
//! A user-defined literal.
UserLiteral = 25,
InactiveUserLiteral = UserLiteral + 64,
//! A task marker.
TaskMarker = 26,
InactiveTaskMarker = TaskMarker + 64,
//! An escape sequence.
EscapeSequence = 27,
InactiveEscapeSequence = EscapeSequence + 64,
};
//! Construct a QsciLexerCPP with parent \a parent. \a parent is typically
//! the QsciScintilla instance. \a caseInsensitiveKeywords is true if the
//! lexer ignores the case of keywords.
QsciLexerCPP(QObject *parent = 0, bool caseInsensitiveKeywords = false);
//! Destroys the QsciLexerCPP instance.
virtual ~QsciLexerCPP();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the character sequences that can separate
//! auto-completion words.
QStringList autoCompletionWordSeparators() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the end of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockEnd(int *style = 0) const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns a space separated list of keywords in a
//! particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStartKeyword(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string. Set 1 is normally used for
//! primary keywords and identifiers. Set 2 is normally used for secondary
//! keywords and identifiers. Set 3 is normally used for documentation
//! comment keywords. Set 4 is normally used for global classes and
//! typedefs.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if "} else {" lines can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const {return fold_atelse;}
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
//! Returns true if preprocessor blocks can be folded.
//!
//! \sa setFoldPreprocessor()
bool foldPreprocessor() const {return fold_preproc;}
//! Returns true if preprocessor lines (after the preprocessor
//! directive) are styled.
//!
//! \sa setStylePreprocessor()
bool stylePreprocessor() const {return style_preproc;}
//! If \a allowed is true then '$' characters are allowed in identifier
//! names. The default is true.
//!
//! \sa dollarsAllowed()
void setDollarsAllowed(bool allowed);
//! Returns true if '$' characters are allowed in identifier names.
//!
//! \sa setDollarsAllowed()
bool dollarsAllowed() const {return dollars;}
//! If \a enabled is true then triple quoted strings are highlighted. The
//! default is false.
//!
//! \sa highlightTripleQuotedStrings()
void setHighlightTripleQuotedStrings(bool enabled);
//! Returns true if triple quoted strings should be highlighted.
//!
//! \sa setHighlightTripleQuotedStrings()
bool highlightTripleQuotedStrings() const {return highlight_triple;}
//! If \a enabled is true then hash quoted strings are highlighted. The
//! default is false.
//!
//! \sa highlightHashQuotedStrings()
void setHighlightHashQuotedStrings(bool enabled);
//! Returns true if hash quoted strings should be highlighted.
//!
//! \sa setHighlightHashQuotedStrings()
bool highlightHashQuotedStrings() const {return highlight_hash;}
//! If \a enabled is true then back-quoted raw strings are highlighted.
//! The default is false.
//!
//! \sa highlightBackQuotedStrings()
void setHighlightBackQuotedStrings(bool enabled);
//! Returns true if back-quoted raw strings should be highlighted.
//!
//! \sa setHighlightBackQuotedStrings()
bool highlightBackQuotedStrings() const {return highlight_back;}
//! If \a enabled is true then escape sequences in strings are highlighted.
//! The default is false.
//!
//! \sa highlightEscapeSequences()
void setHighlightEscapeSequences(bool enabled);
//! Returns true if escape sequences in strings should be highlighted.
//!
//! \sa setHighlightEscapeSequences()
bool highlightEscapeSequences() const {return highlight_escape;}
//! If \a allowed is true then escape sequences are allowed in verbatim
//! strings. The default is false.
//!
//! \sa verbatimStringEscapeSequencesAllowed()
void setVerbatimStringEscapeSequencesAllowed(bool allowed);
//! Returns true if hash quoted strings should be highlighted.
//!
//! \sa setVerbatimStringEscapeSequencesAllowed()
bool verbatimStringEscapeSequencesAllowed() const {return vs_escape;}
public slots:
//! If \a fold is true then "} else {" lines can be folded. The
//! default is false.
//!
//! \sa foldAtElse()
virtual void setFoldAtElse(bool fold);
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
//! If \a fold is true then preprocessor blocks can be folded. The
//! default is true.
//!
//! \sa foldPreprocessor()
virtual void setFoldPreprocessor(bool fold);
//! If \a style is true then preprocessor lines (after the preprocessor
//! directive) are styled. The default is false.
//!
//! \sa stylePreprocessor()
virtual void setStylePreprocessor(bool style);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa writeProperties()
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
//! \sa readProperties()
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setAtElseProp();
void setCommentProp();
void setCompactProp();
void setPreprocProp();
void setStylePreprocProp();
void setDollarsProp();
void setHighlightTripleProp();
void setHighlightHashProp();
void setHighlightBackProp();
void setHighlightEscapeProp();
void setVerbatimStringEscapeProp();
bool fold_atelse;
bool fold_comments;
bool fold_compact;
bool fold_preproc;
bool style_preproc;
bool dollars;
bool highlight_triple;
bool highlight_hash;
bool highlight_back;
bool highlight_escape;
bool vs_escape;
bool nocase;
QsciLexerCPP(const QsciLexerCPP &);
QsciLexerCPP &operator=(const QsciLexerCPP &);
};
#endif

View File

@@ -0,0 +1,77 @@
// This defines the interface to the QsciLexerCSharp class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERCSHARP_H
#define QSCILEXERCSHARP_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexercpp.h>
//! \brief The QsciLexerCSharp class encapsulates the Scintilla C#
//! lexer.
class QSCINTILLA_EXPORT QsciLexerCSharp : public QsciLexerCPP
{
Q_OBJECT
public:
//! Construct a QsciLexerCSharp with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerCSharp(QObject *parent = 0);
//! Destroys the QsciLexerCSharp instance.
virtual ~QsciLexerCSharp();
//! Returns the name of the language.
const char *language() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerCSharp(const QsciLexerCSharp &);
QsciLexerCSharp &operator=(const QsciLexerCSharp &);
};
#endif

View File

@@ -0,0 +1,252 @@
// This defines the interface to the QsciLexerCSS class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERCSS_H
#define QSCILEXERCSS_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerCSS class encapsulates the Scintilla CSS lexer.
class QSCINTILLA_EXPORT QsciLexerCSS : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! CSS lexer.
enum {
//! The default.
Default = 0,
//! A tag.
Tag = 1,
//! A class selector.
ClassSelector = 2,
//! A pseudo class. The list of pseudo classes is defined by keyword
//! set 2.
PseudoClass = 3,
//! An unknown pseudo class.
UnknownPseudoClass = 4,
//! An operator.
Operator = 5,
//! A CSS1 property. The list of CSS1 properties is defined by keyword
//! set 1.
CSS1Property = 6,
//! An unknown property.
UnknownProperty = 7,
//! A value.
Value = 8,
//! A comment.
Comment = 9,
//! An ID selector.
IDSelector = 10,
//! An important value.
Important = 11,
//! An @-rule.
AtRule = 12,
//! A double-quoted string.
DoubleQuotedString = 13,
//! A single-quoted string.
SingleQuotedString = 14,
//! A CSS2 property. The list of CSS2 properties is defined by keyword
//! set 3.
CSS2Property = 15,
//! An attribute.
Attribute = 16,
//! A CSS3 property. The list of CSS3 properties is defined by keyword
//! set 4.
CSS3Property = 17,
//! A pseudo element. The list of pseudo elements is defined by
//! keyword set 5.
PseudoElement = 18,
//! An extended (browser specific) CSS property. The list of extended
//! CSS properties is defined by keyword set 6.
ExtendedCSSProperty = 19,
//! An extended (browser specific) pseudo class. The list of extended
//! pseudo classes is defined by keyword set 7.
ExtendedPseudoClass = 20,
//! An extended (browser specific) pseudo element. The list of
//! extended pseudo elements is defined by keyword set 8.
ExtendedPseudoElement = 21,
//! A media rule.
MediaRule = 22,
//! A variable.
Variable = 23,
};
//! Construct a QsciLexerCSS with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerCSS(QObject *parent = 0);
//! Destroys the QsciLexerCSS instance.
virtual ~QsciLexerCSS();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the end of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockEnd(int *style = 0) const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
//! If \a enabled is true then support for HSS is enabled. The default is
//! false.
//!
//! \sa HSSLanguage()
void setHSSLanguage(bool enabled);
//! Returns true if support for HSS is enabled.
//!
//! \sa setHSSLanguage()
bool HSSLanguage() const {return hss_language;}
//! If \a enabled is true then support for Less CSS is enabled. The
//! default is false.
//!
//! \sa LessLanguage()
void setLessLanguage(bool enabled);
//! Returns true if support for Less CSS is enabled.
//!
//! \sa setLessLanguage()
bool LessLanguage() const {return less_language;}
//! If \a enabled is true then support for Sassy CSS is enabled. The
//! default is false.
//!
//! \sa SCSSLanguage()
void setSCSSLanguage(bool enabled);
//! Returns true if support for Sassy CSS is enabled.
//!
//! \sa setSCSSLanguage()
bool SCSSLanguage() const {return scss_language;}
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setHSSProp();
void setLessProp();
void setSCSSProp();
bool fold_comments;
bool fold_compact;
bool hss_language;
bool less_language;
bool scss_language;
QsciLexerCSS(const QsciLexerCSS &);
QsciLexerCSS &operator=(const QsciLexerCSS &);
};
#endif

View File

@@ -0,0 +1,100 @@
// This defines the interface to the QsciLexerCustom class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERCUSTOM_H
#define QSCILEXERCUSTOM_H
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
class QsciScintilla;
class QsciStyle;
//! \brief The QsciLexerCustom class is an abstract class used as a base for
//! new language lexers.
//!
//! The advantage of implementing a new lexer this way (as opposed to adding
//! the lexer to the underlying Scintilla code) is that it does not require the
//! QScintilla library to be re-compiled. It also makes it possible to
//! integrate external lexers.
//!
//! All that is necessary to implement a new lexer is to define appropriate
//! styles and to re-implement the styleText() method.
class QSCINTILLA_EXPORT QsciLexerCustom : public QsciLexer
{
Q_OBJECT
public:
//! Construct a QsciLexerCustom with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerCustom(QObject *parent = 0);
//! Destroy the QSciLexerCustom.
virtual ~QsciLexerCustom();
//! The next \a length characters starting from the current styling
//! position have their style set to style number \a style. The current
//! styling position is moved. The styling position is initially set by
//! calling startStyling().
//!
//! \sa startStyling(), styleText()
void setStyling(int length, int style);
//! The next \a length characters starting from the current styling
//! position have their style set to style \a style. The current styling
//! position is moved. The styling position is initially set by calling
//! startStyling().
//!
//! \sa startStyling(), styleText()
void setStyling(int length, const QsciStyle &style);
//! The styling position is set to \a start. \a styleBits is unused.
//!
//! \sa setStyling(), styleBitsNeeded(), styleText()
void startStyling(int pos, int styleBits = 0);
//! This is called when the section of text beginning at position \a start
//! and up to position \a end needs to be styled. \a start will always be
//! at the start of a line. The text is styled by calling startStyling()
//! followed by one or more calls to setStyling(). It must be
//! re-implemented by a sub-class.
//!
//! \sa setStyling(), startStyling(), QsciScintilla::bytes(),
//! QsciScintilla::text()
virtual void styleText(int start, int end) = 0;
//! \reimp
virtual void setEditor(QsciScintilla *editor);
//! \reimp This re-implementation returns 5 as the number of style bits
//! needed.
virtual int styleBitsNeeded() const;
private slots:
void handleStyleNeeded(int pos);
private:
QsciLexerCustom(const QsciLexerCustom &);
QsciLexerCustom &operator=(const QsciLexerCustom &);
};
#endif

View File

@@ -0,0 +1,242 @@
// This defines the interface to the QsciLexerD class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERD_H
#define QSCILEXERD_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerD class encapsulates the Scintilla D lexer.
class QSCINTILLA_EXPORT QsciLexerD : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the D
//! lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A comment line.
CommentLine = 2,
//! A JavaDoc and Doxygen comment.
CommentDoc = 3,
//! A nested comment.
CommentNested = 4,
//! A number.
Number = 5,
//! A keyword.
Keyword = 6,
//! A secondary keyword.
KeywordSecondary = 7,
//! A doc keyword
KeywordDoc = 8,
//! Typedefs and aliases
Typedefs = 9,
//! A string.
String = 10,
//! The end of a line where a string is not closed.
UnclosedString = 11,
//! A character
Character = 12,
//! An operator.
Operator = 13,
//! An identifier
Identifier = 14,
//! A JavaDoc and Doxygen line.
CommentLineDoc = 15,
//! A JavaDoc and Doxygen keyword.
CommentDocKeyword = 16,
//! A JavaDoc and Doxygen keyword error.
CommentDocKeywordError = 17,
//! A backquoted string.
BackquoteString = 18,
//! A raw, hexadecimal or delimited string.
RawString = 19,
//! A keyword defined in keyword set number 5. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet5 = 20,
//! A keyword defined in keyword set number 6. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet6 = 21,
//! A keyword defined in keyword set number 7. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet7 = 22,
};
//! Construct a QsciLexerD with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerD(QObject *parent = 0);
//! Destroys the QsciLexerD instance.
virtual ~QsciLexerD();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the character sequences that can separate
//! auto-completion words.
QStringList autoCompletionWordSeparators() const;
//! \internal Returns a space separated list of words or characters in a
//! particular style that define the end of a block for auto-indentation.
//! The styles is returned via \a style.
const char *blockEnd(int *style = 0) const;
//! \internal Returns a space separated list of words or characters in a
//! particular style that define the start of a block for auto-indentation.
//! The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns a space separated list of keywords in a particular
//! style that define the start of a block for auto-indentation. The
//! styles is returned via \a style.
const char *blockStartKeyword(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised by
//! the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the style
//! is invalid for this language then an empty QString is returned. This
//! is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if "} else {" lines can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const;
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
public slots:
//! If \a fold is true then "} else {" lines can be folded. The default is
//! false.
//!
//! \sa foldAtElse()
virtual void setFoldAtElse(bool fold);
//! If \a fold is true then multi-line comment blocks can be folded. The
//! default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa writeProperties()
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa readProperties()
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setAtElseProp();
void setCommentProp();
void setCompactProp();
bool fold_atelse;
bool fold_comments;
bool fold_compact;
QsciLexerD(const QsciLexerD &);
QsciLexerD &operator=(const QsciLexerD &);
};
#endif

View File

@@ -0,0 +1,107 @@
// This defines the interface to the QsciLexerDiff class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERDIFF_H
#define QSCILEXERDIFF_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerDiff class encapsulates the Scintilla Diff
//! lexer.
class QSCINTILLA_EXPORT QsciLexerDiff : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Diff lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A command.
Command = 2,
//! A header.
Header = 3,
//! A position.
Position = 4,
//! A line removed.
LineRemoved = 5,
//! A line added.
LineAdded = 6,
//! A line changed.
LineChanged = 7,
//! An adding patch added.
AddingPatchAdded = 8,
//! A removing patch added.
RemovingPatchAdded = 9,
//! An adding patch added.
AddingPatchRemoved = 10,
//! A removing patch added.
RemovingPatchRemoved = 11,
};
//! Construct a QsciLexerDiff with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerDiff(QObject *parent = 0);
//! Destroys the QsciLexerDiff instance.
virtual ~QsciLexerDiff();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
QColor defaultColor(int style) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerDiff(const QsciLexerDiff &);
QsciLexerDiff &operator=(const QsciLexerDiff &);
};
#endif

View File

@@ -0,0 +1,96 @@
// This defines the interface to the QsciLexerEDIFACT class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXEREDIFACT_H
#define QSCILEXEREDIFACT_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerEDIFACT class encapsulates the Scintilla EDIFACT lexer.
class QSCINTILLA_EXPORT QsciLexerEDIFACT : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! EDIFACT lexer.
enum {
//! The default.
Default = 0,
//! A segment start.
SegmentStart = 1,
//! A segment end.
SegmentEnd = 2,
//! An element separator.
ElementSeparator = 3,
//! A composite separator.
CompositeSeparator = 4,
//! A release separator.
ReleaseSeparator = 5,
//! A UNA segment header.
UNASegmentHeader = 6,
//! A UNH segment header.
UNHSegmentHeader = 7,
//! A bad segment.
BadSegment = 8,
};
//! Construct a QsciLexerEDIFACT with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerEDIFACT(QObject *parent = 0);
//! Destroys the QsciLexerEDIFACT instance.
virtual ~QsciLexerEDIFACT();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerEDIFACT(const QsciLexerEDIFACT &);
QsciLexerEDIFACT &operator=(const QsciLexerEDIFACT &);
};
#endif

View File

@@ -0,0 +1,59 @@
// This defines the interface to the QsciLexerFortran class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERFORTRAN_H
#define QSCILEXERFORTRAN_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexerfortran77.h>
//! \brief The QsciLexerFortran class encapsulates the Scintilla Fortran lexer.
class QSCINTILLA_EXPORT QsciLexerFortran : public QsciLexerFortran77
{
Q_OBJECT
public:
//! Construct a QsciLexerFortran with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerFortran(QObject *parent = 0);
//! Destroys the QsciLexerFortran instance.
virtual ~QsciLexerFortran();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
private:
QsciLexerFortran(const QsciLexerFortran &);
QsciLexerFortran &operator=(const QsciLexerFortran &);
};
#endif

View File

@@ -0,0 +1,168 @@
// This defines the interface to the QsciLexerFortran77 class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERFORTRAN77_H
#define QSCILEXERFORTRAN77_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerFortran77 class encapsulates the Scintilla Fortran77
//! lexer.
class QSCINTILLA_EXPORT QsciLexerFortran77 : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Fortran77 lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A number.
Number = 2,
//! A single-quoted string.
SingleQuotedString = 3,
//! A double-quoted string.
DoubleQuotedString = 4,
//! The end of a line where a string is not closed.
UnclosedString = 5,
//! An operator.
Operator = 6,
//! An identifier
Identifier = 7,
//! A keyword.
Keyword = 8,
//! An intrinsic function.
IntrinsicFunction = 9,
//! An extended, non-standard or user defined function.
ExtendedFunction = 10,
//! A pre-processor block.
PreProcessor = 11,
//! An operator in .NAME. format.
DottedOperator = 12,
//! A label.
Label = 13,
//! A continuation.
Continuation = 14
};
//! Construct a QsciLexerFortran77 with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerFortran77(QObject *parent = 0);
//! Destroys the QsciLexerFortran77 instance.
virtual ~QsciLexerFortran77();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
public slots:
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa writeProperties()
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
//! \sa readProperties()
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCompactProp();
bool fold_compact;
QsciLexerFortran77(const QsciLexerFortran77 &);
QsciLexerFortran77 &operator=(const QsciLexerFortran77 &);
};
#endif

View File

@@ -0,0 +1,120 @@
// This defines the interface to the abstract QsciLexerHex class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERHEX_H
#define QSCILEXERHEX_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The abstract QsciLexerHex class encapsulates the Scintilla Hex
//! lexer.
class QSCINTILLA_EXPORT QsciLexerHex : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Hex lexer.
enum {
//! The default.
Default = 0,
//! A record start.
RecordStart = 1,
//! A record type.
RecordType = 2,
//! An unknown record type.
UnknownRecordType = 3,
//! A correct byte count field.
ByteCount = 4,
//! An incorrect byte count field.
IncorrectByteCount = 5,
//! No address (S-Record and Intel Hex only).
NoAddress = 6,
//! A data address.
DataAddress = 7,
//! A record count (S-Record only).
RecordCount = 8,
//! A start address.
StartAddress = 9,
//! An extended address (Intel Hex only).
ExtendedAddress = 11,
//! Odd data.
OddData = 12,
//! Even data.
EvenData = 13,
//! Unknown data (S-Record and Intel Hex only).
UnknownData = 14,
//! A correct checksum.
Checksum = 16,
//! An incorrect checksum.
IncorrectChecksum = 17,
//! Garbage data after the record.
TrailingGarbage = 18,
};
//! Construct a QsciLexerHex with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerHex(QObject *parent = 0);
//! Destroys the QsciLexerHex instance.
virtual ~QsciLexerHex();
//! Returns the foreground colour of the text for style number \a style.
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerHex(const QsciLexerHex &);
QsciLexerHex &operator=(const QsciLexerHex &);
};
#endif

View File

@@ -0,0 +1,532 @@
// This defines the interface to the QsciLexerHTML class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERHTML_H
#define QSCILEXERHTML_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerHTML class encapsulates the Scintilla HTML lexer.
class QSCINTILLA_EXPORT QsciLexerHTML : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! HTML lexer.
enum {
//! The default.
Default = 0,
//! A tag.
Tag = 1,
//! An unknown tag.
UnknownTag = 2,
//! An attribute.
Attribute = 3,
//! An unknown attribute.
UnknownAttribute = 4,
//! An HTML number.
HTMLNumber = 5,
//! An HTML double-quoted string.
HTMLDoubleQuotedString = 6,
//! An HTML single-quoted string.
HTMLSingleQuotedString = 7,
//! Other text within a tag.
OtherInTag = 8,
//! An HTML comment.
HTMLComment = 9,
//! An entity.
Entity = 10,
//! The end of an XML style tag.
XMLTagEnd = 11,
//! The start of an XML fragment.
XMLStart = 12,
//! The end of an XML fragment.
XMLEnd = 13,
//! A script tag.
Script = 14,
//! The start of an ASP fragment with @.
ASPAtStart = 15,
//! The start of an ASP fragment.
ASPStart = 16,
//! CDATA.
CDATA = 17,
//! The start of a PHP fragment.
PHPStart = 18,
//! An unquoted HTML value.
HTMLValue = 19,
//! An ASP X-Code comment.
ASPXCComment = 20,
//! The default for SGML.
SGMLDefault = 21,
//! An SGML command.
SGMLCommand = 22,
//! The first parameter of an SGML command.
SGMLParameter = 23,
//! An SGML double-quoted string.
SGMLDoubleQuotedString = 24,
//! An SGML single-quoted string.
SGMLSingleQuotedString = 25,
//! An SGML error.
SGMLError = 26,
//! An SGML special entity.
SGMLSpecial = 27,
//! An SGML entity.
SGMLEntity = 28,
//! An SGML comment.
SGMLComment = 29,
//! A comment with the first parameter of an SGML command.
SGMLParameterComment = 30,
//! The default for an SGML block.
SGMLBlockDefault = 31,
//! The start of a JavaScript fragment.
JavaScriptStart = 40,
//! The default for JavaScript.
JavaScriptDefault = 41,
//! A JavaScript comment.
JavaScriptComment = 42,
//! A JavaScript line comment.
JavaScriptCommentLine = 43,
//! A JavaDoc style JavaScript comment.
JavaScriptCommentDoc = 44,
//! A JavaScript number.
JavaScriptNumber = 45,
//! A JavaScript word.
JavaScriptWord = 46,
//! A JavaScript keyword.
JavaScriptKeyword = 47,
//! A JavaScript double-quoted string.
JavaScriptDoubleQuotedString = 48,
//! A JavaScript single-quoted string.
JavaScriptSingleQuotedString = 49,
//! A JavaScript symbol.
JavaScriptSymbol = 50,
//! The end of a JavaScript line where a string is not closed.
JavaScriptUnclosedString = 51,
//! A JavaScript regular expression.
JavaScriptRegex = 52,
//! The start of an ASP JavaScript fragment.
ASPJavaScriptStart = 55,
//! The default for ASP JavaScript.
ASPJavaScriptDefault = 56,
//! An ASP JavaScript comment.
ASPJavaScriptComment = 57,
//! An ASP JavaScript line comment.
ASPJavaScriptCommentLine = 58,
//! An ASP JavaDoc style JavaScript comment.
ASPJavaScriptCommentDoc = 59,
//! An ASP JavaScript number.
ASPJavaScriptNumber = 60,
//! An ASP JavaScript word.
ASPJavaScriptWord = 61,
//! An ASP JavaScript keyword.
ASPJavaScriptKeyword = 62,
//! An ASP JavaScript double-quoted string.
ASPJavaScriptDoubleQuotedString = 63,
//! An ASP JavaScript single-quoted string.
ASPJavaScriptSingleQuotedString = 64,
//! An ASP JavaScript symbol.
ASPJavaScriptSymbol = 65,
//! The end of an ASP JavaScript line where a string is not
//! closed.
ASPJavaScriptUnclosedString = 66,
//! An ASP JavaScript regular expression.
ASPJavaScriptRegex = 67,
//! The start of a VBScript fragment.
VBScriptStart = 70,
//! The default for VBScript.
VBScriptDefault = 71,
//! A VBScript comment.
VBScriptComment = 72,
//! A VBScript number.
VBScriptNumber = 73,
//! A VBScript keyword.
VBScriptKeyword = 74,
//! A VBScript string.
VBScriptString = 75,
//! A VBScript identifier.
VBScriptIdentifier = 76,
//! The end of a VBScript line where a string is not closed.
VBScriptUnclosedString = 77,
//! The start of an ASP VBScript fragment.
ASPVBScriptStart = 80,
//! The default for ASP VBScript.
ASPVBScriptDefault = 81,
//! An ASP VBScript comment.
ASPVBScriptComment = 82,
//! An ASP VBScript number.
ASPVBScriptNumber = 83,
//! An ASP VBScript keyword.
ASPVBScriptKeyword = 84,
//! An ASP VBScript string.
ASPVBScriptString = 85,
//! An ASP VBScript identifier.
ASPVBScriptIdentifier = 86,
//! The end of an ASP VBScript line where a string is not
//! closed.
ASPVBScriptUnclosedString = 87,
//! The start of a Python fragment.
PythonStart = 90,
//! The default for Python.
PythonDefault = 91,
//! A Python comment.
PythonComment = 92,
//! A Python number.
PythonNumber = 93,
//! A Python double-quoted string.
PythonDoubleQuotedString = 94,
//! A Python single-quoted string.
PythonSingleQuotedString = 95,
//! A Python keyword.
PythonKeyword = 96,
//! A Python triple single-quoted string.
PythonTripleSingleQuotedString = 97,
//! A Python triple double-quoted string.
PythonTripleDoubleQuotedString = 98,
//! The name of a Python class.
PythonClassName = 99,
//! The name of a Python function or method.
PythonFunctionMethodName = 100,
//! A Python operator.
PythonOperator = 101,
//! A Python identifier.
PythonIdentifier = 102,
//! The start of an ASP Python fragment.
ASPPythonStart = 105,
//! The default for ASP Python.
ASPPythonDefault = 106,
//! An ASP Python comment.
ASPPythonComment = 107,
//! An ASP Python number.
ASPPythonNumber = 108,
//! An ASP Python double-quoted string.
ASPPythonDoubleQuotedString = 109,
//! An ASP Python single-quoted string.
ASPPythonSingleQuotedString = 110,
//! An ASP Python keyword.
ASPPythonKeyword = 111,
//! An ASP Python triple single-quoted string.
ASPPythonTripleSingleQuotedString = 112,
//! An ASP Python triple double-quoted string.
ASPPythonTripleDoubleQuotedString = 113,
//! The name of an ASP Python class.
ASPPythonClassName = 114,
//! The name of an ASP Python function or method.
ASPPythonFunctionMethodName = 115,
//! An ASP Python operator.
ASPPythonOperator = 116,
//! An ASP Python identifier
ASPPythonIdentifier = 117,
//! The default for PHP.
PHPDefault = 118,
//! A PHP double-quoted string.
PHPDoubleQuotedString = 119,
//! A PHP single-quoted string.
PHPSingleQuotedString = 120,
//! A PHP keyword.
PHPKeyword = 121,
//! A PHP number.
PHPNumber = 122,
//! A PHP variable.
PHPVariable = 123,
//! A PHP comment.
PHPComment = 124,
//! A PHP line comment.
PHPCommentLine = 125,
//! A PHP double-quoted variable.
PHPDoubleQuotedVariable = 126,
//! A PHP operator.
PHPOperator = 127
};
//! Construct a QsciLexerHTML with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerHTML(QObject *parent = 0);
//! Destroys the QsciLexerHTML instance.
virtual ~QsciLexerHTML();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the auto-completion fillup characters.
const char *autoCompletionFillups() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if tags are case sensitive.
//!
//! \sa setCaseSensitiveTags()
bool caseSensitiveTags() const {return case_sens_tags;}
//! If \a enabled is true then Django templates are enabled. The default
//! is false.
//!
//! \sa djangoTemplates()
void setDjangoTemplates(bool enabled);
//! Returns true if support for Django templates is enabled.
//!
//! \sa setDjangoTemplates()
bool djangoTemplates() const {return django_templates;}
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
//! Returns true if preprocessor blocks can be folded.
//!
//! \sa setFoldPreprocessor()
bool foldPreprocessor() const {return fold_preproc;}
//! If \a fold is true then script comments can be folded. The default is
//! false.
//!
//! \sa foldScriptComments()
void setFoldScriptComments(bool fold);
//! Returns true if script comments can be folded.
//!
//! \sa setFoldScriptComments()
bool foldScriptComments() const {return fold_script_comments;}
//! If \a fold is true then script heredocs can be folded. The default is
//! false.
//!
//! \sa foldScriptHeredocs()
void setFoldScriptHeredocs(bool fold);
//! Returns true if script heredocs can be folded.
//!
//! \sa setFoldScriptHeredocs()
bool foldScriptHeredocs() const {return fold_script_heredocs;}
//! If \a enabled is true then Mako templates are enabled. The default is
//! false.
//!
//! \sa makoTemplates()
void setMakoTemplates(bool enabled);
//! Returns true if support for Mako templates is enabled.
//!
//! \sa setMakoTemplates()
bool makoTemplates() const {return mako_templates;}
public slots:
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
//! If \a fold is true then preprocessor blocks can be folded. The
//! default is false.
//!
//! \sa foldPreprocessor()
virtual void setFoldPreprocessor(bool fold);
//! If \a sens is true then tags are case sensitive. The default is false.
//!
//! \sa caseSensitiveTags()
virtual void setCaseSensitiveTags(bool sens);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCompactProp();
void setPreprocProp();
void setCaseSensTagsProp();
void setScriptCommentsProp();
void setScriptHeredocsProp();
void setDjangoProp();
void setMakoProp();
bool fold_compact;
bool fold_preproc;
bool case_sens_tags;
bool fold_script_comments;
bool fold_script_heredocs;
bool django_templates;
bool mako_templates;
QsciLexerHTML(const QsciLexerHTML &);
QsciLexerHTML &operator=(const QsciLexerHTML &);
};
#endif

View File

@@ -0,0 +1,64 @@
// This defines the interface to the QsciLexerIDL class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERIDL_H
#define QSCILEXERIDL_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexercpp.h>
//! \brief The QsciLexerIDL class encapsulates the Scintilla IDL
//! lexer.
class QSCINTILLA_EXPORT QsciLexerIDL : public QsciLexerCPP
{
Q_OBJECT
public:
//! Construct a QsciLexerIDL with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerIDL(QObject *parent = 0);
//! Destroys the QsciLexerIDL instance.
virtual ~QsciLexerIDL();
//! Returns the name of the language.
const char *language() const;
//! Returns the foreground colour of the text for style number \a style.
QColor defaultColor(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerIDL(const QsciLexerIDL &);
QsciLexerIDL &operator=(const QsciLexerIDL &);
};
#endif

View File

@@ -0,0 +1,60 @@
// This defines the interface to the QsciLexerIntelHex class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERINTELHEX_H
#define QSCILEXERINTELHEX_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexerhex.h>
//! \brief The QsciLexerIntelHex class encapsulates the Scintilla Intel Hex
//! lexer.
class QSCINTILLA_EXPORT QsciLexerIntelHex : public QsciLexerHex
{
Q_OBJECT
public:
//! Construct a QsciLexerIntelHex with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerIntelHex(QObject *parent = 0);
//! Destroys the QsciLexerIntelHex instance.
virtual ~QsciLexerIntelHex();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer.
const char *lexer() const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerIntelHex(const QsciLexerIntelHex &);
QsciLexerIntelHex &operator=(const QsciLexerIntelHex &);
};
#endif

View File

@@ -0,0 +1,55 @@
// This defines the interface to the QsciLexerJava class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERJAVA_H
#define QSCILEXERJAVA_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexercpp.h>
//! \brief The QsciLexerJava class encapsulates the Scintilla Java lexer.
class QSCINTILLA_EXPORT QsciLexerJava : public QsciLexerCPP
{
Q_OBJECT
public:
//! Construct a QsciLexerJava with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerJava(QObject *parent = 0);
//! Destroys the QsciLexerJava instance.
virtual ~QsciLexerJava();
//! Returns the name of the language.
const char *language() const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
private:
QsciLexerJava(const QsciLexerJava &);
QsciLexerJava &operator=(const QsciLexerJava &);
};
#endif

View File

@@ -0,0 +1,81 @@
// This defines the interface to the QsciLexerJavaScript class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERJSCRIPT_H
#define QSCILEXERJSCRIPT_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexercpp.h>
//! \brief The QsciLexerJavaScript class encapsulates the Scintilla JavaScript
//! lexer.
class QSCINTILLA_EXPORT QsciLexerJavaScript : public QsciLexerCPP
{
Q_OBJECT
public:
//! Construct a QsciLexerJavaScript with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerJavaScript(QObject *parent = 0);
//! Destroys the QsciLexerJavaScript instance.
virtual ~QsciLexerJavaScript();
//! Returns the name of the language.
const char *language() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
friend class QsciLexerHTML;
static const char *keywordClass;
QsciLexerJavaScript(const QsciLexerJavaScript &);
QsciLexerJavaScript &operator=(const QsciLexerJavaScript &);
};
#endif

View File

@@ -0,0 +1,184 @@
// This defines the interface to the QsciLexerJSON class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERJSON_H
#define QSCILEXERJSON_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerJSON class encapsulates the Scintilla JSON lexer.
class QSCINTILLA_EXPORT QsciLexerJSON : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! JSON lexer.
enum {
//! The default.
Default = 0,
//! A number.
Number = 1,
//! A string.
String = 2,
//! An unclosed string.
UnclosedString = 3,
//! A property.
Property = 4,
//! An escape sequence.
EscapeSequence = 5,
//! A line comment.
CommentLine = 6,
//! A block comment.
CommentBlock = 7,
//! An operator.
Operator = 8,
//! An Internationalised Resource Identifier (IRI).
IRI = 9,
//! A JSON-LD compact IRI.
IRICompact = 10,
//! A JSON keyword.
Keyword = 11,
//! A JSON-LD keyword.
KeywordLD = 12,
//! A parsing error.
Error = 13,
};
//! Construct a QsciLexerJSON with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerJSON(QObject *parent = 0);
//! Destroys the QsciLexerJSON instance.
virtual ~QsciLexerJSON();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! If \a highlight is true then line and block comments will be
//! highlighted. The default is true.
//!
//! \sa hightlightComments()
void setHighlightComments(bool highlight);
//! Returns true if line and block comments are highlighted
//!
//! \sa setHightlightComments()
bool highlightComments() const {return allow_comments;}
//! If \a highlight is true then escape sequences in strings are
//! highlighted. The default is true.
//!
//! \sa highlightEscapeSequences()
void setHighlightEscapeSequences(bool highlight);
//! Returns true if escape sequences in strings are highlighted.
//!
//! \sa setHighlightEscapeSequences()
bool highlightEscapeSequences() const {return escape_sequence;}
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
void setFoldCompact(bool fold);
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setAllowCommentsProp();
void setEscapeSequenceProp();
void setCompactProp();
bool allow_comments;
bool escape_sequence;
bool fold_compact;
QsciLexerJSON(const QsciLexerJSON &);
QsciLexerJSON &operator=(const QsciLexerJSON &);
};
#endif

View File

@@ -0,0 +1,194 @@
// This defines the interface to the QsciLexerLua class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERLUA_H
#define QSCILEXERLUA_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerLua class encapsulates the Scintilla Lua
//! lexer.
class QSCINTILLA_EXPORT QsciLexerLua : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Lua lexer.
enum {
//! The default.
Default = 0,
//! A block comment.
Comment = 1,
//! A line comment.
LineComment = 2,
//! A number.
Number = 4,
//! A keyword.
Keyword = 5,
//! A string.
String = 6,
//! A character.
Character = 7,
//! A literal string.
LiteralString = 8,
//! Preprocessor
Preprocessor = 9,
//! An operator.
Operator = 10,
//! An identifier
Identifier = 11,
//! The end of a line where a string is not closed.
UnclosedString = 12,
//! Basic functions.
BasicFunctions = 13,
//! String, table and maths functions.
StringTableMathsFunctions = 14,
//! Coroutines, I/O and system facilities.
CoroutinesIOSystemFacilities = 15,
//! A keyword defined in keyword set number 5. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet5 = 16,
//! A keyword defined in keyword set number 6. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet6 = 17,
//! A keyword defined in keyword set number 7. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet7 = 18,
//! A keyword defined in keyword set number 8. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet8 = 19,
//! A label.
Label = 20
};
//! Construct a QsciLexerLua with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerLua(QObject *parent = 0);
//! Destroys the QsciLexerLua instance.
virtual ~QsciLexerLua();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the character sequences that can separate
//! auto-completion words.
QStringList autoCompletionWordSeparators() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
public slots:
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCompactProp();
bool fold_compact;
QsciLexerLua(const QsciLexerLua &);
QsciLexerLua &operator=(const QsciLexerLua &);
};
#endif

View File

@@ -0,0 +1,105 @@
// This defines the interface to the QsciLexerMakefile class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERMAKEFILE_H
#define QSCILEXERMAKEFILE_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerMakefile class encapsulates the Scintilla
//! Makefile lexer.
class QSCINTILLA_EXPORT QsciLexerMakefile : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Makefile lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A pre-processor directive.
Preprocessor = 2,
//! A variable.
Variable = 3,
//! An operator.
Operator = 4,
//! A target.
Target = 5,
//! An error.
Error = 9
};
//! Construct a QsciLexerMakefile with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerMakefile(QObject *parent = 0);
//! Destroys the QsciLexerMakefile instance.
virtual ~QsciLexerMakefile();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerMakefile(const QsciLexerMakefile &);
QsciLexerMakefile &operator=(const QsciLexerMakefile &);
};
#endif

View File

@@ -0,0 +1,148 @@
// This defines the interface to the QsciLexerMarkdown class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERMARKDOWN_H
#define QSCILEXERMARKDOWN_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerMarkdown class encapsulates the Scintilla Markdown
//! lexer.
class QSCINTILLA_EXPORT QsciLexerMarkdown : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Markdown lexer.
// Note that some values are omitted (ie. LINE_BEGIN and PRECHAR) as these
// seem to be internal state information rather than indicating that text
// should be styled differently.
enum {
//! The default.
Default = 0,
//! Special (e.g. end-of-line codes if enabled).
Special = 1,
//! Strong emphasis using double asterisks.
StrongEmphasisAsterisks = 2,
//! Strong emphasis using double underscores.
StrongEmphasisUnderscores = 3,
//! Emphasis using single asterisks.
EmphasisAsterisks = 4,
//! Emphasis using single underscores.
EmphasisUnderscores = 5,
//! A level 1 header.
Header1 = 6,
//! A level 2 header.
Header2 = 7,
//! A level 3 header.
Header3 = 8,
//! A level 4 header.
Header4 = 9,
//! A level 5 header.
Header5 = 10,
//! A level 6 header.
Header6 = 11,
//! Pre-char (up to three indent spaces, e.g. for a sub-list).
Prechar = 12,
//! An unordered list item.
UnorderedListItem = 13,
//! An ordered list item.
OrderedListItem = 14,
//! A block quote.
BlockQuote = 15,
//! Strike out.
StrikeOut = 16,
//! A horizontal rule.
HorizontalRule = 17,
//! A link.
Link = 18,
//! Code between backticks.
CodeBackticks = 19,
//! Code between double backticks.
CodeDoubleBackticks = 20,
//! A code block.
CodeBlock = 21,
};
//! Construct a QsciLexerMarkdown with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerMarkdown(QObject *parent = 0);
//! Destroys the QsciLexerMarkdown instance.
virtual ~QsciLexerMarkdown();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerMarkdown(const QsciLexerMarkdown &);
QsciLexerMarkdown &operator=(const QsciLexerMarkdown &);
};
#endif

View File

@@ -0,0 +1,54 @@
// This defines the interface to the QsciLexerMASM class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERMASM_H
#define QSCILEXERMASM_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexerasm.h>
//! \brief The QsciLexerMASM class encapsulates the Scintilla MASM lexer.
class QSCINTILLA_EXPORT QsciLexerMASM : public QsciLexerAsm
{
Q_OBJECT
public:
//! Construct a QsciLexerMASM with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerMASM(QObject *parent = 0);
//! Destroys the QsciLexerMASM instance.
virtual ~QsciLexerMASM();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer.
const char *lexer() const;
private:
QsciLexerMASM(const QsciLexerMASM &);
QsciLexerMASM &operator=(const QsciLexerMASM &);
};
#endif

View File

@@ -0,0 +1,104 @@
// This defines the interface to the QsciLexerMatlab class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERMATLAB_H
#define QSCILEXERMATLAB_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerMatlab class encapsulates the Scintilla Matlab file
//! lexer.
class QSCINTILLA_EXPORT QsciLexerMatlab : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Matlab file lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A command.
Command = 2,
//! A number.
Number = 3,
//! A keyword.
Keyword = 4,
//! A single quoted string.
SingleQuotedString = 5,
//! An operator
Operator = 6,
//! An identifier.
Identifier = 7,
//! A double quoted string.
DoubleQuotedString = 8
};
//! Construct a QsciLexerMatlab with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerMatlab(QObject *parent = 0);
//! Destroys the QsciLexerMatlab instance.
virtual ~QsciLexerMatlab();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerMatlab(const QsciLexerMatlab &);
QsciLexerMatlab &operator=(const QsciLexerMatlab &);
};
#endif

View File

@@ -0,0 +1,54 @@
// This defines the interface to the QsciLexerNASM class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERNASM_H
#define QSCILEXERNASM_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexerasm.h>
//! \brief The QsciLexerNASM class encapsulates the Scintilla NASM lexer.
class QSCINTILLA_EXPORT QsciLexerNASM : public QsciLexerAsm
{
Q_OBJECT
public:
//! Construct a QsciLexerNASM with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerNASM(QObject *parent = 0);
//! Destroys the QsciLexerNASM instance.
virtual ~QsciLexerNASM();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer.
const char *lexer() const;
private:
QsciLexerNASM(const QsciLexerNASM &);
QsciLexerNASM &operator=(const QsciLexerNASM &);
};
#endif

View File

@@ -0,0 +1,60 @@
// This defines the interface to the QsciLexerOctave class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXEROCTAVE_H
#define QSCILEXEROCTAVE_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexermatlab.h>
//! \brief The QsciLexerOctave class encapsulates the Scintilla Octave file
//! lexer.
class QSCINTILLA_EXPORT QsciLexerOctave : public QsciLexerMatlab
{
Q_OBJECT
public:
//! Construct a QsciLexerOctave with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerOctave(QObject *parent = 0);
//! Destroys the QsciLexerOctave instance.
virtual ~QsciLexerOctave();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
private:
QsciLexerOctave(const QsciLexerOctave &);
QsciLexerOctave &operator=(const QsciLexerOctave &);
};
#endif

View File

@@ -0,0 +1,227 @@
// This defines the interface to the QsciLexerPascal class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERPASCAL_H
#define QSCILEXERPASCAL_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerPascal class encapsulates the Scintilla Pascal lexer.
class QSCINTILLA_EXPORT QsciLexerPascal : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! C++ lexer.
enum {
//! The default.
Default = 0,
//! An identifier
Identifier = 1,
//! A '{ ... }' style comment.
Comment = 2,
//! A '(* ... *)' style comment.
CommentParenthesis = 3,
//! A comment line.
CommentLine = 4,
//! A '{$ ... }' style pre-processor block.
PreProcessor = 5,
//! A '(*$ ... *)' style pre-processor block.
PreProcessorParenthesis = 6,
//! A number.
Number = 7,
//! A hexadecimal number.
HexNumber = 8,
//! A keyword.
Keyword = 9,
//! A single-quoted string.
SingleQuotedString = 10,
//! The end of a line where a string is not closed.
UnclosedString = 11,
//! A character.
Character = 12,
//! An operator.
Operator = 13,
//! Inline Asm.
Asm = 14
};
//! Construct a QsciLexerPascal with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerPascal(QObject *parent = 0);
//! Destroys the QsciLexerPascal instance.
virtual ~QsciLexerPascal();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the character sequences that can separate
//! auto-completion words.
QStringList autoCompletionWordSeparators() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the end of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockEnd(int *style = 0) const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns a space separated list of keywords in a
//! particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStartKeyword(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
//! Returns true if preprocessor blocks can be folded.
//!
//! \sa setFoldPreprocessor()
bool foldPreprocessor() const;
//! If \a enabled is true then some keywords will only be highlighted in an
//! appropriate context (similar to how the Delphi IDE works). The default
//! is true.
//!
//! \sa smartHighlighting()
void setSmartHighlighting(bool enabled);
//! Returns true if some keywords will only be highlighted in an
//! appropriate context (similar to how the Delphi IDE works).
//!
//! \sa setSmartHighlighting()
bool smartHighlighting() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
//! If \a fold is true then preprocessor blocks can be folded. The
//! default is true.
//!
//! \sa foldPreprocessor()
virtual void setFoldPreprocessor(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa writeProperties()
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
//! \sa readProperties()
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setPreprocProp();
void setSmartHighlightProp();
bool fold_comments;
bool fold_compact;
bool fold_preproc;
bool smart_highlight;
QsciLexerPascal(const QsciLexerPascal &);
QsciLexerPascal &operator=(const QsciLexerPascal &);
};
#endif

View File

@@ -0,0 +1,312 @@
// This defines the interface to the QsciLexerPerl class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERPERL_H
#define QSCILEXERPERL_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerPerl class encapsulates the Scintilla Perl
//! lexer.
class QSCINTILLA_EXPORT QsciLexerPerl : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Perl lexer.
enum {
//! The default.
Default = 0,
//! An error.
Error = 1,
//! A comment.
Comment = 2,
//! A POD.
POD = 3,
//! A number.
Number = 4,
//! A keyword.
Keyword = 5,
//! A double-quoted string.
DoubleQuotedString = 6,
//! A single-quoted string.
SingleQuotedString = 7,
//! An operator.
Operator = 10,
//! An identifier
Identifier = 11,
//! A scalar.
Scalar = 12,
//! An array.
Array = 13,
//! A hash.
Hash = 14,
//! A symbol table.
SymbolTable = 15,
//! A regular expression.
Regex = 17,
//! A substitution.
Substitution = 18,
//! Backticks.
Backticks = 20,
//! A data section.
DataSection = 21,
//! A here document delimiter.
HereDocumentDelimiter = 22,
//! A single quoted here document.
SingleQuotedHereDocument = 23,
//! A double quoted here document.
DoubleQuotedHereDocument = 24,
//! A backtick here document.
BacktickHereDocument = 25,
//! A quoted string (q).
QuotedStringQ = 26,
//! A quoted string (qq).
QuotedStringQQ = 27,
//! A quoted string (qx).
QuotedStringQX = 28,
//! A quoted string (qr).
QuotedStringQR = 29,
//! A quoted string (qw).
QuotedStringQW = 30,
//! A verbatim POD.
PODVerbatim = 31,
//! A Subroutine prototype.
SubroutinePrototype = 40,
//! A format identifier.
FormatIdentifier = 41,
//! A format body.
FormatBody = 42,
//! A double-quoted string (interpolated variable).
DoubleQuotedStringVar = 43,
//! A translation.
Translation = 44,
//! A regular expression (interpolated variable).
RegexVar = 54,
//! A substitution (interpolated variable).
SubstitutionVar = 55,
//! Backticks (interpolated variable).
BackticksVar = 57,
//! A double quoted here document (interpolated variable).
DoubleQuotedHereDocumentVar = 61,
//! A backtick here document (interpolated variable).
BacktickHereDocumentVar = 62,
//! A quoted string (qq, interpolated variable).
QuotedStringQQVar = 64,
//! A quoted string (qx, interpolated variable).
QuotedStringQXVar = 65,
//! A quoted string (qr, interpolated variable).
QuotedStringQRVar = 66
};
//! Construct a QsciLexerPerl with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerPerl(QObject *parent = 0);
//! Destroys the QsciLexerPerl instance.
virtual ~QsciLexerPerl();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the character sequences that can separate
//! auto-completion words.
QStringList autoCompletionWordSeparators() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the end of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockEnd(int *style = 0) const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number
//! \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! If \a fold is true then "} else {" lines can be folded. The default is
//! false.
//!
//! \sa foldAtElse()
void setFoldAtElse(bool fold);
//! Returns true if "} else {" lines can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const {return fold_atelse;}
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
//! If \a fold is true then packages can be folded. The default is true.
//!
//! \sa foldPackages()
void setFoldPackages(bool fold);
//! Returns true if packages can be folded.
//!
//! \sa setFoldPackages()
bool foldPackages() const;
//! If \a fold is true then POD blocks can be folded. The default is true.
//!
//! \sa foldPODBlocks()
void setFoldPODBlocks(bool fold);
//! Returns true if POD blocks can be folded.
//!
//! \sa setFoldPODBlocks()
bool foldPODBlocks() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setAtElseProp();
void setCommentProp();
void setCompactProp();
void setPackagesProp();
void setPODBlocksProp();
bool fold_atelse;
bool fold_comments;
bool fold_compact;
bool fold_packages;
bool fold_pod_blocks;
QsciLexerPerl(const QsciLexerPerl &);
QsciLexerPerl &operator=(const QsciLexerPerl &);
};
#endif

View File

@@ -0,0 +1,163 @@
// This defines the interface to the QsciLexerPO class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERPO_H
#define QSCILEXERPO_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerPO class encapsulates the Scintilla PO lexer.
class QSCINTILLA_EXPORT QsciLexerPO : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! PO lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A message identifier.
MessageId = 2,
//! The text of a message identifier.
MessageIdText = 3,
//! A message string.
MessageString = 4,
//! The text of a message string.
MessageStringText = 5,
//! A message context.
MessageContext = 6,
//! The text of a message context.
MessageContextText = 7,
//! The "fuzzy" flag.
Fuzzy = 8,
//! A programmer comment.
ProgrammerComment = 9,
//! A reference.
Reference = 10,
//! A flag.
Flags = 11,
//! A message identifier text end-of-line.
MessageIdTextEOL = 12,
//! A message string text end-of-line.
MessageStringTextEOL = 13,
//! A message context text end-of-line.
MessageContextTextEOL = 14
};
//! Construct a QsciLexerPO with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerPO(QObject *parent = 0);
//! Destroys the QsciLexerPO instance.
virtual ~QsciLexerPO();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
bool fold_comments;
bool fold_compact;
QsciLexerPO(const QsciLexerPO &);
QsciLexerPO &operator=(const QsciLexerPO &);
};
#endif

View File

@@ -0,0 +1,204 @@
// This defines the interface to the QsciLexerPostScript class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERPOSTSCRIPT_H
#define QSCILEXERPOSTSCRIPT_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerPostScript class encapsulates the Scintilla PostScript
//! lexer.
class QSCINTILLA_EXPORT QsciLexerPostScript : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! PostScript lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A DSC comment.
DSCComment = 2,
//! A DSC comment value.
DSCCommentValue = 3,
//! A number.
Number = 4,
//! A name.
Name = 5,
//! A keyword.
Keyword = 6,
//! A literal.
Literal = 7,
//! An immediately evaluated literal.
ImmediateEvalLiteral = 8,
//! Array parenthesis.
ArrayParenthesis = 9,
//! Dictionary parenthesis.
DictionaryParenthesis = 10,
//! Procedure parenthesis.
ProcedureParenthesis = 11,
//! Text.
Text = 12,
//! A hexadecimal string.
HexString = 13,
//! A base85 string.
Base85String = 14,
//! A bad string character.
BadStringCharacter = 15
};
//! Construct a QsciLexerPostScript with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerPostScript(QObject *parent = 0);
//! Destroys the QsciLexerPostScript instance.
virtual ~QsciLexerPostScript();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string. Set 5 can be used to provide
//! additional user defined keywords.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if tokens should be marked.
//!
//! \sa setTokenize()
bool tokenize() const;
//! Returns the PostScript level.
//!
//! \sa setLevel()
int level() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
//! Returns true if else blocks can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const;
public slots:
//! If \a tokenize is true then tokens are marked. The default is false.
//!
//! \sa tokenize()
virtual void setTokenize(bool tokenize);
//! The PostScript level is set to \a level. The default is 3.
//!
//! \sa level()
virtual void setLevel(int level);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
//! If \a fold is true then else blocks can be folded. The default is
//! false.
//!
//! \sa foldAtElse()
virtual void setFoldAtElse(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setTokenizeProp();
void setLevelProp();
void setCompactProp();
void setAtElseProp();
bool ps_tokenize;
int ps_level;
bool fold_compact;
bool fold_atelse;
QsciLexerPostScript(const QsciLexerPostScript &);
QsciLexerPostScript &operator=(const QsciLexerPostScript &);
};
#endif

View File

@@ -0,0 +1,203 @@
// This defines the interface to the QsciLexerPOV class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERPOV_H
#define QSCILEXERPOV_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerPOV class encapsulates the Scintilla POV lexer.
class QSCINTILLA_EXPORT QsciLexerPOV : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! POV lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A comment line.
CommentLine = 2,
//! A number.
Number = 3,
//! An operator.
Operator = 4,
//! An identifier
Identifier = 5,
//! A string.
String = 6,
//! The end of a line where a string is not closed.
UnclosedString = 7,
//! A directive.
Directive = 8,
//! A bad directive.
BadDirective = 9,
//! Objects, CSG and appearance.
ObjectsCSGAppearance = 10,
//! Types, modifiers and items.
TypesModifiersItems = 11,
//! Predefined identifiers.
PredefinedIdentifiers = 12,
//! Predefined identifiers.
PredefinedFunctions = 13,
//! A keyword defined in keyword set number 6. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet6 = 14,
//! A keyword defined in keyword set number 7. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet7 = 15,
//! A keyword defined in keyword set number 8. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet8 = 16
};
//! Construct a QsciLexerPOV with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerPOV(QObject *parent = 0);
//! Destroys the QsciLexerPOV instance.
virtual ~QsciLexerPOV();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
//! Returns true if directives can be folded.
//!
//! \sa setFoldDirectives()
bool foldDirectives() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
//! If \a fold is true then directives can be folded. The default is
//! false.
//!
//! \sa foldDirectives()
virtual void setFoldDirectives(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setDirectiveProp();
bool fold_comments;
bool fold_compact;
bool fold_directives;
QsciLexerPOV(const QsciLexerPOV &);
QsciLexerPOV &operator=(const QsciLexerPOV &);
};
#endif

View File

@@ -0,0 +1,150 @@
// This defines the interface to the QsciLexerProperties class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERPROPERTIES_H
#define QSCILEXERPROPERTIES_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerProperties class encapsulates the Scintilla
//! Properties lexer.
class QSCINTILLA_EXPORT QsciLexerProperties : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Properties lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A section.
Section = 2,
//! An assignment operator.
Assignment = 3,
//! A default value.
DefaultValue = 4,
//! A key.
Key = 5
};
//! Construct a QsciLexerProperties with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerProperties(QObject *parent = 0);
//! Destroys the QsciLexerProperties instance.
virtual ~QsciLexerProperties();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the descriptive name for style number \a style. If the style
//! is invalid for this language then an empty QString is returned. This
//! is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
//! If \a enable is true then initial spaces in a line are allowed. The
//! default is true.
//!
//! \sa initialSpaces()
void setInitialSpaces(bool enable);
//! Returns true if initial spaces in a line are allowed.
//!
//! \sa setInitialSpaces()
bool initialSpaces() const {return initial_spaces;}
public slots:
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa writeProperties()
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
//! \sa readProperties()
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCompactProp();
void setInitialSpacesProp();
bool fold_compact;
bool initial_spaces;
QsciLexerProperties(const QsciLexerProperties &);
QsciLexerProperties &operator=(const QsciLexerProperties &);
};
#endif

View File

@@ -0,0 +1,333 @@
// This defines the interface to the QsciLexerPython class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERPYTHON_H
#define QSCILEXERPYTHON_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
#include "Qsci/qsciscintillabase.h"
//! \brief The QsciLexerPython class encapsulates the Scintilla Python lexer.
class QSCINTILLA_EXPORT QsciLexerPython : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Python lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A number.
Number = 2,
//! A double-quoted string.
DoubleQuotedString = 3,
//! A single-quoted string.
SingleQuotedString = 4,
//! A keyword.
Keyword = 5,
//! A triple single-quoted string.
TripleSingleQuotedString = 6,
//! A triple double-quoted string.
TripleDoubleQuotedString = 7,
//! The name of a class.
ClassName = 8,
//! The name of a function or method.
FunctionMethodName = 9,
//! An operator.
Operator = 10,
//! An identifier
Identifier = 11,
//! A comment block.
CommentBlock = 12,
//! The end of a line where a string is not closed.
UnclosedString = 13,
//! A highlighted identifier. These are defined by keyword set
//! 2. Reimplement keywords() to define keyword set 2.
HighlightedIdentifier = 14,
//! A decorator.
Decorator = 15,
//! A double-quoted f-string.
DoubleQuotedFString = 16,
//! A single-quoted f-string.
SingleQuotedFString = 17,
//! A triple single-quoted f-string.
TripleSingleQuotedFString = 18,
//! A triple double-quoted f-string.
TripleDoubleQuotedFString = 19,
};
//! This enum defines the different conditions that can cause
//! indentations to be displayed as being bad.
enum IndentationWarning {
//! Bad indentation is not displayed differently.
NoWarning = 0,
//! The indentation is inconsistent when compared to the
//! previous line, ie. it is made up of a different combination
//! of tabs and/or spaces.
Inconsistent = 1,
//! The indentation is made up of spaces followed by tabs.
TabsAfterSpaces = 2,
//! The indentation contains spaces.
Spaces = 3,
//! The indentation contains tabs.
Tabs = 4
};
//! Construct a QsciLexerPython with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerPython(QObject *parent = 0);
//! Destroys the QsciLexerPython instance.
virtual ~QsciLexerPython();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the character sequences that can separate
//! auto-completion words.
QStringList autoCompletionWordSeparators() const;
//! \internal Returns the number of lines prior to the current one when
//! determining the scope of a block when auto-indenting.
int blockLookback() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! \internal Returns the view used for indentation guides.
virtual int indentationGuideView() const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if indented comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
void setFoldCompact(bool fold);
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
//! Returns true if triple quoted strings can be folded.
//!
//! \sa setFoldQuotes()
bool foldQuotes() const {return fold_quotes;}
//! Returns the condition that will cause bad indentations to be
//! displayed.
//!
//! \sa setIndentationWarning()
QsciLexerPython::IndentationWarning indentationWarning() const {return indent_warn;}
//! If \a enabled is true then sub-identifiers defined in keyword set 2
//! will be highlighted. For example, if it is false and "open" is defined
//! in keyword set 2 then "foo.open" will not be highlighted. The default
//! is true.
//!
//! \sa highlightSubidentifiers()
void setHighlightSubidentifiers(bool enabled);
//! Returns true if string literals are allowed to span newline characters.
//!
//! \sa setHighlightSubidentifiers()
bool highlightSubidentifiers() const {return highlight_subids;}
//! If \a allowed is true then string literals are allowed to span newline
//! characters. The default is false.
//!
//! \sa stringsOverNewlineAllowed()
void setStringsOverNewlineAllowed(bool allowed);
//! Returns true if string literals are allowed to span newline characters.
//!
//! \sa setStringsOverNewlineAllowed()
bool stringsOverNewlineAllowed() const {return strings_over_newline;}
//! If \a allowed is true then Python v2 unicode string literals (e.g.
//! u"utf8") are allowed. The default is true.
//!
//! \sa v2UnicodeAllowed()
void setV2UnicodeAllowed(bool allowed);
//! Returns true if Python v2 unicode string literals (e.g. u"utf8") are
//! allowed.
//!
//! \sa setV2UnicodeAllowed()
bool v2UnicodeAllowed() const {return v2_unicode;}
//! If \a allowed is true then Python v3 binary and octal literals (e.g.
//! 0b1011, 0o712) are allowed. The default is true.
//!
//! \sa v3BinaryOctalAllowed()
void setV3BinaryOctalAllowed(bool allowed);
//! Returns true if Python v3 binary and octal literals (e.g. 0b1011,
//! 0o712) are allowed.
//!
//! \sa setV3BinaryOctalAllowed()
bool v3BinaryOctalAllowed() const {return v3_binary_octal;}
//! If \a allowed is true then Python v3 bytes string literals (e.g.
//! b"bytes") are allowed. The default is true.
//!
//! \sa v3BytesAllowed()
void setV3BytesAllowed(bool allowed);
//! Returns true if Python v3 bytes string literals (e.g. b"bytes") are
//! allowed.
//!
//! \sa setV3BytesAllowed()
bool v3BytesAllowed() const {return v3_bytes;}
public slots:
//! If \a fold is true then indented comment blocks can be folded. The
//! default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then triple quoted strings can be folded. The
//! default is false.
//!
//! \sa foldQuotes()
virtual void setFoldQuotes(bool fold);
//! Sets the condition that will cause bad indentations to be
//! displayed.
//!
//! \sa indentationWarning()
virtual void setIndentationWarning(QsciLexerPython::IndentationWarning warn);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setQuotesProp();
void setTabWhingeProp();
void setStringsOverNewlineProp();
void setV2UnicodeProp();
void setV3BinaryOctalProp();
void setV3BytesProp();
void setHighlightSubidsProp();
bool fold_comments;
bool fold_compact;
bool fold_quotes;
IndentationWarning indent_warn;
bool strings_over_newline;
bool v2_unicode;
bool v3_binary_octal;
bool v3_bytes;
bool highlight_subids;
friend class QsciLexerHTML;
static const char *keywordClass;
QsciLexerPython(const QsciLexerPython &);
QsciLexerPython &operator=(const QsciLexerPython &);
};
#endif

View File

@@ -0,0 +1,240 @@
// This defines the interface to the QsciLexerRuby class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERRUBY_H
#define QSCILEXERRUBY_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerRuby class encapsulates the Scintilla Ruby lexer.
class QSCINTILLA_EXPORT QsciLexerRuby : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Ruby lexer.
enum {
//! The default.
Default = 0,
//! An error.
Error = 1,
//! A comment.
Comment = 2,
//! A POD.
POD = 3,
//! A number.
Number = 4,
//! A keyword.
Keyword = 5,
//! A double-quoted string.
DoubleQuotedString = 6,
//! A single-quoted string.
SingleQuotedString = 7,
//! The name of a class.
ClassName = 8,
//! The name of a function or method.
FunctionMethodName = 9,
//! An operator.
Operator = 10,
//! An identifier
Identifier = 11,
//! A regular expression.
Regex = 12,
//! A global.
Global = 13,
//! A symbol.
Symbol = 14,
//! The name of a module.
ModuleName = 15,
//! An instance variable.
InstanceVariable = 16,
//! A class variable.
ClassVariable = 17,
//! Backticks.
Backticks = 18,
//! A data section.
DataSection = 19,
//! A here document delimiter.
HereDocumentDelimiter = 20,
//! A here document.
HereDocument = 21,
//! A %q string.
PercentStringq = 24,
//! A %Q string.
PercentStringQ = 25,
//! A %x string.
PercentStringx = 26,
//! A %r string.
PercentStringr = 27,
//! A %w string.
PercentStringw = 28,
//! A demoted keyword.
DemotedKeyword = 29,
//! stdin.
Stdin = 30,
//! stdout.
Stdout = 31,
//! stderr.
Stderr = 40
};
//! Construct a QsciLexerRuby with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerRuby(QObject *parent = 0);
//! Destroys the QsciLexerRuby instance.
virtual ~QsciLexerRuby();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the end of a block for
//! auto-indentation. The style is returned via \a style.
const char *blockEnd(int *style = 0) const;
//! \internal Returns a space separated list of words or characters in
//! a particular style that define the start of a block for
//! auto-indentation. The styles is returned via \a style.
const char *blockStart(int *style = 0) const;
//! \internal Returns a space separated list of keywords in a
//! particular style that define the start of a block for
//! auto-indentation. The style is returned via \a style.
const char *blockStartKeyword(int *style = 0) const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultpaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the style
//! is invalid for this language then an empty QString is returned. This
//! is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
void setFoldComments(bool fold);
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
void setFoldCompact(bool fold);
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs, const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs, const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
bool fold_comments;
bool fold_compact;
QsciLexerRuby(const QsciLexerRuby &);
QsciLexerRuby &operator=(const QsciLexerRuby &);
};
#endif

View File

@@ -0,0 +1,106 @@
// This defines the interface to the QsciLexerSpice class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERSPICE_H
#define QSCILEXERSPICE_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerSpice class encapsulates the Scintilla Spice lexer.
class QSCINTILLA_EXPORT QsciLexerSpice : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Spice lexer.
enum {
//! The default.
Default = 0,
//! An identifier.
Identifier = 1,
//! A command.
Command = 2,
//! A function.
Function = 3,
//! A parameter.
Parameter = 4,
//! A number.
Number = 5,
//! A delimiter.
Delimiter = 6,
//! A value.
Value = 7,
//! A comment.
Comment = 8
};
//! Construct a QsciLexerSpice with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerSpice(QObject *parent = 0);
//! Destroys the QsciLexerSpice instance.
virtual ~QsciLexerSpice();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerSpice(const QsciLexerSpice &);
QsciLexerSpice &operator=(const QsciLexerSpice &);
};
#endif

View File

@@ -0,0 +1,286 @@
// This defines the interface to the QsciLexerSQL class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERSQL_H
#define QSCILEXERSQL_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerSQL class encapsulates the Scintilla SQL lexer.
class QSCINTILLA_EXPORT QsciLexerSQL : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! SQL lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A line comment.
CommentLine = 2,
//! A JavaDoc/Doxygen style comment.
CommentDoc = 3,
//! A number.
Number = 4,
//! A keyword.
Keyword = 5,
//! A double-quoted string.
DoubleQuotedString = 6,
//! A single-quoted string.
SingleQuotedString = 7,
//! An SQL*Plus keyword.
PlusKeyword = 8,
//! An SQL*Plus prompt.
PlusPrompt = 9,
//! An operator.
Operator = 10,
//! An identifier
Identifier = 11,
//! An SQL*Plus comment.
PlusComment = 13,
//! A '#' line comment.
CommentLineHash = 15,
//! A JavaDoc/Doxygen keyword.
CommentDocKeyword = 17,
//! A JavaDoc/Doxygen keyword error.
CommentDocKeywordError = 18,
//! A keyword defined in keyword set number 5. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
//! Note that keywords must be defined using lower case.
KeywordSet5 = 19,
//! A keyword defined in keyword set number 6. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
//! Note that keywords must be defined using lower case.
KeywordSet6 = 20,
//! A keyword defined in keyword set number 7. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
//! Note that keywords must be defined using lower case.
KeywordSet7 = 21,
//! A keyword defined in keyword set number 8. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
//! Note that keywords must be defined using lower case.
KeywordSet8 = 22,
//! A quoted identifier.
QuotedIdentifier = 23,
//! A quoted operator.
QuotedOperator = 24,
};
//! Construct a QsciLexerSQL with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerSQL(QObject *parent = 0);
//! Destroys the QsciLexerSQL instance.
virtual ~QsciLexerSQL();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised by
//! the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the style
//! is invalid for this language then an empty QString is returned. This
//! is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! Returns true if backslash escapes are enabled.
//!
//! \sa setBackslashEscapes()
bool backslashEscapes() const {return backslash_escapes;}
//! If \a enable is true then words may contain dots (i.e. periods or full
//! stops). The default is false.
//!
//! \sa dottedWords()
void setDottedWords(bool enable);
//! Returns true if words may contain dots (i.e. periods or full stops).
//!
//! \sa setDottedWords()
bool dottedWords() const {return allow_dotted_word;}
//! If \a fold is true then ELSE blocks can be folded. The default is
//! false.
//!
//! \sa foldAtElse()
void setFoldAtElse(bool fold);
//! Returns true if ELSE blocks can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const {return at_else;}
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
//! If \a fold is true then only BEGIN blocks can be folded. The default
//! is false.
//!
//! \sa foldOnlyBegin()
void setFoldOnlyBegin(bool fold);
//! Returns true if BEGIN blocks only can be folded.
//!
//! \sa setFoldOnlyBegin()
bool foldOnlyBegin() const {return only_begin;}
//! If \a enable is true then '#' is used as a comment character. It is
//! typically enabled for MySQL and disabled for Oracle. The default is
//! false.
//!
//! \sa hashComments()
void setHashComments(bool enable);
//! Returns true if '#' is used as a comment character.
//!
//! \sa setHashComments()
bool hashComments() const {return numbersign_comment;}
//! If \a enable is true then quoted identifiers are enabled. The default
//! is false.
//!
//! \sa quotedIdentifiers()
void setQuotedIdentifiers(bool enable);
//! Returns true if quoted identifiers are enabled.
//!
//! \sa setQuotedIdentifiers()
bool quotedIdentifiers() const {return backticks_identifier;}
public slots:
//! If \a enable is true then backslash escapes are enabled. The
//! default is false.
//!
//! \sa backslashEscapes()
virtual void setBackslashEscapes(bool enable);
//! If \a fold is true then multi-line comment blocks can be folded. The
//! default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs, const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs, const QString &prefix) const;
private:
void setAtElseProp();
void setCommentProp();
void setCompactProp();
void setOnlyBeginProp();
void setBackticksIdentifierProp();
void setNumbersignCommentProp();
void setBackslashEscapesProp();
void setAllowDottedWordProp();
bool at_else;
bool fold_comments;
bool fold_compact;
bool only_begin;
bool backticks_identifier;
bool numbersign_comment;
bool backslash_escapes;
bool allow_dotted_word;
QsciLexerSQL(const QsciLexerSQL &);
QsciLexerSQL &operator=(const QsciLexerSQL &);
};
#endif

View File

@@ -0,0 +1,59 @@
// This defines the interface to the QsciLexerSRec class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERSREC_H
#define QSCILEXERSREC_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexerhex.h>
//! \brief The QsciLexerSRec class encapsulates the Scintilla S-Record lexer.
class QSCINTILLA_EXPORT QsciLexerSRec : public QsciLexerHex
{
Q_OBJECT
public:
//! Construct a QsciLexerSRec with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerSRec(QObject *parent = 0);
//! Destroys the QsciLexerSRec instance.
virtual ~QsciLexerSRec();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer.
const char *lexer() const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerSRec(const QsciLexerSRec &);
QsciLexerSRec &operator=(const QsciLexerSRec &);
};
#endif

View File

@@ -0,0 +1,189 @@
// This defines the interface to the QsciLexerTCL class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERTCL_H
#define QSCILEXERTCL_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerTCL class encapsulates the Scintilla TCL lexer.
class QSCINTILLA_EXPORT QsciLexerTCL : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the TCL
//! lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A comment line.
CommentLine = 2,
//! A number.
Number = 3,
//! A quoted keyword.
QuotedKeyword = 4,
//! A quoted string.
QuotedString = 5,
//! An operator.
Operator = 6,
//! An identifier
Identifier = 7,
//! A substitution.
Substitution = 8,
//! A substitution starting with a brace.
SubstitutionBrace = 9,
//! A modifier.
Modifier = 10,
//! Expand keyword (defined in keyword set number 5).
ExpandKeyword = 11,
//! A TCL keyword (defined in keyword set number 1).
TCLKeyword = 12,
//! A Tk keyword (defined in keyword set number 2).
TkKeyword = 13,
//! An iTCL keyword (defined in keyword set number 3).
ITCLKeyword = 14,
//! A Tk command (defined in keyword set number 4).
TkCommand = 15,
//! A keyword defined in keyword set number 6. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet6 = 16,
//! A keyword defined in keyword set number 7. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet7 = 17,
//! A keyword defined in keyword set number 8. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet8 = 18,
//! A keyword defined in keyword set number 9. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet9 = 19,
//! A comment box.
CommentBox = 20,
//! A comment block.
CommentBlock = 21
};
//! Construct a QsciLexerTCL with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerTCL(QObject *parent = 0);
//! Destroys the QsciLexerTCL instance.
virtual ~QsciLexerTCL();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the style
//! is invalid for this language then an empty QString is returned. This
//! is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! If \a fold is true then multi-line comment blocks can be folded. The
//! default is false.
//!
//! \sa foldComments()
void setFoldComments(bool fold);
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
bool fold_comments;
QsciLexerTCL(const QsciLexerTCL &);
QsciLexerTCL &operator=(const QsciLexerTCL &);
};
#endif

View File

@@ -0,0 +1,60 @@
// This defines the interface to the QsciLexerTekHex class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERTEKHEX_H
#define QSCILEXERTEKHEX_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexerhex.h>
//! \brief The QsciLexerTekHex class encapsulates the Scintilla Tektronix Hex
//! lexer.
class QSCINTILLA_EXPORT QsciLexerTekHex : public QsciLexerHex
{
Q_OBJECT
public:
//! Construct a QsciLexerTekHex with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerTekHex(QObject *parent = 0);
//! Destroys the QsciLexerTekHex instance.
virtual ~QsciLexerTekHex();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer.
const char *lexer() const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
private:
QsciLexerTekHex(const QsciLexerTekHex &);
QsciLexerTekHex &operator=(const QsciLexerTekHex &);
};
#endif

View File

@@ -0,0 +1,163 @@
// This defines the interface to the QsciLexerTeX class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERTEX_H
#define QSCILEXERTEX_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerTeX class encapsulates the Scintilla TeX lexer.
class QSCINTILLA_EXPORT QsciLexerTeX : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! TeX lexer.
enum {
//! The default.
Default = 0,
//! A special.
Special = 1,
//! A group.
Group = 2,
//! A symbol.
Symbol = 3,
//! A command.
Command = 4,
//! Text.
Text = 5
};
//! Construct a QsciLexerTeX with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerTeX(QObject *parent = 0);
//! Destroys the QsciLexerTeX instance.
virtual ~QsciLexerTeX();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
QColor defaultColor(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! If \a fold is true then multi-line comment blocks can be folded. The
//! default is false.
//!
//! \sa foldComments()
void setFoldComments(bool fold);
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
void setFoldCompact(bool fold);
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;}
//! If \a enable is true then comments are processed as TeX source
//! otherwise they are ignored. The default is false.
//!
//! \sa processComments()
void setProcessComments(bool enable);
//! Returns true if comments are processed as TeX source.
//!
//! \sa setProcessComments()
bool processComments() const {return process_comments;}
//! If \a enable is true then \\if<unknown> processed is processed as a
//! command. The default is true.
//!
//! \sa processIf()
void setProcessIf(bool enable);
//! Returns true if \\if<unknown> is processed as a command.
//!
//! \sa setProcessIf()
bool processIf() const {return process_if;}
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs, const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs, const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setProcessCommentsProp();
void setAutoIfProp();
bool fold_comments;
bool fold_compact;
bool process_comments;
bool process_if;
QsciLexerTeX(const QsciLexerTeX &);
QsciLexerTeX &operator=(const QsciLexerTeX &);
};
#endif

View File

@@ -0,0 +1,257 @@
// This defines the interface to the QsciLexerVerilog class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERVERILOG_H
#define QSCILEXERVERILOG_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerVerilog class encapsulates the Scintilla Verilog
//! lexer.
class QSCINTILLA_EXPORT QsciLexerVerilog : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! Verilog lexer.
enum {
//! The default.
Default = 0,
InactiveDefault = Default + 64,
//! A comment.
Comment = 1,
InactiveComment = Comment + 64,
//! A line comment.
CommentLine = 2,
InactiveCommentLine = CommentLine + 64,
//! A bang comment.
CommentBang = 3,
InactiveCommentBang = CommentBang + 64,
//! A number
Number = 4,
InactiveNumber = Number + 64,
//! A keyword.
Keyword = 5,
InactiveKeyword = Keyword + 64,
//! A string.
String = 6,
InactiveString = String + 64,
//! A keyword defined in keyword set number 2. The class must
//! be sub-classed and re-implement keywords() to make use of
//! this style.
KeywordSet2 = 7,
InactiveKeywordSet2 = KeywordSet2 + 64,
//! A system task.
SystemTask = 8,
InactiveSystemTask = SystemTask + 64,
//! A pre-processor block.
Preprocessor = 9,
InactivePreprocessor = Preprocessor + 64,
//! An operator.
Operator = 10,
InactiveOperator = Operator + 64,
//! An identifier.
Identifier = 11,
InactiveIdentifier = Identifier + 64,
//! The end of a line where a string is not closed.
UnclosedString = 12,
InactiveUnclosedString = UnclosedString + 64,
//! A keyword defined in keyword set number 4. The class must
//! be sub-classed and re-implement keywords() to make use of
//! this style. This set is intended to be used for user defined
//! identifiers and tasks.
UserKeywordSet = 19,
InactiveUserKeywordSet = UserKeywordSet + 64,
//! A keyword comment.
CommentKeyword = 20,
InactiveCommentKeyword = CommentKeyword + 64,
//! An input port declaration.
DeclareInputPort = 21,
InactiveDeclareInputPort = DeclareInputPort + 64,
//! An output port declaration.
DeclareOutputPort = 22,
InactiveDeclareOutputPort = DeclareOutputPort + 64,
//! An input/output port declaration.
DeclareInputOutputPort = 23,
InactiveDeclareInputOutputPort = DeclareInputOutputPort + 64,
//! A port connection.
PortConnection = 24,
InactivePortConnection = PortConnection + 64,
};
//! Construct a QsciLexerVerilog with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerVerilog(QObject *parent = 0);
//! Destroys the QsciLexerVerilog instance.
virtual ~QsciLexerVerilog();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the string of characters that comprise a word.
const char *wordCharacters() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! If \a fold is true then "} else {" lines can be folded. The
//! default is false.
//!
//! \sa foldAtElse()
void setFoldAtElse(bool fold);
//! Returns true if "} else {" lines can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const {return fold_atelse;}
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
void setFoldComments(bool fold);
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const {return fold_comments;}
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
void setFoldCompact(bool fold);
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const {return fold_compact;};
//! If \a fold is true then preprocessor blocks can be folded. The
//! default is true.
//!
//! \sa foldPreprocessor()
void setFoldPreprocessor(bool fold);
//! Returns true if preprocessor blocks can be folded.
//!
//! \sa setFoldPreprocessor()
bool foldPreprocessor() const {return fold_preproc;};
//! If \a fold is true then modules can be folded. The default is false.
//!
//! \sa foldAtModule()
void setFoldAtModule(bool fold);
//! Returns true if modules can be folded.
//!
//! \sa setFoldAtModule()
bool foldAtModule() const {return fold_atmodule;};
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
//! \sa writeProperties()
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
//! \sa readProperties()
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setAtElseProp();
void setCommentProp();
void setCompactProp();
void setPreprocProp();
void setAtModuleProp();
bool fold_atelse;
bool fold_comments;
bool fold_compact;
bool fold_preproc;
bool fold_atmodule;
QsciLexerVerilog(const QsciLexerVerilog &);
QsciLexerVerilog &operator=(const QsciLexerVerilog &);
};
#endif

View File

@@ -0,0 +1,221 @@
// This defines the interface to the QsciLexerVHDL class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERVHDL_H
#define QSCILEXERVHDL_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerVHDL class encapsulates the Scintilla VHDL lexer.
class QSCINTILLA_EXPORT QsciLexerVHDL : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! VHDL lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! A comment line.
CommentLine = 2,
//! A number.
Number = 3,
//! A string.
String = 4,
//! An operator.
Operator = 5,
//! An identifier
Identifier = 6,
//! The end of a line where a string is not closed.
UnclosedString = 7,
//! A keyword.
Keyword = 8,
//! A standard operator.
StandardOperator = 9,
//! An attribute.
Attribute = 10,
//! A standard function.
StandardFunction = 11,
//! A standard package.
StandardPackage = 12,
//! A standard type.
StandardType = 13,
//! A keyword defined in keyword set number 7. The class must be
//! sub-classed and re-implement keywords() to make use of this style.
KeywordSet7 = 14,
//! A comment block.
CommentBlock = 15,
};
//! Construct a QsciLexerVHDL with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerVHDL(QObject *parent = 0);
//! Destroys the QsciLexerVHDL instance.
virtual ~QsciLexerVHDL();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! \internal Returns the style used for braces for brace matching.
int braceStyle() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
//! Returns true if trailing blank lines are included in a fold block.
//!
//! \sa setFoldCompact()
bool foldCompact() const;
//! Returns true if else blocks can be folded.
//!
//! \sa setFoldAtElse()
bool foldAtElse() const;
//! Returns true if begin blocks can be folded.
//!
//! \sa setFoldAtBegin()
bool foldAtBegin() const;
//! Returns true if blocks can be folded at a parenthesis.
//!
//! \sa setFoldAtParenthesis()
bool foldAtParenthesis() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is true.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
//! If \a fold is true then trailing blank lines are included in a fold
//! block. The default is true.
//!
//! \sa foldCompact()
virtual void setFoldCompact(bool fold);
//! If \a fold is true then else blocks can be folded. The default is
//! true.
//!
//! \sa foldAtElse()
virtual void setFoldAtElse(bool fold);
//! If \a fold is true then begin blocks can be folded. The default is
//! true.
//!
//! \sa foldAtBegin()
virtual void setFoldAtBegin(bool fold);
//! If \a fold is true then blocks can be folded at a parenthesis. The
//! default is true.
//!
//! \sa foldAtParenthesis()
virtual void setFoldAtParenthesis(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
void setCompactProp();
void setAtElseProp();
void setAtBeginProp();
void setAtParenthProp();
bool fold_comments;
bool fold_compact;
bool fold_atelse;
bool fold_atbegin;
bool fold_atparenth;
QsciLexerVHDL(const QsciLexerVHDL &);
QsciLexerVHDL &operator=(const QsciLexerVHDL &);
};
#endif

View File

@@ -0,0 +1,106 @@
// This defines the interface to the QsciLexerXML class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERXML_H
#define QSCILEXERXML_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexerhtml.h>
//! \brief The QsciLexerXML class encapsulates the Scintilla XML lexer.
class QSCINTILLA_EXPORT QsciLexerXML : public QsciLexerHTML
{
Q_OBJECT
public:
//! Construct a QsciLexerXML with parent \a parent. \a parent is typically
//! the QsciScintilla instance.
QsciLexerXML(QObject *parent = 0);
//! Destroys the QsciLexerXML instance.
virtual ~QsciLexerXML();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Causes all properties to be refreshed by emitting the
//! propertyChanged() signal as required.
void refreshProperties();
//! If \a allowed is true then scripts are styled. The default is true.
//!
//! \sa scriptsStyled()
void setScriptsStyled(bool styled);
//! Returns true if scripts are styled.
//!
//! \sa setScriptsStyled()
bool scriptsStyled() const;
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs, const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs, const QString &prefix) const;
private:
void setScriptsProp();
bool scripts;
QsciLexerXML(const QsciLexerXML &);
QsciLexerXML &operator=(const QsciLexerXML &);
};
#endif

View File

@@ -0,0 +1,147 @@
// This defines the interface to the QsciLexerYAML class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCILEXERYAML_H
#define QSCILEXERYAML_H
#include <QObject>
#include <Qsci/qsciglobal.h>
#include <Qsci/qscilexer.h>
//! \brief The QsciLexerYAML class encapsulates the Scintilla YAML lexer.
class QSCINTILLA_EXPORT QsciLexerYAML : public QsciLexer
{
Q_OBJECT
public:
//! This enum defines the meanings of the different styles used by the
//! YAML lexer.
enum {
//! The default.
Default = 0,
//! A comment.
Comment = 1,
//! An identifier.
Identifier = 2,
//! A keyword
Keyword = 3,
//! A number.
Number = 4,
//! A reference.
Reference = 5,
//! A document delimiter.
DocumentDelimiter = 6,
//! A text block marker.
TextBlockMarker = 7,
//! A syntax error marker.
SyntaxErrorMarker = 8,
//! An operator.
Operator = 9
};
//! Construct a QsciLexerYAML with parent \a parent. \a parent is
//! typically the QsciScintilla instance.
QsciLexerYAML(QObject *parent = 0);
//! Destroys the QsciLexerYAML instance.
virtual ~QsciLexerYAML();
//! Returns the name of the language.
const char *language() const;
//! Returns the name of the lexer. Some lexers support a number of
//! languages.
const char *lexer() const;
//! Returns the foreground colour of the text for style number \a style.
//!
//! \sa defaultPaper()
QColor defaultColor(int style) const;
//! Returns the end-of-line fill for style number \a style.
bool defaultEolFill(int style) const;
//! Returns the font for style number \a style.
QFont defaultFont(int style) const;
//! Returns the background colour of the text for style number \a style.
//!
//! \sa defaultColor()
QColor defaultPaper(int style) const;
//! Returns the set of keywords for the keyword set \a set recognised
//! by the lexer as a space separated string.
const char *keywords(int set) const;
//! Returns the descriptive name for style number \a style. If the
//! style is invalid for this language then an empty QString is returned.
//! This is intended to be used in user preference dialogs.
QString description(int style) const;
//! Causes all properties to be refreshed by emitting the propertyChanged()
//! signal as required.
void refreshProperties();
//! Returns true if multi-line comment blocks can be folded.
//!
//! \sa setFoldComments()
bool foldComments() const;
public slots:
//! If \a fold is true then multi-line comment blocks can be folded.
//! The default is false.
//!
//! \sa foldComments()
virtual void setFoldComments(bool fold);
protected:
//! The lexer's properties are read from the settings \a qs. \a prefix
//! (which has a trailing '/') should be used as a prefix to the key of
//! each setting. true is returned if there is no error.
//!
bool readProperties(QSettings &qs,const QString &prefix);
//! The lexer's properties are written to the settings \a qs.
//! \a prefix (which has a trailing '/') should be used as a prefix to
//! the key of each setting. true is returned if there is no error.
//!
bool writeProperties(QSettings &qs,const QString &prefix) const;
private:
void setCommentProp();
bool fold_comments;
QsciLexerYAML(const QsciLexerYAML &);
QsciLexerYAML &operator=(const QsciLexerYAML &);
};
#endif

View File

@@ -0,0 +1,98 @@
// This defines the interface to the QsciMacro class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCIMACRO_H
#define QSCIMACRO_H
#include <QList>
#include <QObject>
#include <QString>
#include <Qsci/qsciglobal.h>
class QsciScintilla;
//! \brief The QsciMacro class represents a sequence of recordable editor
//! commands.
//!
//! Methods are provided to convert convert a macro to and from a textual
//! representation so that they can be easily written to and read from
//! permanent storage.
class QSCINTILLA_EXPORT QsciMacro : public QObject
{
Q_OBJECT
public:
//! Construct a QsciMacro with parent \a parent.
QsciMacro(QsciScintilla *parent);
//! Construct a QsciMacro from the printable ASCII representation \a asc,
//! with parent \a parent.
QsciMacro(const QString &asc, QsciScintilla *parent);
//! Destroy the QsciMacro instance.
virtual ~QsciMacro();
//! Clear the contents of the macro.
void clear();
//! Load the macro from the printable ASCII representation \a asc. Returns
//! true if there was no error.
//!
//! \sa save()
bool load(const QString &asc);
//! Return a printable ASCII representation of the macro. It is guaranteed
//! that only printable ASCII characters are used and that double quote
//! characters will not be used.
//!
//! \sa load()
QString save() const;
public slots:
//! Play the macro.
virtual void play();
//! Start recording user commands and add them to the macro.
virtual void startRecording();
//! Stop recording user commands.
virtual void endRecording();
private slots:
void record(unsigned int msg, unsigned long wParam, void *lParam);
private:
struct Macro {
unsigned int msg;
unsigned long wParam;
QByteArray text;
};
QsciScintilla *qsci;
QList<Macro> macro;
QsciMacro(const QsciMacro &);
QsciMacro &operator=(const QsciMacro &);
};
#endif

View File

@@ -0,0 +1,120 @@
// This module defines interface to the QsciPrinter class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCIPRINTER_H
#define QSCIPRINTER_H
// This is needed for Qt v5.0.0-alpha.
#if defined(B0)
#undef B0
#endif
#include <qprinter.h>
#if !defined(QT_NO_PRINTER)
#include <Qsci/qsciglobal.h>
#include <Qsci/qsciscintilla.h>
QT_BEGIN_NAMESPACE
class QRect;
class QPainter;
QT_END_NAMESPACE
class QsciScintillaBase;
//! \brief The QsciPrinter class is a sub-class of the Qt QPrinter class that
//! is able to print the text of a Scintilla document.
//!
//! The class can be further sub-classed to alter to layout of the text, adding
//! headers and footers for example.
class QSCINTILLA_EXPORT QsciPrinter : public QPrinter
{
public:
//! Constructs a printer paint device with mode \a mode.
QsciPrinter(PrinterMode mode = ScreenResolution);
//! Destroys the QsciPrinter instance.
virtual ~QsciPrinter();
//! Format a page, by adding headers and footers for example, before the
//! document text is drawn on it. \a painter is the painter to be used to
//! add customised text and graphics. \a drawing is true if the page is
//! actually being drawn rather than being sized. \a painter drawing
//! methods must only be called when \a drawing is true. \a area is the
//! area of the page that will be used to draw the text. This should be
//! modified if it is necessary to reserve space for any customised text or
//! graphics. By default the area is relative to the printable area of the
//! page. Use QPrinter::setFullPage() before calling printRange() if you
//! want to try and print over the whole page. \a pagenr is the number of
//! the page. The first page is numbered 1.
virtual void formatPage(QPainter &painter, bool drawing, QRect &area,
int pagenr);
//! Return the number of points to add to each font when printing.
//!
//! \sa setMagnification()
int magnification() const {return mag;}
//! Sets the number of points to add to each font when printing to \a
//! magnification.
//!
//! \sa magnification()
virtual void setMagnification(int magnification);
//! Print a range of lines from the Scintilla instance \a qsb using the
//! supplied QPainter \a painter. \a from is the first line to print and a
//! negative value signifies the first line of text. \a to is the last
//! line to print and a negative value signifies the last line of text.
//! true is returned if there was no error.
virtual int printRange(QsciScintillaBase *qsb, QPainter &painter,
int from = -1, int to = -1);
//! Print a range of lines from the Scintilla instance \a qsb using a
//! default QPainter. \a from is the first line to print and a negative
//! value signifies the first line of text. \a to is the last line to
//! print and a negative value signifies the last line of text. true is
//! returned if there was no error.
virtual int printRange(QsciScintillaBase *qsb, int from = -1, int to = -1);
//! Return the line wrap mode used when printing. The default is
//! QsciScintilla::WrapWord.
//!
//! \sa setWrapMode()
QsciScintilla::WrapMode wrapMode() const {return wrap;}
//! Sets the line wrap mode used when printing to \a wmode.
//!
//! \sa wrapMode()
virtual void setWrapMode(QsciScintilla::WrapMode wmode);
private:
int mag;
QsciScintilla::WrapMode wrap;
QsciPrinter(const QsciPrinter &);
QsciPrinter &operator=(const QsciPrinter &);
};
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,204 @@
// This module defines interface to the QsciStyle class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCISTYLE_H
#define QSCISTYLE_H
#include <qcolor.h>
#include <qfont.h>
#include <qstring.h>
#include <Qsci/qsciglobal.h>
class QsciScintillaBase;
//! \brief The QsciStyle class encapsulates all the attributes of a style.
//!
//! Each character of a document has an associated style which determines how
//! the character is displayed, e.g. its font and color. A style is identified
//! by a number. Lexers define styles for each of the language's features so
//! that they are displayed differently. Some style numbers have hard-coded
//! meanings, e.g. the style used for call tips.
class QSCINTILLA_EXPORT QsciStyle
{
public:
//! This enum defines the different ways the displayed case of the text can
//! be changed.
enum TextCase {
//! The text is displayed as its original case.
OriginalCase = 0,
//! The text is displayed as upper case.
UpperCase = 1,
//! The text is displayed as lower case.
LowerCase = 2
};
//! Constructs a QsciStyle instance for style number \a style. If \a style
//! is negative then a new style number is automatically allocated if
//! possible. If it is not possible then style() will return a negative
//! value.
//!
//! \sa style()
QsciStyle(int style = -1);
//! Constructs a QsciStyle instance for style number \a style. If \a style
//! is negative then a new style number is automatically allocated if
//! possible. If it is not possible then style() will return a negative
//! value. The styles description, color, paper color, font and
//! end-of-line fill are set to \a description, \a color, \a paper, \a font
//! and \a eolFill respectively.
//!
//! \sa style()
QsciStyle(int style, const QString &description, const QColor &color,
const QColor &paper, const QFont &font, bool eolFill = false);
//! \internal Apply the style to a particular editor.
void apply(QsciScintillaBase *sci) const;
//! The style's number is set to \a style.
//!
//! \sa style()
void setStyle(int style) {style_nr = style;}
//! Returns the number of the style. This will be negative if the style is
//! invalid.
//!
//! \sa setStyle()
int style() const {return style_nr;}
//! The style's description is set to \a description.
//!
//! \sa description()
void setDescription(const QString &description) {style_description = description;}
//! Returns the style's description.
//!
//! \sa setDescription()
QString description() const {return style_description;}
//! The style's foreground color is set to \a color. The default is taken
//! from the application's default palette.
//!
//! \sa color()
void setColor(const QColor &color);
//! Returns the style's foreground color.
//!
//! \sa setColor()
QColor color() const {return style_color;}
//! The style's background color is set to \a paper. The default is taken
//! from the application's default palette.
//!
//! \sa paper()
void setPaper(const QColor &paper);
//! Returns the style's background color.
//!
//! \sa setPaper()
QColor paper() const {return style_paper;}
//! The style's font is set to \a font. The default is the application's
//! default font.
//!
//! \sa font()
void setFont(const QFont &font);
//! Returns the style's font.
//!
//! \sa setFont()
QFont font() const {return style_font;}
//! The style's end-of-line fill is set to \a fill. The default is false.
//!
//! \sa eolFill()
void setEolFill(bool fill);
//! Returns the style's end-of-line fill.
//!
//! \sa setEolFill()
bool eolFill() const {return style_eol_fill;}
//! The style's text case is set to \a text_case. The default is
//! OriginalCase.
//!
//! \sa textCase()
void setTextCase(TextCase text_case);
//! Returns the style's text case.
//!
//! \sa setTextCase()
TextCase textCase() const {return style_case;}
//! The style's visibility is set to \a visible. The default is true.
//!
//! \sa visible()
void setVisible(bool visible);
//! Returns the style's visibility.
//!
//! \sa setVisible()
bool visible() const {return style_visible;}
//! The style's changeability is set to \a changeable. The default is
//! true.
//!
//! \sa changeable()
void setChangeable(bool changeable);
//! Returns the style's changeability.
//!
//! \sa setChangeable()
bool changeable() const {return style_changeable;}
//! The style's sensitivity to mouse clicks is set to \a hotspot. The
//! default is false.
//!
//! \sa hotspot()
void setHotspot(bool hotspot);
//! Returns the style's sensitivity to mouse clicks.
//!
//! \sa setHotspot()
bool hotspot() const {return style_hotspot;}
//! Refresh the style settings.
void refresh();
private:
int style_nr;
QString style_description;
QColor style_color;
QColor style_paper;
QFont style_font;
bool style_eol_fill;
TextCase style_case;
bool style_visible;
bool style_changeable;
bool style_hotspot;
void init(int style);
};
#endif

View File

@@ -0,0 +1,61 @@
// This module defines interface to the QsciStyledText class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef QSCISTYLEDTEXT_H
#define QSCISTYLEDTEXT_H
#include <qstring.h>
#include <Qsci/qsciglobal.h>
class QsciScintillaBase;
class QsciStyle;
//! \brief The QsciStyledText class is a container for a piece of text and the
//! style used to display the text.
class QSCINTILLA_EXPORT QsciStyledText
{
public:
//! Constructs a QsciStyledText instance for text \a text and style number
//! \a style.
QsciStyledText(const QString &text, int style);
//! Constructs a QsciStyledText instance for text \a text and style \a
//! style.
QsciStyledText(const QString &text, const QsciStyle &style);
//! \internal Apply the style to a particular editor.
void apply(QsciScintillaBase *sci) const;
//! Returns a reference to the text.
const QString &text() const {return styled_text;}
//! Returns the number of the style.
int style() const;
private:
QString styled_text;
int style_nr;
const QsciStyle *explicit_style;
};
#endif

View File

@@ -0,0 +1,739 @@
// The implementation of the class that implements accessibility support.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <qglobal.h>
#if !defined(QT_NO_ACCESSIBILITY)
#include "SciAccessibility.h"
#include <QAccessible>
#include <QFont>
#include <QFontMetrics>
#include <QRect>
#include <QWidget>
#include "Qsci/qsciscintillabase.h"
// Set if the accessibility support needs initialising.
bool QsciAccessibleScintillaBase::needs_initialising = true;
// The list of all accessibles.
QList<QsciAccessibleScintillaBase *> QsciAccessibleScintillaBase::all_accessibles;
// Forward declarations.
static QAccessibleInterface *factory(const QString &classname, QObject *object);
// The ctor.
QsciAccessibleScintillaBase::QsciAccessibleScintillaBase(QWidget *widget) :
QAccessibleWidget(widget, QAccessible::EditableText),
current_cursor_offset(-1), is_selection(false)
{
all_accessibles.append(this);
}
// The dtor.
QsciAccessibleScintillaBase::~QsciAccessibleScintillaBase()
{
all_accessibles.removeOne(this);
}
// Initialise the accessibility support.
void QsciAccessibleScintillaBase::initialise()
{
if (needs_initialising)
{
QAccessible::installFactory(factory);
needs_initialising = false;
}
}
// Find the accessible for a widget.
QsciAccessibleScintillaBase *QsciAccessibleScintillaBase::findAccessible(
QsciScintillaBase *sb)
{
for (int i = 0; i < all_accessibles.size(); ++i)
{
QsciAccessibleScintillaBase *acc_sb = all_accessibles.at(i);
if (acc_sb->sciWidget() == sb)
return acc_sb;
}
return 0;
}
// Return the QsciScintillaBase instance.
QsciScintillaBase *QsciAccessibleScintillaBase::sciWidget() const
{
return static_cast<QsciScintillaBase *>(widget());
}
// Update the accessible when the selection has changed.
void QsciAccessibleScintillaBase::selectionChanged(QsciScintillaBase *sb,
bool selection)
{
QsciAccessibleScintillaBase *acc_sb = findAccessible(sb);
if (!acc_sb)
return;
acc_sb->is_selection = selection;
}
// Update the accessibility when text has been inserted.
void QsciAccessibleScintillaBase::textInserted(QsciScintillaBase *sb,
int position, const char *text, int length)
{
Q_ASSERT(text);
QString new_text = sb->bytesAsText(text, length);
int offset = positionAsOffset(sb, position);
QAccessibleTextInsertEvent ev(sb, offset, new_text);
QAccessible::updateAccessibility(&ev);
}
// Return the fragment of text before an offset.
QString QsciAccessibleScintillaBase::textBeforeOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
// Initialise in case of errors.
*startOffset = *endOffset = -1;
int position = validPosition(offset);
if (position < 0)
return QString();
int start_position, end_position;
if (!boundaries(sb, position, boundaryType, &start_position, &end_position))
return QString();
if (start_position == 0)
return QString();
if (!boundaries(sb, start_position - 1, boundaryType, &start_position, &end_position))
return QString();
positionRangeAsOffsetRange(sb, start_position, end_position, startOffset,
endOffset);
return textRange(sb, start_position, end_position);
}
// Return the fragment of text after an offset.
QString QsciAccessibleScintillaBase::textAfterOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
// Initialise in case of errors.
*startOffset = *endOffset = -1;
int position = validPosition(offset);
if (position < 0)
return QString();
int start_position, end_position;
if (!boundaries(sb, position, boundaryType, &start_position, &end_position))
return QString();
if (end_position >= sb->SendScintilla(QsciScintillaBase::SCI_GETTEXTLENGTH))
return QString();
if (!boundaries(sb, end_position, boundaryType, &start_position, &end_position))
return QString();
positionRangeAsOffsetRange(sb, start_position, end_position, startOffset,
endOffset);
return textRange(sb, start_position, end_position);
}
// Return the fragment of text at an offset.
QString QsciAccessibleScintillaBase::textAtOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
// Initialise in case of errors.
*startOffset = *endOffset = -1;
int position = validPosition(offset);
if (position < 0)
return QString();
int start_position, end_position;
if (!boundaries(sb, position, boundaryType, &start_position, &end_position))
return QString();
positionRangeAsOffsetRange(sb, start_position, end_position, startOffset,
endOffset);
return textRange(sb, start_position, end_position);
}
// Update the accessibility when text has been deleted.
void QsciAccessibleScintillaBase::textDeleted(QsciScintillaBase *sb,
int position, const char *text, int length)
{
Q_ASSERT(text);
QString old_text = sb->bytesAsText(text, length);
int offset = positionAsOffset(sb, position);
QAccessibleTextRemoveEvent ev(sb, offset, old_text);
QAccessible::updateAccessibility(&ev);
}
// Update the accessibility when the UI has been updated.
void QsciAccessibleScintillaBase::updated(QsciScintillaBase *sb)
{
QsciAccessibleScintillaBase *acc_sb = findAccessible(sb);
if (!acc_sb)
return;
int cursor_offset = positionAsOffset(sb,
sb->SendScintilla(QsciScintillaBase::SCI_GETCURRENTPOS));
if (acc_sb->current_cursor_offset != cursor_offset)
{
acc_sb->current_cursor_offset = cursor_offset;
QAccessibleTextCursorEvent ev(sb, cursor_offset);
QAccessible::updateAccessibility(&ev);
}
}
// Return a valid position from an offset or -1 if it was invalid.
int QsciAccessibleScintillaBase::validPosition(int offset) const
{
// An offset of -1 is interpreted as the length of the text.
int nr_chars = characterCount();
if (offset == -1)
offset = nr_chars;
// Check there is some text and the offset is within range.
if (nr_chars == 0 || offset < 0 || offset > nr_chars)
return -1;
return offsetAsPosition(sciWidget(), offset);
}
// Get the start and end boundary positions for a type of boundary. true is
// returned if the boundary positions are valid.
bool QsciAccessibleScintillaBase::boundaries(QsciScintillaBase *sb,
int position, QAccessible::TextBoundaryType boundaryType,
int *start_position, int *end_position)
{
// This implementation is based on what Qt does although that may itself be
// wrong. The cursor is in a word if it is before or after any character
// in the word. If the cursor is not in a word (eg. is has a space each
// side) then the previous word is current.
switch (boundaryType)
{
case QAccessible::CharBoundary:
*start_position = position;
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_POSITIONAFTER, position);
break;
case QAccessible::WordBoundary:
*start_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDSTARTPOSITION, position, 1);
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDENDPOSITION, position, 1);
// If the start and end positions are the same then we are not in a
// word.
if (*start_position == *end_position)
{
// We need the immediately preceding word. Note that Qt behaves
// differently as it will not move before the current line.
// Find the end of the preceding word.
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDSTARTPOSITION, position, 0L);
// If the end is 0 then there isn't a preceding word.
if (*end_position == 0)
return false;
// Now find the start.
*start_position = sb->SendScintilla(
QsciScintillaBase::SCI_WORDSTARTPOSITION, *end_position,
1);
}
break;
case QAccessible::SentenceBoundary:
return false;
case QAccessible::ParagraphBoundary:
// Paragraph boundaries are supposed to be supported but it isn't clear
// what this means in a code editor.
return false;
case QAccessible::LineBoundary:
{
int line = sb->SendScintilla(
QsciScintillaBase::SCI_LINEFROMPOSITION, position);
*start_position = sb->SendScintilla(
QsciScintillaBase::SCI_POSITIONFROMLINE, line);
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_POSITIONFROMLINE, line + 1);
// See if we are after the last end-of-line character.
if (*start_position == *end_position)
return false;
}
break;
case QAccessible::NoBoundary:
*start_position = 0;
*end_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETTEXTLENGTH);
break;
}
return true;
}
// Return the text between two positions.
QString QsciAccessibleScintillaBase::textRange(QsciScintillaBase *sb,
int start_position, int end_position)
{
QByteArray bytes(end_position - start_position + 1, '\0');
sb->SendScintilla(QsciScintillaBase::SCI_GETTEXTRANGE, start_position,
end_position, bytes.data());
return sb->bytesAsText(bytes.constData(), bytes.size() - 1);
}
// Convert a byte position to a character offset.
int QsciAccessibleScintillaBase::positionAsOffset(QsciScintillaBase *sb,
int position)
{
return sb->SendScintilla(QsciScintillaBase::SCI_COUNTCHARACTERS, 0,
position);
}
// Convert a range of byte poisitions to character offsets.
void QsciAccessibleScintillaBase::positionRangeAsOffsetRange(
QsciScintillaBase *sb, int start_position, int end_position,
int *startOffset, int *endOffset)
{
*startOffset = positionAsOffset(sb, start_position);
*endOffset = positionAsOffset(sb, end_position);
}
// Convert character offset position to a byte position.
int QsciAccessibleScintillaBase::offsetAsPosition(QsciScintillaBase *sb,
int offset)
{
return sb->SendScintilla(QsciScintillaBase::SCI_POSITIONRELATIVE, 0,
offset);
}
// Get the current selection if any.
void QsciAccessibleScintillaBase::selection(int selectionIndex,
int *startOffset, int *endOffset) const
{
int start, end;
if (selectionIndex == 0 && is_selection)
{
QsciScintillaBase *sb = sciWidget();
int start_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETSELECTIONSTART);
int end_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETSELECTIONEND);
start = positionAsOffset(sb, start_position);
end = positionAsOffset(sb, end_position);
}
else
{
start = end = 0;
}
*startOffset = start;
*endOffset = end;
}
// Return the number of selections.
int QsciAccessibleScintillaBase::selectionCount() const
{
return (is_selection ? 1 : 0);
}
// Add a selection.
void QsciAccessibleScintillaBase::addSelection(int startOffset, int endOffset)
{
setSelection(0, startOffset, endOffset);
}
// Remove a selection.
void QsciAccessibleScintillaBase::removeSelection(int selectionIndex)
{
if (selectionIndex == 0)
sciWidget()->SendScintilla(QsciScintillaBase::SCI_CLEARSELECTIONS);
}
// Set the selection.
void QsciAccessibleScintillaBase::setSelection(int selectionIndex,
int startOffset, int endOffset)
{
if (selectionIndex == 0)
{
QsciScintillaBase *sb = sciWidget();
sb->SendScintilla(QsciScintillaBase::SCI_SETSELECTIONSTART,
offsetAsPosition(sb, startOffset));
sb->SendScintilla(QsciScintillaBase::SCI_SETSELECTIONEND,
offsetAsPosition(sb, endOffset));
}
}
// Return the current cursor offset.
int QsciAccessibleScintillaBase::cursorPosition() const
{
return current_cursor_offset;
}
// Set the cursor offset.
void QsciAccessibleScintillaBase::setCursorPosition(int position)
{
QsciScintillaBase *sb = sciWidget();
sb->SendScintilla(QsciScintillaBase::SCI_GOTOPOS,
offsetAsPosition(sb, position));
}
// Return the text between two offsets.
QString QsciAccessibleScintillaBase::text(int startOffset, int endOffset) const
{
QsciScintillaBase *sb = sciWidget();
return textRange(sb, offsetAsPosition(sb, startOffset),
offsetAsPosition(sb, endOffset));
}
// Return the number of characters in the text.
int QsciAccessibleScintillaBase::characterCount() const
{
QsciScintillaBase *sb = sciWidget();
return sb->SendScintilla(QsciScintillaBase::SCI_COUNTCHARACTERS, 0,
sb->SendScintilla(QsciScintillaBase::SCI_GETTEXTLENGTH));
}
QRect QsciAccessibleScintillaBase::characterRect(int offset) const
{
QsciScintillaBase *sb = sciWidget();
int position = offsetAsPosition(sb, offset);
int x_vport = sb->SendScintilla(QsciScintillaBase::SCI_POINTXFROMPOSITION,
position);
int y_vport = sb->SendScintilla(QsciScintillaBase::SCI_POINTYFROMPOSITION,
position);
const QString ch = text(offset, offset + 1);
// Get the character's font metrics.
int style = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT, position);
QFontMetrics metrics(fontForStyle(style));
QRect rect(x_vport, y_vport, metrics.horizontalAdvance(ch),
metrics.height());
rect.moveTo(sb->viewport()->mapToGlobal(rect.topLeft()));
return rect;
}
// Return the offset of the character at the given screen coordinates.
int QsciAccessibleScintillaBase::offsetAtPoint(const QPoint &point) const
{
QsciScintillaBase *sb = sciWidget();
QPoint p = sb->viewport()->mapFromGlobal(point);
int position = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONFROMPOINT,
p.x(), p.y());
return (position >= 0) ? positionAsOffset(sb, position) : -1;
}
// Scroll to make sure an area of text is visible.
void QsciAccessibleScintillaBase::scrollToSubstring(int startIndex,
int endIndex)
{
QsciScintillaBase *sb = sciWidget();
int start = offsetAsPosition(sb, startIndex);
int end = offsetAsPosition(sb, endIndex);
sb->SendScintilla(QsciScintillaBase::SCI_SCROLLRANGE, end, start);
}
// Return the attributes of a character and surrounding text.
QString QsciAccessibleScintillaBase::attributes(int offset, int *startOffset,
int *endOffset) const
{
QsciScintillaBase *sb = sciWidget();
int position = offsetAsPosition(sb, offset);
int style = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT, position);
// Find the start of the text with this style.
int start_position = position;
int start_text_position = offset;
while (start_position > 0)
{
int before = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONBEFORE,
start_position);
int s = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT, before);
if (s != style)
break;
start_position = before;
--start_text_position;
}
*startOffset = start_text_position;
// Find the end of the text with this style.
int end_position = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONAFTER,
position);
int end_text_position = offset + 1;
int last_position = sb->SendScintilla(
QsciScintillaBase::SCI_GETTEXTLENGTH);
while (end_position < last_position)
{
int s = sb->SendScintilla(QsciScintillaBase::SCI_GETSTYLEAT,
end_position);
if (s != style)
break;
end_position = sb->SendScintilla(QsciScintillaBase::SCI_POSITIONAFTER,
end_position);
++end_text_position;
}
*endOffset = end_text_position;
// Convert the style to attributes.
QString attrs;
int back = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETBACK, style);
addAttribute(attrs, "background-color", colourAsRGB(back));
int fore = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETFORE, style);
addAttribute(attrs, "color", colourAsRGB(fore));
QFont font = fontForStyle(style);
QString family = font.family();
family = family.replace('\\', QLatin1String("\\\\"));
family = family.replace(':', QLatin1String("\\:"));
family = family.replace(',', QLatin1String("\\,"));
family = family.replace('=', QLatin1String("\\="));
family = family.replace(';', QLatin1String("\\;"));
family = family.replace('\"', QLatin1String("\\\""));
addAttribute(attrs, "font-familly",
QLatin1Char('"') + family + QLatin1Char('"'));
int font_size = int(font.pointSize());
addAttribute(attrs, "font-size",
QString::fromLatin1("%1pt").arg(font_size));
QFont::Style font_style = font.style();
addAttribute(attrs, "font-style",
QString::fromLatin1((font_style == QFont::StyleItalic) ? "italic" : ((font_style == QFont::StyleOblique) ? "oblique": "normal")));
int font_weight = font.weight();
addAttribute(attrs, "font-weight",
QString::fromLatin1(
(font_weight > QFont::Normal) ? "bold" : "normal"));
int underline = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETUNDERLINE,
style);
if (underline)
addAttribute(attrs, "text-underline-type",
QString::fromLatin1("single"));
return attrs;
}
// Add an attribute name/value pair.
void QsciAccessibleScintillaBase::addAttribute(QString &attrs,
const char *name, const QString &value)
{
attrs.append(QLatin1String(name));
attrs.append(QChar(':'));
attrs.append(value);
attrs.append(QChar(';'));
}
// Convert a integer colour to an RGB string.
QString QsciAccessibleScintillaBase::colourAsRGB(int colour)
{
return QString::fromLatin1("rgb(%1,%2,%3)").arg(colour & 0xff).arg((colour >> 8) & 0xff).arg((colour >> 16) & 0xff);
}
// Convert a integer colour to an RGB string.
QFont QsciAccessibleScintillaBase::fontForStyle(int style) const
{
QsciScintillaBase *sb = sciWidget();
char fontName[64];
int len = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETFONT, style,
fontName);
int size = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETSIZE, style);
bool italic = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETITALIC,
style);
int weight = sb->SendScintilla(QsciScintillaBase::SCI_STYLEGETWEIGHT,
style);
return QFont(QString::fromUtf8(fontName, len), size, weight, italic);
}
// Delete some text.
void QsciAccessibleScintillaBase::deleteText(int startOffset, int endOffset)
{
addSelection(startOffset, endOffset);
sciWidget()->SendScintilla(QsciScintillaBase::SCI_REPLACESEL, "");
}
// Insert some text.
void QsciAccessibleScintillaBase::insertText(int offset, const QString &text)
{
QsciScintillaBase *sb = sciWidget();
sb->SendScintilla(QsciScintillaBase::SCI_INSERTTEXT,
offsetAsPosition(sb, offset), sb->textAsBytes(text).constData());
}
// Replace some text.
void QsciAccessibleScintillaBase::replaceText(int startOffset, int endOffset,
const QString &text)
{
QsciScintillaBase *sb = sciWidget();
addSelection(startOffset, endOffset);
sb->SendScintilla(QsciScintillaBase::SCI_REPLACESEL,
sb->textAsBytes(text).constData());
}
// Return the state.
QAccessible::State QsciAccessibleScintillaBase::state() const
{
QAccessible::State st = QAccessibleWidget::state();
st.selectableText = true;
st.multiLine = true;
if (sciWidget()->SendScintilla(QsciScintillaBase::SCI_GETREADONLY))
st.readOnly = true;
else
st.editable = true;
return st;
}
// Provide access to the indivual interfaces.
void *QsciAccessibleScintillaBase::interface_cast(QAccessible::InterfaceType t)
{
if (t == QAccessible::TextInterface)
return static_cast<QAccessibleTextInterface *>(this);
if (t == QAccessible::EditableTextInterface)
return static_cast<QAccessibleEditableTextInterface *>(this);
return QAccessibleWidget::interface_cast(t);
}
// The accessibility interface factory.
static QAccessibleInterface *factory(const QString &classname, QObject *object)
{
if (classname == QLatin1String("QsciScintillaBase") && object && object->isWidgetType())
return new QsciAccessibleScintillaBase(static_cast<QWidget *>(object));
return 0;
}
#endif

View File

@@ -0,0 +1,119 @@
// The definition of the class that implements accessibility support.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef _SCIACCESSIBILITY_H
#define _SCIACCESSIBILITY_H
#include <qglobal.h>
#if !defined(QT_NO_ACCESSIBILITY)
#include <QAccessible>
#include <QAccessibleEditableTextInterface>
#include <QAccessibleTextInterface>
#include <QAccessibleWidget>
#include <QByteArray>
#include <QFont>
#include <QList>
#include <QString>
class QsciScintillaBase;
// The implementation of accessibility support.
class QsciAccessibleScintillaBase : public QAccessibleWidget,
public QAccessibleTextInterface,
public QAccessibleEditableTextInterface
{
public:
explicit QsciAccessibleScintillaBase(QWidget *widget);
~QsciAccessibleScintillaBase();
static void initialise();
static void selectionChanged(QsciScintillaBase *sb, bool selection);
static void textInserted(QsciScintillaBase *sb, int position,
const char *text, int length);
static void textDeleted(QsciScintillaBase *sb, int position,
const char *text, int length);
static void updated(QsciScintillaBase *sb);
void selection(int selectionIndex, int *startOffset, int *endOffset) const;
int selectionCount() const;
void addSelection(int startOffset, int endOffset);
void removeSelection(int selectionIndex);
void setSelection(int selectionIndex, int startOffset, int endOffset);
int cursorPosition() const;
void setCursorPosition(int position);
QString text(int startOffset, int endOffset) const;
QString textBeforeOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const;
QString textAfterOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const;
QString textAtOffset(int offset,
QAccessible::TextBoundaryType boundaryType, int *startOffset,
int *endOffset) const;
int characterCount() const;
QRect characterRect(int offset) const;
int offsetAtPoint(const QPoint &point) const;
void scrollToSubstring(int startIndex, int endIndex);
QString attributes(int offset, int *startOffset, int *endOffset) const;
void deleteText(int startOffset, int endOffset);
void insertText(int offset, const QString &text);
void replaceText(int startOffset, int endOffset, const QString &text);
QAccessible::State state() const;
void *interface_cast(QAccessible::InterfaceType t);
private:
static bool needs_initialising;
static QList<QsciAccessibleScintillaBase *> all_accessibles;
int current_cursor_offset;
bool is_selection;
static QsciAccessibleScintillaBase *findAccessible(QsciScintillaBase *sb);
QsciScintillaBase *sciWidget() const;
int validPosition(int offset) const;
static bool boundaries(QsciScintillaBase *sb, int position,
QAccessible::TextBoundaryType boundaryType, int *start_position,
int *end_position);
static QString textRange(QsciScintillaBase *sb, int start_position,
int end_position);
static int positionAsOffset(QsciScintillaBase *sb, int position);
static void positionRangeAsOffsetRange(QsciScintillaBase *sb,
int start_position, int end_position, int *startOffset,
int *endOffset);
static int offsetAsPosition(QsciScintillaBase *sb, int offset);
static QString colourAsRGB(int colour);
static void addAttribute(QString &attrs, const char *name,
const QString &value);
QFont fontForStyle(int style) const;
};
#endif
#endif

View File

@@ -0,0 +1,189 @@
// The implementation of various Qt version independent classes used by the
// rest of the port.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "SciClasses.h"
#include <QCoreApplication>
#include <QKeyEvent>
#include <QListWidgetItem>
#include <QMouseEvent>
#include <QPainter>
#include <QPaintEvent>
#include "ScintillaQt.h"
#include "ListBoxQt.h"
// Create a call tip.
QsciSciCallTip::QsciSciCallTip(QWidget *parent, QsciScintillaQt *sci_)
: QWidget(parent, Qt::WindowFlags(Qt::Popup|Qt::FramelessWindowHint|Qt::WA_StaticContents)),
sci(sci_)
{
// Ensure that the main window keeps the focus (and the caret flashing)
// when this is displayed.
setFocusProxy(parent);
}
// Destroy a call tip.
QsciSciCallTip::~QsciSciCallTip()
{
// Ensure that the main window doesn't receive a focus out event when
// this is destroyed.
setFocusProxy(0);
}
// Paint a call tip.
void QsciSciCallTip::paintEvent(QPaintEvent *)
{
Scintilla::Surface *surfaceWindow = Scintilla::Surface::Allocate(
SC_TECHNOLOGY_DEFAULT);
if (!surfaceWindow)
return;
QPainter p(this);
surfaceWindow->Init(&p);
surfaceWindow->SetUnicodeMode(sci->CodePage() == SC_CP_UTF8);
sci->ct.PaintCT(surfaceWindow);
delete surfaceWindow;
}
// Handle a mouse press in a call tip.
void QsciSciCallTip::mousePressEvent(QMouseEvent *e)
{
Scintilla::Point pt;
pt.x = e->x();
pt.y = e->y();
sci->ct.MouseClick(pt);
sci->CallTipClick();
update();
}
// Create the popup instance.
QsciSciPopup::QsciSciPopup()
{
// Set up the mapper.
connect(&mapper, SIGNAL(mapped(int)), this, SLOT(on_triggered(int)));
}
// Add an item and associated command to the popup and enable it if required.
void QsciSciPopup::addItem(const QString &label, int cmd, bool enabled,
QsciScintillaQt *sci_)
{
QAction *act = addAction(label, &mapper, SLOT(map()));
mapper.setMapping(act, cmd);
act->setEnabled(enabled);
sci = sci_;
}
// A slot to handle a menu action being triggered.
void QsciSciPopup::on_triggered(int cmd)
{
sci->Command(cmd);
}
QsciSciListBox::QsciSciListBox(QWidget *parent, QsciListBoxQt *lbx_)
: QListWidget(parent), lbx(lbx_)
{
setAttribute(Qt::WA_StaticContents);
#if defined(Q_OS_WIN)
setWindowFlags(Qt::Tool|Qt::FramelessWindowHint);
// This stops the main widget losing focus when the user clicks on this one
// (which prevents this one being destroyed).
setFocusPolicy(Qt::NoFocus);
#else
// This is the root of the focus problems under Gnome's window manager. We
// have tried many flag combinations in the past. The consensus now seems
// to be that the following works. However it might now work because of a
// change in Qt so we only enable it for recent versions in order to
// reduce the risk of breaking something that works with earlier versions.
setWindowFlags(Qt::ToolTip|Qt::WindowStaysOnTopHint);
// This may not be needed.
setFocusProxy(parent);
#endif
setFrameShape(StyledPanel);
setFrameShadow(Plain);
}
QsciSciListBox::~QsciSciListBox()
{
// Ensure that the main widget doesn't get a focus out event when this is
// destroyed.
setFocusProxy(0);
}
void QsciSciListBox::addItemPixmap(const QPixmap &pm, const QString &txt)
{
new QListWidgetItem(pm, txt, this);
}
int QsciSciListBox::find(const QString &prefix)
{
QList<QListWidgetItem *> itms = findItems(prefix,
Qt::MatchStartsWith|Qt::MatchCaseSensitive);
if (itms.size() == 0)
return -1;
return row(itms[0]);
}
QString QsciSciListBox::text(int n)
{
QListWidgetItem *itm = item(n);
if (!itm)
return QString();
return itm->text();
}
void QsciSciListBox::mouseDoubleClickEvent(QMouseEvent *)
{
lbx->handleDoubleClick();
}
void QsciSciListBox::mouseReleaseEvent(QMouseEvent *)
{
lbx->handleRelease();
}

103
third_party/qscintilla/src/SciClasses.h vendored Normal file
View File

@@ -0,0 +1,103 @@
// The definition of various Qt version independent classes used by the rest of
// the port.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef _SCICLASSES_H
#define _SCICLASSES_H
#include <QListWidget>
#include <QMenu>
#include <QSignalMapper>
#include <QWidget>
#include <Qsci/qsciglobal.h>
class QsciScintillaQt;
class QsciListBoxQt;
// A simple QWidget sub-class to implement a call tip. This is not put into
// the Scintilla namespace because of moc's problems with preprocessor macros.
class QsciSciCallTip : public QWidget
{
Q_OBJECT
public:
QsciSciCallTip(QWidget *parent, QsciScintillaQt *sci_);
~QsciSciCallTip();
protected:
void paintEvent(QPaintEvent *e);
void mousePressEvent(QMouseEvent *e);
private:
QsciScintillaQt *sci;
};
// A popup menu where options correspond to a numeric command. This is not put
// into the Scintilla namespace because of moc's problems with preprocessor
// macros.
class QsciSciPopup : public QMenu
{
Q_OBJECT
public:
QsciSciPopup();
void addItem(const QString &label, int cmd, bool enabled,
QsciScintillaQt *sci_);
private slots:
void on_triggered(int cmd);
private:
QsciScintillaQt *sci;
QSignalMapper mapper;
};
// This sub-class of QListBox is needed to provide slots from which we can call
// QsciListBox's double-click callback (and you thought this was a C++
// program). This is not put into the Scintilla namespace because of moc's
// problems with preprocessor macros.
class QsciSciListBox : public QListWidget
{
Q_OBJECT
public:
QsciSciListBox(QWidget *parent, QsciListBoxQt *lbx_);
virtual ~QsciSciListBox();
void addItemPixmap(const QPixmap &pm, const QString &txt);
int find(const QString &prefix);
QString text(int n);
protected:
void mouseDoubleClickEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
private:
QsciListBoxQt *lbx;
};
#endif

View File

@@ -0,0 +1,768 @@
// The implementation of the Qt specific subclass of ScintillaBase.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <string.h>
#include <qapplication.h>
#include <qbytearray.h>
#include <qdrag.h>
#include <qevent.h>
#include <qmimedata.h>
#include <qpainter.h>
#include <qscrollbar.h>
#include <qstring.h>
#include "Qsci/qsciscintillabase.h"
#include "ScintillaQt.h"
#if !defined(QT_NO_ACCESSIBILITY)
#include "SciAccessibility.h"
#endif
#include "SciClasses.h"
// We want to use the Scintilla notification names as Qt signal names.
#undef SCEN_CHANGE
#undef SCN_AUTOCCANCELLED
#undef SCN_AUTOCCHARDELETED
#undef SCN_AUTOCCOMPLETED
#undef SCN_AUTOCSELECTION
#undef SCN_AUTOCSELECTIONCHANGE
#undef SCN_CALLTIPCLICK
#undef SCN_CHARADDED
#undef SCN_DOUBLECLICK
#undef SCN_DWELLEND
#undef SCN_DWELLSTART
#undef SCN_FOCUSIN
#undef SCN_FOCUSOUT
#undef SCN_HOTSPOTCLICK
#undef SCN_HOTSPOTDOUBLECLICK
#undef SCN_HOTSPOTRELEASECLICK
#undef SCN_INDICATORCLICK
#undef SCN_INDICATORRELEASE
#undef SCN_MACRORECORD
#undef SCN_MARGINCLICK
#undef SCN_MARGINRIGHTCLICK
#undef SCN_MODIFIED
#undef SCN_MODIFYATTEMPTRO
#undef SCN_NEEDSHOWN
#undef SCN_PAINTED
#undef SCN_SAVEPOINTLEFT
#undef SCN_SAVEPOINTREACHED
#undef SCN_STYLENEEDED
#undef SCN_UPDATEUI
#undef SCN_USERLISTSELECTION
#undef SCN_ZOOM
enum
{
SCEN_CHANGE = 768,
SCN_AUTOCCANCELLED = 2025,
SCN_AUTOCCHARDELETED = 2026,
SCN_AUTOCCOMPLETED = 2030,
SCN_AUTOCSELECTION = 2022,
SCN_AUTOCSELECTIONCHANGE = 2032,
SCN_CALLTIPCLICK = 2021,
SCN_CHARADDED = 2001,
SCN_DOUBLECLICK = 2006,
SCN_DWELLEND = 2017,
SCN_DWELLSTART = 2016,
SCN_FOCUSIN = 2028,
SCN_FOCUSOUT = 2029,
SCN_HOTSPOTCLICK = 2019,
SCN_HOTSPOTDOUBLECLICK = 2020,
SCN_HOTSPOTRELEASECLICK = 2027,
SCN_INDICATORCLICK = 2023,
SCN_INDICATORRELEASE = 2024,
SCN_MACRORECORD = 2009,
SCN_MARGINCLICK = 2010,
SCN_MARGINRIGHTCLICK = 2031,
SCN_MODIFIED = 2008,
SCN_MODIFYATTEMPTRO = 2004,
SCN_NEEDSHOWN = 2011,
SCN_PAINTED = 2013,
SCN_SAVEPOINTLEFT = 2003,
SCN_SAVEPOINTREACHED = 2002,
SCN_STYLENEEDED = 2000,
SCN_UPDATEUI = 2007,
SCN_USERLISTSELECTION = 2014,
SCN_ZOOM = 2018
};
// The ctor.
QsciScintillaQt::QsciScintillaQt(QsciScintillaBase *qsb_)
: vMax(0), hMax(0), vPage(0), hPage(0), capturedMouse(false), qsb(qsb_)
{
wMain = qsb->viewport();
// This is ignored.
imeInteraction = imeInline;
// Using pixmaps screws things up when moving to a different display
// (although this could be because we haven't got the pixmap code right).
// However Qt shouldn't need buffered drawing anyway.
WndProc(SCI_SETBUFFEREDDRAW, 0, 0);
for (int i = 0; i <= static_cast<int>(tickPlatform); ++i)
timers[i] = 0;
Initialise();
}
// The dtor.
QsciScintillaQt::~QsciScintillaQt()
{
Finalise();
}
// Initialise the instance.
void QsciScintillaQt::Initialise()
{
// This signal is only ever emitted for systems that have a separate
// selection (ie. X11).
connect(QApplication::clipboard(), SIGNAL(selectionChanged()), this,
SLOT(onSelectionChanged()));
}
// Tidy up the instance.
void QsciScintillaQt::Finalise()
{
for (int i = 0; i <= static_cast<int>(tickPlatform); ++i)
FineTickerCancel(static_cast<TickReason>(i));
ScintillaBase::Finalise();
}
// Start a drag.
void QsciScintillaQt::StartDrag()
{
inDragDrop = ddDragging;
QDrag *qdrag = new QDrag(qsb);
qdrag->setMimeData(mimeSelection(drag));
Qt::DropAction action = qdrag->exec(Qt::MoveAction | Qt::CopyAction, Qt::MoveAction);
// Remove the dragged text if it was a move to another widget or
// application.
if (action == Qt::MoveAction && qdrag->target() != qsb->viewport())
ClearSelection();
SetDragPosition(Scintilla::SelectionPosition());
inDragDrop = ddNone;
}
// Re-implement to trap certain messages.
sptr_t QsciScintillaQt::WndProc(unsigned int iMessage, uptr_t wParam,
sptr_t lParam)
{
switch (iMessage)
{
case SCI_GETDIRECTFUNCTION:
return reinterpret_cast<sptr_t>(DirectFunction);
case SCI_GETDIRECTPOINTER:
return reinterpret_cast<sptr_t>(this);
}
return ScintillaBase::WndProc(iMessage, wParam, lParam);
}
// Windows nonsense.
sptr_t QsciScintillaQt::DefWndProc(unsigned int, uptr_t, sptr_t)
{
return 0;
}
// Grab or release the mouse (and keyboard).
void QsciScintillaQt::SetMouseCapture(bool on)
{
if (mouseDownCaptures)
{
if (on)
qsb->viewport()->grabMouse();
else
qsb->viewport()->releaseMouse();
}
capturedMouse = on;
}
// Return true if the mouse/keyboard are currently grabbed.
bool QsciScintillaQt::HaveMouseCapture()
{
return capturedMouse;
}
// Set the position of the vertical scrollbar.
void QsciScintillaQt::SetVerticalScrollPos()
{
QScrollBar *sb = qsb->verticalScrollBar();
bool was_blocked = sb->blockSignals(true);
sb->setValue(topLine);
sb->blockSignals(was_blocked);
}
// Set the position of the horizontal scrollbar.
void QsciScintillaQt::SetHorizontalScrollPos()
{
QScrollBar *sb = qsb->horizontalScrollBar();
bool was_blocked = sb->blockSignals(true);
sb->setValue(xOffset);
sb->blockSignals(was_blocked);
}
// Set the extent of the vertical and horizontal scrollbars and return true if
// the view needs re-drawing.
bool QsciScintillaQt::ModifyScrollBars(Sci::Line nMax, Sci::Line nPage)
{
bool modified = false;
QScrollBar *sb;
int vNewPage = nPage;
int vNewMax = nMax - vNewPage + 1;
if (vMax != vNewMax || vPage != vNewPage)
{
vMax = vNewMax;
vPage = vNewPage;
modified = true;
sb = qsb->verticalScrollBar();
sb->setMaximum(vMax);
sb->setPageStep(vPage);
}
int hNewPage = GetTextRectangle().Width();
int hNewMax = (scrollWidth > hNewPage) ? scrollWidth - hNewPage : 0;
int charWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
sb = qsb->horizontalScrollBar();
if (hMax != hNewMax || hPage != hNewPage || sb->singleStep() != charWidth)
{
hMax = hNewMax;
hPage = hNewPage;
modified = true;
sb->setMaximum(hMax);
sb->setPageStep(hPage);
sb->setSingleStep(charWidth);
}
return modified;
}
// Called after SCI_SETWRAPMODE and SCI_SETHSCROLLBAR.
void QsciScintillaQt::ReconfigureScrollBars()
{
// Hide or show the scrollbars if needed.
bool hsb = (horizontalScrollBarVisible && !Wrapping());
qsb->setHorizontalScrollBarPolicy(hsb ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
qsb->setVerticalScrollBarPolicy(verticalScrollBarVisible ? Qt::ScrollBarAsNeeded : Qt::ScrollBarAlwaysOff);
}
// Notify interested parties of any change in the document.
void QsciScintillaQt::NotifyChange()
{
emit qsb->SCEN_CHANGE();
}
// Notify interested parties of various events. This is the main mapping
// between Scintilla notifications and Qt signals.
void QsciScintillaQt::NotifyParent(SCNotification scn)
{
switch (scn.nmhdr.code)
{
case SCN_CALLTIPCLICK:
emit qsb->SCN_CALLTIPCLICK(scn.position);
break;
case SCN_AUTOCCANCELLED:
emit qsb->SCN_AUTOCCANCELLED();
break;
case SCN_AUTOCCHARDELETED:
emit qsb->SCN_AUTOCCHARDELETED();
break;
case SCN_AUTOCCOMPLETED:
emit qsb->SCN_AUTOCCOMPLETED(scn.text, scn.position, scn.ch,
scn.listCompletionMethod);
break;
case SCN_AUTOCSELECTION:
emit qsb->SCN_AUTOCSELECTION(scn.text, scn.position, scn.ch,
scn.listCompletionMethod);
emit qsb->SCN_AUTOCSELECTION(scn.text, scn.position);
break;
case SCN_AUTOCSELECTIONCHANGE:
emit qsb->SCN_AUTOCSELECTIONCHANGE(scn.text, scn.listType,
scn.position);
break;
case SCN_CHARADDED:
emit qsb->SCN_CHARADDED(scn.ch);
break;
case SCN_DOUBLECLICK:
emit qsb->SCN_DOUBLECLICK(scn.position, scn.line, scn.modifiers);
break;
case SCN_DWELLEND:
emit qsb->SCN_DWELLEND(scn.position, scn.x, scn.y);
break;
case SCN_DWELLSTART:
emit qsb->SCN_DWELLSTART(scn.position, scn.x, scn.y);
break;
case SCN_FOCUSIN:
emit qsb->SCN_FOCUSIN();
break;
case SCN_FOCUSOUT:
emit qsb->SCN_FOCUSOUT();
break;
case SCN_HOTSPOTCLICK:
emit qsb->SCN_HOTSPOTCLICK(scn.position, scn.modifiers);
break;
case SCN_HOTSPOTDOUBLECLICK:
emit qsb->SCN_HOTSPOTDOUBLECLICK(scn.position, scn.modifiers);
break;
case SCN_HOTSPOTRELEASECLICK:
emit qsb->SCN_HOTSPOTRELEASECLICK(scn.position, scn.modifiers);
break;
case SCN_INDICATORCLICK:
emit qsb->SCN_INDICATORCLICK(scn.position, scn.modifiers);
break;
case SCN_INDICATORRELEASE:
emit qsb->SCN_INDICATORRELEASE(scn.position, scn.modifiers);
break;
case SCN_MACRORECORD:
emit qsb->SCN_MACRORECORD(scn.message, scn.wParam,
reinterpret_cast<void *>(scn.lParam));
break;
case SCN_MARGINCLICK:
emit qsb->SCN_MARGINCLICK(scn.position, scn.modifiers, scn.margin);
break;
case SCN_MARGINRIGHTCLICK:
emit qsb->SCN_MARGINRIGHTCLICK(scn.position, scn.modifiers,
scn.margin);
break;
case SCN_MODIFIED:
{
char *text;
#if !defined(QT_NO_ACCESSIBILITY)
if ((scn.modificationType & SC_MOD_INSERTTEXT) != 0)
QsciAccessibleScintillaBase::textInserted(qsb, scn.position,
scn.text, scn.length);
else if ((scn.modificationType & SC_MOD_DELETETEXT) != 0)
QsciAccessibleScintillaBase::textDeleted(qsb, scn.position,
scn.text, scn.length);
#endif
// Give some protection to the Python bindings.
if (scn.text && (scn.modificationType & (SC_MOD_INSERTTEXT|SC_MOD_DELETETEXT)) != 0)
{
text = new char[scn.length + 1];
memcpy(text, scn.text, scn.length);
text[scn.length] = '\0';
}
else
{
text = 0;
}
emit qsb->SCN_MODIFIED(scn.position, scn.modificationType, text,
scn.length, scn.linesAdded, scn.line, scn.foldLevelNow,
scn.foldLevelPrev, scn.token, scn.annotationLinesAdded);
if (text)
delete[] text;
break;
}
case SCN_MODIFYATTEMPTRO:
emit qsb->SCN_MODIFYATTEMPTRO();
break;
case SCN_NEEDSHOWN:
emit qsb->SCN_NEEDSHOWN(scn.position, scn.length);
break;
case SCN_PAINTED:
emit qsb->SCN_PAINTED();
break;
case SCN_SAVEPOINTLEFT:
emit qsb->SCN_SAVEPOINTLEFT();
break;
case SCN_SAVEPOINTREACHED:
emit qsb->SCN_SAVEPOINTREACHED();
break;
case SCN_STYLENEEDED:
emit qsb->SCN_STYLENEEDED(scn.position);
break;
case SCN_UPDATEUI:
#if !defined(QT_NO_ACCESSIBILITY)
QsciAccessibleScintillaBase::updated(qsb);
#endif
emit qsb->SCN_UPDATEUI(scn.updated);
break;
case SCN_USERLISTSELECTION:
emit qsb->SCN_USERLISTSELECTION(scn.text, scn.listType, scn.ch,
scn.listCompletionMethod, scn.position);
emit qsb->SCN_USERLISTSELECTION(scn.text, scn.listType, scn.ch,
scn.listCompletionMethod);
emit qsb->SCN_USERLISTSELECTION(scn.text, scn.listType);
break;
case SCN_ZOOM:
emit qsb->SCN_ZOOM();
break;
default:
qWarning("Unknown notification: %u", scn.nmhdr.code);
}
}
// Convert a selection to mime data.
QMimeData *QsciScintillaQt::mimeSelection(
const Scintilla::SelectionText &text) const
{
return qsb->toMimeData(QByteArray(text.Data()), text.rectangular);
}
// Copy the selected text to the clipboard.
void QsciScintillaQt::CopyToClipboard(
const Scintilla::SelectionText &selectedText)
{
QApplication::clipboard()->setMimeData(mimeSelection(selectedText));
}
// Implement copy.
void QsciScintillaQt::Copy()
{
if (!sel.Empty())
{
Scintilla::SelectionText text;
CopySelectionRange(&text);
CopyToClipboard(text);
}
}
// Implement pasting text.
void QsciScintillaQt::Paste()
{
pasteFromClipboard(QClipboard::Clipboard);
}
// Paste text from either the clipboard or selection.
void QsciScintillaQt::pasteFromClipboard(QClipboard::Mode mode)
{
int len;
const char *s;
bool rectangular;
const QMimeData *source = QApplication::clipboard()->mimeData(mode);
if (!source || !qsb->canInsertFromMimeData(source))
return;
QByteArray text = qsb->fromMimeData(source, rectangular);
len = text.length();
s = text.data();
std::string dest = Scintilla::Document::TransformLineEnds(s, len,
pdoc->eolMode);
Scintilla::SelectionText selText;
selText.Copy(dest, (IsUnicodeMode() ? SC_CP_UTF8 : 0),
vs.styles[STYLE_DEFAULT].characterSet, rectangular, false);
Scintilla::UndoGroup ug(pdoc);
ClearSelection();
InsertPasteShape(selText.Data(), selText.Length(),
selText.rectangular ? pasteRectangular : pasteStream);
EnsureCaretVisible();
}
// Create a call tip window.
void QsciScintillaQt::CreateCallTipWindow(Scintilla::PRectangle rc)
{
if (!ct.wCallTip.Created())
ct.wCallTip = new QsciSciCallTip(qsb, this);
QsciSciCallTip *w = reinterpret_cast<QsciSciCallTip *>(ct.wCallTip.GetID());
w->resize(rc.right - rc.left, rc.bottom - rc.top);
ct.wCallTip.Show();
}
// Add an item to the right button menu.
void QsciScintillaQt::AddToPopUp(const char *label, int cmd, bool enabled)
{
QsciSciPopup *pm = static_cast<QsciSciPopup *>(popup.GetID());
if (*label)
pm->addItem(qApp->translate("ContextMenu", label), cmd, enabled, this);
else
pm->addSeparator();
}
// Claim the (primary) selection.
void QsciScintillaQt::ClaimSelection()
{
QClipboard *cb = QApplication::clipboard();
bool isSel = !sel.Empty();
if (cb->supportsSelection())
{
if (isSel)
{
Scintilla::SelectionText text;
CopySelectionRange(&text);
if (text.Data())
cb->setMimeData(mimeSelection(text), QClipboard::Selection);
primarySelection = true;
}
else
{
primarySelection = false;
}
}
#if !defined(QT_NO_ACCESSIBILITY)
QsciAccessibleScintillaBase::selectionChanged(qsb, isSel);
#endif
emit qsb->QSCN_SELCHANGED(isSel);
}
// Unclaim the (primary) selection.
void QsciScintillaQt::onSelectionChanged()
{
bool new_primary = QApplication::clipboard()->ownsSelection();
if (primarySelection != new_primary)
{
primarySelection = new_primary;
qsb->viewport()->update();
}
}
// Implemented to provide compatibility with the Windows version.
sptr_t QsciScintillaQt::DirectFunction(QsciScintillaQt *sciThis, unsigned int iMessage,
uptr_t wParam, sptr_t lParam)
{
return sciThis->WndProc(iMessage,wParam,lParam);
}
// Draw the contents of the widget.
void QsciScintillaQt::paintEvent(QPaintEvent *e)
{
Scintilla::Surface *sw;
const QRect &qr = e->rect();
rcPaint.left = qr.left();
rcPaint.top = qr.top();
rcPaint.right = qr.right() + 1;
rcPaint.bottom = qr.bottom() + 1;
Scintilla::PRectangle rcClient = GetClientRectangle();
paintingAllText = rcPaint.Contains(rcClient);
sw = Scintilla::Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (!sw)
return;
QPainter painter(qsb->viewport());
paintState = painting;
sw->Init(&painter);
sw->SetUnicodeMode(CodePage() == SC_CP_UTF8);
Paint(sw, rcPaint);
delete sw;
// If the painting area was insufficient to cover the new style or brace
// highlight positions then repaint the whole thing.
if (paintState == paintAbandoned)
{
// Do a full re-paint immediately. This may only be needed on OS X (to
// avoid flicker).
paintingAllText = true;
sw = Scintilla::Surface::Allocate(SC_TECHNOLOGY_DEFAULT);
if (!sw)
return;
QPainter painter(qsb->viewport());
paintState = painting;
sw->Init(&painter);
sw->SetUnicodeMode(CodePage() == SC_CP_UTF8);
Paint(sw, rcPaint);
delete sw;
qsb->viewport()->update();
}
paintState = notPainting;
}
// Re-implemented to drive the tickers.
void QsciScintillaQt::timerEvent(QTimerEvent *e)
{
for (int i = 0; i <= static_cast<int>(tickPlatform); ++i)
if (timers[i] == e->timerId())
TickFor(static_cast<TickReason>(i));
}
// Re-implemented to say we support fine tickers.
bool QsciScintillaQt::FineTickerAvailable()
{
return true;
}
// Re-implemented to stop a ticker.
void QsciScintillaQt::FineTickerCancel(TickReason reason)
{
int &ticker = timers[static_cast<int>(reason)];
if (ticker != 0)
{
killTimer(ticker);
ticker = 0;
}
}
// Re-implemented to check if a particular ticker is running.
bool QsciScintillaQt::FineTickerRunning(TickReason reason)
{
return (timers[static_cast<int>(reason)] != 0);
}
// Re-implemented to start a ticker.
void QsciScintillaQt::FineTickerStart(TickReason reason, int ms, int)
{
int &ticker = timers[static_cast<int>(reason)];
if (ticker != 0)
killTimer(ticker);
ticker = startTimer(ms);
}
// Re-implemented to support idle processing.
bool QsciScintillaQt::SetIdle(bool on)
{
if (on)
{
if (!idler.state)
{
QTimer *timer = reinterpret_cast<QTimer *>(idler.idlerID);
if (!timer)
{
idler.idlerID = timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(onIdle()));
}
timer->start(0);
idler.state = true;
}
}
else if (idler.state)
{
reinterpret_cast<QTimer *>(idler.idlerID)->stop();
idler.state = false;
}
return true;
}
// Invoked to trigger any idle processing.
void QsciScintillaQt::onIdle()
{
if (!Idle())
SetIdle(false);
}

151
third_party/qscintilla/src/ScintillaQt.h vendored Normal file
View File

@@ -0,0 +1,151 @@
// The definition of the Qt specific subclass of ScintillaBase.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#ifndef SCINTILLAQT_H
#define SCINTILLAQT_H
#include <QClipboard>
#include <QObject>
#include <Qsci/qsciglobal.h>
// These are needed because Scintilla class header files don't manage their own
// dependencies properly.
#include <algorithm>
#include <assert.h>
#include <ctype.h>
#include <memory>
#include <stdexcept>
#include <stdlib.h>
#include <string>
#include <map>
#include <vector>
#include "ILexer.h"
#include "ILoader.h"
#include "Platform.h"
#include "Scintilla.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "Position.h"
#include "UniqueString.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "RunStyles.h"
#include "CaseFolder.h"
#include "Decoration.h"
#include "Document.h"
#include "Style.h"
#include "XPM.h"
#include "LineMarker.h"
#include "Indicator.h"
#include "ViewStyle.h"
#include "KeyMap.h"
#include "ContractionState.h"
#include "Selection.h"
#include "PositionCache.h"
#include "EditModel.h"
#include "MarginView.h"
#include "EditView.h"
#include "Editor.h"
#include "AutoComplete.h"
#include "CallTip.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "ScintillaBase.h"
QT_BEGIN_NAMESPACE
class QMimeData;
class QPaintEvent;
QT_END_NAMESPACE
class QsciScintillaBase;
class QsciSciCallTip;
class QsciSciPopup;
// This is an internal class but it is referenced by a public class so it has
// to have a Qsci prefix rather than being put in the Scintilla namespace.
// (However the reason for avoiding this no longer applies.)
class QsciScintillaQt : public QObject, public Scintilla::ScintillaBase
{
Q_OBJECT
friend class QsciScintillaBase;
friend class QsciSciCallTip;
friend class QsciSciPopup;
public:
QsciScintillaQt(QsciScintillaBase *qsb_);
virtual ~QsciScintillaQt();
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam,
sptr_t lParam);
protected:
void timerEvent(QTimerEvent *e);
private slots:
void onIdle();
void onSelectionChanged();
private:
void Initialise();
void Finalise();
bool SetIdle(bool on);
void StartDrag();
sptr_t DefWndProc(unsigned int, uptr_t, sptr_t);
void SetMouseCapture(bool on);
bool HaveMouseCapture();
void SetVerticalScrollPos();
void SetHorizontalScrollPos();
bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage);
void ReconfigureScrollBars();
void NotifyChange();
void NotifyParent(SCNotification scn);
void CopyToClipboard(const Scintilla::SelectionText &selectedText);
void Copy();
void Paste();
void CreateCallTipWindow(Scintilla::PRectangle rc);
void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
void ClaimSelection();
void UnclaimSelection();
static sptr_t DirectFunction(QsciScintillaQt *sci, unsigned int iMessage,
uptr_t wParam,sptr_t lParam);
QMimeData *mimeSelection(const Scintilla::SelectionText &text) const;
void paintEvent(QPaintEvent *e);
void pasteFromClipboard(QClipboard::Mode mode);
// tickPlatform is the last of the TickReason members.
int timers[tickPlatform + 1];
bool FineTickerAvailable();
void FineTickerCancel(TickReason reason);
bool FineTickerRunning(TickReason reason);
void FineTickerStart(TickReason reason, int ms, int tolerance);
int vMax, hMax, vPage, hPage;
bool capturedMouse;
QsciScintillaBase *qsb;
};
#endif

View File

@@ -0,0 +1,269 @@
debug/qsciscintilla.o
debug/qsciscintillabase.o
debug/qsciabstractapis.o
debug/qsciapis.o
debug/qscicommand.o
debug/qscicommandset.o
debug/qscidocument.o
debug/qscilexer.o
debug/qscilexerasm.o
debug/qscilexeravs.o
debug/qscilexerbash.o
debug/qscilexerbatch.o
debug/qscilexercmake.o
debug/qscilexercoffeescript.o
debug/qscilexercpp.o
debug/qscilexercsharp.o
debug/qscilexercss.o
debug/qscilexercustom.o
debug/qscilexerd.o
debug/qscilexerdiff.o
debug/qscilexeredifact.o
debug/qscilexerfortran.o
debug/qscilexerfortran77.o
debug/qscilexerhex.o
debug/qscilexerhtml.o
debug/qscilexeridl.o
debug/qscilexerintelhex.o
debug/qscilexerjava.o
debug/qscilexerjavascript.o
debug/qscilexerjson.o
debug/qscilexerlua.o
debug/qscilexermakefile.o
debug/qscilexermarkdown.o
debug/qscilexermasm.o
debug/qscilexermatlab.o
debug/qscilexernasm.o
debug/qscilexeroctave.o
debug/qscilexerpascal.o
debug/qscilexerperl.o
debug/qscilexerpostscript.o
debug/qscilexerpo.o
debug/qscilexerpov.o
debug/qscilexerproperties.o
debug/qscilexerpython.o
debug/qscilexerruby.o
debug/qscilexerspice.o
debug/qscilexersql.o
debug/qscilexersrec.o
debug/qscilexertcl.o
debug/qscilexertekhex.o
debug/qscilexertex.o
debug/qscilexerverilog.o
debug/qscilexervhdl.o
debug/qscilexerxml.o
debug/qscilexeryaml.o
debug/qscimacro.o
debug/qscistyle.o
debug/qscistyledtext.o
debug/InputMethod.o
debug/ListBoxQt.o
debug/MacPasteboardMime.o
debug/PlatQt.o
debug/SciAccessibility.o
debug/SciClasses.o
debug/ScintillaQt.o
debug/LexA68k.o
debug/LexAPDL.o
debug/LexASY.o
debug/LexAU3.o
debug/LexAVE.o
debug/LexAVS.o
debug/LexAbaqus.o
debug/LexAda.o
debug/LexAsm.o
debug/LexAsn1.o
debug/LexBaan.o
debug/LexBash.o
debug/LexBasic.o
debug/LexBatch.o
debug/LexBibTeX.o
debug/LexBullant.o
debug/LexCLW.o
debug/LexCOBOL.o
debug/LexCPP.o
debug/LexCSS.o
debug/LexCaml.o
debug/LexCmake.o
debug/LexCoffeeScript.o
debug/LexConf.o
debug/LexCrontab.o
debug/LexCsound.o
debug/LexD.o
debug/LexDMAP.o
debug/LexDMIS.o
debug/LexDiff.o
debug/LexECL.o
debug/LexEDIFACT.o
debug/LexEScript.o
debug/LexEiffel.o
debug/LexErlang.o
debug/LexErrorList.o
debug/LexFlagship.o
debug/LexForth.o
debug/LexFortran.o
debug/LexGAP.o
debug/LexGui4Cli.o
debug/LexHTML.o
debug/LexHaskell.o
debug/LexHex.o
debug/LexIndent.o
debug/LexInno.o
debug/LexJSON.o
debug/LexKVIrc.o
debug/LexKix.o
debug/LexLaTeX.o
debug/LexLisp.o
debug/LexLout.o
debug/LexLua.o
debug/LexMMIXAL.o
debug/LexMPT.o
debug/LexMSSQL.o
debug/LexMagik.o
debug/LexMake.o
debug/LexMarkdown.o
debug/LexMatlab.o
debug/LexMaxima.o
debug/LexMetapost.o
debug/LexModula.o
debug/LexMySQL.o
debug/LexNimrod.o
debug/LexNsis.o
debug/LexNull.o
debug/LexOScript.o
debug/LexOpal.o
debug/LexPB.o
debug/LexPLM.o
debug/LexPO.o
debug/LexPOV.o
debug/LexPS.o
debug/LexPascal.o
debug/LexPerl.o
debug/LexPowerPro.o
debug/LexPowerShell.o
debug/LexProgress.o
debug/LexProps.o
debug/LexPython.o
debug/LexR.o
debug/LexRebol.o
debug/LexRegistry.o
debug/LexRuby.o
debug/LexRust.o
debug/LexSAS.o
debug/LexSML.o
debug/LexSQL.o
debug/LexSTTXT.o
debug/LexScriptol.o
debug/LexSmalltalk.o
debug/LexSorcus.o
debug/LexSpecman.o
debug/LexSpice.o
debug/LexStata.o
debug/LexTACL.o
debug/LexTADS3.o
debug/LexTAL.o
debug/LexTCL.o
debug/LexTCMD.o
debug/LexTeX.o
debug/LexTxt2tags.o
debug/LexVB.o
debug/LexVHDL.o
debug/LexVerilog.o
debug/LexVisualProlog.o
debug/LexYAML.o
debug/Accessor.o
debug/CharacterCategory.o
debug/CharacterSet.o
debug/DefaultLexer.o
debug/LexerBase.o
debug/LexerModule.o
debug/LexerNoExceptions.o
debug/LexerSimple.o
debug/PropSetSimple.o
debug/StyleContext.o
debug/WordList.o
debug/AutoComplete.o
debug/CallTip.o
debug/CaseConvert.o
debug/CaseFolder.o
debug/Catalogue.o
debug/CellBuffer.o
debug/CharClassify.o
debug/ContractionState.o
debug/DBCS.o
debug/Decoration.o
debug/Document.o
debug/EditModel.o
debug/Editor.o
debug/EditView.o
debug/ExternalLexer.o
debug/Indicator.o
debug/KeyMap.o
debug/LineMarker.o
debug/MarginView.o
debug/PerLine.o
debug/PositionCache.o
debug/RESearch.o
debug/RunStyles.o
debug/ScintillaBase.o
debug/Selection.o
debug/Style.o
debug/UniConversion.o
debug/ViewStyle.o
debug/XPM.o
debug/qsciprinter.o
debug/moc_qsciscintilla.o
debug/moc_qsciscintillabase.o
debug/moc_qsciabstractapis.o
debug/moc_qsciapis.o
debug/moc_qscilexer.o
debug/moc_qscilexerasm.o
debug/moc_qscilexeravs.o
debug/moc_qscilexerbash.o
debug/moc_qscilexerbatch.o
debug/moc_qscilexercmake.o
debug/moc_qscilexercoffeescript.o
debug/moc_qscilexercpp.o
debug/moc_qscilexercsharp.o
debug/moc_qscilexercss.o
debug/moc_qscilexercustom.o
debug/moc_qscilexerd.o
debug/moc_qscilexerdiff.o
debug/moc_qscilexeredifact.o
debug/moc_qscilexerfortran.o
debug/moc_qscilexerfortran77.o
debug/moc_qscilexerhex.o
debug/moc_qscilexerhtml.o
debug/moc_qscilexeridl.o
debug/moc_qscilexerintelhex.o
debug/moc_qscilexerjava.o
debug/moc_qscilexerjavascript.o
debug/moc_qscilexerjson.o
debug/moc_qscilexerlua.o
debug/moc_qscilexermakefile.o
debug/moc_qscilexermarkdown.o
debug/moc_qscilexermasm.o
debug/moc_qscilexermatlab.o
debug/moc_qscilexernasm.o
debug/moc_qscilexeroctave.o
debug/moc_qscilexerpascal.o
debug/moc_qscilexerperl.o
debug/moc_qscilexerpostscript.o
debug/moc_qscilexerpo.o
debug/moc_qscilexerpov.o
debug/moc_qscilexerproperties.o
debug/moc_qscilexerpython.o
debug/moc_qscilexerruby.o
debug/moc_qscilexerspice.o
debug/moc_qscilexersql.o
debug/moc_qscilexersrec.o
debug/moc_qscilexertcl.o
debug/moc_qscilexertekhex.o
debug/moc_qscilexertex.o
debug/moc_qscilexerverilog.o
debug/moc_qscilexervhdl.o
debug/moc_qscilexerxml.o
debug/moc_qscilexeryaml.o
debug/moc_qscimacro.o
debug/moc_SciClasses.o
debug/moc_ScintillaQt.o

View File

@@ -0,0 +1,25 @@
QT += widgets
!ios:QT += printsupport
macx:lessThan(QT_MAJOR_VERSION, 6) {
QT += macextras
}
DEFINES += QSCINTILLA_DLL
INCLUDEPATH += $$[QT_INSTALL_HEADERS]
LIBS += -L$$[QT_INSTALL_LIBS]
CONFIG(debug, debug|release) {
mac: {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}_debug
} else {
win32: {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}d
} else {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}
}
}
} else {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}
}

View File

@@ -0,0 +1,23 @@
QT += widgets
!ios:QT += printsupport
macx:lessThan(QT_MAJOR_VERSION, 6) {
QT += macextras
}
INCLUDEPATH += $$[QT_INSTALL_HEADERS]
LIBS += -L$$[QT_INSTALL_LIBS]
CONFIG(debug, debug|release) {
mac: {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}_debug
} else {
win32: {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}d
} else {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}
}
}
} else {
LIBS += -lqscintilla2_qt$${QT_MAJOR_VERSION}
}

View File

@@ -0,0 +1,51 @@
// This module implements the QsciAbstractAPIs class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qsciabstractapis.h"
#include "Qsci/qscilexer.h"
// The ctor.
QsciAbstractAPIs::QsciAbstractAPIs(QsciLexer *lexer)
: QObject(lexer), lex(lexer)
{
lexer->setAPIs(this);
}
// The dtor.
QsciAbstractAPIs::~QsciAbstractAPIs()
{
}
// Return the lexer.
QsciLexer *QsciAbstractAPIs::lexer() const
{
return lex;
}
// Called when the user has made a selection from the auto-completion list.
void QsciAbstractAPIs::autoCompletionSelected(const QString &selection)
{
Q_UNUSED(selection);
}

995
third_party/qscintilla/src/qsciapis.cpp vendored Normal file
View File

@@ -0,0 +1,995 @@
// This module implements the QsciAPIs class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include <stdlib.h>
#include <algorithm>
#include "Qsci/qsciapis.h"
#include <QApplication>
#include <QDataStream>
#include <QDir>
#include <QEvent>
#include <QFile>
#include <QLibraryInfo>
#include <QMap>
#include <QTextStream>
#include <QThread>
#include "Qsci/qscilexer.h"
// The version number of the prepared API information format.
const unsigned char PreparedDataFormatVersion = 0;
// This class contains prepared API information.
struct QsciAPIsPrepared
{
// The word dictionary is a map of individual words and a list of positions
// each occurs in the sorted list of APIs. A position is a tuple of the
// index into the list of APIs and the index into the particular API.
QMap<QString, QsciAPIs::WordIndexList> wdict;
// The case dictionary maps the case insensitive words to the form in which
// they are to be used. It is only used if the language is case
// insensitive.
QMap<QString, QString> cdict;
// The raw API information.
QStringList raw_apis;
QStringList apiWords(int api_idx, const QStringList &wseps,
bool strip_image) const;
static QString apiBaseName(const QString &api);
};
// Return a particular API entry as a list of words.
QStringList QsciAPIsPrepared::apiWords(int api_idx, const QStringList &wseps,
bool strip_image) const
{
QString base = apiBaseName(raw_apis[api_idx]);
// Remove any embedded image reference if necessary.
if (strip_image)
{
int tail = base.indexOf('?');
if (tail >= 0)
base.truncate(tail);
}
if (wseps.isEmpty())
return QStringList(base);
return base.split(wseps.first());
}
// Return the name of an API function, ie. without the arguments.
QString QsciAPIsPrepared::apiBaseName(const QString &api)
{
QString base = api;
int tail = base.indexOf('(');
if (tail >= 0)
base.truncate(tail);
return base.simplified();
}
// The user event type that signals that the worker thread has started.
const QEvent::Type WorkerStarted = static_cast<QEvent::Type>(QEvent::User + 1012);
// The user event type that signals that the worker thread has finished.
const QEvent::Type WorkerFinished = static_cast<QEvent::Type>(QEvent::User + 1013);
// The user event type that signals that the worker thread has aborted.
const QEvent::Type WorkerAborted = static_cast<QEvent::Type>(QEvent::User + 1014);
// This class is the worker thread that post-processes the API set.
class QsciAPIsWorker : public QThread
{
public:
QsciAPIsWorker(QsciAPIs *apis);
virtual ~QsciAPIsWorker();
virtual void run();
QsciAPIsPrepared *prepared;
private:
QsciAPIs *proxy;
bool abort;
};
// The worker thread ctor.
QsciAPIsWorker::QsciAPIsWorker(QsciAPIs *apis)
: prepared(0), proxy(apis), abort(false)
{
}
// The worker thread dtor.
QsciAPIsWorker::~QsciAPIsWorker()
{
// Tell the thread to stop. There is no need to bother with a mutex.
abort = true;
// Wait for it to do so and hit it if it doesn't.
if (!wait(500))
terminate();
if (prepared)
delete prepared;
}
// The worker thread entry point.
void QsciAPIsWorker::run()
{
// Sanity check.
if (!prepared)
return;
// Tell the main thread we have started.
QApplication::postEvent(proxy, new QEvent(WorkerStarted));
// Sort the full list.
prepared->raw_apis.sort();
QStringList wseps = proxy->lexer()->autoCompletionWordSeparators();
bool cs = proxy->lexer()->caseSensitive();
// Split each entry into separate words but ignoring any arguments.
for (int a = 0; a < prepared->raw_apis.count(); ++a)
{
// Check to see if we should stop.
if (abort)
break;
QStringList words = prepared->apiWords(a, wseps, true);
for (int w = 0; w < words.count(); ++w)
{
const QString &word = words[w];
// Add the word's position to any existing list for this word.
QsciAPIs::WordIndexList wil = prepared->wdict[word];
// If the language is case insensitive and we haven't seen this
// word before then save it in the case dictionary.
if (!cs && wil.count() == 0)
prepared->cdict[word.toUpper()] = word;
wil.append(QsciAPIs::WordIndex(a, w));
prepared->wdict[word] = wil;
}
}
// Tell the main thread we have finished.
QApplication::postEvent(proxy, new QEvent(abort ? WorkerAborted : WorkerFinished));
}
// The ctor.
QsciAPIs::QsciAPIs(QsciLexer *lexer)
: QsciAbstractAPIs(lexer), worker(0), origin_len(0)
{
prep = new QsciAPIsPrepared;
}
// The dtor.
QsciAPIs::~QsciAPIs()
{
deleteWorker();
delete prep;
}
// Delete the worker thread if there is one.
void QsciAPIs::deleteWorker()
{
if (worker)
{
delete worker;
worker = 0;
}
}
//! Handle termination events from the worker thread.
bool QsciAPIs::event(QEvent *e)
{
switch (e->type())
{
case WorkerStarted:
emit apiPreparationStarted();
return true;
case WorkerAborted:
deleteWorker();
emit apiPreparationCancelled();
return true;
case WorkerFinished:
delete prep;
old_context.clear();
prep = worker->prepared;
worker->prepared = 0;
deleteWorker();
// Allow the raw API information to be modified.
apis = prep->raw_apis;
emit apiPreparationFinished();
return true;
default:
break;
}
return QObject::event(e);
}
// Clear the current raw API entries.
void QsciAPIs::clear()
{
apis.clear();
}
// Clear out all API information.
bool QsciAPIs::load(const QString &filename)
{
QFile f(filename);
if (!f.open(QIODevice::ReadOnly))
return false;
QTextStream ts(&f);
for (;;)
{
QString line = ts.readLine();
if (line.isEmpty())
break;
apis.append(line);
}
return true;
}
// Add a single API entry.
void QsciAPIs::add(const QString &entry)
{
apis.append(entry);
}
// Remove a single API entry.
void QsciAPIs::remove(const QString &entry)
{
int idx = apis.indexOf(entry);
if (idx >= 0)
apis.removeAt(idx);
}
// Position the "origin" cursor into the API entries according to the user
// supplied context.
QStringList QsciAPIs::positionOrigin(const QStringList &context, QString &path)
{
// Get the list of words and see if the context is the same as last time we
// were called.
QStringList new_context;
bool same_context = (old_context.count() > 0 && old_context.count() < context.count());
for (int i = 0; i < context.count(); ++i)
{
QString word = context[i];
if (!lexer()->caseSensitive())
word = word.toUpper();
if (i < old_context.count() && old_context[i] != word)
same_context = false;
new_context << word;
}
// If the context has changed then reset the origin.
if (!same_context)
origin_len = 0;
// If we have a current origin (ie. the user made a specific selection in
// the current context) then adjust the origin to include the last complete
// word as the user may have entered more parts of the name without using
// auto-completion.
if (origin_len > 0)
{
const QString wsep = lexer()->autoCompletionWordSeparators().first();
int start_new = old_context.count();
int end_new = new_context.count() - 1;
if (start_new == end_new)
{
path = old_context.join(wsep);
origin_len = path.length();
}
else
{
QString fixed = *origin;
fixed.truncate(origin_len);
path = fixed;
while (start_new < end_new)
{
// Add this word to the current path.
path.append(wsep);
path.append(new_context[start_new]);
origin_len = path.length();
// Skip entries in the current origin that don't match the
// path.
while (origin != prep->raw_apis.end())
{
// See if the current origin has come to an end.
if (!originStartsWith(fixed, wsep))
origin = prep->raw_apis.end();
else if (originStartsWith(path, wsep))
break;
else
++origin;
}
if (origin == prep->raw_apis.end())
break;
++start_new;
}
}
// Terminate the path.
path.append(wsep);
// If the new text wasn't recognised then reset the origin.
if (origin == prep->raw_apis.end())
origin_len = 0;
}
if (origin_len == 0)
path.truncate(0);
// Save the "committed" context for next time.
old_context = new_context;
old_context.removeLast();
return new_context;
}
// Return true if the origin starts with the given path.
bool QsciAPIs::originStartsWith(const QString &path, const QString &wsep)
{
const QString &orig = *origin;
if (!orig.startsWith(path))
return false;
// Check that the path corresponds to the end of a word, ie. that what
// follows in the origin is either a word separator or a (.
QString tail = orig.mid(path.length());
return (!tail.isEmpty() && (tail.startsWith(wsep) || tail.at(0) == '('));
}
// Add auto-completion words to an existing list.
void QsciAPIs::updateAutoCompletionList(const QStringList &context,
QStringList &list)
{
QString path;
QStringList new_context = positionOrigin(context, path);
if (origin_len > 0)
{
const QString wsep = lexer()->autoCompletionWordSeparators().first();
QStringList::const_iterator it = origin;
unambiguous_context = path;
while (it != prep->raw_apis.end())
{
QString base = QsciAPIsPrepared::apiBaseName(*it);
if (!base.startsWith(path))
break;
// Make sure we have something after the path.
if (base != path)
{
// Get the word we are interested in (ie. the one after the
// current origin in path).
QString w = base.mid(origin_len + wsep.length()).split(wsep).first();
// Append the space, we know the origin is unambiguous.
w.append(' ');
if (!list.contains(w))
list << w;
}
++it;
}
}
else
{
// At the moment we assume we will add words from multiple contexts so
// mark the unambiguous context as unknown.
unambiguous_context = QString();
bool unambig = true;
QStringList with_context;
if (new_context.last().isEmpty())
lastCompleteWord(new_context[new_context.count() - 2], with_context, unambig);
else
lastPartialWord(new_context.last(), with_context, unambig);
for (int i = 0; i < with_context.count(); ++i)
{
// Remove any unambigious context (allowing for a possible image
// identifier).
QString noc = with_context[i];
if (unambig)
{
int op = noc.indexOf(QLatin1String(" ("));
if (op >= 0)
{
int cl = noc.indexOf(QLatin1String(")"));
if (cl > op)
noc.remove(op, cl - op + 1);
else
noc.truncate(op);
}
}
list << noc;
}
}
}
// Get the index list for a particular word if there is one.
const QsciAPIs::WordIndexList *QsciAPIs::wordIndexOf(const QString &word) const
{
QString csword;
// Indirect through the case dictionary if the language isn't case
// sensitive.
if (lexer()->caseSensitive())
csword = word;
else
{
csword = prep->cdict[word];
if (csword.isEmpty())
return 0;
}
// Get the possible API entries if any.
const WordIndexList *wl = &prep->wdict[csword];
if (wl->isEmpty())
return 0;
return wl;
}
// Add auto-completion words based on the last complete word entered.
void QsciAPIs::lastCompleteWord(const QString &word, QStringList &with_context, bool &unambig)
{
// Get the possible API entries if any.
const WordIndexList *wl = wordIndexOf(word);
if (wl)
addAPIEntries(*wl, true, with_context, unambig);
}
// Add auto-completion words based on the last partial word entered.
void QsciAPIs::lastPartialWord(const QString &word, QStringList &with_context, bool &unambig)
{
if (lexer()->caseSensitive())
{
QMap<QString, WordIndexList>::const_iterator it = prep->wdict.lowerBound(word);
while (it != prep->wdict.end())
{
if (!it.key().startsWith(word))
break;
addAPIEntries(it.value(), false, with_context, unambig);
++it;
}
}
else
{
QMap<QString, QString>::const_iterator it = prep->cdict.lowerBound(word);
while (it != prep->cdict.end())
{
if (!it.key().startsWith(word))
break;
addAPIEntries(prep->wdict[it.value()], false, with_context, unambig);
++it;
}
}
}
// Handle the selection of an entry in the auto-completion list.
void QsciAPIs::autoCompletionSelected(const QString &selection)
{
// If the selection is an API (ie. it has a space separating the selected
// word and the optional origin) then remember the origin.
QStringList lst = selection.split(' ');
if (lst.count() != 2)
{
origin_len = 0;
return;
}
const QString &path = lst[1];
QString owords;
if (path.isEmpty())
owords = unambiguous_context;
else
{
// Check the parenthesis.
if (!path.startsWith("(") || !path.endsWith(")"))
{
origin_len = 0;
return;
}
// Remove the parenthesis.
owords = path.mid(1, path.length() - 2);
}
origin = std::lower_bound(prep->raw_apis.begin(), prep->raw_apis.end(),
owords);
origin_len = owords.length();
}
// Add auto-completion words for a particular word (defined by where it appears
// in the APIs) and depending on whether the word was complete (when it's
// actually the next word in the API entry that is of interest) or not.
void QsciAPIs::addAPIEntries(const WordIndexList &wl, bool complete,
QStringList &with_context, bool &unambig)
{
QStringList wseps = lexer()->autoCompletionWordSeparators();
for (int w = 0; w < wl.count(); ++w)
{
const WordIndex &wi = wl[w];
QStringList api_words = prep->apiWords(wi.first, wseps, false);
int idx = wi.second;
if (complete)
{
// Skip if this is the last word.
if (++idx >= api_words.count())
continue;
}
QString api_word, org;
if (idx == 0)
{
api_word = api_words[0] + ' ';
org = QString::fromLatin1("");
}
else
{
QStringList orgl = api_words.mid(0, idx);
org = orgl.join(wseps.first());
// Add the context (allowing for a possible image identifier).
QString w = api_words[idx];
QString type;
int type_idx = w.indexOf(QLatin1String("?"));
if (type_idx >= 0)
{
type = w.mid(type_idx);
w.truncate(type_idx);
}
api_word = QString("%1 (%2)%3").arg(w).arg(org).arg(type);
}
// If the origin is different to the context then the context is
// ambiguous.
if (unambig)
{
if (unambiguous_context.isNull())
{
unambiguous_context = org;
}
else if (unambiguous_context != org)
{
unambiguous_context.truncate(0);
unambig = false;
}
}
if (!with_context.contains(api_word))
with_context.append(api_word);
}
}
// Return the call tip for a function.
QStringList QsciAPIs::callTips(const QStringList &context, int commas,
QsciScintilla::CallTipsStyle style, QList<int> &shifts)
{
QString path;
QStringList new_context = positionOrigin(context, path);
QStringList wseps = lexer()->autoCompletionWordSeparators();
QStringList cts;
if (origin_len > 0)
{
// The path should have a trailing word separator.
const QString &wsep = wseps.first();
path.chop(wsep.length());
QStringList::const_iterator it = origin;
QString prev;
// Work out the length of the context.
QStringList strip = path.split(wsep);
strip.removeLast();
int ctstart = strip.join(wsep).length();
if (ctstart)
ctstart += wsep.length();
int shift;
if (style == QsciScintilla::CallTipsContext)
{
shift = ctstart;
ctstart = 0;
}
else
shift = 0;
// Make sure we only look at the functions we are interested in.
path.append('(');
while (it != prep->raw_apis.end() && (*it).startsWith(path))
{
QString w = (*it).mid(ctstart);
if (w != prev && enoughCommas(w, commas))
{
shifts << shift;
cts << w;
prev = w;
}
++it;
}
}
else
{
const QString &fname = new_context[new_context.count() - 2];
// Find everywhere the function name appears in the APIs.
const WordIndexList *wil = wordIndexOf(fname);
if (wil)
for (int i = 0; i < wil->count(); ++i)
{
const WordIndex &wi = (*wil)[i];
QStringList awords = prep->apiWords(wi.first, wseps, true);
// Check the word is the function name and not part of any
// context.
if (wi.second != awords.count() - 1)
continue;
const QString &api = prep->raw_apis[wi.first];
int tail = api.indexOf('(');
if (tail < 0)
continue;
if (!enoughCommas(api, commas))
continue;
if (style == QsciScintilla::CallTipsNoContext)
{
shifts << 0;
cts << (fname + api.mid(tail));
}
else
{
shifts << tail - fname.length();
// Remove any image type.
int im_type = api.indexOf('?');
if (im_type <= 0)
cts << api;
else
cts << (api.left(im_type - 1) + api.mid(tail));
}
}
}
return cts;
}
// Return true if a string has enough commas in the argument list.
bool QsciAPIs::enoughCommas(const QString &s, int commas)
{
int end = s.indexOf(')');
if (end < 0)
return false;
QString w = s.left(end);
return (w.count(',') >= commas);
}
// Ensure the list is ready.
void QsciAPIs::prepare()
{
// Handle the trivial case.
if (worker)
return;
QsciAPIsPrepared *new_apis = new QsciAPIsPrepared;
new_apis->raw_apis = apis;
worker = new QsciAPIsWorker(this);
worker->prepared = new_apis;
worker->start();
}
// Cancel any current preparation.
void QsciAPIs::cancelPreparation()
{
deleteWorker();
}
// Check that a prepared API file exists.
bool QsciAPIs::isPrepared(const QString &filename) const
{
QString pname = prepName(filename);
if (pname.isEmpty())
return false;
QFileInfo fi(pname);
return fi.exists();
}
// Load the prepared API information.
bool QsciAPIs::loadPrepared(const QString &filename)
{
QString pname = prepName(filename);
if (pname.isEmpty())
return false;
// Read the prepared data and decompress it.
QFile pf(pname);
if (!pf.open(QIODevice::ReadOnly))
return false;
QByteArray cpdata = pf.readAll();
pf.close();
if (cpdata.count() == 0)
return false;
QByteArray pdata = qUncompress(cpdata);
// Extract the data.
QDataStream pds(pdata);
unsigned char vers;
pds >> vers;
if (vers > PreparedDataFormatVersion)
return false;
char *lex_name;
pds >> lex_name;
if (qstrcmp(lex_name, lexer()->lexer()) != 0)
{
delete[] lex_name;
return false;
}
delete[] lex_name;
prep->wdict.clear();
pds >> prep->wdict;
if (!lexer()->caseSensitive())
{
// Build up the case dictionary.
prep->cdict.clear();
QMap<QString, WordIndexList>::const_iterator it = prep->wdict.begin();
while (it != prep->wdict.end())
{
prep->cdict[it.key().toUpper()] = it.key();
++it;
}
}
prep->raw_apis.clear();
pds >> prep->raw_apis;
// Allow the raw API information to be modified.
apis = prep->raw_apis;
return true;
}
// Save the prepared API information.
bool QsciAPIs::savePrepared(const QString &filename) const
{
QString pname = prepName(filename, true);
if (pname.isEmpty())
return false;
// Write the prepared data to a memory buffer.
QByteArray pdata;
QDataStream pds(&pdata, QIODevice::WriteOnly);
// Use a serialisation format supported by Qt v3.0 and later.
pds.setVersion(QDataStream::Qt_3_0);
pds << PreparedDataFormatVersion;
pds << lexer()->lexer();
pds << prep->wdict;
pds << prep->raw_apis;
// Compress the data and write it.
QFile pf(pname);
if (!pf.open(QIODevice::WriteOnly|QIODevice::Truncate))
return false;
if (pf.write(qCompress(pdata)) < 0)
{
pf.close();
return false;
}
pf.close();
return true;
}
// Return the name of the default prepared API file.
QString QsciAPIs::defaultPreparedName() const
{
return prepName(QString());
}
// Return the name of a prepared API file.
QString QsciAPIs::prepName(const QString &filename, bool mkpath) const
{
// Handle the tivial case.
if (!filename.isEmpty())
return filename;
QString pdname;
char *qsci = getenv("QSCIDIR");
if (qsci)
pdname = qsci;
else
{
static const char *qsci_dir = ".qsci";
QDir pd = QDir::home();
if (mkpath && !pd.exists(qsci_dir) && !pd.mkdir(qsci_dir))
return QString();
pdname = pd.filePath(qsci_dir);
}
return QString("%1/%2.pap").arg(pdname).arg(lexer()->lexer());
}
// Return installed API files.
QStringList QsciAPIs::installedAPIFiles() const
{
QString qtdir = QLibraryInfo::location(QLibraryInfo::DataPath);
QDir apidir = QDir(QString("%1/qsci/api/%2").arg(qtdir).arg(lexer()->lexer()));
QStringList filenames;
QStringList filters;
filters << "*.api";
QFileInfoList flist = apidir.entryInfoList(filters, QDir::Files, QDir::IgnoreCase);
foreach (QFileInfo fi, flist)
filenames << fi.absoluteFilePath();
return filenames;
}

View File

@@ -0,0 +1,143 @@
// This module implements the QsciCommand class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscicommand.h"
#include <qnamespace.h>
#include <qapplication.h>
#include "Qsci/qsciscintilla.h"
#include "Qsci/qsciscintillabase.h"
static int convert(int key);
// The ctor.
QsciCommand::QsciCommand(QsciScintilla *qs, QsciCommand::Command cmd, int key,
int altkey, const char *desc)
: qsCmd(qs), scicmd(cmd), qkey(key), qaltkey(altkey), descCmd(desc)
{
scikey = convert(qkey);
if (scikey)
qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scikey,
scicmd);
scialtkey = convert(qaltkey);
if (scialtkey)
qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scialtkey,
scicmd);
}
// Execute the command.
void QsciCommand::execute()
{
qsCmd->SendScintilla(scicmd);
}
// Bind a key to a command.
void QsciCommand::setKey(int key)
{
bindKey(key,qkey,scikey);
}
// Bind an alternate key to a command.
void QsciCommand::setAlternateKey(int altkey)
{
bindKey(altkey,qaltkey,scialtkey);
}
// Do the hard work of binding a key.
void QsciCommand::bindKey(int key,int &qk,int &scik)
{
int new_scikey;
// Ignore if it is invalid, allowing for the fact that we might be
// unbinding it.
if (key)
{
new_scikey = convert(key);
if (!new_scikey)
return;
}
else
new_scikey = 0;
if (scik)
qsCmd->SendScintilla(QsciScintillaBase::SCI_CLEARCMDKEY, scik);
qk = key;
scik = new_scikey;
if (scik)
qsCmd->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY, scik, scicmd);
}
// See if a key is valid.
bool QsciCommand::validKey(int key)
{
return convert(key);
}
// Convert a Qt character to the Scintilla equivalent. Return zero if it is
// invalid.
static int convert(int key)
{
// Convert the modifiers.
int sci_mod = 0;
if (key & Qt::SHIFT)
sci_mod |= QsciScintillaBase::SCMOD_SHIFT;
if (key & Qt::CTRL)
sci_mod |= QsciScintillaBase::SCMOD_CTRL;
if (key & Qt::ALT)
sci_mod |= QsciScintillaBase::SCMOD_ALT;
if (key & Qt::META)
sci_mod |= QsciScintillaBase::SCMOD_META;
key &= ~Qt::MODIFIER_MASK;
// Convert the key.
int sci_key = QsciScintillaBase::commandKey(key, sci_mod);
if (sci_key)
sci_key |= (sci_mod << 16);
return sci_key;
}
// Return the translated user friendly description.
QString QsciCommand::description() const
{
return qApp->translate("QsciCommand", descCmd);
}

View File

@@ -0,0 +1,987 @@
// This module implements the QsciCommandSet class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscicommandset.h"
#include <QSettings>
#include "Qsci/qscicommand.h"
#include "Qsci/qsciscintilla.h"
#include "Qsci/qsciscintillabase.h"
// Starting with QScintilla v2.7 the standard OS/X keyboard shortcuts are used
// where possible. In order to restore the behaviour of earlier versions then
// #define DONT_USE_OSX_KEYS here or add it to the qmake project (.pro) file.
#if defined(Q_OS_MAC) && !defined(DONT_USE_OSX_KEYS)
#define USING_OSX_KEYS
#else
#undef USING_OSX_KEYS
#endif
// The ctor.
QsciCommandSet::QsciCommandSet(QsciScintilla *qs) : qsci(qs)
{
struct sci_cmd {
QsciCommand::Command cmd;
int key;
int altkey;
const char *desc;
};
static struct sci_cmd cmd_table[] = {
{
QsciCommand::LineDown,
Qt::Key_Down,
#if defined(USING_OSX_KEYS)
Qt::Key_N | Qt::META,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move down one line")
},
{
QsciCommand::LineDownExtend,
Qt::Key_Down | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_N | Qt::META | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection down one line")
},
{
QsciCommand::LineDownRectExtend,
Qt::Key_Down | Qt::ALT | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_N | Qt::META | Qt::ALT | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection down one line")
},
{
QsciCommand::LineScrollDown,
Qt::Key_Down | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Scroll view down one line")
},
{
QsciCommand::LineUp,
Qt::Key_Up,
#if defined(USING_OSX_KEYS)
Qt::Key_P | Qt::META,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move up one line")
},
{
QsciCommand::LineUpExtend,
Qt::Key_Up | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_P | Qt::META | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection up one line")
},
{
QsciCommand::LineUpRectExtend,
Qt::Key_Up | Qt::ALT | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_P | Qt::META | Qt::ALT | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection up one line")
},
{
QsciCommand::LineScrollUp,
Qt::Key_Up | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Scroll view up one line")
},
{
QsciCommand::ScrollToStart,
#if defined(USING_OSX_KEYS)
Qt::Key_Home,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Scroll to start of document")
},
{
QsciCommand::ScrollToEnd,
#if defined(USING_OSX_KEYS)
Qt::Key_End,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Scroll to end of document")
},
{
QsciCommand::VerticalCentreCaret,
#if defined(USING_OSX_KEYS)
Qt::Key_L | Qt::META,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Scroll vertically to centre current line")
},
{
QsciCommand::ParaDown,
Qt::Key_BracketRight | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move down one paragraph")
},
{
QsciCommand::ParaDownExtend,
Qt::Key_BracketRight | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection down one paragraph")
},
{
QsciCommand::ParaUp,
Qt::Key_BracketLeft | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move up one paragraph")
},
{
QsciCommand::ParaUpExtend,
Qt::Key_BracketLeft | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection up one paragraph")
},
{
QsciCommand::CharLeft,
Qt::Key_Left,
#if defined(USING_OSX_KEYS)
Qt::Key_B | Qt::META,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move left one character")
},
{
QsciCommand::CharLeftExtend,
Qt::Key_Left | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_B | Qt::META | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection left one character")
},
{
QsciCommand::CharLeftRectExtend,
Qt::Key_Left | Qt::ALT | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_B | Qt::META | Qt::ALT | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection left one character")
},
{
QsciCommand::CharRight,
Qt::Key_Right,
#if defined(USING_OSX_KEYS)
Qt::Key_F | Qt::META,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move right one character")
},
{
QsciCommand::CharRightExtend,
Qt::Key_Right | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_F | Qt::META | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection right one character")
},
{
QsciCommand::CharRightRectExtend,
Qt::Key_Right | Qt::ALT | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_F | Qt::META | Qt::ALT | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection right one character")
},
{
QsciCommand::WordLeft,
#if defined(USING_OSX_KEYS)
Qt::Key_Left | Qt::ALT,
#else
Qt::Key_Left | Qt::CTRL,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move left one word")
},
{
QsciCommand::WordLeftExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_Left | Qt::ALT | Qt::SHIFT,
#else
Qt::Key_Left | Qt::CTRL | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection left one word")
},
{
QsciCommand::WordRight,
#if defined(USING_OSX_KEYS)
0,
#else
Qt::Key_Right | Qt::CTRL,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move right one word")
},
{
QsciCommand::WordRightExtend,
Qt::Key_Right | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection right one word")
},
{
QsciCommand::WordLeftEnd,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to end of previous word")
},
{
QsciCommand::WordLeftEndExtend,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of previous word")
},
{
QsciCommand::WordRightEnd,
#if defined(USING_OSX_KEYS)
Qt::Key_Right | Qt::ALT,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to end of next word")
},
{
QsciCommand::WordRightEndExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_Right | Qt::ALT | Qt::SHIFT,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of next word")
},
{
QsciCommand::WordPartLeft,
Qt::Key_Slash | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move left one word part")
},
{
QsciCommand::WordPartLeftExtend,
Qt::Key_Slash | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection left one word part")
},
{
QsciCommand::WordPartRight,
Qt::Key_Backslash | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move right one word part")
},
{
QsciCommand::WordPartRightExtend,
Qt::Key_Backslash | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection right one word part")
},
{
QsciCommand::Home,
#if defined(USING_OSX_KEYS)
Qt::Key_A | Qt::META,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to start of document line")
},
{
QsciCommand::HomeExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_A | Qt::META | Qt::SHIFT,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to start of document line")
},
{
QsciCommand::HomeRectExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_A | Qt::META | Qt::ALT | Qt::SHIFT,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection to start of document line")
},
{
QsciCommand::HomeDisplay,
#if defined(USING_OSX_KEYS)
Qt::Key_Left | Qt::CTRL,
#else
Qt::Key_Home | Qt::ALT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to start of display line")
},
{
QsciCommand::HomeDisplayExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_Left | Qt::CTRL | Qt::SHIFT,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to start of display line")
},
{
QsciCommand::HomeWrap,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Move to start of display or document line")
},
{
QsciCommand::HomeWrapExtend,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to start of display or document line")
},
{
QsciCommand::VCHome,
#if defined(USING_OSX_KEYS)
0,
#else
Qt::Key_Home,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Move to first visible character in document line")
},
{
QsciCommand::VCHomeExtend,
#if defined(USING_OSX_KEYS)
0,
#else
Qt::Key_Home | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to first visible character in document line")
},
{
QsciCommand::VCHomeRectExtend,
#if defined(USING_OSX_KEYS)
0,
#else
Qt::Key_Home | Qt::ALT | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection to first visible character in document line")
},
{
QsciCommand::VCHomeWrap,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Move to first visible character of display in document line")
},
{
QsciCommand::VCHomeWrapExtend,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to first visible character in display or document line")
},
{
QsciCommand::LineEnd,
#if defined(USING_OSX_KEYS)
Qt::Key_E | Qt::META,
#else
Qt::Key_End,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to end of document line")
},
{
QsciCommand::LineEndExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_E | Qt::META | Qt::SHIFT,
#else
Qt::Key_End | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of document line")
},
{
QsciCommand::LineEndRectExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_E | Qt::META | Qt::ALT | Qt::SHIFT,
#else
Qt::Key_End | Qt::ALT | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection to end of document line")
},
{
QsciCommand::LineEndDisplay,
#if defined(USING_OSX_KEYS)
Qt::Key_Right | Qt::CTRL,
#else
Qt::Key_End | Qt::ALT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to end of display line")
},
{
QsciCommand::LineEndDisplayExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_Right | Qt::CTRL | Qt::SHIFT,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of display line")
},
{
QsciCommand::LineEndWrap,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Move to end of display or document line")
},
{
QsciCommand::LineEndWrapExtend,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of display or document line")
},
{
QsciCommand::DocumentStart,
#if defined(USING_OSX_KEYS)
Qt::Key_Up | Qt::CTRL,
#else
Qt::Key_Home | Qt::CTRL,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to start of document")
},
{
QsciCommand::DocumentStartExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_Up | Qt::CTRL | Qt::SHIFT,
#else
Qt::Key_Home | Qt::CTRL | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to start of document")
},
{
QsciCommand::DocumentEnd,
#if defined(USING_OSX_KEYS)
Qt::Key_Down | Qt::CTRL,
#else
Qt::Key_End | Qt::CTRL,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move to end of document")
},
{
QsciCommand::DocumentEndExtend,
#if defined(USING_OSX_KEYS)
Qt::Key_Down | Qt::CTRL | Qt::SHIFT,
#else
Qt::Key_End | Qt::CTRL | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend selection to end of document")
},
{
QsciCommand::PageUp,
Qt::Key_PageUp,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move up one page")
},
{
QsciCommand::PageUpExtend,
Qt::Key_PageUp | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection up one page")
},
{
QsciCommand::PageUpRectExtend,
Qt::Key_PageUp | Qt::ALT | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection up one page")
},
{
QsciCommand::PageDown,
Qt::Key_PageDown,
#if defined(USING_OSX_KEYS)
Qt::Key_V | Qt::META,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Move down one page")
},
{
QsciCommand::PageDownExtend,
Qt::Key_PageDown | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_V | Qt::META | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Extend selection down one page")
},
{
QsciCommand::PageDownRectExtend,
Qt::Key_PageDown | Qt::ALT | Qt::SHIFT,
#if defined(USING_OSX_KEYS)
Qt::Key_V | Qt::META | Qt::ALT | Qt::SHIFT,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand",
"Extend rectangular selection down one page")
},
{
QsciCommand::StutteredPageUp,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Stuttered move up one page")
},
{
QsciCommand::StutteredPageUpExtend,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Stuttered extend selection up one page")
},
{
QsciCommand::StutteredPageDown,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Stuttered move down one page")
},
{
QsciCommand::StutteredPageDownExtend,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Stuttered extend selection down one page")
},
{
QsciCommand::Delete,
Qt::Key_Delete,
#if defined(USING_OSX_KEYS)
Qt::Key_D | Qt::META,
#else
0,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Delete current character")
},
{
QsciCommand::DeleteBack,
Qt::Key_Backspace,
#if defined(USING_OSX_KEYS)
Qt::Key_H | Qt::META,
#else
Qt::Key_Backspace | Qt::SHIFT,
#endif
QT_TRANSLATE_NOOP("QsciCommand", "Delete previous character")
},
{
QsciCommand::DeleteBackNotLine,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Delete previous character if not at start of line")
},
{
QsciCommand::DeleteWordLeft,
Qt::Key_Backspace | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Delete word to left")
},
{
QsciCommand::DeleteWordRight,
Qt::Key_Delete | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Delete word to right")
},
{
QsciCommand::DeleteWordRightEnd,
#if defined(USING_OSX_KEYS)
Qt::Key_Delete | Qt::ALT,
#else
0,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Delete right to end of next word")
},
{
QsciCommand::DeleteLineLeft,
Qt::Key_Backspace | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Delete line to left")
},
{
QsciCommand::DeleteLineRight,
#if defined(USING_OSX_KEYS)
Qt::Key_K | Qt::META,
#else
Qt::Key_Delete | Qt::CTRL | Qt::SHIFT,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Delete line to right")
},
{
QsciCommand::LineDelete,
Qt::Key_L | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Delete current line")
},
{
QsciCommand::LineCut,
Qt::Key_L | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Cut current line")
},
{
QsciCommand::LineCopy,
Qt::Key_T | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Copy current line")
},
{
QsciCommand::LineTranspose,
Qt::Key_T | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Transpose current and previous lines")
},
{
QsciCommand::LineDuplicate,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Duplicate the current line")
},
{
QsciCommand::SelectAll,
Qt::Key_A | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Select all")
},
{
QsciCommand::MoveSelectedLinesUp,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Move selected lines up one line")
},
{
QsciCommand::MoveSelectedLinesDown,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand",
"Move selected lines down one line")
},
{
QsciCommand::SelectionDuplicate,
Qt::Key_D | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Duplicate selection")
},
{
QsciCommand::SelectionLowerCase,
Qt::Key_U | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Convert selection to lower case")
},
{
QsciCommand::SelectionUpperCase,
Qt::Key_U | Qt::CTRL | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Convert selection to upper case")
},
{
QsciCommand::SelectionCut,
Qt::Key_X | Qt::CTRL,
Qt::Key_Delete | Qt::SHIFT,
QT_TRANSLATE_NOOP("QsciCommand", "Cut selection")
},
{
QsciCommand::SelectionCopy,
Qt::Key_C | Qt::CTRL,
Qt::Key_Insert | Qt::CTRL,
QT_TRANSLATE_NOOP("QsciCommand", "Copy selection")
},
{
QsciCommand::Paste,
Qt::Key_V | Qt::CTRL,
Qt::Key_Insert | Qt::SHIFT,
QT_TRANSLATE_NOOP("QsciCommand", "Paste")
},
{
QsciCommand::EditToggleOvertype,
Qt::Key_Insert,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Toggle insert/overtype")
},
{
QsciCommand::Newline,
Qt::Key_Return,
Qt::Key_Return | Qt::SHIFT,
QT_TRANSLATE_NOOP("QsciCommand", "Insert newline")
},
{
QsciCommand::Formfeed,
0,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Formfeed")
},
{
QsciCommand::Tab,
Qt::Key_Tab,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Indent one level")
},
{
QsciCommand::Backtab,
Qt::Key_Tab | Qt::SHIFT,
0,
QT_TRANSLATE_NOOP("QsciCommand", "De-indent one level")
},
{
QsciCommand::Cancel,
Qt::Key_Escape,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Cancel")
},
{
QsciCommand::Undo,
Qt::Key_Z | Qt::CTRL,
Qt::Key_Backspace | Qt::ALT,
QT_TRANSLATE_NOOP("QsciCommand", "Undo last command")
},
{
QsciCommand::Redo,
#if defined(USING_OSX_KEYS)
Qt::Key_Z | Qt::CTRL | Qt::SHIFT,
#else
Qt::Key_Y | Qt::CTRL,
#endif
0,
QT_TRANSLATE_NOOP("QsciCommand", "Redo last command")
},
{
QsciCommand::ZoomIn,
Qt::Key_Plus | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Zoom in")
},
{
QsciCommand::ZoomOut,
Qt::Key_Minus | Qt::CTRL,
0,
QT_TRANSLATE_NOOP("QsciCommand", "Zoom out")
},
};
// Clear the default map.
qsci->SendScintilla(QsciScintillaBase::SCI_CLEARALLCMDKEYS);
// By default control characters don't do anything (rather than insert the
// control character into the text).
for (int k = 'A'; k <= 'Z'; ++k)
qsci->SendScintilla(QsciScintillaBase::SCI_ASSIGNCMDKEY,
k + (QsciScintillaBase::SCMOD_CTRL << 16),
QsciScintillaBase::SCI_NULL);
for (int i = 0; i < sizeof (cmd_table) / sizeof (cmd_table[0]); ++i)
cmds.append(
new QsciCommand(qsci, cmd_table[i].cmd, cmd_table[i].key,
cmd_table[i].altkey, cmd_table[i].desc));
}
// The dtor.
QsciCommandSet::~QsciCommandSet()
{
for (int i = 0; i < cmds.count(); ++i)
delete cmds.at(i);
}
// Read the command set from settings.
bool QsciCommandSet::readSettings(QSettings &qs, const char *prefix)
{
bool rc = true;
for (int i = 0; i < cmds.count(); ++i)
{
QsciCommand *cmd = cmds.at(i);
QString skey = QString("%1/keymap/c%2/").arg(prefix).arg(static_cast<int>(cmd->command()));
int key;
bool ok;
// Read the key.
ok = qs.contains(skey + "key");
key = qs.value(skey + "key", 0).toInt();
if (ok)
cmd->setKey(key);
else
rc = false;
// Read the alternate key.
ok = qs.contains(skey + "alt");
key = qs.value(skey + "alt", 0).toInt();
if (ok)
cmd->setAlternateKey(key);
else
rc = false;
}
return rc;
}
// Write the command set to settings.
bool QsciCommandSet::writeSettings(QSettings &qs, const char *prefix)
{
bool rc = true;
for (int i = 0; i < cmds.count(); ++i)
{
QsciCommand *cmd = cmds.at(i);
QString skey = QString("%1/keymap/c%2/").arg(prefix).arg(static_cast<int>(cmd->command()));
// Write the key.
qs.setValue(skey + "key", cmd->key());
// Write the alternate key.
qs.setValue(skey + "alt", cmd->alternateKey());
}
return rc;
}
// Clear the key bindings.
void QsciCommandSet::clearKeys()
{
for (int i = 0; i < cmds.count(); ++i)
cmds.at(i)->setKey(0);
}
// Clear the alternate key bindings.
void QsciCommandSet::clearAlternateKeys()
{
for (int i = 0; i < cmds.count(); ++i)
cmds.at(i)->setAlternateKey(0);
}
// Find the command bound to a key.
QsciCommand *QsciCommandSet::boundTo(int key) const
{
for (int i = 0; i < cmds.count(); ++i)
{
QsciCommand *cmd = cmds.at(i);
if (cmd->key() == key || cmd->alternateKey() == key)
return cmd;
}
return 0;
}
// Find a command.
QsciCommand *QsciCommandSet::find(QsciCommand::Command command) const
{
for (int i = 0; i < cmds.count(); ++i)
{
QsciCommand *cmd = cmds.at(i);
if (cmd->command() == command)
return cmd;
}
// This should never happen.
return 0;
}

View File

@@ -0,0 +1,151 @@
// This module implements the QsciDocument class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscidocument.h"
#include "Qsci/qsciscintillabase.h"
// This internal class encapsulates the underlying document and is shared by
// QsciDocument instances.
class QsciDocumentP
{
public:
QsciDocumentP() : doc(0), nr_displays(0), nr_attaches(1), modified(false) {}
void *doc; // The Scintilla document.
int nr_displays; // The number of displays.
int nr_attaches; // The number of attaches.
bool modified; // Set if not at a save point.
};
// The ctor.
QsciDocument::QsciDocument()
{
pdoc = new QsciDocumentP();
}
// The dtor.
QsciDocument::~QsciDocument()
{
detach();
}
// The copy ctor.
QsciDocument::QsciDocument(const QsciDocument &that)
{
attach(that);
}
// The assignment operator.
QsciDocument &QsciDocument::operator=(const QsciDocument &that)
{
if (pdoc != that.pdoc)
{
detach();
attach(that);
}
return *this;
}
// Attach an existing document to this one.
void QsciDocument::attach(const QsciDocument &that)
{
++that.pdoc->nr_attaches;
pdoc = that.pdoc;
}
// Detach the underlying document.
void QsciDocument::detach()
{
if (!pdoc)
return;
if (--pdoc->nr_attaches == 0)
{
if (pdoc->doc && pdoc->nr_displays == 0)
{
QsciScintillaBase *qsb = QsciScintillaBase::pool();
// Release the explicit reference to the document. If the pool is
// empty then we just accept the memory leak.
if (qsb)
qsb->SendScintilla(QsciScintillaBase::SCI_RELEASEDOCUMENT, 0,
pdoc->doc);
}
delete pdoc;
}
pdoc = 0;
}
// Undisplay and detach the underlying document.
void QsciDocument::undisplay(QsciScintillaBase *qsb)
{
if (--pdoc->nr_attaches == 0)
delete pdoc;
else if (--pdoc->nr_displays == 0)
{
// Create an explicit reference to the document to keep it alive.
qsb->SendScintilla(QsciScintillaBase::SCI_ADDREFDOCUMENT, 0, pdoc->doc);
}
pdoc = 0;
}
// Display the underlying document.
void QsciDocument::display(QsciScintillaBase *qsb, const QsciDocument *from)
{
void *ndoc = (from ? from->pdoc->doc : 0);
// SCI_SETDOCPOINTER appears to reset the EOL mode so save and restore it.
int eol_mode = qsb->SendScintilla(QsciScintillaBase::SCI_GETEOLMODE);
qsb->SendScintilla(QsciScintillaBase::SCI_SETDOCPOINTER, 0, ndoc);
ndoc = qsb->SendScintillaPtrResult(QsciScintillaBase::SCI_GETDOCPOINTER);
qsb->SendScintilla(QsciScintillaBase::SCI_SETEOLMODE, eol_mode);
pdoc->doc = ndoc;
++pdoc->nr_displays;
}
// Return the modified state of the document.
bool QsciDocument::isModified() const
{
return pdoc->modified;
}
// Set the modified state of the document.
void QsciDocument::setModified(bool m)
{
pdoc->modified = m;
}

749
third_party/qscintilla/src/qscilexer.cpp vendored Normal file
View File

@@ -0,0 +1,749 @@
// This module implements the QsciLexer class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexer.h"
#include <qapplication.h>
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
#include "Qsci/qsciapis.h"
#include "Qsci/qsciscintilla.h"
#include "Qsci/qsciscintillabase.h"
// The ctor.
QsciLexer::QsciLexer(QObject *parent)
: QObject(parent),
autoIndStyle(-1), apiSet(0), attached_editor(0)
{
#if defined(Q_OS_WIN)
defFont = QFont("Verdana", 10);
#elif defined(Q_OS_MAC)
defFont = QFont("Menlo", 12);
#else
defFont = QFont("Bitstream Vera Sans", 9);
#endif
// Set the default fore and background colours.
QPalette pal = QApplication::palette();
defColor = pal.text().color();
defPaper = pal.base().color();
// Putting this on the heap means we can keep the style getters const.
style_map = new StyleDataMap;
style_map->style_data_set = false;
}
// The dtor.
QsciLexer::~QsciLexer()
{
delete style_map;
}
// Set the attached editor.
void QsciLexer::setEditor(QsciScintilla *editor)
{
attached_editor = editor;
}
// Return the lexer name.
const char *QsciLexer::lexer() const
{
return 0;
}
// Return the lexer identifier.
int QsciLexer::lexerId() const
{
return QsciScintillaBase::SCLEX_CONTAINER;
}
// Return the number of style bits needed by the lexer.
int QsciLexer::styleBitsNeeded() const
{
return 8;
}
// Make sure the style defaults have been set.
void QsciLexer::setStyleDefaults() const
{
if (!style_map->style_data_set)
{
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
styleData(i);
style_map->style_data_set = true;
}
}
// Return a reference to a style's data, setting up the defaults if needed.
QsciLexer::StyleData &QsciLexer::styleData(int style) const
{
StyleData &sd = style_map->style_data[style];
// See if this is a new style by checking if the colour is valid.
if (!sd.color.isValid())
{
sd.color = defaultColor(style);
sd.paper = defaultPaper(style);
sd.font = defaultFont(style);
sd.eol_fill = defaultEolFill(style);
}
return sd;
}
// Set the APIs associated with the lexer.
void QsciLexer::setAPIs(QsciAbstractAPIs *apis)
{
apiSet = apis;
}
// Return a pointer to the current APIs if there are any.
QsciAbstractAPIs *QsciLexer::apis() const
{
return apiSet;
}
// Default implementation to return the set of fill up characters that can end
// auto-completion.
const char *QsciLexer::autoCompletionFillups() const
{
return "(";
}
// Default implementation to return the view used for indentation guides.
int QsciLexer::indentationGuideView() const
{
return QsciScintillaBase::SC_IV_LOOKBOTH;
}
// Default implementation to return the list of character sequences that can
// separate auto-completion words.
QStringList QsciLexer::autoCompletionWordSeparators() const
{
return QStringList();
}
// Default implementation to return the list of keywords that can start a
// block.
const char *QsciLexer::blockStartKeyword(int *) const
{
return 0;
}
// Default implementation to return the list of characters that can start a
// block.
const char *QsciLexer::blockStart(int *) const
{
return 0;
}
// Default implementation to return the list of characters that can end a
// block.
const char *QsciLexer::blockEnd(int *) const
{
return 0;
}
// Default implementation to return the style used for braces.
int QsciLexer::braceStyle() const
{
return -1;
}
// Default implementation to return the number of lines to look back when
// auto-indenting.
int QsciLexer::blockLookback() const
{
return 20;
}
// Default implementation to return the case sensitivity of the language.
bool QsciLexer::caseSensitive() const
{
return true;
}
// Default implementation to return the characters that make up a word.
const char *QsciLexer::wordCharacters() const
{
return 0;
}
// Default implementation to return the style used for whitespace.
int QsciLexer::defaultStyle() const
{
return 0;
}
// Returns the foreground colour of the text for a style.
QColor QsciLexer::color(int style) const
{
return styleData(style).color;
}
// Returns the background colour of the text for a style.
QColor QsciLexer::paper(int style) const
{
return styleData(style).paper;
}
// Returns the font for a style.
QFont QsciLexer::font(int style) const
{
return styleData(style).font;
}
// Returns the end-of-line fill for a style.
bool QsciLexer::eolFill(int style) const
{
return styleData(style).eol_fill;
}
// Returns the set of keywords.
const char *QsciLexer::keywords(int) const
{
return 0;
}
// Returns the default EOL fill for a style.
bool QsciLexer::defaultEolFill(int) const
{
return false;
}
// Returns the default font for a style.
QFont QsciLexer::defaultFont(int) const
{
return defaultFont();
}
// Returns the default font.
QFont QsciLexer::defaultFont() const
{
return defFont;
}
// Sets the default font.
void QsciLexer::setDefaultFont(const QFont &f)
{
defFont = f;
}
// Returns the default text colour for a style.
QColor QsciLexer::defaultColor(int) const
{
return defaultColor();
}
// Returns the default text colour.
QColor QsciLexer::defaultColor() const
{
return defColor;
}
// Sets the default text colour.
void QsciLexer::setDefaultColor(const QColor &c)
{
defColor = c;
}
// Returns the default paper colour for a styles.
QColor QsciLexer::defaultPaper(int) const
{
return defaultPaper();
}
// Returns the default paper colour.
QColor QsciLexer::defaultPaper() const
{
return defPaper;
}
// Sets the default paper colour.
void QsciLexer::setDefaultPaper(const QColor &c)
{
defPaper = c;
// Normally the default values are only intended to provide defaults when a
// lexer is first setup because once a style has been referenced then a
// copy of the default is made. However the default paper is a special
// case because there is no other way to set the background colour used
// where there is no text. Therefore we also actively set it.
setPaper(c, QsciScintillaBase::STYLE_DEFAULT);
}
// Read properties from the settings.
bool QsciLexer::readProperties(QSettings &,const QString &)
{
return true;
}
// Refresh all properties.
void QsciLexer::refreshProperties()
{
}
// Write properties to the settings.
bool QsciLexer::writeProperties(QSettings &,const QString &) const
{
return true;
}
// Restore the user settings.
bool QsciLexer::readSettings(QSettings &qs,const char *prefix)
{
bool ok, flag, rc = true;
int num;
QString key, full_key;
QStringList fdesc;
setStyleDefaults();
// Read the styles.
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
{
// Ignore invalid styles.
if (description(i).isEmpty())
continue;
key = QString("%1/%2/style%3/").arg(prefix).arg(language()).arg(i);
// Read the foreground colour.
full_key = key + "color";
ok = qs.contains(full_key);
num = qs.value(full_key).toInt();
if (ok)
setColor(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i);
else
rc = false;
// Read the end-of-line fill.
full_key = key + "eolfill";
ok = qs.contains(full_key);
flag = qs.value(full_key, false).toBool();
if (ok)
setEolFill(flag, i);
else
rc = false;
// Read the font. First try the deprecated format that uses an integer
// point size.
full_key = key + "font";
ok = qs.contains(full_key);
fdesc = qs.value(full_key).toStringList();
if (ok && fdesc.count() == 5)
{
QFont f;
f.setFamily(fdesc[0]);
f.setPointSize(fdesc[1].toInt());
f.setBold(fdesc[2].toInt());
f.setItalic(fdesc[3].toInt());
f.setUnderline(fdesc[4].toInt());
setFont(f, i);
}
else
rc = false;
// Now try the newer font format that uses a floating point point size.
// It is not an error if it doesn't exist.
full_key = key + "font2";
ok = qs.contains(full_key);
fdesc = qs.value(full_key).toStringList();
if (ok)
{
// Allow for future versions with more fields.
if (fdesc.count() >= 5)
{
QFont f;
f.setFamily(fdesc[0]);
f.setPointSizeF(fdesc[1].toDouble());
f.setBold(fdesc[2].toInt());
f.setItalic(fdesc[3].toInt());
f.setUnderline(fdesc[4].toInt());
setFont(f, i);
}
else
{
rc = false;
}
}
// Read the background colour.
full_key = key + "paper";
ok = qs.contains(full_key);
num = qs.value(full_key).toInt();
if (ok)
setPaper(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff), i);
else
rc = false;
}
// Read the properties.
key = QString("%1/%2/properties/").arg(prefix).arg(language());
if (!readProperties(qs,key))
rc = false;
refreshProperties();
// Read the rest.
key = QString("%1/%2/").arg(prefix).arg(language());
// Read the default foreground colour.
full_key = key + "defaultcolor";
ok = qs.contains(full_key);
num = qs.value(full_key).toInt();
if (ok)
setDefaultColor(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff));
else
rc = false;
// Read the default background colour.
full_key = key + "defaultpaper";
ok = qs.contains(full_key);
num = qs.value(full_key).toInt();
if (ok)
setDefaultPaper(QColor((num >> 16) & 0xff, (num >> 8) & 0xff, num & 0xff));
else
rc = false;
// Read the default font. First try the deprecated format that uses an
// integer point size.
full_key = key + "defaultfont";
ok = qs.contains(full_key);
fdesc = qs.value(full_key).toStringList();
if (ok && fdesc.count() == 5)
{
QFont f;
f.setFamily(fdesc[0]);
f.setPointSize(fdesc[1].toInt());
f.setBold(fdesc[2].toInt());
f.setItalic(fdesc[3].toInt());
f.setUnderline(fdesc[4].toInt());
setDefaultFont(f);
}
else
rc = false;
// Now try the newer font format that uses a floating point point size. It
// is not an error if it doesn't exist.
full_key = key + "defaultfont2";
ok = qs.contains(full_key);
fdesc = qs.value(full_key).toStringList();
if (ok)
{
// Allow for future versions with more fields.
if (fdesc.count() >= 5)
{
QFont f;
f.setFamily(fdesc[0]);
f.setPointSizeF(fdesc[1].toDouble());
f.setBold(fdesc[2].toInt());
f.setItalic(fdesc[3].toInt());
f.setUnderline(fdesc[4].toInt());
setDefaultFont(f);
}
else
{
rc = false;
}
}
full_key = key + "autoindentstyle";
ok = qs.contains(full_key);
num = qs.value(full_key).toInt();
if (ok)
setAutoIndentStyle(num);
else
rc = false;
return rc;
}
// Save the user settings.
bool QsciLexer::writeSettings(QSettings &qs,const char *prefix) const
{
bool rc = true;
QString key, fmt("%1");
int num;
QStringList fdesc;
setStyleDefaults();
// Write the styles.
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
{
// Ignore invalid styles.
if (description(i).isEmpty())
continue;
QColor c;
key = QString("%1/%2/style%3/").arg(prefix).arg(language()).arg(i);
// Write the foreground colour.
c = color(i);
num = (c.red() << 16) | (c.green() << 8) | c.blue();
qs.setValue(key + "color", num);
// Write the end-of-line fill.
qs.setValue(key + "eolfill", eolFill(i));
// Write the font using the deprecated format.
QFont f = font(i);
fdesc.clear();
fdesc += f.family();
fdesc += fmt.arg(f.pointSize());
// The casts are for Borland.
fdesc += fmt.arg((int)f.bold());
fdesc += fmt.arg((int)f.italic());
fdesc += fmt.arg((int)f.underline());
qs.setValue(key + "font", fdesc);
// Write the font using the newer format.
fdesc[1] = fmt.arg(f.pointSizeF());
qs.setValue(key + "font2", fdesc);
// Write the background colour.
c = paper(i);
num = (c.red() << 16) | (c.green() << 8) | c.blue();
qs.setValue(key + "paper", num);
}
// Write the properties.
key = QString("%1/%2/properties/").arg(prefix).arg(language());
if (!writeProperties(qs,key))
rc = false;
// Write the rest.
key = QString("%1/%2/").arg(prefix).arg(language());
// Write the default foreground colour.
num = (defColor.red() << 16) | (defColor.green() << 8) | defColor.blue();
qs.setValue(key + "defaultcolor", num);
// Write the default background colour.
num = (defPaper.red() << 16) | (defPaper.green() << 8) | defPaper.blue();
qs.setValue(key + "defaultpaper", num);
// Write the default font using the deprecated format.
fdesc.clear();
fdesc += defFont.family();
fdesc += fmt.arg(defFont.pointSize());
// The casts are for Borland.
fdesc += fmt.arg((int)defFont.bold());
fdesc += fmt.arg((int)defFont.italic());
fdesc += fmt.arg((int)defFont.underline());
qs.setValue(key + "defaultfont", fdesc);
// Write the font using the newer format.
fdesc[1] = fmt.arg(defFont.pointSizeF());
qs.setValue(key + "defaultfont2", fdesc);
qs.setValue(key + "autoindentstyle", autoIndStyle);
return rc;
}
// Return the auto-indentation style.
int QsciLexer::autoIndentStyle()
{
// We can't do this in the ctor because we want the virtuals to work.
if (autoIndStyle < 0)
autoIndStyle = (blockStartKeyword() || blockStart() || blockEnd()) ?
0 : QsciScintilla::AiMaintain;
return autoIndStyle;
}
// Set the auto-indentation style.
void QsciLexer::setAutoIndentStyle(int autoindentstyle)
{
autoIndStyle = autoindentstyle;
}
// Set the foreground colour for a style.
void QsciLexer::setColor(const QColor &c, int style)
{
if (style >= 0)
{
styleData(style).color = c;
emit colorChanged(c, style);
}
else
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setColor(c, i);
}
// Set the end-of-line fill for a style.
void QsciLexer::setEolFill(bool eolfill, int style)
{
if (style >= 0)
{
styleData(style).eol_fill = eolfill;
emit eolFillChanged(eolfill, style);
}
else
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setEolFill(eolfill, i);
}
// Set the font for a style.
void QsciLexer::setFont(const QFont &f, int style)
{
if (style >= 0)
{
styleData(style).font = f;
emit fontChanged(f, style);
}
else
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setFont(f, i);
}
// Set the background colour for a style.
void QsciLexer::setPaper(const QColor &c, int style)
{
if (style >= 0)
{
styleData(style).paper = c;
emit paperChanged(c, style);
}
else
{
for (int i = 0; i <= QsciScintillaBase::STYLE_MAX; ++i)
if (!description(i).isEmpty())
setPaper(c, i);
emit paperChanged(c, QsciScintillaBase::STYLE_DEFAULT);
}
}
// Encode a QString as bytes.
QByteArray QsciLexer::textAsBytes(const QString &text) const
{
Q_ASSERT(attached_editor);
return attached_editor->textAsBytes(text);
}
// Decode bytes as a QString.
QString QsciLexer::bytesAsText(const char *bytes, int size) const
{
Q_ASSERT(attached_editor);
return attached_editor->bytesAsText(bytes, size);
}

View File

@@ -0,0 +1,575 @@
// This module implements the abstract QsciLexerAsm class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerasm.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor. Note that we choose not to support explicit fold points.
QsciLexerAsm::QsciLexerAsm(QObject *parent)
: QsciLexer(parent),
fold_comments(true), fold_compact(true), comment_delimiter('~'),
fold_syntax_based(true)
{
}
// The dtor.
QsciLexerAsm::~QsciLexerAsm()
{
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerAsm::defaultColor(int style) const
{
switch (style)
{
case Comment:
case BlockComment:
return QColor(0x00, 0x7f, 0x00);
case Number:
return QColor(0x00, 0x7f, 0x7f);
case DoubleQuotedString:
case SingleQuotedString:
return QColor(0x7f, 0x00, 0x7f);
case Operator:
case UnclosedString:
return QColor(0x00, 0x00, 0x00);
case CPUInstruction:
return QColor(0x00, 0x00, 0x7f);
case FPUInstruction:
case Directive:
case DirectiveOperand:
return QColor(0x00, 0x00, 0xff);
case Register:
return QColor(0x46, 0xaa, 0x03);
case ExtendedInstruction:
return QColor(0xb0, 0x00, 0x40);
case CommentDirective:
return QColor(0x66, 0xaa, 0x00);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerAsm::defaultEolFill(int style) const
{
if (style == UnclosedString)
return true;
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerAsm::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Operator:
case CPUInstruction:
case Register:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
case Comment:
case BlockComment:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the background colour of the text for a style.
QColor QsciLexerAsm::defaultPaper(int style) const
{
if (style == UnclosedString)
return QColor(0xe0, 0xc0, 0xe0);
return QsciLexer::defaultPaper(style);
}
// Returns the set of keywords.
const char *QsciLexerAsm::keywords(int set) const
{
if (set == 1)
return
"aaa aad aam aas daa das "
"ja jae jb jbe jc jcxz je jg jge jl jle jmp jna jnae jnb jnbe jnc "
"jne jng jnge jnl jnle jno jnp jns jnz jo jp jpe jpo js jz jcxz "
"jecxz jrcxz loop loope loopne loopz loopnz call ret "
"add sub adc sbb neg cmp inc dec and or xor not test shl shr sal "
"sar shld shrd rol ror rcl rcr cbw cwd cwde cdq cdqe cqo bsf bsr "
"bt btc btr bts idiv imul div mul bswap nop "
"lea mov movsx movsxd movzx xlatb bound xchg xadd cmpxchg "
"cmpxchg8b cmpxchg16b "
"push pop pushad popad pushf popf pushfd popfd pushfq popfq "
"seta setae setb setbe setc sete setg setge setl setle setna "
"setnae setnb setnbe setnc setne setng setnge setnl setnle setno "
"setnp setns setnz seto setp setpe setpo sets setz salc "
"clc cld stc std cmc lahf sahf "
"cmovo cmovno cmovb cmovc cmovnae cmovae cmovnb cmovnc cmove "
"cmovz cmovne cmovnz cmovbe cmovna cmova cmovnbe cmovs cmovns "
"cmovp cmovpe cmovnp cmovpo cmovl cmovnge cmovge cmovnl cmovle "
"cmovng cmovg cmovnle "
"lock rep repe repz repne repnz "
"cmpsb cmpsw cmpsq movsb movsw movsq scasb scasw scasd scasq "
"stosb stosw stosd stosq "
"cpuid rdtsc rdtscp rdpmc xgetbv "
"llwpcb slwpcb lwpval lwpins "
"crc32 popcnt lzcnt tzcnt movbe pclmulqdq rdrand "
"andn bextr blsi blsmk blsr "
"bzhi mulx pdep pext rorx sarx shlx shrx";
if (set == 2)
return
"f2xm1 fabs fadd faddp fbld fbstp fchs fclex fcom fcomp fcompp "
"fdecstp fdisi fdiv fdivp fdivr fdivrp feni ffree fiadd ficom "
"ficomp fidiv fidivr fild fimul fincstp finit fist fistp fisub "
"fisubr fld fld1 fldcw fldenv fldenvw fldl2e fldl2t fldlg2 fldln2 "
"fldpi fldz fmul fmulp fnclex fndisi fneni fninit fnop fnsave "
"fnsavew fnstcw fnstenv fnstenvw fnstsw fpatan fprem fptan "
"frndint frstor frstorw fsave fsavew fscale fsqrt fst fstcw "
"fstenv fstenvw fstp fstsw fsub fsubp fsubr fsubrp ftst fwait "
"fxam fxch fxtract fyl2x fyl2xp1 fsetpm fcos fldenvd fnsaved "
"fnstenvd fprem1 frstord fsaved fsin fsincos fstenvd fucom fucomp "
"fucompp fcomi fcomip fucomi fucomip ffreep fcmovb fcmove fcmovbe "
"fcmovu fcmovnb fcmovne fcmovnbe fcmovnu";
if (set == 3)
return
"al ah bl bh cl ch dl dh ax bx cx dx si di bp eax ebx ecx edx esi "
"edi ebx esp st0 st1 st2 st3 st4 st5 st6 st7 mm0 mm1 mm2 mm3 mm4 "
"mm5 mm6 mm7 xmm0 xmm1 xmm2 xmm3 xmm4 xmm5 xmm6 xmm7 ymm0 ymm1 "
"ymm2 ymm3 ymm4 ymm5 ymm6 ymm7 fs "
"sil dil bpl r8b r9b r10b r11b r12b r13b r14b r15b r8w r9w r10w "
"r11w r12w r13w r14w r15w rax rcx rdx rbx rsp rbp rsi rdi r8 r9 "
"r10 r11 r12 r13 r14 r15 xmm8 xmm9 xmm10 xmm11 xmm12 xmm13 xmm14 "
"xmm15 ymm8 ymm9 ymm10 ymm11 ymm12 ymm13 ymm14 ymm15 gs";
if (set == 4)
return
"db dw dd dq dt do dy resb resw resd resq rest reso resy incbin "
"equ times safeseh __utf16__ __utf32__ %+ default cpu float start "
"imagebase osabi ..start ..imagebase ..gotpc ..gotoff ..gottpoff "
"..got ..plt ..sym ..tlsie section segment __sect__ group "
"absolute .bss .comment .data .lbss .ldata .lrodata .rdata "
".rodata .tbss .tdata .text alloc bss code exec data noalloc "
"nobits noexec nowrite progbits rdata tls write private public "
"common stack overlay class extern global common import export "
"%define %idefine %xdefine %ixdefine %assign %undef %? %?? "
"%defstr %idefstr %deftok %ideftok %strcat %strlen %substr %macro "
"%imacro %rmacro %exitmacro %endmacro %unmacro %if %ifn %elif "
"%elifn %else %endif %ifdef %ifndef %elifdef %elifndef %ifmacro "
"%ifnmacro %elifmacro %elifnmacro %ifctx %ifnctx %elifctx "
"%elifnctx %ifidn %ifnidn %elifidn %elifnidn %ifidni %ifnidni "
"%elifidni %elifnidni %ifid %ifnid %elifid %elifnid %ifnum "
"%ifnnum %elifnum %elifnnum %ifstr %ifnstr %elifstr %elifnstr "
"%iftoken %ifntoken %eliftoken %elifntoken %ifempty %elifempty "
"%ifnempty %elifnempty %ifenv %ifnenv %elifenv %elifnenv %rep "
"%exitrep %endrep %while %exitwhile %endwhile %include "
"%pathsearch %depend %use %push %pop %repl %arg %local %stacksize "
"flat flat64 large small %error %warning %fatal %00 .nolist "
"%rotate %line %! %final %clear struc endstruc istruc at iend "
"align alignb sectalign bits use16 use32 use64 __nasm_major__ "
"__nasm_minor__ __nasm_subminor__ ___nasm_patchlevel__ "
"__nasm_version_id__ __nasm_ver__ __file__ __line__ __pass__ "
"__bits__ __output_format__ __date__ __time__ __date_num__ "
"__time_num__ __posix_time__ __utc_date__ __utc_time__ "
"__utc_date_num__ __utc_time_num__ __float_daz__ __float_round__ "
"__float__ __use_altreg__ altreg __use_smartalign__ smartalign "
"__alignmode__ __use_fp__ __infinity__ __nan__ __qnan__ __snan__ "
"__float8__ __float16__ __float32__ __float64__ __float80m__ "
"__float80e__ __float128l__ __float128h__";
if (set == 5)
return
"a16 a32 a64 o16 o32 o64 strict byte word dword qword tword oword "
"yword nosplit %0 %1 %2 %3 %4 %5 %6 %7 %8 %9 abs rel $ $$ seg wrt";
if (set == 6)
return
"movd movq paddb paddw paddd paddsb paddsw paddusb paddusw psubb "
"psubw psubd psubsb psubsw psubusb psubusw pand pandn por pxor "
"pcmpeqb pcmpeqd pcmpeqw pcmpgtb pcmpgtd pcmpgtw pmaddwd pmulhw "
"pmullw psllw pslld psllq psrlw psrld psrlq psraw psrad packuswb "
"packsswb packssdw punpcklbw punpcklwd punpckldq punpckhbw "
"punpckhwd punpckhdq emms "
"pavgb pavgw pextrw pinsrw pmovmskb pmaxsw pmaxub pminsw pminub "
"pmulhuw psadbw pshufw prefetchnta prefetcht0 prefetcht1 "
"prefetcht2 maskmovq movntq sfence "
"paddsiw psubsiw pmulhrw pmachriw pmulhriw pmagw pdistib paveb "
"pmvzb pmvnzb pmvlzb pmvgezb "
"pfacc pfadd pfsub pfsubr pfmul pfcmpeq pfcmpge pfcmpgt pfmax "
"pfmin pfrcp pfrcpit1 pfrcpit2 pfrsqit1 pfrsqrt pi2fd pf2id "
"pavgusb pmulhrw femms "
"pfnacc pfpnacc pi2fw pf2iw pswapd "
"pfrsqrtv pfrcpv "
"prefetch prefetchw "
"addss addps subss subps mulss mulps divss divps sqrtss sqrtps "
"rcpss rcpps rsqrtss rsqrtps maxss maxps minss minps cmpss comiss "
"ucomiss cmpps cmpeqss cmpltss cmpless cmpunordss cmpneqss "
"cmpnltss cmpnless cmpordss cmpeqps cmpltps cmpleps cmpunordps "
"cmpneqps cmpnltps cmpnleps cmpordps andnps andps orps xorps "
"cvtsi2ss cvtss2si cvttss2si cvtpi2ps cvtps2pi cvttps2pi movss "
"movlps movhps movlhps movhlps movaps movups movntps movmskps "
"shufps unpckhps unpcklps ldmxcsr stmxcsr "
"addpd addsd subpd subsd mulsd mulpd divsd divpd sqrtsd sqrtpd "
"maxsd maxpd minsd minpd cmpsd comisd ucomisd cmppd cmpeqsd "
"cmpltsd cmplesd cmpunordsd cmpneqsd cmpnltsd cmpnlesd cmpordsd "
"cmpeqpd cmpltpd cmplepd cmpunordpd cmpneqpd cmpnltpd cmpnlepd "
"cmpordpd andnpd andpd orpd xorpd cvtsd2ss cvtpd2ps cvtss2sd "
"cvtps2pd cvtdq2ps cvtps2dq cvttps2dq cvtdq2pd cvtpd2dq cvttpd2dq "
"cvtsi2sd cvtsd2si cvttsd2si cvtpi2pd cvtpd2pi cvttpd2pi movsd "
"movlpd movhpd movapd movupd movntpd movmskpd shufpd unpckhpd "
"unpcklpd movnti movdqa movdqu movntdq maskmovdqu movdq2q movq2dq "
"paddq psubq pmuludq pslldq psrldq punpcklqdq punpckhqdq pshufhw "
"pshuflw pshufd lfence mfence "
"addsubps addsubpd haddps haddpd hsubps hsubpd movsldup movshdup "
"movddup lddqu fisttp "
"psignb psignw psignd pabsb pabsw pabsd palignr pshufb pmulhrsw "
"pmaddubsw phaddw phaddd phaddsw phsubw phsubd phsubsw "
"extrq insertq movntsd movntss "
"mpsadbw phminposuw pmuldq pmulld dpps dppd blendps blendpd "
"blendvps blendvpd pblendvb pblendw pmaxsb pmaxuw pmaxsd pmaxud "
"pminsb pminuw pminsd pminud roundps roundss roundpd roundsd "
"insertps pinsrb pinsrd pinsrq extractps pextrb pextrd pextrq "
"pmovsxbw pmovsxbd pmovsxbq pmovsxwd pmovsxwq pmovsxdq pmovzxbw "
"pmovzxbd pmovzxbq pmovzxwd pmovzxwq pmovzxdq ptest pcmpeqq "
"packusdw movntdqa "
"pcmpgtq pcmpestri pcmpestrm pcmpistri pcmpistrm "
"aesenc aesenclast aesdec aesdeclast aeskeygenassist aesimc "
"xcryptcbc xcryptcfb xcryptctr xcryptecb xcryptofb xsha1 xsha256 "
"montmul xstore "
"vaddss vaddps vaddsd vaddpd vsubss vsubps vsubsd vsubpd "
"vaddsubps vaddsubpd vhaddps vhaddpd vhsubps vhsubpd vmulss "
"vmulps vmulsd vmulpd vmaxss vmaxps vmaxsd vmaxpd vminss vminps "
"vminsd vminpd vandps vandpd vandnps vandnpd vorps vorpd vxorps "
"vxorpd vblendps vblendpd vblendvps vblendvpd vcmpss vcomiss "
"vucomiss vcmpsd vcomisd vucomisd vcmpps vcmppd vcmpeqss vcmpltss "
"vcmpless vcmpunordss vcmpneqss vcmpnltss vcmpnless vcmpordss "
"vcmpeq_uqss vcmpngess vcmpngtss vcmpfalsess vcmpneq_oqss "
"vcmpgess vcmpgtss vcmptruess vcmpeq_osss vcmplt_oqss vcmple_oqss "
"vcmpunord_sss vcmpneq_usss vcmpnlt_uqss vcmpnle_uqss vcmpord_sss "
"vcmpeq_usss vcmpnge_uqss vcmpngt_uqss vcmpfalse_osss "
"vcmpneq_osss vcmpge_oqss vcmpgt_oqss vcmptrue_usss vcmpeqps "
"vcmpltps vcmpleps vcmpunordps vcmpneqps vcmpnltps vcmpnleps "
"vcmpordps vcmpeq_uqps vcmpngeps vcmpngtps vcmpfalseps "
"vcmpneq_oqps vcmpgeps vcmpgtps vcmptrueps vcmpeq_osps "
"vcmplt_oqps vcmple_oqps vcmpunord_sps vcmpneq_usps vcmpnlt_uqps "
"vcmpnle_uqps vcmpord_sps vcmpeq_usps vcmpnge_uqps vcmpngt_uqps "
"vcmpfalse_osps vcmpneq_osps vcmpge_oqps vcmpgt_oqps "
"vcmptrue_usps vcmpeqsd vcmpltsd vcmplesd vcmpunordsd vcmpneqsd "
"vcmpnltsd vcmpnlesd vcmpordsd vcmpeq_uqsd vcmpngesd vcmpngtsd "
"vcmpfalsesd vcmpneq_oqsd vcmpgesd vcmpgtsd vcmptruesd "
"vcmpeq_ossd vcmplt_oqsd vcmple_oqsd vcmpunord_ssd vcmpneq_ussd "
"vcmpnlt_uqsd vcmpnle_uqsd vcmpord_ssd vcmpeq_ussd vcmpnge_uqsd "
"vcmpngt_uqsd vcmpfalse_ossd vcmpneq_ossd vcmpge_oqsd vcmpgt_oqsd "
"vcmptrue_ussd vcmpeqpd vcmpltpd vcmplepd vcmpunordpd vcmpneqpd "
"vcmpnltpd vcmpnlepd vcmpordpd vcmpeq_uqpd vcmpngepd vcmpngtpd "
"vcmpfalsepd vcmpneq_oqpd vcmpgepd vcmpgtpd vcmptruepd "
"vcmpeq_ospd vcmplt_oqpd vcmple_oqpd vcmpunord_spd vcmpneq_uspd "
"vcmpnlt_uqpd vcmpnle_uqpd vcmpord_spd vcmpeq_uspd vcmpnge_uqpd "
"vcmpngt_uqpd vcmpfalse_ospd vcmpneq_ospd vcmpge_oqpd vcmpgt_oqpd "
"vcmptrue_uspd vcvtsd2ss vcvtpd2ps vcvtss2sd vcvtps2pd vcvtsi2ss "
"vcvtss2si vcvttss2si vcvtpi2ps vcvtps2pi vcvttps2pi vcvtdq2ps "
"vcvtps2dq vcvttps2dq vcvtdq2pd vcvtpd2dq vcvttpd2dq vcvtsi2sd "
"vcvtsd2si vcvttsd2si vcvtpi2pd vcvtpd2pi vcvttpd2pi vdivss "
"vdivps vdivsd vdivpd vsqrtss vsqrtps vsqrtsd vsqrtpd vdpps vdppd "
"vmaskmovps vmaskmovpd vmovss vmovsd vmovaps vmovapd vmovups "
"vmovupd vmovntps vmovntpd vmovhlps vmovlhps vmovlps vmovlpd "
"vmovhps vmovhpd vmovsldup vmovshdup vmovddup vmovmskps vmovmskpd "
"vroundss vroundps vroundsd vroundpd vrcpss vrcpps vrsqrtss "
"vrsqrtps vunpcklps vunpckhps vunpcklpd vunpckhpd vbroadcastss "
"vbroadcastsd vbroadcastf128 vextractps vinsertps vextractf128 "
"vinsertf128 vshufps vshufpd vpermilps vpermilpd vperm2f128 "
"vtestps vtestpd vpaddb vpaddusb vpaddsb vpaddw vpaddusw vpaddsw "
"vpaddd vpaddq vpsubb vpsubusb vpsubsb vpsubw vpsubusw vpsubsw "
"vpsubd vpsubq vphaddw vphaddsw vphaddd vphsubw vphsubsw vphsubd "
"vpsllw vpslld vpsllq vpsrlw vpsrld vpsrlq vpsraw vpsrad vpand "
"vpandn vpor vpxor vpblendwb vpblendw vpsignb vpsignw vpsignd "
"vpavgb vpavgw vpabsb vpabsw vpabsd vmovd vmovq vmovdqa vmovdqu "
"vlddqu vmovntdq vmovntdqa vmaskmovdqu vpmovsxbw vpmovsxbd "
"vpmovsxbq vpmovsxwd vpmovsxwq vpmovsxdq vpmovzxbw vpmovzxbd "
"vpmovzxbq vpmovzxwd vpmovzxwq vpmovzxdq vpackuswb vpacksswb "
"vpackusdw vpackssdw vpcmpeqb vpcmpeqw vpcmpeqd vpcmpeqq vpcmpgtb "
"vpcmpgtw vpcmpgtd vpcmpgtq vpmaddubsw vpmaddwd vpmullw vpmulhuw "
"vpmulhw vpmulhrsw vpmulld vpmuludq vpmuldq vpmaxub vpmaxsb "
"vpmaxuw vpmaxsw vpmaxud vpmaxsd vpminub vpminsb vpminuw vpminsw "
"vpminud vpminsd vpmovmskb vptest vpunpcklbw vpunpcklwd "
"vpunpckldq vpunpcklqdq vpunpckhbw vpunpckhwd vpunpckhdq "
"vpunpckhqdq vpslldq vpsrldq vpalignr vpshufb vpshuflw vpshufhw "
"vpshufd vpextrb vpextrw vpextrd vpextrq vpinsrb vpinsrw vpinsrd "
"vpinsrq vpsadbw vmpsadbw vphminposuw vpcmpestri vpcmpestrm "
"vpcmpistri vpcmpistrm vpclmulqdq vaesenc vaesenclast vaesdec "
"vaesdeclast vaeskeygenassist vaesimc vldmxcsr vstmxcsr vzeroall "
"vzeroupper "
"vbroadcasti128 vpbroadcastb vpbroadcastw vpbroadcastd "
"vpbroadcastq vpblendd vpermd vpermq vperm2i128 vextracti128 "
"vinserti128 vpmaskmovd vpmaskmovq vpsllvd vpsllvq vpsravd "
"vpsrlvd vpsrldq vpgatherdd vpgatherqd vgatherdq vgatherqq "
"vpermps vpermpd vgatherdpd vgatherqpd vgatherdps vgatherqps "
"vfrczss vfrczps vfrczsd vfrczpd vpermil2ps vperlil2pd vtestps "
"vtestpd vpcomub vpcomb vpcomuw vpcomw vpcomud vpcomd vpcomuq "
"vpcomq vphaddubw vphaddbw vphaddubd vphaddbd vphaddubq vphaddbq "
"vphadduwd vphaddwd vphadduwq vphaddwq vphaddudq vphadddq "
"vphsubbw vphsubwd vphsubdq vpmacsdd vpmacssdd vpmacsdql "
"vpmacssdql vpmacsdqh vpmacssdqh vpmacsww vpmacssww vpmacswd "
"vpmacsswd vpmadcswd vpmadcsswd vpcmov vpperm vprotb vprotw "
"vprotd vprotq vpshab vpshaw vpshad vpshaq vpshlb vpshlw vpshld "
"vpshlq "
"vcvtph2ps vcvtps2ph "
"vfmaddss vfmaddps vfmaddsd vfmaddpd vfmsubss vfmsubps vfmsubsd "
"vfmsubpd vnfmaddss vnfmaddps vnfmaddsd vnfmaddpd vnfmsubss "
"vnfmsubps vnfmsubsd vnfmsubpd vfmaddsubps vfmaddsubpd "
"vfmsubaddps vfmsubaddpd "
"vfmadd132ss vfmadd213ss vfmadd231ss vfmadd132ps vfmadd213ps "
"vfmadd231ps vfmadd132sd vfmadd213sd vfmadd231sd vfmadd132pd "
"vfmadd213pd vfmadd231pd vfmaddsub132ps vfmaddsub213ps "
"vfmaddsub231ps vfmaddsub132pd vfmaddsub213pd vfmaddsub231pd "
"vfmsubadd132ps vfmsubadd213ps vfmsubadd231ps vfmsubadd132pd "
"vfmsubadd213pd vfmsubadd231pd vfmsub132ss vfmsub213ss "
"vfmsub231ss vfmsub132ps vfmsub213ps vfmsub231ps vfmsub132sd "
"vfmsub213sd vfmsub231sd vfmsub132pd vfmsub213pd vfmsub231pd "
"vfnmadd132ss vfnmadd213ss vfnmadd231ss vfnmadd132ps vfnmadd213ps "
"vfnmadd231ps vfnmadd132sd vfnmadd213sd vfnmadd231sd vfnmadd132pd "
"vfnmadd213pd vfnmadd231pd vfnmsub132ss vfnmsub213ss vfnmsub231ss "
"vfnmsub132ps vfnmsub213ps vfnmsub231ps vfnmsub132sd vfnmsub213sd "
"vfnmsub231sd vfnmsub132pd vfnmsub213pd vfnmsub231pd";
return 0;
}
// Returns the user name of a style.
QString QsciLexerAsm::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Comment:
return tr("Comment");
case Number:
return tr("Number");
case DoubleQuotedString:
return tr("Double-quoted string");
case Operator:
return tr("Operator");
case Identifier:
return tr("Identifier");
case CPUInstruction:
return tr("CPU instruction");
case FPUInstruction:
return tr("FPU instruction");
case Register:
return tr("Register");
case Directive:
return tr("Directive");
case DirectiveOperand:
return tr("Directive operand");
case BlockComment:
return tr("Block comment");
case SingleQuotedString:
return tr("Single-quoted string");
case UnclosedString:
return tr("Unclosed string");
case ExtendedInstruction:
return tr("Extended instruction");
case CommentDirective:
return tr("Comment directive");
}
return QString();
}
// Refresh all properties.
void QsciLexerAsm::refreshProperties()
{
setCommentProp();
setCompactProp();
setCommentDelimiterProp();
setSyntaxBasedProp();
}
// Read properties from the settings.
bool QsciLexerAsm::readProperties(QSettings &qs,const QString &prefix)
{
fold_comments = qs.value(prefix + "foldcomments", true).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
comment_delimiter = qs.value(prefix + "commentdelimiter",
QChar('~')).toChar();
fold_syntax_based = qs.value(prefix + "foldsyntaxbased", true).toBool();
return true;
}
// Write properties to the settings.
bool QsciLexerAsm::writeProperties(QSettings &qs,const QString &prefix) const
{
qs.setValue(prefix + "foldcomments", fold_comments);
qs.setValue(prefix + "foldcompact", fold_compact);
qs.setValue(prefix + "commentdelimiter", comment_delimiter);
qs.setValue(prefix + "foldsyntaxbased", fold_syntax_based);
return true;
}
// Return true if comments can be folded.
bool QsciLexerAsm::foldComments() const
{
return fold_comments;
}
// Set if comments can be folded.
void QsciLexerAsm::setFoldComments(bool fold)
{
fold_comments = fold;
setCommentProp();
}
// Set the "fold.asm.comment.multiline" property.
void QsciLexerAsm::setCommentProp()
{
emit propertyChanged("fold.asm.comment.multiline",
(fold_comments ? "1" : "0"));
}
// Return true if folds are compact.
bool QsciLexerAsm::foldCompact() const
{
return fold_compact;
}
// Set if folds are compact.
void QsciLexerAsm::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerAsm::setCompactProp()
{
emit propertyChanged("fold.compact", (fold_compact ? "1" : "0"));
}
// Return the comment delimiter.
QChar QsciLexerAsm::commentDelimiter() const
{
return comment_delimiter;
}
// Set the comment delimiter.
void QsciLexerAsm::setCommentDelimiter(QChar delimiter)
{
comment_delimiter = delimiter;
setCommentDelimiterProp();
}
// Set the "lexer.asm.comment.delimiter" property.
void QsciLexerAsm::setCommentDelimiterProp()
{
emit propertyChanged("lexer.asm.comment.delimiter",
textAsBytes(QString(comment_delimiter)).constData());
}
// Return true if folds are syntax-based.
bool QsciLexerAsm::foldSyntaxBased() const
{
return fold_syntax_based;
}
// Set if folds are syntax-based.
void QsciLexerAsm::setFoldSyntaxBased(bool syntax_based)
{
fold_syntax_based = syntax_based;
setSyntaxBasedProp();
}
// Set the "fold.asm.syntax.based" property.
void QsciLexerAsm::setSyntaxBasedProp()
{
emit propertyChanged("fold.asm.syntax.based",
(fold_syntax_based ? "1" : "0"));
}

View File

@@ -0,0 +1,414 @@
// This module implements the QsciLexerAVS class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexeravs.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerAVS::QsciLexerAVS(QObject *parent)
: QsciLexer(parent),
fold_comments(false), fold_compact(true)
{
}
// The dtor.
QsciLexerAVS::~QsciLexerAVS()
{
}
// Returns the language name.
const char *QsciLexerAVS::language() const
{
return "AVS";
}
// Returns the lexer name.
const char *QsciLexerAVS::lexer() const
{
return "avs";
}
// Return the style used for braces.
int QsciLexerAVS::braceStyle() const
{
return Operator;
}
// Return the string of characters that comprise a word.
const char *QsciLexerAVS::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerAVS::defaultColor(int style) const
{
switch (style)
{
case Default:
case Operator:
return QColor(0x00, 0x00, 0x00);
case BlockComment:
case NestedBlockComment:
case LineComment:
return QColor(0x00, 0x7f, 0x00);
case Number:
case Function:
return QColor(0x00, 0x7f, 0x7f);
case String:
case TripleString:
return QColor(0x7f, 0x00, 0x7f);
case Keyword:
case Filter:
case ClipProperty:
return QColor(0x00, 0x00, 0x7f);
case Plugin:
return QColor(0x00, 0x80, 0xc0);
case KeywordSet6:
return QColor(0x80, 0x00, 0xff);
}
return QsciLexer::defaultColor(style);
}
// Returns the font of the text for a style.
QFont QsciLexerAVS::defaultFont(int style) const
{
QFont f;
switch (style)
{
case BlockComment:
case NestedBlockComment:
case LineComment:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS", 9);
#elif defined(Q_OS_MAC)
f = QFont("Georgia", 13);
#else
f = QFont("Bitstream Vera Serif", 9);
#endif
break;
case Keyword:
case Filter:
case Plugin:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerAVS::keywords(int set) const
{
if (set == 1)
return "true false return global";
if (set == 2)
return
"addborders alignedsplice amplify amplifydb animate applyrange "
"assumebff assumefieldbased assumefps assumeframebased "
"assumesamplerate assumescaledfps assumetff audiodub audiodubex "
"avifilesource avisource bicubicresize bilinearresize "
"blackmanresize blackness blankclip blur bob cache changefps "
"colorbars colorkeymask coloryuv compare complementparity "
"conditionalfilter conditionalreader convertaudio "
"convertaudioto16bit convertaudioto24bit convertaudioto32bit "
"convertaudioto8bit convertaudiotofloat convertbacktoyuy2 "
"convertfps converttobackyuy2 converttomono converttorgb "
"converttorgb24 converttorgb32 converttoy8 converttoyv16 "
"converttoyv24 converttoyv411 converttoyuy2 converttoyv12 crop "
"cropbottom delayaudio deleteframe dissolve distributor "
"doubleweave duplicateframe ensurevbrmp3sync fadein fadein0 "
"fadein2 fadeio fadeio0 fadeio2 fadeout fadeout0 fadeout2 "
"fixbrokenchromaupsampling fixluminance fliphorizontal "
"flipvertical frameevaluate freezeframe gaussresize "
"generalconvolution getchannel getchannels getmtmode getparity "
"grayscale greyscale histogram horizontalreduceby2 imagereader "
"imagesource imagewriter info interleave internalcache "
"internalcachemt invert killaudio killvideo lanczos4resize "
"lanczosresize layer letterbox levels limiter loop mask maskhs "
"max merge mergeargb mergechannels mergechroma mergeluma mergergb "
"messageclip min mixaudio monotostereo normalize null "
"opendmlsource overlay peculiarblend pointresize pulldown "
"reduceby2 resampleaudio resetmask reverse rgbadjust scriptclip "
"segmentedavisource segmenteddirectshowsource selecteven "
"selectevery selectodd selectrangeevery separatefields setmtmode "
"sharpen showalpha showblue showfiveversions showframenumber "
"showgreen showred showsmpte showtime sincresize skewrows "
"spatialsoften spline16resize spline36resize spline64resize ssrc "
"stackhorizontal stackvertical subtitle subtract supereq "
"swapfields swapuv temporalsoften timestretch tone trim turn180 "
"turnleft turnright tweak unalignedsplice utoy utoy8 version "
"verticalreduceby2 vtoy vtoy8 wavsource weave writefile "
"writefileend writefileif writefilestart ytouv";
if (set == 3)
return
"addgrain addgrainc agc_hdragc analyzelogo animeivtc asharp "
"audiograph autocrop autoyuy2 avsrecursion awarpsharp "
"bassaudiosource bicublinresize bifrost binarize blendfields "
"blindpp blockbuster bordercontrol cfielddiff cframediff "
"chromashift cnr2 colormatrix combmask contra convolution3d "
"convolution3dyv12 dctfilter ddcc deblendlogo deblock deblock_qed "
"decimate decomb dedup deen deflate degrainmedian depan "
"depanestimate depaninterleave depanscenes depanstabilize "
"descratch despot dfttest dgbob dgsource directshowsource "
"distancefunction dss2 dup dupmc edeen edgemask ediupsizer eedi2 "
"eedi3 eedi3_rpow2 expand faerydust fastbicubicresize "
"fastbilinearresize fastediupsizer dedgemask fdecimate "
"ffaudiosource ffdshow ffindex ffmpegsource ffmpegsource2 "
"fft3dfilter fft3dgpu ffvideosource fielddeinterlace fielddiff "
"fillmargins fity2uv fity2u fity2v fitu2y fitv2y fluxsmooth "
"fluxsmoothst fluxsmootht framediff framenumber frfun3b frfun7 "
"gicocu golddust gradfun2db grapesmoother greedyhma grid "
"guavacomb hqdn3d hybridfupp hysteresymask ibob "
"improvesceneswitch inflate inpand inpaintlogo interframe "
"interlacedresize interlacedwarpedresize interleaved2planar "
"iscombed iscombedt iscombedtivtc kerneldeint leakkernelbob "
"leakkerneldeint limitedsharpen limitedsharpenfaster logic lsfmod "
"lumafilter lumayv12 manalyse maskeddeinterlace maskedmerge "
"maskedmix mblockfps mcompensate mctemporaldenoise "
"mctemporaldenoisepp mdegrain1 mdegrain2 mdegrain3 mdepan "
"medianblur mergehints mflow mflowblur mflowfps mflowinter "
"minblur mipsmooth mmask moderatesharpen monitorfilter motionmask "
"mpasource mpeg2source mrecalculate mscdetection msharpen mshow "
"msmooth msu_fieldshiftfixer msu_frc msuper mt mt_adddiff "
"mt_average mt_binarize mt_circle mt_clamp mt_convolution "
"mt_deflate mt_diamond mt_edge mt_ellipse mt_expand "
"mt_freeellipse mt_freelosange mt_freerectangle mt_hysteresis "
"mt_infix mt_inflate mt_inpand mt_invert mt_logic mt_losange "
"mt_lut mt_lutf mt_luts mt_lutspa mt_lutsx mt_lutxy mt_lutxyz "
"mt_makediff mt_mappedblur mt_merge mt_motion mt_polish "
"mt_rectangle mt_square mti mtsource multidecimate mvanalyse "
"mvblockfps mvchangecompensate mvcompensate mvdegrain1 mvdegrain2 "
"mvdegrain3 mvdenoise mvdepan mvflow mvflowblur mvflowfps "
"mvflowfps2 mvflowinter mvincrease mvmask mvrecalculate "
"mvscdetection mvshow nicac3source nicdtssource niclpcmsource "
"nicmpasource nicmpg123source nnedi nnedi2 nnedi2_rpow2 nnedi3 "
"nnedi3_rpow2 nomosmooth overlaymask peachsmoother pixiedust "
"planar2interleaved qtgmc qtinput rawavsource rawsource "
"reduceflicker reinterpolate411 removedirt removedust removegrain "
"removegrainhd removetemporalgrain repair requestlinear "
"reversefielddominance rgb3dlut rgdeinterlace rgsdeinterlace "
"rgblut rotate sangnom seesaw sharpen2 showchannels "
"showcombedtivtc smartdecimate smartdeinterlace smdegrain "
"smoothdeinterlace smoothuv soothess soxfilter spacedust sshiq "
"ssim ssiq stmedianfilter t3dlut tanisotropic tbilateral tcanny "
"tcomb tcombmask tcpserver tcpsource tdecimate tdeint tedgemask "
"telecide temporalcleaner temporalrepair temporalsmoother "
"tfieldblank tfm tisophote tivtc tmaskblank tmaskedmerge "
"tmaskedmerge3 tmm tmonitor tnlmeans tomsmocomp toon textsub "
"ttempsmooth ttempsmoothf tunsharp unblock uncomb undot unfilter "
"unsharpmask vaguedenoiser variableblur verticalcleaner "
"videoscope vinverse vobsub vqmcalc warpedresize warpsharp "
"xsharpen yadif yadifmod yuy2lut yv12convolution "
"yv12interlacedreduceby2 yv12interlacedselecttopfields yv12layer "
"yv12lut yv12lutxy yv12substract yv12torgb24 yv12toyuy2";
if (set == 4)
return
"abs apply assert bool ceil chr clip continueddenominator "
"continuednumerator cos default defined eval averagechromau "
"averagechromav averageluma chromaudifference chromavdifference "
"lumadifference exist exp findstr float floor frac hexvalue "
"import int isbool isclip isfloat isint isstring lcase leftstr "
"load_stdcall_plugin loadcplugin loadplugin loadvfapiplugin "
"loadvirtualdubplugin log midstr muldiv nop opt_allowfloataudio "
"opt_avipadscanlines opt_dwchannelmask opt_usewaveextensible "
"opt_vdubplanarhack pi pow rand revstr rightstr round scriptdir "
"scriptfile scriptname select setmemorymax "
"setplanarlegacyalignment rgbdifference rgbdifferencefromprevious "
"rgbdifferencetonext udifferencefromprevious udifferencetonext "
"setworkingdir sign sin spline sqrt string strlen time ucase "
"undefined value versionnumber versionstring uplanemax "
"uplanemedian uplanemin uplaneminmaxdifference "
"vdifferencefromprevious vdifferencetonext vplanemax vplanemedian "
"vplanemin vplaneminmaxdifference ydifferencefromprevious "
"ydifferencetonext yplanemax yplanemedian yplanemin "
"yplaneminmaxdifference";
if (set == 5)
return
"audiobits audiochannels audiolength audiolengthf audiorate "
"framecount framerate frameratedenominator frameratenumerator "
"getleftchannel getrightchannel hasaudio hasvideo height "
"isaudiofloat isaudioint isfieldbased isframebased isinterleaved "
"isplanar isrgb isrgb24 isrgb32 isyuv isyuy2 isyv12 width";
return 0;
}
// Returns the user name of a style.
QString QsciLexerAVS::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case BlockComment:
return tr("Block comment");
case NestedBlockComment:
return tr("Nested block comment");
case LineComment:
return tr("Line comment");
case Number:
return tr("Number");
case Operator:
return tr("Operator");
case Identifier:
return tr("Identifier");
case String:
return tr("Double-quoted string");
case TripleString:
return tr("Triple double-quoted string");
case Keyword:
return tr("Keyword");
case Filter:
return tr("Filter");
case Plugin:
return tr("Plugin");
case Function:
return tr("Function");
case ClipProperty:
return tr("Clip property");
case KeywordSet6:
return tr("User defined");
}
return QString();
}
// Refresh all properties.
void QsciLexerAVS::refreshProperties()
{
setCommentProp();
setCompactProp();
}
// Read properties from the settings.
bool QsciLexerAVS::readProperties(QSettings &qs,const QString &prefix)
{
int rc = true;
fold_comments = qs.value(prefix + "foldcomments", false).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
return rc;
}
// Write properties to the settings.
bool QsciLexerAVS::writeProperties(QSettings &qs,const QString &prefix) const
{
int rc = true;
qs.setValue(prefix + "foldcomments", fold_comments);
qs.setValue(prefix + "foldcompact", fold_compact);
return rc;
}
// Return true if comments can be folded.
bool QsciLexerAVS::foldComments() const
{
return fold_comments;
}
// Set if comments can be folded.
void QsciLexerAVS::setFoldComments(bool fold)
{
fold_comments = fold;
setCommentProp();
}
// Set the "fold.comment" property.
void QsciLexerAVS::setCommentProp()
{
emit propertyChanged("fold.comment",(fold_comments ? "1" : "0"));
}
// Return true if folds are compact.
bool QsciLexerAVS::foldCompact() const
{
return fold_compact;
}
// Set if folds are compact
void QsciLexerAVS::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerAVS::setCompactProp()
{
emit propertyChanged("fold.compact",(fold_compact ? "1" : "0"));
}

View File

@@ -0,0 +1,350 @@
// This module implements the QsciLexerBash class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerbash.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerBash::QsciLexerBash(QObject *parent)
: QsciLexer(parent), fold_comments(false), fold_compact(true)
{
}
// The dtor.
QsciLexerBash::~QsciLexerBash()
{
}
// Returns the language name.
const char *QsciLexerBash::language() const
{
return "Bash";
}
// Returns the lexer name.
const char *QsciLexerBash::lexer() const
{
return "bash";
}
// Return the style used for braces.
int QsciLexerBash::braceStyle() const
{
return Operator;
}
// Return the string of characters that comprise a word.
const char *QsciLexerBash::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_$@%&";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerBash::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0x80,0x80,0x80);
case Error:
case Backticks:
return QColor(0xff,0xff,0x00);
case Comment:
return QColor(0x00,0x7f,0x00);
case Number:
return QColor(0x00,0x7f,0x7f);
case Keyword:
return QColor(0x00,0x00,0x7f);
case DoubleQuotedString:
case SingleQuotedString:
case SingleQuotedHereDocument:
return QColor(0x7f,0x00,0x7f);
case Operator:
case Identifier:
case Scalar:
case ParameterExpansion:
case HereDocumentDelimiter:
return QColor(0x00,0x00,0x00);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerBash::defaultEolFill(int style) const
{
switch (style)
{
case SingleQuotedHereDocument:
return true;
}
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerBash::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Comment:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
case Keyword:
case Operator:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
case DoubleQuotedString:
case SingleQuotedString:
#if defined(Q_OS_WIN)
f = QFont("Courier New",10);
#elif defined(Q_OS_MAC)
f = QFont("Courier", 12);
#else
f = QFont("Bitstream Vera Sans Mono",9);
#endif
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerBash::keywords(int set) const
{
if (set == 1)
return
"alias ar asa awk banner basename bash bc bdiff break "
"bunzip2 bzip2 cal calendar case cat cc cd chmod "
"cksum clear cmp col comm compress continue cp cpio "
"crypt csplit ctags cut date dc dd declare deroff dev "
"df diff diff3 dircmp dirname do done du echo ed "
"egrep elif else env esac eval ex exec exit expand "
"export expr false fc fgrep fi file find fmt fold for "
"function functions getconf getopt getopts grep gres "
"hash head help history iconv id if in integer jobs "
"join kill local lc let line ln logname look ls m4 "
"mail mailx make man mkdir more mt mv newgrp nl nm "
"nohup ntps od pack paste patch pathchk pax pcat perl "
"pg pr print printf ps pwd read readonly red return "
"rev rm rmdir sed select set sh shift size sleep sort "
"spell split start stop strings strip stty sum "
"suspend sync tail tar tee test then time times touch "
"tr trap true tsort tty type typeset ulimit umask "
"unalias uname uncompress unexpand uniq unpack unset "
"until uudecode uuencode vi vim vpax wait wc whence "
"which while who wpaste wstart xargs zcat "
"chgrp chown chroot dir dircolors factor groups "
"hostid install link md5sum mkfifo mknod nice pinky "
"printenv ptx readlink seq sha1sum shred stat su tac "
"unlink users vdir whoami yes";
return 0;
}
// Returns the user name of a style.
QString QsciLexerBash::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Error:
return tr("Error");
case Comment:
return tr("Comment");
case Number:
return tr("Number");
case Keyword:
return tr("Keyword");
case DoubleQuotedString:
return tr("Double-quoted string");
case SingleQuotedString:
return tr("Single-quoted string");
case Operator:
return tr("Operator");
case Identifier:
return tr("Identifier");
case Scalar:
return tr("Scalar");
case ParameterExpansion:
return tr("Parameter expansion");
case Backticks:
return tr("Backticks");
case HereDocumentDelimiter:
return tr("Here document delimiter");
case SingleQuotedHereDocument:
return tr("Single-quoted here document");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerBash::defaultPaper(int style) const
{
switch (style)
{
case Error:
return QColor(0xff,0x00,0x00);
case Scalar:
return QColor(0xff,0xe0,0xe0);
case ParameterExpansion:
return QColor(0xff,0xff,0xe0);
case Backticks:
return QColor(0xa0,0x80,0x80);
case HereDocumentDelimiter:
case SingleQuotedHereDocument:
return QColor(0xdd,0xd0,0xdd);
}
return QsciLexer::defaultPaper(style);
}
// Refresh all properties.
void QsciLexerBash::refreshProperties()
{
setCommentProp();
setCompactProp();
}
// Read properties from the settings.
bool QsciLexerBash::readProperties(QSettings &qs, const QString &prefix)
{
int rc = true;
fold_comments = qs.value(prefix + "foldcomments", false).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
return rc;
}
// Write properties to the settings.
bool QsciLexerBash::writeProperties(QSettings &qs, const QString &prefix) const
{
int rc = true;
qs.setValue(prefix + "foldcomments", fold_comments);
qs.setValue(prefix + "foldcompact", fold_compact);
return rc;
}
// Return true if comments can be folded.
bool QsciLexerBash::foldComments() const
{
return fold_comments;
}
// Set if comments can be folded.
void QsciLexerBash::setFoldComments(bool fold)
{
fold_comments = fold;
setCommentProp();
}
// Set the "fold.comment" property.
void QsciLexerBash::setCommentProp()
{
emit propertyChanged("fold.comment", (fold_comments ? "1" : "0"));
}
// Return true if folds are compact.
bool QsciLexerBash::foldCompact() const
{
return fold_compact;
}
// Set if folds are compact
void QsciLexerBash::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerBash::setCompactProp()
{
emit propertyChanged("fold.compact", (fold_compact ? "1" : "0"));
}

View File

@@ -0,0 +1,212 @@
// This module implements the QsciLexerBatch class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerbatch.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerBatch::QsciLexerBatch(QObject *parent)
: QsciLexer(parent)
{
}
// The dtor.
QsciLexerBatch::~QsciLexerBatch()
{
}
// Returns the language name.
const char *QsciLexerBatch::language() const
{
return "Batch";
}
// Returns the lexer name.
const char *QsciLexerBatch::lexer() const
{
return "batch";
}
// Return the string of characters that comprise a word.
const char *QsciLexerBatch::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerBatch::defaultColor(int style) const
{
switch (style)
{
case Default:
case Operator:
return QColor(0x00,0x00,0x00);
case Comment:
return QColor(0x00,0x7f,0x00);
case Keyword:
case ExternalCommand:
return QColor(0x00,0x00,0x7f);
case Label:
return QColor(0x7f,0x00,0x7f);
case HideCommandChar:
return QColor(0x7f,0x7f,0x00);
case Variable:
return QColor(0x80,0x00,0x80);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerBatch::defaultEolFill(int style) const
{
switch (style)
{
case Label:
return true;
}
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerBatch::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Comment:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
case Keyword:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
case ExternalCommand:
#if defined(Q_OS_WIN)
f = QFont("Courier New",10);
#elif defined(Q_OS_MAC)
f = QFont("Courier", 12);
#else
f = QFont("Bitstream Vera Sans Mono",9);
#endif
f.setBold(true);
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerBatch::keywords(int set) const
{
if (set == 1)
return
"rem set if exist errorlevel for in do break call "
"chcp cd chdir choice cls country ctty date del "
"erase dir echo exit goto loadfix loadhigh mkdir md "
"move path pause prompt rename ren rmdir rd shift "
"time type ver verify vol com con lpt nul";
return 0;
}
// Return the case sensitivity.
bool QsciLexerBatch::caseSensitive() const
{
return false;
}
// Returns the user name of a style.
QString QsciLexerBatch::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Comment:
return tr("Comment");
case Keyword:
return tr("Keyword");
case Label:
return tr("Label");
case HideCommandChar:
return tr("Hide command character");
case ExternalCommand:
return tr("External command");
case Variable:
return tr("Variable");
case Operator:
return tr("Operator");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerBatch::defaultPaper(int style) const
{
switch (style)
{
case Label:
return QColor(0x60,0x60,0x60);
}
return QsciLexer::defaultPaper(style);
}

View File

@@ -0,0 +1,304 @@
// This module implements the QsciLexerCMake class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexercmake.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerCMake::QsciLexerCMake(QObject *parent)
: QsciLexer(parent), fold_atelse(false)
{
}
// The dtor.
QsciLexerCMake::~QsciLexerCMake()
{
}
// Returns the language name.
const char *QsciLexerCMake::language() const
{
return "CMake";
}
// Returns the lexer name.
const char *QsciLexerCMake::lexer() const
{
return "cmake";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerCMake::defaultColor(int style) const
{
switch (style)
{
case Default:
case KeywordSet3:
return QColor(0x00,0x00,0x00);
case Comment:
return QColor(0x00,0x7f,0x00);
case String:
case StringLeftQuote:
case StringRightQuote:
return QColor(0x7f,0x00,0x7f);
case Function:
case BlockWhile:
case BlockForeach:
case BlockIf:
case BlockMacro:
return QColor(0x00,0x00,0x7f);
case Variable:
return QColor(0x80,0x00,0x00);
case Label:
case StringVariable:
return QColor(0xcc,0x33,0x00);
case Number:
return QColor(0x00,0x7f,0x7f);
}
return QsciLexer::defaultColor(style);
}
// Returns the font of the text for a style.
QFont QsciLexerCMake::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Comment:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
case Function:
case BlockWhile:
case BlockForeach:
case BlockIf:
case BlockMacro:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerCMake::keywords(int set) const
{
if (set == 1)
return
"add_custom_command add_custom_target add_definitions "
"add_dependencies add_executable add_library add_subdirectory "
"add_test aux_source_directory build_command build_name "
"cmake_minimum_required configure_file create_test_sourcelist "
"else elseif enable_language enable_testing endforeach endif "
"endmacro endwhile exec_program execute_process "
"export_library_dependencies file find_file find_library "
"find_package find_path find_program fltk_wrap_ui foreach "
"get_cmake_property get_directory_property get_filename_component "
"get_source_file_property get_target_property get_test_property "
"if include include_directories include_external_msproject "
"include_regular_expression install install_files "
"install_programs install_targets link_directories link_libraries "
"list load_cache load_command macro make_directory "
"mark_as_advanced math message option output_required_files "
"project qt_wrap_cpp qt_wrap_ui remove remove_definitions "
"separate_arguments set set_directory_properties "
"set_source_files_properties set_target_properties "
"set_tests_properties site_name source_group string "
"subdir_depends subdirs target_link_libraries try_compile try_run "
"use_mangled_mesa utility_source variable_requires "
"vtk_make_instantiator vtk_wrap_java vtk_wrap_python vtk_wrap_tcl "
"while write_file";
if (set == 2)
return
"ABSOLUTE ABSTRACT ADDITIONAL_MAKE_CLEAN_FILES ALL AND APPEND "
"ARGS ASCII BEFORE CACHE CACHE_VARIABLES CLEAR COMMAND COMMANDS "
"COMMAND_NAME COMMENT COMPARE COMPILE_FLAGS COPYONLY DEFINED "
"DEFINE_SYMBOL DEPENDS DOC EQUAL ESCAPE_QUOTES EXCLUDE "
"EXCLUDE_FROM_ALL EXISTS EXPORT_MACRO EXT EXTRA_INCLUDE "
"FATAL_ERROR FILE FILES FORCE FUNCTION GENERATED GLOB "
"GLOB_RECURSE GREATER GROUP_SIZE HEADER_FILE_ONLY HEADER_LOCATION "
"IMMEDIATE INCLUDES INCLUDE_DIRECTORIES INCLUDE_INTERNALS "
"INCLUDE_REGULAR_EXPRESSION LESS LINK_DIRECTORIES LINK_FLAGS "
"LOCATION MACOSX_BUNDLE MACROS MAIN_DEPENDENCY MAKE_DIRECTORY "
"MATCH MATCHALL MATCHES MODULE NAME NAME_WE NOT NOTEQUAL "
"NO_SYSTEM_PATH OBJECT_DEPENDS OPTIONAL OR OUTPUT OUTPUT_VARIABLE "
"PATH PATHS POST_BUILD POST_INSTALL_SCRIPT PREFIX PREORDER "
"PRE_BUILD PRE_INSTALL_SCRIPT PRE_LINK PROGRAM PROGRAM_ARGS "
"PROPERTIES QUIET RANGE READ REGEX REGULAR_EXPRESSION REPLACE "
"REQUIRED RETURN_VALUE RUNTIME_DIRECTORY SEND_ERROR SHARED "
"SOURCES STATIC STATUS STREQUAL STRGREATER STRLESS SUFFIX TARGET "
"TOLOWER TOUPPER VAR VARIABLES VERSION WIN32 WRAP_EXCLUDE WRITE "
"APPLE MINGW MSYS CYGWIN BORLAND WATCOM MSVC MSVC_IDE MSVC60 "
"MSVC70 MSVC71 MSVC80 CMAKE_COMPILER_2005 OFF ON";
return 0;
}
// Returns the user name of a style.
QString QsciLexerCMake::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Comment:
return tr("Comment");
case String:
return tr("String");
case StringLeftQuote:
return tr("Left quoted string");
case StringRightQuote:
return tr("Right quoted string");
case Function:
return tr("Function");
case Variable:
return tr("Variable");
case Label:
return tr("Label");
case KeywordSet3:
return tr("User defined");
case BlockWhile:
return tr("WHILE block");
case BlockForeach:
return tr("FOREACH block");
case BlockIf:
return tr("IF block");
case BlockMacro:
return tr("MACRO block");
case StringVariable:
return tr("Variable within a string");
case Number:
return tr("Number");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerCMake::defaultPaper(int style) const
{
switch (style)
{
case String:
case StringLeftQuote:
case StringRightQuote:
case StringVariable:
return QColor(0xee,0xee,0xee);
}
return QsciLexer::defaultPaper(style);
}
// Refresh all properties.
void QsciLexerCMake::refreshProperties()
{
setAtElseProp();
}
// Read properties from the settings.
bool QsciLexerCMake::readProperties(QSettings &qs,const QString &prefix)
{
int rc = true;
fold_atelse = qs.value(prefix + "foldatelse", false).toBool();
return rc;
}
// Write properties to the settings.
bool QsciLexerCMake::writeProperties(QSettings &qs,const QString &prefix) const
{
int rc = true;
qs.setValue(prefix + "foldatelse", fold_atelse);
return rc;
}
// Return true if ELSE blocks can be folded.
bool QsciLexerCMake::foldAtElse() const
{
return fold_atelse;
}
// Set if ELSE blocks can be folded.
void QsciLexerCMake::setFoldAtElse(bool fold)
{
fold_atelse = fold;
setAtElseProp();
}
// Set the "fold.at.else" property.
void QsciLexerCMake::setAtElseProp()
{
emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0"));
}

View File

@@ -0,0 +1,454 @@
// This module implements the QsciLexerCoffeeScript class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexercoffeescript.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerCoffeeScript::QsciLexerCoffeeScript(QObject *parent)
: QsciLexer(parent),
fold_comments(false), fold_compact(true), style_preproc(false),
dollars(true)
{
}
// The dtor.
QsciLexerCoffeeScript::~QsciLexerCoffeeScript()
{
}
// Returns the language name.
const char *QsciLexerCoffeeScript::language() const
{
return "CoffeeScript";
}
// Returns the lexer name.
const char *QsciLexerCoffeeScript::lexer() const
{
return "coffeescript";
}
// Return the set of character sequences that can separate auto-completion
// words.
QStringList QsciLexerCoffeeScript::autoCompletionWordSeparators() const
{
QStringList wl;
wl << ".";
return wl;
}
// Return the list of keywords that can start a block.
const char *QsciLexerCoffeeScript::blockStartKeyword(int *style) const
{
if (style)
*style = Keyword;
return "catch class do else finally for if try until when while";
}
// Return the list of characters that can start a block.
const char *QsciLexerCoffeeScript::blockStart(int *style) const
{
if (style)
*style = Operator;
return "{";
}
// Return the list of characters that can end a block.
const char *QsciLexerCoffeeScript::blockEnd(int *style) const
{
if (style)
*style = Operator;
return "}";
}
// Return the style used for braces.
int QsciLexerCoffeeScript::braceStyle() const
{
return Operator;
}
// Return the string of characters that comprise a word.
const char *QsciLexerCoffeeScript::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerCoffeeScript::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0x80, 0x80, 0x80);
case Comment:
case CommentLine:
case CommentBlock:
case BlockRegexComment:
return QColor(0x00, 0x7f, 0x00);
case CommentDoc:
case CommentLineDoc:
return QColor(0x3f, 0x70, 0x3f);
case Number:
return QColor(0x00, 0x7f, 0x7f);
case Keyword:
return QColor(0x00, 0x00, 0x7f);
case DoubleQuotedString:
case SingleQuotedString:
return QColor(0x7f, 0x00, 0x7f);
case PreProcessor:
return QColor(0x7f, 0x7f, 0x00);
case Operator:
case UnclosedString:
return QColor(0x00, 0x00, 0x00);
case VerbatimString:
return QColor(0x00, 0x7f, 0x00);
case Regex:
case BlockRegex:
return QColor(0x3f, 0x7f, 0x3f);
case CommentDocKeyword:
return QColor(0x30, 0x60, 0xa0);
case CommentDocKeywordError:
return QColor(0x80, 0x40, 0x20);
case InstanceProperty:
return QColor(0xc0, 0x60, 0x00);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerCoffeeScript::defaultEolFill(int style) const
{
switch (style)
{
case UnclosedString:
case VerbatimString:
case Regex:
return true;
}
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerCoffeeScript::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Comment:
case CommentLine:
case CommentDoc:
case CommentLineDoc:
case CommentDocKeyword:
case CommentDocKeywordError:
case CommentBlock:
case BlockRegexComment:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
case Keyword:
case Operator:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
case DoubleQuotedString:
case SingleQuotedString:
case UnclosedString:
case VerbatimString:
case Regex:
case BlockRegex:
#if defined(Q_OS_WIN)
f = QFont("Courier New",10);
#elif defined(Q_OS_MAC)
f = QFont("Courier", 12);
#else
f = QFont("Bitstream Vera Sans Mono",9);
#endif
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerCoffeeScript::keywords(int set) const
{
if (set == 1)
return
"true false null this new delete typeof in instanceof return "
"throw break continue debugger if else switch for while do try "
"catch finally class extends super "
"undefined then unless until loop of by when and or is isnt not "
"yes no on off";
return 0;
}
// Returns the user name of a style.
QString QsciLexerCoffeeScript::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Comment:
return tr("C-style comment");
case CommentLine:
return tr("C++-style comment");
case CommentDoc:
return tr("JavaDoc C-style comment");
case Number:
return tr("Number");
case Keyword:
return tr("Keyword");
case DoubleQuotedString:
return tr("Double-quoted string");
case SingleQuotedString:
return tr("Single-quoted string");
case UUID:
return tr("IDL UUID");
case PreProcessor:
return tr("Pre-processor block");
case Operator:
return tr("Operator");
case Identifier:
return tr("Identifier");
case UnclosedString:
return tr("Unclosed string");
case VerbatimString:
return tr("C# verbatim string");
case Regex:
return tr("Regular expression");
case CommentLineDoc:
return tr("JavaDoc C++-style comment");
case KeywordSet2:
return tr("Secondary keywords and identifiers");
case CommentDocKeyword:
return tr("JavaDoc keyword");
case CommentDocKeywordError:
return tr("JavaDoc keyword error");
case GlobalClass:
return tr("Global classes");
case CommentBlock:
return tr("Block comment");
case BlockRegex:
return tr("Block regular expression");
case BlockRegexComment:
return tr("Block regular expression comment");
case InstanceProperty:
return tr("Instance property");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerCoffeeScript::defaultPaper(int style) const
{
switch (style)
{
case UnclosedString:
return QColor(0xe0,0xc0,0xe0);
case VerbatimString:
return QColor(0xe0,0xff,0xe0);
case Regex:
return QColor(0xe0,0xf0,0xe0);
}
return QsciLexer::defaultPaper(style);
}
// Refresh all properties.
void QsciLexerCoffeeScript::refreshProperties()
{
setCommentProp();
setCompactProp();
setStylePreprocProp();
setDollarsProp();
}
// Read properties from the settings.
bool QsciLexerCoffeeScript::readProperties(QSettings &qs,const QString &prefix)
{
int rc = true;
fold_comments = qs.value(prefix + "foldcomments", false).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
style_preproc = qs.value(prefix + "stylepreprocessor", false).toBool();
dollars = qs.value(prefix + "dollars", true).toBool();
return rc;
}
// Write properties to the settings.
bool QsciLexerCoffeeScript::writeProperties(QSettings &qs,const QString &prefix) const
{
int rc = true;
qs.setValue(prefix + "foldcomments", fold_comments);
qs.setValue(prefix + "foldcompact", fold_compact);
qs.setValue(prefix + "stylepreprocessor", style_preproc);
qs.setValue(prefix + "dollars", dollars);
return rc;
}
// Set if comments can be folded.
void QsciLexerCoffeeScript::setFoldComments(bool fold)
{
fold_comments = fold;
setCommentProp();
}
// Set the "fold.comment" property.
void QsciLexerCoffeeScript::setCommentProp()
{
emit propertyChanged("fold.coffeescript.comment",
(fold_comments ? "1" : "0"));
}
// Set if folds are compact
void QsciLexerCoffeeScript::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerCoffeeScript::setCompactProp()
{
emit propertyChanged("fold.compact", (fold_compact ? "1" : "0"));
}
// Set if preprocessor lines are styled.
void QsciLexerCoffeeScript::setStylePreprocessor(bool style)
{
style_preproc = style;
setStylePreprocProp();
}
// Set the "styling.within.preprocessor" property.
void QsciLexerCoffeeScript::setStylePreprocProp()
{
emit propertyChanged("styling.within.preprocessor",
(style_preproc ? "1" : "0"));
}
// Set if '$' characters are allowed.
void QsciLexerCoffeeScript::setDollarsAllowed(bool allowed)
{
dollars = allowed;
setDollarsProp();
}
// Set the "lexer.cpp.allow.dollars" property.
void QsciLexerCoffeeScript::setDollarsProp()
{
emit propertyChanged("lexer.cpp.allow.dollars", (dollars ? "1" : "0"));
}

View File

@@ -0,0 +1,801 @@
// This module implements the QsciLexerCPP class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexercpp.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerCPP::QsciLexerCPP(QObject *parent, bool caseInsensitiveKeywords)
: QsciLexer(parent),
fold_atelse(false), fold_comments(false), fold_compact(true),
fold_preproc(true), style_preproc(false), dollars(true),
highlight_triple(false), highlight_hash(false), highlight_back(false),
highlight_escape(false), vs_escape(false),
nocase(caseInsensitiveKeywords)
{
}
// The dtor.
QsciLexerCPP::~QsciLexerCPP()
{
}
// Returns the language name.
const char *QsciLexerCPP::language() const
{
return "C++";
}
// Returns the lexer name.
const char *QsciLexerCPP::lexer() const
{
return (nocase ? "cppnocase" : "cpp");
}
// Return the set of character sequences that can separate auto-completion
// words.
QStringList QsciLexerCPP::autoCompletionWordSeparators() const
{
QStringList wl;
wl << "::" << "->" << ".";
return wl;
}
// Return the list of keywords that can start a block.
const char *QsciLexerCPP::blockStartKeyword(int *style) const
{
if (style)
*style = Keyword;
return "case catch class default do else finally for if private "
"protected public struct try union while";
}
// Return the list of characters that can start a block.
const char *QsciLexerCPP::blockStart(int *style) const
{
if (style)
*style = Operator;
return "{";
}
// Return the list of characters that can end a block.
const char *QsciLexerCPP::blockEnd(int *style) const
{
if (style)
*style = Operator;
return "}";
}
// Return the style used for braces.
int QsciLexerCPP::braceStyle() const
{
return Operator;
}
// Return the string of characters that comprise a word.
const char *QsciLexerCPP::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerCPP::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0x80, 0x80, 0x80);
case Comment:
case CommentLine:
return QColor(0x00, 0x7f, 0x00);
case CommentDoc:
case CommentLineDoc:
case PreProcessorCommentLineDoc:
return QColor(0x3f, 0x70, 0x3f);
case Number:
return QColor(0x00, 0x7f, 0x7f);
case Keyword:
return QColor(0x00, 0x00, 0x7f);
case DoubleQuotedString:
case SingleQuotedString:
case RawString:
return QColor(0x7f, 0x00, 0x7f);
case PreProcessor:
return QColor(0x7f, 0x7f, 0x00);
case Operator:
case UnclosedString:
return QColor(0x00, 0x00, 0x00);
case VerbatimString:
case TripleQuotedVerbatimString:
case HashQuotedString:
return QColor(0x00, 0x7f, 0x00);
case Regex:
return QColor(0x3f, 0x7f, 0x3f);
case CommentDocKeyword:
return QColor(0x30, 0x60, 0xa0);
case CommentDocKeywordError:
return QColor(0x80, 0x40, 0x20);
case PreProcessorComment:
return QColor(0x65, 0x99, 0x00);
case InactiveDefault:
case InactiveUUID:
case InactiveCommentLineDoc:
case InactiveKeywordSet2:
case InactiveCommentDocKeyword:
case InactiveCommentDocKeywordError:
case InactivePreProcessorCommentLineDoc:
return QColor(0xc0, 0xc0, 0xc0);
case InactiveComment:
case InactiveCommentLine:
case InactiveNumber:
case InactiveVerbatimString:
case InactiveTripleQuotedVerbatimString:
case InactiveHashQuotedString:
return QColor(0x90, 0xb0, 0x90);
case InactiveCommentDoc:
return QColor(0xd0, 0xd0, 0xd0);
case InactiveKeyword:
return QColor(0x90, 0x90, 0xb0);
case InactiveDoubleQuotedString:
case InactiveSingleQuotedString:
case InactiveRawString:
return QColor(0xb0, 0x90, 0xb0);
case InactivePreProcessor:
return QColor(0xb0, 0xb0, 0x90);
case InactiveOperator:
case InactiveIdentifier:
case InactiveGlobalClass:
return QColor(0xb0, 0xb0, 0xb0);
case InactiveUnclosedString:
return QColor(0x00, 0x00, 0x00);
case InactiveRegex:
return QColor(0x7f, 0xaf, 0x7f);
case InactivePreProcessorComment:
return QColor(0xa0, 0xc0, 0x90);
case UserLiteral:
return QColor(0xc0, 0x60, 0x00);
case InactiveUserLiteral:
return QColor(0xd7, 0xa0, 0x90);
case TaskMarker:
return QColor(0xbe, 0x07, 0xff);
case InactiveTaskMarker:
return QColor(0xc3, 0xa1, 0xcf);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerCPP::defaultEolFill(int style) const
{
switch (style)
{
case UnclosedString:
case InactiveUnclosedString:
case VerbatimString:
case InactiveVerbatimString:
case Regex:
case InactiveRegex:
case TripleQuotedVerbatimString:
case InactiveTripleQuotedVerbatimString:
case HashQuotedString:
case InactiveHashQuotedString:
return true;
}
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerCPP::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Comment:
case InactiveComment:
case CommentLine:
case InactiveCommentLine:
case CommentDoc:
case InactiveCommentDoc:
case CommentLineDoc:
case InactiveCommentLineDoc:
case CommentDocKeyword:
case InactiveCommentDocKeyword:
case CommentDocKeywordError:
case InactiveCommentDocKeywordError:
case TaskMarker:
case InactiveTaskMarker:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
case Keyword:
case InactiveKeyword:
case Operator:
case InactiveOperator:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
case DoubleQuotedString:
case InactiveDoubleQuotedString:
case SingleQuotedString:
case InactiveSingleQuotedString:
case UnclosedString:
case InactiveUnclosedString:
case VerbatimString:
case InactiveVerbatimString:
case Regex:
case InactiveRegex:
case TripleQuotedVerbatimString:
case InactiveTripleQuotedVerbatimString:
case HashQuotedString:
case InactiveHashQuotedString:
#if defined(Q_OS_WIN)
f = QFont("Courier New",10);
#elif defined(Q_OS_MAC)
f = QFont("Courier", 12);
#else
f = QFont("Bitstream Vera Sans Mono",9);
#endif
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerCPP::keywords(int set) const
{
if (set == 1)
return
"and and_eq asm auto bitand bitor bool break case "
"catch char class compl const const_cast continue "
"default delete do double dynamic_cast else enum "
"explicit export extern false float for friend goto if "
"inline int long mutable namespace new not not_eq "
"operator or or_eq private protected public register "
"reinterpret_cast return short signed sizeof static "
"static_cast struct switch template this throw true "
"try typedef typeid typename union unsigned using "
"virtual void volatile wchar_t while xor xor_eq";
if (set == 3)
return
"a addindex addtogroup anchor arg attention author b "
"brief bug c class code date def defgroup deprecated "
"dontinclude e em endcode endhtmlonly endif "
"endlatexonly endlink endverbatim enum example "
"exception f$ f[ f] file fn hideinitializer "
"htmlinclude htmlonly if image include ingroup "
"internal invariant interface latexonly li line link "
"mainpage name namespace nosubgrouping note overload "
"p page par param post pre ref relates remarks return "
"retval sa section see showinitializer since skip "
"skipline struct subsection test throw todo typedef "
"union until var verbatim verbinclude version warning "
"weakgroup $ @ \\ & < > # { }";
return 0;
}
// Returns the user name of a style.
QString QsciLexerCPP::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case InactiveDefault:
return tr("Inactive default");
case Comment:
return tr("C comment");
case InactiveComment:
return tr("Inactive C comment");
case CommentLine:
return tr("C++ comment");
case InactiveCommentLine:
return tr("Inactive C++ comment");
case CommentDoc:
return tr("JavaDoc style C comment");
case InactiveCommentDoc:
return tr("Inactive JavaDoc style C comment");
case Number:
return tr("Number");
case InactiveNumber:
return tr("Inactive number");
case Keyword:
return tr("Keyword");
case InactiveKeyword:
return tr("Inactive keyword");
case DoubleQuotedString:
return tr("Double-quoted string");
case InactiveDoubleQuotedString:
return tr("Inactive double-quoted string");
case SingleQuotedString:
return tr("Single-quoted string");
case InactiveSingleQuotedString:
return tr("Inactive single-quoted string");
case UUID:
return tr("IDL UUID");
case InactiveUUID:
return tr("Inactive IDL UUID");
case PreProcessor:
return tr("Pre-processor block");
case InactivePreProcessor:
return tr("Inactive pre-processor block");
case Operator:
return tr("Operator");
case InactiveOperator:
return tr("Inactive operator");
case Identifier:
return tr("Identifier");
case InactiveIdentifier:
return tr("Inactive identifier");
case UnclosedString:
return tr("Unclosed string");
case InactiveUnclosedString:
return tr("Inactive unclosed string");
case VerbatimString:
return tr("C# verbatim string");
case InactiveVerbatimString:
return tr("Inactive C# verbatim string");
case Regex:
return tr("JavaScript regular expression");
case InactiveRegex:
return tr("Inactive JavaScript regular expression");
case CommentLineDoc:
return tr("JavaDoc style C++ comment");
case InactiveCommentLineDoc:
return tr("Inactive JavaDoc style C++ comment");
case KeywordSet2:
return tr("Secondary keywords and identifiers");
case InactiveKeywordSet2:
return tr("Inactive secondary keywords and identifiers");
case CommentDocKeyword:
return tr("JavaDoc keyword");
case InactiveCommentDocKeyword:
return tr("Inactive JavaDoc keyword");
case CommentDocKeywordError:
return tr("JavaDoc keyword error");
case InactiveCommentDocKeywordError:
return tr("Inactive JavaDoc keyword error");
case GlobalClass:
return tr("Global classes and typedefs");
case InactiveGlobalClass:
return tr("Inactive global classes and typedefs");
case RawString:
return tr("C++ raw string");
case InactiveRawString:
return tr("Inactive C++ raw string");
case TripleQuotedVerbatimString:
return tr("Vala triple-quoted verbatim string");
case InactiveTripleQuotedVerbatimString:
return tr("Inactive Vala triple-quoted verbatim string");
case HashQuotedString:
return tr("Pike hash-quoted string");
case InactiveHashQuotedString:
return tr("Inactive Pike hash-quoted string");
case PreProcessorComment:
return tr("Pre-processor C comment");
case InactivePreProcessorComment:
return tr("Inactive pre-processor C comment");
case PreProcessorCommentLineDoc:
return tr("JavaDoc style pre-processor comment");
case InactivePreProcessorCommentLineDoc:
return tr("Inactive JavaDoc style pre-processor comment");
case UserLiteral:
return tr("User-defined literal");
case InactiveUserLiteral:
return tr("Inactive user-defined literal");
case TaskMarker:
return tr("Task marker");
case InactiveTaskMarker:
return tr("Inactive task marker");
case EscapeSequence:
return tr("Escape sequence");
case InactiveEscapeSequence:
return tr("Inactive escape sequence");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerCPP::defaultPaper(int style) const
{
switch (style)
{
case UnclosedString:
case InactiveUnclosedString:
return QColor(0xe0,0xc0,0xe0);
case VerbatimString:
case InactiveVerbatimString:
case TripleQuotedVerbatimString:
case InactiveTripleQuotedVerbatimString:
return QColor(0xe0,0xff,0xe0);
case Regex:
case InactiveRegex:
return QColor(0xe0,0xf0,0xe0);
case RawString:
case InactiveRawString:
return QColor(0xff,0xf3,0xff);
case HashQuotedString:
case InactiveHashQuotedString:
return QColor(0xe7,0xff,0xd7);
}
return QsciLexer::defaultPaper(style);
}
// Refresh all properties.
void QsciLexerCPP::refreshProperties()
{
setAtElseProp();
setCommentProp();
setCompactProp();
setPreprocProp();
setStylePreprocProp();
setDollarsProp();
setHighlightTripleProp();
setHighlightHashProp();
setHighlightBackProp();
setHighlightEscapeProp();
setVerbatimStringEscapeProp();
}
// Read properties from the settings.
bool QsciLexerCPP::readProperties(QSettings &qs,const QString &prefix)
{
fold_atelse = qs.value(prefix + "foldatelse", false).toBool();
fold_comments = qs.value(prefix + "foldcomments", false).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
fold_preproc = qs.value(prefix + "foldpreprocessor", true).toBool();
style_preproc = qs.value(prefix + "stylepreprocessor", false).toBool();
dollars = qs.value(prefix + "dollars", true).toBool();
highlight_triple = qs.value(prefix + "highlighttriple", false).toBool();
highlight_hash = qs.value(prefix + "highlighthash", false).toBool();
highlight_back = qs.value(prefix + "highlightback", false).toBool();
highlight_escape = qs.value(prefix + "highlightescape", false).toBool();
vs_escape = qs.value(prefix + "verbatimstringescape", false).toBool();
return true;
}
// Write properties to the settings.
bool QsciLexerCPP::writeProperties(QSettings &qs,const QString &prefix) const
{
qs.setValue(prefix + "foldatelse", fold_atelse);
qs.setValue(prefix + "foldcomments", fold_comments);
qs.setValue(prefix + "foldcompact", fold_compact);
qs.setValue(prefix + "foldpreprocessor", fold_preproc);
qs.setValue(prefix + "stylepreprocessor", style_preproc);
qs.setValue(prefix + "dollars", dollars);
qs.setValue(prefix + "highlighttriple", highlight_triple);
qs.setValue(prefix + "highlighthash", highlight_hash);
qs.setValue(prefix + "highlightback", highlight_back);
qs.setValue(prefix + "highlightescape", highlight_escape);
qs.setValue(prefix + "verbatimstringescape", vs_escape);
return true;
}
// Set if else can be folded.
void QsciLexerCPP::setFoldAtElse(bool fold)
{
fold_atelse = fold;
setAtElseProp();
}
// Set the "fold.at.else" property.
void QsciLexerCPP::setAtElseProp()
{
emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0"));
}
// Set if comments can be folded.
void QsciLexerCPP::setFoldComments(bool fold)
{
fold_comments = fold;
setCommentProp();
}
// Set the "fold.comment" property.
void QsciLexerCPP::setCommentProp()
{
emit propertyChanged("fold.comment",(fold_comments ? "1" : "0"));
}
// Set if folds are compact
void QsciLexerCPP::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerCPP::setCompactProp()
{
emit propertyChanged("fold.compact",(fold_compact ? "1" : "0"));
}
// Set if preprocessor blocks can be folded.
void QsciLexerCPP::setFoldPreprocessor(bool fold)
{
fold_preproc = fold;
setPreprocProp();
}
// Set the "fold.preprocessor" property.
void QsciLexerCPP::setPreprocProp()
{
emit propertyChanged("fold.preprocessor",(fold_preproc ? "1" : "0"));
}
// Set if preprocessor lines are styled.
void QsciLexerCPP::setStylePreprocessor(bool style)
{
style_preproc = style;
setStylePreprocProp();
}
// Set the "styling.within.preprocessor" property.
void QsciLexerCPP::setStylePreprocProp()
{
emit propertyChanged("styling.within.preprocessor",(style_preproc ? "1" : "0"));
}
// Set if '$' characters are allowed.
void QsciLexerCPP::setDollarsAllowed(bool allowed)
{
dollars = allowed;
setDollarsProp();
}
// Set the "lexer.cpp.allow.dollars" property.
void QsciLexerCPP::setDollarsProp()
{
emit propertyChanged("lexer.cpp.allow.dollars",(dollars ? "1" : "0"));
}
// Set if triple quoted strings are highlighted.
void QsciLexerCPP::setHighlightTripleQuotedStrings(bool enabled)
{
highlight_triple = enabled;
setHighlightTripleProp();
}
// Set the "lexer.cpp.triplequoted.strings" property.
void QsciLexerCPP::setHighlightTripleProp()
{
emit propertyChanged("lexer.cpp.triplequoted.strings",
(highlight_triple ? "1" : "0"));
}
// Set if hash quoted strings are highlighted.
void QsciLexerCPP::setHighlightHashQuotedStrings(bool enabled)
{
highlight_hash = enabled;
setHighlightHashProp();
}
// Set the "lexer.cpp.hashquoted.strings" property.
void QsciLexerCPP::setHighlightHashProp()
{
emit propertyChanged("lexer.cpp.hashquoted.strings",
(highlight_hash ? "1" : "0"));
}
// Set if back-quoted strings are highlighted.
void QsciLexerCPP::setHighlightBackQuotedStrings(bool enabled)
{
highlight_back = enabled;
setHighlightBackProp();
}
// Set the "lexer.cpp.backquoted.strings" property.
void QsciLexerCPP::setHighlightBackProp()
{
emit propertyChanged("lexer.cpp.backquoted.strings",
(highlight_back ? "1" : "0"));
}
// Set if escape sequences in strings are highlighted.
void QsciLexerCPP::setHighlightEscapeSequences(bool enabled)
{
highlight_escape = enabled;
setHighlightEscapeProp();
}
// Set the "lexer.cpp.escape.sequence" property.
void QsciLexerCPP::setHighlightEscapeProp()
{
emit propertyChanged("lexer.cpp.escape.sequence",
(highlight_escape ? "1" : "0"));
}
// Set if escape sequences in verbatim strings are allowed.
void QsciLexerCPP::setVerbatimStringEscapeSequencesAllowed(bool allowed)
{
vs_escape = allowed;
setVerbatimStringEscapeProp();
}
// Set the "lexer.cpp.verbatim.strings.allow.escapes" property.
void QsciLexerCPP::setVerbatimStringEscapeProp()
{
emit propertyChanged("lexer.cpp.verbatim.strings.allow.escapes",
(vs_escape ? "1" : "0"));
}

View File

@@ -0,0 +1,118 @@
// This module implements the QsciLexerCSharp class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexercsharp.h"
#include <qcolor.h>
#include <qfont.h>
// The ctor.
QsciLexerCSharp::QsciLexerCSharp(QObject *parent)
: QsciLexerCPP(parent)
{
}
// The dtor.
QsciLexerCSharp::~QsciLexerCSharp()
{
}
// Returns the language name.
const char *QsciLexerCSharp::language() const
{
return "C#";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerCSharp::defaultColor(int style) const
{
if (style == VerbatimString)
return QColor(0x00,0x7f,0x00);
return QsciLexerCPP::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerCSharp::defaultEolFill(int style) const
{
if (style == VerbatimString)
return true;
return QsciLexerCPP::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerCSharp::defaultFont(int style) const
{
if (style == VerbatimString)
#if defined(Q_OS_WIN)
return QFont("Courier New",10);
#elif defined(Q_OS_MAC)
return QFont("Courier", 12);
#else
return QFont("Bitstream Vera Sans Mono",9);
#endif
return QsciLexerCPP::defaultFont(style);
}
// Returns the set of keywords.
const char *QsciLexerCSharp::keywords(int set) const
{
if (set != 1)
return 0;
return "abstract as base bool break byte case catch char checked "
"class const continue decimal default delegate do double else "
"enum event explicit extern false finally fixed float for "
"foreach goto if implicit in int interface internal is lock "
"long namespace new null object operator out override params "
"private protected public readonly ref return sbyte sealed "
"short sizeof stackalloc static string struct switch this "
"throw true try typeof uint ulong unchecked unsafe ushort "
"using virtual void while";
}
// Returns the user name of a style.
QString QsciLexerCSharp::description(int style) const
{
if (style == VerbatimString)
return tr("Verbatim string");
return QsciLexerCPP::description(style);
}
// Returns the background colour of the text for a style.
QColor QsciLexerCSharp::defaultPaper(int style) const
{
if (style == VerbatimString)
return QColor(0xe0,0xff,0xe0);
return QsciLexer::defaultPaper(style);
}

View File

@@ -0,0 +1,440 @@
// This module implements the QsciLexerCSS class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexercss.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerCSS::QsciLexerCSS(QObject *parent)
: QsciLexer(parent),
fold_comments(false), fold_compact(true), hss_language(false),
less_language(false), scss_language(false)
{
}
// The dtor.
QsciLexerCSS::~QsciLexerCSS()
{
}
// Returns the language name.
const char *QsciLexerCSS::language() const
{
return "CSS";
}
// Returns the lexer name.
const char *QsciLexerCSS::lexer() const
{
return "css";
}
// Return the list of characters that can start a block.
const char *QsciLexerCSS::blockStart(int *style) const
{
if (style)
*style = Operator;
return "{";
}
// Return the list of characters that can end a block.
const char *QsciLexerCSS::blockEnd(int *style) const
{
if (style)
*style = Operator;
return "}";
}
// Return the string of characters that comprise a word.
const char *QsciLexerCSS::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerCSS::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0xff,0x00,0x80);
case Tag:
return QColor(0x00,0x00,0x7f);
case PseudoClass:
case Attribute:
return QColor(0x80,0x00,0x00);
case UnknownPseudoClass:
case UnknownProperty:
return QColor(0xff,0x00,0x00);
case Operator:
return QColor(0x00,0x00,0x00);
case CSS1Property:
return QColor(0x00,0x40,0xe0);
case Value:
case DoubleQuotedString:
case SingleQuotedString:
return QColor(0x7f,0x00,0x7f);
case Comment:
return QColor(0x00,0x7f,0x00);
case IDSelector:
return QColor(0x00,0x7f,0x7f);
case Important:
return QColor(0xff,0x80,0x00);
case AtRule:
case MediaRule:
return QColor(0x7f,0x7f,0x00);
case CSS2Property:
return QColor(0x00,0xa0,0xe0);
}
return QsciLexer::defaultColor(style);
}
// Returns the font of the text for a style.
QFont QsciLexerCSS::defaultFont(int style) const
{
QFont f;
if (style == Comment)
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
else
{
f = QsciLexer::defaultFont(style);
switch (style)
{
case Tag:
case Important:
case MediaRule:
f.setBold(true);
break;
case IDSelector:
f.setItalic(true);
break;
}
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerCSS::keywords(int set) const
{
if (set == 1)
return
"color background-color background-image "
"background-repeat background-attachment "
"background-position background font-family "
"font-style font-variant font-weight font-size font "
"word-spacing letter-spacing text-decoration "
"vertical-align text-transform text-align "
"text-indent line-height margin-top margin-right "
"margin-bottom margin-left margin padding-top "
"padding-right padding-bottom padding-left padding "
"border-top-width border-right-width "
"border-bottom-width border-left-width border-width "
"border-top border-right border-bottom border-left "
"border border-color border-style width height float "
"clear display white-space list-style-type "
"list-style-image list-style-position list-style";
if (set == 2)
return
"first-letter first-line link active visited "
"first-child focus hover lang before after left "
"right first";
if (set == 3)
return
"border-top-color border-right-color "
"border-bottom-color border-left-color border-color "
"border-top-style border-right-style "
"border-bottom-style border-left-style border-style "
"top right bottom left position z-index direction "
"unicode-bidi min-width max-width min-height "
"max-height overflow clip visibility content quotes "
"counter-reset counter-increment marker-offset size "
"marks page-break-before page-break-after "
"page-break-inside page orphans widows font-stretch "
"font-size-adjust unicode-range units-per-em src "
"panose-1 stemv stemh slope cap-height x-height "
"ascent descent widths bbox definition-src baseline "
"centerline mathline topline text-shadow "
"caption-side table-layout border-collapse "
"border-spacing empty-cells speak-header cursor "
"outline outline-width outline-style outline-color "
"volume speak pause-before pause-after pause "
"cue-before cue-after cue play-during azimuth "
"elevation speech-rate voice-family pitch "
"pitch-range stress richness speak-punctuation "
"speak-numeral";
return 0;
}
// Returns the user name of a style.
QString QsciLexerCSS::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Tag:
return tr("Tag");
case ClassSelector:
return tr("Class selector");
case PseudoClass:
return tr("Pseudo-class");
case UnknownPseudoClass:
return tr("Unknown pseudo-class");
case Operator:
return tr("Operator");
case CSS1Property:
return tr("CSS1 property");
case UnknownProperty:
return tr("Unknown property");
case Value:
return tr("Value");
case Comment:
return tr("Comment");
case IDSelector:
return tr("ID selector");
case Important:
return tr("Important");
case AtRule:
return tr("@-rule");
case DoubleQuotedString:
return tr("Double-quoted string");
case SingleQuotedString:
return tr("Single-quoted string");
case CSS2Property:
return tr("CSS2 property");
case Attribute:
return tr("Attribute");
case CSS3Property:
return tr("CSS3 property");
case PseudoElement:
return tr("Pseudo-element");
case ExtendedCSSProperty:
return tr("Extended CSS property");
case ExtendedPseudoClass:
return tr("Extended pseudo-class");
case ExtendedPseudoElement:
return tr("Extended pseudo-element");
case MediaRule:
return tr("Media rule");
case Variable:
return tr("Variable");
}
return QString();
}
// Refresh all properties.
void QsciLexerCSS::refreshProperties()
{
setCommentProp();
setCompactProp();
setHSSProp();
setLessProp();
setSCSSProp();
}
// Read properties from the settings.
bool QsciLexerCSS::readProperties(QSettings &qs,const QString &prefix)
{
int rc = true;
fold_comments = qs.value(prefix + "foldcomments", false).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
hss_language = qs.value(prefix + "hsslanguage", false).toBool();
less_language = qs.value(prefix + "lesslanguage", false).toBool();
scss_language = qs.value(prefix + "scsslanguage", false).toBool();
return rc;
}
// Write properties to the settings.
bool QsciLexerCSS::writeProperties(QSettings &qs,const QString &prefix) const
{
int rc = true;
qs.setValue(prefix + "foldcomments", fold_comments);
qs.setValue(prefix + "foldcompact", fold_compact);
qs.setValue(prefix + "hsslanguage", hss_language);
qs.setValue(prefix + "lesslanguage", less_language);
qs.setValue(prefix + "scsslanguage", scss_language);
return rc;
}
// Return true if comments can be folded.
bool QsciLexerCSS::foldComments() const
{
return fold_comments;
}
// Set if comments can be folded.
void QsciLexerCSS::setFoldComments(bool fold)
{
fold_comments = fold;
setCommentProp();
}
// Set the "fold.comment" property.
void QsciLexerCSS::setCommentProp()
{
emit propertyChanged("fold.comment",(fold_comments ? "1" : "0"));
}
// Return true if folds are compact.
bool QsciLexerCSS::foldCompact() const
{
return fold_compact;
}
// Set if folds are compact
void QsciLexerCSS::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerCSS::setCompactProp()
{
emit propertyChanged("fold.compact",(fold_compact ? "1" : "0"));
}
// Set if HSS is supported.
void QsciLexerCSS::setHSSLanguage(bool enabled)
{
hss_language = enabled;
setHSSProp();
}
// Set the "lexer.css.hss.language" property.
void QsciLexerCSS::setHSSProp()
{
emit propertyChanged("lexer.css.hss.language",(hss_language ? "1" : "0"));
}
// Set if Less CSS is supported.
void QsciLexerCSS::setLessLanguage(bool enabled)
{
less_language = enabled;
setLessProp();
}
// Set the "lexer.css.less.language" property.
void QsciLexerCSS::setLessProp()
{
emit propertyChanged("lexer.css.less.language",(less_language ? "1" : "0"));
}
// Set if Sassy CSS is supported.
void QsciLexerCSS::setSCSSLanguage(bool enabled)
{
scss_language = enabled;
setSCSSProp();
}
// Set the "lexer.css.scss.language" property.
void QsciLexerCSS::setSCSSProp()
{
emit propertyChanged("lexer.css.scss.language",(scss_language ? "1" : "0"));
}

View File

@@ -0,0 +1,101 @@
// This module implements the QsciLexerCustom class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexercustom.h"
#include "Qsci/qsciscintilla.h"
#include "Qsci/qsciscintillabase.h"
#include "Qsci/qscistyle.h"
// The ctor.
QsciLexerCustom::QsciLexerCustom(QObject *parent)
: QsciLexer(parent)
{
}
// The dtor.
QsciLexerCustom::~QsciLexerCustom()
{
}
// Start styling.
void QsciLexerCustom::startStyling(int start, int)
{
if (!editor())
return;
editor()->SendScintilla(QsciScintillaBase::SCI_STARTSTYLING, start);
}
// Set the style for a number of characters.
void QsciLexerCustom::setStyling(int length, int style)
{
if (!editor())
return;
editor()->SendScintilla(QsciScintillaBase::SCI_SETSTYLING, length, style);
}
// Set the style for a number of characters.
void QsciLexerCustom::setStyling(int length, const QsciStyle &style)
{
setStyling(length, style.style());
}
// Set the attached editor.
void QsciLexerCustom::setEditor(QsciScintilla *new_editor)
{
if (editor())
disconnect(editor(), SIGNAL(SCN_STYLENEEDED(int)), this,
SLOT(handleStyleNeeded(int)));
QsciLexer::setEditor(new_editor);
if (editor())
connect(editor(), SIGNAL(SCN_STYLENEEDED(int)), this,
SLOT(handleStyleNeeded(int)));
}
// Return the number of style bits needed by the lexer.
int QsciLexerCustom::styleBitsNeeded() const
{
return 5;
}
// Handle a request to style some text.
void QsciLexerCustom::handleStyleNeeded(int pos)
{
int start = editor()->SendScintilla(QsciScintillaBase::SCI_GETENDSTYLED);
int line = editor()->SendScintilla(QsciScintillaBase::SCI_LINEFROMPOSITION,
start);
start = editor()->SendScintilla(QsciScintillaBase::SCI_POSITIONFROMLINE,
line);
if (start != pos)
styleText(start, pos);
}

View File

@@ -0,0 +1,450 @@
// This module implements the QsciLexerD class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerd.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerD::QsciLexerD(QObject *parent)
: QsciLexer(parent),
fold_atelse(false), fold_comments(false), fold_compact(true)
{
}
// The dtor.
QsciLexerD::~QsciLexerD()
{
}
// Returns the language name.
const char *QsciLexerD::language() const
{
return "D";
}
// Returns the lexer name.
const char *QsciLexerD::lexer() const
{
return "d";
}
// Return the set of character sequences that can separate auto-completion
// words.
QStringList QsciLexerD::autoCompletionWordSeparators() const
{
QStringList wl;
wl << ".";
return wl;
}
// Return the list of keywords that can start a block.
const char *QsciLexerD::blockStartKeyword(int *style) const
{
if (style)
*style = Keyword;
return "case catch class default do else finally for foreach "
"foreach_reverse if private protected public struct try union "
"while";
}
// Return the list of characters that can start a block.
const char *QsciLexerD::blockStart(int *style) const
{
if (style)
*style = Operator;
return "{";
}
// Return the list of characters that can end a block.
const char *QsciLexerD::blockEnd(int *style) const
{
if (style)
*style = Operator;
return "}";
}
// Return the style used for braces.
int QsciLexerD::braceStyle() const
{
return Operator;
}
// Return the string of characters that comprise a word.
const char *QsciLexerD::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_#";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerD::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0x80,0x80,0x80);
case Comment:
case CommentLine:
return QColor(0x00,0x7f,0x00);
case CommentDoc:
case CommentLineDoc:
return QColor(0x3f,0x70,0x3f);
case CommentNested:
return QColor(0xa0,0xc0,0xa0);
case Number:
return QColor(0x00,0x7f,0x7f);
case Keyword:
case KeywordSecondary:
case KeywordDoc:
case Typedefs:
return QColor(0x00,0x00,0x7f);
case String:
return QColor(0x7f,0x00,0x7f);
case Character:
return QColor(0x7f,0x00,0x7f);
case Operator:
case UnclosedString:
return QColor(0x00,0x00,0x00);
case Identifier:
break;
case CommentDocKeyword:
return QColor(0x30,0x60,0xa0);
case CommentDocKeywordError:
return QColor(0x80,0x40,0x20);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerD::defaultEolFill(int style) const
{
if (style == UnclosedString)
return true;
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerD::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Comment:
case CommentLine:
case CommentDoc:
case CommentNested:
case CommentLineDoc:
case CommentDocKeyword:
case CommentDocKeywordError:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
case Keyword:
case KeywordSecondary:
case KeywordDoc:
case Typedefs:
case Operator:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
case String:
case UnclosedString:
#if defined(Q_OS_WIN)
f = QFont("Courier New",10);
#elif defined(Q_OS_MAC)
f = QFont("Courier", 12);
#else
f = QFont("Bitstream Vera Sans Mono",9);
#endif
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerD::keywords(int set) const
{
if (set == 1)
return
"abstract alias align asm assert auto body bool break byte case "
"cast catch cdouble cent cfloat char class const continue creal "
"dchar debug default delegate delete deprecated do double else "
"enum export extern false final finally float for foreach "
"foreach_reverse function goto idouble if ifloat import in inout "
"int interface invariant ireal is lazy long mixin module new null "
"out override package pragma private protected public real return "
"scope short static struct super switch synchronized template "
"this throw true try typedef typeid typeof ubyte ucent uint ulong "
"union unittest ushort version void volatile wchar while with";
if (set == 3)
return
"a addindex addtogroup anchor arg attention author b brief bug c "
"class code date def defgroup deprecated dontinclude e em endcode "
"endhtmlonly endif endlatexonly endlink endverbatim enum example "
"exception f$ f[ f] file fn hideinitializer htmlinclude htmlonly "
"if image include ingroup internal invariant interface latexonly "
"li line link mainpage name namespace nosubgrouping note overload "
"p page par param post pre ref relates remarks return retval sa "
"section see showinitializer since skip skipline struct "
"subsection test throw todo typedef union until var verbatim "
"verbinclude version warning weakgroup $ @ \\ & < > # { }";
return 0;
}
// Returns the user name of a style.
QString QsciLexerD::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Comment:
return tr("Block comment");
case CommentLine:
return tr("Line comment");
case CommentDoc:
return tr("DDoc style block comment");
case CommentNested:
return tr("Nesting comment");
case Number:
return tr("Number");
case Keyword:
return tr("Keyword");
case KeywordSecondary:
return tr("Secondary keyword");
case KeywordDoc:
return tr("Documentation keyword");
case Typedefs:
return tr("Type definition");
case String:
return tr("String");
case UnclosedString:
return tr("Unclosed string");
case Character:
return tr("Character");
case Operator:
return tr("Operator");
case Identifier:
return tr("Identifier");
case CommentLineDoc:
return tr("DDoc style line comment");
case CommentDocKeyword:
return tr("DDoc keyword");
case CommentDocKeywordError:
return tr("DDoc keyword error");
case BackquoteString:
return tr("Backquoted string");
case RawString:
return tr("Raw string");
case KeywordSet5:
return tr("User defined 1");
case KeywordSet6:
return tr("User defined 2");
case KeywordSet7:
return tr("User defined 3");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerD::defaultPaper(int style) const
{
if (style == UnclosedString)
return QColor(0xe0,0xc0,0xe0);
return QsciLexer::defaultPaper(style);
}
// Refresh all properties.
void QsciLexerD::refreshProperties()
{
setAtElseProp();
setCommentProp();
setCompactProp();
}
// Read properties from the settings.
bool QsciLexerD::readProperties(QSettings &qs,const QString &prefix)
{
int rc = true;
fold_atelse = qs.value(prefix + "foldatelse", false).toBool();
fold_comments = qs.value(prefix + "foldcomments", false).toBool();
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
return rc;
}
// Write properties to the settings.
bool QsciLexerD::writeProperties(QSettings &qs,const QString &prefix) const
{
int rc = true;
qs.setValue(prefix + "foldatelse", fold_atelse);
qs.setValue(prefix + "foldcomments", fold_comments);
qs.setValue(prefix + "foldcompact", fold_compact);
return rc;
}
// Return true if else can be folded.
bool QsciLexerD::foldAtElse() const
{
return fold_atelse;
}
// Set if else can be folded.
void QsciLexerD::setFoldAtElse(bool fold)
{
fold_atelse = fold;
setAtElseProp();
}
// Set the "fold.at.else" property.
void QsciLexerD::setAtElseProp()
{
emit propertyChanged("fold.at.else",(fold_atelse ? "1" : "0"));
}
// Return true if comments can be folded.
bool QsciLexerD::foldComments() const
{
return fold_comments;
}
// Set if comments can be folded.
void QsciLexerD::setFoldComments(bool fold)
{
fold_comments = fold;
setCommentProp();
}
// Set the "fold.comment" property.
void QsciLexerD::setCommentProp()
{
emit propertyChanged("fold.comment",(fold_comments ? "1" : "0"));
}
// Return true if folds are compact.
bool QsciLexerD::foldCompact() const
{
return fold_compact;
}
// Set if folds are compact
void QsciLexerD::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerD::setCompactProp()
{
emit propertyChanged("fold.compact",(fold_compact ? "1" : "0"));
}

View File

@@ -0,0 +1,143 @@
// This module implements the QsciLexerDiff class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerdiff.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerDiff::QsciLexerDiff(QObject *parent)
: QsciLexer(parent)
{
}
// The dtor.
QsciLexerDiff::~QsciLexerDiff()
{
}
// Returns the language name.
const char *QsciLexerDiff::language() const
{
return "Diff";
}
// Returns the lexer name.
const char *QsciLexerDiff::lexer() const
{
return "diff";
}
// Return the string of characters that comprise a word.
const char *QsciLexerDiff::wordCharacters() const
{
return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerDiff::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0x00,0x00,0x00);
case Comment:
return QColor(0x00,0x7f,0x00);
case Command:
return QColor(0x7f,0x7f,0x00);
case Header:
return QColor(0x7f,0x00,0x00);
case Position:
return QColor(0x7f,0x00,0x7f);
case LineRemoved:
case AddingPatchRemoved:
case RemovingPatchRemoved:
return QColor(0x00,0x7f,0x7f);
case LineAdded:
case AddingPatchAdded:
case RemovingPatchAdded:
return QColor(0x00,0x00,0x7f);
case LineChanged:
return QColor(0x7f,0x7f,0x7f);
}
return QsciLexer::defaultColor(style);
}
// Returns the user name of a style.
QString QsciLexerDiff::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Comment:
return tr("Comment");
case Command:
return tr("Command");
case Header:
return tr("Header");
case Position:
return tr("Position");
case LineRemoved:
return tr("Removed line");
case LineAdded:
return tr("Added line");
case LineChanged:
return tr("Changed line");
case AddingPatchAdded:
return tr("Added adding patch");
case RemovingPatchAdded:
return tr("Removed adding patch");
case AddingPatchRemoved:
return tr("Added removing patch");
case RemovingPatchRemoved:
return tr("Removed removing patch");
}
return QString();
}

View File

@@ -0,0 +1,122 @@
// This module implements the QsciLexerEDIFACT class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexeredifact.h"
// The ctor.
QsciLexerEDIFACT::QsciLexerEDIFACT(QObject *parent)
: QsciLexer(parent)
{
}
// The dtor.
QsciLexerEDIFACT::~QsciLexerEDIFACT()
{
}
// Returns the language name.
const char *QsciLexerEDIFACT::language() const
{
return "EDIFACT";
}
// Returns the lexer name.
const char *QsciLexerEDIFACT::lexer() const
{
return "edifact";
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerEDIFACT::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0x80, 0x80, 0x80);
case SegmentStart:
return QColor(0x00, 0x00, 0xcb);
case SegmentEnd:
return QColor(0xff, 0x8d, 0xb1);
case ElementSeparator:
return QColor(0xff, 0x8d, 0xb1);
case CompositeSeparator:
return QColor(0x80, 0x80, 0x00);
case ReleaseSeparator:
return QColor(0x5e, 0x5e, 0x5e);
case UNASegmentHeader:
return QColor(0x00, 0x80, 0x00);
case UNHSegmentHeader:
return QColor(0x2f, 0x8b, 0xbd);
case BadSegment:
return QColor(0x80, 0x00, 0x00);
}
return QsciLexer::defaultColor(style);
}
// Returns the user name of a style.
QString QsciLexerEDIFACT::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case SegmentStart:
return tr("Segment start");
case SegmentEnd:
return tr("Segment end");
case ElementSeparator:
return tr("Element separator");
case CompositeSeparator:
return tr("Composite separator");
case ReleaseSeparator:
return tr("Release separator");
case UNASegmentHeader:
return tr("UNA segment header");
case UNHSegmentHeader:
return tr("UNH segment header");
case BadSegment:
return tr("Badly formed segment");
}
return QString();
}

View File

@@ -0,0 +1,109 @@
// This module implements the QsciLexerFortran class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerfortran.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerFortran::QsciLexerFortran(QObject *parent)
: QsciLexerFortran77(parent)
{
}
// The dtor.
QsciLexerFortran::~QsciLexerFortran()
{
}
// Returns the language name.
const char *QsciLexerFortran::language() const
{
return "Fortran";
}
// Returns the lexer name.
const char *QsciLexerFortran::lexer() const
{
return "fortran";
}
// Returns the set of keywords.
const char *QsciLexerFortran::keywords(int set) const
{
if (set == 2)
return
"abs achar acos acosd adjustl adjustr aimag aimax0 aimin0 aint "
"ajmax0 ajmin0 akmax0 akmin0 all allocated alog alog10 amax0 "
"amax1 amin0 amin1 amod anint any asin asind associated atan "
"atan2 atan2d atand bitest bitl bitlr bitrl bjtest bit_size "
"bktest break btest cabs ccos cdabs cdcos cdexp cdlog cdsin "
"cdsqrt ceiling cexp char clog cmplx conjg cos cosd cosh count "
"cpu_time cshift csin csqrt dabs dacos dacosd dasin dasind datan "
"datan2 datan2d datand date date_and_time dble dcmplx dconjg dcos "
"dcosd dcosh dcotan ddim dexp dfloat dflotk dfloti dflotj digits "
"dim dimag dint dlog dlog10 dmax1 dmin1 dmod dnint dot_product "
"dprod dreal dsign dsin dsind dsinh dsqrt dtan dtand dtanh "
"eoshift epsilon errsns exp exponent float floati floatj floatk "
"floor fraction free huge iabs iachar iand ibclr ibits ibset "
"ichar idate idim idint idnint ieor ifix iiabs iiand iibclr "
"iibits iibset iidim iidint iidnnt iieor iifix iint iior iiqint "
"iiqnnt iishft iishftc iisign ilen imax0 imax1 imin0 imin1 imod "
"index inint inot int int1 int2 int4 int8 iqint iqnint ior ishft "
"ishftc isign isnan izext jiand jibclr jibits jibset jidim jidint "
"jidnnt jieor jifix jint jior jiqint jiqnnt jishft jishftc jisign "
"jmax0 jmax1 jmin0 jmin1 jmod jnint jnot jzext kiabs kiand kibclr "
"kibits kibset kidim kidint kidnnt kieor kifix kind kint kior "
"kishft kishftc kisign kmax0 kmax1 kmin0 kmin1 kmod knint knot "
"kzext lbound leadz len len_trim lenlge lge lgt lle llt log log10 "
"logical lshift malloc matmul max max0 max1 maxexponent maxloc "
"maxval merge min min0 min1 minexponent minloc minval mod modulo "
"mvbits nearest nint not nworkers number_of_processors pack "
"popcnt poppar precision present product radix random "
"random_number random_seed range real repeat reshape rrspacing "
"rshift scale scan secnds selected_int_kind selected_real_kind "
"set_exponent shape sign sin sind sinh size sizeof sngl snglq "
"spacing spread sqrt sum system_clock tan tand tanh tiny transfer "
"transpose trim ubound unpack verify";
if (set == 3)
return
"cdabs cdcos cdexp cdlog cdsin cdsqrt cotan cotand dcmplx dconjg "
"dcotan dcotand decode dimag dll_export dll_import doublecomplex "
"dreal dvchk encode find flen flush getarg getcharqq getcl getdat "
"getenv gettim hfix ibchng identifier imag int1 int2 int4 intc "
"intrup invalop iostat_msg isha ishc ishl jfix lacfar locking "
"locnear map nargs nbreak ndperr ndpexc offset ovefl peekcharqq "
"precfill prompt qabs qacos qacosd qasin qasind qatan qatand "
"qatan2 qcmplx qconjg qcos qcosd qcosh qdim qexp qext qextd "
"qfloat qimag qlog qlog10 qmax1 qmin1 qmod qreal qsign qsin qsind "
"qsinh qsqrt qtan qtand qtanh ran rand randu rewrite segment "
"setdat settim system timer undfl unlock union val virtual "
"volatile zabs zcos zexp zlog zsin zsqrt";
return QsciLexerFortran77::keywords(set);
}

View File

@@ -0,0 +1,296 @@
// This module implements the QsciLexerFortran77 class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerfortran77.h"
#include <qcolor.h>
#include <qfont.h>
#include <qsettings.h>
// The ctor.
QsciLexerFortran77::QsciLexerFortran77(QObject *parent)
: QsciLexer(parent), fold_compact(true)
{
}
// The dtor.
QsciLexerFortran77::~QsciLexerFortran77()
{
}
// Returns the language name.
const char *QsciLexerFortran77::language() const
{
return "Fortran77";
}
// Returns the lexer name.
const char *QsciLexerFortran77::lexer() const
{
return "f77";
}
// Return the style used for braces.
int QsciLexerFortran77::braceStyle() const
{
return Default;
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerFortran77::defaultColor(int style) const
{
switch (style)
{
case Default:
return QColor(0x80,0x80,0x80);
case Comment:
return QColor(0x00,0x7f,0x00);
case Number:
return QColor(0x00,0x7f,0x7f);
case SingleQuotedString:
case DoubleQuotedString:
return QColor(0x7f,0x00,0x7f);
case UnclosedString:
case Operator:
case DottedOperator:
case Continuation:
return QColor(0x00,0x00,0x00);
case Identifier:
break;
case Keyword:
return QColor(0x00,0x00,0x7f);
case IntrinsicFunction:
return QColor(0xb0,0x00,0x40);
case ExtendedFunction:
return QColor(0xb0,0x40,0x80);
case PreProcessor:
return QColor(0x7f,0x7f,0x00);
case Label:
return QColor(0xe0,0xc0,0xe0);
}
return QsciLexer::defaultColor(style);
}
// Returns the end-of-line fill for a style.
bool QsciLexerFortran77::defaultEolFill(int style) const
{
if (style == UnclosedString)
return true;
return QsciLexer::defaultEolFill(style);
}
// Returns the font of the text for a style.
QFont QsciLexerFortran77::defaultFont(int style) const
{
QFont f;
switch (style)
{
case Comment:
#if defined(Q_OS_WIN)
f = QFont("Comic Sans MS",9);
#elif defined(Q_OS_MAC)
f = QFont("Comic Sans MS", 12);
#else
f = QFont("Bitstream Vera Serif",9);
#endif
break;
case Operator:
case DottedOperator:
f = QsciLexer::defaultFont(style);
f.setBold(true);
break;
default:
f = QsciLexer::defaultFont(style);
}
return f;
}
// Returns the set of keywords.
const char *QsciLexerFortran77::keywords(int set) const
{
if (set == 1)
return
"access action advance allocatable allocate apostrophe assign "
"assignment associate asynchronous backspace bind blank blockdata "
"call case character class close common complex contains continue "
"cycle data deallocate decimal delim default dimension direct do "
"dowhile double doubleprecision else elseif elsewhere encoding "
"end endassociate endblockdata enddo endfile endforall "
"endfunction endif endinterface endmodule endprogram endselect "
"endsubroutine endtype endwhere entry eor equivalence err errmsg "
"exist exit external file flush fmt forall form format formatted "
"function go goto id if implicit in include inout integer inquire "
"intent interface intrinsic iomsg iolength iostat kind len "
"logical module name named namelist nextrec nml none nullify "
"number only open opened operator optional out pad parameter pass "
"pause pending pointer pos position precision print private "
"program protected public quote read readwrite real rec recl "
"recursive result return rewind save select selectcase selecttype "
"sequential sign size stat status stop stream subroutine target "
"then to type unformatted unit use value volatile wait where "
"while write";
return 0;
}
// Returns the user name of a style.
QString QsciLexerFortran77::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case Comment:
return tr("Comment");
case Number:
return tr("Number");
case SingleQuotedString:
return tr("Single-quoted string");
case DoubleQuotedString:
return tr("Double-quoted string");
case UnclosedString:
return tr("Unclosed string");
case Operator:
return tr("Operator");
case Identifier:
return tr("Identifier");
case Keyword:
return tr("Keyword");
case IntrinsicFunction:
return tr("Intrinsic function");
case ExtendedFunction:
return tr("Extended function");
case PreProcessor:
return tr("Pre-processor block");
case DottedOperator:
return tr("Dotted operator");
case Label:
return tr("Label");
case Continuation:
return tr("Continuation");
}
return QString();
}
// Returns the background colour of the text for a style.
QColor QsciLexerFortran77::defaultPaper(int style) const
{
if (style == UnclosedString)
return QColor(0xe0,0xc0,0xe0);
if (style == Continuation)
return QColor(0xf0,0xe0,0x80);
return QsciLexer::defaultPaper(style);
}
// Refresh all properties.
void QsciLexerFortran77::refreshProperties()
{
setCompactProp();
}
// Read properties from the settings.
bool QsciLexerFortran77::readProperties(QSettings &qs, const QString &prefix)
{
int rc = true;
fold_compact = qs.value(prefix + "foldcompact", true).toBool();
return rc;
}
// Write properties to the settings.
bool QsciLexerFortran77::writeProperties(QSettings &qs,const QString &prefix) const
{
int rc = true;
qs.setValue(prefix + "foldcompact", fold_compact);
return rc;
}
// Return true if folds are compact.
bool QsciLexerFortran77::foldCompact() const
{
return fold_compact;
}
// Set if folds are compact
void QsciLexerFortran77::setFoldCompact(bool fold)
{
fold_compact = fold;
setCompactProp();
}
// Set the "fold.compact" property.
void QsciLexerFortran77::setCompactProp()
{
emit propertyChanged("fold.compact",(fold_compact ? "1" : "0"));
}

View File

@@ -0,0 +1,156 @@
// This module implements the abstract QsciLexerHex class.
//
// Copyright (c) 2023 Riverbank Computing Limited <info@riverbankcomputing.com>
//
// This file is part of QScintilla.
//
// This file may be used under the terms of the GNU General Public License
// version 3.0 as published by the Free Software Foundation and appearing in
// the file LICENSE included in the packaging of this file. Please review the
// following information to ensure the GNU General Public License version 3.0
// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
//
// If you do not wish to use this file under the terms of the GPL version 3.0
// then you may purchase a commercial license. For more information contact
// info@riverbankcomputing.com.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "Qsci/qscilexerhex.h"
#include <qcolor.h>
#include <qfont.h>
// The ctor.
QsciLexerHex::QsciLexerHex(QObject *parent)
: QsciLexer(parent)
{
}
// The dtor.
QsciLexerHex::~QsciLexerHex()
{
}
// Returns the foreground colour of the text for a style.
QColor QsciLexerHex::defaultColor(int style) const
{
switch (style)
{
case RecordStart:
case RecordType:
case UnknownRecordType:
return QColor(0x7f, 0x00, 0x00);
case ByteCount:
return QColor(0x7f, 0x7f, 0x00);
case IncorrectByteCount:
case IncorrectChecksum:
return QColor(0xff, 0xff, 0x00);
case NoAddress:
case RecordCount:
return QColor(0x7f, 0x00, 0xff);
case DataAddress:
case StartAddress:
case ExtendedAddress:
return QColor(0x00, 0x7f, 0xff);
case Checksum:
return QColor(0x00, 0xbf, 0x00);
}
return QsciLexer::defaultColor(style);
}
// Returns the font of the text for a style.
QFont QsciLexerHex::defaultFont(int style) const
{
QFont f = QsciLexer::defaultFont(style);
if (style == UnknownRecordType || style == UnknownData || style == TrailingGarbage)
f.setItalic(true);
else if (style == OddData)
f.setBold(true);
return f;
}
// Returns the background colour of the text for a style.
QColor QsciLexerHex::defaultPaper(int style) const
{
if (style == IncorrectByteCount || style == IncorrectChecksum)
return QColor(0xff, 0x00, 0x00);
return QsciLexer::defaultPaper(style);
}
// Returns the user name of a style.
QString QsciLexerHex::description(int style) const
{
switch (style)
{
case Default:
return tr("Default");
case RecordStart:
return tr("Record start");
case RecordType:
return tr("Record type");
case UnknownRecordType:
return tr("Unknown record type");
case ByteCount:
return tr("Byte count");
case IncorrectByteCount:
return tr("Incorrect byte count");
case NoAddress:
return tr("No address");
case DataAddress:
return tr("Data address");
case RecordCount:
return tr("Record count");
case StartAddress:
return tr("Start address");
case ExtendedAddress:
return tr("Extended address");
case OddData:
return tr("Odd data");
case EvenData:
return tr("Even data");
case UnknownData:
return tr("Unknown data");
case Checksum:
return tr("Checksum");
case IncorrectChecksum:
return tr("Incorrect checksum");
case TrailingGarbage:
return tr("Trailing garbage after a record");
}
return QString();
}

Some files were not shown because too many files have changed in this diff Show More