Mercurial > hg > ltpda
diff m-toolbox/m/gui/gltpda/g_AddParamCallback.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/gltpda/g_AddParamCallback.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,66 @@ + function g_AddParamCallback(hObject,varargin) + + global params selBlocks paramEnabled + + hparamType = get(hObject,'UserData'); + if isa(hparamType,'char') && strcmp(hparamType,'input') + key = 'input'; + while ~isempty(find(params,key)), key =[key,'x']; end + params = append(params, param(key,'-->')); + g_UpdateInports(key,1); + paramcommand = g_BuildParamCommand(params); + for kk=1:length(selBlocks) + set_param(selBlocks(kk),'Description',paramcommand); + end + % g_arithmetic(currPanel); + + else + paramTypes = get(hparamType,'String'); + paramType = paramTypes{get(hparamType,'Value')}; + + switch paramType + case {'double','double/char'} + ii = 1; key = ['addPar_name',num2str(ii)]; + while ~isempty(find(params,key)) + ii = ii+1; key = ['addPar_name',num2str(ii)]; + end + params = append(params, param(key,1)); + case 'specwin' + newParam = param('addPar_Win',specwin('Kaiser',1000,200)); + params = append(params, newParam); + paramTypes(strmatch('specwin',paramTypes,'exact'))=[]; + case 'pzmodel' + pzObj = pzmodel(1,[pz(10,2),pz(100)],pz(1)); + newParam = param('addPar_pzmodel',pzObj); + params = append(params, newParam); + paramTypes(strmatch('pzmodel',paramTypes,'exact'))=[]; + case '-->' + ii = 1; key = ['addPar_name',num2str(ii)]; + while ~isempty(find(params,key)) + ii = ii+1; key = ['addPar_name',num2str(ii)]; + end + params = append(params, param(key,'-->')); + g_UpdateInports(key,1) + case 'pz' + ii = 1; key = ['addPar_pz',num2str(ii)]; + while ~isempty(find(params,key)) + ii = ii+1; key = ['addPar_pz',num2str(ii)]; + end + params = append(params, param(key,pz(1))); + case 'unit' + ii = 1; key = ['addPar_unit',num2str(ii)]; + while ~isempty(find(params,key)) + ii = ii+1; key = ['addPar_unit',num2str(ii)]; + end + params = append(params, param(key,unit())); + end + set(findobj(gcf,'Tag','addparamspopup','Style','popupmenu'),'String',paramTypes) + if nparams(params)==1, paramEnabled = 1; + else paramEnabled = [paramEnabled,1]; + end + set(findobj('Tag','apply'),'Enable','on'); + set(findobj('Tag','undo'),'Enable','on'); + + ltpdagui('Redraw',2) + end + end