- case wxAND: // src AND dst
- dstColor.red = dstColor.red & srcColor.red ;
- dstColor.green = dstColor.green & srcColor.green ;
- dstColor.blue = dstColor.blue & srcColor.blue ;
- break ;
- case wxAND_INVERT: // (NOT src) AND dst
- dstColor.red = dstColor.red & ~srcColor.red ;
- dstColor.green = dstColor.green & ~srcColor.green ;
- dstColor.blue = dstColor.blue & ~srcColor.blue ;
- break ;
- case wxAND_REVERSE:// src AND (NOT dst)
- dstColor.red = ~dstColor.red & srcColor.red ;
- dstColor.green = ~dstColor.green & srcColor.green ;
- dstColor.blue = ~dstColor.blue & srcColor.blue ;
- break ;
- case wxCLEAR: // 0
- dstColor.red = 0 ;
- dstColor.green = 0 ;
- dstColor.blue = 0 ;
- break ;
+ case wxAND: // src AND dst
+ dstColor.red = dstColor.red & srcColor.red ;
+ dstColor.green = dstColor.green & srcColor.green ;
+ dstColor.blue = dstColor.blue & srcColor.blue ;
+ break ;
+ case wxAND_INVERT: // (NOT src) AND dst
+ dstColor.red = dstColor.red & ~srcColor.red ;
+ dstColor.green = dstColor.green & ~srcColor.green ;
+ dstColor.blue = dstColor.blue & ~srcColor.blue ;
+ break ;
+ case wxAND_REVERSE:// src AND (NOT dst)
+ dstColor.red = ~dstColor.red & srcColor.red ;
+ dstColor.green = ~dstColor.green & srcColor.green ;
+ dstColor.blue = ~dstColor.blue & srcColor.blue ;
+ break ;
+ case wxCLEAR: // 0
+ dstColor.red = 0 ;
+ dstColor.green = 0 ;
+ dstColor.blue = 0 ;
+ break ;
- dstColor.red = srcColor.red ;
- dstColor.green = srcColor.green ;
- dstColor.blue = srcColor.blue ;
- break ;
- case wxEQUIV: // (NOT src) XOR dst
- dstColor.red = dstColor.red ^ ~srcColor.red ;
- dstColor.green = dstColor.green ^ ~srcColor.green ;
- dstColor.blue = dstColor.blue ^ ~srcColor.blue ;
- break ;
- case wxINVERT: // NOT dst
- dstColor.red = ~dstColor.red ;
- dstColor.green = ~dstColor.green ;
- dstColor.blue = ~dstColor.blue ;
- break ;
- case wxNAND: // (NOT src) OR (NOT dst)
- dstColor.red = ~dstColor.red | ~srcColor.red ;
- dstColor.green = ~dstColor.green | ~srcColor.green ;
- dstColor.blue = ~dstColor.blue | ~srcColor.blue ;
- break ;
- case wxNOR: // (NOT src) AND (NOT dst)
- dstColor.red = ~dstColor.red & ~srcColor.red ;
- dstColor.green = ~dstColor.green & ~srcColor.green ;
- dstColor.blue = ~dstColor.blue & ~srcColor.blue ;
- break ;
- case wxNO_OP: // dst
- break ;
- case wxOR: // src OR dst
- dstColor.red = dstColor.red | srcColor.red ;
- dstColor.green = dstColor.green | srcColor.green ;
- dstColor.blue = dstColor.blue | srcColor.blue ;
- break ;
- case wxOR_INVERT: // (NOT src) OR dst
- dstColor.red = dstColor.red | ~srcColor.red ;
- dstColor.green = dstColor.green | ~srcColor.green ;
- dstColor.blue = dstColor.blue | ~srcColor.blue ;
- break ;
- case wxOR_REVERSE: // src OR (NOT dst)
- dstColor.red = ~dstColor.red | srcColor.red ;
- dstColor.green = ~dstColor.green | srcColor.green ;
- dstColor.blue = ~dstColor.blue | srcColor.blue ;
- break ;
- case wxSET: // 1
- dstColor.red = 0xFFFF ;
- dstColor.green = 0xFFFF ;
- dstColor.blue = 0xFFFF ;
- break ;
- case wxSRC_INVERT: // (NOT src)
- dstColor.red = ~srcColor.red ;
- dstColor.green = ~srcColor.green ;
- dstColor.blue = ~srcColor.blue ;
- break ;
- case wxXOR: // src XOR dst
- dstColor.red = dstColor.red ^ srcColor.red ;
- dstColor.green = dstColor.green ^ srcColor.green ;
- dstColor.blue = dstColor.blue ^ srcColor.blue ;
- break ;
+ dstColor.red = srcColor.red ;
+ dstColor.green = srcColor.green ;
+ dstColor.blue = srcColor.blue ;
+ break ;
+ case wxEQUIV: // (NOT src) XOR dst
+ dstColor.red = dstColor.red ^ ~srcColor.red ;
+ dstColor.green = dstColor.green ^ ~srcColor.green ;
+ dstColor.blue = dstColor.blue ^ ~srcColor.blue ;
+ break ;
+ case wxINVERT: // NOT dst
+ dstColor.red = ~dstColor.red ;
+ dstColor.green = ~dstColor.green ;
+ dstColor.blue = ~dstColor.blue ;
+ break ;
+ case wxNAND: // (NOT src) OR (NOT dst)
+ dstColor.red = ~dstColor.red | ~srcColor.red ;
+ dstColor.green = ~dstColor.green | ~srcColor.green ;
+ dstColor.blue = ~dstColor.blue | ~srcColor.blue ;
+ break ;
+ case wxNOR: // (NOT src) AND (NOT dst)
+ dstColor.red = ~dstColor.red & ~srcColor.red ;
+ dstColor.green = ~dstColor.green & ~srcColor.green ;
+ dstColor.blue = ~dstColor.blue & ~srcColor.blue ;
+ break ;
+ case wxNO_OP: // dst
+ break ;
+ case wxOR: // src OR dst
+ dstColor.red = dstColor.red | srcColor.red ;
+ dstColor.green = dstColor.green | srcColor.green ;
+ dstColor.blue = dstColor.blue | srcColor.blue ;
+ break ;
+ case wxOR_INVERT: // (NOT src) OR dst
+ dstColor.red = dstColor.red | ~srcColor.red ;
+ dstColor.green = dstColor.green | ~srcColor.green ;
+ dstColor.blue = dstColor.blue | ~srcColor.blue ;
+ break ;
+ case wxOR_REVERSE: // src OR (NOT dst)
+ dstColor.red = ~dstColor.red | srcColor.red ;
+ dstColor.green = ~dstColor.green | srcColor.green ;
+ dstColor.blue = ~dstColor.blue | srcColor.blue ;
+ break ;
+ case wxSET: // 1
+ dstColor.red = 0xFFFF ;
+ dstColor.green = 0xFFFF ;
+ dstColor.blue = 0xFFFF ;
+ break ;
+ case wxSRC_INVERT: // (NOT src)
+ dstColor.red = ~srcColor.red ;
+ dstColor.green = ~srcColor.green ;
+ dstColor.blue = ~srcColor.blue ;
+ break ;
+ case wxXOR: // src XOR dst
+ dstColor.red = dstColor.red ^ srcColor.red ;
+ dstColor.green = dstColor.green ^ srcColor.green ;
+ dstColor.blue = dstColor.blue ^ srcColor.blue ;
+ break ;
- m_ok = FALSE;
- m_colour = TRUE;
-
- m_mm_to_pix_x = mm2pt;
- m_mm_to_pix_y = mm2pt;
-
- m_internalDeviceOriginX = 0;
- m_internalDeviceOriginY = 0;
- m_externalDeviceOriginX = 0;
- m_externalDeviceOriginY = 0;
-
- m_logicalScaleX = 1.0;
- m_logicalScaleY = 1.0;
- m_userScaleX = 1.0;
- m_userScaleY = 1.0;
- m_scaleX = 1.0;
- m_scaleY = 1.0;
-
- m_needComputeScaleX = FALSE;
- m_needComputeScaleY = FALSE;
-
- m_macPort = NULL ;
- m_macMask = NULL ;
- m_ok = FALSE ;
-
- m_macFontInstalled = false ;
- m_macBrushInstalled = false ;
- m_macPenInstalled = false ;
-
- m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
- m_macBoundaryClipRgn = NewRgn() ;
- m_macCurrentClipRgn = NewRgn() ;
-
- SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
- SetRectRgn( (RgnHandle) m_macCurrentClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
-
+ m_ok = FALSE;
+ m_colour = TRUE;
+ m_mm_to_pix_x = mm2pt;
+ m_mm_to_pix_y = mm2pt;
+ m_internalDeviceOriginX = 0;
+ m_internalDeviceOriginY = 0;
+ m_externalDeviceOriginX = 0;
+ m_externalDeviceOriginY = 0;
+ m_logicalScaleX = 1.0;
+ m_logicalScaleY = 1.0;
+ m_userScaleX = 1.0;
+ m_userScaleY = 1.0;
+ m_scaleX = 1.0;
+ m_scaleY = 1.0;
+ m_needComputeScaleX = FALSE;
+ m_needComputeScaleY = FALSE;
+ m_macPort = NULL ;
+ m_macMask = NULL ;
+ m_ok = FALSE ;
+ m_macFontInstalled = false ;
+ m_macBrushInstalled = false ;
+ m_macPenInstalled = false ;
+ m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
+ m_macBoundaryClipRgn = NewRgn() ;
+ m_macCurrentClipRgn = NewRgn() ;
+ SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
+ SetRectRgn( (RgnHandle) m_macCurrentClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
- // CMB: copy scale to see if it changes
- double origScaleX = m_scaleX;
- double origScaleY = m_scaleY;
-
- m_scaleX = m_logicalScaleX * m_userScaleX;
- m_scaleY = m_logicalScaleY * m_userScaleY;
-
- m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
- m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
-
- // CMB: if scale has changed call SetPen to recalulate the line width
- if (m_scaleX != origScaleX || m_scaleY != origScaleY)
- {
- // this is a bit artificial, but we need to force wxDC to think
- // the pen has changed
- wxPen* pen = & GetPen();
- wxPen tempPen;
- m_pen = tempPen;
- SetPen(* pen);
- }
+ // CMB: copy scale to see if it changes
+ double origScaleX = m_scaleX;
+ double origScaleY = m_scaleY;
+ m_scaleX = m_logicalScaleX * m_userScaleX;
+ m_scaleY = m_logicalScaleY * m_userScaleY;
+ m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
+ m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
+ // CMB: if scale has changed call SetPen to recalulate the line width
+ if (m_scaleX != origScaleX || m_scaleY != origScaleY)
+ {
+ // this is a bit artificial, but we need to force wxDC to think
+ // the pen has changed
+ wxPen* pen = & GetPen();
+ wxPen tempPen;
+ m_pen = tempPen;
+ SetPen(* pen);
+ }
- wxCHECK_RET(Ok(), wxT("Invalid DC"));
- wxMacPortSetter helper(this) ;
-
- if (m_pen.GetStyle() == wxTRANSPARENT)
- return;
-
- MacInstallPen() ;
-
- wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
- m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
-
- wxCoord x1, x2 , y1 , y2 ;
- 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++)
- {
- x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
- y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
- ::LineTo( x2 - offset, y2 - offset );
- }
+ wxCHECK_RET(Ok(), wxT("Invalid DC"));
+ wxMacPortSetter helper(this) ;
+ if (m_pen.GetStyle() == wxTRANSPARENT)
+ return;
+ MacInstallPen() ;
+ wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
+ m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
+ wxCoord x1, x2 , y1 , y2 ;
+ 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++)
+ {
+ x2 = XLOG2DEVMAC(points[i+1].x + xoffset);
+ y2 = YLOG2DEVMAC(points[i+1].y + yoffset);
+ ::LineTo( x2 - offset, y2 - offset );
+ }
-
- wxCoord xx = XLOG2DEVMAC(x);
- wxCoord yy = YLOG2DEVMAC(y);
- wxCoord ww = m_signX * XLOG2DEVREL(width);
- wxCoord hh = m_signY * YLOG2DEVREL(height);
-
- // CMB: draw nothing if transformed w or h is 0
- if (ww == 0 || hh == 0)
- return;
-
- // CMB: handle -ve width and/or height
- if (ww < 0)
- {
- ww = -ww;
- xx = xx - ww;
- }
-
- if (hh < 0)
- {
- hh = -hh;
- yy = yy - hh;
- }
-
- Rect rect = { yy , xx , yy + hh , xx + ww } ;
-
- if (m_brush.GetStyle() != wxTRANSPARENT)
- {
- MacInstallBrush() ;
- ::PaintRect( &rect ) ;
- }
-
- if (m_pen.GetStyle() != wxTRANSPARENT)
- {
- MacInstallPen() ;
- ::FrameRect( &rect ) ;
- }
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
+ wxCoord ww = m_signX * XLOG2DEVREL(width);
+ wxCoord hh = m_signY * YLOG2DEVREL(height);
+ // CMB: draw nothing if transformed w or h is 0
+ if (ww == 0 || hh == 0)
+ return;
+ // CMB: handle -ve width and/or height
+ if (ww < 0)
+ {
+ ww = -ww;
+ xx = xx - ww;
+ }
+ if (hh < 0)
+ {
+ hh = -hh;
+ yy = yy - hh;
+ }
+ Rect rect = { yy , xx , yy + hh , xx + ww } ;
+ if (m_brush.GetStyle() != wxTRANSPARENT)
+ {
+ MacInstallBrush() ;
+ ::PaintRect( &rect ) ;
+ }
+ if (m_pen.GetStyle() != wxTRANSPARENT)
+ {
+ MacInstallPen() ;
+ ::FrameRect( &rect ) ;
+ }
- radius = - radius * ((width < height) ? width : height);
-
- wxCoord xx = XLOG2DEVMAC(x);
- wxCoord yy = YLOG2DEVMAC(y);
- wxCoord ww = m_signX * XLOG2DEVREL(width);
- wxCoord hh = m_signY * YLOG2DEVREL(height);
-
- // CMB: draw nothing if transformed w or h is 0
- if (ww == 0 || hh == 0)
- return;
-
- // CMB: handle -ve width and/or height
- if (ww < 0)
- {
- ww = -ww;
- xx = xx - ww;
- }
-
- if (hh < 0)
- {
- hh = -hh;
- yy = yy - hh;
- }
-
- Rect rect = { yy , xx , yy + hh , xx + ww } ;
-
- if (m_brush.GetStyle() != wxTRANSPARENT)
- {
- MacInstallBrush() ;
- ::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
- }
-
- if (m_pen.GetStyle() != wxTRANSPARENT)
- {
- MacInstallPen() ;
- ::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
- }
+ radius = - radius * ((width < height) ? width : height);
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
+ wxCoord ww = m_signX * XLOG2DEVREL(width);
+ wxCoord hh = m_signY * YLOG2DEVREL(height);
+ // CMB: draw nothing if transformed w or h is 0
+ if (ww == 0 || hh == 0)
+ return;
+ // CMB: handle -ve width and/or height
+ if (ww < 0)
+ {
+ ww = -ww;
+ xx = xx - ww;
+ }
+ if (hh < 0)
+ {
+ hh = -hh;
+ yy = yy - hh;
+ }
+ Rect rect = { yy , xx , yy + hh , xx + ww } ;
+ if (m_brush.GetStyle() != wxTRANSPARENT)
+ {
+ MacInstallBrush() ;
+ ::PaintRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
+ }
+ if (m_pen.GetStyle() != wxTRANSPARENT)
+ {
+ MacInstallPen() ;
+ ::FrameRoundRect( &rect , int(radius * 2) , int(radius * 2) ) ;
+ }
-
- wxCoord xx = XLOG2DEVMAC(x);
- wxCoord yy = YLOG2DEVMAC(y);
- wxCoord ww = m_signX * XLOG2DEVREL(width);
- wxCoord hh = m_signY * YLOG2DEVREL(height);
-
- // CMB: draw nothing if transformed w or h is 0
- if (ww == 0 || hh == 0)
- return;
-
- // CMB: handle -ve width and/or height
- if (ww < 0)
- {
- ww = -ww;
- xx = xx - ww;
- }
-
- if (hh < 0)
- {
- hh = -hh;
- yy = yy - hh;
- }
-
- Rect rect = { yy , xx , yy + hh , xx + ww } ;
-
- if (m_brush.GetStyle() != wxTRANSPARENT)
- {
- MacInstallBrush() ;
- ::PaintOval( &rect ) ;
- }
-
- if (m_pen.GetStyle() != wxTRANSPARENT)
- {
- MacInstallPen() ;
- ::FrameOval( &rect ) ;
- }
+ wxCoord xx = XLOG2DEVMAC(x);
+ wxCoord yy = YLOG2DEVMAC(y);
+ wxCoord ww = m_signX * XLOG2DEVREL(width);
+ wxCoord hh = m_signY * YLOG2DEVREL(height);
+ // CMB: draw nothing if transformed w or h is 0
+ if (ww == 0 || hh == 0)
+ return;
+ // CMB: handle -ve width and/or height
+ if (ww < 0)
+ {
+ ww = -ww;
+ xx = xx - ww;
+ }
+ if (hh < 0)
+ {
+ hh = -hh;
+ yy = yy - hh;
+ }
+ Rect rect = { yy , xx , yy + hh , xx + ww } ;
+ if (m_brush.GetStyle() != wxTRANSPARENT)
+ {
+ MacInstallBrush() ;
+ ::PaintOval( &rect ) ;
+ }
+ if (m_pen.GetStyle() != wxTRANSPARENT)
+ {
+ MacInstallPen() ;
+ ::FrameOval( &rect ) ;
+ }
-
- Rect srcrect , dstrect ;
- 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 ) ;
-
+ Rect srcrect , dstrect ;
+ 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 ) ;
- case wxAND: // src AND dst
- mode = srcOr ; // ok
- break ;
- case wxAND_INVERT: // (NOT src) AND dst
- mode = notSrcOr ; // ok
- break ;
- case wxAND_REVERSE:// src AND (NOT dst)
- invertDestinationFirst = true ;
- mode = srcOr ;
- break ;
- case wxCLEAR: // 0
- mode = kEmulatedMode ;
- break ;
- case wxCOPY: // src
- mode = srcCopy ; // ok
- break ;
- case wxEQUIV: // (NOT src) XOR dst
- mode = srcXor ; // ok
- break ;
- case wxINVERT: // NOT dst
- mode = kEmulatedMode ; //or hilite ;
- break ;
- case wxNAND: // (NOT src) OR (NOT dst)
- invertDestinationFirst = true ;
- mode = srcBic ;
- break ;
- case wxNOR: // (NOT src) AND (NOT dst)
- invertDestinationFirst = true ;
- mode = notSrcOr ;
- break ;
- case wxNO_OP: // dst
- mode = kEmulatedMode ; // this has already been handled upon entry
- break ;
- case wxOR: // src OR dst
- mode = notSrcBic ;
- break ;
- case wxOR_INVERT: // (NOT src) OR dst
- mode = srcBic ;
- break ;
- case wxOR_REVERSE: // src OR (NOT dst)
- invertDestinationFirst = true ;
- mode = notSrcBic ;
- break ;
- case wxSET: // 1
- mode = kEmulatedMode ;
- break ;
- case wxSRC_INVERT: // (NOT src)
- mode = notSrcCopy ; // ok
- break ;
- case wxXOR: // src XOR dst
- mode = notSrcXor ; // ok
- break ;
-
- default :
- break ;
-
+ case wxAND: // src AND dst
+ mode = adMin ; // ok
+ break ;
+ case wxAND_INVERT: // (NOT src) AND dst
+ mode = notSrcOr ; // ok
+ break ;
+ case wxAND_REVERSE:// src AND (NOT dst)
+ invertDestinationFirst = true ;
+ mode = srcOr ;
+ break ;
+ case wxCLEAR: // 0
+ mode = kEmulatedMode ;
+ break ;
+ case wxCOPY: // src
+ mode = srcCopy ; // ok
+ break ;
+ case wxEQUIV: // (NOT src) XOR dst
+ mode = srcXor ; // ok
+ break ;
+ case wxINVERT: // NOT dst
+ mode = kEmulatedMode ; //or hilite ;
+ break ;
+ case wxNAND: // (NOT src) OR (NOT dst)
+ invertDestinationFirst = true ;
+ mode = srcBic ;
+ break ;
+ case wxNOR: // (NOT src) AND (NOT dst)
+ invertDestinationFirst = true ;
+ mode = notSrcOr ;
+ break ;
+ case wxNO_OP: // dst
+ mode = kEmulatedMode ; // this has already been handled upon entry
+ break ;
+ case wxOR: // src OR dst
+ mode = notSrcBic ;
+ break ;
+ case wxOR_INVERT: // (NOT src) OR dst
+ mode = srcBic ;
+ break ;
+ case wxOR_REVERSE: // src OR (NOT dst)
+ invertDestinationFirst = true ;
+ mode = notSrcBic ;
+ break ;
+ case wxSET: // 1
+ mode = kEmulatedMode ;
+ break ;
+ case wxSRC_INVERT: // (NOT src)
+ mode = notSrcCopy ; // ok
+ break ;
+ case wxXOR: // src XOR dst
+ mode = notSrcXor ; // ok
+ break ;
+ default :
+ break ;
-
- if ( useMask && source->m_macMask )
- {
- if ( mode == srcCopy )
- {
- if ( LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) )
- {
- CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
- GetPortBitMapForCopyBits( MAC_WXHBITMAP(source->m_macMask) ) ,
- GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
- &srcrect, &srcrect , &dstrect ) ;
- UnlockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) ;
- }
- }
- else
- {
+ if ( useMask && source->m_macMask )
+ {
+ if ( mode == srcCopy )
+ {
+ if ( LockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) )
+ {
+ CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
+ GetPortBitMapForCopyBits( MAC_WXHBITMAP(source->m_macMask) ) ,
+ GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+ &srcrect, &srcrect , &dstrect ) ;
+ UnlockPixels( GetGWorldPixMap( MAC_WXHBITMAP(source->m_macMask) ) ) ;
+ }
+ }
+ else
+ {
- CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
- GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
- &srcrect, &dstrect, mode, NULL ) ;
- }
- DisposeRgn( clipRgn ) ;
- }
- UnlockPixels( bmappixels ) ;
- }
-
- m_macPenInstalled = false ;
- m_macBrushInstalled = false ;
- m_macFontInstalled = false ;
-
- return TRUE;
+ CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
+ GetPortBitMapForCopyBits( MAC_WXHBITMAP(m_macPort) ) ,
+ &srcrect, &dstrect, mode, NULL ) ;
+ }
+ DisposeRgn( clipRgn ) ;
+ }
+ UnlockPixels( bmappixels ) ;
+ }
+ m_macPenInstalled = false ;
+ m_macBrushInstalled = false ;
+ m_macFontInstalled = false ;
+ return TRUE;
-
- TECObjectRef ec;
- status = TECCreateConverter(&ec, kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
- wxASSERT_MSG( status == noErr , "couldn't start converter" ) ;
-
+ ATSUTextLayout atsuLayout ;
+ UniCharCount chars = str.Length() ;
+#if wxUSE_UNICODE
+ status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) (const wxChar*) str , 0 , str.Length() , str.Length() , 1 ,
+ &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
+#else
+ TECObjectRef ec;
+ status = TECCreateConverter(&ec,
+ wxApp::s_macDefaultEncodingIsPC ? kTextEncodingWindowsLatin1 : kTextEncodingMacRoman, kTextEncodingUnicodeDefault);
+
+ wxASSERT_MSG( status == noErr , wxT("couldn't start converter") ) ;
-
- status = TECConvertText(ec, (ConstTextPtr)text.c_str() , byteInLen, &byteInLen,
- (TextPtr)buf, byteBufferLen, &byteOutLen);
-
- wxASSERT_MSG( status == noErr , "couldn't convert text" ) ;
- status = TECDisposeConverter(ec);
- wxASSERT_MSG( status == noErr , "couldn't dispose converter" ) ;
-
- ATSUTextLayout atsuLayout ;
- UniCharCount chars = byteOutLen / 2 ;
+ status = TECConvertText(ec, (ConstTextPtr)str.c_str() , byteInLen, &byteInLen,
+ (TextPtr)buf, byteBufferLen, &byteOutLen);
+ wxASSERT_MSG( status == noErr , wxT("couldn't convert text") ) ;
+ status = TECDisposeConverter(ec);
+ wxASSERT_MSG( status == noErr , wxT("couldn't dispose converter") ) ;
- Fixed atsuAngle = IntToFixed( angle ) ;
- ByteCount angleSize = sizeof(Fixed) ;
- ATSUAttributeTag rotationTag = kATSULineRotationTag ;
- ATSUAttributeValuePtr angleValue = &atsuAngle ;
- status = ::ATSUSetLayoutControls(atsuLayout , 1 , &rotationTag , &angleSize , &angleValue ) ;
+ Fixed atsuAngle = IntToFixed( iAngle ) ;
+ ATSUAttributeTag atsuTags[] =
+ {
+ kATSULineRotationTag ,
+ } ;
+ ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+ {
+ sizeof( Fixed ) ,
+ } ;
+ ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+ {
+ &atsuAngle ,
+ } ;
+ status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag),
+ atsuTags, atsuSizes, atsuValues ) ;
- if ( useDrawThemeText )
- {
- Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 1000 } ;
- CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text + laststop , i - laststop , CFStringGetSystemEncoding(), false ) ;
- ::DrawThemeTextBox( mString,
- kThemeCurrentPortFont,
- kThemeStateActive,
- false,
- &frame,
- teJustLeft,
- nil );
- CFRelease( mString ) ;
- line++ ;
+ if ( useDrawThemeText )
+ {
+ Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+ wxMacCFStringHolder mString( linetext ) ;
+ if ( m_backgroundMode != wxTRANSPARENT )
+ {
+ Point bounds={0,0} ;
+ Rect background = frame ;
+ SInt16 baseline ;
+ ::GetThemeTextDimensions( mString,
+ kThemeCurrentPortFont,
+ kThemeStateActive,
+ false,
+ &bounds,
+ &baseline );
+ background.right = background.left + bounds.h ;
+ background.bottom = background.top + bounds.v ;
+ ::EraseRect( &background ) ;
+ }
+ ::DrawThemeTextBox( mString,
+ kThemeCurrentPortFont,
+ kThemeStateActive,
+ false,
+ &frame,
+ teJustLeft,
+ nil );
+ line++ ;
- {
- Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 1000 } ;
- CFStringRef mString = CFStringCreateWithCString( NULL , text + laststop , kCFStringEncodingMacRoman ) ;
- ::DrawThemeTextBox( mString,
- kThemeCurrentPortFont,
- kThemeStateActive,
- false,
- &frame,
- teJustLeft,
- nil );
- CFRelease( mString ) ;
+ {
+ Rect frame = { yy + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
+ wxMacCFStringHolder mString( linetext ) ;
+
+ if ( m_backgroundMode != wxTRANSPARENT )
+ {
+ Point bounds={0,0} ;
+ Rect background = frame ;
+ SInt16 baseline ;
+ ::GetThemeTextDimensions( mString,
+ kThemeCurrentPortFont,
+ kThemeStateActive,
+ false,
+ &bounds,
+ &baseline );
+ background.right = background.left + bounds.h ;
+ background.bottom = background.top + bounds.v ;
+ ::EraseRect( &background ) ;
+ }
+ ::DrawThemeTextBox( mString,
+ kThemeCurrentPortFont,
+ kThemeStateActive,
+ false,
+ &frame,
+ teJustLeft,
+ nil );
- wxCHECK_RET(Ok(), wxT("Invalid DC"));
- wxMacPortSetter helper(this) ;
-
- wxFont formerFont = m_font ;
-
- if ( theFont )
- {
- // work around the constness
- *((wxFont*)(&m_font)) = *theFont ;
- }
-
- MacInstallFont() ;
-
- FontInfo fi ;
- ::GetFontInfo( &fi ) ;
-#if TARGET_CARBON
- bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
- useGetThemeText = false ;
+ wxCHECK_RET(Ok(), wxT("Invalid DC"));
+ wxMacPortSetter helper(this) ;
+ wxFont formerFont = m_font ;
+ if ( theFont )
+ {
+ // work around the constness
+ *((wxFont*)(&m_font)) = *theFont ;
+ }
+ MacInstallFont() ;
+ FontInfo fi ;
+ ::GetFontInfo( &fi ) ;
+#if TARGET_CARBON
+ bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
+ if ( IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
+ useGetThemeText = false ;
-
- if ( height )
- *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
- if ( descent )
- *descent =YDEV2LOGREL( fi.descent );
- if ( externalLeading )
- *externalLeading = YDEV2LOGREL( fi.leading ) ;
-
- const char *text = NULL ;
- int length = 0 ;
- wxString macText ;
- if ( wxApp::s_macDefaultEncodingIsPC )
- {
- macText = wxMacMakeMacStringFromPC( string ) ;
- text = macText ;
- length = macText.Length() ;
- }
- else
- {
- text = string ;
- length = string.Length() ;
- }
-
- int laststop = 0 ;
- int i = 0 ;
- int curwidth = 0 ;
- if ( width )
- {
- *width = 0 ;
-
- while( i < length )
- {
- if( text[i] == 13 || text[i] == 10)
- {
- if ( height )
- *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
+ if ( height )
+ *height = YDEV2LOGREL( fi.descent + fi.ascent ) ;
+ if ( descent )
+ *descent =YDEV2LOGREL( fi.descent );
+ if ( externalLeading )
+ *externalLeading = YDEV2LOGREL( fi.leading ) ;
+ int length = strtext.Length() ;
+ /*
+ const char *text = NULL ;
+ wxString macText ;
+ if ( wxApp::s_macDefaultEncodingIsPC )
+ {
+ macText = wxMacMakeMacStringFromPC( string ) ;
+ text = macText ;
+ length = macText.Length() ;
+ }
+ else
+ {
+ text = string ;
+ length = string.Length() ;
+ }
+ */
+ int laststop = 0 ;
+ int i = 0 ;
+ int curwidth = 0 ;
+ if ( width )
+ {
+ *width = 0 ;
+ while( i < length )
+ {
+ if( strtext[i] == 13 || strtext[i] == 10)
+ {
+ wxString linetext = strtext.Mid( laststop , i - laststop ) ;
+ if ( height )
+ *height += YDEV2LOGREL( fi.descent + fi.ascent + fi.leading ) ;
- curwidth = ::TextWidth( text , laststop , i - laststop ) ;
- }
- if ( curwidth > *width )
- *width = XDEV2LOGREL( curwidth ) ;
- }
-
- if ( theFont )
- {
- // work around the constness
- *((wxFont*)(&m_font)) = formerFont ;
- m_macFontInstalled = false ;
- }
+ wxCharBuffer text = wxMacStringToCString(linetext) ;
+ curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
+ }
+ if ( curwidth > *width )
+ *width = XDEV2LOGREL( curwidth ) ;
+ }
+ if ( theFont )
+ {
+ // work around the constness
+ *((wxFont*)(&m_font)) = formerFont ;
+ m_macFontInstalled = false ;
+ }
-
- wxMacPortSetter helper(this) ;
-
- MacInstallFont() ;
-
- int width = ::TextWidth( "n" , 0 , 1 ) ;
-
- return YDEV2LOGREL(width) ;
+ wxMacPortSetter helper(this) ;
+ MacInstallFont() ;
+ int width = 0 ;
+#if TARGET_CARBON
+ bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
+ if ( ((wxFont*)&m_font)->GetNoAntiAliasing() )
+ useGetThemeText = false ;
+#endif
+ char text[] = "H" ;
+#if TARGET_CARBON
+ if ( useGetThemeText )
+ {
+ Point bounds={0,0} ;
+ SInt16 baseline ;
+ CFStringRef mString = CFStringCreateWithBytes( NULL , (UInt8*) text , 1 , CFStringGetSystemEncoding(), false ) ;
+ ::GetThemeTextDimensions( mString,
+ kThemeCurrentPortFont,
+ kThemeStateActive,
+ false,
+ &bounds,
+ &baseline );
+ CFRelease( mString ) ;
+ width = bounds.h ;
+ }
+ else
+#endif
+ {
+ width = ::TextWidth( text , 0 , 1 ) ;
+ }
+ return YDEV2LOGREL(width) ;
-// if ( m_macFontInstalled )
-// return ;
- Pattern blackColor ;
-
- MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
-
- wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
-
- if ( font )
- {
- ::TextFont( font->m_macFontNum ) ;
- ::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
- ::TextFace( font->m_macFontStyle ) ;
-
- m_macFontInstalled = true ;
- m_macBrushInstalled = false ;
- m_macPenInstalled = false ;
-
- RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
- RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
- ::RGBForeColor( &forecolor );
- ::RGBBackColor( &backcolor );
- }
- else
- {
+ // if ( m_macFontInstalled )
+ // return ;
+ Pattern blackColor ;
+ MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
+ wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
+ if ( font )
+ {
+ ::TextFont( font->m_macFontNum ) ;
+ ::TextSize( short(m_scaleY * font->m_macFontSize) ) ;
+ ::TextFace( font->m_macFontStyle ) ;
+ m_macFontInstalled = true ;
+ m_macBrushInstalled = false ;
+ m_macPenInstalled = false ;
+ RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
+ RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
+ ::RGBForeColor( &forecolor );
+ ::RGBBackColor( &backcolor );
+ }
+ else
+ {
-
- ::TextFont( fontId ) ;
- ::TextSize( short(m_scaleY * fontSize) ) ;
- ::TextFace( fontStyle ) ;
-
- // todo reset after spacing changes - or store the current spacing somewhere
-
- m_macFontInstalled = true ;
- m_macBrushInstalled = false ;
- m_macPenInstalled = false ;
-
- RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
- RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
- ::RGBForeColor( &forecolor );
- ::RGBBackColor( &backcolor );
- }
-
- short mode = patCopy ;
-
- // todo :
-
- switch( m_logicalFunction )
- {
- case wxCOPY: // src
- mode = patCopy ;
- break ;
- case wxINVERT: // NOT dst
- ::PenPat(GetQDGlobalsBlack(&blackColor));
- mode = patXor ;
- break ;
- case wxXOR: // src XOR dst
- mode = patXor ;
- break ;
- case wxOR_REVERSE: // src OR (NOT dst)
- mode = notPatOr ;
- break ;
- case wxSRC_INVERT: // (NOT src)
- mode = notPatCopy ;
- break ;
-
- // unsupported TODO
-
- case wxCLEAR: // 0
- case wxAND_REVERSE:// src AND (NOT dst)
- case wxAND: // src AND dst
- case wxAND_INVERT: // (NOT src) AND dst
- case wxNO_OP: // dst
- case wxNOR: // (NOT src) AND (NOT dst)
- case wxEQUIV: // (NOT src) XOR dst
- case wxOR_INVERT: // (NOT src) OR dst
- case wxNAND: // (NOT src) OR (NOT dst)
- case wxOR: // src OR dst
- case wxSET: // 1
-// case wxSRC_OR: // source _bitmap_ OR destination
-// case wxSRC_AND: // source _bitmap_ AND destination
- break ;
- }
- ::PenMode( mode ) ;
-
+ ::TextFont( fontId ) ;
+ ::TextSize( short(m_scaleY * fontSize) ) ;
+ ::TextFace( fontStyle ) ;
+ // todo reset after spacing changes - or store the current spacing somewhere
+ m_macFontInstalled = true ;
+ m_macBrushInstalled = false ;
+ m_macPenInstalled = false ;
+ RGBColor forecolor = MAC_WXCOLORREF( m_textForegroundColour.GetPixel());
+ RGBColor backcolor = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel());
+ ::RGBForeColor( &forecolor );
+ ::RGBBackColor( &backcolor );
+ }
+ short mode = patCopy ;
+ // todo :
+ switch( m_logicalFunction )
+ {
+ case wxCOPY: // src
+ mode = patCopy ;
+ break ;
+ case wxINVERT: // NOT dst
+ ::PenPat(GetQDGlobalsBlack(&blackColor));
+ mode = patXor ;
+ break ;
+ case wxXOR: // src XOR dst
+ mode = patXor ;
+ break ;
+ case wxOR_REVERSE: // src OR (NOT dst)
+ mode = notPatOr ;
+ break ;
+ case wxSRC_INVERT: // (NOT src)
+ mode = notPatCopy ;
+ break ;
+ case wxAND: // src AND dst
+ mode = adMin ;
+ break ;
+ // unsupported TODO
+ case wxCLEAR: // 0
+ case wxAND_REVERSE:// src AND (NOT dst)
+ case wxAND_INVERT: // (NOT src) AND dst
+ case wxNO_OP: // dst
+ case wxNOR: // (NOT src) AND (NOT dst)
+ case wxEQUIV: // (NOT src) XOR dst
+ case wxOR_INVERT: // (NOT src) OR dst
+ case wxNAND: // (NOT src) OR (NOT dst)
+ case wxOR: // src OR dst
+ case wxSET: // 1
+ // case wxSRC_OR: // source _bitmap_ OR destination
+ // case wxSRC_AND: // source _bitmap_ AND destination
+ break ;
+ }
+ ::PenMode( mode ) ;
-
- ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
- {
- &atsuFont ,
- &atsuSize ,
-// &MAC_WXCOLORREF( m_textForegroundColour.GetPixel() ) ,
- &kBaselineDefault ,
- &kHorizontal,
-
- (qdStyle & bold) ? &kTrue : &kFalse ,
- (qdStyle & italic) ? &kTrue : &kFalse ,
- (qdStyle & underline) ? &kTrue : &kFalse ,
- (qdStyle & condense) ? &kTrue : &kFalse ,
- (qdStyle & extend) ? &kTrue : &kFalse ,
- } ;
-
- status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
- atsuTags, atsuSizes, atsuValues);
- wxASSERT_MSG( status == noErr , "couldn't set create ATSU style" ) ;
-
+ ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
+ {
+ &atsuFont ,
+ &atsuSize ,
+ // &MAC_WXCOLORREF( m_textForegroundColour.GetPixel() ) ,
+ // &kBaselineDefault ,
+ &kHorizontal,
+ (qdStyle & bold) ? &kTrue : &kFalse ,
+ (qdStyle & italic) ? &kTrue : &kFalse ,
+ (qdStyle & underline) ? &kTrue : &kFalse ,
+ (qdStyle & condense) ? &kTrue : &kFalse ,
+ (qdStyle & extend) ? &kTrue : &kFalse ,
+ } ;
+ status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag),
+ atsuTags, atsuSizes, atsuValues);
+ wxASSERT_MSG( status == noErr , wxT("couldn't set create ATSU style") ) ;
- { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } ,
- { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } ,
- { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } ,
- { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } ,
- { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } ,
- { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } ,
- { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } ,
+ { { 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF , 0xFF } },
+ { { 0x01 , 0x02 , 0x04 , 0x08 , 0x10 , 0x20 , 0x40 , 0x80 } },
+ { { 0x80 , 0x40 , 0x20 , 0x10 , 0x08 , 0x04 , 0x02 , 0x01 } },
+ { { 0x10 , 0x10 , 0x10 , 0xFF , 0x10 , 0x10 , 0x10 , 0x10 } },
+ { { 0x00 , 0x00 , 0x00 , 0xFF , 0x00 , 0x00 , 0x00 , 0x00 } },
+ { { 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 , 0x10 } },
+ { { 0x81 , 0x42 , 0x24 , 0x18 , 0x18 , 0x24 , 0x42 , 0x81 } }
-
- Pattern blackColor;
-
-// if ( m_macPenInstalled )
-// return ;
-
- RGBColor forecolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
- RGBColor backcolor = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel());
- ::RGBForeColor( &forecolor );
- ::RGBBackColor( &backcolor );
-
- ::PenNormal() ;
- int penWidth = m_pen.GetWidth() * (int) m_scaleX ;
-
- // null means only one pixel, at whatever resolution
- if ( penWidth == 0 )
- penWidth = 1 ;
- ::PenSize(penWidth, penWidth);
-
- int penStyle = m_pen.GetStyle();
-
- if (penStyle == wxSOLID)
- {
- ::PenPat(GetQDGlobalsBlack(&blackColor));
- }
- else if (IS_HATCH(penStyle))
- {
- Pattern pat ;
- wxMacGetHatchPattern(penStyle, &pat);
- ::PenPat(&pat);
- }
- else
- {
- Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
- 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 :
+ Pattern blackColor;
+ // if ( m_macPenInstalled )
+ // return ;
+ RGBColor forecolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
+ RGBColor backcolor = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel());
+ ::RGBForeColor( &forecolor );
+ ::RGBBackColor( &backcolor );
+ ::PenNormal() ;
+ int penWidth = m_pen.GetWidth() * (int) m_scaleX ;
+ // null means only one pixel, at whatever resolution
+ if ( penWidth == 0 )
+ penWidth = 1 ;
+ ::PenSize(penWidth, penWidth);
+ int penStyle = m_pen.GetStyle();
+ if (penStyle == wxSOLID)
+ {
+ ::PenPat(GetQDGlobalsBlack(&blackColor));
+ }
+ else if (IS_HATCH(penStyle))
+ {
+ Pattern pat ;
+ wxMacGetHatchPattern(penStyle, &pat);
+ ::PenPat(&pat);
+ }
+ else
+ {
+ Pattern pat = *GetQDGlobalsBlack(&blackColor) ;
+ 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) ;
- break ;
- case wxUSER_DASH :
- {
- wxDash* dash ;
- int number = m_pen.GetDashes(&dash) ;
- // right now we don't allocate larger pixmaps
- for ( int i = 0 ; i < 8 ; ++i )
- {
- pat.pat[i] = dash[0] ;
- }
- }
- break ;
- }
- ::PenPat(&pat);
- }
-
- short mode = patCopy ;
-
- // todo :
-
- switch( m_logicalFunction )
- {
- case wxCOPY: // only foreground color, leave background (thus not patCopy)
- mode = patOr ;
- break ;
- case wxINVERT: // NOT dst
-// ::PenPat(GetQDGlobalsBlack(&blackColor));
- mode = patXor ;
- break ;
- case wxXOR: // src XOR dst
- mode = patXor ;
- break ;
- case wxOR_REVERSE: // src OR (NOT dst)
- mode = notPatOr ;
- break ;
- case wxSRC_INVERT: // (NOT src)
- mode = notPatCopy ;
- break ;
-
- // unsupported TODO
-
- case wxCLEAR: // 0
- case wxAND_REVERSE:// src AND (NOT dst)
- case wxAND: // src AND dst
- case wxAND_INVERT: // (NOT src) AND dst
- case wxNO_OP: // dst
- case wxNOR: // (NOT src) AND (NOT dst)
- case wxEQUIV: // (NOT src) XOR dst
- case wxOR_INVERT: // (NOT src) OR dst
- case wxNAND: // (NOT src) OR (NOT dst)
- case wxOR: // src OR dst
- case wxSET: // 1
-// case wxSRC_OR: // source _bitmap_ OR destination
-// case wxSRC_AND: // source _bitmap_ AND destination
- break ;
- }
- ::PenMode( mode ) ;
- m_macPenInstalled = true ;
- m_macBrushInstalled = false ;
- m_macFontInstalled = false ;
+ }
+ break ;
+ }
+ ::PenPat(&pat);
+ }
+ short mode = patCopy ;
+ // todo :
+ switch( m_logicalFunction )
+ {
+ case wxCOPY: // only foreground color, leave background (thus not patCopy)
+ mode = patOr ;
+ break ;
+ case wxINVERT: // NOT dst
+ // ::PenPat(GetQDGlobalsBlack(&blackColor));
+ mode = patXor ;
+ break ;
+ case wxXOR: // src XOR dst
+ mode = patXor ;
+ break ;
+ case wxOR_REVERSE: // src OR (NOT dst)
+ mode = notPatOr ;
+ break ;
+ case wxSRC_INVERT: // (NOT src)
+ mode = notPatCopy ;
+ break ;
+ case wxAND: // src AND dst
+ mode = adMin ;
+ break ;
+ // unsupported TODO
+ case wxCLEAR: // 0
+ case wxAND_REVERSE:// src AND (NOT dst)
+ case wxAND_INVERT: // (NOT src) AND dst
+ case wxNO_OP: // dst
+ case wxNOR: // (NOT src) AND (NOT dst)
+ case wxEQUIV: // (NOT src) XOR dst
+ case wxOR_INVERT: // (NOT src) OR dst
+ case wxNAND: // (NOT src) OR (NOT dst)
+ case wxOR: // src OR dst
+ case wxSET: // 1
+ // case wxSRC_OR: // source _bitmap_ OR destination
+ // case wxSRC_AND: // source _bitmap_ AND destination
+ break ;
+ }
+ ::PenMode( mode ) ;
+ m_macPenInstalled = true ;
+ m_macBrushInstalled = false ;
+ m_macFontInstalled = false ;
- ::RGBBackColor( &MAC_WXCOLORREF( 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 ;
+ ::RGBBackColor( &MAC_WXCOLORREF( 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 ;
-
- Pattern blackColor ;
-// if ( m_macBrushInstalled )
-// return ;
-
- // foreground
-
- bool backgroundTransparent = (GetBackgroundMode() == wxTRANSPARENT) ;
-
- ::RGBForeColor( &MAC_WXCOLORREF( m_brush.GetColour().GetPixel()) );
- ::RGBBackColor( &MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) );
-
- int brushStyle = m_brush.GetStyle();
- if (brushStyle == wxSOLID)
- {
- ::PenPat(GetQDGlobalsBlack(&blackColor));
- }
- else if (IS_HATCH(brushStyle))
- {
- Pattern pat ;
- wxMacGetHatchPattern(brushStyle, &pat);
- ::PenPat(&pat);
- }
- else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
- {
- // we force this in order to be compliant with wxMSW
- backgroundTransparent = false ;
- // for these the text fore (and back for MASK_OPAQUE) colors are used
- wxBitmap* bitmap = m_brush.GetStipple() ;
- int width = bitmap->GetWidth() ;
- int height = bitmap->GetHeight() ;
+ Pattern blackColor ;
+ // if ( m_macBrushInstalled )
+ // return ;
+ // foreground
+ bool backgroundTransparent = (GetBackgroundMode() == wxTRANSPARENT) ;
+ ::RGBForeColor( &MAC_WXCOLORREF( m_brush.GetColour().GetPixel()) );
+ ::RGBBackColor( &MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) );
+ int brushStyle = m_brush.GetStyle();
+ if (brushStyle == wxSOLID)
+ {
+ ::PenPat(GetQDGlobalsBlack(&blackColor));
+ }
+ else if (IS_HATCH(brushStyle))
+ {
+ Pattern pat ;
+ wxMacGetHatchPattern(brushStyle, &pat);
+ ::PenPat(&pat);
+ }
+ else if ( m_brush.GetStyle() == wxSTIPPLE || m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE )
+ {
+ // we force this in order to be compliant with wxMSW
+ backgroundTransparent = false ;
+ // for these the text fore (and back for MASK_OPAQUE) colors are used
+ wxBitmap* bitmap = m_brush.GetStipple() ;
+ int width = bitmap->GetWidth() ;
+ int height = bitmap->GetHeight() ;
- CTabHandle ctable = ((**((**pixpat).patMap)).pmTable) ;
- ColorSpecPtr ctspec = (ColorSpecPtr) &(**ctable).ctTable ;
- if ( ctspec[0].rgb.red == 0x0000 )
- {
- ctspec[1].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
- ctspec[0].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
- }
- else
- {
- ctspec[0].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
- ctspec[1].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
- }
- ::CTabChanged( ctable ) ;
+ CTabHandle ctable = ((**((**pixpat).patMap)).pmTable) ;
+ ColorSpecPtr ctspec = (ColorSpecPtr) &(**ctable).ctTable ;
+ if ( ctspec[0].rgb.red == 0x0000 )
+ {
+ ctspec[1].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
+ ctspec[0].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
+ }
+ else
+ {
+ ctspec[0].rgb = MAC_WXCOLORREF( m_textBackgroundColour.GetPixel()) ;
+ ctspec[1].rgb = MAC_WXCOLORREF( m_textForegroundColour.GetPixel()) ;
+ }
+ ::CTabChanged( ctable ) ;
- ::PenPat(GetQDGlobalsBlack(&blackColor));
- }
-
- short mode = patCopy ;
- switch( m_logicalFunction )
- {
- case wxCOPY: // src
- if ( backgroundTransparent )
- mode = patOr ;
- else
- mode = patCopy ;
- break ;
- case wxINVERT: // NOT dst
- if ( !backgroundTransparent )
- {
- ::PenPat(GetQDGlobalsBlack(&blackColor));
- }
- mode = patXor ;
- break ;
- case wxXOR: // src XOR dst
- mode = patXor ;
- break ;
- case wxOR_REVERSE: // src OR (NOT dst)
- mode = notPatOr ;
- break ;
- case wxSRC_INVERT: // (NOT src)
- mode = notPatCopy ;
- break ;
-
- // unsupported TODO
-
- case wxCLEAR: // 0
- case wxAND_REVERSE:// src AND (NOT dst)
- case wxAND: // src AND dst
- case wxAND_INVERT: // (NOT src) AND dst
- case wxNO_OP: // dst
- case wxNOR: // (NOT src) AND (NOT dst)
- case wxEQUIV: // (NOT src) XOR dst
- case wxOR_INVERT: // (NOT src) OR dst
- case wxNAND: // (NOT src) OR (NOT dst)
- case wxOR: // src OR dst
- case wxSET: // 1
-// case wxSRC_OR: // source _bitmap_ OR destination
-// case wxSRC_AND: // source _bitmap_ AND destination
- break ;
- }
- ::PenMode( mode ) ;
- m_macBrushInstalled = true ;
- m_macPenInstalled = false ;
- m_macFontInstalled = false ;
+ ::PenPat(GetQDGlobalsBlack(&blackColor));
+ }
+ short mode = patCopy ;
+ switch( m_logicalFunction )
+ {
+ case wxCOPY: // src
+ if ( backgroundTransparent )
+ mode = patOr ;
+ else
+ mode = patCopy ;
+ break ;
+ case wxINVERT: // NOT dst
+ if ( !backgroundTransparent )
+ {
+ ::PenPat(GetQDGlobalsBlack(&blackColor));
+ }
+ mode = patXor ;
+ break ;
+ case wxXOR: // src XOR dst
+ mode = patXor ;
+ break ;
+ case wxOR_REVERSE: // src OR (NOT dst)
+ mode = notPatOr ;
+ break ;
+ case wxSRC_INVERT: // (NOT src)
+ mode = notPatCopy ;
+ break ;
+ case wxAND: // src AND dst
+ mode = adMin ;
+ break ;
+ // unsupported TODO
+ case wxCLEAR: // 0
+ case wxAND_REVERSE:// src AND (NOT dst)
+ case wxAND_INVERT: // (NOT src) AND dst
+ case wxNO_OP: // dst
+ case wxNOR: // (NOT src) AND (NOT dst)
+ case wxEQUIV: // (NOT src) XOR dst
+ case wxOR_INVERT: // (NOT src) OR dst
+ case wxNAND: // (NOT src) OR (NOT dst)
+ case wxOR: // src OR dst
+ case wxSET: // 1
+ // case wxSRC_OR: // source _bitmap_ OR destination
+ // case wxSRC_AND: // source _bitmap_ AND destination
+ break ;
+ }
+ ::PenMode( mode ) ;
+ m_macBrushInstalled = true ;
+ m_macPenInstalled = false ;
+ m_macFontInstalled = false ;