diff options
| author | nyamatongwe <devnull@localhost> | 2002-08-05 06:48:27 +0000 | 
|---|---|---|
| committer | nyamatongwe <devnull@localhost> | 2002-08-05 06:48:27 +0000 | 
| commit | c8d0c32129aaaf7f56091ec267f86c0fec7267b0 (patch) | |
| tree | d29470a095456504b888e2779eb49a4b07f42db0 | |
| parent | 734741819ffb01a79faa13abe15462acb9054f37 (diff) | |
| download | scintilla-mirror-c8d0c32129aaaf7f56091ec267f86c0fec7267b0.tar.gz | |
Visible whitespace specifiable colours feature from Martin Alderson.
| -rw-r--r-- | include/Scintilla.h | 2 | ||||
| -rw-r--r-- | include/Scintilla.iface | 6 | ||||
| -rw-r--r-- | src/Editor.cxx | 25 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 10 | ||||
| -rw-r--r-- | src/ViewStyle.h | 4 | 
5 files changed, 47 insertions, 0 deletions
| diff --git a/include/Scintilla.h b/include/Scintilla.h index 165f504e6..0e0fad265 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -206,6 +206,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define SCI_INDICGETSTYLE 2081  #define SCI_INDICSETFORE 2082  #define SCI_INDICGETFORE 2083 +#define SCI_SETWHITESPACEFORE 2084 +#define SCI_SETWHITESPACEBACK 2085  #define SCI_SETSTYLEBITS 2090  #define SCI_GETSTYLEBITS 2091  #define SCI_SETLINESTATE 2092 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 0f06d0c88..f31cd7806 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -467,6 +467,12 @@ set void IndicSetFore=2082(int indic, colour fore)  # Retrieve the foreground colour of an indicator.  get colour IndicGetFore=2083(int indic,) +# Set the foreground colour of all whitespace and whether to use this setting. +fun void SetWhitespaceFore=2084(bool useSetting, colour fore) + +# Set the background colour of all whitespace and whether to use this setting. +fun void SetWhitespaceBack=2085(bool useSetting, colour back) +  # Divide each styling byte into lexical class bits (default: 5) and indicator  # bits (default: 3). If a lexer requires more than 32 lexical states, then this  # is used to expand the possible states. 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 | 
