added getting started quickhelp menu item, made quick help sticky

This commit is contained in:
Fredrik Osterlind 2012-06-01 10:49:56 +02:00
parent ef2338d2f3
commit be52981bcc

View file

@ -387,11 +387,28 @@ public class GUI extends Observable {
)); ));
quickHelpScroll.setVisible(false); quickHelpScroll.setVisible(false);
loadQuickHelp("KEYBOARD_SHORTCUTS"); loadQuickHelp("KEYBOARD_SHORTCUTS");
loadQuickHelp("GETTING_STARTED");
// Load default and overwrite with user settings (if any) // Load default and overwrite with user settings (if any)
loadExternalToolsDefaultSettings(); loadExternalToolsDefaultSettings();
loadExternalToolsUserSettings(); loadExternalToolsUserSettings();
final boolean showQuickhelp = getExternalToolsSetting("SHOW_QUICKHELP", "true").equalsIgnoreCase("true");
if (showQuickhelp) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JCheckBoxMenuItem checkBox = ((JCheckBoxMenuItem)showQuickHelpAction.getValue("checkbox"));
if (checkBox == null) {
return;
}
if (checkBox.isSelected()) {
return;
}
checkBox.doClick();
}
});
}
/* Debugging - Break on repaints outside EDT */ /* Debugging - Break on repaints outside EDT */
/*RepaintManager.setCurrentManager(new RepaintManager() { /*RepaintManager.setCurrentManager(new RepaintManager() {
public void addDirtyRegion(JComponent comp, int a, int b, int c, int d) { public void addDirtyRegion(JComponent comp, int a, int b, int c, int d) {
@ -1003,6 +1020,7 @@ public class GUI extends Observable {
/* Help */ /* Help */
menu = new JMenu("Help"); menu = new JMenu("Help");
menu.setMnemonic(KeyEvent.VK_H); menu.setMnemonic(KeyEvent.VK_H);
menu.add(new JMenuItem(showGettingStartedAction));
menu.add(new JMenuItem(showKeyboardShortcutsAction)); menu.add(new JMenuItem(showKeyboardShortcutsAction));
JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(showQuickHelpAction); JCheckBoxMenuItem checkBox = new JCheckBoxMenuItem(showQuickHelpAction);
showQuickHelpAction.putValue("checkbox", checkBox); showQuickHelpAction.putValue("checkbox", checkBox);
@ -1971,6 +1989,7 @@ public class GUI extends Observable {
* @return Plugin instance * @return Plugin instance
* @deprecated * @deprecated
*/ */
@Deprecated
public Plugin getStartedPlugin(String classname) { public Plugin getStartedPlugin(String classname) {
return getPlugin(classname); return getPlugin(classname);
} }
@ -4502,6 +4521,7 @@ public class GUI extends Observable {
boolean show = ((JCheckBoxMenuItem) e.getSource()).isSelected(); boolean show = ((JCheckBoxMenuItem) e.getSource()).isSelected();
quickHelpTextPane.setVisible(show); quickHelpTextPane.setVisible(show);
quickHelpScroll.setVisible(show); quickHelpScroll.setVisible(show);
setExternalToolsSetting("SHOW_QUICKHELP", new Boolean(show).toString());
((JPanel)frame.getContentPane()).revalidate(); ((JPanel)frame.getContentPane()).revalidate();
updateDesktopSize(getDesktopPane()); updateDesktopSize(getDesktopPane());
} }
@ -4510,6 +4530,24 @@ public class GUI extends Observable {
return true; return true;
} }
}; };
GUIAction showGettingStartedAction = new GUIAction("Getting started") {
private static final long serialVersionUID = 2382848024856978524L;
public void actionPerformed(ActionEvent e) {
loadQuickHelp("GETTING_STARTED");
JCheckBoxMenuItem checkBox = ((JCheckBoxMenuItem)showQuickHelpAction.getValue("checkbox"));
if (checkBox == null) {
return;
}
if (checkBox.isSelected()) {
return;
}
checkBox.doClick();
}
public boolean shouldBeEnabled() {
return true;
}
};
GUIAction showKeyboardShortcutsAction = new GUIAction("Keyboard shortcuts") { GUIAction showKeyboardShortcutsAction = new GUIAction("Keyboard shortcuts") {
private static final long serialVersionUID = 2382848024856978524L; private static final long serialVersionUID = 2382848024856978524L;
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {