refactor: clean up QSynedit
This commit is contained in:
parent
4807bdb43a
commit
d946b9373e
|
@ -30,7 +30,7 @@ HighlighterManager::HighlighterManager()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::PSynHighlighter HighlighterManager::getHighlighter(const QString &filename)
|
QSynedit::PHighlighter HighlighterManager::getHighlighter(const QString &filename)
|
||||||
{
|
{
|
||||||
QFileInfo info(filename);
|
QFileInfo info(filename);
|
||||||
QString suffix = info.suffix();
|
QString suffix = info.suffix();
|
||||||
|
@ -43,13 +43,13 @@ QSynedit::PSynHighlighter HighlighterManager::getHighlighter(const QString &file
|
||||||
} else if (suffix == "vs" || suffix == "fs" || suffix == "frag") {
|
} else if (suffix == "vs" || suffix == "fs" || suffix == "frag") {
|
||||||
return getGLSLHighlighter();
|
return getGLSLHighlighter();
|
||||||
}
|
}
|
||||||
return QSynedit::PSynHighlighter();
|
return QSynedit::PHighlighter();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::PSynHighlighter HighlighterManager::copyHighlighter(QSynedit::PSynHighlighter highlighter)
|
QSynedit::PHighlighter HighlighterManager::copyHighlighter(QSynedit::PHighlighter highlighter)
|
||||||
{
|
{
|
||||||
if (!highlighter)
|
if (!highlighter)
|
||||||
return QSynedit::PSynHighlighter();
|
return QSynedit::PHighlighter();
|
||||||
if (highlighter->getName() == SYN_HIGHLIGHTER_CPP)
|
if (highlighter->getName() == SYN_HIGHLIGHTER_CPP)
|
||||||
return getCppHighlighter();
|
return getCppHighlighter();
|
||||||
else if (highlighter->getName() == SYN_HIGHLIGHTER_ASM)
|
else if (highlighter->getName() == SYN_HIGHLIGHTER_ASM)
|
||||||
|
@ -57,16 +57,16 @@ QSynedit::PSynHighlighter HighlighterManager::copyHighlighter(QSynedit::PSynHigh
|
||||||
else if (highlighter->getName() == SYN_HIGHLIGHTER_GLSL)
|
else if (highlighter->getName() == SYN_HIGHLIGHTER_GLSL)
|
||||||
return getGLSLHighlighter();
|
return getGLSLHighlighter();
|
||||||
//todo
|
//todo
|
||||||
return QSynedit::PSynHighlighter();
|
return QSynedit::PHighlighter();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::PSynHighlighter HighlighterManager::getCppHighlighter()
|
QSynedit::PHighlighter HighlighterManager::getCppHighlighter()
|
||||||
{
|
{
|
||||||
QSynedit::SynEditCppHighlighter* highlighter = new QSynedit::SynEditCppHighlighter();
|
QSynedit::CppHighlighter* highlighter = new QSynedit::CppHighlighter();
|
||||||
highlighter->asmAttribute()->setForeground(Qt::blue);
|
highlighter->asmAttribute()->setForeground(Qt::blue);
|
||||||
highlighter->charAttribute()->setForeground(Qt::black);
|
highlighter->charAttribute()->setForeground(Qt::black);
|
||||||
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
||||||
highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic);
|
highlighter->commentAttribute()->setStyles(QSynedit::FontStyle::fsItalic);
|
||||||
highlighter->classAttribute()->setForeground(0x008080);
|
highlighter->classAttribute()->setForeground(0x008080);
|
||||||
highlighter->floatAttribute()->setForeground(Qt::darkMagenta);
|
highlighter->floatAttribute()->setForeground(Qt::darkMagenta);
|
||||||
highlighter->functionAttribute()->setForeground(0x00627A);
|
highlighter->functionAttribute()->setForeground(0x00627A);
|
||||||
|
@ -84,16 +84,16 @@ QSynedit::PSynHighlighter HighlighterManager::getCppHighlighter()
|
||||||
highlighter->stringEscapeSequenceAttribute()->setForeground(Qt::red);
|
highlighter->stringEscapeSequenceAttribute()->setForeground(Qt::red);
|
||||||
highlighter->symbolAttribute()->setForeground(0xc10000);
|
highlighter->symbolAttribute()->setForeground(0xc10000);
|
||||||
highlighter->variableAttribute()->setForeground(0x400080);
|
highlighter->variableAttribute()->setForeground(0x400080);
|
||||||
QSynedit::PSynHighlighter pHighlighter=std::make_shared<QSynedit::SynEditCppHighlighter>();
|
QSynedit::PHighlighter pHighlighter=std::make_shared<QSynedit::CppHighlighter>();
|
||||||
return pHighlighter;
|
return pHighlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::PSynHighlighter HighlighterManager::getAsmHighlighter()
|
QSynedit::PHighlighter HighlighterManager::getAsmHighlighter()
|
||||||
{
|
{
|
||||||
QSynedit::SynEditASMHighlighter* highlighter = new QSynedit::SynEditASMHighlighter();
|
QSynedit::ASMHighlighter* highlighter = new QSynedit::ASMHighlighter();
|
||||||
QSynedit::PSynHighlighter pHighlighter(highlighter);
|
QSynedit::PHighlighter pHighlighter(highlighter);
|
||||||
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
||||||
highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic);
|
highlighter->commentAttribute()->setStyles(QSynedit::FontStyle::fsItalic);
|
||||||
highlighter->identifierAttribute()->setForeground(0x080808);
|
highlighter->identifierAttribute()->setForeground(0x080808);
|
||||||
highlighter->keywordAttribute()->setForeground(0x0033b3);
|
highlighter->keywordAttribute()->setForeground(0x0033b3);
|
||||||
highlighter->numberAttribute()->setForeground(0x1750EB);
|
highlighter->numberAttribute()->setForeground(0x1750EB);
|
||||||
|
@ -103,14 +103,14 @@ QSynedit::PSynHighlighter HighlighterManager::getAsmHighlighter()
|
||||||
return pHighlighter;
|
return pHighlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::PSynHighlighter HighlighterManager::getGLSLHighlighter()
|
QSynedit::PHighlighter HighlighterManager::getGLSLHighlighter()
|
||||||
{
|
{
|
||||||
QSynedit::SynEditGLSLHighlighter* highlighter = new QSynedit::SynEditGLSLHighlighter();
|
QSynedit::GLSLHighlighter* highlighter = new QSynedit::GLSLHighlighter();
|
||||||
QSynedit::PSynHighlighter pHighlighter(highlighter);
|
QSynedit::PHighlighter pHighlighter(highlighter);
|
||||||
highlighter->asmAttribute()->setForeground(Qt::blue);
|
highlighter->asmAttribute()->setForeground(Qt::blue);
|
||||||
highlighter->charAttribute()->setForeground(Qt::black);
|
highlighter->charAttribute()->setForeground(Qt::black);
|
||||||
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
highlighter->commentAttribute()->setForeground(0x8C8C8C);
|
||||||
highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic);
|
highlighter->commentAttribute()->setStyles(QSynedit::FontStyle::fsItalic);
|
||||||
highlighter->classAttribute()->setForeground(0x008080);
|
highlighter->classAttribute()->setForeground(0x008080);
|
||||||
highlighter->floatAttribute()->setForeground(Qt::darkMagenta);
|
highlighter->floatAttribute()->setForeground(Qt::darkMagenta);
|
||||||
highlighter->functionAttribute()->setForeground(0x00627A);
|
highlighter->functionAttribute()->setForeground(0x00627A);
|
||||||
|
@ -131,7 +131,7 @@ QSynedit::PSynHighlighter HighlighterManager::getGLSLHighlighter()
|
||||||
return pHighlighter;
|
return pHighlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HighlighterManager::applyColorScheme(QSynedit::PSynHighlighter highlighter, const QString &schemeName)
|
void HighlighterManager::applyColorScheme(QSynedit::PHighlighter highlighter, const QString &schemeName)
|
||||||
{
|
{
|
||||||
if (!highlighter)
|
if (!highlighter)
|
||||||
return;
|
return;
|
||||||
|
@ -141,14 +141,14 @@ void HighlighterManager::applyColorScheme(QSynedit::PSynHighlighter highlighter,
|
||||||
for (QString name: highlighter->attributes().keys()) {
|
for (QString name: highlighter->attributes().keys()) {
|
||||||
PColorSchemeItem item = pColorManager->getItem(schemeName,name);
|
PColorSchemeItem item = pColorManager->getItem(schemeName,name);
|
||||||
if (item) {
|
if (item) {
|
||||||
QSynedit::PSynHighlighterAttribute attr = highlighter->attributes()[name];
|
QSynedit::PHighlighterAttribute attr = highlighter->attributes()[name];
|
||||||
attr->setBackground(item->background());
|
attr->setBackground(item->background());
|
||||||
attr->setForeground(item->foreground());
|
attr->setForeground(item->foreground());
|
||||||
QSynedit::SynFontStyles styles = QSynedit::SynFontStyle::fsNone;
|
QSynedit::FontStyles styles = QSynedit::FontStyle::fsNone;
|
||||||
styles.setFlag(QSynedit::SynFontStyle::fsBold, item->bold());
|
styles.setFlag(QSynedit::FontStyle::fsBold, item->bold());
|
||||||
styles.setFlag(QSynedit::SynFontStyle::fsItalic, item->italic());
|
styles.setFlag(QSynedit::FontStyle::fsItalic, item->italic());
|
||||||
styles.setFlag(QSynedit::SynFontStyle::fsUnderline, item->underlined());
|
styles.setFlag(QSynedit::FontStyle::fsUnderline, item->underlined());
|
||||||
styles.setFlag(QSynedit::SynFontStyle::fsStrikeOut, item->strikeout());
|
styles.setFlag(QSynedit::FontStyle::fsStrikeOut, item->strikeout());
|
||||||
attr->setStyles(styles);
|
attr->setStyles(styles);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,12 +23,12 @@ class HighlighterManager
|
||||||
public:
|
public:
|
||||||
HighlighterManager();
|
HighlighterManager();
|
||||||
|
|
||||||
QSynedit::PSynHighlighter getHighlighter(const QString& filename);
|
QSynedit::PHighlighter getHighlighter(const QString& filename);
|
||||||
QSynedit::PSynHighlighter copyHighlighter(QSynedit::PSynHighlighter highlighter);
|
QSynedit::PHighlighter copyHighlighter(QSynedit::PHighlighter highlighter);
|
||||||
QSynedit::PSynHighlighter getCppHighlighter();
|
QSynedit::PHighlighter getCppHighlighter();
|
||||||
QSynedit::PSynHighlighter getAsmHighlighter();
|
QSynedit::PHighlighter getAsmHighlighter();
|
||||||
QSynedit::PSynHighlighter getGLSLHighlighter();
|
QSynedit::PHighlighter getGLSLHighlighter();
|
||||||
void applyColorScheme(QSynedit::PSynHighlighter highlighter, const QString& schemeName);
|
void applyColorScheme(QSynedit::PHighlighter highlighter, const QString& schemeName);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern HighlighterManager highlighterManager;
|
extern HighlighterManager highlighterManager;
|
||||||
|
|
|
@ -226,7 +226,7 @@ PSearchResultTreeItem CppRefacter::findOccurenceInFile(
|
||||||
while (!editor.highlighter()->eol()) {
|
while (!editor.highlighter()->eol()) {
|
||||||
int start = editor.highlighter()->getTokenPos() + 1;
|
int start = editor.highlighter()->getTokenPos() + 1;
|
||||||
QString token = editor.highlighter()->getToken();
|
QString token = editor.highlighter()->getToken();
|
||||||
QSynedit::PSynHighlighterAttribute attr = editor.highlighter()->getTokenAttribute();
|
QSynedit::PHighlighterAttribute attr = editor.highlighter()->getTokenAttribute();
|
||||||
if (!attr || attr!=editor.highlighter()->commentAttribute()) {
|
if (!attr || attr!=editor.highlighter()->commentAttribute()) {
|
||||||
if (token == statement->command) {
|
if (token == statement->command) {
|
||||||
//same name symbol , test if the same statement;
|
//same name symbol , test if the same statement;
|
||||||
|
|
|
@ -103,7 +103,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber());
|
||||||
}
|
}
|
||||||
QFileInfo fileInfo(mFilename);
|
QFileInfo fileInfo(mFilename);
|
||||||
QSynedit::PSynHighlighter highlighter;
|
QSynedit::PHighlighter highlighter;
|
||||||
if (!isNew) {
|
if (!isNew) {
|
||||||
loadFile();
|
loadFile();
|
||||||
highlighter = highlighterManager.getHighlighter(mFilename);
|
highlighter = highlighterManager.getHighlighter(mFilename);
|
||||||
|
@ -148,7 +148,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
|
||||||
connect(this,&SynEdit::statusChanged,this,&Editor::onStatusChanged);
|
connect(this,&SynEdit::statusChanged,this,&Editor::onStatusChanged);
|
||||||
connect(this,&SynEdit::gutterClicked,this,&Editor::onGutterClicked);
|
connect(this,&SynEdit::gutterClicked,this,&Editor::onGutterClicked);
|
||||||
|
|
||||||
onStatusChanged(QSynedit::SynStatusChange::scOpenFile);
|
onStatusChanged(QSynedit::StatusChange::scOpenFile);
|
||||||
|
|
||||||
setAttribute(Qt::WA_Hover,true);
|
setAttribute(Qt::WA_Hover,true);
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ bool Editor::saveAs(const QString &name, bool fromProject){
|
||||||
}
|
}
|
||||||
|
|
||||||
//update (reassign highlighter)
|
//update (reassign highlighter)
|
||||||
QSynedit::PSynHighlighter newHighlighter = HighlighterManager().getHighlighter(mFilename);
|
QSynedit::PHighlighter newHighlighter = HighlighterManager().getHighlighter(mFilename);
|
||||||
if (newHighlighter) {
|
if (newHighlighter) {
|
||||||
setUseCodeFolding(true);
|
setUseCodeFolding(true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -474,10 +474,10 @@ void Editor::setPageControl(QTabWidget *newPageControl)
|
||||||
|
|
||||||
void Editor::undoSymbolCompletion(int pos)
|
void Editor::undoSymbolCompletion(int pos)
|
||||||
{
|
{
|
||||||
QSynedit::PSynHighlighterAttribute Attr;
|
QSynedit::PHighlighterAttribute Attr;
|
||||||
QString Token;
|
QString Token;
|
||||||
bool tokenFinished;
|
bool tokenFinished;
|
||||||
QSynedit::SynHighlighterTokenType tokenType;
|
QSynedit::TokenType tokenType;
|
||||||
|
|
||||||
if (!highlighter())
|
if (!highlighter())
|
||||||
return;
|
return;
|
||||||
|
@ -485,7 +485,7 @@ void Editor::undoSymbolCompletion(int pos)
|
||||||
return;
|
return;
|
||||||
if (!getHighlighterAttriAtRowCol(caretXY(), Token, tokenFinished, tokenType, Attr))
|
if (!getHighlighterAttriAtRowCol(caretXY(), Token, tokenFinished, tokenType, Attr))
|
||||||
return;
|
return;
|
||||||
if ((tokenType == QSynedit::SynHighlighterTokenType::Comment) && (!tokenFinished))
|
if ((tokenType == QSynedit::TokenType::Comment) && (!tokenFinished))
|
||||||
return ;
|
return ;
|
||||||
//convert caret x to string index;
|
//convert caret x to string index;
|
||||||
pos--;
|
pos--;
|
||||||
|
@ -494,11 +494,11 @@ void Editor::undoSymbolCompletion(int pos)
|
||||||
return;
|
return;
|
||||||
QChar DeletedChar = lineText().at(pos);
|
QChar DeletedChar = lineText().at(pos);
|
||||||
QChar NextChar = lineText().at(pos+1);
|
QChar NextChar = lineText().at(pos+1);
|
||||||
if ((tokenType == QSynedit::SynHighlighterTokenType::Character) && (DeletedChar != '\''))
|
if ((tokenType == QSynedit::TokenType::Character) && (DeletedChar != '\''))
|
||||||
return;
|
return;
|
||||||
if (tokenType == QSynedit::SynHighlighterTokenType::StringEscapeSequence)
|
if (tokenType == QSynedit::TokenType::StringEscapeSequence)
|
||||||
return;
|
return;
|
||||||
if (tokenType == QSynedit::SynHighlighterTokenType::String) {
|
if (tokenType == QSynedit::TokenType::String) {
|
||||||
if ((DeletedChar!='"') && (DeletedChar!='('))
|
if ((DeletedChar!='"') && (DeletedChar!='('))
|
||||||
return;
|
return;
|
||||||
if ((DeletedChar=='"') && (Token!="\"\""))
|
if ((DeletedChar=='"') && (Token!="\"\""))
|
||||||
|
@ -506,7 +506,7 @@ void Editor::undoSymbolCompletion(int pos)
|
||||||
if ((DeletedChar=='(') && (!Token.startsWith("R\"")))
|
if ((DeletedChar=='(') && (!Token.startsWith("R\"")))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((DeletedChar == '\'') && (tokenType == QSynedit::SynHighlighterTokenType::Number))
|
if ((DeletedChar == '\'') && (tokenType == QSynedit::TokenType::Number))
|
||||||
return;
|
return;
|
||||||
if ((DeletedChar == '<') &&
|
if ((DeletedChar == '<') &&
|
||||||
!(mParser && mParser->isIncludeLine(lineText())))
|
!(mParser && mParser->isIncludeLine(lineText())))
|
||||||
|
@ -517,7 +517,7 @@ void Editor::undoSymbolCompletion(int pos)
|
||||||
(pSettings->editor().completeBrace() && (DeletedChar == '{') && (NextChar == '}')) ||
|
(pSettings->editor().completeBrace() && (DeletedChar == '{') && (NextChar == '}')) ||
|
||||||
(pSettings->editor().completeSingleQuote() && (DeletedChar == '\'') && (NextChar == '\'')) ||
|
(pSettings->editor().completeSingleQuote() && (DeletedChar == '\'') && (NextChar == '\'')) ||
|
||||||
(pSettings->editor().completeDoubleQuote() && (DeletedChar == '\"') && (NextChar == '\"'))) {
|
(pSettings->editor().completeDoubleQuote() && (DeletedChar == '\"') && (NextChar == '\"'))) {
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecDeleteChar);
|
commandProcessor(QSynedit::EditCommand::ecDeleteChar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -716,7 +716,7 @@ void Editor::keyPressEvent(QKeyEvent *event)
|
||||||
if (t.isEmpty())
|
if (t.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (activeSelectionMode()==QSynedit::SynSelectionMode::Column)
|
if (activeSelectionMode()==QSynedit::SelectionMode::Column)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QChar ch = t[0];
|
QChar ch = t[0];
|
||||||
|
@ -865,12 +865,12 @@ void Editor::onGutterPaint(QPainter &painter, int aLine, int X, int Y)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onGetEditingAreas(int Line, QSynedit::SynEditingAreaList &areaList)
|
void Editor::onGetEditingAreas(int Line, QSynedit::EditingAreaList &areaList)
|
||||||
{
|
{
|
||||||
areaList.clear();
|
areaList.clear();
|
||||||
if (mTabStopBegin>=0 && mTabStopY == Line) {
|
if (mTabStopBegin>=0 && mTabStopY == Line) {
|
||||||
QSynedit::PSynEditingArea p = make_shared<QSynedit::SynEditingArea>();
|
QSynedit::PEditingArea p = make_shared<QSynedit::EditingArea>();
|
||||||
p->type = QSynedit::SynEditingAreaType::eatRectangleBorder;
|
p->type = QSynedit::EditingAreaType::eatRectangleBorder;
|
||||||
// int spaceCount = leftSpaces(mLineBeforeTabStop);
|
// int spaceCount = leftSpaces(mLineBeforeTabStop);
|
||||||
// int spaceBefore = mLineBeforeTabStop.length()-TrimLeft(mLineBeforeTabStop).length();
|
// int spaceBefore = mLineBeforeTabStop.length()-TrimLeft(mLineBeforeTabStop).length();
|
||||||
p->beginX = mTabStopBegin;
|
p->beginX = mTabStopBegin;
|
||||||
|
@ -881,7 +881,7 @@ void Editor::onGetEditingAreas(int Line, QSynedit::SynEditingAreaList &areaList)
|
||||||
PSyntaxIssueList lst = getSyntaxIssuesAtLine(Line);
|
PSyntaxIssueList lst = getSyntaxIssuesAtLine(Line);
|
||||||
if (lst) {
|
if (lst) {
|
||||||
for (const PSyntaxIssue& issue: *lst) {
|
for (const PSyntaxIssue& issue: *lst) {
|
||||||
QSynedit::PSynEditingArea p=std::make_shared<QSynedit::SynEditingArea>();
|
QSynedit::PEditingArea p=std::make_shared<QSynedit::EditingArea>();
|
||||||
p->beginX = issue->col;
|
p->beginX = issue->col;
|
||||||
p->endX = issue->endCol;
|
p->endX = issue->endCol;
|
||||||
if (issue->issueType == CompileIssueType::Error) {
|
if (issue->issueType == CompileIssueType::Error) {
|
||||||
|
@ -889,7 +889,7 @@ void Editor::onGetEditingAreas(int Line, QSynedit::SynEditingAreaList &areaList)
|
||||||
} else {
|
} else {
|
||||||
p->color = mSyntaxWarningColor;
|
p->color = mSyntaxWarningColor;
|
||||||
}
|
}
|
||||||
p->type = QSynedit::SynEditingAreaType::eatWaveUnderLine;
|
p->type = QSynedit::EditingAreaType::eatWaveUnderLine;
|
||||||
areaList.append(p);
|
areaList.append(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -919,7 +919,7 @@ bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgr
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PSynHighlighterAttribute attr, QSynedit::SynFontStyles &style, QColor &foreground, QColor &background)
|
void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PHighlighterAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background)
|
||||||
{
|
{
|
||||||
if (token.isEmpty())
|
if (token.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -936,7 +936,7 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
|
||||||
pos1++;
|
pos1++;
|
||||||
pos2++;
|
pos2++;
|
||||||
if (pos1>0 && pos2>0 && pos1<aChar && aChar < pos2) {
|
if (pos1>0 && pos2>0 && pos1<aChar && aChar < pos2) {
|
||||||
style.setFlag(QSynedit::SynFontStyle::fsUnderline);
|
style.setFlag(QSynedit::FontStyle::fsUnderline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -971,10 +971,10 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
|
||||||
if (item) {
|
if (item) {
|
||||||
foreground = item->foreground();
|
foreground = item->foreground();
|
||||||
//background = item->background();
|
//background = item->background();
|
||||||
style.setFlag(QSynedit::SynFontStyle::fsBold,item->bold());
|
style.setFlag(QSynedit::FontStyle::fsBold,item->bold());
|
||||||
style.setFlag(QSynedit::SynFontStyle::fsItalic,item->italic());
|
style.setFlag(QSynedit::FontStyle::fsItalic,item->italic());
|
||||||
style.setFlag(QSynedit::SynFontStyle::fsUnderline,item->underlined());
|
style.setFlag(QSynedit::FontStyle::fsUnderline,item->underlined());
|
||||||
style.setFlag(QSynedit::SynFontStyle::fsStrikeOut,item->strikeout());
|
style.setFlag(QSynedit::FontStyle::fsStrikeOut,item->strikeout());
|
||||||
} else {
|
} else {
|
||||||
foreground = highlighter()->identifierAttribute()->foreground();
|
foreground = highlighter()->identifierAttribute()->foreground();
|
||||||
}
|
}
|
||||||
|
@ -982,7 +982,7 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to
|
||||||
QSynedit::BufferCoord p;
|
QSynedit::BufferCoord p;
|
||||||
if (pointToCharLine(mapFromGlobal(QCursor::pos()),p)) {
|
if (pointToCharLine(mapFromGlobal(QCursor::pos()),p)) {
|
||||||
if (line==p.line && (aChar<=p.ch && p.ch<aChar+token.length())) {
|
if (line==p.line && (aChar<=p.ch && p.ch<aChar+token.length())) {
|
||||||
style.setFlag(QSynedit::SynFontStyle::fsUnderline);
|
style.setFlag(QSynedit::FontStyle::fsUnderline);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1379,7 +1379,7 @@ void Editor::copyAsHTML()
|
||||||
exporter.setExportAsText(false);
|
exporter.setExportAsText(false);
|
||||||
exporter.setUseBackground(pSettings->editor().copyHTMLUseBackground());
|
exporter.setUseBackground(pSettings->editor().copyHTMLUseBackground());
|
||||||
exporter.setFont(font());
|
exporter.setFont(font());
|
||||||
QSynedit::PSynHighlighter hl = highlighter();
|
QSynedit::PHighlighter hl = highlighter();
|
||||||
if (!pSettings->editor().copyHTMLUseEditorColor()) {
|
if (!pSettings->editor().copyHTMLUseEditorColor()) {
|
||||||
hl = highlighterManager.copyHighlighter(highlighter());
|
hl = highlighterManager.copyHighlighter(highlighter());
|
||||||
highlighterManager.applyColorScheme(hl,pSettings->editor().copyHTMLColorScheme());
|
highlighterManager.applyColorScheme(hl,pSettings->editor().copyHTMLColorScheme());
|
||||||
|
@ -1426,9 +1426,9 @@ void Editor::addSyntaxIssues(int line, int startChar, int endChar, CompileIssueT
|
||||||
PSyntaxIssue pError;
|
PSyntaxIssue pError;
|
||||||
QSynedit::BufferCoord p;
|
QSynedit::BufferCoord p;
|
||||||
QString token;
|
QString token;
|
||||||
QSynedit::SynHighlighterTokenType tokenType;
|
QSynedit::TokenType tokenType;
|
||||||
int tokenKind,start;
|
int tokenKind,start;
|
||||||
QSynedit::PSynHighlighterAttribute attr;
|
QSynedit::PHighlighterAttribute attr;
|
||||||
PSyntaxIssueList lst;
|
PSyntaxIssueList lst;
|
||||||
if ((line<1) || (line>document()->count()))
|
if ((line<1) || (line>document()->count()))
|
||||||
return;
|
return;
|
||||||
|
@ -1537,18 +1537,18 @@ Editor::PSyntaxIssue Editor::getSyntaxIssueAtPosition(const QSynedit::BufferCoor
|
||||||
return PSyntaxIssue();
|
return PSyntaxIssue();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onStatusChanged(QSynedit::SynStatusChanges changes)
|
void Editor::onStatusChanged(QSynedit::StatusChanges changes)
|
||||||
{
|
{
|
||||||
if ((!changes.testFlag(QSynedit::SynStatusChange::scReadOnly)
|
if ((!changes.testFlag(QSynedit::StatusChange::scReadOnly)
|
||||||
&& !changes.testFlag(QSynedit::SynStatusChange::scInsertMode)
|
&& !changes.testFlag(QSynedit::StatusChange::scInsertMode)
|
||||||
&& (document()->count()!=mLineCount)
|
&& (document()->count()!=mLineCount)
|
||||||
&& (document()->count()!=0) && ((mLineCount>0) || (document()->count()>1)))
|
&& (document()->count()!=0) && ((mLineCount>0) || (document()->count()>1)))
|
||||||
||
|
||
|
||||||
(mCurrentLineModified
|
(mCurrentLineModified
|
||||||
&& !changes.testFlag(QSynedit::SynStatusChange::scReadOnly)
|
&& !changes.testFlag(QSynedit::StatusChange::scReadOnly)
|
||||||
&& changes.testFlag(QSynedit::SynStatusChange::scCaretY))) {
|
&& changes.testFlag(QSynedit::StatusChange::scCaretY))) {
|
||||||
mCurrentLineModified = false;
|
mCurrentLineModified = false;
|
||||||
if (!changes.testFlag(QSynedit::SynStatusChange::scOpenFile))
|
if (!changes.testFlag(QSynedit::StatusChange::scOpenFile))
|
||||||
reparse();
|
reparse();
|
||||||
// if (pSettings->codeCompletion().clearWhenEditorHidden()
|
// if (pSettings->codeCompletion().clearWhenEditorHidden()
|
||||||
// && changes.testFlag(SynStatusChange::scOpenFile)) {
|
// && changes.testFlag(SynStatusChange::scOpenFile)) {
|
||||||
|
@ -1569,8 +1569,8 @@ void Editor::onStatusChanged(QSynedit::SynStatusChanges changes)
|
||||||
mCanAutoSave = true;
|
mCanAutoSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (changes.testFlag(QSynedit::SynStatusChange::scCaretX)
|
if (changes.testFlag(QSynedit::StatusChange::scCaretX)
|
||||||
|| changes.testFlag(QSynedit::SynStatusChange::scCaretY)) {
|
|| changes.testFlag(QSynedit::StatusChange::scCaretY)) {
|
||||||
if (mTabStopBegin >=0) {
|
if (mTabStopBegin >=0) {
|
||||||
if (mTabStopY==caretY()) {
|
if (mTabStopY==caretY()) {
|
||||||
if (mLineAfterTabStop.isEmpty()) {
|
if (mLineAfterTabStop.isEmpty()) {
|
||||||
|
@ -1615,7 +1615,7 @@ void Editor::onStatusChanged(QSynedit::SynStatusChanges changes)
|
||||||
coord.ch = ch+1;
|
coord.ch = ch+1;
|
||||||
coord.line = caretY();
|
coord.line = caretY();
|
||||||
}
|
}
|
||||||
QSynedit::PSynHighlighterAttribute attr;
|
QSynedit::PHighlighterAttribute attr;
|
||||||
QString token;
|
QString token;
|
||||||
if (getHighlighterAttriAtRowCol(coord,token,attr)
|
if (getHighlighterAttriAtRowCol(coord,token,attr)
|
||||||
&& attr == highlighter()->symbolAttribute()) {
|
&& attr == highlighter()->symbolAttribute()) {
|
||||||
|
@ -1633,7 +1633,7 @@ void Editor::onStatusChanged(QSynedit::SynStatusChanges changes)
|
||||||
}
|
}
|
||||||
|
|
||||||
// scSelection includes anything caret related
|
// scSelection includes anything caret related
|
||||||
if (changes.testFlag(QSynedit::SynStatusChange::scSelection)) {
|
if (changes.testFlag(QSynedit::StatusChange::scSelection)) {
|
||||||
if (!selAvail() && pSettings->editor().highlightCurrentWord()) {
|
if (!selAvail() && pSettings->editor().highlightCurrentWord()) {
|
||||||
mCurrentHighlightedWord = wordAtCursor();
|
mCurrentHighlightedWord = wordAtCursor();
|
||||||
} else if (selAvail() && blockBegin() == wordStart()
|
} else if (selAvail() && blockBegin() == wordStart()
|
||||||
|
@ -1665,7 +1665,7 @@ void Editor::onStatusChanged(QSynedit::SynStatusChanges changes)
|
||||||
|
|
||||||
pMainWindow->updateEditorActions();
|
pMainWindow->updateEditorActions();
|
||||||
|
|
||||||
if (changes.testFlag(QSynedit::SynStatusChange::scCaretY) && mParentPageControl) {
|
if (changes.testFlag(QSynedit::StatusChange::scCaretY) && mParentPageControl) {
|
||||||
pMainWindow->caretList().addCaret(this,caretY(),caretX());
|
pMainWindow->caretList().addCaret(this,caretY(),caretX());
|
||||||
pMainWindow->updateCaretActions();
|
pMainWindow->updateCaretActions();
|
||||||
}
|
}
|
||||||
|
@ -1766,42 +1766,42 @@ bool Editor::notParsed()
|
||||||
|
|
||||||
void Editor::insertLine()
|
void Editor::insertLine()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecInsertLine,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecInsertLine,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::deleteWord()
|
void Editor::deleteWord()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteWord,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecDeleteWord,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::deleteToWordStart()
|
void Editor::deleteToWordStart()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteWordStart,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecDeleteWordStart,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::deleteToWordEnd()
|
void Editor::deleteToWordEnd()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteWordEnd,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecDeleteWordEnd,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::deleteLine()
|
void Editor::deleteLine()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteLine,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecDeleteLine,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::duplicateLine()
|
void Editor::duplicateLine()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecDuplicateLine,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecDuplicateLine,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::deleteToEOL()
|
void Editor::deleteToEOL()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteEOL,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecDeleteEOL,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::deleteToBOL()
|
void Editor::deleteToBOL()
|
||||||
{
|
{
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteBOL,QChar(),nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecDeleteBOL,QChar(),nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList Editor::getOwnerExpressionAndMemberAtPositionForCompletion(
|
QStringList Editor::getOwnerExpressionAndMemberAtPositionForCompletion(
|
||||||
|
@ -1823,7 +1823,7 @@ QStringList Editor::getExpressionAtPosition(
|
||||||
int ch = pos.ch-1;
|
int ch = pos.ch-1;
|
||||||
int symbolMatchingLevel = 0;
|
int symbolMatchingLevel = 0;
|
||||||
LastSymbolType lastSymbolType=LastSymbolType::None;
|
LastSymbolType lastSymbolType=LastSymbolType::None;
|
||||||
QSynedit::PSynHighlighter highlighter;
|
QSynedit::PHighlighter highlighter;
|
||||||
if (isNew())
|
if (isNew())
|
||||||
highlighter = highlighterManager.getCppHighlighter();
|
highlighter = highlighterManager.getCppHighlighter();
|
||||||
else
|
else
|
||||||
|
@ -1848,7 +1848,7 @@ QStringList Editor::getExpressionAtPosition(
|
||||||
if (start>ch) {
|
if (start>ch) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QSynedit::PSynHighlighterAttribute attr = highlighter->getTokenAttribute();
|
QSynedit::PHighlighterAttribute attr = highlighter->getTokenAttribute();
|
||||||
if ( (line == pos.line-1)
|
if ( (line == pos.line-1)
|
||||||
&& (start<=ch) && (ch<=endPos)) {
|
&& (start<=ch) && (ch<=endPos)) {
|
||||||
if (attr==highlighter->commentAttribute() || attr == highlighter->stringAttribute()) {
|
if (attr==highlighter->commentAttribute() || attr == highlighter->stringAttribute()) {
|
||||||
|
@ -2088,14 +2088,14 @@ bool Editor::handleSymbolCompletion(QChar key)
|
||||||
} else {
|
} else {
|
||||||
QSynedit::BufferCoord HighlightPos = QSynedit::BufferCoord{caretX()-1, caretY()};
|
QSynedit::BufferCoord HighlightPos = QSynedit::BufferCoord{caretX()-1, caretY()};
|
||||||
// Check if that line is highlighted as comment
|
// Check if that line is highlighted as comment
|
||||||
QSynedit::PSynHighlighterAttribute Attr;
|
QSynedit::PHighlighterAttribute Attr;
|
||||||
QString Token;
|
QString Token;
|
||||||
bool tokenFinished;
|
bool tokenFinished;
|
||||||
QSynedit::SynHighlighterTokenType tokenType;
|
QSynedit::TokenType tokenType;
|
||||||
if (getHighlighterAttriAtRowCol(HighlightPos, Token, tokenFinished, tokenType,Attr)) {
|
if (getHighlighterAttriAtRowCol(HighlightPos, Token, tokenFinished, tokenType,Attr)) {
|
||||||
if ((tokenType == QSynedit::SynHighlighterTokenType::Comment) && (!tokenFinished))
|
if ((tokenType == QSynedit::TokenType::Comment) && (!tokenFinished))
|
||||||
return false;
|
return false;
|
||||||
if ((tokenType == QSynedit::SynHighlighterTokenType::String) && (!tokenFinished)
|
if ((tokenType == QSynedit::TokenType::String) && (!tokenFinished)
|
||||||
&& (key!='\'') && (key!='\"') && (key!='(') && (key!=')'))
|
&& (key!='\'') && (key!='\"') && (key!='(') && (key!=')'))
|
||||||
return false;
|
return false;
|
||||||
if (( key=='<' || key =='>') && (mParser && !mParser->isIncludeLine(lineText())))
|
if (( key=='<' || key =='>') && (mParser && !mParser->isIncludeLine(lineText())))
|
||||||
|
@ -2191,17 +2191,17 @@ bool Editor::handleParentheseCompletion()
|
||||||
QString text=selText();
|
QString text=selText();
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'(');
|
commandProcessor(QSynedit::EditCommand::ecChar,'(');
|
||||||
setSelText(text);
|
setSelText(text);
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,')');
|
commandProcessor(QSynedit::EditCommand::ecChar,')');
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
} else {
|
} else {
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'(');
|
commandProcessor(QSynedit::EditCommand::ecChar,'(');
|
||||||
QSynedit::BufferCoord oldCaret = caretXY();
|
QSynedit::BufferCoord oldCaret = caretXY();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,')');
|
commandProcessor(QSynedit::EditCommand::ecChar,')');
|
||||||
setCaretXY(oldCaret);
|
setCaretXY(oldCaret);
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
|
@ -2228,7 +2228,7 @@ bool Editor::handleParentheseSkip()
|
||||||
if (document()->count()==0)
|
if (document()->count()==0)
|
||||||
return false;
|
return false;
|
||||||
if (highlighter()) {
|
if (highlighter()) {
|
||||||
QSynedit::SynRangeState lastLineState = document()->ranges(document()->count()-1);
|
QSynedit::HighlighterState lastLineState = document()->ranges(document()->count()-1);
|
||||||
if (lastLineState.parenthesisLevel==0) {
|
if (lastLineState.parenthesisLevel==0) {
|
||||||
setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over
|
setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over
|
||||||
return true;
|
return true;
|
||||||
|
@ -2252,17 +2252,17 @@ bool Editor::handleBracketCompletion()
|
||||||
QString text=selText();
|
QString text=selText();
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'[');
|
commandProcessor(QSynedit::EditCommand::ecChar,'[');
|
||||||
setSelText(text);
|
setSelText(text);
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,']');
|
commandProcessor(QSynedit::EditCommand::ecChar,']');
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
} else {
|
} else {
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'[');
|
commandProcessor(QSynedit::EditCommand::ecChar,'[');
|
||||||
QSynedit::BufferCoord oldCaret = caretXY();
|
QSynedit::BufferCoord oldCaret = caretXY();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,']');
|
commandProcessor(QSynedit::EditCommand::ecChar,']');
|
||||||
setCaretXY(oldCaret);
|
setCaretXY(oldCaret);
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
|
@ -2279,7 +2279,7 @@ bool Editor::handleBracketSkip()
|
||||||
if (document()->count()==0)
|
if (document()->count()==0)
|
||||||
return false;
|
return false;
|
||||||
if (highlighter()) {
|
if (highlighter()) {
|
||||||
QSynedit::SynRangeState lastLineState = document()->ranges(document()->count()-1);
|
QSynedit::HighlighterState lastLineState = document()->ranges(document()->count()-1);
|
||||||
if (lastLineState.bracketLevel==0) {
|
if (lastLineState.bracketLevel==0) {
|
||||||
setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over
|
setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over
|
||||||
return true;
|
return true;
|
||||||
|
@ -2300,14 +2300,14 @@ bool Editor::handleMultilineCommentCompletion()
|
||||||
QString text=selText();
|
QString text=selText();
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'*');
|
commandProcessor(QSynedit::EditCommand::ecChar,'*');
|
||||||
QSynedit::BufferCoord oldCaret;
|
QSynedit::BufferCoord oldCaret;
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
oldCaret = caretXY();
|
oldCaret = caretXY();
|
||||||
else
|
else
|
||||||
setSelText(text);
|
setSelText(text);
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'*');
|
commandProcessor(QSynedit::EditCommand::ecChar,'*');
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'/');
|
commandProcessor(QSynedit::EditCommand::ecChar,'/');
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
setCaretXY(oldCaret);
|
setCaretXY(oldCaret);
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
|
@ -2328,16 +2328,16 @@ bool Editor::handleBraceCompletion()
|
||||||
QString text=selText();
|
QString text=selText();
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'{');
|
commandProcessor(QSynedit::EditCommand::ecChar,'{');
|
||||||
QSynedit::BufferCoord oldCaret;
|
QSynedit::BufferCoord oldCaret;
|
||||||
if (text.isEmpty()) {
|
if (text.isEmpty()) {
|
||||||
oldCaret = caretXY();
|
oldCaret = caretXY();
|
||||||
} else {
|
} else {
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecInsertLine);
|
commandProcessor(QSynedit::EditCommand::ecInsertLine);
|
||||||
setSelText(text);
|
setSelText(text);
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecInsertLine);
|
commandProcessor(QSynedit::EditCommand::ecInsertLine);
|
||||||
}
|
}
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'}');
|
commandProcessor(QSynedit::EditCommand::ecChar,'}');
|
||||||
if (
|
if (
|
||||||
( (s.startsWith("struct")
|
( (s.startsWith("struct")
|
||||||
|| s.startsWith("class")
|
|| s.startsWith("class")
|
||||||
|
@ -2348,7 +2348,7 @@ bool Editor::handleBraceCompletion()
|
||||||
|| s.startsWith("enum") )
|
|| s.startsWith("enum") )
|
||||||
&& !s.contains(';')
|
&& !s.contains(';')
|
||||||
) || s.endsWith('=')) {
|
) || s.endsWith('=')) {
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,';');
|
commandProcessor(QSynedit::EditCommand::ecChar,';');
|
||||||
}
|
}
|
||||||
if (text.isEmpty())
|
if (text.isEmpty())
|
||||||
setCaretXY(oldCaret);
|
setCaretXY(oldCaret);
|
||||||
|
@ -2365,11 +2365,11 @@ bool Editor::handleBraceSkip()
|
||||||
if (document()->count()==0)
|
if (document()->count()==0)
|
||||||
return false;
|
return false;
|
||||||
if (highlighter()) {
|
if (highlighter()) {
|
||||||
QSynedit::SynRangeState lastLineState = document()->ranges(document()->count()-1);
|
QSynedit::HighlighterState lastLineState = document()->ranges(document()->count()-1);
|
||||||
if (lastLineState.braceLevel==0) {
|
if (lastLineState.braceLevel==0) {
|
||||||
bool oldInsertMode = insertMode();
|
bool oldInsertMode = insertMode();
|
||||||
setInsertMode(false); //set mode to overwrite
|
setInsertMode(false); //set mode to overwrite
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'}');
|
commandProcessor(QSynedit::EditCommand::ecChar,'}');
|
||||||
setInsertMode(oldInsertMode);
|
setInsertMode(oldInsertMode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2378,7 +2378,7 @@ bool Editor::handleBraceSkip()
|
||||||
if (pos.line != 0) {
|
if (pos.line != 0) {
|
||||||
bool oldInsertMode = insertMode();
|
bool oldInsertMode = insertMode();
|
||||||
setInsertMode(false); //set mode to overwrite
|
setInsertMode(false); //set mode to overwrite
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'}');
|
commandProcessor(QSynedit::EditCommand::ecChar,'}');
|
||||||
setInsertMode(oldInsertMode);
|
setInsertMode(oldInsertMode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2401,9 +2401,9 @@ bool Editor::handleSingleQuoteCompletion()
|
||||||
QString text=selText();
|
QString text=selText();
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'\'');
|
commandProcessor(QSynedit::EditCommand::ecChar,'\'');
|
||||||
setSelText(text);
|
setSelText(text);
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'\'');
|
commandProcessor(QSynedit::EditCommand::ecChar,'\'');
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
return true;
|
return true;
|
||||||
|
@ -2412,9 +2412,9 @@ bool Editor::handleSingleQuoteCompletion()
|
||||||
// insert ''
|
// insert ''
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'\'');
|
commandProcessor(QSynedit::EditCommand::ecChar,'\'');
|
||||||
QSynedit::BufferCoord oldCaret = caretXY();
|
QSynedit::BufferCoord oldCaret = caretXY();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'\'');
|
commandProcessor(QSynedit::EditCommand::ecChar,'\'');
|
||||||
setCaretXY(oldCaret);
|
setCaretXY(oldCaret);
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
|
@ -2441,9 +2441,9 @@ bool Editor::handleDoubleQuoteCompletion()
|
||||||
QString text=selText();
|
QString text=selText();
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'"');
|
commandProcessor(QSynedit::EditCommand::ecChar,'"');
|
||||||
setSelText(text);
|
setSelText(text);
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'"');
|
commandProcessor(QSynedit::EditCommand::ecChar,'"');
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
return true;
|
return true;
|
||||||
|
@ -2452,9 +2452,9 @@ bool Editor::handleDoubleQuoteCompletion()
|
||||||
// insert ""
|
// insert ""
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'"');
|
commandProcessor(QSynedit::EditCommand::ecChar,'"');
|
||||||
QSynedit::BufferCoord oldCaret = caretXY();
|
QSynedit::BufferCoord oldCaret = caretXY();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'"');
|
commandProcessor(QSynedit::EditCommand::ecChar,'"');
|
||||||
setCaretXY(oldCaret);
|
setCaretXY(oldCaret);
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
endUpdate();
|
endUpdate();
|
||||||
|
@ -2474,9 +2474,9 @@ bool Editor::handleGlobalIncludeCompletion()
|
||||||
return false;
|
return false;
|
||||||
beginUpdate();
|
beginUpdate();
|
||||||
beginUndoBlock();
|
beginUndoBlock();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'<');
|
commandProcessor(QSynedit::EditCommand::ecChar,'<');
|
||||||
QSynedit::BufferCoord oldCaret = caretXY();
|
QSynedit::BufferCoord oldCaret = caretXY();
|
||||||
commandProcessor(QSynedit::SynEditorCommand::ecChar,'>');
|
commandProcessor(QSynedit::EditCommand::ecChar,'>');
|
||||||
setCaretXY(oldCaret);
|
setCaretXY(oldCaret);
|
||||||
endUpdate();
|
endUpdate();
|
||||||
endUndoBlock();
|
endUndoBlock();
|
||||||
|
@ -2515,7 +2515,7 @@ bool Editor::handleCodeCompletion(QChar key)
|
||||||
showCompletion("",false);
|
showCompletion("",false);
|
||||||
return true;
|
return true;
|
||||||
case ':':
|
case ':':
|
||||||
ExecuteCommand(QSynedit::SynEditorCommand::ecChar,':',nullptr);
|
ExecuteCommand(QSynedit::EditCommand::ecChar,':',nullptr);
|
||||||
//setSelText(key);
|
//setSelText(key);
|
||||||
if ((caretX() > 2) && (lineText().length() >= 2) &&
|
if ((caretX() > 2) && (lineText().length() >= 2) &&
|
||||||
(lineText()[caretX() - 3] == ':'))
|
(lineText()[caretX() - 3] == ':'))
|
||||||
|
@ -2550,7 +2550,7 @@ void Editor::initParser()
|
||||||
resetCppParser(mParser);
|
resetCppParser(mParser);
|
||||||
mParser->setEnabled(
|
mParser->setEnabled(
|
||||||
pSettings->codeCompletion().enabled() &&
|
pSettings->codeCompletion().enabled() &&
|
||||||
(highlighter() && highlighter()->getClass() == QSynedit::SynHighlighterClass::CppHighlighter));
|
(highlighter() && highlighter()->getClass() == QSynedit::HighlighterClass::CppHighlighter));
|
||||||
}
|
}
|
||||||
|
|
||||||
Editor::QuoteStatus Editor::getQuoteStatus()
|
Editor::QuoteStatus Editor::getQuoteStatus()
|
||||||
|
@ -2678,8 +2678,8 @@ void Editor::reparse()
|
||||||
{
|
{
|
||||||
if (!highlighter())
|
if (!highlighter())
|
||||||
return;
|
return;
|
||||||
if (highlighter()->language() != QSynedit::SynHighlighterLanguage::Cpp
|
if (highlighter()->language() != QSynedit::HighlighterLanguage::Cpp
|
||||||
&& highlighter()->language() != QSynedit::SynHighlighterLanguage::GLSL)
|
&& highlighter()->language() != QSynedit::HighlighterLanguage::GLSL)
|
||||||
return;
|
return;
|
||||||
if (mParser)
|
if (mParser)
|
||||||
mParser->setEnabled(pSettings->codeCompletion().enabled());
|
mParser->setEnabled(pSettings->codeCompletion().enabled());
|
||||||
|
@ -2843,7 +2843,7 @@ void Editor::exportAsRTF(const QString &rtfFilename)
|
||||||
exporter.setExportAsText(true);
|
exporter.setExportAsText(true);
|
||||||
exporter.setUseBackground(pSettings->editor().copyRTFUseBackground());
|
exporter.setUseBackground(pSettings->editor().copyRTFUseBackground());
|
||||||
exporter.setFont(font());
|
exporter.setFont(font());
|
||||||
QSynedit::PSynHighlighter hl = highlighter();
|
QSynedit::PHighlighter hl = highlighter();
|
||||||
if (!pSettings->editor().copyRTFUseEditorColor()) {
|
if (!pSettings->editor().copyRTFUseEditorColor()) {
|
||||||
hl = highlighterManager.copyHighlighter(highlighter());
|
hl = highlighterManager.copyHighlighter(highlighter());
|
||||||
highlighterManager.applyColorScheme(hl,pSettings->editor().copyRTFColorScheme());
|
highlighterManager.applyColorScheme(hl,pSettings->editor().copyRTFColorScheme());
|
||||||
|
@ -2868,7 +2868,7 @@ void Editor::exportAsHTML(const QString &htmlFilename)
|
||||||
exporter.setExportAsText(false);
|
exporter.setExportAsText(false);
|
||||||
exporter.setUseBackground(pSettings->editor().copyHTMLUseBackground());
|
exporter.setUseBackground(pSettings->editor().copyHTMLUseBackground());
|
||||||
exporter.setFont(font());
|
exporter.setFont(font());
|
||||||
QSynedit::PSynHighlighter hl = highlighter();
|
QSynedit::PHighlighter hl = highlighter();
|
||||||
if (!pSettings->editor().copyHTMLUseEditorColor()) {
|
if (!pSettings->editor().copyHTMLUseEditorColor()) {
|
||||||
hl = highlighterManager.copyHighlighter(highlighter());
|
hl = highlighterManager.copyHighlighter(highlighter());
|
||||||
highlighterManager.applyColorScheme(hl,pSettings->editor().copyHTMLColorScheme());
|
highlighterManager.applyColorScheme(hl,pSettings->editor().copyHTMLColorScheme());
|
||||||
|
@ -2905,28 +2905,28 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete)
|
||||||
QString word="";
|
QString word="";
|
||||||
|
|
||||||
QString s;
|
QString s;
|
||||||
QSynedit::PSynHighlighterAttribute attr;
|
QSynedit::PHighlighterAttribute attr;
|
||||||
bool tokenFinished;
|
bool tokenFinished;
|
||||||
QSynedit::SynHighlighterTokenType tokenType;
|
QSynedit::TokenType tokenType;
|
||||||
QSynedit::BufferCoord pBeginPos, pEndPos;
|
QSynedit::BufferCoord pBeginPos, pEndPos;
|
||||||
if (getHighlighterAttriAtRowCol(
|
if (getHighlighterAttriAtRowCol(
|
||||||
QSynedit::BufferCoord{caretX() - 1,
|
QSynedit::BufferCoord{caretX() - 1,
|
||||||
caretY()}, s, tokenFinished,tokenType, attr)) {
|
caretY()}, s, tokenFinished,tokenType, attr)) {
|
||||||
if (tokenType == QSynedit::SynHighlighterTokenType::PreprocessDirective) {//Preprocessor
|
if (tokenType == QSynedit::TokenType::PreprocessDirective) {//Preprocessor
|
||||||
word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpDirective);
|
word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpDirective);
|
||||||
if (!word.startsWith('#')) {
|
if (!word.startsWith('#')) {
|
||||||
word = "";
|
word = "";
|
||||||
}
|
}
|
||||||
} else if (tokenType == QSynedit::SynHighlighterTokenType::Comment) { //Comment, javadoc tag
|
} else if (tokenType == QSynedit::TokenType::Comment) { //Comment, javadoc tag
|
||||||
word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpJavadoc);
|
word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpJavadoc);
|
||||||
if (!word.startsWith('@')) {
|
if (!word.startsWith('@')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
(tokenType != QSynedit::SynHighlighterTokenType::Symbol) &&
|
(tokenType != QSynedit::TokenType::Symbol) &&
|
||||||
(tokenType != QSynedit::SynHighlighterTokenType::Space) &&
|
(tokenType != QSynedit::TokenType::Space) &&
|
||||||
(tokenType != QSynedit::SynHighlighterTokenType::Keyword) &&
|
(tokenType != QSynedit::TokenType::Keyword) &&
|
||||||
(tokenType != QSynedit::SynHighlighterTokenType::Identifier)
|
(tokenType != QSynedit::TokenType::Identifier)
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2971,7 +2971,7 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete)
|
||||||
|
|
||||||
QSet<QString> keywords;
|
QSet<QString> keywords;
|
||||||
if (highlighter()) {
|
if (highlighter()) {
|
||||||
if (highlighter()->language() != QSynedit::SynHighlighterLanguage::Cpp ) {
|
if (highlighter()->language() != QSynedit::HighlighterLanguage::Cpp ) {
|
||||||
keywords = highlighter()->keywords();
|
keywords = highlighter()->keywords();
|
||||||
} else if (mUseCppSyntax) {
|
} else if (mUseCppSyntax) {
|
||||||
foreach (const QString& keyword, CppKeywords.keys()) {
|
foreach (const QString& keyword, CppKeywords.keys()) {
|
||||||
|
@ -3256,7 +3256,7 @@ bool Editor::onCompletionKeyPressed(QKeyEvent *event)
|
||||||
return true;
|
return true;
|
||||||
case Qt::Key_Backspace:
|
case Qt::Key_Backspace:
|
||||||
ExecuteCommand(
|
ExecuteCommand(
|
||||||
QSynedit::SynEditorCommand::ecDeleteLastChar,
|
QSynedit::EditCommand::ecDeleteLastChar,
|
||||||
QChar(), nullptr); // Simulate backspace in editor
|
QChar(), nullptr); // Simulate backspace in editor
|
||||||
if (purpose == WordPurpose::wpCompletion) {
|
if (purpose == WordPurpose::wpCompletion) {
|
||||||
phrase = getWordForCompletionSearch(caretXY(), mCompletionPopup->memberOperator()=="::");
|
phrase = getWordForCompletionSearch(caretXY(), mCompletionPopup->memberOperator()=="::");
|
||||||
|
@ -3318,7 +3318,7 @@ bool Editor::onHeaderCompletionKeyPressed(QKeyEvent *event)
|
||||||
switch (event->key()) {
|
switch (event->key()) {
|
||||||
case Qt::Key_Backspace:
|
case Qt::Key_Backspace:
|
||||||
ExecuteCommand(
|
ExecuteCommand(
|
||||||
QSynedit::SynEditorCommand::ecDeleteLastChar,
|
QSynedit::EditCommand::ecDeleteLastChar,
|
||||||
QChar(), nullptr); // Simulate backspace in editor
|
QChar(), nullptr); // Simulate backspace in editor
|
||||||
phrase = getWordAtPosition(this,caretXY(),
|
phrase = getWordAtPosition(this,caretXY(),
|
||||||
pBeginPos,pEndPos,
|
pBeginPos,pEndPos,
|
||||||
|
@ -3389,7 +3389,7 @@ Editor::TipType Editor::getTipType(QPoint point, QSynedit::BufferCoord& pos)
|
||||||
return TipType::Error;
|
return TipType::Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::PSynHighlighterAttribute attr;
|
QSynedit::PHighlighterAttribute attr;
|
||||||
QString s;
|
QString s;
|
||||||
|
|
||||||
// Only allow hand tips in highlighted areas
|
// Only allow hand tips in highlighted areas
|
||||||
|
@ -3589,7 +3589,7 @@ void Editor::updateFunctionTip(bool showTip)
|
||||||
while(!highlighter()->eol()) {
|
while(!highlighter()->eol()) {
|
||||||
int start = highlighter()->getTokenPos();
|
int start = highlighter()->getTokenPos();
|
||||||
QString token = highlighter()->getToken();
|
QString token = highlighter()->getToken();
|
||||||
QSynedit::PSynHighlighterAttribute attr = highlighter()->getTokenAttribute();
|
QSynedit::PHighlighterAttribute attr = highlighter()->getTokenAttribute();
|
||||||
if (start>=currentChar)
|
if (start>=currentChar)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -3798,7 +3798,7 @@ void Editor::popUserCodeInTabStops()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::onExportedFormatToken(QSynedit::PSynHighlighter syntaxHighlighter, int Line, int column, const QString &token, QSynedit::PSynHighlighterAttribute& attr)
|
void Editor::onExportedFormatToken(QSynedit::PHighlighter syntaxHighlighter, int Line, int column, const QString &token, QSynedit::PHighlighterAttribute& attr)
|
||||||
{
|
{
|
||||||
if (!syntaxHighlighter)
|
if (!syntaxHighlighter)
|
||||||
return;
|
return;
|
||||||
|
@ -3826,7 +3826,7 @@ void Editor::onExportedFormatToken(QSynedit::PSynHighlighter syntaxHighlighter,
|
||||||
kind = StatementKind::skVariable;
|
kind = StatementKind::skVariable;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QSynedit::SynEditCppHighlighter* cppHighlighter = dynamic_cast<QSynedit::SynEditCppHighlighter*>(syntaxHighlighter.get());
|
QSynedit::CppHighlighter* cppHighlighter = dynamic_cast<QSynedit::CppHighlighter*>(syntaxHighlighter.get());
|
||||||
switch(kind) {
|
switch(kind) {
|
||||||
case StatementKind::skFunction:
|
case StatementKind::skFunction:
|
||||||
case StatementKind::skConstructor:
|
case StatementKind::skConstructor:
|
||||||
|
@ -4312,9 +4312,9 @@ void Editor::reformat()
|
||||||
addLeftTopToUndo();
|
addLeftTopToUndo();
|
||||||
addCaretToUndo();
|
addCaretToUndo();
|
||||||
|
|
||||||
QSynedit::SynEditorOptions oldOptions = getOptions();
|
QSynedit::EditorOptions oldOptions = getOptions();
|
||||||
QSynedit::SynEditorOptions newOptions = oldOptions;
|
QSynedit::EditorOptions newOptions = oldOptions;
|
||||||
newOptions.setFlag(QSynedit::SynEditorOption::eoAutoIndent,false);
|
newOptions.setFlag(QSynedit::EditorOption::eoAutoIndent,false);
|
||||||
setOptions(newOptions);
|
setOptions(newOptions);
|
||||||
replaceAll(QString::fromUtf8(newContent));
|
replaceAll(QString::fromUtf8(newContent));
|
||||||
setCaretXY(mOldCaret);
|
setCaretXY(mOldCaret);
|
||||||
|
@ -4333,7 +4333,7 @@ void Editor::checkSyntaxInBack()
|
||||||
return;
|
return;
|
||||||
if (!highlighter())
|
if (!highlighter())
|
||||||
return;
|
return;
|
||||||
if (highlighter()->language()!=QSynedit::SynHighlighterLanguage::Cpp)
|
if (highlighter()->language()!=QSynedit::HighlighterLanguage::Cpp)
|
||||||
return;
|
return;
|
||||||
if(pSettings->editor().syntaxCheck())
|
if(pSettings->editor().syntaxCheck())
|
||||||
pMainWindow->checkSyntaxInBack(this);
|
pMainWindow->checkSyntaxInBack(this);
|
||||||
|
@ -4470,7 +4470,7 @@ void Editor::setActiveBreakpointFocus(int Line, bool setFocus)
|
||||||
|
|
||||||
void Editor::applySettings()
|
void Editor::applySettings()
|
||||||
{
|
{
|
||||||
QSynedit::SynEditorOptions options = QSynedit::eoAltSetsColumnMode |
|
QSynedit::EditorOptions options = QSynedit::eoAltSetsColumnMode |
|
||||||
QSynedit::eoDragDropEditing | QSynedit::eoDropFiles | QSynedit::eoKeepCaretX | QSynedit::eoTabsToSpaces |
|
QSynedit::eoDragDropEditing | QSynedit::eoDropFiles | QSynedit::eoKeepCaretX | QSynedit::eoTabsToSpaces |
|
||||||
QSynedit::eoRightMouseMovesCursor | QSynedit::eoScrollByOneLess | QSynedit::eoTabIndent | QSynedit::eoHideShowScrollbars | QSynedit::eoGroupUndo;
|
QSynedit::eoRightMouseMovesCursor | QSynedit::eoScrollByOneLess | QSynedit::eoTabIndent | QSynedit::eoHideShowScrollbars | QSynedit::eoGroupUndo;
|
||||||
|
|
||||||
|
@ -4515,7 +4515,7 @@ void Editor::applySettings()
|
||||||
// Set gutter properties
|
// Set gutter properties
|
||||||
gutter().setLeftOffset(pointToPixel(pSettings->editor().fontSize()) + pSettings->editor().gutterLeftOffset());
|
gutter().setLeftOffset(pointToPixel(pSettings->editor().fontSize()) + pSettings->editor().gutterLeftOffset());
|
||||||
gutter().setRightOffset(pSettings->editor().gutterRightOffset());
|
gutter().setRightOffset(pSettings->editor().gutterRightOffset());
|
||||||
gutter().setBorderStyle(QSynedit::SynGutterBorderStyle::None);
|
gutter().setBorderStyle(QSynedit::GutterBorderStyle::None);
|
||||||
gutter().setUseFontStyle(pSettings->editor().gutterUseCustomFont());
|
gutter().setUseFontStyle(pSettings->editor().gutterUseCustomFont());
|
||||||
if (pSettings->editor().gutterUseCustomFont()) {
|
if (pSettings->editor().gutterUseCustomFont()) {
|
||||||
f=QFont(pSettings->editor().gutterFontName());
|
f=QFont(pSettings->editor().gutterFontName());
|
||||||
|
@ -4551,30 +4551,30 @@ void Editor::applySettings()
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
static QSynedit::PSynHighlighterAttribute createRainbowAttribute(const QString& attrName, const QString& schemeName, const QString& schemeItemName) {
|
static QSynedit::PHighlighterAttribute createRainbowAttribute(const QString& attrName, const QString& schemeName, const QString& schemeItemName) {
|
||||||
PColorSchemeItem item = pColorManager->getItem(schemeName,schemeItemName);
|
PColorSchemeItem item = pColorManager->getItem(schemeName,schemeItemName);
|
||||||
if (item) {
|
if (item) {
|
||||||
QSynedit::PSynHighlighterAttribute attr = std::make_shared<QSynedit::SynHighlighterAttribute>(attrName);
|
QSynedit::PHighlighterAttribute attr = std::make_shared<QSynedit::HighlighterAttribute>(attrName);
|
||||||
attr->setForeground(item->foreground());
|
attr->setForeground(item->foreground());
|
||||||
attr->setBackground(item->background());
|
attr->setBackground(item->background());
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
return QSynedit::PSynHighlighterAttribute();
|
return QSynedit::PHighlighterAttribute();
|
||||||
}
|
}
|
||||||
void Editor::applyColorScheme(const QString& schemeName)
|
void Editor::applyColorScheme(const QString& schemeName)
|
||||||
{
|
{
|
||||||
QSynedit::SynEditorOptions options = getOptions();
|
QSynedit::EditorOptions options = getOptions();
|
||||||
options.setFlag(QSynedit::SynEditorOption::eoShowRainbowColor, pSettings->editor().rainbowParenthesis());
|
options.setFlag(QSynedit::EditorOption::eoShowRainbowColor, pSettings->editor().rainbowParenthesis());
|
||||||
setOptions(options);
|
setOptions(options);
|
||||||
highlighterManager.applyColorScheme(highlighter(),schemeName);
|
highlighterManager.applyColorScheme(highlighter(),schemeName);
|
||||||
if (pSettings->editor().rainbowParenthesis()) {
|
if (pSettings->editor().rainbowParenthesis()) {
|
||||||
QSynedit::PSynHighlighterAttribute attr0 =createRainbowAttribute(SYNS_AttrSymbol,
|
QSynedit::PHighlighterAttribute attr0 =createRainbowAttribute(SYNS_AttrSymbol,
|
||||||
schemeName,COLOR_SCHEME_BRACE_1);
|
schemeName,COLOR_SCHEME_BRACE_1);
|
||||||
QSynedit::PSynHighlighterAttribute attr1 =createRainbowAttribute(SYNS_AttrSymbol,
|
QSynedit::PHighlighterAttribute attr1 =createRainbowAttribute(SYNS_AttrSymbol,
|
||||||
schemeName,COLOR_SCHEME_BRACE_2);
|
schemeName,COLOR_SCHEME_BRACE_2);
|
||||||
QSynedit::PSynHighlighterAttribute attr2 =createRainbowAttribute(SYNS_AttrSymbol,
|
QSynedit::PHighlighterAttribute attr2 =createRainbowAttribute(SYNS_AttrSymbol,
|
||||||
schemeName,COLOR_SCHEME_BRACE_3);
|
schemeName,COLOR_SCHEME_BRACE_3);
|
||||||
QSynedit::PSynHighlighterAttribute attr3 =createRainbowAttribute(SYNS_AttrSymbol,
|
QSynedit::PHighlighterAttribute attr3 =createRainbowAttribute(SYNS_AttrSymbol,
|
||||||
schemeName,COLOR_SCHEME_BRACE_4);
|
schemeName,COLOR_SCHEME_BRACE_4);
|
||||||
setRainbowAttrs(attr0,attr1,attr2,attr3);
|
setRainbowAttrs(attr0,attr1,attr2,attr3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,7 @@ signals:
|
||||||
void renamed(const QString& oldName, const QString& newName, bool firstSave);
|
void renamed(const QString& oldName, const QString& newName, bool firstSave);
|
||||||
void fileSaved(const QString& filename, bool inProject);
|
void fileSaved(const QString& filename, bool inProject);
|
||||||
private slots:
|
private slots:
|
||||||
void onStatusChanged(QSynedit::SynStatusChanges changes);
|
void onStatusChanged(QSynedit::StatusChanges changes);
|
||||||
void onGutterClicked(Qt::MouseButton button, int x, int y, int line);
|
void onGutterClicked(Qt::MouseButton button, int x, int y, int line);
|
||||||
void onTipEvalValueReady(const QString& value);
|
void onTipEvalValueReady(const QString& value);
|
||||||
void onLinesDeleted(int first,int count);
|
void onLinesDeleted(int first,int count);
|
||||||
|
@ -284,8 +284,8 @@ private:
|
||||||
void updateFunctionTip(bool showTip);
|
void updateFunctionTip(bool showTip);
|
||||||
void clearUserCodeInTabStops();
|
void clearUserCodeInTabStops();
|
||||||
void popUserCodeInTabStops();
|
void popUserCodeInTabStops();
|
||||||
void onExportedFormatToken(QSynedit::PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token,
|
void onExportedFormatToken(QSynedit::PHighlighter syntaxHighlighter, int Line, int column, const QString& token,
|
||||||
QSynedit::PSynHighlighterAttribute &attr);
|
QSynedit::PHighlighterAttribute &attr);
|
||||||
void onScrollBarValueChanged();
|
void onScrollBarValueChanged();
|
||||||
private:
|
private:
|
||||||
QByteArray mEncodingOption; // the encoding type set by the user
|
QByteArray mEncodingOption; // the encoding type set by the user
|
||||||
|
@ -347,7 +347,7 @@ protected:
|
||||||
// SynEdit interface
|
// SynEdit interface
|
||||||
protected:
|
protected:
|
||||||
void onGutterPaint(QPainter &painter, int aLine, int X, int Y) override;
|
void onGutterPaint(QPainter &painter, int aLine, int X, int Y) override;
|
||||||
void onGetEditingAreas(int Line, QSynedit::SynEditingAreaList &areaList) override;
|
void onGetEditingAreas(int Line, QSynedit::EditingAreaList &areaList) override;
|
||||||
|
|
||||||
// SynEdit interface
|
// SynEdit interface
|
||||||
protected:
|
protected:
|
||||||
|
@ -355,7 +355,7 @@ protected:
|
||||||
|
|
||||||
// SynEdit interface
|
// SynEdit interface
|
||||||
protected:
|
protected:
|
||||||
void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PSynHighlighterAttribute attr, QSynedit::SynFontStyles &style, QColor &foreground, QColor &background) override;
|
void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PHighlighterAttribute attr, QSynedit::FontStyles &style, QColor &foreground, QColor &background) override;
|
||||||
|
|
||||||
// QObject interface
|
// QObject interface
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4138,7 +4138,7 @@ PStatement CppParser::doParseEvalTypeInfo(
|
||||||
QString s = type;
|
QString s = type;
|
||||||
// qDebug()<<"eval type info"<<type;
|
// qDebug()<<"eval type info"<<type;
|
||||||
int position = s.length()-1;
|
int position = s.length()-1;
|
||||||
QSynedit::SynEditCppHighlighter highlighter;
|
QSynedit::CppHighlighter highlighter;
|
||||||
highlighter.resetState();
|
highlighter.resetState();
|
||||||
highlighter.setLine(type,0);
|
highlighter.setLine(type,0);
|
||||||
int bracketLevel = 0;
|
int bracketLevel = 0;
|
||||||
|
|
|
@ -166,6 +166,7 @@ struct Statement {
|
||||||
QString fullName; // fullname(including class and namespace), ClassA::foo
|
QString fullName; // fullname(including class and namespace), ClassA::foo
|
||||||
QSet<QString> usingList; // using namespaces
|
QSet<QString> usingList; // using namespaces
|
||||||
QString noNameArgs;// Args without name
|
QString noNameArgs;// Args without name
|
||||||
|
|
||||||
// fields for code completion
|
// fields for code completion
|
||||||
int usageCount; //Usage Count
|
int usageCount; //Usage Count
|
||||||
int matchPosTotal; // total of matched positions
|
int matchPosTotal; // total of matched positions
|
||||||
|
|
|
@ -1255,8 +1255,8 @@ void Settings::Editor::doLoad()
|
||||||
mEnhanceHomeKey = boolValue("enhance_home_key", true);
|
mEnhanceHomeKey = boolValue("enhance_home_key", true);
|
||||||
mEnhanceEndKey = boolValue("enhance_end_key",true);
|
mEnhanceEndKey = boolValue("enhance_end_key",true);
|
||||||
mKeepCaretX = boolValue("keep_caret_x",true);
|
mKeepCaretX = boolValue("keep_caret_x",true);
|
||||||
mCaretForInsert = static_cast<QSynedit::SynEditCaretType>( intValue("caret_for_insert",static_cast<int>(QSynedit::SynEditCaretType::ctVerticalLine)));
|
mCaretForInsert = static_cast<QSynedit::EditCaretType>( intValue("caret_for_insert",static_cast<int>(QSynedit::EditCaretType::ctVerticalLine)));
|
||||||
mCaretForOverwrite = static_cast<QSynedit::SynEditCaretType>( intValue("caret_for_overwrite",static_cast<int>(QSynedit::SynEditCaretType::ctBlock)));
|
mCaretForOverwrite = static_cast<QSynedit::EditCaretType>( intValue("caret_for_overwrite",static_cast<int>(QSynedit::EditCaretType::ctBlock)));
|
||||||
mCaretUseTextColor = boolValue("caret_use_text_color",true);
|
mCaretUseTextColor = boolValue("caret_use_text_color",true);
|
||||||
mCaretColor = colorValue("caret_color",Qt::yellow);
|
mCaretColor = colorValue("caret_color",Qt::yellow);
|
||||||
|
|
||||||
|
@ -1382,22 +1382,22 @@ void Settings::Editor::doLoad()
|
||||||
mShowFunctionTips = boolValue("show_function_tips",true);
|
mShowFunctionTips = boolValue("show_function_tips",true);
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::SynEditCaretType Settings::Editor::caretForOverwrite() const
|
QSynedit::EditCaretType Settings::Editor::caretForOverwrite() const
|
||||||
{
|
{
|
||||||
return mCaretForOverwrite;
|
return mCaretForOverwrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::Editor::setCaretForOverwrite(const QSynedit::SynEditCaretType &caretForOverwrite)
|
void Settings::Editor::setCaretForOverwrite(const QSynedit::EditCaretType &caretForOverwrite)
|
||||||
{
|
{
|
||||||
mCaretForOverwrite = caretForOverwrite;
|
mCaretForOverwrite = caretForOverwrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSynedit::SynEditCaretType Settings::Editor::caretForInsert() const
|
QSynedit::EditCaretType Settings::Editor::caretForInsert() const
|
||||||
{
|
{
|
||||||
return mCaretForInsert;
|
return mCaretForInsert;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Settings::Editor::setCaretForInsert(const QSynedit::SynEditCaretType &caretForInsert)
|
void Settings::Editor::setCaretForInsert(const QSynedit::EditCaretType &caretForInsert)
|
||||||
{
|
{
|
||||||
mCaretForInsert = caretForInsert;
|
mCaretForInsert = caretForInsert;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,11 +143,11 @@ public:
|
||||||
bool enhanceEndKey() const;
|
bool enhanceEndKey() const;
|
||||||
void setEnhanceEndKey(bool enhanceEndKey);
|
void setEnhanceEndKey(bool enhanceEndKey);
|
||||||
|
|
||||||
QSynedit::SynEditCaretType caretForInsert() const;
|
QSynedit::EditCaretType caretForInsert() const;
|
||||||
void setCaretForInsert(const QSynedit::SynEditCaretType &caretForInsert);
|
void setCaretForInsert(const QSynedit::EditCaretType &caretForInsert);
|
||||||
|
|
||||||
QSynedit::SynEditCaretType caretForOverwrite() const;
|
QSynedit::EditCaretType caretForOverwrite() const;
|
||||||
void setCaretForOverwrite(const QSynedit::SynEditCaretType &caretForOverwrite);
|
void setCaretForOverwrite(const QSynedit::EditCaretType &caretForOverwrite);
|
||||||
|
|
||||||
QColor caretColor() const;
|
QColor caretColor() const;
|
||||||
void setCaretColor(const QColor &caretColor);
|
void setCaretColor(const QColor &caretColor);
|
||||||
|
@ -380,8 +380,8 @@ public:
|
||||||
bool mEnhanceHomeKey;
|
bool mEnhanceHomeKey;
|
||||||
bool mEnhanceEndKey;
|
bool mEnhanceEndKey;
|
||||||
bool mKeepCaretX;
|
bool mKeepCaretX;
|
||||||
QSynedit::SynEditCaretType mCaretForInsert;
|
QSynedit::EditCaretType mCaretForInsert;
|
||||||
QSynedit::SynEditCaretType mCaretForOverwrite;
|
QSynedit::EditCaretType mCaretForOverwrite;
|
||||||
bool mCaretUseTextColor;
|
bool mCaretUseTextColor;
|
||||||
QColor mCaretColor;
|
QColor mCaretColor;
|
||||||
|
|
||||||
|
|
|
@ -40,15 +40,15 @@ EditorGeneralWidget::~EditorGeneralWidget()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setCaretTypeIndex(QComboBox* combo, QSynedit::SynEditCaretType caretType) {
|
static void setCaretTypeIndex(QComboBox* combo, QSynedit::EditCaretType caretType) {
|
||||||
int t = static_cast<int>(caretType);
|
int t = static_cast<int>(caretType);
|
||||||
combo->setCurrentIndex(t);
|
combo->setCurrentIndex(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
static QSynedit::SynEditCaretType getCaretTypeIndex(QComboBox* combo) {
|
static QSynedit::EditCaretType getCaretTypeIndex(QComboBox* combo) {
|
||||||
if (combo->currentIndex()<0)
|
if (combo->currentIndex()<0)
|
||||||
return QSynedit::SynEditCaretType::ctVerticalLine;
|
return QSynedit::EditCaretType::ctVerticalLine;
|
||||||
return static_cast<QSynedit::SynEditCaretType>(combo->currentIndex());
|
return static_cast<QSynedit::EditCaretType>(combo->currentIndex());
|
||||||
}
|
}
|
||||||
void EditorGeneralWidget::doLoad()
|
void EditorGeneralWidget::doLoad()
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,7 +63,7 @@ TodoThread::TodoThread(const QString& filename, QObject *parent): QThread(parent
|
||||||
|
|
||||||
void TodoThread::run()
|
void TodoThread::run()
|
||||||
{
|
{
|
||||||
QSynedit::PSynHighlighter highlighter = highlighterManager.getCppHighlighter();
|
QSynedit::PHighlighter highlighter = highlighterManager.getCppHighlighter();
|
||||||
emit parseStarted(mFilename);
|
emit parseStarted(mFilename);
|
||||||
auto action = finally([this]{
|
auto action = finally([this]{
|
||||||
emit parseFinished();
|
emit parseFinished();
|
||||||
|
@ -72,13 +72,13 @@ void TodoThread::run()
|
||||||
if (!pMainWindow->editorList()->getContentFromOpenedEditor(mFilename,lines)) {
|
if (!pMainWindow->editorList()->getContentFromOpenedEditor(mFilename,lines)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QSynedit::PSynHighlighterAttribute commentAttr = highlighter->getAttribute(SYNS_AttrComment);
|
QSynedit::PHighlighterAttribute commentAttr = highlighter->getAttribute(SYNS_AttrComment);
|
||||||
|
|
||||||
highlighter->resetState();
|
highlighter->resetState();
|
||||||
for (int i =0;i<lines.count();i++) {
|
for (int i =0;i<lines.count();i++) {
|
||||||
highlighter->setLine(lines[i],i);
|
highlighter->setLine(lines[i],i);
|
||||||
while (!highlighter->eol()) {
|
while (!highlighter->eol()) {
|
||||||
QSynedit::PSynHighlighterAttribute attr;
|
QSynedit::PHighlighterAttribute attr;
|
||||||
attr = highlighter->getTokenAttribute();
|
attr = highlighter->getTokenAttribute();
|
||||||
if (attr == commentAttr) {
|
if (attr == commentAttr) {
|
||||||
QString token = highlighter->getToken();
|
QString token = highlighter->getToken();
|
||||||
|
|
|
@ -56,7 +56,7 @@ void FilePropertiesDialog::calcFile(Editor *editor,
|
||||||
while (j<line.length() && (line[j]=='\t' || line[j]==' '))
|
while (j<line.length() && (line[j]=='\t' || line[j]==' '))
|
||||||
j++;
|
j++;
|
||||||
QString token;
|
QString token;
|
||||||
QSynedit::PSynHighlighterAttribute attr;
|
QSynedit::PHighlighterAttribute attr;
|
||||||
if (editor->getHighlighterAttriAtRowCol(QSynedit::BufferCoord{j+1,i+1},
|
if (editor->getHighlighterAttriAtRowCol(QSynedit::BufferCoord{j+1,i+1},
|
||||||
token,attr)) {
|
token,attr)) {
|
||||||
// if it is preprocessor...
|
// if it is preprocessor...
|
||||||
|
|
|
@ -44,8 +44,8 @@ SearchDialog::SearchDialog(QWidget *parent) :
|
||||||
ui->dialogLayout->insertWidget(0,mTabBar);
|
ui->dialogLayout->insertWidget(0,mTabBar);
|
||||||
connect(mTabBar,&QTabBar::currentChanged,this, &SearchDialog::onTabChanged);
|
connect(mTabBar,&QTabBar::currentChanged,this, &SearchDialog::onTabChanged);
|
||||||
mSearchOptions&=0;
|
mSearchOptions&=0;
|
||||||
mBasicSearchEngine= QSynedit::PSynSearchBase(new QSynedit::SynSearch());
|
mBasicSearchEngine= QSynedit::PSynSearchBase(new QSynedit::BasicSearcher());
|
||||||
mRegexSearchEngine= QSynedit::PSynSearchBase(new QSynedit::SynSearchRegex());
|
mRegexSearchEngine= QSynedit::PSynSearchBase(new QSynedit::RegexSearcher());
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchDialog::~SearchDialog()
|
SearchDialog::~SearchDialog()
|
||||||
|
@ -87,7 +87,7 @@ void SearchDialog::findInFiles(const QString &text)
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, QSynedit::SynSearchOptions options)
|
void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, QSynedit::SearchOptions options)
|
||||||
{
|
{
|
||||||
mTabBar->setCurrentIndex(2);
|
mTabBar->setCurrentIndex(2);
|
||||||
|
|
||||||
|
@ -283,18 +283,18 @@ void SearchDialog::on_btnExecute_clicked()
|
||||||
QMessageBox::Yes|QMessageBox::YesAll|QMessageBox::No|QMessageBox::Cancel,
|
QMessageBox::Yes|QMessageBox::YesAll|QMessageBox::No|QMessageBox::Cancel,
|
||||||
QMessageBox::Yes)) {
|
QMessageBox::Yes)) {
|
||||||
case QMessageBox::Yes:
|
case QMessageBox::Yes:
|
||||||
return QSynedit::SynSearchAction::Replace;
|
return QSynedit::SearchAction::Replace;
|
||||||
case QMessageBox::YesAll:
|
case QMessageBox::YesAll:
|
||||||
return QSynedit::SynSearchAction::ReplaceAll;
|
return QSynedit::SearchAction::ReplaceAll;
|
||||||
case QMessageBox::No:
|
case QMessageBox::No:
|
||||||
return QSynedit::SynSearchAction::Skip;
|
return QSynedit::SearchAction::Skip;
|
||||||
case QMessageBox::Cancel:
|
case QMessageBox::Cancel:
|
||||||
return QSynedit::SynSearchAction::Exit;
|
return QSynedit::SearchAction::Exit;
|
||||||
default:
|
default:
|
||||||
return QSynedit::SynSearchAction::Exit;
|
return QSynedit::SearchAction::Exit;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return QSynedit::SynSearchAction::ReplaceAll;
|
return QSynedit::SearchAction::ReplaceAll;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[](){
|
[](){
|
||||||
|
@ -402,8 +402,8 @@ void SearchDialog::on_btnExecute_clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
int SearchDialog::execute(QSynedit::SynEdit *editor, const QString &sSearch, const QString &sReplace,
|
int SearchDialog::execute(QSynedit::SynEdit *editor, const QString &sSearch, const QString &sReplace,
|
||||||
QSynedit::SynSearchMathedProc matchCallback,
|
QSynedit::SearchMathedProc matchCallback,
|
||||||
QSynedit::SynSearchConfirmAroundProc confirmAroundCallback)
|
QSynedit::SearchConfirmAroundProc confirmAroundCallback)
|
||||||
{
|
{
|
||||||
if (editor==nullptr)
|
if (editor==nullptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -452,7 +452,7 @@ std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(QSynedit::
|
||||||
item->text = e->document()->getString(Line-1);
|
item->text = e->document()->getString(Line-1);
|
||||||
item->text.replace('\t',' ');
|
item->text.replace('\t',' ');
|
||||||
parentItem->results.append(item);
|
parentItem->results.append(item);
|
||||||
return QSynedit::SynSearchAction::Skip;
|
return QSynedit::SearchAction::Skip;
|
||||||
});
|
});
|
||||||
|
|
||||||
// restore
|
// restore
|
||||||
|
|
|
@ -46,7 +46,7 @@ public:
|
||||||
void findNext();
|
void findNext();
|
||||||
void findPrevious();
|
void findPrevious();
|
||||||
void findInFiles(const QString& text);
|
void findInFiles(const QString& text);
|
||||||
void findInFiles(const QString& keyword, SearchFileScope scope, QSynedit::SynSearchOptions options);
|
void findInFiles(const QString& keyword, SearchFileScope scope, QSynedit::SearchOptions options);
|
||||||
void replace(const QString& sFind, const QString& sReplace);
|
void replace(const QString& sFind, const QString& sReplace);
|
||||||
QSynedit::PSynSearchBase searchEngine() const;
|
QSynedit::PSynSearchBase searchEngine() const;
|
||||||
|
|
||||||
|
@ -62,13 +62,13 @@ private slots:
|
||||||
private:
|
private:
|
||||||
int execute(QSynedit::SynEdit* editor, const QString& sSearch,
|
int execute(QSynedit::SynEdit* editor, const QString& sSearch,
|
||||||
const QString& sReplace,
|
const QString& sReplace,
|
||||||
QSynedit::SynSearchMathedProc matchCallback = nullptr,
|
QSynedit::SearchMathedProc matchCallback = nullptr,
|
||||||
QSynedit::SynSearchConfirmAroundProc confirmAroundCallback = nullptr);
|
QSynedit::SearchConfirmAroundProc confirmAroundCallback = nullptr);
|
||||||
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(QSynedit::SynEdit * editor,const QString& filename, const QString& keyword);
|
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(QSynedit::SynEdit * editor,const QString& filename, const QString& keyword);
|
||||||
private:
|
private:
|
||||||
Ui::SearchDialog *ui;
|
Ui::SearchDialog *ui;
|
||||||
QTabBar *mTabBar;
|
QTabBar *mTabBar;
|
||||||
QSynedit::SynSearchOptions mSearchOptions;
|
QSynedit::SearchOptions mSearchOptions;
|
||||||
QSynedit::PSynSearchBase mSearchEngine;
|
QSynedit::PSynSearchBase mSearchEngine;
|
||||||
QSynedit::PSynSearchBase mBasicSearchEngine;
|
QSynedit::PSynSearchBase mBasicSearchEngine;
|
||||||
QSynedit::PSynSearchBase mRegexSearchEngine;
|
QSynedit::PSynSearchBase mRegexSearchEngine;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
#include <QStyledItemDelegate>
|
#include <QStyledItemDelegate>
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
PSearchResults SearchResultModel::addSearchResults(const QString &keyword, QSynedit::SynSearchOptions options, SearchFileScope scope)
|
PSearchResults SearchResultModel::addSearchResults(const QString &keyword, QSynedit::SearchOptions options, SearchFileScope scope)
|
||||||
{
|
{
|
||||||
int index=-1;
|
int index=-1;
|
||||||
for (int i=0;i<mSearchResults.size();i++) {
|
for (int i=0;i<mSearchResults.size();i++) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct SearchResultTreeItem {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SearchResults{
|
struct SearchResults{
|
||||||
QSynedit::SynSearchOptions options;
|
QSynedit::SearchOptions options;
|
||||||
QString keyword;
|
QString keyword;
|
||||||
QString statementFullname;
|
QString statementFullname;
|
||||||
SearchFileScope scope;
|
SearchFileScope scope;
|
||||||
|
@ -61,7 +61,7 @@ class SearchResultModel : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SearchResultModel(QObject* parent=nullptr);
|
explicit SearchResultModel(QObject* parent=nullptr);
|
||||||
PSearchResults addSearchResults(const QString& keyword,QSynedit::SynSearchOptions options,
|
PSearchResults addSearchResults(const QString& keyword,QSynedit::SearchOptions options,
|
||||||
SearchFileScope scope);
|
SearchFileScope scope);
|
||||||
PSearchResults addSearchResults(
|
PSearchResults addSearchResults(
|
||||||
const QString& keyword,
|
const QString& keyword,
|
||||||
|
|
|
@ -20,14 +20,14 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
int SynEditFoldRegions::count()
|
int CodeFoldingDefines::count()
|
||||||
{
|
{
|
||||||
return fRegions.size();
|
return fRegions.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditFoldRegion SynEditFoldRegions::add(bool addEnding, const QChar &openSymbol, const QChar &closeSymbol, const QString &highlight)
|
PCodeFoldingDefine CodeFoldingDefines::add(bool addEnding, const QChar &openSymbol, const QChar &closeSymbol, const QString &highlight)
|
||||||
{
|
{
|
||||||
PSynEditFoldRegion region = std::make_shared<SynEditFoldRegion>();
|
PCodeFoldingDefine region = std::make_shared<CodeFoldingDefine>();
|
||||||
region->addEnding = addEnding;
|
region->addEnding = addEnding;
|
||||||
region->openSymbol = openSymbol;
|
region->openSymbol = openSymbol;
|
||||||
region->closeSymbol = closeSymbol;
|
region->closeSymbol = closeSymbol;
|
||||||
|
@ -36,12 +36,12 @@ PSynEditFoldRegion SynEditFoldRegions::add(bool addEnding, const QChar &openSymb
|
||||||
return region;
|
return region;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditFoldRegion SynEditFoldRegions::get(int index)
|
PCodeFoldingDefine CodeFoldingDefines::get(int index)
|
||||||
{
|
{
|
||||||
return fRegions.at(index);
|
return fRegions.at(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
SynEditCodeFolding::SynEditCodeFolding():
|
CodeFoldingOptions::CodeFoldingOptions():
|
||||||
indentGuides(true),
|
indentGuides(true),
|
||||||
fillIndents(false),
|
fillIndents(false),
|
||||||
showCollapsedLine(true),
|
showCollapsedLine(true),
|
||||||
|
@ -53,9 +53,9 @@ SynEditCodeFolding::SynEditCodeFolding():
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SynEditFoldRange::parentCollapsed()
|
bool CodeFoldingRange::parentCollapsed()
|
||||||
{
|
{
|
||||||
PSynEditFoldRange parentFold = parent;
|
PCodeFoldingRange parentFold = parent;
|
||||||
// Find first parent that is collapsed
|
// Find first parent that is collapsed
|
||||||
while (parentFold) {
|
while (parentFold) {
|
||||||
if (parentFold->collapsed) {
|
if (parentFold->collapsed) {
|
||||||
|
@ -66,13 +66,16 @@ bool SynEditFoldRange::parentCollapsed()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditFoldRange::move(int count)
|
void CodeFoldingRange::move(int count)
|
||||||
{
|
{
|
||||||
fromLine += count;
|
fromLine += count;
|
||||||
toLine += count;
|
toLine += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynEditFoldRange::SynEditFoldRange(PSynEditFoldRange aParent, PSynEditFoldRanges aAllFold, int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine):
|
CodeFoldingRange::CodeFoldingRange(PCodeFoldingRange aParent,
|
||||||
|
PCodeFoldingRanges aAllFold,
|
||||||
|
int aFromLine,
|
||||||
|
PCodeFoldingDefine aFoldRegion, int aToLine):
|
||||||
fromLine(aFromLine),
|
fromLine(aFromLine),
|
||||||
toLine(aToLine),
|
toLine(aToLine),
|
||||||
linesCollapsed(0),
|
linesCollapsed(0),
|
||||||
|
@ -82,37 +85,37 @@ SynEditFoldRange::SynEditFoldRange(PSynEditFoldRange aParent, PSynEditFoldRanges
|
||||||
hintMarkLeft(0),
|
hintMarkLeft(0),
|
||||||
parent(aParent)
|
parent(aParent)
|
||||||
{
|
{
|
||||||
subFoldRanges = std::make_shared<SynEditFoldRanges>();
|
subFoldRanges = std::make_shared<CodeFoldingRanges>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PSynEditFoldRange SynEditFoldRanges::range(int index)
|
PCodeFoldingRange CodeFoldingRanges::range(int index)
|
||||||
{
|
{
|
||||||
return mRanges[index];
|
return mRanges[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditFoldRanges::clear()
|
void CodeFoldingRanges::clear()
|
||||||
{
|
{
|
||||||
mRanges.clear();
|
mRanges.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEditFoldRanges::count() const
|
int CodeFoldingRanges::count() const
|
||||||
{
|
{
|
||||||
return mRanges.size();
|
return mRanges.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
SynEditFoldRanges::SynEditFoldRanges()
|
CodeFoldingRanges::CodeFoldingRanges()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditFoldRange SynEditFoldRanges::addByParts(PSynEditFoldRange aParent,
|
PCodeFoldingRange CodeFoldingRanges::addByParts(PCodeFoldingRange aParent,
|
||||||
PSynEditFoldRanges aAllFold,
|
PCodeFoldingRanges aAllFold,
|
||||||
int aFromLine,
|
int aFromLine,
|
||||||
PSynEditFoldRegion aFoldRegion,
|
PCodeFoldingDefine aFoldRegion,
|
||||||
int aToLine)
|
int aToLine)
|
||||||
{
|
{
|
||||||
PSynEditFoldRange range=std::make_shared<SynEditFoldRange>(aParent,aAllFold, aFromLine,aFoldRegion,aToLine);
|
PCodeFoldingRange range=std::make_shared<CodeFoldingRange>(aParent,aAllFold, aFromLine,aFoldRegion,aToLine);
|
||||||
mRanges.append(range);
|
mRanges.append(range);
|
||||||
if (aAllFold && aAllFold.get()!=this) {
|
if (aAllFold && aAllFold.get()!=this) {
|
||||||
aAllFold->add(range);
|
aAllFold->add(range);
|
||||||
|
@ -120,22 +123,22 @@ PSynEditFoldRange SynEditFoldRanges::addByParts(PSynEditFoldRange aParent,
|
||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditFoldRanges::insert(int index, PSynEditFoldRange range)
|
void CodeFoldingRanges::insert(int index, PCodeFoldingRange range)
|
||||||
{
|
{
|
||||||
mRanges.insert(index,range);
|
mRanges.insert(index,range);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditFoldRanges::remove(int index)
|
void CodeFoldingRanges::remove(int index)
|
||||||
{
|
{
|
||||||
mRanges.remove(index);
|
mRanges.remove(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditFoldRanges::add(PSynEditFoldRange foldRange)
|
void CodeFoldingRanges::add(PCodeFoldingRange foldRange)
|
||||||
{
|
{
|
||||||
mRanges.push_back(foldRange);
|
mRanges.push_back(foldRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditFoldRange SynEditFoldRanges::operator[](int index) const
|
PCodeFoldingRange CodeFoldingRanges::operator[](int index) const
|
||||||
{
|
{
|
||||||
return mRanges[index];
|
return mRanges[index];
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,77 +22,77 @@
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
struct SynEditFoldRegion;
|
struct CodeFoldingDefine;
|
||||||
typedef std::shared_ptr<SynEditFoldRegion> PSynEditFoldRegion;
|
using PCodeFoldingDefine = std::shared_ptr<CodeFoldingDefine> ;
|
||||||
|
|
||||||
class SynEditFoldRegions {
|
class CodeFoldingDefines {
|
||||||
private:
|
private:
|
||||||
std::vector<PSynEditFoldRegion> fRegions;
|
std::vector<PCodeFoldingDefine> fRegions;
|
||||||
public:
|
public:
|
||||||
int count();
|
int count();
|
||||||
PSynEditFoldRegion add(bool addEnding, const QChar& openSymbol, const QChar& closeSymbol, const QString& highlight);
|
PCodeFoldingDefine add(bool addEnding, const QChar& openSymbol, const QChar& closeSymbol, const QString& highlight);
|
||||||
PSynEditFoldRegion get(int index);
|
PCodeFoldingDefine get(int index);
|
||||||
};
|
};
|
||||||
typedef std::shared_ptr<SynEditFoldRegions> PSynFoldRegions;
|
typedef std::shared_ptr<CodeFoldingDefines> PSynFoldRegions;
|
||||||
|
|
||||||
|
|
||||||
struct SynEditFoldRegion {
|
struct CodeFoldingDefine {
|
||||||
bool addEnding;
|
bool addEnding;
|
||||||
SynEditFoldRegions subFoldRegions;
|
CodeFoldingDefines subFoldRegions;
|
||||||
QChar openSymbol;
|
QChar openSymbol;
|
||||||
QChar closeSymbol;
|
QChar closeSymbol;
|
||||||
QString highlight;
|
QString highlight;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SynEditCodeFolding {
|
struct CodeFoldingOptions {
|
||||||
bool indentGuides;
|
bool indentGuides;
|
||||||
bool fillIndents;
|
bool fillIndents;
|
||||||
bool showCollapsedLine;
|
bool showCollapsedLine;
|
||||||
QColor collapsedLineColor;
|
QColor collapsedLineColor;
|
||||||
QColor folderBarLinesColor;
|
QColor folderBarLinesColor;
|
||||||
QColor indentGuidesColor;
|
QColor indentGuidesColor;
|
||||||
SynEditFoldRegions foldRegions;
|
CodeFoldingDefines foldRegions;
|
||||||
SynEditCodeFolding();
|
CodeFoldingOptions();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SynEditFoldRange;
|
class CodeFoldingRange;
|
||||||
typedef std::shared_ptr<SynEditFoldRange> PSynEditFoldRange;
|
typedef std::shared_ptr<CodeFoldingRange> PCodeFoldingRange;
|
||||||
class SynEditFoldRanges;
|
class CodeFoldingRanges;
|
||||||
typedef std::shared_ptr<SynEditFoldRanges> PSynEditFoldRanges;
|
typedef std::shared_ptr<CodeFoldingRanges> PCodeFoldingRanges;
|
||||||
|
|
||||||
class SynEditFoldRanges{
|
class CodeFoldingRanges{
|
||||||
private:
|
private:
|
||||||
QVector<PSynEditFoldRange> mRanges;
|
QVector<PCodeFoldingRange> mRanges;
|
||||||
public:
|
public:
|
||||||
PSynEditFoldRange range(int index);
|
PCodeFoldingRange range(int index);
|
||||||
void clear();
|
void clear();
|
||||||
int count() const;
|
int count() const;
|
||||||
SynEditFoldRanges();
|
CodeFoldingRanges();
|
||||||
PSynEditFoldRange addByParts(PSynEditFoldRange aParent, PSynEditFoldRanges aAllFold,
|
PCodeFoldingRange addByParts(PCodeFoldingRange aParent, PCodeFoldingRanges aAllFold,
|
||||||
int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine);
|
int aFromLine, PCodeFoldingDefine aFoldRegion, int aToLine);
|
||||||
|
|
||||||
void insert(int index, PSynEditFoldRange range);
|
void insert(int index, PCodeFoldingRange range);
|
||||||
void remove(int index);
|
void remove(int index);
|
||||||
void add(PSynEditFoldRange foldRange);
|
void add(PCodeFoldingRange foldRange);
|
||||||
PSynEditFoldRange operator[](int index) const;
|
PCodeFoldingRange operator[](int index) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
// A single fold
|
// A single fold
|
||||||
class SynEditFoldRange {
|
class CodeFoldingRange {
|
||||||
public:
|
public:
|
||||||
int fromLine; // Beginning line
|
int fromLine; // Beginning line
|
||||||
int toLine; // End line
|
int toLine; // End line
|
||||||
int linesCollapsed; // Number of collapsed lines
|
int linesCollapsed; // Number of collapsed lines
|
||||||
PSynEditFoldRanges subFoldRanges; // Sub fold ranges
|
PCodeFoldingRanges subFoldRanges; // Sub fold ranges
|
||||||
bool collapsed; // Is collapsed?
|
bool collapsed; // Is collapsed?
|
||||||
PSynEditFoldRanges allFoldRanges;// TAllFoldRanges pointer
|
PCodeFoldingRanges allFoldRanges;// TAllFoldRanges pointer
|
||||||
PSynEditFoldRegion foldRegion; // FoldRegion
|
PCodeFoldingDefine foldRegion; // FoldRegion
|
||||||
int hintMarkLeft;
|
int hintMarkLeft;
|
||||||
PSynEditFoldRange parent;
|
PCodeFoldingRange parent;
|
||||||
bool parentCollapsed();
|
bool parentCollapsed();
|
||||||
void move(int count);
|
void move(int count);
|
||||||
explicit SynEditFoldRange(PSynEditFoldRange aParent, PSynEditFoldRanges aAllFold,
|
explicit CodeFoldingRange(PCodeFoldingRange aParent, PCodeFoldingRanges aAllFold,
|
||||||
int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine);
|
int aFromLine, PCodeFoldingDefine aFoldRegion, int aToLine);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,12 +17,11 @@
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
const QSet<QChar> SynWordBreakChars{'.', ',', ';', ':',
|
const QSet<QChar> WordBreakChars{'.', ',', ';', ':',
|
||||||
'"', '\'', '!', '?', '[', ']', '(', ')', '{', '}', '^', '-', '=', '+',
|
'"', '\'', '!', '?', '[', ']', '(', ')', '{', '}', '^', '-', '=', '+',
|
||||||
'-', '*', '/', '\\', '|'};
|
'-', '*', '/', '\\', '|'};
|
||||||
const QChar SynTabChar('\t');
|
const QChar TabGlyph(0x2192);
|
||||||
const QChar SynTabGlyph(0x2192);
|
const QChar SpaceGlyph('.');
|
||||||
const QChar SynSpaceGlyph('.');
|
const QChar LineBreakGlyph(0x2193);
|
||||||
const QChar SynLineBreakGlyph(0x2193);
|
const QChar SoftBreakGlyph(0x2193);
|
||||||
const QChar SynSoftBreakGlyph(0x2193);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,12 +21,11 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
extern const QSet<QChar> SynWordBreakChars;
|
extern const QSet<QChar> WordBreakChars;
|
||||||
extern const QChar SynTabChar;
|
extern const QChar SpaceGlyph;
|
||||||
extern const QChar SynSpaceGlyph;
|
extern const QChar TabGlyph;
|
||||||
extern const QChar SynTabGlyph;
|
extern const QChar LineBreakGlyph;
|
||||||
extern const QChar SynLineBreakGlyph;
|
extern const QChar SoftBreakGlyph;
|
||||||
extern const QChar SynSoftBreakGlyph;
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_SCROLL 65535
|
#define MAX_SCROLL 65535
|
||||||
|
|
|
@ -18,16 +18,16 @@
|
||||||
#include "MiscProcs.h"
|
#include "MiscProcs.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
SynEditKeyStroke::SynEditKeyStroke()
|
EditKeyStroke::EditKeyStroke()
|
||||||
{
|
{
|
||||||
mKey = 0;
|
mKey = 0;
|
||||||
mKeyModifiers = Qt::NoModifier;
|
mKeyModifiers = Qt::NoModifier;
|
||||||
mKey2 = 0;
|
mKey2 = 0;
|
||||||
mKeyModifiers2 = Qt::NoModifier;
|
mKeyModifiers2 = Qt::NoModifier;
|
||||||
mCommand = SynEditorCommand::ecNone;
|
mCommand = EditCommand::ecNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeySequence SynEditKeyStroke::keySequence() const
|
QKeySequence EditKeyStroke::keySequence() const
|
||||||
{
|
{
|
||||||
if (mKey2 == 0) {
|
if (mKey2 == 0) {
|
||||||
return QKeySequence(mKey + mKeyModifiers);
|
return QKeySequence(mKey + mKeyModifiers);
|
||||||
|
@ -36,7 +36,7 @@ QKeySequence SynEditKeyStroke::keySequence() const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStroke::setKeySequence(QKeySequence &keySequence)
|
void EditKeyStroke::setKeySequence(QKeySequence &keySequence)
|
||||||
{
|
{
|
||||||
if (keySequence.isEmpty())
|
if (keySequence.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -49,64 +49,64 @@ void SynEditKeyStroke::setKeySequence(QKeySequence &keySequence)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEditKeyStroke::key() const
|
int EditKeyStroke::key() const
|
||||||
{
|
{
|
||||||
return mKey;
|
return mKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStroke::setKey(int key)
|
void EditKeyStroke::setKey(int key)
|
||||||
{
|
{
|
||||||
mKey = key;
|
mKey = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::KeyboardModifiers SynEditKeyStroke::keyModifiers() const
|
Qt::KeyboardModifiers EditKeyStroke::keyModifiers() const
|
||||||
{
|
{
|
||||||
return mKeyModifiers;
|
return mKeyModifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStroke::setKeyModifiers(const Qt::KeyboardModifiers &keyModifiers)
|
void EditKeyStroke::setKeyModifiers(const Qt::KeyboardModifiers &keyModifiers)
|
||||||
{
|
{
|
||||||
mKeyModifiers = keyModifiers;
|
mKeyModifiers = keyModifiers;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEditKeyStroke::key2() const
|
int EditKeyStroke::key2() const
|
||||||
{
|
{
|
||||||
return mKey2;
|
return mKey2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStroke::setKey2(int key2)
|
void EditKeyStroke::setKey2(int key2)
|
||||||
{
|
{
|
||||||
mKey2 = key2;
|
mKey2 = key2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt::KeyboardModifiers SynEditKeyStroke::keyModifiers2() const
|
Qt::KeyboardModifiers EditKeyStroke::keyModifiers2() const
|
||||||
{
|
{
|
||||||
return mKeyModifiers2;
|
return mKeyModifiers2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStroke::setKeyModifiers2(const Qt::KeyboardModifiers &keyModifiers2)
|
void EditKeyStroke::setKeyModifiers2(const Qt::KeyboardModifiers &keyModifiers2)
|
||||||
{
|
{
|
||||||
mKeyModifiers2 = keyModifiers2;
|
mKeyModifiers2 = keyModifiers2;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynEditorCommand SynEditKeyStroke::command() const
|
EditCommand EditKeyStroke::command() const
|
||||||
{
|
{
|
||||||
return mCommand;
|
return mCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStroke::setCommand(const SynEditorCommand &command)
|
void EditKeyStroke::setCommand(const EditCommand &command)
|
||||||
{
|
{
|
||||||
mCommand = command;
|
mCommand = command;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynKeyError::SynKeyError(const QString &reason):BaseError(reason)
|
KeyError::KeyError(const QString &reason):BaseError(reason)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditKeyStroke SynEditKeyStrokes::add(SynEditorCommand command, int key, Qt::KeyboardModifiers modifiers)
|
PEditKeyStroke EditKeyStrokes::add(EditCommand command, int key, Qt::KeyboardModifiers modifiers)
|
||||||
{
|
{
|
||||||
PSynEditKeyStroke keyStroke = std::make_shared<SynEditKeyStroke>();
|
PEditKeyStroke keyStroke = std::make_shared<EditKeyStroke>();
|
||||||
keyStroke->setKey(key);
|
keyStroke->setKey(key);
|
||||||
keyStroke->setKeyModifiers(modifiers);
|
keyStroke->setKeyModifiers(modifiers);
|
||||||
keyStroke->setCommand(command);
|
keyStroke->setCommand(command);
|
||||||
|
@ -114,40 +114,40 @@ PSynEditKeyStroke SynEditKeyStrokes::add(SynEditorCommand command, int key, Qt::
|
||||||
return keyStroke;
|
return keyStroke;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditKeyStroke SynEditKeyStrokes::findCommand(SynEditorCommand command)
|
PEditKeyStroke EditKeyStrokes::findCommand(EditCommand command)
|
||||||
{
|
{
|
||||||
for (PSynEditKeyStroke& keyStroke:mList) {
|
for (PEditKeyStroke& keyStroke:mList) {
|
||||||
if (keyStroke->command() == command)
|
if (keyStroke->command() == command)
|
||||||
return keyStroke;
|
return keyStroke;
|
||||||
}
|
}
|
||||||
return PSynEditKeyStroke();
|
return PEditKeyStroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditKeyStroke SynEditKeyStrokes::findKeycode(int key, Qt::KeyboardModifiers modifiers)
|
PEditKeyStroke EditKeyStrokes::findKeycode(int key, Qt::KeyboardModifiers modifiers)
|
||||||
{
|
{
|
||||||
for (PSynEditKeyStroke& keyStroke:mList) {
|
for (PEditKeyStroke& keyStroke:mList) {
|
||||||
if (keyStroke->key() == key
|
if (keyStroke->key() == key
|
||||||
&& keyStroke->keyModifiers() == (modifiers & ~ Qt::KeypadModifier)
|
&& keyStroke->keyModifiers() == (modifiers & ~ Qt::KeypadModifier)
|
||||||
&& keyStroke->key2()==0)
|
&& keyStroke->key2()==0)
|
||||||
return keyStroke;
|
return keyStroke;
|
||||||
}
|
}
|
||||||
return PSynEditKeyStroke();
|
return PEditKeyStroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditKeyStroke SynEditKeyStrokes::findKeycode2(int key, Qt::KeyboardModifiers modifiers,
|
PEditKeyStroke EditKeyStrokes::findKeycode2(int key, Qt::KeyboardModifiers modifiers,
|
||||||
int key2, Qt::KeyboardModifiers modifiers2)
|
int key2, Qt::KeyboardModifiers modifiers2)
|
||||||
{
|
{
|
||||||
for (PSynEditKeyStroke& keyStroke:mList) {
|
for (PEditKeyStroke& keyStroke:mList) {
|
||||||
if (keyStroke->key() == key
|
if (keyStroke->key() == key
|
||||||
&& keyStroke->keyModifiers()==(modifiers & ~ Qt::KeypadModifier)
|
&& keyStroke->keyModifiers()==(modifiers & ~ Qt::KeypadModifier)
|
||||||
&& keyStroke->key2()==key2
|
&& keyStroke->key2()==key2
|
||||||
&& keyStroke->keyModifiers2()== (modifiers2 & ~ Qt::KeypadModifier))
|
&& keyStroke->keyModifiers2()== (modifiers2 & ~ Qt::KeypadModifier))
|
||||||
return keyStroke;
|
return keyStroke;
|
||||||
}
|
}
|
||||||
return PSynEditKeyStroke();
|
return PEditKeyStroke();
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynEditKeyStroke SynEditKeyStrokes::findKeySequence(const QKeySequence &keySeq)
|
PEditKeyStroke EditKeyStrokes::findKeySequence(const QKeySequence &keySeq)
|
||||||
{
|
{
|
||||||
switch (keySeq.count()) {
|
switch (keySeq.count()) {
|
||||||
case 1: {
|
case 1: {
|
||||||
|
@ -169,75 +169,75 @@ PSynEditKeyStroke SynEditKeyStrokes::findKeySequence(const QKeySequence &keySeq)
|
||||||
return findKeycode2(key,modifiers,key2,modifiers2);
|
return findKeycode2(key,modifiers,key2,modifiers2);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return PSynEditKeyStroke();
|
return PEditKeyStroke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStrokes::clear()
|
void EditKeyStrokes::clear()
|
||||||
{
|
{
|
||||||
return mList.clear();
|
return mList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStrokes::resetDefaults()
|
void EditKeyStrokes::resetDefaults()
|
||||||
{
|
{
|
||||||
clear();
|
clear();
|
||||||
add(SynEditorCommand::ecUp, Qt::Key_Up, Qt::NoModifier);
|
add(EditCommand::ecUp, Qt::Key_Up, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelUp, Qt::Key_Up, Qt::ShiftModifier);
|
add(EditCommand::ecSelUp, Qt::Key_Up, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecSelUp, Qt::Key_Up, Qt::ShiftModifier | Qt::AltModifier);
|
add(EditCommand::ecSelUp, Qt::Key_Up, Qt::ShiftModifier | Qt::AltModifier);
|
||||||
add(SynEditorCommand::ecScrollUp, Qt::Key_Up, Qt::ControlModifier);
|
add(EditCommand::ecScrollUp, Qt::Key_Up, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecDown, Qt::Key_Down, Qt::NoModifier);
|
add(EditCommand::ecDown, Qt::Key_Down, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelDown, Qt::Key_Down, Qt::ShiftModifier);
|
add(EditCommand::ecSelDown, Qt::Key_Down, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecSelDown, Qt::Key_Down, Qt::ShiftModifier | Qt::AltModifier);
|
add(EditCommand::ecSelDown, Qt::Key_Down, Qt::ShiftModifier | Qt::AltModifier);
|
||||||
add(SynEditorCommand::ecScrollDown, Qt::Key_Down, Qt::ControlModifier);
|
add(EditCommand::ecScrollDown, Qt::Key_Down, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecLeft, Qt::Key_Left, Qt::NoModifier);
|
add(EditCommand::ecLeft, Qt::Key_Left, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelLeft, Qt::Key_Left, Qt::ShiftModifier);
|
add(EditCommand::ecSelLeft, Qt::Key_Left, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecWordLeft, Qt::Key_Left, Qt::ControlModifier);
|
add(EditCommand::ecWordLeft, Qt::Key_Left, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecSelWordLeft, Qt::Key_Left, Qt::ShiftModifier|Qt::ControlModifier);
|
add(EditCommand::ecSelWordLeft, Qt::Key_Left, Qt::ShiftModifier|Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecRight, Qt::Key_Right, Qt::NoModifier);
|
add(EditCommand::ecRight, Qt::Key_Right, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelRight, Qt::Key_Right, Qt::ShiftModifier);
|
add(EditCommand::ecSelRight, Qt::Key_Right, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecWordRight, Qt::Key_Right, Qt::ControlModifier);
|
add(EditCommand::ecWordRight, Qt::Key_Right, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecSelWordRight, Qt::Key_Right, Qt::ShiftModifier|Qt::ControlModifier);
|
add(EditCommand::ecSelWordRight, Qt::Key_Right, Qt::ShiftModifier|Qt::ControlModifier);
|
||||||
|
|
||||||
// add(SynEditorCommand::ecExpandSelection, Qt::Key_Right, Qt::ShiftModifier|Qt::AltModifier);
|
// add(SynEditorCommand::ecExpandSelection, Qt::Key_Right, Qt::ShiftModifier|Qt::AltModifier);
|
||||||
// add(SynEditorCommand::ecShrinkSelection, Qt::Key_Left, Qt::ShiftModifier | Qt::AltModifier);
|
// add(SynEditorCommand::ecShrinkSelection, Qt::Key_Left, Qt::ShiftModifier | Qt::AltModifier);
|
||||||
|
|
||||||
add(SynEditorCommand::ecPageDown, Qt::Key_PageDown, Qt::NoModifier);
|
add(EditCommand::ecPageDown, Qt::Key_PageDown, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelPageDown, Qt::Key_PageDown, Qt::ShiftModifier);
|
add(EditCommand::ecSelPageDown, Qt::Key_PageDown, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecPageBottom, Qt::Key_PageDown, Qt::ControlModifier);
|
add(EditCommand::ecPageBottom, Qt::Key_PageDown, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecSelPageBottom, Qt::Key_PageDown, Qt::ShiftModifier|Qt::ControlModifier);
|
add(EditCommand::ecSelPageBottom, Qt::Key_PageDown, Qt::ShiftModifier|Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecPageUp, Qt::Key_PageUp, Qt::NoModifier);
|
add(EditCommand::ecPageUp, Qt::Key_PageUp, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelPageUp, Qt::Key_PageUp, Qt::ShiftModifier);
|
add(EditCommand::ecSelPageUp, Qt::Key_PageUp, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecPageTop, Qt::Key_PageUp, Qt::ControlModifier);
|
add(EditCommand::ecPageTop, Qt::Key_PageUp, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecSelPageTop, Qt::Key_PageUp, Qt::ShiftModifier|Qt::ControlModifier);
|
add(EditCommand::ecSelPageTop, Qt::Key_PageUp, Qt::ShiftModifier|Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecLineStart, Qt::Key_Home, Qt::NoModifier);
|
add(EditCommand::ecLineStart, Qt::Key_Home, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelLineStart, Qt::Key_Home, Qt::ShiftModifier);
|
add(EditCommand::ecSelLineStart, Qt::Key_Home, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecEditorStart, Qt::Key_Home, Qt::ControlModifier);
|
add(EditCommand::ecEditorStart, Qt::Key_Home, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecSelEditorStart, Qt::Key_Home, Qt::ShiftModifier|Qt::ControlModifier);
|
add(EditCommand::ecSelEditorStart, Qt::Key_Home, Qt::ShiftModifier|Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecLineEnd, Qt::Key_End, Qt::NoModifier);
|
add(EditCommand::ecLineEnd, Qt::Key_End, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecSelLineEnd, Qt::Key_End, Qt::ShiftModifier);
|
add(EditCommand::ecSelLineEnd, Qt::Key_End, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecEditorEnd, Qt::Key_End, Qt::ControlModifier);
|
add(EditCommand::ecEditorEnd, Qt::Key_End, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecSelEditorEnd, Qt::Key_End, Qt::ShiftModifier|Qt::ControlModifier);
|
add(EditCommand::ecSelEditorEnd, Qt::Key_End, Qt::ShiftModifier|Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecToggleMode, Qt::Key_Insert, Qt::NoModifier);
|
add(EditCommand::ecToggleMode, Qt::Key_Insert, Qt::NoModifier);
|
||||||
// add(SynEditorCommand::ecCopy, Qt::Key_Insert, Qt::ControlModifier);
|
// add(SynEditorCommand::ecCopy, Qt::Key_Insert, Qt::ControlModifier);
|
||||||
// add(SynEditorCommand::ecCut, Qt::Key_Delete, Qt::ShiftModifier);
|
// add(SynEditorCommand::ecCut, Qt::Key_Delete, Qt::ShiftModifier);
|
||||||
// add(SynEditorCommand::ecPaste, Qt::Key_Insert, Qt::ShiftModifier);
|
// add(SynEditorCommand::ecPaste, Qt::Key_Insert, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecDeleteChar, Qt::Key_Delete, Qt::NoModifier);
|
add(EditCommand::ecDeleteChar, Qt::Key_Delete, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecDeleteLastChar, Qt::Key_Backspace, Qt::NoModifier);
|
add(EditCommand::ecDeleteLastChar, Qt::Key_Backspace, Qt::NoModifier);
|
||||||
// add(SynEditorCommand::ecDeleteLastChar, Qt::Key_Backspace, Qt::ShiftModifier);
|
// add(SynEditorCommand::ecDeleteLastChar, Qt::Key_Backspace, Qt::ShiftModifier);
|
||||||
// add(SynEditorCommand::ecDeleteWordStart, Qt::Key_Backspace, Qt::ControlModifier);
|
// add(SynEditorCommand::ecDeleteWordStart, Qt::Key_Backspace, Qt::ControlModifier);
|
||||||
// add(SynEditorCommand::ecDeleteWordEnd, Qt::Key_Delete, Qt::ControlModifier);
|
// add(SynEditorCommand::ecDeleteWordEnd, Qt::Key_Delete, Qt::ControlModifier);
|
||||||
// add(SynEditorCommand::ecUndo, Qt::Key_Backspace, Qt::AltModifier);
|
// add(SynEditorCommand::ecUndo, Qt::Key_Backspace, Qt::AltModifier);
|
||||||
// add(SynEditorCommand::ecRedo, Qt::Key_Backspace, Qt::AltModifier|Qt::ShiftModifier);
|
// add(SynEditorCommand::ecRedo, Qt::Key_Backspace, Qt::AltModifier|Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecLineBreak, Qt::Key_Return, Qt::NoModifier);
|
add(EditCommand::ecLineBreak, Qt::Key_Return, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecLineBreak, Qt::Key_Return, Qt::ShiftModifier);
|
add(EditCommand::ecLineBreak, Qt::Key_Return, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecLineBreakAtEnd, Qt::Key_Return, Qt::ControlModifier);
|
add(EditCommand::ecLineBreakAtEnd, Qt::Key_Return, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecLineBreak, Qt::Key_Enter, Qt::NoModifier);
|
add(EditCommand::ecLineBreak, Qt::Key_Enter, Qt::NoModifier);
|
||||||
add(SynEditorCommand::ecLineBreak, Qt::Key_Enter, Qt::ShiftModifier);
|
add(EditCommand::ecLineBreak, Qt::Key_Enter, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecLineBreakAtEnd, Qt::Key_Enter, Qt::ControlModifier);
|
add(EditCommand::ecLineBreakAtEnd, Qt::Key_Enter, Qt::ControlModifier);
|
||||||
// add(SynEditorCommand::ecTab, Qt::Key_Tab, Qt::NoModifier);
|
// add(SynEditorCommand::ecTab, Qt::Key_Tab, Qt::NoModifier);
|
||||||
// add(SynEditorCommand::ecShiftTab, Qt::Key_Backtab, Qt::ShiftModifier);
|
// add(SynEditorCommand::ecShiftTab, Qt::Key_Backtab, Qt::ShiftModifier);
|
||||||
// add(SynEditorCommand::ecShiftTab, Qt::Key_Tab, Qt::ShiftModifier);
|
// add(SynEditorCommand::ecShiftTab, Qt::Key_Tab, Qt::ShiftModifier);
|
||||||
add(SynEditorCommand::ecContextHelp, Qt::Key_F1, Qt::NoModifier);
|
add(EditCommand::ecContextHelp, Qt::Key_F1, Qt::NoModifier);
|
||||||
|
|
||||||
// add(SynEditorCommand::ecSelectAll, Qt::Key_A, Qt::ControlModifier);
|
// add(SynEditorCommand::ecSelectAll, Qt::Key_A, Qt::ControlModifier);
|
||||||
// add(SynEditorCommand::ecCopy, Qt::Key_C, Qt::ControlModifier);
|
// add(SynEditorCommand::ecCopy, Qt::Key_C, Qt::ControlModifier);
|
||||||
|
@ -260,21 +260,21 @@ void SynEditKeyStrokes::resetDefaults()
|
||||||
// add(SynEditorCommand::ecMatchBracket, Qt::Key_B, Qt::ControlModifier | Qt::ShiftModifier);
|
// add(SynEditorCommand::ecMatchBracket, Qt::Key_B, Qt::ControlModifier | Qt::ShiftModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditKeyStrokes::setExtraKeyStrokes()
|
void EditKeyStrokes::setExtraKeyStrokes()
|
||||||
{
|
{
|
||||||
add(SynEditorCommand::ecDeleteWordStart, Qt::Key_Backspace, Qt::ControlModifier);
|
add(EditCommand::ecDeleteWordStart, Qt::Key_Backspace, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecDeleteWordEnd, Qt::Key_Delete, Qt::ControlModifier);
|
add(EditCommand::ecDeleteWordEnd, Qt::Key_Delete, Qt::ControlModifier);
|
||||||
|
|
||||||
add(SynEditorCommand::ecDuplicateLine, Qt::Key_D, Qt::ControlModifier);
|
add(EditCommand::ecDuplicateLine, Qt::Key_D, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecDeleteLine, Qt::Key_E, Qt::ControlModifier);
|
add(EditCommand::ecDeleteLine, Qt::Key_E, Qt::ControlModifier);
|
||||||
|
|
||||||
add(SynEditorCommand::ecSelectAll, Qt::Key_A, Qt::ControlModifier);
|
add(EditCommand::ecSelectAll, Qt::Key_A, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecCopy, Qt::Key_C, Qt::ControlModifier);
|
add(EditCommand::ecCopy, Qt::Key_C, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecPaste, Qt::Key_V, Qt::ControlModifier);
|
add(EditCommand::ecPaste, Qt::Key_V, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecCut, Qt::Key_X, Qt::ControlModifier);
|
add(EditCommand::ecCut, Qt::Key_X, Qt::ControlModifier);
|
||||||
|
|
||||||
add(SynEditorCommand::ecUndo, Qt::Key_Z, Qt::ControlModifier);
|
add(EditCommand::ecUndo, Qt::Key_Z, Qt::ControlModifier);
|
||||||
add(SynEditorCommand::ecRedo, Qt::Key_Y, Qt::ControlModifier);
|
add(EditCommand::ecRedo, Qt::Key_Y, Qt::ControlModifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ namespace QSynedit {
|
||||||
// valid, while the ecEditXXX commands are ignored when the editor is in
|
// valid, while the ecEditXXX commands are ignored when the editor is in
|
||||||
// read-only mode
|
// read-only mode
|
||||||
|
|
||||||
enum class SynEditorCommand {
|
enum class EditCommand {
|
||||||
ecNone = 0, // Nothing. Useful for user event to handle command
|
ecNone = 0, // Nothing. Useful for user event to handle command
|
||||||
ecViewCommandFirst = 0,
|
ecViewCommandFirst = 0,
|
||||||
ecViewCommandLast = 500,
|
ecViewCommandLast = 500,
|
||||||
|
@ -175,15 +175,15 @@ enum class SynEditorCommand {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class SynKeyError: public BaseError {
|
class KeyError: public BaseError {
|
||||||
public:
|
public:
|
||||||
explicit SynKeyError(const QString& reason);
|
explicit KeyError(const QString& reason);
|
||||||
};
|
};
|
||||||
|
|
||||||
class SynEditKeyStroke
|
class EditKeyStroke
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SynEditKeyStroke();
|
explicit EditKeyStroke();
|
||||||
QKeySequence keySequence() const;
|
QKeySequence keySequence() const;
|
||||||
void setKeySequence(QKeySequence& keySequence);
|
void setKeySequence(QKeySequence& keySequence);
|
||||||
int key() const;
|
int key() const;
|
||||||
|
@ -198,34 +198,34 @@ public:
|
||||||
Qt::KeyboardModifiers keyModifiers2() const;
|
Qt::KeyboardModifiers keyModifiers2() const;
|
||||||
void setKeyModifiers2(const Qt::KeyboardModifiers &keyModifiers2);
|
void setKeyModifiers2(const Qt::KeyboardModifiers &keyModifiers2);
|
||||||
|
|
||||||
SynEditorCommand command() const;
|
EditCommand command() const;
|
||||||
void setCommand(const SynEditorCommand &command);
|
void setCommand(const EditCommand &command);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int mKey; // Virtual keycode, i.e. VK_xxx
|
int mKey; // Virtual keycode, i.e. VK_xxx
|
||||||
Qt::KeyboardModifiers mKeyModifiers;
|
Qt::KeyboardModifiers mKeyModifiers;
|
||||||
int mKey2;
|
int mKey2;
|
||||||
Qt::KeyboardModifiers mKeyModifiers2;
|
Qt::KeyboardModifiers mKeyModifiers2;
|
||||||
SynEditorCommand mCommand;
|
EditCommand mCommand;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
using PSynEditKeyStroke = std::shared_ptr<SynEditKeyStroke>;
|
using PEditKeyStroke = std::shared_ptr<EditKeyStroke>;
|
||||||
using SynEditKeyStrokeList = QList<PSynEditKeyStroke>;
|
using EditKeyStrokeList = QList<PEditKeyStroke>;
|
||||||
|
|
||||||
class SynEditKeyStrokes {
|
class EditKeyStrokes {
|
||||||
public:
|
public:
|
||||||
PSynEditKeyStroke add(SynEditorCommand command, int key, Qt::KeyboardModifiers modifiers);
|
PEditKeyStroke add(EditCommand command, int key, Qt::KeyboardModifiers modifiers);
|
||||||
PSynEditKeyStroke findCommand(SynEditorCommand command);
|
PEditKeyStroke findCommand(EditCommand command);
|
||||||
PSynEditKeyStroke findKeycode(int key, Qt::KeyboardModifiers modifiers);
|
PEditKeyStroke findKeycode(int key, Qt::KeyboardModifiers modifiers);
|
||||||
PSynEditKeyStroke findKeycode2(int key, Qt::KeyboardModifiers modifiers,
|
PEditKeyStroke findKeycode2(int key, Qt::KeyboardModifiers modifiers,
|
||||||
int key2, Qt::KeyboardModifiers modifiers2);
|
int key2, Qt::KeyboardModifiers modifiers2);
|
||||||
PSynEditKeyStroke findKeySequence(const QKeySequence& keySeq);
|
PEditKeyStroke findKeySequence(const QKeySequence& keySeq);
|
||||||
void clear();
|
void clear();
|
||||||
void resetDefaults();
|
void resetDefaults();
|
||||||
void setExtraKeyStrokes();
|
void setExtraKeyStrokes();
|
||||||
private:
|
private:
|
||||||
SynEditKeyStrokeList mList;
|
EditKeyStrokeList mList;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynGutter::SynGutter(QObject *parent):
|
Gutter::Gutter(QObject *parent):
|
||||||
QObject(parent)
|
QObject(parent)
|
||||||
{
|
{
|
||||||
mFont = QFont("Courier New",10);
|
mFont = QFont("Courier New",10);
|
||||||
|
@ -35,7 +35,7 @@ SynGutter::SynGutter(QObject *parent):
|
||||||
mUseFontStyle = true;
|
mUseFontStyle = true;
|
||||||
mAutoSize = true;
|
mAutoSize = true;
|
||||||
mAutoSizeDigitCount = mDigitCount;
|
mAutoSizeDigitCount = mDigitCount;
|
||||||
mBorderStyle = SynGutterBorderStyle::Middle;
|
mBorderStyle = GutterBorderStyle::Middle;
|
||||||
mLineNumberStart = 1;
|
mLineNumberStart = 1;
|
||||||
mGradient = false;
|
mGradient = false;
|
||||||
mGradientStartColor = Qt::transparent;
|
mGradientStartColor = Qt::transparent;
|
||||||
|
@ -43,12 +43,12 @@ SynGutter::SynGutter(QObject *parent):
|
||||||
mGradientSteps = 48;
|
mGradientSteps = 48;
|
||||||
}
|
}
|
||||||
|
|
||||||
QFont SynGutter::font() const
|
QFont Gutter::font() const
|
||||||
{
|
{
|
||||||
return mFont;
|
return mFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setFont(const QFont &font)
|
void Gutter::setFont(const QFont &font)
|
||||||
{
|
{
|
||||||
if (mFont != font) {
|
if (mFont != font) {
|
||||||
mFont = font;
|
mFont = font;
|
||||||
|
@ -56,12 +56,12 @@ void SynGutter::setFont(const QFont &font)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynGutter::autoSize() const
|
bool Gutter::autoSize() const
|
||||||
{
|
{
|
||||||
return mAutoSize;
|
return mAutoSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setAutoSize(bool value)
|
void Gutter::setAutoSize(bool value)
|
||||||
{
|
{
|
||||||
if (mAutoSize != value) {
|
if (mAutoSize != value) {
|
||||||
mAutoSize = value;
|
mAutoSize = value;
|
||||||
|
@ -69,27 +69,27 @@ void SynGutter::setAutoSize(bool value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setChanged()
|
void Gutter::setChanged()
|
||||||
{
|
{
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
const QColor &SynGutter::activeLineTextColor() const
|
const QColor &Gutter::activeLineTextColor() const
|
||||||
{
|
{
|
||||||
return mActiveLineTextColor;
|
return mActiveLineTextColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setActiveLineTextColor(const QColor &newActiveLineTextColor)
|
void Gutter::setActiveLineTextColor(const QColor &newActiveLineTextColor)
|
||||||
{
|
{
|
||||||
mActiveLineTextColor = newActiveLineTextColor;
|
mActiveLineTextColor = newActiveLineTextColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SynGutter::textColor() const
|
QColor Gutter::textColor() const
|
||||||
{
|
{
|
||||||
return mTextColor;
|
return mTextColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setTextColor(const QColor &value)
|
void Gutter::setTextColor(const QColor &value)
|
||||||
{
|
{
|
||||||
if (mTextColor!=value) {
|
if (mTextColor!=value) {
|
||||||
mTextColor = value;
|
mTextColor = value;
|
||||||
|
@ -97,7 +97,7 @@ void SynGutter::setTextColor(const QColor &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::autoSizeDigitCount(int linesCount)
|
void Gutter::autoSizeDigitCount(int linesCount)
|
||||||
{
|
{
|
||||||
if (mVisible && mAutoSize && mShowLineNumbers) {
|
if (mVisible && mAutoSize && mShowLineNumbers) {
|
||||||
linesCount += (mLineNumberStart - 1);
|
linesCount += (mLineNumberStart - 1);
|
||||||
|
@ -109,7 +109,7 @@ void SynGutter::autoSizeDigitCount(int linesCount)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynGutter::formatLineNumber(int line)
|
QString Gutter::formatLineNumber(int line)
|
||||||
{
|
{
|
||||||
line += (mLineNumberStart - 1);
|
line += (mLineNumberStart - 1);
|
||||||
QString result = QString::number(line);
|
QString result = QString::number(line);
|
||||||
|
@ -120,7 +120,7 @@ QString SynGutter::formatLineNumber(int line)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynGutter::realGutterWidth(int charWidth)
|
int Gutter::realGutterWidth(int charWidth)
|
||||||
{
|
{
|
||||||
if (!mVisible) {
|
if (!mVisible) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -131,12 +131,12 @@ int SynGutter::realGutterWidth(int charWidth)
|
||||||
return mLeftOffset + mRightOffset;
|
return mLeftOffset + mRightOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynGutter::visible() const
|
bool Gutter::visible() const
|
||||||
{
|
{
|
||||||
return mVisible;
|
return mVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setVisible(bool visible)
|
void Gutter::setVisible(bool visible)
|
||||||
{
|
{
|
||||||
if (mVisible!=visible) {
|
if (mVisible!=visible) {
|
||||||
mVisible = visible;
|
mVisible = visible;
|
||||||
|
@ -144,12 +144,12 @@ void SynGutter::setVisible(bool visible)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynGutter::useFontStyle() const
|
bool Gutter::useFontStyle() const
|
||||||
{
|
{
|
||||||
return mUseFontStyle;
|
return mUseFontStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setUseFontStyle(bool useFontStyle)
|
void Gutter::setUseFontStyle(bool useFontStyle)
|
||||||
{
|
{
|
||||||
if (mUseFontStyle!=useFontStyle) {
|
if (mUseFontStyle!=useFontStyle) {
|
||||||
mUseFontStyle = useFontStyle;
|
mUseFontStyle = useFontStyle;
|
||||||
|
@ -157,12 +157,12 @@ void SynGutter::setUseFontStyle(bool useFontStyle)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynGutter::showLineNumbers() const
|
bool Gutter::showLineNumbers() const
|
||||||
{
|
{
|
||||||
return mShowLineNumbers;
|
return mShowLineNumbers;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setShowLineNumbers(bool showLineNumbers)
|
void Gutter::setShowLineNumbers(bool showLineNumbers)
|
||||||
{
|
{
|
||||||
if (mShowLineNumbers!=showLineNumbers) {
|
if (mShowLineNumbers!=showLineNumbers) {
|
||||||
mShowLineNumbers = showLineNumbers;
|
mShowLineNumbers = showLineNumbers;
|
||||||
|
@ -170,12 +170,12 @@ void SynGutter::setShowLineNumbers(bool showLineNumbers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynGutter::rightOffset() const
|
int Gutter::rightOffset() const
|
||||||
{
|
{
|
||||||
return mRightOffset;
|
return mRightOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setRightOffset(int rightOffset)
|
void Gutter::setRightOffset(int rightOffset)
|
||||||
{
|
{
|
||||||
int value = std::max(0, rightOffset);
|
int value = std::max(0, rightOffset);
|
||||||
if (mRightOffset != value) {
|
if (mRightOffset != value) {
|
||||||
|
@ -184,12 +184,12 @@ void SynGutter::setRightOffset(int rightOffset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynGutter::lineNumberStart() const
|
int Gutter::lineNumberStart() const
|
||||||
{
|
{
|
||||||
return mLineNumberStart;
|
return mLineNumberStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setLineNumberStart(int lineNumberStart)
|
void Gutter::setLineNumberStart(int lineNumberStart)
|
||||||
{
|
{
|
||||||
int value = std::max(0,lineNumberStart);
|
int value = std::max(0,lineNumberStart);
|
||||||
if (mLineNumberStart!=value) {
|
if (mLineNumberStart!=value) {
|
||||||
|
@ -198,17 +198,17 @@ void SynGutter::setLineNumberStart(int lineNumberStart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynGutter::zeroStart()
|
bool Gutter::zeroStart()
|
||||||
{
|
{
|
||||||
return mLineNumberStart == 0;
|
return mLineNumberStart == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynGutter::leftOffset() const
|
int Gutter::leftOffset() const
|
||||||
{
|
{
|
||||||
return mLeftOffset;
|
return mLeftOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setLeftOffset(int leftOffset)
|
void Gutter::setLeftOffset(int leftOffset)
|
||||||
{
|
{
|
||||||
int value = std::max(0,leftOffset);
|
int value = std::max(0,leftOffset);
|
||||||
if (mLeftOffset != value) {
|
if (mLeftOffset != value) {
|
||||||
|
@ -217,12 +217,12 @@ void SynGutter::setLeftOffset(int leftOffset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynGutter::leadingZeros() const
|
bool Gutter::leadingZeros() const
|
||||||
{
|
{
|
||||||
return mLeadingZeros;
|
return mLeadingZeros;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setLeadingZeros(bool value)
|
void Gutter::setLeadingZeros(bool value)
|
||||||
{
|
{
|
||||||
if (mLeadingZeros!=value) {
|
if (mLeadingZeros!=value) {
|
||||||
mLeadingZeros = value;
|
mLeadingZeros = value;
|
||||||
|
@ -230,12 +230,12 @@ void SynGutter::setLeadingZeros(bool value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynGutter::gradientSteps() const
|
int Gutter::gradientSteps() const
|
||||||
{
|
{
|
||||||
return mGradientSteps;
|
return mGradientSteps;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setGradientSteps(int value)
|
void Gutter::setGradientSteps(int value)
|
||||||
{
|
{
|
||||||
if (mGradientSteps!=value) {
|
if (mGradientSteps!=value) {
|
||||||
mGradientSteps = value;
|
mGradientSteps = value;
|
||||||
|
@ -245,12 +245,12 @@ void SynGutter::setGradientSteps(int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SynGutter::gradientEndColor() const
|
QColor Gutter::gradientEndColor() const
|
||||||
{
|
{
|
||||||
return mGradientEndColor;
|
return mGradientEndColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setGradientEndColor(const QColor &value)
|
void Gutter::setGradientEndColor(const QColor &value)
|
||||||
{
|
{
|
||||||
if (mGradientEndColor!=value) {
|
if (mGradientEndColor!=value) {
|
||||||
mGradientEndColor = value;
|
mGradientEndColor = value;
|
||||||
|
@ -258,12 +258,12 @@ void SynGutter::setGradientEndColor(const QColor &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SynGutter::gradientStartColor() const
|
QColor Gutter::gradientStartColor() const
|
||||||
{
|
{
|
||||||
return mGradientStartColor;
|
return mGradientStartColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setGradientStartColor(const QColor &value)
|
void Gutter::setGradientStartColor(const QColor &value)
|
||||||
{
|
{
|
||||||
if (mGradientStartColor!=value) {
|
if (mGradientStartColor!=value) {
|
||||||
mGradientStartColor = value;
|
mGradientStartColor = value;
|
||||||
|
@ -271,12 +271,12 @@ void SynGutter::setGradientStartColor(const QColor &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynGutter::gradient() const
|
bool Gutter::gradient() const
|
||||||
{
|
{
|
||||||
return mGradient;
|
return mGradient;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setGradient(bool value)
|
void Gutter::setGradient(bool value)
|
||||||
{
|
{
|
||||||
if (mGradient!=value){
|
if (mGradient!=value){
|
||||||
mGradient = value;
|
mGradient = value;
|
||||||
|
@ -284,12 +284,12 @@ void SynGutter::setGradient(bool value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SynGutterBorderStyle SynGutter::borderStyle() const
|
GutterBorderStyle Gutter::borderStyle() const
|
||||||
{
|
{
|
||||||
return mBorderStyle;
|
return mBorderStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setBorderStyle(const SynGutterBorderStyle &value)
|
void Gutter::setBorderStyle(const GutterBorderStyle &value)
|
||||||
{
|
{
|
||||||
if (mBorderStyle!=value) {
|
if (mBorderStyle!=value) {
|
||||||
mBorderStyle = value;
|
mBorderStyle = value;
|
||||||
|
@ -297,12 +297,12 @@ void SynGutter::setBorderStyle(const SynGutterBorderStyle &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynGutter::digitCount() const
|
int Gutter::digitCount() const
|
||||||
{
|
{
|
||||||
return mDigitCount;
|
return mDigitCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setDigitCount(int value)
|
void Gutter::setDigitCount(int value)
|
||||||
{
|
{
|
||||||
if (mDigitCount != value ) {
|
if (mDigitCount != value ) {
|
||||||
mDigitCount = value;
|
mDigitCount = value;
|
||||||
|
@ -310,12 +310,12 @@ void SynGutter::setDigitCount(int value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SynGutter::color() const
|
QColor Gutter::color() const
|
||||||
{
|
{
|
||||||
return mColor;
|
return mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setColor(const QColor &value)
|
void Gutter::setColor(const QColor &value)
|
||||||
{
|
{
|
||||||
if (mColor!=value) {
|
if (mColor!=value) {
|
||||||
mColor = value;
|
mColor = value;
|
||||||
|
@ -323,12 +323,12 @@ void SynGutter::setColor(const QColor &value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SynGutter::borderColor() const
|
QColor Gutter::borderColor() const
|
||||||
{
|
{
|
||||||
return mBorderColor;
|
return mBorderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynGutter::setBorderColor(const QColor &value)
|
void Gutter::setBorderColor(const QColor &value)
|
||||||
{
|
{
|
||||||
if (mBorderColor!=value) {
|
if (mBorderColor!=value) {
|
||||||
mBorderColor = value;
|
mBorderColor = value;
|
||||||
|
|
|
@ -24,16 +24,16 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
enum class SynGutterBorderStyle {
|
enum class GutterBorderStyle {
|
||||||
None,
|
None,
|
||||||
Middle,
|
Middle,
|
||||||
Right
|
Right
|
||||||
};
|
};
|
||||||
|
|
||||||
class SynGutter : public QObject {
|
class Gutter : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SynGutter(QObject* parent = nullptr);
|
explicit Gutter(QObject* parent = nullptr);
|
||||||
QFont font() const;
|
QFont font() const;
|
||||||
void setFont(const QFont &value);
|
void setFont(const QFont &value);
|
||||||
|
|
||||||
|
@ -49,8 +49,8 @@ public:
|
||||||
int digitCount() const;
|
int digitCount() const;
|
||||||
void setDigitCount(int value);
|
void setDigitCount(int value);
|
||||||
|
|
||||||
SynGutterBorderStyle borderStyle() const;
|
GutterBorderStyle borderStyle() const;
|
||||||
void setBorderStyle(const SynGutterBorderStyle &value);
|
void setBorderStyle(const GutterBorderStyle &value);
|
||||||
|
|
||||||
bool gradient() const;
|
bool gradient() const;
|
||||||
void setGradient(bool value);
|
void setGradient(bool value);
|
||||||
|
@ -118,13 +118,13 @@ private:
|
||||||
int mLineNumberStart;
|
int mLineNumberStart;
|
||||||
int mRightOffset;
|
int mRightOffset;
|
||||||
bool mShowLineNumbers;
|
bool mShowLineNumbers;
|
||||||
SynGutterBorderStyle mBorderStyle;
|
GutterBorderStyle mBorderStyle;
|
||||||
bool mUseFontStyle;
|
bool mUseFontStyle;
|
||||||
bool mVisible;
|
bool mVisible;
|
||||||
int mAutoSizeDigitCount;
|
int mAutoSizeDigitCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PSynGutter = std::shared_ptr<SynGutter>;
|
using PSynGutter = std::shared_ptr<Gutter>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,11 +42,11 @@ int getEOL(const QString &Line, int start)
|
||||||
return Line.size();
|
return Line.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool internalEnumHighlighterAttris(PSynHighlighter Highlighter,
|
bool internalEnumHighlighterAttris(PHighlighter Highlighter,
|
||||||
bool SkipDuplicates,
|
bool SkipDuplicates,
|
||||||
HighlighterAttriProc highlighterAttriProc,
|
HighlighterAttriProc highlighterAttriProc,
|
||||||
std::initializer_list<void *>& Params,
|
std::initializer_list<void *>& Params,
|
||||||
SynHighlighterList& HighlighterList) {
|
HighlighterList& HighlighterList) {
|
||||||
bool Result = true;
|
bool Result = true;
|
||||||
if (HighlighterList.indexOf(Highlighter)>0) {
|
if (HighlighterList.indexOf(Highlighter)>0) {
|
||||||
if (SkipDuplicates)
|
if (SkipDuplicates)
|
||||||
|
@ -54,10 +54,10 @@ bool internalEnumHighlighterAttris(PSynHighlighter Highlighter,
|
||||||
} else {
|
} else {
|
||||||
HighlighterList.append(Highlighter);
|
HighlighterList.append(Highlighter);
|
||||||
}
|
}
|
||||||
if (Highlighter->getClass() == SynHighlighterClass::Composition) {
|
if (Highlighter->getClass() == HighlighterClass::Composition) {
|
||||||
//todo: handle composition highlighter
|
//todo: handle composition highlighter
|
||||||
} else if (Highlighter) {
|
} else if (Highlighter) {
|
||||||
for (PSynHighlighterAttribute pAttr: Highlighter->attributes()){
|
for (PHighlighterAttribute pAttr: Highlighter->attributes()){
|
||||||
QString UniqueAttriName = Highlighter->getName()
|
QString UniqueAttriName = Highlighter->getName()
|
||||||
+ QString("%1").arg(HighlighterList.indexOf(Highlighter)) + '.'
|
+ QString("%1").arg(HighlighterList.indexOf(Highlighter)) + '.'
|
||||||
+ pAttr->name();
|
+ pAttr->name();
|
||||||
|
@ -70,7 +70,7 @@ bool internalEnumHighlighterAttris(PSynHighlighter Highlighter,
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool enumHighlighterAttributes(PSynHighlighter Highlighter, bool SkipDuplicates,
|
bool enumHighlighterAttributes(PHighlighter Highlighter, bool SkipDuplicates,
|
||||||
HighlighterAttriProc highlighterAttriProc,
|
HighlighterAttriProc highlighterAttriProc,
|
||||||
std::initializer_list<void *> Params)
|
std::initializer_list<void *> Params)
|
||||||
{
|
{
|
||||||
|
@ -78,7 +78,7 @@ bool enumHighlighterAttributes(PSynHighlighter Highlighter, bool SkipDuplicates,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterList HighlighterList;
|
HighlighterList HighlighterList;
|
||||||
return internalEnumHighlighterAttris(Highlighter, SkipDuplicates,
|
return internalEnumHighlighterAttris(Highlighter, SkipDuplicates,
|
||||||
highlighterAttriProc, Params, HighlighterList);
|
highlighterAttriProc, Params, HighlighterList);
|
||||||
}
|
}
|
||||||
|
@ -89,13 +89,13 @@ int mulDiv(int a, int b, int c)
|
||||||
return a*b/c;
|
return a*b/c;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynFontStyles getFontStyles(const QFont &font)
|
FontStyles getFontStyles(const QFont &font)
|
||||||
{
|
{
|
||||||
SynFontStyles styles;
|
FontStyles styles;
|
||||||
styles.setFlag(SynFontStyle::fsBold, font.bold());
|
styles.setFlag(FontStyle::fsBold, font.bold());
|
||||||
styles.setFlag(SynFontStyle::fsItalic, font.italic());
|
styles.setFlag(FontStyle::fsItalic, font.italic());
|
||||||
styles.setFlag(SynFontStyle::fsUnderline, font.underline());
|
styles.setFlag(FontStyle::fsUnderline, font.underline());
|
||||||
styles.setFlag(SynFontStyle::fsStrikeOut, font.strikeOut());
|
styles.setFlag(FontStyle::fsStrikeOut, font.strikeOut());
|
||||||
return styles;
|
return styles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,18 +46,18 @@ QStringList splitStrings(const QString& text);
|
||||||
|
|
||||||
int calSpanLines(const BufferCoord& startPos, const BufferCoord& endPos);
|
int calSpanLines(const BufferCoord& startPos, const BufferCoord& endPos);
|
||||||
|
|
||||||
using HighlighterAttriProc = std::function<bool(PSynHighlighter Highlighter,
|
using HighlighterAttriProc = std::function<bool(PHighlighter Highlighter,
|
||||||
PSynHighlighterAttribute Attri, const QString& UniqueAttriName,
|
PHighlighterAttribute Attri, const QString& UniqueAttriName,
|
||||||
QList<void *> Params)>;
|
QList<void *> Params)>;
|
||||||
|
|
||||||
// Enums all child highlighters and their attributes of a TSynMultiSyn through a
|
// Enums all child highlighters and their attributes of a TSynMultiSyn through a
|
||||||
// callback function.
|
// callback function.
|
||||||
// This function also handles nested TSynMultiSyns including their MarkerAttri.
|
// This function also handles nested TSynMultiSyns including their MarkerAttri.
|
||||||
bool enumHighlighterAttributes(PSynHighlighter Highlighter,
|
bool enumHighlighterAttributes(PHighlighter Highlighter,
|
||||||
bool SkipDuplicates, HighlighterAttriProc highlighterAttriProc,
|
bool SkipDuplicates, HighlighterAttriProc highlighterAttriProc,
|
||||||
std::initializer_list<void *> Params);
|
std::initializer_list<void *> Params);
|
||||||
|
|
||||||
SynFontStyles getFontStyles(const QFont& font);
|
FontStyles getFontStyles(const QFont& font);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the first occurency of word char in s, starting from startPos
|
* Find the first occurency of word char in s, starting from startPos
|
||||||
|
|
|
@ -18,31 +18,31 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynSearch::SynSearch(QObject *parent):SynSearchBase(parent)
|
BasicSearcher::BasicSearcher(QObject *parent):BaseSearcher(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearch::length(int aIndex)
|
int BasicSearcher::length(int aIndex)
|
||||||
{
|
{
|
||||||
if (aIndex<0 || aIndex >= mResults.length())
|
if (aIndex<0 || aIndex >= mResults.length())
|
||||||
return 0;
|
return 0;
|
||||||
return pattern().length();
|
return pattern().length();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearch::result(int aIndex)
|
int BasicSearcher::result(int aIndex)
|
||||||
{
|
{
|
||||||
if (aIndex<0 || aIndex >= mResults.length())
|
if (aIndex<0 || aIndex >= mResults.length())
|
||||||
return -1;
|
return -1;
|
||||||
return mResults[aIndex];
|
return mResults[aIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearch::resultCount()
|
int BasicSearcher::resultCount()
|
||||||
{
|
{
|
||||||
return mResults.count();
|
return mResults.count();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearch::findAll(const QString &text)
|
int BasicSearcher::findAll(const QString &text)
|
||||||
{
|
{
|
||||||
mResults.clear();
|
mResults.clear();
|
||||||
if (pattern().isEmpty())
|
if (pattern().isEmpty())
|
||||||
|
@ -74,12 +74,12 @@ int SynSearch::findAll(const QString &text)
|
||||||
return mResults.size();
|
return mResults.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynSearch::replace(const QString &, const QString &aReplacement)
|
QString BasicSearcher::replace(const QString &, const QString &aReplacement)
|
||||||
{
|
{
|
||||||
return aReplacement;
|
return aReplacement;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynSearch::isDelimitChar(QChar ch)
|
bool BasicSearcher::isDelimitChar(QChar ch)
|
||||||
{
|
{
|
||||||
return !(ch == '_' || ch.isLetterOrNumber());
|
return !(ch == '_' || ch.isLetterOrNumber());
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,11 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
class SynSearch : public SynSearchBase
|
class BasicSearcher : public BaseSearcher
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SynSearch(QObject* parent = nullptr);
|
explicit BasicSearcher(QObject* parent = nullptr);
|
||||||
|
|
||||||
// SynSearchBase interface
|
// SynSearchBase interface
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -17,27 +17,27 @@
|
||||||
#include "SearchBase.h"
|
#include "SearchBase.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
SynSearchBase::SynSearchBase(QObject *parent) : QObject(parent)
|
BaseSearcher::BaseSearcher(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynSearchBase::pattern()
|
QString BaseSearcher::pattern()
|
||||||
{
|
{
|
||||||
return mPattern;
|
return mPattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynSearchBase::setPattern(const QString &value)
|
void BaseSearcher::setPattern(const QString &value)
|
||||||
{
|
{
|
||||||
mPattern = value;
|
mPattern = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynSearchOptions SynSearchBase::options() const
|
SearchOptions BaseSearcher::options() const
|
||||||
{
|
{
|
||||||
return mOptions;
|
return mOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynSearchBase::setOptions(const SynSearchOptions &options)
|
void BaseSearcher::setOptions(const SearchOptions &options)
|
||||||
{
|
{
|
||||||
mOptions = options;
|
mOptions = options;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
enum SynSearchOption {
|
enum SearchOption {
|
||||||
ssoMatchCase = 0x0001,
|
ssoMatchCase = 0x0001,
|
||||||
ssoWholeWord = 0x0002,
|
ssoWholeWord = 0x0002,
|
||||||
ssoBackwards = 0x0004,
|
ssoBackwards = 0x0004,
|
||||||
|
@ -32,14 +32,14 @@ enum SynSearchOption {
|
||||||
ssoRegExp = 0x0080
|
ssoRegExp = 0x0080
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(SynSearchOptions, SynSearchOption)
|
Q_DECLARE_FLAGS(SearchOptions, SearchOption)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SynSearchOptions)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(SearchOptions)
|
||||||
|
|
||||||
class SynSearchBase : public QObject
|
class BaseSearcher : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SynSearchBase(QObject *parent = nullptr);
|
explicit BaseSearcher(QObject *parent = nullptr);
|
||||||
QString pattern();
|
QString pattern();
|
||||||
virtual void setPattern(const QString& value);
|
virtual void setPattern(const QString& value);
|
||||||
virtual int length(int aIndex) = 0;
|
virtual int length(int aIndex) = 0;
|
||||||
|
@ -47,15 +47,15 @@ public:
|
||||||
virtual int resultCount() = 0;
|
virtual int resultCount() = 0;
|
||||||
virtual int findAll(const QString& text) = 0;
|
virtual int findAll(const QString& text) = 0;
|
||||||
virtual QString replace(const QString& aOccurrence, const QString& aReplacement) = 0;
|
virtual QString replace(const QString& aOccurrence, const QString& aReplacement) = 0;
|
||||||
SynSearchOptions options() const;
|
SearchOptions options() const;
|
||||||
virtual void setOptions(const SynSearchOptions &options);
|
virtual void setOptions(const SearchOptions &options);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString mPattern;
|
QString mPattern;
|
||||||
SynSearchOptions mOptions;
|
SearchOptions mOptions;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PSynSearchBase = std::shared_ptr<SynSearchBase>;
|
using PSynSearchBase = std::shared_ptr<BaseSearcher>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,31 +20,31 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynSearchRegex::SynSearchRegex(QObject* parent):SynSearchBase(parent)
|
RegexSearcher::RegexSearcher(QObject* parent):BaseSearcher(parent)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearchRegex::length(int aIndex)
|
int RegexSearcher::length(int aIndex)
|
||||||
{
|
{
|
||||||
if (aIndex<0 || aIndex >= mResults.length())
|
if (aIndex<0 || aIndex >= mResults.length())
|
||||||
return -1;
|
return -1;
|
||||||
return mLengths[aIndex];
|
return mLengths[aIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearchRegex::result(int aIndex)
|
int RegexSearcher::result(int aIndex)
|
||||||
{
|
{
|
||||||
if (aIndex<0 || aIndex >= mResults.length())
|
if (aIndex<0 || aIndex >= mResults.length())
|
||||||
return -1;
|
return -1;
|
||||||
return mResults[aIndex];
|
return mResults[aIndex];
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearchRegex::resultCount()
|
int RegexSearcher::resultCount()
|
||||||
{
|
{
|
||||||
return mResults.size();
|
return mResults.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynSearchRegex::findAll(const QString &text)
|
int RegexSearcher::findAll(const QString &text)
|
||||||
{
|
{
|
||||||
if (pattern().isEmpty())
|
if (pattern().isEmpty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -59,28 +59,28 @@ int SynSearchRegex::findAll(const QString &text)
|
||||||
return mResults.size();
|
return mResults.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynSearchRegex::replace(const QString &aOccurrence, const QString &aReplacement)
|
QString RegexSearcher::replace(const QString &aOccurrence, const QString &aReplacement)
|
||||||
{
|
{
|
||||||
QString s=aOccurrence;
|
QString s=aOccurrence;
|
||||||
return s.replace(mRegex,aReplacement);
|
return s.replace(mRegex,aReplacement);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynSearchRegex::setPattern(const QString &value)
|
void RegexSearcher::setPattern(const QString &value)
|
||||||
{
|
{
|
||||||
SynSearchBase::setPattern(value);
|
BaseSearcher::setPattern(value);
|
||||||
mRegex.setPattern(value);
|
mRegex.setPattern(value);
|
||||||
updateRegexOptions();
|
updateRegexOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynSearchRegex::setOptions(const SynSearchOptions &options)
|
void RegexSearcher::setOptions(const SearchOptions &options)
|
||||||
{
|
{
|
||||||
SynSearchBase::setOptions(options);
|
BaseSearcher::setOptions(options);
|
||||||
updateRegexOptions();
|
updateRegexOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynSearchRegex::updateRegexOptions()
|
void RegexSearcher::updateRegexOptions()
|
||||||
{
|
{
|
||||||
if (options().testFlag(SynSearchOption::ssoMatchCase)) {
|
if (options().testFlag(SearchOption::ssoMatchCase)) {
|
||||||
mRegex.setPatternOptions(
|
mRegex.setPatternOptions(
|
||||||
mRegex.patternOptions() &
|
mRegex.patternOptions() &
|
||||||
~QRegularExpression::CaseInsensitiveOption);
|
~QRegularExpression::CaseInsensitiveOption);
|
||||||
|
|
|
@ -21,11 +21,11 @@
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
class SynSearchRegex : public SynSearchBase
|
class RegexSearcher : public BaseSearcher
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SynSearchRegex(QObject* parent=nullptr);
|
explicit RegexSearcher(QObject* parent=nullptr);
|
||||||
|
|
||||||
// SynSearchBase interface
|
// SynSearchBase interface
|
||||||
public:
|
public:
|
||||||
|
@ -35,7 +35,7 @@ public:
|
||||||
int findAll(const QString &text) override;
|
int findAll(const QString &text) override;
|
||||||
QString replace(const QString &aOccurrence, const QString &aReplacement) override;
|
QString replace(const QString &aOccurrence, const QString &aReplacement) override;
|
||||||
void setPattern(const QString &value) override;
|
void setPattern(const QString &value) override;
|
||||||
void setOptions(const SynSearchOptions &options) override;
|
void setOptions(const SearchOptions &options) override;
|
||||||
private:
|
private:
|
||||||
void updateRegexOptions();
|
void updateRegexOptions();
|
||||||
private:
|
private:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -33,24 +33,15 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
enum class SynFontSmoothMethod {
|
enum class ScrollStyle {
|
||||||
None, AntiAlias, ClearType
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
enum class SynScrollHintFormat {
|
|
||||||
shfTopLineOnly, shfTopToBottom
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class SynScrollStyle {
|
|
||||||
ssNone, ssHorizontal, ssVertical, ssBoth
|
ssNone, ssHorizontal, ssVertical, ssBoth
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SynEditCaretType {
|
enum class EditCaretType {
|
||||||
ctVerticalLine=0, ctHorizontalLine=1, ctHalfBlock=2, ctBlock=3
|
ctVerticalLine=0, ctHorizontalLine=1, ctHalfBlock=2, ctBlock=3
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SynStatusChange {
|
enum StatusChange {
|
||||||
scNone = 0,
|
scNone = 0,
|
||||||
scAll = 0x0001,
|
scAll = 0x0001,
|
||||||
scCaretX = 0x0002,
|
scCaretX = 0x0002,
|
||||||
|
@ -65,10 +56,10 @@ enum SynStatusChange {
|
||||||
scModified = 0x0400
|
scModified = 0x0400
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(SynStatusChanges, SynStatusChange)
|
Q_DECLARE_FLAGS(StatusChanges, StatusChange)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SynStatusChanges)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(StatusChanges)
|
||||||
|
|
||||||
enum class SynStateFlag {
|
enum class StateFlag {
|
||||||
sfCaretChanged = 0x0001,
|
sfCaretChanged = 0x0001,
|
||||||
sfScrollbarChanged = 0x0002,
|
sfScrollbarChanged = 0x0002,
|
||||||
sfLinesChanging = 0x0004,
|
sfLinesChanging = 0x0004,
|
||||||
|
@ -78,11 +69,11 @@ enum class SynStateFlag {
|
||||||
sfWaitForDragging = 0x0040
|
sfWaitForDragging = 0x0040
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(SynStateFlags,SynStateFlag)
|
Q_DECLARE_FLAGS(StateFlags,StateFlag)
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SynStateFlags)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(StateFlags)
|
||||||
|
|
||||||
enum SynEditorOption {
|
enum EditorOption {
|
||||||
eoAltSetsColumnMode = 0x00000001, //Holding down the Alt Key will put the selection mode into columnar format
|
eoAltSetsColumnMode = 0x00000001, //Holding down the Alt Key will put the selection mode into columnar format
|
||||||
eoAutoIndent = 0x00000002, //Will auto calculate the indent when input
|
eoAutoIndent = 0x00000002, //Will auto calculate the indent when input
|
||||||
eoLigatureSupport = 0x00000004, //Support ligaures in fonts like fira code
|
eoLigatureSupport = 0x00000004, //Support ligaures in fonts like fira code
|
||||||
|
@ -115,11 +106,11 @@ enum SynEditorOption {
|
||||||
// eoNoCaret = 0x00000800, //Makes it so the caret is never visible
|
// eoNoCaret = 0x00000800, //Makes it so the caret is never visible
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(SynEditorOptions, SynEditorOption)
|
Q_DECLARE_FLAGS(EditorOptions, EditorOption)
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SynEditorOptions)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(EditorOptions)
|
||||||
|
|
||||||
enum class SynSearchAction {
|
enum class SearchAction {
|
||||||
Replace,
|
Replace,
|
||||||
ReplaceAll,
|
ReplaceAll,
|
||||||
Skip,
|
Skip,
|
||||||
|
@ -128,27 +119,23 @@ enum class SynSearchAction {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enum class SynTransientType {
|
enum class TransientType {
|
||||||
ttBefore, ttAfter
|
ttBefore, ttAfter
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SynScrollBarKind {
|
|
||||||
sbHorizontal, sbVertical
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
using SynPaintTransientProc = std::function<void(const QPaintDevice& paintDevice,
|
using SynPaintTransientProc = std::function<void(const QPaintDevice& paintDevice,
|
||||||
SynTransientType transientType)>;
|
SynTransientType transientType)>;
|
||||||
*/
|
*/
|
||||||
using SynProcessCommandProc = std::function<void(SynEditorCommand& command, QChar& AChar, void* data)>;
|
using ProcessCommandProc = std::function<void(EditCommand& command, QChar& AChar, void* data)>;
|
||||||
using SynMouseCursorProc = std::function<void(const BufferCoord& aLineCharPos, QCursor & aCursor)>;
|
using MouseCursorProc = std::function<void(const BufferCoord& aLineCharPos, QCursor & aCursor)>;
|
||||||
using SynPaintProc = std::function<void(const QPaintDevice& paintDevice )>;
|
using PaintProc = std::function<void(const QPaintDevice& paintDevice )>;
|
||||||
//using SynPreparePaintHighlightTokenProc = std::function<void(int row,
|
//using SynPreparePaintHighlightTokenProc = std::function<void(int row,
|
||||||
// int column, const QString& token, PSynHighlighterAttribute attr,
|
// int column, const QString& token, PSynHighlighterAttribute attr,
|
||||||
// SynFontStyles& style, QColor& foreground, QColor& background)>;
|
// FontStyles& style, QColor& foreground, QColor& background)>;
|
||||||
using SynSearchMathedProc = std::function<SynSearchAction(const QString& sSearch,
|
using SearchMathedProc = std::function<SearchAction(const QString& sSearch,
|
||||||
const QString& sReplace, int Line, int ch, int wordLen)>;
|
const QString& sReplace, int Line, int ch, int wordLen)>;
|
||||||
using SynSearchConfirmAroundProc = std::function<bool ()>;
|
using SearchConfirmAroundProc = std::function<bool ()>;
|
||||||
|
|
||||||
class SynEdit;
|
class SynEdit;
|
||||||
using PSynEdit = std::shared_ptr<SynEdit>;
|
using PSynEdit = std::shared_ptr<SynEdit>;
|
||||||
|
@ -230,7 +217,7 @@ public:
|
||||||
BufferCoord prevWordPos();
|
BufferCoord prevWordPos();
|
||||||
BufferCoord prevWordPosEx(const BufferCoord& XY);
|
BufferCoord prevWordPosEx(const BufferCoord& XY);
|
||||||
|
|
||||||
void commandProcessor(SynEditorCommand Command, QChar AChar = QChar(), void * pData = nullptr);
|
void commandProcessor(EditCommand Command, QChar AChar = QChar(), void * pData = nullptr);
|
||||||
//Caret
|
//Caret
|
||||||
void showCaret();
|
void showCaret();
|
||||||
void hideCaret();
|
void hideCaret();
|
||||||
|
@ -248,25 +235,25 @@ public:
|
||||||
void collapseAll();
|
void collapseAll();
|
||||||
void unCollpaseAll();
|
void unCollpaseAll();
|
||||||
void uncollapseAroundLine(int line);
|
void uncollapseAroundLine(int line);
|
||||||
PSynEditFoldRange foldHidesLine(int line);
|
PCodeFoldingRange foldHidesLine(int line);
|
||||||
void setSelLength(int Value);
|
void setSelLength(int Value);
|
||||||
void setSelText(const QString& text);
|
void setSelText(const QString& text);
|
||||||
|
|
||||||
int searchReplace(const QString& sSearch, const QString& sReplace, SynSearchOptions options,
|
int searchReplace(const QString& sSearch, const QString& sReplace, SearchOptions options,
|
||||||
PSynSearchBase searchEngine, SynSearchMathedProc matchedCallback = nullptr,
|
PSynSearchBase searchEngine, SearchMathedProc matchedCallback = nullptr,
|
||||||
SynSearchConfirmAroundProc confirmAroundCallback = nullptr);
|
SearchConfirmAroundProc confirmAroundCallback = nullptr);
|
||||||
|
|
||||||
int maxScrollWidth() const;
|
int maxScrollWidth() const;
|
||||||
int maxScrollHeight() const;
|
int maxScrollHeight() const;
|
||||||
|
|
||||||
bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token,
|
bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token,
|
||||||
PSynHighlighterAttribute& attri);
|
PHighlighterAttribute& attri);
|
||||||
bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token,
|
bool getHighlighterAttriAtRowCol(const BufferCoord& pos, QString& token,
|
||||||
bool& tokenFinished, SynHighlighterTokenType& tokenType,
|
bool& tokenFinished, TokenType& tokenType,
|
||||||
PSynHighlighterAttribute& attri);
|
PHighlighterAttribute& attri);
|
||||||
bool getHighlighterAttriAtRowColEx(const BufferCoord& pos, QString& token,
|
bool getHighlighterAttriAtRowColEx(const BufferCoord& pos, QString& token,
|
||||||
SynHighlighterTokenType& tokenType, SynTokenKind &tokenKind, int &start,
|
TokenType& tokenType, TokenKind &tokenKind, int &start,
|
||||||
PSynHighlighterAttribute& attri);
|
PHighlighterAttribute& attri);
|
||||||
|
|
||||||
void beginUndoBlock();
|
void beginUndoBlock();
|
||||||
void endUndoBlock();
|
void endUndoBlock();
|
||||||
|
@ -280,26 +267,26 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
//Commands
|
//Commands
|
||||||
virtual void cutToClipboard() { commandProcessor(SynEditorCommand::ecCut);}
|
virtual void cutToClipboard() { commandProcessor(EditCommand::ecCut);}
|
||||||
virtual void copyToClipboard() { commandProcessor(SynEditorCommand::ecCopy);}
|
virtual void copyToClipboard() { commandProcessor(EditCommand::ecCopy);}
|
||||||
virtual void pasteFromClipboard() { commandProcessor(SynEditorCommand::ecPaste);}
|
virtual void pasteFromClipboard() { commandProcessor(EditCommand::ecPaste);}
|
||||||
virtual void undo() { commandProcessor(SynEditorCommand::ecUndo);}
|
virtual void undo() { commandProcessor(EditCommand::ecUndo);}
|
||||||
virtual void redo() { commandProcessor(SynEditorCommand::ecRedo);}
|
virtual void redo() { commandProcessor(EditCommand::ecRedo);}
|
||||||
virtual void zoomIn() { commandProcessor(SynEditorCommand::ecZoomIn);}
|
virtual void zoomIn() { commandProcessor(EditCommand::ecZoomIn);}
|
||||||
virtual void zoomOut() { commandProcessor(SynEditorCommand::ecZoomOut);}
|
virtual void zoomOut() { commandProcessor(EditCommand::ecZoomOut);}
|
||||||
virtual void selectAll() {
|
virtual void selectAll() {
|
||||||
commandProcessor(SynEditorCommand::ecSelectAll);
|
commandProcessor(EditCommand::ecSelectAll);
|
||||||
}
|
}
|
||||||
virtual void selectWord() {
|
virtual void selectWord() {
|
||||||
commandProcessor(SynEditorCommand::ecSelWord);
|
commandProcessor(EditCommand::ecSelWord);
|
||||||
}
|
}
|
||||||
virtual void tab() { commandProcessor(SynEditorCommand::ecTab);}
|
virtual void tab() { commandProcessor(EditCommand::ecTab);}
|
||||||
virtual void shifttab() { commandProcessor(SynEditorCommand::ecShiftTab);}
|
virtual void shifttab() { commandProcessor(EditCommand::ecShiftTab);}
|
||||||
virtual void toggleComment() { commandProcessor(SynEditorCommand::ecToggleComment);}
|
virtual void toggleComment() { commandProcessor(EditCommand::ecToggleComment);}
|
||||||
virtual void toggleBlockComment() { commandProcessor(SynEditorCommand::ecToggleBlockComment);}
|
virtual void toggleBlockComment() { commandProcessor(EditCommand::ecToggleBlockComment);}
|
||||||
virtual void matchBracket() { commandProcessor(SynEditorCommand::ecMatchBracket);}
|
virtual void matchBracket() { commandProcessor(EditCommand::ecMatchBracket);}
|
||||||
virtual void moveSelUp(){ commandProcessor(SynEditorCommand::ecMoveSelUp);}
|
virtual void moveSelUp(){ commandProcessor(EditCommand::ecMoveSelUp);}
|
||||||
virtual void moveSelDown(){ commandProcessor(SynEditorCommand::ecMoveSelDown);}
|
virtual void moveSelDown(){ commandProcessor(EditCommand::ecMoveSelDown);}
|
||||||
|
|
||||||
virtual void beginUpdate();
|
virtual void beginUpdate();
|
||||||
virtual void endUpdate();
|
virtual void endUpdate();
|
||||||
|
@ -315,10 +302,10 @@ public:
|
||||||
bool pointToLine(const QPoint& point, int& line);
|
bool pointToLine(const QPoint& point, int& line);
|
||||||
bool isIdentChar(const QChar& ch);
|
bool isIdentChar(const QChar& ch);
|
||||||
|
|
||||||
void setRainbowAttrs(const PSynHighlighterAttribute &attr0,
|
void setRainbowAttrs(const PHighlighterAttribute &attr0,
|
||||||
const PSynHighlighterAttribute &attr1,
|
const PHighlighterAttribute &attr1,
|
||||||
const PSynHighlighterAttribute &attr2,
|
const PHighlighterAttribute &attr2,
|
||||||
const PSynHighlighterAttribute &attr3);
|
const PHighlighterAttribute &attr3);
|
||||||
|
|
||||||
void updateMouseCursor();
|
void updateMouseCursor();
|
||||||
|
|
||||||
|
@ -339,8 +326,8 @@ public:
|
||||||
void setBlockBegin(BufferCoord value);
|
void setBlockBegin(BufferCoord value);
|
||||||
void setBlockEnd(BufferCoord Value);
|
void setBlockEnd(BufferCoord Value);
|
||||||
|
|
||||||
SynSelectionMode activeSelectionMode() const;
|
SelectionMode activeSelectionMode() const;
|
||||||
void setActiveSelectionMode(const SynSelectionMode &Value);
|
void setActiveSelectionMode(const SelectionMode &Value);
|
||||||
|
|
||||||
int charsInWindow() const;
|
int charsInWindow() const;
|
||||||
|
|
||||||
|
@ -354,13 +341,13 @@ public:
|
||||||
bool modified() const;
|
bool modified() const;
|
||||||
void setModified(bool Value);
|
void setModified(bool Value);
|
||||||
|
|
||||||
PSynHighlighter highlighter() const;
|
PHighlighter highlighter() const;
|
||||||
void setHighlighter(const PSynHighlighter &highlighter);
|
void setHighlighter(const PHighlighter &highlighter);
|
||||||
|
|
||||||
bool useCodeFolding() const;
|
bool useCodeFolding() const;
|
||||||
void setUseCodeFolding(bool value);
|
void setUseCodeFolding(bool value);
|
||||||
|
|
||||||
SynEditCodeFolding & codeFolding();
|
CodeFoldingOptions & codeFolding();
|
||||||
|
|
||||||
QString displayLineText();
|
QString displayLineText();
|
||||||
QString lineText() const;
|
QString lineText() const;
|
||||||
|
@ -369,17 +356,17 @@ public:
|
||||||
const PSynDocument& document() const;
|
const PSynDocument& document() const;
|
||||||
bool empty();
|
bool empty();
|
||||||
|
|
||||||
SynSelectionMode selectionMode() const;
|
SelectionMode selectionMode() const;
|
||||||
void setSelectionMode(SynSelectionMode value);
|
void setSelectionMode(SelectionMode value);
|
||||||
|
|
||||||
QString selText();
|
QString selText();
|
||||||
|
|
||||||
QStringList getContent(BufferCoord startPos, BufferCoord endPos, SynSelectionMode mode) const;
|
QStringList getContent(BufferCoord startPos, BufferCoord endPos, SelectionMode mode) const;
|
||||||
|
|
||||||
QString lineBreak();
|
QString lineBreak();
|
||||||
|
|
||||||
SynEditorOptions getOptions() const;
|
EditorOptions getOptions() const;
|
||||||
void setOptions(const SynEditorOptions &Value);
|
void setOptions(const EditorOptions &Value);
|
||||||
|
|
||||||
int tabWidth() const { return mDocument->tabWidth(); }
|
int tabWidth() const { return mDocument->tabWidth(); }
|
||||||
void setTabWidth(int tabWidth);
|
void setTabWidth(int tabWidth);
|
||||||
|
@ -390,13 +377,13 @@ public:
|
||||||
QColor activeLineColor() const;
|
QColor activeLineColor() const;
|
||||||
void setActiveLineColor(const QColor &activeLineColor);
|
void setActiveLineColor(const QColor &activeLineColor);
|
||||||
|
|
||||||
SynEditCaretType overwriteCaret() const;
|
EditCaretType overwriteCaret() const;
|
||||||
void setOverwriteCaret(const SynEditCaretType &overwriteCaret);
|
void setOverwriteCaret(const EditCaretType &overwriteCaret);
|
||||||
|
|
||||||
SynEditCaretType insertCaret() const;
|
EditCaretType insertCaret() const;
|
||||||
void setInsertCaret(const SynEditCaretType &insertCaret);
|
void setInsertCaret(const EditCaretType &insertCaret);
|
||||||
|
|
||||||
SynGutter& gutter();
|
Gutter& gutter();
|
||||||
|
|
||||||
bool readOnly() const;
|
bool readOnly() const;
|
||||||
void setReadOnly(bool readOnly);
|
void setReadOnly(bool readOnly);
|
||||||
|
@ -424,13 +411,13 @@ public:
|
||||||
bool caretUseTextColor() const;
|
bool caretUseTextColor() const;
|
||||||
void setCaretUseTextColor(bool newCaretUseTextColor);
|
void setCaretUseTextColor(bool newCaretUseTextColor);
|
||||||
|
|
||||||
const PSynHighlighterAttribute &rainbowAttr0() const;
|
const PHighlighterAttribute &rainbowAttr0() const;
|
||||||
|
|
||||||
const PSynHighlighterAttribute &rainbowAttr1() const;
|
const PHighlighterAttribute &rainbowAttr1() const;
|
||||||
|
|
||||||
const PSynHighlighterAttribute &rainbowAttr2() const;
|
const PHighlighterAttribute &rainbowAttr2() const;
|
||||||
|
|
||||||
const PSynHighlighterAttribute &rainbowAttr3() const;
|
const PHighlighterAttribute &rainbowAttr3() const;
|
||||||
|
|
||||||
int mouseWheelScrollSpeed() const;
|
int mouseWheelScrollSpeed() const;
|
||||||
void setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed);
|
void setMouseWheelScrollSpeed(int newMouseWheelScrollSpeed);
|
||||||
|
@ -463,8 +450,7 @@ signals:
|
||||||
|
|
||||||
// void contextHelp(const QString& word);
|
// void contextHelp(const QString& word);
|
||||||
|
|
||||||
// void scrolled(SynScrollBarKind ScrollBar);
|
void statusChanged(StatusChanges changes);
|
||||||
void statusChanged(SynStatusChanges changes);
|
|
||||||
|
|
||||||
void fontChanged();
|
void fontChanged();
|
||||||
void tabSizeChanged();
|
void tabSizeChanged();
|
||||||
|
@ -472,21 +458,21 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
virtual bool onGetSpecialLineColors(int Line,
|
virtual bool onGetSpecialLineColors(int Line,
|
||||||
QColor& foreground, QColor& backgroundColor) ;
|
QColor& foreground, QColor& backgroundColor) ;
|
||||||
virtual void onGetEditingAreas(int Line, SynEditingAreaList& areaList);
|
virtual void onGetEditingAreas(int Line, EditingAreaList& areaList);
|
||||||
virtual void onGutterGetText(int aLine, QString& aText);
|
virtual void onGutterGetText(int aLine, QString& aText);
|
||||||
virtual void onGutterPaint(QPainter& painter, int aLine, int X, int Y);
|
virtual void onGutterPaint(QPainter& painter, int aLine, int X, int Y);
|
||||||
virtual void onPaint(QPainter& painter);
|
virtual void onPaint(QPainter& painter);
|
||||||
virtual void onPreparePaintHighlightToken(int line,
|
virtual void onPreparePaintHighlightToken(int line,
|
||||||
int aChar, const QString& token, PSynHighlighterAttribute attr,
|
int aChar, const QString& token, PHighlighterAttribute attr,
|
||||||
SynFontStyles& style, QColor& foreground, QColor& background);
|
FontStyles& style, QColor& foreground, QColor& background);
|
||||||
virtual void onProcessCommand(SynEditorCommand Command, QChar AChar, void * pData);
|
virtual void onProcessCommand(EditCommand Command, QChar AChar, void * pData);
|
||||||
virtual void onCommandProcessed(SynEditorCommand Command, QChar AChar, void * pData);
|
virtual void onCommandProcessed(EditCommand Command, QChar AChar, void * pData);
|
||||||
virtual void ExecuteCommand(SynEditorCommand Command, QChar AChar, void * pData);
|
virtual void ExecuteCommand(EditCommand Command, QChar AChar, void * pData);
|
||||||
virtual void onEndFirstPaintLock();
|
virtual void onEndFirstPaintLock();
|
||||||
virtual void onBeginFirstPaintLock();
|
virtual void onBeginFirstPaintLock();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void clearAreaList(SynEditingAreaList areaList);
|
void clearAreaList(EditingAreaList areaList);
|
||||||
void computeCaret();
|
void computeCaret();
|
||||||
void computeScroll(bool isDragging);
|
void computeScroll(bool isDragging);
|
||||||
|
|
||||||
|
@ -498,7 +484,7 @@ private:
|
||||||
int clientLeft();
|
int clientLeft();
|
||||||
QRect clientRect();
|
QRect clientRect();
|
||||||
void synFontChanged();
|
void synFontChanged();
|
||||||
void doOnPaintTransient(SynTransientType TransientType);
|
|
||||||
void doSetSelText(const QString& value);
|
void doSetSelText(const QString& value);
|
||||||
|
|
||||||
void updateLastCaretX();
|
void updateLastCaretX();
|
||||||
|
@ -509,8 +495,8 @@ private:
|
||||||
void internalSetCaretXY(const BufferCoord& Value);
|
void internalSetCaretXY(const BufferCoord& Value);
|
||||||
void internalSetCaretX(int Value);
|
void internalSetCaretX(int Value);
|
||||||
void internalSetCaretY(int Value);
|
void internalSetCaretY(int Value);
|
||||||
void setStatusChanged(SynStatusChanges changes);
|
void setStatusChanged(StatusChanges changes);
|
||||||
void doOnStatusChange(SynStatusChanges changes);
|
void doOnStatusChange(StatusChanges changes);
|
||||||
void updateScrollbars();
|
void updateScrollbars();
|
||||||
void updateCaret();
|
void updateCaret();
|
||||||
void recalcCharExtent();
|
void recalcCharExtent();
|
||||||
|
@ -519,30 +505,29 @@ private:
|
||||||
int scanFrom(int Index, int canStopIndex);
|
int scanFrom(int Index, int canStopIndex);
|
||||||
void rescanRange(int line);
|
void rescanRange(int line);
|
||||||
void rescanRanges();
|
void rescanRanges();
|
||||||
void uncollapse(PSynEditFoldRange FoldRange);
|
void uncollapse(PCodeFoldingRange FoldRange);
|
||||||
void collapse(PSynEditFoldRange FoldRange);
|
void collapse(PCodeFoldingRange FoldRange);
|
||||||
|
|
||||||
void foldOnListInserted(int Line, int Count);
|
void foldOnListInserted(int Line, int Count);
|
||||||
void foldOnListDeleted(int Line, int Count);
|
void foldOnListDeleted(int Line, int Count);
|
||||||
void foldOnListCleared();
|
void foldOnListCleared();
|
||||||
void rescanFolds(); // rescan for folds
|
void rescanFolds(); // rescan for folds
|
||||||
void rescanForFoldRanges();
|
void rescanForFoldRanges();
|
||||||
void scanForFoldRanges(PSynEditFoldRanges TopFoldRanges);
|
void scanForFoldRanges(PCodeFoldingRanges TopFoldRanges);
|
||||||
int lineHasChar(int Line, int startChar, QChar character, const QString& highlighterAttrName);
|
int lineHasChar(int Line, int startChar, QChar character, const QString& highlighterAttrName);
|
||||||
void findSubFoldRange(PSynEditFoldRanges TopFoldRanges,int FoldIndex,PSynEditFoldRanges& parentFoldRanges, PSynEditFoldRange Parent);
|
void findSubFoldRange(PCodeFoldingRanges TopFoldRanges,int FoldIndex,PCodeFoldingRanges& parentFoldRanges, PCodeFoldingRange Parent);
|
||||||
PSynEditFoldRange collapsedFoldStartAtLine(int Line);
|
PCodeFoldingRange collapsedFoldStartAtLine(int Line);
|
||||||
void doOnPaintTransientEx(SynTransientType TransientType, bool Lock);
|
|
||||||
void initializeCaret();
|
void initializeCaret();
|
||||||
PSynEditFoldRange foldStartAtLine(int Line) const;
|
PCodeFoldingRange foldStartAtLine(int Line) const;
|
||||||
bool foldCollapsedBetween(int startLine, int endLine) const;
|
bool foldCollapsedBetween(int startLine, int endLine) const;
|
||||||
QString substringByColumns(const QString& s, int startColumn, int& colLen);
|
QString substringByColumns(const QString& s, int startColumn, int& colLen);
|
||||||
PSynEditFoldRange foldAroundLine(int Line);
|
PCodeFoldingRange foldAroundLine(int Line);
|
||||||
PSynEditFoldRange foldAroundLineEx(int Line, bool WantCollapsed, bool AcceptFromLine, bool AcceptToLine);
|
PCodeFoldingRange foldAroundLineEx(int Line, bool WantCollapsed, bool AcceptFromLine, bool AcceptToLine);
|
||||||
PSynEditFoldRange checkFoldRange(SynEditFoldRanges* FoldRangeToCheck,int Line, bool WantCollapsed, bool AcceptFromLine, bool AcceptToLine);
|
PCodeFoldingRange checkFoldRange(CodeFoldingRanges* FoldRangeToCheck,int Line, bool WantCollapsed, bool AcceptFromLine, bool AcceptToLine);
|
||||||
PSynEditFoldRange foldEndAtLine(int Line);
|
PCodeFoldingRange foldEndAtLine(int Line);
|
||||||
void paintCaret(QPainter& painter, const QRect rcClip);
|
void paintCaret(QPainter& painter, const QRect rcClip);
|
||||||
int textOffset() const;
|
int textOffset() const;
|
||||||
SynEditorCommand TranslateKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
EditCommand TranslateKeyCode(int key, Qt::KeyboardModifiers modifiers);
|
||||||
/**
|
/**
|
||||||
* Move the caret to right DX columns
|
* Move the caret to right DX columns
|
||||||
* @param DX
|
* @param DX
|
||||||
|
@ -556,15 +541,15 @@ private:
|
||||||
void moveCaretToLineEnd(bool isSelection);
|
void moveCaretToLineEnd(bool isSelection);
|
||||||
void setSelectedTextEmpty();
|
void setSelectedTextEmpty();
|
||||||
void setSelTextPrimitive(const QStringList& text);
|
void setSelTextPrimitive(const QStringList& text);
|
||||||
void setSelTextPrimitiveEx(SynSelectionMode PasteMode,
|
void setSelTextPrimitiveEx(SelectionMode PasteMode,
|
||||||
const QStringList& text);
|
const QStringList& text);
|
||||||
void doLinesDeleted(int FirstLine, int Count);
|
void doLinesDeleted(int FirstLine, int Count);
|
||||||
void doLinesInserted(int FirstLine, int Count);
|
void doLinesInserted(int FirstLine, int Count);
|
||||||
void properSetLine(int ALine, const QString& ALineText, bool notify = true);
|
void properSetLine(int ALine, const QString& ALineText, bool notify = true);
|
||||||
|
|
||||||
//primitive edit operations
|
//primitive edit operations
|
||||||
void doDeleteText(BufferCoord startPos, BufferCoord endPos, SynSelectionMode mode);
|
void doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionMode mode);
|
||||||
void doInsertText(const BufferCoord& pos, const QStringList& text, SynSelectionMode mode, int startLine, int endLine);
|
void doInsertText(const BufferCoord& pos, const QStringList& text, SelectionMode mode, int startLine, int endLine);
|
||||||
int doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
int doInsertTextByNormalMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
||||||
int doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos, int startLine, int endLine);
|
int doInsertTextByColumnMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos, int startLine, int endLine);
|
||||||
int doInsertTextByLineMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
int doInsertTextByLineMode(const BufferCoord& pos, const QStringList& text, BufferCoord &newPos);
|
||||||
|
@ -651,8 +636,8 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<QImage> mContentImage;
|
std::shared_ptr<QImage> mContentImage;
|
||||||
SynEditFoldRanges mAllFoldRanges;
|
CodeFoldingRanges mAllFoldRanges;
|
||||||
SynEditCodeFolding mCodeFolding;
|
CodeFoldingOptions mCodeFolding;
|
||||||
bool mUseCodeFolding;
|
bool mUseCodeFolding;
|
||||||
bool mAlwaysShowCaret;
|
bool mAlwaysShowCaret;
|
||||||
BufferCoord mBlockBegin;
|
BufferCoord mBlockBegin;
|
||||||
|
@ -664,7 +649,6 @@ private:
|
||||||
int mCharWidth;
|
int mCharWidth;
|
||||||
QFont mFontDummy;
|
QFont mFontDummy;
|
||||||
QFont mFontForNonAscii;
|
QFont mFontForNonAscii;
|
||||||
SynFontSmoothMethod mFontSmoothing;
|
|
||||||
bool mMouseMoved;
|
bool mMouseMoved;
|
||||||
|
|
||||||
bool mInserting;
|
bool mInserting;
|
||||||
|
@ -676,21 +660,19 @@ private:
|
||||||
bool mReadOnly;
|
bool mReadOnly;
|
||||||
int mRightEdge;
|
int mRightEdge;
|
||||||
QColor mRightEdgeColor;
|
QColor mRightEdgeColor;
|
||||||
QColor mScrollHintColor;
|
ScrollStyle mScrollBars;
|
||||||
SynScrollHintFormat mScrollHintFormat;
|
|
||||||
SynScrollStyle mScrollBars;
|
|
||||||
int mTextHeight;
|
int mTextHeight;
|
||||||
int mTopLine;
|
int mTopLine;
|
||||||
PSynHighlighter mHighlighter;
|
PHighlighter mHighlighter;
|
||||||
QColor mSelectedForeground;
|
QColor mSelectedForeground;
|
||||||
QColor mSelectedBackground;
|
QColor mSelectedBackground;
|
||||||
QColor mForegroundColor;
|
QColor mForegroundColor;
|
||||||
QColor mBackgroundColor;
|
QColor mBackgroundColor;
|
||||||
QColor mCaretColor;
|
QColor mCaretColor;
|
||||||
PSynHighlighterAttribute mRainbowAttr0;
|
PHighlighterAttribute mRainbowAttr0;
|
||||||
PSynHighlighterAttribute mRainbowAttr1;
|
PHighlighterAttribute mRainbowAttr1;
|
||||||
PSynHighlighterAttribute mRainbowAttr2;
|
PHighlighterAttribute mRainbowAttr2;
|
||||||
PSynHighlighterAttribute mRainbowAttr3;
|
PHighlighterAttribute mRainbowAttr3;
|
||||||
|
|
||||||
bool mCaretUseTextColor;
|
bool mCaretUseTextColor;
|
||||||
QColor mActiveLineColor;
|
QColor mActiveLineColor;
|
||||||
|
@ -699,22 +681,22 @@ private:
|
||||||
QPoint mMouseDownPos;
|
QPoint mMouseDownPos;
|
||||||
bool mHideSelection;
|
bool mHideSelection;
|
||||||
int mMouseWheelAccumulator;
|
int mMouseWheelAccumulator;
|
||||||
SynEditCaretType mOverwriteCaret;
|
EditCaretType mOverwriteCaret;
|
||||||
SynEditCaretType mInsertCaret;
|
EditCaretType mInsertCaret;
|
||||||
QPoint mCaretOffset;
|
QPoint mCaretOffset;
|
||||||
SynEditKeyStrokes mKeyStrokes;
|
EditKeyStrokes mKeyStrokes;
|
||||||
bool mModified;
|
bool mModified;
|
||||||
QDateTime mLastModifyTime;
|
QDateTime mLastModifyTime;
|
||||||
int mExtraLineSpacing;
|
int mExtraLineSpacing;
|
||||||
SynSelectionMode mSelectionMode;
|
SelectionMode mSelectionMode;
|
||||||
SynSelectionMode mActiveSelectionMode; //mode of the active selection
|
SelectionMode mActiveSelectionMode; //mode of the active selection
|
||||||
bool mWantReturns;
|
bool mWantReturns;
|
||||||
bool mWantTabs;
|
bool mWantTabs;
|
||||||
SynGutter mGutter;
|
Gutter mGutter;
|
||||||
QRect mInvalidateRect;
|
QRect mInvalidateRect;
|
||||||
SynStateFlags mStateFlags;
|
StateFlags mStateFlags;
|
||||||
SynEditorOptions mOptions;
|
EditorOptions mOptions;
|
||||||
SynStatusChanges mStatusChanges;
|
StatusChanges mStatusChanges;
|
||||||
int mLastKey;
|
int mLastKey;
|
||||||
Qt::KeyboardModifiers mLastKeyModifiers;
|
Qt::KeyboardModifiers mLastKeyModifiers;
|
||||||
//fSearchEngine: TSynEditSearchCustom;
|
//fSearchEngine: TSynEditSearchCustom;
|
||||||
|
@ -733,12 +715,12 @@ private:
|
||||||
int mPainterLock; // lock counter to prevent repaint while painting
|
int mPainterLock; // lock counter to prevent repaint while painting
|
||||||
bool mUndoing;
|
bool mUndoing;
|
||||||
// event handlers
|
// event handlers
|
||||||
SynProcessCommandProc mOnCommandProcessed;
|
ProcessCommandProc mOnCommandProcessed;
|
||||||
SynMouseCursorProc mOnMouseCursor;
|
MouseCursorProc mOnMouseCursor;
|
||||||
SynPaintProc mOnPaint;
|
PaintProc mOnPaint;
|
||||||
// SynPreparePaintHighlightTokenProc mOnPaintHighlightToken;
|
// SynPreparePaintHighlightTokenProc mOnPaintHighlightToken;
|
||||||
SynProcessCommandProc mOnProcessingCommand;
|
ProcessCommandProc mOnProcessingCommand;
|
||||||
SynProcessCommandProc mOnProcessingUserCommand;
|
ProcessCommandProc mOnProcessingUserCommand;
|
||||||
|
|
||||||
// SynSpecialLineColorsProc mOnSpecialLineColors;
|
// SynSpecialLineColorsProc mOnSpecialLineColors;
|
||||||
// SynEditingAreasProc mOnEditingAreas;
|
// SynEditingAreasProc mOnEditingAreas;
|
||||||
|
@ -796,6 +778,9 @@ protected:
|
||||||
int mouseSelectionScrollSpeed() const;
|
int mouseSelectionScrollSpeed() const;
|
||||||
void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed);
|
void setMouseSelectionScrollSpeed(int newMouseSelectionScrollSpeed);
|
||||||
|
|
||||||
|
ScrollStyle scrollBars() const;
|
||||||
|
void setScrollBars(ScrollStyle newScrollBars);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||||
void dropEvent(QDropEvent *event) override;
|
void dropEvent(QDropEvent *event) override;
|
||||||
|
|
|
@ -153,7 +153,7 @@ QString SynDocument::lineBreak() const
|
||||||
return "\n";
|
return "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
SynRangeState SynDocument::ranges(int Index)
|
HighlighterState SynDocument::ranges(int Index)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (Index>=0 && Index < mLines.size()) {
|
if (Index>=0 && Index < mLines.size()) {
|
||||||
|
@ -161,7 +161,7 @@ SynRangeState SynDocument::ranges(int Index)
|
||||||
} else {
|
} else {
|
||||||
ListIndexOutOfBounds(Index);
|
ListIndexOutOfBounds(Index);
|
||||||
}
|
}
|
||||||
return SynRangeState();
|
return HighlighterState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynDocument::insertItem(int Index, const QString &s)
|
void SynDocument::insertItem(int Index, const QString &s)
|
||||||
|
@ -196,7 +196,7 @@ void SynDocument::setAppendNewLineAtEOF(bool appendNewLineAtEOF)
|
||||||
mAppendNewLineAtEOF = appendNewLineAtEOF;
|
mAppendNewLineAtEOF = appendNewLineAtEOF;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynDocument::setRange(int Index, const SynRangeState& ARange)
|
void SynDocument::setRange(int Index, const HighlighterState& ARange)
|
||||||
{
|
{
|
||||||
QMutexLocker locker(&mMutex);
|
QMutexLocker locker(&mMutex);
|
||||||
if (Index<0 || Index>=mLines.count()) {
|
if (Index<0 || Index>=mLines.count()) {
|
||||||
|
@ -839,7 +839,7 @@ SynEditUndoList::SynEditUndoList():QObject()
|
||||||
|
|
||||||
void SynEditUndoList::addChange(SynChangeReason reason, const BufferCoord &startPos,
|
void SynEditUndoList::addChange(SynChangeReason reason, const BufferCoord &startPos,
|
||||||
const BufferCoord &endPos, const QStringList& changeText,
|
const BufferCoord &endPos, const QStringList& changeText,
|
||||||
SynSelectionMode selMode)
|
SelectionMode selMode)
|
||||||
{
|
{
|
||||||
int changeNumber;
|
int changeNumber;
|
||||||
if (inBlock()) {
|
if (inBlock()) {
|
||||||
|
@ -861,7 +861,7 @@ void SynEditUndoList::addChange(SynChangeReason reason, const BufferCoord &start
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditUndoList::restoreChange(SynChangeReason AReason, const BufferCoord &AStart, const BufferCoord &AEnd, const QStringList &ChangeText, SynSelectionMode SelMode, size_t changeNumber)
|
void SynEditUndoList::restoreChange(SynChangeReason AReason, const BufferCoord &AStart, const BufferCoord &AEnd, const QStringList &ChangeText, SelectionMode SelMode, size_t changeNumber)
|
||||||
{
|
{
|
||||||
PSynEditUndoItem newItem = std::make_shared<SynEditUndoItem>(AReason,
|
PSynEditUndoItem newItem = std::make_shared<SynEditUndoItem>(AReason,
|
||||||
SelMode,AStart,AEnd,ChangeText,
|
SelMode,AStart,AEnd,ChangeText,
|
||||||
|
@ -890,7 +890,7 @@ void SynEditUndoList::addGroupBreak()
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (lastChangeReason() != SynChangeReason::GroupBreak) {
|
if (lastChangeReason() != SynChangeReason::GroupBreak) {
|
||||||
addChange(SynChangeReason::GroupBreak, {0,0}, {0,0}, QStringList(), SynSelectionMode::Normal);
|
addChange(SynChangeReason::GroupBreak, {0,0}, {0,0}, QStringList(), SelectionMode::Normal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1054,7 +1054,7 @@ void SynEditUndoList::ensureMaxEntries()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SynSelectionMode SynEditUndoItem::changeSelMode() const
|
SelectionMode SynEditUndoItem::changeSelMode() const
|
||||||
{
|
{
|
||||||
return mChangeSelMode;
|
return mChangeSelMode;
|
||||||
}
|
}
|
||||||
|
@ -1079,7 +1079,7 @@ size_t SynEditUndoItem::changeNumber() const
|
||||||
return mChangeNumber;
|
return mChangeNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynEditUndoItem::SynEditUndoItem(SynChangeReason reason, SynSelectionMode selMode,
|
SynEditUndoItem::SynEditUndoItem(SynChangeReason reason, SelectionMode selMode,
|
||||||
BufferCoord startPos, BufferCoord endPos,
|
BufferCoord startPos, BufferCoord endPos,
|
||||||
const QStringList& text, int number)
|
const QStringList& text, int number)
|
||||||
{
|
{
|
||||||
|
@ -1101,7 +1101,7 @@ SynEditRedoList::SynEditRedoList()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditRedoList::addRedo(SynChangeReason AReason, const BufferCoord &AStart, const BufferCoord &AEnd, const QStringList &ChangeText, SynSelectionMode SelMode, size_t changeNumber)
|
void SynEditRedoList::addRedo(SynChangeReason AReason, const BufferCoord &AStart, const BufferCoord &AEnd, const QStringList &ChangeText, SelectionMode SelMode, size_t changeNumber)
|
||||||
{
|
{
|
||||||
PSynEditUndoItem newItem = std::make_shared<SynEditUndoItem>(
|
PSynEditUndoItem newItem = std::make_shared<SynEditUndoItem>(
|
||||||
AReason,
|
AReason,
|
||||||
|
|
|
@ -39,7 +39,7 @@ typedef int SynEditStringFlags;
|
||||||
|
|
||||||
struct SynDocumentLine {
|
struct SynDocumentLine {
|
||||||
QString fString;
|
QString fString;
|
||||||
SynRangeState fRange;
|
HighlighterState fRange;
|
||||||
int fColumns; //
|
int fColumns; //
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -70,8 +70,8 @@ public:
|
||||||
int rightBraces(int Index);
|
int rightBraces(int Index);
|
||||||
int lengthOfLongestLine();
|
int lengthOfLongestLine();
|
||||||
QString lineBreak() const;
|
QString lineBreak() const;
|
||||||
SynRangeState ranges(int Index);
|
HighlighterState ranges(int Index);
|
||||||
void setRange(int Index, const SynRangeState& ARange);
|
void setRange(int Index, const HighlighterState& ARange);
|
||||||
QString getString(int Index);
|
QString getString(int Index);
|
||||||
int count();
|
int count();
|
||||||
QString text();
|
QString text();
|
||||||
|
@ -174,21 +174,21 @@ enum class SynChangeReason {
|
||||||
class SynEditUndoItem {
|
class SynEditUndoItem {
|
||||||
private:
|
private:
|
||||||
SynChangeReason mChangeReason;
|
SynChangeReason mChangeReason;
|
||||||
SynSelectionMode mChangeSelMode;
|
SelectionMode mChangeSelMode;
|
||||||
BufferCoord mChangeStartPos;
|
BufferCoord mChangeStartPos;
|
||||||
BufferCoord mChangeEndPos;
|
BufferCoord mChangeEndPos;
|
||||||
QStringList mChangeText;
|
QStringList mChangeText;
|
||||||
size_t mChangeNumber;
|
size_t mChangeNumber;
|
||||||
public:
|
public:
|
||||||
SynEditUndoItem(SynChangeReason reason,
|
SynEditUndoItem(SynChangeReason reason,
|
||||||
SynSelectionMode selMode,
|
SelectionMode selMode,
|
||||||
BufferCoord startPos,
|
BufferCoord startPos,
|
||||||
BufferCoord endPos,
|
BufferCoord endPos,
|
||||||
const QStringList& text,
|
const QStringList& text,
|
||||||
int number);
|
int number);
|
||||||
|
|
||||||
SynChangeReason changeReason() const;
|
SynChangeReason changeReason() const;
|
||||||
SynSelectionMode changeSelMode() const;
|
SelectionMode changeSelMode() const;
|
||||||
BufferCoord changeStartPos() const;
|
BufferCoord changeStartPos() const;
|
||||||
BufferCoord changeEndPos() const;
|
BufferCoord changeEndPos() const;
|
||||||
QStringList changeText() const;
|
QStringList changeText() const;
|
||||||
|
@ -203,10 +203,10 @@ public:
|
||||||
explicit SynEditUndoList();
|
explicit SynEditUndoList();
|
||||||
|
|
||||||
void addChange(SynChangeReason AReason, const BufferCoord& AStart, const BufferCoord& AEnd,
|
void addChange(SynChangeReason AReason, const BufferCoord& AStart, const BufferCoord& AEnd,
|
||||||
const QStringList& ChangeText, SynSelectionMode SelMode);
|
const QStringList& ChangeText, SelectionMode SelMode);
|
||||||
|
|
||||||
void restoreChange(SynChangeReason AReason, const BufferCoord& AStart, const BufferCoord& AEnd,
|
void restoreChange(SynChangeReason AReason, const BufferCoord& AStart, const BufferCoord& AEnd,
|
||||||
const QStringList& ChangeText, SynSelectionMode SelMode, size_t changeNumber);
|
const QStringList& ChangeText, SelectionMode SelMode, size_t changeNumber);
|
||||||
|
|
||||||
void restoreChange(PSynEditUndoItem item);
|
void restoreChange(PSynEditUndoItem item);
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ public:
|
||||||
explicit SynEditRedoList();
|
explicit SynEditRedoList();
|
||||||
|
|
||||||
void addRedo(SynChangeReason AReason, const BufferCoord& AStart, const BufferCoord& AEnd,
|
void addRedo(SynChangeReason AReason, const BufferCoord& AStart, const BufferCoord& AEnd,
|
||||||
const QStringList& ChangeText, SynSelectionMode SelMode, size_t changeNumber);
|
const QStringList& ChangeText, SelectionMode SelMode, size_t changeNumber);
|
||||||
void addRedo(PSynEditUndoItem item);
|
void addRedo(PSynEditUndoItem item);
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
|
@ -135,7 +135,7 @@ void SynEditTextPainter::paintGutter(const QRect& clip)
|
||||||
if (edit->mGutter.activeLineTextColor().isValid()) {
|
if (edit->mGutter.activeLineTextColor().isValid()) {
|
||||||
if (
|
if (
|
||||||
(edit->mCaretY==vLine) ||
|
(edit->mCaretY==vLine) ||
|
||||||
(edit->mActiveSelectionMode == SynSelectionMode::Column && vLine >= selectionStart.line && vLine <= selectionEnd.line)
|
(edit->mActiveSelectionMode == SelectionMode::Column && vLine >= selectionStart.line && vLine <= selectionEnd.line)
|
||||||
)
|
)
|
||||||
painter->setPen(edit->mGutter.activeLineTextColor());
|
painter->setPen(edit->mGutter.activeLineTextColor());
|
||||||
else
|
else
|
||||||
|
@ -195,7 +195,7 @@ void SynEditTextPainter::paintGutter(const QRect& clip)
|
||||||
rcFold.top() + rcFold.height() / 2);
|
rcFold.top() + rcFold.height() / 2);
|
||||||
}
|
}
|
||||||
// Any fold ranges beginning on this line?
|
// Any fold ranges beginning on this line?
|
||||||
PSynEditFoldRange FoldRange = edit->foldStartAtLine(vLine);
|
PCodeFoldingRange FoldRange = edit->foldStartAtLine(vLine);
|
||||||
if (FoldRange) {
|
if (FoldRange) {
|
||||||
// Draw the bottom part of a line
|
// Draw the bottom part of a line
|
||||||
if (!FoldRange->collapsed) {
|
if (!FoldRange->collapsed) {
|
||||||
|
@ -307,7 +307,7 @@ void SynEditTextPainter::computeSelectionInfo()
|
||||||
}
|
}
|
||||||
// In the column selection mode sort the begin and end of the selection,
|
// In the column selection mode sort the begin and end of the selection,
|
||||||
// this makes the painting code simpler.
|
// this makes the painting code simpler.
|
||||||
if (edit->mActiveSelectionMode == SynSelectionMode::Column && vSelStart.Column > vSelEnd.Column)
|
if (edit->mActiveSelectionMode == SelectionMode::Column && vSelStart.Column > vSelEnd.Column)
|
||||||
std::swap(vSelStart.Column, vSelEnd.Column);
|
std::swap(vSelStart.Column, vSelEnd.Column);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ void SynEditTextPainter::paintToken(const QString &token, int tokenCols, int col
|
||||||
for (int i=0;i<token.length();i++) {
|
for (int i=0;i<token.length();i++) {
|
||||||
int charCols=0;
|
int charCols=0;
|
||||||
QString textToPaint = token[i];
|
QString textToPaint = token[i];
|
||||||
if (token[i] == SynTabChar) {
|
if (token[i] == '\t') {
|
||||||
charCols = edit->tabWidth() - ((columnsBefore+tokenColLen) % edit->tabWidth());
|
charCols = edit->tabWidth() - ((columnsBefore+tokenColLen) % edit->tabWidth());
|
||||||
} else {
|
} else {
|
||||||
charCols = edit->charColumns(token[i]);
|
charCols = edit->charColumns(token[i]);
|
||||||
|
@ -411,7 +411,7 @@ void SynEditTextPainter::paintToken(const QString &token, int tokenCols, int col
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditTextPainter::paintEditAreas(const SynEditingAreaList &areaList)
|
void SynEditTextPainter::paintEditAreas(const EditingAreaList &areaList)
|
||||||
{
|
{
|
||||||
QRect rc;
|
QRect rc;
|
||||||
int x1,x2;
|
int x1,x2;
|
||||||
|
@ -420,7 +420,7 @@ void SynEditTextPainter::paintEditAreas(const SynEditingAreaList &areaList)
|
||||||
rc=rcLine;
|
rc=rcLine;
|
||||||
rc.setBottom(rc.bottom()-1);
|
rc.setBottom(rc.bottom()-1);
|
||||||
setDrawingColors(false);
|
setDrawingColors(false);
|
||||||
for (const PSynEditingArea& p:areaList) {
|
for (const PEditingArea& p:areaList) {
|
||||||
if (p->beginX > LastCol)
|
if (p->beginX > LastCol)
|
||||||
continue;
|
continue;
|
||||||
if (p->endX < FirstCol)
|
if (p->endX < FirstCol)
|
||||||
|
@ -438,13 +438,13 @@ void SynEditTextPainter::paintEditAreas(const SynEditingAreaList &areaList)
|
||||||
painter->setPen(p->color);
|
painter->setPen(p->color);
|
||||||
painter->setBrush(Qt::NoBrush);
|
painter->setBrush(Qt::NoBrush);
|
||||||
switch(p->type) {
|
switch(p->type) {
|
||||||
case SynEditingAreaType::eatRectangleBorder:
|
case EditingAreaType::eatRectangleBorder:
|
||||||
painter->drawRect(rc);
|
painter->drawRect(rc);
|
||||||
break;
|
break;
|
||||||
case SynEditingAreaType::eatUnderLine:
|
case EditingAreaType::eatUnderLine:
|
||||||
painter->drawLine(rc.left(),rc.bottom(),rc.right(),rc.bottom());
|
painter->drawLine(rc.left(),rc.bottom(),rc.right(),rc.bottom());
|
||||||
break;
|
break;
|
||||||
case SynEditingAreaType::eatWaveUnderLine:
|
case EditingAreaType::eatWaveUnderLine:
|
||||||
offset=3;
|
offset=3;
|
||||||
int lastX=rc.left();
|
int lastX=rc.left();
|
||||||
int lastY=rc.bottom()-offset;
|
int lastY=rc.bottom()-offset;
|
||||||
|
@ -498,16 +498,16 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
||||||
// if (bSpecialLine && edit->mOptions.testFlag(eoSpecialLineDefaultFg))
|
// if (bSpecialLine && edit->mOptions.testFlag(eoSpecialLineDefaultFg))
|
||||||
// colFG = TokenAccu.FG;
|
// colFG = TokenAccu.FG;
|
||||||
QFont font = edit->font();
|
QFont font = edit->font();
|
||||||
font.setBold(TokenAccu.Style & SynFontStyle::fsBold);
|
font.setBold(TokenAccu.Style & FontStyle::fsBold);
|
||||||
font.setItalic(TokenAccu.Style & SynFontStyle::fsItalic);
|
font.setItalic(TokenAccu.Style & FontStyle::fsItalic);
|
||||||
font.setStrikeOut(TokenAccu.Style & SynFontStyle::fsStrikeOut);
|
font.setStrikeOut(TokenAccu.Style & FontStyle::fsStrikeOut);
|
||||||
font.setUnderline(TokenAccu.Style & SynFontStyle::fsUnderline);
|
font.setUnderline(TokenAccu.Style & FontStyle::fsUnderline);
|
||||||
painter->setFont(font);
|
painter->setFont(font);
|
||||||
QFont nonAsciiFont = edit->fontForNonAscii();
|
QFont nonAsciiFont = edit->fontForNonAscii();
|
||||||
nonAsciiFont.setBold(TokenAccu.Style & SynFontStyle::fsBold);
|
nonAsciiFont.setBold(TokenAccu.Style & FontStyle::fsBold);
|
||||||
nonAsciiFont.setItalic(TokenAccu.Style & SynFontStyle::fsItalic);
|
nonAsciiFont.setItalic(TokenAccu.Style & FontStyle::fsItalic);
|
||||||
nonAsciiFont.setStrikeOut(TokenAccu.Style & SynFontStyle::fsStrikeOut);
|
nonAsciiFont.setStrikeOut(TokenAccu.Style & FontStyle::fsStrikeOut);
|
||||||
nonAsciiFont.setUnderline(TokenAccu.Style & SynFontStyle::fsUnderline);
|
nonAsciiFont.setUnderline(TokenAccu.Style & FontStyle::fsUnderline);
|
||||||
|
|
||||||
// Paint the chars
|
// Paint the chars
|
||||||
if (bComplexToken) {
|
if (bComplexToken) {
|
||||||
|
@ -548,7 +548,7 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
||||||
if (rcToken.left() < nX1) {
|
if (rcToken.left() < nX1) {
|
||||||
setDrawingColors(false);
|
setDrawingColors(false);
|
||||||
rcToken.setRight(nX1);
|
rcToken.setRight(nX1);
|
||||||
// if (TokenAccu.Len != 0 && TokenAccu.Style != SynFontStyle::fsNone)
|
// if (TokenAccu.Len != 0 && TokenAccu.Style != FontStyle::fsNone)
|
||||||
// AdjustEndRect();
|
// AdjustEndRect();
|
||||||
painter->fillRect(rcToken,painter->brush());
|
painter->fillRect(rcToken,painter->brush());
|
||||||
rcToken.setLeft(nX1);
|
rcToken.setLeft(nX1);
|
||||||
|
@ -567,7 +567,7 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
|
||||||
} else {
|
} else {
|
||||||
setDrawingColors(bLineSelected);
|
setDrawingColors(bLineSelected);
|
||||||
rcToken.setRight(rcLine.right());
|
rcToken.setRight(rcLine.right());
|
||||||
// if (TokenAccu.Len != 0 && TokenAccu.Style != SynFontStyle::fsNone)
|
// if (TokenAccu.Len != 0 && TokenAccu.Style != FontStyle::fsNone)
|
||||||
// AdjustEndRect();
|
// AdjustEndRect();
|
||||||
painter->fillRect(rcToken,painter->brush());
|
painter->fillRect(rcToken,painter->brush());
|
||||||
}
|
}
|
||||||
|
@ -594,11 +594,11 @@ bool SynEditTextPainter::tokenIsSpaces(bool &bSpacesTest, const QString& token,
|
||||||
// record. This will paint any chars already stored if there is
|
// record. This will paint any chars already stored if there is
|
||||||
// a (visible) change in the attributes.
|
// a (visible) change in the attributes.
|
||||||
void SynEditTextPainter::addHighlightToken(const QString &Token, int columnsBefore,
|
void SynEditTextPainter::addHighlightToken(const QString &Token, int columnsBefore,
|
||||||
int tokenColumns, int cLine, PSynHighlighterAttribute p_Attri)
|
int tokenColumns, int cLine, PHighlighterAttribute p_Attri)
|
||||||
{
|
{
|
||||||
bool bCanAppend;
|
bool bCanAppend;
|
||||||
QColor foreground, background;
|
QColor foreground, background;
|
||||||
SynFontStyles style;
|
FontStyles style;
|
||||||
bool bSpacesTest,bIsSpaces;
|
bool bSpacesTest,bIsSpaces;
|
||||||
|
|
||||||
if (p_Attri) {
|
if (p_Attri) {
|
||||||
|
@ -629,7 +629,7 @@ void SynEditTextPainter::addHighlightToken(const QString &Token, int columnsBefo
|
||||||
bSpacesTest = false;
|
bSpacesTest = false;
|
||||||
if (TokenAccu.Columns > 0) {
|
if (TokenAccu.Columns > 0) {
|
||||||
// font style must be the same or token is only spaces
|
// font style must be the same or token is only spaces
|
||||||
if (TokenAccu.Style == style || ( (style & SynFontStyle::fsUnderline) == (TokenAccu.Style & fsUnderline)
|
if (TokenAccu.Style == style || ( (style & FontStyle::fsUnderline) == (TokenAccu.Style & fsUnderline)
|
||||||
&& tokenIsSpaces(bSpacesTest,Token,bIsSpaces)) ) {
|
&& tokenIsSpaces(bSpacesTest,Token,bIsSpaces)) ) {
|
||||||
if (
|
if (
|
||||||
// background color must be the same and
|
// background color must be the same and
|
||||||
|
@ -706,12 +706,12 @@ void SynEditTextPainter::paintFoldAttributes()
|
||||||
indentLevel++ ;
|
indentLevel++ ;
|
||||||
if (edit->mHighlighter) {
|
if (edit->mHighlighter) {
|
||||||
if (edit->mCodeFolding.indentGuides) {
|
if (edit->mCodeFolding.indentGuides) {
|
||||||
PSynHighlighterAttribute attr = edit->mHighlighter->symbolAttribute();
|
PHighlighterAttribute attr = edit->mHighlighter->symbolAttribute();
|
||||||
getBraceColorAttr(indentLevel,attr);
|
getBraceColorAttr(indentLevel,attr);
|
||||||
paintColor = attr->foreground();
|
paintColor = attr->foreground();
|
||||||
}
|
}
|
||||||
if (edit->mCodeFolding.fillIndents) {
|
if (edit->mCodeFolding.fillIndents) {
|
||||||
PSynHighlighterAttribute attr = edit->mHighlighter->symbolAttribute();
|
PHighlighterAttribute attr = edit->mHighlighter->symbolAttribute();
|
||||||
getBraceColorAttr(indentLevel,attr);
|
getBraceColorAttr(indentLevel,attr);
|
||||||
gradientStart=attr->foreground();
|
gradientStart=attr->foreground();
|
||||||
attr = edit->mHighlighter->symbolAttribute();
|
attr = edit->mHighlighter->symbolAttribute();
|
||||||
|
@ -752,7 +752,7 @@ void SynEditTextPainter::paintFoldAttributes()
|
||||||
if (edit->mCodeFolding.showCollapsedLine) {
|
if (edit->mCodeFolding.showCollapsedLine) {
|
||||||
painter->setPen(edit->mCodeFolding.collapsedLineColor);
|
painter->setPen(edit->mCodeFolding.collapsedLineColor);
|
||||||
for (int i=0; i< edit->mAllFoldRanges.count();i++) {
|
for (int i=0; i< edit->mAllFoldRanges.count();i++) {
|
||||||
PSynEditFoldRange range = edit->mAllFoldRanges[i];
|
PCodeFoldingRange range = edit->mAllFoldRanges[i];
|
||||||
if (range->collapsed && !range->parentCollapsed() &&
|
if (range->collapsed && !range->parentCollapsed() &&
|
||||||
(range->fromLine <= vLastLine) && (range->fromLine >= vFirstLine) ) {
|
(range->fromLine <= vLastLine) && (range->fromLine >= vFirstLine) ) {
|
||||||
// Get starting and end points
|
// Get starting and end points
|
||||||
|
@ -764,13 +764,13 @@ void SynEditTextPainter::paintFoldAttributes()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditTextPainter::getBraceColorAttr(int level, PSynHighlighterAttribute &attr)
|
void SynEditTextPainter::getBraceColorAttr(int level, PHighlighterAttribute &attr)
|
||||||
{
|
{
|
||||||
if (!edit->mOptions.testFlag(SynEditorOption::eoShowRainbowColor))
|
if (!edit->mOptions.testFlag(EditorOption::eoShowRainbowColor))
|
||||||
return;
|
return;
|
||||||
if (attr != edit->mHighlighter->symbolAttribute())
|
if (attr != edit->mHighlighter->symbolAttribute())
|
||||||
return;
|
return;
|
||||||
PSynHighlighterAttribute oldAttr = attr;
|
PHighlighterAttribute oldAttr = attr;
|
||||||
switch(level % 4) {
|
switch(level % 4) {
|
||||||
case 0:
|
case 0:
|
||||||
attr = edit->mRainbowAttr0;
|
attr = edit->mRainbowAttr0;
|
||||||
|
@ -796,12 +796,12 @@ void SynEditTextPainter::paintLines()
|
||||||
QString sLine; // the current line
|
QString sLine; // the current line
|
||||||
QString sToken; // highlighter token info
|
QString sToken; // highlighter token info
|
||||||
int nTokenColumnsBefore, nTokenColumnLen;
|
int nTokenColumnsBefore, nTokenColumnLen;
|
||||||
PSynHighlighterAttribute attr;
|
PHighlighterAttribute attr;
|
||||||
int vFirstChar;
|
int vFirstChar;
|
||||||
int vLastChar;
|
int vLastChar;
|
||||||
SynEditingAreaList areaList;
|
EditingAreaList areaList;
|
||||||
PSynEditFoldRange foldRange;
|
PCodeFoldingRange foldRange;
|
||||||
PSynHighlighterAttribute preeditAttr;
|
PHighlighterAttribute preeditAttr;
|
||||||
int nFold;
|
int nFold;
|
||||||
QString sFold;
|
QString sFold;
|
||||||
|
|
||||||
|
@ -822,7 +822,7 @@ void SynEditTextPainter::paintLines()
|
||||||
// Get the line.
|
// Get the line.
|
||||||
sLine = edit->mDocument->getString(vLine - 1);
|
sLine = edit->mDocument->getString(vLine - 1);
|
||||||
// determine whether will be painted with ActiveLineColor
|
// determine whether will be painted with ActiveLineColor
|
||||||
if (edit->mActiveSelectionMode == SynSelectionMode::Column) {
|
if (edit->mActiveSelectionMode == SelectionMode::Column) {
|
||||||
bCurrentLine = (vLine >= selectionBegin.line && vLine <= selectionEnd.line);
|
bCurrentLine = (vLine >= selectionBegin.line && vLine <= selectionEnd.line);
|
||||||
} else {
|
} else {
|
||||||
bCurrentLine = (edit->mCaretY == vLine);
|
bCurrentLine = (edit->mCaretY == vLine);
|
||||||
|
@ -860,8 +860,8 @@ void SynEditTextPainter::paintLines()
|
||||||
// selection mode and a good start for the smNormal mode.
|
// selection mode and a good start for the smNormal mode.
|
||||||
nLineSelStart = FirstCol;
|
nLineSelStart = FirstCol;
|
||||||
nLineSelEnd = LastCol + 1;
|
nLineSelEnd = LastCol + 1;
|
||||||
if ((edit->mActiveSelectionMode == SynSelectionMode::Column) ||
|
if ((edit->mActiveSelectionMode == SelectionMode::Column) ||
|
||||||
((edit->mActiveSelectionMode == SynSelectionMode::Normal) && (cRow == vSelStart.Row)) ) {
|
((edit->mActiveSelectionMode == SelectionMode::Normal) && (cRow == vSelStart.Row)) ) {
|
||||||
int ch = edit->columnToChar(vLine,vSelStart.Column);
|
int ch = edit->columnToChar(vLine,vSelStart.Column);
|
||||||
ch = edit->charToColumn(vLine,ch);
|
ch = edit->charToColumn(vLine,ch);
|
||||||
if (ch > LastCol) {
|
if (ch > LastCol) {
|
||||||
|
@ -872,8 +872,8 @@ void SynEditTextPainter::paintLines()
|
||||||
bComplexLine = true;
|
bComplexLine = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( (edit->mActiveSelectionMode == SynSelectionMode::Column) ||
|
if ( (edit->mActiveSelectionMode == SelectionMode::Column) ||
|
||||||
((edit->mActiveSelectionMode == SynSelectionMode::Normal) && (cRow == vSelEnd.Row)) ) {
|
((edit->mActiveSelectionMode == SelectionMode::Normal) && (cRow == vSelEnd.Row)) ) {
|
||||||
int ch = edit->columnToChar(vLine,vSelEnd.Column);
|
int ch = edit->columnToChar(vLine,vSelEnd.Column);
|
||||||
int col = edit->charToColumn(vLine,ch);
|
int col = edit->charToColumn(vLine,ch);
|
||||||
if (col<vSelEnd.Column)
|
if (col<vSelEnd.Column)
|
||||||
|
@ -904,8 +904,8 @@ void SynEditTextPainter::paintLines()
|
||||||
nTokenColumnLen = edit->mDocument->lineColumns(vLine-1);
|
nTokenColumnLen = edit->mDocument->lineColumns(vLine-1);
|
||||||
}
|
}
|
||||||
if (edit->mOptions.testFlag(eoShowSpecialChars) && (!bLineSelected) && (!bSpecialLine) && (nTokenColumnLen < vLastChar)) {
|
if (edit->mOptions.testFlag(eoShowSpecialChars) && (!bLineSelected) && (!bSpecialLine) && (nTokenColumnLen < vLastChar)) {
|
||||||
sToken = sToken + SynLineBreakGlyph;
|
sToken = sToken + LineBreakGlyph;
|
||||||
nTokenColumnLen += edit->charColumns(SynLineBreakGlyph);
|
nTokenColumnLen += edit->charColumns(LineBreakGlyph);
|
||||||
}
|
}
|
||||||
if (bComplexLine) {
|
if (bComplexLine) {
|
||||||
setDrawingColors(true);
|
setDrawingColors(true);
|
||||||
|
@ -925,12 +925,12 @@ void SynEditTextPainter::paintLines()
|
||||||
}
|
}
|
||||||
//Paint editingAreaBorders
|
//Paint editingAreaBorders
|
||||||
if (bCurrentLine && edit->mInputPreeditString.length()>0) {
|
if (bCurrentLine && edit->mInputPreeditString.length()>0) {
|
||||||
PSynEditingArea area = std::make_shared<SynEditingArea>();
|
PEditingArea area = std::make_shared<EditingArea>();
|
||||||
int col = edit->charToColumn(edit->mCaretY,edit->mCaretX);
|
int col = edit->charToColumn(edit->mCaretY,edit->mCaretX);
|
||||||
int ch = edit->columnToChar(vLine,col);
|
int ch = edit->columnToChar(vLine,col);
|
||||||
area->beginX = edit->charToColumn(sLine,ch);
|
area->beginX = edit->charToColumn(sLine,ch);
|
||||||
area->endX = edit->charToColumn(sLine,ch + edit->mInputPreeditString.length());
|
area->endX = edit->charToColumn(sLine,ch + edit->mInputPreeditString.length());
|
||||||
area->type = SynEditingAreaType::eatUnderLine;
|
area->type = EditingAreaType::eatUnderLine;
|
||||||
area->color = colFG;
|
area->color = colFG;
|
||||||
areaList.append(area);
|
areaList.append(area);
|
||||||
paintEditAreas(areaList);
|
paintEditAreas(areaList);
|
||||||
|
@ -981,7 +981,7 @@ void SynEditTextPainter::paintLines()
|
||||||
|| sToken == "("
|
|| sToken == "("
|
||||||
|| sToken == "{"
|
|| sToken == "{"
|
||||||
) {
|
) {
|
||||||
SynRangeState rangeState = edit->mHighlighter->getRangeState();
|
HighlighterState rangeState = edit->mHighlighter->getState();
|
||||||
getBraceColorAttr(rangeState.bracketLevel
|
getBraceColorAttr(rangeState.bracketLevel
|
||||||
+rangeState.braceLevel
|
+rangeState.braceLevel
|
||||||
+rangeState.parenthesisLevel
|
+rangeState.parenthesisLevel
|
||||||
|
@ -990,7 +990,7 @@ void SynEditTextPainter::paintLines()
|
||||||
|| sToken == ")"
|
|| sToken == ")"
|
||||||
|| sToken == "}"
|
|| sToken == "}"
|
||||||
){
|
){
|
||||||
SynRangeState rangeState = edit->mHighlighter->getRangeState();
|
HighlighterState rangeState = edit->mHighlighter->getState();
|
||||||
getBraceColorAttr(rangeState.bracketLevel
|
getBraceColorAttr(rangeState.bracketLevel
|
||||||
+rangeState.braceLevel
|
+rangeState.braceLevel
|
||||||
+rangeState.parenthesisLevel+1,
|
+rangeState.parenthesisLevel+1,
|
||||||
|
@ -1028,15 +1028,15 @@ void SynEditTextPainter::paintLines()
|
||||||
if (nTokenColumnLen > 0) {
|
if (nTokenColumnLen > 0) {
|
||||||
sToken = edit->substringByColumns(sLine,nTokenColumnsBefore+1,nTokenColumnLen);
|
sToken = edit->substringByColumns(sLine,nTokenColumnsBefore+1,nTokenColumnLen);
|
||||||
addHighlightToken(sToken, nTokenColumnsBefore - (vFirstChar - FirstCol),
|
addHighlightToken(sToken, nTokenColumnsBefore - (vFirstChar - FirstCol),
|
||||||
nTokenColumnLen, vLine, PSynHighlighterAttribute());
|
nTokenColumnLen, vLine, PHighlighterAttribute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Draw LineBreak glyph.
|
// Draw LineBreak glyph.
|
||||||
if (edit->mOptions.testFlag(eoShowSpecialChars) && (!bLineSelected) &&
|
if (edit->mOptions.testFlag(eoShowSpecialChars) && (!bLineSelected) &&
|
||||||
(!bSpecialLine) && (edit->mDocument->lineColumns(vLine-1) < vLastChar)) {
|
(!bSpecialLine) && (edit->mDocument->lineColumns(vLine-1) < vLastChar)) {
|
||||||
addHighlightToken(SynLineBreakGlyph,
|
addHighlightToken(LineBreakGlyph,
|
||||||
edit->mDocument->lineColumns(vLine-1) - (vFirstChar - FirstCol),
|
edit->mDocument->lineColumns(vLine-1) - (vFirstChar - FirstCol),
|
||||||
edit->charColumns(SynLineBreakGlyph),vLine, edit->mHighlighter->whitespaceAttribute());
|
edit->charColumns(LineBreakGlyph),vLine, edit->mHighlighter->whitespaceAttribute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1046,7 +1046,7 @@ void SynEditTextPainter::paintLines()
|
||||||
sFold = edit->highlighter()->foldString();
|
sFold = edit->highlighter()->foldString();
|
||||||
nFold = edit->stringColumns(sFold,edit->mDocument->lineColumns(vLine-1));
|
nFold = edit->stringColumns(sFold,edit->mDocument->lineColumns(vLine-1));
|
||||||
attr = edit->mHighlighter->symbolAttribute();
|
attr = edit->mHighlighter->symbolAttribute();
|
||||||
getBraceColorAttr(edit->mHighlighter->getRangeState().braceLevel,attr);
|
getBraceColorAttr(edit->mHighlighter->getState().braceLevel,attr);
|
||||||
addHighlightToken(sFold,edit->mDocument->lineColumns(vLine-1) - (vFirstChar - FirstCol)
|
addHighlightToken(sFold,edit->mDocument->lineColumns(vLine-1) - (vFirstChar - FirstCol)
|
||||||
, nFold, vLine, attr);
|
, nFold, vLine, attr);
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1056,7 @@ void SynEditTextPainter::paintLines()
|
||||||
paintHighlightToken(true);
|
paintHighlightToken(true);
|
||||||
|
|
||||||
//Paint editingAreaBorders
|
//Paint editingAreaBorders
|
||||||
foreach (const PSynEditingArea& area, areaList) {
|
foreach (const PEditingArea& area, areaList) {
|
||||||
if (bCurrentLine && edit->mInputPreeditString.length()>0) {
|
if (bCurrentLine && edit->mInputPreeditString.length()>0) {
|
||||||
if (area->beginX > edit->mCaretX) {
|
if (area->beginX > edit->mCaretX) {
|
||||||
area->beginX+=edit->mInputPreeditString.length();
|
area->beginX+=edit->mInputPreeditString.length();
|
||||||
|
@ -1069,12 +1069,12 @@ void SynEditTextPainter::paintLines()
|
||||||
area->endX = edit->charToColumn(sLine,area->endX);
|
area->endX = edit->charToColumn(sLine,area->endX);
|
||||||
}
|
}
|
||||||
if (bCurrentLine && edit->mInputPreeditString.length()>0) {
|
if (bCurrentLine && edit->mInputPreeditString.length()>0) {
|
||||||
PSynEditingArea area = std::make_shared<SynEditingArea>();
|
PEditingArea area = std::make_shared<EditingArea>();
|
||||||
int col = edit->charToColumn(edit->mCaretY,edit->mCaretX);
|
int col = edit->charToColumn(edit->mCaretY,edit->mCaretX);
|
||||||
int ch = edit->columnToChar(vLine,col);
|
int ch = edit->columnToChar(vLine,col);
|
||||||
area->beginX = edit->charToColumn(sLine,ch);
|
area->beginX = edit->charToColumn(sLine,ch);
|
||||||
area->endX = edit->charToColumn(sLine,ch + edit->mInputPreeditString.length());
|
area->endX = edit->charToColumn(sLine,ch + edit->mInputPreeditString.length());
|
||||||
area->type = SynEditingAreaType::eatUnderLine;
|
area->type = EditingAreaType::eatUnderLine;
|
||||||
if (preeditAttr) {
|
if (preeditAttr) {
|
||||||
area->color = preeditAttr->foreground();
|
area->color = preeditAttr->foreground();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class SynEditTextPainter
|
||||||
QString s;
|
QString s;
|
||||||
QColor FG;
|
QColor FG;
|
||||||
QColor BG;
|
QColor BG;
|
||||||
SynFontStyles Style;
|
FontStyles Style;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -51,14 +51,14 @@ private:
|
||||||
void paintToken(const QString& token, int tokenLen, int columnsBefore,
|
void paintToken(const QString& token, int tokenLen, int columnsBefore,
|
||||||
int first, int last, bool isSelection, const QFont& font,
|
int first, int last, bool isSelection, const QFont& font,
|
||||||
const QFont& fontForNonAscii);
|
const QFont& fontForNonAscii);
|
||||||
void paintEditAreas(const SynEditingAreaList& areaList);
|
void paintEditAreas(const EditingAreaList& areaList);
|
||||||
void paintHighlightToken(bool bFillToEOL);
|
void paintHighlightToken(bool bFillToEOL);
|
||||||
bool tokenIsSpaces(bool& bSpacesTest, const QString& token, bool& bIsSpaces);
|
bool tokenIsSpaces(bool& bSpacesTest, const QString& token, bool& bIsSpaces);
|
||||||
void addHighlightToken(const QString& token, int columnsBefore, int tokenColumns,
|
void addHighlightToken(const QString& token, int columnsBefore, int tokenColumns,
|
||||||
int cLine, PSynHighlighterAttribute p_Attri);
|
int cLine, PHighlighterAttribute p_Attri);
|
||||||
|
|
||||||
void paintFoldAttributes();
|
void paintFoldAttributes();
|
||||||
void getBraceColorAttr(int level, PSynHighlighterAttribute &attr);
|
void getBraceColorAttr(int level, PHighlighterAttribute &attr);
|
||||||
void paintLines();
|
void paintLines();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
enum class SynSelectionMode {Normal, Line, Column};
|
enum class SelectionMode {Normal, Line, Column};
|
||||||
|
|
||||||
struct BufferCoord {
|
struct BufferCoord {
|
||||||
int ch;
|
int ch;
|
||||||
|
@ -42,7 +42,7 @@ struct DisplayCoord {
|
||||||
int Row;
|
int Row;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum SynFontStyle {
|
enum FontStyle {
|
||||||
fsNone = 0,
|
fsNone = 0,
|
||||||
fsBold = 0x0001,
|
fsBold = 0x0001,
|
||||||
fsItalic = 0x0002,
|
fsItalic = 0x0002,
|
||||||
|
@ -50,27 +50,27 @@ enum SynFontStyle {
|
||||||
fsStrikeOut = 0x0008
|
fsStrikeOut = 0x0008
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(SynFontStyles,SynFontStyle)
|
Q_DECLARE_FLAGS(FontStyles,FontStyle)
|
||||||
|
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(SynFontStyles)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(FontStyles)
|
||||||
|
|
||||||
enum class SynEditingAreaType {
|
enum class EditingAreaType {
|
||||||
eatRectangleBorder,
|
eatRectangleBorder,
|
||||||
eatWaveUnderLine,
|
eatWaveUnderLine,
|
||||||
eatUnderLine
|
eatUnderLine
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SynEditingArea {
|
struct EditingArea {
|
||||||
int beginX;
|
int beginX;
|
||||||
int endX;
|
int endX;
|
||||||
QColor color;
|
QColor color;
|
||||||
SynEditingAreaType type;
|
EditingAreaType type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
using PSynEditingArea = std::shared_ptr<SynEditingArea>;
|
using PEditingArea = std::shared_ptr<EditingArea>;
|
||||||
using SynEditingAreaList = QList<PSynEditingArea>;
|
using EditingAreaList = QList<PEditingArea>;
|
||||||
using PSynEditingAreaList = std::shared_ptr<SynEditingAreaList>;
|
using PEditingAreaList = std::shared_ptr<EditingAreaList>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ SynExporter::SynExporter(const QByteArray charset):mCharset(charset)
|
||||||
void SynExporter::clear()
|
void SynExporter::clear()
|
||||||
{
|
{
|
||||||
mBuffer.clear();
|
mBuffer.clear();
|
||||||
mLastStyle = SynFontStyle::fsNone;
|
mLastStyle = FontStyle::fsNone;
|
||||||
mLastBG = QGuiApplication::palette().color(QPalette::Base);
|
mLastBG = QGuiApplication::palette().color(QPalette::Base);
|
||||||
mLastFG = QGuiApplication::palette().color(QPalette::Text);
|
mLastFG = QGuiApplication::palette().color(QPalette::Text);
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ void SynExporter::ExportRange(PSynDocument ALines, BufferCoord Start, BufferCoor
|
||||||
// export the line
|
// export the line
|
||||||
mHighlighter->setLine(Line, i);
|
mHighlighter->setLine(Line, i);
|
||||||
while (!mHighlighter->eol()) {
|
while (!mHighlighter->eol()) {
|
||||||
PSynHighlighterAttribute attri = mHighlighter->getTokenAttribute();
|
PHighlighterAttribute attri = mHighlighter->getTokenAttribute();
|
||||||
int startPos = mHighlighter->getTokenPos();
|
int startPos = mHighlighter->getTokenPos();
|
||||||
QString token = mHighlighter->getToken();
|
QString token = mHighlighter->getToken();
|
||||||
if (i==Start.line && (startPos+token.length() < Start.ch)) {
|
if (i==Start.line && (startPos+token.length() < Start.ch)) {
|
||||||
|
@ -166,12 +166,12 @@ void SynExporter::setFont(const QFont &font)
|
||||||
mFont = font;
|
mFont = font;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighter SynExporter::highlighter() const
|
PHighlighter SynExporter::highlighter() const
|
||||||
{
|
{
|
||||||
return mHighlighter;
|
return mHighlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynExporter::setHighlighter(PSynHighlighter Value)
|
void SynExporter::setHighlighter(PHighlighter Value)
|
||||||
{
|
{
|
||||||
if (mHighlighter != Value) {
|
if (mHighlighter != Value) {
|
||||||
mHighlighter = Value;
|
mHighlighter = Value;
|
||||||
|
@ -338,7 +338,7 @@ static QColor ValidatedColor(const QColor& color, const QColor& defaultColor) {
|
||||||
else
|
else
|
||||||
return defaultColor;
|
return defaultColor;
|
||||||
}
|
}
|
||||||
void SynExporter::SetTokenAttribute(PSynHighlighterAttribute Attri)
|
void SynExporter::SetTokenAttribute(PHighlighterAttribute Attri)
|
||||||
{
|
{
|
||||||
if (mFirstAttribute) {
|
if (mFirstAttribute) {
|
||||||
mFirstAttribute = false;
|
mFirstAttribute = false;
|
||||||
|
@ -354,7 +354,7 @@ void SynExporter::SetTokenAttribute(PSynHighlighterAttribute Attri)
|
||||||
bool ChangedFG = (mLastFG != ValidatedColor(Attri->foreground(), mForegroundColor));
|
bool ChangedFG = (mLastFG != ValidatedColor(Attri->foreground(), mForegroundColor));
|
||||||
if (ChangedBG || ChangedFG || (mLastStyle != Attri->styles())) {
|
if (ChangedBG || ChangedFG || (mLastStyle != Attri->styles())) {
|
||||||
// which font style bits are to reset?
|
// which font style bits are to reset?
|
||||||
SynFontStyles ChangedStyles = mLastStyle & ~(Attri->styles());
|
FontStyles ChangedStyles = mLastStyle & ~(Attri->styles());
|
||||||
FormatAttributeDone(ChangedBG, ChangedFG, ChangedStyles);
|
FormatAttributeDone(ChangedBG, ChangedFG, ChangedStyles);
|
||||||
// which font style bits are to set?
|
// which font style bits are to set?
|
||||||
ChangedStyles = Attri->styles() & ~(mLastStyle);
|
ChangedStyles = Attri->styles() & ~(mLastStyle);
|
||||||
|
|
|
@ -21,8 +21,8 @@
|
||||||
#include "../SynEdit.h"
|
#include "../SynEdit.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
using FormatTokenHandler = std::function<void(PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token,
|
using FormatTokenHandler = std::function<void(PHighlighter syntaxHighlighter, int Line, int column, const QString& token,
|
||||||
PSynHighlighterAttribute& attr)>;
|
PHighlighterAttribute& attr)>;
|
||||||
class SynExporter
|
class SynExporter
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -69,8 +69,8 @@ public:
|
||||||
QFont font() const;
|
QFont font() const;
|
||||||
void setFont(const QFont &font);
|
void setFont(const QFont &font);
|
||||||
|
|
||||||
PSynHighlighter highlighter() const;
|
PHighlighter highlighter() const;
|
||||||
void setHighlighter(PSynHighlighter Value);
|
void setHighlighter(PHighlighter Value);
|
||||||
|
|
||||||
QString title() const;
|
QString title() const;
|
||||||
void setTitle(const QString &Value);
|
void setTitle(const QString &Value);
|
||||||
|
@ -112,10 +112,10 @@ protected:
|
||||||
QString mDefaultFilter;
|
QString mDefaultFilter;
|
||||||
bool mExportAsText;
|
bool mExportAsText;
|
||||||
QFont mFont;
|
QFont mFont;
|
||||||
PSynHighlighter mHighlighter;
|
PHighlighter mHighlighter;
|
||||||
QColor mLastBG;
|
QColor mLastBG;
|
||||||
QColor mLastFG;
|
QColor mLastFG;
|
||||||
SynFontStyles mLastStyle;
|
FontStyles mLastStyle;
|
||||||
QMap<QChar,QString> mReplaceReserved;
|
QMap<QChar,QString> mReplaceReserved;
|
||||||
QString mTitle;
|
QString mTitle;
|
||||||
bool mUseBackground;
|
bool mUseBackground;
|
||||||
|
@ -156,7 +156,7 @@ protected:
|
||||||
* @param FontStylesChanged
|
* @param FontStylesChanged
|
||||||
*/
|
*/
|
||||||
virtual void FormatAttributeDone(bool BackgroundChanged, bool ForegroundChanged,
|
virtual void FormatAttributeDone(bool BackgroundChanged, bool ForegroundChanged,
|
||||||
SynFontStyles FontStylesChanged) = 0;
|
FontStyles FontStylesChanged) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Has to be overridden in descendant classes to add the opening format
|
* @brief Has to be overridden in descendant classes to add the opening format
|
||||||
|
@ -167,7 +167,7 @@ protected:
|
||||||
* @param FontStylesChanged
|
* @param FontStylesChanged
|
||||||
*/
|
*/
|
||||||
virtual void FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged,
|
virtual void FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged,
|
||||||
SynFontStyles FontStylesChanged) = 0;
|
FontStyles FontStylesChanged) = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Has to be overridden in descendant classes to add the closing format
|
* @brief Has to be overridden in descendant classes to add the closing format
|
||||||
* strings to the output buffer after the last token has been written.
|
* strings to the output buffer after the last token has been written.
|
||||||
|
@ -182,7 +182,7 @@ protected:
|
||||||
* @param FontStylesChanged
|
* @param FontStylesChanged
|
||||||
*/
|
*/
|
||||||
virtual void FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged,
|
virtual void FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged,
|
||||||
SynFontStyles FontStylesChanged) = 0;
|
FontStyles FontStylesChanged) = 0;
|
||||||
/**
|
/**
|
||||||
* @brief Can be overridden in descendant classes to add the formatted text of
|
* @brief Can be overridden in descendant classes to add the formatted text of
|
||||||
* the actual token text to the output buffer.
|
* the actual token text to the output buffer.
|
||||||
|
@ -236,7 +236,7 @@ protected:
|
||||||
* added to the output buffer.
|
* added to the output buffer.
|
||||||
* @param Attri
|
* @param Attri
|
||||||
*/
|
*/
|
||||||
virtual void SetTokenAttribute(PSynHighlighterAttribute Attri);
|
virtual void SetTokenAttribute(PHighlighterAttribute Attri);
|
||||||
|
|
||||||
QTextCodec *getCodec();
|
QTextCodec *getCodec();
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -45,7 +45,7 @@ void SynHTMLExporter::setCreateHTMLFragment(bool createHTMLFragment)
|
||||||
mCreateHTMLFragment = createHTMLFragment;
|
mCreateHTMLFragment = createHTMLFragment;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynHTMLExporter::AttriToCSS(PSynHighlighterAttribute Attri, const QString &UniqueAttriName)
|
QString SynHTMLExporter::AttriToCSS(PHighlighterAttribute Attri, const QString &UniqueAttriName)
|
||||||
{
|
{
|
||||||
QString StyleName = MakeValidName(UniqueAttriName);
|
QString StyleName = MakeValidName(UniqueAttriName);
|
||||||
|
|
||||||
|
@ -55,19 +55,19 @@ QString SynHTMLExporter::AttriToCSS(PSynHighlighterAttribute Attri, const QStrin
|
||||||
if (Attri->foreground().isValid())
|
if (Attri->foreground().isValid())
|
||||||
Result += "color: " + ColorToHTML(Attri->foreground()) + "; ";
|
Result += "color: " + ColorToHTML(Attri->foreground()) + "; ";
|
||||||
|
|
||||||
if (Attri->styles().testFlag(SynFontStyle::fsBold))
|
if (Attri->styles().testFlag(FontStyle::fsBold))
|
||||||
Result += "font-weight: bold; ";
|
Result += "font-weight: bold; ";
|
||||||
if (Attri->styles().testFlag(SynFontStyle::fsItalic))
|
if (Attri->styles().testFlag(FontStyle::fsItalic))
|
||||||
Result += "font-style: italic; ";
|
Result += "font-style: italic; ";
|
||||||
if (Attri->styles().testFlag(SynFontStyle::fsUnderline))
|
if (Attri->styles().testFlag(FontStyle::fsUnderline))
|
||||||
Result += "text-decoration: underline; ";
|
Result += "text-decoration: underline; ";
|
||||||
if (Attri->styles().testFlag(SynFontStyle::fsStrikeOut))
|
if (Attri->styles().testFlag(FontStyle::fsStrikeOut))
|
||||||
Result += "text-decoration: line-through; ";
|
Result += "text-decoration: line-through; ";
|
||||||
Result += "}";
|
Result += "}";
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynHTMLExporter::AttriToCSSCallback(PSynHighlighter , PSynHighlighterAttribute Attri, const QString& UniqueAttriName, QList<void *> params)
|
bool SynHTMLExporter::AttriToCSSCallback(PHighlighter , PHighlighterAttribute Attri, const QString& UniqueAttriName, QList<void *> params)
|
||||||
{
|
{
|
||||||
QString& styles = *static_cast<QString *>(params[0]);
|
QString& styles = *static_cast<QString *>(params[0]);
|
||||||
styles.append(AttriToCSS(Attri,UniqueAttriName) + lineBreak());
|
styles.append(AttriToCSS(Attri,UniqueAttriName) + lineBreak());
|
||||||
|
@ -79,7 +79,7 @@ QString SynHTMLExporter::ColorToHTML(const QColor &AColor)
|
||||||
return AColor.name();
|
return AColor.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynHTMLExporter::GetStyleName(PSynHighlighter Highlighter, PSynHighlighterAttribute Attri)
|
QString SynHTMLExporter::GetStyleName(PHighlighter Highlighter, PHighlighterAttribute Attri)
|
||||||
{
|
{
|
||||||
QString result;
|
QString result;
|
||||||
enumHighlighterAttributes(Highlighter,false,
|
enumHighlighterAttributes(Highlighter,false,
|
||||||
|
@ -104,9 +104,9 @@ QString SynHTMLExporter::MakeValidName(const QString &Name)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynHTMLExporter::StyleNameCallback(PSynHighlighter /*Highlighter*/, PSynHighlighterAttribute Attri, const QString& UniqueAttriName, QList<void *> params)
|
bool SynHTMLExporter::StyleNameCallback(PHighlighter /*Highlighter*/, PHighlighterAttribute Attri, const QString& UniqueAttriName, QList<void *> params)
|
||||||
{
|
{
|
||||||
PSynHighlighterAttribute& AttriToFind = *static_cast<PSynHighlighterAttribute*>(params[0]);
|
PHighlighterAttribute& AttriToFind = *static_cast<PHighlighterAttribute*>(params[0]);
|
||||||
QString& StyleName = *static_cast<QString *>(params[1]);
|
QString& StyleName = *static_cast<QString *>(params[1]);
|
||||||
|
|
||||||
if (Attri == AttriToFind) {
|
if (Attri == AttriToFind) {
|
||||||
|
@ -117,12 +117,12 @@ bool SynHTMLExporter::StyleNameCallback(PSynHighlighter /*Highlighter*/, PSynHig
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHTMLExporter::FormatAttributeDone(bool , bool , SynFontStyles )
|
void SynHTMLExporter::FormatAttributeDone(bool , bool , FontStyles )
|
||||||
{
|
{
|
||||||
AddData("</span>");
|
AddData("</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHTMLExporter::FormatAttributeInit(bool , bool , SynFontStyles )
|
void SynHTMLExporter::FormatAttributeInit(bool , bool , FontStyles )
|
||||||
{
|
{
|
||||||
QString StyleName = GetStyleName(mHighlighter, mLastAttri);
|
QString StyleName = GetStyleName(mHighlighter, mLastAttri);
|
||||||
AddData(QString("<span class=\"%1\">").arg(StyleName));
|
AddData(QString("<span class=\"%1\">").arg(StyleName));
|
||||||
|
@ -133,7 +133,7 @@ void SynHTMLExporter::FormatAfterLastAttribute()
|
||||||
AddData("</span>");
|
AddData("</span>");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHTMLExporter::FormatBeforeFirstAttribute(bool, bool, SynFontStyles)
|
void SynHTMLExporter::FormatBeforeFirstAttribute(bool, bool, FontStyles)
|
||||||
{
|
{
|
||||||
QString StyleName = GetStyleName(mHighlighter, mLastAttri);
|
QString StyleName = GetStyleName(mHighlighter, mLastAttri);
|
||||||
AddData(QString("<span class=\"%1\">").arg(StyleName));
|
AddData(QString("<span class=\"%1\">").arg(StyleName));
|
||||||
|
@ -222,7 +222,7 @@ QString SynHTMLExporter::GetHeader()
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHTMLExporter::SetTokenAttribute(PSynHighlighterAttribute Attri)
|
void SynHTMLExporter::SetTokenAttribute(PHighlighterAttribute Attri)
|
||||||
{
|
{
|
||||||
mLastAttri = Attri;
|
mLastAttri = Attri;
|
||||||
SynExporter::SetTokenAttribute(Attri);
|
SynExporter::SetTokenAttribute(Attri);
|
||||||
|
|
|
@ -30,28 +30,28 @@ public:
|
||||||
protected:
|
protected:
|
||||||
bool mCreateHTMLFragment;
|
bool mCreateHTMLFragment;
|
||||||
private:
|
private:
|
||||||
PSynHighlighterAttribute mLastAttri;
|
PHighlighterAttribute mLastAttri;
|
||||||
QString AttriToCSS(PSynHighlighterAttribute Attri, const QString& UniqueAttriName);
|
QString AttriToCSS(PHighlighterAttribute Attri, const QString& UniqueAttriName);
|
||||||
bool AttriToCSSCallback(PSynHighlighter Highlighter, PSynHighlighterAttribute Attri,
|
bool AttriToCSSCallback(PHighlighter Highlighter, PHighlighterAttribute Attri,
|
||||||
const QString& UniqueAttriName, QList<void *> params);
|
const QString& UniqueAttriName, QList<void *> params);
|
||||||
QString ColorToHTML(const QColor &AColor);
|
QString ColorToHTML(const QColor &AColor);
|
||||||
QString GetStyleName(PSynHighlighter Highlighter,
|
QString GetStyleName(PHighlighter Highlighter,
|
||||||
PSynHighlighterAttribute Attri);
|
PHighlighterAttribute Attri);
|
||||||
QString MakeValidName(const QString &Name);
|
QString MakeValidName(const QString &Name);
|
||||||
bool StyleNameCallback(PSynHighlighter Highlighter, PSynHighlighterAttribute Attri,
|
bool StyleNameCallback(PHighlighter Highlighter, PHighlighterAttribute Attri,
|
||||||
const QString& UniqueAttriName, QList<void *> params);
|
const QString& UniqueAttriName, QList<void *> params);
|
||||||
|
|
||||||
// SynExporter interface
|
// SynExporter interface
|
||||||
protected:
|
protected:
|
||||||
void FormatAttributeDone(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged);
|
void FormatAttributeDone(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged);
|
||||||
void FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged);
|
void FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged);
|
||||||
void FormatAfterLastAttribute();
|
void FormatAfterLastAttribute();
|
||||||
void FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged);
|
void FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged);
|
||||||
void FormatNewLine();
|
void FormatNewLine();
|
||||||
QString GetFooter();
|
QString GetFooter();
|
||||||
QString GetFormatName();
|
QString GetFormatName();
|
||||||
QString GetHeader();
|
QString GetHeader();
|
||||||
void SetTokenAttribute(PSynHighlighterAttribute Attri);
|
void SetTokenAttribute(PHighlighterAttribute Attri);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // SYNHTMLEXPORTER_H
|
#endif // SYNHTMLEXPORTER_H
|
||||||
|
|
|
@ -55,28 +55,28 @@ QString SynRTFExporter::GetFontTable()
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynRTFExporter::FormatAttributeDone(bool , bool , SynFontStyles FontStylesChanged)
|
void SynRTFExporter::FormatAttributeDone(bool , bool , FontStyles FontStylesChanged)
|
||||||
{
|
{
|
||||||
// nothing to do about the color, but reset the font style
|
// nothing to do about the color, but reset the font style
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsBold)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsBold)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\b0");
|
AddData("\\b0");
|
||||||
}
|
}
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsItalic)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsItalic)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\i0");
|
AddData("\\i0");
|
||||||
}
|
}
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsUnderline)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsUnderline)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\ul0");
|
AddData("\\ul0");
|
||||||
}
|
}
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsStrikeOut)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsStrikeOut)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\strike0");
|
AddData("\\strike0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynRTFExporter::FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged)
|
void SynRTFExporter::FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged)
|
||||||
{
|
{
|
||||||
// background color
|
// background color
|
||||||
if (BackgroundChanged) {
|
if (BackgroundChanged) {
|
||||||
|
@ -93,19 +93,19 @@ void SynRTFExporter::FormatAttributeInit(bool BackgroundChanged, bool Foreground
|
||||||
}
|
}
|
||||||
// font styles
|
// font styles
|
||||||
// nothing to do about the color, but reset the font style
|
// nothing to do about the color, but reset the font style
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsBold)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsBold)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\b0");
|
AddData("\\b0");
|
||||||
}
|
}
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsItalic)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsItalic)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\i0");
|
AddData("\\i0");
|
||||||
}
|
}
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsUnderline)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsUnderline)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\ul0");
|
AddData("\\ul0");
|
||||||
}
|
}
|
||||||
if (FontStylesChanged.testFlag(SynFontStyle::fsStrikeOut)) {
|
if (FontStylesChanged.testFlag(FontStyle::fsStrikeOut)) {
|
||||||
mAttributesChanged = true;
|
mAttributesChanged = true;
|
||||||
AddData("\\strike0");
|
AddData("\\strike0");
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ void SynRTFExporter::FormatAfterLastAttribute()
|
||||||
// no need to reset the font style here...
|
// no need to reset the font style here...
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynRTFExporter::FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged)
|
void SynRTFExporter::FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged)
|
||||||
{
|
{
|
||||||
FormatAttributeInit(BackgroundChanged, ForegroundChanged, FontStylesChanged);
|
FormatAttributeInit(BackgroundChanged, ForegroundChanged, FontStylesChanged);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,10 +34,10 @@ private:
|
||||||
|
|
||||||
// SynExporter interface
|
// SynExporter interface
|
||||||
protected:
|
protected:
|
||||||
void FormatAttributeDone(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged) override;
|
void FormatAttributeDone(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged) override;
|
||||||
void FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged) override;
|
void FormatAttributeInit(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged) override;
|
||||||
void FormatAfterLastAttribute() override;
|
void FormatAfterLastAttribute() override;
|
||||||
void FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged, SynFontStyles FontStylesChanged) override;
|
void FormatBeforeFirstAttribute(bool BackgroundChanged, bool ForegroundChanged, FontStyles FontStylesChanged) override;
|
||||||
void FormatNewLine() override;
|
void FormatNewLine() override;
|
||||||
QString GetFooter() override;
|
QString GetFooter() override;
|
||||||
QString GetFormatName() override;
|
QString GetFormatName() override;
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
const QSet<QString> SynEditASMHighlighter::Keywords {
|
const QSet<QString> ASMHighlighter::Keywords {
|
||||||
"aaa","aad","aam","adc","add","and","arpl","bound","bsf","bsr","bswap","bt","btc","btr","bts",
|
"aaa","aad","aam","adc","add","and","arpl","bound","bsf","bsr","bswap","bt","btc","btr","bts",
|
||||||
"call","cbw","cdq","clc","cld","cli","clts","cmc","cmp","cmps","cmpsb","cmpsd","cmpsw",
|
"call","cbw","cdq","clc","cld","cli","clts","cmc","cmp","cmps","cmpsb","cmpsd","cmpsw",
|
||||||
"cmpxchg","cwd","cwde","daa","das","dec","div","emms","enter","f2xm1","fabs","fadd","faddp","fbld",
|
"cmpxchg","cwd","cwde","daa","das","dec","div","emms","enter","f2xm1","fabs","fadd","faddp","fbld",
|
||||||
|
@ -55,56 +55,56 @@ const QSet<QString> SynEditASMHighlighter::Keywords {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SynEditASMHighlighter::SynEditASMHighlighter()
|
ASMHighlighter::ASMHighlighter()
|
||||||
{
|
{
|
||||||
mCommentAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrComment);
|
mCommentAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrComment);
|
||||||
mCommentAttribute->setStyles(SynFontStyle::fsItalic);
|
mCommentAttribute->setStyles(FontStyle::fsItalic);
|
||||||
addAttribute(mCommentAttribute);
|
addAttribute(mCommentAttribute);
|
||||||
mIdentifierAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrIdentifier);
|
mIdentifierAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrIdentifier);
|
||||||
addAttribute(mIdentifierAttribute);
|
addAttribute(mIdentifierAttribute);
|
||||||
mKeywordAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrReservedWord);
|
mKeywordAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrReservedWord);
|
||||||
mKeywordAttribute->setStyles(SynFontStyle::fsBold);
|
mKeywordAttribute->setStyles(FontStyle::fsBold);
|
||||||
addAttribute(mKeywordAttribute);
|
addAttribute(mKeywordAttribute);
|
||||||
mNumberAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrNumber);
|
mNumberAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrNumber);
|
||||||
addAttribute(mNumberAttribute);
|
addAttribute(mNumberAttribute);
|
||||||
mWhitespaceAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrSpace);
|
mWhitespaceAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrSpace);
|
||||||
addAttribute(mWhitespaceAttribute);
|
addAttribute(mWhitespaceAttribute);
|
||||||
mStringAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrString);
|
mStringAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrString);
|
||||||
addAttribute(mStringAttribute);
|
addAttribute(mStringAttribute);
|
||||||
mSymbolAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrSymbol);
|
mSymbolAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrSymbol);
|
||||||
addAttribute(mSymbolAttribute);
|
addAttribute(mSymbolAttribute);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynEditASMHighlighter::numberAttribute()
|
PHighlighterAttribute ASMHighlighter::numberAttribute()
|
||||||
{
|
{
|
||||||
return mNumberAttribute;
|
return mNumberAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::CommentProc()
|
void ASMHighlighter::CommentProc()
|
||||||
{
|
{
|
||||||
mTokenID = TokenKind::Comment;
|
mTokenID = TokenId::Comment;
|
||||||
do {
|
do {
|
||||||
mRun++;
|
mRun++;
|
||||||
} while (! (mLine[mRun]==0 || mLine[mRun] == '\r' || mLine[mRun]=='\n'));
|
} while (! (mLine[mRun]==0 || mLine[mRun] == '\r' || mLine[mRun]=='\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::CRProc()
|
void ASMHighlighter::CRProc()
|
||||||
{
|
{
|
||||||
mTokenID = TokenKind::Space;
|
mTokenID = TokenId::Space;
|
||||||
mRun++;
|
mRun++;
|
||||||
if (mLine[mRun] == '\n')
|
if (mLine[mRun] == '\n')
|
||||||
mRun++;
|
mRun++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::GreaterProc()
|
void ASMHighlighter::GreaterProc()
|
||||||
{
|
{
|
||||||
mRun++;
|
mRun++;
|
||||||
mTokenID = TokenKind::Symbol;
|
mTokenID = TokenId::Symbol;
|
||||||
if (mLine[mRun] == '=')
|
if (mLine[mRun] == '=')
|
||||||
mRun++;
|
mRun++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::IdentProc()
|
void ASMHighlighter::IdentProc()
|
||||||
{
|
{
|
||||||
int start = mRun;
|
int start = mRun;
|
||||||
while (isIdentChar(mLine[mRun])) {
|
while (isIdentChar(mLine[mRun])) {
|
||||||
|
@ -112,35 +112,35 @@ void SynEditASMHighlighter::IdentProc()
|
||||||
}
|
}
|
||||||
QString s = mLineString.mid(start,mRun-start);
|
QString s = mLineString.mid(start,mRun-start);
|
||||||
if (Keywords.contains(s)) {
|
if (Keywords.contains(s)) {
|
||||||
mTokenID = TokenKind::Key;
|
mTokenID = TokenId::Key;
|
||||||
} else {
|
} else {
|
||||||
mTokenID = TokenKind::Identifier;
|
mTokenID = TokenId::Identifier;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::LFProc()
|
void ASMHighlighter::LFProc()
|
||||||
{
|
{
|
||||||
mTokenID = TokenKind::Space;
|
mTokenID = TokenId::Space;
|
||||||
mRun++;
|
mRun++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::LowerProc()
|
void ASMHighlighter::LowerProc()
|
||||||
{
|
{
|
||||||
mRun++;
|
mRun++;
|
||||||
mTokenID = TokenKind::Symbol;
|
mTokenID = TokenId::Symbol;
|
||||||
if (mLine[mRun]=='=' || mLine[mRun]== '>')
|
if (mLine[mRun]=='=' || mLine[mRun]== '>')
|
||||||
mRun++;
|
mRun++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::NullProc()
|
void ASMHighlighter::NullProc()
|
||||||
{
|
{
|
||||||
mTokenID = TokenKind::Null;
|
mTokenID = TokenId::Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::NumberProc()
|
void ASMHighlighter::NumberProc()
|
||||||
{
|
{
|
||||||
mRun++;
|
mRun++;
|
||||||
mTokenID = TokenKind::Number;
|
mTokenID = TokenId::Number;
|
||||||
while (true) {
|
while (true) {
|
||||||
QChar ch = mLine[mRun];
|
QChar ch = mLine[mRun];
|
||||||
if (!((ch>='0' && ch<='9') || (ch=='.') || (ch >= 'a' && ch<='f')
|
if (!((ch>='0' && ch<='9') || (ch=='.') || (ch >= 'a' && ch<='f')
|
||||||
|
@ -150,9 +150,9 @@ void SynEditASMHighlighter::NumberProc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::SingleQuoteStringProc()
|
void ASMHighlighter::SingleQuoteStringProc()
|
||||||
{
|
{
|
||||||
mTokenID = TokenKind::String;
|
mTokenID = TokenId::String;
|
||||||
if ((mRun+2 < mLineString.size()) && (mLine[mRun + 1] == '\'') && (mLine[mRun + 2] == '\''))
|
if ((mRun+2 < mLineString.size()) && (mLine[mRun + 1] == '\'') && (mLine[mRun + 2] == '\''))
|
||||||
mRun += 2;
|
mRun += 2;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -164,23 +164,23 @@ void SynEditASMHighlighter::SingleQuoteStringProc()
|
||||||
mRun++;
|
mRun++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::SlashProc()
|
void ASMHighlighter::SlashProc()
|
||||||
{
|
{
|
||||||
mRun++;
|
mRun++;
|
||||||
if (mLine[mRun] == '/') {
|
if (mLine[mRun] == '/') {
|
||||||
mTokenID = TokenKind::Comment;
|
mTokenID = TokenId::Comment;
|
||||||
while (true) {
|
while (true) {
|
||||||
mRun++;
|
mRun++;
|
||||||
if (mLine[mRun] == 0 || mLine[mRun] == '\r' || mLine[mRun] == '\n')
|
if (mLine[mRun] == 0 || mLine[mRun] == '\r' || mLine[mRun] == '\n')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
mTokenID = TokenKind::Symbol;
|
mTokenID = TokenId::Symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::SpaceProc()
|
void ASMHighlighter::SpaceProc()
|
||||||
{
|
{
|
||||||
mTokenID = TokenKind::Space;
|
mTokenID = TokenId::Space;
|
||||||
while (true) {
|
while (true) {
|
||||||
mRun++;
|
mRun++;
|
||||||
if (mLine[mRun] == 0 || mLine[mRun] == '\r' || mLine[mRun] == '\n')
|
if (mLine[mRun] == 0 || mLine[mRun] == '\r' || mLine[mRun] == '\n')
|
||||||
|
@ -190,9 +190,9 @@ void SynEditASMHighlighter::SpaceProc()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::StringProc()
|
void ASMHighlighter::StringProc()
|
||||||
{
|
{
|
||||||
mTokenID = TokenKind::String;
|
mTokenID = TokenId::String;
|
||||||
if ((mRun+2 < mLineString.size()) && (mLine[mRun + 1] == '\"') && (mLine[mRun + 2] == '\"'))
|
if ((mRun+2 < mLineString.size()) && (mLine[mRun + 1] == '\"') && (mLine[mRun + 2] == '\"'))
|
||||||
mRun += 2;
|
mRun += 2;
|
||||||
while (true) {
|
while (true) {
|
||||||
|
@ -206,95 +206,95 @@ void SynEditASMHighlighter::StringProc()
|
||||||
mRun++;
|
mRun++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::SymbolProc()
|
void ASMHighlighter::SymbolProc()
|
||||||
{
|
{
|
||||||
mRun++;
|
mRun++;
|
||||||
mTokenID = TokenKind::Symbol;
|
mTokenID = TokenId::Symbol;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::UnknownProc()
|
void ASMHighlighter::UnknownProc()
|
||||||
{
|
{
|
||||||
mRun++;
|
mRun++;
|
||||||
mTokenID = TokenKind::Unknown;
|
mTokenID = TokenId::Unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynEditASMHighlighter::eol() const
|
bool ASMHighlighter::eol() const
|
||||||
{
|
{
|
||||||
return mTokenID == TokenKind::Null;
|
return mTokenID == TokenId::Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynEditASMHighlighter::languageName()
|
QString ASMHighlighter::languageName()
|
||||||
{
|
{
|
||||||
return "asm";
|
return "asm";
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterLanguage SynEditASMHighlighter::language()
|
HighlighterLanguage ASMHighlighter::language()
|
||||||
{
|
{
|
||||||
return SynHighlighterLanguage::Asssembly;
|
return HighlighterLanguage::Asssembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynEditASMHighlighter::getToken() const
|
QString ASMHighlighter::getToken() const
|
||||||
{
|
{
|
||||||
return mLineString.mid(mTokenPos,mRun-mTokenPos);
|
return mLineString.mid(mTokenPos,mRun-mTokenPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynEditASMHighlighter::getTokenAttribute() const
|
PHighlighterAttribute ASMHighlighter::getTokenAttribute() const
|
||||||
{
|
{
|
||||||
switch(mTokenID) {
|
switch(mTokenID) {
|
||||||
case TokenKind::Comment:
|
case TokenId::Comment:
|
||||||
return mCommentAttribute;
|
return mCommentAttribute;
|
||||||
case TokenKind::Identifier:
|
case TokenId::Identifier:
|
||||||
return mIdentifierAttribute;
|
return mIdentifierAttribute;
|
||||||
case TokenKind::Key:
|
case TokenId::Key:
|
||||||
return mKeywordAttribute;
|
return mKeywordAttribute;
|
||||||
case TokenKind::Number:
|
case TokenId::Number:
|
||||||
return mNumberAttribute;
|
return mNumberAttribute;
|
||||||
case TokenKind::Space:
|
case TokenId::Space:
|
||||||
return mWhitespaceAttribute;
|
return mWhitespaceAttribute;
|
||||||
case TokenKind::String:
|
case TokenId::String:
|
||||||
return mStringAttribute;
|
return mStringAttribute;
|
||||||
case TokenKind::Symbol:
|
case TokenId::Symbol:
|
||||||
return mSymbolAttribute;
|
return mSymbolAttribute;
|
||||||
case TokenKind::Unknown:
|
case TokenId::Unknown:
|
||||||
return mIdentifierAttribute;
|
return mIdentifierAttribute;
|
||||||
}
|
}
|
||||||
return PSynHighlighterAttribute();
|
return PHighlighterAttribute();
|
||||||
}
|
}
|
||||||
|
|
||||||
SynTokenKind SynEditASMHighlighter::getTokenKind()
|
TokenKind ASMHighlighter::getTokenKind()
|
||||||
{
|
{
|
||||||
return mTokenID;
|
return mTokenID;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterTokenType SynEditASMHighlighter::getTokenType()
|
TokenType ASMHighlighter::getTokenType()
|
||||||
{
|
{
|
||||||
switch(mTokenID) {
|
switch(mTokenID) {
|
||||||
case TokenKind::Comment:
|
case TokenId::Comment:
|
||||||
return SynHighlighterTokenType::Comment;
|
return TokenType::Comment;
|
||||||
case TokenKind::Identifier:
|
case TokenId::Identifier:
|
||||||
return SynHighlighterTokenType::Identifier;
|
return TokenType::Identifier;
|
||||||
case TokenKind::Key:
|
case TokenId::Key:
|
||||||
return SynHighlighterTokenType::Keyword;
|
return TokenType::Keyword;
|
||||||
case TokenKind::Number:
|
case TokenId::Number:
|
||||||
return SynHighlighterTokenType::Number;
|
return TokenType::Number;
|
||||||
case TokenKind::Space:
|
case TokenId::Space:
|
||||||
return SynHighlighterTokenType::Space;
|
return TokenType::Space;
|
||||||
case TokenKind::String:
|
case TokenId::String:
|
||||||
return SynHighlighterTokenType::String;
|
return TokenType::String;
|
||||||
case TokenKind::Symbol:
|
case TokenId::Symbol:
|
||||||
return SynHighlighterTokenType::Symbol;
|
return TokenType::Symbol;
|
||||||
case TokenKind::Unknown:
|
case TokenId::Unknown:
|
||||||
return SynHighlighterTokenType::Default;
|
return TokenType::Default;
|
||||||
}
|
}
|
||||||
return SynHighlighterTokenType::Default;
|
return TokenType::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynEditASMHighlighter::getTokenPos()
|
int ASMHighlighter::getTokenPos()
|
||||||
{
|
{
|
||||||
return mTokenPos;
|
return mTokenPos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::next()
|
void ASMHighlighter::next()
|
||||||
{
|
{
|
||||||
mTokenPos = mRun;
|
mTokenPos = mRun;
|
||||||
switch(mLine[mRun].unicode()) {
|
switch(mLine[mRun].unicode()) {
|
||||||
|
@ -355,7 +355,7 @@ void SynEditASMHighlighter::next()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::setLine(const QString &newLine, int lineNumber)
|
void ASMHighlighter::setLine(const QString &newLine, int lineNumber)
|
||||||
{
|
{
|
||||||
mLineString = newLine;
|
mLineString = newLine;
|
||||||
mLine = mLineString.data();
|
mLine = mLineString.data();
|
||||||
|
@ -364,47 +364,47 @@ void SynEditASMHighlighter::setLine(const QString &newLine, int lineNumber)
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterClass SynEditASMHighlighter::getClass() const
|
HighlighterClass ASMHighlighter::getClass() const
|
||||||
{
|
{
|
||||||
return SynHighlighterClass::CppHighlighter;
|
return HighlighterClass::CppHighlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynEditASMHighlighter::getName() const
|
QString ASMHighlighter::getName() const
|
||||||
{
|
{
|
||||||
return SYN_HIGHLIGHTER_CPP;
|
return SYN_HIGHLIGHTER_CPP;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynEditASMHighlighter::getTokenFinished() const
|
bool ASMHighlighter::getTokenFinished() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynEditASMHighlighter::isLastLineCommentNotFinished(int /*state*/) const
|
bool ASMHighlighter::isLastLineCommentNotFinished(int /*state*/) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynEditASMHighlighter::isLastLineStringNotFinished(int /*state*/) const
|
bool ASMHighlighter::isLastLineStringNotFinished(int /*state*/) const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynRangeState SynEditASMHighlighter::getRangeState() const
|
HighlighterState ASMHighlighter::getState() const
|
||||||
{
|
{
|
||||||
return SynRangeState();
|
return HighlighterState();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::setState(const SynRangeState&)
|
void ASMHighlighter::setState(const HighlighterState&)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynEditASMHighlighter::resetState()
|
void ASMHighlighter::resetState()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> SynEditASMHighlighter::keywords() const
|
QSet<QString> ASMHighlighter::keywords() const
|
||||||
{
|
{
|
||||||
return Keywords;
|
return Keywords;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
class SynEditASMHighlighter : public SynHighlighter
|
class ASMHighlighter : public Highlighter
|
||||||
{
|
{
|
||||||
enum TokenKind {
|
enum TokenId {
|
||||||
Comment,
|
Comment,
|
||||||
Identifier,
|
Identifier,
|
||||||
Key,
|
Key,
|
||||||
|
@ -35,8 +35,8 @@ class SynEditASMHighlighter : public SynHighlighter
|
||||||
Unknown
|
Unknown
|
||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
explicit SynEditASMHighlighter();
|
explicit ASMHighlighter();
|
||||||
PSynHighlighterAttribute numberAttribute();
|
PHighlighterAttribute numberAttribute();
|
||||||
|
|
||||||
static const QSet<QString> Keywords;
|
static const QSet<QString> Keywords;
|
||||||
private:
|
private:
|
||||||
|
@ -47,8 +47,8 @@ private:
|
||||||
int mStringLen;
|
int mStringLen;
|
||||||
QChar mToIdent;
|
QChar mToIdent;
|
||||||
int mTokenPos;
|
int mTokenPos;
|
||||||
SynTokenKind mTokenID;
|
TokenKind mTokenID;
|
||||||
PSynHighlighterAttribute mNumberAttribute;
|
PHighlighterAttribute mNumberAttribute;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void CommentProc();
|
void CommentProc();
|
||||||
|
@ -72,18 +72,18 @@ public:
|
||||||
bool eol() const override;
|
bool eol() const override;
|
||||||
|
|
||||||
QString languageName() override;
|
QString languageName() override;
|
||||||
SynHighlighterLanguage language() override;
|
HighlighterLanguage language() override;
|
||||||
QString getToken() const override;
|
QString getToken() const override;
|
||||||
PSynHighlighterAttribute getTokenAttribute() const override;
|
PHighlighterAttribute getTokenAttribute() const override;
|
||||||
SynTokenKind getTokenKind() override;
|
TokenKind getTokenKind() override;
|
||||||
SynHighlighterTokenType getTokenType() override;
|
TokenType getTokenType() override;
|
||||||
int getTokenPos() override;
|
int getTokenPos() override;
|
||||||
void next() override;
|
void next() override;
|
||||||
void setLine(const QString &newLine, int lineNumber) override;
|
void setLine(const QString &newLine, int lineNumber) override;
|
||||||
|
|
||||||
// SynHighlighter interface
|
// SynHighlighter interface
|
||||||
public:
|
public:
|
||||||
SynHighlighterClass getClass() const override;
|
HighlighterClass getClass() const override;
|
||||||
QString getName() const override;
|
QString getName() const override;
|
||||||
|
|
||||||
// SynHighlighter interface
|
// SynHighlighter interface
|
||||||
|
@ -91,8 +91,8 @@ public:
|
||||||
bool getTokenFinished() const override;
|
bool getTokenFinished() const override;
|
||||||
bool isLastLineCommentNotFinished(int state) const override;
|
bool isLastLineCommentNotFinished(int state) const override;
|
||||||
bool isLastLineStringNotFinished(int state) const override;
|
bool isLastLineStringNotFinished(int state) const override;
|
||||||
SynRangeState getRangeState() const override;
|
HighlighterState getState() const override;
|
||||||
void setState(const SynRangeState& rangeState) override;
|
void setState(const HighlighterState& rangeState) override;
|
||||||
void resetState() override;
|
void resetState() override;
|
||||||
|
|
||||||
// SynHighlighter interface
|
// SynHighlighter interface
|
||||||
|
|
|
@ -18,85 +18,85 @@
|
||||||
#include "../Constants.h"
|
#include "../Constants.h"
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
SynHighlighter::SynHighlighter() :
|
Highlighter::Highlighter() :
|
||||||
mEnabled(true),
|
mEnabled(true),
|
||||||
mWordBreakChars{ SynWordBreakChars }
|
mWordBreakChars{ WordBreakChars }
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QMap<QString, PSynHighlighterAttribute>& SynHighlighter::attributes() const
|
const QMap<QString, PHighlighterAttribute>& Highlighter::attributes() const
|
||||||
{
|
{
|
||||||
return mAttributes;
|
return mAttributes;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QSet<QChar>& SynHighlighter::wordBreakChars() const
|
const QSet<QChar>& Highlighter::wordBreakChars() const
|
||||||
{
|
{
|
||||||
return mWordBreakChars;
|
return mWordBreakChars;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynHighlighter::commentAttribute() const
|
PHighlighterAttribute Highlighter::commentAttribute() const
|
||||||
{
|
{
|
||||||
return mCommentAttribute;
|
return mCommentAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynHighlighter::identifierAttribute() const
|
PHighlighterAttribute Highlighter::identifierAttribute() const
|
||||||
{
|
{
|
||||||
return mIdentifierAttribute;
|
return mIdentifierAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynHighlighter::keywordAttribute() const
|
PHighlighterAttribute Highlighter::keywordAttribute() const
|
||||||
{
|
{
|
||||||
return mKeywordAttribute;
|
return mKeywordAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynHighlighter::stringAttribute() const
|
PHighlighterAttribute Highlighter::stringAttribute() const
|
||||||
{
|
{
|
||||||
return mStringAttribute;
|
return mStringAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynHighlighter::whitespaceAttribute() const
|
PHighlighterAttribute Highlighter::whitespaceAttribute() const
|
||||||
{
|
{
|
||||||
return mWhitespaceAttribute;
|
return mWhitespaceAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynHighlighter::symbolAttribute() const
|
PHighlighterAttribute Highlighter::symbolAttribute() const
|
||||||
{
|
{
|
||||||
return mSymbolAttribute;
|
return mSymbolAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterTokenType SynHighlighter::getTokenType()
|
TokenType Highlighter::getTokenType()
|
||||||
{
|
{
|
||||||
return SynHighlighterTokenType::Default;
|
return TokenType::Default;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynHighlighter::isKeyword(const QString &)
|
bool Highlighter::isKeyword(const QString &)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighter::nextToEol()
|
void Highlighter::nextToEol()
|
||||||
{
|
{
|
||||||
while (!eol())
|
while (!eol())
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|
||||||
QSet<QString> SynHighlighter::keywords() const
|
QSet<QString> Highlighter::keywords() const
|
||||||
{
|
{
|
||||||
return QSet<QString>();
|
return QSet<QString>();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynHighlighter::foldString()
|
QString Highlighter::foldString()
|
||||||
{
|
{
|
||||||
return " ... }";
|
return " ... }";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynHighlighter::isSpaceChar(const QChar &ch)
|
bool Highlighter::isSpaceChar(const QChar &ch)
|
||||||
{
|
{
|
||||||
return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
|
return ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynHighlighter::isWordBreakChar(const QChar &ch)
|
bool Highlighter::isWordBreakChar(const QChar &ch)
|
||||||
{
|
{
|
||||||
switch (ch.unicode()) {
|
switch (ch.unicode()) {
|
||||||
case '.':
|
case '.':
|
||||||
|
@ -130,7 +130,7 @@ bool SynHighlighter::isWordBreakChar(const QChar &ch)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynHighlighter::isIdentChar(const QChar &ch) const
|
bool Highlighter::isIdentChar(const QChar &ch) const
|
||||||
{
|
{
|
||||||
if (ch == '_') {
|
if (ch == '_') {
|
||||||
return true;
|
return true;
|
||||||
|
@ -147,96 +147,96 @@ bool SynHighlighter::isIdentChar(const QChar &ch) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighter::addAttribute(PSynHighlighterAttribute attribute)
|
void Highlighter::addAttribute(PHighlighterAttribute attribute)
|
||||||
{
|
{
|
||||||
mAttributes[attribute->name()]=attribute;
|
mAttributes[attribute->name()]=attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighter::clearAttributes()
|
void Highlighter::clearAttributes()
|
||||||
{
|
{
|
||||||
mAttributes.clear();
|
mAttributes.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynHighlighter::attributesCount() const
|
int Highlighter::attributesCount() const
|
||||||
{
|
{
|
||||||
return mAttributes.size();
|
return mAttributes.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynHighlighter::getAttribute(const QString &name) const
|
PHighlighterAttribute Highlighter::getAttribute(const QString &name) const
|
||||||
{
|
{
|
||||||
auto search = mAttributes.find(name);
|
auto search = mAttributes.find(name);
|
||||||
if (search!=mAttributes.end()) {
|
if (search!=mAttributes.end()) {
|
||||||
return search.value();
|
return search.value();
|
||||||
}
|
}
|
||||||
return PSynHighlighterAttribute();
|
return PHighlighterAttribute();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynHighlighter::enabled() const
|
bool Highlighter::enabled() const
|
||||||
{
|
{
|
||||||
return mEnabled;
|
return mEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighter::setEnabled(bool value)
|
void Highlighter::setEnabled(bool value)
|
||||||
{
|
{
|
||||||
if (value != mEnabled) {
|
if (value != mEnabled) {
|
||||||
mEnabled = value;
|
mEnabled = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SynFontStyles SynHighlighterAttribute::styles() const
|
FontStyles HighlighterAttribute::styles() const
|
||||||
{
|
{
|
||||||
return mStyles;
|
return mStyles;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighterAttribute::setStyles(const SynFontStyles &styles)
|
void HighlighterAttribute::setStyles(const FontStyles &styles)
|
||||||
{
|
{
|
||||||
if (mStyles!=styles) {
|
if (mStyles!=styles) {
|
||||||
mStyles = styles;
|
mStyles = styles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SynHighlighterAttribute::foreground() const
|
QColor HighlighterAttribute::foreground() const
|
||||||
{
|
{
|
||||||
return mForeground;
|
return mForeground;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighterAttribute::setForeground(const QColor &color)
|
void HighlighterAttribute::setForeground(const QColor &color)
|
||||||
{
|
{
|
||||||
mForeground = color;
|
mForeground = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor SynHighlighterAttribute::background() const
|
QColor HighlighterAttribute::background() const
|
||||||
{
|
{
|
||||||
return mBackground;
|
return mBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighterAttribute::setBackground(const QColor &background)
|
void HighlighterAttribute::setBackground(const QColor &background)
|
||||||
{
|
{
|
||||||
mBackground = background;
|
mBackground = background;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynHighlighterAttribute::name() const
|
QString HighlighterAttribute::name() const
|
||||||
{
|
{
|
||||||
return mName;
|
return mName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynHighlighterAttribute::setName(const QString &name)
|
void HighlighterAttribute::setName(const QString &name)
|
||||||
{
|
{
|
||||||
if (mName!=name) {
|
if (mName!=name) {
|
||||||
mName = name;
|
mName = name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterAttribute::SynHighlighterAttribute(const QString &name):
|
HighlighterAttribute::HighlighterAttribute(const QString &name):
|
||||||
mForeground(QColor()),
|
mForeground(QColor()),
|
||||||
mBackground(QColor()),
|
mBackground(QColor()),
|
||||||
mName(name),
|
mName(name),
|
||||||
mStyles(SynFontStyle::fsNone)
|
mStyles(FontStyle::fsNone)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SynRangeState::operator==(const SynRangeState &s2)
|
bool HighlighterState::operator==(const HighlighterState &s2)
|
||||||
{
|
{
|
||||||
// indents contains the information of brace/parenthesis/brackets embedded levels
|
// indents contains the information of brace/parenthesis/brackets embedded levels
|
||||||
return (state == s2.state)
|
return (state == s2.state)
|
||||||
|
@ -244,14 +244,14 @@ bool SynRangeState::operator==(const SynRangeState &s2)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynRangeState::getLastIndent()
|
int HighlighterState::getLastIndent()
|
||||||
{
|
{
|
||||||
if (indents.isEmpty())
|
if (indents.isEmpty())
|
||||||
return -1;
|
return -1;
|
||||||
return indents.back();
|
return indents.back();
|
||||||
}
|
}
|
||||||
|
|
||||||
SynRangeState::SynRangeState():
|
HighlighterState::HighlighterState():
|
||||||
state(0),
|
state(0),
|
||||||
braceLevel(0),
|
braceLevel(0),
|
||||||
bracketLevel(0),
|
bracketLevel(0),
|
||||||
|
|
|
@ -34,7 +34,7 @@ enum SynIndentType {
|
||||||
sitStatement = 3,
|
sitStatement = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SynRangeState {
|
struct HighlighterState {
|
||||||
int state; // current syntax parsing state
|
int state; // current syntax parsing state
|
||||||
int braceLevel; // current braces embedding level (needed by rainbow color)
|
int braceLevel; // current braces embedding level (needed by rainbow color)
|
||||||
int bracketLevel; // current brackets embedding level (needed by rainbow color)
|
int bracketLevel; // current brackets embedding level (needed by rainbow color)
|
||||||
|
@ -47,41 +47,41 @@ struct SynRangeState {
|
||||||
QVector<int> matchingIndents; /* the indent matched ( and removed )
|
QVector<int> matchingIndents; /* the indent matched ( and removed )
|
||||||
but not started at this line
|
but not started at this line
|
||||||
(need by auto indent) */
|
(need by auto indent) */
|
||||||
bool operator==(const SynRangeState& s2);
|
bool operator==(const HighlighterState& s2);
|
||||||
int getLastIndent();
|
int getLastIndent();
|
||||||
SynRangeState();
|
HighlighterState();
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef int SynTokenKind;
|
typedef int TokenKind;
|
||||||
|
|
||||||
enum class SynHighlighterTokenType {
|
enum class TokenType {
|
||||||
Default, Space, Comment,
|
Default, Space, Comment,
|
||||||
PreprocessDirective, String, StringEscapeSequence,
|
PreprocessDirective, String, StringEscapeSequence,
|
||||||
Identifier, Symbol,
|
Identifier, Symbol,
|
||||||
Character, Keyword, Number};
|
Character, Keyword, Number};
|
||||||
|
|
||||||
enum class SynHighlighterClass {
|
enum class HighlighterClass {
|
||||||
Composition,
|
Composition,
|
||||||
CppHighlighter,
|
CppHighlighter,
|
||||||
AsmHighlighter,
|
AsmHighlighter,
|
||||||
GLSLHighlighter
|
GLSLHighlighter
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class SynHighlighterLanguage {
|
enum class HighlighterLanguage {
|
||||||
Asssembly,
|
Asssembly,
|
||||||
Cpp,
|
Cpp,
|
||||||
GLSL
|
GLSL
|
||||||
};
|
};
|
||||||
|
|
||||||
class SynHighlighterAttribute {
|
class HighlighterAttribute {
|
||||||
public:
|
public:
|
||||||
explicit SynHighlighterAttribute(const QString& name);
|
explicit HighlighterAttribute(const QString& name);
|
||||||
|
|
||||||
QString name() const;
|
QString name() const;
|
||||||
void setName(const QString &name);
|
void setName(const QString &name);
|
||||||
|
|
||||||
SynFontStyles styles() const;
|
FontStyles styles() const;
|
||||||
void setStyles(const SynFontStyles &styles);
|
void setStyles(const FontStyles &styles);
|
||||||
|
|
||||||
QColor foreground() const;
|
QColor foreground() const;
|
||||||
void setForeground(const QColor &color);
|
void setForeground(const QColor &color);
|
||||||
|
@ -93,58 +93,58 @@ private:
|
||||||
QColor mForeground;
|
QColor mForeground;
|
||||||
QColor mBackground;
|
QColor mBackground;
|
||||||
QString mName;
|
QString mName;
|
||||||
SynFontStyles mStyles;
|
FontStyles mStyles;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::shared_ptr<SynHighlighterAttribute> PSynHighlighterAttribute;
|
typedef std::shared_ptr<HighlighterAttribute> PHighlighterAttribute;
|
||||||
using SynHighlighterAttributeList = QVector<PSynHighlighterAttribute>;
|
using HighlighterAttributeList = QVector<PHighlighterAttribute>;
|
||||||
|
|
||||||
class SynHighlighter {
|
class Highlighter {
|
||||||
public:
|
public:
|
||||||
explicit SynHighlighter();
|
explicit Highlighter();
|
||||||
|
|
||||||
const QMap<QString, PSynHighlighterAttribute>& attributes() const;
|
const QMap<QString, PHighlighterAttribute>& attributes() const;
|
||||||
|
|
||||||
const QSet<QChar>& wordBreakChars() const;
|
const QSet<QChar>& wordBreakChars() const;
|
||||||
|
|
||||||
|
|
||||||
PSynHighlighterAttribute commentAttribute() const;
|
PHighlighterAttribute commentAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute identifierAttribute() const;
|
PHighlighterAttribute identifierAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute keywordAttribute() const;
|
PHighlighterAttribute keywordAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute stringAttribute() const;
|
PHighlighterAttribute stringAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute whitespaceAttribute() const;
|
PHighlighterAttribute whitespaceAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute symbolAttribute() const;
|
PHighlighterAttribute symbolAttribute() const;
|
||||||
|
|
||||||
virtual bool isIdentChar(const QChar& ch) const;
|
virtual bool isIdentChar(const QChar& ch) const;
|
||||||
|
|
||||||
virtual SynHighlighterClass getClass() const = 0;
|
virtual HighlighterClass getClass() const = 0;
|
||||||
virtual QString getName() const = 0;
|
virtual QString getName() const = 0;
|
||||||
|
|
||||||
virtual bool getTokenFinished() const = 0;
|
virtual bool getTokenFinished() const = 0;
|
||||||
virtual bool isLastLineCommentNotFinished(int state) const = 0;
|
virtual bool isLastLineCommentNotFinished(int state) const = 0;
|
||||||
virtual bool isLastLineStringNotFinished(int state) const = 0;
|
virtual bool isLastLineStringNotFinished(int state) const = 0;
|
||||||
virtual bool eol() const = 0;
|
virtual bool eol() const = 0;
|
||||||
virtual SynRangeState getRangeState() const = 0;
|
virtual HighlighterState getState() const = 0;
|
||||||
virtual QString getToken() const=0;
|
virtual QString getToken() const=0;
|
||||||
virtual PSynHighlighterAttribute getTokenAttribute() const=0;
|
virtual PHighlighterAttribute getTokenAttribute() const=0;
|
||||||
virtual SynHighlighterTokenType getTokenType();
|
virtual TokenType getTokenType();
|
||||||
virtual SynTokenKind getTokenKind() = 0;
|
virtual TokenKind getTokenKind() = 0;
|
||||||
virtual int getTokenPos() = 0;
|
virtual int getTokenPos() = 0;
|
||||||
virtual bool isKeyword(const QString& word);
|
virtual bool isKeyword(const QString& word);
|
||||||
virtual void next() = 0;
|
virtual void next() = 0;
|
||||||
virtual void nextToEol();
|
virtual void nextToEol();
|
||||||
virtual void setState(const SynRangeState& rangeState) = 0;
|
virtual void setState(const HighlighterState& rangeState) = 0;
|
||||||
virtual void setLine(const QString& newLine, int lineNumber) = 0;
|
virtual void setLine(const QString& newLine, int lineNumber) = 0;
|
||||||
virtual void resetState() = 0;
|
virtual void resetState() = 0;
|
||||||
virtual QSet<QString> keywords() const;
|
virtual QSet<QString> keywords() const;
|
||||||
|
|
||||||
virtual QString languageName() = 0;
|
virtual QString languageName() = 0;
|
||||||
virtual SynHighlighterLanguage language() = 0;
|
virtual HighlighterLanguage language() = 0;
|
||||||
|
|
||||||
virtual QString foldString();
|
virtual QString foldString();
|
||||||
|
|
||||||
|
@ -152,28 +152,28 @@ public:
|
||||||
virtual bool isWordBreakChar(const QChar& ch);
|
virtual bool isWordBreakChar(const QChar& ch);
|
||||||
bool enabled() const;
|
bool enabled() const;
|
||||||
void setEnabled(bool value);
|
void setEnabled(bool value);
|
||||||
virtual PSynHighlighterAttribute getAttribute(const QString& name) const;
|
virtual PHighlighterAttribute getAttribute(const QString& name) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PSynHighlighterAttribute mCommentAttribute;
|
PHighlighterAttribute mCommentAttribute;
|
||||||
PSynHighlighterAttribute mIdentifierAttribute;
|
PHighlighterAttribute mIdentifierAttribute;
|
||||||
PSynHighlighterAttribute mKeywordAttribute;
|
PHighlighterAttribute mKeywordAttribute;
|
||||||
PSynHighlighterAttribute mStringAttribute;
|
PHighlighterAttribute mStringAttribute;
|
||||||
PSynHighlighterAttribute mWhitespaceAttribute;
|
PHighlighterAttribute mWhitespaceAttribute;
|
||||||
PSynHighlighterAttribute mSymbolAttribute;
|
PHighlighterAttribute mSymbolAttribute;
|
||||||
|
|
||||||
void addAttribute(PSynHighlighterAttribute attribute);
|
void addAttribute(PHighlighterAttribute attribute);
|
||||||
void clearAttributes();
|
void clearAttributes();
|
||||||
virtual int attributesCount() const;
|
virtual int attributesCount() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString,PSynHighlighterAttribute> mAttributes;
|
QMap<QString,PHighlighterAttribute> mAttributes;
|
||||||
bool mEnabled;
|
bool mEnabled;
|
||||||
QSet<QChar> mWordBreakChars;
|
QSet<QChar> mWordBreakChars;
|
||||||
};
|
};
|
||||||
|
|
||||||
using PSynHighlighter = std::shared_ptr<SynHighlighter>;
|
using PHighlighter = std::shared_ptr<Highlighter>;
|
||||||
using SynHighlighterList = QVector<PSynHighlighter>;
|
using HighlighterList = QVector<PHighlighter>;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif // SYNHIGHLIGTERBASE_H
|
#endif // SYNHIGHLIGTERBASE_H
|
||||||
|
|
|
@ -19,86 +19,86 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
SynHighlightComposition::SynHighlightComposition()
|
CompositedHighlighter::CompositedHighlighter()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SynHighlighterClass SynHighlightComposition::getClass() const
|
HighlighterClass CompositedHighlighter::getClass() const
|
||||||
{
|
{
|
||||||
return SynHighlighterClass::Composition;
|
return HighlighterClass::Composition;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynHighlightComposition::getName() const
|
QString CompositedHighlighter::getName() const
|
||||||
{
|
{
|
||||||
return "SynHighlightComposition";
|
return "SynHighlightComposition";
|
||||||
}
|
}
|
||||||
|
|
||||||
SynScheme::SynScheme(QObject *parent):
|
HighlighterSchema::HighlighterSchema(QObject *parent):
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
mCaseSensitive(true)
|
mCaseSensitive(true)
|
||||||
{
|
{
|
||||||
mMarkerAttribute = std::make_shared<SynHighlighterAttribute>(SYNS_AttrMarker);
|
mMarkerAttribute = std::make_shared<HighlighterAttribute>(SYNS_AttrMarker);
|
||||||
mMarkerAttribute->setForeground(Qt::yellow);
|
mMarkerAttribute->setForeground(Qt::yellow);
|
||||||
mMarkerAttribute->setStyles(SynFontStyle::fsBold);
|
mMarkerAttribute->setStyles(FontStyle::fsBold);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynScheme::endExpr() const
|
QString HighlighterSchema::endExpr() const
|
||||||
{
|
{
|
||||||
return mEndExpr;
|
return mEndExpr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynScheme::setEndExpr(const QString &endExpr)
|
void HighlighterSchema::setEndExpr(const QString &endExpr)
|
||||||
{
|
{
|
||||||
mEndExpr = endExpr;
|
mEndExpr = endExpr;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynScheme::getStartExpr() const
|
QString HighlighterSchema::getStartExpr() const
|
||||||
{
|
{
|
||||||
return StartExpr;
|
return StartExpr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynScheme::setStartExpr(const QString &value)
|
void HighlighterSchema::setStartExpr(const QString &value)
|
||||||
{
|
{
|
||||||
StartExpr = value;
|
StartExpr = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighter SynScheme::getHighlighter() const
|
PHighlighter HighlighterSchema::getHighlighter() const
|
||||||
{
|
{
|
||||||
return mHighlighter;
|
return mHighlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynScheme::setHighlighter(const PSynHighlighter &highlighter)
|
void HighlighterSchema::setHighlighter(const PHighlighter &highlighter)
|
||||||
{
|
{
|
||||||
mHighlighter = highlighter;
|
mHighlighter = highlighter;
|
||||||
}
|
}
|
||||||
|
|
||||||
PSynHighlighterAttribute SynScheme::getMarkerAttribute() const
|
PHighlighterAttribute HighlighterSchema::getMarkerAttribute() const
|
||||||
{
|
{
|
||||||
return mMarkerAttribute;
|
return mMarkerAttribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynScheme::getSchemeName() const
|
QString HighlighterSchema::getSchemeName() const
|
||||||
{
|
{
|
||||||
return mSchemeName;
|
return mSchemeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynScheme::setSchemeName(const QString &schemeName)
|
void HighlighterSchema::setSchemeName(const QString &schemeName)
|
||||||
{
|
{
|
||||||
mSchemeName = schemeName;
|
mSchemeName = schemeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SynScheme::getCaseSensitive() const
|
int HighlighterSchema::getCaseSensitive() const
|
||||||
{
|
{
|
||||||
return mCaseSensitive;
|
return mCaseSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynScheme::setCaseSensitive(int caseSensitive)
|
void HighlighterSchema::setCaseSensitive(int caseSensitive)
|
||||||
{
|
{
|
||||||
mCaseSensitive = caseSensitive;
|
mCaseSensitive = caseSensitive;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString SynScheme::ConvertExpression(const QString &Value)
|
QString HighlighterSchema::ConvertExpression(const QString &Value)
|
||||||
{
|
{
|
||||||
if (!mCaseSensitive) {
|
if (!mCaseSensitive) {
|
||||||
return Value.toUpper();
|
return Value.toUpper();
|
||||||
|
@ -107,7 +107,7 @@ QString SynScheme::ConvertExpression(const QString &Value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SynScheme::MarkerAttriChanged() {
|
void HighlighterSchema::MarkerAttriChanged() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,26 +21,26 @@
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
class SynSchema;
|
class HighlighterSchema;
|
||||||
using PSynSchema = std::shared_ptr<SynSchema>;
|
using PHighlighterSchema = std::shared_ptr<HighlighterSchema>;
|
||||||
|
|
||||||
using OnCheckMarker = std::function<void(PSynSchema Sender,int &StartPos, int &MarkerLen,
|
//using OnCheckMarker = std::function<void(PHighlighterSchema Sender,int &StartPos, int &MarkerLen,
|
||||||
std::shared_ptr<QString>& MarkerText , int Line)>;
|
// std::shared_ptr<QString>& MarkerText , int Line)>;
|
||||||
|
|
||||||
class SynScheme : public QObject {
|
class HighlighterSchema : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SynScheme(QObject* parent=nullptr);
|
explicit HighlighterSchema(QObject* parent=nullptr);
|
||||||
QString endExpr() const;
|
QString endExpr() const;
|
||||||
void setEndExpr(const QString &endExpr);
|
void setEndExpr(const QString &endExpr);
|
||||||
|
|
||||||
QString getStartExpr() const;
|
QString getStartExpr() const;
|
||||||
void setStartExpr(const QString &value);
|
void setStartExpr(const QString &value);
|
||||||
|
|
||||||
PSynHighlighter getHighlighter() const;
|
PHighlighter getHighlighter() const;
|
||||||
void setHighlighter(const PSynHighlighter &highlighter);
|
void setHighlighter(const PHighlighter &highlighter);
|
||||||
|
|
||||||
PSynHighlighterAttribute getMarkerAttribute() const;
|
PHighlighterAttribute getMarkerAttribute() const;
|
||||||
|
|
||||||
QString getSchemeName() const;
|
QString getSchemeName() const;
|
||||||
void setSchemeName(const QString &schemeName);
|
void setSchemeName(const QString &schemeName);
|
||||||
|
@ -51,12 +51,12 @@ public:
|
||||||
private:
|
private:
|
||||||
QString mEndExpr;
|
QString mEndExpr;
|
||||||
QString StartExpr;
|
QString StartExpr;
|
||||||
PSynHighlighter mHighlighter;
|
PHighlighter mHighlighter;
|
||||||
PSynHighlighterAttribute mMarkerAttribute;
|
PHighlighterAttribute mMarkerAttribute;
|
||||||
QString mSchemeName;
|
QString mSchemeName;
|
||||||
int mCaseSensitive;
|
int mCaseSensitive;
|
||||||
OnCheckMarker mOnCheckStartMarker;
|
// OnCheckMarker mOnCheckStartMarker;
|
||||||
OnCheckMarker mOnCheckEndMarker;
|
// OnCheckMarker mOnCheckEndMarker;
|
||||||
QString ConvertExpression(const QString& Value);
|
QString ConvertExpression(const QString& Value);
|
||||||
private slots:
|
private slots:
|
||||||
void MarkerAttriChanged();
|
void MarkerAttriChanged();
|
||||||
|
@ -64,14 +64,14 @@ private slots:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class SynHighlightComposition : public SynHighlighter
|
class CompositedHighlighter : public Highlighter
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SynHighlightComposition();
|
explicit CompositedHighlighter();
|
||||||
|
|
||||||
// SynHighligterBase interface
|
// SynHighligterBase interface
|
||||||
public:
|
public:
|
||||||
SynHighlighterClass getClass() const override;
|
HighlighterClass getClass() const override;
|
||||||
QString getName() const override;
|
QString getName() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
class SynEditCppHighlighter: public SynHighlighter
|
class CppHighlighter: public Highlighter
|
||||||
{
|
{
|
||||||
enum TokenKind {
|
enum TokenId {
|
||||||
Asm = 1,
|
Asm = 1,
|
||||||
Comment,
|
Comment,
|
||||||
Directive,
|
Directive,
|
||||||
|
@ -44,7 +44,7 @@ class SynEditCppHighlighter: public SynHighlighter
|
||||||
RawString
|
RawString
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ExtTokenKind {
|
enum class ExtTokenId {
|
||||||
Add, AddAssign, And, AndAssign, Arrow, Assign,
|
Add, AddAssign, And, AndAssign, Arrow, Assign,
|
||||||
BitComplement, BraceClose, BraceOpen, Colon, Comma,
|
BitComplement, BraceClose, BraceOpen, Colon, Comma,
|
||||||
Decrement, Divide, DivideAssign, Ellipse, GreaterThan,
|
Decrement, Divide, DivideAssign, Ellipse, GreaterThan,
|
||||||
|
@ -68,40 +68,40 @@ class SynEditCppHighlighter: public SynHighlighter
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SynEditCppHighlighter();
|
explicit CppHighlighter();
|
||||||
|
|
||||||
PSynHighlighterAttribute asmAttribute() const;
|
PHighlighterAttribute asmAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute preprocessorAttribute() const;
|
PHighlighterAttribute preprocessorAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute invalidAttribute() const;
|
PHighlighterAttribute invalidAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute numberAttribute() const;
|
PHighlighterAttribute numberAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute floatAttribute() const;
|
PHighlighterAttribute floatAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute hexAttribute() const;
|
PHighlighterAttribute hexAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute octAttribute() const;
|
PHighlighterAttribute octAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute stringEscapeSequenceAttribute() const;
|
PHighlighterAttribute stringEscapeSequenceAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute charAttribute() const;
|
PHighlighterAttribute charAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute variableAttribute() const;
|
PHighlighterAttribute variableAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute functionAttribute() const;
|
PHighlighterAttribute functionAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute classAttribute() const;
|
PHighlighterAttribute classAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute globalVarAttribute() const;
|
PHighlighterAttribute globalVarAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute localVarAttribute() const;
|
PHighlighterAttribute localVarAttribute() const;
|
||||||
|
|
||||||
static const QSet<QString> Keywords;
|
static const QSet<QString> Keywords;
|
||||||
|
|
||||||
ExtTokenKind getExtTokenId();
|
ExtTokenId getExtTokenId();
|
||||||
SynTokenKind getTokenId();
|
TokenKind getTokenId();
|
||||||
private:
|
private:
|
||||||
void andSymbolProc();
|
void andSymbolProc();
|
||||||
void ansiCppProc();
|
void ansiCppProc();
|
||||||
|
@ -152,7 +152,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mAsmStart;
|
bool mAsmStart;
|
||||||
SynRangeState mRange;
|
HighlighterState mRange;
|
||||||
// SynRangeState mSpaceRange;
|
// SynRangeState mSpaceRange;
|
||||||
QString mLineString;
|
QString mLineString;
|
||||||
QChar* mLine;
|
QChar* mLine;
|
||||||
|
@ -162,25 +162,25 @@ private:
|
||||||
int mToIdent;
|
int mToIdent;
|
||||||
int mTokenPos;
|
int mTokenPos;
|
||||||
int mTokenId;
|
int mTokenId;
|
||||||
ExtTokenKind mExtTokenId;
|
ExtTokenId mExtTokenId;
|
||||||
int mLineNumber;
|
int mLineNumber;
|
||||||
int mLeftBraces;
|
int mLeftBraces;
|
||||||
int mRightBraces;
|
int mRightBraces;
|
||||||
|
|
||||||
PSynHighlighterAttribute mAsmAttribute;
|
PHighlighterAttribute mAsmAttribute;
|
||||||
PSynHighlighterAttribute mPreprocessorAttribute;
|
PHighlighterAttribute mPreprocessorAttribute;
|
||||||
PSynHighlighterAttribute mInvalidAttribute;
|
PHighlighterAttribute mInvalidAttribute;
|
||||||
PSynHighlighterAttribute mNumberAttribute;
|
PHighlighterAttribute mNumberAttribute;
|
||||||
PSynHighlighterAttribute mFloatAttribute;
|
PHighlighterAttribute mFloatAttribute;
|
||||||
PSynHighlighterAttribute mHexAttribute;
|
PHighlighterAttribute mHexAttribute;
|
||||||
PSynHighlighterAttribute mOctAttribute;
|
PHighlighterAttribute mOctAttribute;
|
||||||
PSynHighlighterAttribute mStringEscapeSequenceAttribute;
|
PHighlighterAttribute mStringEscapeSequenceAttribute;
|
||||||
PSynHighlighterAttribute mCharAttribute;
|
PHighlighterAttribute mCharAttribute;
|
||||||
PSynHighlighterAttribute mVariableAttribute;
|
PHighlighterAttribute mVariableAttribute;
|
||||||
PSynHighlighterAttribute mFunctionAttribute;
|
PHighlighterAttribute mFunctionAttribute;
|
||||||
PSynHighlighterAttribute mClassAttribute;
|
PHighlighterAttribute mClassAttribute;
|
||||||
PSynHighlighterAttribute mGlobalVarAttribute;
|
PHighlighterAttribute mGlobalVarAttribute;
|
||||||
PSynHighlighterAttribute mLocalVarAttribute;
|
PHighlighterAttribute mLocalVarAttribute;
|
||||||
|
|
||||||
// SynHighligterBase interface
|
// SynHighligterBase interface
|
||||||
public:
|
public:
|
||||||
|
@ -189,24 +189,24 @@ public:
|
||||||
bool isLastLineStringNotFinished(int state) const override;
|
bool isLastLineStringNotFinished(int state) const override;
|
||||||
bool eol() const override;
|
bool eol() const override;
|
||||||
QString getToken() const override;
|
QString getToken() const override;
|
||||||
PSynHighlighterAttribute getTokenAttribute() const override;
|
PHighlighterAttribute getTokenAttribute() const override;
|
||||||
SynTokenKind getTokenKind() override;
|
TokenKind getTokenKind() override;
|
||||||
int getTokenPos() override;
|
int getTokenPos() override;
|
||||||
void next() override;
|
void next() override;
|
||||||
void setLine(const QString &newLine, int lineNumber) override;
|
void setLine(const QString &newLine, int lineNumber) override;
|
||||||
bool isKeyword(const QString &word) override;
|
bool isKeyword(const QString &word) override;
|
||||||
SynHighlighterTokenType getTokenType() override;
|
TokenType getTokenType() override;
|
||||||
void setState(const SynRangeState& rangeState) override;
|
void setState(const HighlighterState& rangeState) override;
|
||||||
void resetState() override;
|
void resetState() override;
|
||||||
SynHighlighterClass getClass() const override;
|
HighlighterClass getClass() const override;
|
||||||
QString getName() const override;
|
QString getName() const override;
|
||||||
|
|
||||||
QString languageName() override;
|
QString languageName() override;
|
||||||
SynHighlighterLanguage language() override;
|
HighlighterLanguage language() override;
|
||||||
|
|
||||||
// SynHighlighter interface
|
// SynHighlighter interface
|
||||||
public:
|
public:
|
||||||
SynRangeState getRangeState() const override;
|
HighlighterState getState() const override;
|
||||||
|
|
||||||
// SynHighlighter interface
|
// SynHighlighter interface
|
||||||
public:
|
public:
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
namespace QSynedit {
|
namespace QSynedit {
|
||||||
|
|
||||||
class SynEditGLSLHighlighter: public SynHighlighter
|
class GLSLHighlighter: public Highlighter
|
||||||
{
|
{
|
||||||
enum TokenKind {
|
enum TokenId {
|
||||||
Asm = 1,
|
Asm = 1,
|
||||||
Comment,
|
Comment,
|
||||||
Directive,
|
Directive,
|
||||||
|
@ -44,7 +44,7 @@ class SynEditGLSLHighlighter: public SynHighlighter
|
||||||
RawString
|
RawString
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ExtTokenKind {
|
enum class ExtTokenId {
|
||||||
Add, AddAssign, And, AndAssign, Arrow, Assign,
|
Add, AddAssign, And, AndAssign, Arrow, Assign,
|
||||||
BitComplement, BraceClose, BraceOpen, Colon, Comma,
|
BitComplement, BraceClose, BraceOpen, Colon, Comma,
|
||||||
Decrement, Divide, DivideAssign, Ellipse, GreaterThan,
|
Decrement, Divide, DivideAssign, Ellipse, GreaterThan,
|
||||||
|
@ -68,40 +68,40 @@ class SynEditGLSLHighlighter: public SynHighlighter
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SynEditGLSLHighlighter();
|
explicit GLSLHighlighter();
|
||||||
|
|
||||||
PSynHighlighterAttribute asmAttribute() const;
|
PHighlighterAttribute asmAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute preprocessorAttribute() const;
|
PHighlighterAttribute preprocessorAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute invalidAttribute() const;
|
PHighlighterAttribute invalidAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute numberAttribute() const;
|
PHighlighterAttribute numberAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute floatAttribute() const;
|
PHighlighterAttribute floatAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute hexAttribute() const;
|
PHighlighterAttribute hexAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute octAttribute() const;
|
PHighlighterAttribute octAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute stringEscapeSequenceAttribute() const;
|
PHighlighterAttribute stringEscapeSequenceAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute charAttribute() const;
|
PHighlighterAttribute charAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute variableAttribute() const;
|
PHighlighterAttribute variableAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute functionAttribute() const;
|
PHighlighterAttribute functionAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute classAttribute() const;
|
PHighlighterAttribute classAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute globalVarAttribute() const;
|
PHighlighterAttribute globalVarAttribute() const;
|
||||||
|
|
||||||
PSynHighlighterAttribute localVarAttribute() const;
|
PHighlighterAttribute localVarAttribute() const;
|
||||||
|
|
||||||
static const QSet<QString> Keywords;
|
static const QSet<QString> Keywords;
|
||||||
|
|
||||||
ExtTokenKind getExtTokenId();
|
ExtTokenId getExtTokenId();
|
||||||
SynTokenKind getTokenId();
|
TokenKind getTokenId();
|
||||||
private:
|
private:
|
||||||
void andSymbolProc();
|
void andSymbolProc();
|
||||||
void ansiCppProc();
|
void ansiCppProc();
|
||||||
|
@ -149,7 +149,7 @@ private:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool mAsmStart;
|
bool mAsmStart;
|
||||||
SynRangeState mRange;
|
HighlighterState mRange;
|
||||||
// SynRangeState mSpaceRange;
|
// SynRangeState mSpaceRange;
|
||||||
QString mLineString;
|
QString mLineString;
|
||||||
QChar* mLine;
|
QChar* mLine;
|
||||||
|
@ -159,25 +159,25 @@ private:
|
||||||
int mToIdent;
|
int mToIdent;
|
||||||
int mTokenPos;
|
int mTokenPos;
|
||||||
int mTokenId;
|
int mTokenId;
|
||||||
ExtTokenKind mExtTokenId;
|
ExtTokenId mExtTokenId;
|
||||||
int mLineNumber;
|
int mLineNumber;
|
||||||
int mLeftBraces;
|
int mLeftBraces;
|
||||||
int mRightBraces;
|
int mRightBraces;
|
||||||
|
|
||||||
PSynHighlighterAttribute mAsmAttribute;
|
PHighlighterAttribute mAsmAttribute;
|
||||||
PSynHighlighterAttribute mPreprocessorAttribute;
|
PHighlighterAttribute mPreprocessorAttribute;
|
||||||
PSynHighlighterAttribute mInvalidAttribute;
|
PHighlighterAttribute mInvalidAttribute;
|
||||||
PSynHighlighterAttribute mNumberAttribute;
|
PHighlighterAttribute mNumberAttribute;
|
||||||
PSynHighlighterAttribute mFloatAttribute;
|
PHighlighterAttribute mFloatAttribute;
|
||||||
PSynHighlighterAttribute mHexAttribute;
|
PHighlighterAttribute mHexAttribute;
|
||||||
PSynHighlighterAttribute mOctAttribute;
|
PHighlighterAttribute mOctAttribute;
|
||||||
PSynHighlighterAttribute mStringEscapeSequenceAttribute;
|
PHighlighterAttribute mStringEscapeSequenceAttribute;
|
||||||
PSynHighlighterAttribute mCharAttribute;
|
PHighlighterAttribute mCharAttribute;
|
||||||
PSynHighlighterAttribute mVariableAttribute;
|
PHighlighterAttribute mVariableAttribute;
|
||||||
PSynHighlighterAttribute mFunctionAttribute;
|
PHighlighterAttribute mFunctionAttribute;
|
||||||
PSynHighlighterAttribute mClassAttribute;
|
PHighlighterAttribute mClassAttribute;
|
||||||
PSynHighlighterAttribute mGlobalVarAttribute;
|
PHighlighterAttribute mGlobalVarAttribute;
|
||||||
PSynHighlighterAttribute mLocalVarAttribute;
|
PHighlighterAttribute mLocalVarAttribute;
|
||||||
|
|
||||||
// SynHighligterBase interface
|
// SynHighligterBase interface
|
||||||
public:
|
public:
|
||||||
|
@ -186,24 +186,24 @@ public:
|
||||||
bool isLastLineStringNotFinished(int state) const override;
|
bool isLastLineStringNotFinished(int state) const override;
|
||||||
bool eol() const override;
|
bool eol() const override;
|
||||||
QString getToken() const override;
|
QString getToken() const override;
|
||||||
PSynHighlighterAttribute getTokenAttribute() const override;
|
PHighlighterAttribute getTokenAttribute() const override;
|
||||||
SynTokenKind getTokenKind() override;
|
TokenKind getTokenKind() override;
|
||||||
int getTokenPos() override;
|
int getTokenPos() override;
|
||||||
void next() override;
|
void next() override;
|
||||||
void setLine(const QString &newLine, int lineNumber) override;
|
void setLine(const QString &newLine, int lineNumber) override;
|
||||||
bool isKeyword(const QString &word) override;
|
bool isKeyword(const QString &word) override;
|
||||||
SynHighlighterTokenType getTokenType() override;
|
TokenType getTokenType() override;
|
||||||
void setState(const SynRangeState& rangeState) override;
|
void setState(const HighlighterState& rangeState) override;
|
||||||
void resetState() override;
|
void resetState() override;
|
||||||
SynHighlighterClass getClass() const override;
|
HighlighterClass getClass() const override;
|
||||||
QString getName() const override;
|
QString getName() const override;
|
||||||
|
|
||||||
QString languageName() override;
|
QString languageName() override;
|
||||||
SynHighlighterLanguage language() override;
|
HighlighterLanguage language() override;
|
||||||
|
|
||||||
// SynHighlighter interface
|
// SynHighlighter interface
|
||||||
public:
|
public:
|
||||||
SynRangeState getRangeState() const override;
|
HighlighterState getState() const override;
|
||||||
|
|
||||||
// SynHighlighter interface
|
// SynHighlighter interface
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Reference in New Issue