diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CallTip.cxx | 40 | ||||
| -rw-r--r-- | src/CallTip.h | 15 | ||||
| -rw-r--r-- | src/Editor.cxx | 271 | ||||
| -rw-r--r-- | src/Editor.h | 14 | ||||
| -rw-r--r-- | src/Indicator.cxx | 10 | ||||
| -rw-r--r-- | src/Indicator.h | 2 | ||||
| -rw-r--r-- | src/LineMarker.cxx | 127 | ||||
| -rw-r--r-- | src/LineMarker.h | 7 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 5 | ||||
| -rw-r--r-- | src/ScintillaBase.h | 2 | ||||
| -rw-r--r-- | src/Style.cxx | 16 | ||||
| -rw-r--r-- | src/Style.h | 4 | ||||
| -rw-r--r-- | src/ViewStyle.cxx | 115 | ||||
| -rw-r--r-- | src/ViewStyle.h | 35 | ||||
| -rw-r--r-- | src/XPM.cxx | 32 | ||||
| -rw-r--r-- | src/XPM.h | 10 | 
16 files changed, 299 insertions, 406 deletions
diff --git a/src/CallTip.cxx b/src/CallTip.cxx index 0e1e80cc1..8fc34eb0f 100644 --- a/src/CallTip.cxx +++ b/src/CallTip.cxx @@ -37,15 +37,15 @@ CallTip::CallTip() {  #ifdef __APPLE__  	// proper apple colours for the default -	colourBG.desired = ColourDesired(0xff, 0xff, 0xc6); -	colourUnSel.desired = ColourDesired(0, 0, 0); +	colourBG = ColourDesired(0xff, 0xff, 0xc6); +	colourUnSel = ColourDesired(0, 0, 0);  #else -	colourBG.desired = ColourDesired(0xff, 0xff, 0xff); -	colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80); +	colourBG = ColourDesired(0xff, 0xff, 0xff); +	colourUnSel = ColourDesired(0x80, 0x80, 0x80);  #endif -	colourSel.desired = ColourDesired(0, 0, 0x80); -	colourShade.desired = ColourDesired(0, 0, 0); -	colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0); +	colourSel = ColourDesired(0, 0, 0x80); +	colourShade = ColourDesired(0, 0, 0); +	colourLight = ColourDesired(0xc0, 0xc0, 0xc0);  	codePage = 0;  	clickPlace = 0;  } @@ -57,14 +57,6 @@ CallTip::~CallTip() {  	val = 0;  } -void CallTip::RefreshColourPalette(Palette &pal, bool want) { -	pal.WantFind(colourBG, want); -	pal.WantFind(colourUnSel, want); -	pal.WantFind(colourSel, want); -	pal.WantFind(colourShade, want); -	pal.WantFind(colourLight, want); -} -  // Although this test includes 0, we should never see a \0 character.  static bool IsArrowCharacter(char ch) {  	return (ch == 0) || (ch == '\001') || (ch == '\002'); @@ -120,10 +112,10 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,  					const int halfWidth = widthArrow / 2 - 3;  					const int centreX = rcClient.left + widthArrow / 2 - 1;  					const int centreY = (rcClient.top + rcClient.bottom) / 2; -					surface->FillRectangle(rcClient, colourBG.allocated); +					surface->FillRectangle(rcClient, colourBG);  					PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1,  					                         rcClient.right - 2, rcClient.bottom - 1); -					surface->FillRectangle(rcClientInner, colourUnSel.allocated); +					surface->FillRectangle(rcClientInner, colourUnSel);  					if (upArrow) {      // Up arrow  						Point pts[] = { @@ -132,7 +124,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,      						Point(centreX, centreY - halfWidth + halfWidth / 2),  						};  						surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), -                 						colourBG.allocated, colourBG.allocated); +                 						colourBG, colourBG);  					} else {            // Down arrow  						Point pts[] = {      						Point(centreX - halfWidth, centreY - halfWidth / 2), @@ -140,7 +132,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,      						Point(centreX, centreY + halfWidth - halfWidth / 2),  						};  						surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), -                 						colourBG.allocated, colourBG.allocated); +                 						colourBG, colourBG);  					}  				}  				xEnd = rcClient.right; @@ -159,7 +151,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,  					rcClient.right = xEnd;  					surface->DrawTextTransparent(rcClient, font, ytext,  										s+startSeg, endSeg - startSeg, -					                             highlight ? colourSel.allocated : colourUnSel.allocated); +					                             highlight ? colourSel : colourUnSel);  				}  			}  			x = xEnd; @@ -227,7 +219,7 @@ void CallTip::PaintCT(Surface *surfaceWindow) {  	                        rcClientPos.bottom - rcClientPos.top);  	PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); -	surfaceWindow->FillRectangle(rcClient, colourBG.allocated); +	surfaceWindow->FillRectangle(rcClient, colourBG);  	offsetMain = insetX;    // initial alignment assuming no arrows  	PaintContents(surfaceWindow, true); @@ -236,10 +228,10 @@ void CallTip::PaintCT(Surface *surfaceWindow) {  	// OSX doesn't put borders on "help tags"  	// Draw a raised border around the edges of the window  	surfaceWindow->MoveTo(0, rcClientSize.bottom - 1); -	surfaceWindow->PenColour(colourShade.allocated); +	surfaceWindow->PenColour(colourShade);  	surfaceWindow->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1);  	surfaceWindow->LineTo(rcClientSize.right - 1, 0); -	surfaceWindow->PenColour(colourLight.allocated); +	surfaceWindow->PenColour(colourLight);  	surfaceWindow->LineTo(0, 0);  	surfaceWindow->LineTo(0, rcClientSize.bottom - 1);  #endif @@ -326,7 +318,7 @@ void CallTip::SetTabSize(int tabSz) {  // It might be better to have two access functions for this and to use  // them for all settings of colours. -void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) { +void CallTip::SetForeBack(const ColourDesired &fore, const ColourDesired &back) {  	colourBG = back;  	colourUnSel = fore;  } diff --git a/src/CallTip.h b/src/CallTip.h index e437f3309..0cb2ede72 100644 --- a/src/CallTip.h +++ b/src/CallTip.h @@ -41,20 +41,17 @@ public:  	Window wDraw;  	bool inCallTipMode;  	int posStartCallTip; -	ColourPair colourBG; -	ColourPair colourUnSel; -	ColourPair colourSel; -	ColourPair colourShade; -	ColourPair colourLight; +	ColourDesired colourBG; +	ColourDesired colourUnSel; +	ColourDesired colourSel; +	ColourDesired colourShade; +	ColourDesired colourLight;  	int codePage;  	int clickPlace;  	CallTip();  	~CallTip(); -	/// Claim or accept palette entries for the colours required to paint a calltip. -	void RefreshColourPalette(Palette &pal, bool want); -  	void PaintCT(Surface *surfaceWindow);  	void MouseClick(Point pt); @@ -77,7 +74,7 @@ public:  	bool UseStyleCallTip() const { return useStyleCallTip;}  	// Modify foreground and background colours -	void SetForeBack(const ColourPair &fore, const ColourPair &back); +	void SetForeBack(const ColourDesired &fore, const ColourDesired &back);  };  #ifdef SCI_NAMESPACE diff --git a/src/Editor.cxx b/src/Editor.cxx index 507ae60a1..01f55b333 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -280,7 +280,6 @@ void Editor::InvalidateStyleData() {  	vs.technology = technology;  	DropGraphics(false);  	AllocateGraphics(); -	palette.Release();  	llc.Invalidate(LineLayout::llInvalid);  	posCache.Clear();  } @@ -291,19 +290,12 @@ void Editor::InvalidateStyleRedraw() {  	Redraw();  } -void Editor::RefreshColourPalette(Palette &pal, bool want) { -	vs.RefreshColourPalette(pal, want); -} -  void Editor::RefreshStyleData() {  	if (!stylesValid) {  		stylesValid = true;  		AutoSurface surface(this);  		if (surface) {  			vs.Refresh(*surface); -			RefreshColourPalette(palette, true); -			palette.Allocate(wMain); -			RefreshColourPalette(palette, false);  		}  		if (wrapIndentMode == SC_WRAPINDENT_INDENT) {  			wrapAddIndent = pdoc->IndentSize() * vs.spaceWidth; @@ -1737,8 +1729,8 @@ void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle  			surface->DrawTextNoClip(rcSegment, vs.styles[style].font,  					ascent, st.text + start + i,  					static_cast<int>(end - i + 1), -					vs.styles[style].fore.allocated, -					vs.styles[style].back.allocated); +					vs.styles[style].fore, +					vs.styles[style].back);  			x += width;  			i = end + 1;  		} @@ -1747,8 +1739,8 @@ void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle  		surface->DrawTextNoClip(rcText, vs.styles[style].font,  				rcText.top + vs.maxAscent, st.text + start,  				static_cast<int>(length), -				vs.styles[style].fore.allocated, -				vs.styles[style].back.allocated); +				vs.styles[style].fore, +				vs.styles[style].back);  	}  } @@ -1783,22 +1775,22 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {  					// Required because of special way brush is created for selection margin  					surface->FillRectangle(rcSelMargin, *pixmapSelPattern);  				else { -					ColourAllocated colour; +					ColourDesired colour;  					switch (vs.ms[margin].style) {  					case SC_MARGIN_BACK: -						colour = vs.styles[STYLE_DEFAULT].back.allocated; +						colour = vs.styles[STYLE_DEFAULT].back;  						break;  					case SC_MARGIN_FORE: -						colour = vs.styles[STYLE_DEFAULT].fore.allocated; +						colour = vs.styles[STYLE_DEFAULT].fore;  						break;  					default: -						colour = vs.styles[STYLE_LINENUMBER].back.allocated; +						colour = vs.styles[STYLE_LINENUMBER].back;  						break;  					}  					surface->FillRectangle(rcSelMargin, colour);  				}  			} else { -				surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated); +				surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back);  			}  			int visibleLine = topLine; @@ -1962,14 +1954,14 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {  					rcNumber.left = xpos;  					surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,  					        rcNumber.top + vs.maxAscent, number, istrlen(number), -					        vs.styles[STYLE_LINENUMBER].fore.allocated, -					        vs.styles[STYLE_LINENUMBER].back.allocated); +					        vs.styles[STYLE_LINENUMBER].fore, +					        vs.styles[STYLE_LINENUMBER].back);  				} else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) {  					if (firstSubLine) {  						const StyledText stMargin  = pdoc->MarginStyledText(lineDoc);  						if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) {  							surface->FillRectangle(rcMarker, -								vs.styles[stMargin.StyleAt(0)+vs.marginStyleOffset].back.allocated); +								vs.styles[stMargin.StyleAt(0)+vs.marginStyleOffset].back);  							if (vs.ms[margin].style == SC_MARGIN_RTEXT) {  								int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin);  								rcMarker.left = rcMarker.right - width - 3; @@ -2015,7 +2007,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {  	PRectangle rcBlankMargin = rcMargin;  	rcBlankMargin.left = rcSelMargin.right; -	surface->FillRectangle(rcBlankMargin, vs.styles[STYLE_DEFAULT].back.allocated); +	surface->FillRectangle(rcBlankMargin, vs.styles[STYLE_DEFAULT].back);  	if (bufferedDraw) {  		surfWindow->Copy(rcMargin, Point(), *pixmapSelMargin); @@ -2401,14 +2393,14 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  	}  } -ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw, bool main) { +ColourDesired Editor::SelectionBackground(ViewStyle &vsDraw, bool main) {  	return main ? -		(primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated) : -		vsDraw.selAdditionalBackground.allocated; +		(primarySelection ? vsDraw.selbackground : vsDraw.selbackground2) : +		vsDraw.selAdditionalBackground;  } -ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, -        ColourAllocated background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { +ColourDesired Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, +        ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) {  	if (inSelection == 1) {  		if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {  			return SelectionBackground(vsDraw, true); @@ -2421,14 +2413,14 @@ ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackgroun  		if ((vsDraw.edgeState == EDGE_BACKGROUND) &&  		        (i >= ll->edgeColumn) &&  		        !IsEOLChar(ll->chars[i])) -			return vsDraw.edgecolour.allocated; +			return vsDraw.edgecolour;  		if (inHotspot && vsDraw.hotspotBackgroundSet) -			return vsDraw.hotspotBackground.allocated; +			return vsDraw.hotspotBackground;  	}  	if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) {  		return background;  	} else { -		return vsDraw.styles[styleMain].back.allocated; +		return vsDraw.styles[styleMain].back;  	}  } @@ -2440,7 +2432,7 @@ void Editor::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight,  }  void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, -        bool isEndMarker, ColourAllocated wrapColour) { +        bool isEndMarker, ColourDesired wrapColour) {  	surface->PenColour(wrapColour);  	enum { xa = 1 }; // gap before start @@ -2485,14 +2477,14 @@ void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace,  	        y - 2 * dy);  } -static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) { +static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourDesired fill, int alpha) {  	if (alpha != SC_ALPHA_NOALPHA) {  		surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0);  	}  }  void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment, -				  const char *s, ColourAllocated textBack, ColourAllocated textFore, bool twoPhaseDraw) { +				  const char *s, ColourDesired textBack, ColourDesired textFore, bool twoPhaseDraw) {  	if (!twoPhaseDraw) {  		surface->FillRectangle(rcSegment, textBack);  	} @@ -2517,8 +2509,8 @@ void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment,  void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,          int line, int lineEnd, int xStart, int subLine, int subLineStart, -        bool overrideBackground, ColourAllocated background, -        bool drawWrapMarkEnd, ColourAllocated wrapColour) { +        bool overrideBackground, ColourDesired background, +        bool drawWrapMarkEnd, ColourDesired wrapColour) {  	const int posLineStart = pdoc->LineStart(line);  	const int styleMask = pdoc->stylingBitsMask; @@ -2539,7 +2531,7 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  	if (virtualSpace) {  		rcSegment.left = xEol + xStart;  		rcSegment.right = xEol + xStart + virtualSpace; -		surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); +		surface->FillRectangle(rcSegment, overrideBackground ? background : vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);  		if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) {  			SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line))));  			for (size_t r=0; r<sel.Count(); r++) { @@ -2574,8 +2566,8 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  			int inSelection = 0;  			bool inHotspot = false;  			int styleMain = ll->styles[eolPos]; -			ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, eolPos, ll); -			ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated; +			ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, eolPos, ll); +			ColourDesired textFore = vsDraw.styles[styleMain].fore;  			if (!hideSelection && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1)) {  				if (alpha == SC_ALPHA_NOALPHA) {  					surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1)); @@ -2600,11 +2592,11 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  		if (overrideBackground) {  			surface->FillRectangle(rcSegment, background);  		} else if (line < pdoc->LinesTotal() - 1) { -			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); +			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);  		} else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { -			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); +			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);  		} else { -			surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); +			surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);  		}  		if (!hideSelection && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {  			SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1), alpha); @@ -2623,9 +2615,9 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  		if (overrideBackground) {  			surface->FillRectangle(rcSegment, background);  		} else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { -			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); +			surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back);  		} else { -			surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); +			surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back);  		}  		if (!hideSelection && vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) {  			SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1), alpha); @@ -2743,14 +2735,14 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x  	int annotationLine = subLine - ll->lines;  	const StyledText stAnnotation  = pdoc->AnnotationStyledText(line);  	if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) { -		surface->FillRectangle(rcSegment, vsDraw.styles[0].back.allocated); +		surface->FillRectangle(rcSegment, vsDraw.styles[0].back);  		if (vs.annotationVisible == ANNOTATION_BOXED) {  			// Only care about calculating width if need to draw box  			int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation);  			widthAnnotation += vsDraw.spaceWidth * 2; // Margins  			rcSegment.left = xStart + indent;  			rcSegment.right = rcSegment.left + widthAnnotation; -			surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore.allocated); +			surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore);  		} else {  			rcSegment.left = xStart;  		} @@ -2766,7 +2758,7 @@ void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int x  		PRectangle rcText = rcSegment;  		if (vs.annotationVisible == ANNOTATION_BOXED) {  			surface->FillRectangle(rcText, -				vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back.allocated); +				vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back);  			rcText.left += vsDraw.spaceWidth;  		}  		DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, rcText.top + vsDraw.maxAscent, @@ -2805,17 +2797,17 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  	// with the earlier taking precedence.  When multiple markers cause background override,  	// the color for the highest numbered one is used.  	bool overrideBackground = false; -	ColourAllocated background; +	ColourDesired background;  	if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {  		overrideBackground = true; -		background = vsDraw.caretLineBackground.allocated; +		background = vsDraw.caretLineBackground;  	}  	if (!overrideBackground) {  		int marks = pdoc->GetMark(line);  		for (int markBit = 0; (markBit < 32) && marks; markBit++) {  			if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&  			        (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { -				background = vsDraw.markers[markBit].back.allocated; +				background = vsDraw.markers[markBit].back;  				overrideBackground = true;  			}  			marks >>= 1; @@ -2829,7 +2821,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  					if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) &&  					        (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {  						overrideBackground = true; -						background = vsDraw.markers[markBit].back.allocated; +						background = vsDraw.markers[markBit].back;  					}  					marksMasked >>= 1;  				} @@ -2861,9 +2853,9 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  		}  	} -	ColourAllocated wrapColour = vsDraw.styles[STYLE_DEFAULT].fore.allocated; +	ColourDesired wrapColour = vsDraw.styles[STYLE_DEFAULT].fore;  	if (vsDraw.whitespaceForegroundSet) -		wrapColour = vsDraw.whitespaceForeground.allocated; +		wrapColour = vsDraw.whitespaceForeground;  	bool drawWrapMarkEnd = false; @@ -2889,12 +2881,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  			// default bgnd here..  			surface->FillRectangle(rcSegment, overrideBackground ? background : -			        vsDraw.styles[STYLE_DEFAULT].back.allocated); +			        vsDraw.styles[STYLE_DEFAULT].back);  			// main line style would be below but this would be inconsistent with end markers  			// also would possibly not be the style at wrap point  			//int styleMain = ll->styles[lineStart]; -			//surface->FillRectangle(rcPlace, vsDraw.styles[styleMain].back.allocated); +			//surface->FillRectangle(rcPlace, vsDraw.styles[styleMain].back);  			if (wrapVisualFlags & SC_WRAPVISUALFLAG_START) { @@ -2943,12 +2935,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  			int styleMain = ll->styles[i];  			const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc);  			bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); -			ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); +			ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll);  			if (ll->chars[i] == '\t') {  				// Tab display  				if (drawWhitespaceBackground &&  				        (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) -					textBack = vsDraw.whitespaceBackground.allocated; +					textBack = vsDraw.whitespaceBackground;  				surface->FillRectangle(rcSegment, textBack);  			} else if (IsControlCharacter(ll->chars[i])) {  				// Control character display @@ -2967,7 +2959,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  									rcSegment.top,  									ll->positions[cpos + startseg + 1] + xStart - subLineStart,  									rcSegment.bottom); -								surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated); +								surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground);  							}  						} else {  							inIndentation = false; @@ -2994,7 +2986,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  		if ((ll->wrapIndent != 0) && (lineStart != 0))  			rcSegment.left -= ll->wrapIndent;  		rcSegment.right = rcSegment.left + 1; -		surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated); +		surface->FillRectangle(rcSegment, vsDraw.edgecolour);  	}  	// Draw underline mark as part of background if not transparent @@ -3005,7 +2997,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  		    (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {  			PRectangle rcUnderline = rcLine;  			rcUnderline.top = rcUnderline.bottom - 2; -			surface->FillRectangle(rcUnderline, vsDraw.markers[markBit].back.allocated); +			surface->FillRectangle(rcUnderline, vsDraw.markers[markBit].back);  		}  		marks >>= 1;  	} @@ -3030,31 +3022,31 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  		// draw strings that are completely past the right side of the window.  		if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) {  			int styleMain = ll->styles[i]; -			ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated; +			ColourDesired textFore = vsDraw.styles[styleMain].fore;  			Font &textFont = vsDraw.styles[styleMain].font;  			//hotspot foreground  			if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) {  				if (vsDraw.hotspotForegroundSet) -					textFore = vsDraw.hotspotForeground.allocated; +					textFore = vsDraw.hotspotForeground;  			}  			const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc);  			if (inSelection && (vsDraw.selforeset)) { -				textFore = (inSelection == 1) ? vsDraw.selforeground.allocated : vsDraw.selAdditionalForeground.allocated; +				textFore = (inSelection == 1) ? vsDraw.selforeground : vsDraw.selAdditionalForeground;  			}  			bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); -			ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); +			ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll);  			if (ll->chars[i] == '\t') {  				// Tab display  				if (!twoPhaseDraw) {  					if (drawWhitespaceBackground &&  					        (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) -						textBack = vsDraw.whitespaceBackground.allocated; +						textBack = vsDraw.whitespaceBackground;  					surface->FillRectangle(rcSegment, textBack);  				}  				if ((vsDraw.viewWhitespace != wsInvisible) ||  				        (inIndentation && vsDraw.viewIndentationGuides != ivNone)) {  					if (vsDraw.whitespaceForegroundSet) -						textFore = vsDraw.whitespaceForeground.allocated; +						textFore = vsDraw.whitespaceForeground;  					surface->PenColour(textFore);  				}  				if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { @@ -3109,12 +3101,12 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  						if (ll->chars[cpos + startseg] == ' ') {  							if (vsDraw.viewWhitespace != wsInvisible) {  								if (vsDraw.whitespaceForegroundSet) -									textFore = vsDraw.whitespaceForeground.allocated; +									textFore = vsDraw.whitespaceForeground;  								if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) {  									int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2;  									if (!twoPhaseDraw && drawWhitespaceBackground &&  									        (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { -										textBack = vsDraw.whitespaceBackground.allocated; +										textBack = vsDraw.whitespaceBackground;  										PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart,  											rcSegment.top,  											ll->positions[cpos + startseg + 1] + xStart - subLineStart, @@ -3145,7 +3137,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  				rcUL.top = rcUL.top + vsDraw.maxAscent + 1;  				rcUL.bottom = rcUL.top + 1;  				if (vsDraw.hotspotForegroundSet) -					surface->FillRectangle(rcUL, vsDraw.hotspotForeground.allocated); +					surface->FillRectangle(rcUL, vsDraw.hotspotForeground);  				else  					surface->FillRectangle(rcUL, textFore);  			} else if (vsDraw.styles[styleMain].underline) { @@ -3245,16 +3237,16 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  	rcSegment.left = 0;  	rcSegment.right = rcLine.right - 1;  	if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) { -		SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha); +		SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground, vsDraw.caretLineAlpha);  	}  	marks = pdoc->GetMark(line);  	for (markBit = 0; (markBit < 32) && marks; markBit++) {  		if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) { -			SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); +			SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha);  		} else if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE)) {  			PRectangle rcUnderline = rcSegment;  			rcUnderline.top = rcUnderline.bottom - 2; -			SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); +			SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha);  		}  		marks >>= 1;  	} @@ -3263,7 +3255,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  		if (marksMasked) {  			for (markBit = 0; (markBit < 32) && marksMasked; markBit++) {  				if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) { -					SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); +					SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back, vsDraw.markers[markBit].alpha);  				}  				marksMasked >>= 1;  			} @@ -3272,7 +3264,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis  }  void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, -							int xStart, int offset, int posCaret, PRectangle rcCaret, ColourAllocated caretColour) { +							int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour) {  	int lineStart = ll->LineStart(subLine);  	int posBefore = posCaret; @@ -3330,7 +3322,7 @@ void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll,  	int styleMain = ll->styles[offsetFirstChar];  	surface->DrawTextClipped(rcCaret, vsDraw.styles[styleMain].font,  	        rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, -	        numCharsToDraw, vsDraw.styles[styleMain].back.allocated, +	        numCharsToDraw, vsDraw.styles[styleMain].back,  	        caretColour);  } @@ -3345,22 +3337,22 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) {  		PRectangle rcPattern(0, 0, patternSize, patternSize);  		// Initialize default colours based on the chrome colour scheme.  Typically the highlight is white. -		ColourAllocated colourFMFill = vs.selbar.allocated; -		ColourAllocated colourFMStripes = vs.selbarlight.allocated; +		ColourDesired colourFMFill = vs.selbar; +		ColourDesired colourFMStripes = vs.selbarlight; -		if (!(vs.selbarlight.desired == ColourDesired(0xff, 0xff, 0xff))) { +		if (!(vs.selbarlight == ColourDesired(0xff, 0xff, 0xff))) {  			// User has chosen an unusual chrome colour scheme so just use the highlight edge colour.  			// (Typically, the highlight colour is white.) -			colourFMFill = vs.selbarlight.allocated; +			colourFMFill = vs.selbarlight;  		}  		if (vs.foldmarginColourSet) {  			// override default fold margin colour -			colourFMFill = vs.foldmarginColour.allocated; +			colourFMFill = vs.foldmarginColour;  		}  		if (vs.foldmarginHighlightColourSet) {  			// override default fold margin highlight colour -			colourFMStripes = vs.foldmarginHighlightColour.allocated; +			colourFMStripes = vs.foldmarginHighlightColour;  		}  		pixmapSelPattern->FillRectangle(rcPattern, colourFMFill); @@ -3377,14 +3369,14 @@ void Editor::RefreshPixMaps(Surface *surfaceWindow) {  		pixmapIndentGuide->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID());  		pixmapIndentGuideHighlight->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID());  		PRectangle rcIG(0, 0, 1, vs.lineHeight); -		pixmapIndentGuide->FillRectangle(rcIG, vs.styles[STYLE_INDENTGUIDE].back.allocated); -		pixmapIndentGuide->PenColour(vs.styles[STYLE_INDENTGUIDE].fore.allocated); -		pixmapIndentGuideHighlight->FillRectangle(rcIG, vs.styles[STYLE_BRACELIGHT].back.allocated); -		pixmapIndentGuideHighlight->PenColour(vs.styles[STYLE_BRACELIGHT].fore.allocated); +		pixmapIndentGuide->FillRectangle(rcIG, vs.styles[STYLE_INDENTGUIDE].back); +		pixmapIndentGuide->PenColour(vs.styles[STYLE_INDENTGUIDE].fore); +		pixmapIndentGuideHighlight->FillRectangle(rcIG, vs.styles[STYLE_BRACELIGHT].back); +		pixmapIndentGuideHighlight->PenColour(vs.styles[STYLE_BRACELIGHT].fore);  		for (int stripe = 1; stripe < vs.lineHeight + 1; stripe += 2) {  			PRectangle rcPixel(0, stripe, 1, stripe+1); -			pixmapIndentGuide->FillRectangle(rcPixel, vs.styles[STYLE_INDENTGUIDE].fore.allocated); -			pixmapIndentGuideHighlight->FillRectangle(rcPixel, vs.styles[STYLE_BRACELIGHT].fore.allocated); +			pixmapIndentGuide->FillRectangle(rcPixel, vs.styles[STYLE_INDENTGUIDE].fore); +			pixmapIndentGuideHighlight->FillRectangle(rcPixel, vs.styles[STYLE_BRACELIGHT].fore);  		}  	} @@ -3469,7 +3461,7 @@ void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xS  					rcCaret.left = xposCaret - caretWidthOffset;  					rcCaret.right = rcCaret.left + vsDraw.caretWidth;  				} -				ColourAllocated caretColour = mainCaret ? vsDraw.caretcolour.allocated : vsDraw.additionalCaretColour.allocated; +				ColourDesired caretColour = mainCaret ? vsDraw.caretcolour : vsDraw.additionalCaretColour;  				if (drawBlockCaret) {  					DrawBlockCaret(surface, vsDraw, ll, subLine, xStart, offset, posCaret.Position(), rcCaret, caretColour);  				} else { @@ -3496,9 +3488,6 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  	//Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d)   %d\n",  	//	rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); -	surfaceWindow->SetPalette(&palette, true); -	pixmapLine->SetPalette(&palette, !hasFocus); -  	int screenLinePaintFirst = rcArea.top / vs.lineHeight;  	int xStart = vs.fixedColumnWidth - xOffset; @@ -3509,17 +3498,11 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  	bool paintAbandonedByStyling = paintState == paintAbandoned;  	if (needUpdateUI) { -		// Deselect palette by selecting a temporary palette -		Palette palTemp; -		surfaceWindow->SetPalette(&palTemp, true); -  		NotifyUpdateUI();  		needUpdateUI = 0;  		RefreshStyleData();  		RefreshPixMaps(surfaceWindow); -		surfaceWindow->SetPalette(&palette, true); -		pixmapLine->SetPalette(&palette, !hasFocus);  	}  	// Call priority lines wrap on a window of lines which are likely @@ -3544,7 +3527,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  		PRectangle rcRightMargin = rcClient;  		rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth;  		if (rcArea.Intersects(rcRightMargin)) { -			surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated); +			surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back);  		}  	} @@ -3654,7 +3637,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  						(!expanded && (foldFlags & SC_FOLDFLAG_LINEBEFORE_CONTRACTED))) {  						PRectangle rcFoldLine = rcLine;  						rcFoldLine.bottom = rcFoldLine.top + 1; -						surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); +						surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore);  					}  					// Paint the line below the fold  					if ((expanded && (foldFlags & SC_FOLDFLAG_LINEAFTER_EXPANDED)) @@ -3662,7 +3645,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  						(!expanded && (foldFlags & SC_FOLDFLAG_LINEAFTER_CONTRACTED))) {  						PRectangle rcFoldLine = rcLine;  						rcFoldLine.top = rcFoldLine.bottom - 1; -						surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); +						surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore);  					}  				} @@ -3699,12 +3682,12 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {  		rcBeyondEOF.right = rcBeyondEOF.right;  		rcBeyondEOF.top = (cs.LinesDisplayed() - topLine) * vs.lineHeight;  		if (rcBeyondEOF.top < rcBeyondEOF.bottom) { -			surfaceWindow->FillRectangle(rcBeyondEOF, vs.styles[STYLE_DEFAULT].back.allocated); +			surfaceWindow->FillRectangle(rcBeyondEOF, vs.styles[STYLE_DEFAULT].back);  			if (vs.edgeState == EDGE_LINE) {  				int edgeX = theEdge * vs.spaceWidth;  				rcBeyondEOF.left = edgeX + xStart;  				rcBeyondEOF.right = rcBeyondEOF.left + 1; -				surfaceWindow->FillRectangle(rcBeyondEOF, vs.edgecolour.allocated); +				surfaceWindow->FillRectangle(rcBeyondEOF, vs.edgecolour);  			}  		}  		//Platform::DebugPrintf( @@ -3780,21 +3763,21 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) {  	// Set colours for printing according to users settings  	for (size_t sty = 0; sty < vsPrint.stylesSize; sty++) {  		if (printColourMode == SC_PRINT_INVERTLIGHT) { -			vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired); -			vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired); +			vsPrint.styles[sty].fore = InvertedLight(vsPrint.styles[sty].fore); +			vsPrint.styles[sty].back = InvertedLight(vsPrint.styles[sty].back);  		} else if (printColourMode == SC_PRINT_BLACKONWHITE) { -			vsPrint.styles[sty].fore.desired = ColourDesired(0, 0, 0); -			vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); +			vsPrint.styles[sty].fore = ColourDesired(0, 0, 0); +			vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff);  		} else if (printColourMode == SC_PRINT_COLOURONWHITE) { -			vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); +			vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff);  		} else if (printColourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) {  			if (sty <= STYLE_DEFAULT) { -				vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); +				vsPrint.styles[sty].back = ColourDesired(0xff, 0xff, 0xff);  			}  		}  	}  	// White background for the line numbers -	vsPrint.styles[STYLE_LINENUMBER].back.desired = ColourDesired(0xff, 0xff, 0xff); +	vsPrint.styles[STYLE_LINENUMBER].back = ColourDesired(0xff, 0xff, 0xff);  	vsPrint.Refresh(*surfaceMeasure);  	// Determining width must hapen after fonts have been realised in Refresh @@ -3805,9 +3788,6 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) {  		vsPrint.ms[lineNumberIndex].width = lineNumberWidth;  		vsPrint.Refresh(*surfaceMeasure);	// Recalculate fixedColumnWidth  	} -	// Ensure colours are set up -	vsPrint.RefreshColourPalette(palette, true); -	vsPrint.RefreshColourPalette(palette, false);  	int linePrintStart = pdoc->LineFromPosition(pfr->chrg.cpMin);  	int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; @@ -3887,8 +3867,8 @@ long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) {  			surface->FlushCachedState();  			surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font,  			        ypos + vsPrint.maxAscent, number, istrlen(number), -			        vsPrint.styles[STYLE_LINENUMBER].fore.allocated, -			        vsPrint.styles[STYLE_LINENUMBER].back.allocated); +			        vsPrint.styles[STYLE_LINENUMBER].fore, +			        vsPrint.styles[STYLE_LINENUMBER].back);  		}  		// Draw the line @@ -7008,10 +6988,10 @@ void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam  	vs.EnsureStyle(wParam);  	switch (iMessage) {  	case SCI_STYLESETFORE: -		vs.styles[wParam].fore.desired = ColourDesired(lParam); +		vs.styles[wParam].fore = ColourDesired(lParam);  		break;  	case SCI_STYLESETBACK: -		vs.styles[wParam].back.desired = ColourDesired(lParam); +		vs.styles[wParam].back = ColourDesired(lParam);  		break;  	case SCI_STYLESETBOLD:  		vs.styles[wParam].weight = lParam != 0 ? SC_WEIGHT_BOLD : SC_WEIGHT_NORMAL; @@ -7062,9 +7042,9 @@ sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lPar  	vs.EnsureStyle(wParam);  	switch (iMessage) {  	case SCI_STYLEGETFORE: -		return vs.styles[wParam].fore.desired.AsLong(); +		return vs.styles[wParam].fore.AsLong();  	case SCI_STYLEGETBACK: -		return vs.styles[wParam].back.desired.AsLong(); +		return vs.styles[wParam].back.AsLong();  	case SCI_STYLEGETBOLD:  		return vs.styles[wParam].weight > SC_WEIGHT_NORMAL;  	case SCI_STYLEGETWEIGHT: @@ -8010,13 +7990,14 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_GETCODEPAGE:  		return pdoc->dbcsCodePage; +#ifdef INCLUDE_DEPRECATED_FEATURES  	case SCI_SETUSEPALETTE: -		palette.allowRealization = wParam != 0;  		InvalidateStyleRedraw();  		break;  	case SCI_GETUSEPALETTE: -		return palette.allowRealization; +		return 0; +#endif  		// Marker definition and setting  	case SCI_MARKERDEFINE: @@ -8034,13 +8015,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_MARKERSETFORE:  		if (wParam <= MARKER_MAX) -			vs.markers[wParam].fore.desired = ColourDesired(lParam); +			vs.markers[wParam].fore = ColourDesired(lParam);  		InvalidateStyleData();  		RedrawSelMargin();  		break;  	case SCI_MARKERSETBACKSELECTED:  		if (wParam <= MARKER_MAX) -			vs.markers[wParam].backSelected.desired = ColourDesired(lParam); +			vs.markers[wParam].backSelected = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_MARKERENABLEHIGHLIGHT: @@ -8049,7 +8030,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		break;  	case SCI_MARKERSETBACK:  		if (wParam <= MARKER_MAX) -			vs.markers[wParam].back.desired = ColourDesired(lParam); +			vs.markers[wParam].back = ColourDesired(lParam);  		InvalidateStyleData();  		RedrawSelMargin();  		break; @@ -8247,9 +8228,9 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		InvalidateStyleRedraw();  		break;  	case SCI_GETCARETLINEBACK: -		return vs.caretLineBackground.desired.AsLong(); +		return vs.caretLineBackground.AsLong();  	case SCI_SETCARETLINEBACK: -		vs.caretLineBackground.desired = wParam; +		vs.caretLineBackground = wParam;  		InvalidateStyleRedraw();  		break;  	case SCI_GETCARETLINEBACKALPHA: @@ -8362,15 +8343,15 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_SETSELFORE:  		vs.selforeset = wParam != 0; -		vs.selforeground.desired = ColourDesired(lParam); -		vs.selAdditionalForeground.desired = ColourDesired(lParam); +		vs.selforeground = ColourDesired(lParam); +		vs.selAdditionalForeground = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETSELBACK:  		vs.selbackset = wParam != 0; -		vs.selbackground.desired = ColourDesired(lParam); -		vs.selAdditionalBackground.desired = ColourDesired(lParam); +		vs.selbackground = ColourDesired(lParam); +		vs.selAdditionalBackground = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break; @@ -8393,23 +8374,23 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_SETWHITESPACEFORE:  		vs.whitespaceForegroundSet = wParam != 0; -		vs.whitespaceForeground.desired = ColourDesired(lParam); +		vs.whitespaceForeground = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETWHITESPACEBACK:  		vs.whitespaceBackgroundSet = wParam != 0; -		vs.whitespaceBackground.desired = ColourDesired(lParam); +		vs.whitespaceBackground = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETCARETFORE: -		vs.caretcolour.desired = ColourDesired(wParam); +		vs.caretcolour = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break;  	case SCI_GETCARETFORE: -		return vs.caretcolour.desired.AsLong(); +		return vs.caretcolour.AsLong();  	case SCI_SETCARETSTYLE:  		if (wParam <= CARETSTYLE_BLOCK) @@ -8462,13 +8443,13 @@ 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 = ColourDesired(lParam); +			vs.indicators[wParam].fore = ColourDesired(lParam);  			InvalidateStyleRedraw();  		}  		break;  	case SCI_INDICGETFORE: -		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fore.desired.AsLong() : 0; +		return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fore.AsLong() : 0;  	case SCI_INDICSETUNDER:  		if (wParam <= INDIC_MAX) { @@ -8684,10 +8665,10 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		break;  	case SCI_GETEDGECOLOUR: -		return vs.edgecolour.desired.AsLong(); +		return vs.edgecolour.AsLong();  	case SCI_SETEDGECOLOUR: -		vs.edgecolour.desired = ColourDesired(wParam); +		vs.edgecolour = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break; @@ -8841,33 +8822,33 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_SETFOLDMARGINCOLOUR:  		vs.foldmarginColourSet = wParam != 0; -		vs.foldmarginColour.desired = ColourDesired(lParam); +		vs.foldmarginColour = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETFOLDMARGINHICOLOUR:  		vs.foldmarginHighlightColourSet = wParam != 0; -		vs.foldmarginHighlightColour.desired = ColourDesired(lParam); +		vs.foldmarginHighlightColour = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETHOTSPOTACTIVEFORE:  		vs.hotspotForegroundSet = wParam != 0; -		vs.hotspotForeground.desired = ColourDesired(lParam); +		vs.hotspotForeground = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_GETHOTSPOTACTIVEFORE: -		return vs.hotspotForeground.desired.AsLong(); +		return vs.hotspotForeground.AsLong();  	case SCI_SETHOTSPOTACTIVEBACK:  		vs.hotspotBackgroundSet = wParam != 0; -		vs.hotspotBackground.desired = ColourDesired(lParam); +		vs.hotspotBackground = ColourDesired(lParam);  		InvalidateStyleRedraw();  		break;  	case SCI_GETHOTSPOTACTIVEBACK: -		return vs.hotspotBackground.desired.AsLong(); +		return vs.hotspotBackground.AsLong();  	case SCI_SETHOTSPOTACTIVEUNDERLINE:  		vs.hotspotUnderline = wParam != 0; @@ -9202,12 +9183,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		return virtualSpaceOptions;  	case SCI_SETADDITIONALSELFORE: -		vs.selAdditionalForeground.desired = ColourDesired(wParam); +		vs.selAdditionalForeground = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break;  	case SCI_SETADDITIONALSELBACK: -		vs.selAdditionalBackground.desired = ColourDesired(wParam); +		vs.selAdditionalBackground = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break; @@ -9220,12 +9201,12 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  		return vs.selAdditionalAlpha;  	case SCI_SETADDITIONALCARETFORE: -		vs.additionalCaretColour.desired = ColourDesired(wParam); +		vs.additionalCaretColour = ColourDesired(wParam);  		InvalidateStyleRedraw();  		break;  	case SCI_GETADDITIONALCARETFORE: -		return vs.additionalCaretColour.desired.AsLong(); +		return vs.additionalCaretColour.AsLong();  	case SCI_ROTATESELECTION:  		sel.RotateMain(); diff --git a/src/Editor.h b/src/Editor.h index 06b905961..fa2b95440 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -133,7 +133,6 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	ViewStyle vs;  	int technology;  	Point sizeRGBAImage; -	Palette palette;  	int printMagnification;  	int printColourMode; @@ -279,7 +278,6 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	void InvalidateStyleData();  	void InvalidateStyleRedraw(); -	virtual void RefreshColourPalette(Palette &pal, bool want);  	void RefreshStyleData();  	void DropGraphics(bool freeObjects);  	void AllocateGraphics(); @@ -370,14 +368,14 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	LineLayout *RetrieveLineLayout(int lineNumber);  	void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,  		int width=LineLayout::wrapWidthInfinite); -	ColourAllocated SelectionBackground(ViewStyle &vsDraw, bool main); -	ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll); +	ColourDesired SelectionBackground(ViewStyle &vsDraw, bool main); +	ColourDesired TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourDesired background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);  	void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); -	void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour); +	void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourDesired wrapColour);  	void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,  		int line, int lineEnd, int xStart, int subLine, int subLineStart, -		bool overrideBackground, ColourAllocated background, -		bool drawWrapMark, ColourAllocated wrapColour); +		bool overrideBackground, ColourDesired background, +		bool drawWrapMark, ColourDesired wrapColour);  	void DrawIndicator(int indicNum, int startPos, int endPos, Surface *surface, ViewStyle &vsDraw,  		int xStart, PRectangle rcLine, LineLayout *ll, int subLine);  	void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, @@ -387,7 +385,7 @@ protected:	// ScintillaBase subclass needs access to much of Editor  	void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,  		PRectangle rcLine, LineLayout *ll, int subLine);  	void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, -		int xStart, int offset, int posCaret, PRectangle rcCaret, ColourAllocated caretColour); +		int xStart, int offset, int posCaret, PRectangle rcCaret, ColourDesired caretColour);  	void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart,  		PRectangle rcLine, LineLayout *ll, int subLine);  	void RefreshPixMaps(Surface *surfaceWindow); diff --git a/src/Indicator.cxx b/src/Indicator.cxx index 7059a55bd..dfa2a999c 100644 --- a/src/Indicator.cxx +++ b/src/Indicator.cxx @@ -23,7 +23,7 @@ using namespace Scintilla;  #endif  void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { -	surface->PenColour(fore.allocated); +	surface->PenColour(fore);  	int ymid = (rc.bottom + rc.top) / 2;  	if (style == INDIC_SQUIGGLE) {  		surface->MoveTo(rc.left, rc.top); @@ -91,7 +91,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  		rcBox.top = rcLine.top + 1;  		rcBox.left = rc.left;  		rcBox.right = rc.right; -		surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore.allocated, fillAlpha, fore.allocated, outlineAlpha, 0); +		surface->AlphaRectangle(rcBox, (style == INDIC_ROUNDBOX) ? 1 : 0, fore, fillAlpha, fore, outlineAlpha, 0);  	} else if (style == INDIC_DOTBOX) {  		PRectangle rcBox = rcLine;  		rcBox.top = rcLine.top + 1; @@ -103,13 +103,13 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  		// Draw horizontal lines top and bottom  		for (int x=0; x<width; x++) {  			for (int y=0; y<rcBox.Height(); y += rcBox.Height()-1) { -				image.SetPixel(x, y, fore.desired, ((x + y) % 2) ? outlineAlpha : fillAlpha); +				image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);  			}  		}  		// Draw vertical lines left and right  		for (int y=1; y<rcBox.Height(); y++) {  			for (int x=0; x<width; x += width-1) { -				image.SetPixel(x, y, fore.desired, ((x + y) % 2) ? outlineAlpha : fillAlpha); +				image.SetPixel(x, y, fore, ((x + y) % 2) ? outlineAlpha : fillAlpha);  			}  		}  		surface->DrawRGBAImage(rcBox, image.GetWidth(), image.GetHeight(), image.Pixels()); @@ -124,7 +124,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r  		int x = rc.left;  		while (x < rc.right) {  			PRectangle rcDot(x, ymid, x+1, ymid+1); -			surface->FillRectangle(rcDot, fore.allocated); +			surface->FillRectangle(rcDot, fore);  			x += 2;  		}  	} else {	// Either INDIC_PLAIN or unknown diff --git a/src/Indicator.h b/src/Indicator.h index e787b592d..0284a855b 100644 --- a/src/Indicator.h +++ b/src/Indicator.h @@ -18,7 +18,7 @@ class Indicator {  public:  	int style;  	bool under; -	ColourPair fore; +	ColourDesired fore;  	int fillAlpha;  	int outlineAlpha;  	Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30), outlineAlpha(50) { diff --git a/src/LineMarker.cxx b/src/LineMarker.cxx index b2b7ceae8..a14e4e40d 100644 --- a/src/LineMarker.cxx +++ b/src/LineMarker.cxx @@ -20,15 +20,6 @@  using namespace Scintilla;  #endif -void LineMarker::RefreshColourPalette(Palette &pal, bool want) { -	pal.WantFind(fore, want); -	pal.WantFind(back, want); -	pal.WantFind(backSelected, want); -	if (pxpm) { -		pxpm->RefreshColourPalette(pal, want); -	} -} -  void LineMarker::SetXPM(const char *textForm) {  	delete pxpm;  	pxpm = new XPM(textForm); @@ -47,7 +38,7 @@ void LineMarker::SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRG  	markType = SC_MARK_RGBAIMAGE;  } -static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourAllocated fore, ColourAllocated back) { +static void DrawBox(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {  	PRectangle rc;  	rc.left = centreX - armSize;  	rc.top = centreY - armSize; @@ -56,7 +47,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, ColourAllocated fore, ColourAllocated back) { +static void DrawCircle(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore, ColourDesired back) {  	PRectangle rcCircle;  	rcCircle.left = centreX - armSize;  	rcCircle.top = centreY - armSize; @@ -65,22 +56,22 @@ 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, ColourAllocated fore) { +static void DrawPlus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired 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, ColourAllocated fore) { +static void DrawMinus(Surface *surface, int centreX, int centreY, int armSize, ColourDesired fore) {  	PRectangle rcH(centreX - armSize + 2, centreY, centreX + armSize - 2 + 1, centreY+1);  	surface->FillRectangle(rcH, fore);  }  void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharacter, typeOfFold tFold) { -	ColourPair head = back; -	ColourPair body = back; -	ColourPair tail = back; +	ColourDesired head = back; +	ColourDesired body = back; +	ColourDesired tail = back;  	switch (tFold) {  	case LineMarker::head : @@ -130,14 +121,14 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac  		PRectangle rcRounded = rc;  		rcRounded.left = rc.left + 1;  		rcRounded.right = rc.right - 1; -		surface->RoundedRectangle(rcRounded, fore.allocated, back.allocated); +		surface->RoundedRectangle(rcRounded, fore, back);  	} else if (markType == SC_MARK_CIRCLE) {  		PRectangle rcCircle;  		rcCircle.left = centreX - dimOn2;  		rcCircle.top = centreY - dimOn2;  		rcCircle.right = centreX + dimOn2;  		rcCircle.bottom = centreY + dimOn2; -		surface->Ellipse(rcCircle, fore.allocated, back.allocated); +		surface->Ellipse(rcCircle, fore, back);  	} else if (markType == SC_MARK_ARROW) {  		Point pts[] = {      		Point(centreX - dimOn4, centreY - dimOn2), @@ -145,7 +136,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac      		Point(centreX + dimOn2 - dimOn4, centreY),  		};  		surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), -                 		fore.allocated, back.allocated); +                 		fore, back);  	} else if (markType == SC_MARK_ARROWDOWN) {  		Point pts[] = { @@ -154,7 +145,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac      		Point(centreX, centreY + dimOn2 - dimOn4),  		};  		surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), -                 		fore.allocated, back.allocated); +                 		fore, back);  	} else if (markType == SC_MARK_PLUS) {  		Point pts[] = { @@ -172,7 +163,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac      		Point(centreX - armSize, centreY + 1),  		};  		surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), -                 		fore.allocated, back.allocated); +                 		fore, back);  	} else if (markType == SC_MARK_MINUS) {  		Point pts[] = { @@ -182,7 +173,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac      		Point(centreX - armSize, centreY + 1),  		};  		surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), -                 		fore.allocated, back.allocated); +                 		fore, back);  	} else if (markType == SC_MARK_SMALLRECT) {  		PRectangle rcSmall; @@ -190,76 +181,76 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac  		rcSmall.top = rc.top + 2;  		rcSmall.right = rc.right - 1;  		rcSmall.bottom = rc.bottom - 2; -		surface->RectangleDraw(rcSmall, fore.allocated, back.allocated); +		surface->RectangleDraw(rcSmall, fore, back);  	} else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND ||  		markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) {  		// An invisible marker so don't draw anything  	} else if (markType == SC_MARK_VLINE) { -		surface->PenColour(body.allocated); +		surface->PenColour(body);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, rcWhole.bottom);  	} else if (markType == SC_MARK_LCORNER) { -		surface->PenColour(tail.allocated); +		surface->PenColour(tail);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, rc.top + dimOn2);  		surface->LineTo(rc.right - 2, rc.top + dimOn2);  	} else if (markType == SC_MARK_TCORNER) { -		surface->PenColour(tail.allocated); +		surface->PenColour(tail);  		surface->MoveTo(centreX, rc.top + dimOn2);  		surface->LineTo(rc.right - 2, rc.top + dimOn2); -		surface->PenColour(body.allocated); +		surface->PenColour(body);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, rc.top + dimOn2 + 1); -		surface->PenColour(head.allocated); +		surface->PenColour(head);  		surface->LineTo(centreX, rcWhole.bottom);  	} else if (markType == SC_MARK_LCORNERCURVE) { -		surface->PenColour(tail.allocated); +		surface->PenColour(tail);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, rc.top + dimOn2-3);  		surface->LineTo(centreX+3, rc.top + dimOn2);  		surface->LineTo(rc.right - 1, rc.top + dimOn2);  	} else if (markType == SC_MARK_TCORNERCURVE) { -		surface->PenColour(tail.allocated); +		surface->PenColour(tail);  		surface->MoveTo(centreX, rc.top + dimOn2-3);  		surface->LineTo(centreX+3, rc.top + dimOn2);  		surface->LineTo(rc.right - 1, rc.top + dimOn2); -		surface->PenColour(body.allocated); +		surface->PenColour(body);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, rc.top + dimOn2-2); -		surface->PenColour(head.allocated); +		surface->PenColour(head);  		surface->LineTo(centreX, rcWhole.bottom);  	} else if (markType == SC_MARK_BOXPLUS) { -		DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawBox(surface, centreX, centreY, blobSize, fore, head); +		DrawPlus(surface, centreX, centreY, blobSize, tail);  	} else if (markType == SC_MARK_BOXPLUSCONNECTED) {  		if (tFold == LineMarker::headWithTail) -			surface->PenColour(tail.allocated); +			surface->PenColour(tail);  		else -			surface->PenColour(body.allocated); +			surface->PenColour(body);  		surface->MoveTo(centreX, centreY + blobSize);  		surface->LineTo(centreX, rcWhole.bottom); -		surface->PenColour(body.allocated); +		surface->PenColour(body);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, centreY - blobSize); -		DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawBox(surface, centreX, centreY, blobSize, fore, head); +		DrawPlus(surface, centreX, centreY, blobSize, tail);  		if (tFold == LineMarker::body) { -			surface->PenColour(tail.allocated); +			surface->PenColour(tail);  			surface->MoveTo(centreX + 1, centreY + blobSize);  			surface->LineTo(centreX + blobSize + 1, centreY + blobSize); @@ -270,27 +261,27 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac  			surface->LineTo(centreX + blobSize + 1, centreY - blobSize);  		}  	} else if (markType == SC_MARK_BOXMINUS) { -		DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawBox(surface, centreX, centreY, blobSize, fore, head); +		DrawMinus(surface, centreX, centreY, blobSize, tail); -		surface->PenColour(head.allocated); +		surface->PenColour(head);  		surface->MoveTo(centreX, centreY + blobSize);  		surface->LineTo(centreX, rcWhole.bottom);  	} else if (markType == SC_MARK_BOXMINUSCONNECTED) { -		DrawBox(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawBox(surface, centreX, centreY, blobSize, fore, head); +		DrawMinus(surface, centreX, centreY, blobSize, tail); -		surface->PenColour(head.allocated); +		surface->PenColour(head);  		surface->MoveTo(centreX, centreY + blobSize);  		surface->LineTo(centreX, rcWhole.bottom); -		surface->PenColour(body.allocated); +		surface->PenColour(body);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, centreY - blobSize);  		if (tFold == LineMarker::body) { -			surface->PenColour(tail.allocated); +			surface->PenColour(tail);  			surface->MoveTo(centreX + 1, centreY + blobSize);  			surface->LineTo(centreX + blobSize + 1, centreY + blobSize); @@ -301,41 +292,41 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac  			surface->LineTo(centreX + blobSize + 1, centreY - blobSize);  		}  	} else if (markType == SC_MARK_CIRCLEPLUS) { -		DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawCircle(surface, centreX, centreY, blobSize, fore, head); +		DrawPlus(surface, centreX, centreY, blobSize, tail);  	} else if (markType == SC_MARK_CIRCLEPLUSCONNECTED) {  		if (tFold == LineMarker::headWithTail) -			surface->PenColour(tail.allocated); +			surface->PenColour(tail);  		else -			surface->PenColour(body.allocated); +			surface->PenColour(body);  		surface->MoveTo(centreX, centreY + blobSize);  		surface->LineTo(centreX, rcWhole.bottom); -		surface->PenColour(body.allocated); +		surface->PenColour(body);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, centreY - blobSize); -		DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawPlus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawCircle(surface, centreX, centreY, blobSize, fore, head); +		DrawPlus(surface, centreX, centreY, blobSize, tail);  	} else if (markType == SC_MARK_CIRCLEMINUS) { -		DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawCircle(surface, centreX, centreY, blobSize, fore, head); +		DrawMinus(surface, centreX, centreY, blobSize, tail); -		surface->PenColour(head.allocated); +		surface->PenColour(head);  		surface->MoveTo(centreX, centreY + blobSize);  		surface->LineTo(centreX, rcWhole.bottom);  	} else if (markType == SC_MARK_CIRCLEMINUSCONNECTED) { -		DrawCircle(surface, centreX, centreY, blobSize, fore.allocated, head.allocated); -		DrawMinus(surface, centreX, centreY, blobSize, tail.allocated); +		DrawCircle(surface, centreX, centreY, blobSize, fore, head); +		DrawMinus(surface, centreX, centreY, blobSize, tail); -		surface->PenColour(head.allocated); +		surface->PenColour(head);  		surface->MoveTo(centreX, centreY + blobSize);  		surface->LineTo(centreX, rcWhole.bottom); -		surface->PenColour(body.allocated); +		surface->PenColour(body);  		surface->MoveTo(centreX, rcWhole.top);  		surface->LineTo(centreX, centreY - blobSize); @@ -346,17 +337,17 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac  		rc.left += (rc.Width() - width) / 2;  		rc.right = rc.left + width;  		surface->DrawTextClipped(rc, fontForCharacter, rc.bottom - 2, -			character, 1, fore.allocated, back.allocated); +			character, 1, fore, back);  	} else if (markType == SC_MARK_DOTDOTDOT) {  		int right = centreX - 6;  		for (int b=0; b<3; b++) {  			PRectangle rcBlob(right, rc.bottom - 4, right + 2, rc.bottom-2); -			surface->FillRectangle(rcBlob, fore.allocated); +			surface->FillRectangle(rcBlob, fore);  			right += 5;  		}  	} else if (markType == SC_MARK_ARROWS) { -		surface->PenColour(fore.allocated); +		surface->PenColour(fore);  		int right = centreX - 2;  		for (int b=0; b<3; b++) {  			surface->MoveTo(right - 4, centreY - 4); @@ -376,12 +367,12 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac  			Point(centreX, centreY + dimOn2),  		};  		surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), -				fore.allocated, back.allocated); +				fore, back);  	} else if (markType == SC_MARK_LEFTRECT) {  		PRectangle rcLeft = rcWhole;  		rcLeft.right = rcLeft.left + 4; -		surface->FillRectangle(rcLeft, back.allocated); +		surface->FillRectangle(rcLeft, back);  	} else { // SC_MARK_FULLRECT -		surface->FillRectangle(rcWhole, back.allocated); +		surface->FillRectangle(rcWhole, back);  	}  } diff --git a/src/LineMarker.h b/src/LineMarker.h index 6477a1ffe..ccf410414 100644 --- a/src/LineMarker.h +++ b/src/LineMarker.h @@ -20,9 +20,9 @@ public:  	enum typeOfFold { undefined, head, body, tail, headWithTail };  	int markType; -	ColourPair fore; -	ColourPair back; -	ColourPair backSelected; +	ColourDesired fore; +	ColourDesired back; +	ColourDesired backSelected;  	int alpha;  	XPM *pxpm;  	RGBAImage *image; @@ -62,7 +62,6 @@ public:  		image = NULL;  		return *this;  	} -	void RefreshColourPalette(Palette &pal, bool want);  	void SetXPM(const char *textForm);  	void SetXPM(const char *const *linesForm);  	void SetRGBAImage(Point sizeRGBAImage, const unsigned char *pixelsRGBAImage); diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 247f34c4e..0f1c9cda3 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -65,11 +65,6 @@ void ScintillaBase::Finalise() {  	popup.Destroy();  } -void ScintillaBase::RefreshColourPalette(Palette &pal, bool want) { -	Editor::RefreshColourPalette(pal, want); -	ct.RefreshColourPalette(pal, want); -} -  void ScintillaBase::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {  	bool isFillUp = ac.Active() && ac.IsFillUpChar(*s);  	if (!isFillUp) { diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index 203510844..e143f027d 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -59,8 +59,6 @@ protected:  	virtual void Initialise() = 0;  	virtual void Finalise() = 0; -	virtual void RefreshColourPalette(Palette &pal, bool want); -  	virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);  	void Command(int cmdId);  	virtual void CancelModes(); diff --git a/src/Style.cxx b/src/Style.cxx index 0a38cd6a5..ed30f5529 100644 --- a/src/Style.cxx +++ b/src/Style.cxx @@ -64,8 +64,8 @@ Style::Style(const Style &source) : FontSpecification(), FontMeasurements() {  	Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),  	      0, 0, 0,  	      SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); -	fore.desired = source.fore.desired; -	back.desired = source.back.desired; +	fore = source.fore; +	back = source.back;  	characterSet = source.characterSet;  	weight = source.weight;  	italic = source.italic; @@ -87,8 +87,8 @@ Style &Style::operator=(const Style &source) {  	Clear(ColourDesired(0, 0, 0), ColourDesired(0xff, 0xff, 0xff),  	      0, 0, SC_CHARSET_DEFAULT,  	      SC_WEIGHT_NORMAL, false, false, false, caseMixed, true, true, false); -	fore.desired = source.fore.desired; -	back.desired = source.back.desired; +	fore = source.fore; +	back = source.back;  	characterSet = source.characterSet;  	weight = source.weight;  	italic = source.italic; @@ -106,8 +106,8 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,          int weight_, bool italic_, bool eolFilled_,          bool underline_, ecaseForced caseForce_,          bool visible_, bool changeable_, bool hotspot_) { -	fore.desired = fore_; -	back.desired = back_; +	fore = fore_; +	back = back_;  	characterSet = characterSet_;  	weight = weight_;  	italic = italic_; @@ -125,8 +125,8 @@ void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,  void Style::ClearTo(const Style &source) {  	Clear( -	    source.fore.desired, -	    source.back.desired, +	    source.fore, +	    source.back,  	    source.size,  	    source.fontName,  	    source.characterSet, diff --git a/src/Style.h b/src/Style.h index 0e706d322..ab433107d 100644 --- a/src/Style.h +++ b/src/Style.h @@ -58,8 +58,8 @@ struct FontMeasurements {   */  class Style : public FontSpecification, public FontMeasurements {  public: -	ColourPair fore; -	ColourPair back; +	ColourDesired fore; +	ColourDesired back;  	bool eolFilled;  	bool underline;  	enum ecaseForced {caseMixed, caseUpper, caseLower}; diff --git a/src/ViewStyle.cxx b/src/ViewStyle.cxx index 08164f648..ab3c68907 100644 --- a/src/ViewStyle.cxx +++ b/src/ViewStyle.cxx @@ -150,40 +150,40 @@ ViewStyle::ViewStyle(const ViewStyle &source) {  	}  	selforeset = source.selforeset; -	selforeground.desired = source.selforeground.desired; -	selAdditionalForeground.desired = source.selAdditionalForeground.desired; +	selforeground = source.selforeground; +	selAdditionalForeground = source.selAdditionalForeground;  	selbackset = source.selbackset; -	selbackground.desired = source.selbackground.desired; -	selAdditionalBackground.desired = source.selAdditionalBackground.desired; -	selbackground2.desired = source.selbackground2.desired; +	selbackground = source.selbackground; +	selAdditionalBackground = source.selAdditionalBackground; +	selbackground2 = source.selbackground2;  	selAlpha = source.selAlpha;  	selAdditionalAlpha = source.selAdditionalAlpha;  	selEOLFilled = source.selEOLFilled;  	foldmarginColourSet = source.foldmarginColourSet; -	foldmarginColour.desired = source.foldmarginColour.desired; +	foldmarginColour = source.foldmarginColour;  	foldmarginHighlightColourSet = source.foldmarginHighlightColourSet; -	foldmarginHighlightColour.desired = source.foldmarginHighlightColour.desired; +	foldmarginHighlightColour = source.foldmarginHighlightColour;  	hotspotForegroundSet = source.hotspotForegroundSet; -	hotspotForeground.desired = source.hotspotForeground.desired; +	hotspotForeground = source.hotspotForeground;  	hotspotBackgroundSet = source.hotspotBackgroundSet; -	hotspotBackground.desired = source.hotspotBackground.desired; +	hotspotBackground = source.hotspotBackground;  	hotspotUnderline = source.hotspotUnderline;  	hotspotSingleLine = source.hotspotSingleLine;  	whitespaceForegroundSet = source.whitespaceForegroundSet; -	whitespaceForeground.desired = source.whitespaceForeground.desired; +	whitespaceForeground = source.whitespaceForeground;  	whitespaceBackgroundSet = source.whitespaceBackgroundSet; -	whitespaceBackground.desired = source.whitespaceBackground.desired; -	selbar.desired = source.selbar.desired; -	selbarlight.desired = source.selbarlight.desired; -	caretcolour.desired = source.caretcolour.desired; -	additionalCaretColour.desired = source.additionalCaretColour.desired; +	whitespaceBackground = source.whitespaceBackground; +	selbar = source.selbar; +	selbarlight = source.selbarlight; +	caretcolour = source.caretcolour; +	additionalCaretColour = source.additionalCaretColour;  	showCaretLineBackground = source.showCaretLineBackground; -	caretLineBackground.desired = source.caretLineBackground.desired; +	caretLineBackground = source.caretLineBackground;  	caretLineAlpha = source.caretLineAlpha; -	edgecolour.desired = source.edgecolour.desired; +	edgecolour = source.edgecolour;  	edgeState = source.edgeState;  	caretStyle = source.caretStyle;  	caretWidth = source.caretWidth; @@ -248,35 +248,35 @@ void ViewStyle::Init(size_t stylesSize_) {  	spaceWidth = 8;  	selforeset = false; -	selforeground.desired = ColourDesired(0xff, 0, 0); -	selAdditionalForeground.desired = ColourDesired(0xff, 0, 0); +	selforeground = ColourDesired(0xff, 0, 0); +	selAdditionalForeground = ColourDesired(0xff, 0, 0);  	selbackset = true; -	selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0); -	selAdditionalBackground.desired = ColourDesired(0xd7, 0xd7, 0xd7); -	selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0); +	selbackground = ColourDesired(0xc0, 0xc0, 0xc0); +	selAdditionalBackground = ColourDesired(0xd7, 0xd7, 0xd7); +	selbackground2 = ColourDesired(0xb0, 0xb0, 0xb0);  	selAlpha = SC_ALPHA_NOALPHA;  	selAdditionalAlpha = SC_ALPHA_NOALPHA;  	selEOLFilled = false;  	foldmarginColourSet = false; -	foldmarginColour.desired = ColourDesired(0xff, 0, 0); +	foldmarginColour = ColourDesired(0xff, 0, 0);  	foldmarginHighlightColourSet = false; -	foldmarginHighlightColour.desired = ColourDesired(0xc0, 0xc0, 0xc0); +	foldmarginHighlightColour = ColourDesired(0xc0, 0xc0, 0xc0);  	whitespaceForegroundSet = false; -	whitespaceForeground.desired = ColourDesired(0, 0, 0); +	whitespaceForeground = 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); -	styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); -	caretcolour.desired = ColourDesired(0, 0, 0); -	additionalCaretColour.desired = ColourDesired(0x7f, 0x7f, 0x7f); +	whitespaceBackground = ColourDesired(0xff, 0xff, 0xff); +	selbar = Platform::Chrome(); +	selbarlight = Platform::ChromeHighlight(); +	styles[STYLE_LINENUMBER].fore = ColourDesired(0, 0, 0); +	styles[STYLE_LINENUMBER].back = Platform::Chrome(); +	caretcolour = ColourDesired(0, 0, 0); +	additionalCaretColour = ColourDesired(0x7f, 0x7f, 0x7f);  	showCaretLineBackground = false; -	caretLineBackground.desired = ColourDesired(0xff, 0xff, 0); +	caretLineBackground = ColourDesired(0xff, 0xff, 0);  	caretLineAlpha = SC_ALPHA_NOALPHA; -	edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0); +	edgecolour = ColourDesired(0xc0, 0xc0, 0xc0);  	edgeState = EDGE_NONE;  	caretStyle = CARETSTYLE_LINE;  	caretWidth = 1; @@ -284,9 +284,9 @@ void ViewStyle::Init(size_t stylesSize_) {  	someStylesForceCase = false;  	hotspotForegroundSet = false; -	hotspotForeground.desired = ColourDesired(0, 0, 0xff); +	hotspotForeground = ColourDesired(0, 0, 0xff);  	hotspotBackgroundSet = false; -	hotspotBackground.desired = ColourDesired(0xff, 0xff, 0xff); +	hotspotBackground = ColourDesired(0xff, 0xff, 0xff);  	hotspotUnderline = true;  	hotspotSingleLine = true; @@ -328,39 +328,6 @@ void ViewStyle::Init(size_t stylesSize_) {  	braceBadLightIndicator = 0;  } -void ViewStyle::RefreshColourPalette(Palette &pal, bool want) { -	unsigned int i; -	for (i=0; i<stylesSize; i++) { -		pal.WantFind(styles[i].fore, want); -		pal.WantFind(styles[i].back, want); -	} -	for (i=0; i<(sizeof(indicators)/sizeof(indicators[0])); i++) { -		pal.WantFind(indicators[i].fore, want); -	} -	for (i=0; i<(sizeof(markers)/sizeof(markers[0])); i++) { -		markers[i].RefreshColourPalette(pal, want); -	} -	pal.WantFind(selforeground, want); -	pal.WantFind(selAdditionalForeground, want); -	pal.WantFind(selbackground, want); -	pal.WantFind(selAdditionalBackground, want); -	pal.WantFind(selbackground2, want); - -	pal.WantFind(foldmarginColour, want); -	pal.WantFind(foldmarginHighlightColour, want); - -	pal.WantFind(whitespaceForeground, want); -	pal.WantFind(whitespaceBackground, want); -	pal.WantFind(selbar, want); -	pal.WantFind(selbarlight, want); -	pal.WantFind(caretcolour, want); -	pal.WantFind(additionalCaretColour, want); -	pal.WantFind(caretLineBackground, want); -	pal.WantFind(edgecolour, want); -	pal.WantFind(hotspotForeground, want); -	pal.WantFind(hotspotBackground, want); -} -  void ViewStyle::CreateFont(const FontSpecification &fs) {  	if (fs.fontName) {  		for (FontRealised *cur=frFirst; cur; cur=cur->frNext) { @@ -378,8 +345,8 @@ void ViewStyle::CreateFont(const FontSpecification &fs) {  void ViewStyle::Refresh(Surface &surface) {  	delete frFirst;  	frFirst = NULL; -	selbar.desired = Platform::Chrome(); -	selbarlight.desired = Platform::ChromeHighlight(); +	selbar = Platform::Chrome(); +	selbarlight = Platform::ChromeHighlight();  	for (unsigned int i=0; i<stylesSize; i++) {  		styles[i].extraFontFlag = extraFontFlag; @@ -471,11 +438,11 @@ void ViewStyle::ClearStyles() {  			styles[i].ClearTo(styles[STYLE_DEFAULT]);  		}  	} -	styles[STYLE_LINENUMBER].back.desired = Platform::Chrome(); +	styles[STYLE_LINENUMBER].back = Platform::Chrome();  	// Set call tip fore/back to match the values previously set for call tips -	styles[STYLE_CALLTIP].back.desired = ColourDesired(0xff, 0xff, 0xff); -	styles[STYLE_CALLTIP].fore.desired = ColourDesired(0x80, 0x80, 0x80); +	styles[STYLE_CALLTIP].back = ColourDesired(0xff, 0xff, 0xff); +	styles[STYLE_CALLTIP].fore = ColourDesired(0x80, 0x80, 0x80);  }  void ViewStyle::SetStyleFontName(int styleIndex, const char *name) { diff --git a/src/ViewStyle.h b/src/ViewStyle.h index b15b9163c..39cd77339 100644 --- a/src/ViewStyle.h +++ b/src/ViewStyle.h @@ -74,29 +74,29 @@ public:  	unsigned int aveCharWidth;  	unsigned int spaceWidth;  	bool selforeset; -	ColourPair selforeground; -	ColourPair selAdditionalForeground; +	ColourDesired selforeground; +	ColourDesired selAdditionalForeground;  	bool selbackset; -	ColourPair selbackground; -	ColourPair selAdditionalBackground; -	ColourPair selbackground2; +	ColourDesired selbackground; +	ColourDesired selAdditionalBackground; +	ColourDesired selbackground2;  	int selAlpha;  	int selAdditionalAlpha;  	bool selEOLFilled;  	bool whitespaceForegroundSet; -	ColourPair whitespaceForeground; +	ColourDesired whitespaceForeground;  	bool whitespaceBackgroundSet; -	ColourPair whitespaceBackground; -	ColourPair selbar; -	ColourPair selbarlight; +	ColourDesired whitespaceBackground; +	ColourDesired selbar; +	ColourDesired selbarlight;  	bool foldmarginColourSet; -	ColourPair foldmarginColour; +	ColourDesired foldmarginColour;  	bool foldmarginHighlightColourSet; -	ColourPair foldmarginHighlightColour; +	ColourDesired foldmarginHighlightColour;  	bool hotspotForegroundSet; -	ColourPair hotspotForeground; +	ColourDesired hotspotForeground;  	bool hotspotBackgroundSet; -	ColourPair hotspotBackground; +	ColourDesired hotspotBackground;  	bool hotspotUnderline;  	bool hotspotSingleLine;  	/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin @@ -113,12 +113,12 @@ public:  	IndentView viewIndentationGuides;  	bool viewEOL;  	bool showMarkedLines; -	ColourPair caretcolour; -	ColourPair additionalCaretColour; +	ColourDesired caretcolour; +	ColourDesired additionalCaretColour;  	bool showCaretLineBackground; -	ColourPair caretLineBackground; +	ColourDesired caretLineBackground;  	int caretLineAlpha; -	ColourPair edgecolour; +	ColourDesired edgecolour;  	int edgeState;  	int caretStyle;  	int caretWidth; @@ -140,7 +140,6 @@ public:  	~ViewStyle();  	void Init(size_t stylesSize_=64);  	void CreateFont(const FontSpecification &fs); -	void RefreshColourPalette(Palette &pal, bool want);  	void Refresh(Surface &surface);  	void AllocStyles(size_t sizeNew);  	void EnsureStyle(size_t index); diff --git a/src/XPM.cxx b/src/XPM.cxx index f0277c65f..cdaa69535 100644 --- a/src/XPM.cxx +++ b/src/XPM.cxx @@ -46,11 +46,11 @@ static size_t MeasureLength(const char *s) {  }  ColourDesired XPM::ColourDesiredFromCode(int ch) const { -	return colourCodeTable[ch]->desired; +	return *colourCodeTable[ch];  } -ColourAllocated XPM::ColourFromCode(int ch) const { -	return colourCodeTable[ch]->allocated; +ColourDesired XPM::ColourFromCode(int ch) const { +	return *colourCodeTable[ch];  #ifdef SLOW  	for (int i=0; i<nColours; i++) {  		if (codes[i] == ch) { @@ -124,7 +124,7 @@ void XPM::Init(const char *const *linesForm) {  		return;  	}  	codes = new char[nColours]; -	colours = new ColourPair[nColours]; +	colours = new ColourDesired[nColours];  	int strings = 1+height+nColours;  	lines = new char *[strings]; @@ -151,9 +151,9 @@ void XPM::Init(const char *const *linesForm) {  		codes[c] = colourDef[0];  		colourDef += 4;  		if (*colourDef == '#') { -			colours[c].desired.Set(colourDef); +			colours[c].Set(colourDef);  		} else { -			colours[c].desired = ColourDesired(0xff, 0xff, 0xff); +			colours[c] = ColourDesired(0xff, 0xff, 0xff);  			codeTransparent = codes[c];  		}  		colourCodeTable[static_cast<unsigned char>(codes[c])] = &(colours[c]); @@ -171,24 +171,6 @@ void XPM::Clear() {  	lines = 0;  } -void XPM::RefreshColourPalette(Palette &pal, bool want) { -	if (!data || !codes || !colours || !lines) { -		return; -	} -	for (int i=0; i<nColours; i++) { -		pal.WantFind(colours[i], want); -	} -} - -void XPM::CopyDesiredColours() { -	if (!data || !codes || !colours || !lines) { -		return; -	} -	for (int i=0; i<nColours; i++) { -		colours[i].Copy(); -	} -} -  void XPM::Draw(Surface *surface, PRectangle &rc) {  	if (!data || !codes || !colours || !lines) {  		return; @@ -296,7 +278,6 @@ void XPMSet::Add(int ident, const char *textForm) {  	for (int i = 0; i < len; i++) {  		if (set[i]->GetId() == ident) {  			set[i]->Init(textForm); -			set[i]->CopyDesiredColours();  			return;  		}  	} @@ -305,7 +286,6 @@ void XPMSet::Add(int ident, const char *textForm) {  	XPM *pxpm = new XPM(textForm);  	if (pxpm) {  		pxpm->SetId(ident); -		pxpm->CopyDesiredColours();  		if (len == maximum) {  			maximum += 64;  			XPM **setNew = new XPM *[maximum]; @@ -23,12 +23,12 @@ class XPM {  	char *data;  	char codeTransparent;  	char *codes; -	ColourPair *colours; +	ColourDesired *colours;  	ColourDesired ColourDesiredFromCode(int ch) const; -	ColourAllocated ColourFromCode(int ch) const; +	ColourDesired ColourFromCode(int ch) const;  	void FillRun(Surface *surface, int code, int startX, int y, int x);  	char **lines; -	ColourPair *colourCodeTable[256]; +	ColourDesired *colourCodeTable[256];  public:  	XPM(const char *textForm);  	XPM(const char *const *linesForm); @@ -36,10 +36,6 @@ public:  	void Init(const char *textForm);  	void Init(const char *const *linesForm);  	void Clear(); -	/// Similar to same named method in ViewStyle: -	void RefreshColourPalette(Palette &pal, bool want); -	/// No palette used, so just copy the desired colours to the allocated colours -	void CopyDesiredColours();  	/// Decompose image into runs and use FillRectangle for each run  	void Draw(Surface *surface, PRectangle &rc);  	char **InLinesForm() { return lines; }  | 
