]> git.saurik.com Git - wxWidgets.git/commitdiff
remove 10.4 compatibility code
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Mar 2012 17:47:18 +0000 (17:47 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 12 Mar 2012 17:47:18 +0000 (17:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70884 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/osx/carbon/app.cpp
src/osx/carbon/dcprint.cpp
src/osx/core/printmac.cpp

index 95b1ab78b05be0a7a88ab4a342927cecc63b0c55..1505a9883e126e123061212fae55ee9105137a55 100644 (file)
@@ -710,22 +710,7 @@ pascal OSStatus wxMacAppEventHandler( EventHandlerCallRef handler , EventRef eve
             break ;
 #endif
         case kEventClassAppleEvent :
             break ;
 #endif
         case kEventClassAppleEvent :
-            {
-#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 ) ;
-                    result = AEProcessAppleEvent( &rec ) ;
-                }
-#endif
-            }
+            result = AEProcessEvent(event);
             break ;
 
         default :
             break ;
 
         default :
@@ -982,98 +967,6 @@ void wxApp::CleanUp()
 // misc initialization stuff
 //----------------------------------------------------------------------
 
 // misc initialization stuff
 //----------------------------------------------------------------------
 
-#if wxOSX_USE_CARBON && MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec)
-{
-    OSStatus err = noErr ;
-    bool converted = ConvertEventRefToEventRecord( event, rec) ;
-
-    if ( !converted )
-    {
-        switch ( GetEventClass( event ) )
-        {
-            case kEventClassKeyboard :
-            {
-                converted = true ;
-                switch ( GetEventKind(event) )
-                {
-                    case kEventRawKeyDown :
-                        rec->what = keyDown ;
-                        break ;
-
-                    case kEventRawKeyRepeat :
-                        rec->what = autoKey ;
-                        break ;
-
-                    case kEventRawKeyUp :
-                        rec->what = keyUp ;
-                        break ;
-
-                    case kEventRawKeyModifiersChanged :
-                        rec->what = nullEvent ;
-                        break ;
-
-                    default :
-                        converted = false ;
-                        break ;
-                }
-
-                if ( converted )
-                {
-                    UInt32 keyCode ;
-                    unsigned char charCode ;
-                    UInt32 modifiers ;
-                    GetMouse( &rec->where) ;
-                    err = GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
-                    err = GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
-                    err = GetEventParameter(event, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode);
-                    rec->modifiers = modifiers ;
-                    rec->message = (keyCode << 8 ) + charCode ;
-                }
-            }
-            break ;
-
-            case kEventClassTextInput :
-            {
-                switch ( GetEventKind( event ) )
-                {
-                    case kEventTextInputUnicodeForKeyEvent :
-                        {
-                            EventRef rawEvent ;
-                            err = GetEventParameter(
-                                event, kEventParamTextInputSendKeyboardEvent, typeEventRef, NULL,
-                                sizeof(rawEvent), NULL, &rawEvent ) ;
-                            converted = true ;
-
-                            {
-                                UInt32 keyCode, modifiers;
-                                unsigned char charCode ;
-                                GetMouse( &rec->where) ;
-                                rec->what = keyDown ;
-                                err = GetEventParameter(rawEvent, kEventParamKeyModifiers, typeUInt32, NULL, 4, NULL, &modifiers);
-                                err = GetEventParameter(rawEvent, kEventParamKeyCode, typeUInt32, NULL, 4, NULL, &keyCode);
-                                err = GetEventParameter(rawEvent, kEventParamKeyMacCharCodes, typeChar, NULL, 1, NULL, &charCode);
-                                rec->modifiers = modifiers ;
-                                rec->message = (keyCode << 8 ) + charCode ;
-                            }
-                       }
-                       break ;
-
-                    default :
-                        break ;
-                }
-            }
-            break ;
-
-            default :
-                break ;
-        }
-    }
-
-    return converted ;
-}
-#endif
-
 wxApp::wxApp()
 {
     m_printMode = wxPRINT_WINDOWS;
 wxApp::wxApp()
 {
     m_printMode = wxPRINT_WINDOWS;
index e0f31f91a22576dc261e78aa2c15a30bb9f61380..e1927125bced305b37a8517dac460c523e3cabe3 100644 (file)
@@ -88,28 +88,11 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data )
     m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
     if ( m_err == noErr )
     {
     m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
     if ( m_err == noErr )
     {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-        if ( PMPrinterGetOutputResolution != NULL )
+        m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
+        if ( m_err == -9589 /* kPMKeyNotFound */ )
         {
         {
-            {
-                m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
-                if ( m_err == -9589 /* kPMKeyNotFound */ )
-                {
-                    m_err = noErr ;
-                    res.hRes = res.vRes = 300;
-                }
-            }
-        }
-        else
-#endif
-        {
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-            m_err = PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res);
-            if ( m_err != noErr )
-            {
-                m_err = PMGetResolution((PMPageFormat) (native->GetPageFormat()), &res);
-            }
-#endif
+            m_err = noErr ;
+            res.hRes = res.vRes = 300;
         }
     }
     else
         }
     }
     else
@@ -162,28 +145,14 @@ bool wxMacCarbonPrinterDC::StartDoc(  wxPrinterDC* dc , const wxString& message
     m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
     if (m_err == noErr)
     {
     m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
     if (m_err == noErr)
     {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-        if ( PMPrinterGetOutputResolution != NULL )
+        m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
+        if ( m_err == -9589 /* kPMKeyNotFound */ )
         {
         {
-            m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
-            if ( m_err == -9589 /* kPMKeyNotFound */ )
-            {
-                m_err = noErr ;
-                res.hRes = res.vRes = 300;
-            }
-        }
-        else
-#endif
-        {
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-            if ( PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res) != noErr )
-            {
-                res.hRes = res.vRes = 300;
-            }
-#endif
+            m_err = noErr ;
+            res.hRes = res.vRes = 300;
         }
     }
         }
     }
-
+    
     m_maxX = wxCoord((double)m_maxX * res.hRes / 72.0);
     m_maxY = wxCoord((double)m_maxY * res.vRes / 72.0);
 
     m_maxX = wxCoord((double)m_maxX * res.hRes / 72.0);
     m_maxY = wxCoord((double)m_maxY * res.vRes / 72.0);
 
index 992118663f1233040f2877642b1ff7d16c098f8c..5722b094566734a44db60c09428ec0e61cf37d6d 100644 (file)
@@ -61,27 +61,7 @@ static PMResolution *GetSupportedResolutions(PMPrinter printer, UInt32 *count)
 {
     PMResolution res, *resolutions = NULL;
     OSStatus status = PMPrinterGetPrinterResolutionCount(printer, count);
 {
     PMResolution res, *resolutions = NULL;
     OSStatus status = PMPrinterGetPrinterResolutionCount(printer, count);
-    if (status == kPMNotImplemented)
-    {
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-        resolutions = (PMResolution *)malloc(sizeof(PMResolution) * 4);
-        *count = 0;
-        if (PMPrinterGetPrinterResolution(printer, kPMMinRange, &res) == noErr)
-            resolutions[(*count)++] = res;
-        if (PMPrinterGetPrinterResolution(printer, kPMMinSquareResolution, &res) == noErr)
-            resolutions[(*count)++] = res;
-        if (PMPrinterGetPrinterResolution(printer, kPMMaxSquareResolution, &res) == noErr)
-            resolutions[(*count)++] = res;
-        if (PMPrinterGetPrinterResolution(printer, kPMMaxRange, &res) == noErr)
-            resolutions[(*count)++] = res;
-        if (*count == 0)
-        {
-            if (PMPrinterGetPrinterResolution(printer, kPMDefaultResolution, &res) == noErr)
-                resolutions[(*count)++] = res;
-        }
-#endif
-    }
-    else if (status == noErr)
+    if (status == noErr)
     {
         resolutions = (PMResolution *)malloc(sizeof(PMResolution) * (*count));
         UInt32 realCount = 0;
     {
         resolutions = (PMResolution *)malloc(sizeof(PMResolution) * (*count));
         UInt32 realCount = 0;
@@ -219,20 +199,8 @@ void wxOSXPrintData::TransferPaperInfoFrom( const wxPrintData &data )
                     wxString id, name(wxT("Custom paper"));
                     id.Printf(wxT("wxPaperCustom%dx%d"), papersize.x, papersize.y);
 
                     wxString id, name(wxT("Custom paper"));
                     id.Printf(wxT("wxPaperCustom%dx%d"), papersize.x, papersize.y);
 
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-                    if ( PMPaperCreateCustom != NULL)
-                    {
-                        PMPaperCreateCustom(printer, wxCFStringRef( id, wxFont::GetDefaultEncoding() ), wxCFStringRef( name, wxFont::GetDefaultEncoding() ),
+                    PMPaperCreateCustom(printer, wxCFStringRef( id, wxFont::GetDefaultEncoding() ), wxCFStringRef( name, wxFont::GetDefaultEncoding() ),
                                             papersize.x, papersize.y, &margins, &paper);
                                             papersize.x, papersize.y, &margins, &paper);
-                    }
-#endif
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-                    if ( paper == kPMNoData )
-                    {
-                        PMPaperCreate(printer, wxCFStringRef( id, wxFont::GetDefaultEncoding() ), wxCFStringRef( name, wxFont::GetDefaultEncoding() ),
-                                      papersize.x, papersize.y, &margins, &paper);
-                    }
-#endif
                 }
                 if ( bestPaper != kPMNoData )
                 {
                 }
                 if ( bestPaper != kPMNoData )
                 {
@@ -295,16 +263,7 @@ void wxOSXPrintData::TransferResolutionFrom( const wxPrintData &data )
             quality = wxPRINT_QUALITY_HIGH;
 
         PMResolution res = resolutions[((quality - wxPRINT_QUALITY_DRAFT) * (resCount - 1)) / 3];
             quality = wxPRINT_QUALITY_HIGH;
 
         PMResolution res = resolutions[((quality - wxPRINT_QUALITY_DRAFT) * (resCount - 1)) / 3];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-        if ( PMPrinterSetOutputResolution != NULL )
-            PMPrinterSetOutputResolution(printer, m_macPrintSettings, &res);
-        else
-#endif
-        {
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-            PMSetResolution( m_macPageFormat, &res);
-#endif
-        }
+        PMPrinterSetOutputResolution(printer, m_macPrintSettings, &res);
 
         free(resolutions);
     }
 
         free(resolutions);
     }
@@ -424,17 +383,9 @@ void wxOSXPrintData::TransferResolutionTo( wxPrintData &data )
     {
         bool valid = false;
         PMResolution res;
     {
         bool valid = false;
         PMResolution res;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-        if ( PMPrinterGetOutputResolution != NULL )
-        {
-            if ( PMPrinterGetOutputResolution(printer, m_macPrintSettings, &res) == noErr )
-                valid = true;
-        }
-#endif
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-        if (PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res) == noErr)
+        if ( PMPrinterGetOutputResolution(printer, m_macPrintSettings, &res) == noErr )
             valid = true;
             valid = true;
-#endif
+
         if ( valid )
         {
             UInt32 i;
         if ( valid )
         {
             UInt32 i;
@@ -637,20 +588,9 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
 
     if (PMSessionGetCurrentPrinter(nativeData->GetPrintSession(), &printer) == noErr)
     {
 
     if (PMSessionGetCurrentPrinter(nativeData->GetPrintSession(), &printer) == noErr)
     {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
-        if ( PMPrinterGetOutputResolution != NULL )
+        if (PMPrinterGetOutputResolution( printer, nativeData->GetPrintSettings(), &res) == -9589 /* kPMKeyNotFound */ )
         {
         {
-            if (PMPrinterGetOutputResolution( printer, nativeData->GetPrintSettings(), &res) == -9589 /* kPMKeyNotFound */ )
-            {
-                res.hRes = res.vRes = 300;
-            }
-        }
-        else
-#endif
-        {
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
-            PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res);
-#endif
+            res.hRes = res.vRes = 300;
         }
     }
     else
         }
     }
     else