0001 function [dirname, fnames, canceled] = pa_prjfile_select(proj_root, ext, caption)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 persistent h;
0016 persistent HISTORY;
0017
0018 dirname = [];
0019 fnames= [];
0020 canceled = false;
0021
0022
0023 if ~isempty(h)
0024 canceled = true;
0025 return;
0026 end
0027
0028 h = file_dialog;
0029 h = set(h, 'file_extensions', ext);
0030 if exist('caption', 'var')
0031 h.dialog_title = caption;
0032 end
0033 h = set(h, 'current_dir', proj_root);
0034
0035
0036 hist_num = length(HISTORY);
0037 if ~isempty(HISTORY)
0038 k=1;
0039 for k=1:hist_num
0040 h = set(h, 'hist_dir', HISTORY{k});
0041 end
0042 h = set(h, 'current_dir', char(HISTORY{k}));
0043 end
0044 [dirname fnames] = visible(h);
0045
0046
0047 if isempty(dirname)
0048 canceled = true;
0049 end
0050
0051
0052 if ~isempty(dirname)
0053 HISTORY{hist_num+1} = {dirname};
0054 end
0055
0056
0057 if ~isempty(dirname) & ~isempty(proj_root)
0058 dirname = vb_relativepath(dirname, proj_root);
0059 dirname = dirname(1:length(dirname)-1);
0060 end
0061
0062 h = [];