www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgmodelnode/show.m
function View=show(nd,cgh,View) %SHOW Reconfigure the browser display % % View=SHOW(nd,cgh,View) is called when the browser display is first % entered for an object. This configures the display to correctly display % the node. % Copyright 2000-2016 The MathWorks, Inc. and Ford Global Technologies, Inc. cgmod = getdata(nd); M = cgmod.get('model'); % Check whether function editing should be enabled if strcmp(type(M),'Function model') set(View.ChangeFuncModel,'Enable','on'); set(View.ChangeFuncModelBtn,'Enable','on'); set(View.NodeContextEditFunc, 'Visible', 'on'); else set(View.ChangeFuncModel,'Enable','off'); set(View.ChangeFuncModelBtn,'Enable','off'); set(View.NodeContextEditFunc, 'Visible', 'off'); end % Check whether Load Model menu should be enabled en = 'off'; if strcmp(type(M),'MBC model') || strcmp(type(M),'Point-by-point model') INFO = getinfo(M); if ~isempty(INFO) && isfield(INFO, 'Parent') && exist(INFO.Parent, 'file') en = 'on'; end end set(View.LoadMBCModel,'Enable',en); % Check whether constraints option should be available if cgmod.concheck set([View.DispConstraintsMenu, View.ClipConstraintsMenu], ... 'Enable', 'on'); else set([View.DispConstraintsMenu, View.ClipConstraintsMenu], ... 'Enable', 'off'); end % Update displays if View.ExprView.RootExpression==cgmod View.ExprView.update; View.ModelView.setmodel; else View.ExprView.RootExpression = cgmod; View.ModelView.Expression = cgmod; end View.SkipViewUpdate = true; % display dependencies A = getConnections(project(nd)); CurrentItem = find(A,'data',cgmod); idxUsers = getUsers(A,CurrentItem); pUsed = A.pNode(idxUsers); View.UsedInList.Items = pUsed; if ~isempty(pUsed) % select first item View.UsedInList.SelectedIndex = 1; end View.UsedText.String = sprintf('Items that use %s',getname(nd));