Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 575)
+++ trunk/src/uvmat.m	(revision 576)
@@ -216,13 +216,16 @@
 
 %% load the list of previously browsed files in menus Open, Open_1 and transform_fct
- dir_perso=prefdir; % path to the directory .matlab for personal data
- profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab
+ dir_perso=prefdir; % path to the directory .matlab containing the personal data of the current user
+ profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmat_perso.mat' in .matlab
  if exist(profil_perso,'file')
      h=load (profil_perso);
      if isfield(h,'MenuFile')% load the menu of previously opened files
          for ifile=1:min(length(h.MenuFile),5)
-             eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});'])
-             eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',h.MenuFile{ifile});'])
+             set(handles.(['MenuFile_' num2str(ifile)]),'Label',h.MenuFile{ifile});
+             set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',h.MenuFile{ifile});
          end
+     end
+     if isfield(h,'RootPath')
+         set(handles.RootPath,'UserData',h.RootPath); %store the previous campaign in the UserData of RootPath
      end
      if isfield(h,'transform_fct') && iscell(h.transform_fct) % load the menu of transform fct set by user
@@ -335,13 +338,6 @@
 [RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
 oldfile=fullfile(RootPath,SubDir);
-if isempty(oldfile)||isequal(oldfile,'') %loads the previously stored file name and set it as default in the file_input box
-         dir_perso=prefdir;
-         profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
-         if exist(profil_perso,'file')
-              h=load (profil_perso);
-             if isfield(h,'MenuFile_1')
-                  oldfile=h.MenuFile_1;
-             end
-         end
+if isempty(oldfile) %loads the previously stored file name and set it as default in the file_input box
+    oldfile=get(handles.RootPath,'UserData');
 end
 [FileName, PathName] = uigetfile({'*.*','All Files(*.*)'},'Pick a file',oldfile);
@@ -357,5 +353,9 @@
 function MenuBrowseCampaign_Callback(hObject, eventdata, handles)
 % -----------------------------------------------------------------------
-CampaignPath=fileparts(fileparts(get(handles.RootPath,'String')));
+RootPath=get(handles.RootPath,'String');
+if isempty(RootPath)
+    RootPath=get(handles.RootPath,'UserData');%use Rootpath recored from the personal file at uvmat opening
+end
+CampaignPath=fileparts(fileparts(RootPath));
 DirFull = uigetdir(CampaignPath,'Select a Campaign dir, then press OK');
 if ~ischar(DirFull)|| ~exist(DirFull,'dir')
@@ -447,18 +447,18 @@
 set(handles.MenuFile_4_1,'Label',MenuFile_4)
 set(handles.MenuFile_5_1,'Label',MenuFile_5)
-dir_perso=prefdir;
-profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
-if exist(profil_perso,'file')
-    save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat
-else
-    txt=ver('MATLAB');
-    Release=txt.Release;
-    relnumb=str2double(Release(3:4));
-    if relnumb >= 14
-        save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat
-    else
-        save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat
-    end
-end
+% dir_perso=prefdir;
+% profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
+% if exist(profil_perso,'file')
+%     save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat
+% else
+%     txt=ver('MATLAB');
+%     Release=txt.Release;
+%     relnumb=str2double(Release(3:4));
+%     if relnumb >= 14
+%         save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat
+%     else
+%         save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat
+%     end
+% end
 
 % --------------------------------------------------------------------
@@ -787,13 +787,13 @@
 end
 for ifile=1:min(length(MenuFile),5)
-    eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});'])
-    eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',MenuFile{ifile});'])
+    set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
+    set(handles.(['MenuFile_' num2str(ifile) '_1']),'Label',MenuFile{ifile});
 end
 dir_perso=prefdir;
 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');
 if exist(profil_perso,'file')
-    save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat
+    save (profil_perso,'MenuFile','RootPath','-append'); %store the file names for future opening of uvmat
 else
