#define mm2pt 2.83464566929
#define pt2mm 0.352777777778
#if !defined( __DARWIN__ ) || defined(__MWERKS__)
+#ifndef M_PI
const double M_PI = 3.14159265358979 ;
#endif
+#endif
const double RAD2DEG = 180.0 / M_PI;
const short kEmulatedMode = -1 ;
const short kUnsupportedMode = -2 ;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxWHITE_BRUSH;
+#ifdef __WXDEBUG__
+ // needed to debug possible errors with two active drawing methods at the same time on
+ // the same DC
m_macCurrentPortStateHelper = NULL ;
+#endif
m_macATSUIStyle = NULL ;
m_macAliasWasEnabled = false;
m_macForegroundPixMap = NULL ;
void wxDC::MacSetupPort(wxMacPortStateHelper* help) const
{
+#ifdef __WXDEBUG__
wxASSERT( m_macCurrentPortStateHelper == NULL ) ;
m_macCurrentPortStateHelper = help ;
+#endif
SetClip( (RgnHandle) m_macCurrentClipRgn);
m_macFontInstalled = false ;
m_macBrushInstalled = false ;
void wxDC::MacCleanupPort(wxMacPortStateHelper* help) const
{
+#ifdef __WXDEBUG__
wxASSERT( m_macCurrentPortStateHelper == help ) ;
m_macCurrentPortStateHelper = NULL ;
+#endif
if( m_macATSUIStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
m_clipping = FALSE;
}
-void wxDC::DoGetSize( int* width, int* height ) const
-{
- *width = m_maxX-m_minX;
- *height = m_maxY-m_minY;
-}
-
void wxDC::DoGetSizeMM( int* width, int* height ) const
{
int w = 0;
double angle)
{
wxCHECK_RET( Ok(), wxT("wxDC::DoDrawRotatedText Invalid window dc") );
+
if (angle == 0.0 )
{
DrawText(str, x, y);
return;
}
+
if ( str.Length() == 0 )
return ;
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
#else
TECObjectRef ec;
- status = TECCreateConverter(&ec,
- wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+ status = TECCreateConverter(&ec,
+ wxApp::s_macDefaultEncodingIsPC
+ ? (int)kTextEncodingWindowsLatin1
+ : (int)kTextEncodingMacRoman,
+ kTextEncodingUnicodeDefault);
wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
ByteCount byteOutLen ;
status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
&textBefore , &textAfter, &ascent , &descent );
- drawX += sin(angle/RAD2DEG) * FixedToInt(ascent) ;
- drawY += cos(angle/RAD2DEG) * FixedToInt(ascent) ;
+ drawX += (int)(sin(angle/RAD2DEG) * FixedToInt(ascent));
+ drawY += (int)(cos(angle/RAD2DEG) * FixedToInt(ascent));
status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
IntToFixed(drawX) , IntToFixed(drawY) );
wxASSERT_MSG( status == noErr , wxT("couldn't draw the rotated text") );
void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
{
wxCHECK_RET(Ok(), wxT("wxDC::DoDrawText Invalid DC"));
+
wxMacPortSetter helper(this) ;
long xx = XLOG2DEVMAC(x);
long yy = YLOG2DEVMAC(y);
#if TARGET_CARBON
+
bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || m_font.GetNoAntiAliasing() )
useDrawThemeText = false ;
} ;
Boolean kTrue = true ;
Boolean kFalse = false ;
- BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
+ //BslnBaselineClass kBaselineDefault = kBSLNHangingBaseline ;
ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{
(qdStyle & condense) ? &kTrue : &kFalse ,
(qdStyle & extend) ? &kTrue : &kFalse ,
} ;
- status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
+ status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag) ,
atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
}