OSStatus	LLFilePicker::doNavChooseDialog(ELoadFilter filter)
{
	OSStatus		error = noErr;
	NavDialogRef	navRef = NULL;
	NavReplyRecord	navReply;

	// if local file browsing is turned off, return without opening dialog
	if ( check_local_file_access_enabled() == false )
	{
		return FALSE;
	}

	memset(&navReply, 0, sizeof(navReply));
	
	// NOTE: we are passing the address of a local variable here.  
	//   This is fine, because the object this call creates will exist for less than the lifetime of this function.
	//   (It is destroyed by NavDialogDispose() below.)
	error = NavCreateChooseFileDialog(&mNavOptions, NULL, NULL, NULL, navOpenFilterProc, (void*)(&filter), &navRef);

	gViewerWindow->getWindow()->beforeDialog();

	if (error == noErr)
		error = NavDialogRun(navRef);

	gViewerWindow->getWindow()->afterDialog();

	if (error == noErr)
		error = NavDialogGetReply(navRef, &navReply);

	if (navRef)
		NavDialogDispose(navRef);

	if (error == noErr && navReply.validRecord)
	{
		SInt32	count = 0;
		SInt32	index;
		
		// AE indexes are 1 based...
		error = AECountItems(&navReply.selection, &count);
		for (index = 1; index <= count; index++)
		{
			FSRef		fsRef;
			AEKeyword	theAEKeyword;
			DescType	typeCode;
			Size		actualSize = 0;
			char		path[MAX_PATH];	/*Flawfinder: ignore*/
			
			memset(&fsRef, 0, sizeof(fsRef));
			error = AEGetNthPtr(&navReply.selection, index, typeFSRef, &theAEKeyword, &typeCode, &fsRef, sizeof(fsRef), &actualSize);
			
			if (error == noErr)
				error = FSRefMakePath(&fsRef, (UInt8*) path, sizeof(path));
			
			if (error == noErr)
				mFiles.push_back(std::string(path));
		}
	}
	
	return error;
}
Example #2
0
// select a file to play, and play it
BOOL PlayFile()
{
	BOOL ret=FALSE;
	NavDialogRef fileDialog;
	NavDialogCreationOptions fo;
	NavGetDefaultDialogCreationOptions(&fo);
	fo.optionFlags=0;
	fo.parentWindow=win;
	NavCreateChooseFileDialog(&fo,NULL,NULL,NULL,NULL,NULL,&fileDialog);
	if (!NavDialogRun(fileDialog)) {
		NavReplyRecord r;
		if (!NavDialogGetReply(fileDialog,&r)) {
			AEKeyword k;
			FSRef fr;
			if (!AEGetNthPtr(&r.selection,1,typeFSRef,&k,NULL,&fr,sizeof(fr),NULL)) {
				char file[256];
				FSRefMakePath(&fr,(BYTE*)file,sizeof(file));
				if (!(chan=BASS_StreamCreateFile(FALSE,file,0,0,BASS_SAMPLE_LOOP))
					&& !(chan=BASS_MusicLoad(FALSE,file,0,0,BASS_MUSIC_RAMP|BASS_SAMPLE_LOOP,1))) {
					Error("Can't play file");
				} else {
					BASS_ChannelPlay(chan,FALSE);
					ret=TRUE;
				}
			}
			NavDisposeReply(&r);
		}
	}
	NavDialogDispose(fileDialog);
	return ret;
}
Example #3
0
OSErr squeakFindImage(char* pathName)
{
    NavDialogCreationOptions    dialogOptions;
    NavObjectFilterUPP  filterProc =  NewNavObjectFilterUPP(findImageFilterProc);
    OSErr               anErr = noErr;
    NavDialogRef		navDialog;
	FSRef fileAsFSRef;
	
    //  Specify default options for dialog box
    anErr = NavGetDefaultDialogCreationOptions(&dialogOptions);
    if (anErr != noErr)
		return anErr;
		

	//  Adjust the options to fit our needs
	//  Set default location option
	dialogOptions.optionFlags |= kNavSelectDefaultLocation;
	dialogOptions.optionFlags  |= kNavAllFilesInPopup;
	dialogOptions.optionFlags  |= kNavSelectAllReadableItem;
	//  Clear preview option
	dialogOptions.optionFlags  ^= kNavAllowPreviews;
	
				
	// Call NavGetFile() with specified options and
	// declare our app-defined functions and type list
	NavCreateChooseFileDialog (
			&dialogOptions,
			nil,
			nil,
			nil,
			filterProc,
			nil,
			&navDialog);
	anErr = NavDialogRun (navDialog);
	if (anErr != noErr )
		return anErr;
		
	NavReplyRecord outReply;
	anErr = NavDialogGetReply (navDialog,&outReply);
	
    DisposeNavObjectFilterUPP(filterProc);
	NavDialogDispose(navDialog);	
		
	if (anErr != noErr)
		return anErr;
		
	if (!outReply.validRecord) {
		anErr = NavDisposeReply(&outReply);
		return -1;
	}

	// Get the file
	anErr = AEGetNthPtr(&(outReply.selection), 1, typeFSRef, NULL, NULL, &fileAsFSRef, sizeof(FSRef), NULL);
	PathToFileViaFSRef(pathName,DOCUMENT_NAME_SIZE, &fileAsFSRef, gCurrentVMEncoding);

	//  Dispose of NavReplyRecord, resources, descriptors
	anErr = NavDisposeReply(&outReply);

    return 0;
}
Example #4
0
pascal OSStatus OpenEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	NavDialogRef fileDialog;
	NavDialogCreationOptions fo;
	NavGetDefaultDialogCreationOptions(&fo);
	fo.optionFlags=0;
	fo.parentWindow=win;
	NavCreateChooseFileDialog(&fo,NULL,NULL,NULL,NULL,NULL,&fileDialog);
