Adds a "Start Tutorial" entry to the view menu, closes #366

This commit is contained in:
hneemann 2019-10-25 09:46:41 +02:00
parent e96d91742e
commit a2373e39d7
3 changed files with 29 additions and 8 deletions

View File

@ -407,6 +407,16 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
});
treeCheckBox.setAccelerator(KeyStroke.getKeyStroke("F5"));
ToolTipAction tutorial = new ToolTipAction(Lang.get("menu_tutorial")) {
@Override
public void actionPerformed(ActionEvent e) {
if (ClosingWindowListener.checkForSave(Main.this, Main.this)) {
clearPane();
new InitialTutorial(Main.this).setVisible(true);
}
}
}.setToolTip(Lang.get("menu_tutorial_tt"));
if (Settings.getInstance().get(Keys.SETTINGS_DEFAULT_TREESELECT))
SwingUtilities.invokeLater(treeCheckBox::doClick);
@ -423,9 +433,22 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
view.addSeparator();
view.add(treeCheckBox);
view.addSeparator();
view.add(tutorial.createJMenuItem());
view.addSeparator();
view.add(viewHelp.createJMenuItem());
}
private void clearPane() {
circuitComponent.setCircuit(new Circuit());
setFilename(null, true);
windowPosManager.closeAll();
try {
library.setRootFilePath(null);
} catch (IOException e1) {
// can not happen, no folder is scanned
}
}
/**
* Creates the file menu and adds it to menu and toolbar
*
@ -438,14 +461,7 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
@Override
public void actionPerformed(ActionEvent e) {
if (ClosingWindowListener.checkForSave(Main.this, Main.this)) {
circuitComponent.setCircuit(new Circuit());
setFilename(null, true);
windowPosManager.closeAll();
try {
library.setRootFilePath(null);
} catch (IOException e1) {
// can not happen, no folder is scanned
}
clearPane();
}
}
}.setAcceleratorCTRLplus('N').setToolTip(Lang.get("menu_new_tt")).setEnabledChain(allowAll);

View File

@ -1644,6 +1644,8 @@ Sind evtl. die Namen der Variablen nicht eindeutig?</string>
<string name="menu_labelPins">Ein- und Ausgänge benennen</string>
<string name="menu_labelPins_tt">Für alle unbenannten Ein- und Ausgänge eine Bezeichnung setzen.</string>
<string name="menu_tutorial">Tutorial starten</string>
<string name="menu_tutorial_tt">Startet das Anfänger-Tutorial.</string>
<string name="menu_stats">Schaltungsstatistik</string>
<string name="menu_stats_tt">Zeigt eine Liste der verwendeten Komponenten</string>

View File

@ -1624,6 +1624,9 @@
<string name="menu_labelPins">Label Inputs and Outputs</string>
<string name="menu_labelPins_tt">Set a label to all inputs and outputs without a label.</string>
<string name="menu_tutorial">Start Tutorial</string>
<string name="menu_tutorial_tt">Starts the beginner tutorial.</string>
<string name="menu_stats">Circuit Statistics</string>
<string name="menu_stats_tt">Shows a list of used components.</string>
<string name="stat_number">Number</string>