Index: trunk/src/uigetfile_uvmat.m
===================================================================
--- trunk/src/uigetfile_uvmat.m	(revision 609)
+++ trunk/src/uigetfile_uvmat.m	(revision 610)
@@ -12,14 +12,23 @@
 function fileinput=uigetfile_uvmat(title,InputName)
 fileinput=''; %default file selection
-if strcmp(title,'status')
-    option='status';
+if strcmp(title,'status_display')
+    option='status_display';
 else
     option='browser';
 end
-if exist(InputName,'file')||exist(InputName,'dir')
+if exist(InputName,'dir')
+    InputDir=InputName;
+      InputFileName='';
+elseif exist(InputName,'file')
     [InputDir,InputFileName,Ext]=fileparts(InputName);
-    InputFileName=[InputFileName Ext];
+    if isempty(InputFileName)% if InputName is already the root
+        InputFileName=InputDir;
+        if  ~isempty(strcmp (computer, {'PCWIN','PCWIN64'}))%case of Windows systems
+            InputDir=[InputDir '\'];% append '\' for a correct action of dir
+            InputFileName=[InputFileName '\'];
+        end
+    end
     if isdir(InputName)
-        InputFileName=['+/' InputFileName];
+        InputFileName=['+/' InputFileName Ext];
     end
 else
@@ -45,5 +54,5 @@
         'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',12);
     %set(hrefresh,'UserData',StatusData)
-    if strcmp(option,'status') %put a run advancement display
+    if strcmp(option,'status_display') %put a run advancement display
         set(hfig,'DeleteFcn',@stop_status)
         uicontrol('Style','frame','Units','normalized', 'Position',[0.05 0.81 0.01 0.05],'BackgroundColor',[1 0 0],'tag','waitbar');
@@ -59,10 +68,96 @@
     drawnow
 end
-refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName)  
-if ~strcmp(option,'status')  
+refresh_GUI(findobj(hfig,'Tag','refresh'),InputFileName)% refresh the list of content of the current dir  
+if ~strcmp(option,'status_display')  
     uiwait(hfig)
-end
-fileinput=get(hfig,'UserData');% retrieve the input file selection
-delete(hfig)
+    fileinput=get(hfig,'UserData');% retrieve the input file selection
+    delete(hfig)
+end
+
+
+
+%------------------------------------------------------------------------   
+% --- launched by refreshing the display figure
+function refresh_GUI(hObject,InputFileName)
+%------------------------------------------------------------------------
+if ~exist('InputFileName','var')
+    InputFileName='';
+end
+hfig=get(hObject,'parent');
+DirName=get(hfig,'UserData');
+ListFiles=list_files(DirName);% list the directory content
+hlist=findobj(hfig,'tag','list');% find the list object
+set(hlist,'String',ListFiles)
+Value=[];
+if ~isempty(InputFileName)
+    Value=find(strcmp(InputFileName,ListFiles));
+end
+if isempty(Value)
+    Value=1;
+end
+set(hlist,'Value',Value)
+
+if strcmp(get(hfig,'Tag'),'status_display')
+    
+    hseries=findobj(allchild(0),'tag','series');
+    hstatus=findobj(hseries,'tag','status_display');
+    StatusData=get(hstatus,'UserData');
+    TimeStart=0;
+    if isfield(StatusData,'TimeStart')
+        TimeStart=StatusData.TimeStart;
+    end
+    
+    
+    htitlebox=findobj(hfig,'tag','titlebox');
+    hlist=findobj(hfig,'tag','list');
+    OutputDir=get(hfig,'UserData');
+    
+    testrecent=0;
+    datnum=zeros(numel(ListDisplay),1);
+    for ilist=1:numel(ListDisplay)
+        ListDisplay{ilist}=ListFiles(ilist).name;
+        if ListFiles(ilist).isdir
+            ListDisplay{ilist}=['/' ListDisplay{ilist}];
+        elseif isfield(ListFiles(ilist),'datenum')
+            datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions
+            testrecent=1;
+            if datnum(ilist)<TimeStart
+                ListDisplay{ilist}=[ListDisplay{ilist} '  --OLD--'];
+            end
+        end
+    end
+    
+    %% Look at date of creation
+    ListDisplay=ListDisplay(datnum~=0);
+    datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
+    
+    NbOutputFile=[];
+    if isempty(datnum)
+        if testrecent
+            message='no result created yet';
+        else
+            message='';
+        end
+    else
+        [first,indfirst]=min(datnum);
+        [last,indlast]=max(datnum);
+        NbOutputFile_str='?';
+        if isfield(StatusData,'NbOutputFile')
+            NbOutputFile=StatusData.NbOutputFile;
+            NbOutputFile_str=num2str(NbOutputFile);
+        end
+        message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification:  ' ListDisplay{indfirst} ' : ' datestr(first)];...
+            ['latest modification:  ' ListDisplay{indlast} ' : ' datestr(last)]};
+    end
+    set(htitlebox,'String', [DirName{1};message])
+    
+    %% update the waitbar
+    hwaitbar=findobj(hfig,'tag','waitbar');
+    if ~isempty(NbOutputFile)
+        BarPosition=get(hwaitbar,'Position');
+        BarPosition(3)=0.9*numel(datnum)/NbOutputFile;
+        set(hwaitbar,'Position',BarPosition)
+    end
+end
 
 %------------------------------------------------------------------------   
