Fixed signed/unsigned warning (GetCount() returns size_t, not int); Slight cosmetic cleanup.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24675 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -56,7 +56,7 @@ struct OpenUserDataRec {
|
|||||||
wxArrayString name ;
|
wxArrayString name ;
|
||||||
wxArrayString extensions ;
|
wxArrayString extensions ;
|
||||||
wxArrayLong filtermactypes ;
|
wxArrayLong filtermactypes ;
|
||||||
wxString defaultLocation;
|
wxString defaultLocation;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
CFArrayRef menuitems ;
|
CFArrayRef menuitems ;
|
||||||
#else
|
#else
|
||||||
@@ -135,7 +135,7 @@ NavEventProc(
|
|||||||
sfilename = wxMacMakeStringFromPascal( filename ) ;
|
sfilename = wxMacMakeStringFromPascal( filename ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pos = sfilename.Find('.',TRUE) ;
|
int pos = sfilename.Find('.', true) ;
|
||||||
if ( pos != wxNOT_FOUND )
|
if ( pos != wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
sfilename = sfilename.Left(pos+1)+extension ;
|
sfilename = sfilename.Left(pos+1)+extension ;
|
||||||
@@ -175,7 +175,7 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
|
|||||||
{
|
{
|
||||||
myData->menuitems = NULL ;
|
myData->menuitems = NULL ;
|
||||||
myData->currentfilter = 0 ;
|
myData->currentfilter = 0 ;
|
||||||
myData->saveMode = FALSE ;
|
myData->saveMode = false ;
|
||||||
|
|
||||||
if ( filter && filter[0] )
|
if ( filter && filter[0] )
|
||||||
{
|
{
|
||||||
@@ -381,41 +381,42 @@ int wxFileDialog::ShowModal()
|
|||||||
dialogCreateOptions.saveFileName = defaultFileNameRef;
|
dialogCreateOptions.saveFileName = defaultFileNameRef;
|
||||||
NavDialogRef dialog;
|
NavDialogRef dialog;
|
||||||
NavObjectFilterUPP navFilterUPP = NULL;
|
NavObjectFilterUPP navFilterUPP = NULL;
|
||||||
CFArrayRef cfArray = NULL; // for popupExtension
|
CFArrayRef cfArray = NULL; // for popupExtension
|
||||||
OpenUserDataRec myData;
|
OpenUserDataRec myData;
|
||||||
myData.defaultLocation = m_dir;
|
myData.defaultLocation = m_dir;
|
||||||
|
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (m_dialogStyle & wxSAVE)
|
||||||
{
|
{
|
||||||
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
|
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
|
||||||
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
|
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
|
||||||
dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems;
|
dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems;
|
||||||
|
|
||||||
// The extension is important
|
|
||||||
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
|
|
||||||
|
|
||||||
|
// The extension is important
|
||||||
|
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
|
||||||
|
|
||||||
err = ::NavCreatePutFileDialog(&dialogCreateOptions,
|
err = ::NavCreatePutFileDialog(&dialogCreateOptions,
|
||||||
'TEXT',
|
'TEXT',
|
||||||
'TEXT',
|
'TEXT',
|
||||||
sStandardNavEventFilter,
|
sStandardNavEventFilter,
|
||||||
&myData, // for defaultLocation
|
&myData, // for defaultLocation
|
||||||
&dialog);
|
&dialog);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MakeUserDataRec(&myData , m_wildCard);
|
MakeUserDataRec(&myData , m_wildCard);
|
||||||
int numfilters = myData.extensions.GetCount();
|
size_t numfilters = myData.extensions.GetCount();
|
||||||
if (numfilters > 0){
|
if (numfilters > 0)
|
||||||
CFMutableArrayRef popup = CFArrayCreateMutable( kCFAllocatorDefault ,
|
|
||||||
numfilters , &kCFTypeArrayCallBacks ) ;
|
|
||||||
dialogCreateOptions.popupExtension = popup ;
|
|
||||||
myData.menuitems = dialogCreateOptions.popupExtension ;
|
|
||||||
for ( size_t i = 0 ; i < numfilters ; ++i )
|
|
||||||
{
|
{
|
||||||
CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ;
|
CFMutableArrayRef popup = CFArrayCreateMutable( kCFAllocatorDefault ,
|
||||||
|
numfilters , &kCFTypeArrayCallBacks ) ;
|
||||||
|
dialogCreateOptions.popupExtension = popup ;
|
||||||
|
myData.menuitems = dialogCreateOptions.popupExtension ;
|
||||||
|
for ( size_t i = 0 ; i < numfilters ; ++i )
|
||||||
|
{
|
||||||
|
CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
|
navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
|
||||||
err = ::NavCreateGetFileDialog(&dialogCreateOptions,
|
err = ::NavCreateGetFileDialog(&dialogCreateOptions,
|
||||||
NULL, // NavTypeListHandle
|
NULL, // NavTypeListHandle
|
||||||
@@ -571,9 +572,10 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
|
err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
|
||||||
|
|
||||||
if ( mDefaultLocation.dataHandle ) {
|
if ( mDefaultLocation.dataHandle )
|
||||||
|
{
|
||||||
if (mSelectDefault) {
|
if (mSelectDefault)
|
||||||
|
{
|
||||||
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
|
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
|
||||||
} else {
|
} else {
|
||||||
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
|
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
|
||||||
@@ -663,8 +665,8 @@ int wxFileDialog::ShowModal()
|
|||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNavReply.validRecord) {
|
if (mNavReply.validRecord)
|
||||||
|
{
|
||||||
FSSpec outFileSpec ;
|
FSSpec outFileSpec ;
|
||||||
AEDesc specDesc ;
|
AEDesc specDesc ;
|
||||||
AEKeyword keyWord ;
|
AEKeyword keyWord ;
|
||||||
@@ -674,7 +676,8 @@ int wxFileDialog::ShowModal()
|
|||||||
for ( long i = 1 ; i <= count ; ++i )
|
for ( long i = 1 ; i <= count ; ++i )
|
||||||
{
|
{
|
||||||
OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
|
OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
|
||||||
if ( err != noErr ) {
|
if ( err != noErr )
|
||||||
|
{
|
||||||
m_path = wxT("") ;
|
m_path = wxT("") ;
|
||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
|
@@ -56,7 +56,7 @@ struct OpenUserDataRec {
|
|||||||
wxArrayString name ;
|
wxArrayString name ;
|
||||||
wxArrayString extensions ;
|
wxArrayString extensions ;
|
||||||
wxArrayLong filtermactypes ;
|
wxArrayLong filtermactypes ;
|
||||||
wxString defaultLocation;
|
wxString defaultLocation;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
CFArrayRef menuitems ;
|
CFArrayRef menuitems ;
|
||||||
#else
|
#else
|
||||||
@@ -135,7 +135,7 @@ NavEventProc(
|
|||||||
sfilename = wxMacMakeStringFromPascal( filename ) ;
|
sfilename = wxMacMakeStringFromPascal( filename ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int pos = sfilename.Find('.',TRUE) ;
|
int pos = sfilename.Find('.', true) ;
|
||||||
if ( pos != wxNOT_FOUND )
|
if ( pos != wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
sfilename = sfilename.Left(pos+1)+extension ;
|
sfilename = sfilename.Left(pos+1)+extension ;
|
||||||
@@ -175,7 +175,7 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
|
|||||||
{
|
{
|
||||||
myData->menuitems = NULL ;
|
myData->menuitems = NULL ;
|
||||||
myData->currentfilter = 0 ;
|
myData->currentfilter = 0 ;
|
||||||
myData->saveMode = FALSE ;
|
myData->saveMode = false ;
|
||||||
|
|
||||||
if ( filter && filter[0] )
|
if ( filter && filter[0] )
|
||||||
{
|
{
|
||||||
@@ -381,41 +381,42 @@ int wxFileDialog::ShowModal()
|
|||||||
dialogCreateOptions.saveFileName = defaultFileNameRef;
|
dialogCreateOptions.saveFileName = defaultFileNameRef;
|
||||||
NavDialogRef dialog;
|
NavDialogRef dialog;
|
||||||
NavObjectFilterUPP navFilterUPP = NULL;
|
NavObjectFilterUPP navFilterUPP = NULL;
|
||||||
CFArrayRef cfArray = NULL; // for popupExtension
|
CFArrayRef cfArray = NULL; // for popupExtension
|
||||||
OpenUserDataRec myData;
|
OpenUserDataRec myData;
|
||||||
myData.defaultLocation = m_dir;
|
myData.defaultLocation = m_dir;
|
||||||
|
|
||||||
if (m_dialogStyle & wxSAVE)
|
if (m_dialogStyle & wxSAVE)
|
||||||
{
|
{
|
||||||
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
|
dialogCreateOptions.optionFlags |= kNavNoTypePopup;
|
||||||
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
|
dialogCreateOptions.optionFlags |= kNavDontAutoTranslate;
|
||||||
dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems;
|
dialogCreateOptions.optionFlags |= kNavDontAddTranslateItems;
|
||||||
|
|
||||||
// The extension is important
|
|
||||||
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
|
|
||||||
|
|
||||||
|
// The extension is important
|
||||||
|
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
|
||||||
|
|
||||||
err = ::NavCreatePutFileDialog(&dialogCreateOptions,
|
err = ::NavCreatePutFileDialog(&dialogCreateOptions,
|
||||||
'TEXT',
|
'TEXT',
|
||||||
'TEXT',
|
'TEXT',
|
||||||
sStandardNavEventFilter,
|
sStandardNavEventFilter,
|
||||||
&myData, // for defaultLocation
|
&myData, // for defaultLocation
|
||||||
&dialog);
|
&dialog);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MakeUserDataRec(&myData , m_wildCard);
|
MakeUserDataRec(&myData , m_wildCard);
|
||||||
int numfilters = myData.extensions.GetCount();
|
size_t numfilters = myData.extensions.GetCount();
|
||||||
if (numfilters > 0){
|
if (numfilters > 0)
|
||||||
CFMutableArrayRef popup = CFArrayCreateMutable( kCFAllocatorDefault ,
|
|
||||||
numfilters , &kCFTypeArrayCallBacks ) ;
|
|
||||||
dialogCreateOptions.popupExtension = popup ;
|
|
||||||
myData.menuitems = dialogCreateOptions.popupExtension ;
|
|
||||||
for ( size_t i = 0 ; i < numfilters ; ++i )
|
|
||||||
{
|
{
|
||||||
CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ;
|
CFMutableArrayRef popup = CFArrayCreateMutable( kCFAllocatorDefault ,
|
||||||
|
numfilters , &kCFTypeArrayCallBacks ) ;
|
||||||
|
dialogCreateOptions.popupExtension = popup ;
|
||||||
|
myData.menuitems = dialogCreateOptions.popupExtension ;
|
||||||
|
for ( size_t i = 0 ; i < numfilters ; ++i )
|
||||||
|
{
|
||||||
|
CFArrayAppendValue( popup , (CFStringRef) wxMacCFStringHolder( myData.name[i] ) ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
|
navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
|
||||||
err = ::NavCreateGetFileDialog(&dialogCreateOptions,
|
err = ::NavCreateGetFileDialog(&dialogCreateOptions,
|
||||||
NULL, // NavTypeListHandle
|
NULL, // NavTypeListHandle
|
||||||
@@ -571,9 +572,10 @@ int wxFileDialog::ShowModal()
|
|||||||
|
|
||||||
err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
|
err = ::AECreateDesc(typeFSS, &location, sizeof(FSSpec), &mDefaultLocation );
|
||||||
|
|
||||||
if ( mDefaultLocation.dataHandle ) {
|
if ( mDefaultLocation.dataHandle )
|
||||||
|
{
|
||||||
if (mSelectDefault) {
|
if (mSelectDefault)
|
||||||
|
{
|
||||||
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
|
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
|
||||||
} else {
|
} else {
|
||||||
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
|
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
|
||||||
@@ -663,8 +665,8 @@ int wxFileDialog::ShowModal()
|
|||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNavReply.validRecord) {
|
if (mNavReply.validRecord)
|
||||||
|
{
|
||||||
FSSpec outFileSpec ;
|
FSSpec outFileSpec ;
|
||||||
AEDesc specDesc ;
|
AEDesc specDesc ;
|
||||||
AEKeyword keyWord ;
|
AEKeyword keyWord ;
|
||||||
@@ -674,7 +676,8 @@ int wxFileDialog::ShowModal()
|
|||||||
for ( long i = 1 ; i <= count ; ++i )
|
for ( long i = 1 ; i <= count ; ++i )
|
||||||
{
|
{
|
||||||
OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
|
OSErr err = ::AEGetNthDesc( &mNavReply.selection , i , typeFSS, &keyWord , &specDesc);
|
||||||
if ( err != noErr ) {
|
if ( err != noErr )
|
||||||
|
{
|
||||||
m_path = wxT("") ;
|
m_path = wxT("") ;
|
||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user