diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/EditView.cxx | 13 | ||||
-rw-r--r-- | src/Editor.cxx | 5 | ||||
-rw-r--r-- | src/ViewStyle.cxx | 8 | ||||
-rw-r--r-- | src/ViewStyle.h | 5 |
4 files changed, 15 insertions, 16 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index 4a10f6584..7797236c8 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -1726,8 +1726,9 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi if (ts.representation) { if (ll->chars[i] == '\t') { // Tab display - if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) - textBack = *vsDraw.whitespaceBack; + if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) { + textBack = vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE_BACK)->Opaque(); + } } else { // Blob display inIndentation = false; @@ -1745,7 +1746,8 @@ void EditView::DrawBackground(Surface *surface, const EditModel &model, const Vi rcSegment.top, ll->positions[cpos + ts.start + 1] + xStart - static_cast<XYPOSITION>(subLineStart), rcSegment.bottom); - surface->FillRectangleAligned(rcSpace, Fill(*vsDraw.whitespaceBack)); + surface->FillRectangleAligned(rcSpace, + vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE_BACK)->Opaque()); } } else { inIndentation = false; @@ -1972,7 +1974,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi // Tab display if (phasesDraw == PhasesDraw::one) { if (drawWhitespaceBackground && vsDraw.WhiteSpaceVisible(inIndentation)) - textBack = *vsDraw.whitespaceBack; + textBack = vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE_BACK)->Opaque(); surface->FillRectangleAligned(rcSegment, Fill(textBack)); } if (inIndentation && vsDraw.viewIndentationGuides == IndentView::real) { @@ -2034,7 +2036,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi if (vsDraw.WhiteSpaceVisible(inIndentation)) { const XYPOSITION xmid = (ll->positions[cpos + ts.start] + ll->positions[cpos + ts.start + 1]) / 2; if ((phasesDraw == PhasesDraw::one) && drawWhitespaceBackground) { - textBack = *vsDraw.whitespaceBack; + textBack = vsDraw.ElementColour(SC_ELEMENT_WHITE_SPACE_BACK)->Opaque(); const PRectangle rcSpace( ll->positions[cpos + ts.start] + xStart - static_cast<XYPOSITION>(subLineStart), rcSegment.top, @@ -2514,7 +2516,6 @@ Sci::Position EditView::FormatRange(bool draw, const Sci_RangeToFormat *pfr, Sur // Don't show the selection when printing vsPrint.elementColours.clear(); vsPrint.elementBaseColours.clear(); - vsPrint.whitespaceBack.reset(); vsPrint.caretLine.alwaysShow = false; // Don't highlight matching braces using indicators vsPrint.braceHighlightIndicatorSet = false; diff --git a/src/Editor.cxx b/src/Editor.cxx index 62cb170d3..9b5bfd6ee 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -7518,8 +7518,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { break; case SCI_SETWHITESPACEBACK: - vs.whitespaceBack = OptionalColour(wParam, lParam); - InvalidateStyleRedraw(); + if (vs.SetElementColourOptional(SC_ELEMENT_WHITE_SPACE_BACK, wParam, lParam)) { + InvalidateStyleRedraw(); + } break; case SCI_SETSELECTIONLAYER: diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 3785dec37..489758c71 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -108,7 +108,6 @@ ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicat textStart = source.textStart; zoomLevel = source.zoomLevel; viewWhitespace = source.viewWhitespace; - whitespaceBack = source.whitespaceBack; tabDrawMode = source.tabDrawMode; whitespaceSize = source.whitespaceSize; viewIndentationGuides = source.viewIndentationGuides; @@ -265,7 +264,6 @@ void ViewStyle::Init(size_t stylesSize_) { textStart = marginInside ? fixedColumnWidth : leftMarginWidth; zoomLevel = 0; viewWhitespace = WhiteSpace::invisible; - whitespaceBack.reset(); tabDrawMode = TabDrawMode::longArrow; whitespaceSize = 1; elementColours.erase(SC_ELEMENT_WHITE_SPACE); @@ -522,8 +520,8 @@ bool ViewStyle::SelectionTextDrawn() const { ElementIsSet(SC_ELEMENT_SELECTION_NO_FOCUS_TEXT); } -bool ViewStyle::WhitespaceBackgroundDrawn() const noexcept { - return (viewWhitespace != WhiteSpace::invisible) && (whitespaceBack); +bool ViewStyle::WhitespaceBackgroundDrawn() const { + return (viewWhitespace != WhiteSpace::invisible) && (ElementIsSet(SC_ELEMENT_WHITE_SPACE_BACK)); } bool ViewStyle::WhiteSpaceVisible(bool inIndent) const noexcept { @@ -532,7 +530,7 @@ bool ViewStyle::WhiteSpaceVisible(bool inIndent) const noexcept { viewWhitespace == WhiteSpace::visibleAlways; } -ColourAlpha ViewStyle::WrapColour() const noexcept { +ColourAlpha ViewStyle::WrapColour() const { return ElementColour(SC_ELEMENT_WHITE_SPACE).value_or(styles[STYLE_DEFAULT].fore); } diff --git a/src/ViewStyle.h b/src/ViewStyle.h index b726cc559..cf8da4fe6 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -153,7 +153,6 @@ public: int textStart; ///< Starting x position of text within the view int zoomLevel; WhiteSpace viewWhitespace; - std::optional<ColourAlpha> whitespaceBack; TabDrawMode tabDrawMode; int whitespaceSize; IndentView viewIndentationGuides; @@ -220,8 +219,8 @@ public: std::optional<ColourAlpha> Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const; bool SelectionBackgroundDrawn() const noexcept; bool SelectionTextDrawn() const; - bool WhitespaceBackgroundDrawn() const noexcept; - ColourAlpha WrapColour() const noexcept; + bool WhitespaceBackgroundDrawn() const; + ColourAlpha WrapColour() const; void AddMultiEdge(uptr_t wParam, sptr_t lParam); |