create QSynedit namespace

This commit is contained in:
Roy Qu 2022-09-25 09:55:18 +08:00
parent 40cae133ba
commit 00ea7ee773
60 changed files with 488 additions and 361 deletions

View File

@ -30,7 +30,7 @@ HighlighterManager::HighlighterManager()
}
PSynHighlighter HighlighterManager::getHighlighter(const QString &filename)
QSynedit::PSynHighlighter HighlighterManager::getHighlighter(const QString &filename)
{
QFileInfo info(filename);
QString suffix = info.suffix();
@ -43,26 +43,30 @@ PSynHighlighter HighlighterManager::getHighlighter(const QString &filename)
} else if (suffix == "vs" || suffix == "fs" || suffix == "frag") {
return getGLSLHighlighter();
}
return PSynHighlighter();
return QSynedit::PSynHighlighter();
}
PSynHighlighter HighlighterManager::copyHighlighter(PSynHighlighter highlighter)
QSynedit::PSynHighlighter HighlighterManager::copyHighlighter(QSynedit::PSynHighlighter highlighter)
{
if (!highlighter)
return PSynHighlighter();
return QSynedit::PSynHighlighter();
if (highlighter->getName() == SYN_HIGHLIGHTER_CPP)
return getCppHighlighter();
else if (highlighter->getName() == SYN_HIGHLIGHTER_ASM)
return getAsmHighlighter();
else if (highlighter->getName() == SYN_HIGHLIGHTER_GLSL)
return getGLSLHighlighter();
//todo
return PSynHighlighter();
return QSynedit::PSynHighlighter();
}
PSynHighlighter HighlighterManager::getCppHighlighter()
QSynedit::PSynHighlighter HighlighterManager::getCppHighlighter()
{
SynEditCppHighlighter* highlighter = new SynEditCppHighlighter();
QSynedit::SynEditCppHighlighter* highlighter = new QSynedit::SynEditCppHighlighter();
highlighter->asmAttribute()->setForeground(Qt::blue);
highlighter->charAttribute()->setForeground(Qt::black);
highlighter->commentAttribute()->setForeground(0x8C8C8C);
highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic);
highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic);
highlighter->classAttribute()->setForeground(0x008080);
highlighter->floatAttribute()->setForeground(Qt::darkMagenta);
highlighter->functionAttribute()->setForeground(0x00627A);
@ -80,16 +84,16 @@ PSynHighlighter HighlighterManager::getCppHighlighter()
highlighter->stringEscapeSequenceAttribute()->setForeground(Qt::red);
highlighter->symbolAttribute()->setForeground(0xc10000);
highlighter->variableAttribute()->setForeground(0x400080);
PSynHighlighter pHighlighter=std::make_shared<SynEditCppHighlighter>();
QSynedit::PSynHighlighter pHighlighter=std::make_shared<QSynedit::SynEditCppHighlighter>();
return pHighlighter;
}
PSynHighlighter HighlighterManager::getAsmHighlighter()
QSynedit::PSynHighlighter HighlighterManager::getAsmHighlighter()
{
SynEditASMHighlighter* highlighter = new SynEditASMHighlighter();
PSynHighlighter pHighlighter(highlighter);
QSynedit::SynEditASMHighlighter* highlighter = new QSynedit::SynEditASMHighlighter();
QSynedit::PSynHighlighter pHighlighter(highlighter);
highlighter->commentAttribute()->setForeground(0x8C8C8C);
highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic);
highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic);
highlighter->identifierAttribute()->setForeground(0x080808);
highlighter->keywordAttribute()->setForeground(0x0033b3);
highlighter->numberAttribute()->setForeground(0x1750EB);
@ -99,14 +103,14 @@ PSynHighlighter HighlighterManager::getAsmHighlighter()
return pHighlighter;
}
PSynHighlighter HighlighterManager::getGLSLHighlighter()
QSynedit::PSynHighlighter HighlighterManager::getGLSLHighlighter()
{
SynEditGLSLHighlighter* highlighter = new SynEditGLSLHighlighter();
PSynHighlighter pHighlighter(highlighter);
QSynedit::SynEditGLSLHighlighter* highlighter = new QSynedit::SynEditGLSLHighlighter();
QSynedit::PSynHighlighter pHighlighter(highlighter);
highlighter->asmAttribute()->setForeground(Qt::blue);
highlighter->charAttribute()->setForeground(Qt::black);
highlighter->commentAttribute()->setForeground(0x8C8C8C);
highlighter->commentAttribute()->setStyles(SynFontStyle::fsItalic);
highlighter->commentAttribute()->setStyles(QSynedit::SynFontStyle::fsItalic);
highlighter->classAttribute()->setForeground(0x008080);
highlighter->floatAttribute()->setForeground(Qt::darkMagenta);
highlighter->functionAttribute()->setForeground(0x00627A);
@ -127,7 +131,7 @@ PSynHighlighter HighlighterManager::getGLSLHighlighter()
return pHighlighter;
}
void HighlighterManager::applyColorScheme(PSynHighlighter highlighter, const QString &schemeName)
void HighlighterManager::applyColorScheme(QSynedit::PSynHighlighter highlighter, const QString &schemeName)
{
if (!highlighter)
return;
@ -137,14 +141,14 @@ void HighlighterManager::applyColorScheme(PSynHighlighter highlighter, const QSt
for (QString name: highlighter->attributes().keys()) {
PColorSchemeItem item = pColorManager->getItem(schemeName,name);
if (item) {
PSynHighlighterAttribute attr = highlighter->attributes()[name];
QSynedit::PSynHighlighterAttribute attr = highlighter->attributes()[name];
attr->setBackground(item->background());
attr->setForeground(item->foreground());
SynFontStyles styles = SynFontStyle::fsNone;
styles.setFlag(SynFontStyle::fsBold, item->bold());
styles.setFlag(SynFontStyle::fsItalic, item->italic());
styles.setFlag(SynFontStyle::fsUnderline, item->underlined());
styles.setFlag(SynFontStyle::fsStrikeOut, item->strikeout());
QSynedit::SynFontStyles styles = QSynedit::SynFontStyle::fsNone;
styles.setFlag(QSynedit::SynFontStyle::fsBold, item->bold());
styles.setFlag(QSynedit::SynFontStyle::fsItalic, item->italic());
styles.setFlag(QSynedit::SynFontStyle::fsUnderline, item->underlined());
styles.setFlag(QSynedit::SynFontStyle::fsStrikeOut, item->strikeout());
attr->setStyles(styles);
}
}

View File

@ -23,12 +23,12 @@ class HighlighterManager
public:
HighlighterManager();
PSynHighlighter getHighlighter(const QString& filename);
PSynHighlighter copyHighlighter(PSynHighlighter highlighter);
PSynHighlighter getCppHighlighter();
PSynHighlighter getAsmHighlighter();
PSynHighlighter getGLSLHighlighter();
void applyColorScheme(PSynHighlighter highlighter, const QString& schemeName);
QSynedit::PSynHighlighter getHighlighter(const QString& filename);
QSynedit::PSynHighlighter copyHighlighter(QSynedit::PSynHighlighter highlighter);
QSynedit::PSynHighlighter getCppHighlighter();
QSynedit::PSynHighlighter getAsmHighlighter();
QSynedit::PSynHighlighter getGLSLHighlighter();
void applyColorScheme(QSynedit::PSynHighlighter highlighter, const QString& schemeName);
};
extern HighlighterManager highlighterManager;

View File

@ -19,6 +19,7 @@
#include "compiler.h"
#include <QObject>
#include <QFile>
class Project;
class ProjectCompiler : public Compiler

View File

@ -30,7 +30,7 @@ CppRefacter::CppRefacter(QObject *parent) : QObject(parent)
}
bool CppRefacter::findOccurence(Editor *editor, const BufferCoord &pos)
bool CppRefacter::findOccurence(Editor *editor, const QSynedit::BufferCoord &pos)
{
if (!editor->parser())
return false;
@ -106,7 +106,7 @@ static QString fullParentName(PStatement statement) {
return "";
}
}
void CppRefacter::renameSymbol(Editor *editor, const BufferCoord &pos, const QString &newWord)
void CppRefacter::renameSymbol(Editor *editor, const QSynedit::BufferCoord &pos, const QString &newWord)
{
if (!editor->parser()->freeze())
return;
@ -117,7 +117,7 @@ void CppRefacter::renameSymbol(Editor *editor, const BufferCoord &pos, const QSt
QStringList expression;
QChar s=editor->charAt(pos);
if (!editor->isIdentChar(s)) {
expression = editor->getExpressionAtPosition(BufferCoord{pos.ch-1,pos.line});
expression = editor->getExpressionAtPosition(QSynedit::BufferCoord{pos.ch-1,pos.line});
} else {
expression = editor->getExpressionAtPosition(pos);
}
@ -226,11 +226,11 @@ PSearchResultTreeItem CppRefacter::findOccurenceInFile(
while (!editor.highlighter()->eol()) {
int start = editor.highlighter()->getTokenPos() + 1;
QString token = editor.highlighter()->getToken();
PSynHighlighterAttribute attr = editor.highlighter()->getTokenAttribute();
QSynedit::PSynHighlighterAttribute attr = editor.highlighter()->getTokenAttribute();
if (!attr || attr!=editor.highlighter()->commentAttribute()) {
if (token == statement->command) {
//same name symbol , test if the same statement;
BufferCoord p;
QSynedit::BufferCoord p;
p.line = posY+1;
p.ch = start+1;
@ -290,7 +290,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement &
QString token = editor.highlighter()->getToken();
if (token == statement->command) {
//same name symbol , test if the same statement;
BufferCoord p;
QSynedit::BufferCoord p;
p.line = posY+1;
p.ch = start;
@ -313,7 +313,7 @@ void CppRefacter::renameSymbolInFile(const QString &filename, const PStatement &
Editor * oldEditor = pMainWindow->editorList()->getOpenedEditorByFilename(filename);
if (oldEditor) {
BufferCoord oldXY=oldEditor->caretXY();
QSynedit::BufferCoord oldXY=oldEditor->caretXY();
int topLine = oldEditor->topLine();
int leftChar = oldEditor->leftChar();
oldEditor->beginUndoBlock();

View File

@ -23,7 +23,9 @@
#include "parser/cppparser.h"
class Editor;
struct BufferCoord;
namespace QSynedit {
struct BufferCoord;
}
class Project;
class CppRefacter : public QObject
{
@ -31,10 +33,10 @@ class CppRefacter : public QObject
public:
explicit CppRefacter(QObject *parent = nullptr);
bool findOccurence(Editor * editor, const BufferCoord& pos);
bool findOccurence(Editor * editor, const QSynedit::BufferCoord& pos);
bool findOccurence(const QString& statementFullname, SearchFileScope scope);
void renameSymbol(Editor* editor, const BufferCoord& pos, const QString& newWord);
void renameSymbol(Editor* editor, const QSynedit::BufferCoord& pos, const QString& newWord);
private:
void doFindOccurenceInEditor(PStatement statement, Editor* editor, const PCppParser& parser);
void doFindOccurenceInProject(PStatement statement, std::shared_ptr<Project> project, const PCppParser& parser);

File diff suppressed because it is too large Load Diff

View File

@ -53,7 +53,7 @@ private:
QByteArray mReasonBuffer;
};
class Editor : public SynEdit
class Editor : public QSynedit::SynEdit
{
Q_OBJECT
public:
@ -180,7 +180,7 @@ public:
bool hasPrevSyntaxIssue() const;
bool hasNextSyntaxIssue() const;
PSyntaxIssueList getSyntaxIssuesAtLine(int line);
PSyntaxIssue getSyntaxIssueAtPosition(const BufferCoord& pos);
PSyntaxIssue getSyntaxIssueAtPosition(const QSynedit::BufferCoord& pos);
int gutterClickedLine() const;
void toggleBreakpoint(int line);
void clearBreakpoints();
@ -192,11 +192,11 @@ public:
void removeBreakpointFocus();
void modifyBreakpointProperty(int line);
void setActiveBreakpointFocus(int Line, bool setFocus=true);
QString getPreviousWordAtPositionForSuggestion(const BufferCoord& p);
QString getPreviousWordAtPositionForSuggestion(const QSynedit::BufferCoord& p);
void reformat();
void checkSyntaxInBack();
void gotoDeclaration(const BufferCoord& pos);
void gotoDefinition(const BufferCoord& pos);
void gotoDeclaration(const QSynedit::BufferCoord& pos);
void gotoDefinition(const QSynedit::BufferCoord& pos);
void reparse();
void reparseTodo();
void insertString(const QString& value, bool moveCursor);
@ -216,12 +216,12 @@ public:
void deleteToBOL();
QStringList getOwnerExpressionAndMemberAtPositionForCompletion(
const BufferCoord& pos,
const QSynedit::BufferCoord& pos,
QString& memberOperator,
QStringList& memberExpression);
QString getWordForCompletionSearch(const BufferCoord& pos,bool permitTilde);
QString getWordForCompletionSearch(const QSynedit::BufferCoord& pos,bool permitTilde);
QStringList getExpressionAtPosition(
const BufferCoord& pos);
const QSynedit::BufferCoord& pos);
const PCppParser &parser();
@ -230,7 +230,7 @@ signals:
void renamed(const QString& oldName, const QString& newName, bool firstSave);
void fileSaved(const QString& filename, bool inProject);
private slots:
void onStatusChanged(SynStatusChanges changes);
void onStatusChanged(QSynedit::SynStatusChanges changes);
void onGutterClicked(Qt::MouseButton button, int x, int y, int line);
void onTipEvalValueReady(const QString& value);
void onLinesDeleted(int first,int count);
@ -272,7 +272,7 @@ private:
bool onHeaderCompletionKeyPressed(QKeyEvent* event);
bool onCompletionInputMethod(QInputMethodEvent *event);
TipType getTipType(QPoint point, BufferCoord& pos);
TipType getTipType(QPoint point, QSynedit::BufferCoord& pos);
void cancelHint();
QString getFileHint(const QString& s);
QString getParserHint(const QStringList& expression,const QString& s, int line);
@ -284,8 +284,8 @@ private:
void updateFunctionTip(bool showTip);
void clearUserCodeInTabStops();
void popUserCodeInTabStops();
void onExportedFormatToken(PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token,
PSynHighlighterAttribute &attr);
void onExportedFormatToken(QSynedit::PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token,
QSynedit::PSynHighlighterAttribute &attr);
void onScrollBarValueChanged();
private:
QByteArray mEncodingOption; // the encoding type set by the user
@ -331,8 +331,8 @@ private:
QString mLineBeforeTabStop;
QString mLineAfterTabStop;
QList<PTabStop> mUserCodeInTabStops;
BufferCoord mHighlightCharPos1;
BufferCoord mHighlightCharPos2;
QSynedit::BufferCoord mHighlightCharPos1;
QSynedit::BufferCoord mHighlightCharPos2;
std::shared_ptr<QHash<StatementKind, std::shared_ptr<ColorSchemeItem> > > mStatementColors;
QTimer mFunctionTipTimer;
int mHoverModifiedLine;
@ -347,7 +347,7 @@ protected:
// SynEdit interface
protected:
void onGutterPaint(QPainter &painter, int aLine, int X, int Y) override;
void onGetEditingAreas(int Line, SynEditingAreaList &areaList) override;
void onGetEditingAreas(int Line, QSynedit::SynEditingAreaList &areaList) override;
// SynEdit interface
protected:
@ -355,7 +355,7 @@ protected:
// SynEdit interface
protected:
void onPreparePaintHighlightToken(int line, int aChar, const QString &token, PSynHighlighterAttribute attr, SynFontStyles &style, QColor &foreground, QColor &background) override;
void onPreparePaintHighlightToken(int line, int aChar, const QString &token, QSynedit::PSynHighlighterAttribute attr, QSynedit::SynFontStyles &style, QColor &foreground, QColor &background) override;
// QObject interface
public:
@ -391,10 +391,10 @@ protected:
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
};
QString getWordAtPosition(SynEdit* editor,
const BufferCoord& p,
BufferCoord& pWordBegin,
BufferCoord& pWordEnd,
QString getWordAtPosition(QSynedit::SynEdit* editor,
const QSynedit::BufferCoord& p,
QSynedit::BufferCoord& pWordBegin,
QSynedit::BufferCoord& pWordEnd,
Editor::WordPurpose purpose);

View File

@ -2225,7 +2225,7 @@ void MainWindow::loadLastOpens()
// }
if (!editor)
continue;
BufferCoord pos;
QSynedit::BufferCoord pos;
pos.ch = lastOpenIni.GetLongValue(sectionName,"CursorCol", 1);
pos.line = lastOpenIni.GetLongValue(sectionName,"CursorRow", 1);
editor->setCaretXY(pos);
@ -4027,7 +4027,7 @@ void MainWindow::onEditorContextMenu(const QPoint& pos)
if (!editor)
return;
QMenu menu(this);
BufferCoord p;
QSynedit::BufferCoord p;
mEditorContextMenuPos = pos;
int line;
if (editor->getPositionOfMouse(p)) {
@ -5638,7 +5638,7 @@ void MainWindow::on_actionGoto_Definition_triggered()
void MainWindow::on_actionFind_references_triggered()
{
Editor * editor = mEditorList->getEditor();
BufferCoord pos;
QSynedit::BufferCoord pos;
if (editor && editor->pointToCharLine(mEditorContextMenuPos,pos)) {
CppRefacter refactor;
refactor.findOccurence(editor,pos);
@ -6489,7 +6489,7 @@ void MainWindow::on_actionRename_Symbol_triggered()
if (!editor->parser())
return;
editor->beginUpdate();
BufferCoord oldCaretXY = editor->caretXY();
QSynedit::BufferCoord oldCaretXY = editor->caretXY();
// mClassBrowserModel.beginUpdate();
QCursor oldCursor = editor->cursor();
editor->setCursor(Qt::CursorShape::WaitCursor);
@ -6501,7 +6501,7 @@ void MainWindow::on_actionRename_Symbol_triggered()
QStringList expression = editor->getExpressionAtPosition(oldCaretXY);
if (expression.isEmpty() && oldCaretXY.ch>1) {
BufferCoord coord=oldCaretXY;
QSynedit::BufferCoord coord=oldCaretXY;
coord.ch--;
expression = editor->getExpressionAtPosition(coord);
}
@ -6723,7 +6723,7 @@ void MainWindow::on_btnReplace_clicked()
line.insert(item->start-1, newWord);
contents[item->line-1] = line;
}
BufferCoord coord=editor->caretXY();
QSynedit::BufferCoord coord=editor->caretXY();
int topLine = editor->topLine();
int leftChar = editor->leftChar();
editor->replaceAll(contents.join(editor->lineBreak()));

View File

@ -4138,7 +4138,7 @@ PStatement CppParser::doParseEvalTypeInfo(
QString s = type;
// qDebug()<<"eval type info"<<type;
int position = s.length()-1;
SynEditCppHighlighter highlighter;
QSynedit::SynEditCppHighlighter highlighter;
highlighter.resetState();
highlighter.setLine(type,0);
int bracketLevel = 0;

View File

@ -17,6 +17,9 @@
#include "CodeFolding.h"
#include "Constants.h"
namespace QSynedit {
int SynEditFoldRegions::count()
{
return fRegions.size();
@ -136,3 +139,5 @@ PSynEditFoldRange SynEditFoldRanges::operator[](int index) const
{
return mRanges[index];
}
}

View File

@ -21,6 +21,7 @@
#include <memory>
#include <QVector>
namespace QSynedit {
struct SynEditFoldRegion;
typedef std::shared_ptr<SynEditFoldRegion> PSynEditFoldRegion;
@ -94,4 +95,5 @@ public:
int aFromLine, PSynEditFoldRegion aFoldRegion, int aToLine);
};
}
#endif // CODEFOLDING_H

View File

@ -15,6 +15,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "Constants.h"
namespace QSynedit {
const QSet<QChar> SynWordBreakChars{'.', ',', ';', ':',
'"', '\'', '!', '?', '[', ']', '(', ')', '{', '}', '^', '-', '=', '+',
'-', '*', '/', '\\', '|'};
@ -23,3 +25,4 @@ const QChar SynTabGlyph(0x2192);
const QChar SynSpaceGlyph('.');
const QChar SynLineBreakGlyph(0x2193);
const QChar SynSoftBreakGlyph(0x2193);
}

View File

@ -19,6 +19,8 @@
#include <QSet>
#include <QChar>
namespace QSynedit {
extern const QSet<QChar> SynWordBreakChars;
extern const QChar SynTabChar;
extern const QChar SynSpaceGlyph;
@ -183,4 +185,8 @@ extern const QChar SynSoftBreakGlyph;
#define SYN_HIGHLIGHTER_CPP "SynCppHighlighter"
#define SYN_HIGHLIGHTER_ASM "SynASMHighlighter"
#define SYN_HIGHLIGHTER_GLSL "SynGLSLHighlighter"
}
#endif // CONSTANTS_H

View File

@ -16,6 +16,7 @@
*/
#include "KeyStrokes.h"
namespace QSynedit {
SynEditKeyStroke::SynEditKeyStroke()
{
mKey = 0;
@ -274,3 +275,5 @@ void SynEditKeyStrokes::setExtraKeyStrokes()
add(SynEditorCommand::ecUndo, Qt::Key_Z, Qt::ControlModifier);
add(SynEditorCommand::ecRedo, Qt::Key_Y, Qt::ControlModifier);
}
}

View File

@ -21,6 +21,8 @@
#include <QKeySequence>
#include <QList>
#include <memory>
namespace QSynedit {
//****************************************************************************
// NOTE! If you add an editor command, you must also update the
// EditorCommandStrs constant array in implementation section below, or the
@ -225,4 +227,6 @@ private:
SynEditKeyStrokeList mList;
};
}
#endif // SYNEDITKEYSTROKE_H

View File

@ -16,7 +16,7 @@
*/
#include "MiscClasses.h"
#include "algorithm"
namespace QSynedit {
SynGutter::SynGutter(QObject *parent):
QObject(parent)
{
@ -333,3 +333,5 @@ void SynGutter::setBorderColor(const QColor &value)
setChanged();
}
}
}

View File

@ -22,6 +22,8 @@
#include <QObject>
#include "Types.h"
namespace QSynedit {
enum class SynGutterBorderStyle {
None,
Middle,
@ -124,4 +126,6 @@ private:
using PSynGutter = std::shared_ptr<SynGutter>;
}
#endif // MISCCLASSES_H

View File

@ -20,6 +20,7 @@
#include <QTextStream>
#include <algorithm>
namespace QSynedit {
int minMax(int x, int mi, int ma)
{
x = std::min(x, ma );
@ -226,3 +227,5 @@ int calSpanLines(const BufferCoord &startPos, const BufferCoord &endPos)
{
return std::abs(endPos.line - startPos.line+1);
}
}

View File

@ -33,6 +33,8 @@ class QPainter;
class QRect;
class QColor;
namespace QSynedit {
int minMax(int x, int mi, int ma);
int mulDiv(int a, int b, int c);
BufferCoord maxBufferCoord(const BufferCoord& P1, const BufferCoord& P2);
@ -89,4 +91,6 @@ void ensureNotAfter(BufferCoord& cord1, BufferCoord& cord2);
bool isWordChar(const QChar& ch);
}
#endif // MISCPROCS_H

View File

@ -16,6 +16,8 @@
*/
#include "Search.h"
namespace QSynedit {
SynSearch::SynSearch(QObject *parent):SynSearchBase(parent)
{
@ -81,3 +83,4 @@ bool SynSearch::isDelimitChar(QChar ch)
{
return !(ch == '_' || ch.isLetterOrNumber());
}
}

View File

@ -18,6 +18,7 @@
#define SYNSEARCH_H
#include "SearchBase.h"
namespace QSynedit {
class SynSearch : public SynSearchBase
{
@ -37,5 +38,6 @@ private:
private:
QList<int> mResults;
};
}
#endif // SYNSEARCH_H

View File

@ -16,6 +16,7 @@
*/
#include "SearchBase.h"
namespace QSynedit {
SynSearchBase::SynSearchBase(QObject *parent) : QObject(parent)
{
@ -40,3 +41,4 @@ void SynSearchBase::setOptions(const SynSearchOptions &options)
{
mOptions = options;
}
}

View File

@ -20,6 +20,8 @@
#include <QObject>
#include <memory>
namespace QSynedit {
enum SynSearchOption {
ssoMatchCase = 0x0001,
ssoWholeWord = 0x0002,
@ -55,4 +57,6 @@ private:
using PSynSearchBase = std::shared_ptr<SynSearchBase>;
}
#endif // SYNSEARCHBASE_H

View File

@ -18,6 +18,8 @@
#include <QRegExp>
namespace QSynedit {
SynSearchRegex::SynSearchRegex(QObject* parent):SynSearchBase(parent)
{
@ -88,3 +90,5 @@ void SynSearchRegex::updateRegexOptions()
QRegularExpression::CaseInsensitiveOption);
}
}
}

View File

@ -20,6 +20,7 @@
#include <QRegularExpression>
namespace QSynedit {
class SynSearchRegex : public SynSearchBase
{
Q_OBJECT
@ -43,4 +44,6 @@ private:
QList<int> mResults;
};
}
#endif // SYNSEARCHREGEX_H

View File

@ -41,6 +41,7 @@
#include <QTextEdit>
#include <QMimeData>
namespace QSynedit {
SynEdit::SynEdit(QWidget *parent) : QAbstractScrollArea(parent),
mDropped(false)
{
@ -6958,3 +6959,4 @@ void SynEdit::onDraggingScrollTimeout()
computeScroll(true);
//doMouseScroll(true);
}
}

View File

@ -31,6 +31,8 @@
#include "KeyStrokes.h"
#include "SearchBase.h"
namespace QSynedit {
enum class SynFontSmoothMethod {
None, AntiAlias, ClearType
};
@ -801,4 +803,5 @@ protected:
void dragLeaveEvent(QDragLeaveEvent *event) override;
};
}
#endif // SYNEDIT_H

View File

@ -27,6 +27,8 @@
#include <QMessageBox>
#include <cmath>
namespace QSynedit {
SynDocument::SynDocument(const QFont& font, const QFont& nonAsciiFont, QObject *parent):
QObject(parent),
mFontMetrics(font),
@ -1158,3 +1160,5 @@ int SynEditRedoList::itemCount()
{
return mItems.count();
}
}

View File

@ -23,10 +23,12 @@
#include <QMutex>
#include <QVector>
#include <memory>
#include <QFile>
#include "MiscProcs.h"
#include "../utils.h"
#include "Types.h"
namespace QSynedit {
enum SynEditStringFlag {
sfHasTabs = 0x0001,
sfHasNoTabs = 0x0002,
@ -54,8 +56,6 @@ class SynDocument;
typedef std::shared_ptr<SynDocument> PSynDocument;
class QFile;
class SynDocument : public QObject
{
Q_OBJECT
@ -279,4 +279,6 @@ protected:
using PSynEditUndoList = std::shared_ptr<SynEditUndoList>;
using PSynEditRedoList = std::shared_ptr<SynEditRedoList>;
}
#endif // SYNEDITSTRINGLIST_H

View File

@ -20,6 +20,8 @@
#include <cmath>
#include <QDebug>
namespace QSynedit {
SynEditTextPainter::SynEditTextPainter(SynEdit *edit, QPainter *painter, int FirstRow, int LastRow, int FirstCol, int LastCol)
{
this->edit = edit;
@ -1093,3 +1095,4 @@ void SynEditTextPainter::paintLines()
bCurrentLine = false;
}
}
}

View File

@ -25,6 +25,7 @@
#include "../utils.h"
#include "MiscClasses.h"
namespace QSynedit {
class SynEdit;
class SynEditTextPainter
{
@ -87,4 +88,6 @@ private:
SynTokenAccu TokenAccu;
};
}
#endif // TEXTPAINTER_H

View File

@ -18,6 +18,8 @@
#include "SynEdit.h"
#include <QDebug>
namespace QSynedit {
bool BufferCoord::operator==(const BufferCoord &coord)
{
return coord.ch == ch && coord.line == line;
@ -51,3 +53,5 @@ bool BufferCoord::operator!=(const BufferCoord &coord)
{
return coord.ch != ch || coord.line != line;
}
}

View File

@ -22,6 +22,8 @@
#include <QFlags>
#include <memory>
namespace QSynedit {
enum class SynSelectionMode {Normal, Line, Column};
struct BufferCoord {
@ -70,5 +72,6 @@ using PSynEditingArea = std::shared_ptr<SynEditingArea>;
using SynEditingAreaList = QList<PSynEditingArea>;
using PSynEditingAreaList = std::shared_ptr<SynEditingAreaList>;
}
#endif // TYPES_H

View File

@ -23,6 +23,8 @@
#include <QTextCodec>
#include "../../platform.h"
namespace QSynedit {
SynExporter::SynExporter()
{
mClipboardFormat = "text/plain";
@ -398,3 +400,5 @@ QString SynExporter::lineBreak()
}
return "\n";
}
}

View File

@ -20,8 +20,7 @@
#include <QString>
#include "../SynEdit.h"
namespace QSynedit {
using FormatTokenHandler = std::function<void(PSynHighlighter syntaxHighlighter, int Line, int column, const QString& token,
PSynHighlighterAttribute& attr)>;
class SynExporter
@ -246,5 +245,6 @@ private:
FormatTokenHandler mOnFormatToken;
};
}
#endif // SYNEXPORTER_H

View File

@ -18,6 +18,8 @@
#include "../MiscProcs.h"
#include <functional>
namespace QSynedit {
SynHTMLExporter::SynHTMLExporter(int tabSize)
{
mClipboardFormat = "text/html";
@ -224,3 +226,4 @@ void SynHTMLExporter::SetTokenAttribute(PSynHighlighterAttribute Attri)
mLastAttri = Attri;
SynExporter::SetTokenAttribute(Attri);
}
}

View File

@ -19,6 +19,7 @@
#include "synexporter.h"
namespace QSynedit {
class SynHTMLExporter : public SynExporter
{
public:
@ -52,5 +53,5 @@ protected:
QString GetHeader();
void SetTokenAttribute(PSynHighlighterAttribute Attri);
};
}
#endif // SYNHTMLEXPORTER_H

View File

@ -15,6 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "synrtfexporter.h"
namespace QSynedit {
SynRTFExporter::SynRTFExporter():SynExporter()
{
@ -164,3 +165,4 @@ QString SynRTFExporter::GetHeader()
.arg(GetColorIndex(mBackgroundColor));
return Result;
}
}

View File

@ -19,6 +19,8 @@
#include "synexporter.h"
namespace QSynedit {
class SynRTFExporter : public SynExporter
{
public:
@ -42,4 +44,5 @@ protected:
QString GetHeader() override;
};
}
#endif // SYNRTFEXPORTER_H

View File

@ -17,6 +17,8 @@
#include "asm.h"
#include "../Constants.h"
namespace QSynedit {
const QSet<QString> SynEditASMHighlighter::Keywords {
"aaa","aad","aam","adc","add","and","arpl","bound","bsf","bsr","bswap","bt","btc","btr","bts",
"call","cbw","cdq","clc","cld","cli","clts","cmc","cmp","cmps","cmpsb","cmpsd","cmpsw",
@ -406,3 +408,4 @@ QSet<QString> SynEditASMHighlighter::keywords() const
{
return Keywords;
}
}

View File

@ -19,6 +19,7 @@
#include "base.h"
namespace QSynedit {
class SynEditASMHighlighter : public SynHighlighter
{
@ -99,4 +100,6 @@ public:
QSet<QString> keywords() const override;
};
}
#endif // SYNEDITASMHIGHLIGHTER_H

View File

@ -17,6 +17,7 @@
#include "base.h"
#include "../Constants.h"
namespace QSynedit {
SynHighlighter::SynHighlighter() :
mEnabled(true),
mWordBreakChars{ SynWordBreakChars }
@ -260,3 +261,4 @@ SynRangeState::SynRangeState():
firstIndentThisLine(0)
{
}
}

View File

@ -26,6 +26,7 @@
#include <QVector>
#include "../Types.h"
namespace QSynedit {
enum SynIndentType {
sitBrace = 0,
sitParenthesis = 1,
@ -174,4 +175,5 @@ private:
using PSynHighlighter = std::shared_ptr<SynHighlighter>;
using SynHighlighterList = QVector<PSynHighlighter>;
}
#endif // SYNHIGHLIGTERBASE_H

View File

@ -17,6 +17,8 @@
#include "composition.h"
#include "../Constants.h"
namespace QSynedit {
SynHighlightComposition::SynHighlightComposition()
{
@ -107,3 +109,5 @@ QString SynScheme::ConvertExpression(const QString &Value)
void SynScheme::MarkerAttriChanged() {
}
}

View File

@ -20,6 +20,7 @@
#include <memory>
#include <QObject>
namespace QSynedit {
class SynSchema;
using PSynSchema = std::shared_ptr<SynSchema>;
@ -74,4 +75,5 @@ public:
QString getName() const override;
};
}
#endif // SYNHIGHLIGHTCOMPOSITION_H

View File

@ -19,6 +19,8 @@
#include <QFont>
namespace QSynedit {
static const QSet<QString> CppStatementKeyWords {
"if",
"for",
@ -1692,3 +1694,5 @@ QString SynEditCppHighlighter::foldString()
{
return "...}";
}
}

View File

@ -19,6 +19,8 @@
#include "base.h"
#include <QSet>
namespace QSynedit {
class SynEditCppHighlighter: public SynHighlighter
{
enum TokenKind {
@ -219,4 +221,6 @@ public:
QString foldString() override;
};
}
#endif // SYNEDITCPPHIGHLIGHTER_H

View File

@ -19,6 +19,7 @@
#include <QFont>
namespace QSynedit {
static const QSet<QString> GLSLStatementKeyWords {
"if",
"for",
@ -1560,7 +1561,7 @@ SynHighlighterClass SynEditGLSLHighlighter::getClass() const
QString SynEditGLSLHighlighter::getName() const
{
return SYN_HIGHLIGHTER_CPP;
return SYN_HIGHLIGHTER_GLSL;
}
QString SynEditGLSLHighlighter::languageName()
@ -1587,3 +1588,4 @@ QSet<QString> SynEditGLSLHighlighter::keywords() const
{
return Keywords;
}
}

View File

@ -19,6 +19,8 @@
#include "base.h"
#include <QSet>
namespace QSynedit {
class SynEditGLSLHighlighter: public SynHighlighter
{
enum TokenKind {
@ -212,4 +214,5 @@ public:
QSet<QString> keywords() const override;
};
}
#endif // SYNEDITGLSLHIGHLIGHTER_H

View File

@ -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<SynEditCaretType>( intValue("caret_for_insert",static_cast<int>(SynEditCaretType::ctVerticalLine)));
mCaretForOverwrite = static_cast<SynEditCaretType>( intValue("caret_for_overwrite",static_cast<int>(SynEditCaretType::ctBlock)));
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)));
mCaretUseTextColor = boolValue("caret_use_text_color",true);
mCaretColor = colorValue("caret_color",Qt::yellow);
@ -1382,22 +1382,22 @@ void Settings::Editor::doLoad()
mShowFunctionTips = boolValue("show_function_tips",true);
}
SynEditCaretType Settings::Editor::caretForOverwrite() const
QSynedit::SynEditCaretType Settings::Editor::caretForOverwrite() const
{
return mCaretForOverwrite;
}
void Settings::Editor::setCaretForOverwrite(const SynEditCaretType &caretForOverwrite)
void Settings::Editor::setCaretForOverwrite(const QSynedit::SynEditCaretType &caretForOverwrite)
{
mCaretForOverwrite = caretForOverwrite;
}
SynEditCaretType Settings::Editor::caretForInsert() const
QSynedit::SynEditCaretType Settings::Editor::caretForInsert() const
{
return mCaretForInsert;
}
void Settings::Editor::setCaretForInsert(const SynEditCaretType &caretForInsert)
void Settings::Editor::setCaretForInsert(const QSynedit::SynEditCaretType &caretForInsert)
{
mCaretForInsert = caretForInsert;
}

View File

@ -142,11 +142,11 @@ public:
bool enhanceEndKey() const;
void setEnhanceEndKey(bool enhanceEndKey);
SynEditCaretType caretForInsert() const;
void setCaretForInsert(const SynEditCaretType &caretForInsert);
QSynedit::SynEditCaretType caretForInsert() const;
void setCaretForInsert(const QSynedit::SynEditCaretType &caretForInsert);
SynEditCaretType caretForOverwrite() const;
void setCaretForOverwrite(const SynEditCaretType &caretForOverwrite);
QSynedit::SynEditCaretType caretForOverwrite() const;
void setCaretForOverwrite(const QSynedit::SynEditCaretType &caretForOverwrite);
QColor caretColor() const;
void setCaretColor(const QColor &caretColor);
@ -379,8 +379,8 @@ public:
bool mEnhanceHomeKey;
bool mEnhanceEndKey;
bool mKeepCaretX;
SynEditCaretType mCaretForInsert;
SynEditCaretType mCaretForOverwrite;
QSynedit::SynEditCaretType mCaretForInsert;
QSynedit::SynEditCaretType mCaretForOverwrite;
bool mCaretUseTextColor;
QColor mCaretColor;

View File

@ -40,15 +40,15 @@ EditorGeneralWidget::~EditorGeneralWidget()
delete ui;
}
static void setCaretTypeIndex(QComboBox* combo, SynEditCaretType caretType) {
static void setCaretTypeIndex(QComboBox* combo, QSynedit::SynEditCaretType caretType) {
int t = static_cast<int>(caretType);
combo->setCurrentIndex(t);
}
static SynEditCaretType getCaretTypeIndex(QComboBox* combo) {
static QSynedit::SynEditCaretType getCaretTypeIndex(QComboBox* combo) {
if (combo->currentIndex()<0)
return SynEditCaretType::ctVerticalLine;
return static_cast<SynEditCaretType>(combo->currentIndex());
return QSynedit::SynEditCaretType::ctVerticalLine;
return static_cast<QSynedit::SynEditCaretType>(combo->currentIndex());
}
void EditorGeneralWidget::doLoad()
{

View File

@ -63,7 +63,7 @@ TodoThread::TodoThread(const QString& filename, QObject *parent): QThread(parent
void TodoThread::run()
{
PSynHighlighter highlighter = highlighterManager.getCppHighlighter();
QSynedit::PSynHighlighter highlighter = highlighterManager.getCppHighlighter();
emit parseStarted(mFilename);
auto action = finally([this]{
emit parseFinished();
@ -72,13 +72,13 @@ void TodoThread::run()
if (!pMainWindow->editorList()->getContentFromOpenedEditor(mFilename,lines)) {
return;
}
PSynHighlighterAttribute commentAttr = highlighter->getAttribute(SYNS_AttrComment);
QSynedit::PSynHighlighterAttribute commentAttr = highlighter->getAttribute(SYNS_AttrComment);
highlighter->resetState();
for (int i =0;i<lines.count();i++) {
highlighter->setLine(lines[i],i);
while (!highlighter->eol()) {
PSynHighlighterAttribute attr;
QSynedit::PSynHighlighterAttribute attr;
attr = highlighter->getTokenAttribute();
if (attr == commentAttr) {
QString token = highlighter->getToken();

View File

@ -123,7 +123,7 @@ void CPUDialog::setDisassembly(const QString& file, const QString& funcName,cons
ui->txtCode->document()->add(line);
}
if (activeLine!=-1)
ui->txtCode->setCaretXYEx(true,BufferCoord{1,activeLine+1});
ui->txtCode->setCaretXYEx(true,QSynedit::BufferCoord{1,activeLine+1});
}
void CPUDialog::resetEditorFont(float dpi)

View File

@ -80,7 +80,7 @@
</widget>
</item>
<item>
<widget class="SynEdit" name="txtCode">
<widget class="QSynedit::SynEdit" name="txtCode">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -224,7 +224,7 @@
</widget>
<customwidgets>
<customwidget>
<class>SynEdit</class>
<class>QSynedit::SynEdit</class>
<extends>QFrame</extends>
<header location="global">qsynedit/SynEdit.h</header>
<container>1</container>

View File

@ -56,8 +56,8 @@ void FilePropertiesDialog::calcFile(Editor *editor,
while (j<line.length() && (line[j]=='\t' || line[j]==' '))
j++;
QString token;
PSynHighlighterAttribute attr;
if (editor->getHighlighterAttriAtRowCol(BufferCoord{j+1,i+1},
QSynedit::PSynHighlighterAttribute attr;
if (editor->getHighlighterAttriAtRowCol(QSynedit::BufferCoord{j+1,i+1},
token,attr)) {
// if it is preprocessor...
if (attr->name() == SYNS_AttrPreprocessor) {

View File

@ -44,8 +44,8 @@ SearchDialog::SearchDialog(QWidget *parent) :
ui->dialogLayout->insertWidget(0,mTabBar);
connect(mTabBar,&QTabBar::currentChanged,this, &SearchDialog::onTabChanged);
mSearchOptions&=0;
mBasicSearchEngine= PSynSearchBase(new SynSearch());
mRegexSearchEngine= PSynSearchBase(new SynSearchRegex());
mBasicSearchEngine= QSynedit::PSynSearchBase(new QSynedit::SynSearch());
mRegexSearchEngine= QSynedit::PSynSearchBase(new QSynedit::SynSearchRegex());
}
SearchDialog::~SearchDialog()
@ -87,7 +87,7 @@ void SearchDialog::findInFiles(const QString &text)
show();
}
void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, SynSearchOptions options)
void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, QSynedit::SynSearchOptions options)
{
mTabBar->setCurrentIndex(2);
@ -106,10 +106,10 @@ void SearchDialog::findInFiles(const QString &keyword, SearchFileScope scope, Sy
break;
}
// Apply options
ui->chkRegExp->setChecked(options.testFlag(ssoRegExp));
ui->chkCaseSensetive->setChecked(options.testFlag(ssoMatchCase));
ui->chkWholeWord->setChecked(options.testFlag(ssoWholeWord));
ui->chkWrapAround->setChecked(options.testFlag(ssoWholeWord));
ui->chkRegExp->setChecked(options.testFlag(QSynedit::ssoRegExp));
ui->chkCaseSensetive->setChecked(options.testFlag(QSynedit::ssoMatchCase));
ui->chkWholeWord->setChecked(options.testFlag(QSynedit::ssoWholeWord));
ui->chkWrapAround->setChecked(options.testFlag(QSynedit::ssoWholeWord));
show();
}
@ -215,42 +215,42 @@ void SearchDialog::on_btnExecute_clicked()
// Apply options
if (ui->chkRegExp->isChecked()) {
mSearchOptions.setFlag(ssoRegExp);
mSearchOptions.setFlag(QSynedit::ssoRegExp);
}
if (ui->chkCaseSensetive->isChecked()) {
mSearchOptions.setFlag(ssoMatchCase);
mSearchOptions.setFlag(QSynedit::ssoMatchCase);
}
if (ui->chkWholeWord->isChecked()) {
mSearchOptions.setFlag(ssoWholeWord);
mSearchOptions.setFlag(QSynedit::ssoWholeWord);
}
if (ui->chkWrapAround->isChecked()) {
mSearchOptions.setFlag(ssoWrapAround);
mSearchOptions.setFlag(QSynedit::ssoWrapAround);
}
// Apply scope, when enabled
if (ui->grpScope->isEnabled()) {
if (ui->rbSelection->isChecked()) {
mSearchOptions.setFlag(ssoSelectedOnly);
mSearchOptions.setFlag(QSynedit::ssoSelectedOnly);
}
}
// Apply direction, when enabled
if (ui->grpDirection->isEnabled()) {
if (ui->rbBackward->isChecked()) {
mSearchOptions.setFlag(ssoBackwards);
mSearchOptions.setFlag(QSynedit::ssoBackwards);
}
}
// Apply origin, when enabled
if (ui->grpOrigin->isEnabled()) {
if (ui->rbEntireScope->isChecked()) {
mSearchOptions.setFlag(ssoEntireScope);
mSearchOptions.setFlag(QSynedit::ssoEntireScope);
}
}
// Use entire scope for file finding/replacing
if (actionType == SearchAction::FindFiles || actionType == SearchAction::ReplaceFiles) {
mSearchOptions.setFlag(ssoEntireScope);
mSearchOptions.setFlag(QSynedit::ssoEntireScope);
}
this->close();
@ -283,18 +283,18 @@ void SearchDialog::on_btnExecute_clicked()
QMessageBox::Yes|QMessageBox::YesAll|QMessageBox::No|QMessageBox::Cancel,
QMessageBox::Yes)) {
case QMessageBox::Yes:
return SynSearchAction::Replace;
return QSynedit::SynSearchAction::Replace;
case QMessageBox::YesAll:
return SynSearchAction::ReplaceAll;
return QSynedit::SynSearchAction::ReplaceAll;
case QMessageBox::No:
return SynSearchAction::Skip;
return QSynedit::SynSearchAction::Skip;
case QMessageBox::Cancel:
return SynSearchAction::Exit;
return QSynedit::SynSearchAction::Exit;
default:
return SynSearchAction::Exit;
return QSynedit::SynSearchAction::Exit;
}
} else {
return SynSearchAction::ReplaceAll;
return QSynedit::SynSearchAction::ReplaceAll;
}
},
[](){
@ -378,7 +378,7 @@ void SearchDialog::on_btnExecute_clicked()
results->results.append(parentItem);
}
} else if (fileExists(curFilename)) {
SynEdit editor;
QSynedit::SynEdit editor;
QByteArray realEncoding;
editor.document()->loadFromFile(curFilename,ENCODING_AUTO_DETECT, realEncoding);
fileSearched++;
@ -401,24 +401,24 @@ void SearchDialog::on_btnExecute_clicked()
}
}
int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString &sReplace,
SynSearchMathedProc matchCallback,
SynSearchConfirmAroundProc confirmAroundCallback)
int SearchDialog::execute(QSynedit::SynEdit *editor, const QString &sSearch, const QString &sReplace,
QSynedit::SynSearchMathedProc matchCallback,
QSynedit::SynSearchConfirmAroundProc confirmAroundCallback)
{
if (editor==nullptr)
return 0;
// Modify the caret when using 'from cursor' and when the selection is ignored
if (!mSearchOptions.testFlag(ssoEntireScope) && !mSearchOptions.testFlag(ssoSelectedOnly)
if (!mSearchOptions.testFlag(QSynedit::ssoEntireScope) && !mSearchOptions.testFlag(QSynedit::ssoSelectedOnly)
&& editor->selAvail()) {
// start at end of selection
if (mSearchOptions.testFlag(ssoBackwards)) {
if (mSearchOptions.testFlag(QSynedit::ssoBackwards)) {
editor->setCaretXY(editor->blockBegin());
} else {
editor->setCaretXY(editor->blockEnd());
}
}
if (mSearchOptions.testFlag(ssoRegExp)) {
if (mSearchOptions.testFlag(QSynedit::ssoRegExp)) {
mSearchEngine = mRegexSearchEngine;
} else {
mSearchEngine = mBasicSearchEngine;
@ -428,12 +428,12 @@ int SearchDialog::execute(SynEdit *editor, const QString &sSearch, const QString
mSearchEngine, matchCallback, confirmAroundCallback);
}
std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(SynEdit *e, const QString& filename,const QString &keyword)
std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(QSynedit::SynEdit *e, const QString& filename,const QString &keyword)
{
//backup
BufferCoord caretBackup = e->caretXY();
BufferCoord blockBeginBackup = e->blockBegin();
BufferCoord blockEndBackup = e->blockEnd();
QSynedit::BufferCoord caretBackup = e->caretXY();
QSynedit::BufferCoord blockBeginBackup = e->blockBegin();
QSynedit::BufferCoord blockEndBackup = e->blockEnd();
int toplineBackup = e->topLine();
int leftCharBackup = e->leftChar();
@ -452,7 +452,7 @@ std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(SynEdit *e
item->text = e->document()->getString(Line-1);
item->text.replace('\t',' ');
parentItem->results.append(item);
return SynSearchAction::Skip;
return QSynedit::SynSearchAction::Skip;
});
// restore
@ -486,7 +486,7 @@ QTabBar *SearchDialog::tabBar() const
return mTabBar;
}
PSynSearchBase SearchDialog::searchEngine() const
QSynedit::PSynSearchBase SearchDialog::searchEngine() const
{
return mSearchEngine;
}

View File

@ -46,9 +46,9 @@ public:
void findNext();
void findPrevious();
void findInFiles(const QString& text);
void findInFiles(const QString& keyword, SearchFileScope scope, SynSearchOptions options);
void findInFiles(const QString& keyword, SearchFileScope scope, QSynedit::SynSearchOptions options);
void replace(const QString& sFind, const QString& sReplace);
PSynSearchBase searchEngine() const;
QSynedit::PSynSearchBase searchEngine() const;
QTabBar *tabBar() const;
@ -60,18 +60,18 @@ private slots:
void on_btnExecute_clicked();
private:
int execute(SynEdit* editor, const QString& sSearch,
int execute(QSynedit::SynEdit* editor, const QString& sSearch,
const QString& sReplace,
SynSearchMathedProc matchCallback = nullptr,
SynSearchConfirmAroundProc confirmAroundCallback = nullptr);
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(SynEdit * editor,const QString& filename, const QString& keyword);
QSynedit::SynSearchMathedProc matchCallback = nullptr,
QSynedit::SynSearchConfirmAroundProc confirmAroundCallback = nullptr);
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(QSynedit::SynEdit * editor,const QString& filename, const QString& keyword);
private:
Ui::SearchDialog *ui;
QTabBar *mTabBar;
SynSearchOptions mSearchOptions;
PSynSearchBase mSearchEngine;
PSynSearchBase mBasicSearchEngine;
PSynSearchBase mRegexSearchEngine;
QSynedit::SynSearchOptions mSearchOptions;
QSynedit::PSynSearchBase mSearchEngine;
QSynedit::PSynSearchBase mBasicSearchEngine;
QSynedit::PSynSearchBase mRegexSearchEngine;
// QWidget interface
protected:

View File

@ -20,7 +20,7 @@
#include <QStyledItemDelegate>
#include "mainwindow.h"
PSearchResults SearchResultModel::addSearchResults(const QString &keyword, SynSearchOptions options, SearchFileScope scope)
PSearchResults SearchResultModel::addSearchResults(const QString &keyword, QSynedit::SynSearchOptions options, SearchFileScope scope)
{
int index=-1;
for (int i=0;i<mSearchResults.size();i++) {

View File

@ -46,7 +46,7 @@ struct SearchResultTreeItem {
};
struct SearchResults{
SynSearchOptions options;
QSynedit::SynSearchOptions 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,SynSearchOptions options,
PSearchResults addSearchResults(const QString& keyword,QSynedit::SynSearchOptions options,
SearchFileScope scope);
PSearchResults addSearchResults(
const QString& keyword,