Index: /trunk/src/check_files.m
===================================================================
--- /trunk/src/check_files.m	(revision 624)
+++ /trunk/src/check_files.m	(revision 625)
@@ -43,5 +43,4 @@
     'civ_3D.fig';...
     'civ_matlab';...% civ programs, Matlab version (called by civ.m, option Civprogram/Matlab in the upper menu bar)
-    'close_fig';...% function  activated when a figure is closed
     'copyfields';...% copy fields between two matlab structures
     'create_grid';...% called by the GUI geometry_calib to create a physical grid
Index: /trunk/src/keyboard_callback.m
===================================================================
--- /trunk/src/keyboard_callback.m	(revision 624)
+++ /trunk/src/keyboard_callback.m	(revision 625)
@@ -3,11 +3,12 @@
 function keyboard_callback(hObject,eventdata,handleshaxes)
 cur_axes=get(hObject,'CurrentAxes');%current plotting axes of the figure with handle hObject
-if ~isempty(eventdata) && isnumeric(eventdata)
-    xx=eventdata; % keyboard_callback called by mouse_down
-else
 xx=double(get(hObject,'CurrentCharacter')); %get the keyboard character
-end
 switch xx
     case {29,28,30,31}    %arrows for displacement
+        AxeData=get(cur_axes,'UserData');
+        if isfield(AxeData,'ZoomAxes')&&ishandle(AxeData.ZoomAxes)
+           cur_axes=AxeData.ZoomAxes;% move the field of the zoom sub-plot instead of the main axes  if it exsits
+           axes(cur_axes)
+        end
         if ~isempty(cur_axes)
             xlimit=get(cur_axes,'XLim');
@@ -33,6 +34,4 @@
                 rect([3 4])=[xlimit(2)-xlimit(1) ylimit(2)-ylimit(1)];
                 set(hparentrect,'Position',rect)
-                hfig=get(hparentrect,'parent');
-                hfig=get(hfig,'parent');
             elseif isfield(AxeData,'LimEditBox')&& isequal(AxeData.LimEditBox,1)% update display of the GUI containing the axis (uvmat or view_field)
                 hh=guidata(hfig);
Index: /trunk/src/mouse_down.m
===================================================================
--- /trunk/src/mouse_down.m	(revision 624)
+++ /trunk/src/mouse_down.m	(revision 625)
@@ -28,21 +28,21 @@
 FigData=get(hObject,'UserData'); %default data stored on the current object
 if 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
-    hcurrentfig=get(get(FigData,'parent'),'parent');%handle of the current GUI: zoom plot
+    hCurrentGUI=get(get(FigData,'parent'),'parent');%handle of the current GUI: zoom plot
 else
-    hcurrentfig=hObject; % handle of the current GUI: usual plot
-end
-hhcurrentfig=guidata(hcurrentfig);% tags of the children of the current GUI
+    hCurrentGUI=hObject; % handle of the current GUI: usual plot
+end
+hhCurrentGUI=guidata(hCurrentGUI);% tags of the children of the current GUI
 CheckZoom=0;
-if isfield(hhcurrentfig,'CheckZoom') && get(hhcurrentfig.CheckZoom,'Value');%test for zoom action, first priority
+if isfield(hhCurrentGUI,'CheckZoom') && get(hhCurrentGUI.CheckZoom,'Value');%test for zoom action, first priority
     CheckZoom=1;
 end
 test_piv=isfield(FigData,'CivHandle');
-set(hcurrentfig,'Units','pixels')
-GUI_pos=get(hcurrentfig,'Position');%position of the GUI series on the screen (in pixels), used to position message boxes
-set(hcurrentfig,'Units','normalized')% back to current unit for fig position
+set(hCurrentGUI,'Units','pixels')
+GUI_pos=get(hCurrentGUI,'Position');%position of the GUI series on the screen (in pixels), used to position message boxes
+set(hCurrentGUI,'Units','normalized')% back to current unit for fig position
 
 %% determine the currently selected items
 hcurrentobject=gco;% current object handle (selected by the mouse)
-fig_tag=get(hcurrentfig,'Tag');
+CurrentGUI_tag=get(hCurrentGUI,'Tag');
 obj_tag=get(gco,'Tag');%tag of the currently selected object
 xy=[];%default
@@ -63,5 +63,5 @@
     if ~isempty(hset_object)
         hPLOT=findobj(hset_object,'tag','PLOT');
-        test_create=strcmp(get(hPLOT,'enable'),'on') &&~test_edit;% create new object if set_object is in mode enable and uvmat not in mode 'edit_object'
+        test_create=strcmp(get(hPLOT,'enable'),'on') &&~get(hhuvmat.edit_object,'Value');% create new object if set_object is in mode enable and uvmat not in mode 'edit_object'
     end
     test_edit_vect=get(hhuvmat.edit_vect,'Value') && ~test_create && ~(isequal(obj_tag,'proj_object')||isequal(obj_tag,'DeformPoint')) ;%test for vector editing,  priority 4
@@ -81,6 +81,7 @@
 %% loop on all the objects in the current figure (selected by the last mouse click)
 hchildren=get(hObject,'Children');%handles of all objects in the current figure
-check_visible=strcmp(get(hchildren,'Visible'),'on');% if visible='on', =0 otherwise
-hchildren=hchildren(check_visible); %kkep only the visible children
+check_visible=strcmp(get(hchildren,'Visible'),'on')& ~strcmp(get(hchildren,'Type'),'uimenu');% if visible='on', =0 otherwise
+hchildren=hchildren(check_visible); %keep only the visible children
+set(hchildren,'Units','normalized');
 PosChildren=get(hchildren,'Position');% set of object positions
 if iscell(PosChildren)% only one child
@@ -96,21 +97,5 @@
 ind_object=find(check_pos(:,1) & check_pos(:,2),1);% select the index of the (first) object under the mouse
 hchild=hchildren(ind_object);% corresponding object handle
-if isempty(hchild)
-%     if test_edit||test_create
-%         hPlotAxes=findobj(hcurrentfig,'Tag','PlotAxes');
-%         if ~isempty( hPlotAxes)
-%             PosPlotAxes=get(hPlotAxes,'Position');
-%             PosDiff(1)=xy_fig(1)-PosPlotAxes(1)-PosPlotAxes(3);% distance to the right axes edge
-%             PosDiff(2)=PosPlotAxes(1)-xy_fig(1);% distance to the left axes edge
-%             PosDiff(3)=xy_fig(2)-PosPlotAxes(1)-PosPlotAxes(3);% distance to the top axes edge
-%             PosDiff(4)=PosPlotAxes(2)-xy_fig(2);% distance to the low axes edge
-%             [tild,ind_sel]=max(PosDiff);
-%             list_arrow=[29 28 30 31];
-%             arrow_option=list_arrow(ind_sel);
-%             keyboard_callback(hcurrentfig,arrow_option)
-%             return
-%         end
-%     end
-else
+if ~isempty(hchild)
     htype=get(hchild,'Type');%type of object child of the current figure
     switch htype
@@ -129,5 +114,5 @@
             if test_edit_vect 
                 ivec=[];
-                FigData=get(hcurrentfig,'UserData');
+                FigData=get(hCurrentGUI,'UserData');
                 tagaxes=get(hchild,'tag');
                 if isfield(FigData,tagaxes)
@@ -200,5 +185,5 @@
 
 %% creation of a zoom subfig
-if isfield(hhcurrentfig,'CheckZoomFig') && get(hhcurrentfig.CheckZoomFig,'Value')
+if isfield(hhCurrentGUI,'CheckZoomFig') && get(hhCurrentGUI.CheckZoomFig,'Value')
     AxeData.Drawing='zoom'; %initiate drawing mode
     AxeData.CurrentObject=[];%unselect objects
@@ -212,5 +197,5 @@
 
 %% ruler has second priority 
-if test_ruler
+if test_ruler && ~isempty(xy)
     AxeData.RulerCoord(1,1:2)=xy(1,1:2);
     AxeData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler');
@@ -287,5 +272,5 @@
             IndexObj=ObjectData.IndexObj;
                     %indicate on the list of the GUI uvmat which object has been selected
