aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx116
-rw-r--r--src/Editor.cxx76
-rw-r--r--src/MarginView.cxx2
-rw-r--r--src/ViewStyle.cxx126
-rw-r--r--src/ViewStyle.h84
5 files changed, 215 insertions, 189 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index fbb6f8b5c..1e48ba2b9 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -511,13 +511,13 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
// Simple common case where line does not need wrapping.
ll->lines = 1;
} else {
- if (vstyle.wrapVisualFlags & SC_WRAPVISUALFLAG_END) {
+ if (vstyle.wrap.visualFlags & SC_WRAPVISUALFLAG_END) {
width -= static_cast<int>(vstyle.aveCharWidth); // take into account the space for end wrap mark
}
XYPOSITION wrapAddIndent = 0; // This will be added to initial indent of line
- switch (vstyle.wrapIndentMode) {
+ switch (vstyle.wrap.indentMode) {
case SC_WRAPINDENT_FIXED:
- wrapAddIndent = vstyle.wrapVisualStartIndent * vstyle.aveCharWidth;
+ wrapAddIndent = vstyle.wrap.visualStartIndent * vstyle.aveCharWidth;
break;
case SC_WRAPINDENT_INDENT:
wrapAddIndent = model.pdoc->IndentSize() * vstyle.spaceWidth;
@@ -527,7 +527,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
break;
}
ll->wrapIndent = wrapAddIndent;
- if (vstyle.wrapIndentMode != SC_WRAPINDENT_FIXED) {
+ if (vstyle.wrap.indentMode != SC_WRAPINDENT_FIXED) {
for (int i = 0; i < ll->numCharsInLine; i++) {
if (!IsSpaceOrTab(ll->chars[i])) {
ll->wrapIndent += ll->positions[i]; // Add line indent
@@ -539,7 +539,7 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
if (ll->wrapIndent > width - static_cast<int>(vstyle.aveCharWidth) * 15)
ll->wrapIndent = wrapAddIndent;
// Check for wrapIndent minimum
- if ((vstyle.wrapVisualFlags & SC_WRAPVISUALFLAG_START) && (ll->wrapIndent < vstyle.aveCharWidth))
+ if ((vstyle.wrap.visualFlags & SC_WRAPVISUALFLAG_START) && (ll->wrapIndent < vstyle.aveCharWidth))
ll->wrapIndent = vstyle.aveCharWidth; // Indent to show start visual
ll->lines = 0;
// Calculate line start positions based upon width.
@@ -571,12 +571,12 @@ void EditView::LayoutLine(const EditModel &model, Sci::Line line, Surface *surfa
continue;
}
if (p > 0) {
- if (vstyle.wrapState == WrapMode::character) {
+ if (vstyle.wrap.state == WrapMode::character) {
lastGoodBreak = model.pdoc->MovePositionOutsideChar(p + posLineStart, -1)
- posLineStart;
p = model.pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart;
continue;
- } else if ((vstyle.wrapState == WrapMode::word) && (ll->styles[p] != ll->styles[p - 1])) {
+ } else if ((vstyle.wrap.state == WrapMode::word) && (ll->styles[p] != ll->styles[p - 1])) {
lastGoodBreak = p;
} else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) {
lastGoodBreak = p;
@@ -822,18 +822,18 @@ Sci::Position EditView::StartEndDisplayLine(Surface *surface, const EditModel &m
static ColourAlpha SelectionBackground(const ViewStyle &vsDraw, bool main, bool primarySelection) noexcept {
return main ?
- (primarySelection ? vsDraw.selColours.back.value() : vsDraw.selBackground2) :
- vsDraw.selAdditionalBackground;
+ (primarySelection ? vsDraw.selection.colours.back.value() : vsDraw.selection.background2) :
+ vsDraw.selection.additionalBackground;
}
static ColourAlpha TextBackground(const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
std::optional<ColourAlpha> background, int inSelection, bool inHotspot, int styleMain, Sci::Position i) noexcept {
if (inSelection == 1) {
- if (vsDraw.selColours.back && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
+ if (vsDraw.selection.colours.back && (vsDraw.selection.alpha == SC_ALPHA_NOALPHA)) {
return SelectionBackground(vsDraw, true, model.primarySelection);
}
} else if (inSelection == 2) {
- if (vsDraw.selColours.back && (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA)) {
+ if (vsDraw.selection.colours.back && (vsDraw.selection.additionalAlpha == SC_ALPHA_NOALPHA)) {
return SelectionBackground(vsDraw, false, model.primarySelection);
}
} else {
@@ -900,24 +900,24 @@ static void DrawFrame(Surface *surface, ColourAlpha colour, int alpha, PRectangl
static void DrawCaretLineFramed(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll, PRectangle rcLine, int subLine) {
const int width = vsDraw.GetFrameWidth();
- if (subLine == 0 || ll->wrapIndent == 0 || vsDraw.caretLineAlpha != SC_ALPHA_NOALPHA) {
+ if (subLine == 0 || ll->wrapIndent == 0 || vsDraw.caretLine.alpha != SC_ALPHA_NOALPHA) {
// Left
- DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha,
+ DrawFrame(surface, vsDraw.caretLine.background, vsDraw.caretLine.alpha,
PRectangle(rcLine.left, rcLine.top, rcLine.left + width, rcLine.bottom));
}
if (subLine == 0) {
// Top
- DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha,
+ DrawFrame(surface, vsDraw.caretLine.background, vsDraw.caretLine.alpha,
PRectangle(rcLine.left + width, rcLine.top, rcLine.right - width, rcLine.top + width));
}
- if (subLine == ll->lines - 1 || vsDraw.caretLineAlpha != SC_ALPHA_NOALPHA) {
+ if (subLine == ll->lines - 1 || vsDraw.caretLine.alpha != SC_ALPHA_NOALPHA) {
// Right
- DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha,
+ DrawFrame(surface, vsDraw.caretLine.background, vsDraw.caretLine.alpha,
PRectangle(rcLine.right - width, rcLine.top, rcLine.right, rcLine.bottom));
}
if (subLine == ll->lines - 1) {
// Bottom
- DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha,
+ DrawFrame(surface, vsDraw.caretLine.background, vsDraw.caretLine.alpha,
PRectangle(rcLine.left + width, rcLine.bottom - width, rcLine.right - width, rcLine.bottom));
}
}
@@ -942,12 +942,12 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
rcSegment.left = xEol + xStart;
rcSegment.right = xEol + xStart + virtualSpace;
surface->FillRectangleAligned(rcSegment, Fill(background ? background.value() : vsDraw.styles[ll->styles[ll->numCharsInLine]].back));
- if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) {
+ if (!hideSelection && ((vsDraw.selection.alpha == SC_ALPHA_NOALPHA) || (vsDraw.selection.additionalAlpha == SC_ALPHA_NOALPHA))) {
const SelectionSegment virtualSpaceRange(SelectionPosition(model.pdoc->LineEnd(line)),
SelectionPosition(model.pdoc->LineEnd(line),
model.sel.VirtualSpaceFor(model.pdoc->LineEnd(line))));
for (size_t r = 0; r<model.sel.Count(); r++) {
- const int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha;
+ const int alpha = (r == model.sel.Main()) ? vsDraw.selection.alpha : vsDraw.selection.additionalAlpha;
if (alpha == SC_ALPHA_NOALPHA) {
const SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange);
if (!portion.Empty()) {
@@ -970,7 +970,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
if (!hideSelection) {
const Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1);
eolInSelection = lastSubLine ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0;
- alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha;
+ alpha = (eolInSelection == 1) ? vsDraw.selection.alpha : vsDraw.selection.additionalAlpha;
}
// Draw the [CR], [LF], or [CR][LF] blobs if visible line ends are on
@@ -998,10 +998,10 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
}
}
ColourAlpha textFore = vsDraw.styles[styleMain].fore;
- if (eolInSelection && vsDraw.selColours.fore) {
- textFore = (eolInSelection == 1) ? vsDraw.selColours.fore.value() : vsDraw.selAdditionalForeground;
+ if (eolInSelection && vsDraw.selection.colours.fore) {
+ textFore = (eolInSelection == 1) ? vsDraw.selection.colours.fore.value() : vsDraw.selection.additionalForeground;
}
- if (eolInSelection && vsDraw.selColours.back && (line < model.pdoc->LinesTotal() - 1)) {
+ if (eolInSelection && vsDraw.selection.colours.back && (line < model.pdoc->LinesTotal() - 1)) {
if (alpha == SC_ALPHA_NOALPHA) {
surface->FillRectangleAligned(rcSegment, Fill(SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)));
} else {
@@ -1011,7 +1011,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
surface->FillRectangleAligned(rcSegment, Fill(textBack));
}
DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, phasesDraw == PhasesDraw::one);
- if (eolInSelection && vsDraw.selColours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {
+ if (eolInSelection && vsDraw.selection.colours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha);
}
}
@@ -1021,7 +1021,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
rcSegment.left = xEol + xStart + virtualSpace + blobsWidth;
rcSegment.right = rcSegment.left + vsDraw.aveCharWidth;
- if (eolInSelection && vsDraw.selColours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
+ if (eolInSelection && vsDraw.selection.colours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangleAligned(rcSegment, Fill(SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)));
} else {
if (background) {
@@ -1033,7 +1033,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
} else {
surface->FillRectangleAligned(rcSegment, Fill(vsDraw.styles[STYLE_DEFAULT].back));
}
- if (eolInSelection && vsDraw.selColours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {
+ if (eolInSelection && vsDraw.selection.colours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha);
}
}
@@ -1053,13 +1053,13 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
bool drawWrapMarkEnd = false;
if (subLine + 1 < ll->lines) {
- if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_END) {
+ if (vsDraw.wrap.visualFlags & SC_WRAPVISUALFLAG_END) {
drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0;
}
if (vsDraw.IsLineFrameOpaque(model.caret.active, ll->containsCaret)) {
const int width = vsDraw.GetFrameWidth();
// Draw right of frame under marker
- DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha,
+ DrawFrame(surface, vsDraw.caretLine.background, vsDraw.caretLine.alpha,
PRectangle(rcLine.right - width, rcLine.top, rcLine.right, rcLine.bottom));
}
}
@@ -1067,7 +1067,7 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
if (drawWrapMarkEnd) {
PRectangle rcPlace = rcSegment;
- if (vsDraw.wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_END_BY_TEXT) {
+ if (vsDraw.wrap.visualFlagsLocation & SC_WRAPVISUALFLAGLOC_END_BY_TEXT) {
rcPlace.left = xEol + xStart + virtualSpace;
rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
} else {
@@ -1206,7 +1206,7 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con
if (!hideSelection) {
const Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1);
eolInSelection = (subLine == (ll->lines - 1)) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0;
- alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha;
+ alpha = (eolInSelection == 1) ? vsDraw.selection.alpha : vsDraw.selection.additionalAlpha;
}
const XYPOSITION spaceWidth = vsDraw.styles[ll->EndLineStyle()].spaceWidth;
@@ -1217,8 +1217,8 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con
const std::optional<ColourAlpha> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
ColourAlpha textFore = vsDraw.styles[STYLE_FOLDDISPLAYTEXT].fore;
- if (eolInSelection && (vsDraw.selColours.fore)) {
- textFore = (eolInSelection == 1) ? vsDraw.selColours.fore.value() : vsDraw.selAdditionalForeground;
+ if (eolInSelection && (vsDraw.selection.colours.fore)) {
+ textFore = (eolInSelection == 1) ? vsDraw.selection.colours.fore.value() : vsDraw.selection.additionalForeground;
}
const ColourAlpha textBack = TextBackground(model, vsDraw, ll, background, eolInSelection,
false, STYLE_FOLDDISPLAYTEXT, -1);
@@ -1264,7 +1264,7 @@ void EditView::DrawFoldDisplayText(Surface *surface, const EditModel &model, con
}
if (FlagSet(phase, DrawPhase::selectionTranslucent)) {
- if (eolInSelection && vsDraw.selColours.back && (line < model.pdoc->LinesTotal() - 1) && alpha != SC_ALPHA_NOALPHA) {
+ if (eolInSelection && vsDraw.selection.colours.back && (line < model.pdoc->LinesTotal() - 1) && alpha != SC_ALPHA_NOALPHA) {
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha);
}
}
@@ -1602,9 +1602,9 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
if (drawDrag) {
/* Dragging text, use a line caret */
rcCaret.left = std::round(xposCaret - caretWidthOffset);
- rcCaret.right = rcCaret.left + vsDraw.caretWidth;
+ rcCaret.right = rcCaret.left + vsDraw.caret.width;
} else if ((caretShape == ViewStyle::CaretShape::bar) && drawOverstrikeCaret) {
- /* Overstrike (insert mode), use a modified bar caret */
+ /* Over-strike (insert mode), use a modified bar caret */
rcCaret.top = rcCaret.bottom - 2;
rcCaret.left = xposCaret + 1;
rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1;
@@ -1620,9 +1620,9 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
} else {
/* Line caret */
rcCaret.left = std::round(xposCaret - caretWidthOffset);
- rcCaret.right = rcCaret.left + vsDraw.caretWidth;
+ rcCaret.right = rcCaret.left + vsDraw.caret.width;
}
- const ColourAlpha caretColour = mainCaret ? vsDraw.caretcolour : vsDraw.additionalCaretColour;
+ const ColourAlpha caretColour = mainCaret ? vsDraw.caret.colour : vsDraw.caret.additionalColour;
assert(caretColour.IsOpaque());
if (drawBlockCaret) {
DrawBlockCaret(surface, model, vsDraw, ll, subLine, xStart, offset, posCaret.Position(), rcCaret, caretColour);
@@ -1646,11 +1646,11 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c
if (vsDraw.IsLineFrameOpaque(caretActive, ll->containsCaret)) {
const int width = vsDraw.GetFrameWidth();
// Draw left of frame under marker
- DrawFrame(surface, vsDraw.caretLineBackground, vsDraw.caretLineAlpha,
+ DrawFrame(surface, vsDraw.caretLine.background, vsDraw.caretLine.alpha,
PRectangle(rcLine.left, rcLine.top, rcLine.left + width, rcLine.bottom));
}
- if (vsDraw.wrapVisualFlags & SC_WRAPVISUALFLAG_START) {
+ if (vsDraw.wrap.visualFlags & SC_WRAPVISUALFLAG_START) {
// draw continuation rect
PRectangle rcPlace = rcLine;
@@ -1658,7 +1658,7 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c
rcPlace.left = static_cast<XYPOSITION>(xStart);
rcPlace.right = rcPlace.left + ll->wrapIndent;
- if (vsDraw.wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_START_BY_TEXT)
+ if (vsDraw.wrap.visualFlagsLocation & SC_WRAPVISUALFLAGLOC_START_BY_TEXT)
rcPlace.left = rcPlace.right - vsDraw.aveCharWidth;
else
rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
@@ -1786,7 +1786,7 @@ static void DrawMarkUnderline(Surface *surface, const EditModel &model, const Vi
static void DrawTranslucentSelection(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
Sci::Line line, PRectangle rcLine, int subLine, Range lineRange, int xStart, int tabWidthMinimumPixels) {
- if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA)) {
+ if ((vsDraw.selection.alpha != SC_ALPHA_NOALPHA) || (vsDraw.selection.additionalAlpha != SC_ALPHA_NOALPHA)) {
const Sci::Position posLineStart = model.pdoc->LineStart(line);
const XYACCUMULATOR subLineStart = ll->positions[lineRange.start];
// For each selection draw
@@ -1798,7 +1798,7 @@ static void DrawTranslucentSelection(Surface *surface, const EditModel &model, c
const SelectionPosition posEnd(posLineStart + lineRange.end, virtualSpaces);
const SelectionSegment virtualSpaceRange(posStart, posEnd);
for (size_t r = 0; r < model.sel.Count(); r++) {
- const int alpha = (r == model.sel.Main()) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha;
+ const int alpha = (r == model.sel.Main()) ? vsDraw.selection.alpha : vsDraw.selection.additionalAlpha;
if (alpha != SC_ALPHA_NOALPHA) {
const SelectionSegment portion = model.sel.Range(r).Intersect(virtualSpaceRange);
if (!portion.Empty()) {
@@ -1852,12 +1852,12 @@ static void DrawTranslucentSelection(Surface *surface, const EditModel &model, c
// Draw any translucent whole line states
static void DrawTranslucentLineState(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll,
Sci::Line line, PRectangle rcLine, int subLine) {
- if ((model.caret.active || vsDraw.alwaysShowCaretLineBackground) && vsDraw.showCaretLineBackground && ll->containsCaret &&
- vsDraw.caretLineAlpha != SC_ALPHA_NOALPHA) {
- if (vsDraw.caretLineFrame) {
+ if ((model.caret.active || vsDraw.caretLine.alwaysShow) && vsDraw.caretLine.show && ll->containsCaret &&
+ vsDraw.caretLine.alpha != SC_ALPHA_NOALPHA) {
+ if (vsDraw.caretLine.frame) {
DrawCaretLineFramed(surface, vsDraw, ll, rcLine, subLine);
} else {
- SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLineBackground, vsDraw.caretLineAlpha);
+ SimpleAlphaRectangle(surface, rcLine, vsDraw.caretLine.background, vsDraw.caretLine.alpha);
}
}
const int marksOfLine = model.pdoc->GetMark(line);
@@ -1899,7 +1899,7 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
// Foreground drawing loop
BreakFinder bfFore(ll, &model.sel, lineRange, posLineStart, xStartVisible,
- (((phasesDraw == PhasesDraw::one) && selBackDrawn) || vsDraw.selColours.fore), model.pdoc, &model.reprs, &vsDraw);
+ (((phasesDraw == PhasesDraw::one) && selBackDrawn) || vsDraw.selection.colours.fore), model.pdoc, &model.reprs, &vsDraw);
while (bfFore.More()) {
@@ -1950,8 +1950,8 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
}
}
const int inSelection = hideSelection ? 0 : model.sel.CharacterInSelection(iDoc);
- if (inSelection && (vsDraw.selColours.fore)) {
- textFore = (inSelection == 1) ? vsDraw.selColours.fore.value() : vsDraw.selAdditionalForeground;
+ if (inSelection && (vsDraw.selection.colours.fore)) {
+ textFore = (inSelection == 1) ? vsDraw.selection.colours.fore.value() : vsDraw.selection.additionalForeground;
}
ColourAlpha textBack = TextBackground(model, vsDraw, ll, background, inSelection, inHotspot, styleMain, i);
if (ts.representation) {
@@ -2443,12 +2443,12 @@ void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const
if (!hideSelection) {
const Sci::Position posAfterLineEnd = model.pdoc->LineStart(line + 1);
eolInSelection = (subLine == (ll->lines - 1)) ? model.sel.InSelectionForEOL(posAfterLineEnd) : 0;
- alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha;
+ alpha = (eolInSelection == 1) ? vsDraw.selection.alpha : vsDraw.selection.additionalAlpha;
}
const std::optional<ColourAlpha> background = vsDraw.Background(model.pdoc->GetMark(line), model.caret.active, ll->containsCaret);
- if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
+ if (eolInSelection && vsDraw.selection.eolFilled && vsDraw.selection.colours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) {
surface->FillRectangleAligned(rcArea, Fill(SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection)));
} else {
if (background) {
@@ -2458,7 +2458,7 @@ void EditView::FillLineRemainder(Surface *surface, const EditModel &model, const
} else {
surface->FillRectangleAligned(rcArea, Fill(vsDraw.styles[STYLE_DEFAULT].back));
}
- if (eolInSelection && vsDraw.selEOLFilled && vsDraw.selColours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {
+ if (eolInSelection && vsDraw.selection.eolFilled && vsDraw.selection.colours.back && (line < model.pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {
SimpleAlphaRectangle(surface, rcArea, SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection), alpha);
}
}
@@ -2505,14 +2505,14 @@ Sci::Position EditView::FormatRange(bool draw, const Sci_RangeToFormat *pfr, Sur
// If this ever gets changed, cached pixmap would need to be recreated if technology != SC_TECHNOLOGY_DEFAULT
vsPrint.viewIndentationGuides = IndentView::none;
// Don't show the selection when printing
- vsPrint.selColours.back.reset();
- vsPrint.selColours.fore.reset();
- vsPrint.selAlpha = SC_ALPHA_NOALPHA;
- vsPrint.selAdditionalAlpha = SC_ALPHA_NOALPHA;
+ vsPrint.selection.colours.back.reset();
+ vsPrint.selection.colours.fore.reset();
+ vsPrint.selection.alpha = SC_ALPHA_NOALPHA;
+ vsPrint.selection.additionalAlpha = SC_ALPHA_NOALPHA;
vsPrint.whitespaceColours.back.reset();
vsPrint.whitespaceColours.fore.reset();
- vsPrint.showCaretLineBackground = false;
- vsPrint.alwaysShowCaretLineBackground = false;
+ vsPrint.caretLine.show = false;
+ vsPrint.caretLine.alwaysShow = false;
// Don't highlight matching braces using indicators
vsPrint.braceHighlightIndicatorSet = false;
vsPrint.braceBadLightIndicatorSet = false;
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 5dabfe6ad..573bdb140 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1476,7 +1476,7 @@ void Editor::UpdateSystemCaret() {
}
bool Editor::Wrapping() const noexcept {
- return vs.wrapState != WrapMode::none;
+ return vs.wrap.state != WrapMode::none;
}
void Editor::NeedWrapping(Sci::Line docLineStart, Sci::Line docLineEnd) {
@@ -6708,7 +6708,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETWRAPMODE:
- return static_cast<sptr_t>(vs.wrapState);
+ return static_cast<sptr_t>(vs.wrap.state);
case SCI_SETWRAPVISUALFLAGS:
if (vs.SetWrapVisualFlags(static_cast<int>(wParam))) {
@@ -6718,7 +6718,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETWRAPVISUALFLAGS:
- return vs.wrapVisualFlags;
+ return vs.wrap.visualFlags;
case SCI_SETWRAPVISUALFLAGSLOCATION:
if (vs.SetWrapVisualFlagsLocation(static_cast<int>(wParam))) {
@@ -6727,7 +6727,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETWRAPVISUALFLAGSLOCATION:
- return vs.wrapVisualFlagsLocation;
+ return vs.wrap.visualFlagsLocation;
case SCI_SETWRAPSTARTINDENT:
if (vs.SetWrapVisualStartIndent(static_cast<int>(wParam))) {
@@ -6737,7 +6737,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETWRAPSTARTINDENT:
- return vs.wrapVisualStartIndent;
+ return vs.wrap.visualStartIndent;
case SCI_SETWRAPINDENTMODE:
if (vs.SetWrapIndentMode(static_cast<int>(wParam))) {
@@ -6747,7 +6747,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETWRAPINDENTMODE:
- return vs.wrapIndentMode;
+ return vs.wrap.indentMode;
case SCI_SETLAYOUTCACHE:
view.llc.SetLevel(static_cast<LineLayoutCache::Cache>(wParam));
@@ -7228,34 +7228,34 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return pdoc->GetMaxLineState();
case SCI_GETCARETLINEVISIBLE:
- return vs.showCaretLineBackground;
+ return vs.caretLine.show;
case SCI_SETCARETLINEVISIBLE:
- vs.showCaretLineBackground = wParam != 0;
+ vs.caretLine.show = wParam != 0;
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEVISIBLEALWAYS:
- return vs.alwaysShowCaretLineBackground;
+ return vs.caretLine.alwaysShow;
case SCI_SETCARETLINEVISIBLEALWAYS:
- vs.alwaysShowCaretLineBackground = wParam != 0;
+ vs.caretLine.alwaysShow = wParam != 0;
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEFRAME:
- return vs.caretLineFrame;
+ return vs.caretLine.frame;
case SCI_SETCARETLINEFRAME:
- vs.caretLineFrame = static_cast<int>(wParam);
+ vs.caretLine.frame = static_cast<int>(wParam);
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEBACK:
- return vs.caretLineBackground.OpaqueRGB();
+ return vs.caretLine.background.OpaqueRGB();
case SCI_SETCARETLINEBACK:
- vs.caretLineBackground = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.caretLine.background = ColourAlpha::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
case SCI_GETCARETLINEBACKALPHA:
- return vs.caretLineAlpha;
+ return vs.caretLine.alpha;
case SCI_SETCARETLINEBACKALPHA:
- vs.caretLineAlpha = static_cast<int>(wParam);
+ vs.caretLine.alpha = static_cast<int>(wParam);
InvalidateStyleRedraw();
break;
@@ -7404,31 +7404,31 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return LinesOnScreen();
case SCI_SETSELFORE:
- vs.selColours.fore = OptionalColour(wParam, lParam);
- vs.selAdditionalForeground = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.selection.colours.fore = OptionalColour(wParam, lParam);
+ vs.selection.additionalForeground = ColourAlpha::FromRGB(static_cast<int>(lParam));
InvalidateStyleRedraw();
break;
case SCI_SETSELBACK:
- vs.selColours.back = OptionalColour(wParam, lParam);
- vs.selAdditionalBackground = ColourAlpha::FromRGB(static_cast<int>(lParam));
+ vs.selection.colours.back = OptionalColour(wParam, lParam);
+ vs.selection.additionalBackground = ColourAlpha::FromRGB(static_cast<int>(lParam));
InvalidateStyleRedraw();
break;
case SCI_SETSELALPHA:
- vs.selAlpha = static_cast<int>(wParam);
- vs.selAdditionalAlpha = static_cast<int>(wParam);
+ vs.selection.alpha = static_cast<int>(wParam);
+ vs.selection.additionalAlpha = static_cast<int>(wParam);
InvalidateStyleRedraw();
break;
case SCI_GETSELALPHA:
- return vs.selAlpha;
+ return vs.selection.alpha;
case SCI_GETSELEOLFILLED:
- return vs.selEOLFilled;
+ return vs.selection.eolFilled;
case SCI_SETSELEOLFILLED:
- vs.selEOLFilled = wParam != 0;
+ vs.selection.eolFilled = wParam != 0;
InvalidateStyleRedraw();
break;
@@ -7443,32 +7443,32 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_SETCARETFORE:
- vs.caretcolour = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.caret.colour = ColourAlpha::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
case SCI_GETCARETFORE:
- return vs.caretcolour.OpaqueRGB();
+ return vs.caret.colour.OpaqueRGB();
case SCI_SETCARETSTYLE:
if (wParam <= (CARETSTYLE_BLOCK | CARETSTYLE_OVERSTRIKE_BLOCK | CARETSTYLE_BLOCK_AFTER))
- vs.caretStyle = static_cast<int>(wParam);
+ vs.caret.style = static_cast<int>(wParam);
else
/* Default to the line caret */
- vs.caretStyle = CARETSTYLE_LINE;
+ vs.caret.style = CARETSTYLE_LINE;
InvalidateStyleRedraw();
break;
case SCI_GETCARETSTYLE:
- return vs.caretStyle;
+ return vs.caret.style;
case SCI_SETCARETWIDTH:
- vs.caretWidth = std::clamp(static_cast<int>(wParam), 0, 20);
+ vs.caret.width = std::clamp(static_cast<int>(wParam), 0, 20);
InvalidateStyleRedraw();
break;
case SCI_GETCARETWIDTH:
- return vs.caretWidth;
+ return vs.caret.width;
case SCI_ASSIGNCMDKEY:
kmap.AssignCmdKey(LowShortFromWParam(wParam),
@@ -8405,30 +8405,30 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return virtualSpaceOptions;
case SCI_SETADDITIONALSELFORE:
- vs.selAdditionalForeground = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.selection.additionalForeground = ColourAlpha::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
case SCI_SETADDITIONALSELBACK:
- vs.selAdditionalBackground = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.selection.additionalBackground = ColourAlpha::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
case SCI_SETADDITIONALSELALPHA:
- vs.selAdditionalAlpha = static_cast<int>(wParam);
+ vs.selection.additionalAlpha = static_cast<int>(wParam);
InvalidateStyleRedraw();
break;
case SCI_GETADDITIONALSELALPHA:
- return vs.selAdditionalAlpha;
+ return vs.selection.additionalAlpha;
case SCI_SETADDITIONALCARETFORE:
- vs.additionalCaretColour = ColourAlpha::FromRGB(static_cast<int>(wParam));
+ vs.caret.additionalColour = ColourAlpha::FromRGB(static_cast<int>(wParam));
InvalidateStyleRedraw();
break;
case SCI_GETADDITIONALCARETFORE:
- return vs.additionalCaretColour.OpaqueRGB();
+ return vs.caret.additionalColour.OpaqueRGB();
case SCI_ROTATESELECTION:
sel.RotateMain();
diff --git a/src/MarginView.cxx b/src/MarginView.cxx
index 2382ce1a8..0c0045133 100644
--- a/src/MarginView.cxx
+++ b/src/MarginView.cxx
@@ -391,7 +391,7 @@ void MarginView::PaintMargin(Surface *surface, Sci::Line topLine, PRectangle rc,
rcNumber.left = xpos;
DrawTextNoClipPhase(surface, rcNumber, vs.styles[STYLE_LINENUMBER],
rcNumber.top + vs.maxAscent, sNumber, DrawPhase::all);
- } else if (vs.wrapVisualFlags & SC_WRAPVISUALFLAG_MARGIN) {
+ } else if (vs.wrap.visualFlags & SC_WRAPVISUALFLAG_MARGIN) {
PRectangle rcWrapMarker = rcMarker;
rcWrapMarker.right -= wrapMarkerPaddingRight;
rcWrapMarker.left = rcWrapMarker.right - vs.styles[STYLE_LINENUMBER].aveCharWidth;
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 56cfcf188..f5ecf84c8 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -83,13 +83,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicat
indicatorsDynamic = source.indicatorsDynamic;
indicatorsSetFore = source.indicatorsSetFore;
- selColours = source.selColours;
- selAdditionalForeground = source.selAdditionalForeground;
- selAdditionalBackground = source.selAdditionalBackground;
- selBackground2 = source.selBackground2;
- selAlpha = source.selAlpha;
- selAdditionalAlpha = source.selAdditionalAlpha;
- selEOLFilled = source.selEOLFilled;
+ selection = source.selection;
foldmarginColour = source.foldmarginColour;
foldmarginHighlightColour = source.foldmarginHighlightColour;
@@ -102,15 +96,8 @@ ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicat
controlCharWidth = source.controlCharWidth;
selbar = source.selbar;
selbarlight = source.selbarlight;
- caretcolour = source.caretcolour;
- additionalCaretColour = source.additionalCaretColour;
- caretLineFrame = source.caretLineFrame;
- showCaretLineBackground = source.showCaretLineBackground;
- alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground;
- caretLineBackground = source.caretLineBackground;
- caretLineAlpha = source.caretLineAlpha;
- caretStyle = source.caretStyle;
- caretWidth = source.caretWidth;
+ caret = source.caret;
+ caretLine = source.caretLine;
someStylesProtected = false;
someStylesForceCase = false;
leftMarginWidth = source.leftMarginWidth;
@@ -148,11 +135,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) : markers(MARKER_MAX + 1), indicat
ctrlCharPadding = source.ctrlCharPadding;
lastSegItalicsOffset = source.lastSegItalicsOffset;
- wrapState = source.wrapState;
- wrapVisualFlags = source.wrapVisualFlags;
- wrapVisualFlagsLocation = source.wrapVisualFlagsLocation;
- wrapVisualStartIndent = source.wrapVisualStartIndent;
- wrapIndentMode = source.wrapIndentMode;
+ wrap = source.wrap;
localeName = source.localeName;
}
@@ -212,14 +195,14 @@ void ViewStyle::Init(size_t stylesSize_) {
spaceWidth = 8;
tabWidth = spaceWidth * 8;
- selColours.fore.reset();
- selColours.back = ColourAlpha(0xc0, 0xc0, 0xc0);
- selAdditionalForeground = ColourAlpha(0xff, 0, 0);
- selAdditionalBackground = ColourAlpha(0xd7, 0xd7, 0xd7);
- selBackground2 = ColourAlpha(0xb0, 0xb0, 0xb0);
- selAlpha = SC_ALPHA_NOALPHA;
- selAdditionalAlpha = SC_ALPHA_NOALPHA;
- selEOLFilled = false;
+ selection.colours.fore.reset();
+ selection.colours.back = ColourAlpha(0xc0, 0xc0, 0xc0);
+ selection.additionalForeground = ColourAlpha(0xff, 0, 0);
+ selection.additionalBackground = ColourAlpha(0xd7, 0xd7, 0xd7);
+ selection.background2 = ColourAlpha(0xb0, 0xb0, 0xb0);
+ selection.alpha = SC_ALPHA_NOALPHA;
+ selection.additionalAlpha = SC_ALPHA_NOALPHA;
+ selection.eolFilled = false;
foldmarginColour.reset();
foldmarginHighlightColour.reset();
@@ -232,15 +215,18 @@ void ViewStyle::Init(size_t stylesSize_) {
selbarlight = Platform::ChromeHighlight();
styles[STYLE_LINENUMBER].fore = ColourAlpha(0, 0, 0);
styles[STYLE_LINENUMBER].back = Platform::Chrome();
- caretcolour = ColourAlpha(0, 0, 0);
- additionalCaretColour = ColourAlpha(0x7f, 0x7f, 0x7f);
- caretLineFrame = 0;
- showCaretLineBackground = false;
- alwaysShowCaretLineBackground = false;
- caretLineBackground = ColourAlpha(0xff, 0xff, 0);
- caretLineAlpha = SC_ALPHA_NOALPHA;
- caretStyle = CARETSTYLE_LINE;
- caretWidth = 1;
+
+ caret.colour = ColourAlpha(0, 0, 0);
+ caret.additionalColour = ColourAlpha(0x7f, 0x7f, 0x7f);
+ caret.style = CARETSTYLE_LINE;
+ caret.width = 1;
+
+ caretLine.background = ColourAlpha(0xff, 0xff, 0);
+ caretLine.show = false;
+ caretLine.alwaysShow = false;
+ caretLine.alpha = SC_ALPHA_NOALPHA;
+ caretLine.frame = 0;
+
someStylesProtected = false;
someStylesForceCase = false;
@@ -283,11 +269,11 @@ void ViewStyle::Init(size_t stylesSize_) {
ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side
lastSegItalicsOffset = 2;
- wrapState = WrapMode::none;
- wrapVisualFlags = 0;
- wrapVisualFlagsLocation = 0;
- wrapVisualStartIndent = 0;
- wrapIndentMode = SC_WRAPINDENT_FIXED;
+ wrap.state = WrapMode::none;
+ wrap.visualFlags = 0;
+ wrap.visualFlagsLocation = 0;
+ wrap.visualStartIndent = 0;
+ wrap.indentMode = SC_WRAPINDENT_FIXED;
localeName = localeNameDefault;
}
@@ -448,12 +434,12 @@ void ViewStyle::CalcLargestMarkerHeight() noexcept {
}
int ViewStyle::GetFrameWidth() const noexcept {
- return std::clamp(caretLineFrame, 1, lineHeight / 3);
+ return std::clamp(caretLine.frame, 1, lineHeight / 3);
}
bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) const noexcept {
- return caretLineFrame && (caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground &&
- (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret;
+ return caretLine.frame && (caretActive || caretLine.alwaysShow) && caretLine.show &&
+ (caretLine.alpha == SC_ALPHA_NOALPHA) && lineContainsCaret;
}
// See if something overrides the line background colour: Either if caret is on the line
@@ -464,9 +450,9 @@ bool ViewStyle::IsLineFrameOpaque(bool caretActive, bool lineContainsCaret) cons
// the colour for the highest numbered one is used.
std::optional<ColourAlpha> ViewStyle::Background(int marksOfLine, bool caretActive, bool lineContainsCaret) const {
std::optional<ColourAlpha> background;
- if (!caretLineFrame && (caretActive || alwaysShowCaretLineBackground) && showCaretLineBackground &&
- (caretLineAlpha == SC_ALPHA_NOALPHA) && lineContainsCaret) {
- background = caretLineBackground;
+ if (!caretLine.frame && (caretActive || caretLine.alwaysShow) && caretLine.show &&
+ (caretLine.alpha == SC_ALPHA_NOALPHA) && lineContainsCaret) {
+ background = caretLine.background;
}
if (!background && marksOfLine) {
int marks = marksOfLine;
@@ -494,8 +480,8 @@ std::optional<ColourAlpha> ViewStyle::Background(int marksOfLine, bool caretActi
}
bool ViewStyle::SelectionBackgroundDrawn() const noexcept {
- return selColours.back &&
- ((selAlpha == SC_ALPHA_NOALPHA) || (selAdditionalAlpha == SC_ALPHA_NOALPHA));
+ return selection.colours.back &&
+ ((selection.alpha == SC_ALPHA_NOALPHA) || (selection.additionalAlpha == SC_ALPHA_NOALPHA));
}
bool ViewStyle::WhitespaceBackgroundDrawn() const noexcept {
@@ -553,59 +539,59 @@ bool ViewStyle::SetWrapState(int wrapState_) noexcept {
wrapStateWanted = WrapMode::none;
break;
}
- const bool changed = wrapState != wrapStateWanted;
- wrapState = wrapStateWanted;
+ const bool changed = wrap.state != wrapStateWanted;
+ wrap.state = wrapStateWanted;
return changed;
}
bool ViewStyle::SetWrapVisualFlags(int wrapVisualFlags_) noexcept {
- const bool changed = wrapVisualFlags != wrapVisualFlags_;
- wrapVisualFlags = wrapVisualFlags_;
+ const bool changed = wrap.visualFlags != wrapVisualFlags_;
+ wrap.visualFlags = wrapVisualFlags_;
return changed;
}
bool ViewStyle::SetWrapVisualFlagsLocation(int wrapVisualFlagsLocation_) noexcept {
- const bool changed = wrapVisualFlagsLocation != wrapVisualFlagsLocation_;
- wrapVisualFlagsLocation = wrapVisualFlagsLocation_;
+ const bool changed = wrap.visualFlagsLocation != wrapVisualFlagsLocation_;
+ wrap.visualFlagsLocation = wrapVisualFlagsLocation_;
return changed;
}
bool ViewStyle::SetWrapVisualStartIndent(int wrapVisualStartIndent_) noexcept {
- const bool changed = wrapVisualStartIndent != wrapVisualStartIndent_;
- wrapVisualStartIndent = wrapVisualStartIndent_;
+ const bool changed = wrap.visualStartIndent != wrapVisualStartIndent_;
+ wrap.visualStartIndent = wrapVisualStartIndent_;
return changed;
}
bool ViewStyle::SetWrapIndentMode(int wrapIndentMode_) noexcept {
- const bool changed = wrapIndentMode != wrapIndentMode_;
- wrapIndentMode = wrapIndentMode_;
+ const bool changed = wrap.indentMode != wrapIndentMode_;
+ wrap.indentMode = wrapIndentMode_;
return changed;
}
bool ViewStyle::IsBlockCaretStyle() const noexcept {
- return ((caretStyle & CARETSTYLE_INS_MASK) == CARETSTYLE_BLOCK) ||
- (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0;
+ return ((caret.style & CARETSTYLE_INS_MASK) == CARETSTYLE_BLOCK) ||
+ (caret.style & CARETSTYLE_OVERSTRIKE_BLOCK) != 0;
}
bool ViewStyle::IsCaretVisible() const noexcept {
- return caretWidth > 0 && caretStyle != CARETSTYLE_INVISIBLE;
+ return caret.width > 0 && caret.style != CARETSTYLE_INVISIBLE;
}
bool ViewStyle::DrawCaretInsideSelection(bool inOverstrike, bool imeCaretBlockOverride) const noexcept {
- if (caretStyle & CARETSTYLE_BLOCK_AFTER)
+ if (caret.style & CARETSTYLE_BLOCK_AFTER)
return false;
- return ((caretStyle & CARETSTYLE_INS_MASK) == CARETSTYLE_BLOCK) ||
- (inOverstrike && (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) != 0) ||
+ return ((caret.style & CARETSTYLE_INS_MASK) == CARETSTYLE_BLOCK) ||
+ (inOverstrike && (caret.style & CARETSTYLE_OVERSTRIKE_BLOCK) != 0) ||
imeCaretBlockOverride;
}
ViewStyle::CaretShape ViewStyle::CaretShapeForMode(bool inOverstrike) const noexcept {
if (inOverstrike) {
- return (caretStyle & CARETSTYLE_OVERSTRIKE_BLOCK) ? CaretShape::block : CaretShape::bar;
+ return (caret.style & CARETSTYLE_OVERSTRIKE_BLOCK) ? CaretShape::block : CaretShape::bar;
}
- const int caret = caretStyle & CARETSTYLE_INS_MASK;
- return (caret <= CARETSTYLE_BLOCK) ? static_cast<CaretShape>(caret) : CaretShape::line;
+ const int caretStyle = caret.style & CARETSTYLE_INS_MASK;
+ return (caretStyle <= CARETSTYLE_BLOCK) ? static_cast<CaretShape>(caretStyle) : CaretShape::line;
}
void ViewStyle::AllocStyles(size_t sizeNew) {
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index e672acd8c..c47c91ee8 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -63,6 +63,59 @@ struct ForeBackColours {
std::optional<ColourAlpha> back;
};
+struct SelectionAppearance {
+ // Colours of main selection
+ ForeBackColours colours;
+ // Colours of additional (non-main) selections
+ ColourAlpha additionalForeground;
+ ColourAlpha additionalBackground;
+ // Background colour on X when not primary selection
+ ColourAlpha background2;
+ // Translucency. SC_ALPHA_NOALPHA: draw selection background beneath text
+ int alpha;
+ // Translucency of additional selections
+ int additionalAlpha;
+ // Draw selection past line end characters up to right border
+ bool eolFilled;
+};
+
+struct CaretLineAppearance {
+ // Colour of caret line
+ ColourAlpha background;
+ // Whether to show the caret line
+ bool show;
+ // Also show when non-focused
+ bool alwaysShow;
+ // Translucency. SC_ALPHA_NOALPHA: draw selection background beneath text
+ int alpha;
+ // Non-0: draw a rectangle around line instead of filling line. Value is pixel width of frame
+ int frame;
+};
+
+struct CaretAppearance {
+ // Colour of caret
+ ColourAlpha colour;
+ // Colour of additional (non-main) carets
+ ColourAlpha additionalColour;
+ // Line, block, over-strike bar ...
+ int style;
+ // Width in pixels
+ int width;
+};
+
+struct WrapAppearance {
+ // No wrapping, word, character, whitespace appearance
+ WrapMode state;
+ // Show indication of wrap at line end, line start, or in margin
+ int visualFlags;
+ // Show indication near margin or near text
+ int visualFlagsLocation;
+ // How much indentation to show wrapping
+ int visualStartIndent;
+ // SC_WRAPINDENT_FIXED, _SAME, _INDENT, _DEEPINDENT
+ int indentMode;
+};
+
struct EdgeProperties {
int column = 0;
ColourAlpha colour;
@@ -95,13 +148,9 @@ public:
XYPOSITION aveCharWidth;
XYPOSITION spaceWidth;
XYPOSITION tabWidth;
- ForeBackColours selColours;
- ColourAlpha selAdditionalForeground;
- ColourAlpha selAdditionalBackground;
- ColourAlpha selBackground2;
- int selAlpha;
- int selAdditionalAlpha;
- bool selEOLFilled;
+
+ SelectionAppearance selection;
+
ForeBackColours whitespaceColours;
int controlCharSymbol;
XYPOSITION controlCharWidth;
@@ -126,15 +175,11 @@ public:
int whitespaceSize;
IndentView viewIndentationGuides;
bool viewEOL;
- ColourAlpha caretcolour;
- ColourAlpha additionalCaretColour;
- int caretLineFrame;
- bool showCaretLineBackground;
- bool alwaysShowCaretLineBackground;
- ColourAlpha caretLineBackground;
- int caretLineAlpha;
- int caretStyle;
- int caretWidth;
+
+ CaretAppearance caret;
+
+ CaretLineAppearance caretLine;
+
bool someStylesProtected;
bool someStylesForceCase;
int extraFontFlag;
@@ -159,12 +204,7 @@ public:
std::map<int, std::optional<ColourAlpha>> elementColours;
std::set<int> elementAllowsTranslucent;
- // Wrapping support
- WrapMode wrapState;
- int wrapVisualFlags;
- int wrapVisualFlagsLocation;
- int wrapVisualStartIndent;
- int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
+ WrapAppearance wrap;
std::string localeName;