Index: trunk/src/mouse_down.m
===================================================================
--- trunk/src/mouse_down.m	(revision 67)
+++ trunk/src/mouse_down.m	(revision 71)
@@ -25,5 +25,5 @@
 
 MouseAction='none'; %default
-huvmat=findobj(allchild(0),'Name','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
+huvmat=findobj(allchild(0),'tag','uvmat');%find the uvmat interface handle which controls theoption of  mouse action
 if isempty(huvmat)
     return
@@ -49,5 +49,5 @@
 %edit an existing point or line if found
 hcurrentobject=gco;% current object handle (selected by the mouse)
-hcurrentfig=gcbo;% current figure handle
+hcurrentfig=hObject;% current figure handle
 fig_tag=get(hcurrentfig,'Tag');
 tag_obj=get(gco,'Tag');
@@ -105,10 +105,23 @@
 end    
 
+% zoom has first priority 
 if testzoom %&& ~test_create && ~test_edit && ~test_edit_vect && exist('xy','var')
      AxeData.Drawing='zoom'; %initiate drawing mode
      AxeData.CurrentObject=[];%unselect objects
+     set(haxes,'UserData',AxeData);
      return
 end
 if isempty(huvmat)
+    return
+end
+
+%ruler has second priority 
+if test_ruler
+    UvData.RulerCoord(1,1)=xy(1,1);
+    UvData.RulerCoord(1,2)=xy(1,2);
+    UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler');
+    set(huvmat,'UserData',UvData)
+    AxeData.Drawing='ruler';
+    set(haxes,'UserData',AxeData);
     return
 end
@@ -163,6 +176,10 @@
             end
             IndexObj=ObjectData.IndexObj;
-            set(hhuvmat.list_object_1,'Value',IndexObj);
-            set(hhuvmat.list_object_2,'Value',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
+                set(hhuvmat.list_object_2,'Value',IndexObj);
+            else
+                set(hhuvmat.list_object_1,'Value',IndexObj);
+            end
             testdeform=0;
             set(gcbo,'Pointer','circle'); 
@@ -207,12 +224,10 @@
         set(huvmat,'UserData',UvData)
         list_str=get(hhuvmat.list_object_1,'String');
-        list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style];
-        if ~isequal(list_str{end},'...')
-             list_str{end+1}='...';
-        end
+        list_str{IndexObj}=[num2str(IndexObj) '-' ObjectData.Style]; 
         set(hhuvmat.list_object_1,'String',list_str)
+        list_str{end+1}='...';
         set(hhuvmat.list_object_2,'String',list_str)
         if strcmp(fig_tag,'view_field')%we are in view_field plot
-              set(hhuvmat.list_object_1,'Value',IndexObj)
+              set(hhuvmat.list_object_1,'Value',IndexObj)% the projection field will be plotted in uvmat frame
         else%we are in uvmat plot
             set(hhuvmat.list_object_2,'Value',IndexObj)
@@ -234,11 +249,11 @@
         if ~(isequal(coord_value,1)||isequal(coord_value,3)); %active only with no transform or px (no phys)
             set(hhuvmat.transform_fct,'Value',1)
+            uvmat('transform_fct_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
             set(hhuvmat.FixedLimits,'Value',0)% put FixedLimits option to 'off'
             set(hhuvmat.FixedLimits,'BackgroundColor',[0.7 0.7 0.7])
-            uvmat('run0_Callback',hObject,eventdata,hhuvmat); %file input with xml reading  in uvmat
             return
         end
         Coord=get(h_ListCoord,'String');
-        data=read_geometry_calib(Coord)%transform char cell to numbers
+        data=read_geometry_calib(Coord);%transform char cell to numbers
         ind_range=10;%range of research around each existing point
         test_newpoint=1;
@@ -255,9 +270,9 @@
              val=get(h_ListCoord,'Value');
              if length(Coord)>=val
-                 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord))% push the list forward beyond the current point
+                 Coord(val+1:length(Coord)+1)=Coord(val:length(Coord));% push the list forward beyond the current point
              end
              Coord{val}=strline;
              set(h_ListCoord,'String',Coord)
-             set(h_ListCoord,'Value',val+1)
+            % set(h_ListCoord,'Value',val+1)
              data=read_geometry_calib(Coord);%transform char cell to numbers
              XCoord=data.Coord(:,4);
@@ -274,9 +289,12 @@
         hhh=findobj('Tag','calib_marker');%look for handle of point marker (circle)
         if ~isempty(hhh)
-            set(hhh,'XData',xy(1,1))
-            set(hhh,'YData',xy(1,2))
+            set(hhh,'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range])
         else
-            line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',20);
-        end
+            rectangle('Curvature',[1 1],...
+                  'Position',[xy(1,1)-ind_range/2 xy(1,2)-ind_range/2 ind_range ind_range],'EdgeColor','m',...
+                  'LineStyle','-','Tag','calib_marker');
+           % line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','calib_marker','LineStyle','.','Marker','o','MarkerSize',ind_range);
+        end
+        AxeData.Drawing='calibration';
     end
 end
@@ -296,11 +314,5 @@
 end   
 
-%create ruler
-if test_ruler
-    UvData.RulerCoord(1,1)=xy(1,1);
-    UvData.RulerCoord(1,2)=xy(1,2);
-    UvData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler');
-    set(huvmat,'UserData',UvData)
-end
+
 set(haxes,'UserData',AxeData);
 