-            if strcmp(get(hcurrentfig,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field
+            if strcmp(get(hCurrentGUI,'tag'),'uvmat') %if the uvmat graph has been selected, object projection is on the other frame view_field
 %                 IndexObj=get(hhuvmat.ListObject,'Value');
 %                 if IndexObj>IndexObj_old(1)
@@ -331,66 +316,91 @@
 
 %%  create  projection  object
-if  test_create && ~isempty(xy) 
+if  test_create && ~isempty(xy) && ~strcmp(get(hCurrentGUI,'SelectionType'),'alt')
     % activate this option if the GUI set_object is opened
-    if ~isempty(hset_object) && ~strcmp(get(hcurrentfig,'SelectionType'),'alt')
-        sethandles=guidata(hset_object);% handles of the elements in the GUI set_object
-        ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object
-        IndexObj=length(UvData.ProjObject);
-        %initiate a new object (no data .Coord yet recorded)
-        if ~isfield(UvData.ProjObject{IndexObj},'Coord');
-            ObjectData.Coord=[];
-            ObjectNameNew=ObjectData.Name;
-            if isempty(ObjectNameNew)
-                ObjectNameNew=ObjectData.Type;
-            end
-            % add an index to the object name if the proposed name already exists
-            vers=0;% index of the name
-            ListObject=get(hhuvmat.ListObject,'String');
-            detectname=1;
-            while ~isempty(detectname)
-                detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list
-                if detectname% if the object name already exists
-                    indstr=regexp(ObjectNameNew,'\D');
-                    if indstr(end)<length(ObjectNameNew) %object name ends by a number
-                        vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
-                        ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
-                    else
-                        vers=vers+1;
-                        ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)];
-                    end
+    sethandles=guidata(hset_object);% handles of the elements in the GUI set_object
+    ObjectData=read_GUI(hset_object); %read object parameters in the GUI set_object
+    IndexObj=length(UvData.ProjObject);
+    % if the currently selected object is already finished, a new object is initiated
+    if ~isfield(UvData.ProjObject{IndexObj},'CreateMode')
+        IndexObj=IndexObj+1;%start new object
+        ObjectData.Coord=[];
+        ObjectNameNew=ObjectData.Name;
+        if isempty(ObjectNameNew)
+            ObjectNameNew=ObjectData.Type;
+        end
+        % add an index to the object name if the proposed name already exists
+        vers=0;% index of the name
+        ListObject=get(hhuvmat.ListObject,'String');
+        detectname=1;
+        while ~isempty(detectname)
+            detectname=find(strcmp(ObjectNameNew,ListObject),1);%test the existence of the proposed name in the list
+            if detectname% if the object name already exists
+                indstr=regexp(ObjectNameNew,'\D');
+                if indstr(end)<length(ObjectNameNew) %object name ends by a number
+                    vers=str2double(ObjectNameNew(indstr(end)+1:end))+1;
+                    ObjectNameNew=[ObjectNameNew(1:indstr(end)) num2str(vers)];
+                else
+                    vers=vers+1;
+                    ObjectNameNew=[ObjectNameNew(1:indstr(end)) '_' num2str(vers)];
                 end
             end
-            ObjectName=ObjectNameNew;
-            set(sethandles.Name,'String',ObjectName)% display the default name in set_object
-            if isempty(ListObject)
-                ListObject={ObjectName};
-            else
-                ListObject{end}=ObjectName;
-            end
-            set(hhuvmat.ListObject,'String',ListObject);%complement the object list
-            set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list
+        end
+        ObjectName=ObjectNameNew;
+        set(sethandles.Name,'String',ObjectName)% display the default name in set_object
+        ListObject=[ListObject;{ObjectName}];
+        set(hhuvmat.ListObject,'String',ListObject);%complement the object list
+        set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list
+        if strcmp(CurrentGUI_tag,'uvmat')
             set(hhuvmat.ListObject,'Value',IndexObj)
-            set(hhuvmat.ViewObject,'Value',1)
-        end
-        ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
-                                                         %TODO replace 0 by z coord for 3D       
-        hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(fig_tag);
-        if isempty(hobject)
-            hobject=haxes;
-        end
+        else
+            set(hhuvmat.ListObject_1,'Value',IndexObj)
+        end
+        UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object
+        UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
+        set(hhuvmat.ViewObject,'Value',1)
+    end
+    ObjectData.Coord=[ObjectData.Coord ;xy(1,1:2)];% append the coordinates marked by the mouse to the object
+    %TODO replace 0 by z coord for 3D
+    hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(CurrentGUI_tag);
+    if isempty(hobject)
+        hobject=haxes;
+    end
+    if strcmp(CurrentGUI_tag,'uvmat')
         ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')};
-        AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject
-        UvData.ProjObject{IndexObj}=ObjectData;
-        UvData.ProjObject{IndexObj}.DisplayHandle.(fig_tag)=AxeData.CurrentObject;% attribute the current plot object handle to the Object
-        set(huvmat,'UserData',UvData)
-        PlotData=get(AxeData.CurrentObject,'UserData');
-        PlotData.IndexObj=IndexObj;
-        set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
-        AxeData.Drawing='create';% flag for mouse motion
-        %show object coordinates in the GUI set_object
-        h_set_object=findobj(allchild(0),'Tag','set_object');
-        hh_set_object=guidata(h_set_object);
-        set(hh_set_object.Coord,'Data',ObjectData.Coord);
-    end
+    else
+        ProjObject=UvData.ProjObject{get(hhuvmat.ListObject,'Value')};
+    end
+    AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject
+    UvData.ProjObject{IndexObj}=ObjectData;
+    UvData.ProjObject{IndexObj}.DisplayHandle.(CurrentGUI_tag)=AxeData.CurrentObject;% attribute the current plot object handle to the Object
+    UvData.ProjObject{IndexObj}.CreateMode='on';% mark the object as in the course of creation
+    set(huvmat,'UserData',UvData)
+    PlotData=get(AxeData.CurrentObject,'UserData');
+    PlotData.IndexObj=IndexObj;
+    set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
+    AxeData.Drawing='create';% flag for mouse motion
+    
+    
+    %initiate a new object (no data .Coord yet recorded)
+    %if ~isfield(UvData.ProjObject{IndexObj},'Coord');
+    %     ObjectData.Coord=[];
+    
+    %             if isempty(ListObject)
+    %                 ListObject={ObjectName};
+    %             else
+    %                 ListObject{end}=ObjectName;
+    %             end
+    %                 UvData.ProjObject{IndexObj}=[]; %create a new empty object
+    %     UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object
+    %     UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
+    
+    %         PlotData=get(AxeData.CurrentObject,'UserData');
+    %         PlotData.IndexObj=IndexObj;
+    %         set(AxeData.CurrentObject,'UserData',PlotData); %record the object index in the graph (memory used for mouse motion)
+    %         AxeData.Drawing='create';% flag for mouse motion
+    %show object coordinates in the GUI set_object
+    h_set_object=findobj(allchild(0),'Tag','set_object');
+    hh_set_object=guidata(h_set_object);
+    set(hh_set_object.Coord,'Data',ObjectData.Coord);
 end
 
@@ -475,8 +485,8 @@
         Field.FF(ivec)=0;
     end
-    PlotParam=read_GUI(hcurrentfig);
+    PlotParam=read_GUI(hCurrentGUI);
     plot_field(Field,haxes,PlotParam);
     eval(['FigData.' tagaxes '=Field;'])%record the modified field in FigData
-    set(hcurrentfig,'UserData',FigData);
+    set(hCurrentGUI,'UserData',FigData);
 end  
 set(haxes,'UserData',AxeData);
Index: /trunk/src/mouse_motion.m
===================================================================
--- /trunk/src/mouse_motion.m	(revision 624)
+++ /trunk/src/mouse_motion.m	(revision 625)
@@ -30,13 +30,18 @@
 FigData=get(hObject,'UserData');
 if 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
-    CurrentFig=get(get(FigData,'parent'),'parent');
+    hCurrentFig=get(get(FigData,'parent'),'parent');
 else
-    CurrentFig=hObject;%usual plot
-end
-hhCurrentFig=guidata(CurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
+    hCurrentFig=hObject;%usual plot
+end
+hhCurrentFig=guidata(hCurrentFig);%handles of the elements in the GUI containing the current figure (uvmat or view_field)
 CheckZoom=get(hhCurrentFig.CheckZoom,'Value');% check for zoom on mode
 CheckZoomFig=get(hhCurrentFig.CheckZoomFig,'Value');% check for zoom sub fig creation mode
+hPlotAxes=hhCurrentFig.PlotAxes';% handles of the main plot axes
+AxeData=get(hPlotAxes,'UserData');% data attached to the axis
+test_draw=0;%test for mouse drawing of object, =0 by default
+if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)
+    test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active
+end
 test_zoom_draw=0;
-test_draw=0;%test for mouse drawing of object, =0 by default
 test_object=0; %test for object editing or creation 
 test_edit_object=0;% edit test for mouse shap: an arrow
@@ -64,5 +69,5 @@
 text_displ_4='';
 
-AxeData=[];%default
+% AxeData=[];%default
 xy=[];%default
 xy_fig=get(hObject,'CurrentPoint');% current point of the current figure (gcbo)
@@ -92,15 +97,10 @@
     CurrentAxes=hchild;
     xy=get(CurrentAxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
-    AxeData=get(CurrentAxes,'UserData');% data attached to the axis
-    if isfield(AxeData,'Drawing')&& ~isempty(AxeData.Drawing)
-        test_draw=~isequal(AxeData.Drawing,'off');%=1 if mouse drawing of object is active
-    end
     test_zoom_draw=test_draw && isequal(AxeData.Drawing,'zoom')&& isfield(AxeData,'CurrentOrigin') && isequal(get(gcf,'SelectionType'),'normal');
     test_object=test_draw && isfield(AxeData,'CurrentObject') && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject);
-    %if ~test_edit_object && ~test_zoom_draw && ~test_ruler
     if ~test_edit_object  && ~test_ruler && ~CheckZoom
         pointershape='crosshair';%set pointer with cross shape (default when mouse is over an axis)
     end
-    FigData=get(CurrentFig,'UserData');
+    FigData=get(hCurrentFig,'UserData');
     tagaxes=get(CurrentAxes,'tag');
     if isfield(FigData,tagaxes)
