annotate aim-mat/tools/@parameter/display.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % method of class @parameter
tomwalters@0 2 %
bleeck@3 3 % (c) 2011, University of Southampton
bleeck@3 4 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 5 % download of current version is on the soundsoftware site:
bleeck@3 6 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 7 % documentation and everything is on http://www.acousticscale.org
tomwalters@0 8 function display(param)
tomwalters@0 9 % display the content of an object of the parameter class. This function is
tomwalters@0 10 % called when the object is listed somewhere or the mouse is over it in the
tomwalters@0 11 % editor
tomwalters@0 12
tomwalters@0 13 cont=param.entries;
tomwalters@0 14 nrent=length(cont);
tomwalters@0 15 disp(sprintf('%s: object of class datastruct with %d entries:',param.name,nrent));
tomwalters@0 16
tomwalters@0 17 for i=1:nrent
tomwalters@0 18 panel=cont{i}.panel;
tomwalters@0 19 if ~strcmp(panel,'all')
tomwalters@0 20 indent=' ';
tomwalters@0 21 else
tomwalters@0 22 indent='';
tomwalters@0 23 end
tomwalters@0 24 text=cont{i}.text;
tomwalters@0 25 switch cont{i}.type
tomwalters@0 26 case {'string','pop-up menu','filename','directoryname'}
tomwalters@0 27 val=get(param,text);
tomwalters@0 28 disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,cont{i}.text,val));
tomwalters@0 29 case {'int'}
tomwalters@0 30 val=getstringvalue(param,text);
tomwalters@0 31 disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,cont{i}.text,val));
tomwalters@0 32 case {'float','slider'}
tomwalters@0 33 strval=getstringvalue(param,text);
tomwalters@0 34 if isequal(strval,'auto')
tomwalters@0 35 disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,text,strval));
tomwalters@0 36 else
tomwalters@0 37 curunit=getcurrentunit(param,text);
tomwalters@0 38 uninttype=cont{i}.unittype;
tomwalters@0 39 if isa(uninttype,'unit_none')
tomwalters@0 40 disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,text,strval));
tomwalters@0 41 else
tomwalters@0 42 disp(sprintf('%s(%12s) %30s = %s %s',indent,cont{i}.type,text,strval,curunit));
tomwalters@0 43 end
tomwalters@0 44 end
tomwalters@0 45 case {'bool','radiobutton'}
tomwalters@0 46 val=get(param,text,cont{i}.panel);
tomwalters@0 47 if val==0
tomwalters@0 48 val='false';
tomwalters@0 49 else
tomwalters@0 50 val='true';
tomwalters@0 51 end
tomwalters@0 52 if strcmp(text,'other...') && isequal(val,'true');
tomwalters@0 53 setto=getradiobutton(param,cont{i}.panel);
tomwalters@0 54 disp(sprintf('%s(%12s) %30s = %s (%s)',indent,cont{i}.type,text,val,setto));
tomwalters@0 55 else
tomwalters@0 56 disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,text,val));
tomwalters@0 57 end
tomwalters@0 58 case 'button'
tomwalters@0 59 disp(sprintf('%s( button) %22s (callback:) %s',indent,cont{i}.text,cont{i}.callback));
tomwalters@0 60 case 'panel'
tomwalters@0 61 disp(sprintf('( panel) %22s with %d entries:',cont{i}.text,cont{i}.nr_elements));
tomwalters@0 62 otherwise
tomwalters@0 63 % val=[];
tomwalters@0 64 % disp(sprintf('(%s) %s ',cont{i}.type,cont{i}.text,val));
tomwalters@0 65 end
tomwalters@0 66 end