64 bit fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-11-24 09:41:14 +00:00
parent 18d52fedab
commit 1bd568fa44
8 changed files with 106 additions and 23 deletions

View File

@@ -61,6 +61,7 @@ void wxAboutBox(const wxAboutDialogInfo& info)
// Mac native about box currently can show only name, version, copyright // Mac native about box currently can show only name, version, copyright
// and description fields and we also shoehorn the credits text into the // and description fields and we also shoehorn the credits text into the
// description but if we have anything else we must use the generic version // description but if we have anything else we must use the generic version
#ifndef __LP64__
if ( info.IsSimple() ) if ( info.IsSimple() )
{ {
AboutBoxOptions opts; AboutBoxOptions opts;
@@ -78,6 +79,7 @@ void wxAboutBox(const wxAboutDialogInfo& info)
HIAboutBox(opts); HIAboutBox(opts);
} }
else // simple "native" version is not enough else // simple "native" version is not enough
#endif
{ {
// we need to use the full-blown generic version // we need to use the full-blown generic version
wxGenericAboutBox(info); wxGenericAboutBox(info);

View File

@@ -17,6 +17,8 @@
#include "wx/string.h" #include "wx/string.h"
#endif #endif
#ifndef __WXUNIVERSAL__
IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -103,3 +105,5 @@ int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
return -1; return -1;
} }
#endif

View File

@@ -594,6 +594,7 @@ wxMacAppMenuEventHandler( EventHandlerCallRef WXUNUSED(handler),
return eventNotHandledErr; return eventNotHandledErr;
} }
#ifndef __LP64__
static pascal OSStatus static pascal OSStatus
wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) , wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
EventRef event , EventRef event ,
@@ -630,6 +631,7 @@ wxMacAppCommandEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
} }
return result ; return result ;
} }
#endif
static pascal OSStatus static pascal OSStatus
wxMacAppApplicationEventHandler( EventHandlerCallRef WXUNUSED(handler) , wxMacAppApplicationEventHandler( EventHandlerCallRef WXUNUSED(handler) ,
@@ -667,14 +669,15 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve
OSStatus result = eventNotHandledErr ; OSStatus result = eventNotHandledErr ;
switch ( GetEventClass( event ) ) switch ( GetEventClass( event ) )
{ {
#ifndef __LP64__
case kEventClassCommand : case kEventClassCommand :
result = wxMacAppCommandEventHandler( handler , event , data ) ; result = wxMacAppCommandEventHandler( handler , event , data ) ;
break ; break ;
#endif
case kEventClassApplication : case kEventClassApplication :
result = wxMacAppApplicationEventHandler( handler , event , data ) ; result = wxMacAppApplicationEventHandler( handler , event , data ) ;
break ; break ;
#ifndef __LP64__
case kEventClassMenu : case kEventClassMenu :
result = wxMacAppMenuEventHandler( handler , event , data ) ; result = wxMacAppMenuEventHandler( handler , event , data ) ;
break ; break ;
@@ -692,13 +695,23 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve
result = wxMacTopLevelMouseEventHandler( handler , event , NULL ) ; result = wxMacTopLevelMouseEventHandler( handler , event , NULL ) ;
} }
break ; break ;
#endif
case kEventClassAppleEvent : case kEventClassAppleEvent :
{ {
EventRecord rec ; #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if ( AEProcessEvent != NULL )
{
result = AEProcessEvent(event);
}
#endif
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
{
EventRecord rec ;
wxMacConvertEventToRecord( event , &rec ) ; wxMacConvertEventToRecord( event , &rec ) ;
result = AEProcessAppleEvent( &rec ) ; result = AEProcessAppleEvent( &rec ) ;
}
#endif
} }
break ; break ;
@@ -777,7 +790,7 @@ bool wxApp::Initialize(int& argc, wxChar **argv)
#endif #endif
UMAInitToolbox( 4, sm_isEmbedded ) ; UMAInitToolbox( 4, sm_isEmbedded ) ;
SetEventMask( everyEvent ) ; // TODO CHECK Can Be Removed SetEventMask( everyEvent ) ;
UMAShowWatchCursor() ; UMAShowWatchCursor() ;
// Mac OS X passes a process serial number command line argument when // Mac OS X passes a process serial number command line argument when
@@ -842,15 +855,15 @@ bool wxApp::OnInitGui()
{ {
if ( !wxAppBase::OnInitGui() ) if ( !wxAppBase::OnInitGui() )
return false ; return false ;
#ifndef __LP64__
InstallStandardEventHandler( GetApplicationEventTarget() ) ; InstallStandardEventHandler( GetApplicationEventTarget() ) ;
if (!sm_isEmbedded) if (!sm_isEmbedded)
{ {
InstallApplicationEventHandler( InstallApplicationEventHandler(
GetwxMacAppEventHandlerUPP(), GetwxMacAppEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler)); GetEventTypeCount(eventList), eventList, wxTheApp, (EventHandlerRef *)&(wxTheApp->m_macEventHandler));
} }
#endif
if (!sm_isEmbedded) if (!sm_isEmbedded)
{ {
@@ -931,6 +944,7 @@ void wxApp::CleanUp()
// misc initialization stuff // misc initialization stuff
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec)
{ {
OSStatus err = noErr ; OSStatus err = noErr ;
@@ -971,9 +985,7 @@ bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec)
UInt32 keyCode ; UInt32 keyCode ;
unsigned char charCode ; unsigned char charCode ;
UInt32 modifiers ; UInt32 modifiers ;
#ifndef __LP64__
GetMouse( &rec->where) ; GetMouse( &rec->where) ;
#endif
err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers); err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode); err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
err = GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode); err = GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode);
@@ -998,10 +1010,7 @@ bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec)
{ {
UInt32 keyCode, modifiers; UInt32 keyCode, modifiers;
unsigned char charCode ; unsigned char charCode ;
#ifndef __LP64__
GetMouse( &rec->where) ; GetMouse( &rec->where) ;
#endif
rec->what = keyDown ; rec->what = keyDown ;
err = GetEventParameter(rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers); err = GetEventParameter(rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
err = GetEventParameter(rawEvent, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode); err = GetEventParameter(rawEvent, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
@@ -1025,6 +1034,7 @@ bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec)
return converted ; return converted ;
} }
#endif
wxApp::wxApp() wxApp::wxApp()
{ {
@@ -1514,6 +1524,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
{ {
// if window is not having a focus still testing for default enter or cancel // if window is not having a focus still testing for default enter or cancel
// TODO: add the UMA version for ActiveNonFloatingWindow // TODO: add the UMA version for ActiveNonFloatingWindow
#ifndef __LP64__
wxWindow* focus = wxFindWinFromMacWindow( FrontWindow() ) ; wxWindow* focus = wxFindWinFromMacWindow( FrontWindow() ) ;
if ( focus ) if ( focus )
{ {
@@ -1541,6 +1552,7 @@ bool wxApp::MacSendCharEvent( wxWindow* focus , long keymessage , long modifiers
handled = focus->GetEventHandler()->ProcessEvent( new_event ); handled = focus->GetEventHandler()->ProcessEvent( new_event );
} }
} }
#endif
} }
return handled ; return handled ;
} }

