diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index e55e442e5..cffcc0834 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -829,6 +829,7 @@ RocketCompCfg.outside.stage = Make this Stage Parallel RocketCompCfg.outside.radius = Radial Distance RocketCompCfg.outside.angle = Angle RocketCompCfg.outside.rotation = Rotation +RocketCompCfg.outside.componentname = Name of parent component RocketCompCfg.tab.Figure = Figure RocketCompCfg.tab.Figstyleopt = Figure style options RocketCompCfg.tab.Comment = Comment @@ -1369,6 +1370,7 @@ RocketComponent.Position.BOTTOM = Bottom of the parent component RocketComponent.Position.AFTER = After the parent component RocketComponent.Position.ABSOLUTE = Tip of the nose cone + ! LaunchLug LaunchLug.Launchlug = Launch lug ! NoseCone diff --git a/core/src/net/sf/openrocket/rocketcomponent/Stage.java b/core/src/net/sf/openrocket/rocketcomponent/Stage.java index f568b5d27..079ea9497 100644 --- a/core/src/net/sf/openrocket/rocketcomponent/Stage.java +++ b/core/src/net/sf/openrocket/rocketcomponent/Stage.java @@ -73,58 +73,62 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon public void setOutside(final boolean _outside) { this.outside = _outside; if (this.outside) { - fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE); + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); } } @Override public double getAngularPosition() { - if (this.isInline()) { + if (this.outside) { + return this.position_angular_rad; + } else { return 0.; } - return this.position_angular_rad; + } @Override public void setAngularPosition(final double angle_rad) { this.position_angular_rad = angle_rad; if (this.outside) { - fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE); + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); } } @Override public double getRadialPosition() { - if (this.isInline()) { + if (this.outside) { + return this.position_radial_m; + } else { return 0.; } - return this.position_radial_m; } @Override public void setRadialPosition(final double radius) { this.position_radial_m = radius; if (this.outside) { - fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE); + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); } } @Override public double getRotation() { - if (this.isInline()) { + if (this.outside) { + return this.rotation_rad; + } else { return 0.; } - return this.rotation_rad; + } @Override public void setRotation(final double rotation) { this.rotation_rad = rotation; if (this.outside) { - fireComponentChangeEvent(ComponentChangeEvent.AERODYNAMIC_CHANGE); + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); } - } public RocketComponent.Position getRelativePositionMethod() { @@ -134,6 +138,9 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon @Override public void setRelativePosition(final Position position) { super.setRelativePosition(position); + if (this.outside) { + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); + } } public double getAxialPosition() { @@ -142,6 +149,9 @@ public class Stage extends ComponentAssembly implements FlightConfigurableCompon public void setAxialPosition(final double _pos) { super.setPositionValue(_pos); + if (this.outside) { + fireComponentChangeEvent(ComponentChangeEvent.BOTH_CHANGE); + } } diff --git a/swing/src/net/sf/openrocket/gui/configdialog/StageConfig.java b/swing/src/net/sf/openrocket/gui/configdialog/StageConfig.java index 0586654f4..a60eddea0 100644 --- a/swing/src/net/sf/openrocket/gui/configdialog/StageConfig.java +++ b/swing/src/net/sf/openrocket/gui/configdialog/StageConfig.java @@ -120,9 +120,34 @@ public class StageConfig extends RocketComponentConfig { RocketComponent.Position.ABSOLUTE }); JComboBox combo = new JComboBox( posRelModel ); - motherPanel.add(combo, "spanx, growx, wrap"); + motherPanel.add(combo, "spanx 2, growx, wrap"); parallelEnabledModel.addEnableComponent( positionLabel); + + // setPositions relative to parent component + JLabel parentLabel = new JLabel(trans.get("RocketCompCfg.outside.componentname")); + motherPanel.add( parentLabel); + parallelEnabledModel.addEnableComponent( parentLabel); + + // setPositions relative to parent component +// ComboBoxModel componentModel = new Enj +// JComboBox relToCombo = new JComboBox( componentModel ); + JLabel relToCombo = new JLabel( stage.getParent().getName() ); + motherPanel.add( relToCombo , "growx, wrap"); + parallelEnabledModel.addEnableComponent( relToCombo ); + +// // EnumModel(ChangeSource source, String valueName, Enum[] values) { +// ComboBoxModel posRelModel = new EnumModel(component, "RelativePosition", +// new RocketComponent.Position[] { +// RocketComponent.Position.TOP, +// RocketComponent.Position.MIDDLE, +// RocketComponent.Position.BOTTOM, +// RocketComponent.Position.ABSOLUTE +// }); +// JComboBox combo = new JComboBox( posRelModel ); +// motherPanel.add(combo, "spanx, growx, wrap"); +// parallelEnabledModel.addEnableComponent( positionLabel); +// // plus JLabel positionPlusLabel = new JLabel(trans.get("LaunchLugCfg.lbl.plus")); motherPanel.add( positionPlusLabel );