Changeset 612
- Timestamp:
- Apr 18, 2013, 9:09:13 PM (12 years ago)
- Location:
- trunk/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/read_civdata.m
r594 r612 76 76 %% reading data 77 77 Data=nc2struct(filename,'ListGlobalAttribute','CivStage'); 78 if isfield(Data,'Txt') 79 erromsg=['error in read_civdata: ' Data.Txt]; 80 return 81 end 78 82 [varlist,role,VelTypeOut]=varcivx_generator(ProjModeRequest,VelType,Data.CivStage); 79 83 if isempty(varlist) -
trunk/src/series.m
r611 r612 69 69 set(0,'Unit','points') 70 70 ScreenSize=get(0,'ScreenSize');%size of the current screen 71 Width= 750;% prefered width of the GUI in points (1/72 inch)72 Height= 520;71 Width=900;% prefered width of the GUI in points (1/72 inch) 72 Height=624; 73 73 %adjust to screen size (reduced by a min margin) 74 74 RescaleFactor=min((ScreenSize(3)-80)/Width,(ScreenSize(4)-80)/Height); -
trunk/src/uigetfile_uvmat.m
r611 r612 50 50 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.89 0.9 0.08],'tag','titlebox','Max',2,'BackgroundColor',[1 1 1],... 51 51 'String',InputDir,'FontUnits','points','FontSize',12,'FontWeight','bold'); 52 % uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.85 0.5 0.03],'BackgroundColor',BackgroundColor,... 53 % 'String','first modified:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right'); 54 % uicontrol('Style','text','Units','normalized', 'Position', [0.05 0.82 0.5 0.03],'BackgroundColor',BackgroundColor,... 55 % 'String','last modified:','FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','right'); 56 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.08 0.9 0.66], 'Callback', @(src,event)view_file(option,src,event),'tag','list',... 52 uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.75 0.1 0.07],... 53 'String','<--','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@backward); 54 uicontrol('Style','togglebutton','Units','normalized', 'Position', [0.75 0.75 0.2 0.04],'tag','check_date','Callback',@dates_Callback,... 55 'String','dates','FontUnits','points','FontSize',12,'FontWeight','bold'); 56 uicontrol('Style','text','Units','normalized', 'Position', [0.4 0.8 0.35 0.03],'BackgroundColor',BackgroundColor,... 57 'String','sort: ','FontUnits','points','FontSize',12,'FontWeight','bold','HorizontalAlignment','right'); 58 uicontrol('Style','popupmenu','Units','normalized', 'Position', [0.75 0.8 0.2 0.04],'tag','sort_option','Callback',@refresh_GUI,'Visible','off',... 59 'String',{'name';'date'},'FontUnits','points','FontSize',12,'FontWeight','bold'); 60 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.08 0.9 0.66], 'Callback', @(src,event)list_Callback(option,src,event),'tag','list',... 57 61 'FontUnits','points','FontSize',12); 58 62 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.005 0.2 0.07],'Callback',@(src,event)close(option,src,event),... … … 66 70 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 67 71 else %put a title and additional pushbuttons 68 uicontrol('Style','text','Units','normalized', 'Position', [0.15 0.75 0. 80.03],'BackgroundColor',BackgroundColor,...72 uicontrol('Style','text','Units','normalized', 'Position', [0.15 0.75 0.6 0.03],'BackgroundColor',BackgroundColor,... 69 73 'String',title,'FontUnits','points','FontSize',12,'FontWeight','bold','ForegroundColor','blue','HorizontalAlignment','left'); 70 uicontrol('Style','pushbutton','Tag','backward','Units','normalized','Position',[0.05 0.75 0.1 0.07],... 71 'String','<--','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@backward); 74 72 75 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.4 0.005 0.2 0.07],... 73 76 'String','Home','FontWeight','bold','FontUnits','points','FontSize',12,'Callback',@home_dir); … … 95 98 htitlebox=findobj(hfig,'tag','titlebox'); 96 99 DirName=get(htitlebox,'String'); 97 ListFiles=list_files(DirName);% list the directory content 100 hsort_option=findobj(hfig,'tag','sort_option'); 101 sort_option='name'; 102 if strcmp(get(hsort_option,'Visible'),'on')&& isequal(get(hsort_option,'Value'),2) 103 sort_option='date'; 104 end 105 hcheck_date=findobj(hfig,'tag','check_date'); 106 ListFiles=list_files(DirName,get(hcheck_date,'Value'),sort_option);% list the directory content 98 107 hlist=findobj(hfig,'tag','list');% find the list object 99 108 set(hlist,'String',ListFiles) … … 107 116 set(hlist,'Value',Value) 108 117 109 if strcmp(get(hfig,'Tag'),'status_display') 110 118 if strcmp(get(hfig,'Tag'),'status_display') 111 119 hseries=findobj(allchild(0),'tag','series'); 112 120 hstatus=findobj(hseries,'tag','status_display'); … … 115 123 if isfield(StatusData,'TimeStart') 116 124 TimeStart=StatusData.TimeStart; 117 end 118 119 120 125 end 121 126 hlist=findobj(hfig,'tag','list'); 122 % OutputDir=get(hfig,'UserData');123 124 127 testrecent=0; 125 128 datnum=zeros(numel(ListDisplay),1); … … 172 175 %------------------------------------------------------------------------ 173 176 % --- launched by selecting an item on the file list 174 function view_file(option,hObject,event) 177 function dates_Callback(hObject,event) 178 %------------------------------------------------------------------------ 179 hfig=get(hObject,'parent'); 180 hsort_option=findobj(hfig,'tag','sort_option'); 181 if get(hObject,'Value') 182 set(hsort_option,'Visible','on') 183 set(hsort_option,'Value',2) 184 else 185 set(hsort_option,'Visible','off') 186 end 187 refresh_GUI(hObject,[]) 188 189 %------------------------------------------------------------------------ 190 % --- launched by selecting an item on the file list 191 function list_Callback(option,hObject,event) 175 192 %------------------------------------------------------------------------ 176 193 list=get(hObject,'String'); … … 180 197 DirName=get(htitlebox,'String'); 181 198 SelectName=regexprep(list{index},'^\+/','');% remove the +/ used to mark dir 199 ind_dot=regexp(SelectName,'\s*\.\.\.');%remove what is beyond '...' 200 if ~isempty(ind_dot) 201 SelectName=SelectName(1:ind_dot-1); 202 end 182 203 if strcmp(SelectName,'..')% the upward dir option has been selected 183 204 FullSelectName=fileparts(DirName); 184 205 else 185 %ind_dot=regexp(SelectName,'\.\.\.');186 % if ~isempty(ind_dot)187 % SelectName=SelectName(1:ind_dot-1);188 % end189 206 FullSelectName=fullfile(DirName,SelectName); 190 207 end 191 208 if exist(FullSelectName,'dir')% a directory has been selected 192 % ListFiles=dir(FullSelectName);193 % ListDisplay=cell(numel(ListFiles),1);194 % for ilist=2:numel(ListDisplay)% suppress the first line '.'195 % ListDisplay{ilist-1}=ListFiles(ilist).name;196 % end197 % set(hObject,'Value',1)198 % set(hObject,'String',ListDisplay)199 % if strcmp(selectname,'..')200 % FullSelectName=fileparts(fileparts(FullSelectName));201 % end209 % ListFiles=dir(FullSelectName); 210 % ListDisplay=cell(numel(ListFiles),1); 211 % for ilist=2:numel(ListDisplay)% suppress the first line '.' 212 % ListDisplay{ilist-1}=ListFiles(ilist).name; 213 % end 214 % set(hObject,'Value',1) 215 % set(hObject,'String',ListDisplay) 216 % if strcmp(selectname,'..') 217 % FullSelectName=fileparts(fileparts(FullSelectName)); 218 % end 202 219 hbackward=findobj(hfig,'Tag','backward'); 203 220 set(hbackward,'UserData',DirName); %store the current dir for future backward action 204 ListFiles=list_files(FullSelectName); 221 hsort_option=findobj(hfig,'tag','sort_option'); 222 sort_option='name';%default 223 if strcmp(get(hsort_option,'Visible'),'on')&& isequal(get(hsort_option,'Value'),2) 224 sort_option='date'; 225 end 226 hcheck_date=findobj(hfig,'tag','check_date'); 227 ListFiles=list_files(FullSelectName,get(hcheck_date,'Value'),sort_option);% list the directory content 205 228 set(hObject,'Value',1) 206 229 set(hObject,'String',ListFiles) … … 212 235 elseif strcmp(FileType,'xml') 213 236 editxml(FullSelectName) 214 237 elseif strcmp(FileType,'figure') 215 238 open(FullSelectName) 216 239 else … … 218 241 switch option 219 242 case 'browser' 220 set(htitlebox,'String',FullSelectName);221 uiresume(hfig)243 set(htitlebox,'String',FullSelectName); 244 uiresume(hfig) 222 245 case 'status_display' 223 uvmat(FullSelectName);246 uvmat(FullSelectName); 224 247 end 225 248 end … … 228 251 %------------------------------------------------------------------------- 229 252 % list the content of a directory 230 function [ListFiles,ListDates]=list_files(DirName)253 function ListFiles=list_files(DirName,check_date,sort_option) 231 254 %------------------------------------------------------------------------- 232 255 ListStruct=dir(DirName);% get structure of the current directory 233 256 if numel(ListStruct)<1 % case of empty dir 234 257 ListFiles={}; 235 ListDates={};236 258 return 237 259 end 238 % if strcmp(ListStruct(1).name,'.')239 % ListStruct(1)=[];%removes the first line ='.'240 % end241 260 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 242 261 ListFiles=ListCells(1,:);%list of file names 243 262 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 244 ListDates=cell2mat(ListCells(5,:));%list of numerical dates245 263 ListFiles(check_dir)=regexprep(ListFiles(check_dir),'^.+','+/$0');% put '+/' in front of dir name display 246 ListDates(check_dir)=0; % we set the dir dates to 0 247 [tild,index_sort]=sort(check_dir,2,'descend');% put the dir first in the list 248 ListFiles=ListFiles(index_sort);% list of names sorted by alaphabetical order and dir and file 249 ListDates=ListDates(index_sort);% sort the corresponding dates 264 if strcmp(sort_option,'date') 265 ListDates=cell2mat(ListCells(5,:));%list of numerical dates 266 ListDates(check_dir)=max(ListDates(~check_dir))+1000; % we set the dir in front 267 [tild,index_sort]=sort(ListDates,2,'descend');% sort files by chronological order, recent first, put the dir first in the list 268 else 269 [tild,index_sort]=sort(check_dir,2,'descend');% put the dir first in the list 270 end 271 ListFiles=ListFiles(index_sort);% list of names sorted by alaphabetical order and dir and file 250 272 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) 251 check_keep=cellfun('isempty', cell_remove); 273 check_keep=cellfun('isempty', cell_remove); 252 274 ListFiles=[{'+/..'} ListFiles(check_keep)]; 253 ListDates=[0 ListDates(check_keep)]; 275 if check_date 276 ListDateString=ListCells(2,:);%list of file dates 277 ListDateString(check_dir)={''}; 278 ListDateString=ListDateString(index_sort);% sort the corresponding dates 279 ListDateString=[{''} ListDateString(check_keep)]; 280 ListFiles=[ListFiles; ListDateString]; 281 ListFiles=cell2tab(ListFiles','...'); 282 end 254 283 255 284 %------------------------------------------------------------------------ … … 258 287 %------------------------------------------------------------------------ 259 288 DirName=pwd; 260 ListFiles=list_files(DirName);% list the directory content261 289 hfig=get(hObject,'parent'); 290 sort_option='name';%default 291 hsort_option=findobj(hfig,'tag','sort_option'); 292 if strcmp(get(hsort_option,'Visible'),'on')&& isequal(get(hsort_option,'Value'),2) 293 sort_option='date'; 294 end 295 hcheck_date=findobj(hfig,'tag','check_date'); 296 ListFiles=list_files(DirName,get(hcheck_date,'Value'),sort_option);% list the directory content 262 297 htitlebox=findobj(hfig,'Tag','titlebox'); 263 298 set(htitlebox,'String',DirName)% record the new dir name -
trunk/src/view_field.m
r599 r612 679 679 680 680 %------------------------------------------------------------------- 681 function VecScale_Callback(hObject, eventdata, handles) 682 %------------------------------------------------------------------- 683 set(handles.FixVec,'Value',1); 684 set(handles.FixVec,'BackgroundColor',[1 1 0]) 681 function num_VecScale_Callback(hObject, eventdata, handles) 682 %------------------------------------------------------------------- 683 set(handles.CheckFixVectors,'Value',1); 685 684 update_plot(handles) 686 685
Note: See TracChangeset
for help on using the changeset viewer.