classdef (Hidden = true) ConfigureModelForPILBlock < handle
%CONFIGUREMODELFORPILBLOCK configures a model for PIL
%
% CONFIGUREMODELFORPILBLOCK(settingsSource) creates an object to configure a
% model for PIL.
%
% Input arguments:
%
% settingsSource Model name or configuration set to configure.
%
% Methods:
%
% configure Configures the settingsSource for PIL.
%
% remove Removes PIL configuration from settingsSource.
%
%
% Static methods:
%
% getBasePILCheckboxWidget Returns a dynamic dialog widget for the PIL
% Checkbox.
%
% getBasePILActionWidget Returns a dynamic dialog widget for the PIL
% action Combobox.
%
% getBasePILGroup Returns a dynamic dialog group for the PIL
% settings.
%
% Example:
% c = rtw.pil.ConfigureModelForPILBlock('rtwdemo_fuelsys')
% c.configure
% c.remove
%
% Example:
% widget = ...
% rtw.pil.ConfigureModelForPILBlock.getBasePILCheckboxWidget('myProp', ...
% 'baseTag', ...
% 'callbackFun', ...
% true)
%
%
%
% This is an undocumented class. Its methods and properties are likely to
% change without warning from one release to the next.

% Copyright 2007-2015 The MathWorks, Inc.

properties(SetAccess = 'protected')
% config set property
cs;
end

% public methods
methods
function this = ConfigureModelForPILBlock(settingsSource)
% Class constructor
%
% check num args
narginchk(1,1);
%
this.cs = targets_getActiveConfigSet(settingsSource);
end

function configure(this)
%
% clean up legacy use of TestInterface API if required (call from an
% update method to upgrade to CodeInfo based PIL)
%
if strcmp(get_param(this.cs, 'GenerateTestInterfaces'), 'on')
set_param(this.cs, 'GenerateTestInterfaces', 'off');
%
% Remove the CustomTestInterfaceFile TLC Option
%
origTLCOptions = get_param(this.cs, 'TLCOptions');
% the TLC option to remove
testInterfaceTLCOption = '-aCustomTestInterfaceFile="pil_gen_interface.tlc"';
newTLCOptions = strrep(origTLCOptions, testInterfaceTLCOption, '');
set_param(this.cs, 'TLCOptions', strtrim(newTLCOptions));
end
end

function remove(this) %#ok<MANU>
end
end

end