view m-toolbox/m/gui/gltpda/g_RemParamCallback.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 source

   function g_RemParamCallback(hObject, varargin)
      
      global params selBlocks paramEnabled

      currParamIndex = get(hObject,'UserData');
      paramKey = params.params(currParamIndex).key;
      paramVal = params.params(currParamIndex).val;
      params = remove(params,paramKey);
      addParamsPopup = findobj(gcf,'Tag','addparamspopup','Style','popupmenu');
      paramTypes = get(addParamsPopup,'String');
      switch class(paramVal)
         case 'specwin'
            paramTypes = [paramTypes;{'specwin'}];
         case 'pzmodel'
            paramTypes = [paramTypes;{'pzmodel'}];
      end
      set(addParamsPopup,'String',paramTypes)
      if ~strcmp(get_param(gcbh,'Tag'),'arithmetic')
         paramEnabled(currParamIndex)=[];
      else
         paramcommand = g_BuildParamCommand(params);
         for kk=1:length(selBlocks), set_param(selBlocks(kk),'Description',paramcommand); end
         g_UpdateInports(paramKey,-1)
       % g_arithmetic(currPanel);
         return;
      end
      if strcmp(paramVal,'-->') % it's a data from Simulink: delete the relative inport block.
         g_UpdateInports(paramKey,-1);
      end
      
      set(findobj('Tag','apply'),'Enable','on');
      set(findobj('Tag','undo'),'Enable','on');
      
      if strcmp(get_param(gcbh,'Tag'),'arithmetic'), g_arithmetic(currPanel);
      else ltpdagui('Redraw',2)
      end
   end