]> git.saurik.com Git - wxWidgets.git/commitdiff
cleanup mac
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 17 Nov 2007 10:37:02 +0000 (10:37 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 17 Nov 2007 10:37:02 +0000 (10:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50017 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

12 files changed:
src/mac/carbon/databrow.cpp
src/mac/carbon/dccg.cpp
src/mac/carbon/listbox.cpp
src/mac/carbon/mediactrl.cpp
src/mac/carbon/menu.cpp
src/mac/carbon/menuitem.cpp
src/mac/carbon/mimetmac.cpp
src/mac/carbon/notebmac.cpp
src/mac/carbon/printmac.cpp
src/mac/carbon/sound.cpp
src/mac/carbon/toplevel.cpp
src/mac/carbon/utils.cpp

index 1527547d933aa244cef1e04b4765f2cd9221fedb..60d0a8005e1923112d2a6fc235f5e4163361b156 100644 (file)
@@ -31,7 +31,7 @@
 #include <limits>
 
 #if defined(__MWERKS__) && wxUSE_UNICODE
-#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
+#if __MWERKS__ < 0x4100 
     #include <wtime.h>
 #endif
 #endif
index 23d903065e81b2495c2e8401b883c0665ca0184e..00d3094a9ecdf2feddb72be5758248ba26683b1e 100644 (file)
@@ -2234,17 +2234,14 @@ void wxDC::Clear(void)
                     wxFAIL_MSG( wxT("There shouldn't be theme backgrounds under Quartz") ) ;
 
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
-                    if ( UMAGetSystemVersion() >= 0x1030 )
+                    HIThemeBackgroundDrawInfo drawInfo ;
+                    drawInfo.version = 0 ;
+                    drawInfo.state = kThemeStateActive ;
+                    drawInfo.kind = m_backgroundBrush.MacGetThemeBackground( NULL ) ;
+                    if ( drawInfo.kind == kThemeBackgroundMetal )
                     {
-                        HIThemeBackgroundDrawInfo drawInfo ;
-                        drawInfo.version = 0 ;
-                        drawInfo.state = kThemeStateActive ;
-                        drawInfo.kind = m_backgroundBrush.MacGetThemeBackground( NULL ) ;
-                        if ( drawInfo.kind == kThemeBackgroundMetal )
-                        {
-                            HIThemeDrawBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
-                            HIThemeApplyBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
-                        }
+                        HIThemeDrawBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
+                        HIThemeApplyBackground( &rect, &drawInfo, cg, kHIThemeOrientationNormal ) ;
                     }
 #endif
                 }
index ab9e40f0c9b265f0c4e97a6c06aec692e4adb8b1..2cf0f52f507f51c6c0daa366c7767c0945d6377b 100644 (file)
@@ -613,8 +613,7 @@ static pascal void ListBoxDrawProc(
         // TODO: switch over to wxSystemSettingsNative::GetColour() when kThemeBrushSecondaryHighlightColor
         // is incorporated Panther DB starts using kThemeBrushSecondaryHighlightColor
         // for inactive browser highlighting
-        Gestalt( gestaltSystemVersion, &systemVersion );
-        if ( (systemVersion >= 0x00001030) && !IsControlActive( browser ) )
+        if ( !IsControlActive( browser ) )
             colorBrushID = kThemeBrushSecondaryHighlightColor;
         else
             colorBrushID = kThemeBrushPrimaryHighlightColor;
index f3ff582a139a7ac3686998726daf4c032bd22b43..c6e16665ac26de6ceafa359517502be748ce76d4 100644 (file)
@@ -57,7 +57,7 @@
 #include <QuickTime/QuickTimeComponents.h>
 #endif
 
-#if !defined(__DARWIN__) || !defined(__LP64__)
+#if !defined(__LP64__)
 #define USE_QUICKTIME 1
 #else
 #define USE_QUICKTIME 0
index b717e52e6bd193c9add602e17d01f3280ad7d1a9..f3806a6a49c9700642454fc447d52955ebb7a63d 100644 (file)
@@ -469,9 +469,8 @@ void wxMenu::MacBeforeDisplay( bool isSubMenu )
             // shown in the application menu anyhow -- it doesn't make
             // sense to show them in their normal place as well
             if ( item->GetId() == wxApp::s_macAboutMenuItemId ||
-                ( UMAGetSystemVersion() >= 0x1000 && (
                     item->GetId() == wxApp::s_macPreferencesMenuItemId ||
-                    item->GetId() == wxApp::s_macExitMenuItemId ) ) )
+                    item->GetId() == wxApp::s_macExitMenuItemId )
 
             {
                 ChangeMenuItemAttributes( MAC_WXHMENU( GetHMenu() ),
@@ -749,7 +748,7 @@ void wxMenuBar::MacInstallMenuBar()
         helpMenuHandle = NULL ;
     }
 
-    if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
+    if ( wxApp::s_macPreferencesMenuItemId)
     {
         wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
         if ( item == NULL || !(item->IsEnabled()) )
@@ -762,7 +761,7 @@ void wxMenuBar::MacInstallMenuBar()
     // enabled unless it is added by the application and then disabled, otherwise
     // a program would be required to add an item with wxID_EXIT in order to get the
     // Quit menu item to be enabled, which seems a bit burdensome.
-    if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macExitMenuItemId)
+    if ( wxApp::s_macExitMenuItemId)
     {
         wxMenuItem *item = FindItem( wxApp::s_macExitMenuItemId , NULL ) ;
         if ( item != NULL && !(item->IsEnabled()) )
index bc6f0dd3d45ec375875a86be4a2dbdea3f8063a1..172c5b0ab15614a765fb534fe092cb860f886548 100644 (file)
@@ -100,7 +100,7 @@ void wxMenuItem::UpdateItemStatus()
     if ( IsSeparator() )
         return ;
 
-    if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
+    if ( GetId() == wxApp::s_macPreferencesMenuItemId)
     {
         if ( !IsEnabled() )
             DisableMenuCommand( NULL , kHICommandPreferences ) ;
@@ -108,7 +108,7 @@ void wxMenuItem::UpdateItemStatus()
             EnableMenuCommand( NULL , kHICommandPreferences ) ;
     }
 
-    if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macExitMenuItemId)
+    if ( GetId() == wxApp::s_macExitMenuItemId)
     {
         if ( !IsEnabled() )
             DisableMenuCommand( NULL , kHICommandQuit ) ;
index c06fb8775e81ab92a15fea0f33fc6715c0b0fa2d..7d6818ba3758e21c706b8c1431a2ab36425b2bb4 100644 (file)
@@ -398,9 +398,8 @@ wxFileTypeImpl::GetPrintCommand(
 // we need to go straight to launch services
 //
 
-#if defined(__DARWIN__)
-
 //on darwin, use launch services
+
 #include <ApplicationServices/ApplicationServices.h>
 
 wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
@@ -457,74 +456,6 @@ wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
     return wxEmptyString;
 }
 
-#else //carbon/classic implementation
-
-
-wxString wxFileTypeImpl::GetCommand(const wxString& verb) const
-{
-    wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
-
-    if (verb == wxT("open"))
-    {
-        ICMapEntry entry;
-        ICGetMapEntry( (ICInstance) m_manager->m_hIC,
-                       (Handle) m_manager->m_hDatabase,
-                       m_lIndex, &entry);
-
-        //The entry in the mimetype database only contains the app
-        //that's registered - it may not exist... we need to remap the creator
-        //type and find the right application
-
-        // THIS IS REALLY COMPLICATED :\.
-        // There are a lot of conversions going on here.
-        Str255 outName;
-        FSSpec outSpec;
-        OSErr err = FindApplication( entry.fileCreator, false, outName, &outSpec );
-        if (err != noErr)
-            return wxEmptyString;
-
-        Handle outPathHandle;
-        short outPathSize;
-        err = FSpGetFullPath( &outSpec, &outPathSize, &outPathHandle );
-        if (err == noErr)
-        {
-            char* szPath = *outPathHandle;
-            wxString sClassicPath(szPath, wxConvLocal, outPathSize);
-
-#if defined(__DARWIN__)
-            // Classic Path --> Unix (OSX) Path
-            CFURLRef finalURL = CFURLCreateWithFileSystemPath(
-                kCFAllocatorDefault,
-                wxMacCFStringHolder(sClassicPath, wxLocale::GetSystemEncoding()),
-                kCFURLHFSPathStyle,
-                false ); //false == not a directory
-
-            //clean up memory from the classic path handle
-            DisposeHandle( outPathHandle );
-
-            if (finalURL)
-            {
-                CFStringRef cfsUnixPath = CFURLCopyFileSystemPath(finalURL, kCFURLPOSIXPathStyle);
-                CFRelease(finalURL);
-
-                // PHEW!  Success!
-                if (cfsUnixPath)
-                    return wxMacCFStringHolder(cfsUnixPath).AsString(wxLocale::GetSystemEncoding());
-            }
-#else //classic HFS path acceptable
-            return sClassicPath;
-#endif
-        }
-        else
-        {
-            wxLogMimeDebug(wxT("FSpGetFullPath failed."), (OSStatus)err);
-        }
-    }
-
-    return wxEmptyString;
-}
-#endif //!DARWIN
-
 bool wxFileTypeImpl::GetDescription(wxString *desc) const
 {
     wxASSERT_MSG( m_manager != NULL , wxT("Bad wxFileType") );
@@ -1681,10 +1612,8 @@ wxFileType* wxMimeTypesManagerImpl::Associate(const wxFileTypeInfo& ftInfo)
         wxLogDebug(wxT("No main bundle"));
     }
 
-#if defined(__DARWIN__)
     if (!bInfoSuccess)
         return NULL;
-#endif
 
     // on mac you have to embed it into the mac's file reference resource ('FREF' I believe)
     // or, alternately, you could just add an entry to m_hDatabase, but you'd need to get
@@ -1991,10 +1920,8 @@ wxMimeTypesManagerImpl::Unassociate(wxFileType *pFileType)
         wxLogDebug(wxT("No main bundle"));
     }
 
-#if defined(__DARWIN__)
     if (!bInfoSuccess)
         return false;
-#endif
 
     // this should be as easy as removing the entry from the database
     // and then saving the database
index e3ffb8f3adbd2bc2511f2bd7dc71b50d857cb57a..993f685d87015b92b7e2ea012b32299b0e05947f 100644 (file)
@@ -405,7 +405,7 @@ void wxNotebook::MacSetupTabs()
         info.name = cflabel ;
         m_peer->SetData<ControlTabInfoRecV1>( ii + 1, kControlTabInfoTag, &info ) ;
 
-        if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
+        if ( GetImageList() && GetPageImage(ii) >= 0 )
         {
             const wxBitmap bmap = GetImageList()->GetBitmap( GetPageImage( ii ) ) ;
             if ( bmap.Ok() )
index 606e813946d52f3c0bebe9de8c9e6dab7e800ab9..d731e35033d0cda2f8761cad647588b5e0565dd0 100644 (file)
@@ -509,17 +509,14 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
             }
             else
             {
-                if ( UMAGetSystemVersion() >= 0x1000 )
-                {
 #if !wxMAC_USE_CORE_GRAPHICS
-                    GrafPtr thePort ;
-                    GetPort( &thePort ) ;
+                GrafPtr thePort ;
+                GetPort( &thePort ) ;
 #endif
-                    wxSafeYield(win,true);
+                wxSafeYield(win,true);
 #if !wxMAC_USE_CORE_GRAPHICS
-                    SetPort( thePort ) ;
+                SetPort( thePort ) ;
 #endif
-                }
                 dc->StartPage();
                 keepGoing = printout->OnPrintPage(pn);
                 dc->EndPage();
index c3afc15e01963be13698dcca1efcc24dad394280..365b1e42a207c5a0483aa48228a0602cba494d10 100644 (file)
@@ -71,7 +71,7 @@
 static wxTimer* lastSoundTimer=NULL;
 static bool lastSoundIsPlaying=false;
 
-#if !defined(__DARWIN__) || !defined(__LP64__)
+#if !defined(__LP64__)
 #define USE_QUICKTIME 1
 #else
 #define USE_QUICKTIME 0
index 572ff2e81d58605804a893303aeed59817a76aa8..0a007a12d56196f9b99cdbf8cc93f55da0073658 100644 (file)
@@ -1222,10 +1222,7 @@ void  wxTopLevelWindowMac::DoMacCreateRealWindow(
         if ( HasFlag( wxCLOSE_BOX) )
             attr |= kWindowCloseBoxAttribute ;
     }
-
-    // turn on live resizing (OS X only)
-    if (UMAGetSystemVersion() >= 0x1000)
-        attr |= kWindowLiveResizeAttribute;
+    attr |= kWindowLiveResizeAttribute;
 
     if ( HasFlag(wxSTAY_ON_TOP) )
         group = GetWindowGroupOfClass(kUtilityWindowClass) ;
@@ -1399,11 +1396,9 @@ bool wxTopLevelWindowMac::Show(bool show)
     if ( !wxTopLevelWindowBase::Show(show) )
         return false;
 
-    bool plainTransition = false;
+    bool plainTransition = true;
 
 #if wxUSE_SYSTEM_OPTIONS
-    // code contributed by Ryan Wilcox December 18, 2003
-    plainTransition = UMAGetSystemVersion() >= 0x1000 ;
     if ( wxSystemOptions::HasOption(wxMAC_WINDOW_PLAIN_TRANSITION) )
         plainTransition = ( wxSystemOptions::GetOptionInt( wxMAC_WINDOW_PLAIN_TRANSITION ) == 1 ) ;
 #endif
index e38a3074340e3cf3f4f5c77599d4993f5d9dcbb0..ae1ef930d579862799b4d5127f60685dd2d62cde 100644 (file)
@@ -65,7 +65,7 @@
 #include "wx/mac/private.h"
 
 #if defined(__MWERKS__) && wxUSE_UNICODE
-#if __MWERKS__ < 0x4100 || !defined(__DARWIN__)
+#if __MWERKS__ < 0x4100
     #include <wtime.h>
 #endif
 #endif
@@ -91,281 +91,12 @@ wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn)
 #endif
 }
 
-// ----------------------------------------------------------------------------
-// debugging support
-// ----------------------------------------------------------------------------
-
-#if defined(__WXDEBUG__) && defined(__WXMAC__) && !defined(__DARWIN__) && defined(__MWERKS__) && (__MWERKS__ >= 0x2400)
-
-// MetroNub stuff doesn't seem to work in CodeWarrior 5.3 Carbon builds...
-
-#ifndef __MetroNubUtils__
-#include "MetroNubUtils.h"
-#endif
-
-#ifndef __GESTALT__
-#include <Gestalt.h>
-#endif
-
-#if TARGET_API_MAC_CARBON
-
-#include <CodeFragments.h>
-
-extern "C" long CallUniversalProc(UniversalProcPtr theProcPtr, ProcInfoType procInfo, ...);
-
-ProcPtr gCallUniversalProc_Proc = NULL;
-
-#endif
-
-static MetroNubUserEntryBlock*    gMetroNubEntry = NULL;
-
-static long fRunOnce = false;
-
-
-Boolean IsMetroNubInstalled()
-{
-    if (!fRunOnce)
-    {
-        long result, value;
-
-        fRunOnce = true;
-        gMetroNubEntry = NULL;
-
-        if (Gestalt(gestaltSystemVersion, &value) == noErr && value < 0x1000)
-        {
-            // look for MetroNub's Gestalt selector
-            if (Gestalt(kMetroNubUserSignature, &result) == noErr)
-            {
-#if TARGET_API_MAC_CARBON
-                if (gCallUniversalProc_Proc == NULL)
-                {
-                    CFragConnectionID   connectionID;
-                    Ptr                 mainAddress;
-                    Str255              errorString;
-                    ProcPtr             symbolAddress;
-                    OSErr               err;
-                    CFragSymbolClass    symbolClass;
-
-                    symbolAddress = NULL;
-                    err = GetSharedLibrary("\pInterfaceLib", kPowerPCCFragArch, kFindCFrag,
-                                           &connectionID, &mainAddress, errorString);
-
-                    if (err != noErr)
-                    {
-                        gCallUniversalProc_Proc = NULL;
-                        goto end;
-                    }
-
-                    err = FindSymbol(connectionID, "\pCallUniversalProc",
-                                    (Ptr *) &gCallUniversalProc_Proc, &symbolClass);
-
-                    if (err != noErr)
-                    {
-                        gCallUniversalProc_Proc = NULL;
-                        goto end;
-                    }
-                }
-#endif
-
-                {
-                    MetroNubUserEntryBlock* block = (MetroNubUserEntryBlock *)result;
-
-                    // make sure the version of the API is compatible
-                    if (block->apiLowVersion <= kMetroNubUserAPIVersion &&
-                        kMetroNubUserAPIVersion <= block->apiHiVersion)
-                    {
-                        // success!
-                        gMetroNubEntry = block;
-                    }
-                }
-            }
-        }
-    }
-
-end:
-
-#if TARGET_API_MAC_CARBON
-    return (gMetroNubEntry != NULL && gCallUniversalProc_Proc != NULL);
-#else
-    return (gMetroNubEntry != NULL);
-#endif
-}
-
-Boolean IsMWDebuggerRunning()
-{
-    if (IsMetroNubInstalled())
-        return CallIsDebuggerRunningProc(gMetroNubEntry->isDebuggerRunning);
-
-    return false;
-}
-
-Boolean AmIBeingMWDebugged()
-{
-    if (IsMetroNubInstalled())
-        return CallAmIBeingDebuggedProc(gMetroNubEntry->amIBeingDebugged);
-
-    return false;
-}
-
 extern bool WXDLLEXPORT wxIsDebuggerRunning()
 {
-    return IsMWDebuggerRunning() && AmIBeingMWDebugged();
-}
-
-#else
-
-extern bool WXDLLEXPORT wxIsDebuggerRunning()
-{
-    return false;
-}
-
-#endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ >= 0x2400)
-
-
-#ifndef __DARWIN__
-// defined in unix/utilsunx.cpp for Mac OS X
-
-// get full hostname (with domain name if possible)
-bool wxGetFullHostName(wxChar *buf, int maxSize)
-{
-    return wxGetHostName(buf, maxSize);
-}
-
-// Get user ID e.g. jacs
-bool wxGetUserId(wxChar *buf, int maxSize)
-{
-    return wxGetUserName( buf , maxSize );
-}
-
-const wxChar* wxGetHomeDir(wxString *pstr)
-{
-    *pstr = wxMacFindFolder( (short) kOnSystemDisk, kPreferencesFolderType, kDontCreateFolder );
-    return pstr->c_str();
-}
-
-// Get hostname only (without domain name)
-bool wxGetHostName(wxChar *buf, int maxSize)
-{
-    // Gets Chooser name of user by examining a System resource.
-    buf[0] = 0;
-
-    const short kComputerNameID = -16413;
-
-    short oldResFile = CurResFile();
-    UseResFile(0);
-    StringHandle chooserName = (StringHandle)::GetString(kComputerNameID);
-    UseResFile(oldResFile);
-
-    if (chooserName && *chooserName)
-    {
-        HLock( (Handle) chooserName );
-        wxString name = wxMacMakeStringFromPascal( *chooserName );
-        HUnlock( (Handle) chooserName );
-        ReleaseResource( (Handle) chooserName );
-        wxStrncpy( buf , name , maxSize - 1 );
-    }
-
-    return true;
-}
-
-// Get user name e.g. Stefan Csomor
-bool wxGetUserName(wxChar *buf, int maxSize)
-{
-    // Gets Chooser name of user by examining a System resource.
-    buf[0] = 0;
-
-    const short kChooserNameID = -16096;
-
-    short oldResFile = CurResFile();
-    UseResFile(0);
-    StringHandle chooserName = (StringHandle)::GetString(kChooserNameID);
-    UseResFile(oldResFile);
-
-    if (chooserName && *chooserName)
-    {
-        HLock( (Handle) chooserName );
-        wxString name = wxMacMakeStringFromPascal( *chooserName );
-        HUnlock( (Handle) chooserName );
-        ReleaseResource( (Handle) chooserName );
-        wxStrncpy( buf , name , maxSize - 1 );
-    }
-
-    return true;
-}
-
-int wxKill(long pid, wxSignal sig , wxKillError *rc, int flags)
-{
-    // TODO
-    return 0;
-}
-
-WXDLLEXPORT bool wxGetEnv(const wxString& var, wxString *value)
-{
-    // TODO : under classic there is no environement support, under X yes
-    return false;
-}
-
-// set the env var name to the given value, return true on success
-WXDLLEXPORT bool wxSetEnv(const wxString& var, const wxString& value)
-{
-    // TODO : under classic there is no environement support, under X yes
-    return false;
-}
-
-WXDLLEXPORT bool wxUnsetEnv(const wxString& var)
-{
-    // TODO : under classic there is no environement support, under X yes
+    // TODO : try to find out ...
     return false;
 }
 
-// Execute a program in an Interactive Shell
-bool wxShell(const wxString& command)
-{
-    // TODO
-    return false;
-}
-
-// Shutdown or reboot the PC
-bool wxShutdown(wxShutdownFlags wFlags)
-{
-    // TODO
-    return false;
-}
-
-// Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX)
-wxMemorySize wxGetFreeMemory()
-{
-    return (wxMemorySize)FreeMem();
-}
-
-#ifndef __DARWIN__
-
-void wxMicroSleep(unsigned long microseconds)
-{
-    AbsoluteTime wakeup = AddDurationToAbsolute( microseconds * durationMicrosecond , UpTime());
-    MPDelayUntil( & wakeup);
-}
-
-void wxMilliSleep(unsigned long milliseconds)
-{
-    AbsoluteTime wakeup = AddDurationToAbsolute( milliseconds, UpTime());
-    MPDelayUntil( & wakeup);
-}
-
-void wxSleep(int nSecs)
-{
-    wxMilliSleep(1000*nSecs);
-}
-
-#endif
-
-// Consume all events until no more left
-void wxFlushEvents()
-{
-}
-
-#endif // !__DARWIN__
-
 // Emit a beeeeeep
 void wxBell()
 {