From dd4e7804282ca821f1a82cbe9b0068cd675295ff Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 22 Jun 2019 11:37:23 +1000 Subject: Backport: Feature [feature-requests:#1297] Update to use INDICATOR_ instead of INDIC_ as INDIC_ is also used for indicator styles. Backport of changeset 7594:190079cd334f. --- cocoa/ScintillaCocoa.mm | 2 +- cocoa/ScintillaView.mm | 8 +++---- gtk/ScintillaGTK.cxx | 10 ++++----- qt/ScintillaEditBase/ScintillaEditBase.cpp | 11 +++++---- src/Decoration.cxx | 4 ++-- src/Editor.cxx | 36 +++++++++++++++--------------- src/ViewStyle.cxx | 4 ++-- win32/ScintillaWin.cxx | 10 ++++----- 8 files changed, 42 insertions(+), 43 deletions(-) diff --git a/cocoa/ScintillaCocoa.mm b/cocoa/ScintillaCocoa.mm index b4789c432..b1b44ea00 100644 --- a/cocoa/ScintillaCocoa.mm +++ b/cocoa/ScintillaCocoa.mm @@ -2387,7 +2387,7 @@ void ScintillaCocoa::CompositionStart() void ScintillaCocoa::CompositionCommit() { pdoc->TentativeCommit(); - pdoc->DecorationSetCurrentIndicator(INDIC_IME); + pdoc->DecorationSetCurrentIndicator(INDICATOR_IME); pdoc->DecorationFillRange(0, 0, pdoc->Length()); } diff --git a/cocoa/ScintillaView.mm b/cocoa/ScintillaView.mm index 224aac06c..0dcca1481 100644 --- a/cocoa/ScintillaView.mm +++ b/cocoa/ScintillaView.mm @@ -676,7 +676,7 @@ static NSCursor *cursorFromEnum(Window::Cursor cursor) posRangeCurrent.length = lengthInserted; mMarkedTextRange = mOwner.backend->CharactersFromPositions(posRangeCurrent); // Mark the just inserted text. Keep the marked range for later reset. - [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INDIC_IME]; + [mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INDICATOR_IME]; [mOwner setGeneralProperty: SCI_INDICATORFILLRANGE parameter: posRangeCurrent.location value: posRangeCurrent.length]; @@ -1498,10 +1498,10 @@ sourceOperationMaskForDraggingContext: (NSDraggingContext) context */ - (void) updateIndicatorIME { - [self setColorProperty: SCI_INDICSETFORE parameter: INDIC_IME fromHTML: @"#FF0000"]; + [self setColorProperty: SCI_INDICSETFORE parameter: INDICATOR_IME fromHTML: @"#FF0000"]; const bool drawInBackground = [self message: SCI_GETPHASESDRAW] != 0; - [self setGeneralProperty: SCI_INDICSETUNDER parameter: INDIC_IME value: drawInBackground]; - [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INDIC_IME value: INDIC_PLAIN]; + [self setGeneralProperty: SCI_INDICSETUNDER parameter: INDICATOR_IME value: drawInBackground]; + [self setGeneralProperty: SCI_INDICSETSTYLE parameter: INDICATOR_IME value: INDIC_PLAIN]; [self setGeneralProperty: SCI_INDICSETALPHA parameter: INDIC_IME value: 100]; } diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index d49bad1bd..eab650179 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -90,10 +90,10 @@ #define IS_WIDGET_REALIZED(w) (gtk_widget_get_realized(GTK_WIDGET(w))) #define IS_WIDGET_MAPPED(w) (gtk_widget_get_mapped(GTK_WIDGET(w))) -#define SC_INDICATOR_INPUT INDIC_IME -#define SC_INDICATOR_TARGET INDIC_IME+1 -#define SC_INDICATOR_CONVERTED INDIC_IME+2 -#define SC_INDICATOR_UNKNOWN INDIC_IME_MAX +#define SC_INDICATOR_INPUT INDICATOR_IME +#define SC_INDICATOR_TARGET INDICATOR_IME+1 +#define SC_INDICATOR_CONVERTED INDICATOR_IME+2 +#define SC_INDICATOR_UNKNOWN INDICATOR_IME_MAX static GdkWindow *WindowFromWidget(GtkWidget *w) noexcept { return gtk_widget_get_window(w); @@ -2260,7 +2260,7 @@ void ScintillaGTK::DrawImeIndicator(int indicator, int len) { // Draw an indicator on the character before caret by the character bytes of len // so it should be called after InsertCharacter(). // It does not affect caret positions. - if (indicator < 8 || indicator > INDIC_MAX) { + if (indicator < 8 || indicator > INDICATOR_MAX) { return; } pdoc->DecorationSetCurrentIndicator(indicator); diff --git a/qt/ScintillaEditBase/ScintillaEditBase.cpp b/qt/ScintillaEditBase/ScintillaEditBase.cpp index ea65fb1d3..54b2c7896 100644 --- a/qt/ScintillaEditBase/ScintillaEditBase.cpp +++ b/qt/ScintillaEditBase/ScintillaEditBase.cpp @@ -23,11 +23,10 @@ #define INDIC_INPUTMETHOD 24 -#define MAXLENINPUTIME 200 -#define SC_INDICATOR_INPUT INDIC_IME -#define SC_INDICATOR_TARGET INDIC_IME+1 -#define SC_INDICATOR_CONVERTED INDIC_IME+2 -#define SC_INDICATOR_UNKNOWN INDIC_IME_MAX +#define SC_INDICATOR_INPUT INDICATOR_IME +#define SC_INDICATOR_TARGET INDICATOR_IME+1 +#define SC_INDICATOR_CONVERTED INDICATOR_IME+2 +#define SC_INDICATOR_UNKNOWN INDICATOR_IME_MAX // Q_WS_MAC and Q_WS_X11 aren't defined in Qt5 #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) @@ -452,7 +451,7 @@ void ScintillaEditBase::DrawImeIndicator(int indicator, int len) // Draw an indicator on the character before caret by the character bytes of len // so it should be called after InsertCharacter(). // It does not affect caret positions. - if (indicator < 8 || indicator > INDIC_MAX) { + if (indicator < 8 || indicator > INDICATOR_MAX) { return; } sqt->pdoc->DecorationSetCurrentIndicator(indicator); diff --git a/src/Decoration.cxx b/src/Decoration.cxx index 104f75ae2..8d60d8935 100644 --- a/src/Decoration.cxx +++ b/src/Decoration.cxx @@ -228,7 +228,7 @@ template void DecorationList::DeleteLexerDecorations() { decorationList.erase(std::remove_if(decorationList.begin(), decorationList.end(), [](const std::unique_ptr> &deco) { - return deco->Indicator() < INDIC_CONTAINER; + return deco->Indicator() < INDICATOR_CONTAINER ; }), decorationList.end()); current = nullptr; SetView(); @@ -259,7 +259,7 @@ int DecorationList::AllOnFor(Sci::Position position) const { int mask = 0; for (const std::unique_ptr> &deco : decorationList) { if (deco->rs.ValueAt(static_cast(position))) { - if (deco->Indicator() < INDIC_IME) { + if (deco->Indicator() < INDICATOR_IME) { mask |= 1 << deco->Indicator(); } } diff --git a/src/Editor.cxx b/src/Editor.cxx index eb8e4f521..fd89d1e5e 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7344,7 +7344,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_INDICSETSTYLE: - if (wParam <= INDIC_MAX) { + if (wParam <= INDICATOR_MAX) { vs.indicators[wParam].sacNormal.style = static_cast(lParam); vs.indicators[wParam].sacHover.style = static_cast(lParam); InvalidateStyleRedraw(); @@ -7352,10 +7352,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_INDICGETSTYLE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.style : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].sacNormal.style : 0; case SCI_INDICSETFORE: - if (wParam <= INDIC_MAX) { + if (wParam <= INDICATOR_MAX) { vs.indicators[wParam].sacNormal.fore = ColourDesired(static_cast(lParam)); vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast(lParam)); InvalidateStyleRedraw(); @@ -7363,67 +7363,67 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_INDICGETFORE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacNormal.fore.AsInteger() : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].sacNormal.fore.AsInteger() : 0; case SCI_INDICSETHOVERSTYLE: - if (wParam <= INDIC_MAX) { + if (wParam <= INDICATOR_MAX) { vs.indicators[wParam].sacHover.style = static_cast(lParam); InvalidateStyleRedraw(); } break; case SCI_INDICGETHOVERSTYLE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.style : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].sacHover.style : 0; case SCI_INDICSETHOVERFORE: - if (wParam <= INDIC_MAX) { + if (wParam <= INDICATOR_MAX) { vs.indicators[wParam].sacHover.fore = ColourDesired(static_cast(lParam)); InvalidateStyleRedraw(); } break; case SCI_INDICGETHOVERFORE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].sacHover.fore.AsInteger() : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].sacHover.fore.AsInteger() : 0; case SCI_INDICSETFLAGS: - if (wParam <= INDIC_MAX) { + if (wParam <= INDICATOR_MAX) { vs.indicators[wParam].SetFlags(static_cast(lParam)); InvalidateStyleRedraw(); } break; case SCI_INDICGETFLAGS: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].Flags() : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].Flags() : 0; case SCI_INDICSETUNDER: - if (wParam <= INDIC_MAX) { + if (wParam <= INDICATOR_MAX) { vs.indicators[wParam].under = lParam != 0; InvalidateStyleRedraw(); } break; case SCI_INDICGETUNDER: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].under : 0; case SCI_INDICSETALPHA: - if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) { + if (wParam <= INDICATOR_MAX && lParam >=0 && lParam <= 255) { vs.indicators[wParam].fillAlpha = static_cast(lParam); InvalidateStyleRedraw(); } break; case SCI_INDICGETALPHA: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fillAlpha : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].fillAlpha : 0; case SCI_INDICSETOUTLINEALPHA: - if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 255) { + if (wParam <= INDICATOR_MAX && lParam >=0 && lParam <= 255) { vs.indicators[wParam].outlineAlpha = static_cast(lParam); InvalidateStyleRedraw(); } break; case SCI_INDICGETOUTLINEALPHA: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].outlineAlpha : 0; + return (wParam <= INDICATOR_MAX) ? vs.indicators[wParam].outlineAlpha : 0; case SCI_SETINDICATORCURRENT: pdoc->DecorationSetCurrentIndicator(static_cast(wParam)); @@ -7558,7 +7558,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_BRACEHIGHLIGHTINDICATOR: - if (lParam >= 0 && lParam <= INDIC_MAX) { + if (lParam >= 0 && lParam <= INDICATOR_MAX) { vs.braceHighlightIndicatorSet = wParam != 0; vs.braceHighlightIndicator = static_cast(lParam); } @@ -7569,7 +7569,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_BRACEBADLIGHTINDICATOR: - if (lParam >= 0 && lParam <= INDIC_MAX) { + if (lParam >= 0 && lParam <= INDICATOR_MAX) { vs.braceBadLightIndicatorSet = wParam != 0; vs.braceBadLightIndicator = static_cast(lParam); } diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index d6fd42a6d..ddebf862b 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -55,13 +55,13 @@ void FontRealised::Realise(Surface &surface, int zoomLevel, int technology, cons spaceWidth = surface.WidthText(font, " ", 1); } -ViewStyle::ViewStyle() : markers(MARKER_MAX + 1), indicators(INDIC_MAX + 1) { +ViewStyle::ViewStyle() : markers(MARKER_MAX + 1), indicators(INDICATOR_MAX + 1) { Init(); } // Copy constructor only called when printing copies the screen ViewStyle so it can be // modified for printing styles. -ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicators(INDIC_MAX + 1) { +ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicators(INDICATOR_MAX + 1) { Init(source.styles.size()); styles = source.styles; for (size_t sty=0; sty INDIC_MAX) { + if (indicator < 8 || indicator > INDICATOR_MAX) { return; } pdoc->DecorationSetCurrentIndicator(indicator); -- cgit v1.2.3