corrections for theme brush alignments under X (no more SetOrigin calls)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13223 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2001-12-29 09:59:59 +00:00
parent 5b36f53bd1
commit 7d9d1fd708
26 changed files with 348 additions and 516 deletions

View File

@@ -2619,7 +2619,6 @@ AGAPortHelper::~AGAPortHelper()
TextSize( size ); TextSize( size );
TextFace( style ); TextFace( style );
TextMode( mode ); TextMode( mode );
SetOrigin( 0 , 0 ) ;
SetPort( port ) ; SetPort( port ) ;
} }
} }

View File

@@ -1161,7 +1161,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else #else
SetPort( (window) ) ; SetPort( (window) ) ;
#endif #endif
SetOrigin( 0 , 0 ) ;
LocalToGlobal( &pt ) ; LocalToGlobal( &pt ) ;
SetPort( port ) ; SetPort( port ) ;
win->SetSize( pt.h , pt.v , -1 , win->SetSize( pt.h , pt.v , -1 ,
@@ -1232,7 +1231,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else #else
SetPort( (window) ) ; SetPort( (window) ) ;
#endif #endif
SetOrigin( 0 , 0 ) ;
SetPort( port ) ; SetPort( port ) ;
} }
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL ) if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )

View File

@@ -24,8 +24,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
wxBrushRefData::wxBrushRefData() wxBrushRefData::wxBrushRefData()
{ {
m_style = wxSOLID; m_style = wxSOLID;
m_isMacTheme = false ; m_macBrushKind = kwxMacBrushColour ;
m_isMacThemeBackground = false ;
} }
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data) wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
@@ -33,8 +32,10 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
m_style = data.m_style; m_style = data.m_style;
m_stipple = data.m_stipple; m_stipple = data.m_stipple;
m_colour = data.m_colour; m_colour = data.m_colour;
m_isMacTheme = data.m_isMacTheme ; m_macBrushKind = data.m_macBrushKind ;
m_macThemeBrush = data.m_macThemeBrush ; m_macThemeBrush = data.m_macThemeBrush ;
m_macThemeBackground = data.m_macThemeBackground ;
m_macThemeBackgroundExtent = data.m_macThemeBackgroundExtent ;
} }
wxBrushRefData::~wxBrushRefData() wxBrushRefData::~wxBrushRefData()
@@ -74,7 +75,7 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
{ {
m_refData = new wxBrushRefData; m_refData = new wxBrushRefData;
M_BRUSHDATA->m_isMacTheme = true; M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush; M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource(); RealizeResource();
@@ -97,8 +98,7 @@ void wxBrush::Unshare()
void wxBrush::SetColour(const wxColour& col) void wxBrush::SetColour(const wxColour& col)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_colour = col; M_BRUSHDATA->m_colour = col;
RealizeResource(); RealizeResource();
@@ -108,8 +108,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_colour.Set(r, g, b); M_BRUSHDATA->m_colour.Set(r, g, b);
RealizeResource(); RealizeResource();
@@ -119,8 +118,7 @@ void wxBrush::SetStyle(int Style)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_style = Style; M_BRUSHDATA->m_style = Style;
RealizeResource(); RealizeResource();
@@ -130,6 +128,7 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_stipple = Stipple; M_BRUSHDATA->m_stipple = Stipple;
RealizeResource(); RealizeResource();
@@ -139,21 +138,19 @@ void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = true; M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush; M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource(); RealizeResource();
} }
void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground) void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground, const Rect &extent)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
M_BRUSHDATA->m_isMacThemeBackground = true ;
M_BRUSHDATA->m_macThemeBackground = macThemeBackground; M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
M_BRUSHDATA->m_macThemeBackgroundExtent = extent ;
RealizeResource(); RealizeResource();
} }
@@ -162,3 +159,17 @@ bool wxBrush::RealizeResource()
return TRUE; return TRUE;
} }
ThemeBackgroundKind wxBrush::GetMacThemeBackground(Rect *extent) const
{
if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground )
{
if ( extent )
*extent = M_BRUSHDATA->m_macThemeBackgroundExtent ;
return M_BRUSHDATA->m_macThemeBackground ;
}
else
{
return 0 ;
}
}

View File

@@ -2619,7 +2619,6 @@ AGAPortHelper::~AGAPortHelper()
TextSize( size ); TextSize( size );
TextFace( style ); TextFace( style );
TextMode( mode ); TextMode( mode );
SetOrigin( 0 , 0 ) ;
SetPort( port ) ; SetPort( port ) ;
} }
} }

View File

@@ -1161,7 +1161,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else #else
SetPort( (window) ) ; SetPort( (window) ) ;
#endif #endif
SetOrigin( 0 , 0 ) ;
LocalToGlobal( &pt ) ; LocalToGlobal( &pt ) ;
SetPort( port ) ; SetPort( port ) ;
win->SetSize( pt.h , pt.v , -1 , win->SetSize( pt.h , pt.v , -1 ,
@@ -1232,7 +1231,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
#else #else
SetPort( (window) ) ; SetPort( (window) ) ;
#endif #endif
SetOrigin( 0 , 0 ) ;
SetPort( port ) ; SetPort( port ) ;
} }
if ( window != frontWindow && wxTheApp->s_captureWindow == NULL ) if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )

View File

@@ -24,8 +24,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
wxBrushRefData::wxBrushRefData() wxBrushRefData::wxBrushRefData()
{ {
m_style = wxSOLID; m_style = wxSOLID;
m_isMacTheme = false ; m_macBrushKind = kwxMacBrushColour ;
m_isMacThemeBackground = false ;
} }
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data) wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
@@ -33,8 +32,10 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
m_style = data.m_style; m_style = data.m_style;
m_stipple = data.m_stipple; m_stipple = data.m_stipple;
m_colour = data.m_colour; m_colour = data.m_colour;
m_isMacTheme = data.m_isMacTheme ; m_macBrushKind = data.m_macBrushKind ;
m_macThemeBrush = data.m_macThemeBrush ; m_macThemeBrush = data.m_macThemeBrush ;
m_macThemeBackground = data.m_macThemeBackground ;
m_macThemeBackgroundExtent = data.m_macThemeBackgroundExtent ;
} }
wxBrushRefData::~wxBrushRefData() wxBrushRefData::~wxBrushRefData()
@@ -74,7 +75,7 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
{ {
m_refData = new wxBrushRefData; m_refData = new wxBrushRefData;
M_BRUSHDATA->m_isMacTheme = true; M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush; M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource(); RealizeResource();
@@ -97,8 +98,7 @@ void wxBrush::Unshare()
void wxBrush::SetColour(const wxColour& col) void wxBrush::SetColour(const wxColour& col)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_colour = col; M_BRUSHDATA->m_colour = col;
RealizeResource(); RealizeResource();
@@ -108,8 +108,7 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_colour.Set(r, g, b); M_BRUSHDATA->m_colour.Set(r, g, b);
RealizeResource(); RealizeResource();
@@ -119,8 +118,7 @@ void wxBrush::SetStyle(int Style)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_style = Style; M_BRUSHDATA->m_style = Style;
RealizeResource(); RealizeResource();
@@ -130,6 +128,7 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
M_BRUSHDATA->m_stipple = Stipple; M_BRUSHDATA->m_stipple = Stipple;
RealizeResource(); RealizeResource();
@@ -139,21 +138,19 @@ void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = true; M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
M_BRUSHDATA->m_isMacThemeBackground = false ;
M_BRUSHDATA->m_macThemeBrush = macThemeBrush; M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
RealizeResource(); RealizeResource();
} }
void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground) void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground, const Rect &extent)
{ {
Unshare(); Unshare();
M_BRUSHDATA->m_isMacTheme = false; M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
M_BRUSHDATA->m_isMacThemeBackground = true ;
M_BRUSHDATA->m_macThemeBackground = macThemeBackground; M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
M_BRUSHDATA->m_macThemeBackgroundExtent = extent ;
RealizeResource(); RealizeResource();
} }
@@ -162,3 +159,17 @@ bool wxBrush::RealizeResource()
return TRUE; return TRUE;
} }
ThemeBackgroundKind wxBrush::GetMacThemeBackground(Rect *extent) const
{
if ( M_BRUSHDATA && M_BRUSHDATA->m_macBrushKind == kwxMacBrushThemeBackground )
{
if ( extent )
*extent = M_BRUSHDATA->m_macThemeBackgroundExtent ;
return M_BRUSHDATA->m_macThemeBackground ;
}
else
{
return 0 ;
}
}

View File

