diff --git a/core/resources/l10n/messages.properties b/core/resources/l10n/messages.properties index 72f5c27ab..c53c6c635 100644 --- a/core/resources/l10n/messages.properties +++ b/core/resources/l10n/messages.properties @@ -259,6 +259,9 @@ pref.dlg.tab.Simulation = Simulation pref.dlg.tab.Launch = Launch pref.dlg.tab.Miscellaneousoptions = Miscellaneous options +pref.dlg.lbl.RockSimWarning = Show warning when saving in RockSim format +pref.dlg.lbl.FileExtensionWarning = Show warning when saving with unusual file name extension + pref.dlg.tab.Graphics = Graphics pref.dlg.lbl.DecalEditor = Graphics Editor pref.dlg.opengl.lbl.title = 3D Graphics @@ -1134,6 +1137,15 @@ FinsetCfg.ttip.Finfillets1 = Adds the predicted mass of fin fillets to the FinsetCfg.ttip.Finfillets2 = Assumes the fillet is concave and tangent to the body tube and fin.
FinsetCfg.ttip.Finfillets3 = Zero radius will give no fillet. +! Save RKT Warning Dialog +SaveRktWarningDialog.txt1="The RockSim file format does not support all features of OpenRocket." +SaveRktWarningDialog.txt2="Do you want to save in RockSim .RKT format or OpenRocket .ORK format?" +SaveRktWarningDialog.btn.rkt="Save as RKT" +SaveRktWarningDialog.btn.ork="Save as ORK" + +! SaveExtensionWarningDialog +SaveExtensionWarningDialog.txt="The file format {} usually has the extension {}" + ! StorageOptionChooser StorageOptChooser.lbl.Simdatatostore = Simulated data to store: StorageOptChooser.rdbut.Allsimdata = All simulated data diff --git a/core/src/net/sf/openrocket/startup/Preferences.java b/core/src/net/sf/openrocket/startup/Preferences.java index a759d9d48..a69ca8872 100644 --- a/core/src/net/sf/openrocket/startup/Preferences.java +++ b/core/src/net/sf/openrocket/startup/Preferences.java @@ -61,6 +61,8 @@ public abstract class Preferences implements ChangeSource { // Node names public static final String PREFERRED_THRUST_CURVE_MOTOR_NODE = "preferredThrustCurveMotors"; private static final String AUTO_OPEN_LAST_DESIGN = "AUTO_OPEN_LAST_DESIGN"; + private static final String SHOW_ROCKSIM_FORMAT_WARNING = "SHOW_ROCKSIM_FORMAT_WARNING"; + private static final String SHOW_FILE_EXTENSION_WARNING = "SHOW_FILE_EXTENSION_WARNING"; //Preferences related to 3D graphics public static final String OPENGL_ENABLED = "OpenGL_Is_Enabled"; @@ -162,6 +164,22 @@ public abstract class Preferences implements ChangeSource { this.putBoolean(LAUNCH_INTO_WIND, check); } + public final boolean getShowRockSimFormatWarning() { + return this.getBoolean(SHOW_ROCKSIM_FORMAT_WARNING, true); + } + + public final void setShowRockSimFormatWarning(boolean check) { + this.putBoolean(SHOW_ROCKSIM_FORMAT_WARNING, check); + } + + public final boolean getShowFileExtensionWarning() { + return this.getBoolean(SHOW_FILE_EXTENSION_WARNING, true); + } + + public final void setShowFileExtensionWarning(boolean check) { + this.putBoolean(SHOW_FILE_EXTENSION_WARNING, check); + } + public final double getDefaultMach() { return Application.getPreferences().getChoice(Preferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); } @@ -533,7 +551,7 @@ public abstract class Preferences implements ChangeSource { String color = get("componentColors", c, StaticFieldHolder.DEFAULT_COLORS); if (color == null) return Color.BLACK; - + Color clr = parseColor(color); if (clr != null) { return clr; @@ -584,7 +602,7 @@ public abstract class Preferences implements ChangeSource { public Material getDefaultComponentMaterial( Class componentClass, Material.Type type) { - + String material = get("componentMaterials", componentClass, null); if (material != null) { try { @@ -613,7 +631,7 @@ public abstract class Preferences implements ChangeSource { */ public void setDefaultComponentMaterial( Class componentClass, Material material) { - + putString("componentMaterials", componentClass.getSimpleName(), material == null ? null : material.toStorableString()); } @@ -689,7 +707,7 @@ public abstract class Preferences implements ChangeSource { protected String get(String directory, Class componentClass, Map, String> defaultMap) { - + // Search preferences Class c = componentClass; while (c != null && RocketComponent.class.isAssignableFrom(c)) { @@ -701,7 +719,7 @@ public abstract class Preferences implements ChangeSource { if (defaultMap == null) return null; - + // Search defaults c = componentClass; while (RocketComponent.class.isAssignableFrom(c)) { @@ -736,12 +754,14 @@ public abstract class Preferences implements ChangeSource { */ private static final HashMap, String> DEFAULT_LINE_STYLES = new HashMap, String>(); + static { DEFAULT_LINE_STYLES.put(RocketComponent.class, LineStyle.SOLID.name()); DEFAULT_LINE_STYLES.put(MassObject.class, LineStyle.DASHED.name()); } private static final HashMap, String> DEFAULT_COLORS = new HashMap, String>(); + static { DEFAULT_COLORS.put(BodyComponent.class, "0,0,240"); DEFAULT_COLORS.put(TubeFinSet.class, "0,0,200"); diff --git a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java index 607b42cbf..686bc9461 100644 --- a/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java +++ b/swing/src/net/sf/openrocket/gui/dialogs/preferences/GeneralPreferencesPanel.java @@ -208,6 +208,40 @@ public class GeneralPreferencesPanel extends PreferencesPanel { } }); this.add(button, "right, wrap"); + + //// Open most recent file on startup + final JCheckBox openRecentOnStartupBox = new JCheckBox(trans.get("pref.dlg.but.openlast")); + openRecentOnStartupBox.setSelected(preferences.isAutoOpenLastDesignOnStartupEnabled()); + openRecentOnStartupBox.addActionListener( new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + preferences.setAutoOpenLastDesignOnStartup(openRecentOnStartupBox.isSelected()); + } + }); + this.add(openRecentOnStartupBox,"spanx, wrap"); + + //// Save RockSim Format warning dialog + final JCheckBox rocksimWarningDialogBox = new JCheckBox(trans.get("pref.dlg.lbl.RockSimWarning")); + rocksimWarningDialogBox.setSelected(preferences.getShowRockSimFormatWarning()); + rocksimWarningDialogBox.addActionListener( new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + preferences.setShowRockSimFormatWarning(rocksimWarningDialogBox.isSelected()); + } + }); + this.add(rocksimWarningDialogBox,"spanx, wrap"); + + //// Extension Format warning dialog + final JCheckBox extensionWarningDialoBox = new JCheckBox(trans.get("pref.dlg.lbl.FileExtensionWarning")); + extensionWarningDialoBox.setSelected(preferences.getShowFileExtensionWarning()); + extensionWarningDialoBox.addActionListener( new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + preferences.setShowFileExtensionWarning(extensionWarningDialoBox.isSelected()); + } + }); + this.add(extensionWarningDialoBox,"spanx, wrap"); + }