diff options
| author | Neil <nyamatongwe@gmail.com> | 2021-05-24 19:31:06 +1000 |
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2021-05-24 19:31:06 +1000 |
| commit | 92290868cf9753d2df0d494cb44e2ff62a570b58 (patch) | |
| tree | 001e6cfce84372a03997de3138d630751ee8d38a /gtk/ScintillaGTKAccessible.h | |
| parent | ee1886079d0a5cd350ee8e3379be347943ba93ae (diff) | |
| download | scintilla-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 'gtk/ScintillaGTKAccessible.h')
| -rw-r--r-- | gtk/ScintillaGTKAccessible.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/gtk/ScintillaGTKAccessible.h b/gtk/ScintillaGTKAccessible.h index 2168d034c..169dd507a 100644 --- a/gtk/ScintillaGTKAccessible.h +++ b/gtk/ScintillaGTKAccessible.h @@ -6,7 +6,7 @@ #ifndef SCINTILLAGTKACCESSIBLE_H #define SCINTILLAGTKACCESSIBLE_H -namespace Scintilla { +namespace Scintilla::Internal { #ifndef ATK_CHECK_VERSION # define ATK_CHECK_VERSION(x, y, z) 0 @@ -24,25 +24,25 @@ private: bool Enabled() const; void UpdateCursor(); - void Notify(GtkWidget *widget, gint code, SCNotification *nt); - static void SciNotify(GtkWidget *widget, gint code, SCNotification *nt, gpointer data) { + void Notify(GtkWidget *widget, gint code, Scintilla::NotificationData *nt); + static void SciNotify(GtkWidget *widget, gint code, Scintilla::NotificationData *nt, gpointer data) { try { static_cast<ScintillaGTKAccessible*>(data)->Notify(widget, code, nt); } catch (...) {} } Sci::Position ByteOffsetFromCharacterOffset(Sci::Position startByte, int characterOffset) { - if (!(sci->pdoc->LineCharacterIndex() & SC_LINECHARACTERINDEX_UTF32)) { + if (!FlagSet(sci->pdoc->LineCharacterIndex(), Scintilla::LineCharacterIndexType::Utf32)) { return startByte + characterOffset; } if (characterOffset > 0) { // Try and reduce the range by reverse-looking into the character offset cache Sci::Line lineStart = sci->pdoc->LineFromPosition(startByte); - Sci::Position posStart = sci->pdoc->IndexLineStart(lineStart, SC_LINECHARACTERINDEX_UTF32); - Sci::Line line = sci->pdoc->LineFromPositionIndex(posStart + characterOffset, SC_LINECHARACTERINDEX_UTF32); + Sci::Position posStart = sci->pdoc->IndexLineStart(lineStart, Scintilla::LineCharacterIndexType::Utf32); + Sci::Line line = sci->pdoc->LineFromPositionIndex(posStart + characterOffset, Scintilla::LineCharacterIndexType::Utf32); if (line != lineStart) { startByte += sci->pdoc->LineStart(line) - sci->pdoc->LineStart(lineStart); - characterOffset -= sci->pdoc->IndexLineStart(line, SC_LINECHARACTERINDEX_UTF32) - posStart; + characterOffset -= sci->pdoc->IndexLineStart(line, Scintilla::LineCharacterIndexType::Utf32) - posStart; } } Sci::Position pos = sci->pdoc->GetRelativePosition(startByte, characterOffset); @@ -62,12 +62,12 @@ private: } Sci::Position CharacterOffsetFromByteOffset(Sci::Position byteOffset) { - if (!(sci->pdoc->LineCharacterIndex() & SC_LINECHARACTERINDEX_UTF32)) { + if (!FlagSet(sci->pdoc->LineCharacterIndex(), Scintilla::LineCharacterIndexType::Utf32)) { return byteOffset; } const Sci::Line line = sci->pdoc->LineFromPosition(byteOffset); const Sci::Position lineStart = sci->pdoc->LineStart(line); - return sci->pdoc->IndexLineStart(line, SC_LINECHARACTERINDEX_UTF32) + sci->pdoc->CountCharacters(lineStart, byteOffset); + return sci->pdoc->IndexLineStart(line, Scintilla::LineCharacterIndexType::Utf32) + sci->pdoc->CountCharacters(lineStart, byteOffset); } void CharacterRangeFromByteRange(Sci::Position startByte, Sci::Position endByte, int *startChar, int *endChar) { |
