Home > m > gui > ltpdv > callbacks > ltpdv_build_params_panel.m

ltpdv_build_params_panel

PURPOSE ^

SYNOPSIS ^

function ltpdv_build_params_panel(ph, ii)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ltpdv_build_params_panel(ph, ii)
0002 
0003   FONTSIZE = 12;
0004   
0005   pmarg = 0.025;
0006 
0007   keyl = pmarg;
0008   keyh = 0.055;
0009   keyw = 0.3;
0010   keyb = 1-pmarg-keyh;
0011 
0012   vall = pmarg*2 + keyw;
0013   valw = 0.5;
0014 
0015   al   = vall + valw + pmarg;
0016   aw   = 0.05;
0017 
0018   delete(get(ph, 'Children'))
0019 
0020   pancomps = {};
0021 
0022   if isa(ii, 'minfo')
0023     % we give a pop-up menu of sets
0024     eh = uicontrol(ph,'Style','popupmenu',...
0025       'String',ii.sets,...
0026       'units', 'normalized', ...
0027       'BackgroundColor', 'w', ...
0028       'Fontsize', FONTSIZE, ...
0029       'Enable', 'on', ...
0030       'Position',[vall keyb valw keyh]);
0031 
0032     set(eh, 'Callback', {@ltpdv_preproc_sets_callback, ii});
0033   else
0034     pl = ii;
0035     
0036     if numel(pl.params) == 0
0037         sth = uicontrol(ph,'Style','text',...
0038           'String', 'contains no parameters',...
0039           'Units', 'normalized', ...
0040           'BackgroundColor', 'w', ...
0041           'Fontsize', FONTSIZE, ...
0042           'Position',[keyl keyb 2*keyw keyh]);
0043     end
0044     % check for any unsupported parameters
0045     unsupported = false;
0046     for j=1:numel(pl.params)
0047       val = pl.params(j).val;
0048       if isa(val, 'timespan')
0049         unsupported = true;
0050       end
0051     end
0052     if unsupported
0053         sth = uicontrol(ph,'Style','text',...
0054           'String', ['contains unsupported parameter of type: ' class(val)],...
0055           'Units', 'normalized', ...
0056           'BackgroundColor', 'w', ...
0057           'Fontsize', FONTSIZE, ...
0058           'Position',[keyl keyb 2*keyw keyh]);
0059       
0060     else
0061       % Build parameters
0062       for j=1:numel(pl.params)
0063 
0064         % Get key and val
0065         key = pl.params(j).key;
0066         val = pl.params(j).val;
0067 
0068         switch class(val)
0069           case 'char'
0070             valstr = val;
0071           case 'double'
0072             valstr = mat2str(val);
0073           case 'specwin'
0074             valstr = specwin.getTypes;
0075           otherwise
0076             valstr = val;
0077         end
0078 
0079         % key text
0080         sth = uicontrol(ph,'Style','text',...
0081           'String', key,...
0082           'Units', 'normalized', ...
0083           'BackgroundColor', 'w', ...
0084           'Fontsize', FONTSIZE, ...
0085           'Position',[keyl keyb keyw keyh]);
0086 
0087         % val edit
0088         if ischar(valstr) || isa(valstr, 'time')
0089           if isa(valstr, 'time')
0090             valstr = char(valstr);
0091           end
0092           eh = uicontrol(ph,'Style','edit',...
0093             'String', valstr,...
0094             'units', 'normalized', ...
0095             'BackgroundColor', 'w', ...
0096             'Fontsize', FONTSIZE, ...
0097             'Enable', 'off', ...
0098             'Position',[vall keyb valw keyh]);
0099         elseif iscell(valstr)
0100           eh = uicontrol(ph,'Style','popupmenu',...
0101             'String',valstr,...
0102             'units', 'normalized', ...
0103             'BackgroundColor', 'w', ...
0104             'Fontsize', FONTSIZE, ...
0105             'Enable', 'off', ...
0106             'Position',[vall keyb valw keyh]);
0107         else
0108           valstr
0109           error('### Unknown type for value string.');
0110         end
0111         setappdata(eh, 'valClass', class(val));
0112         % Activate
0113         ah = uicontrol(ph,'Style','checkbox',...
0114           'String','',...
0115           'units', 'normalized', ...
0116           'BackgroundColor', get(ph, 'BackgroundColor'), ...
0117           'Fontsize', FONTSIZE, ...
0118           'Value', 0, 'Position', [al keyb aw keyh], ...
0119           'Callback', {@ltpdv_preproc_param_act, ph});
0120 
0121         pancomps = [pancomps; {sth, eh, ah}];
0122 
0123         % Do next line
0124         keyb = keyb - pmarg - keyh;
0125 
0126       end
0127     end
0128   end
0129 
0130   setappdata(ph, 'pancomps', pancomps);
0131 
0132 
0133 end

Generated on Mon 25-Aug-2008 22:39:29 by m2html © 2003