X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0e5a4d2032018ad20f8edefcb88db88c71d50ea1..a4a162522b875bc7cb23f1d165703f71bd7010f7:/src/mac/uma.cpp diff --git a/src/mac/uma.cpp b/src/mac/uma.cpp index 2e50863903..dbdb59341f 100644 --- a/src/mac/uma.cpp +++ b/src/mac/uma.cpp @@ -4,7 +4,15 @@ #include #ifndef __DARWIN__ - #include +# include +# if defined(TARGET_CARBON) +# if PM_USE_SESSION_APIS +# include +# endif +# include +# else +# include +# endif #endif // since we have decided that we only support 8.6 upwards we are @@ -115,8 +123,17 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls ) if ( menuMgrAttr & gestaltMenuMgrAquaLayoutMask ) sUMAHasAquaLayout = true ; sUMASystemInitialized = true ; + } +/* +Boolean CanUseATSUI() + { + long result; + OSErr err = Gestalt(gestaltATSUVersion, &result); + return (err == noErr); + } +*/ // process manager long UMAGetProcessMode() { @@ -255,11 +272,7 @@ void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16 int gPrOpenCounter = 0 ; -#if TARGET_CARBON && PM_USE_SESSION_APIS -OSStatus UMAPrOpen(PMPrintSession *macPrintSession) -#else -OSStatus UMAPrOpen() -#endif +OSStatus UMAPrOpen(void *macPrintSession) { #if !TARGET_CARBON OSErr err = noErr ; @@ -277,7 +290,7 @@ OSStatus UMAPrOpen() if ( gPrOpenCounter == 1 ) { #if PM_USE_SESSION_APIS - err = PMCreateSession(macPrintSession) ; + err = PMCreateSession((PMPrintSession *)macPrintSession) ; #else err = PMBegin() ; #endif @@ -287,11 +300,7 @@ OSStatus UMAPrOpen() #endif } -#if TARGET_CARBON && PM_USE_SESSION_APIS -OSStatus UMAPrClose(PMPrintSession *macPrintSession) -#else -OSStatus UMAPrClose() -#endif +OSStatus UMAPrClose(void *macPrintSession) { #if !TARGET_CARBON OSErr err = noErr ; @@ -310,8 +319,8 @@ OSStatus UMAPrClose() if ( gPrOpenCounter == 1 ) { #if PM_USE_SESSION_APIS - err = PMRelease(*macPrintSession) ; - *macPrintSession = kPMNoReference; + err = PMRelease(*(PMPrintSession *)macPrintSession) ; + *(PMPrintSession *)macPrintSession = kPMNoReference; #else err = PMEnd() ; #endif @@ -370,7 +379,7 @@ GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) { wxASSERT( inWindowRef != NULL ) ; #if TARGET_CARBON - return GetWindowPort( inWindowRef ) ; + return (GrafPtr) GetWindowPort( inWindowRef ) ; #else return (GrafPtr) inWindowRef ; #endif @@ -580,7 +589,6 @@ OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) } static OSStatus helpMenuStatus = noErr ; -static MenuRef helpMenuHandle = NULL ; static MenuItemIndex firstCustomItemIndex = 0 ; OSStatus UMAGetHelpMenu( @@ -590,13 +598,11 @@ OSStatus UMAGetHelpMenu( #if TARGET_CARBON return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ; #else - if ( helpMenuHandle == NULL ) + MenuRef helpMenuHandle ; + helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ; + if ( firstCustomItemIndex == 0 && helpMenuStatus == noErr ) { - helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ; - if ( helpMenuStatus == noErr ) - { - firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ; - } + firstCustomItemIndex = CountMenuItems( helpMenuHandle ) + 1 ; } if ( outFirstCustomItemIndex ) {