diff options
-rw-r--r-- | doc/ScintillaDoc.html | 10 | ||||
-rw-r--r-- | doc/ScintillaHistory.html | 6 | ||||
-rw-r--r-- | include/Scintilla.h | 1 | ||||
-rw-r--r-- | include/Scintilla.iface | 1 | ||||
-rw-r--r-- | 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 @@ <h1>Scintilla Documentation</h1> - <p>Last edited 16 October 2014 NH</p> + <p>Last edited 16 November 2014 NH</p> <p>There is <a class="jump" href="Design.html">an overview of the internal design of Scintilla</a>.<br /> @@ -3160,6 +3160,14 @@ struct Sci_TextToFind { <td>Annotations are indented to match the text and are surrounded by a box.</td> </tr> + + <tr> + <th align="left"><code>ANNOTATION_INDENTED</code></th> + + <td>3</td> + + <td>Annotations are indented to match the text.</td> + </tr> </tbody> </table> 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 @@ <td>Mat Berchtold</td> <td>Michael Staszewski</td> <td>Baurzhan Muftakhidinov</td> + </tr><tr> + <td>Erik Angelin</td> </tr> </table> <p> @@ -493,6 +495,10 @@ ensure no clash between the use of indicators for IME and for the application. </li> <li> + ANNOTATION_INDENTED added which is similar to ANNOTATION_BOXED in terms of positioning + but does not show a border. + </li> + <li> VHDL folder fixes "block" keyword. <a href="http://sourceforge.net/p/scintilla/bugs/1664/">Bug #1664</a>. </li> 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<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; |