@@ -118,116 +213,9 @@
         set(hfig,'UserData',FullSelectName);
         uiresume(hfig)
-            case 'status'
+            case 'status_display'
            uvmat(FullSelectName);
         end
         set(gcbo,'Value',1)
     end
-end
-
-%------------------------------------------------------------------------   
-% --- launched by selecting home
-function home_dir(hObject,event)
-%------------------------------------------------------------------------
-DirName=pwd;
-ListFiles=list_files(DirName);% list the directory content
-hfig=get(hObject,'parent');
-    set(hfig,'UserData',DirName)% record the new dir name
-    htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
-    set(htitlebox,'String',DirName)
-    hlist=findobj(hfig,'tag','list');% find the list object
-set(hlist,'String',ListFiles)
-%------------------------------------------------------------------------
-
-%------------------------------------------------------------------------   
-% --- launched by pressing the backward (<--) button
-function backward(hObject,event)
-%------------------------------------------------------------------------
-PrevDir=get(hObject,'UserData');
-if ~isempty(PrevDir)
-hfig=get(hObject,'parent');
-set(hfig,'UserData',PrevDir)
-htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name
-set(htitlebox,'String',PrevDir)
-refresh_GUI(findobj(hfig,'Tag','refresh'))
-end
-
-%------------------------------------------------------------------------
-
-%------------------------------------------------------------------------   
-% --- launched by refreshing the display figure
-function refresh_GUI(hObject,InputFileName)
-%------------------------------------------------------------------------
-if ~exist('InputFileName','var')
-    InputFileName='';
-end
-hfig=get(hObject,'parent');
-DirName=get(hfig,'UserData');
-ListFiles=list_files(DirName);% list the directory content
-hlist=findobj(hfig,'tag','list');% find the list object
-set(hlist,'String',ListFiles)
-Value=[];
-if ~isempty(InputFileName)
-    Value=find(strcmp(InputFileName,ListFiles));
-end
-if isempty(Value)
-    Value=1;
-end
-set(hlist,'Value',Value)
-return
-
-%TODO adapt to series status
-hseries=findobj(allchild(0),'tag','series');
-hstatus=findobj(hseries,'tag','status');
-StatusData=get(hstatus,'UserData');
-TimeStart=0;
-if isfield(StatusData,'TimeStart')
-    TimeStart=StatusData.TimeStart;
-end
-% testrecent=0;
-% datnum=zeros(numel(ListDisplay),1);
-% for ilist=1:numel(ListDisplay)
-%     ListDisplay{ilist}=ListFiles(ilist).name;
-%     if ListFiles(ilist).isdir
-%         ListDisplay{ilist}=['/' ListDisplay{ilist}];    
-%     elseif isfield(ListFiles(ilist),'datenum')
-%         datnum(ilist)=ListFiles(ilist).datenum;%only available in recent matlab versions
-%         testrecent=1;
-%         if datnum(ilist)<TimeStart
-%             ListDisplay{ilist}=[ListDisplay{ilist} '  --OLD--'];
-%         end
-%     end
-% end
-
-
-%% Look at date of creation
-ListDisplay=ListDisplay(datnum~=0);
-datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files
-
-NbOutputFile=[];
-if isempty(datnum)
-    if testrecent
-        message='no result created yet';
-    else
-        message='';
-    end
-else
-    [first,indfirst]=min(datnum);
-    [last,indlast]=max(datnum);
-    NbOutputFile_str='?';
-    if isfield(StatusData,'NbOutputFile')
-        NbOutputFile=StatusData.NbOutputFile;
-        NbOutputFile_str=num2str(NbOutputFile);
-    end
-    message={[num2str(numel(datnum)) ' file(s) done over ' NbOutputFile_str] ;['oldest modification:  ' ListDisplay{indfirst} ' : ' datestr(first)];...
-        ['latest modification:  ' ListDisplay{indlast} ' : ' datestr(last)]};
-end
-set(htitlebox,'String', [DirName{1};message])
-
-%% update the waitbar
-hwaitbar=findobj(hfig,'tag','waitbar');
-if ~isempty(NbOutputFile) 
-    BarPosition=get(hwaitbar,'Position');
-    BarPosition(3)=0.9*numel(datnum)/NbOutputFile;
-    set(hwaitbar,'Position',BarPosition)
 end
 
