Removed display tab for now. Preference reorganization complete.

This commit is contained in:
Craig Earls 2014-12-24 18:07:13 -08:00
parent ff2f68962c
commit ba2590ee04
6 changed files with 174 additions and 111 deletions

View File

@ -81,7 +81,7 @@ public class SimulationOptions implements ChangeSource, Cloneable {
private double launchTemperature = preferences.getDouble(Preferences.LAUNCH_TEMPERATURE, ExtendedISAModel.STANDARD_TEMPERATURE); private double launchTemperature = preferences.getDouble(Preferences.LAUNCH_TEMPERATURE, ExtendedISAModel.STANDARD_TEMPERATURE);
private double launchPressure = preferences.getDouble(Preferences.LAUNCH_PRESSURE, ExtendedISAModel.STANDARD_PRESSURE); private double launchPressure = preferences.getDouble(Preferences.LAUNCH_PRESSURE, ExtendedISAModel.STANDARD_PRESSURE);
private double timeStep = RK4SimulationStepper.RECOMMENDED_TIME_STEP; private double timeStep = preferences.getDouble(Preferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP);
private double maximumAngle = RK4SimulationStepper.RECOMMENDED_ANGLE_STEP; private double maximumAngle = RK4SimulationStepper.RECOMMENDED_ANGLE_STEP;
private int randomSeed = new Random().nextInt(); private int randomSeed = new Random().nextInt();
@ -91,8 +91,6 @@ public class SimulationOptions implements ChangeSource, Cloneable {
private List<EventListener> listeners = new ArrayList<EventListener>(); private List<EventListener> listeners = new ArrayList<EventListener>();
public SimulationOptions(Rocket rocket) { public SimulationOptions(Rocket rocket) {
this.rocket = rocket; this.rocket = rocket;
} }

View File

@ -20,10 +20,12 @@ import net.sf.openrocket.rocketcomponent.LaunchLug;
import net.sf.openrocket.rocketcomponent.MassObject; import net.sf.openrocket.rocketcomponent.MassObject;
import net.sf.openrocket.rocketcomponent.RecoveryDevice; import net.sf.openrocket.rocketcomponent.RecoveryDevice;
import net.sf.openrocket.rocketcomponent.RocketComponent; import net.sf.openrocket.rocketcomponent.RocketComponent;
import net.sf.openrocket.simulation.RK4SimulationStepper;
import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.BugException;
import net.sf.openrocket.util.BuildProperties; import net.sf.openrocket.util.BuildProperties;
import net.sf.openrocket.util.ChangeSource; import net.sf.openrocket.util.ChangeSource;
import net.sf.openrocket.util.Color; import net.sf.openrocket.util.Color;
import net.sf.openrocket.util.GeodeticComputationStrategy;
import net.sf.openrocket.util.LineStyle; import net.sf.openrocket.util.LineStyle;
import net.sf.openrocket.util.MathUtil; import net.sf.openrocket.util.MathUtil;
import net.sf.openrocket.util.StateChangeListener; import net.sf.openrocket.util.StateChangeListener;
@ -84,6 +86,7 @@ public abstract class Preferences implements ChangeSource {
public static final String LAUNCH_PRESSURE = "LaunchPressure"; public static final String LAUNCH_PRESSURE = "LaunchPressure";
public static final String LAUNCH_USE_ISA = "LaunchUseISA"; public static final String LAUNCH_USE_ISA = "LaunchUseISA";
public static final String SIMULATION_TIME_STEP = "SimulationTimeStep"; public static final String SIMULATION_TIME_STEP = "SimulationTimeStep";
public static final String GEODETIC_COMPUTATION = "GeodeticComputationStrategy";
private static final AtmosphericModel ISA_ATMOSPHERIC_MODEL = new ExtendedISAModel(); private static final AtmosphericModel ISA_ATMOSPHERIC_MODEL = new ExtendedISAModel();
@ -377,7 +380,7 @@ public abstract class Preferences implements ChangeSource {
* *
* @return an AtmosphericModel object. * @return an AtmosphericModel object.
*/ */
private AtmosphericModel getAtmosphericModel() { public AtmosphericModel getAtmosphericModel() {
if (this.getBoolean(LAUNCH_USE_ISA, true)) { if (this.getBoolean(LAUNCH_USE_ISA, true)) {
return ISA_ATMOSPHERIC_MODEL; return ISA_ATMOSPHERIC_MODEL;
} }
@ -385,13 +388,20 @@ public abstract class Preferences implements ChangeSource {
this.getDouble(LAUNCH_PRESSURE, ExtendedISAModel.STANDARD_PRESSURE)); this.getDouble(LAUNCH_PRESSURE, ExtendedISAModel.STANDARD_PRESSURE));
} }
public GeodeticComputationStrategy getGeodeticComputation() {
return this.getEnum(GEODETIC_COMPUTATION, GeodeticComputationStrategy.SPHERICAL);
}
public void setGeodeticComputation(GeodeticComputationStrategy gcs) {
this.putEnum(GEODETIC_COMPUTATION, gcs);
}
public double getTimeStep() { public double getTimeStep() {
return this.getDouble(this.SIMULATION_TIME_STEP, 0.05); return this.getDouble(Preferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP);
} }
public void setTimeStep(double timeStep) { public void setTimeStep(double timeStep) {
if (MathUtil.equals(this.getDouble(SIMULATION_TIME_STEP, 0.05), timeStep)) if (MathUtil.equals(this.getDouble(SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP), timeStep))
return; return;
this.putDouble(SIMULATION_TIME_STEP, timeStep); this.putDouble(SIMULATION_TIME_STEP, timeStep);
fireChangeEvent(); fireChangeEvent();
@ -727,6 +737,7 @@ public abstract class Preferences implements ChangeSource {
DEFAULT_LINE_STYLES.put(RocketComponent.class, LineStyle.SOLID.name()); DEFAULT_LINE_STYLES.put(RocketComponent.class, LineStyle.SOLID.name());
DEFAULT_LINE_STYLES.put(MassObject.class, LineStyle.DASHED.name()); DEFAULT_LINE_STYLES.put(MassObject.class, LineStyle.DASHED.name());
} }
private static final HashMap<Class<?>, String> DEFAULT_COLORS = new HashMap<Class<?>, String>(); private static final HashMap<Class<?>, String> DEFAULT_COLORS = new HashMap<Class<?>, String>();
static { static {
DEFAULT_COLORS.put(BodyComponent.class, "0,0,240"); DEFAULT_COLORS.put(BodyComponent.class, "0,0,240");

View File

@ -47,7 +47,7 @@ public enum GeodeticComputationStrategy {
}, },
/** /**
* Perform geodetic computations with a spherical Earch approximation. * Perform geodetic computations with a spherical Earth approximation.
*/ */
SPHERICAL { SPHERICAL {

View File

@ -52,21 +52,24 @@ import net.sf.openrocket.util.StateChangeListener;
public class AppearancePanel extends JPanel { public class AppearancePanel extends JPanel {
private static final Translator trans = Application.getTranslator(); private static final Translator trans = Application.getTranslator();
private EditDecalHelper editDecalHelper = Application.getInjector().getInstance(EditDecalHelper.class); private EditDecalHelper editDecalHelper = Application.getInjector()
.getInstance(EditDecalHelper.class);
private AppearanceBuilder ab; private AppearanceBuilder ab;
// We hang on to the user selected appearance when switching to default appearance. // We hang on to the user selected appearance when switching to default
// appearance.
// this appearance is restored if the user unchecks the "default" button. // this appearance is restored if the user unchecks the "default" button.
private Appearance previousUserSelectedAppearance = null; private Appearance previousUserSelectedAppearance = null;
// We cache the default appearance for this component to make switching faster. // We cache the default appearance for this component to make switching
// faster.
private Appearance defaultAppearance = null; private Appearance defaultAppearance = null;
/** /**
* A non-unit that adjusts by a small amount, suitable for * A non-unit that adjusts by a small amount, suitable for values that are
* values that are on the 0-1 scale * on the 0-1 scale
*/ */
private final static UnitGroup TEXTURE_UNIT = new UnitGroup(); private final static UnitGroup TEXTURE_UNIT = new UnitGroup();
static { static {
@ -75,46 +78,52 @@ public class AppearancePanel extends JPanel {
public double getNextValue(double value) { public double getNextValue(double value) {
return value + .1; return value + .1;
} }
@Override @Override
public double getPreviousValue(double value) { public double getPreviousValue(double value) {
return value - .1; return value - .1;
} }
}; };
TEXTURE_UNIT.addUnit(no_unit); TEXTURE_UNIT.addUnit(no_unit);
} }
private static final JColorChooser colorChooser = new JColorChooser(); private static final JColorChooser colorChooser = new JColorChooser();
private class ColorActionListener implements ActionListener { private class ColorActionListener implements ActionListener {
private final String valueName; private final String valueName;
private final Object o; private final Object o;
ColorActionListener(final Object o, final String valueName) { ColorActionListener(final Object o, final String valueName) {
this.valueName = valueName; this.valueName = valueName;
this.o = o; this.o = o;
} }
@Override @Override
public void actionPerformed(ActionEvent colorClickEvent) { public void actionPerformed(ActionEvent colorClickEvent) {
try { try {
final Method getMethod = o.getClass().getMethod("get" + valueName); final Method getMethod = o.getClass().getMethod(
final Method setMethod = o.getClass().getMethod("set" + valueName, net.sf.openrocket.util.Color.class); "get" + valueName);
net.sf.openrocket.util.Color c = (net.sf.openrocket.util.Color) getMethod.invoke(o); final Method setMethod = o.getClass().getMethod(
"set" + valueName, net.sf.openrocket.util.Color.class);
net.sf.openrocket.util.Color c = (net.sf.openrocket.util.Color) getMethod
.invoke(o);
Color awtColor = ColorConversion.toAwtColor(c); Color awtColor = ColorConversion.toAwtColor(c);
colorChooser.setColor(awtColor); colorChooser.setColor(awtColor);
JDialog d = JColorChooser.createDialog(AppearancePanel.this, JDialog d = JColorChooser.createDialog(AppearancePanel.this,
trans.get("RocketCompCfg.lbl.Choosecolor"), true, colorChooser, new ActionListener() { trans.get("RocketCompCfg.lbl.Choosecolor"), true,
colorChooser, new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent okEvent) { public void actionPerformed(ActionEvent okEvent) {
Color selected = colorChooser.getColor(); Color selected = colorChooser.getColor();
if (selected == null) if (selected == null)
return; return;
try { try {
setMethod.invoke(o, ColorConversion.fromAwtColor(selected)); setMethod.invoke(o, ColorConversion
.fromAwtColor(selected));
} catch (Throwable e1) { } catch (Throwable e1) {
Application.getExceptionHandler().handleErrorCondition(e1); Application.getExceptionHandler()
.handleErrorCondition(e1);
} }
} }
}, null); }, null);
@ -124,30 +133,34 @@ public class AppearancePanel extends JPanel {
} }
} }
} }
public AppearancePanel(final OpenRocketDocument document, final RocketComponent c) { public AppearancePanel(final OpenRocketDocument document,
final RocketComponent c) {
super(new MigLayout("fill", "[150][grow][150][grow]")); super(new MigLayout("fill", "[150][grow][150][grow]"));
previousUserSelectedAppearance = c.getAppearance(); previousUserSelectedAppearance = c.getAppearance();
defaultAppearance = DefaultAppearance.getDefaultAppearance(c); defaultAppearance = DefaultAppearance.getDefaultAppearance(c);
if (previousUserSelectedAppearance == null) { if (previousUserSelectedAppearance == null) {
previousUserSelectedAppearance = new AppearanceBuilder().getAppearance(); previousUserSelectedAppearance = new AppearanceBuilder()
.getAppearance();
ab = new AppearanceBuilder(defaultAppearance); ab = new AppearanceBuilder(defaultAppearance);
} else { } else {
ab = new AppearanceBuilder(previousUserSelectedAppearance); ab = new AppearanceBuilder(previousUserSelectedAppearance);
} }
net.sf.openrocket.util.Color figureColor = c.getColor(); net.sf.openrocket.util.Color figureColor = c.getColor();
if (figureColor == null) { if (figureColor == null) {
figureColor = Application.getPreferences().getDefaultColor(c.getClass()); figureColor = Application.getPreferences().getDefaultColor(
c.getClass());
} }
final JButton figureColorButton = new JButton(new ColorIcon(figureColor)); final JButton figureColorButton = new JButton(
new ColorIcon(figureColor));
final JButton colorButton = new JButton(new ColorIcon(ab.getPaint())); final JButton colorButton = new JButton(new ColorIcon(ab.getPaint()));
final DecalModel decalModel = new DecalModel(this, document, ab); final DecalModel decalModel = new DecalModel(this, document, ab);
final JComboBox textureDropDown = new JComboBox(decalModel); final JComboBox textureDropDown = new JComboBox(decalModel);
ab.addChangeListener(new StateChangeListener() { ab.addChangeListener(new StateChangeListener() {
@Override @Override
public void stateChanged(EventObject e) { public void stateChanged(EventObject e) {
@ -157,25 +170,26 @@ public class AppearancePanel extends JPanel {
decalModel.refresh(); decalModel.refresh();
} }
}); });
c.addChangeListener(new StateChangeListener() { c.addChangeListener(new StateChangeListener() {
@Override @Override
public void stateChanged(EventObject e) { public void stateChanged(EventObject e) {
net.sf.openrocket.util.Color col = c.getColor(); net.sf.openrocket.util.Color col = c.getColor();
if (col == null) { if (col == null) {
col = Application.getPreferences().getDefaultColor(c.getClass()); col = Application.getPreferences().getDefaultColor(
c.getClass());
} }
figureColorButton.setIcon(new ColorIcon(col)); figureColorButton.setIcon(new ColorIcon(col));
} }
}); });
figureColorButton.addActionListener(new ColorActionListener(c, "Color")); figureColorButton
.addActionListener(new ColorActionListener(c, "Color"));
colorButton.addActionListener(new ColorActionListener(ab, "Paint")); colorButton.addActionListener(new ColorActionListener(ab, "Paint"));
BooleanModel mDefault = new BooleanModel(c.getAppearance() == null); BooleanModel mDefault = new BooleanModel(c.getAppearance() == null);
BooleanModel fDefault = new BooleanModel(c.getColor() == null); BooleanModel fDefault = new BooleanModel(c.getColor() == null);
{// Style Header Row {// Style Header Row
final JCheckBox colorDefault = new JCheckBox(fDefault); final JCheckBox colorDefault = new JCheckBox(fDefault);
colorDefault.addActionListener(new ActionListener() { colorDefault.addActionListener(new ActionListener() {
@ -185,25 +199,33 @@ public class AppearancePanel extends JPanel {
c.setColor(null); c.setColor(null);
c.setLineStyle(null); c.setLineStyle(null);
} else { } else {
c.setColor(((SwingPreferences) Application.getPreferences()).getDefaultColor(c.getClass())); c.setColor(((SwingPreferences) Application
c.setLineStyle(((SwingPreferences) Application.getPreferences()).getDefaultLineStyle(c.getClass())); .getPreferences()).getDefaultColor(c.getClass()));
c.setLineStyle(((SwingPreferences) Application
.getPreferences()).getDefaultLineStyle(c
.getClass()));
} }
} }
}); });
colorDefault.setText(trans.get("RocketCompCfg.checkbox.Usedefaultcolor")); colorDefault.setText(trans
add(new StyledLabel(trans.get("RocketCompCfg.lbl.Figurestyle"), Style.BOLD)); .get("RocketCompCfg.checkbox.Usedefaultcolor"));
add(new StyledLabel(trans.get("RocketCompCfg.lbl.Figurestyle"),
Style.BOLD));
add(colorDefault); add(colorDefault);
JButton button = new JButton(trans.get("RocketCompCfg.but.Saveasdefstyle")); JButton button = new JButton(
trans.get("RocketCompCfg.but.Saveasdefstyle"));
button.addActionListener(new ActionListener() { button.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (c.getColor() != null) { if (c.getColor() != null) {
((SwingPreferences) Application.getPreferences()).setDefaultColor(c.getClass(), c.getColor()); ((SwingPreferences) Application.getPreferences())
.setDefaultColor(c.getClass(), c.getColor());
c.setColor(null); c.setColor(null);
} }
if (c.getLineStyle() != null) { if (c.getLineStyle() != null) {
Application.getPreferences().setDefaultLineStyle(c.getClass(), c.getLineStyle()); Application.getPreferences().setDefaultLineStyle(
c.getClass(), c.getLineStyle());
c.setLineStyle(null); c.setLineStyle(null);
} }
} }
@ -211,39 +233,43 @@ public class AppearancePanel extends JPanel {
fDefault.addEnableComponent(button, false); fDefault.addEnableComponent(button, false);
add(button, "span 2, align right, wrap"); add(button, "span 2, align right, wrap");
} }
{// Figure Color {// Figure Color
add(new JLabel(trans.get("RocketCompCfg.lbl.Componentcolor"))); add(new JLabel(trans.get("RocketCompCfg.lbl.Componentcolor")));
fDefault.addEnableComponent(figureColorButton, false); fDefault.addEnableComponent(figureColorButton, false);
add(figureColorButton); add(figureColorButton);
} }
{// Line Style {// Line Style
add(new JLabel(trans.get("RocketCompCfg.lbl.Complinestyle"))); add(new JLabel(trans.get("RocketCompCfg.lbl.Complinestyle")));
LineStyle[] list = new LineStyle[LineStyle.values().length + 1]; LineStyle[] list = new LineStyle[LineStyle.values().length + 1];
System.arraycopy(LineStyle.values(), 0, list, 1, LineStyle.values().length); System.arraycopy(LineStyle.values(), 0, list, 1,
LineStyle.values().length);
JComboBox combo = new JComboBox(new EnumModel<LineStyle>(c, "LineStyle",
//// Default style JComboBox combo = new JComboBox(new EnumModel<LineStyle>(c,
"LineStyle",
// // Default style
list, trans.get("LineStyle.Defaultstyle"))); list, trans.get("LineStyle.Defaultstyle")));
fDefault.addEnableComponent(combo, false); fDefault.addEnableComponent(combo, false);
add(combo, "wrap"); add(combo, "wrap");
} }
add(new JSeparator(SwingConstants.HORIZONTAL), "span, wrap, growx"); add(new JSeparator(SwingConstants.HORIZONTAL), "span, wrap, growx");
{// Texture Header Row {// Texture Header Row
add(new StyledLabel(trans.get("AppearanceCfg.lbl.Appearance"), Style.BOLD)); add(new StyledLabel(trans.get("AppearanceCfg.lbl.Appearance"),
Style.BOLD));
final JCheckBox materialDefault = new JCheckBox(mDefault); final JCheckBox materialDefault = new JCheckBox(mDefault);
materialDefault.addActionListener(new ActionListener() { materialDefault.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (materialDefault.isSelected()) { if (materialDefault.isSelected()) {
previousUserSelectedAppearance = (ab == null) ? null : ab.getAppearance(); previousUserSelectedAppearance = (ab == null) ? null
: ab.getAppearance();
ab.setAppearance(defaultAppearance); ab.setAppearance(defaultAppearance);
} else { } else {
ab.setAppearance(previousUserSelectedAppearance); ab.setAppearance(previousUserSelectedAppearance);
@ -253,16 +279,18 @@ public class AppearancePanel extends JPanel {
materialDefault.setText(trans.get("AppearanceCfg.lbl.Usedefault")); materialDefault.setText(trans.get("AppearanceCfg.lbl.Usedefault"));
add(materialDefault, "wrap"); add(materialDefault, "wrap");
} }
{// Texture File {// Texture File
add(new JLabel(trans.get("AppearanceCfg.lbl.Texture"))); add(new JLabel(trans.get("AppearanceCfg.lbl.Texture")));
JPanel p = new JPanel(new MigLayout("fill, ins 0", "[grow][]")); JPanel p = new JPanel(new MigLayout("fill, ins 0", "[grow][]"));
mDefault.addEnableComponent(textureDropDown, false); mDefault.addEnableComponent(textureDropDown, false);
p.add(textureDropDown, "grow"); p.add(textureDropDown, "grow");
add(p, "span 3, growx, wrap"); add(p, "span 3, growx, wrap");
final JButton editBtn = new JButton(trans.get("AppearanceCfg.but.edit")); final JButton editBtn = new JButton(
trans.get("AppearanceCfg.but.edit"));
editBtn.setEnabled(ab.getImage() != null); editBtn.setEnabled(ab.getImage() != null);
// Enable the editBtn only when the appearance builder has an Image assigned to it. // Enable the editBtn only when the appearance builder has an Image
// assigned to it.
ab.addChangeListener(new StateChangeListener() { ab.addChangeListener(new StateChangeListener() {
@Override @Override
public void stateChanged(EventObject e) { public void stateChanged(EventObject e) {
@ -270,100 +298,110 @@ public class AppearancePanel extends JPanel {
} }
}); });
editBtn.addActionListener(new ActionListener() { editBtn.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
try { try {
DecalImage newImage = editDecalHelper.editDecal(SwingUtilities.getWindowAncestor(AppearancePanel.this), document, c, ab.getImage()); DecalImage newImage = editDecalHelper.editDecal(
SwingUtilities
.getWindowAncestor(AppearancePanel.this),
document, c, ab.getImage());
ab.setImage(newImage); ab.setImage(newImage);
} catch (EditDecalHelperException ex) { } catch (EditDecalHelperException ex) {
JOptionPane.showMessageDialog(AppearancePanel.this, ex.getMessage(), "", JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(AppearancePanel.this,
ex.getMessage(), "", JOptionPane.ERROR_MESSAGE);
} }
} }
}); });
p.add(editBtn); p.add(editBtn);
} }
{ // Color { // Color
add(new JLabel(trans.get("AppearanceCfg.lbl.color.Color"))); add(new JLabel(trans.get("AppearanceCfg.lbl.color.Color")));
mDefault.addEnableComponent(colorButton, false); mDefault.addEnableComponent(colorButton, false);
add(colorButton); add(colorButton);
} }
{ // Scale { // Scale
add(new JLabel(trans.get("AppearanceCfg.lbl.texture.scale"))); add(new JLabel(trans.get("AppearanceCfg.lbl.texture.scale")));
add(new JLabel("x:"), "split 4"); add(new JLabel("x:"), "split 4");
JSpinner scaleU = new JSpinner(new DoubleModel(ab, "ScaleX", TEXTURE_UNIT).getSpinnerModel()); JSpinner scaleU = new JSpinner(new DoubleModel(ab, "ScaleX",
TEXTURE_UNIT).getSpinnerModel());
scaleU.setEditor(new SpinnerEditor(scaleU)); scaleU.setEditor(new SpinnerEditor(scaleU));
mDefault.addEnableComponent(scaleU, false); mDefault.addEnableComponent(scaleU, false);
add(scaleU, "w 40"); add(scaleU, "w 40");
add(new JLabel("y:")); add(new JLabel("y:"));
JSpinner scaleV = new JSpinner(new DoubleModel(ab, "ScaleY", TEXTURE_UNIT).getSpinnerModel()); JSpinner scaleV = new JSpinner(new DoubleModel(ab, "ScaleY",
TEXTURE_UNIT).getSpinnerModel());
scaleV.setEditor(new SpinnerEditor(scaleV)); scaleV.setEditor(new SpinnerEditor(scaleV));
mDefault.addEnableComponent(scaleV, false); mDefault.addEnableComponent(scaleV, false);
add(scaleV, "wrap, w 40"); add(scaleV, "wrap, w 40");
} }
{// Shine {// Shine
add(new JLabel(trans.get("AppearanceCfg.lbl.shine"))); add(new JLabel(trans.get("AppearanceCfg.lbl.shine")));
DoubleModel shineModel = new DoubleModel(ab, "Shine", UnitGroup.UNITS_RELATIVE); DoubleModel shineModel = new DoubleModel(ab, "Shine",
UnitGroup.UNITS_RELATIVE);
JSpinner spin = new JSpinner(shineModel.getSpinnerModel()); JSpinner spin = new JSpinner(shineModel.getSpinnerModel());
spin.setEditor(new SpinnerEditor(spin)); spin.setEditor(new SpinnerEditor(spin));
JSlider slide = new JSlider(shineModel.getSliderModel(0, 1)); JSlider slide = new JSlider(shineModel.getSliderModel(0, 1));
UnitSelector unit = new UnitSelector(shineModel); UnitSelector unit = new UnitSelector(shineModel);
mDefault.addEnableComponent(slide, false); mDefault.addEnableComponent(slide, false);
mDefault.addEnableComponent(spin, false); mDefault.addEnableComponent(spin, false);
mDefault.addEnableComponent(unit, false); mDefault.addEnableComponent(unit, false);
add(spin, "split 3, w 50"); add(spin, "split 3, w 50");
add(unit); add(unit);
add(slide, "w 50"); add(slide, "w 50");
} }
{ // Offset { // Offset
add(new JLabel(trans.get("AppearanceCfg.lbl.texture.offset"))); add(new JLabel(trans.get("AppearanceCfg.lbl.texture.offset")));
add(new JLabel("x:"), "split 4"); add(new JLabel("x:"), "split 4");
JSpinner offsetU = new JSpinner(new DoubleModel(ab, "OffsetU", TEXTURE_UNIT).getSpinnerModel()); JSpinner offsetU = new JSpinner(new DoubleModel(ab, "OffsetU",
TEXTURE_UNIT).getSpinnerModel());
offsetU.setEditor(new SpinnerEditor(offsetU)); offsetU.setEditor(new SpinnerEditor(offsetU));
mDefault.addEnableComponent(offsetU, false); mDefault.addEnableComponent(offsetU, false);
add(offsetU, "w 40"); add(offsetU, "w 40");
add(new JLabel("y:")); add(new JLabel("y:"));
JSpinner offsetV = new JSpinner(new DoubleModel(ab, "OffsetV", TEXTURE_UNIT).getSpinnerModel()); JSpinner offsetV = new JSpinner(new DoubleModel(ab, "OffsetV",
TEXTURE_UNIT).getSpinnerModel());
offsetV.setEditor(new SpinnerEditor(offsetV)); offsetV.setEditor(new SpinnerEditor(offsetV));
mDefault.addEnableComponent(offsetV, false); mDefault.addEnableComponent(offsetV, false);
add(offsetV, "wrap, w 40"); add(offsetV, "wrap, w 40");
} }
{ // Repeat { // Repeat
add(new JLabel(trans.get("AppearanceCfg.lbl.texture.repeat"))); add(new JLabel(trans.get("AppearanceCfg.lbl.texture.repeat")));
EdgeMode[] list = new EdgeMode[EdgeMode.values().length]; EdgeMode[] list = new EdgeMode[EdgeMode.values().length];
System.arraycopy(EdgeMode.values(), 0, list, 0, EdgeMode.values().length); System.arraycopy(EdgeMode.values(), 0, list, 0,
JComboBox combo = new JComboBox(new EnumModel<EdgeMode>(ab, "EdgeMode", list)); EdgeMode.values().length);
JComboBox combo = new JComboBox(new EnumModel<EdgeMode>(ab,
"EdgeMode", list));
mDefault.addEnableComponent(combo, false); mDefault.addEnableComponent(combo, false);
add(combo); add(combo);
} }
{ // Rotation { // Rotation
add(new JLabel(trans.get("AppearanceCfg.lbl.texture.rotation"))); add(new JLabel(trans.get("AppearanceCfg.lbl.texture.rotation")));
DoubleModel rotationModel = new DoubleModel(ab, "Rotation", UnitGroup.UNITS_ANGLE); DoubleModel rotationModel = new DoubleModel(ab, "Rotation",
UnitGroup.UNITS_ANGLE);
JSpinner rotation = new JSpinner(rotationModel.getSpinnerModel()); JSpinner rotation = new JSpinner(rotationModel.getSpinnerModel());
rotation.setEditor(new SpinnerEditor(rotation)); rotation.setEditor(new SpinnerEditor(rotation));
mDefault.addEnableComponent(rotation, false); mDefault.addEnableComponent(rotation, false);
add(rotation, "split 3, w 50"); add(rotation, "split 3, w 50");
add(new UnitSelector(rotationModel)); add(new UnitSelector(rotationModel));
BasicSlider bs = new BasicSlider(rotationModel.getSliderModel(-Math.PI, Math.PI)); BasicSlider bs = new BasicSlider(rotationModel.getSliderModel(
-Math.PI, Math.PI));
mDefault.addEnableComponent(bs, false); mDefault.addEnableComponent(bs, false);
add(bs, "w 50, wrap"); add(bs, "w 50, wrap");
} }
} }
} }

