Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 625)
+++ trunk/src/uvmat.m	(revision 627)
@@ -2551,5 +2551,5 @@
         UvData.ProjObject{1}.Type='plane';%main plotting plane
         UvData.ProjObject{1}.ProjMode='projection';%main plotting plane
-        UvData.ProjObject{1}.Coord=[0 0 0];
+       % UvData.ProjObject{1}.Coord=[0 0 0];
         UvData.ProjObject{1}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
         UvData.ProjObject{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
@@ -2619,5 +2619,4 @@
         end
     end
-    %write_plot_param(handles,PlotParamOut) %update the auto plot parameters
     
 %% 2D or 3D fieldname are generally projected
@@ -2945,26 +2944,27 @@
      return
 end
-test_civ2=isequal(get(handles.civ2,'BackgroundColor'),[1 1 0]);
-test_civ1=isequal(get(handles.VelType,'BackgroundColor'),[1 1 0]);
+MenuVelType=get(handles.VelType,'String');
+test_civ2=strcmp(MenuVelType{get(handles.VelType,'Value')},'civ2');
+test_civ1=strcmp(MenuVelType{get(handles.VelType,'Value')},'civ1');
 if ~test_civ2 && ~test_civ1
     msgbox_uvmat('ERROR','manual correction only possible for CIV1 or CIV2 velocity fields')
 end 
 if test_civ2
-    nbname='nb_vectors2';
-   flagname='vec2_FixFlag';
-   attrname='fix2';
+    nbname='nb_vec_2';
+   flagname='Civ2_FF';
+   CivStage=5;
 end
 if test_civ1
-    nbname='nb_vectors';
-   flagname='vec_FixFlag';
-   attrname='fix';
+    nbname='nb_vec_1';
+   flagname='Civ1_FF';
+    CivStage=2;
 end
 %write fix flags in the netcdf file
 UvData=get(handles.uvmat,'UserData');
 hhh=which('netcdf.open');% look for built-in matlab netcdf library
-if ~isequal(hhh,'')% case of new builtin Matlab netcdf library
+if ~isequal(hhh,'')% case of  builtin Matlab netcdf library
     nc=netcdf.open(FileName,'NC_WRITE'); 
     netcdf.reDef(nc);
-    netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),attrname,1);
+    netcdf.putAtt(nc,netcdf.getConstant('NC_GLOBAL'),'CivStage',CivStage);
     dimid = netcdf.inqDimID(nc,nbname); 
     try
@@ -3728,5 +3728,5 @@
 if ~strcmp(CoordUnit,CoordUnitPrev)
     set(handles.CheckFixLimits,'Value',0)
-set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
+% set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
     hother=findobj('Tag','proj_object');%find all the proj objects
     for iobj=1:length(hother)
@@ -3777,5 +3777,5 @@
 %------------------------------------------------------------------------
 set(handles.CheckFixLimits,'Value',1) %suppress auto mode
-set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
+% set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
 update_plot(handles);
 
@@ -3784,5 +3784,5 @@
 %------------------------------------------------------------------------
 set(handles.CheckFixLimits,'Value',1) %suppress auto mode
-set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
+% set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
 update_plot(handles);
 
@@ -3791,5 +3791,5 @@
 %------------------------------------------
 set(handles.CheckFixLimits,'Value',1) %suppress auto mode
-set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
+% set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
 update_plot(handles);
 
@@ -3798,5 +3798,5 @@
 %------------------------------------------------------------------------
 set(handles.CheckFixLimits,'Value',1) %suppress auto mode
-set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
+% set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
 update_plot(handles);
 
@@ -3808,5 +3808,5 @@
 %------------------------------------------
 set(handles.CheckFixScalar,'Value',1) %suppress auto mode
-set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
+% set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
 MinA=str2double(get(handles.num_MinA,'String'));
 MaxA=str2double(get(handles.num_MaxA,'String'));
@@ -3824,5 +3824,5 @@
 %------------------------------------------------------------------------
 set(handles.CheckFixScalar,'Value',1) %suppress auto mode
-set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
+% set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
 MinA=str2double(get(handles.num_MinA,'String'));
 MaxA=str2double(get(handles.num_MaxA,'String'));
@@ -3841,7 +3841,7 @@
 test=get(handles.CheckFixScalar,'Value');
 if test
-    set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
+%     set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
 else
-    set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
+%     set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
     update_plot(handles);
 end
@@ -3901,9 +3901,9 @@
 test=get(handles.CheckFixVectors,'Value');
 if test
-    set(handles.CheckFixVectors,'BackgroundColor',[1 1 0])
+%     set(handles.CheckFixVectors,'BackgroundColor',[1 1 0])
 else
     update_plot(handles);
     %set(handles.num_VecScale,'String',num2str(ScalOut.num_VecScale,3))
-    set(handles.CheckFixVectors,'BackgroundColor',[0.7 0.7 0.7])
+%     set(handles.CheckFixVectors,'BackgroundColor',[0.7 0.7 0.7])
 end
 
@@ -4853,19 +4853,19 @@
 
 
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% MenuEdit Callbacks
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%------------------------------------------------------------------------
-function MenuEditObject_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-set(handles.edit_object,'Value',1)
-edit_Callback(hObject, eventdata, handles)
-
-%------------------------------------------------------------------------
-function MenuEditVectors_Callback(hObject, eventdata, handles)
-%------------------------------------------------------------------------
-set(handles.edit_vect,'Visible','on')
-set(handles.edit_vect,'Value',1)
-edit_vect_Callback(hObject, eventdata, handles)
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% % MenuEdit Callbacks
+% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %------------------------------------------------------------------------
+% function MenuEditObject_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% set(handles.edit_object,'Value',1)
+% edit_Callback(hObject, eventdata, handles)
+% 
+% %------------------------------------------------------------------------
+% function MenuEditVectors_Callback(hObject, eventdata, handles)
+% %------------------------------------------------------------------------
+% set(handles.edit_vect,'Visible','on')
+% set(handles.edit_vect,'Value',1)
+% edit_vect_Callback(hObject, eventdata, handles)
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -5046,4 +5046,8 @@
     set(handles.ListObject,'Value',val);
     flag=1;
+    if ~isfield(UvData.Field,'A')
+            msgbox_uvmat('ERROR','an image needs to be opened to set the mask size');
+    return
+    end
     npx=size(UvData.Field.A,2);
     npy=size(UvData.Field.A,1);
@@ -5374,4 +5378,2 @@
     end
 end
-
-