-    save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat
+    save (profil_perso,'MenuFile','RootPath','-V6'); %store the file names for future opening of uvmat
 end
 
@@ -1411,6 +1411,4 @@
         choice_value=get(handles.transform_fct,'Value');
         transform_name=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
-%         transform_list=get(handles.transform_fct,'UserData');
-%         transform=transform_list{choice_value};
         transform=get(handles.path_transform,'UserData');
         if  ~isequal(transform_name,'') && ~isequal(transform_name,'px')
@@ -1441,8 +1439,5 @@
             axes(handles.PlotAxes)
             hold on    
-            size(flagmask)
-           % MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*flagmask);
             MaskData.maskhandle=image(Mask.AX,Mask.AY,imflag,'Tag','mask','HitTest','off','AlphaData',0.6*ones(size(flagmask)));
-%             set(MaskData.maskhandle,'AlphaData',0.6*flagmask)
             set(handles.CheckMask,'UserData',MaskData)
         end
@@ -1932,8 +1927,4 @@
 
 %px to phys or other transform on field
-% menu_transform=get(handles.transform_fct,'String');
-% choice_value=get(handles.transform_fct,'Value');
-% transform_name=menu_transform{choice_value};%name of the transform fct  given by the menu 'transform_fct'
-% transform_list=get(handles.transform_fct,'UserData');
 transform=get(handles.path_transform,'UserData');
 if  ~isempty(transform)
@@ -2067,4 +2058,5 @@
         list_fields=get(handles.FieldName,'String');% list menu fields
         FieldName= list_fields{get(handles.FieldName,'Value')}; % selected field
+        % if get_field... is selected, the GUI get_field will be used to enter fields 
         if ~strcmp(FieldName,'get_field...')
             if get(handles.FixVelType,'Value')
@@ -2073,4 +2065,5 @@
             end
         end
+        % case of input vector field, get the scalar used for vector color
         if ~isempty(regexp(FieldName,'^vec('))
             list_code=get(handles.ColorCode,'String');% list menu fields
@@ -2132,5 +2125,5 @@
 end
 Field{1}.ZIndex=z_index; %used for multiplane 3D calibration
-% end
+
 
 %% choose and read a second field FileName_1 if defined
@@ -2461,4 +2454,5 @@
 end
 
+%UvData.Field=get_bounds(UvData.Field);
 
 %% get bounds and mesh (needed  to propose default options for projection objects)
@@ -3391,5 +3385,4 @@
 %-------------------------------------------------------
 % 
-% UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
 if isequal(get(handles.edit_vect,'Value'),1)
     test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
@@ -3403,9 +3396,6 @@
     set(handles.CheckZoom,'Value',0)
     set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
-%     set(handles.create,'Value',0)
-%     set(handles.create,'BackgroundColor',[0 1 0])
     set(handles.edit_object,'BackgroundColor',[0.7 0.7 0.7])
     set(gcf,'Pointer','arrow')
-%     UvData.MouseAction='edit_vect';
 else
     set(handles.record,'Visible','off')
@@ -4143,5 +4133,4 @@
 function edit_object_Callback(hObject, eventdata, handles)
 %-------------------------------------------------------------------
-UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
 hset_object=findobj(allchild(0),'Tag','set_object');
 if get(handles.edit_object,'Value')
@@ -4903,7 +4892,8 @@
 [RootPath,SubDir,RootFile,FileIndex,FileExt]=read_file_boxes(handles);
 FileName=[fullfile(RootPath,SubDir,RootFile) FileIndex FileExt];
-CoordList=get(handles.transform_fct,'String');
-val=get(handles.transform_fct,'Value');
-set_grid(FileName,CoordList{val});% call the set_object interface
+UvData=get(handles.uvmat,'UserData');
+% CoordList=get(handles.transform_fct,'String');
+% val=get(handles.transform_fct,'Value');
+set_grid(FileName,UvData.Field);% call the set_object interface
 
 
