Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 84)
+++ trunk/src/uvmat.m	(revision 85)
@@ -1622,22 +1622,28 @@
 % III - MAIN REFRESH FUNCTIONS : 'FRAME PLOT'
 %-------------------------------------------------------------------
-%-------------------------------------------------------------------
-
-%Executes on button press in runplus: make one step forward and call
-%run0. The step forward is along the fields series 1 or 2 depending on 
-%the scan_i and scan_j check box (exclusive each other)
-%-------------------------------------------------------------------
+
+%-------------------------------------------------------------------
+% --- Executes on button press in runplus: make one step forward and call
+% --- run0. The step forward is along the fields series 1 or 2 depending on 
+% --- the scan_i and scan_j check box (exclusive each other)
 function runplus_Callback(hObject, eventdata, handles)
+%-------------------------------------------------------------------
+set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow
+drawnow
 increment=str2num(get(handles.increment_scan,'String')); %get the field increment d
 runpm(hObject,eventdata,handles,increment)
-
-%-------------------------------------------------------------------
-%Executes on button press in runmin: make one step backward and call
-%run0. The step backward is along the fields series 1 or 2 depending on 
-%the scan_i and scan_j check box (exclusive each other)
-%-------------------------------------------------------------------
+set(handles.runplus,'BackgroundColor',[1 0 0])%paint the command button in yellow
+
+%-------------------------------------------------------------------
+% --- Executes on button press in runmin: make one step backward and call
+% --- run0. The step backward is along the fields series 1 or 2 depending on 
+% --- the scan_i and scan_j check box (exclusive each other)
 function runmin_Callback(hObject, eventdata, handles)
+%-------------------------------------------------------------------
+set(handles.runmin,'BackgroundColor',[1 1 0])%paint the command button in yellow
+drawnow
 increment=-str2num(get(handles.increment_scan,'String')); %get the field increment d
 runpm(hObject,eventdata,handles,increment)
+set(handles.runmin,'BackgroundColor',[1 0 0])%paint the command button in yellow
 
 %-------------------------------------------------------------------
@@ -1703,5 +1709,7 @@
 set(handles.MovieBackward,'BusyAction','Cancel')
 set(handles.MenuExportMovie,'BusyAction','Cancel')
-
+set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command buttonback to red
+set(handles.Movie,'BackgroundColor',[1 0 0])%paint the command buttonback to red
+set(handles.MovieBackward,'BackgroundColor',[1 0 0])%paint the command buttonback to red
 
 %------------------------------------------------------------------
@@ -1836,4 +1844,5 @@
     else
         msgbox_uvmat('ERROR','an image or movie must be first introduced as input')
+        set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
         return
     end
@@ -1847,4 +1856,5 @@
     if isempty(num_i2)   
         msgbox_uvmat('ERROR', 'a second image index i2 or j2 is needed to show the pair as a movie')
+        set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
         return
     else
@@ -1858,8 +1868,7 @@
 if ~exist(imaname_1,'file')
       msgbox_uvmat('ERROR',['second input open (-)  ' imaname_1 ' not found']);
+      set(handles.movie_pair,'BackgroundColor',[1 0 0])%paint the command button in red
       return
 end
-% set(handles.i2,'String',''); % indicates that the second index i2 is not used
-% set(handles.j2,'String',''); % indicates that the second index i2 is not used
 
 %read the second image
@@ -1949,4 +1958,6 @@
 function run0_Callback(hObject, eventdata, handles)
 %------------------------------------------------------------------------
+set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
+drawnow
 filename=read_file_boxes(handles);
 
@@ -1963,5 +1974,5 @@
       msgbox_uvmat('ERROR',errormsg);
 end    
-
+set(handles.run0,'BackgroundColor',[1 0 0])
 %------------------------------------------------------------------------
 % --- read the input files and refresh all the plots, including projection.
@@ -1978,6 +1989,5 @@
 
 %initialisation
-set(handles.run0,'BackgroundColor',[1 1 0])%paint the command button in yellow
-drawnow
+
 errormsg=[]; % default error message
 abstime=[];
@@ -2815,5 +2825,5 @@
     end
 end
-set(handles.run0,'BackgroundColor',[1 0 0])
+
 
 
@@ -3051,16 +3061,18 @@
 FileName=[FileName FileIndices FileExt];
 
-%----------------------------------------------
-%read the data displayed for the second input rootfile windows
-%-------------------------------------------------
+%------------------------------------------------------------------------
+% ---- read the data displayed for the second input rootfile windows
 function [FileName_1,RootPath_1,FileBase_1,FileIndices_1,FileExt_1,SubDir_1]=read_file_boxes_1(handles)
