diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/EditView.cxx | 14 | ||||
-rw-r--r-- | src/Editor.cxx | 14 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 5 | ||||
-rw-r--r-- | src/ViewStyle.h | 6 |
4 files changed, 17 insertions, 22 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index 7797236c8..e76921139 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -871,8 +871,8 @@ static ColourAlpha TextBackground(const EditModel &model, const ViewStyle &vsDra (i >= ll->edgeColumn) && (i < ll->numCharsBeforeEOL)) return vsDraw.theEdge.colour; - if (inHotspot && vsDraw.hotspotColours.back) - return *vsDraw.hotspotColours.back; + if (inHotspot && vsDraw.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE_BACK)) + return vsDraw.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE_BACK)->Opaque(); if (background && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) { return *background; } else { @@ -1930,11 +1930,11 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi const int styleMain = ll->styles[i]; ColourAlpha textFore = vsDraw.styles[styleMain].fore; const Font *textFont = vsDraw.styles[styleMain].font.get(); - //hotspot foreground + // Hot-spot foreground const bool inHotspot = (ll->hotspot.Valid()) && ll->hotspot.ContainsCharacter(iDoc); if (inHotspot) { - if (vsDraw.hotspotColours.fore) - textFore = *vsDraw.hotspotColours.fore; + if (vsDraw.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE)) + textFore = *vsDraw.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE); } if (vsDraw.indicatorsSetFore) { // At least one indicator sets the text colour so see if it applies to this segment @@ -2074,8 +2074,8 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi PRectangle rcUL = rcSegment; rcUL.top = rcUL.top + vsDraw.maxAscent + 1; rcUL.bottom = rcUL.top + 1; - if (vsDraw.hotspotColours.fore) - surface->FillRectangleAligned(rcUL, Fill(*vsDraw.hotspotColours.fore)); + if (vsDraw.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE)) + surface->FillRectangleAligned(rcUL, Fill(*vsDraw.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE))); else surface->FillRectangleAligned(rcUL, Fill(textFore)); } else if (vsDraw.styles[styleMain].underline) { diff --git a/src/Editor.cxx b/src/Editor.cxx index 9b5bfd6ee..1a0248522 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -8114,20 +8114,22 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_SETHOTSPOTACTIVEFORE: - vs.hotspotColours.fore = OptionalColour(wParam, lParam); - InvalidateStyleRedraw(); + if (vs.SetElementColourOptional(SC_ELEMENT_HOT_SPOT_ACTIVE, wParam, lParam)) { + InvalidateStyleRedraw(); + } break; case SCI_GETHOTSPOTACTIVEFORE: - return vs.hotspotColours.fore.value_or(ColourAlpha()).OpaqueRGB(); + return vs.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE).value_or(ColourAlpha()).OpaqueRGB(); case SCI_SETHOTSPOTACTIVEBACK: - vs.hotspotColours.back = OptionalColour(wParam, lParam); - InvalidateStyleRedraw(); + if (vs.SetElementColourOptional(SC_ELEMENT_HOT_SPOT_ACTIVE_BACK, wParam, lParam)) { + InvalidateStyleRedraw(); + } break; case SCI_GETHOTSPOTACTIVEBACK: - return vs.hotspotColours.back.value_or(ColourAlpha()).OpaqueRGB(); + return vs.ElementColour(SC_ELEMENT_HOT_SPOT_ACTIVE_BACK).value_or(ColourAlpha()).OpaqueRGB(); case SCI_SETHOTSPOTACTIVEUNDERLINE: vs.hotspotUnderline = wParam != 0; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 489758c71..ca59fef2c 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -87,7 +87,6 @@ ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicat foldmarginColour = source.foldmarginColour; foldmarginHighlightColour = source.foldmarginHighlightColour; - hotspotColours = source.hotspotColours; hotspotUnderline = source.hotspotUnderline; controlCharSymbol = source.controlCharSymbol; @@ -249,9 +248,9 @@ void ViewStyle::Init(size_t stylesSize_) { someStylesProtected = false; someStylesForceCase = false; - hotspotColours.fore.reset(); - hotspotColours.back.reset(); hotspotUnderline = true; + elementColours.erase(SC_ELEMENT_HOT_SPOT_ACTIVE); + elementAllowsTranslucent.insert(SC_ELEMENT_HOT_SPOT_ACTIVE); leftMarginWidth = 1; rightMarginWidth = 1; diff --git a/src/ViewStyle.h b/src/ViewStyle.h index cf8da4fe6..524699590 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -58,11 +58,6 @@ inline std::optional<ColourAlpha> OptionalColour(uptr_t wParam, sptr_t lParam) { } } -struct ForeBackColours { - std::optional<ColourAlpha> fore; - std::optional<ColourAlpha> back; -}; - struct SelectionAppearance { // Whether to draw on base layer or over text Layer layer; @@ -140,7 +135,6 @@ public: ColourAlpha selbarlight; std::optional<ColourAlpha> foldmarginColour; std::optional<ColourAlpha> foldmarginHighlightColour; - ForeBackColours hotspotColours; bool hotspotUnderline; /// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin int leftMarginWidth; ///< Spacing margin on left of text |