@@ -647,7 +647,6 @@ void wxControl::MacRedrawControl()
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ; UMADrawControl( m_macControl ) ;
} }
@@ -667,7 +666,6 @@ void wxControl::OnPaint(wxPaintEvent& event)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ; UMADrawControl( m_macControl ) ;
} }

View File

@@ -119,8 +119,6 @@ wxDC::~wxDC(void)
} }
void wxDC::MacSetupPort(AGAPortHelper* help) const void wxDC::MacSetupPort(AGAPortHelper* help) const
{ {
// help->Setup( m_macPort ) ;
::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
SetClip( m_macCurrentClipRgn); SetClip( m_macCurrentClipRgn);
m_macFontInstalled = false ; m_macFontInstalled = false ;
@@ -136,8 +134,8 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord w = bmp.GetWidth(); wxCoord w = bmp.GetWidth();
wxCoord h = bmp.GetHeight(); wxCoord h = bmp.GetHeight();
wxCoord ww = XLOG2DEVREL(w); wxCoord ww = XLOG2DEVREL(w);
@@ -238,8 +236,8 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC")); wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC"));
wxCoord xx, yy, ww, hh; wxCoord xx, yy, ww, hh;
xx = XLOG2DEV(x); xx = XLOG2DEVMAC(x);
yy = YLOG2DEV(y); yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(width); ww = XLOG2DEVREL(width);
hh = YLOG2DEVREL(height); hh = YLOG2DEVREL(height);
@@ -278,8 +276,8 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region )
region.GetBox( x, y, w, h ); region.GetBox( x, y, w, h );
wxCoord xx, yy, ww, hh; wxCoord xx, yy, ww, hh;
xx = XLOG2DEV(x); xx = XLOG2DEVMAC(x);
yy = YLOG2DEV(y); yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(w); ww = XLOG2DEVREL(w);
hh = YLOG2DEVREL(h); hh = YLOG2DEVREL(h);
@@ -531,7 +529,7 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
RGBColor colour; RGBColor colour;
GetCPixel( XLOG2DEV(x), YLOG2DEV(y), &colour ); GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
// Convert from Mac colour to wx // Convert from Mac colour to wx
col->Set( colour.red >> 8, col->Set( colour.red >> 8,
@@ -553,10 +551,10 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 : wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2; m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
wxCoord xx1 = XLOG2DEV(x1) - offset; wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
wxCoord yy1 = YLOG2DEV(y1) - offset; wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
wxCoord xx2 = XLOG2DEV(x2) - offset; wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
wxCoord yy2 = YLOG2DEV(y2) - offset; wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
if ((m_pen.GetCap() == wxCAP_ROUND) && if ((m_pen.GetCap() == wxCAP_ROUND) &&
(m_pen.GetWidth() <= 1)) (m_pen.GetWidth() <= 1))
@@ -593,14 +591,14 @@ void wxDC::DoCrossHair( wxCoord x, wxCoord y )
int w = 0; int w = 0;
int h = 0; int h = 0;
GetSize( &w, &h ); GetSize( &w, &h );
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
MacInstallPen(); MacInstallPen();
::MoveTo( 0, yy ); ::MoveTo( XLOG2DEVMAC(0), yy );
::LineTo( XLOG2DEVREL(w), yy ); ::LineTo( XLOG2DEVMAC(w), yy );
::MoveTo( xx, 0 ); ::MoveTo( xx, YLOG2DEVMAC(0) );
::LineTo( xx, YLOG2DEVREL(h) ); ::LineTo( xx, YLOG2DEVMAC(h) );
} }
} }
@@ -645,12 +643,12 @@ void wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
{ {
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC")); wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC"));
wxCoord xx1 = XLOG2DEV(x1); wxCoord xx1 = XLOG2DEVMAC(x1);
wxCoord yy1 = YLOG2DEV(y1); wxCoord yy1 = YLOG2DEVMAC(y1);
wxCoord xx2 = XLOG2DEV(x2); wxCoord xx2 = XLOG2DEVMAC(x2);
wxCoord yy2 = YLOG2DEV(y2); wxCoord yy2 = YLOG2DEVMAC(y2);
wxCoord xxc = XLOG2DEV(xc); wxCoord xxc = XLOG2DEVMAC(xc);
wxCoord yyc = YLOG2DEV(yc); wxCoord yyc = YLOG2DEVMAC(yc);
double dx = xx1 - xxc; double dx = xx1 - xxc;
double dy = yy1 - yyc; double dy = yy1 - yyc;
double radius = sqrt((double)(dx*dx+dy*dy)); double radius = sqrt((double)(dx*dx+dy*dy));
@@ -701,8 +699,8 @@ void wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
Rect r; Rect r;
double angle = sa - ea; // Order important Mac in opposite direction to wx double angle = sa - ea; // Order important Mac in opposite direction to wx
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(w); wxCoord ww = m_signX * XLOG2DEVREL(w);
wxCoord hh = m_signY * YLOG2DEVREL(h); wxCoord hh = m_signY * YLOG2DEVREL(h);
@@ -736,8 +734,8 @@ void wxDC::DoDrawPoint( wxCoord x, wxCoord y )
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
MacInstallPen() ; MacInstallPen() ;
wxCoord xx1 = XLOG2DEV(x); wxCoord xx1 = XLOG2DEVMAC(x);
wxCoord yy1 = YLOG2DEV(y); wxCoord yy1 = YLOG2DEVMAC(y);
::MoveTo(xx1,yy1); ::MoveTo(xx1,yy1);
::LineTo(xx1+1, yy1+1); ::LineTo(xx1+1, yy1+1);
@@ -759,14 +757,14 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ; m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
wxCoord x1, x2 , y1 , y2 ; wxCoord x1, x2 , y1 , y2 ;
x1 = XLOG2DEV(points[0].x + xoffset); x1 = XLOG2DEVMAC(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset); y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1 - offset, y1 - offset ); ::MoveTo(x1 - offset, y1 - offset );
for (int i = 0; i < n-1; i++) for (int i = 0; i < n-1; i++)
{ {
x2 = XLOG2DEV(points[i+1].x + xoffset); x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset); y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo( x2 - offset, y2 - offset ); ::LineTo( x2 - offset, y2 - offset );
} }
} }
@@ -784,14 +782,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{ {
PolyHandle polygon = OpenPoly(); PolyHandle polygon = OpenPoly();
x1 = XLOG2DEV(points[0].x + xoffset); x1 = XLOG2DEVMAC(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset); y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1); ::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++) for (int i = 0; i < n-1; i++)
{ {
x2 = XLOG2DEV(points[i+1].x + xoffset); x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset); y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2); ::LineTo(x2, y2);
} }
@@ -807,14 +805,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{ {
PolyHandle polygon = OpenPoly(); PolyHandle polygon = OpenPoly();
x1 = XLOG2DEV(points[0].x + xoffset); x1 = XLOG2DEVMAC(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset); y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1); ::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++) for (int i = 0; i < n-1; i++)
{ {
x2 = XLOG2DEV(points[i+1].x + xoffset); x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset); y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2); ::LineTo(x2, y2);
} }
@@ -835,8 +833,8 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
wxCHECK_RET(Ok(), wxT("Invalid DC")); wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width); wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height); wxCoord hh = m_signY * YLOG2DEVREL(height);
@@ -882,8 +880,8 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
if (radius < 0.0) if (radius < 0.0)
radius = - radius * ((width < height) ? width : height); radius = - radius * ((width < height) ? width : height);
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width); wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height); wxCoord hh = m_signY * YLOG2DEVREL(height);
@@ -924,8 +922,8 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
wxCHECK_RET(Ok(), wxT("Invalid DC")); wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width); wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height); wxCoord hh = m_signY * YLOG2DEVREL(height);
@@ -995,14 +993,14 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
if ( LockPixels(bmappixels) ) if ( LockPixels(bmappixels) )
{ {
Rect srcrect , dstrect ; Rect srcrect , dstrect ;
srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ; srcrect.top = source->YLOG2DEVMAC(ysrc) ;
srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ; srcrect.left = source->XLOG2DEVMAC(xsrc) ;
srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v; srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h; srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
dstrect.top = YLOG2DEV(ydest) ; dstrect.top = YLOG2DEVMAC(ydest) ;
dstrect.left = XLOG2DEV(xdest) ; dstrect.left = XLOG2DEVMAC(xdest) ;
dstrect.bottom = YLOG2DEV(ydest + height ) ; dstrect.bottom = YLOG2DEVMAC(ydest + height ) ;
dstrect.right = XLOG2DEV(xdest + width ) ; dstrect.right = XLOG2DEVMAC(xdest + width ) ;
short mode = (logical_func == wxCOPY ? srcCopy : short mode = (logical_func == wxCOPY ? srcCopy :
// logical_func == wxCLEAR ? WHITENESS : // logical_func == wxCLEAR ? WHITENESS :
@@ -1140,7 +1138,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
textPixel = data[(srcY*w + srcX)*3] == 0; textPixel = data[(srcY*w + srcX)*3] == 0;
if ( textPixel || (m_backgroundMode == wxSOLID) ) if ( textPixel || (m_backgroundMode == wxSOLID) )
{ {
SetCPixel(XLOG2DEV(x + dstX), YLOG2DEV(y + dstY), SetCPixel(XLOG2DEVMAC(x + dstX), YLOG2DEVMAC(y + dstY),
textPixel ? &colText : &colBack); textPixel ? &colText : &colBack);
} }
} }
@@ -1151,8 +1149,8 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
#if 0 #if 0
if ( m_font.GetUnderlined() ) if ( m_font.GetUnderlined() )
{ {
::MoveTo(XLOG2DEV(x + x4), YLOG2DEV(y + y4 + font->descent)); ::MoveTo(XLOG2DEVMAC(x + x4), YLOG2DEVMAC(y + y4 + font->descent));
::LineTo(XLOG2DEV(x + x3), YLOG2DEV(y + y3 + font->descent)); ::LineTo(XLOG2DEVMAC(x + x3), YLOG2DEVMAC(y + y3 + font->descent));
} }
#endif // 0 #endif // 0
@@ -1165,8 +1163,8 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC")); wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x); long xx = XLOG2DEVMAC(x);
long yy = YLOG2DEV(y); long yy = YLOG2DEVMAC(y);
// if (m_pen.GetStyle() != wxTRANSPARENT) // if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
@@ -1561,37 +1559,42 @@ void wxDC::MacInstallPen() const
m_macFontInstalled = false ; m_macFontInstalled = false ;
} }
int wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background ) void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
{ {
Pattern whiteColor ; Pattern whiteColor ;
if ( background.IsMacTheme() ) switch( background.MacGetBrushKind() )
{ {
SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ; case kwxMacBrushTheme :
} {
else if ( background.IsMacThemeBackground() ) ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
{ break ;
Rect originBox = { 0,0,1,1 } ; }
::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive , case kwxMacBrushThemeBackground :
wxDisplayDepth() , true ) ; {
} Rect extent ;
else ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
{ ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
::RGBBackColor( &background.GetColour().GetPixel() ); break ;
int brushStyle = background.GetStyle(); }
if (brushStyle == wxSOLID) case kwxMacBrushColour :
::BackPat(GetQDGlobalsWhite(&whiteColor)); {
else if (IS_HATCH(brushStyle)) ::RGBBackColor( &background.GetColour().GetPixel() );
{ int brushStyle = background.GetStyle();
Pattern pat ; if (brushStyle == wxSOLID)
wxMacGetHatchPattern(brushStyle, &pat); ::BackPat(GetQDGlobalsWhite(&whiteColor));
::BackPat(&pat); else if (IS_HATCH(brushStyle))
} {
else Pattern pat ;
{ wxMacGetHatchPattern(brushStyle, &pat);
::BackPat(GetQDGlobalsWhite(&whiteColor)); ::BackPat(&pat);
} }
} else
return 0 ; {
::BackPat(GetQDGlobalsWhite(&whiteColor));
}
break ;
}
}
} }
void wxDC::MacInstallBrush() const void wxDC::MacInstallBrush() const

