Set top view above side view
This commit is contained in:
parent
a944298624
commit
16ec1ad48f
@ -31,7 +31,7 @@ public class VariableTableModel extends AbstractTableModel {
|
||||
|
||||
//Collections.addAll(types, FlightDataType.ALL_TYPES);
|
||||
//for (CustomExpression expression : doc.getCustomExpressions()){
|
||||
// types.add(expression.getType());
|
||||
// types.add(expression.getCurrentViewType());
|
||||
//}
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,8 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
private static final String ROCKET_FIGURE_PACKAGE = "net.sf.openrocket.gui.rocketfigure";
|
||||
private static final String ROCKET_FIGURE_SUFFIX = "Shapes";
|
||||
|
||||
public static final int VIEW_SIDE = 0;
|
||||
public static final int VIEW_TOP = 1;
|
||||
public static final int VIEW_TOP = 0;
|
||||
public static final int VIEW_SIDE = 1;
|
||||
public static final int VIEW_BACK = 2;
|
||||
|
||||
// Width for drawing normal and selected components
|
||||
@ -149,7 +149,7 @@ public class RocketFigure extends AbstractScaleFigure {
|
||||
}
|
||||
|
||||
|
||||
public RocketPanel.VIEW_TYPE getType() {
|
||||
public RocketPanel.VIEW_TYPE getCurrentViewType() {
|
||||
return currentViewType;
|
||||
}
|
||||
|
||||
|
@ -94,8 +94,8 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
|
||||
private static final String VIEW_TYPE_SEPARATOR = "__SEPARATOR__"; // Dummy string to indicate a horizontal separator item in the view type combobox
|
||||
public enum VIEW_TYPE {
|
||||
SideView(false, RocketFigure.VIEW_SIDE),
|
||||
TopView(false, RocketFigure.VIEW_TOP),
|
||||
SideView(false, RocketFigure.VIEW_SIDE),
|
||||
BackView(false, RocketFigure.VIEW_BACK),
|
||||
SEPARATOR(false, -248), // Horizontal combobox separator dummy item
|
||||
Figure3D(true, RocketFigure3d.TYPE_FIGURE),
|
||||
@ -118,6 +118,10 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
return trans.get("RocketPanel.FigTypeAct." + super.toString());
|
||||
}
|
||||
|
||||
public static VIEW_TYPE getDefaultViewType() {
|
||||
return SideView;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean is3d;
|
||||
@ -315,7 +319,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
JPanel ribbon = new JPanel(new MigLayout("insets 0, fill"));
|
||||
|
||||
// View Type drop-down
|
||||
ComboBoxModel<VIEW_TYPE> cm = new DefaultComboBoxModel<VIEW_TYPE>(VIEW_TYPE.values()) {
|
||||
ComboBoxModel<VIEW_TYPE> cm = new ViewTypeComboBoxModel(VIEW_TYPE.values(), VIEW_TYPE.getDefaultViewType()) {
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object o) {
|
||||
@ -787,7 +791,7 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
}
|
||||
|
||||
if (length > 0 &&
|
||||
((figure.getType() == RocketPanel.VIEW_TYPE.TopView) || (figure.getType() == RocketPanel.VIEW_TYPE.SideView))) {
|
||||
((figure.getCurrentViewType() == RocketPanel.VIEW_TYPE.TopView) || (figure.getCurrentViewType() == RocketPanel.VIEW_TYPE.SideView))) {
|
||||
extraCP.setPosition(cpx, cpy);
|
||||
extraCG.setPosition(cgx, cgy);
|
||||
} else {
|
||||
@ -1075,6 +1079,13 @@ public class RocketPanel extends JPanel implements TreeSelectionListener, Change
|
||||
figure3d.setSelection(components);
|
||||
}
|
||||
|
||||
private static class ViewTypeComboBoxModel extends DefaultComboBoxModel<VIEW_TYPE> {
|
||||
public ViewTypeComboBoxModel(VIEW_TYPE[] items, VIEW_TYPE initialItem) {
|
||||
super(items);
|
||||
super.setSelectedItem(initialItem);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom combobox renderer that supports the display of horizontal separators between items.
|
||||
* ComboBox objects with the text {@link VIEW_TYPE_SEPARATOR} objects in the combobox are replaced by a separator object.
|
||||
|
Loading…
x
Reference in New Issue
Block a user