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_range(combi,duration) tomwalters@0: % sets the range and the step size, so that the width of the slider is OK 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: % works only for linear sliders (yet) tomwalters@0: if combi.is_log==1 tomwalters@0: set(combi.sliderhandle,'SliderStep',[0.01 0.1]); tomwalters@0: else tomwalters@0: dur=combi.maxvalue-combi.minvalue; % so long is it indeed tomwalters@0: if abs(dur-duration)>0 tomwalters@0: step1=duration/abs(dur-duration); tomwalters@0: % step1=duration/dur; tomwalters@0: if abs(dur) > 0 tomwalters@0: step2=duration/dur/10; tomwalters@0: step1=max(0,step1); tomwalters@0: step1=min(1,step1); tomwalters@0: step2=max(0,step2); tomwalters@0: step2=min(1,step2); tomwalters@0: set(combi.sliderhandle,'SliderStep',[step2 step1]); tomwalters@0: return tomwalters@0: end tomwalters@0: end tomwalters@0: step1=1; tomwalters@0: step2=1; tomwalters@0: set(combi.sliderhandle,'SliderStep',[step2 step1]); tomwalters@0: end