Index: trunk/src/uvmat.m
===================================================================
--- trunk/src/uvmat.m	(revision 251)
+++ trunk/src/uvmat.m	(revision 252)
@@ -230,4 +230,6 @@
 set(hObject,'WindowButtonUpFcn',{'mouse_up',handles}) 
 set(hObject,'DeleteFcn',{@closefcn})%
+set(handles.list_object_1,'ButtonDownFcn',{@list_object_1_Callback,handles})% allows activation of lis_object_1_callback with right mouse click
+set(handles.list_object_2,'ButtonDownFcn',{@list_object_2_Callback,handles})
 
 %% refresh projection plane
@@ -1676,4 +1678,5 @@
 function runplus_Callback(hObject, eventdata, handles)
 %-------------------------------------------------------------------
+eventdata
 set(handles.runplus,'BackgroundColor',[1 1 0])%paint the command button in yellow
 drawnow
@@ -2570,8 +2573,15 @@
 else
     % create a default projection
-%     UvData.Object{1}.ProjMode='projection';%main plotting plane
-%     UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
-%     set(handles.list_object_1,'Value',1);
-%     set(handles.list_object_1,'String',{''});
+    UvData.Object{1}.ProjMode='projection';%main plotting plane
+    UvData.Object{1}.DisplayHandle_uvmat=[]; %plane not visible in uvmat
+    set(handles.list_object_1,'Value',1);
+    list_object=get(handles.list_object_1,'String')
+    if isempty(list_object)
+        list_object={''};
+    elseif ~isempty(list_object{1})
+        list_object=[{''};list_object];
+    end
+    set(handles.list_object_1,'String',list_object);
+    set(handles.list_object_2,'String',list_object);
 end
 % if ~isfield(UvData.Object{1},'plotaxes')
@@ -4295,12 +4305,6 @@
 list_str=get(handles.list_object_1,'String');
 IndexObj=get(handles.list_object_1,'Value');
-str_1=list_str{IndexObj};
-% val_2=get(handles.list_object_2,'Value');
-% str_2=get(handles.list_object_2,'String');
-% if isequal(val_2,IndexObj)% if the first selection is equal to the second, it will suppress the second
-%     set(handles.list_object_2,'Value',numel(str_2))%select the end of the list ('...')
-%     list_object_2_Callback(hObject, eventdata, handles)
-% end
-update_object(handles,IndexObj,1,str_1)
+%IndexObj(2)=get(handles.list_object_2,'Value');
+update_object(handles,IndexObj,1,list_str{IndexObj})
 
 %------------------------------------------------------------------------
@@ -4310,5 +4314,7 @@
 list_str=get(handles.list_object_2,'String');
 IndexObj=get(handles.list_object_2,'Value');
-if ischar(list_str) || isempty(list_str{IndexObj})% || strcmp(list_str{IndexObj},'...')
+%IndexObj(2)=get(handles.list_object_2,'Value')-1;
+% if no projection object is selected, close view_field
+if ischar(list_str) || isempty(list_str{IndexObj})
     hview_field=findobj(allchild(0),'Tag','view_field');
     if ~isempty(hview_field)
@@ -4320,5 +4326,10 @@
     end
 else
-    update_object(handles,IndexObj,2,list_str{IndexObj})
+    if isequal(get(handles.uvmat,'SelectionType'),'alt')
+        option=4;%will show object properties on the GUI set_object
+    else
+        option=2; % just update the projection
+    end
+    update_object(handles,IndexObj,option,list_str{IndexObj})   
 end
 
@@ -4327,8 +4338,12 @@
 %------------------------------------------------------------------------
 UvData=get(handles.uvmat,'UserData');%read UvData properties stored on the uvmat interface
-if numel(UvData.Object)<IndexObj;
+if numel(UvData.Object)<max(IndexObj);
     return
 end
+% if option==1 ||option==3
 ObjectData=UvData.Object{IndexObj};
+% else
+%    ObjectData=UvData.Object{IndexObj}; 
+% end
 ObjectData.Name=ObjectName;
 if isequal(get(handles.edit_object,'Value'),1)
@@ -4352,12 +4367,15 @@
     end
 end
-hset_object=set_object(ObjectData,[],ZBounds);% call the set_object interface,
-
-% %project the current field on the object and plot it
-ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
-if option==1%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
+
+if option==3 ||option==4% right mouse selection, show the GUI set_object:
+    hset_object=set_object(ObjectData,[],ZBounds);
+end
+
+%project on the selected object and update the corresponding plot
+hview_field=findobj(allchild(0),'tag','view_field');
+% PlotHandles=guidata(hview_field);
+if option==1 ||  option==3%length(UvData.Object)>= IndexObj && isfield(UvData.Object{IndexObj},'plotaxes')&& ishandle(UvData.Object{IndexObj}.plotaxes)
     PlotHandles=handles;
 else
-    hview_field=findobj(allchild(0),'tag','view_field');
     if isempty(hview_field)
         hview_field=view_field;
@@ -4365,7 +4383,15 @@
     PlotHandles=guidata(hview_field);
 end
-%plot_field(ProjData,PlotHandles.axes3,PlotHandles);
-set(handles.uvmat,'UserData',UvData)
-hother=findobj('Tag','proj_object');%find all the proj objects
+if option==1 ||option==2% lefet mouse selection, peroject the field:
+    ProjData= proj_field(UvData.Field,ObjectData);%project the current interface field on ObjectData
+    plot_field(ProjData,PlotHandles.axes3,read_plot_param(PlotHandles));%read plotting parameters on the uvmat interfacPlotHandles);
+    UvData.Object=update_obj(UvData,IndexObj,[]);
+    set(handles.uvmat,'UserData',UvData)
+end
+
+
+% set(handles.uvmat,'UserData',UvData)
+hother=[findobj(handles.axes3,'Tag','proj_object') ;findobj(PlotHandles.axes3,'Tag','proj_object')] ;%find all the proj objects
+hother=[hother ;findobj(handles.axes3,'Tag','DeformPoint'); findobj(PlotHandles.axes3,'Tag','DeformPoint')];
 for iobj=1:length(hother)
     if isequal(get(hother(iobj),'Type'),'rectangle')||isequal(get(hother(iobj),'Type'),'patch')
@@ -4383,7 +4409,4 @@
     set(hother(iobj),'Selected','off')
 end
-hother=findobj('Tag','DeformPoint');
-set(hother,'Color','b');
-set(hother,'Selected','off')
 if isfield(ObjectData,'DisplayHandle_uvmat')
     if ishandle(ObjectData.DisplayHandle_uvmat)
@@ -4417,8 +4440,5 @@
         end
     end
-    %     end
-end
-% pause(0.1)
-figure(hset_object)%put set_object in front
+end
 
 %------------------------------------------------------
