This commit is contained in:
Roy Qu 2023-01-11 16:22:26 +08:00
parent abf4a5985f
commit 1761c66456
54 changed files with 555 additions and 558 deletions

View File

@ -22,7 +22,7 @@
#include <QJsonObject>
#include "utils.h"
#include "settings.h"
#include "qsynedit/Constants.h"
#include "qsynedit/constants.h"
ColorManager * pColorManager;

View File

@ -34,7 +34,7 @@
#include "qsynedit/exporter/rtfexporter.h"
#include "qsynedit/exporter/htmlexporter.h"
#include "qsynedit/exporter/qtsupportedhtmlexporter.h"
#include "qsynedit/Constants.h"
#include "qsynedit/constants.h"
#include <QGuiApplication>
#include <QClipboard>
#include <QPainter>
@ -82,7 +82,7 @@ Editor::Editor(QWidget *parent, const QString& filename,
const QByteArray& encoding,
Project* pProject, bool isNew,
QTabWidget* parentPageControl):
SynEdit(parent),
QSynEdit(parent),
mEncodingOption(encoding),
mFilename(QFileInfo(filename).absoluteFilePath()),
mParentPageControl(parentPageControl),
@ -150,18 +150,18 @@ Editor::Editor(QWidget *parent, const QString& filename,
//mLineBeforeTabStop="";
//mLineAfterTabStop = "";
connect(this,&SynEdit::statusChanged,this,&Editor::onStatusChanged);
connect(this,&QSynEdit::statusChanged,this,&Editor::onStatusChanged);
if (mParentPageControl)
connect(this,&SynEdit::gutterClicked,this,&Editor::onGutterClicked);
connect(this,&QSynEdit::gutterClicked,this,&Editor::onGutterClicked);
onStatusChanged(QSynedit::StatusChange::scOpenFile);
setAttribute(Qt::WA_Hover,true);
connect(this,&SynEdit::linesDeleted,
connect(this,&QSynEdit::linesDeleted,
this, &Editor::onLinesDeleted);
connect(this,&SynEdit::linesInserted,
connect(this,&QSynEdit::linesInserted,
this, &Editor::onLinesInserted);
setContextMenuPolicy(Qt::CustomContextMenu);
@ -578,17 +578,17 @@ void Editor::wheelEvent(QWheelEvent *event) {
return;
}
}
SynEdit::wheelEvent(event);
QSynEdit::wheelEvent(event);
}
void Editor::focusInEvent(QFocusEvent *event)
{
SynEdit::focusInEvent(event);
QSynEdit::focusInEvent(event);
}
void Editor::focusOutEvent(QFocusEvent *event)
{
SynEdit::focusOutEvent(event);
QSynEdit::focusOutEvent(event);
//pMainWindow->updateClassBrowserForEditor(nullptr);
if (!pMainWindow->isQuitting())
pMainWindow->functionTip()->hide();
@ -599,7 +599,7 @@ void Editor::keyPressEvent(QKeyEvent *event)
bool handled = false;
auto action = finally([&,this]{
if (!handled) {
SynEdit::keyPressEvent(event);
QSynEdit::keyPressEvent(event);
} else {
event->accept();
}
@ -1301,7 +1301,7 @@ bool Editor::event(QEvent *event)
}
}
}
return SynEdit::event(event);
return QSynEdit::event(event);
}
void Editor::mouseReleaseEvent(QMouseEvent *event)
@ -1331,12 +1331,12 @@ void Editor::mouseReleaseEvent(QMouseEvent *event)
}
}
}
QSynedit::SynEdit::mouseReleaseEvent(event);
QSynedit::QSynEdit::mouseReleaseEvent(event);
}
void Editor::inputMethodEvent(QInputMethodEvent *event)
{
QSynedit::SynEdit::inputMethodEvent(event);
QSynedit::QSynEdit::inputMethodEvent(event);
QString s = event->commitString();
if (s.isEmpty())
return;
@ -1403,7 +1403,7 @@ void Editor::showEvent(QShowEvent */*event*/)
connect(mParser.get(),
&CppParser::onEndParsing,
this,
&QSynedit::SynEdit::invalidate);
&QSynedit::QSynEdit::invalidate);
reparse(false);
}
if (mParentPageControl) {
@ -1446,7 +1446,7 @@ void Editor::hideEvent(QHideEvent */*event*/)
disconnect(mParser.get(),
&CppParser::onEndParsing,
this,
&QSynedit::SynEdit::invalidate);
&QSynedit::QSynEdit::invalidate);
}
pMainWindow->updateForEncodingInfo(nullptr);
pMainWindow->updateStatusbarForLineCol(nullptr);
@ -1457,7 +1457,7 @@ void Editor::hideEvent(QHideEvent */*event*/)
void Editor::resizeEvent(QResizeEvent *event)
{
QSynedit::SynEdit::resizeEvent(event);
QSynedit::QSynEdit::resizeEvent(event);
pMainWindow->functionTip()->hide();
}
@ -1482,7 +1482,7 @@ void Editor::copyToClipboard()
copyAsHTML();
break;;
default:
QSynedit::SynEdit::copyToClipboard();
QSynedit::QSynEdit::copyToClipboard();
}
}
@ -1502,7 +1502,7 @@ void Editor::cutToClipboard()
return;
}
}
QSynedit::SynEdit::cutToClipboard();
QSynedit::QSynEdit::cutToClipboard();
}
void Editor::copyAsHTML()
@ -4135,7 +4135,7 @@ void Editor::setProject(Project *pProject)
connect(mParser.get(),
&CppParser::onEndParsing,
this,
&QSynedit::SynEdit::invalidate);
&QSynedit::QSynEdit::invalidate);
} else {
invalidate();
}
@ -4207,7 +4207,7 @@ void Editor::gotoDefinition(const QSynedit::BufferCoord &pos)
}
}
QString getWordAtPosition(QSynedit::SynEdit *editor, const QSynedit::BufferCoord &p, QSynedit::BufferCoord &pWordBegin, QSynedit::BufferCoord &pWordEnd, Editor::WordPurpose purpose)
QString getWordAtPosition(QSynedit::QSynEdit *editor, const QSynedit::BufferCoord &p, QSynedit::BufferCoord &pWordBegin, QSynedit::BufferCoord &pWordEnd, Editor::WordPurpose purpose)
{
QString result = "";
QString s;
@ -4631,7 +4631,7 @@ void Editor::tab()
return;
}
}
SynEdit::tab();
QSynEdit::tab();
}
int Editor::gutterClickedLine() const

