Skip to content
Snippets Groups Projects
tsgqc_GUI.m 41.3 KiB
Newer Older
% tsgqc_GUI 
% TSG (Thermosalinograph) Quality Control software
%
% $Id$
%

%% COPYRIGHT & LICENSE
%  Copyright 2007 - IRD US191, all rights reserved.
%
%  This file is part of tsgqc_GUI.
%
%    Datagui is free software; you can redistribute it and/or modify
%    it under the terms of the GNU General Public License as published by
%    the Free Software Foundation; either version 2 of the License, or
%    (at your option) any later version.
%
%    tsgqc_GUI is distributed in the hope that it will be useful,
%    but WITHOUT ANY WARRANTY; without even the implied warranty of
%    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%    GNU General Public License for more details.
%
%    You should have received a copy of the GNU General Public License
%    along with Datagui; if not, write to the Free Software
%    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

%%  Initialization tasks
%   ********************
    % functions (icons) should be store at a lower level
    % add directories to Matlab search path, works on UNIX
    % and Windows host
    % ---------------------------------------------------
    tsgqcname = mfilename;
    fulltsgqcname = mfilename('fullpath');
    DEFAULT_PATH_FILE = strrep(fulltsgqcname, tsgqcname, '') ;
    p = [pathsep,...
         DEFAULT_PATH_FILE,[filesep 'tsg_util' pathsep],...
         DEFAULT_PATH_FILE,[filesep 'tsg_data' pathsep]
        ];
    addpath( p, '-END' );
    rehash;
    % Screen limits for the GUI
    % -------------------------
    set(0,'Units','normalized');
    guiLimits = get(0,'ScreenSize');
    guiLimits(1) = guiLimits(1) + 0.05;
    guiLimits(2) = guiLimits(2) + 0.1;
    guiLimits(3) = guiLimits(3) - 0.1;
    guiLimits(4) = guiLimits(4) - 0.2;
    
    % Create and then hide the GUI as it is being constructed.
    % --------------------------------------------------------
    hMainFig = figure(...
                'Name', 'TSG Validation', ...
                'NumberTitle', 'off', ...
                'Resize', 'on', ...
                'Menubar','none', ...
                'Toolbar', 'none', ...
                'UserData', 'ButtonMotionOff', ...
                'WindowButtonMotionFcn', @MouseMotion, ...
                'HandleVisibility','callback',...
                'Visible','on',...
                'Units', 'normalized',...
                'Position',guiLimits, ...
                'Color', get( 0, 'DefaultUIControlBackgroundColor' ));
    
    %  Construct the Menu
    %   -----------------
    hFileMenu = uimenu(...
                    'Parent', hMainFig,...
                    'HandleVisibility','callback',...
                    'Label', 'File');
    hOpenMenu = uimenu(...
                    'Parent', hFileMenu,...
                    'UserData', 'off', ...
                    'Label','Open',...
                    'Accelerator','O',...
                    'HandleVisibility','callback',...
                    'Callback', @OpenMenuCallback);
    hSaveMenu = uimenu(...
                    'Parent', hFileMenu,...
                    'Label','Save',...
                    'Accelerator','S',...
                    'UserData', 'off', ...
                    'HandleVisibility','callback',...
                    'Callback',@SaveMenuCallback);
    hQuitMenu = uimenu(...
                    'Parent',hFileMenu,...
                    'Label','Quit',...
                    'Separator','on',...
                    'Accelerator','Q',...
                    'HandleVisibility','callback',...
                    'Callback',@QuitMenuCallback);

    %  Construct the Toolbar
    %   -----------------
    hToolbar       =   uitoolbar(...   % Toolbar for Open and Print buttons
                        'Parent',hMainFig, ...
                        'HandleVisibility','callback');
    hOpenPushtool  =   uipushtool(...   % Opendoc toolbar button
                        'Parent',hToolbar,...
                        'TooltipString','Open file',...
                        'CData', iconRead(fullfile(matlabroot, ...
                                     '/toolbox/matlab/icons/opendoc.mat')),...
                        'HandleVisibility','callback', ...
                        'Tag','PUSHTOOL_OPEN',...
                        'UserData', 'off',...
                        'Enable', 'on',...
                        'ClickedCallback', @OpenMenuCallback);
    hSavePushtool  =   uipushtool(...   % Open Save toolbar button
                        'TooltipString','Save NetCDF file',...
                           [DEFAULT_PATH_FILE 'tsg_icon' filesep 'savedoc.mat']),...
                        'HandleVisibility','callback', ...
                        'Tag','PUSHTOOL_SAVE',...
                        'Enable', 'off',...
                        'ClickedCallback', @SaveMenuCallback);
    hZoomPushtool  =   uipushtool(...   % Open Zoom toolbar button
                        'Parent',hToolbar,...
                        'Separator', 'on', ...
                        'TooltipString','Zoom',...
                        'CData', iconRead(fullfile(matlabroot, ...
                                     '/toolbox/matlab/icons/zoom.mat')),...
                        'HandleVisibility','callback', ...
                        'Tag','PUSHTOOL_ZOOM',...
                        'Enable', 'off',...
                        'ClickedCallback', @ZoomMenuCallback);
    hPanPushtool  =   uipushtool(...   % Open Pan toolbar button
                        'Parent',hToolbar,...
                        'TooltipString','Pan',...
                        'CData',iconRead(fullfile(matlabroot, ...
                                      '/toolbox/matlab/icons/pan.mat')),...
                        'HandleVisibility','callback', ...
                        'Tag','PUSHTOOL_PAN',...
                        'Enable', 'off',...
                        'ClickedCallback', @PanMenuCallback);
    hQCPushtool  =   uipushtool(...   % Open QC toolbar button
                        'Parent',hToolbar,...
                        'TooltipString','Validation codes',...
                        'Separator', 'on', ...
                        'CData',iconRead(...
                            [DEFAULT_PATH_FILE 'tsg_icon' filesep 'qcicon.mat']),...
                        'HandleVisibility','callback', ...
                        'Tag','QC',...
                        'UserData', 'off',...
                        'Enable', 'off',...
                        'ClickedCallback', @QCMenuCallback);
    hMapPushtool  =   uipushtool(...   % Open Map toolbar button
                        'Parent',hToolbar,...
                        'TooltipString','Map and ship track',...
                        'Separator', 'on', ...
                        'CData',iconRead(...
                            [DEFAULT_PATH_FILE 'tsg_icon' filesep 'mapicon.mat']),...
                        'HandleVisibility','callback', ...
                        'Tag','PUSHTOOL_MAP',...
                        'UserData', 'off', ...
                        'Enable', 'off',...
                        'ClickedCallback', @MapMenuCallback);
    hClimPushtool  =   uipushtool(...   % Open Climatology toolbar button
                        'Parent',hToolbar,...
                        'TooltipString','Climatology',...
                        'Separator', 'on', ...
                        'CData',iconRead(...
                           [DEFAULT_PATH_FILE 'tsg_icon' filesep 'climicon.mat']),...
                        'HandleVisibility','callback', ...
                        'Tag','PUSHTOOL_CLIM',...
                        'UserData', 'off',...
                        'Enable', 'off',...
                        'ClickedCallback', @ClimMenuCallback);
    hBottlePushtool  = uipushtool(...   % Open toolbar button
                        'Parent',hToolbar,...
Yves Gouriou's avatar
Yves Gouriou committed
                        'TooltipString','Plot the Samples',...
                        'Separator', 'on', ...
                        'CData',iconRead(...
                         [DEFAULT_PATH_FILE 'tsg_icon' filesep 'bottleicon.mat']),...
                        'HandleVisibility','callback', ...
                        'Tag','BOTTLE',...
                        'Enable', 'off',...
                        'ClickedCallback', @BottleMenuCallback);
    hHeaderPushtool  = uipushtool(...   % Open headerForm button
                        'Parent',hToolbar,...
                        'TooltipString','Fill the header form',...
                        'Separator', 'on', ...
                        'CData',iconRead(...
                         [DEFAULT_PATH_FILE 'tsg_icon' filesep 'hdricon.mat']),...
                        'HandleVisibility','callback', ...
                        'Tag','PUSHTOOL_HEADER',...
                        'Enable', 'off',...
                        'ClickedCallback', @HeaderMenuCallback);                      

    % Static text that displays the position, salinity and temperature
    % ----------------------------------------------------------------
Loading
Loading full blame...