@@ -130,6 +130,6 @@
                                 pointershape='arrow'; %mouse indicates  the detection of a vector
                                 if isempty(hhh)
-                                    set(0,'CurrentFigure',CurrentFig)
-                                    set(CurrentFig,'CurrentAxes',CurrentAxes)
+                                    set(0,'CurrentFigure',hCurrentFig)
+                                    set(hCurrentFig,'CurrentAxes',CurrentAxes)
                                     rectangle('Curvature',[1 1],...
                                         'Position',[X(ivec)-Field.CoordMesh/2 Y(ivec)-Field.CoordMesh/2 Field.CoordMesh Field.CoordMesh],'EdgeColor','m',...
@@ -232,6 +232,6 @@
                 hhhh=findobj(CurrentAxes,'Tag','PIV_search_marker');
                 if isempty(hhh)
-                    set(0,'CurrentFigure',CurrentFig)
-                    set(CurrentFig,'CurrentAxes',CurrentAxes)
+                    set(0,'CurrentFigure',hCurrentFig)
+                    set(hCurrentFig,'CurrentAxes',CurrentAxes)
                     rectangle('Curvature',[0 0],...
                         'Position',[xround-ibx2 yround-iby2 2*ibx2 2*iby2],'EdgeColor','m',...
@@ -420,3 +420,3 @@
 
 %% update the mouse pointer
-set(CurrentFig,'Pointer',pointershape);
+set(hCurrentFig,'Pointer',pointershape);
Index: /trunk/src/mouse_up.m
===================================================================
--- /trunk/src/mouse_up.m	(revision 624)
+++ /trunk/src/mouse_up.m	(revision 625)
@@ -25,40 +25,46 @@
 
 test_ruler=0;%default
-hcurrentfig=hObject;
-fig_tag=get(hcurrentfig,'tag');
-currentaxes=gca; %store the current axes handle
-AxeData=get(currentaxes,'UserData');
+AxeData=get(gca,'UserData');
+if isfield(AxeData,'ParentAxes')% case of a zoom plot as current axis
+    hcurrentaxes=AxeData.ParentAxes;
+    AxeData=get(hcurrentaxes,'UserData');
+    hcurrentfig=get(hcurrentaxes,'parent');%handles of the GUI parent of the zoom plot
+    testsubplot=1;% mouse selection is on a zoom subplot
+else
+    hcurrentfig=hObject;
+    hcurrentaxes=gca; %store the current axes handle
+    testsubplot=0;
+end
 CurrentOrigin=[];
 if isfield(AxeData,'CurrentOrigin')
     CurrentOrigin=AxeData.CurrentOrigin;
 end
-if isfield(AxeData,'ParentRect')% case of a zoom plot as current axis
-    parentaxes=get(AxeData.ParentRect,'parent');
-    AxeData=get(parentaxes,'UserData');
-    controlGUI=get(parentaxes,'parent');%handles of the GUI parent of the zoom plot
-    hhcurrentfig=guidata(controlGUI);
-    testsubplot=1;
-else
-    hhcurrentfig=guidata(hcurrentfig);%the current figure is a GUI (uvmat or view_field)
-    testsubplot=0;
-end
-test_zoom=get(hhcurrentfig.CheckZoom,'Value');
-
+FigTag=get(hcurrentfig,'tag');
+hhcurrentfig=guidata(hcurrentfig);%the current figure is a GUI (uvmat or view_field)
+CheckZoom=get(hhcurrentfig.CheckZoom,'Value');
+CheckZoomFig=get(hhcurrentfig.CheckZoomFig,'Value');%exclusive to CheckZoom
 huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle
 if ~isempty(huvmat)
     hhuvmat=guidata(huvmat);
     UvData=get(huvmat,'UserData');
-   test_ruler=~test_zoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority
-end
-test_drawing=0;%default
-
-%% finalize the fabrication or the translation/deformation of an object and plot the corresponding projected field
+   test_ruler=~CheckZoom && isequal(get(hhuvmat.MenuRuler,'checked'),'on');%test for ruler  action, second priority
+end
+test_drawing=0;%default, =1 to allow drawing by further mouse action
+xy=get(gca,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
+
+
+%% proceed with the creation or editing (translation/deformation) of an object
 if ~isempty(huvmat) && isfield(AxeData,'Drawing') && ~isequal(AxeData.Drawing,'off') && isfield(AxeData,'CurrentObject')...
         && ~isempty(AxeData.CurrentObject) && ishandle(AxeData.CurrentObject)
-    xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
+    %     xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
     PlotData=get(AxeData.CurrentObject,'UserData');%get data attached to the current projection object
     IndexObj=PlotData.IndexObj;
     ObjectData=UvData.ProjObject{IndexObj};
     check_multiple=0;
+    
+    h_set_object=findobj(allchild(0),'Tag','set_object');
+    hh_set_object=guidata(h_set_object);
+    ObjectData.Coord=get(hh_set_object.Coord,'Data');
+    
     % ending translation
     if isequal(AxeData.Drawing,'translate')
@@ -69,5 +75,5 @@
         ObjectData.Coord(:,2)=ObjectData.Coord(:,2)+DY;
         
-    %ending object deformation
+        %ending object deformation
     elseif isequal(AxeData.Drawing,'deform')
         ind_move=AxeData.CurrentIndex;
@@ -75,5 +81,5 @@
         ObjectData.Coord(ind_move,2)=xy(1,2);
         
-    %creating object
+        %creating object
     else
         switch ObjectData.Type
@@ -85,18 +91,18 @@
                 end
             case {'rectangle','ellipse','volume'}
-%                  if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click
-%                     check_multiple=1;
-%                  else
-                ObjectData.Coord=(CurrentOrigin+xy(1,1:2))/2;% keep only the first point coordinate     
+                %                  if size(ObjectData.Coord,1)==1 % this is the mouse up for the first point, continue until next click
+                %                     check_multiple=1;
+                %                  else
+                ObjectData.Coord=(CurrentOrigin+xy(1,1:2))/2;% keep only the first point coordinate
                 ObjectData.RangeX=abs(ObjectData.Coord(1,1)-xy(1,1));%rectangle width
-                ObjectData.RangeY=abs(ObjectData.Coord(1,2)-xy(1,2));%rectangle height    
+                ObjectData.RangeY=abs(ObjectData.Coord(1,2)-xy(1,2));%rectangle height
                 if isequal(ObjectData.RangeX,0)||isequal(ObjectData.RangeY,0)
                     check_multiple=1;% pass to next mous up if width of height=0
                 end
-%                 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
-%                 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
-%                 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
-%                 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
-%                  end
+                %                 ObjectData.Coord(1,1)=(xy(1,1)+XYData(1))/2;%origin rectangle, x coordinate
+                %                 ObjectData.Coord(1,2)=(xy(1,2)+XYData(2))/2;
+                %                 ObjectData.RangeX=abs(xy(1,1)-XYData(1))/2;%rectangle width
+                %                 ObjectData.RangeY=abs(xy(1,2)-XYData(2))/2;%rectangle height
+                %                  end
             case 'plane' %case of 'plane'
                 DX=(xy(1,1)-ObjectData.Coord(1,1));
@@ -110,24 +116,24 @@
                 end
             otherwise
-                check_multiple=1; 
+                check_multiple=1;
         end
     end
     
     %show object coordinates in the GUI set_object
-    h_set_object=findobj(allchild(0),'Tag','set_object');
-    hh_set_object=guidata(h_set_object);
-    set(hh_set_object.Coord,'Data',ObjectData.Coord);
+    %     h_set_object=findobj(allchild(0),'Tag','set_object');
+    %     hh_set_object=guidata(h_set_object);
+    %     set(hh_set_object.Coord,'Data',ObjectData.Coord);
     if strcmp(ObjectData.Type,'rectangle')||strcmp(ObjectData.Type,'ellipse')
         set(hh_set_object.num_RangeX_2,'String',num2str(ObjectData.RangeX,4));
         set(hh_set_object.num_RangeY_2,'String',num2str(ObjectData.RangeY,4));
     end
-
-    %stop drawing and plot projected field if the object manipulation is finished
+    
+    %% stop drawing and plot the projected field if the object manipulation is finished
     if check_multiple==0  || isequal(get(hcurrentfig,'SelectionType'),'alt')
         AxeData.CurrentOrigin=[]; %suppress the current origin
-        hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(fig_tag);
+        hobject=UvData.ProjObject{IndexObj}.DisplayHandle.(FigTag);
         if ~isempty(hObject)
-         ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')};
-        AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject
+            ProjObject=UvData.ProjObject{get(hhuvmat.ListObject_1,'Value')};
+            AxeData.CurrentObject=plot_object(ObjectData,ProjObject,hobject,'m');%draw the object and its handle becomes AxeData.CurrentObject
         end
         %%
@@ -136,5 +142,5 @@
             ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
             if ~isempty(ProjData)
-                if strcmp(fig_tag,'uvmat')% uvmat plot selected, projection plot seen in view_field
+                if strcmp(FigTag,'uvmat')% uvmat plot selected, projection plot seen in view_field
                     hview_field=findobj(allchild(0),'tag','view_field');
                     if isempty(hview_field)
@@ -159,61 +165,66 @@
                 else
                     UvData.PlotAxes=ProjData;
-                    [PlotType,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(hhuvmat));%update an existing field plot
+                    [PlotType,PlotParam]=plot_field(ProjData,hhuvmat.PlotAxes,read_GUI(huvmat));%update an existing field plot
                     errormsg=fill_GUI(PlotParam,huvmat);
                 end
             end
             set(hhuvmat.ViewField,'Value',1);%
-            set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
-            set(hhuvmat.edit_object,'Value',1);%
+            set(hhuvmat.edit_object,'Value',1);%           
             set(hhuvmat.edit_object,'Enable','on');%
             set(hhuvmat.MenuEditObject,'Enable','on');%
             set(hhuvmat.MenuEdit,'Enable','on');%
+            set(get(h_set_object,'children'),'Enable','on')
+        end
+        UvData.ProjObject{IndexObj}=ObjectData;
+        if isfield(UvData.ProjObject{IndexObj},'CreateMode')
+            UvData.ProjObject{IndexObj}=rmfield(UvData.ProjObject{IndexObj},'CreateMode');%remove createMode to mark the object as finished
         end
     else
-%         test_drawing=1;%allow continuation of drawing object
-%          AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the next current origin
-    end
-    UvData.ProjObject{IndexObj}=ObjectData;
+        test_drawing=1;%allow continuation of drawing object
+        AxeData.CurrentOrigin=[xy(1,1) xy(1,2)]; %the current point becomes the next current origin
+    end
+    %     UvData.ProjObject{IndexObj}=ObjectData;
     hother=findobj('Tag','deformpoint');%find all the deformpoints
     set(hother,'Color','b');%reset all the deformpoints in 'blue'
 end
 
-%% creation of a new zoom plot
-if isequal(get(hcurrentfig,'SelectionType'),'normal');%if left button has been pressed
+%% creation or update of a  zoom sub-plot
+if CheckZoomFig && isequal(get(hcurrentfig,'SelectionType'),'normal')&&...%if left button has been pressed
+     ~isempty(CurrentOrigin) && ~isequal(CurrentOrigin(1),xy(1,1)) && ~isequal(CurrentOrigin(2),xy(1,2))%if mouse moved in x and y since presed down
     hparentfig=hcurrentfig;
     %open or update a new zoom figure if a rectangle has been drawn
-    if ishandle(currentaxes);
+    if ishandle(hcurrentaxes);
         if isfield(AxeData,'CurrentRectZoom') && ~isempty(AxeData.CurrentRectZoom) && ishandle(AxeData.CurrentRectZoom)
-            PosRect=get(AxeData.CurrentRectZoom,'Position');
+            %PosRect=get(AxeData.CurrentRectZoom,'Position');
             if isfield(AxeData,'CurrentVec') && ~isempty(AxeData.CurrentVec) && ishandle(AxeData.CurrentVec)
                 delete(AxeData.CurrentVec)
             end
-            if ~testsubplot
-                hfig2=figure;%create new figure
-                set(hfig2,'name','zoom')
-                set(0,'Unit','pixels')
-                set(hfig2,'Unit','pixels')
-                FigPos=get(hfig2,'Position');
-                ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
-                Left=ScreenSize(3)- FigPos(3)-40; %right edge close to the right, with margin=40 
-                Bottom=ScreenSize(4)-FigPos(4)-40; %put fig at top right
-                FigPos(1:2)=[Left Bottom];
-                set(hfig2,'Position',FigPos);
-                map=colormap(currentaxes);
-                colormap(map);%transmit the current colormap to the zoom fig
-                set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
-                set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function
-                set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function
-                set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles})
-                set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom,'zoom'})
-                set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig
-                AxeData.ZoomAxes=copyobj(currentaxes,hfig2); %copy the current graph axes to the zoom figure
+            if ~testsubplot% if we are not already on a zoom plot
+                hfig2=findobj(allchild(0),'Tag','zoom_fig');
+                if isempty(hfig2)% create zoom sub plot if absent
+                    hfig2=figure('name',['zoom_' FigTag],'tag','zoom_fig');%create new figure (unit='pixels' by default)
+                    set(0,'Unit','pixels')
+                    FigPos=get(hfig2,'Position');%get the standard width and height of the fig
+                    ScreenSize=get(0,'ScreenSize');% get the size of the screen, to put the fig on the upper right
+                    Left=ScreenSize(3)- FigPos(3)-40; %right edge close to the right, with margin=40
+                    Bottom=ScreenSize(4)-FigPos(4)-40; %put fig at top right
+                    FigPos(1:2)=[Left Bottom];
+                    set(hfig2,'Position',FigPos);% put the zoom fig close to the upper right of the screen
+                    map=colormap(hcurrentaxes);
+                    colormap(map);%transmit the current colormap to the zoom fig
+                    set(hfig2,'KeyPressFcn',{@keyboard_callback,handles})%set keyboard action function
+                    set(hfig2,'WindowButtonMotionFcn',{@mouse_motion,handles})%set mouse action function
+                    set(hfig2,'WindowButtonDownFcn',{@mouse_down})%set mouse click action function
+                    set(hfig2,'WindowButtonUpFcn',{@mouse_up,handles})
+                else
+                    zoom_axes=findobj(hfig2,'Type','axes');%delete existing axes
+                    axes(zoom_axes);%make the zoom axes apparent
+                    delete(zoom_axes)
+                end
+                set(hfig2,'DeleteFcn',{@close_fig,AxeData.CurrentRectZoom})
+                set(hfig2,'UserData',AxeData.CurrentRectZoom)% record the parent object (zoom rectangle) in the new fig   
+                AxeData.ZoomAxes=copyobj(hcurrentaxes,hfig2); %copy the current graph axes to the zoom figure
                 hrect_zoom=findobj(AxeData.ZoomAxes,'Tag','rect_zoom');%find and delete the copy of the rect_zoom rectangle
                 delete(hrect_zoom)
