Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 60)
+++ trunk/src/uvmat.m	(revision 61)
@@ -246,6 +246,6 @@
 if ~isfield(UvData.Object{1},'plotaxes')
     UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
-    set(handles.list_object,'String',{'1-PLANE'});
-    set(handles.list_object,'Value',1);
+    set(handles.list_object_1,'String',{'1-PLANE'});
+    set(handles.list_object_1,'Value',1);
 end
 
@@ -379,5 +379,5 @@
         set(handles.OBJECT_txt,'Visible','on')
         set(handles.edit,'Visible','on')
-        set(handles.list_object,'Visible','on')
+        set(handles.list_object_1,'Visible','on')
         set(handles.frame_object,'Visible','on')
     else
@@ -598,5 +598,5 @@
         set(handles.OBJECT_txt,'Visible','on')
         set(handles.edit,'Visible','on')
-        set(handles.list_object,'Visible','on')
+        set(handles.list_object_1,'Visible','on')
         set(handles.frame_object,'Visible','on')
          % initiate input file: 
@@ -647,5 +647,4 @@
 drawnow
 set(handles.Fields,'UserData',[])% reinialize data from uvmat opening
-%huvmat=get(handles.RootPath,'parent');
 UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface
 UvData.NewSeries=1; %flag for run0: begin a new series
@@ -920,6 +919,6 @@
 function MenuBrowse_1_Callback(hObject, eventdata, handles)
 %-------------------------------------------------------------------
-huvmat=get(handles.run0,'parent');
-UvData=get(huvmat,'UserData');
+% huvmat=get(handles.run0,'parent');
+UvData=get(handles.uvmat,'UserData');
 
 RootPath=get(handles.RootPath,'String');
@@ -1142,6 +1141,6 @@
 set(handles.RootPath_1,'BackgroundColor',[1 1 0])% indicate active program by yellow color
 drawnow
-huvmat=get(handles.RootPath,'parent');
-UvData=get(huvmat,'UserData');%huvmat=handles of the uvmat interface
+%huvmat=get(handles.RootPath,'parent');
+UvData=get(handles.uvmat,'UserData');%huvmat=handles of the uvmat interface
 UvData.NewSeries=1; %flag for run0: begin a new series
 
@@ -1279,5 +1278,5 @@
 end
 UvData.XmlData_1=XmlData;
-set(huvmat,'UserData',UvData)%update the data attached to the uvmat interface
+set(handles.uvmat,'UserData',UvData)%update the data attached to the uvmat interface
 
 if ~isequal(warntext,'')
@@ -1476,9 +1475,9 @@
     end
     set(handles.mask_test,'UserData',[])    
-    huvmat=get(handles.mask_test,'parent');
-    UvData=get(huvmat,'UserData');
+    %huvmat=get(handles.mask_test,'parent');
+    UvData=get(handles.uvmat,'UserData');
     if isfield(UvData,'MaskName')
         UvData=rmfield(UvData,'MaskName');
-        set(huvmat,'UserData',UvData)
+        set(handles.uvmat,'UserData',UvData)
     end
     set(handles.mask_test,'BackgroundColor',[0.7 0.7 0.7])
@@ -2455,6 +2454,6 @@
 if ~isfield(UvData.Object{1},'plotaxes')
     UvData.Object{1}.plotaxes=handles.axes3;%default plotting axis
-    set(handles.list_object,'String',{'1-PLANE'});
-    set(handles.list_object,'Value',1);
+    set(handles.list_object_1,'String',{'1-PLANE'});
+    set(handles.list_object_1,'Value',1);
 end
 
@@ -2472,5 +2471,5 @@
     ZBounds(2)=UvData.ZMax;%maximum for the Z slider
     set_object(UvData.Object{1},PlotHandles,ZBounds);
-    set(handles.list_object,'Value',1);
+    set(handles.list_object_1,'Value',1);
 %multilevel case (single menuplane in a 3D space)
 elseif isfield(UvData,'Z')
@@ -2499,5 +2498,5 @@
     set(handles.MaxA,'String','255')
 end
-IndexObj=get(handles.list_object,'Value');
+IndexObj=get(handles.list_object_1,'Value');
 Object=UvData.Object;
 IndexObj=min(IndexObj,numel(Object));