View File

@ -20,7 +20,7 @@
#include <QObject>
#include <utils.h>
#include <QTabWidget>
#include "qsynedit/SynEdit.h"
#include "qsynedit/qsynedit.h"
#include "colorscheme.h"
#include "common.h"
#include "parser/cppparser.h"
@ -55,7 +55,7 @@ private:
QByteArray mReasonBuffer;
};
class Editor : public QSynedit::SynEdit
class Editor : public QSynedit::QSynEdit
{
Q_OBJECT
public:
@ -400,7 +400,7 @@ protected:
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
};
QString getWordAtPosition(QSynedit::SynEdit* editor,
QString getWordAtPosition(QSynedit::QSynEdit* editor,
const QSynedit::BufferCoord& p,
QSynedit::BufferCoord& pWordBegin,
QSynedit::BufferCoord& pWordEnd,

View File

@ -20,7 +20,7 @@
#include "editor.h"
#include "systemconsts.h"
#include "settings.h"
#include "qsynedit/Constants.h"
#include "qsynedit/constants.h"
#include "debugger.h"
#include "widgets/cpudialog.h"
#include "widgets/filepropertiesdialog.h"

View File

@ -23,7 +23,7 @@
#include <QColor>
#include <QString>
#include <QPair>
#include "qsynedit/SynEdit.h"
#include "qsynedit/qsynedit.h"
#include "compiler/compilerinfo.h"
#include "utils.h"

View File

@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tabSnippet">
<attribute name="title">

View File

@ -17,13 +17,13 @@
#include "syntaxermanager.h"
#include <QFileInfo>
#include <QObject>
#include "qsynedit/Constants.h"
#include "qsynedit/constants.h"
#include "qsynedit/syntaxer/cpp.h"
#include "qsynedit/syntaxer/asm.h"
#include "qsynedit/syntaxer/glsl.h"
#include "qsynedit/syntaxer/makefile.h"
#include "qsynedit/Constants.h"
#include "qsynedit/constants.h"
#include "colorscheme.h"
SyntaxerManager syntaxerManager;

View File

@ -22,7 +22,7 @@
#include <QMutex>
#include <QAbstractListModel>
#include "syntaxermanager.h"
#include "qsynedit/Constants.h"
#include "qsynedit/constants.h"
struct TodoItem {
QString filename;

View File

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

View File

@ -19,7 +19,7 @@
#include "../mainwindow.h"
#include "../editorlist.h"
#include "../editor.h"
#include <qsynedit/Constants.h>
#include <qsynedit/constants.h>
#include <QFileInfo>

View File

@ -2,8 +2,8 @@
#include "ui_replacedialog.h"
#include <QMessageBox>
#include <memory>
#include <qsynedit/Search.h>
#include <qsynedit/SearchRegex.h>
#include <qsynedit/searcher/basicsearcher.h>
#include <qsynedit/searcher/regexsearcher.h>
#include "../utils.h"
#include "../editor.h"
#include "../editorlist.h"

View File

@ -2,7 +2,7 @@
#define REPLACEDIALOG_H
#include <QDialog>
#include <qsynedit/SearchBase.h>
#include <qsynedit/searcher/baseseacher.h>
namespace Ui {
class ReplaceDialog;

View File

@ -3,8 +3,8 @@
#include <QMessageBox>
#include <memory>
#include <qsynedit/Search.h>
#include <qsynedit/SearchRegex.h>
#include <qsynedit/searcher/basicsearcher.h>
#include <qsynedit/searcher/regexsearcher.h>
#include "../utils.h"
#include "../editor.h"
#include "../editorlist.h"

View File

@ -2,7 +2,7 @@
#define SEARCHDIALOG_H
#include <QDialog>
#include <qsynedit/SearchBase.h>
#include <qsynedit/searcher/baseseacher.h>
namespace Ui {
class SearchDialog;

View File

@ -20,8 +20,8 @@
#include "../editor.h"
#include "../mainwindow.h"
#include "../editorlist.h"
#include <qsynedit/Search.h>
#include <qsynedit/SearchRegex.h>
#include <qsynedit/searcher/basicsearcher.h>
#include <qsynedit/searcher/regexsearcher.h>
#include "../project.h"
#include "../settings.h"
#include <QMessageBox>
@ -184,7 +184,7 @@ void SearchInFileDialog::doSearch(bool replace)
results->results.append(parentItem);
}
} else if (fileExists(curFilename)) {
QSynedit::SynEdit editor;
QSynedit::QSynEdit editor;
QByteArray realEncoding;
editor.document()->loadFromFile(curFilename,ENCODING_AUTO_DETECT, realEncoding);
fileSearched++;
@ -207,7 +207,7 @@ void SearchInFileDialog::doSearch(bool replace)
}
int SearchInFileDialog::execute(QSynedit::SynEdit *editor, const QString &sSearch, const QString &sReplace,
int SearchInFileDialog::execute(QSynedit::QSynEdit *editor, const QString &sSearch, const QString &sReplace,
QSynedit::SearchMathedProc matchCallback,
QSynedit::SearchConfirmAroundProc confirmAroundCallback)
{
@ -235,7 +235,7 @@ int SearchInFileDialog::execute(QSynedit::SynEdit *editor, const QString &sSearc
searchEngine, matchCallback, confirmAroundCallback);
}
std::shared_ptr<SearchResultTreeItem> SearchInFileDialog::batchFindInEditor(QSynedit::SynEdit *e, const QString& filename,const QString &keyword)
std::shared_ptr<SearchResultTreeItem> SearchInFileDialog::batchFindInEditor(QSynedit::QSynEdit *e, const QString& filename,const QString &keyword)
{
//backup
QSynedit::BufferCoord caretBackup = e->caretXY();

View File

@ -18,7 +18,7 @@
#define SEARCHINFILEDIALOG_H
#include <QDialog>
#include <qsynedit/SynEdit.h>
#include <qsynedit/qsynedit.h>
#include "../utils.h"
namespace Ui {
@ -49,11 +49,11 @@ private slots:
private:
void doSearch(bool replace);
int execute(QSynedit::SynEdit* editor, const QString& sSearch,
int execute(QSynedit::QSynEdit* editor, const QString& sSearch,
const QString& sReplace,
QSynedit::SearchMathedProc matchCallback = nullptr,
QSynedit::SearchConfirmAroundProc confirmAroundCallback = nullptr);
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(QSynedit::SynEdit * editor,const QString& filename, const QString& keyword);
std::shared_ptr<SearchResultTreeItem> batchFindInEditor(QSynedit::QSynEdit * editor,const QString& filename, const QString& keyword);
private:
Ui::SearchInFileDialog *ui;
QSynedit::SearchOptions mSearchOptions;

View File

@ -20,7 +20,7 @@
#include <QTreeView>
#include <QMap>
#include <QStyledItemDelegate>
#include "qsynedit/SearchBase.h"
#include "qsynedit/searcher/baseseacher.h"
#include "utils.h"
#define MAX_SEARCH_RESULTS 20

View File

@ -19,45 +19,46 @@ msvc {
DEFINES += NOMINMAX
}
SOURCES += qsynedit/CodeFolding.cpp \
qsynedit/Constants.cpp \
qsynedit/KeyStrokes.cpp \
qsynedit/MiscClasses.cpp \
qsynedit/MiscProcs.cpp \
qsynedit/SynEdit.cpp \
qsynedit/TextBuffer.cpp \
qsynedit/TextPainter.cpp \
SOURCES += qsynedit/codefolding.cpp \
qsynedit/constants.cpp \
qsynedit/document.cpp \
qsynedit/keyStrokes.cpp \
qsynedit/miscprocs.cpp \
qsynedit/exporter/exporter.cpp \
qsynedit/exporter/htmlexporter.cpp \
qsynedit/exporter/qtsupportedhtmlexporter.cpp \
qsynedit/exporter/rtfexporter.cpp \
qsynedit/gutter.cpp \
qsynedit/painter.cpp \
qsynedit/qsynedit.cpp \
qsynedit/searcher/baseseacher.cpp \
qsynedit/searcher/basicsearcher.cpp \
qsynedit/searcher/regexsearcher.cpp \
qsynedit/syntaxer/asm.cpp \
qsynedit/syntaxer/cpp.cpp \
qsynedit/syntaxer/customhighlighterv1.cpp \
qsynedit/syntaxer/glsl.cpp \
qsynedit/Search.cpp \
qsynedit/SearchBase.cpp \
qsynedit/SearchRegex.cpp \
qsynedit/Types.cpp \
qsynedit/types.cpp \
qsynedit/syntaxer/makefile.cpp \
qsynedit/syntaxer/syntaxer.cpp
HEADERS += qsynedit/Search.h \
qsynedit/SearchBase.h \
qsynedit/SearchRegex.h \
qsynedit/CodeFolding.h \
qsynedit/Constants.h \
qsynedit/KeyStrokes.h \
qsynedit/MiscClasses.h \
qsynedit/MiscProcs.h \
qsynedit/SynEdit.h \
qsynedit/TextBuffer.h \
qsynedit/TextPainter.h \
qsynedit/Types.h \
HEADERS += \
qsynedit/codefolding.h \
qsynedit/constants.h \
qsynedit/document.h \
qsynedit/keystrokes.h \
qsynedit/miscprocs.h \
qsynedit/types.h \
qsynedit/exporter/exporter.h \
qsynedit/exporter/htmlexporter.h \
qsynedit/exporter/qtsupportedhtmlexporter.h \
qsynedit/exporter/rtfexporter.h \
qsynedit/gutter.h \
qsynedit/painter.h \
qsynedit/qsynedit.h \
qsynedit/searcher/baseseacher.h \
qsynedit/searcher/basicsearcher.h \
qsynedit/searcher/regexsearcher.h \
qsynedit/syntaxer/asm.h \
qsynedit/syntaxer/cpp.h \
qsynedit/syntaxer/customhighlighterv1.h \

View File

@ -14,33 +14,12 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "CodeFolding.h"
#include "Constants.h"
#include "codefolding.h"
#include "constants.h"
namespace QSynedit {
int CodeFoldingDefines::count()
{
return fRegions.size();
}
PCodeFoldingDefine CodeFoldingDefines::add(bool addEnding, const QChar &openSymbol, const QChar &closeSymbol, const QString &highlight)
{
PCodeFoldingDefine region = std::make_shared<CodeFoldingDefine>();
region->addEnding = addEnding;
region->openSymbol = openSymbol;
region->closeSymbol = closeSymbol;
region->highlight = highlight;
fRegions.push_back(region);
return region;
}
PCodeFoldingDefine CodeFoldingDefines::get(int index)
{
return fRegions.at(index);
}
CodeFoldingOptions::CodeFoldingOptions():
indentGuides(true),
fillIndents(false),

View File

@ -22,27 +22,6 @@
#include <QVector>
namespace QSynedit {
struct CodeFoldingDefine;
using PCodeFoldingDefine = std::shared_ptr<CodeFoldingDefine> ;
class CodeFoldingDefines {
private:
std::vector<PCodeFoldingDefine> fRegions;
public:
int count();
PCodeFoldingDefine add(bool addEnding, const QChar& openSymbol, const QChar& closeSymbol, const QString& highlight);
PCodeFoldingDefine get(int index);
};
typedef std::shared_ptr<CodeFoldingDefines> PSynFoldRegions;
struct CodeFoldingDefine {
bool addEnding;
QChar openSymbol;
QChar closeSymbol;
QString highlight;
};
struct CodeFoldingOptions {
bool indentGuides;
bool fillIndents;
@ -60,13 +39,14 @@ class CodeFoldingRanges;
typedef std::shared_ptr<CodeFoldingRanges> PCodeFoldingRanges;
class CodeFoldingRanges{
private:
QVector<PCodeFoldingRange> mRanges;
public:
explicit CodeFoldingRanges();
CodeFoldingRanges& operator=(const CodeFoldingRanges&)=delete;
PCodeFoldingRange range(int index);
void clear();
int count() const;
CodeFoldingRanges();
PCodeFoldingRange addByParts(PCodeFoldingRange parent, PCodeFoldingRanges allFold,
int fromLine, int toLine);
@ -74,11 +54,16 @@ public:
void remove(int index);
void add(PCodeFoldingRange foldRange);
PCodeFoldingRange operator[](int index) const;
private:
QVector<PCodeFoldingRange> mRanges;
};
// A single fold
class CodeFoldingRange {
public:
explicit CodeFoldingRange(PCodeFoldingRange parent, int fromLine, int toLine);
CodeFoldingRange(const CodeFoldingRange&)=delete;
CodeFoldingRange& operator=(const CodeFoldingRange&)=delete;
int fromLine; // Beginning line
int toLine; // End line
int linesCollapsed; // Number of collapsed lines
@ -88,7 +73,6 @@ public:
std::weak_ptr<CodeFoldingRange> parent;
bool parentCollapsed();
void move(int count);
explicit CodeFoldingRange(PCodeFoldingRange parent, int fromLine, int toLine);
};
}

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "Constants.h"
#include "constants.h"
namespace QSynedit {
const QSet<QChar> WordBreakChars{'.', ',', ';', ':',

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "TextBuffer.h"
#include "document.h"
#include "qt_utils/utils.h"
#include <QDataStream>
#include <QFile>
@ -22,7 +22,7 @@
#include <QTextStream>
#include <QMutexLocker>
#include <stdexcept>
#include "SynEdit.h"
#include "qsynedit.h"
#include <QMessageBox>
#include <cmath>
#include "qt_utils/charsetinfo.h"

View File

@ -24,8 +24,8 @@
#include <QVector>
#include <memory>
#include <QFile>
#include "MiscProcs.h"
#include "Types.h"
#include "miscprocs.h"
#include "types.h"
#include "qt_utils/utils.h"
namespace QSynedit {

View File

@ -18,7 +18,7 @@
#define EXPORTER_H
#include <QString>
#include "../SynEdit.h"
#include "../qsynedit.h"
namespace QSynedit {
using FormatTokenHandler = std::function<void(PSyntaxer syntaxHighlighter, int line, int column, const QString& token,
@ -28,6 +28,8 @@ class Exporter
public:
explicit Exporter(int tabSize, const QByteArray charset);
Exporter(const Exporter&)=delete;
Exporter& operator=(const Exporter&)=delete;
/**
* @brief Clears the output buffer and any internal data that relates to the last

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "htmlexporter.h"
#include "../MiscProcs.h"
#include "../miscprocs.h"
#include <functional>
namespace QSynedit {

View File

@ -23,7 +23,10 @@ namespace QSynedit {
class HTMLExporter : public Exporter
{
public:
HTMLExporter(int tabSize,const QByteArray charset);
explicit HTMLExporter(int tabSize,const QByteArray charset);
HTMLExporter(const HTMLExporter&)=delete;
const HTMLExporter& operator=(const HTMLExporter&)=delete;
bool createHTMLFragment() const;
void setCreateHTMLFragment(bool createHTMLFragment);

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "qtsupportedhtmlexporter.h"
#include "../MiscProcs.h"
#include "../miscprocs.h"
#include <functional>
namespace QSynedit {

View File

@ -7,7 +7,10 @@ namespace QSynedit {
class QtSupportedHtmlExporter : public Exporter
{
public:
QtSupportedHtmlExporter(int tabSize,const QByteArray charset);
explicit QtSupportedHtmlExporter(int tabSize,const QByteArray charset);
QtSupportedHtmlExporter(const QtSupportedHtmlExporter&)=delete;
QtSupportedHtmlExporter& operator=(const QtSupportedHtmlExporter&)=delete;
bool createHTMLFragment() const;
void setCreateHTMLFragment(bool createHTMLFragment);

View File

@ -25,6 +25,8 @@ class RTFExporter : public Exporter
{
public:
explicit RTFExporter(int tabSize,const QByteArray charset);
RTFExporter(const RTFExporter&)=delete;
RTFExporter& operator=(const RTFExporter&)=delete;
private:
bool mAttributesChanged;
QList<QColor> mListColors;

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "MiscClasses.h"
#include "gutter.h"
#include "algorithm"
namespace QSynedit {

View File

@ -14,13 +14,13 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MISCCLASSES_H
#define MISCCLASSES_H
#ifndef GUTTER_H
#define GUTTER_H
#include <QColor>
#include <QFont>
#include <QObject>
#include "Types.h"
#include "types.h"
namespace QSynedit {
@ -34,6 +34,8 @@ class Gutter : public QObject {
Q_OBJECT
public:
explicit Gutter(QObject* parent = nullptr);
Gutter(const Gutter&)=delete;
Gutter& operator=(const Gutter&)=delete;
QFont font() const;
void setFont(const QFont &value);
@ -128,4 +130,4 @@ using PSynGutter = std::shared_ptr<Gutter>;
}
#endif // MISCCLASSES_H
#endif // GUTTER_H

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "KeyStrokes.h"
#include "MiscProcs.h"
#include "keystrokes.h"
#include "miscprocs.h"
namespace QSynedit {
EditKeyStroke::EditKeyStroke()
@ -99,7 +99,7 @@ void EditKeyStroke::setCommand(const EditCommand &command)
mCommand = command;
}
KeyError::KeyError(const QString &reason):BaseError(reason)
EditKeyStrokes::EditKeyStrokes()
{
}

View File

@ -20,7 +20,7 @@
#include <QKeySequence>
#include <QList>
#include <memory>
#include "MiscClasses.h"
#include "gutter.h"
#include "qt_utils/utils.h"
namespace QSynedit {
@ -170,15 +170,13 @@ enum class EditCommand {
UserFirst = 1001, // Start of user-defined commands
};
class KeyError: public BaseError {
public:
explicit KeyError(const QString& reason);
};
class EditKeyStroke
{
public:
explicit EditKeyStroke();
EditKeyStroke(const EditKeyStroke&)=delete;
EditKeyStroke& operator=(const EditKeyStroke&)=delete;
QKeySequence keySequence() const;
void setKeySequence(QKeySequence& keySequence);
int key() const;
@ -210,6 +208,10 @@ using EditKeyStrokeList = QList<PEditKeyStroke>;
class EditKeyStrokes {
public:
explicit EditKeyStrokes();
EditKeyStrokes(const EditKeyStrokes&)=delete;
EditKeyStrokes& operator=(const EditKeyStrokes&)=delete;
PEditKeyStroke add(EditCommand command, int key, Qt::KeyboardModifiers modifiers);
PEditKeyStroke findCommand(EditCommand command);
PEditKeyStroke findKeycode(int key, Qt::KeyboardModifiers modifiers);

View File

@ -14,7 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "MiscProcs.h"
#include "miscprocs.h"
#include <QFile>
#include <QPainter>
#include <QTextStream>

View File

@ -14,15 +14,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "TextPainter.h"
#include "SynEdit.h"
#include "Constants.h"
#include "painter.h"
#include "qsynedit.h"
#include "constants.h"
#include <cmath>
#include <QDebug>
namespace QSynedit {
SynEditTextPainter::SynEditTextPainter(SynEdit *edit, QPainter *painter, int FirstRow, int LastRow, int FirstCol, int LastCol)
QSynEditPainter::QSynEditPainter(QSynEdit *edit, QPainter *painter, int FirstRow, int LastRow, int FirstCol, int LastCol)
{
this->edit = edit;
this->painter = painter;
@ -32,7 +32,7 @@ SynEditTextPainter::SynEditTextPainter(SynEdit *edit, QPainter *painter, int Fir
this->LastCol = LastCol;
}
void SynEditTextPainter::paintTextLines(const QRect& clip)
void QSynEditPainter::paintTextLines(const QRect& clip)
{
painter->fillRect(clip, edit->mBackgroundColor);
AClip = clip;
@ -89,7 +89,7 @@ void SynEditTextPainter::paintTextLines(const QRect& clip)
paintFoldAttributes();
}
void SynEditTextPainter::paintGutter(const QRect& clip)
void QSynEditPainter::paintGutter(const QRect& clip)
{
int cRow;
QRect rcLine, rcFold;
@ -237,7 +237,7 @@ void SynEditTextPainter::paintGutter(const QRect& clip)
}
}
QColor SynEditTextPainter::colEditorBG()
QColor QSynEditPainter::colEditorBG()
{
if (edit->mActiveLineColor.isValid() && bCurrentLine) {
return edit->mActiveLineColor;
@ -246,7 +246,7 @@ QColor SynEditTextPainter::colEditorBG()
}
}
void SynEditTextPainter::computeSelectionInfo()
void QSynEditPainter::computeSelectionInfo()
{
BufferCoord vStart{0,0};
BufferCoord vEnd{0,0};
@ -312,7 +312,7 @@ void SynEditTextPainter::computeSelectionInfo()
}
}
void SynEditTextPainter::setDrawingColors(bool selected)
void QSynEditPainter::setDrawingColors(bool selected)
{
if (selected) {
if (colSelFG.isValid())
@ -331,12 +331,12 @@ void SynEditTextPainter::setDrawingColors(bool selected)
}
}
int SynEditTextPainter::columnToXValue(int col)
int QSynEditPainter::columnToXValue(int col)
{
return edit->textOffset() + (col - 1) * edit->mCharWidth;
}
void SynEditTextPainter::paintToken(const QString &token, int tokenCols, int columnsBefore,
void QSynEditPainter::paintToken(const QString &token, int tokenCols, int columnsBefore,
int first, int last, bool /*isSelection*/, const QFont& font,
const QFont& fontForNonAscii, bool showGlyphs)
{
@ -426,7 +426,7 @@ void SynEditTextPainter::paintToken(const QString &token, int tokenCols, int col
}
}
void SynEditTextPainter::paintEditAreas(const EditingAreaList &areaList)
void QSynEditPainter::paintEditAreas(const EditingAreaList &areaList)
{
QRect rc;
int x1,x2;
@ -478,7 +478,7 @@ void SynEditTextPainter::paintEditAreas(const EditingAreaList &areaList)
}
}
void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
void QSynEditPainter::paintHighlightToken(bool bFillToEOL)
{
bool bComplexToken;
int nC1, nC2, nC1Sel, nC2Sel;
@ -593,7 +593,7 @@ void SynEditTextPainter::paintHighlightToken(bool bFillToEOL)
// Store the token chars with the attributes in the TokenAccu
// 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,
void QSynEditPainter::addHighlightToken(const QString &token, int columnsBefore,
int tokenColumns, int cLine, PTokenAttribute attri, bool showGlyphs)
{
bool bCanAppend;
@ -657,7 +657,7 @@ void SynEditTextPainter::addHighlightToken(const QString &token, int columnsBefo
}
}
void SynEditTextPainter::paintFoldAttributes()
void QSynEditPainter::paintFoldAttributes()
{
int TabSteps, LineIndent, LastNonBlank, X, Y, cRow, vLine;
// Paint indent guides. Use folds to determine indent value of these
@ -764,7 +764,7 @@ void SynEditTextPainter::paintFoldAttributes()
}
void SynEditTextPainter::getBraceColorAttr(int level, PTokenAttribute &attr)
void QSynEditPainter::getBraceColorAttr(int level, PTokenAttribute &attr)
{
if (!edit->mOptions.testFlag(EditorOption::eoShowRainbowColor))
return;
@ -789,7 +789,7 @@ void SynEditTextPainter::getBraceColorAttr(int level, PTokenAttribute &attr)
attr = oldAttr;
}
void SynEditTextPainter::paintLines()
void QSynEditPainter::paintLines()
{
int cRow; // row index for the loop
int vLine;
@ -963,8 +963,8 @@ void SynEditTextPainter::paintLines()
sToken = edit->mSyntaxer->getToken();
// Maybe should also test whether GetTokenPos changed...
if (sToken.isEmpty()) {
qDebug()<<SynEdit::tr("The highlighter seems to be in an infinite loop");
throw BaseError(SynEdit::tr("The highlighter seems to be in an infinite loop"));
qDebug()<<QSynEdit::tr("The highlighter seems to be in an infinite loop");
throw BaseError(QSynEdit::tr("The highlighter seems to be in an infinite loop"));
}
}
//nTokenColumnsBefore = edit->charToColumn(sLine,edit->mHighlighter->getTokenPos()+1)-1;

View File

@ -14,19 +14,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TEXTPAINTER_H
#define TEXTPAINTER_H
#ifndef PAINTER_H
#define PAINTER_H
#include <QColor>
#include <QPainter>
#include <QString>
#include "Types.h"
#include "types.h"
#include "syntaxer/syntaxer.h"
#include "MiscClasses.h"
#include "gutter.h"
namespace QSynedit {
class SynEdit;
class SynEditTextPainter
class QSynEdit;
class QSynEditPainter
{
struct SynTokenAccu {
int columns;
@ -39,7 +39,7 @@ class SynEditTextPainter
};
public:
SynEditTextPainter(SynEdit * edit,QPainter* painter,int FirstRow, int LastRow,
QSynEditPainter(QSynEdit * edit,QPainter* painter,int FirstRow, int LastRow,
int FirstCol, int LastCol);
void paintTextLines(const QRect& clip);
void paintGutter(const QRect& clip);
@ -62,7 +62,7 @@ private:
void paintLines();
private:
SynEdit* edit;
QSynEdit* edit;
QPainter* painter;
bool bDoRightEdge; // right edge
int nRightEdge;
@ -89,4 +89,4 @@ private:
}
#endif // TEXTPAINTER_H
#endif // PAINTER_H

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef SYNEDIT_H
#define SYNEDIT_H
#ifndef QSYNEDIT_H
#define QSYNEDIT_H
#include <QAbstractScrollArea>
#include <QCursor>
@ -24,12 +24,12 @@
#include <QStringList>
#include <QTimer>
#include <QWidget>
#include "MiscClasses.h"
#include "CodeFolding.h"
#include "Types.h"
#include "TextBuffer.h"
#include "KeyStrokes.h"
#include "SearchBase.h"
#include "gutter.h"
#include "codefolding.h"
#include "types.h"
#include "document.h"
#include "keystrokes.h"
#include "searcher/baseseacher.h"
namespace QSynedit {
@ -130,14 +130,14 @@ using SearchMathedProc = std::function<SearchAction(const QString& sSearch,
const QString& sReplace, int Line, int ch, int wordLen)>;
using SearchConfirmAroundProc = std::function<bool ()>;
class SynEdit;
using PSynEdit = std::shared_ptr<SynEdit>;
class QSynEdit;
using PSynEdit = std::shared_ptr<QSynEdit>;
class SynEdit : public QAbstractScrollArea
class QSynEdit : public QAbstractScrollArea
{
Q_OBJECT
public:
explicit SynEdit(QWidget* parent=nullptr);
explicit QSynEdit(QWidget* parent=nullptr);
/**
* Returns how many rows are there in the editor
* @return
@ -739,7 +739,7 @@ private:
BufferCoord mDragSelEndSave;
bool mDropped;
friend class SynEditTextPainter;
friend class QSynEditPainter;
// QWidget interface
protected:
@ -787,4 +787,4 @@ protected:
};
}
#endif // SYNEDIT_H
#endif // QSYNEDIT_H

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "asm.h"
#include "../Constants.h"
#include "../constants.h"
#include <QDebug>
namespace QSynedit {

View File

@ -45,6 +45,9 @@ class ASMSyntaxer : public Syntaxer
public:
explicit ASMSyntaxer();
ASMSyntaxer(const ASMSyntaxer&)=delete;
ASMSyntaxer& operator=(const ASMSyntaxer&)=delete;
const PTokenAttribute &numberAttribute() const;
const PTokenAttribute &directiveAttribute() const;
const PTokenAttribute &labelAttribute() const;

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "cpp.h"
#include "../Constants.h"
#include "../constants.h"
#include <QFont>
#include <QDebug>

View File

@ -55,6 +55,8 @@ class CppSyntaxer: public Syntaxer
public:
explicit CppSyntaxer();
CppSyntaxer(const CppSyntaxer&)=delete;
CppSyntaxer operator=(const CppSyntaxer&)=delete;
const PTokenAttribute &asmAttribute() const;

View File

@ -13,6 +13,8 @@ public:
};
CustomHighlighterV1();
CustomHighlighterV1(const CustomHighlighterV1&)=delete;
CustomHighlighterV1& operator=(const CustomHighlighterV1&)=delete;
// bool getTokenFinished() const override;
// bool isLastLineCommentNotFinished(int state) const override;
// bool isLastLineStringNotFinished(int state) const override;

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "glsl.h"
#include "../Constants.h"
#include "../constants.h"
#include <QFont>

View File

@ -54,6 +54,8 @@ class GLSLSyntaxer: public Syntaxer
public:
explicit GLSLSyntaxer();
GLSLSyntaxer(const GLSLSyntaxer&)=delete;
GLSLSyntaxer& operator=(const GLSLSyntaxer&)=delete;
const PTokenAttribute &asmAttribute() const;

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "makefile.h"
#include "../Constants.h"
#include "../constants.h"
//#include <QDebug>
namespace QSynedit {

View File

@ -67,6 +67,8 @@ class MakefileSyntaxer : public Syntaxer
public:
explicit MakefileSyntaxer();
MakefileSyntaxer(const MakefileSyntaxer&)=delete;
MakefileSyntaxer& operator=(const MakefileSyntaxer&)=delete;
static const QSet<QString> Directives;
private:

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "syntaxer.h"
#include "../Constants.h"
#include "../constants.h"
namespace QSynedit {
Syntaxer::Syntaxer() :

View File

@ -24,7 +24,7 @@
#include <QSet>
#include <QVector>
#include <QVector>
#include "../Types.h"
#include "../types.h"
namespace QSynedit {
enum IndentType {
@ -92,6 +92,8 @@ enum class ProgrammingLanguage {
class TokenAttribute {
public:
explicit TokenAttribute(const QString& name, TokenType mTokenType);
TokenAttribute(const TokenAttribute&)=delete;
TokenAttribute& operator=(const TokenAttribute&)=delete;
QString name() const;
@ -119,6 +121,8 @@ typedef std::shared_ptr<TokenAttribute> PTokenAttribute;
class Syntaxer {
public:
explicit Syntaxer();
Syntaxer(const Syntaxer&)=delete;
Syntaxer& operator=(const Syntaxer&)=delete;
const QMap<QString, PTokenAttribute>& attributes() const;

View File

@ -14,8 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "Types.h"
#include "SynEdit.h"
#include "types.h"
#include "qsynedit.h"
#include <QDebug>
namespace QSynedit {

View File

@ -40,6 +40,10 @@ class CharsetInfoManager: public QObject {
Q_OBJECT
public:
explicit CharsetInfoManager(const QString& localeName);
explicit CharsetInfoManager(CharsetInfoManager&) = delete;
CharsetInfoManager& operator=(CharsetInfoManager&) = delete;
QByteArray getDefaultSystemEncoding();
PCharsetInfo findCharsetByCodepage(int codepage);
QStringList languageNames();