view aim-mat/tools/@parameter/display.m @ 3:20ada0af3d7d

various bugfixes and changed copywrite message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:36:30 +0100
parents 74dedb26614d
children
line wrap: on
line source
% method of class @parameter
% 
% (c) 2011, University of Southampton
% Maintained by Stefan Bleeck (bleeck@gmail.com)
% download of current version is on the soundsoftware site: 
% http://code.soundsoftware.ac.uk/projects/aimmat
% documentation and everything is on http://www.acousticscale.org
function display(param)
% display the content of an object of the parameter class. This function is
% called when the object is listed somewhere or the mouse is over it in the
% editor

cont=param.entries;
nrent=length(cont);
disp(sprintf('%s: object of class datastruct with %d entries:',param.name,nrent));

for i=1:nrent
    panel=cont{i}.panel;
    if ~strcmp(panel,'all')
        indent='   ';
    else
        indent='';
    end
    text=cont{i}.text;
    switch cont{i}.type
        case {'string','pop-up menu','filename','directoryname'}
            val=get(param,text);
            disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,cont{i}.text,val));
        case {'int'}
            val=getstringvalue(param,text);
            disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,cont{i}.text,val));
        case {'float','slider'} 
            strval=getstringvalue(param,text);
            if isequal(strval,'auto')
                disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,text,strval));
            else
                curunit=getcurrentunit(param,text);
                uninttype=cont{i}.unittype;
                if isa(uninttype,'unit_none')
                    disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,text,strval));
                else
                    disp(sprintf('%s(%12s) %30s = %s %s',indent,cont{i}.type,text,strval,curunit));
                end
            end
        case {'bool','radiobutton'}
            val=get(param,text,cont{i}.panel);
            if val==0
                val='false';
            else
                val='true';
            end
            if strcmp(text,'other...') && isequal(val,'true');
                setto=getradiobutton(param,cont{i}.panel);
                disp(sprintf('%s(%12s) %30s = %s (%s)',indent,cont{i}.type,text,val,setto));
            else
                disp(sprintf('%s(%12s) %30s = %s',indent,cont{i}.type,text,val));
            end
        case 'button'
            disp(sprintf('%s(      button) %22s           (callback:) %s',indent,cont{i}.text,cont{i}.callback));
        case 'panel'
            disp(sprintf('(       panel) %22s     with %d entries:',cont{i}.text,cont{i}.nr_elements));
        otherwise
            %             val=[];
            %     disp(sprintf('(%s) %s ',cont{i}.type,cont{i}.text,val));
    end
end