@@ -236,5 +224,5 @@
 function ListFiles=list_files(DirName)
 %-------------------------------------------------------------------------
-ListStruct=dir(DirName);
+ListStruct=dir(DirName);% get structure of the current directory
 if numel(ListStruct)<1
     ListFiles={};
@@ -254,11 +242,38 @@
 ListFiles=[{'+/..'} ListFiles(check_keep)];
 
+%------------------------------------------------------------------------   
+% --- launched by selecting home
+function home_dir(hObject,event)
+%------------------------------------------------------------------------
+DirName=pwd;
+ListFiles=list_files(DirName);% list the directory content
+hfig=get(hObject,'parent');
+    set(hfig,'UserData',DirName)% record the new dir name
+    htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name  
+    set(htitlebox,'String',DirName)
+    hlist=findobj(hfig,'tag','list');% find the list object
+set(hlist,'String',ListFiles)
+%------------------------------------------------------------------------
+
+%------------------------------------------------------------------------   
+% --- launched by pressing the backward (<--) button
+function backward(hObject,event)
+%------------------------------------------------------------------------
+PrevDir=get(hObject,'UserData');
+if ~isempty(PrevDir)
+hfig=get(hObject,'parent');
+set(hfig,'UserData',PrevDir)
+htitlebox=findobj(hfig,'tag','titlebox');  % display the new dir name
+set(htitlebox,'String',PrevDir)
+refresh_GUI(findobj(hfig,'Tag','refresh'))
+end
+
 %-------------------------------------------------------------------------   
 % launched by deleting the status figure (only used in mode series status')
 function close(option,hObject, eventdata)
 %-------------------------------------------------------------------------
-if strcmp(option,'status')
+if strcmp(option,'status_display')
     hseries=findobj(allchild(0),'tag','series');
-    hstatus=findobj(hfig,'Tag','status');
+    hstatus=findobj(hfig,'Tag','status_display');
     set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ
     set(hhciv.status,'BackgroundColor',[0 1 0])
