Changeset 714 for trunk/src/uvmat.m


Ignore:
Timestamp:
Feb 22, 2014, 5:11:04 PM (10 years ago)
Author:
sommeria
Message:

various improvements

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/uvmat.m

    r713 r714  
    474474%------------------------------------------------------------------------
    475475fileinput=get(hObject,'Label');
    476     set(handles.SubField,'Value',0)
    477     desable_subfield(handles)
    478 display_file_name( handles,fileinput)
    479 
     476set(handles.SubField,'Value',0)
     477desable_subfield(handles)
     478errormsg=display_file_name( handles,fileinput);
     479if ~isempty(errormsg)
     480    set(hObject,'Label','')
     481    MenuFile=[{get(handles.MenuFile_1,'Label')};{get(handles.MenuFile_2,'Label')};...
     482        {get(handles.MenuFile_3,'Label')};{get(handles.MenuFile_4,'Label')};{get(handles.MenuFile_5,'Label')}];
     483    str_find=strcmp(get(hObject,'Label'),MenuFile);
     484    MenuFile(str_find)=[];% suppress the input file to the list
     485    for ifile=1:numel(MenuFile)
     486        set(handles.(['MenuFile_' num2str(ifile)]),'Label',MenuFile{ifile});
     487    end
     488end
    480489
    481490% -----------------------------------------------------------------------
     
    616625%------------------------------------------------------------------------   
    617626set(handles.InputFileREFRESH,'BackgroundColor',[1 1 0])% set button color to yellow to indicate that refresh is under action
     627set(handles.uvmat,'Pointer','watch') % set the mouse pointer to 'watch'
     628drawnow
    618629% read the current input file name:
    619630[RootPath,SubDir,RootFile,FileIndices,FileExt]=read_file_boxes(handles);
     
    640651
    641652if isempty(errormsg)
    642 set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
     653% set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
    643654else
    644655    set(handles.InputFileREFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
    645656end
     657set(handles.uvmat,'Pointer','arrow')% set back the mouse pointer to arrow
    646658
    647659%------------------------------------------------------------------------
    648660% --- Fills the edit boxes RootPath, RootFile,NomType...from an input file name 'fileinput'
    649 function display_file_name(handles,fileinput,index)
     661function errormsg=display_file_name(handles,fileinput,index)
    650662%------------------------------------------------------------------------
    651663%% look for the input file existence
     664errormsg='';%default
    652665if ~exist(fileinput,'file')
    653     msgbox_uvmat('ERROR',['input file ' fileinput  ' does not exist'])
     666    errormsg=['input file ' fileinput  ' does not exist'];
     667    msgbox_uvmat('ERROR',errormsg)
    654668    return
    655669end
     
    917931NbSlice=1;%default
    918932ImaDoc_str='';
    919 set(handles.InputFileREFRESH,'BackgroundColor',[1 1 0])
    920933if ~isempty(XmlFileName)
    921934    set(handles.view_xml,'Visible','on')
     
    11481161set(handles.j2,'Visible',state_j)
    11491162set(handles.MaxIndex_j,'Visible',state_j);
    1150 %set(handles.frame_j,'Visible',state_j);
    11511163set(handles.j_text,'Visible',state_j);
    11521164if ~isempty(i2_series)||~isempty(j2_series)
     
    11611173    set(handles.TransformName,'value',2); % set transform to sub_field if the current fct doe not accept two input fields
    11621174end
    1163 TransformName_Callback([],[],handles)
     1175set(handles.InputFileREFRESH,'BackgroundColor',[1 0 0])% set button color to red to indicate that refresh has been updated
     1176TransformName_Callback([],[],handles)% callback for the selection of transform function, then refresh the current plot
    11641177mask_test=get(handles.CheckMask,'value');
    11651178if mask_test
     
    20162029if ~isempty(errormsg)
    20172030      msgbox_uvmat('ERROR',errormsg);
     2031      set(handles.InputFileREFRESH,'BackgroundColor',[1 0 1])% keep button color magenta, input not succesfull
    20182032else
    20192033    set(handles.i1,'BackgroundColor',[1 1 1])
     
    20232037    set(handles.FileIndex,'BackgroundColor',[1 1 1])
    20242038    set(handles.FileIndex_1,'BackgroundColor',[1 1 1]) 
    2025     set(handles.REFRESH,'BackgroundColor',[1 0 0])
     2039    set(handles.REFRESH,'BackgroundColor',[1 0 0])% set button color to red, update successfull
    20262040end   
    20272041
     
    20402054
    20412055%% initialisation
     2056pointer=get(handles.uvmat,'Pointer');
     2057set(handles.uvmat,'Pointer','watch')
     2058drawnow
    20422059if ~exist('Field','var')
    20432060    Field={};
     
    27402757end
    27412758ResizeFcn(handles.uvmat,[],handles)
     2759set(handles.uvmat,'Pointer',pointer)
    27422760
    27432761%------------------------------------------------------------------------
     
    35793597    set(handles.CheckEditObject,'Value',0)
    35803598    set(handles.CheckZoom,'Value',0)
    3581 %     set(handles.CheckZoom,'BackgroundColor',[0.7 0.7 0.7])
    3582 %     set(handles.CheckEditObject,'BackgroundColor',[0.7 0.7 0.7])
    35833599    set(gcf,'Pointer','arrow')
    35843600else
     
    36803696function TransformName_Callback(hObject, eventdata, handles)
    36813697%------------------------------------------------------------------------
     3698set(handles.TransformName,'backgroundColor',[1 1 0])% indicate activation  of the menu
     3699drawnow
    36823700UvData=get(handles.uvmat,'UserData');
    36833701menu=get(handles.TransformName,'String');%refresh
     
    37513769        [fid,errormsg] =fopen([fullfile(list_path{ichoice},transform_name) '.m']);
    37523770        InputText=textscan(fid,'%s',1,'delimiter','\n');
    3753         fclose(fid)
     3771        fclose(fid);
    37543772        set(handles.TransformName,'ToolTipString',['transform_fct: ' InputText{1}{1}])% put the first line of the selected function as tooltip help
    37553773    end
     
    38183836end
    38193837set(handles.uvmat,'UserData',UvData)
     3838set(handles.TransformName,'backgroundColor',[1 1 1])% indicate desactivation  of the menu
     3839drawnow
    38203840
    38213841%% inputfilerefresh the current plot
Note: See TracChangeset for help on using the changeset viewer.