added "C" shortcut to clock a circuit

This commit is contained in:
hneemann 2017-05-27 19:18:21 +02:00
parent 2b2b685a48
commit ad051da54f
4 changed files with 75 additions and 0 deletions

View File

@ -244,6 +244,8 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
}
}.setToolTip(Lang.get("menu_help_elements_tt")).createJMenuItem());
enableClockShortcut();
setPreferredSize(Screen.getInstance().scale(new Dimension(1024, 768)));
pack();
setLocationRelativeTo(builder.parent);
@ -974,6 +976,27 @@ public final class Main extends JFrame implements ClosingWindowListener.ConfirmS
return false;
}
private void enableClockShortcut() {
new ToolTipAction("doClock") {
@Override
public void actionPerformed(ActionEvent actionEvent) {
if (model != null && !realTimeClockRunning) {
ArrayList<Clock> cl = model.getClocks();
if (cl.size() == 1) {
ObservableValue clkVal = cl.get(0).getClockOutput();
clkVal.setBool(!clkVal.getBool());
try {
model.doStep();
circuitComponent.repaintNeeded();
} catch (NodeException | RuntimeException e) {
showErrorAndStopModel(Lang.get("err_remoteExecution"), e);
}
}
}
}
}.setAccelerator("C").enableAcceleratorIn(circuitComponent);
}
@Override
public void showErrorAndStopModel(String message, Exception cause) {
SwingUtilities.invokeLater(() -> {

View File

@ -177,6 +177,24 @@
</fo:block>
</xsl:template>
<xsl:template match="shortcut">
<fo:block keep-together.within-page="always">
<fo:block margin-top="3mm" margin-bottom="1mm">
<fo:inline padding-right="4pt">
<fo:inline font-weight="bold"
border-width="1pt"
border-style="solid"
padding-top="3pt"
padding-bottom="1pt"
padding-left="2pt"
padding-right="2pt"><xsl:apply-templates select="@key"/></fo:inline>:
</fo:inline>
<xsl:apply-templates/>
</fo:block>
</fo:block>
</xsl:template>
<xsl:template match="lib" mode="full">
<fo:block page-break-after="avoid" margin-top="4mm" margin-bottom="4mm" font-size="16pt" font-weight="bold">
<xsl:value-of select="position()"/>. <xsl:value-of select="@name"/>

View File

@ -235,4 +235,21 @@
erforderlich.</answer>
</faq>
</chapter>
<chapter name="Tastenbelegung">
<shortcut key="Leertaste">Starten und stoppen der Simulation.</shortcut>
<shortcut key="C">Einen Taktschritt ausführen (nur bei gestarteter Simulation und nur, wenn es genau ein Taktelement in der Schaltung gibt).</shortcut>
<shortcut key="STRG-X">Ausschneiden der selektierten Elemente und kopieren in die Zwischenablage.</shortcut>
<shortcut key="STRG-C">Kopieren der selektierten Elemente in die Zwischenablage.</shortcut>
<shortcut key="STRG-V">Einfügen der Elemente aus der Zwischenablage.</shortcut>
<shortcut key="R">Beim Einfügen rotieren der Elemente.</shortcut>
<shortcut key="STRG-S">Speichern der Schaltung.</shortcut>
<shortcut key="STRG-Z">Letzte Änderung zurücknehmen.</shortcut>
<shortcut key="STRG-Y">Zurückgenommene Änderung erneut anwenden.</shortcut>
<shortcut key="P">Programmieren einer Diode oder eines FG-FET.</shortcut>
<shortcut key="D">Beim Ziehen einer rechteckigen Leitung in den Diagonalmodus wechseln.</shortcut>
<shortcut key="F">Beim Ziehen einer rechteckigen Leitung die Orientierung wechseln.</shortcut>
<shortcut key="ESC">Abbrechen der aktuellen Aktion.</shortcut>
<shortcut key="Entfernen">Löschen der selektierten Elemente.</shortcut>
<shortcut key="Rückschritt">Löschen der selektierten Elemente.</shortcut>
</chapter>
</root>

View File

@ -224,4 +224,21 @@
<answer>To program such a chip a special programmer hardware is necessary.</answer>
</faq>
</chapter>
<chapter name="Keyboard Shortcuts">
<shortcut key="Space">Starts or stops the simulation.</shortcut>
<shortcut key="C">A single clock step (Works only in a running simulation and only if there is a single clock component).</shortcut>
<shortcut key="CTRL-X">Cuts the selected components to the clipboard.</shortcut>
<shortcut key="CTRL-C">Copys the selected components to the clipboard.</shortcut>
<shortcut key="CTRL-V">Inserts the comonents from the clipboard.</shortcut>
<shortcut key="R">While inserting this rotates the components.</shortcut>
<shortcut key="CTRL-S">Save the circuit.</shortcut>
<shortcut key="CTRL-Z">Undo last modification.</shortcut>
<shortcut key="CTRL-Y">Redo the last undone modification.</shortcut>
<shortcut key="P">Programs a diode or a FG-FET.</shortcut>
<shortcut key="D">While drawing a wire switches to the diagonal mode.</shortcut>
<shortcut key="F">While drawing a line flips the orientation.</shortcut>
<shortcut key="ESC">Abort the actual action.</shortcut>
<shortcut key="Del">Removes the selected components.</shortcut>
<shortcut key="Backspace">Removes the selected components.</shortcut>
</chapter>
</root>