X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/519cb848a8f4c91c73421bb75314754284e593a4..523050b607cfb5e6f9dfcb1544eb4f49ec1978cd:/src/mac/carbon/filedlg.cpp

diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp
index 66de687b80..7837183e2a 100644
--- a/src/mac/carbon/filedlg.cpp
+++ b/src/mac/carbon/filedlg.cpp
@@ -1,6 +1,6 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        filedlg.cpp
-// Purpose:     wxFileDialog
+// Purpose:     wxFileDialog 
 // Author:      AUTHOR
 // Modified by:
 // Created:     ??/??/98
@@ -45,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 
@@ -99,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);
@@ -187,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)
 {
@@ -206,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
 	
@@ -242,6 +245,8 @@ void ExtendedOpenFile( ConstStr255Param message , ConstStr255Param path , const
 		myData.numfilters = 0 ;
 	}
 	// display the dialog
+
+#if !TARGET_CARBON
 	
 	dlgHookUPP = NULL ;
 //	dlgHookUPP = NewDlgHookYDProc(SFGetFolderDialogHook);
@@ -265,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)
@@ -456,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 = "" ;
@@ -481,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 = "" ;