- NavDialogOptions mNavOptions;
- NavObjectFilterUPP mNavFilterUPP = NULL;
- NavPreviewUPP mNavPreviewUPP = NULL ;
- NavReplyRecord mNavReply;
- AEDesc mDefaultLocation ;
- bool mSelectDefault = false ;
-
- // setup dialog
-
- ::NavGetDefaultDialogOptions(&mNavOptions);
-
- mNavFilterUPP = nil;
- mNavPreviewUPP = nil;
- mSelectDefault = false;
- mNavReply.validRecord = false;
- mNavReply.replacing = false;
- mNavReply.isStationery = false;
- mNavReply.translationNeeded = false;
- mNavReply.selection.descriptorType = typeNull;
- mNavReply.selection.dataHandle = nil;
- mNavReply.keyScript = smSystemScript;
- mNavReply.fileTranslation = nil;
-
- // Set default location, the location
- // that's displayed when the dialog
- // first appears
-
- FSSpec location ;
- wxMacFilename2FSSpec( m_dir , &location ) ;
- OSErr err = noErr ;
-
- mDefaultLocation.descriptorType = typeNull;
- mDefaultLocation.dataHandle = nil;
-
- err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
-
- if ( mDefaultLocation.dataHandle ) {
-
- if (mSelectDefault) {
- mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
- } else {
- mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
- }
- }
- wxMacStringToPascal( m_message , (StringPtr)mNavOptions.message ) ;
- wxMacStringToPascal( m_fileName , (StringPtr)mNavOptions.savedFileName ) ;
-
- // zero all data
-
- m_path = wxEmptyString ;
- m_fileName = wxEmptyString ;
- m_paths.Empty();
- m_fileNames.Empty();
-
- OpenUserDataRec myData;
- MakeUserDataRec( &myData , m_wildCard ) ;
- myData.currentfilter = m_filterIndex ;
- if ( myData.extensions.GetCount() > 0 )
+ OSErr err;
+ NavDialogCreationOptions dialogCreateOptions;
+
+ // set default options
+ ::NavGetDefaultDialogCreationOptions(&dialogCreateOptions);
+
+ // this was always unset in the old code
+ dialogCreateOptions.optionFlags &= ~kNavSelectDefaultLocation;
+
+ wxMacCFStringHolder message(m_message, m_font.GetEncoding());
+ dialogCreateOptions.windowTitle = message;
+
+ wxMacCFStringHolder defaultFileName(m_fileName, m_font.GetEncoding());
+ dialogCreateOptions.saveFileName = defaultFileName;
+
+
+ NavDialogRef dialog;
+ NavObjectFilterUPP navFilterUPP = NULL;
+ OpenUserDataRec myData;
+ myData.defaultLocation = m_dir;
+
+ MakeUserDataRec(&myData , m_wildCard);
+ myData.currentfilter = m_filterIndex;
+ size_t numFilters = myData.extensions.GetCount();
+ if (numFilters)