function hZoom = createsignalzoom(hFig, varargin)
%CREATESIGNALZOOM Create the zoom object given a figure

%   Author(s): J. Schickler
%   Copyright 1988-2004 The MathWorks, Inc.
%   $Revision: 1.1.4.2 $  $Date: 2004/08/10 02:11:48 $

hZoom = siggetappdata(hFig, 'siggui', 'mousezoom');

if isempty(hZoom),
    hZoom = createzoom(hFig, varargin{:});
elseif any(~ishandle(hZoom.btnHndls))
    hZoom = createzoom(hFig, varargin{:});
end

% -------------------------------------------------------------------------
function hZoom = createzoom(hFig, hcbo)

if nargin < 2,
    tag = 'none';
else
    tag = get(hcbo, 'tag');
end

sigguiData = siggetappdata(hFig,'siggui');

% Create a mousezoom object
hZoom = siggui.mousezoom(hFig, tag,...
    sigguiData.ZoomBtns, sigguiData.ZoomMenus);

% Set the callbacks of the zoom buttons and zoom menu items to the methods
% of the mousezoom object.
callbacks(hZoom);

% Store the object in the application data of the figure
sigsetappdata(hFig,'siggui','mousezoom',hZoom);

% [EOF]