View File

@@ -55,6 +55,7 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow ); the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ; SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ; m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0; m_minY = m_minX = 0;
@@ -90,6 +91,7 @@ wxClientDC::wxClientDC(wxWindow *window)
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ; SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ; OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ; m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0; m_minY = m_minX = 0;
@@ -126,6 +128,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ; OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ; m_macPort = UMAGetWindowPort( windowref ) ;
m_ok = TRUE ; m_ok = TRUE ;

View File

@@ -237,7 +237,6 @@ void wxPrinterDC::StartPage(void)
m_macLocalOrigin.h = (**m_printData.m_macPrintInfo).rPaper.left ; m_macLocalOrigin.h = (**m_printData.m_macPrintInfo).rPaper.left ;
m_macLocalOrigin.v = (**m_printData.m_macPrintInfo).rPaper.top ; m_macLocalOrigin.v = (**m_printData.m_macPrintInfo).rPaper.top ;
SetOrigin( - m_macLocalOrigin.h , - m_macLocalOrigin.v ) ;
Rect clip = { -32000 , -32000 , 32000 , 32000 } ; Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect( &clip ) ; ::ClipRect( &clip ) ;
err = PrError() ; err = PrError() ;

View File

@@ -187,7 +187,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
@@ -263,7 +262,6 @@ void wxTextCtrl::Paste()
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
@@ -1895,7 +1893,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
@@ -1986,9 +1983,7 @@ void wxTextCtrl::Paste()
if ( win ) if ( win )
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
while ( parent ) while ( parent )

View File

@@ -588,8 +588,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
while ( parent ) while ( parent )

View File

@@ -226,7 +226,6 @@ void wxMacToolTip::Draw()
#endif #endif
m_shown = true ; m_shown = true ;
SetOrigin( 0 , 0 ) ;
TextFont( kFontIDGeneva ) ; TextFont( kFontIDGeneva ) ;
TextSize( 10 ) ; TextSize( 10 ) ;
TextFace( 0 ) ; TextFace( 0 ) ;
@@ -333,7 +332,6 @@ void wxMacToolTip::Clear()
#endif #endif
m_shown = false ; m_shown = false ;
SetOrigin( 0 , 0 ) ;
BackColor( whiteColor ) ; BackColor( whiteColor ) ;
ForeColor(blackColor ) ; ForeColor(blackColor ) ;
DrawPicture(m_backpict, &m_rect); DrawPicture(m_backpict, &m_rect);

View File