-                ChildAxeData=get(AxeData.ZoomAxes,'UserData');
-                if isfield(ChildAxeData,'ParentGUI')
-                    ChildAxeData=rmfield(ChildAxeData,'ParentGUI');%no parent GUI, e.g. uvmat,  for the new plot
-                end
-                set(AxeData.ZoomAxes,'Position',[0.1300    0.1100    0.7750    0.8150])% standard axes position on a figure
                 hcol=findobj(hparentfig,'Tag','Colorbar'); %look for colorbar axes
                 if ~isempty(hcol)
@@ -228,12 +239,23 @@
                     set(hcol_new,'Yticklabel',YTicklabel);
                 end
-            end          
+                ChildAxeData=get(AxeData.ZoomAxes,'UserData');
+            end  
+            ChildAxeData.CurrentOrigin=[];% forget the current origin
             ChildAxeData.CurrentRectZoom=[]; % no rect zoom in the new window
             ChildAxeData.Drawing='off';
-            ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle as a 'parent' associated to the new axe
-            PosRect=CurrentOrigin;
-            xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
-            set(AxeData.ZoomAxes,'Xlim',[PosRect(1) xy(1,1)])
-            set(AxeData.ZoomAxes,'Ylim',[PosRect(2) xy(1,2)])
+            ChildAxeData.ParentAxes=hcurrentaxes;
+            ChildAxeData.ParentRect=AxeData.CurrentRectZoom;%set the rectangle drawing as a 'parent' associated to the new axe
+            %PosRect=CurrentOrigin;
+           % xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
+            if xy(1,1)>CurrentOrigin(1)
+            set(AxeData.ZoomAxes,'Xlim',[CurrentOrigin(1) xy(1,1)])
+            else
+                set(AxeData.ZoomAxes,'Xlim',[xy(1,1) CurrentOrigin(1)])
+            end
+            if xy(1,2)>CurrentOrigin(2)
+            set(AxeData.ZoomAxes,'Ylim',[CurrentOrigin(2) xy(1,2)])
+            else
+                set(AxeData.ZoomAxes,'Ylim',[xy(1,2) CurrentOrigin(2)])
+            end
             set(AxeData.ZoomAxes,'UserData',ChildAxeData);%update the AxeData of the new axes
         end
@@ -242,21 +264,26 @@
 
 %% zoom in or out by a factor 2 if no new figure is created
-if test_zoom
-    xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
-    xlim=get(currentaxes,'XLim');
-    ylim=get(currentaxes,'YLim');
+if CheckZoom
+    if testsubplot
+        haxes=gca;% zoom on a zoom sub-plot
+    else
+        haxes=hcurrentaxes;% zoom on the main plot
+    end
+   % xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
+    xlim=get(haxes,'XLim');
+    ylim=get(haxes,'YLim');
     % if left mouse button has been pressed, zoom in by a factor of 2
