X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/655719367ac5e131d9642e5783f3ecf64d1a3385..5dafb071ba85e7329aa4a0ac176f3ec8e13e55dc:/src/mac/classic/filedlg.cpp diff --git a/src/mac/classic/filedlg.cpp b/src/mac/classic/filedlg.cpp index 59807f398d..7eca40ec7e 100644 --- a/src/mac/classic/filedlg.cpp +++ b/src/mac/classic/filedlg.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: filedlg.cpp +// Name: src/mac/classic/filedlg.cpp // Purpose: wxFileDialog // Author: Stefan Csomor // Modified by: @@ -9,26 +9,29 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "filedlg.h" +#include "wx/wxprec.h" + +#ifdef __BORLANDC__ + #pragma hdrstop #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" + +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/app.h" + #include "wx/utils.h" + #include "wx/dialog.h" +#endif + #include "wx/tokenzr.h" #include "wx/filename.h" #ifndef __DARWIN__ - #include "PLStringFuncs.h" + #include "PLStringFuncs.h" #endif -#if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxFileDialog, wxFileDialogBase) -#endif // begin wxmac @@ -95,7 +98,7 @@ NavEventProc( else if ( inSelector == kNavCBStart ) { #if TARGET_CARBON - if (data && !(data->defaultLocation).IsEmpty()) + if (data && !(data->defaultLocation).empty()) { // Set default location for the modern Navigation APIs // Apple Technical Q&A 1151 @@ -166,7 +169,7 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) int filterIndex = 0; bool isName = true ; wxString current ; - for( unsigned int i = 0; i < filter2.Len() ; i++ ) + for( unsigned int i = 0; i < filter2.length() ; i++ ) { if( filter2.GetChar(i) == wxT('|') ) { @@ -189,7 +192,7 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) // an explanatory text, in that case the first part is name and extension at the same time wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ; - if ( current.IsEmpty() ) + if ( current.empty() ) myData->extensions.Add( myData->name[filterIndex] ) ; else myData->extensions.Add( current.MakeUpper() ) ; @@ -206,21 +209,21 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) wxString extension = myData->extensions[i]; if (extension.GetChar(0) == '*') - extension = extension.Mid(1); // Remove leading * + extension = extension.Mid(1); // Remove leading * if (extension.GetChar(0) == '.') { - extension = extension.Mid(1); // Remove leading . + extension = extension.Mid(1); // Remove leading . } - + if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator )) { myData->filtermactypes.Add( (OSType)fileType ); } else { - myData->filtermactypes.Add( '****' ) ; // We'll fail safe if it's not recognized - } + myData->filtermactypes.Add( '****' ) ; // We'll fail safe if it's not recognized + } } } } @@ -248,7 +251,7 @@ static Boolean CheckFile( const wxString &filename , OSType type , OpenUserDataR if ( extension.GetChar(0) == '*' ) extension = extension.Mid(1) ; - if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) ) + if ( file.length() >= extension.length() && extension == file.Right(extension.length() ) ) return true ; } } @@ -289,8 +292,8 @@ static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dat wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard, - long style, const wxPoint& pos) - :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos) + long style, const wxPoint& pos, const wxSize& sz, const wxString& name) + :wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name) { wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ; } @@ -317,7 +320,7 @@ pascal Boolean CrossPlatformFilterCallback ( wxString file = wxMacMakeStringFromPascal( spec.name ) ; display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ; } - #if TARGET_CARBON +#if TARGET_CARBON else if ( theItem->descriptorType == typeFSRef ) { FSRef fsref ; @@ -325,16 +328,16 @@ pascal Boolean CrossPlatformFilterCallback ( - CFURLRef fullURLRef; + CFURLRef fullURLRef; fullURLRef = ::CFURLCreateFromFSRef(NULL, &fsref); #ifdef __UNIX__ - CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle; + CFURLPathStyle pathstyle = kCFURLPOSIXPathStyle; #else - CFURLPathStyle pathstyle = kCFURLHFSPathStyle; + CFURLPathStyle pathstyle = kCFURLHFSPathStyle; #endif - CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle); - ::CFRelease( fullURLRef ) ; - wxString file = wxMacCFStringHolder(cfString).AsString(wxFont::GetDefaultEncoding()); + CFStringRef cfString = CFURLCopyFileSystemPath(fullURLRef, pathstyle); + ::CFRelease( fullURLRef ) ; + wxString file = wxMacCFStringHolder(cfString).AsString(wxFont::GetDefaultEncoding()); display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ; } @@ -369,7 +372,7 @@ int wxFileDialog::ShowModal() OpenUserDataRec myData; myData.defaultLocation = m_dir; - if (m_dialogStyle & wxSAVE) + if (HasFlag(wxFD_SAVE)) { dialogCreateOptions.optionFlags |= kNavNoTypePopup; dialogCreateOptions.optionFlags |= kNavDontAutoTranslate; @@ -442,7 +445,7 @@ int wxFileDialog::ShowModal() break; CFURLRef fullURLRef; - if (m_dialogStyle & wxSAVE) + if (HasFlag(wxFD_SAVE)) { CFURLRef parentURLRef = ::CFURLCreateFromFSRef(NULL, &theFSRef); @@ -559,7 +562,7 @@ int wxFileDialog::ShowModal() wxMacStringToPascal( myData.name[i] , (StringPtr)(*mNavOptions.popupExtension)[i].menuItemName ) ; } } - if ( m_dialogStyle & wxSAVE ) + if ( HasFlag(wxFD_SAVE) ) { myData.saveMode = true ; @@ -581,7 +584,7 @@ int wxFileDialog::ShowModal() myData.saveMode = false ; mNavFilterUPP = NewNavObjectFilterUPP( CrossPlatformFilterCallback ) ; - if ( m_dialogStyle & wxMULTIPLE ) + if ( m_windowStyle & wxFD_MULTIPLE ) mNavOptions.dialogOptionFlags |= kNavAllowMultipleFiles ; else mNavOptions.dialogOptionFlags &= ~kNavAllowMultipleFiles ; @@ -621,7 +624,7 @@ int wxFileDialog::ShowModal() OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc); if ( err != noErr ) { - m_path = wxT("") ; + m_path = wxEmptyString ; return wxID_CANCEL ; } outFileSpec = **(FSSpec**) specDesc.dataHandle; @@ -644,4 +647,3 @@ int wxFileDialog::ShowModal() return wxID_CANCEL; #endif // TARGET_CARBON } -