function actionbtns_cbs(hcbo, eventStruct)
% ACTIONBTNS_CBS Services the callbacks executed by the action (apply) buttons.
%                It creates a new filter (designed, quantized, or imported) 
%                and saves it in the userdata.  Then it updates the analysis area.
% Inputs:
%   hcbo        - handle to the uicontrol that issued the callback (not used).
%   eventStruct - (not used)

%   Author(s): P. Pacheco, P. Costa
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.8 $  $Date: 2000/06/13 21:22:55 $ 

% Cache figure handle of uicontrol that issued the callback.
hFig = gcbf;

% Sets warning to off and returns the current warning state.
w = warning('off');
lasterr('');
lastwarn('');
try
    % Import, design, quantize (or unquantize) filter.
    createfilter(hFig);
catch
    fdatoolerror(hFig);
    return;
end

if ~isempty(lastwarn),
    fdatoolwarning(hFig);
end
warning(w); % Reset the warning state

% Set analysis to mag. response if current mode is design and 
% static resp. is selected.
set_analysisplot(hFig);

% Perform analysis and update analysis area with new plot.
update_analysisframe(hFig);

% Update other relevant parts of the GUI.
update_actionbtn('update_enablestate',hFig); 
update_currentfilterinfo('update_all',hFig);

%----------------------------------------------------------------------
function set_analysisplot(hFig)
% SET_ANALYSISPLOT Replaces static response with magnitude response 
%                  if in design mode and current analysis is the 
%                  Filter Specifications.

% Cache figure handle of uicontrol that issued callback.
ud = get(hFig,'Userdata');
currentmode = ud.mode.current;

if currentmode==1 & ...  % Design
        strcmpi(ud.toolbar.analysis,'filterresponsespecs'),  % Static resp.
    ud.toolbar.analysis = 'magresp';               % Set to magnitude resp.

    % Save updated userdata back in the figure.
    set(hFig,'Userdata',ud);

    % Update static resp toolbar icon and the analysis menu selection.
    update_toolbar('update_all',hFig);
    update_menus('update_analysis',hFig);
end

% [EOF] actionbtns_cbs.m