-    if  isequal(get(hcurrentfig,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
-        PlotBoxAspectRatio=get(currentaxes,'PlotBoxAspectRatio');
+    if  isequal(get(gcf,'SelectionType'),'normal');%if left button has been pressed, zoom in by a factor of 2
+        PlotBoxAspectRatio=get(haxes,'PlotBoxAspectRatio');
         yoverx=PlotBoxAspectRatio(2)/PlotBoxAspectRatio(1);
         if yoverx <2
             xlim(1)=0.5*xy(1,1)+0.5*xlim(1);
             xlim(2)=0.5*xy(1,1)+0.5*xlim(2);%double the field whith the middle at the selected points
-            set(currentaxes,'XLim',xlim)
+            set(haxes,'XLim',xlim)
         end
         if yoverx >0.5
             ylim(2)=0.5*xy(1,2)+0.5*ylim(2);
             ylim(1)=0.5*xy(1,2)+0.5*ylim(1);
-            set(currentaxes,'YLim',ylim)
+            set(haxes,'YLim',ylim)
         end
         
@@ -267,5 +294,6 @@
         ylim(1)=2*ylim(1)-xy(1,2);
         ylim(2)=2*ylim(2)-xy(1,2);
-        if isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
+        % adjust the zoom out to the available field
+        if ~testsubplot && isfield(AxeData,'RangeX')&& isfield(AxeData,'RangeY')
             xlim(1)=max(AxeData.RangeX(1),xlim(1));
             xlim(2)=min(AxeData.RangeX(2),xlim(2));
@@ -279,11 +307,11 @@
             if isequal(xlim,AxeData.RangeX) && isequal(ylim,AxeData.RangeY)
                 set(hhuvmat.CheckZoom,'Value',0)
-                set(hhuvmat.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
+               % set(hhuvmat.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
                 set(hhuvmat.CheckFixLimits,'Value',0)
-                set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
-            end
-        end
-        set(currentaxes,'XLim',xlim)
-        set(currentaxes,'YLim',ylim)
+              %  set(hhuvmat.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
+            end
+        end
+        set(haxes,'XLim',xlim)
+        set(haxes,'YLim',ylim)
         %test whther zoom out is operating (to inactivate AxedAta
         if ~isfield(AxeData,'CurrentXLim')|| ~isequal(xlim,AxeData.CurrentXLim)
@@ -291,5 +319,8 @@
         end
     end
-    if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field)
+    %if isfield(AxeData,'LimEditBox')&& AxeData.LimEditBox% update display of the GUI containing the axis (uvmat or view_field)
+    if testsubplot
+        set(AxeData.CurrentRectZoom,'Position',[xlim(1) ylim(1) xlim(2)-xlim(1) ylim(2)-ylim(1)])
+    else
         set(hhcurrentfig.num_MinX,'String',num2str(xlim(1)))
         set(hhcurrentfig.num_MaxX,'String',num2str(xlim(2)))
@@ -300,10 +331,10 @@
 
 %% editing calibration point
-if ~test_zoom && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'calibration')
+if ~CheckZoom && isfield(AxeData,'Drawing') && isequal(AxeData.Drawing,'calibration')
     h_geometry_calib=findobj(allchild(0),'tag','geometry_calib'); %find the geomterty_calib GUI
     if ~isempty(h_geometry_calib)
         hh_geometry_calib=guidata(h_geometry_calib);
         edit_test=get(hh_geometry_calib.edit_append,'Value');
-        hh=findobj(currentaxes,'tag','calib_points');%look for handle of calibration points
+        hh=findobj(hcurrentaxes,'tag','calib_points');%look for handle of calibration points
         if ~isempty(hh) && edit_test
             index_point=get(hh,'UserData');
@@ -313,5 +344,5 @@
             data=read_geometry_calib(Coord);
             %         val=get(h_ListCoord,'Value');
-            xy=get(currentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
+          %  xy=get(hcurrentaxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates
             data.Coord(index_point,4)=xy(1,1);
             data.Coord(index_point,5)=xy(1,2);
@@ -331,7 +362,7 @@
 
 %% finalising ruler
-if test_ruler
+if test_ruler && ~isempty(xy)
     set(hhuvmat.MenuRuler,'checked','off')%desable the ruler option in uvmat
-    xy=get(currentaxes,'CurrentPoint');% get the current mouse coordinates
+    xy=get(hcurrentaxes,'CurrentPoint');% get the current mouse coordinates
     RulerCoord=[AxeData.RulerCoord ;xy(1,1:2)];% append the recorded ruler origin to the current mouse coordinates
     RulerCoord=diff(RulerCoord,1);% coordiante difference between segment end and beginning
@@ -346,5 +377,5 @@
 
 %% display the data of the current object selected with the mouse right click
-if isequal(get(hcurrentfig,'SelectionType'),'alt') && ~test_zoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create'))
+if isequal(get(hcurrentfig,'SelectionType'),'alt') && ~CheckZoom && (~isfield(AxeData,'Drawing')||~isequal(AxeData.Drawing,'create'))
     hother=findobj('Tag','proj_object');%find all the proj objects
     nbselect=0;
@@ -384,9 +415,19 @@
         AxeData.Drawing='off';%stop current drawing action
 end
-set(currentaxes,'UserData',AxeData);
+set(hcurrentaxes,'UserData',AxeData);
 if ~isempty(huvmat)
     set(huvmat,'UserData',UvData);
 end
 
-    
-
+%------------------------------------------------------------------------    
+% --- 'close_fig': function  activated when a zoom figure is closed
+%------------------------------------------------------------------------
+function close_fig(ggg,eventdata,hparent)
+
+hfig=get(get(hparent,'parent'),'parent');
+hbutton=findobj(hfig,'Tag','CheckZoomFig');
+if ~isempty(hbutton)
+    set(hbutton,'Value',0)% desactivate the zoom fig option
+end
+delete(hparent)  % delete the rectangle showing the zoom graph in the parent fig
+
Index: /trunk/src/plot_field.m
===================================================================
--- /trunk/src/plot_field.m	(revision 624)
+++ /trunk/src/plot_field.m	(revision 625)
@@ -12,5 +12,5 @@
 %  dimension variables (case of matrices). 
 %
-% function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,htext,PosColorbar)
+% function [PlotType,PlotParamOut,haxes]= plot_field(Data,haxes,PlotParam,PosColorbar)
 %
 % OUPUT:
Index: /trunk/src/plot_object.m
===================================================================
--- /trunk/src/plot_object.m	(revision 624)
+++ /trunk/src/plot_object.m	(revision 625)
@@ -54,5 +54,5 @@
     return 
 end
-XMin=0;%default
+XMin=0;%default range for the graph
 XMax=0;
 YMin=0;
@@ -60,4 +60,10 @@
 ZMin=0;
 ZMax=0;
+XMinRange=[];%default range set by input
+XMaxRange=[];
+YMinRange=[];
+YMaxRange=[];
+ZMinRange=[];
+ZMaxRange=[];
 
 %% determine the plotting axes (with handle 'haxes')
@@ -99,36 +105,26 @@
     XMax=max(ObjectData.RangeX);
     XMin=min(ObjectData.RangeX);
+        XMaxRange=max(ObjectData.RangeX);
+        if numel(ObjectData.RangeX)==2
+    XMinRange=min(ObjectData.RangeX);
+        end
 end
 if isfield(ObjectData,'RangeY')&&~isempty(ObjectData.RangeY)
     YMax=max(ObjectData.RangeY);
     YMin=min(ObjectData.RangeY);
+        YMaxRange=max(ObjectData.RangeY);
+        if numel(ObjectData.RangeY)==2
+    YMinRange=min(ObjectData.RangeY);
+        end
 end
 if isfield(ObjectData,'RangeZ')&&~isempty(ObjectData.RangeZ)
     ZMax=max(ObjectData.RangeZ);
     ZMin=min(ObjectData.RangeZ);
-end
-switch ObjectData.Type
-    case 'points'
-        if strcmp(ObjectData.ProjMode,'projection')
-            YMax=max(XMax,YMax);
-            YMax=max(YMax,ZMax);
-        end
-    case {'rectangle','ellipse','volume'}
-%         if  isequal(YMax,0)
-%             ylim=get(haxes,'YLim');
-%             YMax=(ylim(2)-ylim(1))/100;
-%         end
-%         if isequal(XMax,0)
-%             XMax=YMax;%default
-%         end
-    case 'plane'
-        if  isequal(XMax,0)
-            xlim=get(haxes,'XLim');
-            XMax=xlim(2);
-        end
-        if  isequal(YMax,0)
-            ylim=get(haxes,'YLim');
-            YMax=ylim(2);
-        end
+    ZMaxRange=max(ObjectData.RangeZ);
+    ZMinRange=min(ObjectData.RangeZ);
+end
+if strcmp(ObjectData.Type,'points') && strcmp(ObjectData.ProjMode,'projection')
+    YMax=max(XMax,YMax);
+    YMax=max(YMax,ZMax);
 end
 sizcoord=size(ObjectData.Coord);
@@ -147,15 +143,84 @@
         yline=[yline; ObjectData.Coord(1,2)];
     elseif isequal(ObjectData.Type,'plane')|| isequal(ObjectData.Type,'volume') 
+        if ~isfield(ObjectData,'Angle')
+            ObjectData.Angle=[0 0 0];
+        end
         phi=ObjectData.Angle(3)*pi/180;%angle in radians
-        Xend_x=xline(1)+XMax*cos(phi);
-        Xend_y=yline(1)+XMax*sin(phi);
-        Xbeg_x=xline(1)+XMin*cos(phi);
-        Xbeg_y=yline(1)+XMin*sin(phi);
-        Yend_x=xline(1)-YMax*sin(phi);
-        Yend_y=yline(1)+YMax*cos(phi);
-        Ybeg_x=xline(1)-YMin*sin(phi);
-        Ybeg_y=yline(1)+YMin*cos(phi);
-        xline=[Xbeg_x Xend_x NaN Ybeg_x Yend_x];
-        yline=[Xbeg_y Xend_y NaN Ybeg_y Yend_y];
+        x0=xline(1); y0=yline(1);
+        xlim=get(haxes,'XLim');
+        ylim=get(haxes,'YLim');
+        graph_scale=max(abs(xlim(2)-xlim(1)),abs(ylim(2)-ylim(1)))/2;% estimate the length of axes plots
+        XMax=graph_scale;
+        YMax=graph_scale;
+        XMin=-graph_scale;
+        YMin=-graph_scale;
+        if  ~isempty(XMaxRange)
+            XMax=XMaxRange;
+        end
+        if  ~isempty(XMinRange)
+            XMin=XMinRange;
+        end
+        if  ~isempty(YMaxRange)
+            YMax=YMaxRange;
+        end
+        if  ~isempty(YMinRange)
+            YMin=YMinRange;
+        end   
+        % axes lines
+        xline=NaN(1,13);
+        xline(1)=x0+min(0,XMin)*cos(phi); % min end of the x axes
+        yline(1)=y0+min(0,XMin)*sin(phi);
+        xline(2)=x0+XMax*cos(phi);% max end of the x axes
+        yline(2)=y0+XMax*sin(phi);
+        xline(8)=x0-min(0,YMin)*sin(phi);% min end of the y axes
+        yline(8)=y0+min(0,YMin)*cos(phi);
+        xline(9)=x0-YMax*sin(phi);% max end of the y axes
+        yline(9)=y0+YMax*cos(phi);
+
+        %arrows on x axis
+        arrow_scale=graph_scale/20;
+        xline(3)=xline(2)-arrow_scale*cos(phi-pi/8);
+        yline(3)=yline(2)-arrow_scale*sin(phi-pi/8);
+        xline(5)=xline(2);
+        yline(5)=yline(2);
+        xline(6)=xline(2)-arrow_scale*cos(phi+pi/8);
+        yline(6)=yline(2)-arrow_scale*sin(phi+pi/8);
+        
+        %arrows on y axis
+        xline(10)=xline(9)-arrow_scale*cos(phi+pi/2-pi/8);
+        yline(10)=yline(9)-arrow_scale*sin(phi+pi/2-pi/8);
+        xline(12)=xline(9);
+        yline(12)=yline(9);
+        xline(13)=xline(9)-arrow_scale*cos(phi+pi/2+pi/8);
+        yline(13)=yline(9)-arrow_scale*sin(phi+pi/2+pi/8);     
+        %xline=[Xbeg_x Xend_x NaN Ybeg_x Yend_x];
+        %yline=[Xbeg_y Xend_y NaN Ybeg_y Yend_y];
+        %  dashed lines indicating bounds
+        xsup=NaN(1,5);
+        ysup=NaN(1,5);
+        if ~isempty(XMaxRange)
+            xsup(1)=xline(2)-YMin*sin(phi);
+            ysup(1)=yline(2)+YMin*cos(phi);
+            xsup(2)=xline(2)-YMax*sin(phi);
+            ysup(2)=yline(2)+YMax*cos(phi);
+        end
+        if ~isempty(YMaxRange)
+            xsup(2)=xline(2)-YMax*sin(phi);
+            ysup(2)=yline(2)+YMax*cos(phi);
+            xsup(3)=xline(9)+XMin*cos(phi);
+            ysup(3)=yline(9)+XMin*sin(phi);
+        end    
+        if ~isempty(XMinRange)
+            xsup(3)=xline(9)+XMin*cos(phi);
+            ysup(3)=yline(9)+XMin*sin(phi);
+            xsup(4)=x0+XMin*cos(phi)-YMin*sin(phi);
+            ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi);
+        end  
+        if ~isempty(YMinRange)
+           xsup(4)=x0+XMin*cos(phi)-YMin*sin(phi);
+            ysup(4)=y0+XMin*sin(phi)+YMin*cos(phi);
+            xsup(5)=xline(8)-YMin*sin(phi);
+            ysup(5)=yline(8)+YMin*cos(phi);
+        end 
     end
     SubLineStyle='none';%default
@@ -258,66 +323,72 @@
 if test_newobj==0;
     hh=hplot;
-    PlotData=get(hplot,'UserData');            
+    PlotData=get(hplot,'UserData');
     if test_line
         set(hplot,'XData',xline)
         set(hplot,'YData',yline)
-    %modify subobjects
-        if isfield(PlotData,'SubObject') 
-           if length(PlotData.SubObject)==2 && ~isequal(ObjectData.Type,'points')&& ~isequal(ObjectData.Type,'plane');
+        %modify subobjects
+        if isfield(PlotData,'SubObject')
+            if isequal(ObjectData.Type,'points')
+                if ~isequal(YMax,0)
+                    for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1))
+                        set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax])
+                    end
+                    %complement missing points
+                    if length(PlotData.SubObject)>nbpoints% fpoints in excess on the graph
+                        for ii=nbpoints+1: length(PlotData.SubObject);
+                            if ishandle(PlotData.SubObject(ii))
+                                delete(PlotData.SubObject(ii))
+                            end
+                        end
+                    end
+                    %                NbDeformPoint=nbpoints;
+                    
+                    if nbpoints>length(PlotData.SubObject)
+                        for ipt=length(PlotData.SubObject)+1:nbpoints
+                            PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
+                                'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
+                                'LineStyle',SubLineStyle,'Tag','proj_object');
+                        end
+                    end
+                end
+            elseif length(PlotData.SubObject)==2
                 set(PlotData.SubObject(1),'XData',xinf);
                 set(PlotData.SubObject(1),'YData',yinf);
                 set(PlotData.SubObject(2),'XData',xsup);
                 set(PlotData.SubObject(2),'YData',ysup);