@@ -3412,7 +3411,7 @@
 %     set(handles.edit,'Value',0)
 %     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
-%     list_object=get(handles.list_object,'String');
-%     if ~isempty(list_object)
-%         set(handles.list_object,'Value',length(list_object))
+%     list_object_1=get(handles.list_object_1,'String');
+%     if ~isempty(list_object_1)
+%         set(handles.list_object_1,'Value',length(list_object_1))
 %     end
 %     MouseAction='create_object';
@@ -3471,7 +3470,7 @@
 %     end
 %     %set(hset_object,'Position',[pos_uvmat(1) pos_uvmat(2)-0.05*pos_uvmat(4) 0.2*pos_uvmat(3)  0.5*pos_uvmat(4)]);
-%     list_object=get(handles.list_object,'String');
-%     if ~isempty(list_object)
-%         set(handles.list_object,'Value',length(list_object))
+%     list_object_1=get(handles.list_object_1,'String');
+%     if ~isempty(list_object_1)
+%         set(handles.list_object_1,'Value',length(list_object_1))
 %     end
 %     MouseAction='create_object';
@@ -3503,5 +3502,5 @@
 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
 % set(handles.edit,'Value',0)
-% set(handles.list_object,'Value',1);
+% set(handles.list_object_1,'Value',1);
 % edit_vect_Callback(hObject, eventdata, handles)
 % set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
@@ -3541,7 +3540,7 @@
 %     set(hset_object,'Position',pos_set_object)
 % end
-% list_object=get(handles.list_object,'String');
-% if ~isempty(list_object)
-%     set(handles.list_object,'Value',length(list_object))
+% list_object_1=get(handles.list_object_1,'String');
+% if ~isempty(list_object_1)
+%     set(handles.list_object_1,'Value',length(list_object_1))
 % end
 % MouseAction='create_object';
@@ -3606,7 +3605,7 @@
 %         set(hset_object,'Position',pos_set_object)
 %     end
-%     list_object=get(handles.list_object,'String');
-%     if ~isempty(list_object)
-%         set(handles.list_object,'Value',length(list_object))
+%     list_object_1=get(handles.list_object_1,'String');
+%     if ~isempty(list_object_1)
+%         set(handles.list_object_1,'Value',length(list_object_1))
 %     end
 %     UvData.MouseAction='create_object';
@@ -3677,7 +3676,7 @@
 % set(hset_object,'Position',pos_set_object)
 % end
-% list_object=get(handles.list_object,'String');
-% nbobject=length(list_object);
-% set(handles.list_object,'Value',nbobject)
+% list_object_1=get(handles.list_object_1,'String');
+% nbobject=length(list_object_1);
+% set(handles.list_object_1,'Value',nbobject)
 % UvData.MouseAction='create_object';
 % set(huvmat,'UserData',UvData)
@@ -3691,6 +3690,5 @@
     delete(handles.UVMAT_title)
 end
-huvmat=get(handles.create,'parent');
-UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 
+UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
 if isequal(get(handles.VOLUME,'Value'),1)
     set(handles.zoom,'Value',0)
@@ -3700,6 +3698,6 @@
     set(handles.edit,'Value',0)
     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
-    set(handles.cal,'Value',0)
-    set(handles.cal,'BackgroundColor',[0 1 0])
+%     set(handles.cal,'Value',0)
+%     set(handles.cal,'BackgroundColor',[0 1 0])
     set(handles.edit_vect,'Value',0)
     edit_vect_Callback(hObject, eventdata, handles)
@@ -3753,6 +3751,8 @@
     set(handles.edit_vect,'BackgroundColor',[1 1 0])
     set(handles.edit,'Value',0)
-    set(handles.create,'Value',0)
-    set(handles.create,'BackgroundColor',[0 1 0])
+    set(handles.zoom,'Value',0)
+    set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
+%     set(handles.create,'Value',0)
+%     set(handles.create,'BackgroundColor',[0 1 0])
     set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
     set(gcf,'Pointer','arrow')
@@ -4020,75 +4020,5 @@
 function cal_Callback(hObject, eventdata, handles)
 
