X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..dda88f5eee7ae13a328f92996847f90caed2e5e9:/src/mac/filedlg.cpp diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index ee50e2e6bd..7837183e2a 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -1,6 +1,6 @@ ///////////////////////////////////////////////////////////////////////////// // Name: filedlg.cpp -// Purpose: wxFileDialog +// Purpose: wxFileDialog // Author: AUTHOR // Modified by: // Created: ??/??/98 @@ -19,7 +19,9 @@ #include "wx/filedlg.h" #include "wx/intl.h" +#if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxFileDialog, wxDialog) +#endif // begin wxmac @@ -43,6 +45,27 @@ OSType gfiltersmac[] = '****' } ; +// the data we need to pass to our standard file hook routine +// includes a pointer to the dialog, a pointer to the standard +// file reply record (so we can inspect the current selection) +// and a copy of the "previous" file spec of the reply record +// so we can see if the selection has changed + +const int kwxMacFileTypes = 10 ; + +struct OpenUserDataRec { + StandardFileReply *sfrPtr; + FSSpec oldSelectionFSSpec; + char filter[kwxMacFileTypes][10] ; + OSType filtermactypes[kwxMacFileTypes] ; + int numfilters ; + DialogPtr theDlgPtr; +}; +typedef struct OpenUserDataRec + OpenUserDataRec, *OpenUserDataRecPtr; + +#if !TARGET_CARBON + static void wxMacSetupStandardFile(short newVRefNum, long newDirID) { enum @@ -97,25 +120,6 @@ enum { kDontUseQuotes = false }; -// the data we need to pass to our standard file hook routine -// includes a pointer to the dialog, a pointer to the standard -// file reply record (so we can inspect the current selection) -// and a copy of the "previous" file spec of the reply record -// so we can see if the selection has changed - -const int kwxMacFileTypes = 10 ; - -struct OpenUserDataRec { - StandardFileReply *sfrPtr; - FSSpec oldSelectionFSSpec; - char filter[kwxMacFileTypes][10] ; - OSType filtermactypes[kwxMacFileTypes] ; - int numfilters ; - DialogPtr theDlgPtr; -}; -typedef struct OpenUserDataRec - OpenUserDataRec, *OpenUserDataRecPtr; - static void GetLabelString(StringPtr theStr, short stringNum) { GetIndString(theStr, kStrListID, stringNum); @@ -185,6 +189,7 @@ static pascal Boolean SFGetFolderModalDialogFilter(DialogPtr theDlgPtr, EventRec return false; } +#endif void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const char *filter , FileFilterYDUPP fileFilter, StandardFileReply *theSFR) { @@ -204,7 +209,7 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const // set initial contents of Select button to a space - CopyPStr("\p ", theSFR->sfFile.name); + memcpy( theSFR->sfFile.name , "\p " , 2 ) ; // point the user data parameter at the reply record so we can get to it later @@ -240,6 +245,8 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const myData.numfilters = 0 ; } // display the dialog + +#if !TARGET_CARBON dlgHookUPP = NULL ; // dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook); @@ -263,7 +270,8 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const DisposeRoutineDescriptor(dlgHookUPP); DisposeRoutineDescriptor(myModalFilterUPP); - +#else +#endif // if cancel wasn't pressed and no fatal error occurred... if (theSFR->sfGood) @@ -454,8 +462,12 @@ int wxFileDialog::ShowModal() strcpy((char *)filename, m_fileName) ; c2pstr((char *)filename ) ; + #if !TARGET_CARBON StandardPutFile( prompt , filename , &reply ) ; + + #else + #endif if ( reply.sfGood == false ) { m_path = "" ; @@ -479,14 +491,17 @@ int wxFileDialog::ShowModal() strcpy((char *)path, m_path ) ; c2pstr((char *)path ) ; - FileFilterYDUPP crossPlatformFileFilterUPP; StandardFileReply reply ; + FileFilterYDUPP crossPlatformFileFilterUPP = 0 ; + #if !TARGET_CARBON crossPlatformFileFilterUPP = NewFileFilterYDProc(CrossPlatformFileFilter); + #endif ExtendedOpenFile( prompt , path , m_wildCard , crossPlatformFileFilterUPP, &reply); - - DisposeRoutineDescriptor(crossPlatformFileFilterUPP); + #if !TARGET_CARBON + DisposeFileFilterYDUPP(crossPlatformFileFilterUPP); + #endif if ( reply.sfGood == false ) { m_path = "" ;