line source
function varargout = specwin_viewer(varargin)
% SPECWIN_VIEWER allows the user to explore spectral windows.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: SPECWIN_VIEWER allows the user to explore spectral windows.
%
% CALL: specwin_viewer
%
%
% VERSION: $Id: specwin_viewer.m,v 1.4 2008/08/04 18:23:04 hewitson Exp $
%
% HISTORY: 07-03-08 M Hewitson
% Creation
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Check if I exist already
id = findobj('Tag', 'LTPDAspecwin_viewer');
if ~isempty(id)
figure(id)
return
end
%% Some initial setup
Gproperties.Gcol = [240 240 240]/255;
Gproperties.Gwidth = 800;
Gproperties.Gheight = 400;
Gproperties.Gborder = 10;
fontsize = getappdata(0, 'ltpda_repo_gui_fontsize');
Gproperties.Screen = get(0,'screensize');
Gproperties.Gposition = [150 ...
150 ...
Gproperties.Gwidth...
Gproperties.Gheight];
% Initialize and hide the GUI as it is being constructed.
mainfig = figure('Name', 'LTPDA Spectral Window Viewer',...
'NumberTitle', 'off',...
'Visible','off',...
'Position',Gproperties.Gposition,...
'Color', Gproperties.Gcol,...
'ToolBar', 'none', ...
'NextPlot', 'new', ...
'MenuBar', 'none',...
'Resize', 'off',...
'Tag', 'LTPDAspecwin_viewer');
% Set mainfig callbacks
set(mainfig, 'CloseRequestFcn', {'ltpda_specwin_viewer_close', mainfig});
% Set Application data
setappdata(mainfig, 'Gproperties', Gproperties);
%% Window selection dialog
%----------------------------------- Window selection box
buildWindowSelectionMenu(mainfig);
%----------------------------------- Window size
sth = uicontrol(mainfig,'Style','text',...
'String','Window Size',...
'BackgroundColor', Gprops.Gcol, ...
'Position',[10 Gprops.Gheight-70 80 25]);
eth = uicontrol(mainfig,'Style','edit',...
'String','100',...
'BackgroundColor', 'w', ...
'Tag', 'LTPDA_specwin_viewer_WinSize', ...
'Position',[100 Gprops.Gheight-70 120 25]);
%------------------------------------- PSLL
sth = uicontrol(mainfig,'Style','text',...
'String','Window PSLL',...
'BackgroundColor', Gprops.Gcol, ...
'Position',[10 Gprops.Gheight-100 80 25]);
eth = uicontrol(mainfig,'Style','edit',...
'String','150',...
'BackgroundColor', 'w', ...
'Tag', 'LTPDA_specwin_viewer_PSLL', ...
'Position',[100 Gprops.Gheight-100 120 25]);
%--------------------------- Build Time-domain Button
pbh = uicontrol(mainfig,'Style','pushbutton',...
'String','Plot Time-domain',...
'Callback', {'ltpda_specwin_viewer_build_window', 'Time-domain'}, ...
'Position',[10 Gprops.Gheight-140 100 25]);
%--------------------------- Build Freq-domain Button
pbh = uicontrol(mainfig,'Style','pushbutton',...
'String','Plot Freq-domain',...
'Callback', {'ltpda_specwin_viewer_build_window', 'Freq-domain'}, ...
'Position',[120 Gprops.Gheight-140 100 25]);
%------------------------- Axes
M = 0.01;
ax = axes('Position', [0.5+M 0.2 0.4 0.7], ...
'Parent', mainfig, ...
'Tag', 'LTPDA_specwin_viewer_axes', ...
'Visible', 'on', ...
'Box', 'on');
setappdata(mainfig, 'axes', ax);
sth = uicontrol(mainfig,'Style','text',...
'String','None',...
'BackgroundColor', Gprops.Gcol, ...
'Tag', 'LTPDA_specwin_viewer_wininfo', ...
'Position',[10 10 300 Gproperties.Gheight/2 - 20], ...
'FontSize', 14, 'ForegroundColor', 'b');
% Constructor text field
sth = uicontrol(mainfig,'Style','edit',...
'String','',...
'BackgroundColor', 'w', ...
'Tag', 'LTPDA_specwin_viewer_cstr', ...
'Position',[10 10 300 25]);
% call callback for window type
ltpda_specwin_viewer_wintype(mainfig);
% draw window
ltpda_specwin_viewer_build_window('Time-domain');
%% Start the GUI
% Make the GUI visible.
set(mainfig,'Visible','on')
%% Sub-functions
%---- Window selection box
function buildWindowSelectionMenu(mainfig)
Gprops = getappdata(mainfig, 'Gproperties');
% get window list
wins = specwin.getTypes;
% text field
sth = uicontrol(mainfig,'Style','text',...
'String','Window Type',...
'BackgroundColor', Gprops.Gcol, ...
'Position',[10 Gprops.Gheight-40 80 25]);
% pop-up dialog
pmh = uicontrol(mainfig,'Style','popupmenu',...
'String', [{'Kaiser'} wins],...
'Value', 1, ...
'BackgroundColor', Gprops.Gcol, ...
'Tag', 'LTPDA_specwin_viewer_WinType', ...
'Callback', {'ltpda_specwin_viewer_wintype', mainfig}, ...
'Position',[100 Gprops.Gheight-40 120 25]);
end
end