tomwalters@0: % procedure for 'aim-mat' tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % tomwalters@0: % (c) 2011, University of Southampton bleeck@3: % Maintained by Stefan Bleeck (bleeck@gmail.com) bleeck@3: % download of current version is on the soundsoftware site: bleeck@3: % http://code.soundsoftware.ac.uk/projects/aimmat bleeck@3: % documentation and everything is on http://www.acousticscale.org bleeck@3: tomwalters@0: tomwalters@0: tomwalters@0: function handles=aim_updategui(handles) tomwalters@0: tomwalters@0: % enable / disable the buttons tomwalters@0: loadstatus(1)=handles.info.pcp_loaded; tomwalters@0: loadstatus(2)=handles.info.bmm_loaded; tomwalters@0: loadstatus(3)=handles.info.nap_loaded; tomwalters@0: loadstatus(4)=handles.info.strobes_loaded; tomwalters@0: loadstatus(5)=handles.info.sai_loaded; tomwalters@0: loadstatus(6)=handles.info.usermodule_loaded; tomwalters@0: loadstatus(7)=handles.info.movie_loaded; tomwalters@0: tomwalters@0: for i=1:7 tomwalters@0: but=getbuttonhandle(handles,i); tomwalters@0: frame_hand=getframehandle(handles,i); tomwalters@0: if loadstatus(i)==1 tomwalters@0: set(but,'Enable','on'); tomwalters@0: set(frame_hand,'BackgroundColor',handles.colors.green1); tomwalters@0: else tomwalters@0: set(but,'Enable','off'); tomwalters@0: set(frame_hand,'BackgroundColor',handles.colors.background); tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: % default settings for all but the sai tomwalters@0: set(handles.frame28,'BackgroundColor',handles.colors.green1); tomwalters@0: set(handles.checkbox6,'Enable','on'); tomwalters@0: set(handles.checkbox7,'Enable','on'); tomwalters@0: set(handles.checkbox10,'Enable','on'); tomwalters@0: set(handles.edit3,'Enable','on'); tomwalters@0: set(handles.slider3,'Enable','on'); tomwalters@0: set(handles.edit3,'Visible','on'); %switch on duration tomwalters@0: set(handles.slider3,'Visible','on'); tomwalters@0: set(handles.text7,'Visible','on'); tomwalters@0: set(handles.text10,'Visible','on'); tomwalters@0: set(handles.text9,'String','ms'); tomwalters@0: set(handles.text8,'String','start time'); tomwalters@0: set(handles.pushbutton24,'Enable','on'); tomwalters@0: tomwalters@0: sig=handles.data.signal; tomwalters@0: len=getlength(sig); tomwalters@0: tomwalters@0: handles=aim_set_current_slider(handles); tomwalters@0: tomwalters@0: % the new one is now the old one: tomwalters@0: handles.info.old_current_plot=handles.info.current_plot; tomwalters@0: tomwalters@0: % calculate dependencies TCW AIM2006 tomwalters@0: % enumerate list boxes tomwalters@0: for i=1:7 tomwalters@0: listboxen(i)=getlisthandle(handles, i); tomwalters@0: end tomwalters@0: % if it was a list box that called tomwalters@0: if (find(listboxen==handles.calling_object)) tomwalters@0: current_listbox=handles.calling_object; tomwalters@0: current_listbox_number=find(listboxen==handles.calling_object); tomwalters@0: generating_module_string=get(current_listbox,'String'); tomwalters@0: generating_module=generating_module_string(get(current_listbox,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: generating_section=getsectionnames(current_listbox_number); tomwalters@0: generating_functionline=['handles.all_options.' generating_section '.' generating_module '.default_nextmodule']; tomwalters@0: try tomwalters@0: setdefault=1; tomwalters@0: eval(sprintf('default_gen=%s;',generating_functionline')); tomwalters@0: catch tomwalters@0: setdefault=0; tomwalters@0: end tomwalters@0: if setdefault==1 && current_listbox_number<7 tomwalters@0: next_listbox=getlisthandle(handles,current_listbox_number+1); tomwalters@0: generating_module_string=get(next_listbox,'String'); tomwalters@0: chosen_option=strmatch(default_gen,generating_module_string); tomwalters@0: try tomwalters@0: set(next_listbox,'Value', chosen_option); tomwalters@0: catch tomwalters@0: % never mind, the necessary module doesn't exist tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: % tomwalters@0: tomwalters@0: % set the colors according to the button setting tomwalters@0: switch handles.info.current_plot tomwalters@0: case 1 % signal tomwalters@0: set(handles.checkbox6,'Value',0); % switch off profiles tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: set(handles.checkbox6,'Enable','off'); tomwalters@0: set(handles.checkbox7,'Enable','off'); tomwalters@0: set(handles.pushbutton24,'Enable','off'); tomwalters@0: case 2 % pcp tomwalters@0: set(handles.frame20,'BackgroundColor',handles.colors.green2); tomwalters@0: set(handles.checkbox6,'Value',0); tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: set(handles.checkbox6,'Enable','off'); tomwalters@0: set(handles.checkbox7,'Enable','off'); tomwalters@0: set(handles.pushbutton24,'Enable','off'); tomwalters@0: case 3 %bmm tomwalters@0: %set(handles.checkbox10,'Value',0); tomwalters@0: set(handles.checkbox6,'Value',0); % switch off profiles by default tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: set(handles.checkbox6,'Enable','off'); tomwalters@0: set(handles.checkbox7,'Enable','off'); tomwalters@0: set(handles.frame21,'BackgroundColor',handles.colors.green2); tomwalters@0: case 4 % nap tomwalters@0: %set(handles.checkbox10,'Value',0); tomwalters@0: set(handles.checkbox10, 'Enable', 'on'); tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: set(handles.checkbox7,'Enable','off'); tomwalters@0: set(handles.frame22,'BackgroundColor',handles.colors.green2); tomwalters@0: case 5 % strobes tomwalters@0: %set(handles.checkbox10,'Value',0); tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: set(handles.checkbox7,'Enable','off'); tomwalters@0: set(handles.frame23,'BackgroundColor',handles.colors.green2); tomwalters@0: case 6 % sai tomwalters@0: set(handles.frame24,'BackgroundColor',handles.colors.green2); tomwalters@0: set(handles.slider3,'Visible','off'); tomwalters@0: set(handles.text7,'Visible','off'); tomwalters@0: set(handles.text9,'String',''); tomwalters@0: set(handles.text8,'String','frame #'); tomwalters@0: set(handles.checkbox10,'Value',0); tomwalters@0: set(handles.checkbox10, 'Enable', 'off'); tomwalters@0: case 7 % user defined tomwalters@0: % special: if usermodule is "none", then ignore it and set tomwalters@0: if strcmp(handles.info.current_usermodule_module,'none') tomwalters@0: set(handles.frame24,'BackgroundColor',handles.colors.green2); tomwalters@0: set(handles.slider3,'Visible','off'); tomwalters@0: set(handles.text7,'Visible','off'); tomwalters@0: set(handles.text9,'String',''); tomwalters@0: set(handles.text8,'String','frame #'); tomwalters@0: set(handles.checkbox10,'Value',0); tomwalters@0: set(handles.checkbox10, 'Enable', 'off'); tomwalters@0: handles.info.current_plot=6; tomwalters@0: handles=aim_updategui(handles); tomwalters@0: else tomwalters@0: set(handles.frame25,'BackgroundColor',handles.colors.green2); tomwalters@0: set(handles.slider3,'Visible','off'); tomwalters@0: set(handles.text7,'Visible','off'); tomwalters@0: set(handles.text9,'String','frame #'); tomwalters@0: set(handles.pushbutton24,'Enable','off'); tomwalters@0: set(handles.checkbox10,'Value',0); tomwalters@0: set(handles.checkbox10, 'Enable', 'off'); tomwalters@0: end tomwalters@0: if strcmp(handles.info.current_usermodule_module,'dualprofile') tomwalters@0: set(handles.checkbox6,'Value',0); % switch of profiles tomwalters@0: set(handles.checkbox7,'Value',0); tomwalters@0: set(handles.checkbox6,'Enable','off'); tomwalters@0: set(handles.checkbox7,'Enable','off'); tomwalters@0: set(handles.pushbutton24,'Enable','off'); tomwalters@0: set(handles.checkbox10,'Value',0); tomwalters@0: set(handles.checkbox10, 'Enable', 'off'); tomwalters@0: tomwalters@0: end tomwalters@0: case 8 % movie tomwalters@0: set(handles.frame26,'BackgroundColor',handles.colors.green2); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: % indicate by a blue color, that these ones are to be regenerated or to be tomwalters@0: % deleted tomwalters@0: for i=1:7 tomwalters@0: checkhand=getcheckboxhandle(handles,i); tomwalters@0: texthand=getbuttonhandle(handles,i); tomwalters@0: framehand=getframehandle(handles,i); tomwalters@0: if get(checkhand,'Value')==1 tomwalters@0: set(framehand,'BackgroundColor',handles.colors.blue2); tomwalters@0: set(texthand,'Enable','on'); tomwalters@0: for j=i+1:7 tomwalters@0: checkhand=getcheckboxhandle(handles,j); tomwalters@0: texthand=getbuttonhandle(handles,j); tomwalters@0: if loadstatus(j)==1 tomwalters@0: set(framehand,'BackgroundColor',handles.colors.blue1); tomwalters@0: end tomwalters@0: cd1=getcheckboxhandle(handles,j-1); % left of tomwalters@0: if get(cd1,'Value')==0 tomwalters@0: % and uncheck tomwalters@0: cd=getcheckboxhandle(handles,j); tomwalters@0: set(cd,'Value',0); tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: % set all commands accordingly, so that "calculate" can work with it tomwalters@0: handles.info.calculate_pcp=0; tomwalters@0: handles.info.calculate_bmm=0; tomwalters@0: handles.info.calculate_nap=0; tomwalters@0: handles.info.calculate_strobes=0; tomwalters@0: handles.info.calculate_sai=0; tomwalters@0: handles.info.calculate_usermodule=0; tomwalters@0: handles.info.calculate_movie=0; tomwalters@0: if get(handles.checkbox0,'Value')==1 tomwalters@0: handles.info.calculate_pcp=1; tomwalters@0: end tomwalters@0: if get(handles.checkbox1,'Value')==1 tomwalters@0: handles.info.calculate_bmm=1; tomwalters@0: end tomwalters@0: if get(handles.checkbox2,'Value')==1 tomwalters@0: handles.info.calculate_nap=1; tomwalters@0: end tomwalters@0: if get(handles.checkbox3,'Value')==1 tomwalters@0: handles.info.calculate_strobes=1; tomwalters@0: end tomwalters@0: if get(handles.checkbox4,'Value')==1 tomwalters@0: handles.info.calculate_sai=1; tomwalters@0: end tomwalters@0: if get(handles.checkbox8,'Value')==1 tomwalters@0: handles.info.calculate_usermodule=1; tomwalters@0: end tomwalters@0: if get(handles.checkbox5,'Value')==1 tomwalters@0: handles.info.calculate_movie=1; tomwalters@0: end tomwalters@0: tomwalters@0: % set the tooltip for each listbox: tomwalters@0: settooltip(handles.all_options.pcp,handles.listbox0); tomwalters@0: settooltip(handles.all_options.bmm,handles.listbox1); tomwalters@0: settooltip(handles.all_options.nap,handles.listbox2); tomwalters@0: settooltip(handles.all_options.strobes,handles.listbox3); tomwalters@0: settooltip(handles.all_options.sai,handles.listbox4); tomwalters@0: settooltip(handles.all_options.usermodule,handles.listbox6); tomwalters@0: settooltip(handles.all_options.movie,handles.listbox5); tomwalters@0: tomwalters@0: % set the current info in handles to the current values tomwalters@0: generating_module_string=get(handles.listbox0,'String'); tomwalters@0: generating_module=generating_module_string(get(handles.listbox0,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: handles.info.current_pcp_module=generating_module; tomwalters@0: generating_module_string=get(handles.listbox1,'String'); tomwalters@0: generating_module=generating_module_string(get(handles.listbox1,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: handles.info.current_bmm_module=generating_module; tomwalters@0: generating_module_string=get(handles.listbox2,'String'); tomwalters@0: generating_module=generating_module_string(get(handles.listbox2,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: handles.info.current_nap_module=generating_module; tomwalters@0: generating_module_string=get(handles.listbox3,'String'); tomwalters@0: generating_module=generating_module_string(get(handles.listbox3,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: handles.info.current_strobes_module=generating_module; tomwalters@0: generating_module_string=get(handles.listbox4,'String'); tomwalters@0: generating_module=generating_module_string(get(handles.listbox4,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: handles.info.current_sai_module=generating_module; tomwalters@0: generating_module_string=get(handles.listbox6,'String'); tomwalters@0: generating_module=generating_module_string(get(handles.listbox6,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: handles.info.current_usermodule_module=generating_module; tomwalters@0: generating_module_string=get(handles.listbox5,'String'); tomwalters@0: generating_module=generating_module_string(get(handles.listbox5,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: handles.info.current_movie_module=generating_module; tomwalters@0: tomwalters@0: % special: if the sai-module is set to "ams" (auditory image model), then tomwalters@0: % all buttons before that are set to disable and the settings are set to tomwalters@0: % "none" tomwalters@0: if strcmp(handles.info.current_sai_module,'ams') && handles.info.sai_loaded==1 && ~get(handles.checkbox0,'Value')==1 tomwalters@0: set(handles.pushbutton0,'Enable','off'); tomwalters@0: set(handles.frame20,'BackgroundColor',handles.colors.background); tomwalters@0: % % set(handles.listbox0,'String','none'); tomwalters@0: set(handles.pushbutton2,'Enable','off'); tomwalters@0: set(handles.frame21,'BackgroundColor',handles.colors.background); tomwalters@0: % % set(handles.listbox1,'String','none'); tomwalters@0: set(handles.pushbutton3,'Enable','off'); tomwalters@0: set(handles.frame22,'BackgroundColor',handles.colors.background); tomwalters@0: % set(handles.listbox2,'String','none'); tomwalters@0: set(handles.pushbutton4,'Enable','off'); tomwalters@0: set(handles.frame23,'BackgroundColor',handles.colors.background); tomwalters@0: % set(handles.listbox3,'String','none'); tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: tomwalters@0: return tomwalters@0: tomwalters@0: tomwalters@0: %%%%%%%%%%%%%%%%%%%%%%%% finished tomwalters@0: tomwalters@0: function settooltip(options,hand) tomwalters@0: generating_module_string=get(hand,'String'); tomwalters@0: generating_module=generating_module_string(get(hand,'Value')); tomwalters@0: generating_module=generating_module{1}; tomwalters@0: generating_functionline=['options.' generating_module '.displayname']; tomwalters@0: eval(sprintf('displayname=%s;',generating_functionline')); tomwalters@0: set(hand,'Tooltip',displayname); tomwalters@0: tomwalters@0: function hand=getcheckboxhandle(handles,nr) tomwalters@0: switch nr tomwalters@0: case 1 tomwalters@0: hand=handles.checkbox0; tomwalters@0: case 2 tomwalters@0: hand=handles.checkbox1; tomwalters@0: case 3 tomwalters@0: hand=handles.checkbox2; tomwalters@0: case 4 tomwalters@0: hand=handles.checkbox3; tomwalters@0: case 5 tomwalters@0: hand=handles.checkbox4; tomwalters@0: case 6 tomwalters@0: hand=handles.checkbox8; tomwalters@0: case 7 tomwalters@0: hand=handles.checkbox5; tomwalters@0: end tomwalters@0: tomwalters@0: function hand=getbuttonhandle(handles,nr) tomwalters@0: switch nr tomwalters@0: case 1 tomwalters@0: hand=handles.pushbutton0; tomwalters@0: case 2 tomwalters@0: hand=handles.pushbutton2; tomwalters@0: case 3 tomwalters@0: hand=handles.pushbutton3; tomwalters@0: case 4 tomwalters@0: hand=handles.pushbutton4; tomwalters@0: case 5 tomwalters@0: hand=handles.pushbutton5; tomwalters@0: case 6 tomwalters@0: hand=handles.pushbutton21; tomwalters@0: case 7 tomwalters@0: hand=handles.pushbutton6; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: function hand=getlisthandle(handles,nr) tomwalters@0: switch nr tomwalters@0: case 1 tomwalters@0: hand=handles.listbox0; tomwalters@0: case 2 tomwalters@0: hand=handles.listbox1; tomwalters@0: case 3 tomwalters@0: hand=handles.listbox2; tomwalters@0: case 4 tomwalters@0: hand=handles.listbox3; tomwalters@0: case 5 tomwalters@0: hand=handles.listbox4; tomwalters@0: case 6 tomwalters@0: hand=handles.listbox6; tomwalters@0: case 7 tomwalters@0: hand=handles.listbox5; tomwalters@0: end tomwalters@0: tomwalters@0: tomwalters@0: function hand=getframehandle(handles,nr) tomwalters@0: switch nr tomwalters@0: case 1 tomwalters@0: hand=handles.frame20; tomwalters@0: case 2 tomwalters@0: hand=handles.frame21; tomwalters@0: case 3 tomwalters@0: hand=handles.frame22; tomwalters@0: case 4 tomwalters@0: hand=handles.frame23; tomwalters@0: case 5 tomwalters@0: hand=handles.frame24; tomwalters@0: case 6 tomwalters@0: hand=handles.frame25; tomwalters@0: case 7 tomwalters@0: hand=handles.frame26; tomwalters@0: end tomwalters@0: tomwalters@0: function name=getsectionnames(nr); tomwalters@0: switch nr tomwalters@0: case 1 tomwalters@0: name='pcp'; tomwalters@0: case 2 tomwalters@0: name='bmm'; tomwalters@0: case 3 tomwalters@0: name='nap'; tomwalters@0: case 4 tomwalters@0: name='strobes'; tomwalters@0: case 5 tomwalters@0: name='sai'; tomwalters@0: case 6 tomwalters@0: name='usermodule'; tomwalters@0: case 7 tomwalters@0: name='movie'; tomwalters@0: end