View File

@@ -115,6 +115,9 @@ wxBitmap wxWindowDC::DoGetAsBitmap(const wxRect *subrect) const
if (!m_window) if (!m_window)
return wxNullBitmap; return wxNullBitmap;
#ifdef __LP64__
return wxNullBitmap;
#else
ControlRef handle = (ControlRef) m_window->GetHandle(); ControlRef handle = (ControlRef) m_window->GetHandle();
if ( !handle ) if ( !handle )
return wxNullBitmap; return wxNullBitmap;
@@ -161,6 +164,7 @@ wxBitmap wxWindowDC::DoGetAsBitmap(const wxRect *subrect) const
} }
return bmp; return bmp;
#endif
} }
/* /*

View File

@@ -25,6 +25,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
// Create a DC representing the whole screen // Create a DC representing the whole screen
wxScreenDC::wxScreenDC() wxScreenDC::wxScreenDC()
{ {
#ifdef __LP64__
m_graphicContext = NULL;
m_ok = false ;
#else
CGRect cgbounds ; CGRect cgbounds ;
cgbounds = CGDisplayBounds(CGMainDisplayID()); cgbounds = CGDisplayBounds(CGMainDisplayID());
Rect bounds; Rect bounds;
@@ -39,11 +43,15 @@ wxScreenDC::wxScreenDC()
m_width = (wxCoord)cgbounds.size.width; m_width = (wxCoord)cgbounds.size.width;
m_height = (wxCoord)cgbounds.size.height; m_height = (wxCoord)cgbounds.size.height;
m_ok = true ; m_ok = true ;
#endif
} }
wxScreenDC::~wxScreenDC() wxScreenDC::~wxScreenDC()
{ {
delete m_graphicContext; delete m_graphicContext;
m_graphicContext = NULL; m_graphicContext = NULL;
#ifdef __LP64__
#else
DisposeWindow((WindowRef) m_overlayWindow ); DisposeWindow((WindowRef) m_overlayWindow );
#endif
} }

View File

@@ -310,12 +310,13 @@ void wxFontRefData::MacFindFont()
int attributeCount = sizeof(atsuTags) / sizeof(ATSUAttributeTag) ; int attributeCount = sizeof(atsuTags) / sizeof(ATSUAttributeTag) ;
// attempt to add atsu font // attempt to add atsu font
#if 0
status = ATSUFindFontFromName(m_faceName.c_str(), strlen(m_faceName.c_str()), kFontFamilyName, kFontNoPlatform, kFontNoScript, kFontNoLanguage, &atsuFontID); status = ATSUFindFontFromName(m_faceName.c_str(), strlen(m_faceName.c_str()), kFontFamilyName, kFontNoPlatform, kFontNoScript, kFontNoLanguage, &atsuFontID);
if ( status != noErr ) if ( status != noErr )
{ {
attributeCount--; attributeCount--;
} }
#endif
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] = ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] =
{ {
&atsuSize , &atsuSize ,

View File

@@ -39,6 +39,12 @@
typedef float CGFloat; typedef float CGFloat;
#endif #endif
#ifdef __LP64__
#define wxMAC_USE_CORE_TEXT 1
#else
#define wxMAC_USE_ATSU_TEXT 1
#endif
#undef wxMAC_USE_CG_TEXT
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// constants // constants
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -66,8 +72,9 @@ OSStatus wxMacDrawCGImage(
#ifdef __LP64__ #ifdef __LP64__
// todo flip // todo flip
CGContextDrawImage(inContext, *inBounds, inImage ); CGContextDrawImage(inContext, *inBounds, inImage );
return noErr;
#else #else
HIViewDrawCGImage( inContext, inBounds, inImage ); return HIViewDrawCGImage( inContext, inBounds, inImage );
#endif #endif
} }
@@ -708,6 +715,8 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
{ {
m_macATSUIStyle = NULL; m_macATSUIStyle = NULL;
#ifdef wxMAC_USE_CORE_TEXT
#elif defined(wxMAC_USE_ATSU_TEXT)
OSStatus status; OSStatus status;
status = ATSUCreateAndCopyStyle( (ATSUStyle) font.MacGetATSUStyle() , &m_macATSUIStyle ); status = ATSUCreateAndCopyStyle( (ATSUStyle) font.MacGetATSUStyle() , &m_macATSUIStyle );
@@ -740,15 +749,21 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
atsuTags, atsuSizes, atsuValues); atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") ); wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
#elif defined(WXMAC_USE_CG_TEXT)
#endif
} }
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData() wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
{ {
#ifdef wxMAC_USE_CORE_TEXT
#elif defined(wxMAC_USE_ATSU_TEXT)
if ( m_macATSUIStyle ) if ( m_macATSUIStyle )
{ {
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle); ::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
m_macATSUIStyle = NULL; m_macATSUIStyle = NULL;
} }
#elif defined(WXMAC_USE_CG_TEXT)
#endif
} }
// //
@@ -1320,9 +1335,12 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
int originX , originY; int originX , originY;
originX = originY = 0; originX = originY = 0;
window->MacWindowToRootWindow( &originX , &originY ); window->MacWindowToRootWindow( &originX , &originY );
Rect bounds;
GetWindowBounds( m_windowRef, kWindowContentRgn, &bounds );
Rect bounds = { 0,0,0,0 };
#ifdef __LP64__
#else
GetWindowBounds( m_windowRef, kWindowContentRgn, &bounds );
#endif
m_windowTransform = CGAffineTransformMakeTranslation( 0 , bounds.bottom - bounds.top ); m_windowTransform = CGAffineTransformMakeTranslation( 0 , bounds.bottom - bounds.top );
m_windowTransform = CGAffineTransformScale( m_windowTransform , 1 , -1 ); m_windowTransform = CGAffineTransformScale( m_windowTransform , 1 , -1 );
m_windowTransform = CGAffineTransformTranslate( m_windowTransform, originX, originY ) ; m_windowTransform = CGAffineTransformTranslate( m_windowTransform, originX, originY ) ;
@@ -1711,7 +1729,17 @@ void wxMacCoreGraphicsContext::PopState()
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y ) void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
{ {
if ( m_font.IsNull() )
return;
EnsureIsValid();
#ifdef wxMAC_USE_CORE_TEXT
// TODO core text implementation here
#elif defined(wxMAC_USE_ATSU_TEXT)
DrawText(str, x, y, 0.0); DrawText(str, x, y, 0.0);
#elif defined(WXMAC_USE_CG_TEXT)
// TODO core graphics text implementation here
#endif
} }
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle ) void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
@@ -1720,7 +1748,10 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
return; return;
EnsureIsValid(); EnsureIsValid();
#ifdef wxMAC_USE_CORE_TEXT
// default implementation takes care of rotation and calls non rotated DrawText afterwards
wxGraphicsContext::DrawText( str, x, y, angle );
#elif defined(wxMAC_USE_ATSU_TEXT)
OSStatus status = noErr; OSStatus status = noErr;
ATSUTextLayout atsuLayout; ATSUTextLayout atsuLayout;
UniCharCount chars = str.length(); UniCharCount chars = str.length();
@@ -1826,6 +1857,10 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
#if SIZEOF_WCHAR_T == 4 #if SIZEOF_WCHAR_T == 4
free( ubuf ); free( ubuf );
#endif #endif
#elif defined(WXMAC_USE_CG_TEXT)
// default implementation takes care of rotation and calls non rotated DrawText afterwards
wxGraphicsContext::DrawText( str, x, y, angle );
#endif
} }
void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height, void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
@@ -1845,6 +1880,9 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
if (str.empty()) if (str.empty())
return; return;
#ifdef wxMAC_USE_CORE_TEXT
// TODO core text implementation here
#elif defined(wxMAC_USE_ATSU_TEXT)
OSStatus status = noErr; OSStatus status = noErr;
ATSUTextLayout atsuLayout; ATSUTextLayout atsuLayout;
@@ -1899,6 +1937,9 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
#if SIZEOF_WCHAR_T == 4 #if SIZEOF_WCHAR_T == 4
free( ubuf ) ; free( ubuf ) ;
#endif #endif
#elif defined(WXMAC_USE_CG_TEXT)
// TODO core graphics text implementation here
#endif
} }
void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const
@@ -1909,6 +1950,9 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
if (text.empty()) if (text.empty())
return; return;
#ifdef wxMAC_USE_CORE_TEXT
// TODO core text implementation here
#elif defined(wxMAC_USE_ATSU_TEXT)
ATSUTextLayout atsuLayout; ATSUTextLayout atsuLayout;
UniCharCount chars = text.length(); UniCharCount chars = text.length();
UniChar* ubuf = NULL; UniChar* ubuf = NULL;
@@ -1960,6 +2004,9 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
#if SIZEOF_WCHAR_T == 4 #if SIZEOF_WCHAR_T == 4
free( ubuf ) ; free( ubuf ) ;
#endif #endif
#elif defined(WXMAC_USE_CG_TEXT)
// TODO core graphics text implementation here
#endif
} }
void * wxMacCoreGraphicsContext::GetNativeContext() void * wxMacCoreGraphicsContext::GetNativeContext()

View File

@@ -82,9 +82,12 @@ int wxMacPrintDialog::ShowModal()
((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferFrom( &m_printDialogData ); ((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferFrom( &m_printDialogData );
int result = wxID_CANCEL; int result = wxID_CANCEL;
#ifdef __LP64__
// TODO use NSPrintPanel
#else
OSErr err = noErr; OSErr err = noErr;
Boolean accepted; Boolean accepted;
err = PMSessionPrintDialog( err = PMSessionPrintDialog(
((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->m_macPrintSession, ((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->m_macPrintSession,
((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->m_macPrintSettings, ((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->m_macPrintSettings,
@@ -116,7 +119,7 @@ int wxMacPrintDialog::ShowModal()
m_printDialogData.GetPrintData().ConvertFromNative(); m_printDialogData.GetPrintData().ConvertFromNative();
((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferTo( &m_printDialogData ); ((wxMacCarbonPrintData*)m_printDialogData.GetPrintData().GetNativeData())->TransferTo( &m_printDialogData );
} }
#endif
return result; return result;
} }
@@ -158,6 +161,8 @@ int wxMacPageSetupDialog::ShowModal()
((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData ); ((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferFrom( &m_pageSetupData );
int result = wxID_CANCEL; int result = wxID_CANCEL;
#ifdef __LP64__
#else
OSErr err = noErr; OSErr err = noErr;
Boolean accepted; Boolean accepted;
@@ -194,7 +199,7 @@ int wxMacPageSetupDialog::ShowModal()
m_pageSetupData.SetPaperSize( m_pageSetupData.GetPrintData().GetPaperSize() ); m_pageSetupData.SetPaperSize( m_pageSetupData.GetPrintData().GetPaperSize() );
((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferTo( &m_pageSetupData ); ((wxMacCarbonPrintData*)m_pageSetupData.GetPrintData().GetNativeData())->TransferTo( &m_pageSetupData );
} }
#endif
return result; return result;
} }