X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a3d3d3bf6cd84e44521a1617df5e38ed02c6fee2..b12e1d2fcd5ee2771a4ed1904d462fb516adb05f:/src/mac/uma.cpp diff --git a/src/mac/uma.cpp b/src/mac/uma.cpp index c899f87471..f6bd01f91f 100644 --- a/src/mac/uma.cpp +++ b/src/mac/uma.cpp @@ -10,6 +10,8 @@ # include # endif # include +# else +# include # endif #endif @@ -19,9 +21,6 @@ // windows manager, control manager, navigation services etc. are // present -#define wxUSE_MLTE 0 - - static bool sUMAHasAppearance = false ; static long sUMAAppearanceVersion = 0 ; static bool sUMAHasAquaLayout = false ; @@ -49,9 +48,8 @@ void UMACleanupToolbox() { NavUnload() ; } -#if wxUSE_MLTE - TXNTerminateTextension( ) ; -#endif + if ( TXNTerminateTextension != (void*) kUnresolvedCFragSymbolAddress ) + TXNTerminateTextension( ) ; } void UMAInitToolbox( UInt16 inMoreMastersCalls ) { @@ -92,7 +90,6 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls ) sUMAHasWindowManager = sUMAWindowManagerAttr & gestaltWindowMgrPresent ; } -#ifndef __DARWIN__ #if TARGET_CARBON // Call currently implicitely done : InitFloatingWindows() ; #else @@ -100,7 +97,6 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls ) InitFloatingWindows() ; else InitWindows(); -#endif #endif if ( NavServicesAvailable() ) @@ -108,21 +104,52 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls ) NavLoad() ; } -#if wxUSE_MLTE - TXNMacOSPreferredFontDescription defaults; - defaults.fontID = kFontIDGeneva ; - defaults.pointSize = (10 << 16) ; - defaults.fontStyle = kTXNDefaultFontStyle; - defaults.encoding = kTXNSystemDefaultEncoding; - TXNInitTextension(&defaults, 1, (kTXNAlwaysUseQuickDrawTextMask | kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask)); -#endif long menuMgrAttr ; Gestalt( gestaltMenuMgrAttr , &menuMgrAttr ) ; if ( menuMgrAttr & gestaltMenuMgrAquaLayoutMask ) sUMAHasAquaLayout = true ; + + if ( TXNInitTextension != (void*) kUnresolvedCFragSymbolAddress ) + { + FontFamilyID fontId ; + Str255 fontName ; + SInt16 fontSize ; + Style fontStyle ; + GetThemeFont(kThemeSmallSystemFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ; + GetFNum( fontName, &fontId ); + + TXNMacOSPreferredFontDescription fontDescriptions[] = + { + { fontId , (fontSize << 16) ,kTXNDefaultFontStyle, kTXNSystemDefaultEncoding } , + } ; + int noOfFontDescriptions = sizeof( fontDescriptions ) / sizeof(TXNMacOSPreferredFontDescription) ; +#if 0 // TARGET_CARBON + --noOfFontDescriptions ; +#endif + // kTXNAlwaysUseQuickDrawTextMask might be desirable because of speed increases but it crashes the app under OS X upon key stroke + OptionBits options = kTXNWantMoviesMask | kTXNWantSoundMask | kTXNWantGraphicsMask ; +#if TARGET_CARBON + if ( !UMAHasAquaLayout() ) +#endif + { + options |= kTXNAlwaysUseQuickDrawTextMask ; + } + TXNInitTextension(fontDescriptions, noOfFontDescriptions, options ); + } + + sUMASystemInitialized = true ; + } +/* +Boolean CanUseATSUI() + { + long result; + OSErr err = Gestalt(gestaltATSUVersion, &result); + return (err == noErr); + } +*/ // process manager long UMAGetProcessMode() { @@ -368,7 +395,7 @@ GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) { wxASSERT( inWindowRef != NULL ) ; #if TARGET_CARBON - return GetWindowPort( inWindowRef ) ; + return (GrafPtr) GetWindowPort( inWindowRef ) ; #else return (GrafPtr) inWindowRef ; #endif @@ -577,9 +604,10 @@ OSStatus UMADrawThemePlacard( const Rect *inRect , ThemeDrawState inState ) return ::DrawThemePlacard( inRect , inState ) ; } +#if !TARGET_CARBON static OSStatus helpMenuStatus = noErr ; -static MenuRef helpMenuHandle = NULL ; static MenuItemIndex firstCustomItemIndex = 0 ; +#endif OSStatus UMAGetHelpMenu( MenuRef * outHelpMenu, @@ -588,13 +616,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 ) {