diff --git a/core/src/main/java/info/openrocket/core/document/OpenRocketDocument.java b/core/src/main/java/info/openrocket/core/document/OpenRocketDocument.java index 5ca4585e4..8b04e51aa 100644 --- a/core/src/main/java/info/openrocket/core/document/OpenRocketDocument.java +++ b/core/src/main/java/info/openrocket/core/document/OpenRocketDocument.java @@ -4,8 +4,8 @@ import java.io.File; import java.util.*; import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.rocketcomponent.*; -import info.openrocket.core.preferences.ORPreferences; import info.openrocket.core.util.StateChangeListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +37,7 @@ import info.openrocket.core.util.ArrayList; */ public class OpenRocketDocument implements ComponentChangeListener, StateChangeListener { private static final Logger log = LoggerFactory.getLogger(OpenRocketDocument.class); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); private final List file_extensions = Arrays.asList("ork", "ork.gz", "rkt", "rkt.gz"); // Possible extensions of an OpenRocket document /** * The minimum number of undo levels that are stored. diff --git a/core/src/main/java/info/openrocket/core/file/rasaero/export/LaunchSiteDTO.java b/core/src/main/java/info/openrocket/core/file/rasaero/export/LaunchSiteDTO.java index ecddec48e..bf7033388 100644 --- a/core/src/main/java/info/openrocket/core/file/rasaero/export/LaunchSiteDTO.java +++ b/core/src/main/java/info/openrocket/core/file/rasaero/export/LaunchSiteDTO.java @@ -8,7 +8,7 @@ import info.openrocket.core.logging.ErrorSet; import info.openrocket.core.logging.WarningSet; import info.openrocket.core.simulation.SimulationOptions; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import jakarta.xml.bind.annotation.XmlAccessType; import jakarta.xml.bind.annotation.XmlAccessorType; @@ -62,7 +62,7 @@ public class LaunchSiteDTO { } // If we can't get settings from the sims, use the launch site settings from the preferences - ORPreferences prefs = Application.getPreferences(); + ApplicationPreferences prefs = Application.getPreferences(); setAltitude(prefs.getLaunchAltitude() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_ALTITUDE); setPressure(prefs.getLaunchPressure() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_PRESSURE); setTemperature(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_TEMPERATURE(prefs.getLaunchTemperature())); diff --git a/core/src/main/java/info/openrocket/core/file/wavefrontobj/export/OBJExportOptions.java b/core/src/main/java/info/openrocket/core/file/wavefrontobj/export/OBJExportOptions.java index 12605b7c7..ff668d1df 100644 --- a/core/src/main/java/info/openrocket/core/file/wavefrontobj/export/OBJExportOptions.java +++ b/core/src/main/java/info/openrocket/core/file/wavefrontobj/export/OBJExportOptions.java @@ -6,7 +6,7 @@ import info.openrocket.core.file.wavefrontobj.ObjUtils; import info.openrocket.core.rocketcomponent.Rocket; public class OBJExportOptions { - // ! Update ORPreferences when adding new options ! + // ! Update ApplicationPreferences when adding new options ! /** * If true, export all children of the components as well diff --git a/core/src/main/java/info/openrocket/core/preferences/ORPreferences.java b/core/src/main/java/info/openrocket/core/preferences/ApplicationPreferences.java similarity index 98% rename from core/src/main/java/info/openrocket/core/preferences/ORPreferences.java rename to core/src/main/java/info/openrocket/core/preferences/ApplicationPreferences.java index 5db93d996..261763921 100644 --- a/core/src/main/java/info/openrocket/core/preferences/ORPreferences.java +++ b/core/src/main/java/info/openrocket/core/preferences/ApplicationPreferences.java @@ -35,7 +35,7 @@ import info.openrocket.core.util.MathUtil; import info.openrocket.core.util.StateChangeListener; import info.openrocket.core.util.UniqueID; -public abstract class ORPreferences implements ChangeSource, Preferences { +public abstract class ApplicationPreferences implements ChangeSource, Preferences { private static final String SPLIT_CHARACTER = "|"; /* @@ -320,28 +320,28 @@ public abstract class ORPreferences implements ChangeSource, Preferences { } public final double getDefaultMach() { - return Application.getPreferences().getChoice(ORPreferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); + return Application.getPreferences().getChoice(ApplicationPreferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); } public final void setDefaultMach(double dfn) { - double oldDFN = Application.getPreferences().getChoice(ORPreferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); + double oldDFN = Application.getPreferences().getChoice(ApplicationPreferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); if (MathUtil.equals(oldDFN, dfn)) return; - this.putDouble(ORPreferences.DEFAULT_MACH_NUMBER, dfn); + this.putDouble(ApplicationPreferences.DEFAULT_MACH_NUMBER, dfn); fireChangeEvent(); } public final double getWindTurbulenceIntensity() { - return Application.getPreferences().getChoice(ORPreferences.WIND_TURBULENCE, 0.9, 0.1); + return Application.getPreferences().getChoice(ApplicationPreferences.WIND_TURBULENCE, 0.9, 0.1); } public final void setWindTurbulenceIntensity(double wti) { - double oldWTI = Application.getPreferences().getChoice(ORPreferences.WIND_TURBULENCE, 0.9, 0.3); + double oldWTI = Application.getPreferences().getChoice(ApplicationPreferences.WIND_TURBULENCE, 0.9, 0.3); if (MathUtil.equals(oldWTI, wti)) return; - this.putDouble(ORPreferences.WIND_TURBULENCE, wti); + this.putDouble(ApplicationPreferences.WIND_TURBULENCE, wti); fireChangeEvent(); } @@ -571,7 +571,7 @@ public abstract class ORPreferences implements ChangeSource, Preferences { } public double getTimeStep() { - return this.getDouble(ORPreferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP); + return this.getDouble(ApplicationPreferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP); } public void setTimeStep(double timeStep) { @@ -738,7 +738,7 @@ public abstract class ORPreferences implements ChangeSource, Preferences { * @return true to display designation, false to display common name */ public boolean getMotorNameColumn() { - return getBoolean(ORPreferences.MOTOR_NAME_COLUMN, true); + return getBoolean(ApplicationPreferences.MOTOR_NAME_COLUMN, true); } /** @@ -746,7 +746,7 @@ public abstract class ORPreferences implements ChangeSource, Preferences { * @param value if true, display designation, if false, display common name */ public void setMotorNameColumn(boolean value) { - putBoolean(ORPreferences.MOTOR_NAME_COLUMN, value); + putBoolean(ApplicationPreferences.MOTOR_NAME_COLUMN, value); } /** diff --git a/core/src/main/java/info/openrocket/core/rocketcomponent/RocketComponent.java b/core/src/main/java/info/openrocket/core/rocketcomponent/RocketComponent.java index 998910271..cb95cb242 100644 --- a/core/src/main/java/info/openrocket/core/rocketcomponent/RocketComponent.java +++ b/core/src/main/java/info/openrocket/core/rocketcomponent/RocketComponent.java @@ -17,7 +17,7 @@ import info.openrocket.core.aerodynamics.FlightConditions; import info.openrocket.core.logging.WarningSet; import info.openrocket.core.rocketcomponent.position.AnglePositionable; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.util.ORColor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -770,7 +770,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab public final double getOverrideCD() { mutex.verify(); if (!isCDOverridden()) { - ORPreferences preferences = Application.getPreferences(); + ApplicationPreferences preferences = Application.getPreferences(); overrideCD = getComponentCD(0, 0, preferences.getDefaultMach(), 0); } return overrideCD; @@ -840,7 +840,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab } if (!cdOverridden) { - ORPreferences preferences = Application.getPreferences(); + ApplicationPreferences preferences = Application.getPreferences(); overrideCD = getComponentCD(0, 0, preferences.getDefaultMach(), 0); } diff --git a/core/src/main/java/info/openrocket/core/simulation/DefaultSimulationOptionFactory.java b/core/src/main/java/info/openrocket/core/simulation/DefaultSimulationOptionFactory.java index 46cc2c214..c90af2d5e 100644 --- a/core/src/main/java/info/openrocket/core/simulation/DefaultSimulationOptionFactory.java +++ b/core/src/main/java/info/openrocket/core/simulation/DefaultSimulationOptionFactory.java @@ -1,13 +1,13 @@ package info.openrocket.core.simulation; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import com.google.inject.Inject; public class DefaultSimulationOptionFactory { @Inject - private final ORPreferences prefs; + private final ApplicationPreferences prefs; public static final String SIMCONDITION_WIND_SPEED = "SimConditionWindSpeed"; public static final String SIMCONDITION_WIND_STDDEV = "SimConditionWindStdDev"; @@ -23,7 +23,7 @@ public class DefaultSimulationOptionFactory { public static final String SIMCONDITION_ROD_ANGLE = "SimConditionsRodAngle"; public static final String SIMCONDITION_ROD_DIRECTION = "SimConditionsRodDirection"; - public DefaultSimulationOptionFactory(ORPreferences prefs) { + public DefaultSimulationOptionFactory(ApplicationPreferences prefs) { this.prefs = prefs; } diff --git a/core/src/main/java/info/openrocket/core/simulation/SimulationOptions.java b/core/src/main/java/info/openrocket/core/simulation/SimulationOptions.java index 3ac41255f..87d6ddaf7 100644 --- a/core/src/main/java/info/openrocket/core/simulation/SimulationOptions.java +++ b/core/src/main/java/info/openrocket/core/simulation/SimulationOptions.java @@ -6,7 +6,7 @@ import java.util.EventObject; import java.util.List; import java.util.Random; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,21 +44,21 @@ public class SimulationOptions implements ChangeSource, Cloneable, SimulationOpt */ private static final AtmosphericModel ISA_ATMOSPHERIC_MODEL = new ExtendedISAModel(); - protected final ORPreferences preferences = Application.getPreferences(); + protected final ApplicationPreferences preferences = Application.getPreferences(); /* * NOTE: When adding/modifying parameters, they must also be added to the * equals and copyFrom methods!! */ - private double launchRodLength = preferences.getDouble(ORPreferences.LAUNCH_ROD_LENGTH, 1); - private boolean launchIntoWind = preferences.getBoolean(ORPreferences.LAUNCH_INTO_WIND, true); - private double launchRodAngle = preferences.getDouble(ORPreferences.LAUNCH_ROD_ANGLE, 0); - private double windDirection = preferences.getDouble(ORPreferences.WIND_DIRECTION, Math.PI / 2); - private double launchRodDirection = preferences.getDouble(ORPreferences.LAUNCH_ROD_DIRECTION, Math.PI / 2); + private double launchRodLength = preferences.getDouble(ApplicationPreferences.LAUNCH_ROD_LENGTH, 1); + private boolean launchIntoWind = preferences.getBoolean(ApplicationPreferences.LAUNCH_INTO_WIND, true); + private double launchRodAngle = preferences.getDouble(ApplicationPreferences.LAUNCH_ROD_ANGLE, 0); + private double windDirection = preferences.getDouble(ApplicationPreferences.WIND_DIRECTION, Math.PI / 2); + private double launchRodDirection = preferences.getDouble(ApplicationPreferences.LAUNCH_ROD_DIRECTION, Math.PI / 2); - private double windAverage = preferences.getDouble(ORPreferences.WIND_AVERAGE, 2.0); - private double windTurbulence = preferences.getDouble(ORPreferences.WIND_TURBULENCE, 0.1); + private double windAverage = preferences.getDouble(ApplicationPreferences.WIND_AVERAGE, 2.0); + private double windTurbulence = preferences.getDouble(ApplicationPreferences.WIND_TURBULENCE, 0.1); /* * SimulationOptions maintains the launch site parameters as separate double values, diff --git a/core/src/main/java/info/openrocket/core/simulation/extension/impl/ScriptingUtil.java b/core/src/main/java/info/openrocket/core/simulation/extension/impl/ScriptingUtil.java index a75b55b0c..0b810aaaf 100644 --- a/core/src/main/java/info/openrocket/core/simulation/extension/impl/ScriptingUtil.java +++ b/core/src/main/java/info/openrocket/core/simulation/extension/impl/ScriptingUtil.java @@ -10,9 +10,9 @@ import java.util.prefs.BackingStoreException; import javax.script.ScriptEngine; import javax.script.ScriptEngineFactory; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.scripting.ScriptEngineManagerRedux; import info.openrocket.core.scripting.GraalJSScriptEngineFactory; -import info.openrocket.core.preferences.ORPreferences; import info.openrocket.core.util.ArrayList; import info.openrocket.core.util.BugException; @@ -37,7 +37,7 @@ public class ScriptingUtil { private static ScriptEngineManagerRedux manager; @Inject - ORPreferences prefs; + ApplicationPreferences prefs; public ScriptingUtil() { if (manager == null) { diff --git a/core/src/main/java/info/openrocket/core/startup/Application.java b/core/src/main/java/info/openrocket/core/startup/Application.java index 21d283ed3..2bf53d2d9 100644 --- a/core/src/main/java/info/openrocket/core/startup/Application.java +++ b/core/src/main/java/info/openrocket/core/startup/Application.java @@ -9,7 +9,7 @@ import info.openrocket.core.l10n.ExceptionSuppressingTranslator; import info.openrocket.core.l10n.Translator; import com.google.inject.Injector; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; /** * A class that provides singleton instances / beans for other classes to @@ -59,8 +59,8 @@ public final class Application { /** * @return the preferences */ - public static ORPreferences getPreferences() { - return injector.getInstance(ORPreferences.class); + public static ApplicationPreferences getPreferences() { + return injector.getInstance(ApplicationPreferences.class); } diff --git a/core/src/test/java/info/openrocket/core/ServicesForTesting.java b/core/src/test/java/info/openrocket/core/ServicesForTesting.java index 9bef1c9d6..5c63e0299 100644 --- a/core/src/test/java/info/openrocket/core/ServicesForTesting.java +++ b/core/src/test/java/info/openrocket/core/ServicesForTesting.java @@ -12,9 +12,9 @@ import info.openrocket.core.l10n.DebugTranslator; import info.openrocket.core.l10n.ResourceBundleTranslator; import info.openrocket.core.l10n.Translator; import info.openrocket.core.material.Material; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.preset.ComponentPreset; import info.openrocket.core.preset.ComponentPreset.Type; -import info.openrocket.core.preferences.ORPreferences; import com.google.inject.AbstractModule; import com.google.inject.Provider; @@ -23,7 +23,7 @@ public class ServicesForTesting extends AbstractModule { @Override protected void configure() { - bind(ORPreferences.class).to(PreferencesForTesting.class); + bind(ApplicationPreferences.class).to(PreferencesForTesting.class); bind(Translator.class).toProvider(TranslatorProviderForTesting.class); bind(RocketDescriptor.class).to(RocketDescriptorImpl.class); } @@ -61,7 +61,7 @@ public class ServicesForTesting extends AbstractModule { } - public static class PreferencesForTesting extends ORPreferences { + public static class PreferencesForTesting extends ApplicationPreferences { private static java.util.prefs.Preferences root = null; diff --git a/core/src/test/java/info/openrocket/core/simulation/SimulationConditionsTest.java b/core/src/test/java/info/openrocket/core/simulation/SimulationConditionsTest.java index 3f0fcdae6..148d9a288 100644 --- a/core/src/test/java/info/openrocket/core/simulation/SimulationConditionsTest.java +++ b/core/src/test/java/info/openrocket/core/simulation/SimulationConditionsTest.java @@ -11,9 +11,9 @@ import info.openrocket.core.formatting.RocketDescriptorImpl; import info.openrocket.core.l10n.DebugTranslator; import info.openrocket.core.l10n.Translator; import info.openrocket.core.plugin.PluginModule; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.startup.Application; import info.openrocket.core.startup.MockPreferences; -import info.openrocket.core.preferences.ORPreferences; import info.openrocket.core.util.MathUtil; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; @@ -73,7 +73,7 @@ public class SimulationConditionsTest { private static class PreferencesModule extends AbstractModule { @Override protected void configure() { - bind(ORPreferences.class).to(MockPreferences.class); + bind(ApplicationPreferences.class).to(MockPreferences.class); bind(Translator.class).toProvider(ServicesForTesting.TranslatorProviderForTesting.class); bind(RocketDescriptor.class).to(RocketDescriptorImpl.class); } diff --git a/core/src/test/java/info/openrocket/core/startup/MockPreferences.java b/core/src/test/java/info/openrocket/core/startup/MockPreferences.java index 66d67f396..a54cdd25c 100644 --- a/core/src/test/java/info/openrocket/core/startup/MockPreferences.java +++ b/core/src/test/java/info/openrocket/core/startup/MockPreferences.java @@ -5,13 +5,13 @@ import java.util.prefs.BackingStoreException; import com.google.inject.Singleton; import info.openrocket.core.material.Material; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.preset.ComponentPreset; import info.openrocket.core.preset.ComponentPreset.Type; import info.openrocket.core.util.BugException; @Singleton -public class MockPreferences extends ORPreferences { +public class MockPreferences extends ApplicationPreferences { private final String NODENAME = "OpenRocket-test-mock"; private final java.util.prefs.Preferences NODE; diff --git a/core/src/test/resources/ServicesForTesting.java b/core/src/test/resources/ServicesForTesting.java index ac939fe9e..231205f13 100644 --- a/core/src/test/resources/ServicesForTesting.java +++ b/core/src/test/resources/ServicesForTesting.java @@ -12,9 +12,9 @@ import info.openrocket.core.l10n.DebugTranslator; import info.openrocket.core.l10n.ResourceBundleTranslator; import info.openrocket.core.l10n.Translator; import info.openrocket.core.material.Material; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.preset.ComponentPreset; import info.openrocket.core.preset.ComponentPreset.Type; -import info.openrocket.core.preferences.ORPreferences; import com.google.inject.AbstractModule; import com.google.inject.Provider; @@ -23,7 +23,7 @@ public class ServicesForTesting extends AbstractModule { @Override protected void configure() { - bind(ORPreferences.class).to(PreferencesForTesting.class); + bind(ApplicationPreferences.class).to(PreferencesForTesting.class); bind(Translator.class).toProvider(TranslatorProviderForTesting.class); bind(RocketDescriptor.class).to(RocketDescriptorImpl.class); } @@ -60,7 +60,7 @@ public class ServicesForTesting extends AbstractModule { } - public static class PreferencesForTesting extends ORPreferences { + public static class PreferencesForTesting extends ApplicationPreferences { private static java.util.prefs.Preferences root = null; diff --git a/swing/src/main/java/info/openrocket/swing/gui/components/CsvOptionPanel.java b/swing/src/main/java/info/openrocket/swing/gui/components/CsvOptionPanel.java index 53fd66863..cc1a29f71 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/components/CsvOptionPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/components/CsvOptionPanel.java @@ -9,7 +9,7 @@ import javax.swing.JSpinner; import javax.swing.SpinnerModel; import javax.swing.SpinnerNumberModel; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.l10n.Translator; import info.openrocket.core.startup.Application; @@ -67,7 +67,7 @@ public class CsvOptionPanel extends JPanel { fieldSeparator = new JComboBox(new String[] { ",", ";", SPACE, TAB }); fieldSeparator.setEditable(true); - fieldSeparator.setSelectedItem(Application.getPreferences().getString(ORPreferences.EXPORT_FIELD_SEPARATOR, ",")); + fieldSeparator.setSelectedItem(Application.getPreferences().getString(ApplicationPreferences.EXPORT_FIELD_SEPARATOR, ",")); fieldSeparator.setToolTipText(tip); panel.add(fieldSeparator, "growx, wrap"); @@ -76,7 +76,7 @@ public class CsvOptionPanel extends JPanel { label.setToolTipText(trans.get("SimExpPan.lbl.DecimalPlaces.ttip")); panel.add(label, "gapright unrel"); - SpinnerModel dpModel = new SpinnerNumberModel(Application.getPreferences().getInt(ORPreferences.EXPORT_DECIMAL_PLACES, TextUtil.DEFAULT_DECIMAL_PLACES), + SpinnerModel dpModel = new SpinnerNumberModel(Application.getPreferences().getInt(ApplicationPreferences.EXPORT_DECIMAL_PLACES, TextUtil.DEFAULT_DECIMAL_PLACES), 0, 15, 1); decimalPlacesSpinner = new JSpinner(dpModel); decimalPlacesSpinner.setToolTipText(trans.get("SimExpPan.lbl.DecimalPlaces.ttip")); @@ -85,7 +85,7 @@ public class CsvOptionPanel extends JPanel { //// Exponential notation exponentialNotationCheckbox = new JCheckBox(trans.get("SimExpPan.lbl.ExponentialNotation")); exponentialNotationCheckbox.setToolTipText(trans.get("SimExpPan.lbl.ExponentialNotation.ttip")); - exponentialNotationCheckbox.setSelected(Application.getPreferences().getBoolean(ORPreferences.EXPORT_EXPONENTIAL_NOTATION, true)); + exponentialNotationCheckbox.setSelected(Application.getPreferences().getBoolean(ApplicationPreferences.EXPORT_EXPONENTIAL_NOTATION, true)); panel.add(exponentialNotationCheckbox); this.add(panel, "growx, wrap unrel"); @@ -117,7 +117,7 @@ public class CsvOptionPanel extends JPanel { commentCharacter = new JComboBox(new String[] { "#", "%", ";" }); commentCharacter.setEditable(true); - commentCharacter.setSelectedItem(Application.getPreferences().getString(ORPreferences.EXPORT_COMMENT_CHARACTER, "#")); + commentCharacter.setSelectedItem(Application.getPreferences().getString(ApplicationPreferences.EXPORT_COMMENT_CHARACTER, "#")); commentCharacter.setToolTipText(tip); panel.add(commentCharacter, "growx"); @@ -149,10 +149,10 @@ public class CsvOptionPanel extends JPanel { * Store the selected options to the user preferences. */ public void storePreferences() { - Application.getPreferences().putString(ORPreferences.EXPORT_FIELD_SEPARATOR, getFieldSeparator()); - Application.getPreferences().putInt(ORPreferences.EXPORT_DECIMAL_PLACES, getDecimalPlaces()); - Application.getPreferences().putBoolean(ORPreferences.EXPORT_EXPONENTIAL_NOTATION, isExponentialNotation()); - Application.getPreferences().putString(ORPreferences.EXPORT_COMMENT_CHARACTER, getCommentCharacter()); + Application.getPreferences().putString(ApplicationPreferences.EXPORT_FIELD_SEPARATOR, getFieldSeparator()); + Application.getPreferences().putInt(ApplicationPreferences.EXPORT_DECIMAL_PLACES, getDecimalPlaces()); + Application.getPreferences().putBoolean(ApplicationPreferences.EXPORT_EXPONENTIAL_NOTATION, isExponentialNotation()); + Application.getPreferences().putString(ApplicationPreferences.EXPORT_COMMENT_CHARACTER, getCommentCharacter()); for (int i = 0; i < options.length; i++) { Application.getPreferences().putBoolean("csvOptions." + baseClassName + "." + i, options[i].isSelected()); } diff --git a/swing/src/main/java/info/openrocket/swing/gui/components/PreferencesOptionPanel.java b/swing/src/main/java/info/openrocket/swing/gui/components/PreferencesOptionPanel.java index 39d968f1c..ef1a3c0c6 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/components/PreferencesOptionPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/components/PreferencesOptionPanel.java @@ -1,6 +1,6 @@ package info.openrocket.swing.gui.components; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.l10n.Translator; import info.openrocket.core.startup.Application; @@ -16,7 +16,7 @@ import java.awt.event.ItemListener; */ public class PreferencesOptionPanel extends JPanel { private static final Translator trans = Application.getTranslator(); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); private final JCheckBox exportUserDirectories; private final JCheckBox exportWindowInfo; diff --git a/swing/src/main/java/info/openrocket/swing/gui/components/SVGOptionPanel.java b/swing/src/main/java/info/openrocket/swing/gui/components/SVGOptionPanel.java index 653500932..4224169c2 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/components/SVGOptionPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/components/SVGOptionPanel.java @@ -1,11 +1,11 @@ package info.openrocket.swing.gui.components; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.swing.gui.SpinnerEditor; import info.openrocket.swing.gui.adaptors.DoubleModel; import info.openrocket.core.l10n.Translator; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; import info.openrocket.core.unit.UnitGroup; import javax.swing.JLabel; @@ -15,7 +15,7 @@ import java.awt.Color; public class SVGOptionPanel extends JPanel { private static final Translator trans = Application.getTranslator(); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); private final ColorChooserButton colorChooser; private double strokeWidth = 0.1; diff --git a/swing/src/main/java/info/openrocket/swing/gui/configdialog/FinSetConfig.java b/swing/src/main/java/info/openrocket/swing/gui/configdialog/FinSetConfig.java index 0783adf89..35306d8b9 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/configdialog/FinSetConfig.java +++ b/swing/src/main/java/info/openrocket/swing/gui/configdialog/FinSetConfig.java @@ -21,7 +21,7 @@ import javax.swing.SwingUtilities; import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.swing.gui.components.SVGOptionPanel; import info.openrocket.swing.gui.util.FileHelper; import info.openrocket.swing.gui.util.SwingPreferences; @@ -62,7 +62,7 @@ import org.slf4j.LoggerFactory; public abstract class FinSetConfig extends RocketComponentConfig { private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class); private static final Translator trans = Application.getTranslator(); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); private JButton split = null; diff --git a/swing/src/main/java/info/openrocket/swing/gui/configdialog/InnerTubeConfig.java b/swing/src/main/java/info/openrocket/swing/gui/configdialog/InnerTubeConfig.java index dc494755b..4d59f97e2 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/configdialog/InnerTubeConfig.java +++ b/swing/src/main/java/info/openrocket/swing/gui/configdialog/InnerTubeConfig.java @@ -43,7 +43,7 @@ import info.openrocket.core.rocketcomponent.MotorMount; import info.openrocket.core.rocketcomponent.RingComponent; import info.openrocket.core.rocketcomponent.RocketComponent; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.unit.UnitGroup; import info.openrocket.core.util.BugException; import info.openrocket.core.util.Coordinate; @@ -65,7 +65,7 @@ import info.openrocket.swing.gui.widgets.SelectColorButton; public class InnerTubeConfig extends RocketComponentConfig { private static final long serialVersionUID = 7900041420864324470L; private static final Translator trans = Application.getTranslator(); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); private static final String PREF_SEPARATION_RELATIVE = "InnerTubeSeparationRelative"; diff --git a/swing/src/main/java/info/openrocket/swing/gui/configdialog/RocketComponentConfig.java b/swing/src/main/java/info/openrocket/swing/gui/configdialog/RocketComponentConfig.java index f71322045..d049f99ef 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/configdialog/RocketComponentConfig.java +++ b/swing/src/main/java/info/openrocket/swing/gui/configdialog/RocketComponentConfig.java @@ -60,7 +60,7 @@ import info.openrocket.core.preset.ComponentPreset; import info.openrocket.core.rocketcomponent.*; import info.openrocket.core.rocketcomponent.position.AxialMethod; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.unit.UnitGroup; import info.openrocket.core.util.Invalidatable; @@ -68,7 +68,7 @@ public class RocketComponentConfig extends JPanel implements Invalidatable, Inva private static final long serialVersionUID = -2925484062132243982L; private static final Translator trans = Application.getTranslator(); - private static final ORPreferences preferences = Application.getPreferences(); + private static final ApplicationPreferences preferences = Application.getPreferences(); protected final OpenRocketDocument document; protected final RocketComponent component; diff --git a/swing/src/main/java/info/openrocket/swing/gui/configdialog/SaveDesignInfoPanel.java b/swing/src/main/java/info/openrocket/swing/gui/configdialog/SaveDesignInfoPanel.java index fbbf80291..8f6d23a5d 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/configdialog/SaveDesignInfoPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/configdialog/SaveDesignInfoPanel.java @@ -1,6 +1,6 @@ package info.openrocket.swing.gui.configdialog; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.document.OpenRocketDocument; @@ -25,7 +25,7 @@ import java.awt.event.ActionListener; */ public class SaveDesignInfoPanel extends RocketConfig { private static final Translator trans = Application.getTranslator(); - private static final ORPreferences preferences = Application.getPreferences(); + private static final ApplicationPreferences preferences = Application.getPreferences(); public SaveDesignInfoPanel(OpenRocketDocument d, RocketComponent c, JDialog parent) { super(d, c, parent); diff --git a/swing/src/main/java/info/openrocket/swing/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java b/swing/src/main/java/info/openrocket/swing/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java index d2991f0cf..f28aee90b 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/dialogs/motor/thrustcurve/ThrustCurveMotorSelectionPanel.java @@ -44,7 +44,7 @@ import javax.swing.event.RowSorterListener; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.swing.gui.plot.Util; import info.openrocket.swing.gui.theme.UITheme; import org.jfree.chart.ChartColor; @@ -218,11 +218,11 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec { hideSimilarBox = new JCheckBox(trans.get("TCMotorSelPan.checkbox.hideSimilar")); GUIUtil.changeFontSize(hideSimilarBox, -1); - hideSimilarBox.setSelected(Application.getPreferences().getBoolean(ORPreferences.MOTOR_HIDE_SIMILAR, true)); + hideSimilarBox.setSelected(Application.getPreferences().getBoolean(ApplicationPreferences.MOTOR_HIDE_SIMILAR, true)); hideSimilarBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - Application.getPreferences().putBoolean(ORPreferences.MOTOR_HIDE_SIMILAR, hideSimilarBox.isSelected()); + Application.getPreferences().putBoolean(ApplicationPreferences.MOTOR_HIDE_SIMILAR, hideSimilarBox.isSelected()); updateData(); } }); @@ -233,11 +233,11 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec { hideUnavailableBox = new JCheckBox(trans.get("TCMotorSelPan.checkbox.hideUnavailable")); GUIUtil.changeFontSize(hideUnavailableBox, -1); - hideUnavailableBox.setSelected(Application.getPreferences().getBoolean(ORPreferences.MOTOR_HIDE_UNAVAILABLE, true)); + hideUnavailableBox.setSelected(Application.getPreferences().getBoolean(ApplicationPreferences.MOTOR_HIDE_UNAVAILABLE, true)); hideUnavailableBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - Application.getPreferences().putBoolean(ORPreferences.MOTOR_HIDE_UNAVAILABLE, hideUnavailableBox.isSelected()); + Application.getPreferences().putBoolean(ApplicationPreferences.MOTOR_HIDE_UNAVAILABLE, hideUnavailableBox.isSelected()); motorFilterPanel.setHideUnavailable(hideUnavailableBox.isSelected()); } }); @@ -486,7 +486,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec } // Store selected motor in preferences node, set all others to false - Preferences prefs = ((SwingPreferences) Application.getPreferences()).getNode(ORPreferences.PREFERRED_THRUST_CURVE_MOTOR_NODE); + Preferences prefs = ((SwingPreferences) Application.getPreferences()).getNode(ApplicationPreferences.PREFERRED_THRUST_CURVE_MOTOR_NODE); for (ThrustCurveMotor m : set.getMotors()) { String digest = m.getDigest(); prefs.putBoolean(digest, m == motor); @@ -657,7 +657,7 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec // Find which motor has been used the most recently List list = set.getMotors(); - Preferences prefs = ((SwingPreferences) Application.getPreferences()).getNode(ORPreferences.PREFERRED_THRUST_CURVE_MOTOR_NODE); + Preferences prefs = ((SwingPreferences) Application.getPreferences()).getNode(ApplicationPreferences.PREFERRED_THRUST_CURVE_MOTOR_NODE); for (ThrustCurveMotor m : list) { String digest = m.getDigest(); if (prefs.getBoolean(digest, false)) { diff --git a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DesignPreferencesPanel.java b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DesignPreferencesPanel.java index 4cde182b9..9925e16e8 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DesignPreferencesPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DesignPreferencesPanel.java @@ -10,7 +10,7 @@ import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JSpinner; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.swing.gui.SpinnerEditor; import info.openrocket.swing.gui.adaptors.DoubleModel; @@ -27,7 +27,7 @@ public class DesignPreferencesPanel extends PreferencesPanel { "gapright para"); this.add( new JComboBox(new PrefChoiceSelector( - ORPreferences.BODY_COMPONENT_INSERT_POSITION_KEY, + ApplicationPreferences.BODY_COMPONENT_INSERT_POSITION_KEY, // // Always ask // // Insert in middle // // Add to end @@ -41,7 +41,7 @@ public class DesignPreferencesPanel extends PreferencesPanel { "gapright para"); this.add( new JComboBox(new PrefChoiceSelector( - ORPreferences.STAGE_INSERT_POSITION_KEY, + ApplicationPreferences.STAGE_INSERT_POSITION_KEY, // // Always ask // // Insert in middle // // Add to end @@ -56,7 +56,7 @@ public class DesignPreferencesPanel extends PreferencesPanel { this.add( new JComboBox(new PrefChoiceSelector( - ORPreferences.ROCKET_INFO_FONT_SIZE, + ApplicationPreferences.ROCKET_INFO_FONT_SIZE, // // Small // // Medium // // Large diff --git a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DisplayPreferencesPanel.java b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DisplayPreferencesPanel.java index 544bf0d00..49bc7a87d 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DisplayPreferencesPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/DisplayPreferencesPanel.java @@ -6,7 +6,7 @@ package info.openrocket.swing.gui.dialogs.preferences; import javax.swing.JComboBox; import javax.swing.JLabel; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; /** @@ -23,7 +23,7 @@ public class DisplayPreferencesPanel extends PreferencesPanel { this.add( new JComboBox(new PrefChoiceSelector( - ORPreferences.ROCKET_INFO_FONT_SIZE, + ApplicationPreferences.ROCKET_INFO_FONT_SIZE, // // Small // // Medium // // Large diff --git a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GeneralPreferencesPanel.java b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GeneralPreferencesPanel.java index 8efbca17c..27409fa02 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GeneralPreferencesPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GeneralPreferencesPanel.java @@ -38,7 +38,7 @@ import info.openrocket.core.communication.UpdateInfoRetriever.ReleaseStatus; import info.openrocket.core.gui.util.SimpleFileFilter; import info.openrocket.core.l10n.L10N; import info.openrocket.core.logging.Markers; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.util.BuildProperties; import info.openrocket.core.util.Named; import info.openrocket.core.util.Utils; @@ -93,7 +93,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel { Named selection = (Named) languageCombo.getSelectedItem(); if (selection == null) return; Locale l = selection.get(); - preferences.putString(ORPreferences.USER_LOCAL, l == null ? null : l.toString()); + preferences.putString(ApplicationPreferences.USER_LOCAL, l == null ? null : l.toString()); } }); this.add(new JLabel(trans.get("generalprefs.lbl.language")), "gapright para"); diff --git a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GraphicsPreferencesPanel.java b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GraphicsPreferencesPanel.java index f1619bb58..d965f2cd6 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GraphicsPreferencesPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/dialogs/preferences/GraphicsPreferencesPanel.java @@ -22,7 +22,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.arch.SystemInfo; @@ -165,34 +165,34 @@ public class GraphicsPreferencesPanel extends PreferencesPanel { trans.get("pref.dlg.lbl.effect1"), -2, Style.ITALIC), "spanx, wrap"); - BooleanModel enableGLModel = new BooleanModel(preferences.getBoolean(ORPreferences.OPENGL_ENABLED, true)); + BooleanModel enableGLModel = new BooleanModel(preferences.getBoolean(ApplicationPreferences.OPENGL_ENABLED, true)); final JCheckBox enableGL = new JCheckBox(enableGLModel); enableGL.setText(trans.get("pref.dlg.opengl.but.enableGL")); enableGL.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - preferences.putBoolean(ORPreferences.OPENGL_ENABLED, enableGL.isSelected()); + preferences.putBoolean(ApplicationPreferences.OPENGL_ENABLED, enableGL.isSelected()); } }); add(enableGL, "wrap"); final JCheckBox enableAA = new JCheckBox(trans.get("pref.dlg.opengl.but.enableAA")); - enableAA.setSelected(preferences.getBoolean(ORPreferences.OPENGL_ENABLE_AA, true)); + enableAA.setSelected(preferences.getBoolean(ApplicationPreferences.OPENGL_ENABLE_AA, true)); enableAA.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - preferences.putBoolean(ORPreferences.OPENGL_ENABLE_AA, enableAA.isSelected()); + preferences.putBoolean(ApplicationPreferences.OPENGL_ENABLE_AA, enableAA.isSelected()); } }); enableGLModel.addEnableComponent(enableAA); add(enableAA, "wrap"); final JCheckBox useFBO = new JCheckBox(trans.get("pref.dlg.opengl.lbl.useFBO")); - useFBO.setSelected(preferences.getBoolean(ORPreferences.OPENGL_USE_FBO, false)); + useFBO.setSelected(preferences.getBoolean(ApplicationPreferences.OPENGL_USE_FBO, false)); useFBO.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - preferences.putBoolean(ORPreferences.OPENGL_USE_FBO, useFBO.isSelected()); + preferences.putBoolean(ApplicationPreferences.OPENGL_USE_FBO, useFBO.isSelected()); } }); enableGLModel.addEnableComponent(useFBO); diff --git a/swing/src/main/java/info/openrocket/swing/gui/figure3d/RocketFigure3d.java b/swing/src/main/java/info/openrocket/swing/gui/figure3d/RocketFigure3d.java index 4474f076a..1f7f05fdd 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/figure3d/RocketFigure3d.java +++ b/swing/src/main/java/info/openrocket/swing/gui/figure3d/RocketFigure3d.java @@ -34,7 +34,7 @@ import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import javax.swing.event.MouseInputAdapter; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.swing.gui.util.GUIUtil; import info.openrocket.swing.gui.theme.UITheme; import org.slf4j.Logger; @@ -152,7 +152,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener { if (System.getProperty("openrocket.3d.disable") != null) return false; //return by preference - return Application.getPreferences().getBoolean(ORPreferences.OPENGL_ENABLED, true); + return Application.getPreferences().getBoolean(ApplicationPreferences.OPENGL_ENABLED, true); } private void initGLCanvas() { @@ -166,7 +166,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener { log.trace("GL - creating GLCapabilities"); final GLCapabilities caps = new GLCapabilities(glp); - if (Application.getPreferences().getBoolean(ORPreferences.OPENGL_ENABLE_AA, true)) { + if (Application.getPreferences().getBoolean(ApplicationPreferences.OPENGL_ENABLE_AA, true)) { log.trace("GL - setSampleBuffers"); caps.setSampleBuffers(true); @@ -176,7 +176,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener { log.trace("GL - Not enabling AA by user pref"); } - if (Application.getPreferences().getBoolean(ORPreferences.OPENGL_USE_FBO, false)) { + if (Application.getPreferences().getBoolean(ApplicationPreferences.OPENGL_USE_FBO, false)) { log.trace("GL - Creating GLJPanel"); canvas = new GLJPanel(caps); } else { diff --git a/swing/src/main/java/info/openrocket/swing/gui/figure3d/photo/PhotoPanel.java b/swing/src/main/java/info/openrocket/swing/gui/figure3d/photo/PhotoPanel.java index 274657161..a6a44526d 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/figure3d/photo/PhotoPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/figure3d/photo/PhotoPanel.java @@ -50,7 +50,7 @@ import info.openrocket.core.rocketcomponent.FlightConfigurationId; import info.openrocket.core.rocketcomponent.MotorMount; import info.openrocket.core.rocketcomponent.RocketComponent; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.util.Coordinate; import info.openrocket.core.util.MathUtil; import info.openrocket.core.util.StateChangeListener; @@ -162,7 +162,7 @@ public class PhotoPanel extends JPanel implements GLEventListener { caps.setBackgroundOpaque(false); if (Application.getPreferences().getBoolean( - ORPreferences.OPENGL_ENABLE_AA, true)) { + ApplicationPreferences.OPENGL_ENABLE_AA, true)) { caps.setSampleBuffers(true); caps.setNumSamples(6); } else { @@ -170,7 +170,7 @@ public class PhotoPanel extends JPanel implements GLEventListener { } if (Application.getPreferences().getBoolean( - ORPreferences.OPENGL_USE_FBO, false)) { + ApplicationPreferences.OPENGL_USE_FBO, false)) { log.trace("GL - Creating GLJPanel"); canvas = new GLJPanel(caps); ((GLJPanel) canvas).setOpaque(false); @@ -287,7 +287,7 @@ public class PhotoPanel extends JPanel implements GLEventListener { // in an off-screen framebuffer object (FBO), otherwise the fake transparency rendering will cause the // exported image to have a fully white background. if (!Application.getPreferences().getBoolean( - ORPreferences.OPENGL_USE_FBO, false) && p.getSkyColorOpacity() < 100) { + ApplicationPreferences.OPENGL_USE_FBO, false) && p.getSkyColorOpacity() < 100) { i = drawToBufferedImage(drawable); } else { i = (new AWTGLReadBufferUtil( @@ -443,7 +443,7 @@ public class PhotoPanel extends JPanel implements GLEventListener { // Machines that don't use off-screen rendering can't render transparent background, so we create it // artificially by blending the sky color with white (= color that is rendered as transparent background) if (useFakeTransparencyRendering && !Application.getPreferences().getBoolean( - ORPreferences.OPENGL_USE_FBO, false)) { + ApplicationPreferences.OPENGL_USE_FBO, false)) { convertColor(blendColors(p.getSkyColor(), new ORColor(255, 255, 255, 0), 1-p.getSkyColorOpacity()), color); } else { diff --git a/swing/src/main/java/info/openrocket/swing/gui/main/BasicFrame.java b/swing/src/main/java/info/openrocket/swing/gui/main/BasicFrame.java index cbd7100c6..349c3aaf9 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/main/BasicFrame.java +++ b/swing/src/main/java/info/openrocket/swing/gui/main/BasicFrame.java @@ -49,7 +49,7 @@ import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions; @@ -126,7 +126,7 @@ public class BasicFrame extends JFrame { private static final GeneralRocketSaver ROCKET_SAVER = new GeneralRocketSaver(); private static final Translator trans = Application.getTranslator(); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); public static final int SHORTCUT_KEY = Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx(); diff --git a/swing/src/main/java/info/openrocket/swing/gui/main/ComponentAddButtons.java b/swing/src/main/java/info/openrocket/swing/gui/main/ComponentAddButtons.java index d94442e6d..3fa2c63ae 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/main/ComponentAddButtons.java +++ b/swing/src/main/java/info/openrocket/swing/gui/main/ComponentAddButtons.java @@ -25,7 +25,7 @@ import javax.swing.event.TreeSelectionListener; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -551,7 +551,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { // Check whether to insert between or at the end. // 0 = ask, 1 = in between, 2 = at the end - int pos = Application.getPreferences().getChoice(ORPreferences.BODY_COMPONENT_INSERT_POSITION_KEY, 2, 0); + int pos = Application.getPreferences().getChoice(ApplicationPreferences.BODY_COMPONENT_INSERT_POSITION_KEY, 2, 0); if (pos == 0) { if (parent.getChildPosition(c) == parent.getChildCount() - 1) pos = 2; // Selected component is the last component @@ -623,7 +623,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { if (check.isSelected()) { // Save the preference - Application.getPreferences().putInt(ORPreferences.BODY_COMPONENT_INSERT_POSITION_KEY, sel); + Application.getPreferences().putInt(ApplicationPreferences.BODY_COMPONENT_INSERT_POSITION_KEY, sel); } return sel; } @@ -675,7 +675,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { // Check whether to insert between or at the end. // 0 = ask, 1 = in between, 2 = at the end - int pos = Application.getPreferences().getChoice(ORPreferences.STAGE_INSERT_POSITION_KEY, 2, 0); + int pos = Application.getPreferences().getChoice(ApplicationPreferences.STAGE_INSERT_POSITION_KEY, 2, 0); if (pos == 0) { if (document.getRocket().getChildPosition(parentStage) == document.getRocket().getChildCount() - 1) pos = 2; // Selected component is the last component @@ -747,7 +747,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { if (check.isSelected()) { // Save the preference - Application.getPreferences().putInt(ORPreferences.STAGE_INSERT_POSITION_KEY, sel); + Application.getPreferences().putInt(ApplicationPreferences.STAGE_INSERT_POSITION_KEY, sel); } return sel; } diff --git a/swing/src/main/java/info/openrocket/swing/gui/main/DesignFileSaveAsFileChooser.java b/swing/src/main/java/info/openrocket/swing/gui/main/DesignFileSaveAsFileChooser.java index 9d232989d..46b71f03e 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/main/DesignFileSaveAsFileChooser.java +++ b/swing/src/main/java/info/openrocket/swing/gui/main/DesignFileSaveAsFileChooser.java @@ -17,7 +17,7 @@ import info.openrocket.core.gui.util.SimpleFileFilter; import info.openrocket.core.l10n.Translator; import info.openrocket.core.rocketcomponent.RocketComponent; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.util.FileUtils; import info.openrocket.swing.file.wavefrontobj.OBJOptionChooser; @@ -33,7 +33,7 @@ public class DesignFileSaveAsFileChooser extends SaveFileChooser { private final OpenRocketDocument document; private static final Translator trans = Application.getTranslator(); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); public static DesignFileSaveAsFileChooser build(OpenRocketDocument document, FileType type) { return new DesignFileSaveAsFileChooser(document, type, null); diff --git a/swing/src/main/java/info/openrocket/swing/gui/main/MRUDesignFile.java b/swing/src/main/java/info/openrocket/swing/gui/main/MRUDesignFile.java index 5404e867f..e365deaa6 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/main/MRUDesignFile.java +++ b/swing/src/main/java/info/openrocket/swing/gui/main/MRUDesignFile.java @@ -1,7 +1,7 @@ package info.openrocket.swing.gui.main; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; import javax.swing.event.EventListenerList; import java.beans.PropertyChangeEvent; @@ -115,7 +115,7 @@ public class MRUDesignFile { * Clear all existing MRU references in the preferences backing store. */ private void clear() { - ORPreferences prefs = getPreferences(); + ApplicationPreferences prefs = getPreferences(); for (int i = 0; i < MAX_SIZE; i++) { prefs.putString(MRU_FILE_LIST_PROPERTY + i, null); @@ -126,7 +126,7 @@ public class MRUDesignFile { * Store the MRU list into the preferences backing store. */ protected void store() { - ORPreferences prefs = getPreferences(); + ApplicationPreferences prefs = getPreferences(); // clear the backing store clear(); @@ -142,7 +142,7 @@ public class MRUDesignFile { */ protected void retrieve() { mruFileList.clear(); - ORPreferences prefs = getPreferences(); + ApplicationPreferences prefs = getPreferences(); for (int i = 0; i < MAX_SIZE; i++) { String str = prefs.getString(MRU_FILE_LIST_PROPERTY + i, null); @@ -183,11 +183,11 @@ public class MRUDesignFile { } /** - * Return the ORPreferences + * Return the ApplicationPreferences * - * @return ORPreferences + * @return ApplicationPreferences */ - protected final ORPreferences getPreferences() { + protected final ApplicationPreferences getPreferences() { return Application.getPreferences(); } } \ No newline at end of file diff --git a/swing/src/main/java/info/openrocket/swing/gui/main/SimulationPanel.java b/swing/src/main/java/info/openrocket/swing/gui/main/SimulationPanel.java index 7ae3a88ec..8a30ec4e2 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/main/SimulationPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/main/SimulationPanel.java @@ -56,6 +56,7 @@ import info.openrocket.core.document.events.DocumentChangeListener; import info.openrocket.core.document.events.SimulationChangeEvent; import info.openrocket.core.formatting.RocketDescriptor; import info.openrocket.core.l10n.Translator; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.rocketcomponent.ComponentChangeEvent; import info.openrocket.core.rocketcomponent.ComponentChangeListener; import info.openrocket.core.rocketcomponent.FlightConfigurationId; @@ -63,7 +64,6 @@ import info.openrocket.core.rocketcomponent.Rocket; import info.openrocket.core.simulation.FlightData; import info.openrocket.core.simulation.FlightEvent; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; import info.openrocket.core.unit.UnitGroup; import info.openrocket.core.util.AlphanumComparator; @@ -743,7 +743,7 @@ public class SimulationPanel extends JPanel { /// when the simulation tab is selected this run outdated simulated if appropriate. public void activating(){ - if( ((ORPreferences) Application.getPreferences()).getAutoRunSimulations()){ + if( ((ApplicationPreferences) Application.getPreferences()).getAutoRunSimulations()){ int nSims = simulationTable.getRowCount(); int outdated = 0; if (nSims == 0) { diff --git a/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlot.java b/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlot.java index 7c1f4e619..a332014e5 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlot.java +++ b/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlot.java @@ -25,7 +25,7 @@ import info.openrocket.core.simulation.FlightDataBranch; import info.openrocket.core.simulation.FlightDataType; import info.openrocket.core.simulation.FlightEvent; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.unit.Unit; import info.openrocket.core.unit.UnitGroup; import info.openrocket.core.util.LinearInterpolator; @@ -421,7 +421,7 @@ public class SimulationPlot { List eventImages = new ArrayList<>(); // Plot the markers - if (config.getDomainAxisType() == FlightDataType.TYPE_TIME && !preferences.getBoolean(ORPreferences.MARKER_STYLE_ICON, false)) { + if (config.getDomainAxisType() == FlightDataType.TYPE_TIME && !preferences.getBoolean(ApplicationPreferences.MARKER_STYLE_ICON, false)) { fillEventLists(branch, eventTimes, eventLabels, eventColors, eventImages); plotVerticalLineMarkers(plot, eventTimes, eventLabels, eventColors); diff --git a/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlotDialog.java b/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlotDialog.java index cc9d435c2..04b66bfce 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlotDialog.java +++ b/swing/src/main/java/info/openrocket/swing/gui/plot/SimulationPlotDialog.java @@ -20,9 +20,9 @@ import javax.swing.JPanel; import info.openrocket.core.document.Simulation; import info.openrocket.core.l10n.Translator; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.simulation.FlightDataType; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.swing.gui.components.StyledLabel; @@ -58,7 +58,7 @@ public class SimulationPlotDialog extends JDialog { super(parent, simulation.getName()); this.setModalityType(ModalityType.DOCUMENT_MODAL); - final boolean initialShowPoints = Application.getPreferences().getBoolean(ORPreferences.PLOT_SHOW_POINTS, false); + final boolean initialShowPoints = Application.getPreferences().getBoolean(ApplicationPreferences.PLOT_SHOW_POINTS, false); final SimulationPlot myPlot = new SimulationPlot(simulation, config, initialShowPoints); @@ -94,7 +94,7 @@ public class SimulationPlotDialog extends JDialog { @Override public void actionPerformed(ActionEvent e) { boolean show = checkData.isSelected(); - Application.getPreferences().putBoolean(ORPreferences.PLOT_SHOW_POINTS, show); + Application.getPreferences().putBoolean(ApplicationPreferences.PLOT_SHOW_POINTS, show); myPlot.setShowPoints(show); } }); diff --git a/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationConfigDialog.java b/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationConfigDialog.java index b721f097c..dae6da14a 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationConfigDialog.java +++ b/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationConfigDialog.java @@ -1,6 +1,6 @@ package info.openrocket.swing.gui.simulation; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.document.OpenRocketDocument; import info.openrocket.core.document.Simulation; @@ -54,7 +54,7 @@ public class SimulationConfigDialog extends JDialog { private JButton okButton; private JButton cancelButton; private static final Translator trans = Application.getTranslator(); - private static final ORPreferences preferences = Application.getPreferences(); + private static final ApplicationPreferences preferences = Application.getPreferences(); private final WindowListener applyChangesToSimsListener; diff --git a/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationOptionsPanel.java b/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationOptionsPanel.java index 440962146..29dfa4acc 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationOptionsPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationOptionsPanel.java @@ -31,7 +31,7 @@ import info.openrocket.core.simulation.SimulationOptions; import info.openrocket.core.simulation.extension.SimulationExtension; import info.openrocket.core.simulation.extension.SimulationExtensionProvider; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.unit.UnitGroup; import info.openrocket.core.util.GeodeticComputationStrategy; @@ -180,12 +180,12 @@ class SimulationOptionsPanel extends JPanel { button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - ORPreferences preferences = Application.getPreferences(); + ApplicationPreferences preferences = Application.getPreferences(); conditions.setTimeStep(preferences.getDouble( - ORPreferences.SIMULATION_TIME_STEP, + ApplicationPreferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP)); conditions.setGeodeticComputation(preferences.getEnum( - ORPreferences.GEODETIC_COMPUTATION, + ApplicationPreferences.GEODETIC_COMPUTATION, GeodeticComputationStrategy.SPHERICAL)); } }); diff --git a/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationPlotPanel.java b/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationPlotPanel.java index c20b6a501..9b3b60004 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationPlotPanel.java +++ b/swing/src/main/java/info/openrocket/swing/gui/simulation/SimulationPlotPanel.java @@ -31,7 +31,7 @@ import info.openrocket.core.simulation.FlightDataType; import info.openrocket.core.simulation.FlightDataTypeGroup; import info.openrocket.core.simulation.FlightEvent; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.unit.Unit; import info.openrocket.core.util.Utils; @@ -283,7 +283,7 @@ public class SimulationPlotPanel extends JPanel { bg.add(radioVerticalMarker); bg.add(radioIcon); - boolean useIcon = preferences.getBoolean(ORPreferences.MARKER_STYLE_ICON, false); + boolean useIcon = preferences.getBoolean(ApplicationPreferences.MARKER_STYLE_ICON, false); if (useIcon) { radioIcon.setSelected(true); } else { @@ -295,7 +295,7 @@ public class SimulationPlotPanel extends JPanel { public void itemStateChanged(ItemEvent e) { if (modifying > 0) return; - preferences.putBoolean(ORPreferences.MARKER_STYLE_ICON, radioIcon.isSelected()); + preferences.putBoolean(ApplicationPreferences.MARKER_STYLE_ICON, radioIcon.isSelected()); } }); diff --git a/swing/src/main/java/info/openrocket/swing/gui/util/GUIUtil.java b/swing/src/main/java/info/openrocket/swing/gui/util/GUIUtil.java index 5d35c63b3..1671f5ccf 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/util/GUIUtil.java +++ b/swing/src/main/java/info/openrocket/swing/gui/util/GUIUtil.java @@ -64,7 +64,7 @@ import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreeModel; import javax.swing.tree.TreeSelectionModel; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.swing.gui.Resettable; import info.openrocket.core.logging.Markers; @@ -280,7 +280,7 @@ public class GUIUtil { * @return the current theme */ public static UITheme.Theme getUITheme() { - ORPreferences prefs = Application.getPreferences(); + ApplicationPreferences prefs = Application.getPreferences(); Object theme = prefs.getUITheme(); if (theme instanceof UITheme.Theme) { return (UITheme.Theme) theme; diff --git a/swing/src/main/java/info/openrocket/swing/gui/util/PreferencesExporter.java b/swing/src/main/java/info/openrocket/swing/gui/util/PreferencesExporter.java index 39e9c8632..ccc8bb972 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/util/PreferencesExporter.java +++ b/swing/src/main/java/info/openrocket/swing/gui/util/PreferencesExporter.java @@ -2,9 +2,9 @@ package info.openrocket.swing.gui.util; import info.openrocket.core.arch.SystemInfo; import info.openrocket.core.l10n.Translator; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; import info.openrocket.swing.gui.components.PreferencesOptionPanel; import info.openrocket.swing.gui.main.MRUDesignFile; import info.openrocket.swing.gui.theme.UITheme; @@ -41,11 +41,11 @@ import java.util.prefs.Preferences; public abstract class PreferencesExporter { private static final Translator trans = Application.getTranslator(); private static final Logger log = LoggerFactory.getLogger(PreferencesExporter.class); - private static final ORPreferences prefs = Application.getPreferences(); + private static final ApplicationPreferences prefs = Application.getPreferences(); private static final List keysToIgnore = new ArrayList<>(); // Preference keys to ignore when exporting user directories (= keys that export user directories) private static final List prefixKeysToIgnore = new ArrayList<>(); // Preference keys to ignore when exporting user directories (= keys that start with these prefixes), e.g. - private static final List nodesToIgnore = new ArrayList<>(); // ORPreferences nodes that should not be exported + private static final List nodesToIgnore = new ArrayList<>(); // ApplicationPreferences nodes that should not be exported public static boolean exportPreferences(Window parent, Preferences preferences) { JFileChooser chooser = new SaveFileChooser(); @@ -97,7 +97,7 @@ public abstract class PreferencesExporter { // Export all preferences except user directories exportFilteredPreferences(preferences, fos); } - log.info("ORPreferences exported successfully."); + log.info("ApplicationPreferences exported successfully."); } catch (IOException | BackingStoreException e) { log.warn("Error while importing preferences: " + e.getMessage()); } @@ -111,8 +111,8 @@ public abstract class PreferencesExporter { nodesToIgnore.clear(); if (ignoreUserDirectories) { - keysToIgnore.add(ORPreferences.USER_THRUST_CURVES_KEY); - keysToIgnore.add(ORPreferences.DEFAULT_DIRECTORY); + keysToIgnore.add(ApplicationPreferences.USER_THRUST_CURVES_KEY); + keysToIgnore.add(ApplicationPreferences.DEFAULT_DIRECTORY); prefixKeysToIgnore.add(MRUDesignFile.MRU_FILE_LIST_PROPERTY); } diff --git a/swing/src/main/java/info/openrocket/swing/gui/util/SwingPreferences.java b/swing/src/main/java/info/openrocket/swing/gui/util/SwingPreferences.java index 40621f374..7aa4c20b7 100644 --- a/swing/src/main/java/info/openrocket/swing/gui/util/SwingPreferences.java +++ b/swing/src/main/java/info/openrocket/swing/gui/util/SwingPreferences.java @@ -21,8 +21,8 @@ import java.util.prefs.BackingStoreException; import java.util.prefs.Preferences; import info.openrocket.core.database.Databases; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.rocketcomponent.NoseCone; -import info.openrocket.core.preferences.ORPreferences; import info.openrocket.swing.gui.theme.UITheme; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +57,7 @@ import info.openrocket.core.util.BuildProperties; import info.openrocket.swing.communication.AssetHandler.UpdatePlatform; -public class SwingPreferences extends ORPreferences implements SimulationOptionsInterface { +public class SwingPreferences extends ApplicationPreferences implements SimulationOptionsInterface { private static final Logger log = LoggerFactory.getLogger(SwingPreferences.class); @@ -359,7 +359,7 @@ public class SwingPreferences extends ORPreferences implements SimulationOptions } private UITheme.Theme getUIThemeAsTheme() { - String themeName = getString(ORPreferences.UI_THEME, UITheme.Themes.LIGHT.name()); + String themeName = getString(ApplicationPreferences.UI_THEME, UITheme.Themes.LIGHT.name()); if (themeName == null) return UITheme.Themes.LIGHT; // Default theme try { return UITheme.Themes.valueOf(themeName); @@ -375,7 +375,7 @@ public class SwingPreferences extends ORPreferences implements SimulationOptions @Override public void setUITheme(Object theme) { if (!(theme instanceof UITheme.Theme)) return; - putString(ORPreferences.UI_THEME, ((UITheme.Theme) theme).name()); + putString(ApplicationPreferences.UI_THEME, ((UITheme.Theme) theme).name()); storeVersion(); } @@ -388,7 +388,7 @@ public class SwingPreferences extends ORPreferences implements SimulationOptions } public final float getRocketInfoFontSize() { - return (float) ((getUIFontSize() - 2) + 3 * Application.getPreferences().getChoice(ORPreferences.ROCKET_INFO_FONT_SIZE, 2, 0)); + return (float) ((getUIFontSize() - 2) + 3 * Application.getPreferences().getChoice(ApplicationPreferences.ROCKET_INFO_FONT_SIZE, 2, 0)); } private static int getDefaultFontSize() { @@ -430,7 +430,7 @@ public class SwingPreferences extends ORPreferences implements SimulationOptions } public File getDefaultDirectory() { - String file = getString(ORPreferences.DEFAULT_DIRECTORY, null); + String file = getString(ApplicationPreferences.DEFAULT_DIRECTORY, null); if (file == null) return null; return new File(file); @@ -443,7 +443,7 @@ public class SwingPreferences extends ORPreferences implements SimulationOptions } else { d = dir.getAbsolutePath(); } - putString(ORPreferences.DEFAULT_DIRECTORY, d); + putString(ApplicationPreferences.DEFAULT_DIRECTORY, d); storeVersion(); } diff --git a/swing/src/main/java/info/openrocket/swing/startup/GuiModule.java b/swing/src/main/java/info/openrocket/swing/startup/GuiModule.java index e2259400f..1aff235ee 100644 --- a/swing/src/main/java/info/openrocket/swing/startup/GuiModule.java +++ b/swing/src/main/java/info/openrocket/swing/startup/GuiModule.java @@ -7,7 +7,7 @@ import info.openrocket.core.formatting.RocketDescriptor; import info.openrocket.core.formatting.RocketDescriptorImpl; import info.openrocket.core.l10n.Translator; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.database.ComponentPresetDatabaseLoader; import info.openrocket.core.database.MotorDatabaseLoader; import info.openrocket.swing.gui.util.SwingPreferences; @@ -47,7 +47,7 @@ public class GuiModule extends AbstractModule { @Override protected void configure() { - bind(ORPreferences.class).to(SwingPreferences.class).in(Scopes.SINGLETON); + bind(ApplicationPreferences.class).to(SwingPreferences.class).in(Scopes.SINGLETON); bind(Translator.class).toProvider(TranslatorProvider.class).in(Scopes.SINGLETON); bind(RocketDescriptor.class).to(RocketDescriptorImpl.class).in(Scopes.SINGLETON); bind(WatchService.class).to(WatchServiceImpl.class).in(Scopes.SINGLETON); diff --git a/swing/src/main/java/info/openrocket/swing/startup/SwingStartup.java b/swing/src/main/java/info/openrocket/swing/startup/SwingStartup.java index 72525213f..b5c019c58 100644 --- a/swing/src/main/java/info/openrocket/swing/startup/SwingStartup.java +++ b/swing/src/main/java/info/openrocket/swing/startup/SwingStartup.java @@ -14,8 +14,8 @@ import javax.swing.SwingUtilities; import javax.swing.Timer; import javax.swing.ToolTipManager; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.startup.Application; -import info.openrocket.core.preferences.ORPreferences; import net.miginfocom.layout.LayoutUtil; import info.openrocket.core.arch.SystemInfo; import info.openrocket.core.arch.SystemInfo.Platform; @@ -206,7 +206,7 @@ public class SwingStartup { String cmdLAF = System.getProperty("openrocket.laf"); if (cmdLAF != null) { log.info("Setting cmd line LAF '{}'", cmdLAF); - ORPreferences prefs = Application.getPreferences(); + ApplicationPreferences prefs = Application.getPreferences(); prefs.setUITheme(UITheme.Themes.valueOf(cmdLAF)); } GUIUtil.applyLAF(); diff --git a/swing/src/main/java/info/openrocket/swing/utils/CoreServicesModule.java b/swing/src/main/java/info/openrocket/swing/utils/CoreServicesModule.java index aebcbaf34..2bf952ef7 100644 --- a/swing/src/main/java/info/openrocket/swing/utils/CoreServicesModule.java +++ b/swing/src/main/java/info/openrocket/swing/utils/CoreServicesModule.java @@ -2,7 +2,7 @@ package info.openrocket.swing.utils; import info.openrocket.core.formatting.RocketDescriptor; import info.openrocket.core.formatting.RocketDescriptorImpl; -import info.openrocket.core.preferences.ORPreferences; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.swing.gui.util.SwingPreferences; import info.openrocket.core.l10n.Translator; import info.openrocket.swing.startup.providers.TranslatorProvider; @@ -13,7 +13,7 @@ public class CoreServicesModule extends AbstractModule { @Override protected void configure() { - bind(ORPreferences.class).to(SwingPreferences.class); + bind(ApplicationPreferences.class).to(SwingPreferences.class); bind(Translator.class).toProvider(TranslatorProvider.class); bind(RocketDescriptor.class).to(RocketDescriptorImpl.class); } diff --git a/swing/src/test/java/info/openrocket/swing/ServicesForTesting.java b/swing/src/test/java/info/openrocket/swing/ServicesForTesting.java index 78cbfe15f..c5fac25b4 100644 --- a/swing/src/test/java/info/openrocket/swing/ServicesForTesting.java +++ b/swing/src/test/java/info/openrocket/swing/ServicesForTesting.java @@ -8,9 +8,9 @@ import info.openrocket.core.l10n.DebugTranslator; import info.openrocket.core.l10n.ResourceBundleTranslator; import info.openrocket.core.l10n.Translator; import info.openrocket.core.material.Material; +import info.openrocket.core.preferences.ApplicationPreferences; import info.openrocket.core.preset.ComponentPreset; import info.openrocket.core.preset.ComponentPreset.Type; -import info.openrocket.core.preferences.ORPreferences; import java.util.Collections; import java.util.Locale; @@ -22,7 +22,7 @@ public class ServicesForTesting extends AbstractModule { @Override protected void configure() { - bind(ORPreferences.class).to(PreferencesForTesting.class); + bind(ApplicationPreferences.class).to(PreferencesForTesting.class); bind(Translator.class).toProvider(TranslatorProviderForTesting.class); bind(RocketDescriptor.class).to(RocketDescriptorImpl.class); } @@ -59,7 +59,7 @@ public class ServicesForTesting extends AbstractModule { } - public static class PreferencesForTesting extends ORPreferences { + public static class PreferencesForTesting extends ApplicationPreferences { private static java.util.prefs.Preferences root = null;