// if someone wants to somehow get the file selector to filter like in the Windows example, that'd be nice ;)
	if (!NavDialogRun(fileDialog)) {
		NavReplyRecord r;
		if (!NavDialogGetReply(fileDialog,&r)) {
			AEKeyword k;
			FSRef fr;
			if (!AEGetNthPtr(&r.selection,1,typeFSRef,&k,NULL,&fr,sizeof(fr),NULL)) {
				char file[256];
				FSRefMakePath(&fr,(BYTE*)file,sizeof(file));
				BASS_StreamFree(chan); // free old stream before opening new
				if (!(chan=BASS_StreamCreateFile(FALSE,file,0,0,BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT))) {
					SetControlTitleWithCFString(inUserData,CFSTR("click here to open a file..."));
					{
						ControlRef cref=GetControl(11);
						SetControlData(cref,kControlNoPart,kControlStaticTextTextTag,0,"");
						DrawOneControl(cref);
					}
					SetControl32BitMaximum(GetControl(12),0);
					Error("Can't play the file");
				} else {
					CFStringRef cs=CFStringCreateWithCString(0,file,kCFStringEncodingUTF8);
					SetControlTitleWithCFString(inUserData,cs);
					CFRelease(cs);
					{ // display the file type and length
						QWORD bytes=BASS_ChannelGetLength(chan,BASS_POS_BYTE);
						DWORD time=BASS_ChannelBytes2Seconds(chan,bytes);
						BASS_CHANNELINFO info;
						BASS_ChannelGetInfo(chan,&info);
						sprintf(file,"channel type = %x (%s)\nlength = %llu (%u:%02u)",
							info.ctype,GetCTypeString(info.ctype,info.plugin),bytes,time/60,time%60);
						{
							ControlRef cref=GetControl(11);
							SetControlData(cref,kControlNoPart,kControlStaticTextTextTag,strlen(file),file);
							DrawOneControl(cref);
						}
						SetControl32BitMaximum(GetControl(12),time); // update scroller range
					}
					BASS_ChannelPlay(chan,FALSE);
				}
			}
			NavDisposeReply(&r);
		}
	}
	NavDialogDispose(fileDialog);
    return noErr;
}
PPOpenPanel::ReturnCodes PPOpenPanel::runModal()
{
	ReturnCodes result = ReturnCodeCANCEL;
	
	OSStatus err = noErr;
	NavDialogRef theOpenDialog;
	NavDialogCreationOptions dialogOptions;
	
	if ((err = NavGetDefaultDialogCreationOptions(&dialogOptions)) == noErr)
	{
		
		dialogOptions.modality = kWindowModalityAppModal;
		dialogOptions.windowTitle = CFStringCreateWithCString(NULL, caption, kCFStringEncodingASCII);
		
		err = NavCreateChooseFileDialog(&dialogOptions, NULL, NULL, NULL, NULL, NULL, &theOpenDialog);
	
		if (theOpenDialog)
		{
			err = NavDialogRun(theOpenDialog);
			
			NavReplyRecord reply;
			
			err = NavDialogGetReply (theOpenDialog, &reply);
			
			if (err == noErr)
			{
				
				// retrieve filename
				AEDesc actualDesc;
				FSRef fileToOpen;
				//HFSUniStr255 theFileName;
				//CFStringRef fileNameCFString;
				
				err = AECoerceDesc(&reply.selection, typeFSRef, &actualDesc);
				
				err = AEGetDescData(&actualDesc, reinterpret_cast<void*>(&fileToOpen), sizeof(FSRef));
				
				// gib ihm
				int len = PATH_MAX;
				char* buffer = new char[PATH_MAX+1];
				
				FSRefMakePath (&fileToOpen, (UInt8*)buffer, len);			
				
				fileName = buffer;
					
				delete[] buffer;
				
				result = ReturnCodeOK;
				
				NavDisposeReply(&reply);
			}
			
			NavDialogDispose(theOpenDialog);
			
		}
		
		if (dialogOptions.windowTitle)
			CFRelease(dialogOptions.windowTitle);
				
	}
	
	return result;

}
Example #6
0
void RequestMidiFilename(std::wstring *returned_filename, std::wstring *returned_file_title)
{
   // Grab the filename of the last song we played
   // and pre-load it into the open dialog
   wstring last_filename = UserSetting::Get(L"Last File", L"");

   const static int BufferSize = 512;
   wchar_t filename[BufferSize] = L"";
   wchar_t filetitle[BufferSize] = L"";

#ifdef WIN32
   // Try to populate our "File Open" box with the last file selected
   if (StringCbCopyW(filename, BufferSize, last_filename.c_str()) == STRSAFE_E_INSUFFICIENT_BUFFER)
   {
      // If there wasn't a last file, default to the built-in Music directory
      filename[0] = L'\0';
   }

   wstring default_dir;
   bool default_directory = false;
   if (last_filename.length() == 0)
   {
      default_directory = true;
      default_dir = UserSetting::Get(L"Default Music Directory", L"");

      if (!SetCurrentDirectory(default_dir.c_str()))
      {
         // LOGTODO!
         // This is non-critical.  No action required.
      }
   }

   OPENFILENAME ofn;
   ZeroMemory(&ofn, sizeof(OPENFILENAME));
   ofn.lStructSize =     sizeof(OPENFILENAME);
   ofn.hwndOwner =       0;
   ofn.lpstrTitle =      L"Piano Game: Choose a MIDI song to play";
   ofn.lpstrFilter =     L"MIDI Files (*.mid)\0*.mid;*.midi\0All Files (*.*)\0*.*\0";
   ofn.lpstrFile =       filename;
   ofn.nMaxFile =        BufferSize;
   ofn.lpstrFileTitle =  filetitle;
   ofn.lpstrInitialDir = default_dir.c_str();
   ofn.nMaxFileTitle =   BufferSize;
   ofn.lpstrDefExt =     L"mid";
   ofn.Flags =           OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;

   if (GetOpenFileName(&ofn))
   {
      std::wstring filename = WSTRING(ofn.lpstrFile);

      SetLastMidiFilename(filename);

      if (returned_file_title) *returned_file_title = WSTRING(filetitle);
      if (returned_filename) *returned_filename = filename;
      return;
   }

   if (returned_file_title) *returned_file_title = L"";
   if (returned_filename) *returned_filename = L"";

#else
   
   OSStatus status;
   
   NavDialogCreationOptions options;
   status  = NavGetDefaultDialogCreationOptions(&options);
   if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't create dialog options.  Error code: " << static_cast<int>(status)));
   
   options.windowTitle = CFSTR("Piano Game: Choose a MIDI song to play");
   
   // TODO: Should clean this up at shut-down
   static NavObjectFilterUPP navFilterUPP(0);
   if (navFilterUPP == 0) navFilterUPP = NewNavObjectFilterUPP(NavOpenFilterProc);
   
   NavDialogRef navDialog(0);
   status = NavCreateChooseFileDialog(&options, 0, 0, 0, navFilterUPP, 0, &navDialog);
   if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't create open dialog.  Error code: " << static_cast<int>(status)));
   
   status = NavDialogRun(navDialog);
   if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't run open dialog.  Error code: " << static_cast<int>(status)));
   
   NavReplyRecord navReply;
   status = NavDialogGetReply(navDialog, &navReply);

   if (status == userCanceledErr || !navReply.validRecord)
   {
      NavDisposeReply(&navReply);

      if (returned_file_title) *returned_file_title = L"";
      if (returned_filename) *returned_filename = L"";
      return;
   }
   
   long item_count = 0;
   status = AECountItems(&navReply.selection, &item_count);
   if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't count resulting items from open dialog.  Error code: " << static_cast<int>(status)));
      
   for (long i = 1; i <= item_count; i++)
   {
      FSRef fsRef;
      status = AEGetNthPtr(&navReply.selection, i, typeFSRef, 0, 0, &fsRef, sizeof(FSRef), 0);
      if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get FSRef pointer from open dialog.  Error code: " << static_cast<int>(status)));

      CFStringRef file_title;
      status = LSCopyDisplayNameForRef( &fsRef, &file_title );
      if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get file title.  Error code: " << static_cast<int>(status)));
      
      const static int BufferSize(1024);
      char path_buffer[BufferSize];
      status = FSRefMakePath(&fsRef, (UInt8*)path_buffer, BufferSize);
      if (status != noErr) throw PianoGameError(WSTRING(L"Couldn't get file path.  Error code: " << static_cast<int>(status)));
      
      std::string narrow_path(path_buffer);
      std::wstring filepath(narrow_path.begin(), narrow_path.end());
      
      if (returned_file_title) *returned_file_title = WideFromMacString(file_title);
      if (returned_filename) *returned_filename = filepath;
      
      CFRelease(file_title);
   }
   
   NavDisposeReply(&navReply);
   
#endif
}
OSStatus	LLFilePickerBase::doNavChooseDialog(ELoadFilter filter, std::string const& folder)
{
	OSStatus		error = noErr;
	NavDialogRef	navRef = NULL;
	NavReplyRecord	navReply;

	memset(&navReply, 0, sizeof(navReply));

	mLoadFilter = filter;
	mFolder = folder;

	NavEventUPP eventProc = NewNavEventUPP(doNavCallbackEvent);
	
	// NOTE: we are passing the address of a local variable here.  
	//   This is fine, because the object this call creates will exist for less than the lifetime of this function.
	//   (It is destroyed by NavDialogDispose() below.)
	error = NavCreateChooseFileDialog(&mNavOptions, NULL, eventProc, NULL, navOpenFilterProc, (void*)this, &navRef);

	//gViewerWindow->mWindow->beforeDialog();

	if (error == noErr)
	{
		PLS_FLUSH;
		error = NavDialogRun(navRef);
	}

	//gViewerWindow->mWindow->afterDialog();

	if (error == noErr)
		error = NavDialogGetReply(navRef, &navReply);

	if (navRef)
		NavDialogDispose(navRef);

	if (error == noErr && navReply.validRecord)
	{
		SInt32	count = 0;
		SInt32	index;
		
		// AE indexes are 1 based...
		error = AECountItems(&navReply.selection, &count);
		for (index = 1; index <= count; index++)
		{
			FSRef		fsRef;
			AEKeyword	theAEKeyword;
			DescType	typeCode;
			Size		actualSize = 0;
			char		path[MAX_PATH];	/*Flawfinder: ignore*/
			
			memset(&fsRef, 0, sizeof(fsRef));
			error = AEGetNthPtr(&navReply.selection, index, typeFSRef, &theAEKeyword, &typeCode, &fsRef, sizeof(fsRef), &actualSize);
			
			if (error == noErr)
				error = FSRefMakePath(&fsRef, (UInt8*) path, sizeof(path));
			
			if (error == noErr)
				mFiles.push_back(std::string(path));
		}
	}

	if (eventProc)
		DisposeNavEventUPP(eventProc);
	
	return error;
}
Example #8
0
pascal OSStatus OpenEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	DWORD p;
	NavDialogRef fileDialog;
	NavDialogCreationOptions fo;
	NavGetDefaultDialogCreationOptions(&fo);
	fo.optionFlags=0;
	fo.parentWindow=win;
	NavCreateChooseFileDialog(&fo,NULL,NULL,NULL,NULL,NULL,&fileDialog);
	if (!NavDialogRun(fileDialog)) {
		NavReplyRecord r;
		if (!NavDialogGetReply(fileDialog,&r)) {
			AEKeyword k;
			FSRef fr;
			if (!AEGetNthPtr(&r.selection,1,typeFSRef,&k,NULL,&fr,sizeof(fr),NULL)) {
				char file[256];
				FSRefMakePath(&fr,(BYTE*)file,sizeof(file));
				BASS_StreamFree(chan); // free old streams before opening new
		
				// create decode channel
				chan = BASS_StreamCreateFile(FALSE,file,0,0,BASS_SAMPLE_FLOAT|BASS_STREAM_DECODE|BASS_STREAM_PRESCAN);

				// check for MOD
				if (!chan) chan = BASS_MusicLoad(FALSE, file, 0, 0, BASS_SAMPLE_FLOAT|BASS_MUSIC_RAMP|BASS_STREAM_DECODE|BASS_MUSIC_PRESCAN,0);

				if (!chan) {
					SetControlTitleWithCFString(inUserData,CFSTR("click here to open a file && play it..."));
					Error("Selected file couldn't be loaded!");
				} else {
					// create new stream - decoded & reversed
					// 2 seconds decoding block as a decoding channel
					if (!(chan=BASS_FX_ReverseCreate(chan, 2, BASS_STREAM_DECODE|BASS_FX_FREESOURCE))) {
						SetControlTitleWithCFString(inUserData,CFSTR("click here to open a file && play it..."));
						Error("Couldn't create a reversed stream!");
						BASS_StreamFree(chan);
						BASS_MusicFree(chan);
					} else {
						// create a new stream - decoded & resampled :)
						if (!(chan=BASS_FX_TempoCreate(chan, BASS_SAMPLE_LOOP|BASS_FX_FREESOURCE))){
							SetControlTitleWithCFString(inUserData,CFSTR("click here to open a file && play it..."));
							Error("Couldn't create a resampled stream!");
							BASS_StreamFree(chan);
							BASS_MusicFree(chan);
						} else {
							// update the Button to show the loaded file
							c2pstrcpy((BYTE*)file,file);
							SetControlTitle(inUserData,(BYTE*)file);

							// update the position slider
							p = BASS_ChannelBytes2Seconds(chan, BASS_ChannelGetLength(chan, BASS_POS_BYTE));
							SetControl32BitMaximum(GetControl(15),p);
							SetControl32BitValue(GetControl(15),p);

							// set Volume
							p = GetControl32BitValue(GetControl(11));
							BASS_ChannelSetAttribute(chan, BASS_ATTRIB_VOL, (float)p/100.0f);

							// update tempo slider
							SetControl32BitValue(GetControl(13),0);
							SetStaticText(12,"Tempo = 0%");

							// play new created stream
							BASS_ChannelPlay(chan,FALSE);
						}
					}
				}
			}
			NavDisposeReply(&r);
		}
	}
	NavDialogDispose(fileDialog);
	return noErr;
}
Example #9
0
bool showOpenFileDialog(std::string& result, const std::string& path, const std::string& filetypes) {
	
	class Error : public std::exception {
	public:
		Error(OSStatus status) : std::exception(), _status(status) {}
		OSStatus getStatus() { return _status; }
		virtual const char* what() { return "Error while showing OpenFileDialog"; }
		
		static void checkForError(OSStatus status) { if (status != noErr) throw Error(status); }
		
		virtual ~Error() throw () {}
	private:
		OSStatus _status;
	};

	OSStatus status;
	NavDialogRef dlg(NULL);
	NavObjectFilterUPP navFilterUPP = NULL;
	NavDialogCreationOptions myDialogOptions;
	NavReplyRecord        navReply;
	bool success(false);
	try {
		status = NavGetDefaultDialogCreationOptions (&myDialogOptions);
		myDialogOptions.modality = kWindowModalityAppModal;
		
		DialogData data;
		data.defaultLocation = (path.empty()) ? "" : osgDB::findDataFile(path);
		if (!filetypes.empty()) {
			navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
			std::vector<std::string> exts;
			cefix::strTokenize(filetypes,exts,",");
			data.allowedExtensions.insert(exts.begin(), exts.end());
		}
		status = NavCreateChooseFileDialog(&myDialogOptions, NULL, sStandardNavEventFilter, NULL, navFilterUPP, &data, &dlg);
		Error::checkForError(status);
		
		status = NavDialogRun (dlg);
		Error::checkForError(status);
		
		NavUserAction userAction = NavDialogGetUserAction(dlg);
		if(userAction == kNavUserActionChoose) 
		{
			const unsigned int max_path = 2048;
			FSRef fsRef;
			
			status  = NavDialogGetReply( dlg, &navReply );
			Error::checkForError(status);
			status = AEGetNthPtr(&(navReply.selection), 1, typeFSRef, NULL, NULL, &fsRef, sizeof(FSRef), NULL);
			
			char	 path[max_path];
			status	= FSRefMakePath ( &fsRef, (UInt8*)path, max_path );
			
			NavDisposeReply ( &navReply );
			result = std::string(path);
			success = true;
		}
			
	}
	catch (Error e) {
		log::error("showOpenFileDialog") << "failed with " << e.getStatus() << std::endl;
		success = false;
	}
	if (navFilterUPP)
		::DisposeNavObjectFilterUPP(navFilterUPP);
	if (dlg)
		NavDialogDispose (dlg);
	
	return success;
	
}
Example #10
0
Boolean AskUserForGetFileName(char* prompt_string,    
							short numTypes, 
							OSType typeList[],
							//
							char* pathOfFileSelected,  
							short maxPathLength,
							FSSpec *specPtr,
							MyCustomNavItemsData *myCustomItemsDataPtr)
{
	OSStatus err = 0;
	NavDialogCreationOptions  dialogOptions;
	NavTypeListHandle inTypeList = 0;
	NavEventUPP inEventProc = 0;
	NavPreviewUPP inPreviewProc = 0;
	NavObjectFilterUPP inFilterProc = 0;
	Ptr inClientData = (Ptr)myCustomItemsDataPtr;
	NavDialogRef navDialogRef = 0;
	NavReplyRecord replyRecord;
	Boolean gotReply = false;
	
	FSSpec fsSpec;
	char pathName[256]="";
	
	CFStringRef windowTitleCFStrRef = 0;
	CFStringRef clientNameCFStrRef = 0;
	
	if(specPtr) memset(specPtr,0,sizeof(specPtr));
	if(pathOfFileSelected && maxPathLength > 0) pathOfFileSelected[0] = 0;

	err = NavGetDefaultDialogCreationOptions(&dialogOptions);
	if(err) return false;
	
	// for now don't customize the dialogs, may want to do this later
	/*if(myCustomItemsDataPtr && myCustomItemsDataPtr->ditlResID) {
		inEventProc = GetMyNavEventHandlerUPP();
	}*/

	if(prompt_string && prompt_string[0]) {
		windowTitleCFStrRef = CFStringCreateWithCString(NULL, prompt_string, kCFStringEncodingMacRoman);
		dialogOptions.windowTitle = windowTitleCFStrRef;
	}
	
	// set the client name so the system can remember the last place the user looked
	clientNameCFStrRef  = CFStringCreateWithCString(NULL, "GNOME", kCFStringEncodingMacRoman);
	dialogOptions.clientName = clientNameCFStrRef;
	
	//inTypeList = MyCreateNavTypeListHandle(gMySignature,numTypes,typeList);	// for now allow all files to be shown, filtering is messed up on 10.6
	
	//err = NavCreateChooseFileDialog (&dialogOptions,inTypeList,inEventProc,inPreviewProc,inFilterProc,inClientData,&navDialogRef);
	err = NavCreateChooseFileDialog (&dialogOptions,inTypeList,inEventProc,inPreviewProc,inFilterProc,NULL,&navDialogRef);
	if(err) return false;
	
	InitCursor();
	err = NavDialogRun(navDialogRef);
	SetWatchCursor();
	if(err) goto done;
	
	err = NavDialogGetReply(navDialogRef,&replyRecord);
	if(err) goto done;
	
	gotReply = true;
	
	err = AEGetNthPtr(&(replyRecord.selection), 1, typeFSS, NULL, NULL, &fsSpec, sizeof(fsSpec), NULL);
	if(err) goto done;
	
	(void)PathNameFromDirID(fsSpec.parID,fsSpec.vRefNum,pathName);//GetPathWithDelimiterFromDirID
	mypstrcatJM((StringPtr)pathName,fsSpec.name);
	my_p2cstr(pathName);
	
	if(strlen(pathName) < maxPathLength){
		strcpy(pathOfFileSelected,pathName);
	}
	else  {
		err = -1; // path is too long to return
	}
		
	if(!err && specPtr)  *specPtr = fsSpec;
	
done:
	if(inTypeList) {DisposeHandle((Handle)inTypeList); inTypeList = 0;}
	if(windowTitleCFStrRef) { CFRelease(windowTitleCFStrRef);  windowTitleCFStrRef = 0;}
	if(clientNameCFStrRef) { CFRelease(clientNameCFStrRef);  clientNameCFStrRef = 0;}

	if(gotReply) NavDisposeReply(&replyRecord);
	
	NavDialogDispose(navDialogRef);
	
	if(gotReply && !err) return true;
	return false;
	
} /* end MyGetMacFile() */