%DGUICW1D Demonstrates continuous wavelet GUI tools in the Wavelet Toolbox. 

%       M. Misiti, Y. Misiti, G. Oppenheim, J.M. Poggi 12-Mar-96.
%	Last Revision: 01-Oct-97.
%       Copyright (c) 1995-98 by The MathWorks, Inc.
% $Revision: 1.4 $

% Demo initialization ====================
if ~exist('DRVShowGUIFlag'), figNumber = 0; end;

clc;
if wshowdrv('init',figNumber)
    if figNumber==0 
        active_fig = cw1dtool;
	wenamngr('Inactive',active_fig);
    else
        active_fig = demoguim('startshow',figNumber,'cw1dtool');
	wenamngr('Inactive',active_fig);
        wshowdrv('setactfig',figNumber,active_fig);
        return;
    end
end
if exist('wait_mode')~=1 , wait_mode = 1; end
if figNumber , active_fig = wshowdrv('getactfig',figNumber); end

tag_pop_colm    = 'ColM_pop';
tag_cfs_map     = 'Pop_ColorMap';
pop_handles     = findobj(active_fig,'style','popupmenu');
pop_colm        = findobj(pop_handles,'Tag',tag_pop_colm);
pop_map         = findobj(pop_handles,'Tag',tag_cfs_map);
cba_colm        = get(pop_colm,'Callback');
cba_map         = get(pop_map,'Callback');
map_mode        = get(pop_map,'Value');
if map_mode==2 , map_mode = 1; else , map_mode =2; end
str_col         = get(pop_map,'String'); 
str_col         = deblank(str_col(map_mode,:));

cw1dmngr('demo',active_fig,'freqbrk','db1',1,1,32,1);
wenamngr('Inactive',active_fig);
msg = str2mat(...
        ['To change the Colormap use the popupmenu at the ' ...
         'bottom right of the window.'], ...
        ['We select the ' str_col '  colormap']...
        );
if dguiwait('pause',figNumber,0,active_fig,msg); return; end

set(pop_map,'value',map_mode);
eval(cba_map);

if wshowdrv('pause',figNumber,wait_mode), return; end;

msg = str2mat(...
        ['To change the Coloration Mode use the popupmenu in the ' ...
         'middle of the window.'], ...
         'The present mode is the (init+ by scale + abs) mode. ', ...
         'We select the (init+ by scale) mode.'...
        );
if dguiwait('pause',figNumber,0,active_fig,msg); return; end

set(pop_colm,'value',2);
eval(cba_colm);

if wshowdrv('pause',figNumber,wait_mode), return; end;

cw1dmngr('demo',active_fig,'quachirp','db1',1,1,64,1);
wenamngr('Inactive',active_fig);
if wshowdrv('pause',figNumber,wait_mode), return; end;

msg = 'We select the hot colormap';
if dguiwait('pause',figNumber,0,active_fig,msg); return; end

set(pop_map,'value',4);
eval(cba_map);
set([pop_colm;pop_map],'Enable','On');
if figNumber==0
        wshowdrv('pause',figNumber,wait_mode);
        cw1dtool('close',active_fig);
        delete(active_fig)
end