@@ -279,18 +279,6 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
m_macFocus = NULL ; m_macFocus = NULL ;
} }
void wxTopLevelWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{
localOrigin->h = 0;
localOrigin->v = 0;
clipRect->left = 0;
clipRect->top = 0;
clipRect->right = m_width ;//width;
clipRect->bottom = m_height ;// height;
*window = m_macWindow ;
*rootwin = this ;
}
void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin)
{ {
localOrigin->h = 0; localOrigin->h = 0;
@@ -305,13 +293,7 @@ void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, W
void wxTopLevelWindowMac::Clear() void wxTopLevelWindowMac::Clear()
{ {
wxMacDrawingClientHelper helper ( this ) ; wxWindow::Clear() ;
int w ,h ;
wxPoint origin = GetClientAreaOrigin() ;
GetClientSize( &w , &h ) ;
::SetThemeWindowBackground( m_macWindow , m_macWindowBackgroundTheme , false ) ;
Rect r = { origin.y , origin.x, origin.y+h , origin.x+w } ;
EraseRect( &r ) ;
} }
ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding() ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding()
@@ -327,7 +309,6 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
#else #else
AGAPortHelper help( (m_macWindow) ) ; AGAPortHelper help( (m_macWindow) ) ;
#endif #endif
SetOrigin( 0 , 0 ) ;
BeginUpdate( m_macWindow ) ; BeginUpdate( m_macWindow ) ;
RgnHandle updateRgn = NewRgn(); RgnHandle updateRgn = NewRgn();

View File

@@ -497,7 +497,6 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow,
SetPortWindowPort( inWindow ) ; SetPortWindowPort( inWindow ) ;
SetOrigin( 0 , 0 ) ;
err = SetKeyboardFocus( inWindow , inControl , inPart ) ; err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
SetPort( port ) ; SetPort( port ) ;
return err ; return err ;
@@ -549,7 +548,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
GrafPtr port ; GrafPtr port ;
GetPort( &port ) ; GetPort( &port ) ;
SetPortWindowPort( inWindowRef ) ; SetPortWindowPort( inWindowRef ) ;
SetOrigin( 0 , 0 ) ;
HiliteWindow( inWindowRef , inActivate ) ; HiliteWindow( inWindowRef , inActivate ) ;
ControlHandle control = NULL ; ControlHandle control = NULL ;
::GetRootControl( inWindowRef , & control ) ; ::GetRootControl( inWindowRef , & control ) ;

View File

@@ -366,7 +366,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
GrafPtr port ; GrafPtr port ;
::GetPort( &port ) ; ::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ; ::SetPort( UMAGetWindowPort( window ) ) ;
::SetOrigin( 0 , 0 ) ;
::LocalToGlobal( &localwhere ) ; ::LocalToGlobal( &localwhere ) ;
::SetPort( port ) ; ::SetPort( port ) ;
if(x) *x = localwhere.h ; if(x) *x = localwhere.h ;
@@ -560,6 +560,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() ) if ( focus.Ok() )
{ {
Rect clientrect = { 0 , 0 , m_height , m_width } ; Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ; // ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ; InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
} }
@@ -575,6 +576,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() ) if ( focus.Ok() )
{ {
Rect clientrect = { 0 , 0 , m_height , m_width } ; Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ; // ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ; InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
} }
@@ -909,7 +911,17 @@ const wxBrush& wxWindowMac::MacGetBackgroundBrush()
// if we have the normal colours in the hierarchy but another control etc. -> use it's background // if we have the normal colours in the hierarchy but another control etc. -> use it's background
if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
{ {
m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane ) ; // todo eventually change for inactive Rect extent = { 0 , 0 , 0 , 0 } ;
int x , y ;
x = y = 0 ;
wxSize size = GetSize() ;
parent->MacClientToRootWindow( &x , &y ) ;
extent.left = x ;
extent.top = y ;
extent.top-- ;
extent.right = x + size.x ;
extent.bottom = y + size.y ;
m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , extent ) ; // todo eventually change for inactive
break ; break ;
} }
} }
@@ -939,7 +951,7 @@ void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
wxMacDrawingHelper focus( this ) ; wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() ) if ( focus.Ok() )
{ {
MacPaintBorders() ; MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
} }
} }
@@ -1004,7 +1016,7 @@ void wxWindowMac::SetScrollPos(int orient, int pos, bool refresh)
} }
} }
void wxWindowMac::MacPaintBorders( ) void wxWindowMac::MacPaintBorders( int left , int top )
{ {
if( IsTopLevel() ) if( IsTopLevel() )
return ; return ;
@@ -1018,7 +1030,7 @@ void wxWindowMac::MacPaintBorders( )
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) ) if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{ {
#if wxMAC_USE_THEME_BORDER #if wxMAC_USE_THEME_BORDER
Rect rect = { 0 , 0 , m_height , m_width } ; Rect rect = { top , left , m_height + top , m_width + left } ;
SInt32 border = 0 ; SInt32 border = 0 ;
/* /*
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ; GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
@@ -1030,38 +1042,38 @@ void wxWindowMac::MacPaintBorders( )
#else #else
bool sunken = HasFlag( wxSUNKEN_BORDER ) ; bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBForeColor( &face ); RGBForeColor( &face );
MoveTo( 0 , m_height - 2 ); MoveTo( left + 0 , top + m_height - 2 );
LineTo( 0 , 0 ); LineTo( left + 0 , top + 0 );
LineTo( m_width - 2 , 0 ); LineTo( left + m_width - 2 , top + 0 );
MoveTo( 2 , m_height - 3 ); MoveTo( left + 2 , top + m_height - 3 );
LineTo( m_width - 3 , m_height - 3 ); LineTo( left + m_width - 3 , top + m_height - 3 );
LineTo( m_width - 3 , 2 ); LineTo( left + m_width - 3 , top + 2 );
RGBForeColor( sunken ? &face : &black ); RGBForeColor( sunken ? &face : &black );
MoveTo( 0 , m_height - 1 ); MoveTo( left + 0 , top + m_height - 1 );
LineTo( m_width - 1 , m_height - 1 ); LineTo( left + m_width - 1 , top + m_height - 1 );
LineTo( m_width - 1 , 0 ); LineTo( left + m_width - 1 , top + 0 );
RGBForeColor( sunken ? &shadow : &white ); RGBForeColor( sunken ? &shadow : &white );
MoveTo( 1 , m_height - 3 ); MoveTo( left + 1 , top + m_height - 3 );
LineTo( 1, 1 ); LineTo( left + 1, top + 1 );
LineTo( m_width - 3 , 1 ); LineTo( left + m_width - 3 , top + 1 );
RGBForeColor( sunken ? &white : &shadow ); RGBForeColor( sunken ? &white : &shadow );
MoveTo( 1 , m_height - 2 ); MoveTo( left + 1 , top + m_height - 2 );
LineTo( m_width - 2 , m_height - 2 ); LineTo( left + m_width - 2 , top + m_height - 2 );
LineTo( m_width - 2 , 1 ); LineTo( left + m_width - 2 , top + 1 );
RGBForeColor( sunken ? &black : &face ); RGBForeColor( sunken ? &black : &face );
MoveTo( 2 , m_height - 4 ); MoveTo( left + 2 , top + m_height - 4 );
LineTo( 2 , 2 ); LineTo( left + 2 , top + 2 );
LineTo( m_width - 4 , 2 ); LineTo( left + m_width - 4 , top + 2 );
#endif #endif
} }
else if (HasFlag(wxSIMPLE_BORDER)) else if (HasFlag(wxSIMPLE_BORDER))
{ {
Rect rect = { 0 , 0 , m_height , m_width } ; Rect rect = { top , left , m_height + top , m_width + left } ;
RGBForeColor( &black ) ; RGBForeColor( &black ) ;
FrameRect( &rect ) ; FrameRect( &rect ) ;
} }
@@ -1111,19 +1123,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
// Does a physical scroll // Does a physical scroll
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
{ {
wxMacDrawingClientHelper focus( this ) ; wxMacDrawingHelper focus( this , true ) ;
if ( focus.Ok() ) if ( focus.Ok() )
{ {
int width , height ; int width , height ;
GetClientSize( &width , &height ) ; GetClientSize( &width , &height ) ;
Rect scrollrect = { 0 , 0 , height , width } ; Rect scrollrect = { 0 , 0 , height , width } ;
focus.LocalToWindow( &scrollrect ) ;
RgnHandle updateRgn = NewRgn() ; RgnHandle updateRgn = NewRgn() ;
ClipRect( &scrollrect ) ; ClipRect( &scrollrect ) ;
if ( rect ) if ( rect )
{ {
Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ; Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
focus.LocalToWindow( &r ) ;
SectRect( &scrollrect , &r , &scrollrect ) ; SectRect( &scrollrect , &r , &scrollrect ) ;
} }
ScrollRect( &scrollrect , dx , dy , updateRgn ) ; ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
@@ -1714,24 +1727,6 @@ void wxWindowMac::MacTopLevelWindowChangedPosition()
} }
} }
bool wxWindowMac::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
{
if ( window == NULL )
return false ;
GrafPtr currPort;
GrafPtr port ;
::GetPort(&currPort);
port = UMAGetWindowPort( window) ;
if (currPort != port )
::SetPort(port);
// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ;
::SetOrigin(-localOrigin.h, -localOrigin.v);
return true;
}
bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win ) bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
{ {
if ( window == NULL ) if ( window == NULL )
@@ -1743,9 +1738,9 @@ bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect
port = UMAGetWindowPort( window) ; port = UMAGetWindowPort( window) ;
if (currPort != port ) if (currPort != port )
::SetPort(port); ::SetPort(port);
// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; Rect cr = clipRect ;
::SetOrigin(-localOrigin.h, -localOrigin.v); OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
::ClipRect(&clipRect); ::ClipRect(&cr);
::PenNormal() ; ::PenNormal() ;
::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ; ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
@@ -1773,27 +1768,9 @@ void wxWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef
SectRect(clipRect, &myClip, clipRect); SectRect(clipRect, &myClip, clipRect);
} }
void wxWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{
wxASSERT( GetParent() != NULL ) ;
GetParent()->MacDoGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
localOrigin->h += m_x;
localOrigin->v += m_y;
OffsetRect(clipRect, -m_x, -m_y);
Rect myClip;
myClip.left = 0;
myClip.top = 0;
myClip.right = m_width ;//width;
myClip.bottom = m_height ;// height;
SectRect(clipRect, &myClip, clipRect);
}
void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{ {
MacDoGetPortClientParams( localOrigin , clipRect , window , rootwin ) ; MacGetPortParams( localOrigin , clipRect, window , rootwin ) ;
int width , height ; int width , height ;
GetClientSize( &width , &height ) ; GetClientSize( &width , &height ) ;
@@ -1804,11 +1781,7 @@ void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Win
localOrigin->v += client.y; localOrigin->v += client.y;
OffsetRect(clipRect, -client.x, -client.y); OffsetRect(clipRect, -client.x, -client.y);
Rect myClip; Rect myClip = { 0 , 0 , height , width } ;
myClip.left = 0;
myClip.top = 0;
myClip.right = width;
myClip.bottom = height;
SectRect(clipRect, &myClip, clipRect); SectRect(clipRect, &myClip, clipRect);
} }
@@ -1868,10 +1841,9 @@ long wxWindowMac::MacRemoveBordersFromStyle( long style )
} }
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow ) wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
{ {
m_ok = false ; m_ok = false ;
Point localOrigin ;
Rect clipRect ; Rect clipRect ;
WindowRef window ; WindowRef window ;
wxWindowMac *rootwin ; wxWindowMac *rootwin ;
@@ -1880,12 +1852,15 @@ wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
GetPort( &m_formerPort ) ; GetPort( &m_formerPort ) ;
if ( theWindow ) if ( theWindow )
{ {
theWindow->MacGetPortParams( &localOrigin , &clipRect , &window , &rootwin) ; if ( clientArea )
theWindow->MacGetPortClientParams( &m_origin , &clipRect , &window , &rootwin) ;
else
theWindow->MacGetPortParams( &m_origin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ; m_currentPort = UMAGetWindowPort( window ) ;
if ( m_formerPort != m_currentPort ) if ( m_formerPort != m_currentPort )
SetPort( m_currentPort ) ; SetPort( m_currentPort ) ;
GetPenState( &m_savedPenState ) ; GetPenState( &m_savedPenState ) ;
theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ; theWindow->MacSetPortDrawingParams( m_origin, clipRect, window , rootwin ) ;
m_ok = true ; m_ok = true ;
} }
} }
@@ -1896,46 +1871,6 @@ wxMacDrawingHelper::~wxMacDrawingHelper()
{ {
SetPort( m_currentPort ) ; SetPort( m_currentPort ) ;
SetPenState( &m_savedPenState ) ; SetPenState( &m_savedPenState ) ;
SetOrigin( 0 , 0 ) ;
Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ;
}
if ( m_formerPort != m_currentPort )
SetPort( m_formerPort ) ;
}
wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindowMac * theWindow )
{
m_ok = false ;
Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindowMac *rootwin ;
m_currentPort = NULL ;
GetPort( &m_formerPort ) ;
if ( theWindow )
{
theWindow->MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ;
if ( m_formerPort != m_currentPort )
SetPort( m_currentPort ) ;
GetPenState( &m_savedPenState ) ;
theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ;
m_ok = true ;
}
}
wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
{
if ( m_ok )
{
SetPort( m_currentPort ) ;
SetPenState( &m_savedPenState ) ;
SetOrigin( 0 , 0 ) ;
Rect portRect ; Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ; GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ; ClipRect( &portRect ) ;

View File

@@ -647,7 +647,6 @@ void wxControl::MacRedrawControl()
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ; UMADrawControl( m_macControl ) ;
} }
@@ -667,7 +666,6 @@ void wxControl::OnPaint(wxPaintEvent& event)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ; wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
UMADrawControl( m_macControl ) ; UMADrawControl( m_macControl ) ;
} }

View File

@@ -119,8 +119,6 @@ wxDC::~wxDC(void)
} }
void wxDC::MacSetupPort(AGAPortHelper* help) const void wxDC::MacSetupPort(AGAPortHelper* help) const
{ {
// help->Setup( m_macPort ) ;
::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
SetClip( m_macCurrentClipRgn); SetClip( m_macCurrentClipRgn);
m_macFontInstalled = false ; m_macFontInstalled = false ;
@@ -136,8 +134,8 @@ void wxDC::DoDrawBitmap( const wxBitmap &bmp, wxCoord x, wxCoord y, bool useMask
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord w = bmp.GetWidth(); wxCoord w = bmp.GetWidth();
wxCoord h = bmp.GetHeight(); wxCoord h = bmp.GetHeight();
wxCoord ww = XLOG2DEVREL(w); wxCoord ww = XLOG2DEVREL(w);
@@ -238,8 +236,8 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC")); wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion Invalid DC"));
wxCoord xx, yy, ww, hh; wxCoord xx, yy, ww, hh;
xx = XLOG2DEV(x); xx = XLOG2DEVMAC(x);
yy = YLOG2DEV(y); yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(width); ww = XLOG2DEVREL(width);
hh = YLOG2DEVREL(height); hh = YLOG2DEVREL(height);
@@ -278,8 +276,8 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region )
region.GetBox( x, y, w, h ); region.GetBox( x, y, w, h );
wxCoord xx, yy, ww, hh; wxCoord xx, yy, ww, hh;
xx = XLOG2DEV(x); xx = XLOG2DEVMAC(x);
yy = YLOG2DEV(y); yy = YLOG2DEVMAC(y);
ww = XLOG2DEVREL(w); ww = XLOG2DEVREL(w);
hh = YLOG2DEVREL(h); hh = YLOG2DEVREL(h);
@@ -531,7 +529,7 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
RGBColor colour; RGBColor colour;
GetCPixel( XLOG2DEV(x), YLOG2DEV(y), &colour ); GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
// Convert from Mac colour to wx // Convert from Mac colour to wx
col->Set( colour.red >> 8, col->Set( colour.red >> 8,
@@ -553,10 +551,10 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 : wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2; m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
wxCoord xx1 = XLOG2DEV(x1) - offset; wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
wxCoord yy1 = YLOG2DEV(y1) - offset; wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
wxCoord xx2 = XLOG2DEV(x2) - offset; wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
wxCoord yy2 = YLOG2DEV(y2) - offset; wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
if ((m_pen.GetCap() == wxCAP_ROUND) && if ((m_pen.GetCap() == wxCAP_ROUND) &&
(m_pen.GetWidth() <= 1)) (m_pen.GetWidth() <= 1))
@@ -593,14 +591,14 @@ void wxDC::DoCrossHair( wxCoord x, wxCoord y )
int w = 0; int w = 0;
int h = 0; int h = 0;
GetSize( &w, &h ); GetSize( &w, &h );
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
MacInstallPen(); MacInstallPen();
::MoveTo( 0, yy ); ::MoveTo( XLOG2DEVMAC(0), yy );
::LineTo( XLOG2DEVREL(w), yy ); ::LineTo( XLOG2DEVMAC(w), yy );
::MoveTo( xx, 0 ); ::MoveTo( xx, YLOG2DEVMAC(0) );
::LineTo( xx, YLOG2DEVREL(h) ); ::LineTo( xx, YLOG2DEVMAC(h) );
} }
} }
@@ -645,12 +643,12 @@ void wxDC::DoDrawArc( wxCoord x1, wxCoord y1,
{ {
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC")); wxCHECK_RET(Ok(), wxT("wxDC::DoDrawArc Invalid DC"));
wxCoord xx1 = XLOG2DEV(x1); wxCoord xx1 = XLOG2DEVMAC(x1);
wxCoord yy1 = YLOG2DEV(y1); wxCoord yy1 = YLOG2DEVMAC(y1);
wxCoord xx2 = XLOG2DEV(x2); wxCoord xx2 = XLOG2DEVMAC(x2);
wxCoord yy2 = YLOG2DEV(y2); wxCoord yy2 = YLOG2DEVMAC(y2);
wxCoord xxc = XLOG2DEV(xc); wxCoord xxc = XLOG2DEVMAC(xc);
wxCoord yyc = YLOG2DEV(yc); wxCoord yyc = YLOG2DEVMAC(yc);
double dx = xx1 - xxc; double dx = xx1 - xxc;
double dy = yy1 - yyc; double dy = yy1 - yyc;
double radius = sqrt((double)(dx*dx+dy*dy)); double radius = sqrt((double)(dx*dx+dy*dy));
@@ -701,8 +699,8 @@ void wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
Rect r; Rect r;
double angle = sa - ea; // Order important Mac in opposite direction to wx double angle = sa - ea; // Order important Mac in opposite direction to wx
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(w); wxCoord ww = m_signX * XLOG2DEVREL(w);
wxCoord hh = m_signY * YLOG2DEVREL(h); wxCoord hh = m_signY * YLOG2DEVREL(h);
@@ -736,8 +734,8 @@ void wxDC::DoDrawPoint( wxCoord x, wxCoord y )
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
MacInstallPen() ; MacInstallPen() ;
wxCoord xx1 = XLOG2DEV(x); wxCoord xx1 = XLOG2DEVMAC(x);
wxCoord yy1 = YLOG2DEV(y); wxCoord yy1 = YLOG2DEVMAC(y);
::MoveTo(xx1,yy1); ::MoveTo(xx1,yy1);
::LineTo(xx1+1, yy1+1); ::LineTo(xx1+1, yy1+1);
@@ -759,14 +757,14 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ; m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
wxCoord x1, x2 , y1 , y2 ; wxCoord x1, x2 , y1 , y2 ;
x1 = XLOG2DEV(points[0].x + xoffset); x1 = XLOG2DEVMAC(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset); y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1 - offset, y1 - offset ); ::MoveTo(x1 - offset, y1 - offset );
for (int i = 0; i < n-1; i++) for (int i = 0; i < n-1; i++)
{ {
x2 = XLOG2DEV(points[i+1].x + xoffset); x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset); y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo( x2 - offset, y2 - offset ); ::LineTo( x2 - offset, y2 - offset );
} }
} }
@@ -784,14 +782,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{ {
PolyHandle polygon = OpenPoly(); PolyHandle polygon = OpenPoly();
x1 = XLOG2DEV(points[0].x + xoffset); x1 = XLOG2DEVMAC(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset); y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1); ::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++) for (int i = 0; i < n-1; i++)
{ {
x2 = XLOG2DEV(points[i+1].x + xoffset); x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset); y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2); ::LineTo(x2, y2);
} }
@@ -807,14 +805,14 @@ void wxDC::DoDrawPolygon(int n, wxPoint points[],
{ {
PolyHandle polygon = OpenPoly(); PolyHandle polygon = OpenPoly();
x1 = XLOG2DEV(points[0].x + xoffset); x1 = XLOG2DEVMAC(points[0].x + xoffset);
y1 = YLOG2DEV(points[0].y + yoffset); y1 = YLOG2DEVMAC(points[0].y + yoffset);
::MoveTo(x1,y1); ::MoveTo(x1,y1);
for (int i = 0; i < n-1; i++) for (int i = 0; i < n-1; i++)
{ {
x2 = XLOG2DEV(points[i+1].x + xoffset); x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
y2 = YLOG2DEV(points[i+1].y + yoffset); y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
::LineTo(x2, y2); ::LineTo(x2, y2);
} }
@@ -835,8 +833,8 @@ void wxDC::DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
wxCHECK_RET(Ok(), wxT("Invalid DC")); wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width); wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height); wxCoord hh = m_signY * YLOG2DEVREL(height);
@@ -882,8 +880,8 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
if (radius < 0.0) if (radius < 0.0)
radius = - radius * ((width < height) ? width : height); radius = - radius * ((width < height) ? width : height);
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width); wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height); wxCoord hh = m_signY * YLOG2DEVREL(height);
@@ -924,8 +922,8 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
wxCHECK_RET(Ok(), wxT("Invalid DC")); wxCHECK_RET(Ok(), wxT("Invalid DC"));
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
wxCoord xx = XLOG2DEV(x); wxCoord xx = XLOG2DEVMAC(x);
wxCoord yy = YLOG2DEV(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width); wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height); wxCoord hh = m_signY * YLOG2DEVREL(height);
@@ -995,14 +993,14 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
if ( LockPixels(bmappixels) ) if ( LockPixels(bmappixels) )
{ {
Rect srcrect , dstrect ; Rect srcrect , dstrect ;
srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ; srcrect.top = source->YLOG2DEVMAC(ysrc) ;
srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ; srcrect.left = source->XLOG2DEVMAC(xsrc) ;
srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v; srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h; srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
dstrect.top = YLOG2DEV(ydest) ; dstrect.top = YLOG2DEVMAC(ydest) ;
dstrect.left = XLOG2DEV(xdest) ; dstrect.left = XLOG2DEVMAC(xdest) ;
dstrect.bottom = YLOG2DEV(ydest + height ) ; dstrect.bottom = YLOG2DEVMAC(ydest + height ) ;
dstrect.right = XLOG2DEV(xdest + width ) ; dstrect.right = XLOG2DEVMAC(xdest + width ) ;
short mode = (logical_func == wxCOPY ? srcCopy : short mode = (logical_func == wxCOPY ? srcCopy :
// logical_func == wxCLEAR ? WHITENESS : // logical_func == wxCLEAR ? WHITENESS :
@@ -1140,7 +1138,7 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
textPixel = data[(srcY*w + srcX)*3] == 0; textPixel = data[(srcY*w + srcX)*3] == 0;
if ( textPixel || (m_backgroundMode == wxSOLID) ) if ( textPixel || (m_backgroundMode == wxSOLID) )
{ {
SetCPixel(XLOG2DEV(x + dstX), YLOG2DEV(y + dstY), SetCPixel(XLOG2DEVMAC(x + dstX), YLOG2DEVMAC(y + dstY),
textPixel ? &colText : &colBack); textPixel ? &colText : &colBack);
} }
} }
@@ -1151,8 +1149,8 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
#if 0 #if 0
if ( m_font.GetUnderlined() ) if ( m_font.GetUnderlined() )
{ {
::MoveTo(XLOG2DEV(x + x4), YLOG2DEV(y + y4 + font->descent)); ::MoveTo(XLOG2DEVMAC(x + x4), YLOG2DEVMAC(y + y4 + font->descent));
::LineTo(XLOG2DEV(x + x3), YLOG2DEV(y + y3 + font->descent)); ::LineTo(XLOG2DEVMAC(x + x3), YLOG2DEVMAC(y + y3 + font->descent));
} }
#endif // 0 #endif // 0
@@ -1165,8 +1163,8 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC")); wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
wxMacPortSetter helper(this) ; wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x); long xx = XLOG2DEVMAC(x);
long yy = YLOG2DEV(y); long yy = YLOG2DEVMAC(y);
// if (m_pen.GetStyle() != wxTRANSPARENT) // if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
@@ -1561,37 +1559,42 @@ void wxDC::MacInstallPen() const
m_macFontInstalled = false ; m_macFontInstalled = false ;
} }
int wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background ) void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
{ {
Pattern whiteColor ; Pattern whiteColor ;
if ( background.IsMacTheme() ) switch( background.MacGetBrushKind() )
{ {
SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ; case kwxMacBrushTheme :
} {
else if ( background.IsMacThemeBackground() ) ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
{ break ;
Rect originBox = { 0,0,1,1 } ; }
::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive , case kwxMacBrushThemeBackground :
wxDisplayDepth() , true ) ; {
} Rect extent ;
else ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
{ ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
::RGBBackColor( &background.GetColour().GetPixel() ); break ;
int brushStyle = background.GetStyle(); }
if (brushStyle == wxSOLID) case kwxMacBrushColour :
::BackPat(GetQDGlobalsWhite(&whiteColor)); {
else if (IS_HATCH(brushStyle)) ::RGBBackColor( &background.GetColour().GetPixel() );
{ int brushStyle = background.GetStyle();
Pattern pat ; if (brushStyle == wxSOLID)
wxMacGetHatchPattern(brushStyle, &pat); ::BackPat(GetQDGlobalsWhite(&whiteColor));
::BackPat(&pat); else if (IS_HATCH(brushStyle))
} {
else Pattern pat ;
{ wxMacGetHatchPattern(brushStyle, &pat);
::BackPat(GetQDGlobalsWhite(&whiteColor)); ::BackPat(&pat);
} }
} else
return 0 ; {
::BackPat(GetQDGlobalsWhite(&whiteColor));
}
break ;
}
}
} }
void wxDC::MacInstallBrush() const void wxDC::MacInstallBrush() const

View File

@@ -55,6 +55,7 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow ); the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ; SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ; m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0; m_minY = m_minX = 0;
@@ -90,6 +91,7 @@ wxClientDC::wxClientDC(wxWindow *window)
SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ; SetRectRgn( m_macBoundaryClipRgn , clipRect.left + origin.x , clipRect.top + origin.y , clipRect.right + origin.x , clipRect.bottom + origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ; OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ; m_macPort = UMAGetWindowPort( windowref ) ;
m_minY = m_minX = 0; m_minY = m_minX = 0;
@@ -126,6 +128,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ; OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ; SectRgn( m_macBoundaryClipRgn , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ; CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
m_macPort = UMAGetWindowPort( windowref ) ; m_macPort = UMAGetWindowPort( windowref ) ;
m_ok = TRUE ; m_ok = TRUE ;

View File

@@ -237,7 +237,6 @@ void wxPrinterDC::StartPage(void)
m_macLocalOrigin.h = (**m_printData.m_macPrintInfo).rPaper.left ; m_macLocalOrigin.h = (**m_printData.m_macPrintInfo).rPaper.left ;
m_macLocalOrigin.v = (**m_printData.m_macPrintInfo).rPaper.top ; m_macLocalOrigin.v = (**m_printData.m_macPrintInfo).rPaper.top ;
SetOrigin( - m_macLocalOrigin.h , - m_macLocalOrigin.v ) ;
Rect clip = { -32000 , -32000 , 32000 , 32000 } ; Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect( &clip ) ; ::ClipRect( &clip ) ;
err = PrError() ; err = PrError() ;

View File

@@ -187,7 +187,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
@@ -263,7 +262,6 @@ void wxTextCtrl::Paste()
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
@@ -1895,7 +1893,6 @@ void wxTextCtrl::SetValue(const wxString& st)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
@@ -1986,9 +1983,7 @@ void wxTextCtrl::Paste()
if ( win ) if ( win )
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
while ( parent ) while ( parent )

View File

@@ -588,8 +588,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
{ {
wxMacDrawingHelper help( win ) ; wxMacDrawingHelper help( win ) ;
// the mac control manager always assumes to have the origin at 0,0 // the mac control manager always assumes to have the origin at 0,0
SetOrigin( 0 , 0 ) ;
bool hasTabBehind = false ; bool hasTabBehind = false ;
wxWindow* parent = GetParent() ; wxWindow* parent = GetParent() ;
while ( parent ) while ( parent )

View File

@@ -226,7 +226,6 @@ void wxMacToolTip::Draw()
#endif #endif
m_shown = true ; m_shown = true ;
SetOrigin( 0 , 0 ) ;
TextFont( kFontIDGeneva ) ; TextFont( kFontIDGeneva ) ;
TextSize( 10 ) ; TextSize( 10 ) ;
TextFace( 0 ) ; TextFace( 0 ) ;
@@ -333,7 +332,6 @@ void wxMacToolTip::Clear()
#endif #endif
m_shown = false ; m_shown = false ;
SetOrigin( 0 , 0 ) ;
BackColor( whiteColor ) ; BackColor( whiteColor ) ;
ForeColor(blackColor ) ; ForeColor(blackColor ) ;
DrawPicture(m_backpict, &m_rect); DrawPicture(m_backpict, &m_rect);

View File

@@ -279,18 +279,6 @@ void wxTopLevelWindowMac::MacCreateRealWindow( const wxString& title,
m_macFocus = NULL ; m_macFocus = NULL ;
} }
void wxTopLevelWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{
localOrigin->h = 0;
localOrigin->v = 0;
clipRect->left = 0;
clipRect->top = 0;
clipRect->right = m_width ;//width;
clipRect->bottom = m_height ;// height;
*window = m_macWindow ;
*rootwin = this ;
}
void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin) void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin)
{ {
localOrigin->h = 0; localOrigin->h = 0;
@@ -305,13 +293,7 @@ void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, W
void wxTopLevelWindowMac::Clear() void wxTopLevelWindowMac::Clear()
{ {
wxMacDrawingClientHelper helper ( this ) ; wxWindow::Clear() ;
int w ,h ;
wxPoint origin = GetClientAreaOrigin() ;
GetClientSize( &w , &h ) ;
::SetThemeWindowBackground( m_macWindow , m_macWindowBackgroundTheme , false ) ;
Rect r = { origin.y , origin.x, origin.y+h , origin.x+w } ;
EraseRect( &r ) ;
} }
ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding() ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding()
@@ -327,7 +309,6 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
#else #else
AGAPortHelper help( (m_macWindow) ) ; AGAPortHelper help( (m_macWindow) ) ;
#endif #endif
SetOrigin( 0 , 0 ) ;
BeginUpdate( m_macWindow ) ; BeginUpdate( m_macWindow ) ;
RgnHandle updateRgn = NewRgn(); RgnHandle updateRgn = NewRgn();

View File

@@ -497,7 +497,6 @@ OSErr UMASetKeyboardFocus (WindowPtr inWindow,
SetPortWindowPort( inWindow ) ; SetPortWindowPort( inWindow ) ;
SetOrigin( 0 , 0 ) ;
err = SetKeyboardFocus( inWindow , inControl , inPart ) ; err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
SetPort( port ) ; SetPort( port ) ;
return err ; return err ;
@@ -549,7 +548,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
GrafPtr port ; GrafPtr port ;
GetPort( &port ) ; GetPort( &port ) ;
SetPortWindowPort( inWindowRef ) ; SetPortWindowPort( inWindowRef ) ;
SetOrigin( 0 , 0 ) ;
HiliteWindow( inWindowRef , inActivate ) ; HiliteWindow( inWindowRef , inActivate ) ;
ControlHandle control = NULL ; ControlHandle control = NULL ;
::GetRootControl( inWindowRef , & control ) ; ::GetRootControl( inWindowRef , & control ) ;

View File

@@ -366,7 +366,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
GrafPtr port ; GrafPtr port ;
::GetPort( &port ) ; ::GetPort( &port ) ;
::SetPort( UMAGetWindowPort( window ) ) ; ::SetPort( UMAGetWindowPort( window ) ) ;
::SetOrigin( 0 , 0 ) ;
::LocalToGlobal( &localwhere ) ; ::LocalToGlobal( &localwhere ) ;
::SetPort( port ) ; ::SetPort( port ) ;
if(x) *x = localwhere.h ; if(x) *x = localwhere.h ;
@@ -560,6 +560,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() ) if ( focus.Ok() )
{ {
Rect clientrect = { 0 , 0 , m_height , m_width } ; Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ; // ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ; InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
} }
@@ -575,6 +576,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
if ( focus.Ok() ) if ( focus.Ok() )
{ {
Rect clientrect = { 0 , 0 , m_height , m_width } ; Rect clientrect = { 0 , 0 , m_height , m_width } ;
focus.LocalToWindow( &clientrect ) ;
// ClipRect( &clientrect ) ; // ClipRect( &clientrect ) ;
InvalWindowRect( MacGetRootWindow() , &clientrect ) ; InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
} }
@@ -909,7 +911,17 @@ const wxBrush& wxWindowMac::MacGetBackgroundBrush()
// if we have the normal colours in the hierarchy but another control etc. -> use it's background // if we have the normal colours in the hierarchy but another control etc. -> use it's background
if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) )) if ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
{ {
m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane ) ; // todo eventually change for inactive Rect extent = { 0 , 0 , 0 , 0 } ;
int x , y ;
x = y = 0 ;
wxSize size = GetSize() ;
parent->MacClientToRootWindow( &x , &y ) ;
extent.left = x ;
extent.top = y ;
extent.top-- ;
extent.right = x + size.x ;
extent.bottom = y + size.y ;
m_macBackgroundBrush.SetMacThemeBackground( kThemeBackgroundTabPane , extent ) ; // todo eventually change for inactive
break ; break ;
} }
} }
@@ -939,7 +951,7 @@ void wxWindowMac::OnNcPaint( wxNcPaintEvent& event )
wxMacDrawingHelper focus( this ) ; wxMacDrawingHelper focus( this ) ;
if ( focus.Ok() ) if ( focus.Ok() )
{ {
MacPaintBorders() ; MacPaintBorders( focus.GetOrigin().h , focus.GetOrigin().v) ;
} }
} }
@@ -1004,7 +1016,7 @@ void wxWindowMac::SetScrollPos(int orient, int pos, bool refresh)
} }
} }
void wxWindowMac::MacPaintBorders( ) void wxWindowMac::MacPaintBorders( int left , int top )
{ {
if( IsTopLevel() ) if( IsTopLevel() )
return ; return ;
@@ -1018,7 +1030,7 @@ void wxWindowMac::MacPaintBorders( )
if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) ) if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
{ {
#if wxMAC_USE_THEME_BORDER #if wxMAC_USE_THEME_BORDER
Rect rect = { 0 , 0 , m_height , m_width } ; Rect rect = { top , left , m_height + top , m_width + left } ;
SInt32 border = 0 ; SInt32 border = 0 ;
/* /*
GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ; GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
@@ -1030,38 +1042,38 @@ void wxWindowMac::MacPaintBorders( )
#else #else
bool sunken = HasFlag( wxSUNKEN_BORDER ) ; bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
RGBForeColor( &face ); RGBForeColor( &face );
MoveTo( 0 , m_height - 2 ); MoveTo( left + 0 , top + m_height - 2 );
LineTo( 0 , 0 ); LineTo( left + 0 , top + 0 );
LineTo( m_width - 2 , 0 ); LineTo( left + m_width - 2 , top + 0 );
MoveTo( 2 , m_height - 3 ); MoveTo( left + 2 , top + m_height - 3 );
LineTo( m_width - 3 , m_height - 3 ); LineTo( left + m_width - 3 , top + m_height - 3 );
LineTo( m_width - 3 , 2 ); LineTo( left + m_width - 3 , top + 2 );
RGBForeColor( sunken ? &face : &black ); RGBForeColor( sunken ? &face : &black );
MoveTo( 0 , m_height - 1 ); MoveTo( left + 0 , top + m_height - 1 );
LineTo( m_width - 1 , m_height - 1 ); LineTo( left + m_width - 1 , top + m_height - 1 );
LineTo( m_width - 1 , 0 ); LineTo( left + m_width - 1 , top + 0 );
RGBForeColor( sunken ? &shadow : &white ); RGBForeColor( sunken ? &shadow : &white );
MoveTo( 1 , m_height - 3 ); MoveTo( left + 1 , top + m_height - 3 );
LineTo( 1, 1 ); LineTo( left + 1, top + 1 );
LineTo( m_width - 3 , 1 ); LineTo( left + m_width - 3 , top + 1 );
RGBForeColor( sunken ? &white : &shadow ); RGBForeColor( sunken ? &white : &shadow );
MoveTo( 1 , m_height - 2 ); MoveTo( left + 1 , top + m_height - 2 );
LineTo( m_width - 2 , m_height - 2 ); LineTo( left + m_width - 2 , top + m_height - 2 );
LineTo( m_width - 2 , 1 ); LineTo( left + m_width - 2 , top + 1 );
RGBForeColor( sunken ? &black : &face ); RGBForeColor( sunken ? &black : &face );
MoveTo( 2 , m_height - 4 ); MoveTo( left + 2 , top + m_height - 4 );
LineTo( 2 , 2 ); LineTo( left + 2 , top + 2 );
LineTo( m_width - 4 , 2 ); LineTo( left + m_width - 4 , top + 2 );
#endif #endif
} }
else if (HasFlag(wxSIMPLE_BORDER)) else if (HasFlag(wxSIMPLE_BORDER))
{ {
Rect rect = { 0 , 0 , m_height , m_width } ; Rect rect = { top , left , m_height + top , m_width + left } ;
RGBForeColor( &black ) ; RGBForeColor( &black ) ;
FrameRect( &rect ) ; FrameRect( &rect ) ;
} }
@@ -1111,19 +1123,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
// Does a physical scroll // Does a physical scroll
void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
{ {
wxMacDrawingClientHelper focus( this ) ; wxMacDrawingHelper focus( this , true ) ;
if ( focus.Ok() ) if ( focus.Ok() )
{ {
int width , height ; int width , height ;
GetClientSize( &width , &height ) ; GetClientSize( &width , &height ) ;
Rect scrollrect = { 0 , 0 , height , width } ; Rect scrollrect = { 0 , 0 , height , width } ;
focus.LocalToWindow( &scrollrect ) ;
RgnHandle updateRgn = NewRgn() ; RgnHandle updateRgn = NewRgn() ;
ClipRect( &scrollrect ) ; ClipRect( &scrollrect ) ;
if ( rect ) if ( rect )
{ {
Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ; Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
focus.LocalToWindow( &r ) ;
SectRect( &scrollrect , &r , &scrollrect ) ; SectRect( &scrollrect , &r , &scrollrect ) ;
} }
ScrollRect( &scrollrect , dx , dy , updateRgn ) ; ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
@@ -1714,24 +1727,6 @@ void wxWindowMac::MacTopLevelWindowChangedPosition()
} }
} }
bool wxWindowMac::MacSetPortFocusParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
{
if ( window == NULL )
return false ;
GrafPtr currPort;
GrafPtr port ;
::GetPort(&currPort);
port = UMAGetWindowPort( window) ;
if (currPort != port )
::SetPort(port);
// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ;
::SetOrigin(-localOrigin.h, -localOrigin.v);
return true;
}
bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win ) bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win )
{ {
if ( window == NULL ) if ( window == NULL )
@@ -1743,9 +1738,9 @@ bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect
port = UMAGetWindowPort( window) ; port = UMAGetWindowPort( window) ;
if (currPort != port ) if (currPort != port )
::SetPort(port); ::SetPort(port);
// wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; Rect cr = clipRect ;
::SetOrigin(-localOrigin.h, -localOrigin.v); OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
::ClipRect(&clipRect); ::ClipRect(&cr);
::PenNormal() ; ::PenNormal() ;
::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ; ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
@@ -1773,27 +1768,9 @@ void wxWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef
SectRect(clipRect, &myClip, clipRect); SectRect(clipRect, &myClip, clipRect);
} }
void wxWindowMac::MacDoGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{
wxASSERT( GetParent() != NULL ) ;
GetParent()->MacDoGetPortClientParams( localOrigin , clipRect , window, rootwin) ;
localOrigin->h += m_x;
localOrigin->v += m_y;
OffsetRect(clipRect, -m_x, -m_y);
Rect myClip;
myClip.left = 0;
myClip.top = 0;
myClip.right = m_width ;//width;
myClip.bottom = m_height ;// height;
SectRect(clipRect, &myClip, clipRect);
}
void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin ) void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, WindowRef *window , wxWindowMac** rootwin )
{ {
MacDoGetPortClientParams( localOrigin , clipRect , window , rootwin ) ; MacGetPortParams( localOrigin , clipRect, window , rootwin ) ;
int width , height ; int width , height ;
GetClientSize( &width , &height ) ; GetClientSize( &width , &height ) ;
@@ -1804,11 +1781,7 @@ void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Win
localOrigin->v += client.y; localOrigin->v += client.y;
OffsetRect(clipRect, -client.x, -client.y); OffsetRect(clipRect, -client.x, -client.y);
Rect myClip; Rect myClip = { 0 , 0 , height , width } ;
myClip.left = 0;
myClip.top = 0;
myClip.right = width;
myClip.bottom = height;
SectRect(clipRect, &myClip, clipRect); SectRect(clipRect, &myClip, clipRect);
} }
@@ -1868,10 +1841,9 @@ long wxWindowMac::MacRemoveBordersFromStyle( long style )
} }
wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow ) wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow , bool clientArea )
{ {
m_ok = false ; m_ok = false ;
Point localOrigin ;
Rect clipRect ; Rect clipRect ;
WindowRef window ; WindowRef window ;
wxWindowMac *rootwin ; wxWindowMac *rootwin ;
@@ -1880,12 +1852,15 @@ wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
GetPort( &m_formerPort ) ; GetPort( &m_formerPort ) ;
if ( theWindow ) if ( theWindow )
{ {
theWindow->MacGetPortParams( &localOrigin , &clipRect , &window , &rootwin) ; if ( clientArea )
theWindow->MacGetPortClientParams( &m_origin , &clipRect , &window , &rootwin) ;
else
theWindow->MacGetPortParams( &m_origin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ; m_currentPort = UMAGetWindowPort( window ) ;
if ( m_formerPort != m_currentPort ) if ( m_formerPort != m_currentPort )
SetPort( m_currentPort ) ; SetPort( m_currentPort ) ;
GetPenState( &m_savedPenState ) ; GetPenState( &m_savedPenState ) ;
theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ; theWindow->MacSetPortDrawingParams( m_origin, clipRect, window , rootwin ) ;
m_ok = true ; m_ok = true ;
} }
} }
@@ -1896,46 +1871,6 @@ wxMacDrawingHelper::~wxMacDrawingHelper()
{ {
SetPort( m_currentPort ) ; SetPort( m_currentPort ) ;
SetPenState( &m_savedPenState ) ; SetPenState( &m_savedPenState ) ;
SetOrigin( 0 , 0 ) ;
Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ;
}
if ( m_formerPort != m_currentPort )
SetPort( m_formerPort ) ;
}
wxMacDrawingClientHelper::wxMacDrawingClientHelper( wxWindowMac * theWindow )
{
m_ok = false ;
Point localOrigin ;
Rect clipRect ;
WindowRef window ;
wxWindowMac *rootwin ;
m_currentPort = NULL ;
GetPort( &m_formerPort ) ;
if ( theWindow )
{
theWindow->MacGetPortClientParams( &localOrigin , &clipRect , &window , &rootwin) ;
m_currentPort = UMAGetWindowPort( window ) ;
if ( m_formerPort != m_currentPort )
SetPort( m_currentPort ) ;
GetPenState( &m_savedPenState ) ;
theWindow->MacSetPortDrawingParams( localOrigin, clipRect, window , rootwin ) ;
m_ok = true ;
}
}
wxMacDrawingClientHelper::~wxMacDrawingClientHelper()
{
if ( m_ok )
{
SetPort( m_currentPort ) ;
SetPenState( &m_savedPenState ) ;
SetOrigin( 0 , 0 ) ;
Rect portRect ; Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ; GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ; ClipRect( &portRect ) ;