function initialize(this)
%INITIALIZE  Initialization of LTI VIEWER object.

%   Authors: Kamesh Subbarao
%   Copyright 1986-2010 The MathWorks, Inc. 
%
% Create Style manager
this.StyleManager = wavepack.WaveStyleManager;
% Create Figure
Color = get(0,'DefaultUIControlBackground');
Fig = figure(...
   'WindowStyle','normal',...
   'Visible','off',...
   'Name',ctrlMsgUtils.message('Controllib:gui:strLTIViewer'),...
   'Menu','none',...
   'HandleVisibility','callback',...
   'IntegerHandle','off',...
   'NumberTitle','off',...
   'Units','pixels',...
   'Tag','ResponseGUI',...
   'DockControls', 'off');
matlab.graphics.internal.themes.figureUseDesktopTheme(Fig);
this.Figure = handle(Fig);
% Create Status bar
[StatusSep,StatusText] = LocalStatusBar(this);
% Create event manager
this.EventManager               = ctrluis.framemgr(Fig);
this.EventManager.EventRecorder = ctrluis.recorder;
this.EventManager.StatusField   = StatusText;
this.EventManager.newstatus(ctrlMsgUtils.message('Controllib:gui:strLTIViewer'));
% Set Viewer Preferences
this.Preferences = cstprefs.viewprefs(Fig);  
% Create figure Menus
FigureMenu = figmenus(this);
% ---Save menu handle structure in ltiviewer object
this.HG = struct('FigureMenu',FigureMenu,'StatusSeparator',StatusSep,'StatusText',StatusText);
set(Fig,...
   'WindowButtonMotionFcn',@(x,y) hoverfig(Fig),...
   'ResizeFcn',{@localResize this},...
   'DeleteFcn',{@localClose this},...
   'UserData',this);
% Registers Supported View Types for the viewer
this.AvailableViews = ...
    struct(...
    'Name', ltiplottypes('Name'),...
    'Alias',ltiplottypes('Alias'),...
    'CreateFcn',{...
        {@createView this 'step' [] []};...
        {@createView this 'impulse' [] []};...
        {@createView this 'lsim'};...
        {@createView this 'initial'};...
        {@createView this 'bode'};...
        {@createView this 'bodemag'};...
        {@createView this 'nyquist'};...
        {@createView this 'nichols'};...
        {@createView this 'sigma'};...
        {@createView this 'pzmap'};...
        {@createView this 'iopzmap'};...
    });

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Local CallBack Functions
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function localResize(eventSrc,eventData,this)
layout(this)

function localClose(eventSrc,eventData,this)
close(this)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%  Local Function to create Status Bar
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [StatusSep,StatusText] = LocalStatusBar(this)
% LOCALSTATUSBAR Creates customized Status bars for the figure.
hFig = this.Figure;
color = get(hFig,'Color');
lcolor = min(1,color * 1.2);
dcolor = min(1,color * .6);
StatusSep = [...
      uicontrol('parent',hFig,'style','text','units','character','position',[0 2.5 10 1]);...
      uicontrol('parent',hFig,'style','text','units','character','position',[0 2.5 10 1])];
StatusText = uicontrol('Parent',hFig,'Style','text','HorizontalAlignment','left',...
   'units','character','position',[1.5 0.05 10 2],'TooltipString','Status Bar');
set([StatusSep;StatusText],'Units','pixel')