diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CallTip.cxx | 10 | ||||
| -rw-r--r-- | src/Document.cxx | 4 | ||||
| -rw-r--r-- | src/DocumentAccessor.cxx | 2 | ||||
| -rw-r--r-- | src/Editor.cxx | 56 | ||||
| -rw-r--r-- | src/Indicator.h | 2 | ||||
| -rw-r--r-- | src/LexHTML.cxx | 197 | ||||
| -rw-r--r-- | src/LineMarker.cxx | 8 | ||||
| -rw-r--r-- | src/LineMarker.h | 4 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 2 | ||||
| -rw-r--r-- | src/Style.cxx | 8 | ||||
| -rw-r--r-- | src/Style.h | 2 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 23 | ||||
| -rw-r--r-- | src/WindowAccessor.cxx | 2 | 
13 files changed, 259 insertions, 61 deletions
| diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 3422de696..006e2cb51 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -21,11 +21,11 @@ CallTip::CallTip() {  	startHighlight = 0;  	endHighlight = 0; -	colourBG.desired = Colour(0xff, 0xff, 0xff); -	colourUnSel.desired = Colour(0x80, 0x80, 0x80); -	colourSel.desired = Colour(0, 0, 0x80); -	colourShade.desired = Colour(0, 0, 0); -	colourLight.desired = Colour(0xc0, 0xc0, 0xc0); +	colourBG.desired = ColourDesired(0xff, 0xff, 0xff); +	colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80); +	colourSel.desired = ColourDesired(0, 0, 0x80); +	colourShade.desired = ColourDesired(0, 0, 0); +	colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0);  }  CallTip::~CallTip() { diff --git a/src/Document.cxx b/src/Document.cxx index 7ffb651ba..213a72d6a 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -230,7 +230,7 @@ bool Document::IsDBCS(int pos) {  			while (startLine > 0 && cb.CharAt(startLine) != '\r' && cb.CharAt(startLine) != '\n')  				startLine--;  			while (startLine <= pos) { -				if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) { +				if (Platform::IsDBCSLeadByte(dbcsCodePage, cb.CharAt(startLine))) {  					startLine++;  					if (startLine >= pos)  						return true; @@ -322,7 +322,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {  			while (startLine < pos) {  				if (atLeadByte)  					atLeadByte = false; -				else if (IsDBCSLeadByteEx(dbcsCodePage, cb.CharAt(startLine))) +				else if (Platform::IsDBCSLeadByte(dbcsCodePage, cb.CharAt(startLine)))  					atLeadByte = true;  				else  					atLeadByte = false; diff --git a/src/DocumentAccessor.cxx b/src/DocumentAccessor.cxx index c187f2a44..e8930c23d 100644 --- a/src/DocumentAccessor.cxx +++ b/src/DocumentAccessor.cxx @@ -30,7 +30,7 @@ bool DocumentAccessor::InternalIsLeadByte(char ch) {  		// same so none is considered a lead byte.  		return false;  	else -		return IsDBCSLeadByteEx(codePage, ch); +		return Platform::IsDBCSLeadByte(codePage, ch);  }  #else  // PLAT_GTK or PLAT_WX diff --git a/src/Editor.cxx b/src/Editor.cxx index 15ba91b20..941c05971 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -997,7 +997,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  	// display itself.  These are checked in order with the earlier taking precedence.  When  	// multiple markers cause background override, the color for the highest numbered one is used.  	bool overrideBackground = false; -	Colour background = Colour(0, 0, 0); +	ColourAllocated background;  	if (caret.active && vsDraw.showCaretLineBackground && ll.containsCaret) {  		overrideBackground = true;  		background = vsDraw.caretLineBackground.allocated; @@ -1046,8 +1046,8 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  		        ((ll.selStart != ll.selEnd) && ((iDoc + 1 == ll.selStart) || (iDoc + 1 == ll.selEnd))) ||  		        (i == (ll.edgeColumn - 1))) {  			int styleMain = ll.styles[i]; -			Colour textBack = vsDraw.styles[styleMain].back.allocated; -			Colour textFore = vsDraw.styles[styleMain].fore.allocated; +			ColourAllocated textBack = vsDraw.styles[styleMain].back.allocated; +			ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated;  			Font &textFont = vsDraw.styles[styleMain].font;  			bool inSelection = (iDoc >= ll.selStart) && (iDoc < ll.selEnd) && (ll.selStart != ll.selEnd);  			if (inSelection) { @@ -1239,7 +1239,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  		// way between the chrome colour and the chrome highlight colour making a nice transition  		// between the window chrome and the content area. And it works in low colour depths.  		PRectangle rcPattern(0, 0, 8, 8); -		if (vs.selbarlight.desired == Colour(0xff, 0xff, 0xff)) { +		if (vs.selbarlight.desired == ColourDesired(0xff, 0xff, 0xff)) {  			pixmapSelPattern.FillRectangle(rcPattern, vs.selbar.allocated);  			pixmapSelPattern.PenColour(vs.selbarlight.allocated);  			for (int stripe = 0; stripe < 8; stripe++) { @@ -1494,18 +1494,18 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  // Space (3 space characters) between line numbers and text when printing.  #define lineNumberPrintSpace "   " -Colour InvertedLight(Colour orig) { +ColourDesired InvertedLight(ColourDesired orig) {  	unsigned int r = orig.GetRed();  	unsigned int g = orig.GetGreen();  	unsigned int b = orig.GetBlue();  	unsigned int l = (r + g + b) / 3; 	// There is a better calculation for this that matches human eye  	unsigned int il = 0xff - l;  	if (l == 0) -		return Colour(0xff, 0xff, 0xff); +		return ColourDesired(0xff, 0xff, 0xff);  	r = r * il / l;  	g = g * il / l;  	b = b * il / l; -	return Colour(Platform::Minimum(r, 0xff), Platform::Minimum(g, 0xff), Platform::Minimum(b, 0xff)); +	return ColourDesired(Platform::Minimum(r, 0xff), Platform::Minimum(g, 0xff), Platform::Minimum(b, 0xff));  }  // This is mostly copied from the Paint method but with some things omitted @@ -1549,18 +1549,18 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {  			vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired);  			vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired);  		} else if (printColourMode == SC_PRINT_BLACKONWHITE) { -			vsPrint.styles[sty].fore.desired = Colour(0, 0, 0); -			vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff); +			vsPrint.styles[sty].fore.desired = ColourDesired(0, 0, 0); +			vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff);  		} else if (printColourMode == SC_PRINT_COLOURONWHITE) { -			vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff); +			vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff);  		} else if (printColourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) {  			if (sty <= STYLE_DEFAULT) { -				vsPrint.styles[sty].back.desired = Colour(0xff, 0xff, 0xff); +				vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff);  			}  		}  	}  	// White background for the line numbers -	vsPrint.styles[STYLE_LINENUMBER].back.desired = Colour(0xff, 0xff, 0xff); +	vsPrint.styles[STYLE_LINENUMBER].back.desired = ColourDesired(0xff, 0xff, 0xff);  	vsPrint.Refresh(*surfaceMeasure);  	// Ensure colours are set up @@ -3529,11 +3529,11 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_SETTEXT:  		{  			if (lParam == 0) -				return FALSE; +				return 0;  			pdoc->DeleteChars(0, pdoc->Length());  			SetEmptySelection(0);  			pdoc->InsertString(0, reinterpret_cast<char *>(lParam)); -			return TRUE; +			return 1;  		}  	case SCI_GETTEXTLENGTH: @@ -3565,7 +3565,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		break;  	case SCI_CANUNDO: -		return pdoc->CanUndo() ? TRUE : FALSE; +		return pdoc->CanUndo() ? 1 : 0;  	case SCI_EMPTYUNDOBUFFER:  		pdoc->DeleteUndoHistory(); @@ -3699,7 +3699,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_LINESCROLL:  		ScrollTo(topLine + lParam);  		HorizontalScrollTo(xOffset + wParam * vs.spaceWidth); -		return TRUE; +		return 1;  	case SCI_SETXOFFSET:  		xOffset = wParam; @@ -3715,7 +3715,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_SETREADONLY:  		pdoc->SetReadOnly(wParam); -		return TRUE; +		return 1;  	case SCI_GETREADONLY:  		return pdoc->IsReadOnly(); @@ -3934,7 +3934,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		}  	case SCI_CANREDO: -		return pdoc->CanRedo() ? TRUE : FALSE; +		return pdoc->CanRedo() ? 1 : 0;  	case SCI_MARKERLINEFROMHANDLE:  		return pdoc->LineFromHandle(wParam); @@ -4128,13 +4128,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		break;  	case SCI_MARKERSETFORE:  		if (wParam <= MARKER_MAX) -			vs.markers[wParam].fore.desired = Colour(lParam); +			vs.markers[wParam].fore.desired = ColourDesired(lParam);  		InvalidateStyleData();  		RedrawSelMargin();  		break;  	case SCI_MARKERSETBACK:  		if (wParam <= MARKER_MAX) -			vs.markers[wParam].back.desired = Colour(lParam); +			vs.markers[wParam].back.desired = ColourDesired(lParam);  		InvalidateStyleData();  		RedrawSelMargin();  		break; @@ -4230,13 +4230,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_STYLESETFORE:  		if (wParam <= STYLE_MAX) { -			vs.styles[wParam].fore.desired = Colour(lParam); +			vs.styles[wParam].fore.desired = ColourDesired(lParam);  			InvalidateStyleRedraw();  		}  		break;  	case SCI_STYLESETBACK:  		if (wParam <= STYLE_MAX) { -			vs.styles[wParam].back.desired = Colour(lParam); +			vs.styles[wParam].back.desired = ColourDesired(lParam);  			InvalidateStyleRedraw();  		}  		break; @@ -4418,18 +4418,18 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_SETSELFORE:  		vs.selforeset = wParam; -		vs.selforeground.desired = Colour(lParam); +		vs.selforeground.desired = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETSELBACK:  		vs.selbackset = wParam; -		vs.selbackground.desired = Colour(lParam); +		vs.selbackground.desired = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETCARETFORE: -		vs.caretcolour.desired = Colour(wParam); +		vs.caretcolour.desired = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break; @@ -4475,7 +4475,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_INDICSETFORE:  		if (wParam <= INDIC_MAX) { -			vs.indicators[wParam].fore.desired = Colour(lParam); +			vs.indicators[wParam].fore.desired = ColourDesired(lParam);  			InvalidateStyleRedraw();  		}  		break; @@ -4584,7 +4584,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		return vs.edgecolour.desired.AsLong();  	case SCI_SETEDGECOLOUR: -		vs.edgecolour.desired = Colour(wParam); +		vs.edgecolour.desired = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break; @@ -4629,7 +4629,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		break;  	case SCI_GETOVERTYPE: -		return inOverstrike ? TRUE : FALSE; +		return inOverstrike ? 1 : 0;  	case SCI_SETFOCUS:  		SetFocusState(wParam); diff --git a/src/Indicator.h b/src/Indicator.h index a19b46b5e..56e9420bc 100644 --- a/src/Indicator.h +++ b/src/Indicator.h @@ -14,7 +14,7 @@ class Indicator {  public:  	int style;  	ColourPair fore; -	Indicator() : style(INDIC_PLAIN), fore(Colour(0,0,0)) { +	Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)) {  	}  	void Draw(Surface *surface, PRectangle &rc);  }; diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index 3a03096f8..551e7015a 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -15,6 +15,7 @@  #include "PropSet.h"  #include "Accessor.h" +#include "StyleContext.h"  #include "KeyWords.h"  #include "Scintilla.h"  #include "SciLexer.h" @@ -26,6 +27,14 @@  enum { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock };  enum { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc }; +inline bool IsAWordChar(const int ch) { +	return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); +} + +inline bool IsAWordStart(const int ch) { +	return (ch < 0x80) && (isalnum(ch) || ch == '_'); +} +  static int segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, int prevValue) {  	char s[30 + 1];  	unsigned int i = 0; @@ -1541,5 +1550,193 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty  	}  } +static bool isASPScript(int state) { +	return  +		(state >= SCE_HJA_START && state <= SCE_HJA_REGEX) || +		(state >= SCE_HBA_START && state <= SCE_HBA_STRINGEOL) || +		(state >= SCE_HPA_DEFAULT && state <= SCE_HPA_IDENTIFIER); +} + +static void ColouriseHBAPiece(StyleContext &sc, WordList *keywordlists[]) { +	WordList &keywordsVBS = *keywordlists[2]; +	if (sc.state == SCE_HBA_WORD) { +		if (!IsAWordChar(sc.ch)) { +			char s[100]; +			sc.GetCurrentLowered(s, sizeof(s)); +			if (keywordsVBS.InList(s)) { +				if (strcmp(s, "rem") == 0) { +					sc.ChangeState(SCE_HBA_COMMENTLINE); +					if (sc.atLineEnd) { +						sc.SetState(SCE_HBA_DEFAULT); +					} +				} else { +					sc.SetState(SCE_HBA_DEFAULT); +				} +			} else { +				sc.ChangeState(SCE_HBA_IDENTIFIER); +				sc.SetState(SCE_HBA_DEFAULT); +			} +		} +	} else if (sc.state == SCE_HBA_NUMBER) { +		if (!IsAWordChar(sc.ch)) { +			sc.SetState(SCE_HBA_DEFAULT); +		} +	} else if (sc.state == SCE_HBA_STRING) { +		if (sc.ch == '\"') { +			sc.ForwardSetState(SCE_HBA_DEFAULT); +		} else if (sc.ch == '\r' || sc.ch == '\n') { +			sc.ChangeState(SCE_HBA_STRINGEOL); +			sc.ForwardSetState(SCE_HBA_DEFAULT); +		} +	} else if (sc.state == SCE_HBA_COMMENTLINE) { +		if (sc.ch == '\r' || sc.ch == '\n') { +			sc.SetState(SCE_HBA_DEFAULT); +		} +	} + +	if (sc.state == SCE_HBA_DEFAULT) { +		if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { +			sc.SetState(SCE_HBA_NUMBER); +		} else if (IsAWordStart(sc.ch)) { +			sc.SetState(SCE_HBA_WORD); +		} else if (sc.ch == '\'') { +			sc.SetState(SCE_HBA_COMMENTLINE); +		} else if (sc.ch == '\"') { +			sc.SetState(SCE_HBA_STRING); +		} +	} +} + +static void ColouriseASPPiece(StyleContext &sc, WordList *keywordlists[]) { +	// Possibly exit current state to either SCE_H_DEFAULT or SCE_HBA_DEFAULT +	if ((sc.state == SCE_H_ASPAT || isASPScript(sc.state)) && sc.Match('%', '>')) { +		sc.SetState(SCE_H_ASP); +		sc.Forward(); +		sc.ForwardSetState(SCE_H_DEFAULT); +	}  +			  +	// Handle some ASP script +	if (sc.state >= SCE_HBA_START && sc.state <= SCE_HBA_STRINGEOL) { +		ColouriseHBAPiece(sc, keywordlists); +	} +	 +	// Enter new sc.state +	if (sc.state == SCE_H_DEFAULT) { +		if (sc.Match('<', '%')) { +			sc.SetState(SCE_H_ASP); +			sc.Forward(); +			sc.Forward(); +			if (sc.ch == '@') { +				sc.ForwardSetState(SCE_H_ASPAT); +			} else { +				if (sc.ch == '=') { +					sc.Forward(); +				} +				sc.SetState(SCE_HBA_DEFAULT); +			} +		} +	} +} + +static void ColouriseASPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], +                                  Accessor &styler) { +	// Lexer for HTML requires more lexical states (7 bits worth) than most lexers +	StyleContext sc(startPos, length, initStyle, styler, 0x7f); +	for (; sc.More(); sc.Forward()) { +		ColouriseASPPiece(sc, keywordlists); +	} +	sc.Complete(); +} + +static void ColourisePHPPiece(StyleContext &sc, WordList *[]) { +	// Possibly exit current state to either SCE_H_DEFAULT or SCE_HBA_DEFAULT +	if (sc.state >= SCE_HPHP_DEFAULT && sc.state <= SCE_HPHP_OPERATOR) { +		if (!isPHPStringState(sc.state) &&  +			(sc.state != SCE_HPHP_COMMENT) && +			(sc.Match('?', '>'))) { +			sc.SetState(SCE_H_QUESTION); +			sc.Forward(); +			sc.ForwardSetState(SCE_H_DEFAULT); +		} +	}  +			  +	// Handle some PHP script +	if (sc.state == SCE_HPHP_WORD) { +		if (!IsAWordStart(sc.ch)) { +			sc.SetState(SCE_HPHP_DEFAULT); +		} +	} else if (sc.state == SCE_HPHP_COMMENTLINE) { +		if (sc.ch == '\r' || sc.ch == '\n') { +			sc.SetState(SCE_HPHP_DEFAULT); +		} +	} else if (sc.state == SCE_HPHP_COMMENT) { +		if (sc.Match('*', '/')) { +			sc.Forward(); +			sc.Forward(); +			sc.SetState(SCE_HPHP_DEFAULT); +		} +	} else if (sc.state == SCE_HPHP_HSTRING) { +		if (sc.ch == '\"') { +			sc.ForwardSetState(SCE_HPHP_DEFAULT); +		} +	} else if (sc.state == SCE_HPHP_SIMPLESTRING) { +		if (sc.ch == '\'') { +			sc.ForwardSetState(SCE_HPHP_DEFAULT); +		} +	} else if (sc.state == SCE_HPHP_VARIABLE) { +		if (!IsAWordStart(sc.ch)) { +			sc.SetState(SCE_HPHP_DEFAULT); +		} +	} else if (sc.state == SCE_HPHP_OPERATOR) { +		sc.SetState(SCE_HPHP_DEFAULT); +	} +	 +	// Enter new sc.state +	if (sc.state == SCE_H_DEFAULT) { +		if (sc.Match("<?php")) { +			sc.SetState(SCE_H_QUESTION); +			sc.Forward(); +			sc.Forward(); +			sc.Forward(); +			sc.Forward(); +			sc.Forward(); +			sc.SetState(SCE_HPHP_DEFAULT); +		} +	} +	if (sc.state == SCE_HPHP_DEFAULT) { +		if (IsAWordStart(sc.ch)) { +			sc.SetState(SCE_HPHP_WORD); +		} else if (sc.ch == '#') { +			sc.SetState(SCE_HPHP_COMMENTLINE); +		} else if (sc.Match("<!--")) { +			sc.SetState(SCE_HPHP_COMMENTLINE); +		} else if (sc.Match('/', '/')) { +			sc.SetState(SCE_HPHP_COMMENTLINE); +		} else if (sc.Match('/', '*')) { +			sc.SetState(SCE_HPHP_COMMENT); +		} else if (sc.ch == '\"') { +			sc.SetState(SCE_HPHP_HSTRING); +		} else if (sc.ch == '\'') { +			sc.SetState(SCE_HPHP_SIMPLESTRING); +		} else if (sc.ch == '$') { +			sc.SetState(SCE_HPHP_VARIABLE); +		} else if (isoperator(static_cast<char>(sc.ch))) { +			sc.SetState(SCE_HPHP_OPERATOR); +		} +	} +} + +static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], +                                  Accessor &styler) { +	// Lexer for HTML requires more lexical states (7 bits worth) than most lexers +	StyleContext sc(startPos, length, initStyle, styler, 0x7f); +	for (; sc.More(); sc.Forward()) { +		ColourisePHPPiece(sc, keywordlists); +	} +	sc.Complete(); +} +  LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext");  LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml"); +LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp"); +LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php"); diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index e4b8b3299..1b8975d9c 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -10,7 +10,7 @@  #include "Scintilla.h"  #include "LineMarker.h" -static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) { +static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) {  	PRectangle rc;  	rc.left = centreX - armSize;  	rc.top = centreY - armSize; @@ -19,7 +19,7 @@ static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, Col  	surface->RectangleDraw(rc, back, fore);  } -static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, Colour fore, Colour back) { +static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) {  	PRectangle rcCircle;  	rcCircle.left = centreX - armSize;  	rcCircle.top = centreY - armSize; @@ -28,14 +28,14 @@ static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize,  	surface->Ellipse(rcCircle, back, fore);  } -static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) { +static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore) {  	PRectangle rcV(centreX, centreY - armSize + 2, centreX + 1, centreY + armSize - 2 + 1);  	surface->FillRectangle(rcV, fore);  	PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);  	surface->FillRectangle(rcH, fore);  } -static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, Colour fore) { +static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore) {  	PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);  	surface->FillRectangle(rcH, fore);  } diff --git a/src/LineMarker.h b/src/LineMarker.h index b9dd15d06..7897aa775 100644 --- a/src/LineMarker.h +++ b/src/LineMarker.h @@ -17,8 +17,8 @@ public:  	ColourPair back;  	LineMarker() {  		markType = SC_MARK_CIRCLE; -		fore = Colour(0,0,0); -		back = Colour(0xff,0xff,0xff); +		fore = ColourDesired(0,0,0); +		back = ColourDesired(0xff,0xff,0xff);  	}  	void Draw(Surface *surface, PRectangle &rc, Font &fontForCharacter);  }; diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index f938a1f4d..4863dbcb7 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -517,7 +517,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara  		break;  	case SCI_CALLTIPSETBACK: -		ct.colourBG = Colour(wParam); +		ct.colourBG = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break; diff --git a/src/Style.cxx b/src/Style.cxx index 4a3526791..5989dae80 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -14,13 +14,13 @@  Style::Style() {  	aliasOfDefaultFont = true; -	Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), +	Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),  	      Platform::DefaultFontSize(), 0, SC_CHARSET_DEFAULT,  	      false, false, false, false, caseMixed, true);  }  Style::Style(const Style &source) { -	Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), +	Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),  	      0, 0, 0,  	      false, false, false, false, caseMixed, true);  	fore.desired = source.fore.desired; @@ -46,7 +46,7 @@ Style::~Style() {  Style &Style::operator=(const Style &source) {  	if (this == &source)  		return * this; -	Clear(Colour(0, 0, 0), Colour(0xff, 0xff, 0xff), +	Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),  	      0, 0, SC_CHARSET_DEFAULT,  	      false, false, false, false, caseMixed, true);  	fore.desired = source.fore.desired; @@ -62,7 +62,7 @@ Style &Style::operator=(const Style &source) {  	return *this;  } -void Style::Clear(Colour fore_, Colour back_, int size_, +void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,                    const char *fontName_, int characterSet_,                    bool bold_, bool italic_, bool eolFilled_,                     bool underline_, ecaseForced caseForce_, bool visible_) { diff --git a/src/Style.h b/src/Style.h index 3600886b3..17d32ac33 100644 --- a/src/Style.h +++ b/src/Style.h @@ -39,7 +39,7 @@ public:  	Style(const Style &source);  	~Style();  	Style &operator=(const Style &source); -	void Clear(Colour fore_, Colour back_, +	void Clear(ColourDesired fore_, ColourDesired back_,  	           int size_,  	           const char *fontName_, int characterSet_,  	           bool bold_, bool italic_, bool eolFilled_,  diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 4db7e2508..40615da65 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -103,11 +103,11 @@ void ViewStyle::Init() {  	ResetDefaultStyle();  	indicators[0].style = INDIC_SQUIGGLE; -	indicators[0].fore = Colour(0, 0x7f, 0); +	indicators[0].fore = ColourDesired(0, 0x7f, 0);  	indicators[1].style = INDIC_TT; -	indicators[1].fore = Colour(0, 0, 0xff); +	indicators[1].fore = ColourDesired(0, 0, 0xff);  	indicators[2].style = INDIC_PLAIN; -	indicators[2].fore = Colour(0xff, 0, 0); +	indicators[2].fore = ColourDesired(0xff, 0, 0);  	lineHeight = 1;  	maxAscent = 1; @@ -116,18 +116,18 @@ void ViewStyle::Init() {  	spaceWidth = 8;  	selforeset = false; -	selforeground.desired = Colour(0xff, 0, 0); +	selforeground.desired = ColourDesired(0xff, 0, 0);  	selbackset = true; -	selbackground.desired = Colour(0xc0, 0xc0, 0xc0); -	selbackground2.desired = Colour(0xb0, 0xb0, 0xb0); +	selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0); +	selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);  	selbar.desired = Platform::Chrome();  	selbarlight.desired = Platform::ChromeHighlight(); -	styles[STYLE_LINENUMBER].fore.desired = Colour(0, 0, 0); +	styles[STYLE_LINENUMBER].fore.desired = ColourDesired(0, 0, 0);  	styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); -	caretcolour.desired = Colour(0, 0, 0); +	caretcolour.desired = ColourDesired(0, 0, 0);  	showCaretLineBackground = false; -	caretLineBackground.desired = Colour(0xff, 0xff, 0); -	edgecolour.desired = Colour(0xc0, 0xc0, 0xc0); +	caretLineBackground.desired = ColourDesired(0xff, 0xff, 0); +	edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);  	edgeState = EDGE_NONE;  	caretWidth = 1; @@ -215,7 +215,8 @@ void ViewStyle::Refresh(Surface &surface) {  }  void ViewStyle::ResetDefaultStyle() { -	styles[STYLE_DEFAULT].Clear(Colour(0,0,0), Colour(0xff,0xff,0xff), +	styles[STYLE_DEFAULT].Clear(ColourDesired(0,0,0),  +		ColourDesired(0xff,0xff,0xff),  	        Platform::DefaultFontSize(), fontNames.Save(Platform::DefaultFont()),  		SC_CHARSET_DEFAULT,  		false, false, false, false, Style::caseMixed, true); diff --git a/src/WindowAccessor.cxx b/src/WindowAccessor.cxx index db2f938f3..cd419572c 100644 --- a/src/WindowAccessor.cxx +++ b/src/WindowAccessor.cxx @@ -27,7 +27,7 @@ bool WindowAccessor::InternalIsLeadByte(char ch) {  		// same so none is considered a lead byte.  		return false;	  	else -		return IsDBCSLeadByteEx(codePage, ch); +		return Platform::IsDBCSLeadByte(codePage, ch);  }  #else  // PLAT_GTK or PLAT_WX | 
