Don't add the component info panel for multi-comp edits
This commit is contained in:
parent
10d36145cf
commit
9311ac27ba
@ -988,7 +988,7 @@ ComponentInfo.PodSet = A <b>pod</b> is a fictional component that acts as an <b>
|
||||
ComponentInfo.NoseCone = A <b>nose cone</b> is the <b>front end</b> of the rocket airframe. Nose cones vary widely in shape.<br>The back end can be cut down to form an <b>internal shoulder</b> that slides inside of a body tube to hold the nose cone in place.
|
||||
ComponentInfo.BodyTube = A <b>body tube</b> is primarily used for the <b>structure</b> of the exterior body of the model rocket.
|
||||
ComponentInfo.Transition = A <b>transition</b> is the part of the airframe that <b>connects</b> two <b>body tubes</b> having <b>different</b> outside <b>diameters</b>.<br>Both ends of a transition are cut down to form an internal shoulder that slides inside of each body tube to hold the transition in place at both ends.
|
||||
ComponentInfo.TrapezoidalFinSet = Fins help <b>stabilize</b> the rocket. The most common fin shape is <b>trapezoidal</b>, four sides with parallel root and tip chords (the edge that glues to the body tube and the outer edge).
|
||||
ComponentInfo.TrapezoidFinSet = Fins help <b>stabilize</b> the rocket. The most common fin shape is <b>trapezoidal</b>, four sides with parallel root and tip chords (the edge that glues to the body tube and the outer edge).
|
||||
ComponentInfo.EllipticalFinSet = Fins help <b>stabilize</b> the rocket. The most efficient fin shape is <b>elliptical</b>. This shape induces the <b>least amount of drag</b> of any fin shape. It is commonly used for competition flying events.
|
||||
ComponentInfo.FreeformFinSet = Fins help <b>stabilize</b> the rocket. The most versatile fin component is the <b>freeform fin</b>. This fin component allows the creation of virtually any solid fin shape, with the ability to manually enter data points or import a shape from an image file.
|
||||
ComponentInfo.TubeFinSet = <b>Tube fins</b> are used to keep the model rocket going <b>straight after launch</b>. Tube fins vary in length and diameter, and may have either straight or curved ends.<br>Currently, OpenRocket only supports straight-perpendicular cut ends.
|
||||
|
@ -73,7 +73,10 @@ public class RocketComponentConfig extends JPanel {
|
||||
protected final JTextField componentNameField;
|
||||
protected JTextArea commentTextArea;
|
||||
private final TextFieldListener textFieldListener;
|
||||
|
||||
|
||||
private DescriptionArea componentInfo;
|
||||
private IconToggleButton infoBtn;
|
||||
|
||||
private JPanel buttonPanel;
|
||||
protected JButton closeButton;
|
||||
private AppearancePanel appearancePanel = null;
|
||||
@ -177,6 +180,12 @@ public class RocketComponentConfig extends JPanel {
|
||||
* Add a section to the component configuration dialog that displays information about the component.
|
||||
*/
|
||||
private void addComponentInfo(JPanel buttonPanel) {
|
||||
// Don't add the info panel if this is a multi-comp edit
|
||||
List<RocketComponent> listeners = component.getConfigListeners();
|
||||
if (listeners != null && listeners.size() > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
final String helpText;
|
||||
final String key = "ComponentInfo." + component.getClass().getSimpleName();
|
||||
if (!trans.checkIfKeyExists(key)) {
|
||||
@ -185,13 +194,13 @@ public class RocketComponentConfig extends JPanel {
|
||||
helpText = "<html>" + trans.get(key) + "</html>";
|
||||
|
||||
// Component info
|
||||
DescriptionArea description = new DescriptionArea(helpText, 5);
|
||||
description.setTextFont(null);
|
||||
description.setVisible(false);
|
||||
this.add(description, "gapleft 10, gapright 10, growx, spanx, wrap");
|
||||
componentInfo = new DescriptionArea(helpText, 5);
|
||||
componentInfo.setTextFont(null);
|
||||
componentInfo.setVisible(false);
|
||||
this.add(componentInfo, "gapleft 10, gapright 10, growx, spanx, wrap");
|
||||
|
||||
// Component info toggle button
|
||||
IconToggleButton infoBtn = new IconToggleButton();
|
||||
infoBtn = new IconToggleButton();
|
||||
infoBtn.setToolTipText(trans.get("RocketCompCfg.btn.ComponentInfo.ttip"));
|
||||
infoBtn.setIconScale(1.2f);
|
||||
infoBtn.setSelectedIcon(Icons.HELP_ABOUT);
|
||||
@ -202,7 +211,7 @@ public class RocketComponentConfig extends JPanel {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
// Note: we will display the help text if the infoButton is not selected, and hide it if it is selected.
|
||||
// This way, the info button is displayed as "enabled" to draw attention to it.
|
||||
description.setVisible(e.getStateChange() != ItemEvent.SELECTED);
|
||||
componentInfo.setVisible(e.getStateChange() != ItemEvent.SELECTED);
|
||||
|
||||
// Repaint to fit to the new size
|
||||
if (parent != null) {
|
||||
@ -217,6 +226,9 @@ public class RocketComponentConfig extends JPanel {
|
||||
}
|
||||
|
||||
protected void addButtons(JButton... buttons) {
|
||||
if (componentInfo != null) {
|
||||
this.remove(componentInfo);
|
||||
}
|
||||
if (buttonPanel != null) {
|
||||
this.remove(buttonPanel);
|
||||
}
|
||||
@ -298,6 +310,11 @@ public class RocketComponentConfig extends JPanel {
|
||||
|
||||
// Multi-comp edit label
|
||||
if (listeners != null && listeners.size() > 0) {
|
||||
if (infoBtn != null) {
|
||||
componentInfo.setVisible(false);
|
||||
infoBtn.setVisible(false);
|
||||
}
|
||||
|
||||
multiCompEditLabel.setText(trans.get("ComponentCfgDlg.MultiComponentEdit"));
|
||||
|
||||
StringBuilder components = new StringBuilder(trans.get("ComponentCfgDlg.MultiComponentEdit.ttip"));
|
||||
@ -311,6 +328,11 @@ public class RocketComponentConfig extends JPanel {
|
||||
}
|
||||
multiCompEditLabel.setToolTipText(components.toString());
|
||||
} else {
|
||||
if (infoBtn != null) {
|
||||
componentInfo.setVisible(false);
|
||||
infoBtn.setSelected(true);
|
||||
infoBtn.setVisible(true);
|
||||
}
|
||||
multiCompEditLabel.setText("");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user