Skip to content
Snippets Groups Projects
tsgqc.m 112 KiB
Newer Older
    % Write a .TSG (ascii)  file
    % --------------------------
    error = writeAsciiTsg(hMainFig, strcat(pathName, fileName));
    % Pointer reset to arrow
    % ----------------------
    set( hMainFig, 'Pointer', 'arrow' );

    % enable Quality Control mode
    % ---------------------------
    hdl_pushtool = findobj('Tag', 'QC');
    set(hdl_pushtool, 'Enable', 'on');
    % Set MouseMotion 'on'
    % --------------------
    set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);

    % Check for .TSG writing error - must to be rewriting
    % Because of the 'return' - These line must be at the end
    % --------------------------------------------------------
    if error == -1
      warning('tsgqc:SaveMenuCallback', ...
        'TSG no ouput: %s %s', pathName, fileName);
      return;
    end

  end
%% ExportSampleCallback
% -------------------------------------------------------------------
% Callback function run when the Export menu item is selected
% -------------------------------------------------------------------
  function ExportSampleCallback(hObject, eventdata)

    % Retrieve named application data
    % -------------------------------
    tsg = getappdata( hMainFig, 'tsg_data');
    % Desactivate MouseMotion 'off'
    % ----------------------------
    set( hMainFig, 'WindowButtonMotionFcn', []);

    % Open standard dialog box for saving files
    % -----------------------------------------
    [fileName, pathName, filterindex] = uiputfile('*.spl', ...
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
      'Save file name', strcat(tsg.file.name, '.spl'));

    % if user press cancel button, all var are set to zero
    % ----------------------------------------------------
    if filterindex == 0
    % Pointer set to watch during reading and plotting
    % ------------------------------------------------
    set( hMainFig, 'Pointer', 'watch' );

    % Write a .SPL (ascii)  file
    % --------------------------
    error = writeAsciiSample(hMainFig, strcat(pathName, fileName));

    % Pointer reset to arrow
    % ----------------------
    set( hMainFig, 'Pointer', 'arrow' );

    % enable Quality Control mode
    % ---------------------------
    hdl_pushtool = findobj('Tag', 'QC');
    set(hdl_pushtool, 'Enable', 'on');
    % Set MouseMotion 'on'
    % --------------------
    set( hMainFig, 'WindowButtonMotionFcn', @MouseMotion);

    % Check for .TSG writing error - must to be rewriting
    % Because of the 'return' - These line must be at the end
    % --------------------------------------------------------
    if error == -1
      warning('tsgqc:SaveMenuCallback', ...
        'TSG no ouput: %s %s', pathName, fileName);
      return;
    end
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
% -----------------------------------------------------------------------
% Callback function run when the Edit/Undo menu item is selected (Ctrl+Z)
% -----------------------------------------------------------------------
  function UndoMenuCallback(hObject, eventdata)

    % Undo module not yet implemented
    % -------------------------------
    % msgbox('Undo module not yet implemented', 'modal');
    tsg.queue = undo(tsg.queue);
    tsg.SSPS_QC = get(tsg.queue);
    % Make the Salinity, temperature and velocity plot
    % ------------------------------------------------
    plot_SalTempVel( hMainFig, hPlotAxes );

  end

%% RedoMenuCallback
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
% -----------------------------------------------------------------------
% Callback function run when the Edit/Redo menu item is selected (Ctrl+R)
% -----------------------------------------------------------------------
  function RedoMenuCallback(hObject, eventdata)

    % Redo module not yet implemented
    % -------------------------------
    msgbox('Redo module not yet implemented', 'modal');
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
% -----------------------------------------------------------------
% Callback function run when the Quit Map Figure item is selected
% -----------------------------------------------------------------
  function QuitMapCallback(hObject, eventdata)

    % Make the earth map invisible
    % ----------------------------
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
    set(hMapFig, 'Visible', 'off' );
    set(hMapToggletool, 'state',  'off' );
%% QuitMenuCallback
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
% -----------------------------------------------------------------
% Callback function run when the Quit menu item is selected
% -----------------------------------------------------------------
  function QuitMenuCallback(hObject, eventdata)

    % save config mat file in prefdir
    % -------------------------------
    config_file = [prefdir, filesep, tsgqcname, '.mat'];

    % save preference mat file
    % ------------------------
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
    preference = tsg.preference;
    save( config_file, 'preference');

    % If the data have been modified and not save, the program
    % ask to save the data
    % --------------------------------------------------------
    if  strcmp( get( hSaveMenu, 'UserData' ), 'on')
      selection = ...
        questdlg('The file has been modified.  Do you want to save it ?',...
        'Save before Quit?',...
        'Yes', 'No', 'Yes');
      if strcmp(selection, 'Yes')
        % call File/Save Menu Callback before before quit
        % -----------------------------------------------
        SaveMenuCallback;
      % quit program
      % ------------
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
      quitProgram(DEFAULT_PATH_FILE, hMainFig, hMapFig);

    else
      selection = ...
        questdlg(['Quit ' get(hMainFig, 'Name') '?'],...
        ['Quit ' get(hMainFig, 'Name') '?'],...
        'Yes', 'No', 'Yes');
      if strcmp(selection, 'No')
        return;
      else
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
        quitProgram(DEFAULT_PATH_FILE, hMainFig, hMapFig);
% ----------------
jacques.grelet_ird.fr's avatar
jacques.grelet_ird.fr committed
end