From 44fd19fb024c20194865c4fb49806fe060350f3e Mon Sep 17 00:00:00 2001 From: Erik Angelin Date: Fri, 14 Nov 2014 10:41:27 +0100 Subject: Feature [feature-requests:#1086]. Annotation display style ANNOTATION_INDENTED; like _BOXED but no border. --- doc/ScintillaDoc.html | 10 +++++++++- doc/ScintillaHistory.html | 6 ++++++ include/Scintilla.h | 1 + include/Scintilla.iface | 1 + src/EditView.cxx | 18 ++++++++++-------- 5 files changed, 27 insertions(+), 9 deletions(-) diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index e21be5e6a..068dbdf9d 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -82,7 +82,7 @@

Scintilla Documentation

-

Last edited 16 October 2014 NH

+

Last edited 16 November 2014 NH

There is an overview of the internal design of Scintilla.
@@ -3160,6 +3160,14 @@ struct Sci_TextToFind { Annotations are indented to match the text and are surrounded by a box. + + + ANNOTATION_INDENTED + + 3 + + Annotations are indented to match the text. + diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 61ed3b7bc..5be8e6b89 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -460,6 +460,8 @@ Mat Berchtold Michael Staszewski Baurzhan Muftakhidinov + + Erik Angelin

@@ -493,6 +495,10 @@ ensure no clash between the use of indicators for IME and for the application.

  • + ANNOTATION_INDENTED added which is similar to ANNOTATION_BOXED in terms of positioning + but does not show a border. +
  • +
  • VHDL folder fixes "block" keyword. Bug #1664.
  • diff --git a/include/Scintilla.h b/include/Scintilla.h index b972512c3..9779cfee6 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -818,6 +818,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define ANNOTATION_HIDDEN 0 #define ANNOTATION_STANDARD 1 #define ANNOTATION_BOXED 2 +#define ANNOTATION_INDENTED 3 #define SCI_ANNOTATIONSETVISIBLE 2548 #define SCI_ANNOTATIONGETVISIBLE 2549 #define SCI_ANNOTATIONSETSTYLEOFFSET 2550 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index bfbffd878..e8c96591b 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2157,6 +2157,7 @@ enu AnnotationVisible=ANNOTATION_ val ANNOTATION_HIDDEN=0 val ANNOTATION_STANDARD=1 val ANNOTATION_BOXED=2 +val ANNOTATION_INDENTED=3 # Set the visibility for the annotations for a view set void AnnotationSetVisible=2548(int visible,) 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(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(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(vsDraw.spaceWidth * 2); // Margins - } - if (widthAnnotation > lineWidthMaxSeen) - lineWidthMaxSeen = widthAnnotation; - if (vsDraw.annotationVisible == ANNOTATION_BOXED) { rcSegment.left = static_cast(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; -- cgit v1.2.3