diff options
| author | nyamatongwe <unknown> | 2006-06-06 01:01:59 +0000 | 
|---|---|---|
| committer | nyamatongwe <unknown> | 2006-06-06 01:01:59 +0000 | 
| commit | a94abb53e54f4e97b039da4edfc97fef15489a52 (patch) | |
| tree | 0f99a96b64e7f498fb6f9bfee14d88752dfd693c /src | |
| parent | a06455a982a5319a6af8976054481a3f71131b1d (diff) | |
| download | scintilla-mirror-a94abb53e54f4e97b039da4edfc97fef15489a52.tar.gz | |
Patch from RFE 1501054 by Greg Smith adds margin styles that fill with the
foreground of background of the default style.
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 33 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 12 | ||||
| -rw-r--r-- | src/ViewStyle.h | 2 | 
3 files changed, 30 insertions, 17 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index 66d1b6a35..33479e6ba 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1721,7 +1721,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {  			rcSelMargin.left = rcSelMargin.right;  			rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width; -			if (vs.ms[margin].symbol) { +			if (vs.ms[margin].style != SC_MARGIN_NUMBER) {  				/* alternate scheme:  				if (vs.ms[margin].mask & SC_MASK_FOLDERS)  					surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated); @@ -1732,8 +1732,21 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {  				if (vs.ms[margin].mask & SC_MASK_FOLDERS)  					// Required because of special way brush is created for selection margin  					surface->FillRectangle(rcSelMargin, *pixmapSelPattern); -				else -					surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated); +				else { +					ColourAllocated colour; +					switch (vs.ms[margin].style) { +					case SC_MARGIN_BACK: +						colour = vs.styles[STYLE_DEFAULT].back.allocated; +						break; +					case SC_MARGIN_FORE: +						colour = vs.styles[STYLE_DEFAULT].fore.allocated; +						break; +					default: +						colour = vs.styles[STYLE_LINENUMBER].back.allocated; +						break; +					} +					surface->FillRectangle(rcSelMargin, colour); +				}  			} else {  				surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);  			} @@ -1840,7 +1853,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {  				PRectangle rcMarker = rcSelMargin;  				rcMarker.top = yposScreen;  				rcMarker.bottom = yposScreen + vs.lineHeight; -				if (!vs.ms[margin].symbol) { +				if (vs.ms[margin].style == SC_MARGIN_NUMBER) {  					char number[100];  					number[0] = '\0';  					if (firstSubLine) @@ -2131,7 +2144,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  					continue;  				}  				if (p > 0) { -					if (wrapState == eWrapChar){ +					if (wrapState == eWrapChar) {  						lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1)  												- posLineStart;  						p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; @@ -2210,7 +2223,7 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace,  		    surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative);  		}  	}; -	Relative rel = {surface, x0, xStraight?1:-1, y0, yStraight?1:-1}; +	Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1};  	// arrow head  	rel.MoveTo(xa, y); @@ -3114,7 +3127,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {  	// Printing supports only the line number margin.  	int lineNumberIndex = -1;  	for (int margin = 0; margin < ViewStyle::margins; margin++) { -		if ((!vsPrint.ms[margin].symbol) && (vsPrint.ms[margin].width > 0)) { +		if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) {  			lineNumberIndex = margin;  		} else {  			vsPrint.ms[margin].width = 0; @@ -6357,7 +6370,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		return pdoc->ExtendWordSelect(wParam, 1, lParam != 0);  	case SCI_SETWRAPMODE: -		switch(wParam){ +		switch (wParam) {  			case SC_WRAP_WORD:  				wrapState = eWrapWord;  				break; @@ -6603,14 +6616,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_SETMARGINTYPEN:  		if (ValidMargin(wParam)) { -			vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL); +			vs.ms[wParam].style = lParam;  			InvalidateStyleRedraw();  		}  		break;  	case SCI_GETMARGINTYPEN:  		if (ValidMargin(wParam)) -			return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER; +			return vs.ms[wParam].style;  		else  			return 0; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 3de85c6be..b4da30ace 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -17,7 +17,7 @@  #include "ViewStyle.h"  MarginStyle::MarginStyle() : -	symbol(false), width(0), mask(0), sensitive(false) { +	style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {  }  // A list of the fontnames - avoids wasting space in each style @@ -175,13 +175,13 @@ void ViewStyle::Init() {  	leftMarginWidth = 1;  	rightMarginWidth = 1; -	ms[0].symbol = false; +	ms[0].style = SC_MARGIN_NUMBER;  	ms[0].width = 0;  	ms[0].mask = 0; -	ms[1].symbol = true; +	ms[1].style = SC_MARGIN_SYMBOL;  	ms[1].width = 16;  	ms[1].mask = ~SC_MASK_FOLDERS; -	ms[2].symbol = true; +	ms[2].style = SC_MARGIN_SYMBOL;  	ms[2].width = 0;  	ms[2].mask = 0;  	fixedColumnWidth = leftMarginWidth; @@ -189,7 +189,7 @@ void ViewStyle::Init() {  	maskInLine = 0xffffffff;  	for (int margin=0; margin < margins; margin++) {  		fixedColumnWidth += ms[margin].width; -		symbolMargin = symbolMargin || ms[margin].symbol; +		symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);  		if (ms[margin].width > 0)  			maskInLine &= ~ms[margin].mask;  	} @@ -260,7 +260,7 @@ void ViewStyle::Refresh(Surface &surface) {  	maskInLine = 0xffffffff;  	for (int margin=0; margin < margins; margin++) {  		fixedColumnWidth += ms[margin].width; -		symbolMargin = symbolMargin || ms[margin].symbol; +		symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);  		if (ms[margin].width > 0)  			maskInLine &= ~ms[margin].mask;  	} diff --git a/src/ViewStyle.h b/src/ViewStyle.h index 892fdc59d..75f899d97 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -12,7 +12,7 @@   */  class MarginStyle {  public: -	bool symbol; +	int style;  	int width;  	int mask;  	bool sensitive; | 
