tomwalters@0: % tool tomwalters@0: % tomwalters@0: % INPUT VALUES: tomwalters@0: % tomwalters@0: % RETURN VALUE: tomwalters@0: % tomwalters@0: % bleeck@3: % This external file is included as part of the 'aim-mat' distribution package bleeck@3: % (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: function combi=slidereditcontrol_set_raweditvalue(combi,value) tomwalters@0: % set the edit value eg. by typing a text in the edit control tomwalters@0: % a slidereditcontrol consists of a slider and an edit object, that are tomwalters@0: % related. When one value changes, the other also changes. tomwalters@0: % The combination has the following variables: tomwalters@0: % sliderhandle - the handle of the slider control tomwalters@0: % edithandle - the handle of the edit control tomwalters@0: % minvalue - the minimum value allowed tomwalters@0: % maxvalue - the maximum allowed value tomwalters@0: % (current_value - the current value) tomwalters@0: % is_log - whether the slider reponds logarithmically tomwalters@0: % editscaler - a number, that is multiplied to the edit control (to make ms of secs) tomwalters@0: % nreditdigits - the number of digits in the edit control tomwalters@0: tomwalters@0: % the slider gets the raw value back: tomwalters@0: if ~isempty(value) tomwalters@0: set(combi.edithandle,'String',num2str(value)); tomwalters@0: else % set back to old value tomwalters@0: set(combi.edithandle,'String',num2str(combi.current_value*combi.editscaler)); tomwalters@0: return tomwalters@0: end tomwalters@0: tomwalters@0: % the real value must be translated tomwalters@0: realval=value/combi.editscaler; tomwalters@0: realval=max(realval,combi.minvalue); tomwalters@0: realval=min(realval,combi.maxvalue); tomwalters@0: tomwalters@0: if combi.is_log==1 tomwalters@0: sliderval=f2f(realval,combi.minvalue,combi.maxvalue,0,1,'loglin'); tomwalters@0: else tomwalters@0: sliderval=f2f(realval,combi.minvalue,combi.maxvalue,0,1,'linlin'); tomwalters@0: end tomwalters@0: tomwalters@0: sliderval=min(1,sliderval); tomwalters@0: sliderval=max(0,sliderval); tomwalters@0: tomwalters@0: set(combi.sliderhandle,'Value',sliderval); tomwalters@0: val=realval*combi.editscaler; tomwalters@0: editval=fround(val,combi.nreditdigits); tomwalters@0: set(combi.edithandle,'String',num2str(editval)); tomwalters@0: tomwalters@0: combi.current_value=realval;