comparison m-toolbox/m/gui/gltpda/g_functionNameSet.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_functionNameSet(hObject, varargin)
2 % Setting the name of the function in the 'generic' block.
3
4 functionName2 = get(hObject,'String');
5 classes = utils.helper.ltpda_userclasses;
6 for i=1:numel(classes)
7 if ismethod(eval(classes{i}),functionName2)
8 currSel = utils.prog.gcbsh;
9 for j=1:numel(currSel), set(currSel(j),'Tag',['method ',classes{i}]); end
10 break
11 else
12 currSel = utils.prog.gcbsh;
13 for j=1:numel(currSel), set(currSel(j),'Tag','function'); end
14 end
15 end
16 paramcommand = g_RetrievePlist(functionName2);
17
18 if ~isempty(paramcommand)
19 functionName = functionName2;
20 paramcommand = strcat(paramcommand,'functionName=''',functionName2,''';');
21 for i=1:1000
22 try
23 for kk=1:length(selBlocks), set_param(selBlocks(kk),'Name',functionName2); end
24 break;
25 catch
26 functionName2 = strcat(functionName,'_',num2str(i));
27 end
28 end
29 for kk=1:length(selBlocks), set_param(selBlocks(kk),'Description',paramcommand); end
30 delete(findobj(gcf,'Parent',currPanel))
31 buildplistFigureParam([],[],get(findobj('Tag','paramsPage'),'UserData'))
32
33 else % the functionName inserted it's not valid
34 description = get_param(gcbh,'Description');
35 funcname = findstr('functionName=',description);
36 if funcname
37 i = funcname+14;
38 while ~strcmp(description(i),';'), i=i+1; end
39 functionName = description(funcname+14:i-2);
40 end
41 set(hObject,'String',functionName);
42 end
43
44 ltpdagui('Redraw',2)
45
46 end