summaryrefslogtreecommitdiffstats
path: root/scintilla/src/EditView.cxx
diff options
context:
space:
mode:
authorXhmikosR <xhmikosr@gmail.com>2014-11-29 09:03:13 +0200
committerXhmikosR <xhmikosr@gmail.com>2014-12-02 08:23:18 +0200
commit2e039e98e11ee39865953a2e187c2f8120e80309 (patch)
treeeadb80c7163cf56614e340ca42861562c050cbb0 /scintilla/src/EditView.cxx
parent7862c2ee763d360931aacba8d2517d3739f0d98a (diff)
downloadnotepad2-mod-2e039e98e11ee39865953a2e187c2f8120e80309.zip
notepad2-mod-2e039e98e11ee39865953a2e187c2f8120e80309.tar.gz
notepad2-mod-2e039e98e11ee39865953a2e187c2f8120e80309.tar.bz2
Update scintilla to 3.5.2 [a797ff].
Diffstat (limited to 'scintilla/src/EditView.cxx')
-rw-r--r--scintilla/src/EditView.cxx45
1 files changed, 31 insertions, 14 deletions
diff --git a/scintilla/src/EditView.cxx b/scintilla/src/EditView.cxx
index 7d5860e..4976d36 100644
--- a/scintilla/src/EditView.cxx
+++ b/scintilla/src/EditView.cxx
@@ -12,6 +12,7 @@
#include <assert.h>
#include <ctype.h>
+#include <stdexcept>
#include <string>
#include <vector>
#include <map>
@@ -185,6 +186,9 @@ EditView::EditView() {
pixmapIndentGuideHighlight = 0;
llc.SetLevel(LineLayoutCache::llcCaret);
posCache.SetSize(0x400);
+ tabArrowHeight = 4;
+ customDrawTabArrow = NULL;
+ customDrawWrapMarker = NULL;
}
EditView::~EditView() {
@@ -927,7 +931,11 @@ void EditView::DrawEOL(Surface *surface, const EditModel &model, const ViewStyle
rcPlace.right = rcLine.right;
rcPlace.left = rcPlace.right - vsDraw.aveCharWidth;
}
- DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
+ if (customDrawWrapMarker == NULL) {
+ DrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
+ } else {
+ customDrawWrapMarker(surface, rcPlace, true, vsDraw.WrapColour());
+ }
}
}
@@ -991,6 +999,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);
@@ -1002,18 +1014,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;
@@ -1025,7 +1035,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;
@@ -1201,7 +1211,7 @@ void EditView::DrawCarets(Surface *surface, const EditModel &model, const ViewSt
}
static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, const LineLayout *ll,
- int xStart, PRectangle rcLine, ColourOptional background) {
+ int xStart, PRectangle rcLine, ColourOptional background, DrawWrapMarkerFn customDrawWrapMarker) {
// default bgnd here..
surface->FillRectangle(rcLine, background.isSet ? background :
vsDraw.styles[STYLE_DEFAULT].back);
@@ -1219,7 +1229,11 @@ static void DrawWrapIndentAndMarker(Surface *surface, const ViewStyle &vsDraw, c
else
rcPlace.right = rcPlace.left + vsDraw.aveCharWidth;
- DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
+ if (customDrawWrapMarker == NULL) {
+ DrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
+ } else {
+ customDrawWrapMarker(surface, rcPlace, false, vsDraw.WrapColour());
+ }
}
}
@@ -1463,9 +1477,12 @@ void EditView::DrawForeground(Surface *surface, const EditModel &model, const Vi
if (vsDraw.whitespaceColours.fore.isSet)
textFore = vsDraw.whitespaceColours.fore;
surface->PenColour(textFore);
- PRectangle rcTab(rcSegment.left + 1, rcSegment.top + 4,
+ PRectangle rcTab(rcSegment.left + 1, rcSegment.top + tabArrowHeight,
rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent);
- DrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));
+ if (customDrawTabArrow == NULL)
+ DrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));
+ else
+ customDrawTabArrow(surface, rcTab, static_cast<int>(rcSegment.top + vsDraw.lineHeight / 2));
}
}
} else {
@@ -1632,7 +1649,7 @@ void EditView::DrawLine(Surface *surface, const EditModel &model, const ViewStyl
if ((ll->wrapIndent != 0) && (subLine > 0)) {
if (phase & drawBack) {
- DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background);
+ DrawWrapIndentAndMarker(surface, vsDraw, ll, xStart, rcLine, background, customDrawWrapMarker);
}
xStart += static_cast<int>(ll->wrapIndent);
}