-RootPath_1=get(handles.RootPath_1,'String'); % read the data from the file1_input window
-if isequal(RootPath_1,'"'),RootPath_1=get(handles.RootPath,'String'); end;
+%------------------------------------------------------------------------
+RootPath_1=get(handles.RootPath_1,'String') % read the data from the file1_input window
+if isequal(get(handles.RootPath_1,'Visible'),'off') || isequal(RootPath_1,'"')
+    RootPath_1=get(handles.RootPath,'String');
+end;
 FileName_1=RootPath_1; %default
 SubDir_1=get(handles.SubDir_1,'String');
-if isequal(SubDir_1,'"')
+if isequal(get(handles.SubDir_1,'Visible'),'off')|| isequal(SubDir_1,'"')
     SubDir_1=get(handles.SubDir,'String');
 end
-if ~isempty(SubDir_1) && ~isequal(SubDir_1,'')
+if numel(SubDir_1)>=1
     if (isequal(SubDir_1(1),'/')|| isequal(SubDir_1(1),'\'))
         SubDir_1(1)=[]; %suppress possible / or \ separator
@@ -3069,6 +3081,8 @@
 end
 RootFile_1=get(handles.RootFile_1,'String');
-if isequal(RootFile_1,'"'),RootFile_1=get(handles.RootFile,'String'); end;
-if ~isempty(RootFile_1) && ~isequal(RootFile_1,'')
+if isequal(get(handles.RootFile_1,'Visible'),'off') || isequal(RootFile_1,'"')
+    RootFile_1=get(handles.RootFile,'String'); 
+end
+if numel(RootFile_1)>=1
     if ~(isequal(RootFile_1(1),'/')|isequal(RootFile_1(1),'\'))
         RootFile_1(1)=[];%suppress possible / or \ separator
@@ -3077,14 +3091,17 @@
 end
 FileBase_1=fullfile(RootPath_1,RootFile_1);
-FileIndices_1=get(handles.FileIndex_1,'String');
+if isequal(get(handles.FileIndex_1,'Visible'),'off') 
+    FileIndices_1=get(handles.FileIndex,'String');
+else
+    FileIndices_1=get(handles.FileIndex_1,'String');
+end
 FileExt_1=get(handles.FileExt_1,'String');
 if isequal(FileExt_1,'"'),FileExt_1=get(handles.FileExt,'String'); end;
 FileName_1=[FileName_1 FileIndices_1 FileExt_1];
 
-%---------------------------------------------------
+%------------------------------------------------------------------------
 % --- Executes on menu selection Fields
 function Fields_Callback(hObject, eventdata, handles)
-%-------------------------------------------------
-
+%------------------------------------------------------------------------
 list_fields=get(handles.Fields,'String');% list menu fields
 index_fields=get(handles.Fields,'Value');% selected string index
@@ -3112,11 +3129,11 @@
 if isequal(field,'image') 
     % transform netc type to the corresponding image type
-    if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2')
-        UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory
-        if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/'))
-            UvData.SubDir(1)=[];
-        end
-        set(handles.SubDir,'String','')
-        set(handles.FileExt,'String','.png');
+%     if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')|| isequal(NomType,'#_ab')|| isequal(NomType,'_i1-i2')
+%         UvData.SubDir=get(handles.SubDir,'String'); %preserve the subdir in memory
+%         if ~isempty(UvData.SubDir) && (isequal(UvData.SubDir(1),'/')||isequal(UvData.SubDir(1),'/'))
+%             UvData.SubDir(1)=[];
+%         end
+%         set(handles.SubDir,'String','')
+%         set(handles.FileExt,'String','.png');
         if isequal(NomType,'_i1-i2_j')||isequal(NomType,'_i_j1-j2')
             NomTypeNew='_i_j';
@@ -3125,13 +3142,37 @@
         elseif isequal(NomType,'_i1-i2')
             NomTypeNew='_i';
-            % TODO: look for other types
         end  
-    end
-    veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
-    set_veltype_display(veltype_handles,0) % unvisible civ buttons
+        imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'')
+        if ~exist(imagename,'file')
+                [FileName,PathName] = uigetfile( ...
+           {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)';
+            '*.jpg',' jpeg image files'; ...
+            '*.png','.png image files'; ...
+            '*.tif','.tif image files'; ...
+            '*.avi;*.AVI','.avi movie files'; ...
+            '*.vol','.volume images (png)'; ...
+            '*.*',  'All Files (*.*)'}, ...
+            'Pick an image',imagename)           
+            % display the selected field and related information
+           imagename=[PathName FileName];
+        end
+        display_file_name(hObject, eventdata, handles,imagename)%display the image
+        return
+%     end
+%     veltype_handles=[handles.civ1 handles.interp1 handles.filter1 handles.civ2 handles.interp2 handles.filter2];
+%     set_veltype_display(veltype_handles,0) % unvisible civ buttons
 else
     ext=get(handles.FileExt,'String');
     if ~isequal(ext,'.nc') %find the new NomType if the previous display was not already a netcdf file
-         MenuBrowse_Callback(hObject, eventdata, handles)
+                [FileName,PathName] = uigetfile( ...
+           {'*.nc', ' (*.nc)';
+            '*.nc',' netcdf files'; ...
+            '*.*',  'All Files (*.*)'}, ...
+            'Pick a netcdf file',FileBase)           
+            % display the selected field and related information
+           filename=[PathName FileName];
+        display_file_name(hObject, eventdata, handles,filename)
+        return
+       %  MenuBrowse_Callback(hObject, eventdata, handles)
     end
     if isequal(field,'vort') || isequal(field,'div') || isequal(field,'strain')
@@ -3163,5 +3204,4 @@
     set(handles.npx,'Visible','on')
     set(handles.npy,'Visible','on')
-%     set(handles.fix_pair,'Value',0)
 else
     set(handles.npx_title,'Visible','off')% visible npx,pxcm... buttons
@@ -3169,5 +3209,4 @@
     set(handles.npx,'Visible','off')
     set(handles.npy,'Visible','off')
-%     set(handles.fix_pair,'Value',1)
 end
 setfield(handles);% update the field structure ('civ1'....)
@@ -3195,5 +3234,6 @@
 
 %read the rootfile input display
-FileExt_prev=get(handles.FileExt_1,'String');
+[FileName,RootPath,FileBase,FileIndices,FileExt_prev]=read_file_boxes_1(handles);
+[P,F,str1,str2,str_a,str_b,E,NomType]=name2display(['xxx' get(handles.FileIndex,'String') FileExt_prev]);
 if isempty(FileExt_prev)|isequal(FileExt_prev,'')
     FileExt_1=get(handles.FileExt,'String');
@@ -3239,8 +3279,8 @@
 if isequal(field_1,'image') 
     % transform netc type to the corresponding image type
-    set(handles.FileExt_1,'String','.png');
+%     set(handles.FileExt_1,'String','.png');
     if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')| isequal(NomType_1,'#_ab')| isequal(NomType_1,'_i1-i2')
         UvData.SubDir_1=get(handles.SubDir_1,'String'); %preserve the subdir in memory
-        set(handles.SubDir_1,'String','')
+%         set(handles.SubDir_1,'String','')
 %         set(handles.FileExt_1,'String','.png');        
         if isequal(NomType_1,'_i1-i2_j')|isequal(NomType_1,'_i_j1-j2')
@@ -3252,6 +3292,22 @@
         end  
     end
-    veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
-    set_veltype_display(veltype_handles,0) % unvisible civ buttons
+    imagename=name_generator(FileBase,str2double(str1),str2double(str_a),'.png',NomTypeNew,1,str2double(str2),str2double(str_b),'');
+    if ~exist(imagename,'file')
+        [FileName,PathName] = uigetfile( ...
+            {'*.png;*.jpg;*.tif;*.avi;*.AVI;*.vol', ' (*.png, .tif, *.avi,*.vol)';
+            '*.jpg',' jpeg image files'; ...
+            '*.png','.png image files'; ...
+            '*.tif','.tif image files'; ...
+            '*.avi;*.AVI','.avi movie files'; ...
+            '*.vol','.volume images (png)'; ...
+            '*.*',  'All Files (*.*)'}, ...
+            'Pick an image',imagename)
+        % display the selected field and related information
+        imagename=[PathName FileName];
+    end
+    display_file_name_1(hObject, eventdata, handles,imagename)%display the image
+    return
+%     veltype_handles=[handles.civ1_1 handles.interp1_1 handles.filter1_1 handles.civ2_1 handles.interp2_1 handles.filter2_1];
+%     set_veltype_display(veltype_handles,0) % unvisible civ buttons
 else
     set(handles.SubDir_1,'Visible','on')
@@ -4717,7 +4773,4 @@
 edit_vect_Callback(hObject, eventdata, handles)
 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
-set(handles.edit_vect,'Value',0)  
-edit_vect_Callback(hObject, eventdata, handles)
-set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
 set(handles.list_object_1,'Value',1)      
 
