Skip to content

Commit 50169bb

Browse files
feat(simulation): settings for highlight, panel layout, always-visible input
Move diagram highlight mode to Settings (last executed vs next step). Reorder simulation sidebar, show step text in current block, keep input section always visible, remove back arrow. Default code-gen comments off. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent b111d5d commit 50169bb

9 files changed

Lines changed: 233 additions & 129 deletions

File tree

‎release-notes/v1.2.1.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ Patch release **after** **1.2.0**.
77
- **Verzweigung:** Zweige mit Fallnamen `true` / `false` werden nach Namen gewählt (nicht nur nach XML-Reihenfolge) — z. B. nach „Zweige vertauschen“ und Speichern.
88
- **Reset (Stopp):** Schrittliste wird wieder aus dem Diagramm aufgebaut; **neue Eingabe** bei erneutem Lauf (nicht mehr die erste Zahl).
99
- **Modulo / Vergleich:** numerische `String`-Werte in Ausdrücken robuster.
10+
- **Diagramm-Markierung** („Zuletzt ausgeführt“ / „Als Nächstes“) und **Wiedergabe-Geschwindigkeit** unter **Einstellungen → Textvorlagen**, Bereich „Simulation“ (`simulationhighlight`, `simulationplaydelay`).
11+
- **Simulations-Panel:** Reihenfolge Steuerung → Eingabe (immer sichtbar) → Variablen → Aktueller Block (Anweisungstext) → Ausgabe; Zurück-Pfeil entfernt (Rückkehr über Menü/Palette).
12+
13+
## Code-Generator
14+
15+
- **Struktogrammtext als Kommentare** standardmäßig **aus** (`cecomments=0`).
1016

1117
## Speichern
1218

