diff options
-rw-r--r-- | cocoa/PlatCocoa.h | 31 | ||||
-rw-r--r-- | cocoa/PlatCocoa.mm | 77 | ||||
-rw-r--r-- | doc/ScintillaDoc.html | 34 | ||||
-rw-r--r-- | gtk/PlatGTK.cxx | 155 | ||||
-rw-r--r-- | include/Platform.h | 109 | ||||
-rw-r--r-- | include/Scintilla.h | 4 | ||||
-rw-r--r-- | include/Scintilla.iface | 16 | ||||
-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 | ||||
-rw-r--r-- | win32/PlatWin.cxx | 221 | ||||
-rw-r--r-- | win32/ScintillaWin.cxx | 33 |
25 files changed, 436 insertions, 949 deletions
diff --git a/cocoa/PlatCocoa.h b/cocoa/PlatCocoa.h index 7f6a59705..58017706d 100644 --- a/cocoa/PlatCocoa.h +++ b/cocoa/PlatCocoa.h @@ -57,8 +57,8 @@ private: int bitmapWidth; int bitmapHeight; - /** Set the CGContext's fill colour to the specified allocated colour. */ - void FillColour( const ColourAllocated& back ); + /** Set the CGContext's fill colour to the specified desired colour. */ + void FillColour( const ColourDesired& back ); // 24-bit RGB+A bitmap data constants @@ -76,7 +76,7 @@ public: void Release(); bool Initialised(); - void PenColour(ColourAllocated fore); + void PenColour(ColourDesired fore); /** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */ CGImageRef GetImage(); @@ -86,21 +86,21 @@ public: int DeviceHeightFont(int points); void MoveTo(int x_, int y_); void LineTo(int x_, int y_); - void Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore, ColourAllocated back); - void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void FillRectangle(PRectangle rc, ColourAllocated back); + void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back); + void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); + void FillRectangle(PRectangle rc, ColourDesired back); void FillRectangle(PRectangle rc, Surface &surfacePattern); - void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags); + void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); + void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags); void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); - void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back); + void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource); - void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, - ColourAllocated back); - void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, - ColourAllocated back); - void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore); + void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, + ColourDesired back); + void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, + ColourDesired back); + void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions); XYPOSITION WidthText(Font &font_, const char *s, int len); XYPOSITION WidthChar(Font &font_, char ch); @@ -111,7 +111,6 @@ public: XYPOSITION Height(Font &font_); XYPOSITION AverageCharWidth(Font &font_); - int SetPalette(Scintilla::Palette *pal, bool inBackGround); void SetClip(PRectangle rc); void FlushCachedState(); diff --git a/cocoa/PlatCocoa.mm b/cocoa/PlatCocoa.mm index ce112f853..8a5eff5a1 100644 --- a/cocoa/PlatCocoa.mm +++ b/cocoa/PlatCocoa.mm @@ -92,48 +92,6 @@ Scintilla::Point Scintilla::Point::FromLong(long lpoint) ); } -//----------------- Palette ------------------------------------------------------------------------ - -// The Palette implementation is only here because we would get linker errors if not. -// We don't use indexed colors in ScintillaCocoa. - -Scintilla::Palette::Palette() -{ -} - -//-------------------------------------------------------------------------------------------------- - -Scintilla::Palette::~Palette() -{ -} - -//-------------------------------------------------------------------------------------------------- - -void Scintilla::Palette::Release() -{ -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Used to transform a given color, if needed. If the caller tries to find a color that matches the - * desired color then we simply pass it on, as we support the full color space. - */ -void Scintilla::Palette::WantFind(ColourPair &cp, bool want) -{ - if (!want) - cp.allocated.Set(cp.desired.AsLong()); - - // Don't do anything if the caller wants the color it has already set. -} - -//-------------------------------------------------------------------------------------------------- - -void Scintilla::Palette::Allocate(Window&) -{ - // Nothing to allocate as we don't use palettes. -} - //----------------- Font --------------------------------------------------------------------------- Font::Font(): fid(0) @@ -313,7 +271,7 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface* /* surface_ */, Win //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::PenColour(ColourAllocated fore) +void SurfaceImpl::PenColour(ColourDesired fore) { if (gc) { @@ -327,7 +285,7 @@ void SurfaceImpl::PenColour(ColourAllocated fore) //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::FillColour(const ColourAllocated& back) +void SurfaceImpl::FillColour(const ColourDesired& back) { if (gc) { @@ -450,8 +408,8 @@ void SurfaceImpl::LineTo(int x_, int y_) //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore, - ColourAllocated back) +void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, + ColourDesired back) { // Allocate memory for the array of points. CGPoint *points = new CGPoint[npts]; @@ -483,7 +441,7 @@ void SurfaceImpl::Polygon(Scintilla::Point *pts, int npts, ColourAllocated fore, //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) +void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) { if (gc) { @@ -501,7 +459,7 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAlloc //-------------------------------------------------------------------------------------------------- -void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back) +void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) { if (gc) { @@ -531,7 +489,7 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) CGImageRef image = patternSurface.GetImage(); if (image == NULL) { - FillRectangle(rc, ColourAllocated(0)); + FillRectangle(rc, ColourDesired(0)); return; } @@ -573,7 +531,7 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) } /* pattern != NULL */ } -void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) { // This is only called from the margin marker drawing code for SC_MARK_ROUNDRECT // The Win32 version does // ::RoundRect(hdc, rc.left + 1, rc.top, rc.right - 1, rc.bottom, 8, 8 ); @@ -638,8 +596,8 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl CGContextDrawPath( gc, kCGPathFillStroke ); } -void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, ColourAllocated fill, int alphaFill, - ColourAllocated /*outline*/, int /*alphaOutline*/, int /*flags*/) +void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, ColourDesired fill, int alphaFill, + ColourDesired /*outline*/, int /*alphaOutline*/, int /*flags*/) { if ( gc ) { ColourDesired colour( fill.AsLong() ); @@ -721,7 +679,7 @@ void SurfaceImpl::DrawRGBAImage(PRectangle /* rc */, int width, int height, cons } } -void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) { // Drawing an ellipse with bezier curves. Code modified from: // http://www.codeguru.com/gdi/ellipse.shtml // MAGICAL CONSTANT to map ellipse to beziers 2/3*(sqrt(2)-1) @@ -818,7 +776,7 @@ void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSou // If we could not get an image reference, fill the rectangle black if ( image == NULL ) { - FillRectangle( rc, ColourAllocated( 0 ) ); + FillRectangle( rc, ColourDesired( 0 ) ); return; } @@ -842,7 +800,7 @@ void SurfaceImpl::Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSou //-------------------------------------------------------------------------------------------------- void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) + ColourDesired fore, ColourDesired back) { FillRectangle(rc, back); DrawTextTransparent(rc, font_, ybase, s, len, fore); @@ -851,7 +809,7 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, c //-------------------------------------------------------------------------------------------------- void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) + ColourDesired fore, ColourDesired back) { CGContextSaveGState(gc); CGContextClipToRect(gc, PRectangleToCGRect(rc)); @@ -919,7 +877,7 @@ CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet) } void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore) + ColourDesired fore) { CFStringEncoding encoding = EncodingFromCharacterSet(unicodeMode, FontCharacterSet(font_)); ColourDesired colour(fore.AsLong()); @@ -1072,11 +1030,6 @@ XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) { return (int) ((width / (float) sizeStringLength) + 0.5); } -int SurfaceImpl::SetPalette(Scintilla::Palette *, bool) { - // Mac OS X is always true colour (I think) so this doesn't matter - return 0; -} - void SurfaceImpl::SetClip(PRectangle rc) { CGContextClipToRect( gc, PRectangleToCGRect( rc ) ); } diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index d917913aa..f78a0a74a 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -3023,25 +3023,6 @@ struct Sci_TextToFind { <a class="message" href="#SCI_GETFOCUS">SCI_GETFOCUS</a><br /> </code> - <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool allowPaletteUse)</b><br /> - <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b><br /> - On 8 bit displays, which can only display a maximum of 256 colours, the graphics environment - mediates between the colour needs of applications through the use of palettes. On GTK+, - Scintilla always uses a palette.</p> - - <p>On Windows, there are some problems with visual flashing when switching between applications - with palettes and it is also necessary for the application containing the Scintilla control to - forward some messages to Scintilla for its palette code to work. Because of this, by default, - the palette is not used and the application must tell Scintilla to use one. If Scintilla is not - using a palette, it will only display in those colours already available, which are often the - 20 Windows system colours.</p> - - <p>To see an example of how to enable palette support in Scintilla, search the text of SciTE - for <code>WM_PALETTECHANGED</code>, <code>WM_QUERYNEWPALETTE</code> and - <code>SCI_SETUSEPALETTE</code>. The Windows messages to forward are:<br /> - <code>WM_SYSCOLORCHANGE</code>, <code>WM_PALETTECHANGED</code>, - <code>WM_QUERYNEWPALETTE</code> (should return <code>TRUE</code>).</p> - <p>To forward a message <code>(WM_XXXX, WPARAM, LPARAM)</code> to Scintilla, you can use <code>SendMessage(hScintilla, WM_XXXX, WPARAM, LPARAM)</code> where <code>hScintilla</code> is the handle to the Scintilla window you created as your editor.</p> @@ -6806,15 +6787,14 @@ EM_FORMATRANGE <code>INCLUDE_DEPRECATED_FEATURES</code> in <code>Scintilla.h</code>. To ensure future compatibility you should change them as indicated.</p> - <p><b id="SCN_POSCHANGED">SCN_POSCHANGED()</b> Deprecated<br /> - Fired when the user moves the cursor to a different position in the text. Use <a - class="message" href="#SCN_UPDATEUI"><code>SCN_UPDATEUI</code></a> instead.</p> + <p><b id="SC_CP_DBCS">SC_CP_DBCS</b> Deprecated<br /> + This was used to set a DBCS (Double Byte Character Set) mode on GTK+. + An explicit DBCS code page should be used when calling <a class="message" href="#SCI_SETCODEPAGE">SCI_SETCODEPAGE</a></p> - <p><b id="SCN_CHECKBRACE">SCN_CHECKBRACE</b> Deprecated<br /> - Either the text or styling of the document has changed or the selection range has changed. - This is replaced by <a class="message" href="#SCN_UPDATEUI"><code>SCN_UPDATEUI</code></a>. You - can also use <code><a class="message" href="#SCN_MODIFIED">SCN_MODIFIED</a></code> for more - detailed information on text and styling changes,</p> + <p><b id="SCI_SETUSEPALETTE">SCI_SETUSEPALETTE(bool allowPaletteUse)</b> Deprecated<br /> + <b id="SCI_GETUSEPALETTE">SCI_GETUSEPALETTE</b> Deprecated<br /> + Scintilla no longer supports palette mode. The last version to support palettes was 2.29. + Any calls to these methods should be removed.</p> <h2 id="EditMessagesNeverSupportedByScintilla">Edit messages never supported by Scintilla</h2> <pre> diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 1e36989ad..9431a48e3 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -189,109 +189,12 @@ static GtkWidget *PWidget(WindowID wid) { return reinterpret_cast<GtkWidget *>(wid); } -#if !GTK_CHECK_VERSION(3,0,0) -static GtkWidget *PWidget(Window &w) { - return PWidget(w.GetID()); -} -#endif - Point Point::FromLong(long lpoint) { return Point( Platform::LowShortFromLong(lpoint), Platform::HighShortFromLong(lpoint)); } -Palette::Palette() { - used = 0; - allowRealization = false; - allocatedPalette = 0; - allocatedLen = 0; - size = 100; - entries = new ColourPair[size]; -} - -Palette::~Palette() { - Release(); - delete []entries; - entries = 0; -} - -void Palette::Release() { - used = 0; - delete [](reinterpret_cast<GdkColor *>(allocatedPalette)); - allocatedPalette = 0; - allocatedLen = 0; - delete []entries; - size = 100; - entries = new ColourPair[size]; -} - -// This method either adds a colour to the list of wanted colours (want==true) -// or retrieves the allocated colour back to the ColourPair. -// This is one method to make it easier to keep the code for wanting and retrieving in sync. -void Palette::WantFind(ColourPair &cp, bool want) { - if (want) { - for (int i=0; i < used; i++) { - if (entries[i].desired == cp.desired) - return; - } - - if (used >= size) { - int sizeNew = size * 2; - ColourPair *entriesNew = new ColourPair[sizeNew]; - for (int j=0; j<size; j++) { - entriesNew[j] = entries[j]; - } - delete []entries; - entries = entriesNew; - size = sizeNew; - } - - entries[used].desired = cp.desired; - entries[used].allocated.Set(cp.desired.AsLong()); - used++; - } else { - for (int i=0; i < used; i++) { - if (entries[i].desired == cp.desired) { - cp.allocated = entries[i].allocated; - return; - } - } - cp.allocated.Set(cp.desired.AsLong()); - } -} - -void Palette::Allocate(Window &w) { -#if !GTK_CHECK_VERSION(3,0,0) - // Disable palette on GTK+ 3. - if (allocatedPalette) { - gdk_colormap_free_colors(gtk_widget_get_colormap(PWidget(w)), - reinterpret_cast<GdkColor *>(allocatedPalette), - allocatedLen); - delete [](reinterpret_cast<GdkColor *>(allocatedPalette)); - allocatedPalette = 0; - allocatedLen = 0; - } - GdkColor *paletteNew = new GdkColor[used]; - allocatedPalette = paletteNew; - gboolean *successPalette = new gboolean[used]; - if (paletteNew) { - allocatedLen = used; - int iPal = 0; - for (iPal = 0; iPal < used; iPal++) { - paletteNew[iPal].red = entries[iPal].desired.GetRed() * (65535 / 255); - paletteNew[iPal].green = entries[iPal].desired.GetGreen() * (65535 / 255); - paletteNew[iPal].blue = entries[iPal].desired.GetBlue() * (65535 / 255); - paletteNew[iPal].pixel = entries[iPal].desired.AsLong(); - } - for (iPal = 0; iPal < used; iPal++) { - entries[iPal].allocated.Set(paletteNew[iPal].pixel); - } - } - delete []successPalette; -#endif -} - static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, float size, int weight, bool italic) { memset(&lf, 0, sizeof(lf)); lf.size = size; @@ -456,26 +359,26 @@ public: void Release(); bool Initialised(); - void PenColour(ColourAllocated fore); + void PenColour(ColourDesired fore); int LogPixelsY(); int DeviceHeightFont(int points); void MoveTo(int x_, int y_); void LineTo(int x_, int y_); - void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back); - void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void FillRectangle(PRectangle rc, ColourAllocated back); + void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back); + void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); + void FillRectangle(PRectangle rc, ColourDesired back); void FillRectangle(PRectangle rc, Surface &surfacePattern); - void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags); + void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); + void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags); void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); - void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back); + void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); void Copy(PRectangle rc, Point from, Surface &surfaceSource); - void DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore); - void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore); + void DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); + void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions); XYPOSITION WidthText(Font &font_, const char *s, int len); XYPOSITION WidthChar(Font &font_, char ch); @@ -486,7 +389,6 @@ public: XYPOSITION Height(Font &font_); XYPOSITION AverageCharWidth(Font &font_); - int SetPalette(Palette *pal, bool inBackGround); void SetClip(PRectangle rc); void FlushCachedState(); @@ -659,7 +561,7 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID inited = true; } -void SurfaceImpl::PenColour(ColourAllocated fore) { +void SurfaceImpl::PenColour(ColourDesired fore) { if (context) { ColourDesired cdFore(fore.AsLong()); cairo_set_source_rgb(context, @@ -725,8 +627,8 @@ void SurfaceImpl::LineTo(int x_, int y_) { y = y_; } -void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore, - ColourAllocated back) { +void SurfaceImpl::Polygon(Point *pts, int npts, ColourDesired fore, + ColourDesired back) { PenColour(back); cairo_move_to(context, pts[0].x + 0.5, pts[0].y + 0.5); for (int i = 1;i < npts;i++) { @@ -738,7 +640,7 @@ void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore, cairo_stroke(context); } -void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceImpl::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) { if (context) { cairo_rectangle(context, rc.left + 0.5, rc.top + 0.5, rc.right - rc.left - 1, rc.bottom - rc.top - 1); @@ -749,7 +651,7 @@ void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAlloc } } -void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back) { +void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) { PenColour(back); if (context && (rc.left < maxCoordinate)) { // Protect against out of range cairo_rectangle(context, rc.left, rc.top, @@ -778,11 +680,11 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) { } else { // Something is wrong so try to show anyway // Shows up black because colour not allocated - FillRectangle(rc, ColourAllocated(0)); + FillRectangle(rc, ColourDesired(0)); } } -void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) { if (((rc.right - rc.left) > 4) && ((rc.bottom - rc.top) > 4)) { // Approximate a round rect with some cut off corners Point pts[] = { @@ -817,8 +719,8 @@ static void PathRoundRectangle(cairo_t *context, double left, double top, double cairo_close_path(context); } -void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags) { +void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags) { if (context && rc.Width() > 0) { ColourDesired cdFill(fill.AsLong()); cairo_set_source_rgba(context, @@ -876,7 +778,7 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi cairo_surface_destroy(psurf); } -void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) { PenColour(back); cairo_arc(context, (rc.left + rc.right) / 2 + 0.5, (rc.top + rc.bottom) / 2 + 0.5, Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*M_PI); @@ -961,7 +863,7 @@ static size_t UTF8CharLength(const char *s) { } void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore) { + ColourDesired fore) { PenColour(fore); if (context) { XYPOSITION xText = rc.left; @@ -994,20 +896,20 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, con } void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { + ColourDesired fore, ColourDesired back) { FillRectangle(rc, back); DrawTextBase(rc, font_, ybase, s, len, fore); } // On GTK+, exactly same as DrawTextNoClip void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { + ColourDesired fore, ColourDesired back) { FillRectangle(rc, back); DrawTextBase(rc, font_, ybase, s, len, fore); } void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore) { + ColourDesired fore) { // Avoid drawing spaces in transparent mode for (int i=0;i<len;i++) { if (s[i] != ' ') { @@ -1249,11 +1151,6 @@ XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) { return WidthChar(font_, 'n'); } -int SurfaceImpl::SetPalette(Palette *, bool) { - // Handled in palette allocation for GTK so this does nothing - return 0; -} - void SurfaceImpl::SetClip(PRectangle rc) { cairo_rectangle(context, rc.left, rc.top, rc.right, rc.bottom); cairo_clip(context); diff --git a/include/Platform.h b/include/Platform.h index 499e78e5d..654c4870a 100644 --- a/include/Platform.h +++ b/include/Platform.h @@ -139,18 +139,6 @@ public: }; /** - * In some circumstances, including Win32 in paletted mode and GTK+, each colour - * must be allocated before use. The desired colours are held in the ColourDesired class, - * and after allocation the allocation entry is stored in the ColourAllocated class. In other - * circumstances, such as Win32 in true colour mode, the allocation process just copies - * the RGB values from the desired to the allocated class. - * As each desired colour requires allocation before it can be used, the ColourPair class - * holds both a ColourDesired and a ColourAllocated - * The Palette class is responsible for managing the palette of colours which contains a - * list of ColourPair objects and performs the allocation. - */ - -/** * Holds a desired RGB colour. */ class ColourDesired { @@ -215,80 +203,6 @@ public: }; /** - * Holds an allocated RGB colour which may be an approximation to the desired colour. - */ -class ColourAllocated { - long coAllocated; - -public: - - ColourAllocated(long lcol=0) { - coAllocated = lcol; - } - - void Set(long lcol) { - coAllocated = lcol; - } - - long AsLong() const { - return coAllocated; - } -}; - -/** - * Colour pairs hold a desired colour and an allocated colour. - */ -struct ColourPair { - ColourDesired desired; - ColourAllocated allocated; - - ColourPair(ColourDesired desired_=ColourDesired(0,0,0)) { - desired = desired_; - allocated.Set(desired.AsLong()); - } - void Copy() { - allocated.Set(desired.AsLong()); - } -}; - -class Window; // Forward declaration for Palette - -/** - * Colour palette management. - */ -class Palette { - int used; - int size; - ColourPair *entries; -#if PLAT_GTK - void *allocatedPalette; // GdkColor * - int allocatedLen; -#endif - // Private so Palette objects can not be copied - Palette(const Palette &); - Palette &operator=(const Palette &); -public: -#if PLAT_WIN - void *hpal; -#endif - bool allowRealization; - - Palette(); - ~Palette(); - - void Release(); - - /** - * This method either adds a colour to the list of wanted colours (want==true) - * or retrieves the allocated colour back to the ColourPair. - * This is one method to make it easier to keep the code for wanting and retrieving in sync. - */ - void WantFind(ColourPair &cp, bool want); - - void Allocate(Window &w); -}; - -/** * Font management. */ @@ -367,25 +281,25 @@ public: virtual void Release()=0; virtual bool Initialised()=0; - virtual void PenColour(ColourAllocated fore)=0; + virtual void PenColour(ColourDesired fore)=0; virtual int LogPixelsY()=0; virtual int DeviceHeightFont(int points)=0; virtual void MoveTo(int x_, int y_)=0; virtual void LineTo(int x_, int y_)=0; - virtual void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back)=0; - virtual void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; - virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0; + virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back)=0; + virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back)=0; + virtual void FillRectangle(PRectangle rc, ColourDesired back)=0; virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0; - virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; - virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags)=0; + virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back)=0; + virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags)=0; virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0; - virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; + virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)=0; virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; - virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; - virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; - virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore)=0; + virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; + virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0; + virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0; virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0; virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0; virtual XYPOSITION WidthChar(Font &font_, char ch)=0; @@ -396,7 +310,6 @@ public: virtual XYPOSITION Height(Font &font_)=0; virtual XYPOSITION AverageCharWidth(Font &font_)=0; - virtual int SetPalette(Palette *pal, bool inBackGround)=0; virtual void SetClip(PRectangle rc)=0; virtual void FlushCachedState()=0; diff --git a/include/Scintilla.h b/include/Scintilla.h index 9b99436ff..10f290822 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -92,7 +92,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETTABWIDTH 2121 #define SC_CP_UTF8 65001 #define SCI_SETCODEPAGE 2037 -#define SCI_SETUSEPALETTE 2039 #define MARKER_MAX 31 #define SC_MARK_CIRCLE 0 #define SC_MARK_ROUNDRECT 1 @@ -337,7 +336,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETLINEENDPOSITION 2136 #define SCI_GETCODEPAGE 2137 #define SCI_GETCARETFORE 2138 -#define SCI_GETUSEPALETTE 2139 #define SCI_GETREADONLY 2140 #define SCI_SETCURRENTPOS 2141 #define SCI_SETSELECTIONSTART 2142 @@ -1041,6 +1039,8 @@ struct SCNotification { #ifdef INCLUDE_DEPRECATED_FEATURES #define SC_CP_DBCS 1 +#define SCI_SETUSEPALETTE 2039 +#define SCI_GETUSEPALETTE 2139 #endif diff --git a/include/Scintilla.iface b/include/Scintilla.iface index aa0f030dd..e77675567 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -228,10 +228,6 @@ val SC_CP_UTF8=65001 # The SC_CP_UTF8 value can be used to enter Unicode mode. set void SetCodePage=2037(int codePage,) -# In palette mode, Scintilla uses the environment's palette calls to display -# more colours. This may lead to ugly displays. -set void SetUsePalette=2039(bool usePalette,) - enu MarkerSymbol=SC_MARK_ val MARKER_MAX=31 val SC_MARK_CIRCLE=0 @@ -801,9 +797,6 @@ get int GetCodePage=2137(,) # Get the foreground colour of the caret. get colour GetCaretFore=2138(,) -# In palette mode? -get bool GetUsePalette=2139(,) - # In read-only mode? get bool GetReadOnly=2140(,) @@ -4037,3 +4030,12 @@ cat Deprecated # Deprecated in 2.21 # The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+. val SC_CP_DBCS=1 + +# Deprecated in 2.30 + +# In palette mode? +get bool GetUsePalette=2139(,) + +# In palette mode, Scintilla uses the environment's palette calls to display +# more colours. This may lead to ugly displays. +set void SetUsePalette=2039(bool usePalette,) 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; } diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index a2654ff78..3d9b7e88f 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -115,95 +115,6 @@ static RECT RectFromPRectangle(PRectangle prc) { return rc; } -Palette::Palette() { - used = 0; - allowRealization = false; - hpal = 0; - size = 100; - entries = new ColourPair[size]; -} - -Palette::~Palette() { - Release(); - delete []entries; - entries = 0; -} - -void Palette::Release() { - used = 0; - if (hpal) - ::DeleteObject(hpal); - hpal = 0; - delete []entries; - size = 100; - entries = new ColourPair[size]; -} - -/** - * This method either adds a colour to the list of wanted colours (want==true) - * or retrieves the allocated colour back to the ColourPair. - * This is one method to make it easier to keep the code for wanting and retrieving in sync. - */ -void Palette::WantFind(ColourPair &cp, bool want) { - if (want) { - for (int i=0; i < used; i++) { - if (entries[i].desired == cp.desired) - return; - } - - if (used >= size) { - int sizeNew = size * 2; - ColourPair *entriesNew = new ColourPair[sizeNew]; - for (int j=0; j<size; j++) { - entriesNew[j] = entries[j]; - } - delete []entries; - entries = entriesNew; - size = sizeNew; - } - - entries[used].desired = cp.desired; - entries[used].allocated.Set(cp.desired.AsLong()); - used++; - } else { - for (int i=0; i < used; i++) { - if (entries[i].desired == cp.desired) { - cp.allocated = entries[i].allocated; - return; - } - } - cp.allocated.Set(cp.desired.AsLong()); - } -} - -void Palette::Allocate(Window &) { - if (hpal) - ::DeleteObject(hpal); - hpal = 0; - - if (allowRealization) { - char *pal = new char[sizeof(LOGPALETTE) + (used-1) * sizeof(PALETTEENTRY)]; - LOGPALETTE *logpal = reinterpret_cast<LOGPALETTE *>(pal); - logpal->palVersion = 0x300; - logpal->palNumEntries = static_cast<WORD>(used); - for (int iPal=0;iPal<used;iPal++) { - ColourDesired desired = entries[iPal].desired; - logpal->palPalEntry[iPal].peRed = static_cast<BYTE>(desired.GetRed()); - logpal->palPalEntry[iPal].peGreen = static_cast<BYTE>(desired.GetGreen()); - logpal->palPalEntry[iPal].peBlue = static_cast<BYTE>(desired.GetBlue()); - entries[iPal].allocated.Set( - PALETTERGB(desired.GetRed(), desired.GetGreen(), desired.GetBlue())); - // PC_NOCOLLAPSE means exact colours allocated even when in background this means other windows - // are less likely to get their colours and also flashes more when switching windows - logpal->palPalEntry[iPal].peFlags = PC_NOCOLLAPSE; - // 0 allows approximate colours when in background, yielding moe colours to other windows - //logpal->palPalEntry[iPal].peFlags = 0; - } - hpal = ::CreatePalette(logpal); - delete []pal; - } -} - #if defined(USE_D2D) IDWriteFactory *pIDWriteFactory = 0; ID2D1Factory *pD2DFactory = 0; @@ -570,7 +481,6 @@ class SurfaceGDI : public Surface { HFONT fontOld; HBITMAP bitmap; HBITMAP bitmapOld; - HPALETTE paletteOld; int maxWidthMeasure; int maxLenText; @@ -578,7 +488,7 @@ class SurfaceGDI : public Surface { // If 9x OS and current code page is same as ANSI code page. bool win9xACPSame; - void BrushColor(ColourAllocated back); + void BrushColor(ColourDesired back); void SetFont(Font &font_); // Private so SurfaceGDI objects can not be copied @@ -594,26 +504,26 @@ public: void Release(); bool Initialised(); - void PenColour(ColourAllocated fore); + void PenColour(ColourDesired fore); int LogPixelsY(); int DeviceHeightFont(int points); void MoveTo(int x_, int y_); void LineTo(int x_, int y_); - void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back); - void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void FillRectangle(PRectangle rc, ColourAllocated back); + void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back); + void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); + void FillRectangle(PRectangle rc, ColourDesired back); void FillRectangle(PRectangle rc, Surface &surfacePattern); - void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags); + void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); + void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags); void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); - void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back); + void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); void Copy(PRectangle rc, Point from, Surface &surfaceSource); void DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, UINT fuOptions); - void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore); + void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions); XYPOSITION WidthText(Font &font_, const char *s, int len); XYPOSITION WidthChar(Font &font_, char ch); @@ -624,7 +534,6 @@ public: XYPOSITION Height(Font &font_); XYPOSITION AverageCharWidth(Font &font_); - int SetPalette(Palette *pal, bool inBackGround); void SetClip(PRectangle rc); void FlushCachedState(); @@ -642,8 +551,7 @@ SurfaceGDI::SurfaceGDI() : pen(0), penOld(0), brush(0), brushOld(0), font(0), fontOld(0), - bitmap(0), bitmapOld(0), - paletteOld(0) { + bitmap(0), bitmapOld(0) { // Windows 9x has only a 16 bit coordinate system so break after 30000 pixels maxWidthMeasure = IsNT() ? INT_MAX : 30000; // There appears to be a 16 bit string length limit in GDI on NT and a limit of @@ -683,12 +591,6 @@ void SurfaceGDI::Release() { bitmapOld = 0; } bitmap = 0; - if (paletteOld) { - // Palettes are not deleted as they are owned by a Palette object - ::SelectPalette(reinterpret_cast<HDC>(hdc), - reinterpret_cast<HPALETTE>(paletteOld), TRUE); - paletteOld = 0; - } if (hdcOwned) { ::DeleteDC(reinterpret_cast<HDC>(hdc)); hdc = 0; @@ -722,7 +624,7 @@ void SurfaceGDI::InitPixMap(int width, int height, Surface *surface_, WindowID) ::SetTextAlign(reinterpret_cast<HDC>(hdc), TA_BASELINE); } -void SurfaceGDI::PenColour(ColourAllocated fore) { +void SurfaceGDI::PenColour(ColourDesired fore) { if (pen) { ::SelectObject(hdc, penOld); ::DeleteObject(pen); @@ -733,7 +635,7 @@ void SurfaceGDI::PenColour(ColourAllocated fore) { penOld = static_cast<HPEN>(::SelectObject(reinterpret_cast<HDC>(hdc), pen)); } -void SurfaceGDI::BrushColor(ColourAllocated back) { +void SurfaceGDI::BrushColor(ColourDesired back) { if (brush) { ::SelectObject(hdc, brushOld); ::DeleteObject(brush); @@ -741,7 +643,7 @@ void SurfaceGDI::BrushColor(ColourAllocated back) { brushOld = 0; } // Only ever want pure, non-dithered brushes - ColourAllocated colourNearest = ::GetNearestColor(hdc, back.AsLong()); + ColourDesired colourNearest = ::GetNearestColor(hdc, back.AsLong()); brush = ::CreateSolidBrush(colourNearest.AsLong()); brushOld = static_cast<HBRUSH>(::SelectObject(hdc, brush)); } @@ -775,19 +677,19 @@ void SurfaceGDI::LineTo(int x_, int y_) { ::LineTo(hdc, x_, y_); } -void SurfaceGDI::Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back) { +void SurfaceGDI::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) { PenColour(fore); BrushColor(back); ::Polygon(hdc, reinterpret_cast<POINT *>(pts), npts); } -void SurfaceGDI::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceGDI::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) { PenColour(fore); BrushColor(back); ::Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom); } -void SurfaceGDI::FillRectangle(PRectangle rc, ColourAllocated back) { +void SurfaceGDI::FillRectangle(PRectangle rc, ColourDesired back) { // Using ExtTextOut rather than a FillRect ensures that no dithering occurs. // There is no need to allocate a brush either. RECT rcw = RectFromPRectangle(rc); @@ -806,7 +708,7 @@ void SurfaceGDI::FillRectangle(PRectangle rc, Surface &surfacePattern) { ::DeleteObject(br); } -void SurfaceGDI::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceGDI::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) { PenColour(fore); BrushColor(back); ::RoundRect(hdc, @@ -842,8 +744,8 @@ static DWORD dwordFromBGRA(byte b, byte g, byte r, byte a) { return converter.val; } -void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int /* flags*/ ) { +void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int /* flags*/ ) { if (AlphaBlendFn && rc.Width() > 0) { HDC hMemDC = ::CreateCompatibleDC(reinterpret_cast<HDC>(hdc)); int width = rc.Width(); @@ -940,7 +842,7 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig } } -void SurfaceGDI::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceGDI::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) { PenColour(fore); BrushColor(back); ::Ellipse(hdc, rc.left, rc.top, rc.right, rc.bottom); @@ -999,21 +901,21 @@ void SurfaceGDI::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, co } void SurfaceGDI::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { + ColourDesired fore, ColourDesired back) { ::SetTextColor(hdc, fore.AsLong()); ::SetBkColor(hdc, back.AsLong()); DrawTextCommon(rc, font_, ybase, s, len, ETO_OPAQUE); } void SurfaceGDI::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { + ColourDesired fore, ColourDesired back) { ::SetTextColor(hdc, fore.AsLong()); ::SetBkColor(hdc, back.AsLong()); DrawTextCommon(rc, font_, ybase, s, len, ETO_OPAQUE | ETO_CLIPPED); } void SurfaceGDI::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore) { + ColourDesired fore) { // Avoid drawing spaces in transparent mode for (int i=0;i<len;i++) { if (s[i] != ' ') { @@ -1179,20 +1081,6 @@ XYPOSITION SurfaceGDI::AverageCharWidth(Font &font_) { return tm.tmAveCharWidth; } -int SurfaceGDI::SetPalette(Palette *pal, bool inBackGround) { - if (paletteOld) { - ::SelectPalette(hdc, paletteOld, TRUE); - } - paletteOld = 0; - int changes = 0; - if (pal->allowRealization) { - paletteOld = ::SelectPalette(hdc, - reinterpret_cast<HPALETTE>(pal->hpal), inBackGround); - changes = ::RealizePalette(hdc); - } - return changes; -} - void SurfaceGDI::SetClip(PRectangle rc) { ::IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); } @@ -1213,12 +1101,12 @@ void SurfaceGDI::SetDBCSMode(int codePage_) { win9xACPSame = !IsNT() && ((unsigned int)codePage == ::GetACP()); } +#if defined(USE_D2D) + #ifdef SCI_NAMESPACE namespace Scintilla { #endif -#if defined(USE_D2D) - class SurfaceD2D : public Surface { bool unicodeMode; int x, y; @@ -1258,27 +1146,27 @@ public: HRESULT FlushDrawing(); - void PenColour(ColourAllocated fore); - void D2DPenColour(ColourAllocated fore, int alpha=255); + void PenColour(ColourDesired fore); + void D2DPenColour(ColourDesired fore, int alpha=255); int LogPixelsY(); int DeviceHeightFont(int points); void MoveTo(int x_, int y_); void LineTo(int x_, int y_); - void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back); - void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void FillRectangle(PRectangle rc, ColourAllocated back); + void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back); + void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back); + void FillRectangle(PRectangle rc, ColourDesired back); void FillRectangle(PRectangle rc, Surface &surfacePattern); - void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back); - void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags); + void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back); + void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int flags); void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage); - void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back); + void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back); void Copy(PRectangle rc, Point from, Surface &surfaceSource); void DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, UINT fuOptions); - void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back); - void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourAllocated fore); + void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back); + void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore); void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions); XYPOSITION WidthText(Font &font_, const char *s, int len); XYPOSITION WidthChar(Font &font_, char ch); @@ -1289,7 +1177,6 @@ public: XYPOSITION Height(Font &font_); XYPOSITION AverageCharWidth(Font &font_); - int SetPalette(Palette *pal, bool inBackGround); void SetClip(PRectangle rc); void FlushCachedState(); @@ -1385,11 +1272,11 @@ void SurfaceD2D::InitPixMap(int width, int height, Surface *surface_, WindowID) } } -void SurfaceD2D::PenColour(ColourAllocated fore) { +void SurfaceD2D::PenColour(ColourDesired fore) { D2DPenColour(fore); } -void SurfaceD2D::D2DPenColour(ColourAllocated fore, int alpha) { +void SurfaceD2D::D2DPenColour(ColourDesired fore, int alpha) { if (pRenderTarget) { D2D_COLOR_F col; col.r = (fore.AsLong() & 0xff) / 255.0; @@ -1475,7 +1362,7 @@ void SurfaceD2D::LineTo(int x_, int y_) { } } -void SurfaceD2D::Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back) { +void SurfaceD2D::Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back) { if (pRenderTarget) { ID2D1Factory *pFactory = 0; pRenderTarget->GetFactory(&pFactory); @@ -1504,7 +1391,7 @@ void SurfaceD2D::Polygon(Point *pts, int npts, ColourAllocated fore, ColourAlloc } } -void SurfaceD2D::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceD2D::RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) { if (pRenderTarget) { D2DPenColour(back); D2D1_RECT_F rectangle1 = D2D1::RectF(RoundFloat(rc.left) + 0.5, rc.top+0.5, RoundFloat(rc.right) - 0.5, rc.bottom-0.5); @@ -1515,7 +1402,7 @@ void SurfaceD2D::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAlloca } } -void SurfaceD2D::FillRectangle(PRectangle rc, ColourAllocated back) { +void SurfaceD2D::FillRectangle(PRectangle rc, ColourDesired back) { if (pRenderTarget) { D2DPenColour(back); D2D1_RECT_F rectangle1 = D2D1::RectF(RoundFloat(rc.left), rc.top, RoundFloat(rc.right), rc.bottom); @@ -1547,7 +1434,7 @@ void SurfaceD2D::FillRectangle(PRectangle rc, Surface &surfacePattern) { } } -void SurfaceD2D::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceD2D::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) { if (pRenderTarget) { D2D1_ROUNDED_RECT roundedRectFill = D2D1::RoundedRect( D2D1::RectF(rc.left+1.0, rc.top+1.0, rc.right-1.0, rc.bottom-1.0), @@ -1563,8 +1450,8 @@ void SurfaceD2D::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAll } } -void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int /* flags*/ ) { +void SurfaceD2D::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill, + ColourDesired outline, int alphaOutline, int /* flags*/ ) { if (pRenderTarget) { D2D1_ROUNDED_RECT roundedRectFill = D2D1::RoundedRect( D2D1::RectF(rc.left+1.0, rc.top+1.0, rc.right-1.0, rc.bottom-1.0), @@ -1616,7 +1503,7 @@ void SurfaceD2D::DrawRGBAImage(PRectangle rc, int width, int height, const unsig } } -void SurfaceD2D::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) { +void SurfaceD2D::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) { if (pRenderTarget) { FLOAT radius = rc.Width() / 2.0f - 1.0f; D2D1_ELLIPSE ellipse = D2D1::Ellipse( @@ -1674,7 +1561,7 @@ void SurfaceD2D::DrawTextCommon(PRectangle rc, Font &font_, XYPOSITION ybase, co } void SurfaceD2D::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { + ColourDesired fore, ColourDesired back) { if (pRenderTarget) { FillRectangle(rc, back); D2DPenColour(fore); @@ -1683,7 +1570,7 @@ void SurfaceD2D::DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, co } void SurfaceD2D::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore, ColourAllocated back) { + ColourDesired fore, ColourDesired back) { if (pRenderTarget) { FillRectangle(rc, back); D2DPenColour(fore); @@ -1692,7 +1579,7 @@ void SurfaceD2D::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, c } void SurfaceD2D::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, - ColourAllocated fore) { + ColourDesired fore) { // Avoid drawing spaces in transparent mode for (int i=0;i<len;i++) { if (s[i] != ' ') { @@ -1866,10 +1753,6 @@ XYPOSITION SurfaceD2D::AverageCharWidth(Font &font_) { return int(width + 0.5); } -int SurfaceD2D::SetPalette(Palette *, bool) { - return 0; -} - void SurfaceD2D::SetClip(PRectangle rc) { if (pRenderTarget) { D2D1_RECT_F rcClip = {rc.left, rc.top, rc.right, rc.bottom}; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 75993b8ed..4456a1983 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -270,7 +270,6 @@ class ScintillaWin : virtual void CopyToClipboard(const SelectionText &selectedText); void ScrollMessage(WPARAM wParam); void HorizontalScrollMessage(WPARAM wParam); - void RealizeWindowPalette(bool inBackGround); void FullPaint(); void FullPaintDC(HDC dc); bool IsCompatibleDC(HDC dc); @@ -992,12 +991,10 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam DestroySystemCaret(); } } - //RealizeWindowPalette(true); break; case WM_SETFOCUS: SetFocusState(true); - RealizeWindowPalette(false); DestroySystemCaret(); CreateSystemCaret(); break; @@ -1007,18 +1004,6 @@ sptr_t ScintillaWin::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam InvalidateStyleData(); break; - case WM_PALETTECHANGED: - if (wParam != reinterpret_cast<uptr_t>(MainHWND())) { - //Platform::DebugPrintf("** Palette Changed\n"); - RealizeWindowPalette(true); - } - break; - - case WM_QUERYNEWPALETTE: - //Platform::DebugPrintf("** Query palette\n"); - RealizeWindowPalette(false); - break; - case WM_IME_STARTCOMPOSITION: // dbcs ImeStartComposition(); return ::DefWindowProc(MainHWND(), iMessage, wParam, lParam); @@ -2384,24 +2369,6 @@ void ScintillaWin::HorizontalScrollMessage(WPARAM wParam) { HorizontalScrollTo(xPos); } -void ScintillaWin::RealizeWindowPalette(bool) { - // No support for palette with D2D -/* - RefreshStyleData(); - HDC hdc = ::GetDC(MainHWND()); - // Select a stock font to prevent warnings from BoundsChecker - ::SelectObject(hdc, GetStockFont(DEFAULT_GUI_FONT)); - AutoSurface surfaceWindow(hdc, this); - if (surfaceWindow) { - int changes = surfaceWindow->SetPalette(&palette, inBackGround); - if (changes > 0) - Redraw(); - surfaceWindow->Release(); - } - ::ReleaseDC(MainHWND(), hdc); -*/ -} - /** * Redraw all of text area. * This paint will not be abandoned. |