Hide tooltips

Added option to help menu to hide all tooltips in the GUI.
This commit is contained in:
Douglas Gillespie 2022-12-19 13:55:27 +00:00
parent 407e9d9d08
commit 4322b2d42b
4 changed files with 60 additions and 4 deletions

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId>
<version>2.02.06b</version>
<version>2.02.06c</version>
<name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>

View File

@ -31,12 +31,12 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f'
*/
static public final String version = "2.02.06b";
static public final String version = "2.02.06c";
/**
* Release date
*/
static public final String date = "28 November 2022";
static public final String date = "13 December 2022";
// /**
// * Release type - Beta or Core

View File

@ -30,6 +30,12 @@ public class GuiParameters implements Serializable, Cloneable {
private String currentSelectedTab;
/**
* Flag to hide all tool tips - which are
* very annoying when they cover controls you want to use!
*/
private boolean hideAllToolTips = false;
/* (non-Javadoc)
* @see java.lang.Object#clone()
@ -61,4 +67,20 @@ public class GuiParameters implements Serializable, Cloneable {
this.currentSelectedTab = currentSelectedTab;
}
/**
* @return the hideAllToolTips
*/
public boolean isHideAllToolTips() {
return hideAllToolTips;
}
/**
* @param hideAllToolTips the hideAllToolTips to set
*/
public void setHideAllToolTips(boolean hideAllToolTips) {
this.hideAllToolTips = hideAllToolTips;
}
}

View File

@ -46,6 +46,7 @@ import java.net.URL;
import java.util.List;
import javax.swing.ImageIcon;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
@ -57,6 +58,7 @@ import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.WindowConstants;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
@ -251,6 +253,8 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
frame.setVisible(true);
hideToolTips(guiParameters.isHideAllToolTips());
somethingShowing = true;
}
@ -820,6 +824,11 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
menuItem.addActionListener(new ClearHiddenWarnings());
menu.add(menuItem);
JCheckBoxMenuItem hideTips = new JCheckBoxMenuItem("Hide all tool tips", guiParameters.isHideAllToolTips());
hideTips.setToolTipText("Hide annoying pop-up tool tips which keep getting in the way");
hideTips.addActionListener(new HideToolTips(hideTips));
menu.add(hideTips);
/*
* Add menu item to redirect output to file or console screen
*
@ -1173,6 +1182,32 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
}
}
private class HideToolTips implements ActionListener {
private JCheckBoxMenuItem hideTipsCheckbox;
public HideToolTips(JCheckBoxMenuItem hideTips) {
this.hideTipsCheckbox = hideTips;
}
@Override
public void actionPerformed(ActionEvent e) {
boolean shouldHide = !guiParameters.isHideAllToolTips();
hideToolTips(shouldHide);
guiParameters.setHideAllToolTips(shouldHide);
hideTipsCheckbox.setSelected(shouldHide);
}
}
/**
* hide all tool tips
* @param hide
*/
private void hideToolTips(boolean hide) {
ToolTipManager.sharedInstance().setEnabled(!hide);
}
class ClearHiddenWarnings implements ActionListener {
public void actionPerformed(ActionEvent ev){
WarnOnce.clearHiddenList(getGuiFrame());
@ -1778,7 +1813,6 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
*/
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
guiParameters = ((GuiParameters) pamControlledUnitSettings.getSettings()).clone();
return true;
}
public PamTabbedPane getMainTab() {