// wxDC
//-----------------------------------------------------------------------------
+class WXDLLEXPORT wxMacPortSetter
+{
+public :
+ wxMacPortSetter( wxDC* dc ) ;
+ ~wxMacPortSetter() ;
+private :
+ AGAPortHelper m_ph ;
+} ;
+
class WXDLLEXPORT wxDC: public wxDCBase
{
DECLARE_DYNAMIC_CLASS(wxDC)
mutable bool m_macPenInstalled ;
mutable bool m_macBrushInstalled ;
- mutable long m_macPortId ;
- GrafPtr m_macOrigPort ;
Rect m_macClipRect ;
Point m_macLocalOrigin ;
- mutable AGAPortHelper m_macPortHelper ;
- void MacSetupPort() const ;
- void MacVerifySetup() const { if ( m_macPortId != m_macCurrentPortId ) MacSetupPort() ; }
- static void MacInvalidateSetup() { m_macCurrentPortId++ ; }
- static long m_macCurrentPortId ;
+ void MacSetupPort( AGAPortHelper* ph ) const ;
};
#endif
TextMode( mode );
SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
- wxDC::MacInvalidateSetup() ;
}
}
TextMode( mode );
SetOrigin( 0 , 0 ) ;
SetPort( port ) ;
- wxDC::MacInvalidateSetup() ;
}
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
#define mm2pt 2.83464566929
#define pt2mm 0.352777777778
-long wxDC::m_macCurrentPortId = 1 ;
-
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
- m_macPortId = 0 ;
m_macLocalOrigin.h = m_macLocalOrigin.v = 0 ;
m_macClipRect.left = -32000 ;
m_macClipRect.top = -32000 ;
m_macClipRect.right = 32000 ;
m_macClipRect.bottom = 32000 ;
- ::GetPort( &m_macOrigPort ) ;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxWHITE_BRUSH;
};
+wxMacPortSetter::wxMacPortSetter( wxDC* dc ) :
+ m_ph( dc->m_macPort )
+{
+ wxASSERT( dc->Ok() ) ;
+
+ dc->MacSetupPort(&m_ph) ;
+}
+
+wxMacPortSetter::~wxMacPortSetter()
+{
+}
+
wxDC::~wxDC(void)
{
- if ( !m_macPortHelper.IsCleared() )
- {
- GrafPtr port ;
- GetPort( &port ) ;
- SetPort( m_macPortHelper.GetCurrentPort() ) ;
- SetOrigin( 0 , 0 ) ;
- SetPort( port ) ;
- }
- /*
- if ( m_macPort )
- {
- ::SetPort( m_macPort ) ;
- ::SetOrigin( 0 , 0 ) ;
- ::ClipRect( &m_macPort->portRect ) ;
- ::PenNormal() ;
- ::SetPort( m_macOrigPort ) ;
- }
- */
- ++m_macCurrentPortId ;
};
-void wxDC::MacSetupPort() const
+void wxDC::MacSetupPort(AGAPortHelper* help) const
{
- AGAPortHelper* help = (AGAPortHelper*) &m_macPortHelper ;
help->Setup( m_macPort ) ;
- m_macPortId = ++m_macCurrentPortId ;
::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
::ClipRect(&m_macClipRect);
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx1 = XLOG2DEV(x);
long yy1 = YLOG2DEV(y);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx1 = XLOG2DEV(x);
long yy1 = YLOG2DEV(y);
void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if( m_clipping )
{
m_clipX1 = wxMax( m_clipX1 , x ) ;
{
wxCHECK_RET( Ok(), wxT("invalid window dc") );
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (region.Empty())
{
DestroyClippingRegion();
void wxDC::DestroyClippingRegion(void)
{
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
m_clipping = FALSE;
// Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect(&m_macClipRect);
if (!Ok())
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
m_font = font;
m_macFontInstalled = false ;
if (!Ok() )
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if ( m_pen == pen )
return ;
{
if (!Ok() )
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if (m_brush == brush)
return;
{
if (!Ok())
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if (m_backgroundBrush == brush)
return;
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() == wxTRANSPARENT)
return;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
PolyHandle polygon = OpenPoly() ;
long x1, x2 , y1 , y2 ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (radius < 0.0)
radius = - radius * ((width < height) ? width : height);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask )
{
if (!Ok()) return FALSE;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
wxFont formerFont = m_font ;
if (!Ok())
return 1;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
MacInstallFont() ;
if (!Ok())
return 1;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
MacInstallFont() ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
Rect rect = { -32767 , -32767 , 32767 , 32767 } ;
if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
{
if (!Ok())
return;
- MacVerifySetup() ;
- if ( m_macFontInstalled )
- return ;
+// if ( m_macFontInstalled )
+// return ;
Pattern blackColor ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
{
if (!Ok())
return;
- MacVerifySetup() ;
Pattern blackColor;
- if ( m_macPenInstalled )
- return ;
+// if ( m_macPenInstalled )
+// return ;
RGBColor forecolor = m_pen.GetColour().GetPixel();
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
{
if (!Ok())
return;
- MacVerifySetup() ;
+
Pattern blackColor, whiteColor ;
- if ( m_macBrushInstalled )
- return ;
+// if ( m_macBrushInstalled )
+// return ;
// foreground
m_maxX = size.x ;
m_maxY = size.y ;
- MacSetupPort() ;
m_ok = TRUE ;
SetBackground(wxBrush(the_canvas->GetBackgroundColour(), wxSOLID));
}
window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
m_macPort = UMAGetWindowPort( windowref ) ;
- MacSetupPort() ;
m_minY = m_minX = 0;
wxSize size = window->GetSize() ;
m_maxX = size.x ;
window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
m_macPort = UMAGetWindowPort( windowref ) ;
- MacSetupPort() ;
m_ok = TRUE ;
wxCoord x , y ,w , h ;
window->GetUpdateRegion().GetBox( x , y , w , h ) ;
{
m_macMask = mask->GetMaskBitmap() ;
}
- MacSetupPort() ;
m_ok = TRUE ;
// SetBackground(wxBrush(*wxWHITE, wxSOLID));
}
::UMAPrClose() ;
// ::SetPort( macPrintFormerPort ) ;
::SetPort( LMGetWMgrPort() ) ;
- m_macPortHelper.Clear() ;
}
#else
if ( m_ok )
#else
m_macPort = LMGetWMgrPort() ;
#endif
- MacSetupPort() ;
m_ok = TRUE ;
BitMap screenBits;
GetQDGlobalsScreenBits( &screenBits );
if (!dc->Ok() )
return FALSE;
- dc->MacVerifySetup() ;
-
{
+ wxMacPortSetter helper( dc ) ;
PicHandle pict = GetHMETAFILE() ;
DrawPicture( pict , &(**pict).picFrame ) ;
}
-/*
- if (!m_refData)
- return FALSE;
-
- dc->BeginDrawing();
-
- if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
- PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile);
-
- dc->EndDrawing();
-*/
return TRUE;
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
}
}
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
::DrawText( text , laststop , i - laststop ) ;
- ::TextMode( srcOr ) ;
- wxDC::MacInvalidateSetup() ;
-
+ ::TextMode( srcOr ) ;
// DrawText( m_label , 0 , m_label.Length() ) ;
}
}
DrawPicture(m_backpict, &m_rect);
KillPicture(m_backpict);
m_backpict = NULL ;
- wxDC::MacInvalidateSetup() ;
}
}
}
#endif
SetPort( port ) ;
- wxDC::MacInvalidateSetup() ;
return err ;
}
UMADeactivateControl( control ) ;
}
SetPort( port ) ;
- wxDC::MacInvalidateSetup() ;
}
}
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ;
- wxDC::MacInvalidateSetup() ;
}
if ( m_formerPort != m_currentPort )
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
#define mm2pt 2.83464566929
#define pt2mm 0.352777777778
-long wxDC::m_macCurrentPortId = 1 ;
-
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
m_macBrushInstalled = false ;
m_macPenInstalled = false ;
- m_macPortId = 0 ;
m_macLocalOrigin.h = m_macLocalOrigin.v = 0 ;
m_macClipRect.left = -32000 ;
m_macClipRect.top = -32000 ;
m_macClipRect.right = 32000 ;
m_macClipRect.bottom = 32000 ;
- ::GetPort( &m_macOrigPort ) ;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxWHITE_BRUSH;
};
+wxMacPortSetter::wxMacPortSetter( wxDC* dc ) :
+ m_ph( dc->m_macPort )
+{
+ wxASSERT( dc->Ok() ) ;
+
+ dc->MacSetupPort(&m_ph) ;
+}
+
+wxMacPortSetter::~wxMacPortSetter()
+{
+}
+
wxDC::~wxDC(void)
{
- if ( !m_macPortHelper.IsCleared() )
- {
- GrafPtr port ;
- GetPort( &port ) ;
- SetPort( m_macPortHelper.GetCurrentPort() ) ;
- SetOrigin( 0 , 0 ) ;
- SetPort( port ) ;
- }
- /*
- if ( m_macPort )
- {
- ::SetPort( m_macPort ) ;
- ::SetOrigin( 0 , 0 ) ;
- ::ClipRect( &m_macPort->portRect ) ;
- ::PenNormal() ;
- ::SetPort( m_macOrigPort ) ;
- }
- */
- ++m_macCurrentPortId ;
};
-void wxDC::MacSetupPort() const
+void wxDC::MacSetupPort(AGAPortHelper* help) const
{
- AGAPortHelper* help = (AGAPortHelper*) &m_macPortHelper ;
help->Setup( m_macPort ) ;
- m_macPortId = ++m_macCurrentPortId ;
::SetOrigin(-m_macLocalOrigin.h, -m_macLocalOrigin.v);
::ClipRect(&m_macClipRect);
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx1 = XLOG2DEV(x);
long yy1 = YLOG2DEV(y);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx1 = XLOG2DEV(x);
long yy1 = YLOG2DEV(y);
void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
{
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if( m_clipping )
{
m_clipX1 = wxMax( m_clipX1 , x ) ;
{
wxCHECK_RET( Ok(), wxT("invalid window dc") );
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (region.Empty())
{
DestroyClippingRegion();
void wxDC::DestroyClippingRegion(void)
{
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
m_clipping = FALSE;
// Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
::ClipRect(&m_macClipRect);
if (!Ok())
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
m_font = font;
m_macFontInstalled = false ;
if (!Ok() )
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if ( m_pen == pen )
return ;
{
if (!Ok() )
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if (m_brush == brush)
return;
{
if (!Ok())
return;
- MacVerifySetup() ;
+// wxMacPortSetter helper(this) ;
if (m_backgroundBrush == brush)
return;
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (m_pen.GetStyle() == wxTRANSPARENT)
return;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
PolyHandle polygon = OpenPoly() ;
long x1, x2 , y1 , y2 ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
if (radius < 0.0)
radius = - radius * ((width < height) ? width : height);
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask )
{
if (!Ok()) return FALSE;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
wxFont formerFont = m_font ;
if (!Ok())
return 1;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
MacInstallFont() ;
if (!Ok())
return 1;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
MacInstallFont() ;
{
if (!Ok())
return;
- MacVerifySetup() ;
+ wxMacPortSetter helper(this) ;
Rect rect = { -32767 , -32767 , 32767 , 32767 } ;
if (m_backgroundBrush.GetStyle() != wxTRANSPARENT)
{
if (!Ok())
return;
- MacVerifySetup() ;
- if ( m_macFontInstalled )
- return ;
+// if ( m_macFontInstalled )
+// return ;
Pattern blackColor ;
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
{
if (!Ok())
return;
- MacVerifySetup() ;
Pattern blackColor;
- if ( m_macPenInstalled )
- return ;
+// if ( m_macPenInstalled )
+// return ;
RGBColor forecolor = m_pen.GetColour().GetPixel();
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
{
if (!Ok())
return;
- MacVerifySetup() ;
+
Pattern blackColor, whiteColor ;
- if ( m_macBrushInstalled )
- return ;
+// if ( m_macBrushInstalled )
+// return ;
// foreground
m_maxX = size.x ;
m_maxY = size.y ;
- MacSetupPort() ;
m_ok = TRUE ;
SetBackground(wxBrush(the_canvas->GetBackgroundColour(), wxSOLID));
}
window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
m_macPort = UMAGetWindowPort( windowref ) ;
- MacSetupPort() ;
m_minY = m_minX = 0;
wxSize size = window->GetSize() ;
m_maxX = size.x ;
window->MacGetPortClientParams(&m_macLocalOrigin, &m_macClipRect , &windowref , &rootwindow );
m_macPort = UMAGetWindowPort( windowref ) ;
- MacSetupPort() ;
m_ok = TRUE ;
wxCoord x , y ,w , h ;
window->GetUpdateRegion().GetBox( x , y , w , h ) ;
{
m_macMask = mask->GetMaskBitmap() ;
}
- MacSetupPort() ;
m_ok = TRUE ;
// SetBackground(wxBrush(*wxWHITE, wxSOLID));
}
::UMAPrClose() ;
// ::SetPort( macPrintFormerPort ) ;
::SetPort( LMGetWMgrPort() ) ;
- m_macPortHelper.Clear() ;
}
#else
if ( m_ok )
#else
m_macPort = LMGetWMgrPort() ;
#endif
- MacSetupPort() ;
m_ok = TRUE ;
BitMap screenBits;
GetQDGlobalsScreenBits( &screenBits );
if (!dc->Ok() )
return FALSE;
- dc->MacVerifySetup() ;
-
{
+ wxMacPortSetter helper( dc ) ;
PicHandle pict = GetHMETAFILE() ;
DrawPicture( pict , &(**pict).picFrame ) ;
}
-/*
- if (!m_refData)
- return FALSE;
-
- dc->BeginDrawing();
-
- if (dc->GetHDC() && M_METAFILEDATA->m_metafile)
- PlayMetaFile((HDC) dc->GetHDC(), (HMETAFILE) M_METAFILEDATA->m_metafile);
-
- dc->EndDrawing();
-*/
return TRUE;
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
UMADrawControl( m_macControl ) ;
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
}
}
UMASetThemeWindowBackground( win->MacGetWindowData()->m_macWindow , win->MacGetWindowData()->m_macWindowBackgroundTheme , false ) ;
- wxDC::MacInvalidateSetup() ;
}
}
}
::DrawText( text , laststop , i - laststop ) ;
- ::TextMode( srcOr ) ;
- wxDC::MacInvalidateSetup() ;
-
+ ::TextMode( srcOr ) ;
// DrawText( m_label , 0 , m_label.Length() ) ;
}
}
DrawPicture(m_backpict, &m_rect);
KillPicture(m_backpict);
m_backpict = NULL ;
- wxDC::MacInvalidateSetup() ;
}
}
}
#endif
SetPort( port ) ;
- wxDC::MacInvalidateSetup() ;
return err ;
}
UMADeactivateControl( control ) ;
}
SetPort( port ) ;
- wxDC::MacInvalidateSetup() ;
}
}
OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState )
Rect portRect ;
GetPortBounds( m_currentPort , &portRect ) ;
ClipRect( &portRect ) ;
- wxDC::MacInvalidateSetup() ;
}
if ( m_formerPort != m_currentPort )