-           elseif isequal(ObjectData.Type,'points')&& ~isequal(YMax,0)
-               for ipt=1:min(length(PlotData.SubObject),size(ObjectData.Coord,1))
-                    set(PlotData.SubObject(ipt),'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax])
-               end
-               %complement missing points
-                if length(PlotData.SubObject)>nbpoints% fpoints in excess on the graph
-               for ii=nbpoints+1: length(PlotData.SubObject);
-                   if ishandle(PlotData.SubObject(ii))
-                        delete(PlotData.SubObject(ii))
-                   end
-               end
-%                NbDeformPoint=nbpoints;
-           end
-               if nbpoints>length(PlotData.SubObject)
-                   for ipt=length(PlotData.SubObject)+1:nbpoints
-                     PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
-                  'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
-                  'LineStyle',SubLineStyle,'Tag','proj_object');
-                   end
-               end                                         
-           end
+            elseif length(PlotData.SubObject)==1
+                set(PlotData.SubObject(1),'XData',xsup);
+                set(PlotData.SubObject(1),'YData',ysup);
+            end
         end
         if isfield(PlotData,'DeformPoint')
             NbDeformPoint=length(PlotData.DeformPoint);
-           if NbDeformPoint>nbpoints% fpoints in excess on the graph
-               for ii=nbpoints+1:NbDeformPoint;
-                   if ishandle(PlotData.DeformPoint(ii))
+            if NbDeformPoint>nbpoints% fpoints in excess on the graph
+                for ii=nbpoints+1:NbDeformPoint;
+                    if ishandle(PlotData.DeformPoint(ii))
                         delete(PlotData.DeformPoint(ii))
-                   end
-               end
-               NbDeformPoint=nbpoints;
-           end
-           for ipt=1:NbDeformPoint
-               if ishandle(PlotData.DeformPoint(ipt))
-                   if nbpoints>=ipt  
+                    end
+                end
+                NbDeformPoint=nbpoints;
+            end
+            for ipt=1:NbDeformPoint
+                if ishandle(PlotData.DeformPoint(ipt))
+                    if nbpoints>=ipt
                         set(PlotData.DeformPoint(ipt),'XData',xline(ipt),'YData',yline(ipt));
                     end
-               end
-           end
-           if nbpoints>length(PlotData.DeformPoint)
-               for ipt=length(PlotData.DeformPoint)+1:nbpoints
+                end
+            end
+            if nbpoints>length(PlotData.DeformPoint)
+                for ipt=length(PlotData.DeformPoint)+1:nbpoints
                     PlotData.DeformPoint(ipt)=line(xline(ipt),yline(ipt),'Color',col,'LineStyle','.','Tag','DeformPoint',...
                         'SelectionHighlight','off','UserData',hplot);
-               end
-               set(hplot,'UserData',PlotData)
-           end
+                end
+                set(hplot,'UserData',PlotData)
+            end
         end
     elseif (isequal(ObjectData.Type,'rectangle')||isequal(ObjectData.Type,'ellipse'))&&XMax>0 && YMax>0
