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