View File

@ -33,6 +33,21 @@ public class DesignPreferencesPanel extends PreferencesPanel {
.get("pref.dlg.PrefChoiseSelector3"))), .get("pref.dlg.PrefChoiseSelector3"))),
"wrap para, growx, sg combos"); "wrap para, growx, sg combos");
// Font size of information in panel window
this.add(new JLabel(trans.get("pref.dlg.lbl.Rocketinfofontsize")),
"gapright para");
this.add(
new JComboBox<Object>(new PrefChoiceSelector(
Preferences.ROCKET_INFO_FONT_SIZE,
// // Small
// // Medium
// // Large
trans.get("pref.dlg.PrefFontSmall"), trans
.get("pref.dlg.PrefFontMedium"), trans
.get("pref.dlg.PrefFontLarge"))),
"wrap para, growx, sg combos");
// // Default Mach number // // Default Mach number
JLabel dfn = new JLabel(trans.get("pref.dlg.lbl.DefaultMach")); JLabel dfn = new JLabel(trans.get("pref.dlg.lbl.DefaultMach"));
this.add(dfn, "gapright para"); this.add(dfn, "gapright para");

View File

@ -43,36 +43,37 @@ public class PreferencesDialog extends JDialog {
JTabbedPane tabbedPane = new JTabbedPane(); JTabbedPane tabbedPane = new JTabbedPane();
panel.add(tabbedPane, "grow, wrap"); panel.add(tabbedPane, "grow, wrap");
// // Options and Miscellaneous options // Options and Miscellaneous options
tabbedPane.addTab(trans.get("pref.dlg.tab.Options"), null, tabbedPane.addTab(trans.get("pref.dlg.tab.Options"), null,
new GeneralPreferencesPanel(this), new GeneralPreferencesPanel(this),
trans.get("pref.dlg.tab.Miscellaneousoptions")); trans.get("pref.dlg.tab.Miscellaneousoptions"));
// // Designer options // Designer options
tabbedPane.addTab(trans.get("pref.dlg.tab.Design"), null, tabbedPane.addTab(trans.get("pref.dlg.tab.Design"), null,
new DesignPreferencesPanel(), trans.get("pref.dlg.tab.Design")); new DesignPreferencesPanel(), trans.get("pref.dlg.tab.Design"));
// // Simulation options // Simulation options
tabbedPane.addTab(trans.get("pref.dlg.tab.Simulation"), null, tabbedPane.addTab(trans.get("pref.dlg.tab.Simulation"), null,
new SimulationPreferencesPanel(), new SimulationPreferencesPanel(),
trans.get("pref.dlg.tab.Design")); trans.get("pref.dlg.tab.Design"));
// // Launch options // Launch options
tabbedPane.addTab(trans.get("pref.dlg.tab.Launch"), null, tabbedPane.addTab(trans.get("pref.dlg.tab.Launch"), null,
new LaunchPreferencesPanel(), trans.get("pref.dlg.tab.Launch")); new LaunchPreferencesPanel(), trans.get("pref.dlg.tab.Launch"));
// // Units and Default units // Units and Default units
tabbedPane.addTab(trans.get("pref.dlg.tab.Units"), null, tabbedPane.addTab(trans.get("pref.dlg.tab.Units"), null,
new UnitsPreferencesPanel(this), new UnitsPreferencesPanel(this),
trans.get("pref.dlg.tab.Defaultunits")); trans.get("pref.dlg.tab.Defaultunits"));
// // Materials and Custom materials // Materials and Custom materials
tabbedPane.addTab(trans.get("pref.dlg.tab.Materials"), null, tabbedPane.addTab(trans.get("pref.dlg.tab.Materials"), null,
new MaterialEditPanel(), new MaterialEditPanel(),
trans.get("pref.dlg.tab.Custommaterials")); trans.get("pref.dlg.tab.Custommaterials"));
// // Decal Editor selection // Decal Editor selection
tabbedPane.addTab(trans.get("pref.dlg.tab.Graphics"), tabbedPane.addTab(trans.get("pref.dlg.tab.Graphics"),
new GraphicsPreferencesPanel(this)); new GraphicsPreferencesPanel(this));
// // Default Colors Preferences // Default Colors Preferences
tabbedPane.addTab(trans.get("pref.dlg.tab.Colors"), // tabbedPane.addTab(trans.get("pref.dlg.tab.Colors"),
new DisplayPreferencesPanel()); // new DisplayPreferencesPanel());
// // Close button
// Close button
JButton close = new JButton(trans.get("dlg.but.close")); JButton close = new JButton(trans.get("dlg.but.close"));
close.addActionListener(new ActionListener() { close.addActionListener(new ActionListener() {
@Override @Override