Newer
Older
% Author: Colin Eles elesc@mcmaster.ca
% Organization: McMaster Centre for Software Certification
function TTdiag(varargin)
orig_gcbh = gcbh;
Action = varargin{1};
Colin Eles
committed
DAStudio.warning('improper function use');
LocalOpenBlockFcn(blockHandleTTTopMask,1);
LocalOpenBlockFcn([],0);
case 'Close',
blockHandleTTTopMask = orig_gcbh;
LocalCloseBlockFcn(blockHandleTTTopMask);
case 'Copy',
blockHandleTTTopMask = orig_gcbh;
LocalCopyBlockFcn(blockHandleTTTopMask);
Colin Eles
committed
DAStudio.warning('improper function use');
data = importdata(file);
gui = GUI([],0);
Colin Eles
committed
gui.setData(data);
Colin Eles
committed
msgbox(exception.identifier);
blockHandleTTTopMask = orig_gcbh;
data = get_param(blockHandleTTTopMask,'UserData');
if isempty(data)
return
end
errordlg(...
DAStudio.message('Block Data has been corputed'),...
Colin Eles
committed
'Error', 'modal');
Colin Eles
committed
delete(data.fig);
set_param(blockHandleTTTopMask,'UserData',data);
DAStudio.error('Simulink:dialog:UnknownAction',Action);
end
function LocalCopyBlockFcn(blockHandleTTTopMask)
data = get(blockHandleTTTopMask,'UserData');
if(~isempty(data))
data_new = data.clone(blockHandleTTTopMask);
Colin Eles
committed
set_param(blockHandleTTTopMask,'UserData',data_new);
data = [];
if (mode == 1)
modelHandle = bdroot(blockHandleTTTopMask);
Colin Eles
committed
% check if the user is trying to open the block from the library
Colin Eles
committed
if strcmp(get_param(modelHandle,'Lock'), 'on') || strcmp(get_param(blockHandleTTTopMask,'LinkStatus'),'implicit')
errordlg(...
DAStudio.message('can not open Model Locked, Add to new model to use'),...
Colin Eles
committed
'Error', 'modal');
Colin Eles
committed
end
data = get_param(blockHandleTTTopMask,'UserData');
end
if isempty(data)
data = Data();
data.init();
else
if ~data.valid
errordlg(...
DAStudio.message('Block Data has been corputed'),...
Colin Eles
committed
'Error', 'modal');
return
end
if data.open
if ishghandle(data.fig)
Colin Eles
committed
figure(data.fig);
Colin Eles
committed
end
if mode == 1
gui = GUI(blockHandleTTTopMask,1);
elseif mode == 0
gui = GUI([],0);
end
Colin Eles
committed
gui.setData(data);
gui.init();
if(mode == 1)
set_param(blockHandleTTTopMask,'UserData',data);
set_param(blockHandleTTTopMask, 'UserDataPersistent', 'on');
end
end
function LocalCloseRequestBlockFcn(blockHandleTTTopMask)
modelHandle = bdroot(blockHandleTTTopMask);
data = get_param(blockHandleTTTopMask,'UserData');
Colin Eles
committed
if ~isempty(data)
if data.open
Colin Eles
committed
delete(data.fig);
Colin Eles
committed
end
end
%set_param(gui.fig,'Visible','off')