Changeset 714 for trunk/src


Ignore:
Timestamp:
Feb 22, 2014, 5:11:04 PM (11 years ago)
Author:
sommeria
Message:

various improvements

Location:
trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/fullfile_uvmat.m

    r589 r714  
    3737function filename=fullfile_uvmat(RootPath,SubDir,RootFile,FileExt,NomType,i1,i2,j1,j2)
    3838   
    39 %% display help and test function in the absence of input arument
     39%% display help and test function in the absence of input argument
    4040if ~exist('RootPath','var')
    4141    help fullfile_uvmat;
     
    115115    end
    116116end
    117 % if ~isempty(i2_str)||~isempty(j2_str)
    118     filename=fullfile(RootPath,SubDir,RootFile);
    119 % else
    120 %     filename=fullfile(RootPath,RootFile);
    121 % end
     117filename=fullfile(RootPath,SubDir,RootFile);
    122118filename=[filename sep1 i1_str sep2 i2_str sep3 j1_str sep4 j2_str];
    123119filename=[regexprep(filename,'_$','') FileExt];%suppress possible '_' at the end of the string and add the extension
  • trunk/src/mouse_down.m

    r713 r714  
    3131else
    3232    hCurrentGUI=hObject; % handle of the current GUI: usual plot
     33end
     34if strcmp(get(hCurrentGUI,'Pointer'),'watch')
     35    return % no action if a calculation is running
    3336end
    3437hhCurrentGUI=guidata(hCurrentGUI);% tags of the children of the current GUI
  • trunk/src/mouse_motion.m

    r701 r714  
    2525function mouse_motion(hObject,eventdata,handles)
    2626
    27 if ~exist('handles','var')
    28     set(hCurrentFig,'Pointer','arrow');
    29     return
    30 end
     27% if ~exist('handles','var')
     28%     set(hCurrentFig,'Pointer','arrow');
     29%     return
     30% end
    3131FigData=get(hObject,'UserData');
    3232if ishandle(FigData)% case of a zoom plot, the handle of the parent rectangle is stored in UserData, its parent is the plotting axes of the rectangle
     
    3434else
    3535    hCurrentFig=hObject;%usual plot
     36end
     37if strcmp(get(hCurrentFig,'Pointer'),'watch')
     38    return % no action if a calculation is running
    3639end
    3740hhCurrentFig=guidata(hCurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
  • trunk/src/mouse_up.m

    r701 r714  
    127127    %% stop drawing and plot the projected field if the object manipulation is finished
    128128    if check_multiple==0  || isequal(get(hcurrentfig,'SelectionType'),'alt')
     129        pointer=get(hcurrentfig,'Pointer');%memorize the current pointer shape
     130        set(hcurrentfig,'Pointer','watch')% set the pointer shape to watch to prevent further mouse action
    129131        AxeData.CurrentOrigin=[]; %suppress the current origin
    130132        hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(FigTag);
     
    175177            UvData.ProjObject{IndexObj}=rmfield(UvData.ProjObject{IndexObj},'CreateMode');%remove createMode to mark the object as finished
    176178        end
     179        set(hcurrentfig,'Pointer',pointer)% % revert the pointer shape to allow further mouse action
    177180    else
    178181        test_drawing=1;%allow continuation of drawing object
  • trunk/src/series.m

    r711 r714  
    303303%------------------------------------------------------------------------ 
    304304function MenuBrowse_Callback(hObject, eventdata, handles)
    305 
    306305%% look for the previously opened file 'oldfile'
    307 oldfile=''; %default
    308 if get(handles.CheckAppend,'Value')
    309     % case 'checkappend': new series appended to the input table
    310     InputTable=get(handles.InputTable,'Data');
    311     RootPathCell=InputTable(:,1);
    312     SubDirCell=InputTable(:,3);
    313     oldfile=''; %default
    314     if ~(isempty(RootPathCell) || isequal(RootPathCell,{''}))%loads the previously stored file name and set it as default in the file_input box
    315         oldfile=fullfile(RootPathCell{1},SubDirCell{1});
    316     end
    317 else
    318     % case refresh the input table by a new series
    319     SeriesData=get(handles.series,'UserData');
    320     if isfield(SeriesData,'RefFile')
    321         oldfile=SeriesData.RefFile{1};
    322     end
    323 end
     306InputTable=get(handles.InputTable,'Data');
     307oldfile=InputTable{1,1};
     308if isempty(oldfile)
     309    % use a file name stored in prefdir
     310    dir_perso=prefdir;
     311    profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     312    if exist(profil_perso,'file')
     313        h=load (profil_perso);
     314        if isfield(h,'RootPath') && ischar(h.RootPath)
     315            oldfile=h.RootPath;
     316        end
     317    end
     318end
     319%% launch the browser
     320fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);
     321if ~isempty(fileinput)
     322      display_file_name(handles,fileinput,'one')
     323end
     324
     325% --------------------------------------------------------------------
     326function MenuBrowseAppend_Callback(hObject, eventdata, handles)
     327
     328%% look for the previously opened file 'oldfile'
     329InputTable=get(handles.InputTable,'Data');
     330RootPathCell=InputTable(:,1);
     331if isempty(RootPathCell{1})% no input file in the table
     332     MenuBrowse_Callback(hObject, eventdata, handles)%refresh the input table, not append
     333     return
     334end
     335SubDirCell=InputTable(:,2);
     336oldfile=fullfile(RootPathCell{1},SubDirCell{1});
    324337
    325338%% use a file name stored in prefdir
     
    336349fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);
    337350if ~isempty(fileinput)
    338 %     if get(handles.CheckAppend,'Value')
    339 %         display_file_name(handles,fileinput,'append')
    340 %     else
    341         display_file_name(handles,fileinput,'one')
    342 %     end
    343 end
    344 
    345 % --------------------------------------------------------------------
    346 function MenuBrowseAppend_Callback(hObject, eventdata, handles)
    347 
    348 %% look for the previously opened file 'oldfile'
    349 InputTable=get(handles.InputTable,'Data');
    350 RootPathCell=InputTable(:,1);
    351 if isempty(RootPathCell{1})% no input file in the table
    352      MenuBrowse_Callback(hObject, eventdata, handles)%refresh the input table, not append
    353      return
    354 end
    355 SubDirCell=InputTable(:,2);
    356 % oldfile=''; %default
    357 % if ~(isempty(RootPathCell) || isequal(RootPathCell,{''}))%loads the previously stored file name and set it as default in the file_input box
    358     oldfile=fullfile(RootPathCell{1},SubDirCell{1});
    359 % end
    360 
    361 %% use a file name stored in prefdir
    362 dir_perso=prefdir;
    363 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
    364 if exist(profil_perso,'file')
    365     h=load (profil_perso);
    366     if isfield(h,'RootPath') && ischar(h.RootPath)
    367         oldfile=h.RootPath;
    368     end
    369 end
    370 
    371 %% launch the browser
    372 fileinput=uigetfile_uvmat('pick a file to append in the input table',oldfile);
    373 if ~isempty(fileinput)
    374351        display_file_name(handles,fileinput,'append')
    375352end
     
    380357function MenuFile_Callback(hObject, eventdata, handles)
    381358
    382 display_file_name(handles,get(hObject,'Label'),'one')
     359errormsg=display_file_name(handles,get(hObject,'Label'),'one');
     360if ~isempty(errormsg)
     361    set(hObject,'Label','')
     362    MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
     363        {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
     364    str_find=strcmp(get(hObject,'Label'),MenuFile);
     365    MenuFile(str_find)=[];% suppress the input file to the list
     366    for ifile=1:numel(MenuFile)
     367        set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
     368    end
     369end
    383370
    384371%------------------------------------------------------------------------
     
    546533    if ~exist(RootPath,'dir')
    547534        i1_series=[];
    548         RootPath=fileparts(RootPath); %will try the upped folder
    549     else
     535        RootPath=fileparts(RootPath); %will try the upper folder
     536    else %scan the input folder
    550537        [RootPath,SubDir,RootFile,i1_series,i2_series,j1_series,j2_series,tild,FileType,FileInfo,MovieObject]=...
    551538            find_file_series(fullfile(InputTable{iview,1},InputTable{iview,2}),[InputTable{iview,3} InputTable{iview,4} InputTable{iview,5}]);
    552539    end
     540    % if no file is found, open a browser
    553541    if isempty(i1_series)
    554542        fileinput=uigetfile_uvmat(['wrong input at line ' num2str(iview) ':pick a new input file'],RootPath);
     
    567555%------------------------------------------------------------------------
    568556% --- Function called when a new file is opened, either by series_OpeningFcn or by the browser
    569 function display_file_name(handles,fileinput,iview)
     557function errormsg=display_file_name(handles,fileinput,iview)
    570558%------------------------------------------------------------------------ 
    571559%
     
    576564%       or 'one': refresh the list
    577565%         'append': add a new line to the input table
    578 
     566set(handles.REFRESH,'BackgroundColor',[1 1 0])% set REFRESH  button to yellow color (indicate activation)
     567drawnow
     568errormsg='';%default
    579569%% get the input root name, indices, file extension and nomenclature NomType
    580570if ~exist(fileinput,'file')
    581     msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
     571    errormsg=['input file ' fileinput  ' does not exist'];
     572    msgbox_uvmat('ERROR',errormsg)
     573    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
    582574    return
    583575end
     
    590582if isempty(RootFile)&&isempty(i1_series)
    591583    errormsg='no input file in the series';
     584    msgbox_uvmat('ERROR',errormsg)
     585    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
    592586    return
    593587end
    594588if strcmp(FileType,'txt')
    595589    edit(fileinput)
     590    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
    596591    return
    597592elseif strcmp(FileType,'xml')
    598593    editxml(fileinput)
     594    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
    599595     return
    600596elseif strcmp(FileType,'figure')
    601597    open(fileinput)
     598    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
    602599     return
    603600end
     
    670667set(handles.num_ref_j,'String',num2str(ref_j));
    671668
     669%% update first and last indices if they do not exist
     670Param=read_GUI(handles.series);
     671first_j=[];
     672if isfield(Param.IndexRange,'first_j'); first_j=Param.IndexRange.first_j; end
     673last_j=[];
     674if isfield(Param.IndexRange,'last_j'); last_j=Param.IndexRange.last_j; end
     675[i1,i2,j1,j2] = get_file_index(Param.IndexRange.first_i,first_j,Param.IndexRange.PairString);
     676FirstFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
     677    Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
     678if ~exist(FirstFileName,'file')
     679    set(handles.num_first_i,'String',num2str(ref_i))
     680    set(handles.num_first_j,'String',num2str(ref_j))
     681end
     682[i1,i2,j1,j2] = get_file_index(Param.IndexRange.last_i,last_j,Param.IndexRange.PairString);
     683LastFileName=fullfile_uvmat(Param.InputTable{1,1},Param.InputTable{1,2},Param.InputTable{1,3},...
     684    Param.InputTable{1,5},Param.InputTable{1,4},i1,i2,j1,j2);
     685if ~exist(LastFileName,'file')
     686    set(handles.num_last_i,'String',num2str(ref_i))
     687    set(handles.num_last_j,'String',num2str(ref_j))
     688end
     689
    672690%% update the list of recent files in the menubar and save it for future opening
    673691MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
     
    699717%% initiate input file series and refresh the current field view:     
    700718update_rootinfo(handles,i1_series,i2_series,j1_series,j2_series,FileType,FileInfo,MovieObject,iview);
     719set(handles.REFRESH,'BackgroundColor',[1 0 0])% set REFRESH  button to red color (end of activation)
    701720
    702721%------------------------------------------------------------------------
     
    722741    diff_j_max=diff(ref_j);
    723742    diff_i_max=diff(ref_i);
    724    
    725 %     pair_max=squeeze(max(i1_series,[],1)); %max on pair index
    726 %     j_max=max(pair_max,[],1);
    727 %     MinIndex_i=find(j_max, 1 )-1;% min ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index)
    728 %     MaxIndex_i=find(j_max, 1, 'last' )-1;% max ref index i detected in the series (corresponding to the first non-zero value of i1_series, except for zero index)
    729 %     diff_i_max=diff(j_max);
    730743    if ~isempty(diff_i_max) && isequal (diff_i_max,diff_i_max(1)*ones(size(diff_i_max)))
    731744        set(handles.num_incr_i,'String',num2str(diff_i_max(1)))% detect an increment to dispaly by default
    732745    end
    733 %     i_max=max(pair_max,[],2);
    734 %     MinIndex_j=min(find(i_max))-1;% min ref index j
    735 %     MaxIndex_j=max(find(i_max))-1;% max ref index j
    736 %     diff_j_max=diff(i_max);
    737746    if isequal (diff_j_max,diff_j_max(1)*ones(size(diff_j_max)))
    738747        set(handles.num_incr_j,'String',num2str(diff_j_max(1)))
     
    973982    ind_select=find(file_indices<=numel(j_max{iview}));
    974983    LineData(ind_select)=j_max{iview}(file_select)~=0;
    975 %     LineData=zeros(1,range_index);
    976 %     x_index=find(j_max{iview}>0)-MinIndex_i;
    977 %     LineData(x_index)=1;
    978 %     if numel(x)>1
    979 %         LineData
    980     %LineData=interp1(x,LineData,xI,'nearest');
    981984    CData(ind_y,:)=ones(size(ind_y'))*LineData;
    982 %     end
    983985end
    984986CData=cat(3,zeros(size(CData)),CData,zeros(size(CData)));%make color images r=0,g,b=0
     
    10881090%------------------------------------------------------------------------
    10891091SeriesData=get(handles.series,'UserData');%
    1090 ref_i=[str2num(get(handles.num_first_i,'String')) str2num(get(handles.num_last_i,'String'))];
    1091 ref_j=[str2num(get(handles.num_first_j,'String')) str2num(get(handles.num_last_j,'String'))];
     1092PairString=get(handles.PairString,'Data');
     1093ref_i_1=str2num(get(handles.num_first_i,'String'));%first reference index
     1094ref_i_2=str2num(get(handles.num_last_i,'String'));%last reference index
     1095ref_j_1=[];ref_j_2=[];
     1096if strcmp(get(handles.num_first_j,'Visible'),'on')
     1097ref_j_1=str2num(get(handles.num_first_j,'String'));
     1098ref_j_2=str2num(get(handles.num_last_j,'String'));
     1099end
     1100[i1_1,i2_1,j1_1,j2_1] = get_file_index(ref_i_1,ref_j_1,PairString);
     1101[i1_2,i2_2,j1_2,j2_2] = get_file_index(ref_i_2,ref_j_2,PairString);
    10921102TimeTable=get(handles.TimeTable,'Data');
    1093 Pairs=get(handles.PairString,'Data');
     1103
     1104%Pairs=get(handles.PairString,'Data');
    10941105for iview=1:size(TimeTable,1)
    10951106    if size(SeriesData.Time,1)<iview
    10961107        break
    10971108    end
    1098     i1=ref_i;
    1099     j1=ref_j;
    1100     i2=ref_i;
    1101     j2=ref_j;
    1102     % case of pairs
    1103     if ~isempty(Pairs{iview,1})
    1104         r=regexp(Pairs{iview,1},'(?<mode>(Di=)|(Dj=)) -*(?<num1>\d+)\|(?<num2>\d+)','names');
    1105         if isempty(r)
    1106             r=regexp(Pairs{iview,1},'(?<num1>\d+)(?<mode>-)(?<num2>\d+)','names');
    1107         end
    1108         switch r.mode
    1109             case 'Di='  %  case 'series(Di)')
    1110                 i1=ref_i-str2num(r.num1);
    1111                 i2=ref_i+str2num(r.num2);
    1112             case 'Dj='  %  case 'series(Dj)'
    1113                 j1=ref_j-str2num(r.num1);
    1114                 j2=ref_j+str2num(r.num2);
    1115             case '-'  % case 'bursts'
    1116                 j1=str2num(r.num1)*ones(size(ref_i));
    1117                 j2=str2num(r.num2)*ones(size(ref_i));
    1118         end
    1119     end
    11201109    TimeTable{iview,2}=[];
    11211110    TimeTable{iview,3}=[];
    1122     if size(SeriesData.Time{iview},1)>=i2(2)+1&&size(SeriesData.Time{iview},2)>=j2(2)+1
    1123         if isempty(ref_j)
    1124             time_first=(SeriesData.Time{iview}(i1(1)+1)+SeriesData.Time{iview}(i2(1)+1))/2;
    1125             time_last=(SeriesData.Time{iview}(i1(2)+1)+SeriesData.Time{iview}(i2(2))+1)/2;
     1111    if size(SeriesData.Time{iview},1)>=i2_2+1 && (isempty(ref_j_1)||size(SeriesData.Time{iview},2)>=j2_2+1)
     1112        if isempty(ref_j_1)
     1113            time_first=(SeriesData.Time{iview}(i1_1+1,2)+SeriesData.Time{iview}(i2_1+1,2))/2;
     1114            time_last=(SeriesData.Time{iview}(i1_2+1,2)+SeriesData.Time{iview}(i2_2+1,2))/2;
    11261115        else
    1127             time_first=(SeriesData.Time{iview}(i1(1)+1,j1(1)+1)+SeriesData.Time{iview}(i2(1)+1,j2(1)+1))/2;
    1128             time_last=(SeriesData.Time{iview}(i1(2)+1,j1(2)+1)+SeriesData.Time{iview}(i2(2)+1,j2(2)+1))/2;
     1116            time_first=(SeriesData.Time{iview}(i1_1+1,j1_1+1)+SeriesData.Time{iview}(i2_1+1,j2_1+1))/2;
     1117            time_last=(SeriesData.Time{iview}(i1_2+1,j1_2+1)+SeriesData.Time{iview}(i2_2+1,j2_1+1))/2;
    11291118        end
    11301119        TimeTable{iview,2}=time_first; %TODO: take into account pairs
     
    11371126MinIndex_i=min(get(handles.MinIndex_i,'Data'));
    11381127MaxIndex_i=max(get(handles.MaxIndex_i,'Data'));
    1139 pos_first=(ref_i(1)-MinIndex_i)/(MaxIndex_i-MinIndex_i+1);
    1140 pos_last=(ref_i(2)-MinIndex_i+1)/(MaxIndex_i-MinIndex_i+1);
     1128pos_first=(ref_i_1-MinIndex_i)/(MaxIndex_i-MinIndex_i+1);
     1129pos_last=(ref_i_2-MinIndex_i+1)/(MaxIndex_i-MinIndex_i+1);
    11411130Position=get(handles.Waitbar,'Position');% position of the waitbar:= [ x,y, width, height]
    11421131Position_status=get(handles.FileStatus,'Position');
     
    11451134set(handles.Waitbar,'Position',Position)
    11461135update_waitbar(handles.Waitbar,0)
    1147 
    1148 % for iview=1:numel(SeriesData.i1_series)
    1149 %     pair_max{iview}=squeeze(max(SeriesData.i1_series{iview},[],1)); %max on pair index
    1150 %     if (strcmp(get(handles.num_first_j,'Visible'),'off')&& size(pair_max{iview},2)~=1)
    1151 %         pair_max{iview}=squeeze(max(pair_max{iview},[],1)); % consider only the i index
    1152 %     end
    1153 %     pair_max{iview}=reshape(pair_max{iview},1,[]);
    1154 %     index_min(iview)=find(pair_max{iview}>0, 1 );
    1155 %     index_max(iview)=find(pair_max{iview}>0, 1, 'last' );
    1156 % end
    1157 % [index_min,iview_min]=min(index_min);
    1158 % [index_max,iview_max]=min(index_max);
    1159 % if size(SeriesData.i1_series{iview_min},2)==1% movie
    1160 %     index_first=ref_i(1);
    1161 %     index_last=ref_i(2);
    1162 % else
    1163 %     index_first=(ref_i(1)-1)*(size(SeriesData.i1_series{iview_min},1))+ref_j(1)+1;
    1164 %     index_last=(ref_i(2)-1)*(size(SeriesData.i1_series{iview_max},1))+ref_j(2)+1;
    1165 % end
    1166 % range=index_max-index_min+1;
    1167 % coeff_min=(index_first-index_min)/range;
    1168 % coeff_max=(index_last-index_min+1)/range;
    1169 % Position=get(handles.Waitbar,'Position');% position of the waitbar:= [ x,y, width, height]
    1170 % Position_status=get(handles.FileStatus,'Position');
    1171 % Position(1)=coeff_min*Position_status(3)+Position_status(1);
    1172 % Position(3)=Position_status(3)*(coeff_max-coeff_min);
    1173 % set(handles.Waitbar,'Position',Position)
    1174 % update_waitbar(handles.Waitbar,0)
    11751136
    11761137%------------------------------------------------------------------------
     
    20281989%% Activate the Action fct
    20291990Param=read_GUI_series(handles);% read the parameters from the GUI series
    2030 ParamOut=h_fun(Param);
     1991ParamOut=h_fun(Param);%run the selected Action function to get the relevant input
    20311992
    20321993%% Put the first line of the selected Action fct as tooltip help
     
    20412002SeriesData=get(handles.series,'UserData');
    20422003iview_civ=[];nb_netcdf=0;
    2043 if ~isempty(SeriesData)
     2004if ~isempty(SeriesData)&&isfield(SeriesData,'FileType')
    20442005    iview_civ=find(strcmp('civx',SeriesData.FileType)|strcmp('civdata',SeriesData.FileType));
    20452006    nb_netcdf=numel(find(strcmp('netcdf',SeriesData.FileType)));
     
    21172078InputFieldsVisible='off';%visibility of the frame Fields
    21182079if isfield(ParamOut,'VelType')
    2119     if strcmp( ParamOut.VelType,'one')||strcmp( ParamOut.VelType,'two')
     2080    if strcmp( ParamOut.VelType,'on')||strcmp(ParamOut.VelType,'one')||strcmp( ParamOut.VelType,'two')
    21202081        if numel(iview_civ)>=1
    21212082            VelTypeVisible='on';
     
    21382099FieldName_1Visible='off';  %hidden by default
    21392100if isfield(ParamOut,'FieldName')
    2140     if strcmp( ParamOut.FieldName,'one')||strcmp( ParamOut.FieldName,'two')
     2101    if strcmp( ParamOut.FieldName,'on') || strcmp(ParamOut.FieldName,'one')||strcmp( ParamOut.FieldName,'two')
    21412102        if (numel(iview_civ)+nb_netcdf)>=1
    21422103            InputFieldsVisible='on';
     
    22502211function ActionInput_Callback(hObject, eventdata, handles)
    22512212%------------------------------------------------------------------------
    2252 if get(handles.ActionInput,'Value')
    2253     ActionName_Callback(hObject, eventdata, handles)
    2254 end
     2213% if get(handles.ActionInput,'Value')
     2214ActionName_Callback(hObject, eventdata, handles)
     2215% end
    22552216
    22562217%------------------------------------------------------------------------
     
    23072268                    set(handles.TimeName,'String',['var:' GetFieldData.Time.TimeName])
    23082269                    set(handles.NomType,'String','*')
    2309                     set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])
     2270                    set(handles.RootFile,'String',[get(handles.RootFile,'String') get(handles.FileIndex,'String')])% A VERIFIER !!!!!!
    23102271                    set(handles.FileIndex,'String','')
    23112272                    ParamIn.TimeVarName=GetFieldData.Time.TimeName;
     
    26962657%------------------------------------------------------------------------
    26972658function MenuImportConfig_Callback(hObject, eventdata, handles)
    2698 
     2659% SeriesData=get(handles.series,'UserData');
     2660% if isfield(SeriesData,'RefFile')
     2661%     oldfile=SeriesData.RefFile{1};
     2662% end
     2663%% use a strating file name for browserr
    26992664InputTable=get(handles.InputTable,'Data');
    2700 filexml=uigetfile_uvmat('pick a xml parameter file',InputTable{1,1},'.xml');% get the xml file containing processing parameters
     2665oldfile=InputTable{1,1};
     2666if isempty(oldfile)
     2667    % use a file name stored in prefdir
     2668    dir_perso=prefdir;
     2669    profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
     2670    if exist(profil_perso,'file')
     2671        h=load (profil_perso);
     2672        if isfield(h,'RootPath') && ischar(h.RootPath)
     2673            oldfile=h.RootPath;
     2674        end
     2675    end
     2676end
     2677filexml=uigetfile_uvmat('pick a xml parameter file',oldfile,'.xml');% get the xml file containing processing parameters
    27012678%proceed only if a file has been introduced by the browser
    27022679if ~isempty(filexml)
     
    27152692    SeriesData=get(handles.series,'UserData');
    27162693    if isfield(Param,'ActionInput')%  introduce  parameters specific to an Action fct, for instance PIV parameters
    2717 %         set(handles.ActionInput,'Visible','on')
    2718 %         set(handles.ActionInput_title,'Visible','on')
    27192694        set(handles.ActionInput,'Visible','on')
    27202695        set(handles.ActionInput,'Value',0)
     
    27372712        set(handles.DeleteObject,'Visible','off')     
    27382713    end     
    2739 %     set(handles.REFRESH,'Visible','on')
    27402714    set(handles.REFRESH,'BackgroundColor',[1 0 1]); %paint REFRESH button in magenta to indicate that it should be activated
    2741   %  REFRESH_Callback([],[],handles)% refresh data relative to the input files
    27422715end
    27432716
     
    28022775    OutputSubDir=[Param.OutputSubDir Param.OutputDirExt];% subdirectory for output files
    28032776    OutputDir=fullfile(RootPath,OutputSubDir);
    2804     uigetfile_uvmat('status_display',OutputDir)
     2777    if exist(OutputDir,'dir')
     2778        uigetfile_uvmat('status_display',OutputDir)
     2779    else
     2780        msgbox_uvmat('ERROR','output folder not created yet: calculation did not start')
     2781        set(handles.status,'BackgroundColor',[0 1 0])
     2782    end
    28052783else
    28062784    %% delete current display fig if selection is off
  • trunk/src/uigetfile_uvmat.m

    r664 r714  
    122122%------------------------------------------------------------------------
    123123function OK_Callback(option,filter_ext,hObject,event)
     124set(hObject,'backgroundColor',[1 1 0])% indicate button activation
    124125hfig=get(hObject,'parent');%handle of the fig
    125126htitlebox=findobj(hfig,'tag','titlebox');  % display the current dir name 
     
    159160    end
    160161end
    161 
     162set(hObject,'backgroundColor',[0 1 0])% indicate end button activation
    162163uiresume(get(hObject,'parent'))
    163164
  • trunk/src/uvmat.m

    r713 r714  
    474474%------------------------------------------------------------------------
    475475fileinput=get(hObject,'Label');
    476     set(handles.SubField,'Value',0)
    477     desable_subfield(handles)
    478 display_file_name( handles,fileinput)
    479 
     476set(handles.SubField,'Value',0)
     477desable_subfield(handles)
     478errormsg=display_file_name( handles,fileinput);
     479if ~isempty(errormsg)
     480    set(hObject,'Label','')
     481    MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
     482        {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
     483    str_find=strcmp(get(hObject,'Label'),MenuFile);
     484    MenuFile(str_find)=[];% suppress the input file to the list
     485    for ifile=1:numel(MenuFile)
     486        set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
     487    end
     488end
    480489
    481490% -----------------------------------------------------------------------
     
    616625%------------------------------------------------------------------------   
    617626set(handles.InputFileREFRESH,'BackgroundColor',[1 1 0])% set button color to yellow to indicate that refresh is under action
     627set(handles.uvmat,'Pointer','watch') % set the mouse pointer to 'watch'
     628drawnow
    618629% read the current input file name:
    619630[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     
    640651
    641652if isempty(errormsg)
    642 set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
     653% set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
    643654else
    644655    set(handles.InputFileREFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
    645656end
     657set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow
    646658
    647659%------------------------------------------------------------------------
    648660% --- Fills the edit boxes RootPath, RootFile,NomType...from an input file name 'fileinput'
    649 function display_file_name(handles,fileinput,index)
     661function errormsg=display_file_name(handles,fileinput,index)
    650662%------------------------------------------------------------------------
    651663%% look for the input file existence
     664errormsg='';%default
    652665if ~exist(fileinput,'file')
    653     msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
     666    errormsg=['input file ' fileinput  ' does not exist'];
     667    msgbox_uvmat('ERROR',errormsg)
    654668    return
    655669end
     
    917931NbSlice=1;%default
    918932ImaDoc_str='';
    919 set(handles.InputFileREFRESH,'BackgroundColor',[1 1 0])
    920933if ~isempty(XmlFileName)
    921934    set(handles.view_xml,'Visible','on')
     
    11481161set(handles.j2,'Visible',state_j)
    11491162set(handles.MaxIndex_j,'Visible',state_j);
    1150 %set(handles.frame_j,'Visible',state_j);
    11511163set(handles.j_text,'Visible',state_j);
    11521164if ~isempty(i2_series)||~isempty(j2_series)
     
    11611173    set(handles.TransformName,'value',2); % set transform to sub_field if the current fct doe not accept two input fields
    11621174end
    1163 TransformName_Callback([],[],handles)
     1175set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
     1176TransformName_Callback([],[],handles)% callback for the selection of transform function, then refresh the current plot
    11641177mask_test=get(handles.CheckMask,'value');
    11651178if mask_test
     
    20162029if ~isempty(errormsg)
    20172030      msgbox_uvmat('ERROR',errormsg);
     2031      set(handles.InputFileREFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
    20182032else
    20192033    set(handles.i1,'BackgroundColor',[1 1 1])
     
    20232037    set(handles.FileIndex,'BackgroundColor',[1 1 1])
    20242038    set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 
    2025     set(handles.REFRESH,'BackgroundColor',[1 0 0])
     2039    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull
    20262040end   
    20272041
     
    20402054
    20412055%% initialisation
     2056pointer=get(handles.uvmat,'Pointer');
     2057set(handles.uvmat,'Pointer','watch')
     2058drawnow
    20422059if ~exist('Field','var')
    20432060    Field={};
     
    27402757end
    27412758ResizeFcn(handles.uvmat,[],handles)
     2759set(handles.uvmat,'Pointer',pointer)
    27422760
    27432761%------------------------------------------------------------------------
     
    35793597    set(handles.CheckEditObject,'Value',0)
    35803598    set(handles.CheckZoom,'Value',0)
    3581 %     set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    3582 %     set(handles.CheckEditObject,'BackgroundColor',[0.7 0.7 0.7])
    35833599    set(gcf,'Pointer','arrow')
    35843600else
     
    36803696function TransformName_Callback(hObject, eventdata, handles)
    36813697%------------------------------------------------------------------------
     3698set(handles.TransformName,'backgroundColor',[1 1 0])% indicate activation  of the menu
     3699drawnow
    36823700UvData=get(handles.uvmat,'UserData');
    36833701menu=get(handles.TransformName,'String');%refresh
     
    37513769        [fid,errormsg] =fopen([fullfile(list_path{ichoice},transform_name) '.m']);
    37523770        InputText=textscan(fid,'%s',1,'delimiter','\n');
    3753         fclose(fid)
     3771        fclose(fid);
    37543772        set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help
    37553773    end
     
    38183836end
    38193837set(handles.uvmat,'UserData',UvData)
     3838set(handles.TransformName,'backgroundColor',[1 1 1])% indicate desactivation  of the menu
     3839drawnow
    38203840
    38213841%% inputfilerefresh the current plot
Note: See TracChangeset for help on using the changeset viewer.