From 4f74e0d132e73250ef422c06175dcf7e4146ec57 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Sat, 14 Oct 2006 16:55:55 +0000 Subject: [PATCH] cleanup for 10.5 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42015 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/bitmap.cpp | 18 ++++- src/mac/carbon/cursor.cpp | 13 +++- src/mac/carbon/dccg.cpp | 16 ++-- src/mac/carbon/dcprint.cpp | 36 ++++++++- src/mac/carbon/dcscreen.cpp | 4 + src/mac/carbon/menu.cpp | 25 +++--- src/mac/carbon/metafile.cpp | 13 +++- src/mac/carbon/mimetmac.cpp | 17 +++- src/mac/carbon/morefilex/MoreFilesX.c | 14 +++- src/mac/carbon/morefilex/MoreFilesX.h | 2 +- src/mac/carbon/notebmac.cpp | 4 + src/mac/carbon/printmac.cpp | 24 +++++- src/mac/carbon/taskbar.cpp | 2 +- src/mac/carbon/textctrl.cpp | 70 +++++++++++------ src/mac/carbon/window.cpp | 108 +++++++------------------- 15 files changed, 227 insertions(+), 139 deletions(-) diff --git a/src/mac/carbon/bitmap.cpp b/src/mac/carbon/bitmap.cpp index 16d4ea6873..42031fe4ab 100644 --- a/src/mac/carbon/bitmap.cpp +++ b/src/mac/carbon/bitmap.cpp @@ -93,8 +93,10 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi #endif else { +#ifndef __LP64__ info->contentType = kControlContentPictHandle ; info->u.picture = bmap->GetPictHandle() ; +#endif } } } @@ -176,10 +178,11 @@ bool wxBitmapRefData::Create( int w , int h , int d ) m_hBitmap = NULL ; Rect rect = { 0 , 0 , m_height , m_width } ; +#ifndef __LP64__ verify_noerr( NewGWorldFromPtr( (GWorldPtr*) &m_hBitmap , k32ARGBPixelFormat , &rect , NULL , NULL , 0 , (char*) data , m_bytesPerRow ) ) ; wxASSERT_MSG( m_hBitmap , wxT("Unable to create GWorld context") ) ; - +#endif m_ok = ( m_hBitmap != NULL ) ; return m_ok ; @@ -204,9 +207,11 @@ void wxBitmapRefData::UseAlpha( bool use ) memset( data , 0 , size ) ; Rect rect = { 0 , 0 , height , width } ; +#ifndef __LP64__ verify_noerr( NewGWorldFromPtr( (GWorldPtr*) &m_hMaskBitmap , k32ARGBPixelFormat , &rect , NULL , NULL , 0 , (char*) data , m_maskBytesPerRow ) ) ; wxASSERT_MSG( m_hMaskBitmap , wxT("Unable to create GWorld context for alpha mask") ) ; +#endif m_maskMemBuf.UngetWriteBuf(size) ; #if !wxMAC_USE_CORE_GRAPHICS @@ -215,7 +220,9 @@ void wxBitmapRefData::UseAlpha( bool use ) } else { +#ifndef __LP64__ DisposeGWorld( m_hMaskBitmap ) ; +#endif m_hMaskBitmap = NULL ; m_maskBytesPerRow = 0 ; } @@ -423,6 +430,7 @@ PicHandle wxBitmapRefData::GetPictHandle() { if ( m_pictHandle == NULL ) { +#ifndef __LP64__ CGrafPtr origPort = NULL ; GDHandle origDev = NULL ; GWorldPtr wp = NULL ; @@ -492,6 +500,7 @@ PicHandle wxBitmapRefData::GetPictHandle() SetGWorld( origPort , origDev ) ; if ( clipRgn ) DisposeRgn( clipRgn ) ; +#endif } return m_pictHandle ; @@ -674,6 +683,7 @@ void wxBitmapRefData::Free() m_iconRef = NULL ; } +#ifndef __LP64__ if ( m_pictHandle ) { KillPicture( m_pictHandle ) ; @@ -691,7 +701,7 @@ void wxBitmapRefData::Free() DisposeGWorld( MAC_WXHBITMAP(m_hMaskBitmap) ) ; m_hMaskBitmap = NULL ; } - +#endif if (m_bitmapMask) { delete m_bitmapMask; @@ -1368,11 +1378,13 @@ wxMask::wxMask( const wxMemoryBuffer& data, int width , int height , int bytesPe wxMask::~wxMask() { +#ifndef __LP64__ if ( m_maskBitmap ) { DisposeGWorld( (GWorldPtr)m_maskBitmap ) ; m_maskBitmap = NULL ; } +#endif } void wxMask::Init() @@ -1391,6 +1403,7 @@ void *wxMask::GetRawAccess() const void wxMask::RealizeNative() { +#ifndef __LP64__ if ( m_maskBitmap ) { DisposeGWorld( (GWorldPtr)m_maskBitmap ) ; @@ -1403,6 +1416,7 @@ void wxMask::RealizeNative() (GWorldPtr*) &m_maskBitmap , k32ARGBPixelFormat , &rect , NULL , NULL , 0 , (char*) m_memBuf.GetData() , m_bytesPerRow ) ; verify_noerr( err ) ; +#endif } // Create a mask from a mono bitmap (copies the bitmap). diff --git a/src/mac/carbon/cursor.cpp b/src/mac/carbon/cursor.cpp index df2b686b22..34d1284ea5 100644 --- a/src/mac/carbon/cursor.cpp +++ b/src/mac/carbon/cursor.cpp @@ -223,7 +223,9 @@ wxCursorRefData::~wxCursorRefData() { if ( m_isColorCursor ) { - ::DisposeCCursor( (CCrsrHandle) m_hCursor ) ; +#ifndef __LP64__ + ::DisposeCCursor( (CCrsrHandle) m_hCursor ) ; +#endif } else if ( m_disposeHandle ) { @@ -313,6 +315,7 @@ void wxCursor::CreateFromImage(const wxImage & image) { m_refData = new wxCursorRefData; +#ifndef __LP64__ int w = 16; int h = 16; @@ -443,6 +446,8 @@ void wxCursor::CreateFromImage(const wxImage & image) HUnlock( (Handle)ch ) ; M_CURSORDATA->m_hCursor = ch ; M_CURSORDATA->m_isColorCursor = true ; +#endif + } #endif //wxUSE_IMAGE @@ -452,6 +457,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho m_refData = new wxCursorRefData; if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE ) { +#ifndef __LP64__ Str255 theName ; wxMacStringToPascal( cursor_file , theName ) ; @@ -484,6 +490,7 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho M_CURSORDATA->m_releaseHandle = true ; } } +#endif } else { @@ -619,10 +626,12 @@ void wxCursor::MacInstall() const } else if ( m_refData && M_CURSORDATA->m_hCursor ) { - if ( M_CURSORDATA->m_isColorCursor ) +#ifndef __LP64__ + if ( M_CURSORDATA->m_isColorCursor ) ::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ; else ::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ; +#endif } else { diff --git a/src/mac/carbon/dccg.cpp b/src/mac/carbon/dccg.cpp index 364809af1b..4a175030d9 100755 --- a/src/mac/carbon/dccg.cpp +++ b/src/mac/carbon/dccg.cpp @@ -64,6 +64,7 @@ const short kUnsupportedMode = -2 ; extern TECObjectRef s_TECNativeCToUnicode ; +#ifndef __LP64__ // TODO: update // The textctrl implementation still needs that (needs what?) for the non-HIView implementation @@ -131,6 +132,7 @@ wxMacPortSetter::~wxMacPortSetter() { // m_dc->MacCleanupPort(&m_ph) ; } +#endif //----------------------------------------------------------------------------- // Local functions @@ -252,9 +254,10 @@ wxMacCGContext::~wxMacCGContext() CGContextRestoreGState( m_cgContext ) ; CGContextRestoreGState( m_cgContext ) ; } - +#ifndef __LP64__ if ( m_qdPort ) QDEndCGContext( m_qdPort, &m_cgContext ) ; +#endif } @@ -353,8 +356,11 @@ CGContextRef wxMacCGContext::GetNativeContext() if ( m_cgContext == NULL ) { Rect bounds ; + OSStatus status = noErr; +#ifndef __LP64__ GetPortBounds( (CGrafPtr) m_qdPort , &bounds ) ; - OSStatus status = QDBeginCGContext((CGrafPtr) m_qdPort , &m_cgContext) ; + status = QDBeginCGContext((CGrafPtr) m_qdPort , &m_cgContext) ; +#endif CGContextSaveGState( m_cgContext ) ; wxASSERT_MSG( status == noErr , wxT("Cannot nest wxDCs on the same window") ) ; @@ -1591,14 +1597,14 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const { wxCHECK_MSG( Ok(), false, wxT("wxDC(cg)::DoGetPixel - invalid DC") ); - wxMacPortSaver helper((CGrafPtr)m_macPort) ; RGBColor colour; - +#ifndef __LP64__ + wxMacPortSaver helper((CGrafPtr)m_macPort) ; // NB: GetCPixel is a deprecated QD call, and a slow one at that GetCPixel( XLOG2DEVMAC(x) + m_macLocalOriginInPort.x - m_macLocalOrigin.x, YLOG2DEVMAC(y) + m_macLocalOriginInPort.y - m_macLocalOrigin.y, &colour ); - +#endif // convert from Mac colour to wx col->Set( colour.red >> 8, colour.green >> 8, colour.blue >> 8 ); diff --git a/src/mac/carbon/dcprint.cpp b/src/mac/carbon/dcprint.cpp index c0779550ef..ce17739428 100644 --- a/src/mac/carbon/dcprint.cpp +++ b/src/mac/carbon/dcprint.cpp @@ -62,7 +62,9 @@ public : virtual void GetSize( int *w , int *h) const ; virtual wxSize GetPPI() const ; private : +#if !wxMAC_USE_CORE_GRAPHICS GrafPtr m_macPrintFormerPort ; +#endif wxCoord m_maxX ; wxCoord m_maxY ; wxSize m_ppi ; @@ -71,8 +73,9 @@ private : wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) { +#if !wxMAC_USE_CORE_GRAPHICS ::GetPort( & m_macPrintFormerPort ) ; - +#endif m_err = noErr ; wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) data->GetNativeData() ; @@ -85,14 +88,22 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) m_maxY = wxCoord(rPage.bottom - rPage.top); PMResolution res; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + PMPrinter printer; + PMSessionGetCurrentPrinter(native->m_macPrintSession, &printer); + PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ; +#else m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res); m_ppi = wxSize(int(res.hRes), int(res.vRes)); +#endif } wxMacCarbonPrinterDC::~wxMacCarbonPrinterDC() { +#if !wxMAC_USE_CORE_GRAPHICS // nothing to release from print data, as wxPrinterDC has all data in its wxPrintData member ::SetPort( m_macPrintFormerPort ) ; +#endif } wxNativePrinterDC* wxNativePrinterDC::Create(wxPrintData* data) @@ -107,7 +118,7 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& WXUNUSED wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) dc->GetPrintData().GetNativeData() ; -#if wxMAC_USE_CORE_GRAPHICS +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 && wxMAC_USE_CORE_GRAPHICS { CFStringRef s[1] = { kPMGraphicsContextCoreGraphics }; CFArrayRef graphicsContextsArray = CFArrayCreate(NULL, (const void**)s, 1, &kCFTypeArrayCallBacks); @@ -115,10 +126,17 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& WXUNUSED CFRelease(graphicsContextsArray); } #endif - +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 && wxMAC_USE_CORE_GRAPHICS + m_err = PMSessionBeginCGDocument(native->m_macPrintSession, + native->m_macPrintSettings, + native->m_macPageFormat); +#else m_err = PMSessionBeginDocument(native->m_macPrintSession, native->m_macPrintSettings, native->m_macPageFormat); + +#endif + if ( m_err != noErr ) return false; @@ -131,7 +149,13 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& WXUNUSED m_maxY = wxCoord(rPage.bottom - rPage.top); PMResolution res; +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + PMPrinter printer; + PMSessionGetCurrentPrinter(native->m_macPrintSession, &printer); + PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ; +#else m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res); +#endif m_ppi = wxSize(int(res.hRes), int(res.vRes)); return true ; } @@ -163,9 +187,15 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc ) if ( m_err == noErr ) { #if wxMAC_USE_CORE_GRAPHICS +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 + m_err = PMSessionGetCGGraphicsContext(native->m_macPrintSession, + &pageContext ); + +#else m_err = PMSessionGetGraphicsContext(native->m_macPrintSession, kPMGraphicsContextCoreGraphics, (void**) &pageContext ); +#endif dc->MacSetCGContext(pageContext) ; #else m_err = PMSessionGetGraphicsContext(native->m_macPrintSession, diff --git a/src/mac/carbon/dcscreen.cpp b/src/mac/carbon/dcscreen.cpp index b321bfcfb1..e8ccf9807a 100644 --- a/src/mac/carbon/dcscreen.cpp +++ b/src/mac/carbon/dcscreen.cpp @@ -20,6 +20,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC) // Create a DC representing the whole screen wxScreenDC::wxScreenDC() { +#ifndef __LP64__ m_macPort = CreateNewPort() ; GrafPtr port ; GetPort( &port ) ; @@ -51,6 +52,7 @@ wxScreenDC::wxScreenDC() CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ; #endif m_ok = true ; +#endif } wxScreenDC::~wxScreenDC() @@ -60,6 +62,8 @@ wxScreenDC::~wxScreenDC() m_graphicContext = NULL ; #endif +#ifndef __LP64__ if ( m_macPort ) DisposePort( (CGrafPtr) m_macPort ) ; +#endif } diff --git a/src/mac/carbon/menu.cpp b/src/mac/carbon/menu.cpp index 75b60c03bf..a76f7e6dd9 100644 --- a/src/mac/carbon/menu.cpp +++ b/src/mac/carbon/menu.cpp @@ -161,9 +161,11 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) if ( pItem->IsSeparator() ) { if ( pos == (size_t)-1 ) - MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-"); + AppendMenuItemTextWithCFString( MAC_WXHMENU(m_hMenu), + CFSTR(""), kMenuItemAttrSeparator, 0,NULL); else - MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos); + InsertMenuItemTextWithCFString( MAC_WXHMENU(m_hMenu), + CFSTR(""), pos, kMenuItemAttrSeparator, 0); } else { @@ -201,7 +203,7 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos) } SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , wxIdToMacCommand ( pItem->GetId() ) ) ; - SetMenuItemRefCon( MAC_WXHMENU(m_hMenu) , pos , (UInt32) pItem ) ; + SetMenuItemRefCon( MAC_WXHMENU(m_hMenu) , pos , (URefCon) pItem ) ; pItem->UpdateItemText() ; pItem->UpdateItemBitmap() ; pItem->UpdateItemStatus() ; @@ -596,19 +598,19 @@ void wxMenuBar::MacInstallMenuBar() ::SetMenuBar( menubar ) ; DisposeMenuBar( menubar ) ; MenuHandle appleMenu = NULL ; - char appleMenuTitle[3] = { 01 , kMenuAppleLogoFilledGlyph , 0 } ; verify_noerr( CreateNewMenu( kwxMacAppleMenuId , 0 , &appleMenu ) ) ; - verify_noerr( SetMenuTitle( appleMenu , (ConstStr255Param) appleMenuTitle ) ); + verify_noerr( SetMenuTitleWithCFString( appleMenu , CFSTR( "\x14" ) ) ); // Add About/Preferences separator only on OS X // KH/RN: Separator is always present on 10.3 but not on 10.2 // However, the change from 10.2 to 10.3 suggests it is preferred #if TARGET_API_MAC_OSX - MacInsertMenuItem( appleMenu , "\p-" , 0 ) ; + InsertMenuItemTextWithCFString( appleMenu, + CFSTR(""), 0, kMenuItemAttrSeparator, 0); #endif - - MacInsertMenuItem( appleMenu , "\pAbout..." , 0 ) ; + InsertMenuItemTextWithCFString( appleMenu, + CFSTR("About..."), 0, kMenuItemAttrSeparator, 0); MacInsertMenu( appleMenu , 0 ) ; // clean-up the help menu before adding new items @@ -687,7 +689,8 @@ void wxMenuBar::MacInstallMenuBar() if ( item->IsSeparator() ) { if ( mh ) - MacAppendMenu(mh, "\p-" ); + AppendMenuItemTextWithCFString( mh, + CFSTR(""), kMenuItemAttrSeparator, 0,NULL); } else { @@ -704,7 +707,7 @@ void wxMenuBar::MacInstallMenuBar() { UMAAppendMenuItem(mh, wxStripMenuCodes(item->GetText()) , wxFont::GetDefaultEncoding(), entry); SetMenuItemCommandID( mh , CountMenuItems(mh) , wxIdToMacCommand ( item->GetId() ) ) ; - SetMenuItemRefCon( mh , CountMenuItems(mh) , (UInt32)item ) ; + SetMenuItemRefCon( mh , CountMenuItems(mh) , (URefCon) item ) ; } } @@ -732,7 +735,7 @@ void wxMenuBar::MacInstallMenuBar() UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , wxStripMenuCodes ( aboutMenuItem->GetText() ) , wxFont::GetDefaultEncoding() ); UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true ); SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , kHICommandAbout ) ; - SetMenuItemRefCon(GetMenuHandle( kwxMacAppleMenuId ) , 1 , (UInt32)aboutMenuItem ) ; + SetMenuItemRefCon(GetMenuHandle( kwxMacAppleMenuId ) , 1 , (URefCon)aboutMenuItem ) ; UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ; } } diff --git a/src/mac/carbon/metafile.cpp b/src/mac/carbon/metafile.cpp index 8bb2a11842..00a3fdc09a 100644 --- a/src/mac/carbon/metafile.cpp +++ b/src/mac/carbon/metafile.cpp @@ -61,12 +61,14 @@ wxMetafileRefData::~wxMetafileRefData() { if (m_metafile) { +#ifndef __LP64__ KillPicture( (PicHandle)m_metafile ); m_metafile = NULL; #if wxMAC_USE_CORE_GRAPHICS QDPictRelease( m_qdPictRef ); m_qdPictRef = NULL; +#endif #endif } } @@ -142,12 +144,14 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf) membuf, data, sz, wxMacMemoryBufferReleaseProc ); M_METAFILEDATA->m_qdPictRef = NULL; +#ifndef __LP64__ if (provider != NULL) { M_METAFILEDATA->m_qdPictRef = QDPictCreateWithProvider( provider ); CGDataProviderRelease( provider ); } #endif +#endif } bool wxMetaFile::Play(wxDC *dc) @@ -160,6 +164,7 @@ bool wxMetaFile::Play(wxDC *dc) { #if wxMAC_USE_CORE_GRAPHICS +#ifndef __LP64__ QDPictRef cgPictRef = M_METAFILEDATA->m_qdPictRef; CGContextRef cg = ((wxMacCGContext*)(dc->GetGraphicContext()))->GetNativeContext(); CGRect bounds = QDPictGetBounds( cgPictRef ); @@ -169,6 +174,7 @@ bool wxMetaFile::Play(wxDC *dc) CGContextScaleCTM( cg, 1, -1 ); QDPictDrawToCGContext( cg, bounds, cgPictRef ); CGContextRestoreGState( cg ); +#endif #else PicHandle pict = (PicHandle)GetHMETAFILE(); wxMacPortSetter helper( dc ); @@ -186,11 +192,13 @@ wxSize wxMetaFile::GetSize() const if (Ok()) { - PicHandle pict = (PicHandle)GetHMETAFILE(); +#ifndef __LP64__ + PicHandle pict = (PicHandle)GetHMETAFILE(); Rect r; wxMacGetPictureBounds( pict, &r ); dataSize.x = r.right - r.left; dataSize.y = r.bottom - r.top; +#endif } return dataSize; @@ -244,8 +252,9 @@ void wxMetaFileDC::DoGetSize(int *width, int *height) const wxMetaFile *wxMetaFileDC::Close() { +#ifndef __LP64__ ClosePicture(); - +#endif return m_metaFile; } diff --git a/src/mac/carbon/mimetmac.cpp b/src/mac/carbon/mimetmac.cpp index aef955dd2d..9265887d3c 100644 --- a/src/mac/carbon/mimetmac.cpp +++ b/src/mac/carbon/mimetmac.cpp @@ -58,7 +58,7 @@ #include #endif - +#ifndef __LP64__ // START CODE SAMPLE FROM TECHNOTE 1002 (http://developer.apple.com/technotes/tn/tn1002.html) // IsRemoteVolume can be used to find out if the @@ -320,7 +320,7 @@ pascal OSErr FSpGetFullPath( const FSSpec *spec, return result; } - +#endif // // On the mac there are two ways to open a file - one is through apple events and the // finder, another is through mime types. @@ -459,6 +459,7 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const #else //carbon/classic implementation + wxString wxFileTypeImpl::GetCommand(const wxString& verb) const { wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") ); @@ -789,7 +790,9 @@ pascal OSStatus MoreProcGetProcessTypeSignature( infoRec.processInfoLength = sizeof(ProcessInfoRec); infoRec.processName = NULL; +#ifndef __LP64__ infoRec.processAppSpec = NULL; +#endif if ( pPSN == NULL ) { @@ -1693,8 +1696,18 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo) if (status == noErr) { Str255 psCreatorName; +#ifndef __LP64__ FSSpec dummySpec; status = FindApplication(creator, false, psCreatorName, &dummySpec); +#else + FSRef fsref; + status = LSFindApplicationForInfo( creator, NULL, NULL, &fsref ,NULL); + HFSUniStr255 name; + status = FSGetCatalogInfo(&fsref, kFSCatInfoNone, NULL, &name, NULL, NULL); + CFStringRef str = FSCreateStringFromHFSUniStr( 0 , &name ); + CFStringGetPascalString(str, psCreatorName, 256, CFStringGetSystemEncoding()); + CFRelease( str ); +#endif if (status == noErr) { diff --git a/src/mac/carbon/morefilex/MoreFilesX.c b/src/mac/carbon/morefilex/MoreFilesX.c index 62a495361c..2b64705351 100644 --- a/src/mac/carbon/morefilex/MoreFilesX.c +++ b/src/mac/carbon/morefilex/MoreFilesX.c @@ -69,6 +69,8 @@ <1> 1/25/02 JL MoreFilesX 1.0 */ +#ifndef __LP64__ + #if defined(__MACH__) #include #include @@ -218,6 +220,8 @@ BadParameter: /*****************************************************************************/ +#ifndef __LP64__ + OSErr FSGetVolParms( FSVolumeRefNum volRefNum, @@ -248,6 +252,8 @@ BadParameter: return ( result ); } +#endif + /*****************************************************************************/ OSErr @@ -2121,6 +2127,8 @@ BadParameter: /*****************************************************************************/ +#ifndef __LP64__ + OSErr FSLockRangeMoreFilesX( SInt16 refNum, @@ -2304,7 +2312,7 @@ BadParameter: /*****************************************************************************/ OSErr -FSVolumeMount( +FSVolumeMountX( const void *volMountInfo, FSVolumeRefNum *volRefNum) { @@ -2604,6 +2612,8 @@ BadParameter: return ( result ); } +#endif + /*****************************************************************************/ #pragma mark ----- Utility Routines ----- @@ -2768,3 +2778,5 @@ BadParameter: } /*****************************************************************************/ + +#endif diff --git a/src/mac/carbon/morefilex/MoreFilesX.h b/src/mac/carbon/morefilex/MoreFilesX.h index 5f5393e3c0..b61da102e1 100644 --- a/src/mac/carbon/morefilex/MoreFilesX.h +++ b/src/mac/carbon/morefilex/MoreFilesX.h @@ -1483,7 +1483,7 @@ FSGetVolMountInfo( #pragma mark FSVolumeMount OSErr -FSVolumeMount( +FSVolumeMountX( const void *volMountInfo, FSVolumeRefNum *volRefNum); diff --git a/src/mac/carbon/notebmac.cpp b/src/mac/carbon/notebmac.cpp index 5861863c68..2aff7f536b 100644 --- a/src/mac/carbon/notebmac.cpp +++ b/src/mac/carbon/notebmac.cpp @@ -427,9 +427,13 @@ void wxNotebook::MacSetupTabs() m_peer->SetTabEnabled( ii + 1, true ) ; } +#if wxMAC_USE_CORE_GRAPHICS + Refresh(); +#else Rect bounds; m_peer->GetRectInWindowCoords( &bounds ) ; InvalWindowRect( (WindowRef)MacGetTopLevelWindowRef(), &bounds ); +#endif } wxRect wxNotebook::GetPageRect() const diff --git a/src/mac/carbon/printmac.cpp b/src/mac/carbon/printmac.cpp index 1e16efc6a7..9d695cd4d2 100644 --- a/src/mac/carbon/printmac.cpp +++ b/src/mac/carbon/printmac.cpp @@ -137,6 +137,7 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data ) if ( !m_printerName.empty() ) PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName , wxFont::GetDefaultEncoding() ) ) ; #endif +#ifndef __LP64__ PMColorMode color ; PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; if ( data.GetColour() ) @@ -146,16 +147,24 @@ bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data ) } else PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMBlackAndWhite ) ; +#endif // PMDuplexMode not yet accessible via API // PMQualityMode not yet accessible via API // todo paperSize + PMResolution res; PMPrinter printer; - PMTag tag = kPMMaxSquareResolution; PMSessionGetCurrentPrinter(m_macPrintSession, &printer); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + PMPrinterGetOutputResolution( printer, + (PMPrintSettings) m_macPrintSettings, &res) ; + // TODO transfer ? into page format ? +#else + PMTag tag = kPMMaxSquareResolution; PMPrinterGetPrinterResolution(printer, tag, &res); PMSetResolution((PMPageFormat) m_macPageFormat, &res); +#endif // after setting the new resolution the format has to be updated, otherwise the page rect remains // at the 'old' scaling PMSessionValidatePageFormat((PMPrintSession) m_macPrintSession, @@ -195,11 +204,12 @@ bool wxMacCarbonPrintData::TransferTo( wxPrintData &data ) } #endif +#ifndef __LP64__ PMColorMode color ; err = PMGetColorMode( m_macPrintSettings, &color ) ; if ( err == noErr ) data.SetColour( !(color == kPMBlackAndWhite) ) ; - +#endif // PMDuplexMode not yet accessible via API // PMQualityMode not yet accessible via API // todo paperSize @@ -352,7 +362,13 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) PMResolution res; wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*) (m_printDialogData.GetPrintData().GetNativeData()); +#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + PMPrinter printer; + PMSessionGetCurrentPrinter(nativeData->m_macPrintSession, &printer); + PMPrinterGetOutputResolution( printer, nativeData->m_macPrintSettings, &res) ; +#else PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res); +#endif printout->SetPPIPrinter(int(res.hRes), int(res.vRes)); // Set printout parameters @@ -434,10 +450,14 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) if ( UMAGetSystemVersion() >= 0x1000 ) #endif { +#if !wxMAC_USE_CORE_GRAPHICS GrafPtr thePort ; GetPort( &thePort ) ; +#endif wxSafeYield(win,true); +#if !wxMAC_USE_CORE_GRAPHICS SetPort( thePort ) ; +#endif } dc->StartPage(); keepGoing = printout->OnPrintPage(pn); diff --git a/src/mac/carbon/taskbar.cpp b/src/mac/carbon/taskbar.cpp index bce496ab28..326e764eaa 100644 --- a/src/mac/carbon/taskbar.cpp +++ b/src/mac/carbon/taskbar.cpp @@ -186,7 +186,7 @@ pascal OSStatus wxDockEventHandler( EventHandlerCallRef inHandlerCallRef, wxMenuItem *item = NULL; if (id != 0) // get the wxMenuItem reference from the MenuRef - GetMenuItemRefCon( menuRef, menuItemIndex, (UInt32*) &item ); + GetMenuItemRefCon( menuRef, menuItemIndex, (URefCon*) &item ); if (item) { diff --git a/src/mac/carbon/textctrl.cpp b/src/mac/carbon/textctrl.cpp index ebd4a0dbb3..1e50c81412 100644 --- a/src/mac/carbon/textctrl.cpp +++ b/src/mac/carbon/textctrl.cpp @@ -481,6 +481,9 @@ bool wxTextCtrl::Create( wxWindow *parent, forceMLTE = true ; } #endif +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + forceMLTE = false; +#endif #ifdef __WXMAC_OSX__ #if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2 @@ -493,13 +496,20 @@ bool wxTextCtrl::Create( wxWindow *parent, if ( !m_peer ) { +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 if ( !(m_windowStyle & wxTE_MULTILINE) && !forceMLTE ) +#endif + { m_peer = new wxMacUnicodeTextControl( this , str , pos , size , style ) ; + } } #endif + // the horizontal single line scrolling bug that made us keep +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 if ( !m_peer ) m_peer = new wxMacMLTEClassicControl( this , str , pos , size , style ) ; +#endif MacPostControlCreate(pos, size) ; @@ -1710,7 +1720,9 @@ void wxMacMLTEControl::SetStringValue( const wxString &str ) wxMacConvertNewlines10To13( &st ); { - wxMacWindowClipper c( m_peer ); +#ifndef __LP64__ + wxMacWindowClipper c( m_peer ) ; +#endif { wxMacEditHelper help( m_txn ); @@ -1891,7 +1903,7 @@ void wxMacMLTEControl::TXNSetAttribute( const wxTextAttr& style , long from , lo #else typeAttr[attrCount].tag = kTXNATSUIStyle ; typeAttr[attrCount].size = kTXNATSUIStyleSize ; - typeAttr[attrCount].data.dataValue = (UInt32)font.MacGetATSUStyle() ; + typeAttr[attrCount].data.dataPtr = font.MacGetATSUStyle() ; attrCount++ ; #endif } @@ -1985,7 +1997,9 @@ void wxMacMLTEControl::Replace( long from , long to , const wxString &str ) wxMacConvertNewlines10To13( &value ) ; wxMacEditHelper help( m_txn ) ; +#ifndef __LP64__ wxMacWindowClipper c( m_peer ) ; +#endif TXNSetSelection( m_txn, from, to ) ; TXNClear( m_txn ) ; @@ -1994,7 +2008,9 @@ void wxMacMLTEControl::Replace( long from , long to , const wxString &str ) void wxMacMLTEControl::Remove( long from , long to ) { +#ifndef __LP64__ wxMacWindowClipper c( m_peer ) ; +#endif wxMacEditHelper help( m_txn ) ; TXNSetSelection( m_txn , from , to ) ; TXNClear( m_txn ) ; @@ -2007,7 +2023,9 @@ void wxMacMLTEControl::GetSelection( long* from, long* to) const void wxMacMLTEControl::SetSelection( long from , long to ) { +#ifndef __LP64__ wxMacWindowClipper c( m_peer ) ; +#endif // change the selection if ((from == -1) && (to == -1)) @@ -2026,7 +2044,9 @@ void wxMacMLTEControl::WriteText( const wxString& str ) long start , end , dummy ; GetSelection( &start , &dummy ) ; +#ifndef __LP64__ wxMacWindowClipper c( m_peer ) ; +#endif { wxMacEditHelper helper( m_txn ) ; @@ -2040,7 +2060,9 @@ void wxMacMLTEControl::WriteText( const wxString& str ) void wxMacMLTEControl::Clear() { +#ifndef __LP64__ wxMacWindowClipper c( m_peer ) ; +#endif wxMacEditHelper st( m_txn ) ; TXNSetSelection( m_txn , kTXNStartOffset , kTXNEndOffset ) ; TXNClear( m_txn ) ; @@ -2158,30 +2180,24 @@ bool wxMacMLTEControl::PositionToXY( long pos, long *x, long *y ) const void wxMacMLTEControl::ShowPosition( long pos ) { -#if TARGET_RT_MAC_MACHO && defined(AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER) - { - Point current, desired ; - TXNOffset selstart, selend; + Point current, desired ; + TXNOffset selstart, selend; - TXNGetSelection( m_txn, &selstart, &selend ); - TXNOffsetToPoint( m_txn, selstart, ¤t ); - TXNOffsetToPoint( m_txn, pos, &desired ); + TXNGetSelection( m_txn, &selstart, &selend ); + TXNOffsetToPoint( m_txn, selstart, ¤t ); + TXNOffsetToPoint( m_txn, pos, &desired ); - // TODO: use HIPoints for 10.3 and above - if ( (UInt32)TXNScroll != (UInt32)kUnresolvedCFragSymbolAddress ) - { - OSErr theErr = noErr; - SInt32 dv = desired.v - current.v; - SInt32 dh = desired.h - current.h; - TXNShowSelection( m_txn, kTXNShowStart ) ; // NB: should this be kTXNShowStart or kTXNShowEnd ?? - theErr = TXNScroll( m_txn, kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels, &dv, &dh ); - - // there will be an error returned for classic MLTE implementation when the control is - // invisible, but HITextView works correctly, so we don't assert that one - // wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") ); - } - } -#endif + // TODO: use HIPoints for 10.3 and above + + OSErr theErr = noErr; + long dv = desired.v - current.v; + long dh = desired.h - current.h; + TXNShowSelection( m_txn, kTXNShowStart ) ; // NB: should this be kTXNShowStart or kTXNShowEnd ?? + theErr = TXNScroll( m_txn, kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels, &dv, &dh ); + + // there will be an error returned for classic MLTE implementation when the control is + // invisible, but HITextView works correctly, so we don't assert that one + // wxASSERT_MSG( theErr == noErr, _T("TXNScroll returned an error!") ); } void wxMacMLTEControl::SetTXNData( const wxString& st, TXNOffset start, TXNOffset end ) @@ -2282,6 +2298,8 @@ int wxMacMLTEControl::GetLineLength(long lineNo) const return theLength ; } +#if MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5 + // ---------------------------------------------------------------------------- // MLTE control implementation (classic part) // ---------------------------------------------------------------------------- @@ -2969,6 +2987,7 @@ OSStatus wxMacMLTEClassicControl::DoCreate() return err; } +#endif // ---------------------------------------------------------------------------- // MLTE control implementation (OSX part) @@ -3078,8 +3097,9 @@ wxMacMLTEHIViewControl::wxMacMLTEHIViewControl( wxTextCtrl *wxPeer, } AdjustCreationAttributes( *wxWHITE , true ) ; - +#ifndef __LP64__ wxMacWindowClipper c( m_peer ) ; +#endif SetTXNData( st , kTXNStartOffset, kTXNEndOffset ) ; TXNSetSelection( m_txn, 0, 0 ); diff --git a/src/mac/carbon/window.cpp b/src/mac/carbon/window.cpp index ff50aba9ce..e6a954fa29 100644 --- a/src/mac/carbon/window.cpp +++ b/src/mac/carbon/window.cpp @@ -454,7 +454,7 @@ pascal OSStatus wxMacUnicodeTextEventHandler( EventHandlerCallRef handler , Even UInt32 when = EventTimeToTicks( GetEventTime( event ) ) ; UniChar* charBuf = NULL; - UInt32 dataSize = 0 ; + ByteCount dataSize = 0 ; int numChars = 0 ; UniChar buf[2] ; if ( GetEventParameter( event, kEventParamTextInputSendText, typeUnicodeText, NULL, 0 , &dataSize, NULL ) == noErr ) @@ -1079,7 +1079,7 @@ void wxWindowMac::MacPostControlCreate(const wxPoint& pos, const wxSize& size) { wxASSERT_MSG( m_peer != NULL && m_peer->Ok() , wxT("No valid mac control") ) ; - m_peer->SetReference( (long)this ) ; + m_peer->SetReference( (URefCon) this ) ; GetParent()->AddChild( this ); MacInstallEventHandler( (WXWidget) m_peer->GetControlRef() ); @@ -1430,7 +1430,7 @@ void wxWindowMac::DoScreenToClient(int *x, int *y) const if (y) localwhere.v = *y ; - QDGlobalToLocalPoint( GetWindowPort( window ) , &localwhere ) ; + wxMacGlobalToLocal( window , &localwhere ) ; if (x) *x = localwhere.h ; @@ -1465,7 +1465,7 @@ void wxWindowMac::DoClientToScreen(int *x, int *y) const if (y) localwhere.v = *y ; - QDLocalToGlobalPoint( GetWindowPort( window ) , &localwhere ) ; + wxMacLocalToGlobal( window, &localwhere ) ; if (x) *x = localwhere.h ; @@ -1682,23 +1682,33 @@ bool wxWindowMac::SetCursor(const wxCursor& cursor) { wxTopLevelWindowMac *tlw = MacGetTopLevelWindow() ; WindowRef window = (WindowRef) ( tlw ? tlw->MacGetWindowRef() : 0 ) ; + + ControlPartCode part ; + ControlRef control ; + Point pt ; + #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 + HIPoint hiPoint ; + HIGetMousePosition(kHICoordSpaceWindow, window, &hiPoint); + pt.h = hiPoint.x; + pt.v = hiPoint.y; + #else CGrafPtr savePort ; Boolean swapped = QDSwapPort( GetWindowPort( window ) , &savePort ) ; // TODO: If we ever get a GetCurrentEvent... replacement // for the mouse position, use it... - Point pt ; - ControlPartCode part ; - ControlRef control ; GetMouse( &pt ) ; +#endif control = wxMacFindControlUnderMouse( tlw , pt , window , &part ) ; if ( control ) mouseWin = wxFindControlFromMacControl( control ) ; - if ( swapped ) +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + if ( swapped ) QDSwapPort( savePort , NULL ) ; +#endif } if ( mouseWin == this && !wxIsBusy() ) @@ -2407,8 +2417,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin ) m_peer->GetRect( &rect ) ; InsetRect( &rect, -1 , -1 ) ; -#if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 ) +#if wxMAC_USE_CORE_GRAPHICS { CGRect cgrect = CGRectMake( rect.left , rect.top , rect.right - rect.left , rect.bottom - rect.top ) ; @@ -2455,8 +2464,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin ) HIThemeDrawGrowBox( &cgpoint , &info , cgContext , kHIThemeOrientationNormal ) ; } } - else -#endif + #else { wxTopLevelWindowMac* top = MacGetTopLevelWindow(); if ( top ) @@ -2480,6 +2488,7 @@ void wxWindowMac::MacPaintBorders( int leftOrigin , int rightOrigin ) // DrawThemeStandaloneNoGrowBox } } +#endif } void wxWindowMac::RemoveChild( wxWindowBase *child ) @@ -2546,8 +2555,6 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) int width , height ; GetClientSize( &width , &height ) ; -#if TARGET_API_MAC_OSX - if ( true ) { // note there currently is a bug in OSX which makes inefficient refreshes in case an entire control // area is scrolled, this does not occur if width and height are 2 pixels less, @@ -2587,69 +2594,9 @@ void wxWindowMac::ScrollWindow(int dx, int dy, const wxRect *rect) #else // this would be the preferred version for fast drawing controls -#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 ) - HIViewRender(m_peer->GetControlRef()) ; - else -#endif - Update() ; + HIViewRender(m_peer->GetControlRef()) ; #endif } - else -#endif - { - wxPoint pos; - pos.x = - pos.y = 0; - - Rect scrollrect; - RgnHandle updateRgn = NewRgn() ; - - { - wxClientDC dc(this) ; - wxMacPortSetter helper(&dc) ; - - m_peer->GetRectInWindowCoords( &scrollrect ) ; - //scrollrect.top += MacGetTopBorderSize() ; - //scrollrect.left += MacGetLeftBorderSize() ; - scrollrect.bottom = scrollrect.top + height ; - scrollrect.right = scrollrect.left + width ; - - if ( rect ) - { - Rect r = { dc.YLOG2DEVMAC(rect->y) , dc.XLOG2DEVMAC(rect->x) , dc.YLOG2DEVMAC(rect->y + rect->height) , - dc.XLOG2DEVMAC(rect->x + rect->width) } ; - SectRect( &scrollrect , &r , &scrollrect ) ; - } - - ScrollRect( &scrollrect , dx , dy , updateRgn ) ; - - // now scroll the former update region as well and add the new update region - WindowRef rootWindow = (WindowRef) MacGetTopLevelWindowRef() ; - RgnHandle formerUpdateRgn = NewRgn() ; - RgnHandle scrollRgn = NewRgn() ; - RectRgn( scrollRgn , &scrollrect ) ; - GetWindowUpdateRgn( rootWindow , formerUpdateRgn ) ; - Point pt = {0, 0} ; - LocalToGlobal( &pt ) ; - OffsetRgn( formerUpdateRgn , -pt.h , -pt.v ) ; - SectRgn( formerUpdateRgn , scrollRgn , formerUpdateRgn ) ; - - if ( !EmptyRgn( formerUpdateRgn ) ) - { - MacOffsetRgn( formerUpdateRgn , dx , dy ) ; - SectRgn( formerUpdateRgn , scrollRgn , formerUpdateRgn ) ; - InvalWindowRgn( rootWindow, formerUpdateRgn ) ; - } - - InvalWindowRgn(rootWindow, updateRgn ) ; - DisposeRgn( updateRgn ) ; - DisposeRgn( formerUpdateRgn ) ; - DisposeRgn( scrollRgn ) ; - } - - Update() ; - } wxWindowMac *child; int x, y, w, h; @@ -3079,19 +3026,16 @@ bool wxWindowMac::MacDoRedraw( WXHRGN updatergnr , long time ) eventNc.SetEventObject( child ); if ( !child->GetEventHandler()->ProcessEvent( eventNc ) ) { -#if wxMAC_USE_CORE_GRAPHICS && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 - if ( UMAGetSystemVersion() >= 0x1030 ) - { - child->MacPaintBorders(0, 0) ; - } - else -#endif +#if wxMAC_USE_CORE_GRAPHICS + child->MacPaintBorders(0, 0) ; +#else { wxWindowDC dc(this) ; dc.SetClippingRegion(wxRegion(updatergn)); wxMacPortSetter helper(&dc) ; child->MacPaintBorders(0, 0) ; } +#endif } } } -- 2.45.2