removing old codeparts, fixing bug 1532580

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46148 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-05-21 18:54:42 +00:00
parent 8ef877aabe
commit 0fd55b6c41

View File

@@ -83,12 +83,14 @@ static pascal void NavEventProc(
::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation); ::NavCustomControl(ioParams->context, kNavCtlSetLocation, (void *) &theLocation);
} }
NavMenuItemSpec menuItem; if( data->extensions.GetCount() > 0 )
menuItem.version = kNavMenuItemSpecVersion; {
menuItem.menuCreator = 'WXNG'; NavMenuItemSpec menuItem;
menuItem.menuType = data->currentfilter; memset( &menuItem, 0, sizeof(menuItem) );
wxMacStringToPascal( data->name[data->currentfilter] , (StringPtr)(menuItem.menuItemName) ) ; menuItem.version = kNavMenuItemSpecVersion;
::NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &menuItem); menuItem.menuType = data->currentfilter;
::NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &menuItem);
}
} }
else if ( inSelector == kNavCBPopupMenuSelect ) else if ( inSelector == kNavCBPopupMenuSelect )
{ {
@@ -108,7 +110,7 @@ static pascal void NavEventProc(
sfilename = cfString.AsString() ; sfilename = cfString.AsString() ;
int pos = sfilename.Find('.', true) ; int pos = sfilename.Find('.', true) ;
if ( pos != wxNOT_FOUND ) if ( pos != wxNOT_FOUND && extension != wxT("*") )
{ {
sfilename = sfilename.Left(pos+1)+extension ; sfilename = sfilename.Left(pos+1)+extension ;
cfString.Assign( sfilename , wxFONTENCODING_DEFAULT ) ; cfString.Assign( sfilename , wxFONTENCODING_DEFAULT ) ;
@@ -224,34 +226,6 @@ static Boolean CheckFile( const wxString &filename , OSType type , OpenUserDataR
return true ; return true ;
} }
#if !TARGET_API_MAC_OSX
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
{
OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
// return true if this item is invisible or a file
Boolean visibleFlag;
Boolean folderFlag;
visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
// because the semantics of the filter proc are "true means don't show
// it" we need to invert the result that we return
if ( !visibleFlag )
return true ;
if ( !folderFlag )
{
wxString file = wxMacMakeStringFromPascal( myCInfoPBPtr->hFileInfo.ioNamePtr ) ;
return !CheckFile( file , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
}
return false ;
}
#endif
// end wxmac // end wxmac
wxFileDialog::wxFileDialog( wxFileDialog::wxFileDialog(
@@ -282,9 +256,19 @@ pascal Boolean CrossPlatformFilterCallback(
FSRef fsref ; FSRef fsref ;
if ( AEGetDescData (theItem, &fsref, sizeof (FSRef)) == noErr ) if ( AEGetDescData (theItem, &fsref, sizeof (FSRef)) == noErr )
{ {
#if 1
memcpy( &fsref , *theItem->dataHandle , sizeof(FSRef) ) ; memcpy( &fsref , *theItem->dataHandle , sizeof(FSRef) ) ;
wxString file = wxMacFSRefToPath( &fsref ) ; wxString file = wxMacFSRefToPath( &fsref ) ;
display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ; display = CheckFile( file , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
#else
CFStringRef itemUTI = NULL;
OSStatus status = LSCopyItemAttribute (&fsref, kLSRolesAll, kLSItemContentType, (CFTypeRef*)&itemUTI);
if (status == noErr)
{
display = UTTypeConformsTo (itemUTI, CFSTR("public.text") );
CFRelease (itemUTI);
}
#endif
} }
} }
} }
@@ -339,10 +323,6 @@ int wxFileDialog::ShowModal()
if (!numFilters) if (!numFilters)
dialogCreateOptions.optionFlags |= kNavNoTypePopup; dialogCreateOptions.optionFlags |= kNavNoTypePopup;
// The extension is important
if (numFilters < 2)
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
#if TARGET_API_MAC_OSX #if TARGET_API_MAC_OSX
if (!(m_windowStyle & wxFD_OVERWRITE_PROMPT)) if (!(m_windowStyle & wxFD_OVERWRITE_PROMPT))
dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement; dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;