function quantizationswitch_cb(callback,varargin)
%QUANTIZATIONSWITCH_CB Handles the callback executed by the Turn quantization on
%                      uicontrol.

%   Author(s): P. Costa
%   Copyright 1988-2000 The MathWorks, Inc.
%   $Revision: 1.13 $  $Date: 2000/06/13 21:23:19 $ 

hFig = gcbf;

% Save the current state of the Turn quantization on switch in ud.
saveQSwitchState(hFig);

% Set the file dirty flag because the user made a selection.
setFiledirtyflag(hFig); 

% Convert to dfilt or qfilt depending on the state of the checkbox.
convertfilter(hFig);

% Update other relevant parts of the GUI.
update_analysisframe(hFig);
update_exportdlg('update_all', hFig);
update_convertdlg('update_all', hFig);
update_quantizeparams('update_all', hFig);
update_actionbtn('update_enablestate',hFig); % Update APPLY btn
update_currentfilterinfo('update_all',hFig); 

%-------------------------------------------------------------------------
function saveQSwitchState(hFig)
% SAVEQSWITCHSTATE Save the Turn quantization on checkbox state in ud.

ud = get(hFig,'UserData');

% Get current value of the quantization switch and update ud.
checked = get(ud.h.qswitch.quantizeSwitch,'Value'); % Returns boolean flag.
ud.flags.quantizationswitch = checked;
set(hFig,'UserData',ud);

%-------------------------------------------------------------------------
function setFiledirtyflag(hFig)
% SETFILEDIRTYFLAG Set the file dirty flag and store it in ud.

ud = get(hFig,'UserData');
ud.flags.file_dirty = 1;
set(hFig,'UserData',ud);

% [EOF] quantizationswitch_cb.m