-        set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])          
-    end
-    if test_patch 
+        set(hplot,'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax])
+    end
+    if test_patch
         for iobj=1:length(PlotData.SubObject)
             objtype=get(PlotData.SubObject(iobj),'Type');
@@ -353,35 +424,35 @@
     set(hother,'Color','b');
     set(hother,'Selected','off')  
-    if isequal(ObjectData.Type,'points')
-        hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+');
-        for ipt=1:length(xline)
-              PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
-                  col,'LineStyle','.','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint');
-              %create circle around each point
-              if ~isequal(YMax,0)
-                 PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
-                  'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
-                  'LineStyle',SubLineStyle,'Tag','proj_object');
-              end
-        end
-    elseif  strcmp(ObjectData.Type,'line')||strcmp(ObjectData.Type,'polyline')||...        
-          strcmp(ObjectData.Type,'polygon') ||strcmp(ObjectData.Type,'plane')||strcmp(ObjectData.Type,'volume')%  (isequal(ObjectData.Type,'polygon') & ~test_patch) |isequal(ObjectData.Type,'plane')
-        hh=line(xline,yline,'Color',col);
-        if ~strcmp(ObjectData.Type,'plane') && ~strcmp(ObjectData.Type,'volume')
-            PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
-            PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
-            for ipt=1:sizcoord(1)
+    switch ObjectData.Type
+        case 'points'
+            hh=line(ObjectData.Coord(:,1),ObjectData.Coord(:,2),'Color',col,'LineStyle','.','Marker','+');
+            for ipt=1:length(xline)
                 PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
-                      col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
-            end
-        end
-    
-    elseif strcmp(ObjectData.Type,'rectangle')
-        hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);   
-    elseif strcmp(ObjectData.Type,'ellipse')
-        hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
-    else
-        msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m')
-        return
+                    col,'LineStyle','.','SelectionHighlight','off','UserData',hh,'Tag','DeformPoint');
+                %create circle around each point
+                if ~isequal(YMax,0)
+                    PlotData.SubObject(ipt)=rectangle('Curvature',[1 1],...
+                        'Position',[ObjectData.Coord(ipt,1)-YMax ObjectData.Coord(ipt,2)-YMax 2*YMax 2*YMax],'EdgeColor',col,...
+                        'LineStyle',SubLineStyle,'Tag','proj_object');
+                end
+            end
+        case {'line','polyline','polygon'}
+            hh=line(xline,yline,'Color',col);
+                PlotData.SubObject(1)=line(xinf,yinf,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');%draw sub-lines
+                PlotData.SubObject(2)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
+                for ipt=1:sizcoord(1)
+                    PlotData.DeformPoint(ipt)=line(ObjectData.Coord(ipt,1),ObjectData.Coord(ipt,2),'Color',...
+                        col,'LineStyle','none','Marker','.','Tag','DeformPoint','SelectionHighlight','off','UserData',hh);
+                end
+        case {'plane','volume'}
+            hh=line(xline,yline,'Color',col);
+            PlotData.SubObject(1)=line(xsup,ysup,'Color',col,'LineStyle',SubLineStyle,'Tag','proj_object');
+        case 'rectangle'
+            hh=rectangle('Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'LineWidth',2,'EdgeColor',col);
+        case 'ellipse'
+            hh=rectangle('Curvature',[1 1],'Position',[ObjectData.Coord(1,1)-XMax ObjectData.Coord(1,2)-YMax 2*XMax 2*YMax],'EdgeColor',col);
+        otherwise
+            msgbox_uvmat('ERROR','unknown ObjectData.Type in plot_object.m')
+            return
     end
     set(hh,'Tag','proj_object')
Index: /trunk/src/proj_field.m
===================================================================
--- /trunk/src/proj_field.m	(revision 624)
+++ /trunk/src/proj_field.m	(revision 625)
@@ -2203,11 +2203,11 @@
 
 %% store the properties of the projection object
-ListObject={'Type','ProjMode','RangeX','RangeY','RangeZ','Phi','Theta','Psi','Coord'};
+ListObject={'Name','Type','ProjMode','angle','RangeX','RangeY','RangeZ','DX','DY','DZ','Coord'};
 for ilist=1:length(ListObject)
     if isfield(ObjectData,ListObject{ilist})
         val=ObjectData.(ListObject{ilist});
         if ~isempty(val)
-            ProjData.(['Object' ListObject{ilist}])=val;
-            ProjData.ListGlobalAttribute=[ProjData.ListGlobalAttribute {['Object' ListObject{ilist}]}];
+            ProjData.(['ProjObject' ListObject{ilist}])=val;
+            ProjData.ListGlobalAttribute=[ProjData.ListGlobalAttribute {['ProjObject' ListObject{ilist}]}];
         end
     end   
Index: /trunk/src/set_object.m
===================================================================
--- /trunk/src/set_object.m	(revision 624)
+++ /trunk/src/set_object.m	(revision 625)
@@ -153,27 +153,17 @@
         end
     end  
-    if isfield(data,'Angle') && isequal(numel(data.Angle),3)
+    if ~isfield(data,'Angle')
+        data.Angle=[0 0 0];
+    end
+%     if isfield(data,'Angle') && isequal(numel(data.Angle),3)
          set(handles.num_Angle_1,'String',num2str(data.Angle(1)))
          set(handles.num_Angle_2,'String',num2str(data.Angle(2)))
          set(handles.num_Angle_3,'String',num2str(data.Angle(3)))
-    end
-end
-% if enable_plot
-%    set(handles.PLOT,'enable','on')
-% else
-% enable the PLOT (REFRESH) button by default
-%defaul settings
-set(get(handles.set_object,'children'),'enable','on')
-set(handles.PLOT,'enable','off') 
-% end
-% huvmat=findobj(allchild(0),'tag','uvmat');
-% UvData=get(huvmat,'UserData');
-% pos_uvmat=get(huvmat,'Position');
-% %position the set_object GUI with respect to uvmat
-% if isfield(UvData,'SetObjectOrigin')
-%     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
-%     pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
-%     set(hObject,'Position',pos_set_object)
-% end
+%     end
+end
+set(get(handles.set_object,'children'),'enable','off')
+set(handles.SAVE,'enable','on')
+% set(handles.PLOT,'enable','off') 
+
 
 %------------------------------------------------------------------------
@@ -195,5 +185,5 @@
     set(hhuvmat.ViewObject,'value',0)% 
     set(hhuvmat.edit_object,'Value',0)% desactivate the edit option
-    set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
+%    set(hhuvmat.edit_object,'BackgroundColor',[0.7 0.7 0.7])%put unactivated buttons to gree
     % deselect the object in ListObject when view_field is closed
     if isempty(findobj(allchild(0),'Tag','view_field'))
@@ -450,5 +440,23 @@
 hhuvmat=guidata(huvmat);%handles of the objects children of the  GUI uvmat
 ListObject=get(hhuvmat.ListObject,'String');% list of objects displayed in uvmat
-IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
+
+if isequal(get(hhuvmat.edit_object,'Value'),0) %we append a new object
+    ListObject=[ListObject;{''}];
+    IndexObj=length(ListObject);
+    set(hhuvmat.ListObject,'String',ListObject)
+    set(hhuvmat.ListObject,'Value',IndexObj)
+    UvData.ProjObject{IndexObj}=[]; %create a new empty object
+    UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=hhuvmat.PlotAxes; % axes for plot_object
+    UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
+else
+    % if ~strcmp(ListObject{end},'')
+    %     ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object
+    %     set(handles.ListObject,'String',ListObject)
+    % end
+    % IndexObj=length(ListObject);  
+    % set(handles.uvmat,'UserData',UvData)    
+    IndexObj=get(hhuvmat.ListObject,'Value');% index of the selected object for display in uvmat
+end
+
 %set or modify(edit mode) the nameof the currently selected object
 detectname=1;
@@ -474,4 +482,5 @@
 ListObject{IndexObj}=ObjectName;
 set(hhuvmat.ListObject,'String',ListObject);%complement the object list
+set(hhuvmat.ListObject_1,'String',ListObject);%complement the object list
 set(hhuvmat.ViewObject,'Value',1)% indicate that the currently selected objected is viewed on set_object
 check_handle=isfield(UvData.ProjObject{IndexObj},'DisplayHandle') && isfield(UvData.ProjObject{IndexObj}.DisplayHandle,'uvmat')...
@@ -572,5 +581,5 @@
 set(hhuvmat.MenuEditObject,'enable','on')
 set(hhuvmat.edit_object,'Value',1) % set uvmat to object edit mode to allow further object update
-set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
+%set(hhuvmat.edit_object,'BackgroundColor',[1 1 0]);% paint the edit text in yellow
 set(hhuvmat.ViewField,'Value',1)
 % set(handles.PLOT,'enable','on')
Index: /trunk/src/uvmat.m
===================================================================
--- /trunk/src/uvmat.m	(revision 624)
+++ /trunk/src/uvmat.m	(revision 625)
@@ -2551,4 +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}.DisplayHandle.uvmat=[]; %plane not visible in uvmat
         UvData.ProjObject{1}.DisplayHandle.view_field=[]; %plane not visible in uvmat
@@ -4168,10 +4169,6 @@
 list_str=get(handles.ListObject,'String');
 IndexObj=get(handles.ListObject,'Value');%present object selection
-
-%% The object  is displayed in set_object if this GUI is already opened
 UvData=get(handles.uvmat,'UserData');
 ObjectData=UvData.ProjObject{IndexObj};
-hset_object=findobj(allchild(0),'tag','set_object');
-if ~isempty(hset_object)
     ZBounds=0; % default
     if isfield(UvData.Field,'ZMin') && isfield(UvData.Field,'ZMax')
@@ -4179,11 +4176,23 @@
         ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
     end
-    ObjectData.Name=list_str{IndexObj};
+
+%% show object features if view_object isselected
+if get(handles.ViewObject,'value')
     set_object(ObjectData,[],ZBounds);
-    set(handles.ViewField,'Value',1)% show that the selected object in ListObject is currently visualised
-end
-
-%%  desactivate the edit object mode
+end
+
+%% The object  is displayed in set_object if this GUI is already opened
+% 
+% hset_object=findobj(allchild(0),'tag','set_object');
+% if ~isempty(hset_object)
+% 
+%     ObjectData.Name=list_str{IndexObj};
+%     set_object(ObjectData,[],ZBounds);
+%     set(handles.ViewField,'Value',1)% show that the selected object in ListObject is currently visualised
+% end
+
+%%  desactivate the edit object mode for security 
 set(handles.edit_object,'Value',0) 
+
 % set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7]) 
 
