]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/filedlg.cpp
don't call SelectObject() twice in SetBrush() nor SetFont() neither
[wxWidgets.git] / src / mac / filedlg.cpp
index e70ffbdf4cc66b09eb22e5f144dba27437141289..d003e602ab94a0ddabc14e81f1222103ad50c089 100644 (file)
@@ -141,7 +141,7 @@ NavEventProc(
                 {
                     sfilename = sfilename.Left(pos+1)+extension ;
 #if TARGET_CARBON
-                    cfString = sfilename ;
+                    cfString.Assign( sfilename , wxFONTENCODING_DEFAULT ) ;
                     NavDialogSetSaveFileName( ioParams->context , cfString ) ;
 #else
                     wxMacStringToPascal( sfilename , filename ) ;
@@ -322,10 +322,19 @@ pascal Boolean CrossPlatformFilterCallback (
             {
                 FSRef fsref ;
                 memcpy( &fsref , *theItem->dataHandle , sizeof(FSRef) ) ;
-                wxString file ;
-                const short maxpath = 1024 ;
-                FSRefMakePath( &fsref , (UInt8*) file.GetWriteBuf(maxpath+1),maxpath) ;
-                file.UngetWriteBuf() ;
+
+
+
+               CFURLRef fullURLRef;
+                fullURLRef = ::CFURLCreateFromFSRef(NULL, &fsref);
+#ifdef __UNIX__
+               CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle;
+#else
+               CFURLPathStyle pathstyle = kCFURLHFSPathStyle;
+#endif
+               CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle);
+               wxString file = wxMacCFStringHolder(cfString).AsString(wxFont::GetDefaultEncoding());
+
                 display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
             }
 #endif
@@ -356,7 +365,7 @@ int wxFileDialog::ShowModal()
 #else
     CFStringRef titleRef = ::CFStringCreateWithCString(NULL,
                                                        m_message.c_str(),
-                                                       CFStringGetSystemEncoding());
+                                                       m_font.GetEncoding() );
 #endif
     dialogCreateOptions.windowTitle = titleRef;
 #if wxUSE_UNICODE
@@ -366,7 +375,7 @@ int wxFileDialog::ShowModal()
 #else
     CFStringRef defaultFileNameRef = ::CFStringCreateWithCString(NULL,
                                                                  m_fileName.c_str(),
-                                                                 CFStringGetSystemEncoding());
+                                                                 m_font.GetEncoding());
 #endif
     dialogCreateOptions.saveFileName = defaultFileNameRef;
     NavDialogRef dialog;
@@ -403,7 +412,7 @@ int wxFileDialog::ShowModal()
             myData.menuitems = dialogCreateOptions.popupExtension ;
             for ( size_t i = 0 ; i < numfilters ; ++i )
             {
-                CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ;
+                CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] , m_font.GetEncoding() ) ) ;
             }
         }
 
@@ -484,7 +493,7 @@ int wxFileDialog::ShowModal()
             CFURLPathStyle pathstyle = kCFURLHFSPathStyle;
 #endif
             CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle);
-            thePath = wxMacCFStringHolder(cfString).AsString();
+            thePath = wxMacCFStringHolder(cfString).AsString(m_font.GetEncoding());
             if (!thePath)
             {
                 ::NavDisposeReply(&navReply);