Mercurial > hg > ltpda
view m-toolbox/m/gui/ltpdv/callbacks/ltpdv_build_params_panel.m @ 43:bc767aaa99a8
CVS Update
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Tue, 06 Dec 2011 11:09:25 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
function ltpdv_build_params_panel(ph, ii, varargin) FONTSIZE = 12; pmarg = 0.025; keyl = pmarg; keyh = 0.055; keyw = 0.3; keyb = 1-pmarg-keyh; vall = pmarg*2 + keyw; valw = 0.5; al = vall + valw + pmarg; aw = 0.05; delete(get(ph, 'Children')) if numel(varargin) > 0 activated = varargin{1}; if strcmpi(activated, 'on') chkVal = 1; else chkVal = 0; end else activated = 'off'; chkVal = 0; end pancomps = {}; if isa(ii, 'minfo') % we give a pop-up menu of sets eh = uicontrol(ph,'Style','popupmenu',... 'String',ii.sets,... 'units', 'normalized', ... 'BackgroundColor', 'w', ... 'Fontsize', FONTSIZE, ... 'Enable', 'on', ... 'Position',[vall keyb valw keyh]); set(eh, 'Callback', {@ltpdv_preproc_sets_callback, ii}); else pl = ii; if numel(pl.params) == 0 sth = uicontrol(ph,'Style','text',... 'String', 'contains no parameters',... 'Units', 'normalized', ... 'BackgroundColor', 'w', ... 'Fontsize', FONTSIZE, ... 'Position',[keyl keyb 2*keyw keyh]); end % check for any unsupported parameters unsupported = false; for j=1:numel(pl.params) val = pl.params(j).val; if isa(val, 'timespan') unsupported = true; end end if unsupported sth = uicontrol(ph,'Style','text',... 'String', ['contains unsupported parameter of type: ' class(val)],... 'Units', 'normalized', ... 'BackgroundColor', 'w', ... 'Fontsize', FONTSIZE, ... 'Position',[keyl keyb 2*keyw keyh]); else % Build parameters for j=1:numel(pl.params) % Get key and val key = pl.params(j).key; val = pl.params(j).val; switch class(val) case 'char' valstr = val; case 'double' valstr = mat2str(val); case 'specwin' valstr = specwin.getTypes; otherwise valstr = char(val); end % key text sth = uicontrol(ph,'Style','text',... 'String', key,... 'Units', 'normalized', ... 'BackgroundColor', 'w', ... 'Fontsize', FONTSIZE, ... 'Position',[keyl keyb keyw keyh]); % val edit if ischar(valstr) || isa(valstr, 'time') || isa(valstr, 'sym') if isa(valstr, 'time') || isa(valstr, 'sym') valstr = char(valstr); end eh = uicontrol(ph,'Style','edit',... 'String', valstr,... 'units', 'normalized', ... 'BackgroundColor', 'w', ... 'Fontsize', FONTSIZE, ... 'Enable', activated, ... 'Position',[vall keyb valw keyh]); elseif iscell(valstr) eh = uicontrol(ph,'Style','popupmenu',... 'String',valstr,... 'units', 'normalized', ... 'BackgroundColor', 'w', ... 'Fontsize', FONTSIZE, ... 'Enable', activated, ... 'Position',[vall keyb valw keyh]); else valstr error('### Unknown type for value string.'); end setappdata(eh, 'valClass', class(val)); % Activate ah = uicontrol(ph,'Style','checkbox',... 'String','',... 'units', 'normalized', ... 'BackgroundColor', get(ph, 'BackgroundColor'), ... 'Fontsize', FONTSIZE, ... 'Value', chkVal, 'Position', [al keyb aw keyh], ... 'Callback', {@ltpdv_preproc_param_act, ph}); pancomps = [pancomps; {sth, eh, ah}]; % Do next line keyb = keyb - pmarg - keyh; end end end setappdata(ph, 'pancomps', pancomps); end