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

%   Authors: Kamesh Subbarao
%   Copyright 1986-2004 The MathWorks, Inc.
%   $Revision: 1.22.4.3 $  $Date: 2004/04/10 23:14:40 $
%
% Create Style manager
this.StyleManager = wavepack.WaveStyleManager;
% Create Figure
this.Figure = figure(...
   'Visible','off',...
   'Name','LTI Viewer',...
   'Menu','none',...
   'HandleVisibility','callback',...
   'IntegerHandle','off',...
   'NumberTitle','off',...
   'Units','pixels',...
   'Tag','ResponseGUI',...
   'DockControls', 'off');

% Create Status bar
[StatusBar,StatusText] = LocalStatusBar(this);
% Create event manager
this.EventManager = ctrluis.framemgr(this.Figure);
this.EventManager.StatusField = StatusText;
this.EventManager.newstatus('LTI Viewer');
% Set Viewer Preferences
this.Preferences = cstprefs.viewprefs(this.Figure);  
% Create figure Menus
FigureMenu = figmenus(this);
% ---Save menu handle structure in ltiviewer object
this.HG = struct('FigureMenu',FigureMenu,'StatusBar',StatusBar,'StatusText',StatusText);
set(this.Figure,...
   'WindowButtonMotionFcn',{@hoverfig},...
   '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 [StatusFrame,StatusText] = LocalStatusBar(this);
% LOCALSTATUSBAR Creates customized Status bars for the figure.

StatusFrame = uicontrol('Parent',this.Figure,'Style','frame');
StatusText = uicontrol('Parent',this.Figure,'Style','text','HorizontalAlignment','left',...
   'TooltipString','Status Bar');
if isequal([0 0 0],get(this.Figure,'Color'))
   set(StatusFrame,'BackgroundColor',[0 0 0],'ForegroundColor',[1 1 1]);
end


