Changeset 296
- Timestamp:
- Nov 22, 2011, 1:39:47 PM (13 years ago)
- Location:
- trunk/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r292 r296 102 102 103 103 %% load the list of previously browsed files in menu Open 104 dir_perso=prefdir; % path to the directory .matlab for personal data 105 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab 106 if exist(profil_perso,'file') 107 h=load (profil_perso); 108 if isfield(h,'MenuFile') 109 set(handles.MenuFile_1,'Label',h.MenuFile{1}) 110 %set(handles.MenuFile_1,'Label',h.MenuFile_1); 111 end 112 % if isfield(h,'MenuFile_2') 113 % set(handles.MenuFile_2,'Label',h.MenuFile_2); 114 % end 115 % if isfield(h,'MenuFile_3') 116 % set(handles.MenuFile_3,'Label',h.MenuFile_3); 117 % end 118 % if isfield(h,'MenuFile_4') 119 % set(handles.MenuFile_4,'Label',h.MenuFile_4); 120 % end 121 % if isfield(h,'MenuFile_5') 122 % set(handles.MenuFile_5,'Label',h.MenuFile_5); 123 % end 104 dir_perso=prefdir; % path to the directory .matlab for personal data 105 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');% personal data file uvmauvmat_perso.mat' in .matlab 106 if exist(profil_perso,'file') 107 h=load (profil_perso); 108 if isfield(h,'MenuFile') 109 for ifile=1:min(length(h.MenuFile),5) 110 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});']) 111 end 112 end 124 113 end 125 114 … … 202 191 set(handles.CheckPatch2,'Value',1) 203 192 enable_patch2(handles,1) 204 set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0])193 % set(handles.frame_subdirciv2,'BackgroundColor',[1 1 0]) 205 194 set(handles.ListPairCiv2,'Enable','On') 206 195 enable_pair1(handles,'off') … … 1001 990 end 1002 991 set(handles.ListPairCiv1,'UserData',displ_num); 1003 find_netcpair_civ1( hObject, eventdata,handles)1004 find_netcpair_civ2(h Object, eventdata, handles)992 find_netcpair_civ1( handles) 993 find_netcpair_civ2(handles) 1005 994 1006 995 %------------------------------------------------------------------------ -
trunk/src/mouse_down.m
r292 r296 36 36 hcurrentfig=hObject;%usual plot 37 37 end 38 39 currentfig_pos=get(hcurrentfig,'Position');%position of the GUI series (in pixels)40 38 set(hcurrentfig,'Units','pixels') 39 GUI_pos=get(hcurrentfig,'Position');%position of the GUI series (in pixels) 40 set(hcurrentfig,'Units','normalized') 41 41 hhcurrentfig=guidata(hcurrentfig); 42 42 test_zoom=get(hhcurrentfig.CheckZoom,'Value');%test for zoom action, first priority … … 71 71 xy=[];%default 72 72 xy_fig=get(hObject,'CurrentPoint');% current point of the current figure (gcbo) 73 hchild =get(hObject,'Children');%handles of all objects in the current figure73 hchildren=get(hObject,'Children');%handles of all objects in the current figure 74 74 haxes=[]; 75 75 76 76 %% loop on all the objects in the current figure (selected by the last mouse click) 77 %CurrentOrigin=get(hObject,'CurrentPoint') 78 for ichild=1:length(hchild) 79 obj_pos=get(hchild(ichild),'Position');%position of the object 77 output_str=''; 78 for ichild=1:length(hchildren) 79 hchild=hchildren(ichild); %handle of the current object 80 obj_pos=get(hchild,'Position');%position of the object 80 81 if xy_fig(1) >=obj_pos(1) & xy_fig(2) >= obj_pos(2)& xy_fig(1) <=obj_pos(1)+obj_pos(3) & xy_fig(2) <= obj_pos(2)+obj_pos(4); 81 htype=get(hchild(ichild),'Type');%type of object child of the current figure 82 %if the mouse is over an axis, look at the data 83 if isequal(htype,'axes') 84 y_lim=get(hchild(ichild),'YLim'); 85 x_lim=get(hchild(ichild),'XLim'); 86 haxes=hchild(ichild); 87 xy=get(haxes,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 88 if xy(1,1)>x_lim(1) && xy(1,1)<x_lim(2) && xy(1,2)>y_lim(1) && xy(1,2)<y_lim(2) 89 AxeData=get(haxes,'UserData');% data attached to the axis 90 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin 91 if test_edit_vect && ~isequal(tag_obj,'proj_object') & ~test_create 92 ivec=[]; 93 FigData=get(hcurrentfig,'UserData'); 94 tagaxes=get(haxes,'tag'); 95 if isfield(FigData,tagaxes) 96 eval(['Field=FigData.' tagaxes ';']) 97 [CellVarIndex,NbDim,VarType]=find_field_indices(Field);%analyse the physical fields contained in Field 98 for icell=1:numel(CellVarIndex)%look for all physical fields 99 if NbDim(icell)==2 % select 2D field 100 if isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data 101 eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';']) 102 eval(['Y=Field.' Field.ListVarName{VarType{icell}.coord_y} ';']) 103 flag_vec=(X<(xy(1,1)+Field.Mesh/4) & X>(xy(1,1)-Field.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 104 (Y<(xy(1,2)+Field.Mesh/4) & Y>(xy(1,2)-Field.Mesh/4));%f 105 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 82 htype=get(hchild,'Type');%type of object child of the current figure 83 84 switch htype 85 %if the mouse is over an axis, look at the data 86 case 'axes' 87 y_lim=get(hchild,'YLim'); 88 x_lim=get(hchild,'XLim'); 89 haxes=hchild; 90 xy=get(hchild,'CurrentPoint');%xy(1,1),xy(1,2): current x,y positions in axes coordinates 91 if xy(1,1)>x_lim(1) && xy(1,1)<x_lim(2) && xy(1,2)>y_lim(1) && xy(1,2)<y_lim(2) 92 AxeData=get(hchild,'UserData');% data attached to the axis 93 AxeData.CurrentOrigin=[xy(1,1) xy(1,2)];% The current point set by the mouse becomes the current origin 94 if test_edit_vect && ~isequal(tag_obj,'proj_object') & ~test_create 95 ivec=[]; 96 FigData=get(hcurrentfig,'UserData'); 97 tagaxes=get(hchild,'tag'); 98 if isfield(FigData,tagaxes) 99 eval(['Field=FigData.' tagaxes ';']) 100 [CellVarIndex,NbDim,VarType]=find_field_indices(Field);%analyse the physical fields contained in Field 101 for icell=1:numel(CellVarIndex)%look for all physical fields 102 if NbDim(icell)==2 % select 2D field 103 if isfield(Field,'Mesh') && ~isempty(Field.Mesh)&& ~isempty(VarType{icell}.coord_x) && ~isempty(VarType{icell}.coord_y)%case of unstructured data 104 eval(['X=Field.' Field.ListVarName{VarType{icell}.coord_x} ';']) 105 eval(['Y=Field.' Field.ListVarName{VarType{icell}.coord_y} ';']) 106 flag_vec=(X<(xy(1,1)+Field.Mesh/4) & X>(xy(1,1)-Field.Mesh/4)) & ...%flagx=1 for the vectors with x position selected by the mouse 107 (Y<(xy(1,2)+Field.Mesh/4) & Y>(xy(1,2)-Field.Mesh/4));%f 108 ivec=find(flag_vec,1);% search the (first) selected vector index ivec 109 end 106 110 end 107 111 end 108 112 end 109 113 end 114 else 115 hchild=[];%mouse out of axes 110 116 end 111 else 112 haxes=[];%mouse out of axes 113 end 114 break 115 elseif isequal(get(hObject,'SelectionType'),'alt') && isequal(htype,'uicontrol') && isequal(get(hchild(ichild),'Visible'),'on') && ~isequal(get(hchild(ichild),'tag'),'frame_object')&&... 116 ~isequal(get(hchild(ichild),'tag'),'list_object_2') && ~isequal(get(hchild(ichild),'tag'),'list_object_1') 117 msg_pos(1:2)=currentfig_pos(1:2)+obj_pos(1:2).*currentfig_pos(3:4); 118 msgbox_uvmat(['uicontrol: ' get(hchild(ichild),'Tag')],'',get(hchild(ichild),'String'),msg_pos) 119 break 120 end 121 end 122 end 123 117 break 118 case 'uicontrol' %if the mouse is over a uicontrol, duplicate the display in an editable zoom window 119 if isequal(get(hObject,'SelectionType'),'alt') && isequal(get(hchild,'Visible'),'on') && ~isequal(get(hchild,'tag'),'frame_object')&&... 120 ~isequal(get(hchild,'tag'),'list_object_2') && ~isequal(get(hchild,'tag'),'list_object_1') 121 if strcmp(get(hchild,'Visible'),'on') 122 msg_pos(1:2)=GUI_pos(1:2)+obj_pos(1:2).*GUI_pos(3:4); 123 output_str=msgbox_uvmat(['uicontrol: ' get(hchild,'Tag')],'',get(hchild,'String'),msg_pos); 124 break 125 end 126 end 127 case 'uipanel' 128 panel_pos=obj_pos;%position of the panel 129 hhchildren=get(hchild,'Children');%handles of all objects in the current GUI 130 %% loop on all the objects in the current figure (selected by the last mouse click) 131 for iichild=1:length(hhchildren) 132 hchild=hhchildren(iichild); 133 rel_pos=get(hchild,'Position');%position of the object relative to the uipanel 134 obj_pos(1:2)=panel_pos(1:2)+rel_pos(1:2).*panel_pos(3:4); 135 obj_pos(3:4)=panel_pos(3:4).*rel_pos(3:4); 136 if numel(obj_pos)>=4 && xy_fig(1) >=obj_pos(1) && xy_fig(2) >= obj_pos(2)&& xy_fig(1) <=obj_pos(1)+obj_pos(3) && xy_fig(2) <= obj_pos(2)+obj_pos(4); 137 htype=get(hchild,'Type');%type of object child of the current figure 138 %if the mouse is over a uicontrol, look at the data 139 if strcmp(htype,'uicontrol') && strcmp(get(hchild,'Visible'),'on') 140 msg_pos(1:2)=GUI_pos(1:2)+obj_pos(1:2).*GUI_pos(3:4); 141 output_str=msgbox_uvmat(['uicontrol: ' get(hchild,'Tag')],'',get(hchild,'String'),msg_pos); 142 break 143 end 144 end 145 end 146 end 147 end 148 end 149 if ~isempty(output_str) 150 set(hObject,'Units','pixels') 151 set(hchild,'String',output_str) 152 end 153 124 154 %% desable object creation and vector editing if NbDim different from 2 125 155 if ~(isfield(AxeData,'NbDim') && isequal(AxeData.NbDim,2)) … … 138 168 AxeData.Drawing='zoom'; %initiate drawing mode 139 169 AxeData.CurrentObject=[];%unselect objects 140 set(h axes,'UserData',AxeData);170 set(hchild,'UserData',AxeData); 141 171 return 142 172 end … … 151 181 AxeData.RulerHandle=line([xy(1,1) xy(1,1)],[xy(1,2) xy(1,2)],'Color','m','Tag','ruler'); 152 182 AxeData.Drawing='ruler'; 153 set(h axes,'UserData',AxeData);183 set(hchild,'UserData',AxeData); 154 184 return 155 185 end … … 219 249 end 220 250 set_object(UvData.Object{IndexObj}) 221 axes(h axes);%set back the current axes haxes251 axes(hchild);%set back the current axes haxes 222 252 testdeform=0; 223 253 set(gcbo,'Pointer','circle'); -
trunk/src/msgbox_uvmat.m
r246 r296 59 59 set(handles.Cancel,'Position',[300 2 60 30]) 60 60 set(handles.Cancel,'FontSize',15) 61 61 62 62 63 % Update handles structure … … 178 179 set(handles.No,'Visible','off') 179 180 end 181 set(handles.figure1,'Units','normalized') 182 set(handles.edit_box,'Units','normalized') 183 180 184 set(handles.figure1,'WindowStyle','modal')% Make% Make the GUI modal 181 185 % UIWAIT makes msgbox_uvmat wait for user response (see UIRESUME) -
trunk/src/uvmat.m
r295 r296 268 268 if exist(profil_perso,'file') 269 269 h=load (profil_perso); 270 if isfield(h,'MenuFile_1') 271 set(handles.MenuFile_1,'Label',h.MenuFile_1); 272 set(handles.MenuFile_1_1,'Label',h.MenuFile_1); 273 end 274 if isfield(h,'MenuFile_2') 275 set(handles.MenuFile_2,'Label',h.MenuFile_2); 276 set(handles.MenuFile_2_1,'Label',h.MenuFile_2); 277 end 278 if isfield(h,'MenuFile_3') 279 set(handles.MenuFile_3,'Label',h.MenuFile_3); 280 set(handles.MenuFile_3_1,'Label',h.MenuFile_3); 281 end 282 if isfield(h,'MenuFile_4') 283 set(handles.MenuFile_4,'Label',h.MenuFile_4); 284 set(handles.MenuFile_4_1,'Label',h.MenuFile_4); 285 end 286 if isfield(h,'MenuFile_5') 287 set(handles.MenuFile_5,'Label',h.MenuFile_5); 288 set(handles.MenuFile_5_1,'Label',h.MenuFile_5); 270 if isfield(h,'MenuFile') 271 for ifile=1:min(length(h.MenuFile),5) 272 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',h.MenuFile{ifile});']) 273 eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',h.MenuFile{ifile});']) 274 end 289 275 end 290 276 if isfield(h,'transform_fct') && iscell(h.transform_fct) … … 312 298 set(handles.transform_fct,'UserData',fct_handle)% store the list of path in UserData of ACTION 313 299 314 315 316 300 %% case of an input argument for uvmat 317 301 testinputfield=0; … … 446 430 % display the selected field and related information 447 431 display_file_name(hObject, eventdata, handles,fileinput) 448 449 %update list of recent files in the menubar450 MenuFile_1=fileinput;451 MenuFile_2=get(handles.MenuFile_1,'Label');452 MenuFile_3=get(handles.MenuFile_2,'Label');453 MenuFile_4=get(handles.MenuFile_3,'Label');454 MenuFile_5=get(handles.MenuFile_4,'Label');455 set(handles.MenuFile_1,'Label',MenuFile_1)456 set(handles.MenuFile_2,'Label',MenuFile_2)457 set(handles.MenuFile_3,'Label',MenuFile_3)458 set(handles.MenuFile_4,'Label',MenuFile_4)459 set(handles.MenuFile_5,'Label',MenuFile_5)460 set(handles.MenuFile_1_1,'Label',MenuFile_1)461 set(handles.MenuFile_2_1,'Label',MenuFile_2)462 set(handles.MenuFile_3_1,'Label',MenuFile_3)463 set(handles.MenuFile_4_1,'Label',MenuFile_4)464 set(handles.MenuFile_5_1,'Label',MenuFile_5)465 dir_perso=prefdir;466 profil_perso=fullfile(dir_perso,'uvmat_perso.mat');467 if exist(profil_perso,'file')468 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-append'); %store the file names for future opening of uvmat469 else470 txt=ver('MATLAB');471 Release=txt.Release;472 relnumb=str2double(Release(3:4));473 if relnumb >= 14474 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5','-V6'); %store the file names for future opening of uvmat475 else476 save (profil_perso,'MenuFile_1','MenuFile_2','MenuFile_3','MenuFile_4', 'MenuFile_5'); %store the file names for future opening of uvmat477 end478 end479 432 480 433 % ----------------------------------------------------------------------- … … 909 862 drawnow 910 863 set_scan_options(hObject, eventdata, handles) 864 865 %% update list of recent files in the menubar 866 MenuFile=[{FileName};get(handles.MenuFile_1,'Label');get(handles.MenuFile_2,'Label');... 867 get(handles.MenuFile_3,'Label');get(handles.MenuFile_4,'Label');get(handles.MenuFile_5,'Label')]; 868 869 for ifile=1:length(MenuFile) 870 eval(['set(handles.MenuFile_' num2str(ifile) ',''Label'',MenuFile{ifile});']) 871 eval(['set(handles.MenuFile_' num2str(ifile) '_1,''Label'',MenuFile{ifile});']) 872 end 873 dir_perso=prefdir; 874 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 875 if exist(profil_perso,'file') 876 save (profil_perso,'MenuFile','-append'); %store the file names for future opening of uvmat 877 else 878 save (profil_perso,'MenuFile','-V6'); %store the file names for future opening of uvmat 879 end 911 880 912 881 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.