‎src/main/java/de/visustruct/control/GlobalSettings.java‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ private static Font createPreferredDiagramSansFont(int size) {
111111
private static int codeErzeugerEinrueckungProStufe = 3;
112112
/** {@link CodeErzeuger#typJava}, {@link CodeErzeuger#typPython} oder {@link CodeErzeuger#typJavaScript}. */
113113
private static int codeErzeugerProgrammiersprache = CodeErzeuger.typJava;
114-
private static boolean codeErzeugerAlsKommentar = true;
114+
private static boolean codeErzeugerAlsKommentar = false;
115115

116116
private static boolean elementShortcutsVerwenden = true;
117117

@@ -128,6 +128,16 @@ private static Font createPreferredDiagramSansFont(int size) {
128128

129129
private static double simulationPlayDelaySec = DEFAULT_SIMULATION_PLAY_DELAY_SEC;
130130

131+
/** Welcher Block im Diagramm während der Simulation hervorgehoben wird. */
132+
public enum SimulationHighlightMode {
133+
/** Zuletzt ausgeführter Schritt (Standard). */
134+
LAST_EXECUTED,
135+
/** Nächster auszuführender Schritt. */
136+
NEXT_STEP,
137+
}
138+
139+
private static SimulationHighlightMode simulationHighlightMode = SimulationHighlightMode.LAST_EXECUTED;
140+
131141
/**
132142
* Extended-Modifier-Maske für Menü-Kurzbefehle (Strg bzw. ⌘), z. B. für
133143
* {@link javax.swing.KeyStroke#getKeyStroke(int, int)} und {@code KeyEvent#getModifiersEx()}.
@@ -361,6 +371,11 @@ private static void applySettingsFromProperties(Properties pr) {
361371
}
362372
}
363373

374+
s = pr.getProperty("simulationhighlight");
375+
if (s != null && !s.isBlank()) {
376+
setSimulationHighlightMode(parseSimulationHighlightMode(s.trim()));
377+
}
378+
364379
recentDiagramPaths.clear();
365380
for (int i = 0; i < MAX_RECENT_DIAGRAM_FILES; i++) {
366381
s = pr.getProperty("recentdiagram" + i);
@@ -413,6 +428,7 @@ public static void saveSettings(){
413428
properties.setProperty("uilanguage", uiLanguageTag);
414429

415430
properties.setProperty("simulationplaydelay", Double.toString(simulationPlayDelaySec));
431+
properties.setProperty("simulationhighlight", simulationHighlightMode == SimulationHighlightMode.NEXT_STEP ? "next" : "last");
416432

417433
for (int i = 0; i < MAX_RECENT_DIAGRAM_FILES; i++) {
418434
if (i < recentDiagramPaths.size()) {
@@ -706,4 +722,26 @@ public static int getSimulationPlayDelayIndex() {
706722
}
707723
return 1;
708724
}
725+
726+
public static SimulationHighlightMode getSimulationHighlightMode() {
727+
return simulationHighlightMode;
728+
}
729+
730+
public static boolean isSimulationHighlightNextStep() {
731+
return simulationHighlightMode == SimulationHighlightMode.NEXT_STEP;
732+
}
733+
734+
public static void setSimulationHighlightMode(SimulationHighlightMode mode) {
735+
simulationHighlightMode =
736+
mode == SimulationHighlightMode.NEXT_STEP
737+
? SimulationHighlightMode.NEXT_STEP
738+
: SimulationHighlightMode.LAST_EXECUTED;
739+
}
740+
741+
private static SimulationHighlightMode parseSimulationHighlightMode(String raw) {
742+
if ("next".equalsIgnoreCase(raw)) {
743+
return SimulationHighlightMode.NEXT_STEP;
744+
}
745+
return SimulationHighlightMode.LAST_EXECUTED;
746+
}
709747
}

‎src/main/java/de/visustruct/view/EinstellungsDialog.java‎

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public class EinstellungsDialog extends JDialog {
3636

3737
private final GUI hostGui;
3838
private final JComboBox<Double> simulationSpeedCombo;
39+
private final JRadioButton simulationHighlightLastRadio = new JRadioButton();
40+
private final JRadioButton simulationHighlightNextRadio = new JRadioButton();
3941

4042
public EinstellungsDialog(GUI gui, boolean modal) {
4143
super(gui, I18n.tr("dialog.elementText.title"), modal);
@@ -57,10 +59,35 @@ public EinstellungsDialog(GUI gui, boolean modal) {
5759
simulationSpeedCombo.setRenderer(new SimulationSpeedListRenderer());
5860
simulationSpeedCombo.setSelectedIndex(GlobalSettings.getSimulationPlayDelayIndex());
5961

60-
JPanel simulationPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 4));
62+
JPanel simulationPanel = new JPanel();
63+
simulationPanel.setLayout(new BoxLayout(simulationPanel, BoxLayout.Y_AXIS));
6164
simulationPanel.setBorder(BorderFactory.createTitledBorder(I18n.tr("dialog.elementText.simulationSection")));
62-
simulationPanel.add(new JLabel(I18n.tr("dialog.elementText.simulationSpeedLabel")));
63-
simulationPanel.add(simulationSpeedCombo);
65+
66+
JPanel speedRow = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 4));
67+
speedRow.add(new JLabel(I18n.tr("dialog.elementText.simulationSpeedLabel")));
68+
speedRow.add(simulationSpeedCombo);
69+
simulationPanel.add(speedRow);
70+
71+
JPanel highlightBlock = new JPanel();
72+
highlightBlock.setLayout(new BoxLayout(highlightBlock, BoxLayout.Y_AXIS));
73+
highlightBlock.setBorder(BorderFactory.createEmptyBorder(4, 8, 4, 8));
74+
highlightBlock.add(new JLabel(I18n.tr("dialog.elementText.simulationHighlightLabel")));
75+
ButtonGroup highlightGroup = new ButtonGroup();
76+
highlightGroup.add(simulationHighlightLastRadio);
77+
highlightGroup.add(simulationHighlightNextRadio);
78+
simulationHighlightLastRadio.setText(I18n.tr("dialog.elementText.simulationHighlightLast"));
79+
simulationHighlightNextRadio.setText(I18n.tr("dialog.elementText.simulationHighlightNext"));
80+
if (GlobalSettings.isSimulationHighlightNextStep()) {
81+
simulationHighlightNextRadio.setSelected(true);
82+
} else {
83+
simulationHighlightLastRadio.setSelected(true);
84+
}
85+
JPanel highlightRadios = new JPanel(new FlowLayout(FlowLayout.LEFT, 8, 0));
86+
highlightRadios.add(simulationHighlightLastRadio);
87+
highlightRadios.add(simulationHighlightNextRadio);
88+
highlightBlock.add(highlightRadios);
89+
simulationPanel.add(Box.createVerticalStrut(6));
90+
simulationPanel.add(highlightBlock);
6491

6592
int startIdx = GlobalSettings.getElementBeschriftungPresetIndex();
6693
if (startIdx < 0 || startIdx >= ElementBeschriftungPresets.ANZAHL_PRESETS) {
@@ -135,6 +162,10 @@ private void applyAndClose(JRadioButton[] radios) {
135162
if (speed != null) {
136163
GlobalSettings.setSimulationPlayDelaySec(speed);
137164
}
165+
GlobalSettings.setSimulationHighlightMode(
166+
simulationHighlightNextRadio.isSelected()
167+
? GlobalSettings.SimulationHighlightMode.NEXT_STEP
168+
: GlobalSettings.SimulationHighlightMode.LAST_EXECUTED);
138169
int sel = ElementBeschriftungPresets.PRESET_ENGLISH_JAVA;
139170
for (int u = 0; u < radios.length; u++) {
140171
if (radios[u].isSelected()) {
@@ -149,6 +180,7 @@ private void applyAndClose(JRadioButton[] radios) {
149180
hostGui.gibAuswahlPanel().aktualisiereBeschriftungen();
150181
hostGui.gibAuswahlPanel().revalidate();
151182
hostGui.gibAuswahlPanel().repaint();
183+
hostGui.getSimulationPanel().onSimulationSettingsChanged();
152184
SwingUtilities.invokeLater(() -> hostGui.gibAuswahlPanel().aktualisiereBeschriftungen());
153185
});
154186
setVisible(false);

0 commit comments

Comments
 (0)