Skip to content
Snippets Groups Projects
Commit a8c95fd6 authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

- fix issue #12, resolve a bug with all print menus with Matlab version prior...

- fix issue #12, resolve a bug with all print menus with Matlab version prior 8.4 (R2014). Menu print and Print preview are disable for these versions and saveas was replaced by screencapture function from  "undocumented Matlab" web site.
- add version date on the main TSQGQC figure
parent 18675a30
No related branches found
No related tags found
No related merge requests found
......@@ -2,8 +2,10 @@
Contact: <jacques.grelet@ird.fr>
## v1.50RC2 (2019-01-10)
## v1.50RC2 (2019-01-11)
+ fix issue #12, resolve a bug with all print menus with Matlab version prior 8.4 (R2014). Menu print and Print preview are disable for these versions and saveas was replaced by screencapture function from "undocumented Matlab" web site.
+ add version date on the main TSQGQC figure
+ fix issue #11, improve print menu
+ fix issue #9, add a customize menu to select ship size color, track size
+ fix issue #10, add menu "toolbar" to display toolbar icons. Notes that in R2018b, tools such as the zoom, pan, datatip, etc are no longer at the toolbar at the top of the figure window. These buttons are now in an "axes" toolbar and only appear when you hover your mouse over the plot. See: <https://fr.mathworks.com/matlabcentral/answers/419036-what-happened-to-the-figure-toolbar-in-r2018b-why-is-it-an-axes-toolbar-how-can-i-put-the-buttons>
......
File added
/*
* Based on code snippet from
* http://java.sun.com/developer/technicalArticles/releases/data/
*
* Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms.
*/
import java.awt.image.BufferedImage;
import java.awt.datatransfer.*;
public class ImageSelection implements Transferable {
private static final DataFlavor flavors[] =
{DataFlavor.imageFlavor};
private BufferedImage image;
public ImageSelection(BufferedImage image) {
this.image = image;
}
// Transferable
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException {
if (flavor.equals(flavors[0]) == false) {
throw new UnsupportedFlavorException(flavor);
}
return image;
}
public DataFlavor[] getTransferDataFlavors() {
return flavors;
}
public boolean isDataFlavorSupported(DataFlavor
flavor) {
return flavor.equals(flavors[0]);
}
}
\ No newline at end of file
Copyright (c) 2016, Yair Altman
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the distribution
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
This diff is collapsed.
......@@ -54,7 +54,7 @@ global DEFAULT_PATH_FILE
% -------------------------------------------------------------------
VERSION = 1.50; % -> 1.44
CHAR_VERSION = '1.50RC2';
DATE_VERSION = '10/01/2019';
DATE_VERSION = '01/11/2019';
% netcdf file version, see DATA FORMAT TSG document:
% CORTSG_format_gosud.doc
......@@ -90,6 +90,7 @@ DEFAULT_PATH_FILE = regexprep(fulltsgqcname, expr, '');
if (~isdeployed)
p = [pathsep,...
DEFAULT_PATH_FILE,[ 'tsg_util' pathsep],...
DEFAULT_PATH_FILE,[ 'tsg_util/screencapture' pathsep],...
DEFAULT_PATH_FILE,[ 'tsg_data' pathsep],...
DEFAULT_PATH_FILE,[ 'tsg_io' pathsep],...
DEFAULT_PATH_FILE,[ 'tsg_icon' pathsep],...
......@@ -209,7 +210,7 @@ end
% Create and then hide the GUI as it is being constructed.
% --------------------------------------------------------
hMainFig = figure(...
'Name', strcat('TSG Validation - v', CHAR_VERSION), ...
'Name', ['TSG-QC Validation software - IRD - v', CHAR_VERSION, ' - ', DATE_VERSION],...
'NumberTitle', 'off', ...
'Resize', 'on', ...
'Menubar', 'none', ...
......@@ -1031,11 +1032,11 @@ set(hdls(tsg.preference.map.track.size_index), 'checked', 'on');
hMapPrintMenu = uimenu(hMapFig,'Label','Print', ...
'Tag', 'TAG_UIMENU_MAP_PRINT');
uimenu(hMapPrintMenu,'Label','Print Preview',...
hMapPrintPreviewMenu = uimenu(hMapPrintMenu,'Label','Print Preview',...
'Tag','TAG_UIMENU_MAP_PRINT_PREVIEW',...
'Callback', {@mapPrintPreviewCallback});
uimenu(hMapPrintMenu,'Label','Print',...
hMapPrintPrintMenu = uimenu(hMapPrintMenu,'Label','Print',...
'Tag','TAG_UIMENU_MAP_PRINT_PREVIEW',...
'Accelerator','P',...
'Callback', {@mapPrintCallback});
......@@ -3845,6 +3846,22 @@ end
set(findobj('tag', 'TAG_UIMENU_MAP_CLIMATOLOGY_WITH_PCOLOR'),'enable', 'on');
set(findobj('tag', 'TAG_UIMENU_MAP_CLIMATOLOGY_WITH_CONTOURF'),'enable', 'on');
% find all climato on map submenu and set 'checked' property to 'off'
% ------------------------------------------------------------
hdl = findobj( '-regexp', 'tag', 'TAG_UIMENU_MAP_CLIMATOLOGY_WITH_');
set(hdl, 'checked', 'off');
% check menu with the previously selected climatology
% ---------------------------------------------------
switch tsg.preference.map.climatology
case 'pcolor'
set(findobj('tag', 'TAG_UIMENU_MAP_CLIMATOLOGY_WITH_PCOLOR'),'checked', 'on');
case 'contourf'
set(findobj('tag', 'TAG_UIMENU_MAP_CLIMATOLOGY_WITH_CONTOURF'),'checked', 'on');
otherwise
set(findobj('tag', 'TAG_UIMENU_MAP_CLIMATOLOGY_WITH_NONE'),'checked', 'on');
end
% plot climatology
% ----------------
plot_Climatology(hMainFig, hPlotAxes);
......@@ -4043,6 +4060,13 @@ end
% ---------------------
tsg = getappdata( hMainFig, 'tsg_data');
% see issue #12 with bug on Matlab < R2014b
% -----------------------------------------
if verLessThan('matlab','8.4')
set(hMapPrintPrintMenu, 'enable', 'off');
set(hMapPrintPreviewMenu, 'enable', 'off');
end
% check only the selected menu
% -----------------------------
hdls = findobj( '-regexp', 'tag', 'TAG_UIMENU_MAP_CLIMATOLOGY_WITH_');
......@@ -4143,16 +4167,36 @@ end
function mapPrintCallback(src, evnt)
% cache the contourf setting panel before printing
set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'off');
% call the print dialog box
% resize map panel for full figure
if strcmp(tsg.preference.map.climatology, 'contourf')
set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, 1, 1])
end
% call the print dialog box to the figure handle
printdlg(get(get(hPlotAxes(4),'parent'),'parent'));
% enable the contourf setting panel
set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'on');
if strcmp(tsg.preference.map.climatology, 'contourf')
set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, .8, 1])
% enable the contourf setting panel
set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'on');
end
end
% print preview of the map figure, parent of panel and axe
% --------------------------------------------------------
function mapPrintPreviewCallback(src, evnt)
% cache the contourf setting panel before printing
set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'off');
% resize map panel for full figure
if strcmp(tsg.preference.map.climatology, 'contourf')
set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, 1, 1])
end
printpreview(get(get(hPlotAxes(4),'parent'),'parent'));
% resize map panel for axes only when contourf is selected
if strcmp(tsg.preference.map.climatology, 'contourf')
set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, .8, 1])
% enable the contourf setting panel
set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'on');
end
end
% enable toolbar on map figure from menu
......@@ -4184,11 +4228,21 @@ end
% cache the contourf setting panel before printing
set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'off');
% resize map panel for full figure
set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, 1, 1])
if strcmp(tsg.preference.map.climatology, 'contourf')
set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, 1, 1])
end
% save figure to specific file format
saveas(get(get(hPlotAxes(4),'parent'),'parent'), fullfile(path,file));
map_hdl = get(get(hPlotAxes(4), 'parent'), 'parent');
% bug with saveas for version < R2014b when figure as panel children
% -------------------------------------------------------------------
if verLessThan('matlab','8.4')
screencapture(map_hdl, fullfile(path,file));
else
saveas(map_hdl, fullfile(path,file));
end
% resize map panel for axes only when contourf is selected
if strcmp(tsg.preference.map.climatology, 'contourf')
% resize map panel for axes only when contourf is selected
set(findobj('tag', 'TAG_MAP_CLIMATO_AXES'),'Position',[0, 0, .8, 1])
% enable the contourf setting panel
set(findobj('tag', 'TAG_MAP_CLIMATO_UIPANEL'),'Visible', 'on');
......@@ -4859,6 +4913,7 @@ end
% --------------------------------------------------------------
if (~isdeployed)
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_util'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_util/screencapture'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_data'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_io'] );
rmpath( [DEFAULT_PATH_FILE filesep 'tsg_icon'] );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment