diff options
author | Erik Angelin <erik.angelin@gmail.com> | 2014-11-14 10:41:27 +0100 |
---|---|---|
committer | Erik Angelin <erik.angelin@gmail.com> | 2014-11-14 10:41:27 +0100 |
commit | 44fd19fb024c20194865c4fb49806fe060350f3e (patch) | |
tree | e4788ad3ca5c16dbbe616097cea75a84fe89b1b7 /src | |
parent | 28740fc0e339b42f12ac7731820ced97d099f2cf (diff) | |
download | scintilla-mirror-44fd19fb024c20194865c4fb49806fe060350f3e.tar.gz |
Feature [feature-requests:#1086]. Annotation display style ANNOTATION_INDENTED;
like _BOXED but no border.
Diffstat (limited to 'src')
-rw-r--r-- | src/EditView.cxx | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx index f1d201f15..845d38dc5 100644 --- a/src/EditView.cxx +++ b/src/EditView.cxx @@ -992,6 +992,10 @@ static void DrawIndicators(Surface *surface, const EditModel &model, const ViewS } } +static bool AnnotationBoxedOrIndented(int annotationVisible) { + return annotationVisible == ANNOTATION_BOXED || annotationVisible == ANNOTATION_INDENTED; +} + void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const ViewStyle &vsDraw, const LineLayout *ll, int line, int xStart, PRectangle rcLine, int subLine, DrawPhase phase) { int indent = static_cast<int>(model.pdoc->GetLineIndentation(line) * vsDraw.spaceWidth); @@ -1003,18 +1007,16 @@ void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const Vi surface->FillRectangle(rcSegment, vsDraw.styles[0].back); } rcSegment.left = static_cast<XYPOSITION>(xStart); - if (model.trackLineWidth || (vsDraw.annotationVisible == ANNOTATION_BOXED)) { - // Only care about calculating width if tracking or need to draw box + if (model.trackLineWidth || AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { + // Only care about calculating width if tracking or need to draw indented box int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation); - if (vsDraw.annotationVisible == ANNOTATION_BOXED) { + if (AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { widthAnnotation += static_cast<int>(vsDraw.spaceWidth * 2); // Margins - } - if (widthAnnotation > lineWidthMaxSeen) - lineWidthMaxSeen = widthAnnotation; - if (vsDraw.annotationVisible == ANNOTATION_BOXED) { rcSegment.left = static_cast<XYPOSITION>(xStart + indent); rcSegment.right = rcSegment.left + widthAnnotation; } + if (widthAnnotation > lineWidthMaxSeen) + lineWidthMaxSeen = widthAnnotation; } const int annotationLines = model.pdoc->AnnotationLines(line); size_t start = 0; @@ -1026,7 +1028,7 @@ void EditView::DrawAnnotation(Surface *surface, const EditModel &model, const Vi lineInAnnotation++; } PRectangle rcText = rcSegment; - if ((phase & drawBack) && (vsDraw.annotationVisible == ANNOTATION_BOXED)) { + if ((phase & drawBack) && AnnotationBoxedOrIndented(vsDraw.annotationVisible)) { surface->FillRectangle(rcText, vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back); rcText.left += vsDraw.spaceWidth; |