@@ -4274,6 +4283,5 @@
 %-------------------------------------------------------------------
 hset_object=findobj(allchild(0),'Tag','set_object');
-if get(handles.edit_object,'Value')
-%     set(handles.edit_object,'BackgroundColor',[1,1,0])  
+if get(handles.edit_object,'Value') 
     %suppress the other options 
     set(handles.CheckZoom,'Value',0)
@@ -4283,14 +4291,12 @@
         hhgeometry_calib=guidata(hgeometry_calib);
         set(hhgeometry_calib.edit_append,'Value',0)% desactivate mouse action in geometry_calib
-        set(hhgeometry_calib.edit_append,'BackgroundColor',[0.7 0.7 0.7])
     end
     set(handles.ViewObject,'value',1)
     ViewObject_Callback(hObject, eventdata, handles)
-else % desctivate object edit mode
-%     set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])  
+else % desactivate object edit mode
     if ~isempty(hset_object)% open the 
-        hhset_object=guidata(hset_object);
-        set(hhset_object.PLOT,'enable','off'); 
-        set(get(hset_object,'children'),'enable','inactive')
+        set(get(hset_object,'children'),'Enable','off')
+        hSAVE=findobj(hset_object,'Tag','SAVE');
+        set(hSAVE,'Enable','on')
     end
 end
@@ -4317,36 +4323,14 @@
         ZBounds(2)=UvData.Field.ZMax;%maximum for the Z slider
     end
-%     set(handles.ListObject_1,'Value',IndexObj);%restore ListObject selection after set_object deletion
     data=UvData.ProjObject{IndexObj};
     if ~isfield(data,'Type')% default plane
         data.Type='plane';
     end
-%     if isfield(UvData,'Field')
-%         Field=UvData.Field;
-%         if isfield(UvData.Field,'Mesh')&&~isempty(UvData.Field.Mesh)
-%             data.RangeX=[UvData.Field.XMin UvData.Field.XMax];
-%             if strcmp(data.Type,'line')||strcmp(data.Type,'polyline')
-%                 data.RangeY=UvData.Field.Mesh;
-%             else
-%                 data.RangeY=[UvData.Field.YMin UvData.Field.YMax];
-%             end
-%             data.DX=UvData.Field.Mesh;
-%             data.DY=UvData.Field.Mesh;
-%         end
-%         if isfield(Field,'NbDim')&& isequal(Field.NbDim,3)
-%             data.Coord=[0 0 0]; %default
-%         end
-%         if isfield(Field,'CoordUnit')
-%             data.CoordUnit=Field.CoordUnit;
-%         end
-%     end
     hset_object=set_object(data,[],ZBounds);
     hhset_object=guidata(hset_object);
     if get(handles.edit_object,'Value')% edit mode
-        set(hhset_object.PLOT,'Enable','on')
-        set(get(hset_object,'children'),'enable','on')
+        set(get(hset_object,'children'),'Enable','on')
     else
-        set(hhset_object.PLOT,'Enable','off')
-        set(get(hset_object,'children'),'enable','inactive')% deactivate the GUI except SAVE
+        set(get(hset_object,'children'),'Enable','off')% deactivate the GUI except SAVE
         set(hhset_object.SAVE,'Enable','on')
     end
@@ -4771,4 +4755,6 @@
 end
 set(handles.edit_object,'Value',0)  %desactivate the object edit mode
+edit_object_Callback([],[],handles)
+set(handles.ViewObject,'Value',0) % desactivate view_object (new object created)
 set(handles.CheckZoomFig,'Value',0) %desactivate zoom sub fig
 set(handles.CheckZoom,'Value',0)    %desactivate the zoom action
@@ -4777,20 +4763,20 @@
 end
 
-%% append a new line to the list of projection objects
-ListObject=get(handles.ListObject,'String');
-if isempty(ListObject)
-    ListObject={''};
-end
-if ~strcmp(ListObject{end},'')
-    ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object
-    set(handles.ListObject,'String',ListObject)
-end
-IndexObj=length(ListObject);
-set(handles.ListObject,'Value',IndexObj)
+%% append a new line to the list of projection objects A METTRE PLUS TARD
+% ListObject=get(handles.ListObject,'String');
+% if isempty(ListObject)
+%     ListObject={''};
+% end
+% if ~strcmp(ListObject{end},'')
+%     ListObject=[ListObject;{''}]; %append a blank to the list (if nort already done) to indicate the creation of a new object
+%     set(handles.ListObject,'String',ListObject)
+% end
+% IndexObj=length(ListObject);
+% set(handles.ListObject,'Value',IndexObj)
 UvData=get(handles.uvmat,'UserData');
-UvData.ProjObject{IndexObj}=[]; %create a new empty object
-UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=handles.PlotAxes; % axes for plot_object
-UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
-set(handles.uvmat,'UserData',UvData)
+% UvData.ProjObject{IndexObj}=[]; %create a new empty object
+% UvData.ProjObject{IndexObj}.DisplayHandle.uvmat=handles.PlotAxes; % axes for plot_object
+% UvData.ProjObject{IndexObj}.DisplayHandle.view_field=[]; %no plot handle before plot_field operation
+% set(handles.uvmat,'UserData',UvData)
 
 %% initiate the new projection object
@@ -4862,4 +4848,5 @@
 set(get(hset_object,'children'),'enable','on')% enable edit action on elements on GUI set_object
 set(handles.edit_object,'Value',0); %suppress the object edit mode
+edit_object_Callback([],[],handles)
 % set(handles.edit_object,'BackgroundColor',[0.7,0.7,0.7])  
 set(handles.delete_object,'Visible','on')
Index: /trunk/src/view_field.m
===================================================================
--- /trunk/src/view_field.m	(revision 624)
+++ /trunk/src/view_field.m	(revision 625)
@@ -90,4 +90,5 @@
         set(handles.Scalar,'Visible','off')
     end
+    
     errormsg=fill_GUI(PlotParamOut,hObject);
     if ~isempty(errormsg)
@@ -394,9 +395,9 @@
 function CheckFixLimits_Callback(hObject, eventdata, handles)
 test=get(handles.CheckFixLimits,'Value');
-if test
-    set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
-else
-    set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
-end
+% if test
+%     set(handles.CheckFixLimits,'BackgroundColor',[1 1 0])
+% else
+%     set(handles.CheckFixLimits,'BackgroundColor',[0.7 0.7 0.7])
+% end
 update_plot(handles)
  
@@ -406,8 +407,6 @@
 %-------------------------------------------------------------------
 if get(handles.CheckFixAspectRatio,'Value')
-    set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])
     update_plot(handles);
 else
-    set(handles.CheckFixAspectRatio,'BackgroundColor',[0.7 0.7 0.7])
     update_plot(handles);
 end
@@ -417,5 +416,4 @@
 %-------------------------------------------------------------------
 set(handles.CheckFixAspectRatio,'Value',1)% select the fixed aspect ratio button
-set(handles.CheckFixAspectRatio,'BackgroundColor',[1 1 0])% mark in yellow
 update_plot(handles);
 
@@ -600,5 +598,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);
 
@@ -607,5 +605,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);
 
@@ -614,5 +612,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);
 
@@ -621,5 +619,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);
 
@@ -635,5 +633,5 @@
 %--------------------------------------------
 set(handles.CheckFixScalar,'Value',1) %suppress auto mode
-set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
+% set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
 update_plot(handles)
 
@@ -642,12 +640,12 @@
 %--------------------------------------------
 test=get(handles.CheckFixScalar,'Value');
-if test
-    set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
-else
-    set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
-    update_plot(handles);
-%     set(handles.MinA,'String',num2str(ScalOut.MinA,3))
-%     set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
-end
+% if test
+%     set(handles.CheckFixScalar,'BackgroundColor',[1 1 0])
+% else
+%     set(handles.CheckFixScalar,'BackgroundColor',[0.7 0.7 0.7])
+%     update_plot(handles);
+% %     set(handles.MinA,'String',num2str(ScalOut.MinA,3))
+% %     set(handles.MaxA,'String',num2str(ScalOut.MaxA,3))
+% end
 
 %-------------------------------------------------------------------
@@ -699,5 +697,5 @@
     update_plot(handles);
     %set(handles.VecScale,'String',num2str(ScalOut.VecScale,3))
-    set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])
+%     set(handles.FixVec,'BackgroundColor',[0.7 0.7 0.7])
 end
 
