]> git.saurik.com Git - wxWidgets.git/commitdiff
corrections for theme brush alignments under X (no more SetOrigin calls)
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 29 Dec 2001 09:59:59 +0000 (09:59 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 29 Dec 2001 09:59:59 +0000 (09:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13223 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

26 files changed:
src/mac/aga.cpp
src/mac/app.cpp
src/mac/brush.cpp
src/mac/carbon/aga.cpp
src/mac/carbon/app.cpp
src/mac/carbon/brush.cpp
src/mac/carbon/control.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/dcclient.cpp
src/mac/carbon/dcprint.cpp
src/mac/carbon/textctrl.cpp
src/mac/carbon/toolbar.cpp
src/mac/carbon/tooltip.cpp
src/mac/carbon/toplevel.cpp
src/mac/carbon/uma.cpp
src/mac/carbon/window.cpp
src/mac/control.cpp
src/mac/dc.cpp
src/mac/dcclient.cpp
src/mac/dcprint.cpp
src/mac/textctrl.cpp
src/mac/toolbar.cpp
src/mac/tooltip.cpp
src/mac/toplevel.cpp
src/mac/uma.cpp
src/mac/window.cpp

index 64827558b00742659d8f244a23b72ec7b4690d9d..59d5c154c0562945041c077a87b13a8274e18318 100644 (file)
@@ -2619,7 +2619,6 @@ AGAPortHelper::~AGAPortHelper()
                TextSize( size );
                TextFace( style );
                TextMode( mode );
                TextSize( size );
                TextFace( style );
                TextMode( mode );
-               SetOrigin( 0 , 0 ) ;
                SetPort( port ) ;
        }
 }
                SetPort( port ) ;
        }
 }
index 0257b8c6070640fad78cb421e475d6dd3ba6272f..1a02ff2e587aeacf24f0a864ab6d37b20b158502 100644 (file)
@@ -1161,7 +1161,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                     #else
                     SetPort( (window) ) ;
                     #endif
                     #else
                     SetPort( (window) ) ;
                     #endif
-                    SetOrigin( 0 , 0 ) ;
                     LocalToGlobal( &pt ) ;
                     SetPort( port ) ;
                         win->SetSize( pt.h , pt.v , -1 ,
                     LocalToGlobal( &pt ) ;
                     SetPort( port ) ;
                         win->SetSize( pt.h , pt.v , -1 ,
@@ -1232,7 +1231,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                     #else
                     SetPort( (window) ) ;
                     #endif
                     #else
                     SetPort( (window) ) ;
                     #endif
-                    SetOrigin( 0 , 0 ) ;
                     SetPort( port ) ;
                 }
                 if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
                     SetPort( port ) ;
                 }
                 if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
