Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 function g_AddParamCallback(hObject,varargin) | |
2 | |
3 global params selBlocks paramEnabled | |
4 | |
5 hparamType = get(hObject,'UserData'); | |
6 if isa(hparamType,'char') && strcmp(hparamType,'input') | |
7 key = 'input'; | |
8 while ~isempty(find(params,key)), key =[key,'x']; end | |
9 params = append(params, param(key,'-->')); | |
10 g_UpdateInports(key,1); | |
11 paramcommand = g_BuildParamCommand(params); | |
12 for kk=1:length(selBlocks) | |
13 set_param(selBlocks(kk),'Description',paramcommand); | |
14 end | |
15 % g_arithmetic(currPanel); | |
16 | |
17 else | |
18 paramTypes = get(hparamType,'String'); | |
19 paramType = paramTypes{get(hparamType,'Value')}; | |
20 | |
21 switch paramType | |
22 case {'double','double/char'} | |
23 ii = 1; key = ['addPar_name',num2str(ii)]; | |
24 while ~isempty(find(params,key)) | |
25 ii = ii+1; key = ['addPar_name',num2str(ii)]; | |
26 end | |
27 params = append(params, param(key,1)); | |
28 case 'specwin' | |
29 newParam = param('addPar_Win',specwin('Kaiser',1000,200)); | |
30 params = append(params, newParam); | |
31 paramTypes(strmatch('specwin',paramTypes,'exact'))=[]; | |
32 case 'pzmodel' | |
33 pzObj = pzmodel(1,[pz(10,2),pz(100)],pz(1)); | |
34 newParam = param('addPar_pzmodel',pzObj); | |
35 params = append(params, newParam); | |
36 paramTypes(strmatch('pzmodel',paramTypes,'exact'))=[]; | |
37 case '-->' | |
38 ii = 1; key = ['addPar_name',num2str(ii)]; | |
39 while ~isempty(find(params,key)) | |
40 ii = ii+1; key = ['addPar_name',num2str(ii)]; | |
41 end | |
42 params = append(params, param(key,'-->')); | |
43 g_UpdateInports(key,1) | |
44 case 'pz' | |
45 ii = 1; key = ['addPar_pz',num2str(ii)]; | |
46 while ~isempty(find(params,key)) | |
47 ii = ii+1; key = ['addPar_pz',num2str(ii)]; | |
48 end | |
49 params = append(params, param(key,pz(1))); | |
50 case 'unit' | |
51 ii = 1; key = ['addPar_unit',num2str(ii)]; | |
52 while ~isempty(find(params,key)) | |
53 ii = ii+1; key = ['addPar_unit',num2str(ii)]; | |
54 end | |
55 params = append(params, param(key,unit())); | |
56 end | |
57 set(findobj(gcf,'Tag','addparamspopup','Style','popupmenu'),'String',paramTypes) | |
58 if nparams(params)==1, paramEnabled = 1; | |
59 else paramEnabled = [paramEnabled,1]; | |
60 end | |
61 set(findobj('Tag','apply'),'Enable','on'); | |
62 set(findobj('Tag','undo'),'Enable','on'); | |
63 | |
64 ltpdagui('Redraw',2) | |
65 end | |
66 end |