[#898] Change RocketPanel ribbon layout to be two-row + add CG/CP checkbox
This commit is contained in:
parent
c4ffc663bf
commit
5df388bafd
@ -53,6 +53,9 @@ RocketPanel.FigTypeAct.Unfinished = 3D Unfinished
|
|||||||
RocketPanel.lbl.Flightcfg = Flight configuration:
|
RocketPanel.lbl.Flightcfg = Flight configuration:
|
||||||
RocketPanel.lbl.infoMessage = <html>Click to select Shift+click to select other Double-click to edit Click+drag to move
|
RocketPanel.lbl.infoMessage = <html>Click to select Shift+click to select other Double-click to edit Click+drag to move
|
||||||
RocketPanel.lbl.ViewType = View Type:
|
RocketPanel.lbl.ViewType = View Type:
|
||||||
|
RocketPanel.lbl.Zoom = Zoom:
|
||||||
|
RocketPanel.checkbox.ShowCGCP = Show CG/CP
|
||||||
|
RocketPanel.lbl.Stages = Stages:
|
||||||
|
|
||||||
! BasicFrame
|
! BasicFrame
|
||||||
BasicFrame.tab.Rocketdesign = Rocket design
|
BasicFrame.tab.Rocketdesign = Rocket design
|
||||||
|
@ -28,7 +28,7 @@ public class StageSelector extends JPanel implements StateChangeListener {
|
|||||||
private List<JToggleButton> buttons = new ArrayList<JToggleButton>();
|
private List<JToggleButton> buttons = new ArrayList<JToggleButton>();
|
||||||
|
|
||||||
public StageSelector(Rocket _rkt) {
|
public StageSelector(Rocket _rkt) {
|
||||||
super(new MigLayout("gap 0!"));
|
super(new MigLayout("gap 0!, insets 0"));
|
||||||
this.rocket = _rkt;
|
this.rocket = _rkt;
|
||||||
|
|
||||||
updateButtons( this.rocket.getSelectedConfiguration() );
|
updateButtons( this.rocket.getSelectedConfiguration() );
|
||||||
|
@ -31,6 +31,7 @@ import net.sf.openrocket.aerodynamics.AerodynamicCalculator;
|
|||||||
import net.sf.openrocket.aerodynamics.BarrowmanCalculator;
|
import net.sf.openrocket.aerodynamics.BarrowmanCalculator;
|
||||||
import net.sf.openrocket.aerodynamics.FlightConditions;
|
import net.sf.openrocket.aerodynamics.FlightConditions;
|
||||||
import net.sf.openrocket.aerodynamics.WarningSet;
|
import net.sf.openrocket.aerodynamics.WarningSet;
|
||||||
|
import net.sf.openrocket.arch.SystemInfo;
|
||||||
import net.sf.openrocket.document.OpenRocketDocument;
|
import net.sf.openrocket.document.OpenRocketDocument;
|
||||||
import net.sf.openrocket.document.Simulation;
|
import net.sf.openrocket.document.Simulation;
|
||||||
import net.sf.openrocket.document.events.SimulationChangeEvent;
|
import net.sf.openrocket.document.events.SimulationChangeEvent;
|
||||||
@ -298,6 +299,13 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
|
|
||||||
setPreferredSize(new Dimension(800, 300));
|
setPreferredSize(new Dimension(800, 300));
|
||||||
|
|
||||||
|
// MacOS has a larger y gap than other OS'es, so this fixes that
|
||||||
|
int gap = 0;
|
||||||
|
if (SystemInfo.getPlatform() == SystemInfo.Platform.MAC_OS) {
|
||||||
|
gap = -10;
|
||||||
|
}
|
||||||
|
JPanel ribbon = new JPanel(new MigLayout(String.format("inset 0, gapy %d, fill", gap)));
|
||||||
|
|
||||||
// View Type drop-down
|
// View Type drop-down
|
||||||
ComboBoxModel<VIEW_TYPE> cm = new DefaultComboBoxModel<VIEW_TYPE>(VIEW_TYPE.values()) {
|
ComboBoxModel<VIEW_TYPE> cm = new DefaultComboBoxModel<VIEW_TYPE>(VIEW_TYPE.values()) {
|
||||||
|
|
||||||
@ -315,26 +323,42 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
add(new JLabel(trans.get("RocketPanel.lbl.ViewType")), "spanx, split");
|
ribbon.add(new JLabel(trans.get("RocketPanel.lbl.ViewType")), "cell 0 0");
|
||||||
add(new JComboBox<VIEW_TYPE>(cm));
|
ribbon.add(new JComboBox<VIEW_TYPE>(cm), "cell 0 1");
|
||||||
|
|
||||||
// Zoom level selector
|
// Zoom level selector
|
||||||
scaleSelector = new ScaleSelector(scrollPane);
|
scaleSelector = new ScaleSelector(scrollPane);
|
||||||
add(scaleSelector);
|
ribbon.add(new JLabel(trans.get("RocketPanel.lbl.Zoom")), "cell 1 0, center");
|
||||||
|
ribbon.add(scaleSelector, "cell 1 1");
|
||||||
|
|
||||||
|
// Show CG/CP
|
||||||
|
JCheckBox showCGCP = new JCheckBox();
|
||||||
|
showCGCP.setText(trans.get("RocketPanel.checkbox.ShowCGCP"));
|
||||||
|
showCGCP.setSelected(true);
|
||||||
|
ribbon.add(showCGCP, "cell 2 1, gapleft para");
|
||||||
|
|
||||||
|
// Vertical separator
|
||||||
|
JSeparator sep = new JSeparator(SwingConstants.VERTICAL);
|
||||||
|
Dimension d_sep = sep.getPreferredSize();
|
||||||
|
d_sep.height = (int) (0.7 * ribbon.getPreferredSize().height);
|
||||||
|
sep.setPreferredSize(d_sep);
|
||||||
|
ribbon.add(sep, "cell 3 0, spany 2, gapleft para, gapright para");
|
||||||
|
|
||||||
// Stage selector
|
// Stage selector
|
||||||
StageSelector stageSelector = new StageSelector( rkt );
|
StageSelector stageSelector = new StageSelector( rkt );
|
||||||
rkt.addChangeListener(stageSelector);
|
rkt.addChangeListener(stageSelector);
|
||||||
add(stageSelector);
|
ribbon.add(new JLabel(trans.get("RocketPanel.lbl.Stages")), "cell 4 0, pushx");
|
||||||
|
ribbon.add(stageSelector, "cell 4 1, pushx");
|
||||||
|
|
||||||
// Flight configuration selector
|
// Flight configuration selector
|
||||||
//// Flight configuration:
|
//// Flight configuration:
|
||||||
JLabel label = new JLabel(trans.get("RocketPanel.lbl.Flightcfg"));
|
JLabel label = new JLabel(trans.get("RocketPanel.lbl.Flightcfg"));
|
||||||
label.setHorizontalAlignment(JLabel.RIGHT);
|
ribbon.add(label, "cell 5 0");
|
||||||
add(label, "growx, right");
|
|
||||||
|
|
||||||
final ConfigurationComboBox configComboBox = new ConfigurationComboBox(rkt);
|
final ConfigurationComboBox configComboBox = new ConfigurationComboBox(rkt);
|
||||||
add(configComboBox, "wrap, width 16%, wmin 100");
|
ribbon.add(configComboBox, "cell 5 1, width 16%, wmin 100");
|
||||||
|
|
||||||
|
add(ribbon, "growx, span, wrap");
|
||||||
|
|
||||||
// Create slider and scroll pane
|
// Create slider and scroll pane
|
||||||
rotationModel = new DoubleModel(figure, "Rotation", UnitGroup.UNITS_ANGLE, 0, 2 * Math.PI);
|
rotationModel = new DoubleModel(figure, "Rotation", UnitGroup.UNITS_ANGLE, 0, 2 * Math.PI);
|
||||||
@ -350,6 +374,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
|||||||
JLabel l = new JLabel("360" + Chars.DEGREE);
|
JLabel l = new JLabel("360" + Chars.DEGREE);
|
||||||
Dimension d = l.getPreferredSize();
|
Dimension d = l.getPreferredSize();
|
||||||
|
|
||||||
|
// TODO: tooltip
|
||||||
add(rotationSlider = new BasicSlider(rotationModel.getSliderModel(0, 2 * Math.PI), JSlider.VERTICAL, true),
|
add(rotationSlider = new BasicSlider(rotationModel.getSliderModel(0, 2 * Math.PI), JSlider.VERTICAL, true),
|
||||||
"ax 50%, wrap, width " + (d.width + 6) + "px:null:null, growy");
|
"ax 50%, wrap, width " + (d.width + 6) + "px:null:null, growy");
|
||||||
rotationSlider.addChangeListener(new ChangeListener() {
|
rotationSlider.addChangeListener(new ChangeListener() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user