Mercurial > hg > ltpda
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/m/gui/gltpda/g_functionNameSet.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,46 @@ +function g_functionNameSet(hObject, varargin) + % Setting the name of the function in the 'generic' block. + + functionName2 = get(hObject,'String'); + classes = utils.helper.ltpda_userclasses; + for i=1:numel(classes) + if ismethod(eval(classes{i}),functionName2) + currSel = utils.prog.gcbsh; + for j=1:numel(currSel), set(currSel(j),'Tag',['method ',classes{i}]); end + break + else + currSel = utils.prog.gcbsh; + for j=1:numel(currSel), set(currSel(j),'Tag','function'); end + end + end + paramcommand = g_RetrievePlist(functionName2); + + if ~isempty(paramcommand) + functionName = functionName2; + paramcommand = strcat(paramcommand,'functionName=''',functionName2,''';'); + for i=1:1000 + try + for kk=1:length(selBlocks), set_param(selBlocks(kk),'Name',functionName2); end + break; + catch + functionName2 = strcat(functionName,'_',num2str(i)); + end + end + for kk=1:length(selBlocks), set_param(selBlocks(kk),'Description',paramcommand); end + delete(findobj(gcf,'Parent',currPanel)) + buildplistFigureParam([],[],get(findobj('Tag','paramsPage'),'UserData')) + + else % the functionName inserted it's not valid + description = get_param(gcbh,'Description'); + funcname = findstr('functionName=',description); + if funcname + i = funcname+14; + while ~strcmp(description(i),';'), i=i+1; end + functionName = description(funcname+14:i-2); + end + set(hObject,'String',functionName); + end + + ltpdagui('Redraw',2) + +end