aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2002-08-05 06:48:27 +0000
committernyamatongwe <unknown>2002-08-05 06:48:27 +0000
commit8d5165fcb061fb2d443ba301c459635c2ecde3bb (patch)
treed29470a095456504b888e2779eb49a4b07f42db0 /src
parent76333f2c89b3dfbbbfdc47fed6590d3f64d1d835 (diff)
downloadscintilla-mirror-8d5165fcb061fb2d443ba301c459635c2ecde3bb.tar.gz
Visible whitespace specifiable colours feature from Martin Alderson.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx25
-rw-r--r--src/ViewStyle.cxx10
-rw-r--r--src/ViewStyle.h4
3 files changed, 39 insertions, 0 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 9651b075d..5dce26649 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1830,8 +1830,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
}
if (ll->chars[i] == '\t') {
// Manage tab display
+ if (!overrideBackground && vsDraw.whitespaceBackgroundSet && (vsDraw.viewWhitespace != wsInvisible) && (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways))
+ textBack = vsDraw.whitespaceBackground.allocated;
surface->FillRectangle(rcSegment, textBack);
if ((vsDraw.viewWhitespace != wsInvisible) || ((inIndentation && vsDraw.viewIndentationGuides))) {
+ if (vsDraw.whitespaceForegroundSet)
+ textFore = vsDraw.whitespaceForeground.allocated;
surface->PenColour(textFore);
}
if (inIndentation && vsDraw.viewIndentationGuides) {
@@ -1890,8 +1894,15 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
for (int cpos = 0; cpos <= i - startseg; cpos++) {
if (ll->chars[cpos + startseg] == ' ') {
if (vsDraw.viewWhitespace != wsInvisible) {
+ if (vsDraw.whitespaceForegroundSet)
+ textFore = vsDraw.whitespaceForeground.allocated;
if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) {
int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2;
+ if (!overrideBackground && vsDraw.whitespaceBackgroundSet) {
+ textBack = vsDraw.whitespaceBackground.allocated;
+ PRectangle rcSpace(ll->positions[cpos + startseg] + xStart, rcSegment.top, ll->positions[cpos + startseg + 1] + xStart, rcSegment.bottom);
+ surface->FillRectangle(rcSpace, textBack);
+ }
PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0);
rcDot.right = rcDot.left + 1;
rcDot.bottom = rcDot.top + 1;
@@ -2320,6 +2331,8 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
// Don't show the selection when printing
vsPrint.selbackset = false;
vsPrint.selforeset = false;
+ vsPrint.whitespaceBackgroundSet = false;
+ vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
// Set colours for printing according to users settings
@@ -5430,6 +5443,18 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
InvalidateStyleRedraw();
break;
+ case SCI_SETWHITESPACEFORE:
+ vs.whitespaceForegroundSet = wParam != 0;
+ vs.whitespaceForeground.desired = ColourDesired(lParam);
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_SETWHITESPACEBACK:
+ vs.whitespaceBackgroundSet = wParam != 0;
+ vs.whitespaceBackground.desired = ColourDesired(lParam);
+ InvalidateStyleRedraw();
+ break;
+
case SCI_SETCARETFORE:
vs.caretcolour.desired = ColourDesired(wParam);
InvalidateStyleRedraw();
diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx
index 7937e1fca..12e1406aa 100644
--- a/src/ViewStyle.cxx
+++ b/src/ViewStyle.cxx
@@ -72,6 +72,10 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired;
+ whitespaceForegroundSet = source.whitespaceForegroundSet;
+ whitespaceForeground.desired = source.whitespaceForeground.desired;
+ whitespaceBackgroundSet = source.whitespaceBackgroundSet;
+ whitespaceBackground.desired = source.whitespaceBackground.desired;
selbar.desired = source.selbar.desired;
selbarlight.desired = source.selbarlight.desired;
caretcolour.desired = source.caretcolour.desired;
@@ -120,6 +124,10 @@ void ViewStyle::Init() {
selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
+ whitespaceForegroundSet = false;
+ whitespaceForeground.desired = ColourDesired(0, 0, 0);
+ whitespaceBackgroundSet = false;
+ whitespaceBackground.desired = ColourDesired(0xff, 0xff, 0xff);
selbar.desired = Platform::Chrome();
selbarlight.desired = Platform::ChromeHighlight();
styles[STYLE_LINENUMBER].fore.desired = ColourDesired(0, 0, 0);
@@ -176,6 +184,8 @@ void ViewStyle::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(selforeground, want);
pal.WantFind(selbackground, want);
pal.WantFind(selbackground2, want);
+ pal.WantFind(whitespaceForeground, want);
+ pal.WantFind(whitespaceBackground, want);
pal.WantFind(selbar, want);
pal.WantFind(selbarlight, want);
pal.WantFind(caretcolour, want);
diff --git a/src/ViewStyle.h b/src/ViewStyle.h
index 7528638c5..887170eaa 100644
--- a/src/ViewStyle.h
+++ b/src/ViewStyle.h
@@ -53,6 +53,10 @@ public:
bool selbackset;
ColourPair selbackground;
ColourPair selbackground2;
+ bool whitespaceForegroundSet;
+ ColourPair whitespaceForeground;
+ bool whitespaceBackgroundSet;
+ ColourPair whitespaceBackground;
ColourPair selbar;
ColourPair selbarlight;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin