Applied patch for better pattern support.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1330,7 +1330,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
|||||||
? (int)kTextEncodingWindowsLatin1
|
? (int)kTextEncodingWindowsLatin1
|
||||||
: (int)kTextEncodingMacRoman,
|
: (int)kTextEncodingMacRoman,
|
||||||
kTextEncodingUnicodeDefault);
|
kTextEncodingUnicodeDefault);
|
||||||
|
|
||||||
wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
|
wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
|
||||||
ByteCount byteOutLen ;
|
ByteCount byteOutLen ;
|
||||||
ByteCount byteInLen = str.Length() ;
|
ByteCount byteInLen = str.Length() ;
|
||||||
@@ -1440,7 +1440,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
if( strtext[i] == 13 || strtext[i] == 10)
|
if( strtext[i] == 13 || strtext[i] == 10)
|
||||||
{
|
{
|
||||||
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
if ( useDrawThemeText )
|
if ( useDrawThemeText )
|
||||||
{
|
{
|
||||||
@@ -1473,7 +1473,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
::DrawText( text , 0 , strlen(text) ) ;
|
::DrawText( text , 0 , strlen(text) ) ;
|
||||||
line++ ;
|
line++ ;
|
||||||
::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
|
::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
|
||||||
@@ -1515,7 +1515,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
::DrawText( text , 0 , strlen(text) ) ;
|
::DrawText( text , 0 , strlen(text) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1545,7 +1545,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
::GetFontInfo( &fi ) ;
|
::GetFontInfo( &fi ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||||
if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
||||||
useGetThemeText = false ;
|
useGetThemeText = false ;
|
||||||
#endif
|
#endif
|
||||||
if ( height )
|
if ( height )
|
||||||
@@ -1580,7 +1580,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
{
|
{
|
||||||
if( strtext[i] == 13 || strtext[i] == 10)
|
if( strtext[i] == 13 || strtext[i] == 10)
|
||||||
{
|
{
|
||||||
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
||||||
if ( height )
|
if ( height )
|
||||||
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -1600,8 +1600,8 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
||||||
}
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
*width = XDEV2LOGREL( curwidth ) ;
|
*width = XDEV2LOGREL( curwidth ) ;
|
||||||
@@ -1628,7 +1628,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
||||||
}
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
@@ -1835,45 +1835,41 @@ void wxDC::MacInstallFont() const
|
|||||||
wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
|
wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern gHatchPatterns[] =
|
Pattern gPatterns[] =
|
||||||
{
|
{ // hatch patterns
|
||||||
{ { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } },
|
{ 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
|
||||||
{ { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } },
|
{ 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } ,
|
||||||
{ { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } },
|
{ 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } ,
|
||||||
{ { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } },
|
{ 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } ,
|
||||||
{ { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } },
|
{ 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } ,
|
||||||
{ { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } },
|
{ 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } ,
|
||||||
{ { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } }
|
{ 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } ,
|
||||||
|
// dash patterns
|
||||||
|
{ 0xCC , 0x99 , 0x33 , 0x66 , 0xCC , 0x99 , 0x33 , 0x66 } , // DOT
|
||||||
|
{ 0xFE , 0xFD , 0xFB , 0xF7 , 0xEF , 0xDF , 0xBF , 0x7F } , // LONG_DASH
|
||||||
|
{ 0xEE , 0xDD , 0xBB , 0x77 , 0xEE , 0xDD , 0xBB , 0x77 } , // SHORT_DASH
|
||||||
|
{ 0xDE , 0xBD , 0x7B , 0xF6 , 0xED , 0xDB , 0xB7 , 0x6F } , // DOT_DASH
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static void wxMacGetHatchPattern(int hatchStyle, Pattern *pattern)
|
static void wxMacGetPattern(int penStyle, Pattern *pattern)
|
||||||
{
|
{
|
||||||
int theIndex = 1 ;
|
int index = 0; // solid pattern by default
|
||||||
switch(hatchStyle)
|
switch(penStyle)
|
||||||
{
|
{
|
||||||
case wxBDIAGONAL_HATCH:
|
// hatches
|
||||||
theIndex = 2;
|
case wxBDIAGONAL_HATCH: index = 1; break;
|
||||||
break;
|
case wxFDIAGONAL_HATCH: index = 2; break;
|
||||||
case wxFDIAGONAL_HATCH:
|
case wxCROSS_HATCH: index = 3; break;
|
||||||
theIndex = 3;
|
case wxHORIZONTAL_HATCH: index = 4; break;
|
||||||
break;
|
case wxVERTICAL_HATCH: index = 5; break;
|
||||||
case wxCROSS_HATCH:
|
case wxCROSSDIAG_HATCH: index = 6; break;
|
||||||
theIndex = 4;
|
// dashes
|
||||||
break;
|
case wxDOT: index = 7; break;
|
||||||
case wxHORIZONTAL_HATCH:
|
case wxLONG_DASH: index = 8; break;
|
||||||
theIndex = 5;
|
case wxSHORT_DASH: index = 9; break;
|
||||||
break;
|
case wxDOT_DASH: index = 10; break;
|
||||||
case wxVERTICAL_HATCH:
|
|
||||||
theIndex = 6;
|
|
||||||
break;
|
|
||||||
case wxCROSSDIAG_HATCH:
|
|
||||||
theIndex = 7;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
theIndex = 1; // solid pattern
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
*pattern = gHatchPatterns[theIndex-1] ;
|
*pattern = gPatterns[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::MacInstallPen() const
|
void wxDC::MacInstallPen() const
|
||||||
@@ -1892,62 +1888,28 @@ void wxDC::MacInstallPen() const
|
|||||||
if ( penWidth == 0 )
|
if ( penWidth == 0 )
|
||||||
penWidth = 1 ;
|
penWidth = 1 ;
|
||||||
::PenSize(penWidth, penWidth);
|
::PenSize(penWidth, penWidth);
|
||||||
|
|
||||||
int penStyle = m_pen.GetStyle();
|
int penStyle = m_pen.GetStyle();
|
||||||
if (penStyle == wxSOLID)
|
Pattern pat;
|
||||||
{
|
if (penStyle == wxUSER_DASH)
|
||||||
::PenPat(GetQDGlobalsBlack(&blackColor));
|
{
|
||||||
}
|
// FIXME: there should be exactly 8 items in the dash
|
||||||
else if (IS_HATCH(penStyle))
|
wxDash* dash ;
|
||||||
{
|
int number = m_pen.GetDashes(&dash) ;
|
||||||
Pattern pat ;
|
int index = 0;
|
||||||
wxMacGetHatchPattern(penStyle, &pat);
|
for ( int i = 0 ; i < 8 ; ++i )
|
||||||
::PenPat(&pat);
|
{
|
||||||
|
pat.pat[i] = dash[index] ;
|
||||||
|
if (index < number - 1)
|
||||||
|
index++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
|
wxMacGetPattern(penStyle, &pat);
|
||||||
switch( penStyle )
|
|
||||||
{
|
|
||||||
case wxDOT :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0xCC ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxLONG_DASH :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0xFE ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxSHORT_DASH :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0xEE ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxDOT_DASH :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0x6F ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxUSER_DASH :
|
|
||||||
{
|
|
||||||
wxDash* dash ;
|
|
||||||
m_pen.GetDashes(&dash) ;
|
|
||||||
// right now we don't allocate larger pixmaps
|
|
||||||
// int number =
|
|
||||||
m_pen.GetDashes(&dash) ;
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = dash[0] ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
::PenPat(&pat);
|
|
||||||
}
|
}
|
||||||
|
::PenPat(&pat);
|
||||||
|
|
||||||
short mode = patCopy ;
|
short mode = patCopy ;
|
||||||
// todo :
|
// todo :
|
||||||
switch( m_logicalFunction )
|
switch( m_logicalFunction )
|
||||||
@@ -1997,28 +1959,28 @@ void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
|||||||
Pattern whiteColor ;
|
Pattern whiteColor ;
|
||||||
switch( background.MacGetBrushKind() )
|
switch( background.MacGetBrushKind() )
|
||||||
{
|
{
|
||||||
case kwxMacBrushTheme :
|
case kwxMacBrushTheme :
|
||||||
{
|
{
|
||||||
::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
|
::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case kwxMacBrushThemeBackground :
|
case kwxMacBrushThemeBackground :
|
||||||
{
|
{
|
||||||
Rect extent ;
|
Rect extent ;
|
||||||
ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
|
ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
|
||||||
::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
|
::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case kwxMacBrushColour :
|
case kwxMacBrushColour :
|
||||||
{
|
{
|
||||||
::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
|
::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
|
||||||
int brushStyle = background.GetStyle();
|
int brushStyle = background.GetStyle();
|
||||||
if (brushStyle == wxSOLID)
|
if (brushStyle == wxSOLID)
|
||||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||||
else if (IS_HATCH(brushStyle))
|
else if (IS_HATCH(brushStyle))
|
||||||
{
|
{
|
||||||
Pattern pat ;
|
Pattern pat ;
|
||||||
wxMacGetHatchPattern(brushStyle, &pat);
|
wxMacGetPattern(brushStyle, &pat);
|
||||||
::BackPat(&pat);
|
::BackPat(&pat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2048,7 +2010,7 @@ void wxDC::MacInstallBrush() const
|
|||||||
else if (IS_HATCH(brushStyle))
|
else if (IS_HATCH(brushStyle))
|
||||||
{
|
{
|
||||||
Pattern pat ;
|
Pattern pat ;
|
||||||
wxMacGetHatchPattern(brushStyle, &pat);
|
wxMacGetPattern(brushStyle, &pat);
|
||||||
::PenPat(&pat);
|
::PenPat(&pat);
|
||||||
}
|
}
|
||||||
else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
|
else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
|
||||||
|
164
src/mac/dc.cpp
164
src/mac/dc.cpp
@@ -1330,7 +1330,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
|||||||
? (int)kTextEncodingWindowsLatin1
|
? (int)kTextEncodingWindowsLatin1
|
||||||
: (int)kTextEncodingMacRoman,
|
: (int)kTextEncodingMacRoman,
|
||||||
kTextEncodingUnicodeDefault);
|
kTextEncodingUnicodeDefault);
|
||||||
|
|
||||||
wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
|
wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
|
||||||
ByteCount byteOutLen ;
|
ByteCount byteOutLen ;
|
||||||
ByteCount byteInLen = str.Length() ;
|
ByteCount byteInLen = str.Length() ;
|
||||||
@@ -1440,7 +1440,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
{
|
{
|
||||||
if( strtext[i] == 13 || strtext[i] == 10)
|
if( strtext[i] == 13 || strtext[i] == 10)
|
||||||
{
|
{
|
||||||
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
if ( useDrawThemeText )
|
if ( useDrawThemeText )
|
||||||
{
|
{
|
||||||
@@ -1473,7 +1473,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
::DrawText( text , 0 , strlen(text) ) ;
|
::DrawText( text , 0 , strlen(text) ) ;
|
||||||
line++ ;
|
line++ ;
|
||||||
::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
|
::MoveTo( xx , yy + line*(fi.descent + fi.ascent + fi.leading) );
|
||||||
@@ -1515,7 +1515,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
::DrawText( text , 0 , strlen(text) ) ;
|
::DrawText( text , 0 , strlen(text) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1545,7 +1545,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
::GetFontInfo( &fi ) ;
|
::GetFontInfo( &fi ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||||
if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
||||||
useGetThemeText = false ;
|
useGetThemeText = false ;
|
||||||
#endif
|
#endif
|
||||||
if ( height )
|
if ( height )
|
||||||
@@ -1580,7 +1580,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
{
|
{
|
||||||
if( strtext[i] == 13 || strtext[i] == 10)
|
if( strtext[i] == 13 || strtext[i] == 10)
|
||||||
{
|
{
|
||||||
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
||||||
if ( height )
|
if ( height )
|
||||||
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
*height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -1600,8 +1600,8 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
||||||
}
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
*width = XDEV2LOGREL( curwidth ) ;
|
*width = XDEV2LOGREL( curwidth ) ;
|
||||||
@@ -1628,7 +1628,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
wxCharBuffer text = wxMacStringToCString(linetext) ;
|
||||||
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
||||||
}
|
}
|
||||||
if ( curwidth > *width )
|
if ( curwidth > *width )
|
||||||
@@ -1835,45 +1835,41 @@ void wxDC::MacInstallFont() const
|
|||||||
wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
|
wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pattern gHatchPatterns[] =
|
Pattern gPatterns[] =
|
||||||
{
|
{ // hatch patterns
|
||||||
{ { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } },
|
{ 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
|
||||||
{ { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } },
|
{ 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } ,
|
||||||
{ { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } },
|
{ 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } ,
|
||||||
{ { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } },
|
{ 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } ,
|
||||||
{ { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } },
|
{ 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } ,
|
||||||
{ { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } },
|
{ 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } ,
|
||||||
{ { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } }
|
{ 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } ,
|
||||||
|
// dash patterns
|
||||||
|
{ 0xCC , 0x99 , 0x33 , 0x66 , 0xCC , 0x99 , 0x33 , 0x66 } , // DOT
|
||||||
|
{ 0xFE , 0xFD , 0xFB , 0xF7 , 0xEF , 0xDF , 0xBF , 0x7F } , // LONG_DASH
|
||||||
|
{ 0xEE , 0xDD , 0xBB , 0x77 , 0xEE , 0xDD , 0xBB , 0x77 } , // SHORT_DASH
|
||||||
|
{ 0xDE , 0xBD , 0x7B , 0xF6 , 0xED , 0xDB , 0xB7 , 0x6F } , // DOT_DASH
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static void wxMacGetHatchPattern(int hatchStyle, Pattern *pattern)
|
static void wxMacGetPattern(int penStyle, Pattern *pattern)
|
||||||
{
|
{
|
||||||
int theIndex = 1 ;
|
int index = 0; // solid pattern by default
|
||||||
switch(hatchStyle)
|
switch(penStyle)
|
||||||
{
|
{
|
||||||
case wxBDIAGONAL_HATCH:
|
// hatches
|
||||||
theIndex = 2;
|
case wxBDIAGONAL_HATCH: index = 1; break;
|
||||||
break;
|
case wxFDIAGONAL_HATCH: index = 2; break;
|
||||||
case wxFDIAGONAL_HATCH:
|
case wxCROSS_HATCH: index = 3; break;
|
||||||
theIndex = 3;
|
case wxHORIZONTAL_HATCH: index = 4; break;
|
||||||
break;
|
case wxVERTICAL_HATCH: index = 5; break;
|
||||||
case wxCROSS_HATCH:
|
case wxCROSSDIAG_HATCH: index = 6; break;
|
||||||
theIndex = 4;
|
// dashes
|
||||||
break;
|
case wxDOT: index = 7; break;
|
||||||
case wxHORIZONTAL_HATCH:
|
case wxLONG_DASH: index = 8; break;
|
||||||
theIndex = 5;
|
case wxSHORT_DASH: index = 9; break;
|
||||||
break;
|
case wxDOT_DASH: index = 10; break;
|
||||||
case wxVERTICAL_HATCH:
|
|
||||||
theIndex = 6;
|
|
||||||
break;
|
|
||||||
case wxCROSSDIAG_HATCH:
|
|
||||||
theIndex = 7;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
theIndex = 1; // solid pattern
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
*pattern = gHatchPatterns[theIndex-1] ;
|
*pattern = gPatterns[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::MacInstallPen() const
|
void wxDC::MacInstallPen() const
|
||||||
@@ -1892,62 +1888,28 @@ void wxDC::MacInstallPen() const
|
|||||||
if ( penWidth == 0 )
|
if ( penWidth == 0 )
|
||||||
penWidth = 1 ;
|
penWidth = 1 ;
|
||||||
::PenSize(penWidth, penWidth);
|
::PenSize(penWidth, penWidth);
|
||||||
|
|
||||||
int penStyle = m_pen.GetStyle();
|
int penStyle = m_pen.GetStyle();
|
||||||
if (penStyle == wxSOLID)
|
Pattern pat;
|
||||||
{
|
if (penStyle == wxUSER_DASH)
|
||||||
::PenPat(GetQDGlobalsBlack(&blackColor));
|
{
|
||||||
}
|
// FIXME: there should be exactly 8 items in the dash
|
||||||
else if (IS_HATCH(penStyle))
|
wxDash* dash ;
|
||||||
{
|
int number = m_pen.GetDashes(&dash) ;
|
||||||
Pattern pat ;
|
int index = 0;
|
||||||
wxMacGetHatchPattern(penStyle, &pat);
|
for ( int i = 0 ; i < 8 ; ++i )
|
||||||
::PenPat(&pat);
|
{
|
||||||
|
pat.pat[i] = dash[index] ;
|
||||||
|
if (index < number - 1)
|
||||||
|
index++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
|
wxMacGetPattern(penStyle, &pat);
|
||||||
switch( penStyle )
|
|
||||||
{
|
|
||||||
case wxDOT :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0xCC ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxLONG_DASH :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0xFE ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxSHORT_DASH :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0xEE ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxDOT_DASH :
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = 0x6F ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
case wxUSER_DASH :
|
|
||||||
{
|
|
||||||
wxDash* dash ;
|
|
||||||
m_pen.GetDashes(&dash) ;
|
|
||||||
// right now we don't allocate larger pixmaps
|
|
||||||
// int number =
|
|
||||||
m_pen.GetDashes(&dash) ;
|
|
||||||
for ( int i = 0 ; i < 8 ; ++i )
|
|
||||||
{
|
|
||||||
pat.pat[i] = dash[0] ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
::PenPat(&pat);
|
|
||||||
}
|
}
|
||||||
|
::PenPat(&pat);
|
||||||
|
|
||||||
short mode = patCopy ;
|
short mode = patCopy ;
|
||||||
// todo :
|
// todo :
|
||||||
switch( m_logicalFunction )
|
switch( m_logicalFunction )
|
||||||
@@ -1997,28 +1959,28 @@ void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
|||||||
Pattern whiteColor ;
|
Pattern whiteColor ;
|
||||||
switch( background.MacGetBrushKind() )
|
switch( background.MacGetBrushKind() )
|
||||||
{
|
{
|
||||||
case kwxMacBrushTheme :
|
case kwxMacBrushTheme :
|
||||||
{
|
{
|
||||||
::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
|
::SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case kwxMacBrushThemeBackground :
|
case kwxMacBrushThemeBackground :
|
||||||
{
|
{
|
||||||
Rect extent ;
|
Rect extent ;
|
||||||
ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
|
ThemeBackgroundKind bg = background.GetMacThemeBackground( &extent ) ;
|
||||||
::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
|
::ApplyThemeBackground( bg , &extent ,kThemeStateActive , wxDisplayDepth() , true ) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case kwxMacBrushColour :
|
case kwxMacBrushColour :
|
||||||
{
|
{
|
||||||
::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
|
::RGBBackColor( &MAC_WXCOLORREF( background.GetColour().GetPixel()) );
|
||||||
int brushStyle = background.GetStyle();
|
int brushStyle = background.GetStyle();
|
||||||
if (brushStyle == wxSOLID)
|
if (brushStyle == wxSOLID)
|
||||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||||
else if (IS_HATCH(brushStyle))
|
else if (IS_HATCH(brushStyle))
|
||||||
{
|
{
|
||||||
Pattern pat ;
|
Pattern pat ;
|
||||||
wxMacGetHatchPattern(brushStyle, &pat);
|
wxMacGetPattern(brushStyle, &pat);
|
||||||
::BackPat(&pat);
|
::BackPat(&pat);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2048,7 +2010,7 @@ void wxDC::MacInstallBrush() const
|
|||||||
else if (IS_HATCH(brushStyle))
|
else if (IS_HATCH(brushStyle))
|
||||||
{
|
{
|
||||||
Pattern pat ;
|
Pattern pat ;
|
||||||
wxMacGetHatchPattern(brushStyle, &pat);
|
wxMacGetPattern(brushStyle, &pat);
|
||||||
::PenPat(&pat);
|
::PenPat(&pat);
|
||||||
}
|
}
|
||||||
else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
|
else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
|
||||||
|
Reference in New Issue
Block a user