removed extraneous spaces

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36867 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Surovell
2006-01-14 06:55:06 +00:00
parent b93328d842
commit 0f4c3aa2cc

View File

@@ -51,7 +51,7 @@ const double M_PI = 3.14159265358979 ;
#endif #endif
#endif #endif
const double RAD2DEG = 180.0 / M_PI; const double RAD2DEG = 180.0 / M_PI;
const short kEmulatedMode = -1 ; const short kEmulatedMode = -1 ;
const short kUnsupportedMode = -2 ; const short kUnsupportedMode = -2 ;
@@ -62,9 +62,9 @@ extern TECObjectRef s_TECNativeCToUnicode ;
// The textctrl implementation still needs that (needs what?) for the non-HIView implementation // The textctrl implementation still needs that (needs what?) for the non-HIView implementation
// //
wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) : wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
wxMacPortSaver( (GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ) wxMacPortSaver( (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) )
{ {
m_newPort = (GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ; m_newPort = (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ;
m_formerClip = NewRgn() ; m_formerClip = NewRgn() ;
m_newClip = NewRgn() ; m_newClip = NewRgn() ;
GetClip( m_formerClip ) ; GetClip( m_formerClip ) ;
@@ -76,6 +76,7 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
{ {
int x = 0 , y = 0; int x = 0 , y = 0;
win->MacWindowToRootWindow( &x, &y ) ; win->MacWindowToRootWindow( &x, &y ) ;
// get area including focus rect // get area including focus rect
CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip ) ; CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion(true).GetWXHRGN() , m_newClip ) ;
if ( !EmptyRgn( m_newClip ) ) if ( !EmptyRgn( m_newClip ) )
@@ -98,7 +99,7 @@ wxMacWindowStateSaver::wxMacWindowStateSaver( const wxWindow* win ) :
wxMacWindowClipper( win ) wxMacWindowClipper( win )
{ {
// the port is already set at this point // the port is already set at this point
m_newPort = (GrafPtr) GetWindowPort((WindowRef) win->MacGetTopLevelWindowRef()) ; m_newPort = (GrafPtr) GetWindowPort( (WindowRef) win->MacGetTopLevelWindowRef() ) ;
GetThemeDrawingState( &m_themeDrawingState ) ; GetThemeDrawingState( &m_themeDrawingState ) ;
} }
@@ -392,10 +393,11 @@ protected :
m_image = image ; m_image = image ;
if ( m_image ) if ( m_image )
{ {
m_imageBounds = CGRectMake( 0.0, 0.0, (float)CGImageGetWidth( m_image ), (float)CGImageGetHeight( m_image ) ) ; m_imageBounds = CGRectMake( 0.0, 0.0, (float)CGImageGetWidth( m_image ), (float)CGImageGetHeight( m_image ) ) ;
m_patternRef = CGPatternCreate( this , m_imageBounds, transform , m_patternRef = CGPatternCreate(
m_imageBounds.size.width, m_imageBounds.size.height, this , m_imageBounds, transform ,
kCGPatternTilingNoDistortion, true , &wxMacCGPattern::ms_Callbacks ) ; m_imageBounds.size.width, m_imageBounds.size.height,
kCGPatternTilingNoDistortion, true , &wxMacCGPattern::ms_Callbacks ) ;
} }
} }
@@ -405,8 +407,8 @@ protected :
CGImageRelease( m_image ) ; CGImageRelease( m_image ) ;
} }
CGImageRef m_image ; CGImageRef m_image ;
CGRect m_imageBounds ; CGRect m_imageBounds ;
} ; } ;
class HatchPattern : public wxMacCGPattern class HatchPattern : public wxMacCGPattern
@@ -416,9 +418,10 @@ public :
{ {
m_hatch = hatchstyle ; m_hatch = hatchstyle ;
m_imageBounds = CGRectMake( 0.0, 0.0, 8.0 , 8.0 ) ; m_imageBounds = CGRectMake( 0.0, 0.0, 8.0 , 8.0 ) ;
m_patternRef = CGPatternCreate( this , m_imageBounds, transform , m_patternRef = CGPatternCreate(
m_imageBounds.size.width, m_imageBounds.size.height, this , m_imageBounds, transform ,
kCGPatternTilingNoDistortion, false , &wxMacCGPattern::ms_Callbacks ) ; m_imageBounds.size.width, m_imageBounds.size.height,
kCGPatternTilingNoDistortion, false , &wxMacCGPattern::ms_Callbacks ) ;
} }
void StrokeLineSegments( CGContextRef ctxRef , const CGPoint pts[] , size_t count ) void StrokeLineSegments( CGContextRef ctxRef , const CGPoint pts[] , size_t count )
@@ -517,7 +520,7 @@ protected :
CGRect m_imageBounds ; CGRect m_imageBounds ;
int m_hatch ; int m_hatch ;
} ; };
#pragma mark - #pragma mark -
@@ -531,7 +534,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
bool stroke = pen.GetStyle() != wxTRANSPARENT ; bool stroke = pen.GetStyle() != wxTRANSPARENT ;
#if 0 #if 0
// we can benchmark performance, should go into a setting later // we can benchmark performance; should go into a setting eventually
CGContextSetShouldAntialias( m_cgContext , false ) ; CGContextSetShouldAntialias( m_cgContext , false ) ;
#endif #endif
@@ -545,7 +548,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
RGBColor col = MAC_WXCOLORREF( pen.GetColour().GetPixel() ) ; RGBColor col = MAC_WXCOLORREF( pen.GetColour().GetPixel() ) ;
CGContextSetRGBStrokeColor( m_cgContext , col.red / 65536.0 , col.green / 65536.0 , col.blue / 65536.0 , 1.0 ) ; CGContextSetRGBStrokeColor( m_cgContext , col.red / 65536.0 , col.green / 65536.0 , col.blue / 65536.0 , 1.0 ) ;
// TODO * m_dc->m_scaleX // TODO: * m_dc->m_scaleX
float penWidth = pen.GetWidth(); float penWidth = pen.GetWidth();
if (penWidth <= 0.0) if (penWidth <= 0.0)
penWidth = 0.1; penWidth = 0.1;
@@ -1090,7 +1093,7 @@ wxSize wxDC::GetPPI() const
int wxDC::GetDepth() const int wxDC::GetDepth() const
{ {
return 32 ; return 32;
} }
void wxDC::ComputeScaleAndOrigin() void wxDC::ComputeScaleAndOrigin()
@@ -1111,7 +1114,7 @@ void wxDC::ComputeScaleAndOrigin()
wxPen pen( GetPen() ); wxPen pen( GetPen() );
m_pen = wxNullPen; m_pen = wxNullPen;
SetPen(pen); SetPen( pen );
} }
} }
@@ -1147,8 +1150,8 @@ void wxDC::SetPen( const wxPen &pen )
// we have to compensate for moved device origins etc. otherwise patterned pens are standing still // we have to compensate for moved device origins etc. otherwise patterned pens are standing still
// eg when using a wxScrollWindow and scrolling around // eg when using a wxScrollWindow and scrolling around
CGContextRef cgContext = ((wxMacCGContext*)(m_graphicContext))->GetNativeContext() ; CGContextRef cgContext = ((wxMacCGContext*)(m_graphicContext))->GetNativeContext() ;
int origX = XLOG2DEVMAC(0) ; int origX = XLOG2DEVMAC( 0 ) ;
int origY = YLOG2DEVMAC(0) ; int origY = YLOG2DEVMAC( 0 ) ;
CGContextTranslateCTM( cgContext, origX, origY ); CGContextTranslateCTM( cgContext, origX, origY );
m_graphicContext->SetPen( m_pen ) ; m_graphicContext->SetPen( m_pen ) ;
CGContextTranslateCTM( cgContext, -origX, -origY ); CGContextTranslateCTM( cgContext, -origX, -origY );
@@ -1378,7 +1381,7 @@ void wxDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
CGContextScaleCTM( ctx , 1 * ww / 2 , -1 * hh / 2 ) ; CGContextScaleCTM( ctx , 1 * ww / 2 , -1 * hh / 2 ) ;
if ( fill ) if ( fill )
CGContextMoveToPoint( ctx , 0 , 0 ) ; CGContextMoveToPoint( ctx , 0 , 0 ) ;
CGContextAddArc( ctx, 0, 0, 1, DegToRad(sa), DegToRad(ea), 0 ); CGContextAddArc( ctx, 0, 0, 1, DegToRad( sa ), DegToRad( ea ), 0 );
if ( fill ) if ( fill )
CGContextAddLineToPoint( ctx , 0 , 0 ) ; CGContextAddLineToPoint( ctx , 0 , 0 ) ;
CGContextRestoreGState( ctx ) ; CGContextRestoreGState( ctx ) ;
@@ -1464,8 +1467,9 @@ void wxDC::DoDrawSpline(wxList *points)
wxCoord cx4 = (x1 + x2) / 2; wxCoord cx4 = (x1 + x2) / 2;
wxCoord cy4 = (y1 + y2) / 2; wxCoord cy4 = (y1 + y2) / 2;
path->AddQuadCurveToPoint( XLOG2DEVMAC( x1 ) , XLOG2DEVMAC( y1 ) , path->AddQuadCurveToPoint(
XLOG2DEVMAC( cx4 ) , XLOG2DEVMAC( cy4 ) ) ; XLOG2DEVMAC( x1 ) , XLOG2DEVMAC( y1 ) ,
XLOG2DEVMAC( cx4 ) , XLOG2DEVMAC( cy4 ) ) ;
cx1 = cx4; cx1 = cx4;
cy1 = cy4; cy1 = cy4;
@@ -1580,7 +1584,7 @@ void wxDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
wxMacCGContext* mctx = ((wxMacCGContext*) m_graphicContext) ; wxMacCGContext* mctx = ((wxMacCGContext*) m_graphicContext) ;
CGContextRef ctx = mctx->GetNativeContext() ; CGContextRef ctx = mctx->GetNativeContext() ;
AddRoundedRectToPath( ctx , CGRectMake( xx , yy , ww , hh ) , 16 ,16 ) ; AddRoundedRectToPath( ctx , CGRectMake( xx , yy , ww , hh ) , 16 ,16 ) ;
CGContextDrawPath( ctx , mctx->GetDrawingMode() ) ; CGContextDrawPath( ctx , mctx->GetDrawingMode() ) ;
} }
@@ -1595,6 +1599,7 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
wxCoord yy = YLOG2DEVMAC(y); wxCoord yy = YLOG2DEVMAC(y);
wxCoord ww = m_signX * XLOG2DEVREL(width); wxCoord ww = m_signX * XLOG2DEVREL(width);
wxCoord hh = m_signY * YLOG2DEVREL(height); wxCoord hh = m_signY * YLOG2DEVREL(height);
// CMB: draw nothing if transformed w or h is 0 // CMB: draw nothing if transformed w or h is 0
if (ww == 0 || hh == 0) if (ww == 0 || hh == 0)
return; return;
@@ -1621,14 +1626,15 @@ void wxDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
CGContextDrawPath( ctx , mctx->GetDrawingMode() ) ; CGContextDrawPath( ctx , mctx->GetDrawingMode() ) ;
} }
bool wxDC::CanDrawBitmap(void) const bool wxDC::CanDrawBitmap() const
{ {
return true ; return true ;
} }
bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, bool wxDC::DoBlit(
wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask, wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxCoord xsrcMask, wxCoord ysrcMask ) wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{ {
wxCHECK_MSG( Ok(), false, wxT("wxDC(cg)::DoBlit - invalid DC") ); wxCHECK_MSG( Ok(), false, wxT("wxDC(cg)::DoBlit - invalid DC") );
wxCHECK_MSG( source->Ok(), false, wxT("wxDC(cg)::DoBlit - invalid source DC") ); wxCHECK_MSG( source->Ok(), false, wxT("wxDC(cg)::DoBlit - invalid source DC") );
@@ -1809,9 +1815,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
if ( m_backgroundMode == wxSOLID ) if ( m_backgroundMode == wxSOLID )
{ {
wxGraphicPath* path = m_graphicContext->CreatePath() ; wxGraphicPath* path = m_graphicContext->CreatePath() ;
path->MoveToPoint( path->MoveToPoint( drawX , drawY ) ;
drawX ,
drawY ) ;
path->AddLineToPoint( path->AddLineToPoint(
(int) (drawX + sin(angle / RAD2DEG) * FixedToInt(ascent + descent)) , (int) (drawX + sin(angle / RAD2DEG) * FixedToInt(ascent + descent)) ,
(int) (drawY + cos(angle / RAD2DEG) * FixedToInt(ascent + descent)) ) ; (int) (drawY + cos(angle / RAD2DEG) * FixedToInt(ascent + descent)) ) ;