-huvmat=get(handles.cal,'parent');%handles of the uvmat interface
-UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 
-%reinitialize the edit interface associated with uvmat
-value=get(handles.cal,'Value'); 
-if value
-        set(handles.cal,'BackgroundColor',[1 1 0])
-        %suppress the other options if MENULINE is chosen
-        set(handles.zoom,'Value',0)
-        set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
-        set(handles.create,'Value',0)
-        set(handles.create,'BackgroundColor',[0 1 0])
-        set(handles.create,'enable','off')      
-        set(handles.edit_vect,'Value',0)
-        set(handles.edit_vect,'enable','off')
-        edit_vect_Callback(hObject, eventdata, handles)
-        set(handles.edit,'Value',0)
-        set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
-        set(handles.edit,'enable','off')
-        set(handles.list_object,'Value',1)      
-        % initiate display of GUI geometry_calib
-        data=[]; %default
-		if isfield(UvData,'CoordType')
-            data.CoordType=UvData.CoordType;
-        end
-        %data.ParentButton=handles.cal; % transmit the handles of the calling button to the GUI geometry_calib
-		pos=get(huvmat,'Position');
-		pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen)
-		pos(2)=pos(2)-0.02;
-        [FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
-%         [filebase,num_i1,num_j1,num_i2,num_j2,Ext,NomType,SubDir]=read_input_file(handles);
-%         [inputfile,idetect]=name_generator(filebase,num_i1,num_j1,Ext,NomType,1,num_i2,num_j2,SubDir);
-		[UvData.hset_object,UvData.sethandles]=geometry_calib(handles,pos,FileName);% call the set_object interface	
-        pos_uvmat=get(huvmat,'Position');
-        %pos_cal(1:2)=UvData.CalOrigin + pos_uvmat(1:2);
-        if isfield(UvData,'CalOrigin')
-            pos_cal(1)=pos_uvmat(1)+UvData.CalOrigin(1)*pos_uvmat(3);
-            pos_cal(2)=pos_uvmat(2)+UvData.CalOrigin(2)*pos_uvmat(4);
-            pos_cal(3:4)=UvData.CalSize .* pos_uvmat(3:4);
-            set(UvData.hset_object,'Position',pos_cal)
-        end
-        UvData.MouseAction='calib';
-else
-     UvData.MouseAction='none';     
-     hgeometry_calib=findobj(allchild(0),'Name','geometry_calib');
-%      if ~isempty(hgeometry_calib)
-%          answer=questdlg('close the GUI geometry-calib?');
-%          if isequal(answer,'Yes')
-%              delete(hgeometry_calib)
-%              set(handles.cal,'BackgroundColor',[0 1 0])
-%          else
-%              set(handles.cal,'Value',1)% keep the calibration function active
-%          end
-%      end
-     set(handles.edit_vect,'enable','on')
-     set(handles.edit,'enable','on')
-     set(handles.create,'enable','on')
-%      set(handles.LINE,'enable','on')
-%      set(handles.PATCH,'enable','on')
-%      set(handles.PLANE,'enable','on')
-%      set(handles.VOLUME,'enable','on')
-     %set(handles.makemask,'enable','on')
-     hh=findobj(handles.axes3,'Tag','calib_points');
-     if ~isempty(hh)
-         delete(hh)
-     end
-     hhh=findobj(handles.axes3,'Tag','calib_marker');
-     if ~isempty(hhh)
-         delete(hhh)
-     end    
-end
-set(huvmat,'UserData',UvData);
+
 
 %-------------------------------------------------------------
@@ -4466,10 +4396,10 @@
 function grid_Callback(hObject, eventdata, handles)
 %-------------------------------------------------------------------
-huvmat=get(handles.create,'parent');
-UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 
+
+UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
 
 %suppress the other options if grid is chosen
-set(handles.create,'Value',0)
-set(handles.create,'BackgroundColor',[0 1 0])
+% set(handles.create,'Value',0)
+% set(handles.create,'BackgroundColor',[0 1 0])
 set(handles.edit_vect,'Value',0)
 edit_vect_Callback(hObject, eventdata, handles)
@@ -4478,5 +4408,5 @@
 edit_vect_Callback(hObject, eventdata, handles)
 set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
-set(handles.list_object,'Value',1)      
+set(handles.list_object_1,'Value',1)      
 set(handles.cal,'Value',0)
 set(handles.cal,'BackgroundColor',[0 1 0])   
@@ -4493,6 +4423,5 @@
 function edit_Callback(hObject, eventdata, handles)
 %-------------------------------------------------------------------
-huvmat=get(handles.list_object,'parent');
-UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 
+UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
 test=get(handles.edit,'Value');
 if test
@@ -4502,40 +4431,73 @@
     set(handles.zoom,'Value',0)
     zoom_Callback(hObject, eventdata, handles)
-    set(handles.create,'Value',0)
-    set(handles.create,'BackgroundColor',[0 1 0])
-%     set(handles.LINE,'Value',0)
-%     set(handles.LINE,'BackgroundColor',[0 1 0])
-%     set(handles.PATCH,'Value',0)
-%     set(handles.PATCH,'BackgroundColor',[0 1 0])
-%     set(handles.PLANE,'Value',0)
-%     set(handles.PLANE,'BackgroundColor',[0 1 0])%put activated buttons to yellow
-%     set(handles.VOLUME,'Value',0)
-%     set(handles.VOLUME,'BackgroundColor',[0 1 0])
     set(handles.edit_vect,'Value',0)
     edit_vect_Callback(hObject, eventdata, handles)  
-    set(handles.cal,'Value',0)
-    set(handles.cal,'BackgroundColor',[0 1 0])   
-    %set(handles.grid,'Value',0)
-    %set(handles.grid,'BackgroundColor',[0 1 0])
-    list_object_Callback(hObject, eventdata, handles)
+    %list_object_Callback(hObject, eventdata, handles)
 else 
     UvData.MouseAction='none';
     set(handles.edit,'BackgroundColor',[0.7,0.7,0.7])   
 end
-set(huvmat,'UserData',UvData);
-
-%--------------------------------------------------------
-% --- Executes on selection change in list_object.
-%--------------------------------------------------------
-function list_object_Callback(hObject, eventdata, handles)
+set(handles.uvmat,'UserData',UvData);
+hset_object=findobj(allchild(0),'Tag','set_object');
+if ~isempty(hset_object)
+    hhset_object=guidata(hset_object);
+    if test
+        set(hhset_object.PLOT,'Visible','on');
+    else
+       set(hhset_object.PLOT,'Visible','off'); 
+    end
+end
+
+%------------------------------------------------------------------------
+% --- Executes on selection change in list_object_1.
+function list_object_1_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
+list_str=get(handles.list_object_1,'String');
+IndexObj=get(handles.list_object_1,'Value');
+str_1=list_str{IndexObj};
+set(handles.list_object_1,'BackgroundColor',[1 1 0]) 
+set(handles.list_object_2,'BackgroundColor',[1 1 1]) 
+val_2=get(handles.list_object_2,'Value');
+str_2=get(handles.list_object_2,'String');
+if isequal(val_2,IndexObj)
+    set(handles.list_object_2,'Value',numel(str_2))
+    list_object_2_Callback(hObject, eventdata, handles)
+end
+hset_object=findobj(allchild(0),'Tag','set_object');
+if ~isempty(hset_object)
+     set(hset_object,'name',str_1);
+end
+update_object(handles,IndexObj,1)
+
+%------------------------------------------------------------------------
+% --- Executes on selection change in list_object_1.
+function list_object_2_Callback(hObject, eventdata, handles)
+%------------------------------------------------------------------------
+list_str=get(handles.list_object_2,'String');
+IndexObj=get(handles.list_object_2,'Value');
+if isequal(list_str{IndexObj},'...')
+    hview_field=findobj(allchild(0),'Tag','view_field')
+    if ~isempty(hview_field)
+        delete(hview_field)
+    end
+    set(handles.list_object_2,'BackgroundColor',[1 1 1])
+else
+    hset_object=findobj(allchild(0),'Tag','set_object');
+    if ~isempty(hset_object)
+        set(hset_object,'name',list_str{IndexObj});
+    end
+    set(handles.list_object_2,'BackgroundColor',[1 1 0]) 
+    set(handles.list_object_1,'BackgroundColor',[1 1 1]) 
+    update_object(handles,IndexObj,2)
+end
+
+%------------------------------------------------------------------------
+function update_object(handles,IndexObj,option)
+%------------------------------------------------------------------------
 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
-list_str=get(handles.list_object,'String');
-IndexObj=get(handles.list_object,'Value');
-
 if ~(length(UvData.Object)>=IndexObj);
     return
 end
 ObjectData=UvData.Object{IndexObj};
-ObjectData.desable_open=1; % desable the OPEN option in the set_object GUI (editing mode)
 if isequal(get(handles.edit,'Value'),0)
     ObjectData.desable_plot=1; % desable the PLOT option in the set_object GUI (editing mode
@@ -4547,19 +4509,24 @@
         ZBounds(2)=UvData.ZMax;%maximum for the Z slider
     end
-AxeData.hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface,
+hset_object=findobj(allchild(0),'Name','set_object');
+if ~isempty(hset_object)
+    delete(hset_object)% delete existing version of set_object
+end
+hset_object=set_object(ObjectData,PlotHandles,ZBounds);% call the set_object interface,
 pos_uvmat=get(handles.uvmat,'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(AxeData.hset_object,'Position',pos_set_object)
+    pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
+    pos_set_object(3:4)=UvData.SetObjectSize .* pos_uvmat(3:4);
+    set(hset_object,'Position',pos_set_object)
 end
 
 %project the current field on the object and plot it
 ProjData= proj_field(UvData.Field,ObjectData,IndexObj);%project the current interface field on ObjectData
-if length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
-    plot_field(ProjData,UvData.Object{IndexObj}.plotaxes,PlotHandles);
-else
-     UvData.Object{IndexObj}.plotaxes=view_field(ProjData);
-     set(handles.uvmat,'UserData',UvData)
+if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
+    plot_field(ProjData,handles.axes3,PlotHandles);
+    UvData.Object{IndexObj}.plotaxes=handles.axes3;
+else
+    UvData.Object{IndexObj}.plotaxes=view_field(ProjData);
 end
 
@@ -4617,4 +4584,6 @@
     end
 end
+pause(0.1)
+figure(hset_object)%put set_object in front
 
 %------------------------------------------------------
@@ -4758,9 +4727,42 @@
 % ------------------------------------------------------------------
 function MenuCalib_Callback(hObject, eventdata, handles)
-set(handles.TOOLS_txt,'Visible','on')
-set(handles.frame_tools,'Visible','on')
-set(handles.cal,'Visible','on')
-set(handles.cal,'Value',1)
-cal_Callback(hObject,eventdata,handles)
+% set(handles.TOOLS_txt,'Visible','on')
+% set(handles.frame_tools,'Visible','on')
+UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
+%reinitialize the edit interface associated with uvmat
+%suppress the other options if MENULINE is chosen
+set(handles.zoom,'Value',0)
+set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
+%         set(handles.create,'Value',0)
+%         set(handles.create,'BackgroundColor',[0 1 0])
+%         set(handles.create,'enable','off')      
+set(handles.edit_vect,'Value',0)
+set(handles.edit_vect,'enable','off')
+edit_vect_Callback(hObject, eventdata, handles)
+set(handles.edit,'Value',0)
+set(handles.edit,'BackgroundColor',[0.7 0.7 0.7])
+set(handles.edit,'enable','off')
+set(handles.list_object_1,'Value',1)      
+% initiate display of GUI geometry_calib
+data=[]; %default
+if isfield(UvData,'CoordType')
+    data.CoordType=UvData.CoordType;
+end
+pos=get(handles.uvmat,'Position');
+pos(1)=pos(1)+pos(3)-0.311+0.04; %0.311= width of the geometry_calib interface (units relative to the srcreen)
+pos(2)=pos(2)-0.02;
+[FileName,RootPath,FileBase,FileIndices,FileExt,SubDir]=read_file_boxes(handles);
+[UvData.hset_object,UvData.sethandles]=geometry_calib(handles,pos,FileName);% call the set_object interface	
+pos_uvmat=get(handles.uvmat,'Position');
+%pos_cal(1:2)=UvData.CalOrigin + pos_uvmat(1:2);
+if isfield(UvData,'CalOrigin')
+    pos_cal(1)=pos_uvmat(1)+UvData.CalOrigin(1)*pos_uvmat(3);
+    pos_cal(2)=pos_uvmat(2)+UvData.CalOrigin(2)*pos_uvmat(4);
+    pos_cal(3:4)=UvData.CalSize .* pos_uvmat(3:4);
+    set(UvData.hset_object,'Position',pos_cal)
+end
+UvData.MouseAction='calib';
+set(handles.uvmat,'UserData',UvData);
+
 
 % ------------------------------------------------------------------
@@ -4768,7 +4770,7 @@
 set(handles.TOOLS_txt,'Visible','on')
 set(handles.frame_tools,'Visible','on')
-set(handles.create,'Visible','on')
-set(handles.create,'Value',1)
-set(handles.create,'BackgroundColor',[1 1 0]) %visualise in yellow
+% set(handles.create,'Visible','on')
+% set(handles.create,'Value',1)
+% set(handles.create,'BackgroundColor',[1 1 0]) %visualise in yellow
 set(handles.save_mask,'Visible','on')
 set(handles.masklevel,'Visible','on')
@@ -4790,6 +4792,6 @@
     delete(handles.UVMAT_title)
 end
-huvmat=get(handles.create,'parent');
-UvData=get(huvmat,'UserData');%read UvData properties stored on the uvmat interface 
+% huvmat=get(handles.create,'parent');
+UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface 
 set(handles.zoom,'Value',0)
 set(handles.zoom,'BackgroundColor',[0.7 0.7 0.7])
@@ -4800,6 +4802,6 @@
 set(handles.edit_vect,'Value',0)  
 edit_vect_Callback(hObject, eventdata, handles)
-set(handles.cal,'Value',0)
-set(handles.cal,'BackgroundColor',[0 1 0])
+% set(handles.cal,'Value',0)
+% set(handles.cal,'BackgroundColor',[0 1 0])
 
 %initiate the GUI set_object
@@ -4820,5 +4822,5 @@
 PlotHandles=get_plot_handles(handles);%get the handles of the graphic objects setting the plotting parameters
 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
-pos_uvmat=get(huvmat,'Position');
+pos_uvmat=get(handles.huvmat,'Position');
 if isfield(UvData,'SetObjectOrigin')
     pos_set_object(1:2)=UvData.SetObjectOrigin + pos_uvmat(1:2);
@@ -4826,10 +4828,10 @@
     set(hset_object,'Position',pos_set_object)
 end
-list_object=get(handles.list_object,'String');
+list_object=get(handles.list_object_1,'String');
 if ~isempty(list_object)
-    set(handles.list_object,'Value',length(list_object))
+    set(handles.list_object_1,'Value',length(list_object))
 end
 UvData.MouseAction='create_object';
-set(huvmat,'UserData',UvData);
+set(handles.uvmat,'UserData',UvData);
 
 % ------------------------------------------------------------------
@@ -5008,6 +5010,6 @@
 % ------------------------------------------------------------------
 function Menuvolume_Callback(hObject, eventdata, handles)
-set(handles.create,'Visible','on')
-set(handles.create,'Value',1)
+% set(handles.create,'Visible','on')
+% set(handles.create,'Value',1)
 VOLUME_Callback(hObject,eventdata,handles)
 
@@ -5039,4 +5041,13 @@
 end
 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
+%position the set_object GUI with respect to uvmat
+pos_uvmat=get(handles.uvmat,'Position');
+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(hset_object,'Position',pos_set_object)
+end
+set(handles.edit,'Value',0); %suppress the object edit mode
+set(handles.edit,'BackgroundColor',[0.7,0.7,0.7])  
 UvData.MouseAction='create_object';
 set(handles.uvmat,'UserData',UvData)
@@ -5050,4 +5061,6 @@
 end
 UvData=get(handles.uvmat,'UserData');
+set(handles.edit,'Value',0); %suppress the object edit mode
+set(handles.edit,'BackgroundColor',[0.7,0.7,0.7])  
 if isfield(UvData,'CoordType')
     data.CoordType=UvData.CoordType;
@@ -5080,4 +5093,13 @@
 PlotHandles=get_plot_handles(handles);%get the handles of the interface elements setting the plotting parameters
 [hset_object,UvData.sethandles]=set_object(data,PlotHandles);% call the set_object interface
+
+pos_uvmat=get(handles.uvmat,'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(hset_object,'Position',pos_set_object)
+end
+
 UvData.MouseAction='create_object';
 set(handles.uvmat,'UserData',UvData)
@@ -5095,3 +5117,2 @@
 set(handles.uvmat,'UserData',UvData);
 
-
