Mercurial > hg > ltpda
comparison m-toolbox/m/gui/gltpda/g_editNameCallback.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_editNameCallback(hObject, varargin) | |
2 | |
3 global params | |
4 | |
5 if strcmp(get(gcbh,'Tag'),'arithmetic') | |
6 currParamIndex = get(hObject,'UserData'); | |
7 newName = get(hObject,'String'); | |
8 oldName = params.params(currParamIndex).key; | |
9 params.params(currParamIndex).setKey(newName); | |
10 paramcommand = BuildParamCommand(params); | |
11 for kk=1:length(selBlocks) | |
12 set_param(selBlocks(kk),'Description',paramcommand); | |
13 end | |
14 block2change = find_system(gcb,'SearchDepth',1,'LookUnderMasks','all','Name',lower(oldName)); | |
15 while ~isempty(find_system(gcb,'SearchDepth',1,'LookUnderMasks','all','Name',lower(newName))), newName = [newName,'x']; end | |
16 set_param(block2change{1},'Name',lower(newName)) | |
17 UpdateInports(lower(newName),2); | |
18 return; | |
19 end | |
20 | |
21 currParamIndex = get(hObject,'UserData'); | |
22 newName = get(hObject,'String'); | |
23 oldName = params.params(currParamIndex).key; | |
24 addedPar = 0; | |
25 try if strcmpi(oldName(1:7),'addPar_'), addedPar = 1; oldName(1:7)=[]; end; catch, end | |
26 | |
27 if strcmp(params.params(currParamIndex).val,'-->') | |
28 block2change = find_system(gcb,'SearchDepth',1,'LookUnderMasks','all','Name',lower(oldName)); | |
29 while ~isempty(find_system(gcb,'SearchDepth',1,'LookUnderMasks','all','Name',lower(newName))), newName = [newName,'x']; end | |
30 set_param(block2change{1},'Name',lower(newName)) | |
31 end | |
32 | |
33 if addedPar, newName = ['addPar_',newName]; end | |
34 setKey(params.params(currParamIndex),newName); | |
35 % To change the drawing command: | |
36 if strcmp(params.params(currParamIndex).val,'-->'), UpdateInports(lower(newName),2); end | |
37 | |
38 set(findobj('Tag','apply'),'Enable','on'); | |
39 set(findobj('Tag','undo'),'Enable','on'); | |
40 | |
41 end |