diff options
Diffstat (limited to 'cocoa')
-rw-r--r-- | cocoa/PlatCocoa.h | 31 | ||||
-rw-r--r-- | cocoa/PlatCocoa.mm | 77 |
2 files changed, 30 insertions, 78 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 ) ); } |