aboutsummaryrefslogtreecommitdiffhomepage
path: root/qt/ScintillaEdit/ScintillaDocument.cpp
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2021-05-24 19:31:06 +1000
committerNeil <nyamatongwe@gmail.com>2021-05-24 19:31:06 +1000
commit92290868cf9753d2df0d494cb44e2ff62a570b58 (patch)
tree001e6cfce84372a03997de3138d630751ee8d38a /qt/ScintillaEdit/ScintillaDocument.cpp
parentee1886079d0a5cd350ee8e3379be347943ba93ae (diff)
downloadscintilla-mirror-92290868cf9753d2df0d494cb44e2ff62a570b58.tar.gz
Define C++ version of the Scintilla API in ScintillaTypes.h, ScintillaMessages.h
and ScintillaStructures.h using scoped enumerations. Use these headers instead of Scintilla.h internally. External definitions go in the Scintilla namespace and internal definitio0ns in Scintilla::Internal.
Diffstat (limited to 'qt/ScintillaEdit/ScintillaDocument.cpp')
-rw-r--r--qt/ScintillaEdit/ScintillaDocument.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/qt/ScintillaEdit/ScintillaDocument.cpp b/qt/ScintillaEdit/ScintillaDocument.cpp
index 2272c383c..8d50eabdb 100644
--- a/qt/ScintillaEdit/ScintillaDocument.cpp
+++ b/qt/ScintillaEdit/ScintillaDocument.cpp
@@ -10,6 +10,9 @@
#include <optional>
#include <memory>
+#include "ScintillaTypes.h"
+#include "ScintillaMessages.h"
+#include "ScintillaStructures.h"
#include "ScintillaDocument.h"
#include "Debugging.h"
@@ -39,6 +42,7 @@
#include "Document.h"
using namespace Scintilla;
+using namespace Scintilla::Internal;
class WatcherHelper : public DocWatcher {
ScintillaDocument *owner;
@@ -52,7 +56,7 @@ public:
void NotifyDeleted(Document *doc, void *userData) noexcept override;
void NotifyStyleNeeded(Document *doc, void *userData, Sci::Position endPos) override;
void NotifyLexerChanged(Document *doc, void *userData) override;
- void NotifyErrorOccurred(Document *doc, void *userData, int status) override;
+ void NotifyErrorOccurred(Document *doc, void *userData, Status status) override;
};
WatcherHelper::WatcherHelper(ScintillaDocument *owner_) : owner(owner_) {
@@ -74,8 +78,8 @@ void WatcherHelper::NotifyModified(Document *, DocModification mh, void *) {
if (!mh.text)
length = 0;
QByteArray ba = QByteArray::fromRawData(mh.text, length);
- emit owner->modified(mh.position, mh.modificationType, ba, length,
- mh.linesAdded, mh.line, mh.foldLevelNow, mh.foldLevelPrev);
+ emit owner->modified(mh.position, static_cast<int>(mh.modificationType), ba, length,
+ mh.linesAdded, mh.line, static_cast<int>(mh.foldLevelNow), static_cast<int>(mh.foldLevelPrev));
}
void WatcherHelper::NotifyDeleted(Document *, void *) noexcept {
@@ -89,14 +93,14 @@ void WatcherHelper::NotifyLexerChanged(Document *, void *) {
emit owner->lexer_changed();
}
-void WatcherHelper::NotifyErrorOccurred(Document *, void *, int status) {
- emit owner->error_occurred(status);
+void WatcherHelper::NotifyErrorOccurred(Document *, void *, Status status) {
+ emit owner->error_occurred(static_cast<int>(status));
}
ScintillaDocument::ScintillaDocument(QObject *parent, void *pdoc_) :
QObject(parent), pdoc(pdoc_), docWatcher(nullptr) {
if (!pdoc) {
- pdoc = new Document(SC_DOCUMENTOPTION_DEFAULT);
+ pdoc = new Document(DocumentOption::Default);
}
docWatcher = new WatcherHelper(this);
(static_cast<Document *>(pdoc))->AddRef();
@@ -266,11 +270,11 @@ void ScintillaDocument::set_code_page(int code_page) {
}
int ScintillaDocument::get_eol_mode() {
- return (static_cast<Document *>(pdoc))->eolMode;
+ return static_cast<int>((static_cast<Document *>(pdoc))->eolMode);
}
void ScintillaDocument::set_eol_mode(int eol_mode) {
- (static_cast<Document *>(pdoc))->eolMode = eol_mode;
+ (static_cast<Document *>(pdoc))->eolMode = static_cast<EndOfLine>(eol_mode);
}
int ScintillaDocument::move_position_outside_char(int pos, int move_dir, bool check_line_end) {