aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorA-R-C-A <unknown>2016-09-23 18:07:56 +1000
committerA-R-C-A <unknown>2016-09-23 18:07:56 +1000
commitfdb8953cdffa47ff9f13f1cc173e1cb2df191019 (patch)
tree376de5daa3f3ea982434f9237b732274179ca6a7 /src
parentbb4c51c3f14a3d38b5568e4f12ecfa32b4ec826e (diff)
downloadscintilla-mirror-fdb8953cdffa47ff9f13f1cc173e1cb2df191019.tar.gz
EDGE_MULTILINE and SCI_MULTIEDGEADDLINE added to allow displaying multiple
vertical edges simultaneously.
Diffstat (limited to 'src')
-rw-r--r--src/EditView.cxx33
-rw-r--r--src/Editor.cxx18
-rw-r--r--src/ViewStyle.cxx9
-rw-r--r--src/ViewStyle.h17
4 files changed, 59 insertions, 18 deletions
diff --git a/src/EditView.cxx b/src/EditView.cxx
index 9ca6e95ad..074c23fc9 100644
--- a/src/EditView.cxx
+++ b/src/EditView.cxx
@@ -417,7 +417,7 @@ void EditView::LayoutLine(const EditModel &model, int line, Surface *surface, co
ll->widthLine = LineLayout::wrapWidthInfinite;
ll->lines = 1;
if (vstyle.edgeState == EDGE_BACKGROUND) {
- ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge);
+ ll->edgeColumn = model.pdoc->FindColumn(line, vstyle.theEdge.column);
if (ll->edgeColumn >= posLineStart) {
ll->edgeColumn -= posLineStart;
}
@@ -749,7 +749,7 @@ static ColourDesired TextBackground(const EditModel &model, const ViewStyle &vsD
if ((vsDraw.edgeState == EDGE_BACKGROUND) &&
(i >= ll->edgeColumn) &&
(i < ll->numCharsBeforeEOL))
- return vsDraw.edgecolour;
+ return vsDraw.theEdge.colour;
if (inHotspot && vsDraw.hotspotColours.back.isSet)
return vsDraw.hotspotColours.back;
}
@@ -1339,12 +1339,24 @@ static void DrawEdgeLine(Surface *surface, const ViewStyle &vsDraw, const LineLa
Range lineRange, int xStart) {
if (vsDraw.edgeState == EDGE_LINE) {
PRectangle rcSegment = rcLine;
- int edgeX = static_cast<int>(vsDraw.theEdge * vsDraw.spaceWidth);
+ int edgeX = static_cast<int>(vsDraw.theEdge.column * vsDraw.spaceWidth);
rcSegment.left = static_cast<XYPOSITION>(edgeX + xStart);
if ((ll->wrapIndent != 0) && (lineRange.start != 0))
rcSegment.left -= ll->wrapIndent;
rcSegment.right = rcSegment.left + 1;
- surface->FillRectangle(rcSegment, vsDraw.edgecolour);
+ surface->FillRectangle(rcSegment, vsDraw.theEdge.colour);
+ } else if (vsDraw.edgeState == EDGE_MULTILINE) {
+ for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) {
+ if (vsDraw.theMultiEdge[edge].column >= 0) {
+ PRectangle rcSegment = rcLine;
+ int edgeX = static_cast<int>(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth);
+ rcSegment.left = static_cast<XYPOSITION>(edgeX + xStart);
+ if ((ll->wrapIndent != 0) && (lineRange.start != 0))
+ rcSegment.left -= ll->wrapIndent;
+ rcSegment.right = rcSegment.left + 1;
+ surface->FillRectangle(rcSegment, vsDraw.theMultiEdge[edge].colour);
+ }
+ }
}
}
@@ -1919,10 +1931,19 @@ void EditView::PaintText(Surface *surfaceWindow, const EditModel &model, PRectan
if (rcBeyondEOF.top < rcBeyondEOF.bottom) {
surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.styles[STYLE_DEFAULT].back);
if (vsDraw.edgeState == EDGE_LINE) {
- int edgeX = static_cast<int>(vsDraw.theEdge * vsDraw.spaceWidth);
+ int edgeX = static_cast<int>(vsDraw.theEdge.column * vsDraw.spaceWidth);
rcBeyondEOF.left = static_cast<XYPOSITION>(edgeX + xStart);
rcBeyondEOF.right = rcBeyondEOF.left + 1;
- surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.edgecolour);
+ surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theEdge.colour);
+ } else if (vsDraw.edgeState == EDGE_MULTILINE) {
+ for (size_t edge = 0; edge < vsDraw.theMultiEdge.size(); edge++) {
+ if (vsDraw.theMultiEdge[edge].column >= 0) {
+ int edgeX = static_cast<int>(vsDraw.theMultiEdge[edge].column * vsDraw.spaceWidth);
+ rcBeyondEOF.left = static_cast<XYPOSITION>(edgeX + xStart);
+ rcBeyondEOF.right = rcBeyondEOF.left + 1;
+ surfaceWindow->FillRectangle(rcBeyondEOF, vsDraw.theMultiEdge[edge].colour);
+ }
+ }
}
}
//Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset);
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 12ec73239..beec634d3 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -7433,10 +7433,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return vs.zoomLevel;
case SCI_GETEDGECOLUMN:
- return vs.theEdge;
+ return vs.theEdge.column;
case SCI_SETEDGECOLUMN:
- vs.theEdge = static_cast<int>(wParam);
+ vs.theEdge.column = static_cast<int>(wParam);
InvalidateStyleRedraw();
break;
@@ -7449,10 +7449,20 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
break;
case SCI_GETEDGECOLOUR:
- return vs.edgecolour.AsLong();
+ return vs.theEdge.colour.AsLong();
case SCI_SETEDGECOLOUR:
- vs.edgecolour = ColourDesired(static_cast<long>(wParam));
+ vs.theEdge.colour = ColourDesired(static_cast<long>(wParam));
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_MULTIEDGEADDLINE:
+ vs.theMultiEdge.push_back(EdgeProperties(wParam, lParam));
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_MULTIEDGECLEARALL:
+ std::vector<EdgeProperties>().swap(vs.theMultiEdge); // Free vector and memory, C++03 compatible
InvalidateStyleRedraw();
break;
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index ae68d8bff..33be28422 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -139,8 +139,6 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
alwaysShowCaretLineBackground = source.alwaysShowCaretLineBackground;
caretLineBackground = source.caretLineBackground;
caretLineAlpha = source.caretLineAlpha;
- edgecolour = source.edgecolour;
- edgeState = source.edgeState;
caretStyle = source.caretStyle;
caretWidth = source.caretWidth;
someStylesProtected = false;
@@ -171,7 +169,9 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
braceBadLightIndicatorSet = source.braceBadLightIndicatorSet;
braceBadLightIndicator = source.braceBadLightIndicator;
+ edgeState = source.edgeState;
theEdge = source.theEdge;
+ theMultiEdge = source.theMultiEdge;
marginNumberPadding = source.marginNumberPadding;
ctrlCharPadding = source.ctrlCharPadding;
@@ -268,8 +268,6 @@ void ViewStyle::Init(size_t stylesSize_) {
alwaysShowCaretLineBackground = false;
caretLineBackground = ColourDesired(0xff, 0xff, 0);
caretLineAlpha = SC_ALPHA_NOALPHA;
- edgecolour = ColourDesired(0xc0, 0xc0, 0xc0);
- edgeState = EDGE_NONE;
caretStyle = CARETSTYLE_LINE;
caretWidth = 1;
someStylesProtected = false;
@@ -310,7 +308,8 @@ void ViewStyle::Init(size_t stylesSize_) {
braceBadLightIndicatorSet = false;
braceBadLightIndicator = 0;
- theEdge = 0;
+ edgeState = EDGE_NONE;
+ theEdge = EdgeProperties(0, ColourDesired(0xc0, 0xc0, 0xc0));
marginNumberPadding = 3;
ctrlCharPadding = 3; // +3 For a blank on front and rounded edge each side
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index d5a9d5b71..be84598f1 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -72,6 +72,17 @@ struct ForeBackColours {
ColourOptional back;
};
+struct EdgeProperties {
+ int column;
+ ColourDesired colour;
+ EdgeProperties(int column_ = 0, ColourDesired colour_ = ColourDesired(0)) :
+ column(column_), colour(colour_) {
+ }
+ EdgeProperties(uptr_t wParam, sptr_t lParam) :
+ column(static_cast<int>(wParam)), colour(static_cast<long>(lParam)) {
+ }
+};
+
/**
*/
class ViewStyle {
@@ -130,8 +141,6 @@ public:
bool alwaysShowCaretLineBackground;
ColourDesired caretLineBackground;
int caretLineAlpha;
- ColourDesired edgecolour;
- int edgeState;
int caretStyle;
int caretWidth;
bool someStylesProtected;
@@ -146,7 +155,9 @@ public:
int braceHighlightIndicator;
bool braceBadLightIndicatorSet;
int braceBadLightIndicator;
- int theEdge;
+ int edgeState;
+ EdgeProperties theEdge;
+ std::vector<EdgeProperties> theMultiEdge;
int marginNumberPadding; // the right-side padding of the number margin
int ctrlCharPadding; // the padding around control character text blobs
int lastSegItalicsOffset; // the offset so as not to clip italic characters at EOLs