]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/filedlg.cpp
oops, typo leading to compilation problem fixed
[wxWidgets.git] / src / mac / filedlg.cpp
index dc4f90e22c9a74e4521915e2cc42bf80ce8f4d52..42c94640ef3b0884eb331e9998a782f4b7c609d8 100644 (file)
 #endif
 
 #include "wx/defs.h"
+#include "wx/app.h"
 #include "wx/utils.h"
 #include "wx/dialog.h"
 #include "wx/filedlg.h"
 #include "wx/intl.h"
 
-#include "PLStringFuncs.h"
+#if !defined(__UNIX__)
+  #include "PLStringFuncs.h"
+#endif
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_CLASS(wxFileDialog, wxDialog)
@@ -27,13 +30,19 @@ IMPLEMENT_CLASS(wxFileDialog, wxDialog)
 
 // begin wxmac
 
-#include "Navigation.h"
+#if defined(__UNIX__)
+  #include <Carbon/Carbon.h>
+#else
+  #include <Navigation.h>
+#endif
 
-#include "morefile.h"
-#include "moreextr.h"
-#include "fullpath.h"
-#include "fspcompa.h"
-#include "PLStringFuncs.h"
+#ifndef __UNIX__
+  #include "morefile.h"
+  #include "moreextr.h"
+  #include "fullpath.h"
+  #include "fspcompa.h"
+  #include "PLStringFuncs.h"
+#endif
 
 extern bool gUseNavServices ;
 
@@ -65,6 +74,7 @@ NavEventProc(
                #endif
                */
                
+         wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
        }
 }
 
@@ -202,7 +212,7 @@ static Boolean SameFSSpec(FSSpecPtr spec1, FSSpecPtr spec2)
 // flashing of the button when the key is hit
 
 static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRecord *eventRec,
-                                                                                       short *item, Ptr dataPtr)
+                                                                                       short *item, void *dataPtr)
 {
 #pragma unused (dataPtr)
 
@@ -363,7 +373,7 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
        }
 }
 
-static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, Ptr dataPtr)
+static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
 {      
        Str255                  filename ;
        OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
@@ -497,11 +507,19 @@ int wxFileDialog::ShowModal()
                Str255                          prompt ;
                Str255                          filename ;
 
+#if TARGET_CARBON
+               c2pstrcpy((StringPtr)prompt, m_message) ;
+#else
                strcpy((char *)prompt, m_message) ;
                c2pstr((char *)prompt ) ;
-       
+#endif
+#if TARGET_CARBON
+               c2pstrcpy((StringPtr)filename, m_fileName) ;
+#else
                strcpy((char *)filename, m_fileName) ;
                c2pstr((char *)filename ) ;
+#endif
+
                #if !TARGET_CARBON
                
                StandardPutFile( prompt , filename , &reply ) ;
@@ -515,7 +533,7 @@ int wxFileDialog::ShowModal()
                }
                else
                {
-                       m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+                       m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
                        return wxID_OK ;
                }
        }
@@ -525,11 +543,18 @@ int wxFileDialog::ShowModal()
                Str255                          prompt ;
                Str255                          path ;
 
+#if TARGET_CARBON
+               c2pstrcpy((StringPtr)prompt, m_message) ;
+#else
                strcpy((char *)prompt, m_message) ;
                c2pstr((char *)prompt ) ;
-       
-                       strcpy((char *)path, m_dir ) ;
+#endif
+#if TARGET_CARBON
+               c2pstrcpy((StringPtr)path, m_dir ) ;
+#else
+               strcpy((char *)path, m_dir ) ;
                c2pstr((char *)path ) ;
+#endif
 
                StandardFileReply       reply ;
                FileFilterYDUPP crossPlatformFileFilterUPP = 0 ;
@@ -549,7 +574,7 @@ int wxFileDialog::ShowModal()
                }
                else
                {
-                       m_path = wxMacFSSpec2UnixFilename( &reply.sfFile ) ;
+                       m_path = wxMacFSSpec2MacFilename( &reply.sfFile ) ;
                        return wxID_OK ;
                }
        }
@@ -584,7 +609,7 @@ int wxFileDialog::ShowModal()
                //   first appears
                
                FSSpec location ;
-               wxUnixFilename2FSSpec( m_dir , &location ) ;
+               wxMacFilename2FSSpec( m_dir , &location ) ;
                OSErr err = noErr ;
                
                mDefaultLocation.descriptorType = typeNull;
@@ -601,11 +626,18 @@ int wxFileDialog::ShowModal()
                        }
                }
                
+#if TARGET_CARBON
+               c2pstrcpy((StringPtr)mNavOptions.message, m_message) ;
+#else
                strcpy((char *)mNavOptions.message, m_message) ;
                c2pstr((char *)mNavOptions.message ) ;
-
+#endif
+#if TARGET_CARBON
+               c2pstrcpy((StringPtr)mNavOptions.savedFileName, m_fileName) ;
+#else
                strcpy((char *)mNavOptions.savedFileName, m_fileName) ;
                c2pstr((char *)mNavOptions.savedFileName ) ;
+#endif
 
                if ( m_dialogStyle & wxSAVE )
                {
@@ -672,7 +704,7 @@ int wxFileDialog::ShowModal()
 
                                                                
                                // outFolderDirID = thePB.dirInfo.ioDrDirID;
-                               m_path = wxMacFSSpec2UnixFilename( &outFileSpec ) ;
+                               m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
                                m_paths.Add( m_path ) ;
                    m_fileNames.Add(m_fileName);
                 }