index bb7008a32d83cf5f7cbf6f91dd603a2b0acb16e3..36703d2cc70343537d8755f084eef1aece56a8e7 100644 (file)
@@ -24,8 +24,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
 wxBrushRefData::wxBrushRefData()
 {
     m_style = wxSOLID;
 wxBrushRefData::wxBrushRefData()
 {
     m_style = wxSOLID;
-    m_isMacTheme = false ;
-    m_isMacThemeBackground = false ;
+    m_macBrushKind = kwxMacBrushColour ;
 }
 
 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_stipple = data.m_stipple;
   m_colour = data.m_colour;
   m_style = data.m_style;
   m_stipple = data.m_stipple;
   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;
 
     RealizeResource();
     M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
 
     RealizeResource();
@@ -97,8 +98,7 @@ void wxBrush::Unshare()
 void wxBrush::SetColour(const wxColour& col)
 {
     Unshare();
 void wxBrush::SetColour(const wxColour& col)
 {
     Unshare();
-    M_BRUSHDATA->m_isMacTheme = false;
-    M_BRUSHDATA->m_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_colour = col;
 
     RealizeResource();
     M_BRUSHDATA->m_colour = col;
 
     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_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_colour.Set(r, g, b);
 
     RealizeResource();
     M_BRUSHDATA->m_colour.Set(r, g, b);
 
     RealizeResource();
@@ -119,8 +118,7 @@ void wxBrush::SetStyle(int Style)
 {
     Unshare();
 
 {
     Unshare();
 
-    M_BRUSHDATA->m_isMacTheme = false;
-    M_BRUSHDATA->m_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_style = Style;
 
     RealizeResource();
     M_BRUSHDATA->m_style = Style;
 
     RealizeResource();
@@ -130,6 +128,7 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
 {
     Unshare();
 
 {
     Unshare();
 
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_stipple = Stipple;
 
     RealizeResource();
     M_BRUSHDATA->m_stipple = Stipple;
 
     RealizeResource();
@@ -139,21 +138,19 @@ void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
 {
     Unshare();
 
 {
     Unshare();
 
-    M_BRUSHDATA->m_isMacTheme = true;
-    M_BRUSHDATA->m_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
     M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
 
     RealizeResource();
 }
 
     M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
 
     RealizeResource();
 }
 
-void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground)
+void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground, const Rect &extent)
 {
     Unshare();
 
 {
     Unshare();
 
-    M_BRUSHDATA->m_isMacTheme = false;
-    M_BRUSHDATA->m_isMacThemeBackground = true ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
     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 ;  
+  }
+}
+
index 64827558b00742659d8f244a23b72ec7b4690d9d..59d5c154c0562945041c077a87b13a8274e18318 100644 (file)
@@ -2619,7 +2619,6 @@ AGAPortHelper::~AGAPortHelper()
                TextSize( size );
                TextFace( style );
                TextMode( mode );
                TextSize( size );
                TextFace( style );
                TextMode( mode );
-               SetOrigin( 0 , 0 ) ;
                SetPort( port ) ;
        }
 }
                SetPort( port ) ;
        }
 }
index 0257b8c6070640fad78cb421e475d6dd3ba6272f..1a02ff2e587aeacf24f0a864ab6d37b20b158502 100644 (file)
@@ -1161,7 +1161,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                     #else
                     SetPort( (window) ) ;
                     #endif
                     #else
                     SetPort( (window) ) ;
                     #endif
-                    SetOrigin( 0 , 0 ) ;
                     LocalToGlobal( &pt ) ;
                     SetPort( port ) ;
                         win->SetSize( pt.h , pt.v , -1 ,
                     LocalToGlobal( &pt ) ;
                     SetPort( port ) ;
                         win->SetSize( pt.h , pt.v , -1 ,
@@ -1232,7 +1231,6 @@ void wxApp::MacHandleMouseDownEvent( EventRecord *ev )
                     #else
                     SetPort( (window) ) ;
                     #endif
                     #else
                     SetPort( (window) ) ;
                     #endif
-                    SetOrigin( 0 , 0 ) ;
                     SetPort( port ) ;
                 }
                 if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
                     SetPort( port ) ;
                 }
                 if ( window != frontWindow && wxTheApp->s_captureWindow == NULL )
index bb7008a32d83cf5f7cbf6f91dd603a2b0acb16e3..36703d2cc70343537d8755f084eef1aece56a8e7 100644 (file)
@@ -24,8 +24,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
 wxBrushRefData::wxBrushRefData()
 {
     m_style = wxSOLID;
 wxBrushRefData::wxBrushRefData()
 {
     m_style = wxSOLID;
-    m_isMacTheme = false ;
-    m_isMacThemeBackground = false ;
+    m_macBrushKind = kwxMacBrushColour ;
 }
 
 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_stipple = data.m_stipple;
   m_colour = data.m_colour;
   m_style = data.m_style;
   m_stipple = data.m_stipple;
   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;
 
     RealizeResource();
     M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
 
     RealizeResource();
@@ -97,8 +98,7 @@ void wxBrush::Unshare()
 void wxBrush::SetColour(const wxColour& col)
 {
     Unshare();
 void wxBrush::SetColour(const wxColour& col)
 {
     Unshare();
-    M_BRUSHDATA->m_isMacTheme = false;
-    M_BRUSHDATA->m_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_colour = col;
 
     RealizeResource();
     M_BRUSHDATA->m_colour = col;
 
     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_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_colour.Set(r, g, b);
 
     RealizeResource();
     M_BRUSHDATA->m_colour.Set(r, g, b);
 
     RealizeResource();
@@ -119,8 +118,7 @@ void wxBrush::SetStyle(int Style)
 {
     Unshare();
 
 {
     Unshare();
 
-    M_BRUSHDATA->m_isMacTheme = false;
-    M_BRUSHDATA->m_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_style = Style;
 
     RealizeResource();
     M_BRUSHDATA->m_style = Style;
 
     RealizeResource();
@@ -130,6 +128,7 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
 {
     Unshare();
 
 {
     Unshare();
 
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushColour;
     M_BRUSHDATA->m_stipple = Stipple;
 
     RealizeResource();
     M_BRUSHDATA->m_stipple = Stipple;
 
     RealizeResource();
@@ -139,21 +138,19 @@ void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
 {
     Unshare();
 
 {
     Unshare();
 
-    M_BRUSHDATA->m_isMacTheme = true;
-    M_BRUSHDATA->m_isMacThemeBackground = false ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushTheme;
     M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
 
     RealizeResource();
 }
 
     M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
 
     RealizeResource();
 }
 
-void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground)
+void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground, const Rect &extent)
 {
     Unshare();
 
 {
     Unshare();
 
-    M_BRUSHDATA->m_isMacTheme = false;
-    M_BRUSHDATA->m_isMacThemeBackground = true ;
+    M_BRUSHDATA->m_macBrushKind = kwxMacBrushThemeBackground;
     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 ;  
+  }
+}
+
index 946d01f263bf3d633722fdf044cfa215d411b618..1f62d46592cbce6a7308f326925c8a664db66bbf 100644 (file)
@@ -647,7 +647,6 @@ void wxControl::MacRedrawControl()
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
-                SetOrigin( 0 , 0 ) ;
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
@@ -667,7 +666,6 @@ void wxControl::OnPaint(wxPaintEvent& event)
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
-                SetOrigin( 0 , 0 ) ;
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
index 6d995bb99f1e11bbd84c68f78e2cf3af5057256e..8e930cd837837a1dcd3f09938017fae94ba107fa 100644 (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);
 
        m_macFontInstalled = false ;
        SetClip( m_macCurrentClipRgn);
 
        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 yy = YLOG2DEV(y);
+     wxCoord xx = XLOG2DEVMAC(x);
+     wxCoord yy = YLOG2DEVMAC(y);
      wxCoord w = bmp.GetWidth();
      wxCoord h = bmp.GetHeight();
      wxCoord ww = XLOG2DEVREL(w);
      wxCoord w = bmp.GetWidth();
      wxCoord h = bmp.GetHeight();
      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"));
     wxCoord xx, yy, ww, hh;
 
     wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion  Invalid DC"));
     wxCoord xx, yy, ww, hh;
 
-    xx = XLOG2DEV(x);
-    yy = YLOG2DEV(y);
+    xx = XLOG2DEVMAC(x);
+    yy = YLOG2DEVMAC(y);
     ww = XLOG2DEVREL(width);
     hh = YLOG2DEVREL(height);
 
     ww = XLOG2DEVREL(width);
     hh = YLOG2DEVREL(height);
 
@@ -278,8 +276,8 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
     region.GetBox( x, y, w, h );
     wxCoord xx, yy, ww, hh;
 
     region.GetBox( x, y, w, h );
     wxCoord xx, yy, ww, hh;
 
-    xx = XLOG2DEV(x);
-    yy = YLOG2DEV(y);
+    xx = XLOG2DEVMAC(x);
+    yy = YLOG2DEVMAC(y);
     ww = XLOG2DEVREL(w);
     hh = YLOG2DEVREL(h);
 
     ww = XLOG2DEVREL(w);
     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
     col->Set( colour.red   >> 8,
 
     // Convert from Mac colour to wx
     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 :
                             m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
 
                wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
                             m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
 
-        wxCoord xx1 = XLOG2DEV(x1) - offset;
-        wxCoord yy1 = YLOG2DEV(y1) - offset;
-        wxCoord xx2 = XLOG2DEV(x2) - offset;
-        wxCoord yy2 = YLOG2DEV(y2) - offset;
+        wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
+        wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
+        wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
+        wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
 
         if ((m_pen.GetCap() == wxCAP_ROUND) &&
             (m_pen.GetWidth() <= 1))
 
         if ((m_pen.GetCap() == wxCAP_ROUND) &&
             (m_pen.GetWidth() <= 1))
@@ -593,14 +591,14 @@ void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
         int w = 0;
         int h = 0;
         GetSize( &w, &h );
         int w = 0;
         int h = 0;
         GetSize( &w, &h );
-        wxCoord xx = XLOG2DEV(x);
-        wxCoord yy = YLOG2DEV(y);
+        wxCoord xx = XLOG2DEVMAC(x);
+        wxCoord yy = YLOG2DEVMAC(y);
 
         MacInstallPen();
 
         MacInstallPen();
-        ::MoveTo( 0, yy );
-        ::LineTo( XLOG2DEVREL(w), yy );
-        ::MoveTo( xx, 0 );
-        ::LineTo( xx, YLOG2DEVREL(h) );
+        ::MoveTo( XLOG2DEVMAC(0), yy );
+        ::LineTo( XLOG2DEVMAC(w), yy );
+        ::MoveTo( xx, YLOG2DEVMAC(0) );
+        ::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 yy1 = YLOG2DEV(y1);
-    wxCoord xx2 = XLOG2DEV(x2);
-    wxCoord yy2 = YLOG2DEV(y2);
-    wxCoord xxc = XLOG2DEV(xc);
-    wxCoord yyc = YLOG2DEV(yc);
+    wxCoord xx1 = XLOG2DEVMAC(x1);
+    wxCoord yy1 = YLOG2DEVMAC(y1);
+    wxCoord xx2 = XLOG2DEVMAC(x2);
+    wxCoord yy2 = YLOG2DEVMAC(y2);
+    wxCoord xxc = XLOG2DEVMAC(xc);
+    wxCoord yyc = YLOG2DEVMAC(yc);
     double dx = xx1 - xxc;
     double dy = yy1 - yyc;
     double radius = sqrt((double)(dx*dx+dy*dy));
     double dx = xx1 - xxc;
     double dy = yy1 - yyc;
     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;
     double angle = sa - ea;  // Order important Mac in opposite direction to wx
  
     Rect r;
     double angle = sa - ea;  // Order important Mac in opposite direction to wx
  
-    wxCoord xx = XLOG2DEV(x);
-    wxCoord yy = YLOG2DEV(y);
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
     wxCoord ww = m_signX * XLOG2DEVREL(w);
     wxCoord hh = m_signY * YLOG2DEVREL(h);
 
     wxCoord ww = m_signX * XLOG2DEVREL(w);
     wxCoord hh = m_signY * YLOG2DEVREL(h);
 
@@ -736,8 +734,8 @@ void  wxDC::DoDrawPoint( wxCoord x, wxCoord y )
   if (m_pen.GetStyle() != wxTRANSPARENT) 
   {
                MacInstallPen() ;
   if (m_pen.GetStyle() != wxTRANSPARENT) 
   {
                MacInstallPen() ;
-        wxCoord xx1 = XLOG2DEV(x); 
-        wxCoord yy1 = YLOG2DEV(y);
+        wxCoord xx1 = XLOG2DEVMAC(x); 
+        wxCoord yy1 = YLOG2DEVMAC(y);
        
                ::MoveTo(xx1,yy1);
                ::LineTo(xx1+1, yy1+1);
        
                ::MoveTo(xx1,yy1);
                ::LineTo(xx1+1, yy1+1);
@@ -759,14 +757,14 @@ void  wxDC::DoDrawLines(int n, wxPoint points[],
                       m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
 
   wxCoord x1, x2 , y1 , y2 ;
                       m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
 
   wxCoord x1, x2 , y1 , y2 ;
-  x1 = XLOG2DEV(points[0].x + xoffset);
-  y1 = YLOG2DEV(points[0].y + yoffset);   
+  x1 = XLOG2DEVMAC(points[0].x + xoffset);
+  y1 = YLOG2DEVMAC(points[0].y + yoffset);   
   ::MoveTo(x1 - offset, y1 - offset );
   
   for (int i = 0; i < n-1; i++)
   {
   ::MoveTo(x1 - offset, y1 - offset );
   
   for (int i = 0; i < n-1; i++)
   {
-    x2 = XLOG2DEV(points[i+1].x + xoffset);
-    y2 = YLOG2DEV(points[i+1].y + yoffset);
+    x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+    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);
-               y1 = YLOG2DEV(points[0].y + yoffset);   
+               x1 = XLOG2DEVMAC(points[0].x + xoffset);
+               y1 = YLOG2DEVMAC(points[0].y + yoffset);   
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
-               x2 = XLOG2DEV(points[i+1].x + xoffset);
-               y2 = YLOG2DEV(points[i+1].y + yoffset);
+               x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+               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);
-               y1 = YLOG2DEV(points[0].y + yoffset);   
+               x1 = XLOG2DEVMAC(points[0].x + xoffset);
+               y1 = YLOG2DEVMAC(points[0].y + yoffset);   
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
-               x2 = XLOG2DEV(points[i+1].x + xoffset);
-               y2 = YLOG2DEV(points[i+1].y + yoffset);
+               x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+               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"));
     wxMacPortSetter helper(this) ;
 
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
 
-       wxCoord xx = XLOG2DEV(x);
-       wxCoord yy = YLOG2DEV(y);
+       wxCoord xx = XLOG2DEVMAC(x);
+       wxCoord yy = YLOG2DEVMAC(y);
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
        
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
        
@@ -882,8 +880,8 @@ void  wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
     if (radius < 0.0) 
            radius = - radius * ((width < height) ? width : height);
        
     if (radius < 0.0) 
            radius = - radius * ((width < height) ? width : height);
        
-       wxCoord xx = XLOG2DEV(x);
-       wxCoord yy = YLOG2DEV(y);
+       wxCoord xx = XLOG2DEVMAC(x);
+       wxCoord yy = YLOG2DEVMAC(y);
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
        
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        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"));
     wxMacPortSetter helper(this) ;
 
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
 
-       wxCoord xx = XLOG2DEV(x);
-       wxCoord yy = YLOG2DEV(y);
+       wxCoord xx = XLOG2DEVMAC(x);
+       wxCoord yy = YLOG2DEVMAC(y);
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
 
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
 
@@ -995,14 +993,14 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
        if ( LockPixels(bmappixels) )
        {
                Rect srcrect , dstrect ;
        if ( LockPixels(bmappixels) )
        {
                Rect srcrect , dstrect ;
-               srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ;
-               srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ;
-               srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v;
-               srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h;
-               dstrect.top = YLOG2DEV(ydest) ;
-               dstrect.left = XLOG2DEV(xdest) ;
-               dstrect.bottom = YLOG2DEV(ydest + height )  ;
-               dstrect.right = XLOG2DEV(xdest + width ) ;
+               srcrect.top = source->YLOG2DEVMAC(ysrc) ;
+               srcrect.left = source->XLOG2DEVMAC(xsrc)  ;
+               srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
+               srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
+               dstrect.top = YLOG2DEVMAC(ydest) ;
+               dstrect.left = XLOG2DEVMAC(xdest) ;
+               dstrect.bottom = YLOG2DEVMAC(ydest + height )  ;
+               dstrect.right = XLOG2DEVMAC(xdest + width ) ;
 
        short  mode = (logical_func == wxCOPY ? srcCopy :
  //    logical_func == wxCLEAR ? WHITENESS :
 
        short  mode = (logical_func == wxCOPY ? srcCopy :
  //    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;
             if ( textPixel || (m_backgroundMode == wxSOLID) )
             {
             textPixel = data[(srcY*w + srcX)*3] == 0;
             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 ( m_font.GetUnderlined() )
     {
 #if 0
     if ( m_font.GetUnderlined() )
     {
-        ::MoveTo(XLOG2DEV(x + x4), YLOG2DEV(y + y4 + font->descent));
-        ::LineTo(XLOG2DEV(x + x3), YLOG2DEV(y + y3 + font->descent));
+        ::MoveTo(XLOG2DEVMAC(x + x4), YLOG2DEVMAC(y + y4 + 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"));
     wxMacPortSetter helper(this) ;
 
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText  Invalid DC"));
     wxMacPortSetter helper(this) ;
 
-       long xx = XLOG2DEV(x);
-       long yy = YLOG2DEV(y);
+       long xx = XLOG2DEVMAC(x);
+       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() )
-       {
-           SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
-       }
-       else if ( background.IsMacThemeBackground() )
-       {
-           Rect originBox = { 0,0,1,1 } ;
-           ::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive , 
-               wxDisplayDepth() , true ) ;
-       }
-       else
-       {
-       ::RGBBackColor( &background.GetColour().GetPixel() );
-       int brushStyle = background.GetStyle();
-       if (brushStyle == wxSOLID)
-               ::BackPat(GetQDGlobalsWhite(&whiteColor));
-       else if (IS_HATCH(brushStyle))
-       {
-               Pattern pat ;
-               wxMacGetHatchPattern(brushStyle, &pat);
-               ::BackPat(&pat);
-       }
-       else
-       {
-               ::BackPat(GetQDGlobalsWhite(&whiteColor));
-       }
-       }
-       return 0 ;
+    switch( background.MacGetBrushKind() )
+    {
+      case kwxMacBrushTheme :
+        {
+               ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
+          break ;
+        }
+      case kwxMacBrushThemeBackground :
+        {
+               Rect extent ;
+               ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
+               ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
+          break ;
+        }
+      case kwxMacBrushColour :
+        {
+                 ::RGBBackColor( &background.GetColour().GetPixel() );
+               int brushStyle = background.GetStyle();
+               if (brushStyle == wxSOLID)
+                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
+               else if (IS_HATCH(brushStyle))
+               {
+                       Pattern pat ;
+                       wxMacGetHatchPattern(brushStyle, &pat);
+                       ::BackPat(&pat);
+               }
+               else
+               {
+                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
+               }
+          break ;
+        }
+    }
 }
 
 void wxDC::MacInstallBrush() const
 }
 
 void wxDC::MacInstallBrush() const
index c90d675f8dad8e567b7464e179484aa0d003930c..6312bc3c82660d8115ef6a2fb63f7df2ef7da2f1 100644 (file)
@@ -55,6 +55,7 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
        SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
        SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
        SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
        SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+       OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_minY = m_minX =  0;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        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 ) ;
        SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -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 ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+       OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_minY = m_minX =  0;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_minY = m_minX =  0;
@@ -126,6 +128,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
        SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
   SectRgn( m_macBoundaryClipRgn  , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
   SectRgn( m_macBoundaryClipRgn  , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+       OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_ok = TRUE ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_ok = TRUE ;
index 274c90957a041c52db50286e3a8f9328feec4386..36d8757f67cd1e7f9b410b588de725c0608b510d 100644 (file)
@@ -237,7 +237,6 @@ void wxPrinterDC::StartPage(void)
        m_macLocalOrigin.h =  (**m_printData.m_macPrintInfo).rPaper.left ;
        m_macLocalOrigin.v =  (**m_printData.m_macPrintInfo).rPaper.top ;
        
        m_macLocalOrigin.h =  (**m_printData.m_macPrintInfo).rPaper.left ;
        m_macLocalOrigin.v =  (**m_printData.m_macPrintInfo).rPaper.top ;
        
-       SetOrigin(  - m_macLocalOrigin.h , - m_macLocalOrigin.v  ) ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
        err = PrError() ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
        err = PrError() ;
index ea632f896471b33c71913c19a2cedd9952e2ea72..5ac79c57355acde54d8981ff9cd5556eabc68a82 100644 (file)
@@ -187,7 +187,6 @@ void wxTextCtrl::SetValue(const wxString& st)
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
-            SetOrigin( 0 , 0 ) ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
@@ -263,7 +262,6 @@ void wxTextCtrl::Paste()
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
-                SetOrigin( 0 , 0 ) ;
                 
                 bool            hasTabBehind = false ;
                 wxWindow* parent = GetParent() ;
                 
                 bool            hasTabBehind = false ;
                 wxWindow* parent = GetParent() ;
@@ -1895,7 +1893,6 @@ void wxTextCtrl::SetValue(const wxString& st)
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
-            SetOrigin( 0 , 0 ) ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
@@ -1986,9 +1983,7 @@ void wxTextCtrl::Paste()
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
-                               // the mac control manager always assumes to have the origin at 0,0
-                               SetOrigin( 0 , 0 ) ;
-                               
+                               // the mac control manager always assumes to have the origin at 0,0                             
                                bool                    hasTabBehind = false ;
                                wxWindow* parent = GetParent() ;
                                while ( parent )
                                bool                    hasTabBehind = false ;
                                wxWindow* parent = GetParent() ;
                                while ( parent )
index bcf2beb0003606c37b9e42a30c222b4a0e9f1cf7..86020f988be8582a26d5fb2b7743d48bfc92fe63 100644 (file)
@@ -588,8 +588,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
        {
                wxMacDrawingHelper help( win ) ;
                // the mac control manager always assumes to have the origin at 0,0
        {
                wxMacDrawingHelper help( win ) ;
                // the mac control manager always assumes to have the origin at 0,0
-               SetOrigin( 0 , 0 ) ;
-               
                bool                    hasTabBehind = false ;
                wxWindow* parent = GetParent() ;
                while ( parent )
                bool                    hasTabBehind = false ;
                wxWindow* parent = GetParent() ;
                while ( parent )
index 5f938dcfb59025ebbe33b1ba37c0c3b769a9e6d3..45877f9a1c3098cc472a71a79e22aa9c77159219 100644 (file)
@@ -226,7 +226,6 @@ void wxMacToolTip::Draw()
                #endif
                m_shown = true ;
 
                #endif
                m_shown = true ;
 
-               SetOrigin( 0 , 0 ) ;
                TextFont( kFontIDGeneva ) ;
                TextSize( 10 ) ;
                TextFace( 0 ) ;
                TextFont( kFontIDGeneva ) ;
                TextSize( 10 ) ;
                TextFace( 0 ) ;
@@ -333,7 +332,6 @@ void wxMacToolTip::Clear()
                #endif
                m_shown = false ;
 
                #endif
                m_shown = false ;
 
-               SetOrigin( 0 , 0 ) ;
                BackColor( whiteColor ) ;
                ForeColor(blackColor ) ;
                DrawPicture(m_backpict, &m_rect);
                BackColor( whiteColor ) ;
                ForeColor(blackColor ) ;
                DrawPicture(m_backpict, &m_rect);
index b29a256276b3d6e7178aaad70d20a78b2e2deb49..b952c7cea2db8803de0361278bad08197ae1756e 100644 (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) 
 {
     localOrigin->h = 0;
 void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window  , wxWindowMac** rootwin) 
 {
     localOrigin->h = 0;
@@ -305,13 +293,7 @@ void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, W
 
 void wxTopLevelWindowMac::Clear()
 {
 
 void wxTopLevelWindowMac::Clear()
 {
-    wxMacDrawingClientHelper helper ( this ) ;
-    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 ) ;
+  wxWindow::Clear() ;
 }
 
 ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding() 
 }
 
 ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding() 
@@ -327,7 +309,6 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
     #else
     AGAPortHelper help( (m_macWindow) ) ;
     #endif
     #else
     AGAPortHelper help( (m_macWindow) ) ;
     #endif
-    SetOrigin( 0 , 0 ) ;
     BeginUpdate( m_macWindow ) ;
 
     RgnHandle       updateRgn = NewRgn();    
     BeginUpdate( m_macWindow ) ;
 
     RgnHandle       updateRgn = NewRgn();    
index 25a90e1ec5d7beb975cca976ec11a5122100d15d..91203d7176bb397af194174ef66534a87c61adf9 100644 (file)
@@ -497,7 +497,6 @@ OSErr UMASetKeyboardFocus                           (WindowPtr                              inWindow,
 
        SetPortWindowPort( inWindow ) ;
 
 
        SetPortWindowPort( inWindow ) ;
 
-       SetOrigin( 0 , 0 ) ;
   err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
        SetPort( port ) ;
        return err ;
   err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
        SetPort( port ) ;
        return err ;
@@ -549,7 +548,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
                GrafPtr port ;
                GetPort( &port ) ;
                SetPortWindowPort( inWindowRef ) ;
                GrafPtr port ;
                GetPort( &port ) ;
                SetPortWindowPort( inWindowRef ) ;
-               SetOrigin( 0 , 0 ) ;
                HiliteWindow( inWindowRef , inActivate ) ;
                ControlHandle control = NULL ;
                ::GetRootControl( inWindowRef , & control ) ;
                HiliteWindow( inWindowRef , inActivate ) ;
                ControlHandle control = NULL ;
                ::GetRootControl( inWindowRef , & control ) ;
index dfd0938dd9570bc83beef13f5ce803e8015cbd92..06788f0b9dd5c0f9745ce73001659e03bba63659 100644 (file)
@@ -366,7 +366,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
     GrafPtr     port ;  
     ::GetPort( &port ) ;
     ::SetPort( UMAGetWindowPort( window ) ) ;
     GrafPtr     port ;  
     ::GetPort( &port ) ;
     ::SetPort( UMAGetWindowPort( window ) ) ;
-    ::SetOrigin( 0 , 0 ) ;
+
     ::LocalToGlobal( &localwhere ) ;
     ::SetPort( port ) ;
     if(x)   *x = localwhere.h ;
     ::LocalToGlobal( &localwhere ) ;
     ::SetPort( port ) ;
     if(x)   *x = localwhere.h ;
@@ -560,6 +560,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         if ( focus.Ok() )
         {
             Rect clientrect = { 0 , 0 , m_height , m_width } ;
         if ( focus.Ok() )
         {
             Rect clientrect = { 0 , 0 , m_height , m_width } ;
+            focus.LocalToWindow( &clientrect ) ;
             // ClipRect( &clientrect ) ;
             InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
         }
             // ClipRect( &clientrect ) ;
             InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
         }
@@ -575,6 +576,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
             if ( focus.Ok() )
             {
                 Rect clientrect = { 0 , 0 , m_height , m_width } ;
             if ( focus.Ok() )
             {
                 Rect clientrect = { 0 , 0 , m_height , m_width } ;
+                focus.LocalToWindow( &clientrect ) ;
                 // ClipRect( &clientrect ) ;
                 InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
             }
                 // ClipRect( &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 ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                     {
                     // 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 ) ))
                     {
-                        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 ) ;
     if ( focus.Ok() )
     {
     wxMacDrawingHelper focus( this ) ;
     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() )
         return ;
 {
     if( IsTopLevel() )
         return ;
@@ -1018,7 +1030,7 @@ void wxWindowMac::MacPaintBorders( )
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
     {
 #if wxMAC_USE_THEME_BORDER
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_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 ;
                  /*
                  GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
                  SInt32 border = 0 ;
                  /*
                  GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
@@ -1030,38 +1042,38 @@ void wxWindowMac::MacPaintBorders( )
 #else
        bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
         RGBForeColor( &face );
 #else
        bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
         RGBForeColor( &face );
-        MoveTo( 0 , m_height - 2 );
-        LineTo( 0 , 0 );
-        LineTo( m_width - 2 , 0 );
+        MoveTo( left + 0 , top + m_height - 2 );
+        LineTo( left + 0 , top + 0 );
+        LineTo( left + m_width - 2 , top + 0 );
 
 
-        MoveTo( 2 , m_height - 3 );
-        LineTo( m_width - 3 , m_height - 3 );
-        LineTo( m_width - 3 , 2 );
+        MoveTo( left + 2 , top + m_height - 3 );
+        LineTo( left + m_width - 3 , top + m_height - 3 );
+        LineTo( left + m_width - 3 , top + 2 );
 
         RGBForeColor( sunken ? &face : &black );
 
         RGBForeColor( sunken ? &face : &black );
-        MoveTo( 0 , m_height - 1 );
-        LineTo( m_width - 1 , m_height - 1 );
-        LineTo( m_width - 1 , 0 );
+        MoveTo( left + 0 , top + m_height - 1 );
+        LineTo( left + m_width - 1 , top + m_height - 1 );
+        LineTo( left + m_width - 1 , top + 0 );
 
         RGBForeColor( sunken ? &shadow : &white );
 
         RGBForeColor( sunken ? &shadow : &white );
-        MoveTo( 1 , m_height - 3 );
-        LineTo( 1, 1 );
-        LineTo( m_width - 3 , 1 );
+        MoveTo( left + 1 , top + m_height - 3 );
+        LineTo( left + 1, top + 1 );
+        LineTo( left + m_width - 3 , top + 1 );
 
         RGBForeColor( sunken ? &white : &shadow );
 
         RGBForeColor( sunken ? &white : &shadow );
-        MoveTo( 1 , m_height - 2 );
-        LineTo( m_width - 2 , m_height - 2 );
-        LineTo( m_width - 2 , 1 );
+        MoveTo( left + 1 , top + m_height - 2 );
+        LineTo( left + m_width - 2 , top + m_height - 2 );
+        LineTo( left + m_width - 2 , top + 1 );
 
         RGBForeColor( sunken ? &black : &face );
 
         RGBForeColor( sunken ? &black : &face );
-        MoveTo( 2 , m_height - 4 );
-        LineTo( 2 , 2 );
-        LineTo( m_width - 4 , 2 );
+        MoveTo( left + 2 , top + m_height - 4 );
+        LineTo( left + 2 , top + 2 );
+        LineTo( left + m_width - 4 , top + 2 );
 #endif
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
 #endif
     }
     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 ) ;
         FrameRect( &rect ) ;
     }
         RGBForeColor( &black ) ;
         FrameRect( &rect ) ;
     }
@@ -1111,19 +1123,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
 // Does a physical scroll
 void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
 // Does a physical scroll
 void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
-    wxMacDrawingClientHelper focus( this ) ;
+    wxMacDrawingHelper focus( this , true ) ;
     if ( focus.Ok() )
     {
         int width , height ;
         GetClientSize( &width , &height ) ;
 
         Rect scrollrect = { 0 , 0 , height , width } ;
     if ( focus.Ok() )
     {
         int width , height ;
         GetClientSize( &width , &height ) ;
 
         Rect scrollrect = { 0 , 0 , height , width } ;
-    
+        focus.LocalToWindow( &scrollrect ) ;
         RgnHandle updateRgn = NewRgn() ;
         ClipRect( &scrollrect ) ;
         if ( rect )
         {
             Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
         RgnHandle updateRgn = NewRgn() ;
         ClipRect( &scrollrect ) ;
         if ( rect )
         {
             Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+            focus.LocalToWindow( &r ) ;
             SectRect( &scrollrect , &r , &scrollrect ) ;        
         }
         ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
             SectRect( &scrollrect , &r , &scrollrect ) ;        
         }
         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 ) 
 {
     if ( window == NULL )
 bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win ) 
 {
     if ( window == NULL )
@@ -1743,9 +1738,9 @@ bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect
     port = UMAGetWindowPort( window) ;
     if (currPort != port )
             ::SetPort(port);
     port = UMAGetWindowPort( window) ;
     if (currPort != port )
             ::SetPort(port);
-//  wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; 
-    ::SetOrigin(-localOrigin.h, -localOrigin.v);
-    ::ClipRect(&clipRect);
+    Rect cr = clipRect ;
+    OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
+    ::ClipRect(&cr);
 
     ::PenNormal() ;
     ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
 
     ::PenNormal() ;
     ::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 ;
     GetClientSize( &width , &height ) ;
 
     int width , height ;
     GetClientSize( &width , &height ) ;
@@ -1804,11 +1781,7 @@ void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Win
     localOrigin->v += client.y;
     OffsetRect(clipRect, -client.x, -client.y);
 
     localOrigin->v += client.y;
     OffsetRect(clipRect, -client.x, -client.y);
 
-    Rect myClip;
-    myClip.left = 0;
-    myClip.top = 0;
-    myClip.right = width;
-    myClip.bottom = height;
+    Rect myClip = { 0 , 0 , height , width } ;
     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 ;
     WindowRef window ;
     wxWindowMac *rootwin ;
     Rect clipRect ;
     WindowRef window ;
     wxWindowMac *rootwin ;
@@ -1880,12 +1852,15 @@ wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
     GetPort( &m_formerPort ) ;
     if ( theWindow )
     {
     GetPort( &m_formerPort ) ;
     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 ) ;
         if ( m_formerPort != m_currentPort )
             SetPort( m_currentPort ) ;
         GetPenState( &m_savedPenState ) ;
         m_currentPort = UMAGetWindowPort( window ) ;
         if ( m_formerPort != m_currentPort )
             SetPort( m_currentPort ) ;
         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 ) ;
         SetPenState( &m_savedPenState ) ;
     {
         SetPort( m_currentPort ) ;
         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 ;
         GetPortBounds( m_currentPort , &portRect ) ;
         ClipRect( &portRect ) ;
         Rect portRect ;
         GetPortBounds( m_currentPort , &portRect ) ;
         ClipRect( &portRect ) ;
index 946d01f263bf3d633722fdf044cfa215d411b618..1f62d46592cbce6a7308f326925c8a664db66bbf 100644 (file)
@@ -647,7 +647,6 @@ void wxControl::MacRedrawControl()
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
-                SetOrigin( 0 , 0 ) ;
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
@@ -667,7 +666,6 @@ void wxControl::OnPaint(wxPaintEvent& event)
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
-                SetOrigin( 0 , 0 ) ;
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
                 wxDC::MacSetupBackgroundForCurrentPort( MacGetBackgroundBrush() ) ;
                 UMADrawControl( m_macControl ) ;
             }
index 6d995bb99f1e11bbd84c68f78e2cf3af5057256e..8e930cd837837a1dcd3f09938017fae94ba107fa 100644 (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);
 
        m_macFontInstalled = false ;
        SetClip( m_macCurrentClipRgn);
 
        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 yy = YLOG2DEV(y);
+     wxCoord xx = XLOG2DEVMAC(x);
+     wxCoord yy = YLOG2DEVMAC(y);
      wxCoord w = bmp.GetWidth();
      wxCoord h = bmp.GetHeight();
      wxCoord ww = XLOG2DEVREL(w);
      wxCoord w = bmp.GetWidth();
      wxCoord h = bmp.GetHeight();
      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"));
     wxCoord xx, yy, ww, hh;
 
     wxCHECK_RET(Ok(), wxT("wxDC::DoSetClippingRegion  Invalid DC"));
     wxCoord xx, yy, ww, hh;
 
-    xx = XLOG2DEV(x);
-    yy = YLOG2DEV(y);
+    xx = XLOG2DEVMAC(x);
+    yy = YLOG2DEVMAC(y);
     ww = XLOG2DEVREL(width);
     hh = YLOG2DEVREL(height);
 
     ww = XLOG2DEVREL(width);
     hh = YLOG2DEVREL(height);
 
@@ -278,8 +276,8 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region  )
     region.GetBox( x, y, w, h );
     wxCoord xx, yy, ww, hh;
 
     region.GetBox( x, y, w, h );
     wxCoord xx, yy, ww, hh;
 
-    xx = XLOG2DEV(x);
-    yy = YLOG2DEV(y);
+    xx = XLOG2DEVMAC(x);
+    yy = YLOG2DEVMAC(y);
     ww = XLOG2DEVREL(w);
     hh = YLOG2DEVREL(h);
 
     ww = XLOG2DEVREL(w);
     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
     col->Set( colour.red   >> 8,
 
     // Convert from Mac colour to wx
     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 :
                             m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
 
                wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
                             m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2;
 
-        wxCoord xx1 = XLOG2DEV(x1) - offset;
-        wxCoord yy1 = YLOG2DEV(y1) - offset;
-        wxCoord xx2 = XLOG2DEV(x2) - offset;
-        wxCoord yy2 = YLOG2DEV(y2) - offset;
+        wxCoord xx1 = XLOG2DEVMAC(x1) - offset;
+        wxCoord yy1 = YLOG2DEVMAC(y1) - offset;
+        wxCoord xx2 = XLOG2DEVMAC(x2) - offset;
+        wxCoord yy2 = YLOG2DEVMAC(y2) - offset;
 
         if ((m_pen.GetCap() == wxCAP_ROUND) &&
             (m_pen.GetWidth() <= 1))
 
         if ((m_pen.GetCap() == wxCAP_ROUND) &&
             (m_pen.GetWidth() <= 1))
@@ -593,14 +591,14 @@ void  wxDC::DoCrossHair( wxCoord x, wxCoord y )
         int w = 0;
         int h = 0;
         GetSize( &w, &h );
         int w = 0;
         int h = 0;
         GetSize( &w, &h );
-        wxCoord xx = XLOG2DEV(x);
-        wxCoord yy = YLOG2DEV(y);
+        wxCoord xx = XLOG2DEVMAC(x);
+        wxCoord yy = YLOG2DEVMAC(y);
 
         MacInstallPen();
 
         MacInstallPen();
-        ::MoveTo( 0, yy );
-        ::LineTo( XLOG2DEVREL(w), yy );
-        ::MoveTo( xx, 0 );
-        ::LineTo( xx, YLOG2DEVREL(h) );
+        ::MoveTo( XLOG2DEVMAC(0), yy );
+        ::LineTo( XLOG2DEVMAC(w), yy );
+        ::MoveTo( xx, YLOG2DEVMAC(0) );
+        ::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 yy1 = YLOG2DEV(y1);
-    wxCoord xx2 = XLOG2DEV(x2);
-    wxCoord yy2 = YLOG2DEV(y2);
-    wxCoord xxc = XLOG2DEV(xc);
-    wxCoord yyc = YLOG2DEV(yc);
+    wxCoord xx1 = XLOG2DEVMAC(x1);
+    wxCoord yy1 = YLOG2DEVMAC(y1);
+    wxCoord xx2 = XLOG2DEVMAC(x2);
+    wxCoord yy2 = YLOG2DEVMAC(y2);
+    wxCoord xxc = XLOG2DEVMAC(xc);
+    wxCoord yyc = YLOG2DEVMAC(yc);
     double dx = xx1 - xxc;
     double dy = yy1 - yyc;
     double radius = sqrt((double)(dx*dx+dy*dy));
     double dx = xx1 - xxc;
     double dy = yy1 - yyc;
     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;
     double angle = sa - ea;  // Order important Mac in opposite direction to wx
  
     Rect r;
     double angle = sa - ea;  // Order important Mac in opposite direction to wx
  
-    wxCoord xx = XLOG2DEV(x);
-    wxCoord yy = YLOG2DEV(y);
+    wxCoord xx = XLOG2DEVMAC(x);
+    wxCoord yy = YLOG2DEVMAC(y);
     wxCoord ww = m_signX * XLOG2DEVREL(w);
     wxCoord hh = m_signY * YLOG2DEVREL(h);
 
     wxCoord ww = m_signX * XLOG2DEVREL(w);
     wxCoord hh = m_signY * YLOG2DEVREL(h);
 
@@ -736,8 +734,8 @@ void  wxDC::DoDrawPoint( wxCoord x, wxCoord y )
   if (m_pen.GetStyle() != wxTRANSPARENT) 
   {
                MacInstallPen() ;
   if (m_pen.GetStyle() != wxTRANSPARENT) 
   {
                MacInstallPen() ;
-        wxCoord xx1 = XLOG2DEV(x); 
-        wxCoord yy1 = YLOG2DEV(y);
+        wxCoord xx1 = XLOG2DEVMAC(x); 
+        wxCoord yy1 = YLOG2DEVMAC(y);
        
                ::MoveTo(xx1,yy1);
                ::LineTo(xx1+1, yy1+1);
        
                ::MoveTo(xx1,yy1);
                ::LineTo(xx1+1, yy1+1);
@@ -759,14 +757,14 @@ void  wxDC::DoDrawLines(int n, wxPoint points[],
                       m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
 
   wxCoord x1, x2 , y1 , y2 ;
                       m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
 
   wxCoord x1, x2 , y1 , y2 ;
-  x1 = XLOG2DEV(points[0].x + xoffset);
-  y1 = YLOG2DEV(points[0].y + yoffset);   
+  x1 = XLOG2DEVMAC(points[0].x + xoffset);
+  y1 = YLOG2DEVMAC(points[0].y + yoffset);   
   ::MoveTo(x1 - offset, y1 - offset );
   
   for (int i = 0; i < n-1; i++)
   {
   ::MoveTo(x1 - offset, y1 - offset );
   
   for (int i = 0; i < n-1; i++)
   {
-    x2 = XLOG2DEV(points[i+1].x + xoffset);
-    y2 = YLOG2DEV(points[i+1].y + yoffset);
+    x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+    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);
-               y1 = YLOG2DEV(points[0].y + yoffset);   
+               x1 = XLOG2DEVMAC(points[0].x + xoffset);
+               y1 = YLOG2DEVMAC(points[0].y + yoffset);   
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
-               x2 = XLOG2DEV(points[i+1].x + xoffset);
-               y2 = YLOG2DEV(points[i+1].y + yoffset);
+               x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+               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);
-               y1 = YLOG2DEV(points[0].y + yoffset);   
+               x1 = XLOG2DEVMAC(points[0].x + xoffset);
+               y1 = YLOG2DEVMAC(points[0].y + yoffset);   
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
                ::MoveTo(x1,y1);
   
                for (int i = 0; i < n-1; i++)
                {
-               x2 = XLOG2DEV(points[i+1].x + xoffset);
-               y2 = YLOG2DEV(points[i+1].y + yoffset);
+               x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+               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"));
     wxMacPortSetter helper(this) ;
 
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
 
-       wxCoord xx = XLOG2DEV(x);
-       wxCoord yy = YLOG2DEV(y);
+       wxCoord xx = XLOG2DEVMAC(x);
+       wxCoord yy = YLOG2DEVMAC(y);
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
        
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
        
@@ -882,8 +880,8 @@ void  wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
     if (radius < 0.0) 
            radius = - radius * ((width < height) ? width : height);
        
     if (radius < 0.0) 
            radius = - radius * ((width < height) ? width : height);
        
-       wxCoord xx = XLOG2DEV(x);
-       wxCoord yy = YLOG2DEV(y);
+       wxCoord xx = XLOG2DEVMAC(x);
+       wxCoord yy = YLOG2DEVMAC(y);
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
        
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        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"));
     wxMacPortSetter helper(this) ;
 
     wxCHECK_RET(Ok(), wxT("Invalid DC"));
     wxMacPortSetter helper(this) ;
 
-       wxCoord xx = XLOG2DEV(x);
-       wxCoord yy = YLOG2DEV(y);
+       wxCoord xx = XLOG2DEVMAC(x);
+       wxCoord yy = YLOG2DEVMAC(y);
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
 
        wxCoord ww = m_signX * XLOG2DEVREL(width);
        wxCoord hh = m_signY * YLOG2DEVREL(height);
 
@@ -995,14 +993,14 @@ bool  wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
        if ( LockPixels(bmappixels) )
        {
                Rect srcrect , dstrect ;
        if ( LockPixels(bmappixels) )
        {
                Rect srcrect , dstrect ;
-               srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ;
-               srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ;
-               srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v;
-               srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h;
-               dstrect.top = YLOG2DEV(ydest) ;
-               dstrect.left = XLOG2DEV(xdest) ;
-               dstrect.bottom = YLOG2DEV(ydest + height )  ;
-               dstrect.right = XLOG2DEV(xdest + width ) ;
+               srcrect.top = source->YLOG2DEVMAC(ysrc) ;
+               srcrect.left = source->XLOG2DEVMAC(xsrc)  ;
+               srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
+               srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
+               dstrect.top = YLOG2DEVMAC(ydest) ;
+               dstrect.left = XLOG2DEVMAC(xdest) ;
+               dstrect.bottom = YLOG2DEVMAC(ydest + height )  ;
+               dstrect.right = XLOG2DEVMAC(xdest + width ) ;
 
        short  mode = (logical_func == wxCOPY ? srcCopy :
  //    logical_func == wxCLEAR ? WHITENESS :
 
        short  mode = (logical_func == wxCOPY ? srcCopy :
  //    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;
             if ( textPixel || (m_backgroundMode == wxSOLID) )
             {
             textPixel = data[(srcY*w + srcX)*3] == 0;
             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 ( m_font.GetUnderlined() )
     {
 #if 0
     if ( m_font.GetUnderlined() )
     {
-        ::MoveTo(XLOG2DEV(x + x4), YLOG2DEV(y + y4 + font->descent));
-        ::LineTo(XLOG2DEV(x + x3), YLOG2DEV(y + y3 + font->descent));
+        ::MoveTo(XLOG2DEVMAC(x + x4), YLOG2DEVMAC(y + y4 + 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"));
     wxMacPortSetter helper(this) ;
 
     wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText  Invalid DC"));
     wxMacPortSetter helper(this) ;
 
-       long xx = XLOG2DEV(x);
-       long yy = YLOG2DEV(y);
+       long xx = XLOG2DEVMAC(x);
+       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() )
-       {
-           SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
-       }
-       else if ( background.IsMacThemeBackground() )
-       {
-           Rect originBox = { 0,0,1,1 } ;
-           ::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive , 
-               wxDisplayDepth() , true ) ;
-       }
-       else
-       {
-       ::RGBBackColor( &background.GetColour().GetPixel() );
-       int brushStyle = background.GetStyle();
-       if (brushStyle == wxSOLID)
-               ::BackPat(GetQDGlobalsWhite(&whiteColor));
-       else if (IS_HATCH(brushStyle))
-       {
-               Pattern pat ;
-               wxMacGetHatchPattern(brushStyle, &pat);
-               ::BackPat(&pat);
-       }
-       else
-       {
-               ::BackPat(GetQDGlobalsWhite(&whiteColor));
-       }
-       }
-       return 0 ;
+    switch( background.MacGetBrushKind() )
+    {
+      case kwxMacBrushTheme :
+        {
+               ::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
+          break ;
+        }
+      case kwxMacBrushThemeBackground :
+        {
+               Rect extent ;
+               ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
+               ::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
+          break ;
+        }
+      case kwxMacBrushColour :
+        {
+                 ::RGBBackColor( &background.GetColour().GetPixel() );
+               int brushStyle = background.GetStyle();
+               if (brushStyle == wxSOLID)
+                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
+               else if (IS_HATCH(brushStyle))
+               {
+                       Pattern pat ;
+                       wxMacGetHatchPattern(brushStyle, &pat);
+                       ::BackPat(&pat);
+               }
+               else
+               {
+                       ::BackPat(GetQDGlobalsWhite(&whiteColor));
+               }
+          break ;
+        }
+    }
 }
 
 void wxDC::MacInstallBrush() const
 }
 
 void wxDC::MacInstallBrush() const
index c90d675f8dad8e567b7464e179484aa0d003930c..6312bc3c82660d8115ef6a2fb63f7df2ef7da2f1 100644 (file)
@@ -55,6 +55,7 @@ wxWindowDC::wxWindowDC(wxWindow *the_canvas)
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
        SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
        SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        the_canvas->MacGetPortParams(&m_macLocalOrigin, &clipRect , &windowref , &rootwindow );
        SetRectRgn( m_macBoundaryClipRgn , clipRect.left , clipRect.top , clipRect.right , clipRect.bottom ) ;
        SectRgn( m_macBoundaryClipRgn , the_canvas->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+       OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_minY = m_minX =  0;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        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 ) ;
        SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -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 ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
+       OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_minY = m_minX =  0;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_minY = m_minX =  0;
@@ -126,6 +128,7 @@ wxPaintDC::wxPaintDC(wxWindow *window)
        SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
   SectRgn( m_macBoundaryClipRgn  , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        SectRgn( m_macBoundaryClipRgn , window->MacGetVisibleRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
        OffsetRgn( m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
   SectRgn( m_macBoundaryClipRgn  , window->GetUpdateRegion().GetWXHRGN() , m_macBoundaryClipRgn ) ;
+       OffsetRgn( m_macBoundaryClipRgn , m_macLocalOrigin.h , m_macLocalOrigin.v ) ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_ok = TRUE ;
        CopyRgn( m_macBoundaryClipRgn , m_macCurrentClipRgn ) ;
        m_macPort = UMAGetWindowPort( windowref ) ;
        m_ok = TRUE ;
index 274c90957a041c52db50286e3a8f9328feec4386..36d8757f67cd1e7f9b410b588de725c0608b510d 100644 (file)
@@ -237,7 +237,6 @@ void wxPrinterDC::StartPage(void)
        m_macLocalOrigin.h =  (**m_printData.m_macPrintInfo).rPaper.left ;
        m_macLocalOrigin.v =  (**m_printData.m_macPrintInfo).rPaper.top ;
        
        m_macLocalOrigin.h =  (**m_printData.m_macPrintInfo).rPaper.left ;
        m_macLocalOrigin.v =  (**m_printData.m_macPrintInfo).rPaper.top ;
        
-       SetOrigin(  - m_macLocalOrigin.h , - m_macLocalOrigin.v  ) ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
        err = PrError() ;
        Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
        ::ClipRect( &clip ) ;
        err = PrError() ;
index ea632f896471b33c71913c19a2cedd9952e2ea72..5ac79c57355acde54d8981ff9cd5556eabc68a82 100644 (file)
@@ -187,7 +187,6 @@ void wxTextCtrl::SetValue(const wxString& st)
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
-            SetOrigin( 0 , 0 ) ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
@@ -263,7 +262,6 @@ void wxTextCtrl::Paste()
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
             {
                 wxMacDrawingHelper help( win ) ;
                 // the mac control manager always assumes to have the origin at 0,0
-                SetOrigin( 0 , 0 ) ;
                 
                 bool            hasTabBehind = false ;
                 wxWindow* parent = GetParent() ;
                 
                 bool            hasTabBehind = false ;
                 wxWindow* parent = GetParent() ;
@@ -1895,7 +1893,6 @@ void wxTextCtrl::SetValue(const wxString& st)
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
         {
             wxMacDrawingHelper help( win ) ;
             // the mac control manager always assumes to have the origin at 0,0
-            SetOrigin( 0 , 0 ) ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
             
             bool            hasTabBehind = false ;
             wxWindow* parent = GetParent() ;
@@ -1986,9 +1983,7 @@ void wxTextCtrl::Paste()
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
                        if ( win )
                        {
                                wxMacDrawingHelper help( win ) ;
-                               // the mac control manager always assumes to have the origin at 0,0
-                               SetOrigin( 0 , 0 ) ;
-                               
+                               // the mac control manager always assumes to have the origin at 0,0                             
                                bool                    hasTabBehind = false ;
                                wxWindow* parent = GetParent() ;
                                while ( parent )
                                bool                    hasTabBehind = false ;
                                wxWindow* parent = GetParent() ;
                                while ( parent )
index bcf2beb0003606c37b9e42a30c222b4a0e9f1cf7..86020f988be8582a26d5fb2b7743d48bfc92fe63 100644 (file)
@@ -588,8 +588,6 @@ void wxToolBar::OnPaint(wxPaintEvent& event)
        {
                wxMacDrawingHelper help( win ) ;
                // the mac control manager always assumes to have the origin at 0,0
        {
                wxMacDrawingHelper help( win ) ;
                // the mac control manager always assumes to have the origin at 0,0
-               SetOrigin( 0 , 0 ) ;
-               
                bool                    hasTabBehind = false ;
                wxWindow* parent = GetParent() ;
                while ( parent )
                bool                    hasTabBehind = false ;
                wxWindow* parent = GetParent() ;
                while ( parent )
index 5f938dcfb59025ebbe33b1ba37c0c3b769a9e6d3..45877f9a1c3098cc472a71a79e22aa9c77159219 100644 (file)
@@ -226,7 +226,6 @@ void wxMacToolTip::Draw()
                #endif
                m_shown = true ;
 
                #endif
                m_shown = true ;
 
-               SetOrigin( 0 , 0 ) ;
                TextFont( kFontIDGeneva ) ;
                TextSize( 10 ) ;
                TextFace( 0 ) ;
                TextFont( kFontIDGeneva ) ;
                TextSize( 10 ) ;
                TextFace( 0 ) ;
@@ -333,7 +332,6 @@ void wxMacToolTip::Clear()
                #endif
                m_shown = false ;
 
                #endif
                m_shown = false ;
 
-               SetOrigin( 0 , 0 ) ;
                BackColor( whiteColor ) ;
                ForeColor(blackColor ) ;
                DrawPicture(m_backpict, &m_rect);
                BackColor( whiteColor ) ;
                ForeColor(blackColor ) ;
                DrawPicture(m_backpict, &m_rect);
index b29a256276b3d6e7178aaad70d20a78b2e2deb49..b952c7cea2db8803de0361278bad08197ae1756e 100644 (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) 
 {
     localOrigin->h = 0;
 void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, WindowRef *window  , wxWindowMac** rootwin) 
 {
     localOrigin->h = 0;
@@ -305,13 +293,7 @@ void wxTopLevelWindowMac::MacGetPortParams(Point* localOrigin, Rect* clipRect, W
 
 void wxTopLevelWindowMac::Clear()
 {
 
 void wxTopLevelWindowMac::Clear()
 {
-    wxMacDrawingClientHelper helper ( this ) ;
-    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 ) ;
+  wxWindow::Clear() ;
 }
 
 ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding() 
 }
 
 ControlHandle wxTopLevelWindowMac::MacGetContainerForEmbedding() 
@@ -327,7 +309,6 @@ void wxTopLevelWindowMac::MacUpdate( long timestamp)
     #else
     AGAPortHelper help( (m_macWindow) ) ;
     #endif
     #else
     AGAPortHelper help( (m_macWindow) ) ;
     #endif
-    SetOrigin( 0 , 0 ) ;
     BeginUpdate( m_macWindow ) ;
 
     RgnHandle       updateRgn = NewRgn();    
     BeginUpdate( m_macWindow ) ;
 
     RgnHandle       updateRgn = NewRgn();    
index 25a90e1ec5d7beb975cca976ec11a5122100d15d..91203d7176bb397af194174ef66534a87c61adf9 100644 (file)
@@ -497,7 +497,6 @@ OSErr UMASetKeyboardFocus                           (WindowPtr                              inWindow,
 
        SetPortWindowPort( inWindow ) ;
 
 
        SetPortWindowPort( inWindow ) ;
 
-       SetOrigin( 0 , 0 ) ;
   err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
        SetPort( port ) ;
        return err ;
   err = SetKeyboardFocus( inWindow , inControl , inPart ) ;
        SetPort( port ) ;
        return err ;
@@ -549,7 +548,6 @@ void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate )
                GrafPtr port ;
                GetPort( &port ) ;
                SetPortWindowPort( inWindowRef ) ;
                GrafPtr port ;
                GetPort( &port ) ;
                SetPortWindowPort( inWindowRef ) ;
-               SetOrigin( 0 , 0 ) ;
                HiliteWindow( inWindowRef , inActivate ) ;
                ControlHandle control = NULL ;
                ::GetRootControl( inWindowRef , & control ) ;
                HiliteWindow( inWindowRef , inActivate ) ;
                ControlHandle control = NULL ;
                ::GetRootControl( inWindowRef , & control ) ;
index dfd0938dd9570bc83beef13f5ce803e8015cbd92..06788f0b9dd5c0f9745ce73001659e03bba63659 100644 (file)
@@ -366,7 +366,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const
     GrafPtr     port ;  
     ::GetPort( &port ) ;
     ::SetPort( UMAGetWindowPort( window ) ) ;
     GrafPtr     port ;  
     ::GetPort( &port ) ;
     ::SetPort( UMAGetWindowPort( window ) ) ;
-    ::SetOrigin( 0 , 0 ) ;
+
     ::LocalToGlobal( &localwhere ) ;
     ::SetPort( port ) ;
     if(x)   *x = localwhere.h ;
     ::LocalToGlobal( &localwhere ) ;
     ::SetPort( port ) ;
     if(x)   *x = localwhere.h ;
@@ -560,6 +560,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
         if ( focus.Ok() )
         {
             Rect clientrect = { 0 , 0 , m_height , m_width } ;
         if ( focus.Ok() )
         {
             Rect clientrect = { 0 , 0 , m_height , m_width } ;
+            focus.LocalToWindow( &clientrect ) ;
             // ClipRect( &clientrect ) ;
             InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
         }
             // ClipRect( &clientrect ) ;
             InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
         }
@@ -575,6 +576,7 @@ void wxWindowMac::DoMoveWindow(int x, int y, int width, int height)
             if ( focus.Ok() )
             {
                 Rect clientrect = { 0 , 0 , m_height , m_width } ;
             if ( focus.Ok() )
             {
                 Rect clientrect = { 0 , 0 , m_height , m_width } ;
+                focus.LocalToWindow( &clientrect ) ;
                 // ClipRect( &clientrect ) ;
                 InvalWindowRect( MacGetRootWindow() , &clientrect ) ;
             }
                 // ClipRect( &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 ( parent->IsKindOf( CLASSINFO( wxNotebook ) ) || parent->IsKindOf( CLASSINFO( wxTabCtrl ) ))
                     {
                     // 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 ) ))
                     {
-                        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 ) ;
     if ( focus.Ok() )
     {
     wxMacDrawingHelper focus( this ) ;
     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() )
         return ;
 {
     if( IsTopLevel() )
         return ;
@@ -1018,7 +1030,7 @@ void wxWindowMac::MacPaintBorders( )
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_BORDER) )
     {
 #if wxMAC_USE_THEME_BORDER
     if (HasFlag(wxRAISED_BORDER) || HasFlag( wxSUNKEN_BORDER) || HasFlag(wxDOUBLE_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 ;
                  /*
                  GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
                  SInt32 border = 0 ;
                  /*
                  GetThemeMetric( kThemeMetricListBoxFrameOutset , &border ) ;
@@ -1030,38 +1042,38 @@ void wxWindowMac::MacPaintBorders( )
 #else
        bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
         RGBForeColor( &face );
 #else
        bool sunken = HasFlag( wxSUNKEN_BORDER ) ;
         RGBForeColor( &face );
-        MoveTo( 0 , m_height - 2 );
-        LineTo( 0 , 0 );
-        LineTo( m_width - 2 , 0 );
+        MoveTo( left + 0 , top + m_height - 2 );
+        LineTo( left + 0 , top + 0 );
+        LineTo( left + m_width - 2 , top + 0 );
 
 
-        MoveTo( 2 , m_height - 3 );
-        LineTo( m_width - 3 , m_height - 3 );
-        LineTo( m_width - 3 , 2 );
+        MoveTo( left + 2 , top + m_height - 3 );
+        LineTo( left + m_width - 3 , top + m_height - 3 );
+        LineTo( left + m_width - 3 , top + 2 );
 
         RGBForeColor( sunken ? &face : &black );
 
         RGBForeColor( sunken ? &face : &black );
-        MoveTo( 0 , m_height - 1 );
-        LineTo( m_width - 1 , m_height - 1 );
-        LineTo( m_width - 1 , 0 );
+        MoveTo( left + 0 , top + m_height - 1 );
+        LineTo( left + m_width - 1 , top + m_height - 1 );
+        LineTo( left + m_width - 1 , top + 0 );
 
         RGBForeColor( sunken ? &shadow : &white );
 
         RGBForeColor( sunken ? &shadow : &white );
-        MoveTo( 1 , m_height - 3 );
-        LineTo( 1, 1 );
-        LineTo( m_width - 3 , 1 );
+        MoveTo( left + 1 , top + m_height - 3 );
+        LineTo( left + 1, top + 1 );
+        LineTo( left + m_width - 3 , top + 1 );
 
         RGBForeColor( sunken ? &white : &shadow );
 
         RGBForeColor( sunken ? &white : &shadow );
-        MoveTo( 1 , m_height - 2 );
-        LineTo( m_width - 2 , m_height - 2 );
-        LineTo( m_width - 2 , 1 );
+        MoveTo( left + 1 , top + m_height - 2 );
+        LineTo( left + m_width - 2 , top + m_height - 2 );
+        LineTo( left + m_width - 2 , top + 1 );
 
         RGBForeColor( sunken ? &black : &face );
 
         RGBForeColor( sunken ? &black : &face );
-        MoveTo( 2 , m_height - 4 );
-        LineTo( 2 , 2 );
-        LineTo( m_width - 4 , 2 );
+        MoveTo( left + 2 , top + m_height - 4 );
+        LineTo( left + 2 , top + 2 );
+        LineTo( left + m_width - 4 , top + 2 );
 #endif
     }
     else if (HasFlag(wxSIMPLE_BORDER))
     {
 #endif
     }
     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 ) ;
         FrameRect( &rect ) ;
     }
         RGBForeColor( &black ) ;
         FrameRect( &rect ) ;
     }
@@ -1111,19 +1123,20 @@ void wxWindowMac::SetScrollbar(int orient, int pos, int thumbVisible,
 // Does a physical scroll
 void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
 // Does a physical scroll
 void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect)
 {
-    wxMacDrawingClientHelper focus( this ) ;
+    wxMacDrawingHelper focus( this , true ) ;
     if ( focus.Ok() )
     {
         int width , height ;
         GetClientSize( &width , &height ) ;
 
         Rect scrollrect = { 0 , 0 , height , width } ;
     if ( focus.Ok() )
     {
         int width , height ;
         GetClientSize( &width , &height ) ;
 
         Rect scrollrect = { 0 , 0 , height , width } ;
-    
+        focus.LocalToWindow( &scrollrect ) ;
         RgnHandle updateRgn = NewRgn() ;
         ClipRect( &scrollrect ) ;
         if ( rect )
         {
             Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
         RgnHandle updateRgn = NewRgn() ;
         ClipRect( &scrollrect ) ;
         if ( rect )
         {
             Rect r = { rect->y , rect->x , rect->y + rect->height , rect->x + rect->width } ;
+            focus.LocalToWindow( &r ) ;
             SectRect( &scrollrect , &r , &scrollrect ) ;        
         }
         ScrollRect( &scrollrect , dx , dy , updateRgn ) ;
             SectRect( &scrollrect , &r , &scrollrect ) ;        
         }
         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 ) 
 {
     if ( window == NULL )
 bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect & clipRect, WindowRef window , wxWindowMac* win ) 
 {
     if ( window == NULL )
@@ -1743,9 +1738,9 @@ bool wxWindowMac::MacSetPortDrawingParams( const Point & localOrigin, const Rect
     port = UMAGetWindowPort( window) ;
     if (currPort != port )
             ::SetPort(port);
     port = UMAGetWindowPort( window) ;
     if (currPort != port )
             ::SetPort(port);
-//  wxASSERT( port->portRect.left == 0 && port->portRect.top == 0 ) ; 
-    ::SetOrigin(-localOrigin.h, -localOrigin.v);
-    ::ClipRect(&clipRect);
+    Rect cr = clipRect ;
+    OffsetRect( &cr , localOrigin.h , localOrigin.v ) ;
+    ::ClipRect(&cr);
 
     ::PenNormal() ;
     ::RGBBackColor(& win->GetBackgroundColour().GetPixel() ) ;
 
     ::PenNormal() ;
     ::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 ;
     GetClientSize( &width , &height ) ;
 
     int width , height ;
     GetClientSize( &width , &height ) ;
@@ -1804,11 +1781,7 @@ void wxWindowMac::MacGetPortClientParams(Point* localOrigin, Rect* clipRect, Win
     localOrigin->v += client.y;
     OffsetRect(clipRect, -client.x, -client.y);
 
     localOrigin->v += client.y;
     OffsetRect(clipRect, -client.x, -client.y);
 
-    Rect myClip;
-    myClip.left = 0;
-    myClip.top = 0;
-    myClip.right = width;
-    myClip.bottom = height;
+    Rect myClip = { 0 , 0 , height , width } ;
     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 ;
     WindowRef window ;
     wxWindowMac *rootwin ;
     Rect clipRect ;
     WindowRef window ;
     wxWindowMac *rootwin ;
@@ -1880,12 +1852,15 @@ wxMacDrawingHelper::wxMacDrawingHelper( wxWindowMac * theWindow )
     GetPort( &m_formerPort ) ;
     if ( theWindow )
     {
     GetPort( &m_formerPort ) ;
     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 ) ;
         if ( m_formerPort != m_currentPort )
             SetPort( m_currentPort ) ;
         GetPenState( &m_savedPenState ) ;
         m_currentPort = UMAGetWindowPort( window ) ;
         if ( m_formerPort != m_currentPort )
             SetPort( m_currentPort ) ;
         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 ) ;
         SetPenState( &m_savedPenState ) ;
     {
         SetPort( m_currentPort ) ;
         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 ;
         GetPortBounds( m_currentPort , &portRect ) ;
         ClipRect( &portRect ) ;
         Rect portRect ;
         GetPortBounds( m_currentPort , &portRect ) ;
         ClipRect( &portRect ) ;