Rearranged preferences tabs, added default custom Mach number,
This commit is contained in:
parent
b8999349a9
commit
f4fc41e506
@ -249,20 +249,25 @@ pref.dlg.but.defaultmetric = Default metric
|
|||||||
pref.dlg.but.defaultimperial = Default imperial
|
pref.dlg.but.defaultimperial = Default imperial
|
||||||
pref.dlg.title.Preferences = Preferences
|
pref.dlg.title.Preferences = Preferences
|
||||||
pref.dlg.tab.Units = Units
|
pref.dlg.tab.Units = Units
|
||||||
pref.dlg.tab.Colors = Colors
|
pref.dlg.tab.Colors = Display
|
||||||
pref.dlg.tab.Defaultunits = Default units
|
pref.dlg.tab.Defaultunits = Default units
|
||||||
pref.dlg.tab.Materials = Materials
|
pref.dlg.tab.Materials = Materials
|
||||||
pref.dlg.tab.Custommaterials = Custom materials
|
pref.dlg.tab.Custommaterials = Custom materials
|
||||||
pref.dlg.tab.Options = Options
|
pref.dlg.tab.Options = General
|
||||||
|
pref.dlg.tab.Design = Design
|
||||||
|
pref.dlg.tab.Simulation = Simulation
|
||||||
pref.dlg.tab.Miscellaneousoptions = Miscellaneous options
|
pref.dlg.tab.Miscellaneousoptions = Miscellaneous options
|
||||||
|
|
||||||
pref.dlg.tab.Graphics = Graphics
|
pref.dlg.tab.Graphics = Graphics
|
||||||
pref.dlg.lbl.DecalEditor = Graphics Editor
|
pref.dlg.lbl.DecalEditor = Graphics Editor
|
||||||
pref.dlg.opengl.lbl.title = 3D Graphics
|
pref.dlg.opengl.lbl.title = 3D Graphics
|
||||||
pref.dlg.opengl.but.enableGL = Enable 3D Graphics
|
pref.dlg.opengl.but.enableGL = Enable 3D Graphics
|
||||||
pref.dlg.opengl.but.enableAA = Enable Antialiasing
|
pref.dlg.opengl.but.enableAA = Enable Anti-aliasing
|
||||||
pref.dlg.opengl.lbl.useFBO = Use Off-screen Rendering
|
pref.dlg.opengl.lbl.useFBO = Use Off-screen Rendering
|
||||||
|
|
||||||
|
pref.dlg.lbl.DefaultMach = Default Mach Number for C.P. Estimate:
|
||||||
|
pref.dlg.ttip.DefaultMach1 = <HTML><b>This setting will take effect the next time you start OpenRocket.</b> <BR>
|
||||||
|
pref.dlg.ttip.DefaultMach2 = To change the CP Mach number during this session use Tools->Component Analysis.
|
||||||
|
|
||||||
pref.dlg.lbl.Positiontoinsert = Position to insert new body components:
|
pref.dlg.lbl.Positiontoinsert = Position to insert new body components:
|
||||||
pref.dlg.lbl.Confirmdeletion = Confirm deletion of simulations:
|
pref.dlg.lbl.Confirmdeletion = Confirm deletion of simulations:
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
package net.sf.openrocket.startup;
|
package net.sf.openrocket.startup;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.EventListener;
|
||||||
|
import java.util.EventObject;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@ -16,12 +20,14 @@ import net.sf.openrocket.rocketcomponent.RecoveryDevice;
|
|||||||
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
import net.sf.openrocket.rocketcomponent.RocketComponent;
|
||||||
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.Color;
|
import net.sf.openrocket.util.Color;
|
||||||
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.UniqueID;
|
import net.sf.openrocket.util.UniqueID;
|
||||||
|
|
||||||
public abstract class Preferences {
|
public abstract class Preferences implements ChangeSource {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Well known string keys to preferences.
|
* Well known string keys to preferences.
|
||||||
@ -32,6 +38,7 @@ public abstract class Preferences {
|
|||||||
public static final String CONFIRM_DELETE_SIMULATION = "ConfirmDeleteSimulation";
|
public static final String CONFIRM_DELETE_SIMULATION = "ConfirmDeleteSimulation";
|
||||||
public static final String AUTO_RUN_SIMULATIONS = "AutoRunSimulations";
|
public static final String AUTO_RUN_SIMULATIONS = "AutoRunSimulations";
|
||||||
|
|
||||||
|
public static final String DEFAULT_MACH_NUMBER = "DefaultMachNumber";
|
||||||
// Preferences related to data export
|
// Preferences related to data export
|
||||||
public static final String EXPORT_FIELD_SEPARATOR = "ExportFieldSeparator";
|
public static final String EXPORT_FIELD_SEPARATOR = "ExportFieldSeparator";
|
||||||
public static final String EXPORT_SIMULATION_COMMENT = "ExportSimulationComment";
|
public static final String EXPORT_SIMULATION_COMMENT = "ExportSimulationComment";
|
||||||
@ -112,8 +119,16 @@ public abstract class Preferences {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final double getDefaultMach() {
|
public final double getDefaultMach() {
|
||||||
// TODO: HIGH: implement custom default mach number
|
return Application.getPreferences().getChoice(Preferences.DEFAULT_MACH_NUMBER, 0.9, 0.3);
|
||||||
return 0.3;
|
}
|
||||||
|
|
||||||
|
public final void setDefaultMach(double dfn) {
|
||||||
|
double oldDFN = Application.getPreferences().getChoice(Preferences.DEFAULT_MACH_NUMBER, 0.9, 0.3);
|
||||||
|
|
||||||
|
if (MathUtil.equals(oldDFN, dfn))
|
||||||
|
return;
|
||||||
|
this.putDouble(Preferences.DEFAULT_MACH_NUMBER, dfn);
|
||||||
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final float getRocketInfoFontSize() {
|
public final float getRocketInfoFontSize() {
|
||||||
@ -167,6 +182,24 @@ public abstract class Preferences {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a limited-range double value from the preferences. If the value
|
||||||
|
* in the preferences is negative or greater than max, then the default value
|
||||||
|
* is returned.
|
||||||
|
*
|
||||||
|
* @param key The preference to retrieve.
|
||||||
|
* @param max Maximum allowed value for the choice.
|
||||||
|
* @param def Default value.
|
||||||
|
* @return The preference value.
|
||||||
|
*/
|
||||||
|
public final double getChoice(String key, double max, double def) {
|
||||||
|
double v = this.getDouble(key, def);
|
||||||
|
if ((v < 0) || (v > max))
|
||||||
|
return def;
|
||||||
|
return v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method that puts an integer choice value into the preferences.
|
* Helper method that puts an integer choice value into the preferences.
|
||||||
*
|
*
|
||||||
@ -438,4 +471,27 @@ public abstract class Preferences {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<EventListener> listeners = new ArrayList<EventListener>();
|
||||||
|
private final EventObject event = new EventObject(this);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addChangeListener(StateChangeListener listener) {
|
||||||
|
listeners.add(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeChangeListener(StateChangeListener listener) {
|
||||||
|
listeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fireChangeEvent() {
|
||||||
|
|
||||||
|
// Copy the list before iterating to prevent concurrent modification exceptions.
|
||||||
|
EventListener[] list = listeners.toArray(new EventListener[0]);
|
||||||
|
for (EventListener l : list) {
|
||||||
|
if (l instanceof StateChangeListener) {
|
||||||
|
((StateChangeListener) l).stateChanged(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import javax.swing.JOptionPane;
|
|||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JProgressBar;
|
import javax.swing.JProgressBar;
|
||||||
import javax.swing.JRadioButton;
|
import javax.swing.JRadioButton;
|
||||||
|
import javax.swing.JSpinner;
|
||||||
import javax.swing.JTabbedPane;
|
import javax.swing.JTabbedPane;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
@ -42,7 +43,9 @@ import javax.swing.event.DocumentListener;
|
|||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import net.sf.openrocket.communication.UpdateInfo;
|
import net.sf.openrocket.communication.UpdateInfo;
|
||||||
import net.sf.openrocket.communication.UpdateInfoRetriever;
|
import net.sf.openrocket.communication.UpdateInfoRetriever;
|
||||||
|
import net.sf.openrocket.gui.SpinnerEditor;
|
||||||
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
import net.sf.openrocket.gui.adaptors.BooleanModel;
|
||||||
|
import net.sf.openrocket.gui.adaptors.DoubleModel;
|
||||||
import net.sf.openrocket.gui.components.DescriptionArea;
|
import net.sf.openrocket.gui.components.DescriptionArea;
|
||||||
import net.sf.openrocket.gui.components.StyledLabel;
|
import net.sf.openrocket.gui.components.StyledLabel;
|
||||||
import net.sf.openrocket.gui.components.StyledLabel.Style;
|
import net.sf.openrocket.gui.components.StyledLabel.Style;
|
||||||
@ -86,15 +89,21 @@ 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
|
||||||
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Options"), null, generalOptionsPane(),
|
||||||
|
trans.get("pref.dlg.tab.Miscellaneousoptions"));
|
||||||
|
//// Options and Miscellaneous options
|
||||||
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Design"), null, designOptionsPane(),
|
||||||
|
trans.get("pref.dlg.tab.Design"));
|
||||||
|
//// Options and Miscellaneous options
|
||||||
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Simulation"), null, simulationOptionsPane(),
|
||||||
|
trans.get("pref.dlg.tab.Design"));
|
||||||
//// Units and Default units
|
//// Units and Default units
|
||||||
tabbedPane.addTab(trans.get("pref.dlg.tab.Units"), null, unitsPane(),
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Units"), null, unitsPane(),
|
||||||
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, new MaterialEditPanel(),
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Materials"), null, new MaterialEditPanel(),
|
||||||
trans.get("pref.dlg.tab.Custommaterials"));
|
trans.get("pref.dlg.tab.Custommaterials"));
|
||||||
//// Options and Miscellaneous options
|
|
||||||
tabbedPane.addTab(trans.get("pref.dlg.tab.Options"), null, optionsPane(),
|
|
||||||
trans.get("pref.dlg.tab.Miscellaneousoptions"));
|
|
||||||
//// Decal Editor selection
|
//// Decal Editor selection
|
||||||
tabbedPane.addTab(trans.get("pref.dlg.tab.Graphics"), graphicsOptionsPane());
|
tabbedPane.addTab(trans.get("pref.dlg.tab.Graphics"), graphicsOptionsPane());
|
||||||
|
|
||||||
@ -129,7 +138,82 @@ public class PreferencesDialog extends JDialog {
|
|||||||
return new JPanel(new MigLayout("fillx, ins 301p n n n"));
|
return new JPanel(new MigLayout("fillx, ins 301p n n n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel optionsPane() {
|
@SuppressWarnings("unchecked")
|
||||||
|
private JPanel designOptionsPane() {
|
||||||
|
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
||||||
|
|
||||||
|
//// Position to insert new body components:
|
||||||
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para");
|
||||||
|
panel.add(new JComboBox<Object>(new PrefChoiceSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
||||||
|
//// Always ask
|
||||||
|
//// Insert in middle
|
||||||
|
//// Add to end
|
||||||
|
trans.get("pref.dlg.PrefChoiseSelector1"),
|
||||||
|
trans.get("pref.dlg.PrefChoiseSelector2"),
|
||||||
|
trans.get("pref.dlg.PrefChoiseSelector3"))), "wrap para, growx, sg combos");
|
||||||
|
|
||||||
|
//// Font size of information in panel window
|
||||||
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rocketinfofontsize")), "gapright para");
|
||||||
|
|
||||||
|
panel.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
|
||||||
|
JLabel dfn = new JLabel(trans.get("pref.dlg.lbl.DefaultMach"));
|
||||||
|
panel.add(dfn, "gapright para");
|
||||||
|
dfn.setToolTipText(trans.get("pref.dlg.ttip.DefaultMach1")+
|
||||||
|
trans.get("pref.dlg.ttip.DefaultMach2"));
|
||||||
|
|
||||||
|
DoubleModel m = new DoubleModel(preferences, "DefaultMach", 1.0, UnitGroup.UNITS_COEFFICIENT, 0.1, 0.9);
|
||||||
|
//mach = new DoubleModel(rocketPanel, "CPMach", UnitGroup.UNITS_COEFFICIENT, 0);
|
||||||
|
|
||||||
|
JSpinner spin = new JSpinner(m.getSpinnerModel());
|
||||||
|
spin.setEditor(new SpinnerEditor(spin));
|
||||||
|
spin.setToolTipText(trans.get("pref.dlg.ttip.DefaultMach1")+
|
||||||
|
trans.get("pref.dlg.ttip.DefaultMach2"));
|
||||||
|
panel.add(spin, "wrap");
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
panel.add(new JComboBox(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 40lp, growx, sg combos");
|
||||||
|
*/
|
||||||
|
final JCheckBox autoOpenDesignFile = new JCheckBox(trans.get("pref.dlg.but.openlast"));
|
||||||
|
autoOpenDesignFile.setSelected(preferences.isAutoOpenLastDesignOnStartupEnabled());
|
||||||
|
autoOpenDesignFile.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
preferences.setAutoOpenLastDesignOnStartup(autoOpenDesignFile.isSelected());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
panel.add(autoOpenDesignFile, "wrap, growx, span 2");
|
||||||
|
|
||||||
|
//// Update flight estimates in the design window
|
||||||
|
final JCheckBox updateEstimates =
|
||||||
|
new JCheckBox(trans.get("pref.dlg.checkbox.Updateestimates"));
|
||||||
|
updateEstimates.setSelected(preferences.computeFlightInBackground());
|
||||||
|
updateEstimates.addActionListener(new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
preferences.setComputeFlightInBackground(updateEstimates.isSelected());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
panel.add(updateEstimates, "wrap, growx, sg combos ");
|
||||||
|
|
||||||
|
return panel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private JPanel generalOptionsPane() {
|
||||||
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
||||||
|
|
||||||
|
|
||||||
@ -146,7 +230,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
Collections.sort(locales);
|
Collections.sort(locales);
|
||||||
locales.add(0, new Named<Locale>(null, trans.get("languages.default")));
|
locales.add(0, new Named<Locale>(null, trans.get("languages.default")));
|
||||||
|
|
||||||
final JComboBox languageCombo = new JComboBox(locales.toArray());
|
final JComboBox<?> languageCombo = new JComboBox<Object>(locales.toArray());
|
||||||
for (int i = 0; i < locales.size(); i++) {
|
for (int i = 0; i < locales.size(); i++) {
|
||||||
if (Utils.equals(userLocale, locales.get(i).get())) {
|
if (Utils.equals(userLocale, locales.get(i).get())) {
|
||||||
languageCombo.setSelectedIndex(i);
|
languageCombo.setSelectedIndex(i);
|
||||||
@ -166,35 +250,6 @@ public class PreferencesDialog extends JDialog {
|
|||||||
|
|
||||||
panel.add(new StyledLabel(trans.get("PreferencesDialog.lbl.languageEffect"), -3, Style.ITALIC), "span, wrap para*2");
|
panel.add(new StyledLabel(trans.get("PreferencesDialog.lbl.languageEffect"), -3, Style.ITALIC), "span, wrap para*2");
|
||||||
|
|
||||||
|
|
||||||
//// Position to insert new body components:
|
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Positiontoinsert")), "gapright para");
|
|
||||||
panel.add(new JComboBox(new PrefChoiceSelector(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
|
||||||
//// Always ask
|
|
||||||
//// Insert in middle
|
|
||||||
//// Add to end
|
|
||||||
trans.get("pref.dlg.PrefChoiseSelector1"),
|
|
||||||
trans.get("pref.dlg.PrefChoiseSelector2"),
|
|
||||||
trans.get("pref.dlg.PrefChoiseSelector3"))), "wrap para, growx, sg combos");
|
|
||||||
|
|
||||||
//// Confirm deletion of simulations:
|
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Confirmdeletion")));
|
|
||||||
panel.add(new JComboBox(new PrefBooleanSelector(Preferences.CONFIRM_DELETE_SIMULATION,
|
|
||||||
//// Delete
|
|
||||||
//// Confirm
|
|
||||||
trans.get("pref.dlg.PrefBooleanSelector1"),
|
|
||||||
trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap, growx, sg combos");
|
|
||||||
//// Position to insert new body components:
|
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rocketinfofontsize")), "gapright para");
|
|
||||||
|
|
||||||
panel.add(new JComboBox(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 40lp, growx, sg combos");
|
|
||||||
|
|
||||||
//// User-defined thrust curves:
|
//// User-defined thrust curves:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.User-definedthrust")), "spanx, wrap");
|
||||||
final JTextField field = new JTextField();
|
final JTextField field = new JTextField();
|
||||||
@ -325,15 +380,20 @@ public class PreferencesDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
panel.add(button, "right, wrap");
|
panel.add(button, "right, wrap");
|
||||||
|
|
||||||
final JCheckBox autoOpenDesignFile = new JCheckBox(trans.get("pref.dlg.but.openlast"));
|
return panel;
|
||||||
autoOpenDesignFile.setSelected(preferences.isAutoOpenLastDesignOnStartupEnabled());
|
}
|
||||||
autoOpenDesignFile.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
private JPanel simulationOptionsPane() {
|
||||||
public void actionPerformed(ActionEvent e) {
|
JPanel panel = new JPanel(new MigLayout("fillx, ins 30lp n n n"));
|
||||||
preferences.setAutoOpenLastDesignOnStartup(autoOpenDesignFile.isSelected());
|
|
||||||
}
|
//// Confirm deletion of simulations:
|
||||||
});
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Confirmdeletion")));
|
||||||
panel.add(autoOpenDesignFile, "wrap, growx, span 2");
|
panel.add(new JComboBox<Object>(new PrefBooleanSelector(Preferences.CONFIRM_DELETE_SIMULATION,
|
||||||
|
//// Delete
|
||||||
|
//// Confirm
|
||||||
|
trans.get("pref.dlg.PrefBooleanSelector1"),
|
||||||
|
trans.get("pref.dlg.PrefBooleanSelector2"), true)), "wrap, growx, sg combos");
|
||||||
|
|
||||||
|
|
||||||
//// Automatically run all simulation out-dated by design changes.
|
//// Automatically run all simulation out-dated by design changes.
|
||||||
final JCheckBox automaticallyRunSimsBox =
|
final JCheckBox automaticallyRunSimsBox =
|
||||||
@ -347,24 +407,12 @@ public class PreferencesDialog extends JDialog {
|
|||||||
});
|
});
|
||||||
panel.add(automaticallyRunSimsBox, "wrap, growx, sg combos ");
|
panel.add(automaticallyRunSimsBox, "wrap, growx, sg combos ");
|
||||||
|
|
||||||
//// Update flight estimates in the design window
|
|
||||||
final JCheckBox updateEstimates =
|
|
||||||
new JCheckBox(trans.get("pref.dlg.checkbox.Updateestimates"));
|
|
||||||
updateEstimates.setSelected(preferences.computeFlightInBackground());
|
|
||||||
updateEstimates.addActionListener(new ActionListener() {
|
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
preferences.setComputeFlightInBackground(updateEstimates.isSelected());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
panel.add(updateEstimates, "wrap, growx, sg combos ");
|
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private JPanel unitsPane() {
|
private JPanel unitsPane() {
|
||||||
JPanel panel = new JPanel(new MigLayout("", "[][]40lp[][]"));
|
JPanel panel = new JPanel(new MigLayout("", "[][]40lp[][]"));
|
||||||
JComboBox combo;
|
JComboBox<?> combo;
|
||||||
|
|
||||||
//// Select your preferred units:
|
//// Select your preferred units:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Selectprefunits")), "span, wrap paragraph");
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Selectprefunits")), "span, wrap paragraph");
|
||||||
@ -372,110 +420,110 @@ public class PreferencesDialog extends JDialog {
|
|||||||
|
|
||||||
//// Rocket dimensions:
|
//// Rocket dimensions:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rocketdimensions")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rocketdimensions")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_LENGTH));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_LENGTH));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Line density:
|
//// Line density:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Linedensity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Linedensity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_LINE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_LINE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Motor dimensions:
|
//// Motor dimensions:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Motordimensions")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Motordimensions")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_MOTOR_DIMENSIONS));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_MOTOR_DIMENSIONS));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Surface density:
|
//// Surface density:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfacedensity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfacedensity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_SURFACE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_SURFACE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Distance:
|
//// Distance:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Distance")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Distance")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DISTANCE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_DISTANCE));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Bulk density::
|
//// Bulk density::
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Bulkdensity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Bulkdensity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_BULK));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_DENSITY_BULK));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Velocity:
|
//// Velocity:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Velocity")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Velocity")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_VELOCITY));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_VELOCITY));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Surface roughness:
|
//// Surface roughness:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfaceroughness")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Surfaceroughness")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ROUGHNESS));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_ROUGHNESS));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Acceleration:
|
//// Acceleration:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Acceleration")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Acceleration")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ACCELERATION));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_ACCELERATION));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Area:
|
//// Area:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Area")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Area")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_AREA));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_AREA));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Mass:
|
//// Mass:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Mass")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Mass")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_MASS));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_MASS));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Angle:
|
//// Angle:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Angle")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Angle")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ANGLE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_ANGLE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Force:
|
//// Force:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Force")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Force")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_FORCE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_FORCE));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Roll rate:
|
//// Roll rate:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rollrate")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Rollrate")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_ROLL));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_ROLL));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Total impulse:
|
//// Total impulse:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Totalimpulse")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Totalimpulse")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_IMPULSE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_IMPULSE));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Temperature:
|
//// Temperature:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Temperature")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Temperature")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_TEMPERATURE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_TEMPERATURE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
//// Moment of inertia:
|
//// Moment of inertia:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Momentofinertia")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Momentofinertia")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_INERTIA));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_INERTIA));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Pressure:
|
//// Pressure:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Pressure")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Pressure")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_PRESSURE));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_PRESSURE));
|
||||||
panel.add(combo, "sizegroup boxes, wrap");
|
panel.add(combo, "sizegroup boxes, wrap");
|
||||||
|
|
||||||
|
|
||||||
//// Stability:
|
//// Stability:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Stability")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Stability")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_STABILITY));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_STABILITY));
|
||||||
panel.add(combo, "sizegroup boxes");
|
panel.add(combo, "sizegroup boxes");
|
||||||
|
|
||||||
//// Windspeed:
|
//// Windspeed:
|
||||||
panel.add(new JLabel(trans.get("pref.dlg.lbl.Windspeed")));
|
panel.add(new JLabel(trans.get("pref.dlg.lbl.Windspeed")));
|
||||||
combo = new JComboBox(new DefaultUnitSelector(UnitGroup.UNITS_WINDSPEED));
|
combo = new JComboBox<Object>(new DefaultUnitSelector(UnitGroup.UNITS_WINDSPEED));
|
||||||
panel.add(combo, "sizegroup boxes, wrap para");
|
panel.add(combo, "sizegroup boxes, wrap para");
|
||||||
|
|
||||||
|
|
||||||
@ -669,7 +717,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class DefaultUnitSelector extends AbstractListModel implements ComboBoxModel {
|
private class DefaultUnitSelector extends AbstractListModel<Object> implements ComboBoxModel<Object> {
|
||||||
|
|
||||||
private final UnitGroup group;
|
private final UnitGroup group;
|
||||||
|
|
||||||
@ -713,7 +761,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private class PrefChoiceSelector extends AbstractListModel implements ComboBoxModel {
|
private class PrefChoiceSelector extends AbstractListModel<Object> implements ComboBoxModel<Object> {
|
||||||
private final String preference;
|
private final String preference;
|
||||||
private final String[] descriptions;
|
private final String[] descriptions;
|
||||||
|
|
||||||
@ -760,7 +808,7 @@ public class PreferencesDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class PrefBooleanSelector extends AbstractListModel implements ComboBoxModel {
|
private class PrefBooleanSelector extends AbstractListModel<Object> implements ComboBoxModel<Object> {
|
||||||
private final String preference;
|
private final String preference;
|
||||||
private final String trueDesc, falseDesc;
|
private final String trueDesc, falseDesc;
|
||||||
private final boolean def;
|
private final boolean def;
|
||||||
|
@ -175,7 +175,7 @@ public class RocketInfo implements FigureElement {
|
|||||||
private void drawStabilityInfo() {
|
private void drawStabilityInfo() {
|
||||||
String at;
|
String at;
|
||||||
//// at M=
|
//// at M=
|
||||||
at = trans.get("RocketInfo.at")+UnitGroup.UNITS_COEFFICIENT.getDefaultUnit().toStringUnit(mach);
|
at = trans.get("RocketInfo.at")+UnitGroup.UNITS_COEFFICIENT.getDefaultUnit().toStringUnit(Application.getPreferences().getDefaultMach());
|
||||||
if (!Double.isNaN(aoa)) {
|
if (!Double.isNaN(aoa)) {
|
||||||
at += " "+ALPHA+"=" + UnitGroup.UNITS_ANGLE.getDefaultUnit().toStringUnit(aoa);
|
at += " "+ALPHA+"=" + UnitGroup.UNITS_ANGLE.getDefaultUnit().toStringUnit(aoa);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user