From 00ea7ee7730fbb787037ebfc88c4cc7ad17de7c6 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sun, 25 Sep 2022 09:55:18 +0800 Subject: [PATCH] create QSynedit namespace --- RedPandaIDE/HighlighterManager.cpp | 52 ++- RedPandaIDE/HighlighterManager.h | 12 +- RedPandaIDE/compiler/projectcompiler.h | 1 + RedPandaIDE/cpprefacter.cpp | 14 +- RedPandaIDE/cpprefacter.h | 8 +- RedPandaIDE/editor.cpp | 432 +++++++++--------- RedPandaIDE/editor.h | 40 +- RedPandaIDE/mainwindow.cpp | 12 +- RedPandaIDE/parser/cppparser.cpp | 2 +- RedPandaIDE/qsynedit/CodeFolding.cpp | 5 + RedPandaIDE/qsynedit/CodeFolding.h | 2 + RedPandaIDE/qsynedit/Constants.cpp | 3 + RedPandaIDE/qsynedit/Constants.h | 6 + RedPandaIDE/qsynedit/KeyStrokes.cpp | 3 + RedPandaIDE/qsynedit/KeyStrokes.h | 4 + RedPandaIDE/qsynedit/MiscClasses.cpp | 4 +- RedPandaIDE/qsynedit/MiscClasses.h | 4 + RedPandaIDE/qsynedit/MiscProcs.cpp | 3 + RedPandaIDE/qsynedit/MiscProcs.h | 4 + RedPandaIDE/qsynedit/Search.cpp | 3 + RedPandaIDE/qsynedit/Search.h | 2 + RedPandaIDE/qsynedit/SearchBase.cpp | 2 + RedPandaIDE/qsynedit/SearchBase.h | 4 + RedPandaIDE/qsynedit/SearchRegex.cpp | 4 + RedPandaIDE/qsynedit/SearchRegex.h | 3 + RedPandaIDE/qsynedit/SynEdit.cpp | 2 + RedPandaIDE/qsynedit/SynEdit.h | 3 + RedPandaIDE/qsynedit/TextBuffer.cpp | 4 + RedPandaIDE/qsynedit/TextBuffer.h | 6 +- RedPandaIDE/qsynedit/TextPainter.cpp | 3 + RedPandaIDE/qsynedit/TextPainter.h | 3 + RedPandaIDE/qsynedit/Types.cpp | 4 + RedPandaIDE/qsynedit/Types.h | 3 + RedPandaIDE/qsynedit/exporter/synexporter.cpp | 4 + RedPandaIDE/qsynedit/exporter/synexporter.h | 4 +- .../qsynedit/exporter/synhtmlexporter.cpp | 3 + .../qsynedit/exporter/synhtmlexporter.h | 3 +- .../qsynedit/exporter/synrtfexporter.cpp | 2 + .../qsynedit/exporter/synrtfexporter.h | 3 + RedPandaIDE/qsynedit/highlighter/asm.cpp | 3 + RedPandaIDE/qsynedit/highlighter/asm.h | 3 + RedPandaIDE/qsynedit/highlighter/base.cpp | 2 + RedPandaIDE/qsynedit/highlighter/base.h | 2 + .../qsynedit/highlighter/composition.cpp | 4 + .../qsynedit/highlighter/composition.h | 2 + RedPandaIDE/qsynedit/highlighter/cpp.cpp | 4 + RedPandaIDE/qsynedit/highlighter/cpp.h | 4 + RedPandaIDE/qsynedit/highlighter/glsl.cpp | 4 +- RedPandaIDE/qsynedit/highlighter/glsl.h | 3 + RedPandaIDE/settings.cpp | 12 +- RedPandaIDE/settings.h | 12 +- .../settingsdialog/editorgeneralwidget.cpp | 8 +- RedPandaIDE/todoparser.cpp | 6 +- RedPandaIDE/widgets/cpudialog.cpp | 2 +- RedPandaIDE/widgets/cpudialog.ui | 4 +- RedPandaIDE/widgets/filepropertiesdialog.cpp | 4 +- RedPandaIDE/widgets/searchdialog.cpp | 68 +-- RedPandaIDE/widgets/searchdialog.h | 20 +- RedPandaIDE/widgets/searchresultview.cpp | 2 +- RedPandaIDE/widgets/searchresultview.h | 4 +- 60 files changed, 488 insertions(+), 361 deletions(-) diff --git a/RedPandaIDE/HighlighterManager.cpp b/RedPandaIDE/HighlighterManager.cpp index 221ebb55..7ee79a71 100644 --- a/RedPandaIDE/HighlighterManager.cpp +++ b/RedPandaIDE/HighlighterManager.cpp @@ -30,7 +30,7 @@ HighlighterManager::HighlighterManager() } -PSynHighlighter HighlighterManager::getHighlighter(const QString &filename) +QSynedit::PSynHighlighter HighlighterManager::getHighlighter(const QString &filename) { QFileInfo info(filename); QString suffix = info.suffix(); @@ -43,26 +43,30 @@ PSynHighlighter HighlighterManager::getHighlighter(const QString &filename) } else if (suffix == "vs" || suffix == "fs" || suffix == "frag") { return getGLSLHighlighter(); } - return PSynHighlighter(); + return QSynedit::PSynHighlighter(); } -PSynHighlighter HighlighterManager::copyHighlighter(PSynHighlighter highlighter) +QSynedit::PSynHighlighter HighlighterManager::copyHighlighter(QSynedit::PSynHighlighter highlighter) { if (!highlighter) - return PSynHighlighter(); + return QSynedit::PSynHighlighter(); if (highlighter->getName() == SYN_HIGHLIGHTER_CPP) return getCppHighlighter(); + else if (highlighter->getName() == SYN_HIGHLIGHTER_ASM) + return getAsmHighlighter(); + else if (highlighter->getName() == SYN_HIGHLIGHTER_GLSL) + return getGLSLHighlighter(); //todo - return PSynHighlighter(); + return QSynedit::PSynHighlighter(); } -PSynHighlighter HighlighterManager::getCppHighlighter() +QSynedit::PSynHighlighter HighlighterManager::getCppHighlighter() { - SynEditCppHighlighter* highlighter = new SynEditCppHighlighter(); + QSynedit::SynEditCppHighlighter* highlighter = new QSynedit::SynEditCppHighlighter(); highlighter->asmAttribute()->setForeground(Qt::blue); highlighter->charAttribute()->setForeground(Qt::black); highlighter->commentAttribute()->setForeground(0x8C8C8C); - highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic); + highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic); highlighter->classAttribute()->setForeground(0x008080); highlighter->floatAttribute()->setForeground(Qt::darkMagenta); highlighter->functionAttribute()->setForeground(0x00627A); @@ -80,16 +84,16 @@ PSynHighlighter HighlighterManager::getCppHighlighter() highlighter->stringEscapeSequenceAttribute()->setForeground(Qt::red); highlighter->symbolAttribute()->setForeground(0xc10000); highlighter->variableAttribute()->setForeground(0x400080); - PSynHighlighter pHighlighter=std::make_shared(); + QSynedit::PSynHighlighter pHighlighter=std::make_shared(); return pHighlighter; } -PSynHighlighter HighlighterManager::getAsmHighlighter() +QSynedit::PSynHighlighter HighlighterManager::getAsmHighlighter() { - SynEditASMHighlighter* highlighter = new SynEditASMHighlighter(); - PSynHighlighter pHighlighter(highlighter); + QSynedit::SynEditASMHighlighter* highlighter = new QSynedit::SynEditASMHighlighter(); + QSynedit::PSynHighlighter pHighlighter(highlighter); highlighter->commentAttribute()->setForeground(0x8C8C8C); - highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic); + highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic); highlighter->identifierAttribute()->setForeground(0x080808); highlighter->keywordAttribute()->setForeground(0x0033b3); highlighter->numberAttribute()->setForeground(0x1750EB); @@ -99,14 +103,14 @@ PSynHighlighter HighlighterManager::getAsmHighlighter() return pHighlighter; } -PSynHighlighter HighlighterManager::getGLSLHighlighter() +QSynedit::PSynHighlighter HighlighterManager::getGLSLHighlighter() { - SynEditGLSLHighlighter* highlighter = new SynEditGLSLHighlighter(); - PSynHighlighter pHighlighter(highlighter); + QSynedit::SynEditGLSLHighlighter* highlighter = new QSynedit::SynEditGLSLHighlighter(); + QSynedit::PSynHighlighter pHighlighter(highlighter); highlighter->asmAttribute()->setForeground(Qt::blue); highlighter->charAttribute()->setForeground(Qt::black); highlighter->commentAttribute()->setForeground(0x8C8C8C); - highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic); + highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic); highlighter->classAttribute()->setForeground(0x008080); highlighter->floatAttribute()->setForeground(Qt::darkMagenta); highlighter->functionAttribute()->setForeground(0x00627A); @@ -127,7 +131,7 @@ PSynHighlighter HighlighterManager::getGLSLHighlighter() return pHighlighter; } -void HighlighterManager::applyColorScheme(PSynHighlighter highlighter, const QString &schemeName) +void HighlighterManager::applyColorScheme(QSynedit::PSynHighlighter highlighter, const QString &schemeName) { if (!highlighter) return; @@ -137,14 +141,14 @@ void HighlighterManager::applyColorScheme(PSynHighlighter highlighter, const QSt for (QString name: highlighter->attributes().keys()) { PColorSchemeItem item = pColorManager->getItem(schemeName,name); if (item) { - PSynHighlighterAttribute attr = highlighter->attributes()[name]; + QSynedit::PSynHighlighterAttribute attr = highlighter->attributes()[name]; attr->setBackground(item->background()); attr->setForeground(item->foreground()); - SynFontStyles styles = SynFontStyle::fsNone; - styles.setFlag(SynFontStyle::fsBold, item->bold()); - styles.setFlag(SynFontStyle::fsItalic, item->italic()); - styles.setFlag(SynFontStyle::fsUnderline, item->underlined()); - styles.setFlag(SynFontStyle::fsStrikeOut, item->strikeout()); + QSynedit::SynFontStyles styles = QSynedit::SynFontStyle::fsNone; + styles.setFlag(QSynedit::SynFontStyle::fsBold, item->bold()); + styles.setFlag(QSynedit::SynFontStyle::fsItalic, item->italic()); + styles.setFlag(QSynedit::SynFontStyle::fsUnderline, item->underlined()); + styles.setFlag(QSynedit::SynFontStyle::fsStrikeOut, item->strikeout()); attr->setStyles(styles); } } diff --git a/RedPandaIDE/HighlighterManager.h b/RedPandaIDE/HighlighterManager.h index 8048c543..9f353130 100644 --- a/RedPandaIDE/HighlighterManager.h +++ b/RedPandaIDE/HighlighterManager.h @@ -23,12 +23,12 @@ class HighlighterManager public: HighlighterManager(); - PSynHighlighter getHighlighter(const QString& filename); - PSynHighlighter copyHighlighter(PSynHighlighter highlighter); - PSynHighlighter getCppHighlighter(); - PSynHighlighter getAsmHighlighter(); - PSynHighlighter getGLSLHighlighter(); - void applyColorScheme(PSynHighlighter highlighter, const QString& schemeName); + QSynedit::PSynHighlighter getHighlighter(const QString& filename); + QSynedit::PSynHighlighter copyHighlighter(QSynedit::PSynHighlighter highlighter); + QSynedit::PSynHighlighter getCppHighlighter(); + QSynedit::PSynHighlighter getAsmHighlighter(); + QSynedit::PSynHighlighter getGLSLHighlighter(); + void applyColorScheme(QSynedit::PSynHighlighter highlighter, const QString& schemeName); }; extern HighlighterManager highlighterManager; diff --git a/RedPandaIDE/compiler/projectcompiler.h b/RedPandaIDE/compiler/projectcompiler.h index a4f82236..1a829c63 100644 --- a/RedPandaIDE/compiler/projectcompiler.h +++ b/RedPandaIDE/compiler/projectcompiler.h @@ -19,6 +19,7 @@ #include "compiler.h" #include +#include class Project; class ProjectCompiler : public Compiler diff --git a/RedPandaIDE/cpprefacter.cpp b/RedPandaIDE/cpprefacter.cpp index 81c6a952..2185fc77 100644 --- a/RedPandaIDE/cpprefacter.cpp +++ b/RedPandaIDE/cpprefacter.cpp @@ -30,7 +30,7 @@ CppRefacter::CppRefacter(QObject *parent) : QObject(parent) } -bool CppRefacter::findOccurence(Editor *editor, const BufferCoord &pos) +bool CppRefacter::findOccurence(Editor *editor, const QSynedit::BufferCoord &pos) { if (!editor->parser()) return false; @@ -106,7 +106,7 @@ static QString fullParentName(PStatement statement) { return ""; } } -void CppRefacter::renameSymbol(Editor *editor, const BufferCoord &pos, const QString &newWord) +void CppRefacter::renameSymbol(Editor *editor, const QSynedit::BufferCoord &pos, const QString &newWord) { if (!editor->parser()->freeze()) return; @@ -117,7 +117,7 @@ void CppRefacter::renameSymbol(Editor *editor, const BufferCoord &pos, const QSt QStringList expression; QChar s=editor->charAt(pos); if (!editor->isIdentChar(s)) { - expression = editor->getExpressionAtPosition(BufferCoord{pos.ch-1,pos.line}); + expression = editor->getExpressionAtPosition(QSynedit::BufferCoord{pos.ch-1,pos.line}); } else { expression = editor->getExpressionAtPosition(pos); } @@ -226,11 +226,11 @@ PSearchResultTreeItem CppRefacter::findOccurenceInFile( while (!editor.highlighter()->eol()) { int start = editor.highlighter()->getTokenPos() + 1; QString token = editor.highlighter()->getToken(); - PSynHighlighterAttribute attr = editor.highlighter()->getTokenAttribute(); + QSynedit::PSynHighlighterAttribute attr = editor.highlighter()->getTokenAttribute(); if (!attr || attr!=editor.highlighter()->commentAttribute()) { if (token == statement->command) { //same name symbol , test if the same statement; - BufferCoord p; + QSynedit::BufferCoord p; p.line = posY+1; p.ch = start+1; @@ -290,7 +290,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement & QString token = editor.highlighter()->getToken(); if (token == statement->command) { //same name symbol , test if the same statement; - BufferCoord p; + QSynedit::BufferCoord p; p.line = posY+1; p.ch = start; @@ -313,7 +313,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement & Editor * oldEditor = pMainWindow->editorList()->getOpenedEditorByFilename(filename); if (oldEditor) { - BufferCoord oldXY=oldEditor->caretXY(); + QSynedit::BufferCoord oldXY=oldEditor->caretXY(); int topLine = oldEditor->topLine(); int leftChar = oldEditor->leftChar(); oldEditor->beginUndoBlock(); diff --git a/RedPandaIDE/cpprefacter.h b/RedPandaIDE/cpprefacter.h index 93af26f8..39119daa 100644 --- a/RedPandaIDE/cpprefacter.h +++ b/RedPandaIDE/cpprefacter.h @@ -23,7 +23,9 @@ #include "parser/cppparser.h" class Editor; -struct BufferCoord; +namespace QSynedit { + struct BufferCoord; +} class Project; class CppRefacter : public QObject { @@ -31,10 +33,10 @@ class CppRefacter : public QObject public: explicit CppRefacter(QObject *parent = nullptr); - bool findOccurence(Editor * editor, const BufferCoord& pos); + bool findOccurence(Editor * editor, const QSynedit::BufferCoord& pos); bool findOccurence(const QString& statementFullname, SearchFileScope scope); - void renameSymbol(Editor* editor, const BufferCoord& pos, const QString& newWord); + void renameSymbol(Editor* editor, const QSynedit::BufferCoord& pos, const QString& newWord); private: void doFindOccurenceInEditor(PStatement statement, Editor* editor, const PCppParser& parser); void doFindOccurenceInProject(PStatement statement, std::shared_ptr project, const PCppParser& parser); diff --git a/RedPandaIDE/editor.cpp b/RedPandaIDE/editor.cpp index 6f37c717..6a4cb563 100644 --- a/RedPandaIDE/editor.cpp +++ b/RedPandaIDE/editor.cpp @@ -102,7 +102,7 @@ Editor::Editor(QWidget *parent, const QString& filename, mFilename = tr("untitled")+QString("%1").arg(getNewFileNumber()); } QFileInfo fileInfo(mFilename); - PSynHighlighter highlighter; + QSynedit::PSynHighlighter highlighter; if (!isNew) { loadFile(); highlighter = highlighterManager.getHighlighter(mFilename); @@ -147,7 +147,7 @@ Editor::Editor(QWidget *parent, const QString& filename, connect(this,&SynEdit::statusChanged,this,&Editor::onStatusChanged); connect(this,&SynEdit::gutterClicked,this,&Editor::onGutterClicked); - onStatusChanged(SynStatusChange::scOpenFile); + onStatusChanged(QSynedit::SynStatusChange::scOpenFile); setAttribute(Qt::WA_Hover,true); @@ -374,7 +374,7 @@ bool Editor::saveAs(const QString &name, bool fromProject){ } //update (reassign highlighter) - PSynHighlighter newHighlighter = HighlighterManager().getHighlighter(mFilename); + QSynedit::PSynHighlighter newHighlighter = HighlighterManager().getHighlighter(mFilename); if (newHighlighter) { setUseCodeFolding(true); } else { @@ -473,10 +473,10 @@ void Editor::setPageControl(QTabWidget *newPageControl) void Editor::undoSymbolCompletion(int pos) { - PSynHighlighterAttribute Attr; + QSynedit::PSynHighlighterAttribute Attr; QString Token; bool tokenFinished; - SynHighlighterTokenType tokenType; + QSynedit::SynHighlighterTokenType tokenType; if (!highlighter()) return; @@ -484,7 +484,7 @@ void Editor::undoSymbolCompletion(int pos) return; if (!getHighlighterAttriAtRowCol(caretXY(), Token, tokenFinished, tokenType, Attr)) return; - if ((tokenType == SynHighlighterTokenType::Comment) && (!tokenFinished)) + if ((tokenType == QSynedit::SynHighlighterTokenType::Comment) && (!tokenFinished)) return ; //convert caret x to string index; pos--; @@ -493,11 +493,11 @@ void Editor::undoSymbolCompletion(int pos) return; QChar DeletedChar = lineText().at(pos); QChar NextChar = lineText().at(pos+1); - if ((tokenType == SynHighlighterTokenType::Character) && (DeletedChar != '\'')) + if ((tokenType == QSynedit::SynHighlighterTokenType::Character) && (DeletedChar != '\'')) return; - if (tokenType == SynHighlighterTokenType::StringEscapeSequence) + if (tokenType == QSynedit::SynHighlighterTokenType::StringEscapeSequence) return; - if (tokenType == SynHighlighterTokenType::String) { + if (tokenType == QSynedit::SynHighlighterTokenType::String) { if ((DeletedChar!='"') && (DeletedChar!='(')) return; if ((DeletedChar=='"') && (Token!="\"\"")) @@ -505,7 +505,7 @@ void Editor::undoSymbolCompletion(int pos) if ((DeletedChar=='(') && (!Token.startsWith("R\""))) return; } - if ((DeletedChar == '\'') && (tokenType == SynHighlighterTokenType::Number)) + if ((DeletedChar == '\'') && (tokenType == QSynedit::SynHighlighterTokenType::Number)) return; if ((DeletedChar == '<') && !(mParser && mParser->isIncludeLine(lineText()))) @@ -516,7 +516,7 @@ void Editor::undoSymbolCompletion(int pos) (pSettings->editor().completeBrace() && (DeletedChar == '{') && (NextChar == '}')) || (pSettings->editor().completeSingleQuote() && (DeletedChar == '\'') && (NextChar == '\'')) || (pSettings->editor().completeDoubleQuote() && (DeletedChar == '\"') && (NextChar == '\"'))) { - commandProcessor(SynEditorCommand::ecDeleteChar); + commandProcessor(QSynedit::SynEditorCommand::ecDeleteChar); } } @@ -590,7 +590,7 @@ void Editor::keyPressEvent(QKeyEvent *event) if (s=="/**") { //javadoc style docstring s = lineText().mid(caretX()-1).trimmed(); if (s=="*/") { - BufferCoord p = caretXY(); + QSynedit::BufferCoord p = caretXY(); setBlockBegin(p); p.ch = lineText().length()+1; setBlockEnd(p); @@ -648,7 +648,7 @@ void Editor::keyPressEvent(QKeyEvent *event) int right = document()->getString(caretY()-1).length()-caretX(); s=lineBreak()+"* "; insertString(s,false); - BufferCoord p = caretXY(); + QSynedit::BufferCoord p = caretXY(); p.line++; p.ch = document()->getString(p.line-1).length()+1; if (right>0) { @@ -715,7 +715,7 @@ void Editor::keyPressEvent(QKeyEvent *event) if (t.isEmpty()) return; - if (activeSelectionMode()==SynSelectionMode::Column) + if (activeSelectionMode()==QSynedit::SynSelectionMode::Column) return; QChar ch = t[0]; @@ -864,12 +864,12 @@ void Editor::onGutterPaint(QPainter &painter, int aLine, int X, int Y) } } -void Editor::onGetEditingAreas(int Line, SynEditingAreaList &areaList) +void Editor::onGetEditingAreas(int Line, QSynedit::SynEditingAreaList &areaList) { areaList.clear(); if (mTabStopBegin>=0 && mTabStopY == Line) { - PSynEditingArea p = make_shared(); - p->type = SynEditingAreaType::eatRectangleBorder; + QSynedit::PSynEditingArea p = make_shared(); + p->type = QSynedit::SynEditingAreaType::eatRectangleBorder; // int spaceCount = leftSpaces(mLineBeforeTabStop); // int spaceBefore = mLineBeforeTabStop.length()-TrimLeft(mLineBeforeTabStop).length(); p->beginX = mTabStopBegin; @@ -880,7 +880,7 @@ void Editor::onGetEditingAreas(int Line, SynEditingAreaList &areaList) PSyntaxIssueList lst = getSyntaxIssuesAtLine(Line); if (lst) { for (const PSyntaxIssue& issue: *lst) { - PSynEditingArea p=std::make_shared(); + QSynedit::PSynEditingArea p=std::make_shared(); p->beginX = issue->col; p->endX = issue->endCol; if (issue->issueType == CompileIssueType::Error) { @@ -888,7 +888,7 @@ void Editor::onGetEditingAreas(int Line, SynEditingAreaList &areaList) } else { p->color = mSyntaxWarningColor; } - p->type = SynEditingAreaType::eatWaveUnderLine; + p->type = QSynedit::SynEditingAreaType::eatWaveUnderLine; areaList.append(p); } } @@ -918,7 +918,7 @@ bool Editor::onGetSpecialLineColors(int Line, QColor &foreground, QColor &backgr return false; } -void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &token, PSynHighlighterAttribute attr, SynFontStyles &style, QColor &foreground, QColor &background) +void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PSynHighlighterAttribute attr, QSynedit::SynFontStyles &style, QColor &foreground, QColor &background) { if (token.isEmpty()) return; @@ -927,7 +927,7 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to QString lineText = document()->getString(line-1); if (mParser->isIncludeLine(lineText)) { if (cursor() == Qt::PointingHandCursor) { - BufferCoord p; + QSynedit::BufferCoord p; if (pointToCharLine(mapFromGlobal(QCursor::pos()),p)) { if (line==p.line){ int pos1=std::max(lineText.indexOf("<"),lineText.indexOf("\"")); @@ -935,13 +935,13 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to pos1++; pos2++; if (pos1>0 && pos2>0 && pos1identifierAttribute()) { - BufferCoord p{aChar,line}; + QSynedit::BufferCoord p{aChar,line}; // BufferCoord pBeginPos,pEndPos; // QString s= getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpInformation); // qDebug()<=1) && (pEndPos.ch>=0) @@ -970,18 +970,18 @@ void Editor::onPreparePaintHighlightToken(int line, int aChar, const QString &to if (item) { foreground = item->foreground(); //background = item->background(); - style.setFlag(SynFontStyle::fsBold,item->bold()); - style.setFlag(SynFontStyle::fsItalic,item->italic()); - style.setFlag(SynFontStyle::fsUnderline,item->underlined()); - style.setFlag(SynFontStyle::fsStrikeOut,item->strikeout()); + style.setFlag(QSynedit::SynFontStyle::fsBold,item->bold()); + style.setFlag(QSynedit::SynFontStyle::fsItalic,item->italic()); + style.setFlag(QSynedit::SynFontStyle::fsUnderline,item->underlined()); + style.setFlag(QSynedit::SynFontStyle::fsStrikeOut,item->strikeout()); } else { foreground = highlighter()->identifierAttribute()->foreground(); } if (cursor() == Qt::PointingHandCursor) { - BufferCoord p; + QSynedit::BufferCoord p; if (pointToCharLine(mapFromGlobal(QCursor::pos()),p)) { if (line==p.line && (aChar<=p.ch && p.ch(event); - BufferCoord p; + QSynedit::BufferCoord p; TipType reason = getTipType(helpEvent->pos(),p); PSyntaxIssue pError; int line ; @@ -1058,7 +1058,7 @@ bool Editor::event(QEvent *event) // Get subject bool isIncludeLine = false; - BufferCoord pBeginPos,pEndPos; + QSynedit::BufferCoord pBeginPos,pEndPos; QString s; QStringList expression; switch (reason) { @@ -1204,7 +1204,7 @@ void Editor::mouseReleaseEvent(QMouseEvent *event) if ((cursor() == Qt::PointingHandCursor) && (event->modifiers() == Qt::ControlModifier) && (event->button() == Qt::LeftButton)) { - BufferCoord p; + QSynedit::BufferCoord p; if (pointToCharLine(event->pos(),p)) { QString s = document()->getString(p.line - 1); if (mParser->isIncludeLine(s)) { @@ -1220,12 +1220,12 @@ void Editor::mouseReleaseEvent(QMouseEvent *event) } } } - SynEdit::mouseReleaseEvent(event); + QSynedit::SynEdit::mouseReleaseEvent(event); } void Editor::inputMethodEvent(QInputMethodEvent *event) { - SynEdit::inputMethodEvent(event); + QSynedit::SynEdit::inputMethodEvent(event); QString s = event->commitString(); if (s.isEmpty()) return; @@ -1290,7 +1290,7 @@ void Editor::showEvent(QShowEvent */*event*/) connect(mParser.get(), &CppParser::onEndParsing, this, - &SynEdit::invalidate); + &QSynedit::SynEdit::invalidate); reparse(); } @@ -1308,7 +1308,7 @@ void Editor::hideEvent(QHideEvent */*event*/) disconnect(mParser.get(), &CppParser::onEndParsing, this, - &SynEdit::invalidate); + &QSynedit::SynEdit::invalidate); } if (pSettings->codeCompletion().clearWhenEditorHidden() && !inProject() && mParser @@ -1320,7 +1320,7 @@ void Editor::hideEvent(QHideEvent */*event*/) void Editor::resizeEvent(QResizeEvent *event) { - SynEdit::resizeEvent(event); + QSynedit::SynEdit::resizeEvent(event); pMainWindow->functionTip()->hide(); } @@ -1345,7 +1345,7 @@ void Editor::copyToClipboard() copyAsHTML(); break;; default: - SynEdit::copyToClipboard(); + QSynedit::SynEdit::copyToClipboard(); } } @@ -1365,20 +1365,20 @@ void Editor::cutToClipboard() return; } } - SynEdit::cutToClipboard(); + QSynedit::SynEdit::cutToClipboard(); } void Editor::copyAsHTML() { if (!selAvail()) return; - SynHTMLExporter exporter(tabWidth()); + QSynedit::SynHTMLExporter exporter(tabWidth()); exporter.setTitle(QFileInfo(mFilename).fileName()); exporter.setExportAsText(false); exporter.setUseBackground(pSettings->editor().copyHTMLUseBackground()); exporter.setFont(font()); - PSynHighlighter hl = highlighter(); + QSynedit::PSynHighlighter hl = highlighter(); if (!pSettings->editor().copyHTMLUseEditorColor()) { hl = highlighterManager.copyHighlighter(highlighter()); highlighterManager.applyColorScheme(hl,pSettings->editor().copyHTMLColorScheme()); @@ -1409,7 +1409,7 @@ void Editor::copyAsHTML() void Editor::setCaretPosition(int line, int aChar) { this->uncollapseAroundLine(line); - this->setCaretXYCentered(BufferCoord{aChar,line}); + this->setCaretXYCentered(QSynedit::BufferCoord{aChar,line}); } void Editor::setCaretPositionAndActivate(int line, int aChar) @@ -1417,17 +1417,17 @@ void Editor::setCaretPositionAndActivate(int line, int aChar) this->uncollapseAroundLine(line); if (!this->hasFocus()) this->activate(); - this->setCaretXYCentered(BufferCoord{aChar,line}); + this->setCaretXYCentered(QSynedit::BufferCoord{aChar,line}); } void Editor::addSyntaxIssues(int line, int startChar, int endChar, CompileIssueType errorType, const QString &hint) { PSyntaxIssue pError; - BufferCoord p; + QSynedit::BufferCoord p; QString token; - SynHighlighterTokenType tokenType; + QSynedit::SynHighlighterTokenType tokenType; int tokenKind,start; - PSynHighlighterAttribute attr; + QSynedit::PSynHighlighterAttribute attr; PSyntaxIssueList lst; if ((line<1) || (line>document()->count())) return; @@ -1475,7 +1475,7 @@ void Editor::gotoNextSyntaxIssue() iter++; if (iter==mSyntaxIssues.end()) return; - BufferCoord p; + QSynedit::BufferCoord p; p.ch = (*iter)->at(0)->startChar; p.line = iter.key(); setCaretXY(p); @@ -1489,7 +1489,7 @@ void Editor::gotoPrevSyntaxIssue() if (iter==mSyntaxIssues.begin()) return; iter--; - BufferCoord p; + QSynedit::BufferCoord p; p.ch = (*iter)->at(0)->startChar; p.line = iter.key(); setCaretXY(p); @@ -1524,7 +1524,7 @@ Editor::PSyntaxIssueList Editor::getSyntaxIssuesAtLine(int line) return PSyntaxIssueList(); } -Editor::PSyntaxIssue Editor::getSyntaxIssueAtPosition(const BufferCoord &pos) +Editor::PSyntaxIssue Editor::getSyntaxIssueAtPosition(const QSynedit::BufferCoord &pos) { PSyntaxIssueList lst = getSyntaxIssuesAtLine(pos.line); if (!lst) @@ -1536,18 +1536,18 @@ Editor::PSyntaxIssue Editor::getSyntaxIssueAtPosition(const BufferCoord &pos) return PSyntaxIssue(); } -void Editor::onStatusChanged(SynStatusChanges changes) +void Editor::onStatusChanged(QSynedit::SynStatusChanges changes) { - if ((!changes.testFlag(SynStatusChange::scReadOnly) - && !changes.testFlag(SynStatusChange::scInsertMode) + if ((!changes.testFlag(QSynedit::SynStatusChange::scReadOnly) + && !changes.testFlag(QSynedit::SynStatusChange::scInsertMode) && (document()->count()!=mLineCount) && (document()->count()!=0) && ((mLineCount>0) || (document()->count()>1))) || (mCurrentLineModified - && !changes.testFlag(SynStatusChange::scReadOnly) - && changes.testFlag(SynStatusChange::scCaretY))) { + && !changes.testFlag(QSynedit::SynStatusChange::scReadOnly) + && changes.testFlag(QSynedit::SynStatusChange::scCaretY))) { mCurrentLineModified = false; - if (!changes.testFlag(SynStatusChange::scOpenFile)) + if (!changes.testFlag(QSynedit::SynStatusChange::scOpenFile)) reparse(); // if (pSettings->codeCompletion().clearWhenEditorHidden() // && changes.testFlag(SynStatusChange::scOpenFile)) { @@ -1559,17 +1559,17 @@ void Editor::onStatusChanged(SynStatusChanges changes) reparseTodo(); } mLineCount = document()->count(); - if (changes.testFlag(scModifyChanged)) { + if (changes.testFlag(QSynedit::scModifyChanged)) { updateCaption(); } - if (changes.testFlag(scModified)) { + if (changes.testFlag(QSynedit::scModified)) { mCurrentLineModified = true; if (mParentPageControl!=nullptr) mCanAutoSave = true; } - if (changes.testFlag(SynStatusChange::scCaretX) - || changes.testFlag(SynStatusChange::scCaretY)) { + if (changes.testFlag(QSynedit::SynStatusChange::scCaretX) + || changes.testFlag(QSynedit::SynStatusChange::scCaretY)) { if (mTabStopBegin >=0) { if (mTabStopY==caretY()) { if (mLineAfterTabStop.isEmpty()) { @@ -1598,12 +1598,12 @@ void Editor::onStatusChanged(SynStatusChanges changes) } else if (!selAvail() && highlighter() && pSettings->editor().highlightMathingBraces()){ invalidateLine(mHighlightCharPos1.line); invalidateLine(mHighlightCharPos2.line); - mHighlightCharPos1 = BufferCoord{0,0}; - mHighlightCharPos2 = BufferCoord{0,0}; + mHighlightCharPos1 = QSynedit::BufferCoord{0,0}; + mHighlightCharPos2 = QSynedit::BufferCoord{0,0}; // Is there a bracket char before us? int lineLength = lineText().length(); int ch = caretX() - 2; - BufferCoord coord; + QSynedit::BufferCoord coord; if (ch>=0 && chsymbolAttribute()) { - BufferCoord complementCharPos = getMatchingBracketEx(coord); + QSynedit::BufferCoord complementCharPos = getMatchingBracketEx(coord); if (!foldHidesLine(coord.line) && !foldHidesLine(complementCharPos.line)) { mHighlightCharPos1 = coord; @@ -1632,7 +1632,7 @@ void Editor::onStatusChanged(SynStatusChanges changes) } // scSelection includes anything caret related - if (changes.testFlag(SynStatusChange::scSelection)) { + if (changes.testFlag(QSynedit::SynStatusChange::scSelection)) { if (!selAvail() && pSettings->editor().highlightCurrentWord()) { mCurrentHighlightedWord = wordAtCursor(); } else if (selAvail() && blockBegin() == wordStart() @@ -1659,12 +1659,12 @@ void Editor::onStatusChanged(SynStatusChanges changes) - if (changes.testFlag(scInsertMode) | changes.testFlag(scReadOnly)) + if (changes.testFlag(QSynedit::scInsertMode) | changes.testFlag(QSynedit::scReadOnly)) pMainWindow->updateForStatusbarModeInfo(); pMainWindow->updateEditorActions(); - if (changes.testFlag(SynStatusChange::scCaretY) && mParentPageControl) { + if (changes.testFlag(QSynedit::SynStatusChange::scCaretY) && mParentPageControl) { pMainWindow->caretList().addCaret(this,caretY(),caretX()); pMainWindow->updateCaretActions(); } @@ -1765,46 +1765,46 @@ bool Editor::notParsed() void Editor::insertLine() { - ExecuteCommand(SynEditorCommand::ecInsertLine,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecInsertLine,QChar(),nullptr); } void Editor::deleteWord() { - ExecuteCommand(SynEditorCommand::ecDeleteWord,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteWord,QChar(),nullptr); } void Editor::deleteToWordStart() { - ExecuteCommand(SynEditorCommand::ecDeleteWordStart,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteWordStart,QChar(),nullptr); } void Editor::deleteToWordEnd() { - ExecuteCommand(SynEditorCommand::ecDeleteWordEnd,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteWordEnd,QChar(),nullptr); } void Editor::deleteLine() { - ExecuteCommand(SynEditorCommand::ecDeleteLine,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteLine,QChar(),nullptr); } void Editor::duplicateLine() { - ExecuteCommand(SynEditorCommand::ecDuplicateLine,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecDuplicateLine,QChar(),nullptr); } void Editor::deleteToEOL() { - ExecuteCommand(SynEditorCommand::ecDeleteEOL,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteEOL,QChar(),nullptr); } void Editor::deleteToBOL() { - ExecuteCommand(SynEditorCommand::ecDeleteBOL,QChar(),nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecDeleteBOL,QChar(),nullptr); } QStringList Editor::getOwnerExpressionAndMemberAtPositionForCompletion( - const BufferCoord &pos, + const QSynedit::BufferCoord &pos, QString &memberOperator, QStringList &memberExpression) { @@ -1813,7 +1813,7 @@ QStringList Editor::getOwnerExpressionAndMemberAtPositionForCompletion( } QStringList Editor::getExpressionAtPosition( - const BufferCoord &pos) + const QSynedit::BufferCoord &pos) { QStringList result; if (!highlighter()) @@ -1822,7 +1822,7 @@ QStringList Editor::getExpressionAtPosition( int ch = pos.ch-1; int symbolMatchingLevel = 0; LastSymbolType lastSymbolType=LastSymbolType::None; - PSynHighlighter highlighter; + QSynedit::PSynHighlighter highlighter; if (isNew()) highlighter = highlighterManager.getCppHighlighter(); else @@ -1847,7 +1847,7 @@ QStringList Editor::getExpressionAtPosition( if (start>ch) { break; } - PSynHighlighterAttribute attr = highlighter->getTokenAttribute(); + QSynedit::PSynHighlighterAttribute attr = highlighter->getTokenAttribute(); if ( (line == pos.line-1) && (start<=ch) && (ch<=endPos)) { if (attr==highlighter->commentAttribute() || attr == highlighter->stringAttribute()) { @@ -2036,7 +2036,7 @@ QStringList Editor::getExpressionAtPosition( return result; } -QString Editor::getWordForCompletionSearch(const BufferCoord &pos,bool permitTilde) +QString Editor::getWordForCompletionSearch(const QSynedit::BufferCoord &pos,bool permitTilde) { QString result = ""; QString s; @@ -2085,16 +2085,16 @@ bool Editor::handleSymbolCompletion(QChar key) return false; } } else { - BufferCoord HighlightPos = BufferCoord{caretX()-1, caretY()}; + QSynedit::BufferCoord HighlightPos = QSynedit::BufferCoord{caretX()-1, caretY()}; // Check if that line is highlighted as comment - PSynHighlighterAttribute Attr; + QSynedit::PSynHighlighterAttribute Attr; QString Token; bool tokenFinished; - SynHighlighterTokenType tokenType; + QSynedit::SynHighlighterTokenType tokenType; if (getHighlighterAttriAtRowCol(HighlightPos, Token, tokenFinished, tokenType,Attr)) { - if ((tokenType == SynHighlighterTokenType::Comment) && (!tokenFinished)) + if ((tokenType == QSynedit::SynHighlighterTokenType::Comment) && (!tokenFinished)) return false; - if ((tokenType == SynHighlighterTokenType::String) && (!tokenFinished) + if ((tokenType == QSynedit::SynHighlighterTokenType::String) && (!tokenFinished) && (key!='\'') && (key!='\"') && (key!='(') && (key!=')')) return false; if (( key=='<' || key =='>') && (mParser && !mParser->isIncludeLine(lineText()))) @@ -2190,17 +2190,17 @@ bool Editor::handleParentheseCompletion() QString text=selText(); beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'('); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'('); setSelText(text); - commandProcessor(SynEditorCommand::ecChar,')'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,')'); endUndoBlock(); endUpdate(); } else { beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'('); - BufferCoord oldCaret = caretXY(); - commandProcessor(SynEditorCommand::ecChar,')'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'('); + QSynedit::BufferCoord oldCaret = caretXY(); + commandProcessor(QSynedit::SynEditorCommand::ecChar,')'); setCaretXY(oldCaret); endUndoBlock(); endUpdate(); @@ -2218,7 +2218,7 @@ bool Editor::handleParentheseSkip() return false; QuoteStatus status = getQuoteStatus(); if (status == QuoteStatus::RawStringNoEscape) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } if (status != QuoteStatus::NotQuote) @@ -2227,15 +2227,15 @@ bool Editor::handleParentheseSkip() if (document()->count()==0) return false; if (highlighter()) { - SynRangeState lastLineState = document()->ranges(document()->count()-1); + QSynedit::SynRangeState lastLineState = document()->ranges(document()->count()-1); if (lastLineState.parenthesisLevel==0) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } } else { - BufferCoord pos = getMatchingBracket(); + QSynedit::BufferCoord pos = getMatchingBracket(); if (pos.line != 0) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } } @@ -2251,17 +2251,17 @@ bool Editor::handleBracketCompletion() QString text=selText(); beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'['); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'['); setSelText(text); - commandProcessor(SynEditorCommand::ecChar,']'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,']'); endUndoBlock(); endUpdate(); } else { beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'['); - BufferCoord oldCaret = caretXY(); - commandProcessor(SynEditorCommand::ecChar,']'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'['); + QSynedit::BufferCoord oldCaret = caretXY(); + commandProcessor(QSynedit::SynEditorCommand::ecChar,']'); setCaretXY(oldCaret); endUndoBlock(); endUpdate(); @@ -2278,15 +2278,15 @@ bool Editor::handleBracketSkip() if (document()->count()==0) return false; if (highlighter()) { - SynRangeState lastLineState = document()->ranges(document()->count()-1); + QSynedit::SynRangeState lastLineState = document()->ranges(document()->count()-1); if (lastLineState.bracketLevel==0) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } } else { - BufferCoord pos = getMatchingBracket(); + QSynedit::BufferCoord pos = getMatchingBracket(); if (pos.line != 0) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } } @@ -2299,14 +2299,14 @@ bool Editor::handleMultilineCommentCompletion() QString text=selText(); beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'*'); - BufferCoord oldCaret; + commandProcessor(QSynedit::SynEditorCommand::ecChar,'*'); + QSynedit::BufferCoord oldCaret; if (text.isEmpty()) oldCaret = caretXY(); else setSelText(text); - commandProcessor(SynEditorCommand::ecChar,'*'); - commandProcessor(SynEditorCommand::ecChar,'/'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'*'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'/'); if (text.isEmpty()) setCaretXY(oldCaret); endUndoBlock(); @@ -2327,16 +2327,16 @@ bool Editor::handleBraceCompletion() QString text=selText(); beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'{'); - BufferCoord oldCaret; + commandProcessor(QSynedit::SynEditorCommand::ecChar,'{'); + QSynedit::BufferCoord oldCaret; if (text.isEmpty()) { oldCaret = caretXY(); } else { - commandProcessor(SynEditorCommand::ecInsertLine); + commandProcessor(QSynedit::SynEditorCommand::ecInsertLine); setSelText(text); - commandProcessor(SynEditorCommand::ecInsertLine); + commandProcessor(QSynedit::SynEditorCommand::ecInsertLine); } - commandProcessor(SynEditorCommand::ecChar,'}'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'}'); if ( ( (s.startsWith("struct") || s.startsWith("class") @@ -2347,7 +2347,7 @@ bool Editor::handleBraceCompletion() || s.startsWith("enum") ) && !s.contains(';') ) || s.endsWith('=')) { - commandProcessor(SynEditorCommand::ecChar,';'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,';'); } if (text.isEmpty()) setCaretXY(oldCaret); @@ -2364,20 +2364,20 @@ bool Editor::handleBraceSkip() if (document()->count()==0) return false; if (highlighter()) { - SynRangeState lastLineState = document()->ranges(document()->count()-1); + QSynedit::SynRangeState lastLineState = document()->ranges(document()->count()-1); if (lastLineState.braceLevel==0) { bool oldInsertMode = insertMode(); setInsertMode(false); //set mode to overwrite - commandProcessor(SynEditorCommand::ecChar,'}'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'}'); setInsertMode(oldInsertMode); return true; } } else { - BufferCoord pos = getMatchingBracket(); + QSynedit::BufferCoord pos = getMatchingBracket(); if (pos.line != 0) { bool oldInsertMode = insertMode(); setInsertMode(false); //set mode to overwrite - commandProcessor(SynEditorCommand::ecChar,'}'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'}'); setInsertMode(oldInsertMode); return true; } @@ -2391,7 +2391,7 @@ bool Editor::handleSingleQuoteCompletion() QChar ch = getCurrentChar(); if (ch == '\'') { if (status == QuoteStatus::SingleQuote && !selAvail()) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } } else { @@ -2400,9 +2400,9 @@ bool Editor::handleSingleQuoteCompletion() QString text=selText(); beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'\''); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'\''); setSelText(text); - commandProcessor(SynEditorCommand::ecChar,'\''); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'\''); endUndoBlock(); endUpdate(); return true; @@ -2411,9 +2411,9 @@ bool Editor::handleSingleQuoteCompletion() // insert '' beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'\''); - BufferCoord oldCaret = caretXY(); - commandProcessor(SynEditorCommand::ecChar,'\''); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'\''); + QSynedit::BufferCoord oldCaret = caretXY(); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'\''); setCaretXY(oldCaret); endUndoBlock(); endUpdate(); @@ -2431,7 +2431,7 @@ bool Editor::handleDoubleQuoteCompletion() if (ch == '"') { if ((status == QuoteStatus::DoubleQuote || status == QuoteStatus::RawString) && !selAvail()) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY( QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } } else { @@ -2440,9 +2440,9 @@ bool Editor::handleDoubleQuoteCompletion() QString text=selText(); beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'"'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'"'); setSelText(text); - commandProcessor(SynEditorCommand::ecChar,'"'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'"'); endUndoBlock(); endUpdate(); return true; @@ -2451,9 +2451,9 @@ bool Editor::handleDoubleQuoteCompletion() // insert "" beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'"'); - BufferCoord oldCaret = caretXY(); - commandProcessor(SynEditorCommand::ecChar,'"'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'"'); + QSynedit::BufferCoord oldCaret = caretXY(); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'"'); setCaretXY(oldCaret); endUndoBlock(); endUpdate(); @@ -2473,9 +2473,9 @@ bool Editor::handleGlobalIncludeCompletion() return false; beginUpdate(); beginUndoBlock(); - commandProcessor(SynEditorCommand::ecChar,'<'); - BufferCoord oldCaret = caretXY(); - commandProcessor(SynEditorCommand::ecChar,'>'); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'<'); + QSynedit::BufferCoord oldCaret = caretXY(); + commandProcessor(QSynedit::SynEditorCommand::ecChar,'>'); setCaretXY(oldCaret); endUpdate(); endUndoBlock(); @@ -2489,9 +2489,9 @@ bool Editor::handleGlobalIncludeSkip() QString s= lineText().mid(1).trimmed(); if (!s.startsWith("include")) //it's not #include return false; - BufferCoord pos = getMatchingBracket(); + QSynedit::BufferCoord pos = getMatchingBracket(); if (pos.line != 0) { - setCaretXY( BufferCoord{caretX() + 1, caretY()}); // skip over + setCaretXY(QSynedit::BufferCoord{caretX() + 1, caretY()}); // skip over return true; } return false; @@ -2514,7 +2514,7 @@ bool Editor::handleCodeCompletion(QChar key) showCompletion("",false); return true; case ':': - ExecuteCommand(SynEditorCommand::ecChar,':',nullptr); + ExecuteCommand(QSynedit::SynEditorCommand::ecChar,':',nullptr); //setSelText(key); if ((caretX() > 2) && (lineText().length() >= 2) && (lineText()[caretX() - 3] == ':')) @@ -2549,7 +2549,7 @@ void Editor::initParser() resetCppParser(mParser); mParser->setEnabled( pSettings->codeCompletion().enabled() && - (highlighter() && highlighter()->getClass() == SynHighlighterClass::CppHighlighter)); + (highlighter() && highlighter()->getClass() == QSynedit::SynHighlighterClass::CppHighlighter)); } Editor::QuoteStatus Editor::getQuoteStatus() @@ -2677,8 +2677,8 @@ void Editor::reparse() { if (!highlighter()) return; - if (highlighter()->language() != SynHighlighterLanguage::Cpp - && highlighter()->language() != SynHighlighterLanguage::GLSL) + if (highlighter()->language() != QSynedit::SynHighlighterLanguage::Cpp + && highlighter()->language() != QSynedit::SynHighlighterLanguage::GLSL) return; if (mParser) mParser->setEnabled(pSettings->codeCompletion().enabled()); @@ -2704,7 +2704,7 @@ void Editor::insertString(const QString &value, bool moveCursor) endUpdate(); }); - BufferCoord oldCursorPos = caretXY(); + QSynedit::BufferCoord oldCursorPos = caretXY(); setSelText(value); if (!moveCursor) { setCaretXY(oldCursorPos); @@ -2780,7 +2780,7 @@ void Editor::insertCodeSnippet(const QString &code) newSl.append(s); } - BufferCoord cursorPos = caretXY(); + QSynedit::BufferCoord cursorPos = caretXY(); QString s = linesToText(newSl); // if EndsStr(#13#10,s) then // Delete(s,Length(s)-1,2) @@ -2837,12 +2837,12 @@ void Editor::print() void Editor::exportAsRTF(const QString &rtfFilename) { - SynRTFExporter exporter; + QSynedit::SynRTFExporter exporter; exporter.setTitle(extractFileName(rtfFilename)); exporter.setExportAsText(true); exporter.setUseBackground(pSettings->editor().copyRTFUseBackground()); exporter.setFont(font()); - PSynHighlighter hl = highlighter(); + QSynedit::PSynHighlighter hl = highlighter(); if (!pSettings->editor().copyRTFUseEditorColor()) { hl = highlighterManager.copyHighlighter(highlighter()); highlighterManager.applyColorScheme(hl,pSettings->editor().copyRTFColorScheme()); @@ -2862,12 +2862,12 @@ void Editor::exportAsRTF(const QString &rtfFilename) void Editor::exportAsHTML(const QString &htmlFilename) { - SynHTMLExporter exporter(tabWidth()); + QSynedit::SynHTMLExporter exporter(tabWidth()); exporter.setTitle(extractFileName(htmlFilename)); exporter.setExportAsText(false); exporter.setUseBackground(pSettings->editor().copyHTMLUseBackground()); exporter.setFont(font()); - PSynHighlighter hl = highlighter(); + QSynedit::PSynHighlighter hl = highlighter(); if (!pSettings->editor().copyHTMLUseEditorColor()) { hl = highlighterManager.copyHighlighter(highlighter()); highlighterManager.applyColorScheme(hl,pSettings->editor().copyHTMLColorScheme()); @@ -2904,28 +2904,28 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete) QString word=""; QString s; - PSynHighlighterAttribute attr; + QSynedit::PSynHighlighterAttribute attr; bool tokenFinished; - SynHighlighterTokenType tokenType; - BufferCoord pBeginPos, pEndPos; + QSynedit::SynHighlighterTokenType tokenType; + QSynedit::BufferCoord pBeginPos, pEndPos; if (getHighlighterAttriAtRowCol( - BufferCoord{caretX() - 1, + QSynedit::BufferCoord{caretX() - 1, caretY()}, s, tokenFinished,tokenType, attr)) { - if (tokenType == SynHighlighterTokenType::PreprocessDirective) {//Preprocessor + if (tokenType == QSynedit::SynHighlighterTokenType::PreprocessDirective) {//Preprocessor word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpDirective); if (!word.startsWith('#')) { word = ""; } - } else if (tokenType == SynHighlighterTokenType::Comment) { //Comment, javadoc tag + } else if (tokenType == QSynedit::SynHighlighterTokenType::Comment) { //Comment, javadoc tag word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpJavadoc); if (!word.startsWith('@')) { return; } } else if ( - (tokenType != SynHighlighterTokenType::Symbol) && - (tokenType != SynHighlighterTokenType::Space) && - (tokenType != SynHighlighterTokenType::Keyword) && - (tokenType != SynHighlighterTokenType::Identifier) + (tokenType != QSynedit::SynHighlighterTokenType::Symbol) && + (tokenType != QSynedit::SynHighlighterTokenType::Space) && + (tokenType != QSynedit::SynHighlighterTokenType::Keyword) && + (tokenType != QSynedit::SynHighlighterTokenType::Identifier) ) { return; } @@ -2970,7 +2970,7 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete) QSet keywords; if (highlighter()) { - if (highlighter()->language() != SynHighlighterLanguage::Cpp ) { + if (highlighter()->language() != QSynedit::SynHighlighterLanguage::Cpp ) { keywords = highlighter()->keywords(); } else if (mUseCppSyntax) { foreach (const QString& keyword, CppKeywords.keys()) { @@ -2985,7 +2985,7 @@ void Editor::showCompletion(const QString& preWord,bool autoComplete) //word=getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpCompletion); QString memberOperator; QStringList memberExpression; - BufferCoord pos = caretXY(); + QSynedit::BufferCoord pos = caretXY(); pos.ch--; QStringList ownerExpression = getOwnerExpressionAndMemberAtPositionForCompletion( pos, @@ -3044,7 +3044,7 @@ void Editor::showHeaderCompletion(bool autoComplete, bool forceShow) }); mHeaderCompletionPopup->setParser(mParser); - BufferCoord pBeginPos,pEndPos; + QSynedit::BufferCoord pBeginPos,pEndPos; QString word = getWordAtPosition(this,caretXY(),pBeginPos,pEndPos, WordPurpose::wpHeaderCompletionStart); @@ -3126,8 +3126,8 @@ void Editor::completionInsert(bool appendFunc) QString funcAddOn = ""; // delete the part of the word that's already been typed ... - BufferCoord p = wordEnd(); - BufferCoord pStart = wordStart(); + QSynedit::BufferCoord p = wordEnd(); + QSynedit::BufferCoord pStart = wordStart(); setCaretAndSelection(pStart,pStart,p); // if we are inserting a function, @@ -3205,7 +3205,7 @@ void Editor::headerCompletionInsert() } // delete the part of the word that's already been typed ... - BufferCoord p = caretXY(); + QSynedit::BufferCoord p = caretXY(); int posBegin = p.ch-1; int posEnd = p.ch-1; QString sLine = lineText(); @@ -3245,7 +3245,7 @@ bool Editor::onCompletionKeyPressed(QKeyEvent *event) purpose = WordPurpose::wpJavadoc; } QString phrase; - BufferCoord pBeginPos,pEndPos; + QSynedit::BufferCoord pBeginPos,pEndPos; switch (event->key()) { case Qt::Key_Shift: case Qt::Key_Control: @@ -3255,7 +3255,7 @@ bool Editor::onCompletionKeyPressed(QKeyEvent *event) return true; case Qt::Key_Backspace: ExecuteCommand( - SynEditorCommand::ecDeleteLastChar, + QSynedit::SynEditorCommand::ecDeleteLastChar, QChar(), nullptr); // Simulate backspace in editor if (purpose == WordPurpose::wpCompletion) { phrase = getWordForCompletionSearch(caretXY(), mCompletionPopup->memberOperator()=="::"); @@ -3313,11 +3313,11 @@ bool Editor::onHeaderCompletionKeyPressed(QKeyEvent *event) if (!mHeaderCompletionPopup->isEnabled()) return false; QString phrase; - BufferCoord pBeginPos,pEndPos; + QSynedit::BufferCoord pBeginPos,pEndPos; switch (event->key()) { case Qt::Key_Backspace: ExecuteCommand( - SynEditorCommand::ecDeleteLastChar, + QSynedit::SynEditorCommand::ecDeleteLastChar, QChar(), nullptr); // Simulate backspace in editor phrase = getWordAtPosition(this,caretXY(), pBeginPos,pEndPos, @@ -3379,7 +3379,7 @@ bool Editor::onCompletionInputMethod(QInputMethodEvent *event) return processed; } -Editor::TipType Editor::getTipType(QPoint point, BufferCoord& pos) +Editor::TipType Editor::getTipType(QPoint point, QSynedit::BufferCoord& pos) { // Only allow in the text area... if (pointToCharLine(point, pos)) { @@ -3388,7 +3388,7 @@ Editor::TipType Editor::getTipType(QPoint point, BufferCoord& pos) return TipType::Error; } - PSynHighlighterAttribute attr; + QSynedit::PSynHighlighterAttribute attr; QString s; // Only allow hand tips in highlighted areas @@ -3557,10 +3557,10 @@ void Editor::updateFunctionTip(bool showTip) pMainWindow->functionTip()->hide(); }); const int maxLines=10; - BufferCoord caretPos = caretXY(); + QSynedit::BufferCoord caretPos = caretXY(); int currentLine = caretPos.line-1; int currentChar = caretPos.ch-1; - BufferCoord functionNamePos{-1,-1}; + QSynedit::BufferCoord functionNamePos{-1,-1}; bool foundFunctionStart = false; int parenthesisLevel = 0; int braceLevel = 0; @@ -3588,7 +3588,7 @@ void Editor::updateFunctionTip(bool showTip) while(!highlighter()->eol()) { int start = highlighter()->getTokenPos(); QString token = highlighter()->getToken(); - PSynHighlighterAttribute attr = highlighter()->getTokenAttribute(); + QSynedit::PSynHighlighterAttribute attr = highlighter()->getTokenAttribute(); if (start>=currentChar) break; @@ -3670,7 +3670,7 @@ void Editor::updateFunctionTip(bool showTip) currentParamPos = paramsCount-1; if (!isFunction) return; - BufferCoord pWordBegin, pWordEnd; + QSynedit::BufferCoord pWordBegin, pWordEnd; QString s = getWordAtPosition(this, functionNamePos, pWordBegin,pWordEnd, WordPurpose::wpInformation); @@ -3692,7 +3692,7 @@ void Editor::updateFunctionTip(bool showTip) } if (x >= 0 && hasPreviousWord) { - BufferCoord pos = pWordBegin; + QSynedit::BufferCoord pos = pWordBegin; pos.ch = x+1; QString previousWord = getPreviousWordAtPositionForSuggestion(pos); @@ -3765,7 +3765,7 @@ void Editor::popUserCodeInTabStops() clearUserCodeInTabStops(); return; } - BufferCoord newCursorPos; + QSynedit::BufferCoord newCursorPos; int tabStopEnd; int tabStopBegin; if (mUserCodeInTabStops.count() > 0) { @@ -3797,7 +3797,7 @@ void Editor::popUserCodeInTabStops() } } -void Editor::onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, int column, const QString &token, PSynHighlighterAttribute& attr) +void Editor::onExportedFormatToken(QSynedit::PSynHighlighter syntaxHighlighter, int Line, int column, const QString &token, QSynedit::PSynHighlighterAttribute& attr) { if (!syntaxHighlighter) return; @@ -3808,8 +3808,8 @@ void Editor::onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, return; if (mParser && (attr == syntaxHighlighter->identifierAttribute())) { - BufferCoord p{column,Line}; - BufferCoord pBeginPos,pEndPos; + QSynedit::BufferCoord p{column,Line}; + QSynedit::BufferCoord pBeginPos,pEndPos; QString s= getWordAtPosition(this,p, pBeginPos,pEndPos, WordPurpose::wpInformation); // qDebug()<findStatementOf(mFilename, @@ -3825,7 +3825,7 @@ void Editor::onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, kind = StatementKind::skVariable; } } - SynEditCppHighlighter* cppHighlighter = dynamic_cast(syntaxHighlighter.get()); + QSynedit::SynEditCppHighlighter* cppHighlighter = dynamic_cast(syntaxHighlighter.get()); switch(kind) { case StatementKind::skFunction: case StatementKind::skConstructor: @@ -3924,7 +3924,7 @@ void Editor::setInProject(bool newInProject) connect(mParser.get(), &CppParser::onEndParsing, this, - &SynEdit::invalidate); + &QSynedit::SynEdit::invalidate); } else { invalidate(); } @@ -3934,7 +3934,7 @@ void Editor::setInProject(bool newInProject) } } -void Editor::gotoDeclaration(const BufferCoord &pos) +void Editor::gotoDeclaration(const QSynedit::BufferCoord &pos) { if (!parser()) return; @@ -3972,7 +3972,7 @@ void Editor::gotoDeclaration(const BufferCoord &pos) } } -void Editor::gotoDefinition(const BufferCoord &pos) +void Editor::gotoDefinition(const QSynedit::BufferCoord &pos) { QStringList expression = getExpressionAtPosition(pos); @@ -4001,7 +4001,7 @@ void Editor::gotoDefinition(const BufferCoord &pos) } } -QString getWordAtPosition(SynEdit *editor, const BufferCoord &p, BufferCoord &pWordBegin, BufferCoord &pWordEnd, Editor::WordPurpose purpose) +QString getWordAtPosition(QSynedit::SynEdit *editor, const QSynedit::BufferCoord &p, QSynedit::BufferCoord &pWordBegin, QSynedit::BufferCoord &pWordEnd, Editor::WordPurpose purpose) { QString result = ""; QString s; @@ -4172,8 +4172,8 @@ QString getWordAtPosition(SynEdit *editor, const BufferCoord &p, BufferCoord &pW } else break; } else { - BufferCoord highlightPos; - BufferCoord pDummy; + QSynedit::BufferCoord highlightPos; + QSynedit::BufferCoord pDummy; highlightPos.line = line; highlightPos.ch = i+1; result = getWordAtPosition(editor, highlightPos,pWordBegin,pDummy,purpose)+result; @@ -4213,7 +4213,7 @@ QString getWordAtPosition(SynEdit *editor, const BufferCoord &p, BufferCoord &pW return result; } -QString Editor::getPreviousWordAtPositionForSuggestion(const BufferCoord &p) +QString Editor::getPreviousWordAtPositionForSuggestion(const QSynedit::BufferCoord &p) { QString result; if ((p.line<1) || (p.line>document()->count())) { @@ -4304,15 +4304,15 @@ void Editor::reformat() if (newContent.isEmpty()) return; int oldTopLine = topLine(); - BufferCoord mOldCaret = caretXY(); + QSynedit::BufferCoord mOldCaret = caretXY(); beginUndoBlock(); addLeftTopToUndo(); addCaretToUndo(); - SynEditorOptions oldOptions = getOptions(); - SynEditorOptions newOptions = oldOptions; - newOptions.setFlag(SynEditorOption::eoAutoIndent,false); + QSynedit::SynEditorOptions oldOptions = getOptions(); + QSynedit::SynEditorOptions newOptions = oldOptions; + newOptions.setFlag(QSynedit::SynEditorOption::eoAutoIndent,false); setOptions(newOptions); replaceAll(QString::fromUtf8(newContent)); setCaretXY(mOldCaret); @@ -4331,7 +4331,7 @@ void Editor::checkSyntaxInBack() return; if (!highlighter()) return; - if (highlighter()->language()!=SynHighlighterLanguage::Cpp) + if (highlighter()->language()!=QSynedit::SynHighlighterLanguage::Cpp) return; if(pSettings->editor().syntaxCheck()) pMainWindow->checkSyntaxInBack(this); @@ -4468,27 +4468,27 @@ void Editor::setActiveBreakpointFocus(int Line, bool setFocus) void Editor::applySettings() { - SynEditorOptions options = eoAltSetsColumnMode | - eoDragDropEditing | eoDropFiles | eoKeepCaretX | eoTabsToSpaces | - eoRightMouseMovesCursor | eoScrollByOneLess | eoTabIndent | eoHideShowScrollbars | eoGroupUndo; + QSynedit::SynEditorOptions options = QSynedit::eoAltSetsColumnMode | + QSynedit::eoDragDropEditing | QSynedit::eoDropFiles | QSynedit::eoKeepCaretX | QSynedit::eoTabsToSpaces | + QSynedit::eoRightMouseMovesCursor | QSynedit::eoScrollByOneLess | QSynedit::eoTabIndent | QSynedit::eoHideShowScrollbars | QSynedit::eoGroupUndo; //options - options.setFlag(eoAutoIndent,pSettings->editor().autoIndent()); - options.setFlag(eoTabsToSpaces,pSettings->editor().tabToSpaces()); + options.setFlag(QSynedit::eoAutoIndent,pSettings->editor().autoIndent()); + options.setFlag(QSynedit::eoTabsToSpaces,pSettings->editor().tabToSpaces()); - options.setFlag(eoLigatureSupport, pSettings->editor().enableLigaturesSupport()); + options.setFlag(QSynedit::eoLigatureSupport, pSettings->editor().enableLigaturesSupport()); - options.setFlag(eoKeepCaretX,pSettings->editor().keepCaretX()); - options.setFlag(eoEnhanceHomeKey,pSettings->editor().enhanceHomeKey()); - options.setFlag(eoEnhanceEndKey,pSettings->editor().enhanceEndKey()); + options.setFlag(QSynedit::eoKeepCaretX,pSettings->editor().keepCaretX()); + options.setFlag(QSynedit::eoEnhanceHomeKey,pSettings->editor().enhanceHomeKey()); + options.setFlag(QSynedit::eoEnhanceEndKey,pSettings->editor().enhanceEndKey()); - options.setFlag(eoHideShowScrollbars,pSettings->editor().autoHideScrollbar()); - options.setFlag(eoScrollPastEol,pSettings->editor().scrollPastEol()); - options.setFlag(eoScrollPastEof,pSettings->editor().scrollPastEof()); - options.setFlag(eoScrollByOneLess,pSettings->editor().scrollByOneLess()); - options.setFlag(eoHalfPageScroll,pSettings->editor().halfPageScroll()); - options.setFlag(eoHalfPageScroll,pSettings->editor().halfPageScroll()); - options.setFlag(eoShowRainbowColor, pSettings->editor().rainbowParenthesis()); + options.setFlag(QSynedit::eoHideShowScrollbars,pSettings->editor().autoHideScrollbar()); + options.setFlag(QSynedit::eoScrollPastEol,pSettings->editor().scrollPastEol()); + options.setFlag(QSynedit::eoScrollPastEof,pSettings->editor().scrollPastEof()); + options.setFlag(QSynedit::eoScrollByOneLess,pSettings->editor().scrollByOneLess()); + options.setFlag(QSynedit::eoHalfPageScroll,pSettings->editor().halfPageScroll()); + options.setFlag(QSynedit::eoHalfPageScroll,pSettings->editor().halfPageScroll()); + options.setFlag(QSynedit::eoShowRainbowColor, pSettings->editor().rainbowParenthesis()); setOptions(options); setTabWidth(pSettings->editor().tabWidth()); @@ -4513,7 +4513,7 @@ void Editor::applySettings() // Set gutter properties gutter().setLeftOffset(pointToPixel(pSettings->editor().fontSize()) + pSettings->editor().gutterLeftOffset()); gutter().setRightOffset(pSettings->editor().gutterRightOffset()); - gutter().setBorderStyle(SynGutterBorderStyle::None); + gutter().setBorderStyle(QSynedit::SynGutterBorderStyle::None); gutter().setUseFontStyle(pSettings->editor().gutterUseCustomFont()); if (pSettings->editor().gutterUseCustomFont()) { f=QFont(pSettings->editor().gutterFontName()); @@ -4549,30 +4549,30 @@ void Editor::applySettings() invalidate(); } -static PSynHighlighterAttribute createRainbowAttribute(const QString& attrName, const QString& schemeName, const QString& schemeItemName) { +static QSynedit::PSynHighlighterAttribute createRainbowAttribute(const QString& attrName, const QString& schemeName, const QString& schemeItemName) { PColorSchemeItem item = pColorManager->getItem(schemeName,schemeItemName); if (item) { - PSynHighlighterAttribute attr = std::make_shared(attrName); + QSynedit::PSynHighlighterAttribute attr = std::make_shared(attrName); attr->setForeground(item->foreground()); attr->setBackground(item->background()); return attr; } - return PSynHighlighterAttribute(); + return QSynedit::PSynHighlighterAttribute(); } void Editor::applyColorScheme(const QString& schemeName) { - SynEditorOptions options = getOptions(); - options.setFlag(SynEditorOption::eoShowRainbowColor, pSettings->editor().rainbowParenthesis()); + QSynedit::SynEditorOptions options = getOptions(); + options.setFlag(QSynedit::SynEditorOption::eoShowRainbowColor, pSettings->editor().rainbowParenthesis()); setOptions(options); highlighterManager.applyColorScheme(highlighter(),schemeName); if (pSettings->editor().rainbowParenthesis()) { - PSynHighlighterAttribute attr0 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PSynHighlighterAttribute attr0 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_1); - PSynHighlighterAttribute attr1 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PSynHighlighterAttribute attr1 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_2); - PSynHighlighterAttribute attr2 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PSynHighlighterAttribute attr2 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_3); - PSynHighlighterAttribute attr3 =createRainbowAttribute(SYNS_AttrSymbol, + QSynedit::PSynHighlighterAttribute attr3 =createRainbowAttribute(SYNS_AttrSymbol, schemeName,COLOR_SCHEME_BRACE_4); setRainbowAttrs(attr0,attr1,attr2,attr3); } diff --git a/RedPandaIDE/editor.h b/RedPandaIDE/editor.h index 1137130f..6747a631 100644 --- a/RedPandaIDE/editor.h +++ b/RedPandaIDE/editor.h @@ -53,7 +53,7 @@ private: QByteArray mReasonBuffer; }; -class Editor : public SynEdit +class Editor : public QSynedit::SynEdit { Q_OBJECT public: @@ -180,7 +180,7 @@ public: bool hasPrevSyntaxIssue() const; bool hasNextSyntaxIssue() const; PSyntaxIssueList getSyntaxIssuesAtLine(int line); - PSyntaxIssue getSyntaxIssueAtPosition(const BufferCoord& pos); + PSyntaxIssue getSyntaxIssueAtPosition(const QSynedit::BufferCoord& pos); int gutterClickedLine() const; void toggleBreakpoint(int line); void clearBreakpoints(); @@ -192,11 +192,11 @@ public: void removeBreakpointFocus(); void modifyBreakpointProperty(int line); void setActiveBreakpointFocus(int Line, bool setFocus=true); - QString getPreviousWordAtPositionForSuggestion(const BufferCoord& p); + QString getPreviousWordAtPositionForSuggestion(const QSynedit::BufferCoord& p); void reformat(); void checkSyntaxInBack(); - void gotoDeclaration(const BufferCoord& pos); - void gotoDefinition(const BufferCoord& pos); + void gotoDeclaration(const QSynedit::BufferCoord& pos); + void gotoDefinition(const QSynedit::BufferCoord& pos); void reparse(); void reparseTodo(); void insertString(const QString& value, bool moveCursor); @@ -216,12 +216,12 @@ public: void deleteToBOL(); QStringList getOwnerExpressionAndMemberAtPositionForCompletion( - const BufferCoord& pos, + const QSynedit::BufferCoord& pos, QString& memberOperator, QStringList& memberExpression); - QString getWordForCompletionSearch(const BufferCoord& pos,bool permitTilde); + QString getWordForCompletionSearch(const QSynedit::BufferCoord& pos,bool permitTilde); QStringList getExpressionAtPosition( - const BufferCoord& pos); + const QSynedit::BufferCoord& pos); const PCppParser &parser(); @@ -230,7 +230,7 @@ signals: void renamed(const QString& oldName, const QString& newName, bool firstSave); void fileSaved(const QString& filename, bool inProject); private slots: - void onStatusChanged(SynStatusChanges changes); + void onStatusChanged(QSynedit::SynStatusChanges changes); void onGutterClicked(Qt::MouseButton button, int x, int y, int line); void onTipEvalValueReady(const QString& value); void onLinesDeleted(int first,int count); @@ -272,7 +272,7 @@ private: bool onHeaderCompletionKeyPressed(QKeyEvent* event); bool onCompletionInputMethod(QInputMethodEvent *event); - TipType getTipType(QPoint point, BufferCoord& pos); + TipType getTipType(QPoint point, QSynedit::BufferCoord& pos); void cancelHint(); QString getFileHint(const QString& s); QString getParserHint(const QStringList& expression,const QString& s, int line); @@ -284,8 +284,8 @@ private: void updateFunctionTip(bool showTip); void clearUserCodeInTabStops(); void popUserCodeInTabStops(); - void onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token, - PSynHighlighterAttribute &attr); + void onExportedFormatToken(QSynedit::PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token, + QSynedit::PSynHighlighterAttribute &attr); void onScrollBarValueChanged(); private: QByteArray mEncodingOption; // the encoding type set by the user @@ -331,8 +331,8 @@ private: QString mLineBeforeTabStop; QString mLineAfterTabStop; QList mUserCodeInTabStops; - BufferCoord mHighlightCharPos1; - BufferCoord mHighlightCharPos2; + QSynedit::BufferCoord mHighlightCharPos1; + QSynedit::BufferCoord mHighlightCharPos2; std::shared_ptr > > mStatementColors; QTimer mFunctionTipTimer; int mHoverModifiedLine; @@ -347,7 +347,7 @@ protected: // SynEdit interface protected: void onGutterPaint(QPainter &painter, int aLine, int X, int Y) override; - void onGetEditingAreas(int Line, SynEditingAreaList &areaList) override; + void onGetEditingAreas(int Line, QSynedit::SynEditingAreaList &areaList) override; // SynEdit interface protected: @@ -355,7 +355,7 @@ protected: // SynEdit interface protected: - void onPreparePaintHighlightToken(int line, int aChar, const QString &token, PSynHighlighterAttribute attr, SynFontStyles &style, QColor &foreground, QColor &background) override; + void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PSynHighlighterAttribute attr, QSynedit::SynFontStyles &style, QColor &foreground, QColor &background) override; // QObject interface public: @@ -391,10 +391,10 @@ protected: void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; }; -QString getWordAtPosition(SynEdit* editor, - const BufferCoord& p, - BufferCoord& pWordBegin, - BufferCoord& pWordEnd, +QString getWordAtPosition(QSynedit::SynEdit* editor, + const QSynedit::BufferCoord& p, + QSynedit::BufferCoord& pWordBegin, + QSynedit::BufferCoord& pWordEnd, Editor::WordPurpose purpose); diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index cd14066f..6cc4ceda 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -2225,7 +2225,7 @@ void MainWindow::loadLastOpens() // } if (!editor) continue; - BufferCoord pos; + QSynedit::BufferCoord pos; pos.ch = lastOpenIni.GetLongValue(sectionName,"CursorCol", 1); pos.line = lastOpenIni.GetLongValue(sectionName,"CursorRow", 1); editor->setCaretXY(pos); @@ -4027,7 +4027,7 @@ void MainWindow::onEditorContextMenu(const QPoint& pos) if (!editor) return; QMenu menu(this); - BufferCoord p; + QSynedit::BufferCoord p; mEditorContextMenuPos = pos; int line; if (editor->getPositionOfMouse(p)) { @@ -5638,7 +5638,7 @@ void MainWindow::on_actionGoto_Definition_triggered() void MainWindow::on_actionFind_references_triggered() { Editor * editor = mEditorList->getEditor(); - BufferCoord pos; + QSynedit::BufferCoord pos; if (editor && editor->pointToCharLine(mEditorContextMenuPos,pos)) { CppRefacter refactor; refactor.findOccurence(editor,pos); @@ -6489,7 +6489,7 @@ void MainWindow::on_actionRename_Symbol_triggered() if (!editor->parser()) return; editor->beginUpdate(); - BufferCoord oldCaretXY = editor->caretXY(); + QSynedit::BufferCoord oldCaretXY = editor->caretXY(); // mClassBrowserModel.beginUpdate(); QCursor oldCursor = editor->cursor(); editor->setCursor(Qt::CursorShape::WaitCursor); @@ -6501,7 +6501,7 @@ void MainWindow::on_actionRename_Symbol_triggered() QStringList expression = editor->getExpressionAtPosition(oldCaretXY); if (expression.isEmpty() && oldCaretXY.ch>1) { - BufferCoord coord=oldCaretXY; + QSynedit::BufferCoord coord=oldCaretXY; coord.ch--; expression = editor->getExpressionAtPosition(coord); } @@ -6723,7 +6723,7 @@ void MainWindow::on_btnReplace_clicked() line.insert(item->start-1, newWord); contents[item->line-1] = line; } - BufferCoord coord=editor->caretXY(); + QSynedit::BufferCoord coord=editor->caretXY(); int topLine = editor->topLine(); int leftChar = editor->leftChar(); editor->replaceAll(contents.join(editor->lineBreak())); diff --git a/RedPandaIDE/parser/cppparser.cpp b/RedPandaIDE/parser/cppparser.cpp index 0e0b3ea0..d29055ab 100644 --- a/RedPandaIDE/parser/cppparser.cpp +++ b/RedPandaIDE/parser/cppparser.cpp @@ -4138,7 +4138,7 @@ PStatement CppParser::doParseEvalTypeInfo( QString s = type; // qDebug()<<"eval type info"< #include +namespace QSynedit { struct SynEditFoldRegion; typedef std::shared_ptr PSynEditFoldRegion; @@ -94,4 +95,5 @@ public: int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine); }; +} #endif // CODEFOLDING_H diff --git a/RedPandaIDE/qsynedit/Constants.cpp b/RedPandaIDE/qsynedit/Constants.cpp index 7364f1e9..a4422a33 100644 --- a/RedPandaIDE/qsynedit/Constants.cpp +++ b/RedPandaIDE/qsynedit/Constants.cpp @@ -15,6 +15,8 @@ * along with this program. If not, see . */ #include "Constants.h" + +namespace QSynedit { const QSet SynWordBreakChars{'.', ',', ';', ':', '"', '\'', '!', '?', '[', ']', '(', ')', '{', '}', '^', '-', '=', '+', '-', '*', '/', '\\', '|'}; @@ -23,3 +25,4 @@ const QChar SynTabGlyph(0x2192); const QChar SynSpaceGlyph('.'); const QChar SynLineBreakGlyph(0x2193); const QChar SynSoftBreakGlyph(0x2193); +} diff --git a/RedPandaIDE/qsynedit/Constants.h b/RedPandaIDE/qsynedit/Constants.h index c954942b..1d95c420 100644 --- a/RedPandaIDE/qsynedit/Constants.h +++ b/RedPandaIDE/qsynedit/Constants.h @@ -19,6 +19,8 @@ #include #include +namespace QSynedit { + extern const QSet SynWordBreakChars; extern const QChar SynTabChar; extern const QChar SynSpaceGlyph; @@ -183,4 +185,8 @@ extern const QChar SynSoftBreakGlyph; #define SYN_HIGHLIGHTER_CPP "SynCppHighlighter" #define SYN_HIGHLIGHTER_ASM "SynASMHighlighter" +#define SYN_HIGHLIGHTER_GLSL "SynGLSLHighlighter" + +} + #endif // CONSTANTS_H diff --git a/RedPandaIDE/qsynedit/KeyStrokes.cpp b/RedPandaIDE/qsynedit/KeyStrokes.cpp index 4996cf38..93ce86a7 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.cpp +++ b/RedPandaIDE/qsynedit/KeyStrokes.cpp @@ -16,6 +16,7 @@ */ #include "KeyStrokes.h" +namespace QSynedit { SynEditKeyStroke::SynEditKeyStroke() { mKey = 0; @@ -274,3 +275,5 @@ void SynEditKeyStrokes::setExtraKeyStrokes() add(SynEditorCommand::ecUndo, Qt::Key_Z, Qt::ControlModifier); add(SynEditorCommand::ecRedo, Qt::Key_Y, Qt::ControlModifier); } + +} diff --git a/RedPandaIDE/qsynedit/KeyStrokes.h b/RedPandaIDE/qsynedit/KeyStrokes.h index a7157e46..65a9370d 100644 --- a/RedPandaIDE/qsynedit/KeyStrokes.h +++ b/RedPandaIDE/qsynedit/KeyStrokes.h @@ -21,6 +21,8 @@ #include #include #include + +namespace QSynedit { //**************************************************************************** // NOTE! If you add an editor command, you must also update the // EditorCommandStrs constant array in implementation section below, or the @@ -225,4 +227,6 @@ private: SynEditKeyStrokeList mList; }; +} + #endif // SYNEDITKEYSTROKE_H diff --git a/RedPandaIDE/qsynedit/MiscClasses.cpp b/RedPandaIDE/qsynedit/MiscClasses.cpp index 87b89512..176b86c6 100644 --- a/RedPandaIDE/qsynedit/MiscClasses.cpp +++ b/RedPandaIDE/qsynedit/MiscClasses.cpp @@ -16,7 +16,7 @@ */ #include "MiscClasses.h" #include "algorithm" - +namespace QSynedit { SynGutter::SynGutter(QObject *parent): QObject(parent) { @@ -333,3 +333,5 @@ void SynGutter::setBorderColor(const QColor &value) setChanged(); } } + +} diff --git a/RedPandaIDE/qsynedit/MiscClasses.h b/RedPandaIDE/qsynedit/MiscClasses.h index c2341de9..cbf3019c 100644 --- a/RedPandaIDE/qsynedit/MiscClasses.h +++ b/RedPandaIDE/qsynedit/MiscClasses.h @@ -22,6 +22,8 @@ #include #include "Types.h" +namespace QSynedit { + enum class SynGutterBorderStyle { None, Middle, @@ -124,4 +126,6 @@ private: using PSynGutter = std::shared_ptr; +} + #endif // MISCCLASSES_H diff --git a/RedPandaIDE/qsynedit/MiscProcs.cpp b/RedPandaIDE/qsynedit/MiscProcs.cpp index c6d4d3d4..0d37a50b 100644 --- a/RedPandaIDE/qsynedit/MiscProcs.cpp +++ b/RedPandaIDE/qsynedit/MiscProcs.cpp @@ -20,6 +20,7 @@ #include #include +namespace QSynedit { int minMax(int x, int mi, int ma) { x = std::min(x, ma ); @@ -226,3 +227,5 @@ int calSpanLines(const BufferCoord &startPos, const BufferCoord &endPos) { return std::abs(endPos.line - startPos.line+1); } + +} diff --git a/RedPandaIDE/qsynedit/MiscProcs.h b/RedPandaIDE/qsynedit/MiscProcs.h index de4190c2..ddd84743 100644 --- a/RedPandaIDE/qsynedit/MiscProcs.h +++ b/RedPandaIDE/qsynedit/MiscProcs.h @@ -33,6 +33,8 @@ class QPainter; class QRect; class QColor; +namespace QSynedit { + int minMax(int x, int mi, int ma); int mulDiv(int a, int b, int c); BufferCoord maxBufferCoord(const BufferCoord& P1, const BufferCoord& P2); @@ -89,4 +91,6 @@ void ensureNotAfter(BufferCoord& cord1, BufferCoord& cord2); bool isWordChar(const QChar& ch); +} + #endif // MISCPROCS_H diff --git a/RedPandaIDE/qsynedit/Search.cpp b/RedPandaIDE/qsynedit/Search.cpp index 1e036ad9..31a492a0 100644 --- a/RedPandaIDE/qsynedit/Search.cpp +++ b/RedPandaIDE/qsynedit/Search.cpp @@ -16,6 +16,8 @@ */ #include "Search.h" +namespace QSynedit { + SynSearch::SynSearch(QObject *parent):SynSearchBase(parent) { @@ -81,3 +83,4 @@ bool SynSearch::isDelimitChar(QChar ch) { return !(ch == '_' || ch.isLetterOrNumber()); } +} diff --git a/RedPandaIDE/qsynedit/Search.h b/RedPandaIDE/qsynedit/Search.h index 6ea9f340..b40c67f0 100644 --- a/RedPandaIDE/qsynedit/Search.h +++ b/RedPandaIDE/qsynedit/Search.h @@ -18,6 +18,7 @@ #define SYNSEARCH_H #include "SearchBase.h" +namespace QSynedit { class SynSearch : public SynSearchBase { @@ -37,5 +38,6 @@ private: private: QList mResults; }; +} #endif // SYNSEARCH_H diff --git a/RedPandaIDE/qsynedit/SearchBase.cpp b/RedPandaIDE/qsynedit/SearchBase.cpp index 98b39bc0..9255eaef 100644 --- a/RedPandaIDE/qsynedit/SearchBase.cpp +++ b/RedPandaIDE/qsynedit/SearchBase.cpp @@ -16,6 +16,7 @@ */ #include "SearchBase.h" +namespace QSynedit { SynSearchBase::SynSearchBase(QObject *parent) : QObject(parent) { @@ -40,3 +41,4 @@ void SynSearchBase::setOptions(const SynSearchOptions &options) { mOptions = options; } +} diff --git a/RedPandaIDE/qsynedit/SearchBase.h b/RedPandaIDE/qsynedit/SearchBase.h index e8d5e140..0d5dac92 100644 --- a/RedPandaIDE/qsynedit/SearchBase.h +++ b/RedPandaIDE/qsynedit/SearchBase.h @@ -20,6 +20,8 @@ #include #include +namespace QSynedit { + enum SynSearchOption { ssoMatchCase = 0x0001, ssoWholeWord = 0x0002, @@ -55,4 +57,6 @@ private: using PSynSearchBase = std::shared_ptr; +} + #endif // SYNSEARCHBASE_H diff --git a/RedPandaIDE/qsynedit/SearchRegex.cpp b/RedPandaIDE/qsynedit/SearchRegex.cpp index f92b809c..48bdfbda 100644 --- a/RedPandaIDE/qsynedit/SearchRegex.cpp +++ b/RedPandaIDE/qsynedit/SearchRegex.cpp @@ -18,6 +18,8 @@ #include +namespace QSynedit { + SynSearchRegex::SynSearchRegex(QObject* parent):SynSearchBase(parent) { @@ -88,3 +90,5 @@ void SynSearchRegex::updateRegexOptions() QRegularExpression::CaseInsensitiveOption); } } + +} diff --git a/RedPandaIDE/qsynedit/SearchRegex.h b/RedPandaIDE/qsynedit/SearchRegex.h index a6f44f22..8b1da602 100644 --- a/RedPandaIDE/qsynedit/SearchRegex.h +++ b/RedPandaIDE/qsynedit/SearchRegex.h @@ -20,6 +20,7 @@ #include +namespace QSynedit { class SynSearchRegex : public SynSearchBase { Q_OBJECT @@ -43,4 +44,6 @@ private: QList mResults; }; +} + #endif // SYNSEARCHREGEX_H diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index d5340a39..307b2282 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -41,6 +41,7 @@ #include #include +namespace QSynedit { SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent), mDropped(false) { @@ -6958,3 +6959,4 @@ void SynEdit::onDraggingScrollTimeout() computeScroll(true); //doMouseScroll(true); } +} diff --git a/RedPandaIDE/qsynedit/SynEdit.h b/RedPandaIDE/qsynedit/SynEdit.h index 7aedd4fe..4019e453 100644 --- a/RedPandaIDE/qsynedit/SynEdit.h +++ b/RedPandaIDE/qsynedit/SynEdit.h @@ -31,6 +31,8 @@ #include "KeyStrokes.h" #include "SearchBase.h" +namespace QSynedit { + enum class SynFontSmoothMethod { None, AntiAlias, ClearType }; @@ -801,4 +803,5 @@ protected: void dragLeaveEvent(QDragLeaveEvent *event) override; }; +} #endif // SYNEDIT_H diff --git a/RedPandaIDE/qsynedit/TextBuffer.cpp b/RedPandaIDE/qsynedit/TextBuffer.cpp index 6689f24f..c68aaad6 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.cpp +++ b/RedPandaIDE/qsynedit/TextBuffer.cpp @@ -27,6 +27,8 @@ #include #include +namespace QSynedit { + SynDocument::SynDocument(const QFont& font, const QFont& nonAsciiFont, QObject *parent): QObject(parent), mFontMetrics(font), @@ -1158,3 +1160,5 @@ int SynEditRedoList::itemCount() { return mItems.count(); } + +} diff --git a/RedPandaIDE/qsynedit/TextBuffer.h b/RedPandaIDE/qsynedit/TextBuffer.h index 233c5057..b0ff50c2 100644 --- a/RedPandaIDE/qsynedit/TextBuffer.h +++ b/RedPandaIDE/qsynedit/TextBuffer.h @@ -23,10 +23,12 @@ #include #include #include +#include #include "MiscProcs.h" #include "../utils.h" #include "Types.h" +namespace QSynedit { enum SynEditStringFlag { sfHasTabs = 0x0001, sfHasNoTabs = 0x0002, @@ -54,8 +56,6 @@ class SynDocument; typedef std::shared_ptr PSynDocument; -class QFile; - class SynDocument : public QObject { Q_OBJECT @@ -279,4 +279,6 @@ protected: using PSynEditUndoList = std::shared_ptr; using PSynEditRedoList = std::shared_ptr; +} + #endif // SYNEDITSTRINGLIST_H diff --git a/RedPandaIDE/qsynedit/TextPainter.cpp b/RedPandaIDE/qsynedit/TextPainter.cpp index 9a118c27..72ab4fab 100644 --- a/RedPandaIDE/qsynedit/TextPainter.cpp +++ b/RedPandaIDE/qsynedit/TextPainter.cpp @@ -20,6 +20,8 @@ #include #include +namespace QSynedit { + SynEditTextPainter::SynEditTextPainter(SynEdit *edit, QPainter *painter, int FirstRow, int LastRow, int FirstCol, int LastCol) { this->edit = edit; @@ -1093,3 +1095,4 @@ void SynEditTextPainter::paintLines() bCurrentLine = false; } } +} diff --git a/RedPandaIDE/qsynedit/TextPainter.h b/RedPandaIDE/qsynedit/TextPainter.h index e983f8d5..785e4c0e 100644 --- a/RedPandaIDE/qsynedit/TextPainter.h +++ b/RedPandaIDE/qsynedit/TextPainter.h @@ -25,6 +25,7 @@ #include "../utils.h" #include "MiscClasses.h" +namespace QSynedit { class SynEdit; class SynEditTextPainter { @@ -87,4 +88,6 @@ private: SynTokenAccu TokenAccu; }; +} + #endif // TEXTPAINTER_H diff --git a/RedPandaIDE/qsynedit/Types.cpp b/RedPandaIDE/qsynedit/Types.cpp index dc80c0f8..0458c285 100644 --- a/RedPandaIDE/qsynedit/Types.cpp +++ b/RedPandaIDE/qsynedit/Types.cpp @@ -18,6 +18,8 @@ #include "SynEdit.h" #include +namespace QSynedit { + bool BufferCoord::operator==(const BufferCoord &coord) { return coord.ch == ch && coord.line == line; @@ -51,3 +53,5 @@ bool BufferCoord::operator!=(const BufferCoord &coord) { return coord.ch != ch || coord.line != line; } + +} diff --git a/RedPandaIDE/qsynedit/Types.h b/RedPandaIDE/qsynedit/Types.h index 424707d0..dace15fa 100644 --- a/RedPandaIDE/qsynedit/Types.h +++ b/RedPandaIDE/qsynedit/Types.h @@ -22,6 +22,8 @@ #include #include +namespace QSynedit { + enum class SynSelectionMode {Normal, Line, Column}; struct BufferCoord { @@ -70,5 +72,6 @@ using PSynEditingArea = std::shared_ptr; using SynEditingAreaList = QList; using PSynEditingAreaList = std::shared_ptr; +} #endif // TYPES_H diff --git a/RedPandaIDE/qsynedit/exporter/synexporter.cpp b/RedPandaIDE/qsynedit/exporter/synexporter.cpp index 90ce6d32..1d9f2fe1 100644 --- a/RedPandaIDE/qsynedit/exporter/synexporter.cpp +++ b/RedPandaIDE/qsynedit/exporter/synexporter.cpp @@ -23,6 +23,8 @@ #include #include "../../platform.h" +namespace QSynedit { + SynExporter::SynExporter() { mClipboardFormat = "text/plain"; @@ -398,3 +400,5 @@ QString SynExporter::lineBreak() } return "\n"; } + +} diff --git a/RedPandaIDE/qsynedit/exporter/synexporter.h b/RedPandaIDE/qsynedit/exporter/synexporter.h index f16e39db..b6df7bc9 100644 --- a/RedPandaIDE/qsynedit/exporter/synexporter.h +++ b/RedPandaIDE/qsynedit/exporter/synexporter.h @@ -20,8 +20,7 @@ #include #include "../SynEdit.h" - - +namespace QSynedit { using FormatTokenHandler = std::function; class SynExporter @@ -246,5 +245,6 @@ private: FormatTokenHandler mOnFormatToken; }; +} #endif // SYNEXPORTER_H diff --git a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.cpp b/RedPandaIDE/qsynedit/exporter/synhtmlexporter.cpp index 85fab021..f7702feb 100644 --- a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.cpp +++ b/RedPandaIDE/qsynedit/exporter/synhtmlexporter.cpp @@ -18,6 +18,8 @@ #include "../MiscProcs.h" #include +namespace QSynedit { + SynHTMLExporter::SynHTMLExporter(int tabSize) { mClipboardFormat = "text/html"; @@ -224,3 +226,4 @@ void SynHTMLExporter::SetTokenAttribute(PSynHighlighterAttribute Attri) mLastAttri = Attri; SynExporter::SetTokenAttribute(Attri); } +} diff --git a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.h b/RedPandaIDE/qsynedit/exporter/synhtmlexporter.h index 49a0a133..1c889cac 100644 --- a/RedPandaIDE/qsynedit/exporter/synhtmlexporter.h +++ b/RedPandaIDE/qsynedit/exporter/synhtmlexporter.h @@ -19,6 +19,7 @@ #include "synexporter.h" +namespace QSynedit { class SynHTMLExporter : public SynExporter { public: @@ -52,5 +53,5 @@ protected: QString GetHeader(); void SetTokenAttribute(PSynHighlighterAttribute Attri); }; - +} #endif // SYNHTMLEXPORTER_H diff --git a/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp b/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp index 0d28dcbc..c976940b 100644 --- a/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp +++ b/RedPandaIDE/qsynedit/exporter/synrtfexporter.cpp @@ -15,6 +15,7 @@ * along with this program. If not, see . */ #include "synrtfexporter.h" +namespace QSynedit { SynRTFExporter::SynRTFExporter():SynExporter() { @@ -164,3 +165,4 @@ QString SynRTFExporter::GetHeader() .arg(GetColorIndex(mBackgroundColor)); return Result; } +} diff --git a/RedPandaIDE/qsynedit/exporter/synrtfexporter.h b/RedPandaIDE/qsynedit/exporter/synrtfexporter.h index 5f682fba..a314d60f 100644 --- a/RedPandaIDE/qsynedit/exporter/synrtfexporter.h +++ b/RedPandaIDE/qsynedit/exporter/synrtfexporter.h @@ -19,6 +19,8 @@ #include "synexporter.h" +namespace QSynedit { + class SynRTFExporter : public SynExporter { public: @@ -42,4 +44,5 @@ protected: QString GetHeader() override; }; +} #endif // SYNRTFEXPORTER_H diff --git a/RedPandaIDE/qsynedit/highlighter/asm.cpp b/RedPandaIDE/qsynedit/highlighter/asm.cpp index 30264ed6..57e05acd 100644 --- a/RedPandaIDE/qsynedit/highlighter/asm.cpp +++ b/RedPandaIDE/qsynedit/highlighter/asm.cpp @@ -17,6 +17,8 @@ #include "asm.h" #include "../Constants.h" +namespace QSynedit { + const QSet SynEditASMHighlighter::Keywords { "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", @@ -406,3 +408,4 @@ QSet SynEditASMHighlighter::keywords() const { return Keywords; } +} diff --git a/RedPandaIDE/qsynedit/highlighter/asm.h b/RedPandaIDE/qsynedit/highlighter/asm.h index ad4879e4..3446469d 100644 --- a/RedPandaIDE/qsynedit/highlighter/asm.h +++ b/RedPandaIDE/qsynedit/highlighter/asm.h @@ -19,6 +19,7 @@ #include "base.h" +namespace QSynedit { class SynEditASMHighlighter : public SynHighlighter { @@ -99,4 +100,6 @@ public: QSet keywords() const override; }; +} + #endif // SYNEDITASMHIGHLIGHTER_H diff --git a/RedPandaIDE/qsynedit/highlighter/base.cpp b/RedPandaIDE/qsynedit/highlighter/base.cpp index beffc84e..f6362df7 100644 --- a/RedPandaIDE/qsynedit/highlighter/base.cpp +++ b/RedPandaIDE/qsynedit/highlighter/base.cpp @@ -17,6 +17,7 @@ #include "base.h" #include "../Constants.h" +namespace QSynedit { SynHighlighter::SynHighlighter() : mEnabled(true), mWordBreakChars{ SynWordBreakChars } @@ -260,3 +261,4 @@ SynRangeState::SynRangeState(): firstIndentThisLine(0) { } +} diff --git a/RedPandaIDE/qsynedit/highlighter/base.h b/RedPandaIDE/qsynedit/highlighter/base.h index c4854620..9521ca3e 100644 --- a/RedPandaIDE/qsynedit/highlighter/base.h +++ b/RedPandaIDE/qsynedit/highlighter/base.h @@ -26,6 +26,7 @@ #include #include "../Types.h" +namespace QSynedit { enum SynIndentType { sitBrace = 0, sitParenthesis = 1, @@ -174,4 +175,5 @@ private: using PSynHighlighter = std::shared_ptr; using SynHighlighterList = QVector; +} #endif // SYNHIGHLIGTERBASE_H diff --git a/RedPandaIDE/qsynedit/highlighter/composition.cpp b/RedPandaIDE/qsynedit/highlighter/composition.cpp index 05f04635..6f5c712f 100644 --- a/RedPandaIDE/qsynedit/highlighter/composition.cpp +++ b/RedPandaIDE/qsynedit/highlighter/composition.cpp @@ -17,6 +17,8 @@ #include "composition.h" #include "../Constants.h" +namespace QSynedit { + SynHighlightComposition::SynHighlightComposition() { @@ -107,3 +109,5 @@ QString SynScheme::ConvertExpression(const QString &Value) void SynScheme::MarkerAttriChanged() { } + +} diff --git a/RedPandaIDE/qsynedit/highlighter/composition.h b/RedPandaIDE/qsynedit/highlighter/composition.h index a107c096..494d7617 100644 --- a/RedPandaIDE/qsynedit/highlighter/composition.h +++ b/RedPandaIDE/qsynedit/highlighter/composition.h @@ -20,6 +20,7 @@ #include #include +namespace QSynedit { class SynSchema; using PSynSchema = std::shared_ptr; @@ -74,4 +75,5 @@ public: QString getName() const override; }; +} #endif // SYNHIGHLIGHTCOMPOSITION_H diff --git a/RedPandaIDE/qsynedit/highlighter/cpp.cpp b/RedPandaIDE/qsynedit/highlighter/cpp.cpp index f060865f..d319c58e 100644 --- a/RedPandaIDE/qsynedit/highlighter/cpp.cpp +++ b/RedPandaIDE/qsynedit/highlighter/cpp.cpp @@ -19,6 +19,8 @@ #include +namespace QSynedit { + static const QSet CppStatementKeyWords { "if", "for", @@ -1692,3 +1694,5 @@ QString SynEditCppHighlighter::foldString() { return "...}"; } + +} diff --git a/RedPandaIDE/qsynedit/highlighter/cpp.h b/RedPandaIDE/qsynedit/highlighter/cpp.h index 9b1c2e25..03c51c20 100644 --- a/RedPandaIDE/qsynedit/highlighter/cpp.h +++ b/RedPandaIDE/qsynedit/highlighter/cpp.h @@ -19,6 +19,8 @@ #include "base.h" #include +namespace QSynedit { + class SynEditCppHighlighter: public SynHighlighter { enum TokenKind { @@ -219,4 +221,6 @@ public: QString foldString() override; }; +} + #endif // SYNEDITCPPHIGHLIGHTER_H diff --git a/RedPandaIDE/qsynedit/highlighter/glsl.cpp b/RedPandaIDE/qsynedit/highlighter/glsl.cpp index 42c5dc5c..ec171443 100644 --- a/RedPandaIDE/qsynedit/highlighter/glsl.cpp +++ b/RedPandaIDE/qsynedit/highlighter/glsl.cpp @@ -19,6 +19,7 @@ #include +namespace QSynedit { static const QSet GLSLStatementKeyWords { "if", "for", @@ -1560,7 +1561,7 @@ SynHighlighterClass SynEditGLSLHighlighter::getClass() const QString SynEditGLSLHighlighter::getName() const { - return SYN_HIGHLIGHTER_CPP; + return SYN_HIGHLIGHTER_GLSL; } QString SynEditGLSLHighlighter::languageName() @@ -1587,3 +1588,4 @@ QSet SynEditGLSLHighlighter::keywords() const { return Keywords; } +} diff --git a/RedPandaIDE/qsynedit/highlighter/glsl.h b/RedPandaIDE/qsynedit/highlighter/glsl.h index 772ad9fc..7394efee 100644 --- a/RedPandaIDE/qsynedit/highlighter/glsl.h +++ b/RedPandaIDE/qsynedit/highlighter/glsl.h @@ -19,6 +19,8 @@ #include "base.h" #include +namespace QSynedit { + class SynEditGLSLHighlighter: public SynHighlighter { enum TokenKind { @@ -212,4 +214,5 @@ public: QSet keywords() const override; }; +} #endif // SYNEDITGLSLHIGHLIGHTER_H diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index 87890a9f..4c9df72f 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1255,8 +1255,8 @@ void Settings::Editor::doLoad() mEnhanceHomeKey = boolValue("enhance_home_key", true); mEnhanceEndKey = boolValue("enhance_end_key",true); mKeepCaretX = boolValue("keep_caret_x",true); - mCaretForInsert = static_cast( intValue("caret_for_insert",static_cast(SynEditCaretType::ctVerticalLine))); - mCaretForOverwrite = static_cast( intValue("caret_for_overwrite",static_cast(SynEditCaretType::ctBlock))); + mCaretForInsert = static_cast( intValue("caret_for_insert",static_cast(QSynedit::SynEditCaretType::ctVerticalLine))); + mCaretForOverwrite = static_cast( intValue("caret_for_overwrite",static_cast(QSynedit::SynEditCaretType::ctBlock))); mCaretUseTextColor = boolValue("caret_use_text_color",true); mCaretColor = colorValue("caret_color",Qt::yellow); @@ -1382,22 +1382,22 @@ void Settings::Editor::doLoad() mShowFunctionTips = boolValue("show_function_tips",true); } -SynEditCaretType Settings::Editor::caretForOverwrite() const +QSynedit::SynEditCaretType Settings::Editor::caretForOverwrite() const { return mCaretForOverwrite; } -void Settings::Editor::setCaretForOverwrite(const SynEditCaretType &caretForOverwrite) +void Settings::Editor::setCaretForOverwrite(const QSynedit::SynEditCaretType &caretForOverwrite) { mCaretForOverwrite = caretForOverwrite; } -SynEditCaretType Settings::Editor::caretForInsert() const +QSynedit::SynEditCaretType Settings::Editor::caretForInsert() const { return mCaretForInsert; } -void Settings::Editor::setCaretForInsert(const SynEditCaretType &caretForInsert) +void Settings::Editor::setCaretForInsert(const QSynedit::SynEditCaretType &caretForInsert) { mCaretForInsert = caretForInsert; } diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index be9216bf..e5f4d6e1 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -142,11 +142,11 @@ public: bool enhanceEndKey() const; void setEnhanceEndKey(bool enhanceEndKey); - SynEditCaretType caretForInsert() const; - void setCaretForInsert(const SynEditCaretType &caretForInsert); + QSynedit::SynEditCaretType caretForInsert() const; + void setCaretForInsert(const QSynedit::SynEditCaretType &caretForInsert); - SynEditCaretType caretForOverwrite() const; - void setCaretForOverwrite(const SynEditCaretType &caretForOverwrite); + QSynedit::SynEditCaretType caretForOverwrite() const; + void setCaretForOverwrite(const QSynedit::SynEditCaretType &caretForOverwrite); QColor caretColor() const; void setCaretColor(const QColor &caretColor); @@ -379,8 +379,8 @@ public: bool mEnhanceHomeKey; bool mEnhanceEndKey; bool mKeepCaretX; - SynEditCaretType mCaretForInsert; - SynEditCaretType mCaretForOverwrite; + QSynedit::SynEditCaretType mCaretForInsert; + QSynedit::SynEditCaretType mCaretForOverwrite; bool mCaretUseTextColor; QColor mCaretColor; diff --git a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp index 1ac0d057..89cf95ed 100644 --- a/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp +++ b/RedPandaIDE/settingsdialog/editorgeneralwidget.cpp @@ -40,15 +40,15 @@ EditorGeneralWidget::~EditorGeneralWidget() delete ui; } -static void setCaretTypeIndex(QComboBox* combo, SynEditCaretType caretType) { +static void setCaretTypeIndex(QComboBox* combo, QSynedit::SynEditCaretType caretType) { int t = static_cast(caretType); combo->setCurrentIndex(t); } -static SynEditCaretType getCaretTypeIndex(QComboBox* combo) { +static QSynedit::SynEditCaretType getCaretTypeIndex(QComboBox* combo) { if (combo->currentIndex()<0) - return SynEditCaretType::ctVerticalLine; - return static_cast(combo->currentIndex()); + return QSynedit::SynEditCaretType::ctVerticalLine; + return static_cast(combo->currentIndex()); } void EditorGeneralWidget::doLoad() { diff --git a/RedPandaIDE/todoparser.cpp b/RedPandaIDE/todoparser.cpp index 481c032c..67a89970 100644 --- a/RedPandaIDE/todoparser.cpp +++ b/RedPandaIDE/todoparser.cpp @@ -63,7 +63,7 @@ TodoThread::TodoThread(const QString& filename, QObject *parent): QThread(parent void TodoThread::run() { - PSynHighlighter highlighter = highlighterManager.getCppHighlighter(); + QSynedit::PSynHighlighter highlighter = highlighterManager.getCppHighlighter(); emit parseStarted(mFilename); auto action = finally([this]{ emit parseFinished(); @@ -72,13 +72,13 @@ void TodoThread::run() if (!pMainWindow->editorList()->getContentFromOpenedEditor(mFilename,lines)) { return; } - PSynHighlighterAttribute commentAttr = highlighter->getAttribute(SYNS_AttrComment); + QSynedit::PSynHighlighterAttribute commentAttr = highlighter->getAttribute(SYNS_AttrComment); highlighter->resetState(); for (int i =0;isetLine(lines[i],i); while (!highlighter->eol()) { - PSynHighlighterAttribute attr; + QSynedit::PSynHighlighterAttribute attr; attr = highlighter->getTokenAttribute(); if (attr == commentAttr) { QString token = highlighter->getToken(); diff --git a/RedPandaIDE/widgets/cpudialog.cpp b/RedPandaIDE/widgets/cpudialog.cpp index 0dd2b789..7e45d2d8 100644 --- a/RedPandaIDE/widgets/cpudialog.cpp +++ b/RedPandaIDE/widgets/cpudialog.cpp @@ -123,7 +123,7 @@ void CPUDialog::setDisassembly(const QString& file, const QString& funcName,cons ui->txtCode->document()->add(line); } if (activeLine!=-1) - ui->txtCode->setCaretXYEx(true,BufferCoord{1,activeLine+1}); + ui->txtCode->setCaretXYEx(true,QSynedit::BufferCoord{1,activeLine+1}); } void CPUDialog::resetEditorFont(float dpi) diff --git a/RedPandaIDE/widgets/cpudialog.ui b/RedPandaIDE/widgets/cpudialog.ui index c0f72433..45cbc6f4 100644 --- a/RedPandaIDE/widgets/cpudialog.ui +++ b/RedPandaIDE/widgets/cpudialog.ui @@ -80,7 +80,7 @@ - + 0 @@ -224,7 +224,7 @@ - SynEdit + QSynedit::SynEdit QFrame
qsynedit/SynEdit.h
1 diff --git a/RedPandaIDE/widgets/filepropertiesdialog.cpp b/RedPandaIDE/widgets/filepropertiesdialog.cpp index ce8c1738..92f58278 100644 --- a/RedPandaIDE/widgets/filepropertiesdialog.cpp +++ b/RedPandaIDE/widgets/filepropertiesdialog.cpp @@ -56,8 +56,8 @@ void FilePropertiesDialog::calcFile(Editor *editor, while (jgetHighlighterAttriAtRowCol(BufferCoord{j+1,i+1}, + QSynedit::PSynHighlighterAttribute attr; + if (editor->getHighlighterAttriAtRowCol(QSynedit::BufferCoord{j+1,i+1}, token,attr)) { // if it is preprocessor... if (attr->name() == SYNS_AttrPreprocessor) { diff --git a/RedPandaIDE/widgets/searchdialog.cpp b/RedPandaIDE/widgets/searchdialog.cpp index e5eb6f56..9ed5fcc2 100644 --- a/RedPandaIDE/widgets/searchdialog.cpp +++ b/RedPandaIDE/widgets/searchdialog.cpp @@ -44,8 +44,8 @@ SearchDialog::SearchDialog(QWidget *parent) : ui->dialogLayout->insertWidget(0,mTabBar); connect(mTabBar,&QTabBar::currentChanged,this, &SearchDialog::onTabChanged); mSearchOptions&=0; - mBasicSearchEngine= PSynSearchBase(new SynSearch()); - mRegexSearchEngine= PSynSearchBase(new SynSearchRegex()); + mBasicSearchEngine= QSynedit::PSynSearchBase(new QSynedit::SynSearch()); + mRegexSearchEngine= QSynedit::PSynSearchBase(new QSynedit::SynSearchRegex()); } SearchDialog::~SearchDialog() @@ -87,7 +87,7 @@ void SearchDialog::findInFiles(const QString &text) show(); } -void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, SynSearchOptions options) +void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, QSynedit::SynSearchOptions options) { mTabBar->setCurrentIndex(2); @@ -106,10 +106,10 @@ void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, Sy break; } // Apply options - ui->chkRegExp->setChecked(options.testFlag(ssoRegExp)); - ui->chkCaseSensetive->setChecked(options.testFlag(ssoMatchCase)); - ui->chkWholeWord->setChecked(options.testFlag(ssoWholeWord)); - ui->chkWrapAround->setChecked(options.testFlag(ssoWholeWord)); + ui->chkRegExp->setChecked(options.testFlag(QSynedit::ssoRegExp)); + ui->chkCaseSensetive->setChecked(options.testFlag(QSynedit::ssoMatchCase)); + ui->chkWholeWord->setChecked(options.testFlag(QSynedit::ssoWholeWord)); + ui->chkWrapAround->setChecked(options.testFlag(QSynedit::ssoWholeWord)); show(); } @@ -215,42 +215,42 @@ void SearchDialog::on_btnExecute_clicked() // Apply options if (ui->chkRegExp->isChecked()) { - mSearchOptions.setFlag(ssoRegExp); + mSearchOptions.setFlag(QSynedit::ssoRegExp); } if (ui->chkCaseSensetive->isChecked()) { - mSearchOptions.setFlag(ssoMatchCase); + mSearchOptions.setFlag(QSynedit::ssoMatchCase); } if (ui->chkWholeWord->isChecked()) { - mSearchOptions.setFlag(ssoWholeWord); + mSearchOptions.setFlag(QSynedit::ssoWholeWord); } if (ui->chkWrapAround->isChecked()) { - mSearchOptions.setFlag(ssoWrapAround); + mSearchOptions.setFlag(QSynedit::ssoWrapAround); } // Apply scope, when enabled if (ui->grpScope->isEnabled()) { if (ui->rbSelection->isChecked()) { - mSearchOptions.setFlag(ssoSelectedOnly); + mSearchOptions.setFlag(QSynedit::ssoSelectedOnly); } } // Apply direction, when enabled if (ui->grpDirection->isEnabled()) { if (ui->rbBackward->isChecked()) { - mSearchOptions.setFlag(ssoBackwards); + mSearchOptions.setFlag(QSynedit::ssoBackwards); } } // Apply origin, when enabled if (ui->grpOrigin->isEnabled()) { if (ui->rbEntireScope->isChecked()) { - mSearchOptions.setFlag(ssoEntireScope); + mSearchOptions.setFlag(QSynedit::ssoEntireScope); } } // Use entire scope for file finding/replacing if (actionType == SearchAction::FindFiles || actionType == SearchAction::ReplaceFiles) { - mSearchOptions.setFlag(ssoEntireScope); + mSearchOptions.setFlag(QSynedit::ssoEntireScope); } this->close(); @@ -283,18 +283,18 @@ void SearchDialog::on_btnExecute_clicked() QMessageBox::Yes|QMessageBox::YesAll|QMessageBox::No|QMessageBox::Cancel, QMessageBox::Yes)) { case QMessageBox::Yes: - return SynSearchAction::Replace; + return QSynedit::SynSearchAction::Replace; case QMessageBox::YesAll: - return SynSearchAction::ReplaceAll; + return QSynedit::SynSearchAction::ReplaceAll; case QMessageBox::No: - return SynSearchAction::Skip; + return QSynedit::SynSearchAction::Skip; case QMessageBox::Cancel: - return SynSearchAction::Exit; + return QSynedit::SynSearchAction::Exit; default: - return SynSearchAction::Exit; + return QSynedit::SynSearchAction::Exit; } } else { - return SynSearchAction::ReplaceAll; + return QSynedit::SynSearchAction::ReplaceAll; } }, [](){ @@ -378,7 +378,7 @@ void SearchDialog::on_btnExecute_clicked() results->results.append(parentItem); } } else if (fileExists(curFilename)) { - SynEdit editor; + QSynedit::SynEdit editor; QByteArray realEncoding; editor.document()->loadFromFile(curFilename,ENCODING_AUTO_DETECT, realEncoding); fileSearched++; @@ -401,24 +401,24 @@ void SearchDialog::on_btnExecute_clicked() } } -int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString &sReplace, - SynSearchMathedProc matchCallback, - SynSearchConfirmAroundProc confirmAroundCallback) +int SearchDialog::execute(QSynedit::SynEdit *editor, const QString &sSearch, const QString &sReplace, + QSynedit::SynSearchMathedProc matchCallback, + QSynedit::SynSearchConfirmAroundProc confirmAroundCallback) { if (editor==nullptr) return 0; // Modify the caret when using 'from cursor' and when the selection is ignored - if (!mSearchOptions.testFlag(ssoEntireScope) && !mSearchOptions.testFlag(ssoSelectedOnly) + if (!mSearchOptions.testFlag(QSynedit::ssoEntireScope) && !mSearchOptions.testFlag(QSynedit::ssoSelectedOnly) && editor->selAvail()) { // start at end of selection - if (mSearchOptions.testFlag(ssoBackwards)) { + if (mSearchOptions.testFlag(QSynedit::ssoBackwards)) { editor->setCaretXY(editor->blockBegin()); } else { editor->setCaretXY(editor->blockEnd()); } } - if (mSearchOptions.testFlag(ssoRegExp)) { + if (mSearchOptions.testFlag(QSynedit::ssoRegExp)) { mSearchEngine = mRegexSearchEngine; } else { mSearchEngine = mBasicSearchEngine; @@ -428,12 +428,12 @@ int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString mSearchEngine, matchCallback, confirmAroundCallback); } -std::shared_ptr SearchDialog::batchFindInEditor(SynEdit *e, const QString& filename,const QString &keyword) +std::shared_ptr SearchDialog::batchFindInEditor(QSynedit::SynEdit *e, const QString& filename,const QString &keyword) { //backup - BufferCoord caretBackup = e->caretXY(); - BufferCoord blockBeginBackup = e->blockBegin(); - BufferCoord blockEndBackup = e->blockEnd(); + QSynedit::BufferCoord caretBackup = e->caretXY(); + QSynedit::BufferCoord blockBeginBackup = e->blockBegin(); + QSynedit::BufferCoord blockEndBackup = e->blockEnd(); int toplineBackup = e->topLine(); int leftCharBackup = e->leftChar(); @@ -452,7 +452,7 @@ std::shared_ptr SearchDialog::batchFindInEditor(SynEdit *e item->text = e->document()->getString(Line-1); item->text.replace('\t',' '); parentItem->results.append(item); - return SynSearchAction::Skip; + return QSynedit::SynSearchAction::Skip; }); // restore @@ -486,7 +486,7 @@ QTabBar *SearchDialog::tabBar() const return mTabBar; } -PSynSearchBase SearchDialog::searchEngine() const +QSynedit::PSynSearchBase SearchDialog::searchEngine() const { return mSearchEngine; } diff --git a/RedPandaIDE/widgets/searchdialog.h b/RedPandaIDE/widgets/searchdialog.h index 46568864..98e1a02c 100644 --- a/RedPandaIDE/widgets/searchdialog.h +++ b/RedPandaIDE/widgets/searchdialog.h @@ -46,9 +46,9 @@ public: void findNext(); void findPrevious(); void findInFiles(const QString& text); - void findInFiles(const QString& keyword, SearchFileScope scope, SynSearchOptions options); + void findInFiles(const QString& keyword, SearchFileScope scope, QSynedit::SynSearchOptions options); void replace(const QString& sFind, const QString& sReplace); - PSynSearchBase searchEngine() const; + QSynedit::PSynSearchBase searchEngine() const; QTabBar *tabBar() const; @@ -60,18 +60,18 @@ private slots: void on_btnExecute_clicked(); private: - int execute(SynEdit* editor, const QString& sSearch, + int execute(QSynedit::SynEdit* editor, const QString& sSearch, const QString& sReplace, - SynSearchMathedProc matchCallback = nullptr, - SynSearchConfirmAroundProc confirmAroundCallback = nullptr); - std::shared_ptr batchFindInEditor(SynEdit * editor,const QString& filename, const QString& keyword); + QSynedit::SynSearchMathedProc matchCallback = nullptr, + QSynedit::SynSearchConfirmAroundProc confirmAroundCallback = nullptr); + std::shared_ptr batchFindInEditor(QSynedit::SynEdit * editor,const QString& filename, const QString& keyword); private: Ui::SearchDialog *ui; QTabBar *mTabBar; - SynSearchOptions mSearchOptions; - PSynSearchBase mSearchEngine; - PSynSearchBase mBasicSearchEngine; - PSynSearchBase mRegexSearchEngine; + QSynedit::SynSearchOptions mSearchOptions; + QSynedit::PSynSearchBase mSearchEngine; + QSynedit::PSynSearchBase mBasicSearchEngine; + QSynedit::PSynSearchBase mRegexSearchEngine; // QWidget interface protected: diff --git a/RedPandaIDE/widgets/searchresultview.cpp b/RedPandaIDE/widgets/searchresultview.cpp index ff4a355c..190da707 100644 --- a/RedPandaIDE/widgets/searchresultview.cpp +++ b/RedPandaIDE/widgets/searchresultview.cpp @@ -20,7 +20,7 @@ #include #include "mainwindow.h" -PSearchResults SearchResultModel::addSearchResults(const QString &keyword, SynSearchOptions options, SearchFileScope scope) +PSearchResults SearchResultModel::addSearchResults(const QString &keyword, QSynedit::SynSearchOptions options, SearchFileScope scope) { int index=-1; for (int i=0;i