From b26ae9e541070d2518c17be3f49e1924d5959e8d Mon Sep 17 00:00:00 2001 From: Sibo Van Gool Date: Sun, 30 Jan 2022 14:03:29 +0100 Subject: [PATCH] Adapt new/copy config windows popup based on current tab This will make sure that e.g. when you are in the recovery tab and add a new configuration, that the deployment window opens instead of the motor selection window --- .../FlightConfigurationPanel.java | 24 +++++++++++++++++-- .../RecoveryConfigurationPanel.java | 2 +- .../SeparationConfigurationPanel.java | 2 +- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurationPanel.java b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurationPanel.java index 969086d28..132ad0472 100644 --- a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/FlightConfigurationPanel.java @@ -82,7 +82,17 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe motorConfigurationPanel.table.setColumnSelectionInterval(lastCol, lastCol); configurationChanged(ComponentChangeEvent.MOTOR_CHANGE); configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select - motorConfigurationPanel.selectMotor(); + switch (tabs.getSelectedIndex()) { + case MOTOR_TAB_INDEX: + motorConfigurationPanel.selectMotor(); + break; + case RECOVERY_TAB_INDEX: + recoveryConfigurationPanel.selectDeployment(); + break; + case SEPARATION_TAB_INDEX: + separationConfigurationPanel.selectSeparation(); + break; + } } }); @@ -116,7 +126,17 @@ public class FlightConfigurationPanel extends JPanel implements StateChangeListe addOrCopyConfiguration(true); configurationChanged(ComponentChangeEvent.MOTOR_CHANGE); configurationChanged(ComponentChangeEvent.NONFUNCTIONAL_CHANGE); // Trigger select - motorConfigurationPanel.selectMotor(); + switch (tabs.getSelectedIndex()) { + case MOTOR_TAB_INDEX: + motorConfigurationPanel.selectMotor(); + break; + case RECOVERY_TAB_INDEX: + recoveryConfigurationPanel.selectDeployment(); + break; + case SEPARATION_TAB_INDEX: + separationConfigurationPanel.selectSeparation(); + break; + } } }); this.add(copyConfButton, "wrap"); diff --git a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java index 9fd246ec2..46575bc5f 100644 --- a/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java +++ b/swing/src/net/sf/openrocket/gui/main/flightconfigpanel/RecoveryConfigurationPanel.java @@ -97,7 +97,7 @@ public class RecoveryConfigurationPanel extends FlightConfigurablePanel