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 cc9814243..7b44a88ac 100644 --- a/core/src/main/java/info/openrocket/core/document/OpenRocketDocument.java +++ b/core/src/main/java/info/openrocket/core/document/OpenRocketDocument.java @@ -5,7 +5,7 @@ import java.util.*; import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions; import info.openrocket.core.rocketcomponent.*; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.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 Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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 132321650..59f432dbc 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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 - Preferences prefs = Application.getPreferences(); + ORPreferences 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 7f82ec43c..12605b7c7 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 Preferences when adding new options ! + // ! Update ORPreferences when adding new options ! /** * If true, export all children of the components as well 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 b4e44cac7..4fc7df5b3 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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()) { - Preferences preferences = Application.getPreferences(); + ORPreferences 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) { - Preferences preferences = Application.getPreferences(); + ORPreferences 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 e175a7f54..08cc72116 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; import com.google.inject.Inject; public class DefaultSimulationOptionFactory { @Inject - private final Preferences prefs; + private final ORPreferences 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(Preferences prefs) { + public DefaultSimulationOptionFactory(ORPreferences 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 0d3796ea3..5bb623297 100644 --- a/core/src/main/java/info/openrocket/core/simulation/SimulationOptions.java +++ b/core/src/main/java/info/openrocket/core/simulation/SimulationOptions.java @@ -6,6 +6,7 @@ import java.util.EventObject; import java.util.List; import java.util.Random; +import info.openrocket.core.startup.ORPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -17,7 +18,6 @@ import info.openrocket.core.models.gravity.GravityModel; import info.openrocket.core.models.gravity.WGSGravityModel; import info.openrocket.core.models.wind.PinkNoiseWindModel; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.util.BugException; import info.openrocket.core.util.ChangeSource; import info.openrocket.core.util.GeodeticComputationStrategy; @@ -44,21 +44,21 @@ public class SimulationOptions implements ChangeSource, Cloneable, SimulationOpt */ private static final AtmosphericModel ISA_ATMOSPHERIC_MODEL = new ExtendedISAModel(); - protected final Preferences preferences = Application.getPreferences(); + protected final ORPreferences preferences = Application.getPreferences(); /* * NOTE: When adding/modifying parameters, they must also be added to the * equals and copyFrom methods!! */ - private double launchRodLength = preferences.getDouble(Preferences.LAUNCH_ROD_LENGTH, 1); - private boolean launchIntoWind = preferences.getBoolean(Preferences.LAUNCH_INTO_WIND, true); - private double launchRodAngle = preferences.getDouble(Preferences.LAUNCH_ROD_ANGLE, 0); - private double windDirection = preferences.getDouble(Preferences.WIND_DIRECTION, Math.PI / 2); - private double launchRodDirection = preferences.getDouble(Preferences.LAUNCH_ROD_DIRECTION, Math.PI / 2); + 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 windAverage = preferences.getDouble(Preferences.WIND_AVERAGE, 2.0); - private double windTurbulence = preferences.getDouble(Preferences.WIND_TURBULENCE, 0.1); + private double windAverage = preferences.getDouble(ORPreferences.WIND_AVERAGE, 2.0); + private double windTurbulence = preferences.getDouble(ORPreferences.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 c3a9993ce..49f71ea5b 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 @@ -12,7 +12,7 @@ import javax.script.ScriptEngineFactory; import info.openrocket.core.scripting.ScriptEngineManagerRedux; import info.openrocket.core.scripting.GraalJSScriptEngineFactory; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.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 - Preferences prefs; + ORPreferences 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 a4b35d18f..d2109c8fc 100644 --- a/core/src/main/java/info/openrocket/core/startup/Application.java +++ b/core/src/main/java/info/openrocket/core/startup/Application.java @@ -58,8 +58,8 @@ public final class Application { /** * @return the preferences */ - public static Preferences getPreferences() { - return injector.getInstance(Preferences.class); + public static ORPreferences getPreferences() { + return injector.getInstance(ORPreferences.class); } diff --git a/core/src/main/java/info/openrocket/core/startup/Preferences.java b/core/src/main/java/info/openrocket/core/startup/ORPreferences.java similarity index 98% rename from core/src/main/java/info/openrocket/core/startup/Preferences.java rename to core/src/main/java/info/openrocket/core/startup/ORPreferences.java index 2ea6dc0e1..3e5264b4d 100644 --- a/core/src/main/java/info/openrocket/core/startup/Preferences.java +++ b/core/src/main/java/info/openrocket/core/startup/ORPreferences.java @@ -34,7 +34,7 @@ import info.openrocket.core.util.MathUtil; import info.openrocket.core.util.StateChangeListener; import info.openrocket.core.util.UniqueID; -public abstract class Preferences implements ChangeSource { +public abstract class ORPreferences implements ChangeSource { private static final String SPLIT_CHARACTER = "|"; /* @@ -319,28 +319,28 @@ public abstract class Preferences implements ChangeSource { } public final double getDefaultMach() { - return Application.getPreferences().getChoice(Preferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); + return Application.getPreferences().getChoice(ORPreferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); } public final void setDefaultMach(double dfn) { - double oldDFN = Application.getPreferences().getChoice(Preferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); + double oldDFN = Application.getPreferences().getChoice(ORPreferences.DEFAULT_MACH_NUMBER, 0.9, 0.3); if (MathUtil.equals(oldDFN, dfn)) return; - this.putDouble(Preferences.DEFAULT_MACH_NUMBER, dfn); + this.putDouble(ORPreferences.DEFAULT_MACH_NUMBER, dfn); fireChangeEvent(); } public final double getWindTurbulenceIntensity() { - return Application.getPreferences().getChoice(Preferences.WIND_TURBULENCE, 0.9, 0.1); + return Application.getPreferences().getChoice(ORPreferences.WIND_TURBULENCE, 0.9, 0.1); } public final void setWindTurbulenceIntensity(double wti) { - double oldWTI = Application.getPreferences().getChoice(Preferences.WIND_TURBULENCE, 0.9, 0.3); + double oldWTI = Application.getPreferences().getChoice(ORPreferences.WIND_TURBULENCE, 0.9, 0.3); if (MathUtil.equals(oldWTI, wti)) return; - this.putDouble(Preferences.WIND_TURBULENCE, wti); + this.putDouble(ORPreferences.WIND_TURBULENCE, wti); fireChangeEvent(); } @@ -570,7 +570,7 @@ public abstract class Preferences implements ChangeSource { } public double getTimeStep() { - return this.getDouble(Preferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP); + return this.getDouble(ORPreferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP); } public void setTimeStep(double timeStep) { @@ -737,7 +737,7 @@ public abstract class Preferences implements ChangeSource { * @return true to display designation, false to display common name */ public boolean getMotorNameColumn() { - return getBoolean(info.openrocket.core.startup.Preferences.MOTOR_NAME_COLUMN, true); + return getBoolean(ORPreferences.MOTOR_NAME_COLUMN, true); } /** @@ -745,7 +745,7 @@ public abstract class Preferences implements ChangeSource { * @param value if true, display designation, if false, display common name */ public void setMotorNameColumn(boolean value) { - putBoolean(info.openrocket.core.startup.Preferences.MOTOR_NAME_COLUMN, value); + putBoolean(ORPreferences.MOTOR_NAME_COLUMN, value); } /** diff --git a/core/src/test/java/info/openrocket/core/ServicesForTesting.java b/core/src/test/java/info/openrocket/core/ServicesForTesting.java index 7da7e3fa1..23cbbbb85 100644 --- a/core/src/test/java/info/openrocket/core/ServicesForTesting.java +++ b/core/src/test/java/info/openrocket/core/ServicesForTesting.java @@ -14,7 +14,7 @@ import info.openrocket.core.l10n.Translator; import info.openrocket.core.material.Material; import info.openrocket.core.preset.ComponentPreset; import info.openrocket.core.preset.ComponentPreset.Type; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.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(Preferences.class).to(PreferencesForTesting.class); + bind(ORPreferences.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 Preferences { + public static class PreferencesForTesting extends ORPreferences { 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 6731ff2c6..9192ed304 100644 --- a/core/src/test/java/info/openrocket/core/simulation/SimulationConditionsTest.java +++ b/core/src/test/java/info/openrocket/core/simulation/SimulationConditionsTest.java @@ -13,7 +13,7 @@ import info.openrocket.core.l10n.Translator; import info.openrocket.core.plugin.PluginModule; import info.openrocket.core.startup.Application; import info.openrocket.core.startup.MockPreferences; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.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(Preferences.class).to(MockPreferences.class); + bind(ORPreferences.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 736cc632a..bc6a55b85 100644 --- a/core/src/test/java/info/openrocket/core/startup/MockPreferences.java +++ b/core/src/test/java/info/openrocket/core/startup/MockPreferences.java @@ -10,7 +10,7 @@ import info.openrocket.core.preset.ComponentPreset.Type; import info.openrocket.core.util.BugException; @Singleton -public class MockPreferences extends Preferences { +public class MockPreferences extends ORPreferences { 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 34ed22a3e..b78e009e3 100644 --- a/core/src/test/resources/ServicesForTesting.java +++ b/core/src/test/resources/ServicesForTesting.java @@ -6,17 +6,15 @@ import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import java.util.prefs.BackingStoreException; -import com.google.inject.multibindings.Multibinder; import info.openrocket.core.formatting.RocketDescriptor; import info.openrocket.core.formatting.RocketDescriptorImpl; -import info.openrocket.core.formatting.RocketSubstitutor; 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.preset.ComponentPreset; import info.openrocket.core.preset.ComponentPreset.Type; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; import com.google.inject.AbstractModule; import com.google.inject.Provider; @@ -25,7 +23,7 @@ public class ServicesForTesting extends AbstractModule { @Override protected void configure() { - bind(Preferences.class).to(PreferencesForTesting.class); + bind(ORPreferences.class).to(PreferencesForTesting.class); bind(Translator.class).toProvider(TranslatorProviderForTesting.class); bind(RocketDescriptor.class).to(RocketDescriptorImpl.class); } @@ -62,7 +60,7 @@ public class ServicesForTesting extends AbstractModule { } - public static class PreferencesForTesting extends Preferences { + public static class PreferencesForTesting extends ORPreferences { 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 4efad83b0..af0c8988e 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,10 +9,10 @@ import javax.swing.JSpinner; import javax.swing.SpinnerModel; import javax.swing.SpinnerNumberModel; +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.l10n.Translator; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.util.TextUtil; /** @@ -67,7 +67,7 @@ public class CsvOptionPanel extends JPanel { fieldSeparator = new JComboBox(new String[] { ",", ";", SPACE, TAB }); fieldSeparator.setEditable(true); - fieldSeparator.setSelectedItem(Application.getPreferences().getString(Preferences.EXPORT_FIELD_SEPARATOR, ",")); + fieldSeparator.setSelectedItem(Application.getPreferences().getString(ORPreferences.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(Preferences.EXPORT_DECIMAL_PLACES, TextUtil.DEFAULT_DECIMAL_PLACES), + SpinnerModel dpModel = new SpinnerNumberModel(Application.getPreferences().getInt(ORPreferences.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(Preferences.EXPORT_EXPONENTIAL_NOTATION, true)); + exponentialNotationCheckbox.setSelected(Application.getPreferences().getBoolean(ORPreferences.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(Preferences.EXPORT_COMMENT_CHARACTER, "#")); + commentCharacter.setSelectedItem(Application.getPreferences().getString(ORPreferences.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(Preferences.EXPORT_FIELD_SEPARATOR, getFieldSeparator()); - Application.getPreferences().putInt(Preferences.EXPORT_DECIMAL_PLACES, getDecimalPlaces()); - Application.getPreferences().putBoolean(Preferences.EXPORT_EXPONENTIAL_NOTATION, isExponentialNotation()); - Application.getPreferences().putString(Preferences.EXPORT_COMMENT_CHARACTER, getCommentCharacter()); + 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()); 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 bbf3b5cc3..f01c4c172 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,9 +1,9 @@ package info.openrocket.swing.gui.components; +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.l10n.Translator; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import javax.swing.BorderFactory; import javax.swing.JCheckBox; @@ -16,7 +16,7 @@ import java.awt.event.ItemListener; */ public class PreferencesOptionPanel extends JPanel { private static final Translator trans = Application.getTranslator(); - private static final Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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 da2d840aa..6c0f4672a 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 @@ -5,7 +5,7 @@ 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.startup.Preferences; +import info.openrocket.core.startup.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 Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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 67a3e15f9..8f590c6f7 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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 Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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 b63e969bf..930dfd067 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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 Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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 2975bb36e..581deb9bf 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 @@ -30,7 +30,6 @@ import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.SwingUtilities; -import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; @@ -61,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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.core.unit.UnitGroup; import info.openrocket.core.util.Invalidatable; @@ -69,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 Preferences preferences = Application.getPreferences(); + private static final ORPreferences 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 bf9b6bca0..f154da0f5 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,12 +1,12 @@ package info.openrocket.swing.gui.configdialog; +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.document.OpenRocketDocument; import info.openrocket.core.l10n.Translator; import info.openrocket.core.rocketcomponent.RocketComponent; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.swing.gui.components.StyledLabel; import info.openrocket.swing.gui.widgets.SelectColorButton; @@ -25,7 +25,7 @@ import java.awt.event.ActionListener; */ public class SaveDesignInfoPanel extends RocketConfig { private static final Translator trans = Application.getTranslator(); - private static final Preferences preferences = Application.getPreferences(); + private static final ORPreferences 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 b9cb668de..0b8f04ca9 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,6 +44,7 @@ import javax.swing.event.RowSorterListener; import javax.swing.table.TableModel; import javax.swing.table.TableRowSorter; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.swing.gui.plot.Util; import info.openrocket.swing.gui.theme.UITheme; import org.jfree.chart.ChartColor; @@ -217,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(info.openrocket.core.startup.Preferences.MOTOR_HIDE_SIMILAR, true)); + hideSimilarBox.setSelected(Application.getPreferences().getBoolean(ORPreferences.MOTOR_HIDE_SIMILAR, true)); hideSimilarBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - Application.getPreferences().putBoolean(info.openrocket.core.startup.Preferences.MOTOR_HIDE_SIMILAR, hideSimilarBox.isSelected()); + Application.getPreferences().putBoolean(ORPreferences.MOTOR_HIDE_SIMILAR, hideSimilarBox.isSelected()); updateData(); } }); @@ -232,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(info.openrocket.core.startup.Preferences.MOTOR_HIDE_UNAVAILABLE, true)); + hideUnavailableBox.setSelected(Application.getPreferences().getBoolean(ORPreferences.MOTOR_HIDE_UNAVAILABLE, true)); hideUnavailableBox.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - Application.getPreferences().putBoolean(info.openrocket.core.startup.Preferences.MOTOR_HIDE_UNAVAILABLE, hideUnavailableBox.isSelected()); + Application.getPreferences().putBoolean(ORPreferences.MOTOR_HIDE_UNAVAILABLE, hideUnavailableBox.isSelected()); motorFilterPanel.setHideUnavailable(hideUnavailableBox.isSelected()); } }); @@ -485,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(info.openrocket.core.startup.Preferences.PREFERRED_THRUST_CURVE_MOTOR_NODE); + Preferences prefs = ((SwingPreferences) Application.getPreferences()).getNode(ORPreferences.PREFERRED_THRUST_CURVE_MOTOR_NODE); for (ThrustCurveMotor m : set.getMotors()) { String digest = m.getDigest(); prefs.putBoolean(digest, m == motor); @@ -656,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(info.openrocket.core.startup.Preferences.PREFERRED_THRUST_CURVE_MOTOR_NODE); + Preferences prefs = ((SwingPreferences) Application.getPreferences()).getNode(ORPreferences.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 4f4d0eea8..475f20487 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,11 +10,11 @@ import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JSpinner; +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.swing.gui.SpinnerEditor; import info.openrocket.swing.gui.adaptors.DoubleModel; import info.openrocket.swing.gui.main.BasicFrame; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.unit.UnitGroup; public class DesignPreferencesPanel extends PreferencesPanel { @@ -27,7 +27,7 @@ public class DesignPreferencesPanel extends PreferencesPanel { "gapright para"); this.add( new JComboBox(new PrefChoiceSelector( - Preferences.BODY_COMPONENT_INSERT_POSITION_KEY, + ORPreferences.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( - Preferences.STAGE_INSERT_POSITION_KEY, + ORPreferences.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( - Preferences.ROCKET_INFO_FONT_SIZE, + ORPreferences.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 ca70f0ba3..956b42518 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,8 +6,8 @@ package info.openrocket.swing.gui.dialogs.preferences; import javax.swing.JComboBox; import javax.swing.JLabel; +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; -import info.openrocket.core.startup.Preferences; /** * @author cpearls @@ -23,7 +23,7 @@ public class DisplayPreferencesPanel extends PreferencesPanel { this.add( new JComboBox(new PrefChoiceSelector( - Preferences.ROCKET_INFO_FONT_SIZE, + ORPreferences.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 59123d8e9..1b05fded4 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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(Preferences.USER_LOCAL, l == null ? null : l.toString()); + preferences.putString(ORPreferences.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 67d6d482c..1642c4e6a 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,12 +22,12 @@ import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.arch.SystemInfo; import info.openrocket.core.arch.SystemInfo.Platform; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.swing.gui.adaptors.BooleanModel; import info.openrocket.swing.gui.components.StyledLabel; @@ -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(Preferences.OPENGL_ENABLED, true)); + BooleanModel enableGLModel = new BooleanModel(preferences.getBoolean(ORPreferences.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(Preferences.OPENGL_ENABLED, enableGL.isSelected()); + preferences.putBoolean(ORPreferences.OPENGL_ENABLED, enableGL.isSelected()); } }); add(enableGL, "wrap"); final JCheckBox enableAA = new JCheckBox(trans.get("pref.dlg.opengl.but.enableAA")); - enableAA.setSelected(preferences.getBoolean(Preferences.OPENGL_ENABLE_AA, true)); + enableAA.setSelected(preferences.getBoolean(ORPreferences.OPENGL_ENABLE_AA, true)); enableAA.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - preferences.putBoolean(Preferences.OPENGL_ENABLE_AA, enableAA.isSelected()); + preferences.putBoolean(ORPreferences.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(Preferences.OPENGL_USE_FBO, false)); + useFBO.setSelected(preferences.getBoolean(ORPreferences.OPENGL_USE_FBO, false)); useFBO.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { - preferences.putBoolean(Preferences.OPENGL_USE_FBO, useFBO.isSelected()); + preferences.putBoolean(ORPreferences.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 296cc3149..ce3a3dc96 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,6 +34,7 @@ import javax.swing.JPopupMenu; import javax.swing.SwingUtilities; import javax.swing.event.MouseInputAdapter; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.swing.gui.util.GUIUtil; import info.openrocket.swing.gui.theme.UITheme; import org.slf4j.Logger; @@ -46,7 +47,6 @@ import info.openrocket.core.rocketcomponent.FlightConfiguration; import info.openrocket.core.rocketcomponent.Rocket; import info.openrocket.core.rocketcomponent.RocketComponent; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.util.Coordinate; import info.openrocket.core.util.MathUtil; import info.openrocket.core.util.BoundingBox; @@ -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(Preferences.OPENGL_ENABLED, true); + return Application.getPreferences().getBoolean(ORPreferences.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(Preferences.OPENGL_ENABLE_AA, true)) { + if (Application.getPreferences().getBoolean(ORPreferences.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(Preferences.OPENGL_USE_FBO, false)) { + if (Application.getPreferences().getBoolean(ORPreferences.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 d996c5125..f1a4e64dd 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 @@ -27,7 +27,7 @@ import com.jogamp.opengl.awt.GLJPanel; import com.jogamp.opengl.fixedfunc.GLLightingFunc; import com.jogamp.opengl.fixedfunc.GLMatrixFunc; import com.jogamp.opengl.glu.GLU; -import com.jogamp.common.type.WriteCloneable; + import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JPopupMenu; @@ -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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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( - Preferences.OPENGL_ENABLE_AA, true)) { + ORPreferences.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( - Preferences.OPENGL_USE_FBO, false)) { + ORPreferences.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( - Preferences.OPENGL_USE_FBO, false) && p.getSkyColorOpacity() < 100) { + ORPreferences.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( - Preferences.OPENGL_USE_FBO, false)) { + ORPreferences.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 686277cee..e6dc4b8c9 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 @@ -48,12 +48,12 @@ import javax.swing.filechooser.FileFilter; import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; + +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions; import info.openrocket.core.file.wavefrontobj.export.OBJExporterFactory; -import info.openrocket.core.file.wavefrontobj.CoordTransform; -import info.openrocket.core.file.wavefrontobj.DefaultCoordTransform; import info.openrocket.core.logging.ErrorSet; import info.openrocket.core.logging.WarningSet; import info.openrocket.core.appearance.DecalImage; @@ -74,7 +74,6 @@ import info.openrocket.core.rocketcomponent.ComponentChangeListener; import info.openrocket.core.rocketcomponent.Rocket; import info.openrocket.core.rocketcomponent.RocketComponent; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.util.BugException; import info.openrocket.core.util.DecalNotFoundException; import info.openrocket.core.util.MemoryManagement; @@ -127,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 Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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 6a8a5b3bc..62798d2e1 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 @@ -4,7 +4,6 @@ package info.openrocket.swing.gui.main; import java.awt.Component; import java.awt.Dimension; import java.awt.Rectangle; -import java.awt.Font; import java.awt.event.ActionEvent; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; @@ -26,6 +25,7 @@ import javax.swing.event.TreeSelectionListener; import javax.swing.tree.TreePath; import javax.swing.tree.TreeSelectionModel; +import info.openrocket.core.startup.ORPreferences; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -57,7 +57,6 @@ import info.openrocket.core.rocketcomponent.TrapezoidFinSet; import info.openrocket.core.rocketcomponent.TubeCoupler; import info.openrocket.core.rocketcomponent.TubeFinSet; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.util.BugException; import info.openrocket.core.util.Pair; import info.openrocket.core.util.Reflection; @@ -552,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(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY, 2, 0); + int pos = Application.getPreferences().getChoice(ORPreferences.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 @@ -624,7 +623,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { if (check.isSelected()) { // Save the preference - Application.getPreferences().putInt(Preferences.BODY_COMPONENT_INSERT_POSITION_KEY, sel); + Application.getPreferences().putInt(ORPreferences.BODY_COMPONENT_INSERT_POSITION_KEY, sel); } return sel; } @@ -676,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(Preferences.STAGE_INSERT_POSITION_KEY, 2, 0); + int pos = Application.getPreferences().getChoice(ORPreferences.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 @@ -748,7 +747,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable { if (check.isSelected()) { // Save the preference - Application.getPreferences().putInt(Preferences.STAGE_INSERT_POSITION_KEY, sel); + Application.getPreferences().putInt(ORPreferences.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 6603be594..b92c121dc 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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 Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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 7fb7af1b2..5b21767c5 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.startup.Application; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.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() { - Preferences prefs = getPreferences(); + ORPreferences 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() { - Preferences prefs = getPreferences(); + ORPreferences prefs = getPreferences(); // clear the backing store clear(); @@ -142,7 +142,7 @@ public class MRUDesignFile { */ protected void retrieve() { mruFileList.clear(); - Preferences prefs = getPreferences(); + ORPreferences 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 Preferences + * Return the ORPreferences * - * @return Preferences + * @return ORPreferences */ - protected final Preferences getPreferences() { + protected final ORPreferences 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 6686b1eb6..4c4f77185 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 @@ -63,7 +63,7 @@ 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.startup.Preferences; +import info.openrocket.core.startup.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( ((Preferences) Application.getPreferences()).getAutoRunSimulations()){ + if( ((ORPreferences) 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 53b7f3336..b51b8b07d 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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(Preferences.MARKER_STYLE_ICON, false)) { + if (config.getDomainAxisType() == FlightDataType.TYPE_TIME && !preferences.getBoolean(ORPreferences.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 4ab5821d1..ca27a4e41 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 @@ -22,7 +22,7 @@ import info.openrocket.core.document.Simulation; import info.openrocket.core.l10n.Translator; import info.openrocket.core.simulation.FlightDataType; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.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(Preferences.PLOT_SHOW_POINTS, false); + final boolean initialShowPoints = Application.getPreferences().getBoolean(ORPreferences.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(Preferences.PLOT_SHOW_POINTS, show); + Application.getPreferences().putBoolean(ORPreferences.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 02c8257de..105c45ba2 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,5 +1,6 @@ package info.openrocket.swing.gui.simulation; +import info.openrocket.core.startup.ORPreferences; import net.miginfocom.swing.MigLayout; import info.openrocket.core.document.OpenRocketDocument; import info.openrocket.core.document.Simulation; @@ -15,7 +16,6 @@ import info.openrocket.core.rocketcomponent.FlightConfigurationId; import info.openrocket.core.rocketcomponent.Rocket; import info.openrocket.core.simulation.extension.SimulationExtension; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.util.StateChangeListener; import javax.swing.JButton; @@ -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 Preferences preferences = Application.getPreferences(); + private static final ORPreferences 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 afb372731..d79467a1c 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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) { - Preferences preferences = Application.getPreferences(); + ORPreferences preferences = Application.getPreferences(); conditions.setTimeStep(preferences.getDouble( - Preferences.SIMULATION_TIME_STEP, + ORPreferences.SIMULATION_TIME_STEP, RK4SimulationStepper.RECOMMENDED_TIME_STEP)); conditions.setGeodeticComputation(preferences.getEnum( - Preferences.GEODETIC_COMPUTATION, + ORPreferences.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 de74183af..7a1a82605 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 @@ -20,7 +20,6 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTable; -import javax.swing.border.Border; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; @@ -32,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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.core.unit.Unit; import info.openrocket.core.util.Utils; @@ -284,7 +283,7 @@ public class SimulationPlotPanel extends JPanel { bg.add(radioVerticalMarker); bg.add(radioIcon); - boolean useIcon = preferences.getBoolean(Preferences.MARKER_STYLE_ICON, false); + boolean useIcon = preferences.getBoolean(ORPreferences.MARKER_STYLE_ICON, false); if (useIcon) { radioIcon.setSelected(true); } else { @@ -296,7 +295,7 @@ public class SimulationPlotPanel extends JPanel { public void itemStateChanged(ItemEvent e) { if (modifying > 0) return; - preferences.putBoolean(Preferences.MARKER_STYLE_ICON, radioIcon.isSelected()); + preferences.putBoolean(ORPreferences.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 1aed78a99..58a2d0f91 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 @@ -18,7 +18,6 @@ import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; -import java.util.Enumeration; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -45,13 +44,11 @@ import javax.swing.JTable; import javax.swing.JTree; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; -import javax.swing.LookAndFeel; import javax.swing.RootPaneContainer; import javax.swing.SpinnerModel; import javax.swing.SpinnerNumberModel; import javax.swing.SwingUtilities; import javax.swing.Timer; -import javax.swing.UIManager; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeListener; import javax.swing.table.AbstractTableModel; @@ -67,13 +64,11 @@ import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreeModel; import javax.swing.tree.TreeSelectionModel; -import com.formdev.flatlaf.FlatLightLaf; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.swing.gui.Resettable; -import info.openrocket.core.arch.SystemInfo; import info.openrocket.core.logging.Markers; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; import info.openrocket.core.util.BugException; import info.openrocket.core.util.Invalidatable; import info.openrocket.core.util.MemoryManagement; @@ -285,7 +280,7 @@ public class GUIUtil { * @return the current theme */ public static UITheme.Theme getUITheme() { - Preferences prefs = Application.getPreferences(); + ORPreferences 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 67f3a3df4..5a9d993f6 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 @@ -4,6 +4,7 @@ import info.openrocket.core.arch.SystemInfo; import info.openrocket.core.l10n.Translator; import info.openrocket.core.startup.Application; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.swing.gui.components.PreferencesOptionPanel; import info.openrocket.swing.gui.main.MRUDesignFile; import info.openrocket.swing.gui.theme.UITheme; @@ -40,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 info.openrocket.core.startup.Preferences prefs = Application.getPreferences(); + private static final ORPreferences 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<>(); // Preferences nodes that should not be exported + private static final List nodesToIgnore = new ArrayList<>(); // ORPreferences nodes that should not be exported public static boolean exportPreferences(Window parent, Preferences preferences) { JFileChooser chooser = new SaveFileChooser(); @@ -96,7 +97,7 @@ public abstract class PreferencesExporter { // Export all preferences except user directories exportFilteredPreferences(preferences, fos); } - log.info("Preferences exported successfully."); + log.info("ORPreferences exported successfully."); } catch (IOException | BackingStoreException e) { log.warn("Error while importing preferences: " + e.getMessage()); } @@ -110,8 +111,8 @@ public abstract class PreferencesExporter { nodesToIgnore.clear(); if (ignoreUserDirectories) { - keysToIgnore.add(info.openrocket.core.startup.Preferences.USER_THRUST_CURVES_KEY); - keysToIgnore.add(info.openrocket.core.startup.Preferences.DEFAULT_DIRECTORY); + keysToIgnore.add(ORPreferences.USER_THRUST_CURVES_KEY); + keysToIgnore.add(ORPreferences.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 c769ff919..c0f93a441 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 @@ -22,6 +22,7 @@ import java.util.prefs.Preferences; import info.openrocket.core.database.Databases; import info.openrocket.core.rocketcomponent.NoseCone; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.swing.gui.theme.UITheme; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +57,7 @@ import info.openrocket.core.util.BuildProperties; import info.openrocket.swing.communication.AssetHandler.UpdatePlatform; -public class SwingPreferences extends info.openrocket.core.startup.Preferences implements SimulationOptionsInterface { +public class SwingPreferences extends ORPreferences implements SimulationOptionsInterface { private static final Logger log = LoggerFactory.getLogger(SwingPreferences.class); @@ -358,7 +359,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i } private UITheme.Theme getUIThemeAsTheme() { - String themeName = getString(info.openrocket.core.startup.Preferences.UI_THEME, UITheme.Themes.LIGHT.name()); + String themeName = getString(ORPreferences.UI_THEME, UITheme.Themes.LIGHT.name()); if (themeName == null) return UITheme.Themes.LIGHT; // Default theme try { return UITheme.Themes.valueOf(themeName); @@ -374,7 +375,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i @Override public void setUITheme(Object theme) { if (!(theme instanceof UITheme.Theme)) return; - putString(info.openrocket.core.startup.Preferences.UI_THEME, ((UITheme.Theme) theme).name()); + putString(ORPreferences.UI_THEME, ((UITheme.Theme) theme).name()); storeVersion(); } @@ -387,7 +388,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i } public final float getRocketInfoFontSize() { - return (float) ((getUIFontSize() - 2) + 3 * Application.getPreferences().getChoice(info.openrocket.core.startup.Preferences.ROCKET_INFO_FONT_SIZE, 2, 0)); + return (float) ((getUIFontSize() - 2) + 3 * Application.getPreferences().getChoice(ORPreferences.ROCKET_INFO_FONT_SIZE, 2, 0)); } private static int getDefaultFontSize() { @@ -429,7 +430,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i } public File getDefaultDirectory() { - String file = getString(info.openrocket.core.startup.Preferences.DEFAULT_DIRECTORY, null); + String file = getString(ORPreferences.DEFAULT_DIRECTORY, null); if (file == null) return null; return new File(file); @@ -442,7 +443,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i } else { d = dir.getAbsolutePath(); } - putString(info.openrocket.core.startup.Preferences.DEFAULT_DIRECTORY, d); + putString(ORPreferences.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 9719ed720..f8f5e5891 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.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; 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(Preferences.class).to(SwingPreferences.class).in(Scopes.SINGLETON); + bind(ORPreferences.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 a30a33cd3..19a3f1c05 100644 --- a/swing/src/main/java/info/openrocket/swing/startup/SwingStartup.java +++ b/swing/src/main/java/info/openrocket/swing/startup/SwingStartup.java @@ -15,7 +15,7 @@ import javax.swing.Timer; import javax.swing.ToolTipManager; import info.openrocket.core.startup.Application; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.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); - Preferences prefs = Application.getPreferences(); + ORPreferences 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 513897485..172bbe914 100644 --- a/swing/src/main/java/info/openrocket/swing/utils/CoreServicesModule.java +++ b/swing/src/main/java/info/openrocket/swing/utils/CoreServicesModule.java @@ -2,9 +2,9 @@ package info.openrocket.swing.utils; import info.openrocket.core.formatting.RocketDescriptor; import info.openrocket.core.formatting.RocketDescriptorImpl; +import info.openrocket.core.startup.ORPreferences; import info.openrocket.swing.gui.util.SwingPreferences; import info.openrocket.core.l10n.Translator; -import info.openrocket.core.startup.Preferences; import info.openrocket.swing.startup.providers.TranslatorProvider; import com.google.inject.AbstractModule; @@ -13,7 +13,7 @@ public class CoreServicesModule extends AbstractModule { @Override protected void configure() { - bind(Preferences.class).to(SwingPreferences.class); + bind(ORPreferences.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 63f541b6b..0e3566753 100644 --- a/swing/src/test/java/info/openrocket/swing/ServicesForTesting.java +++ b/swing/src/test/java/info/openrocket/swing/ServicesForTesting.java @@ -10,7 +10,7 @@ import info.openrocket.core.l10n.Translator; import info.openrocket.core.material.Material; import info.openrocket.core.preset.ComponentPreset; import info.openrocket.core.preset.ComponentPreset.Type; -import info.openrocket.core.startup.Preferences; +import info.openrocket.core.startup.ORPreferences; import java.util.Collections; import java.util.Locale; @@ -22,7 +22,7 @@ public class ServicesForTesting extends AbstractModule { @Override protected void configure() { - bind(Preferences.class).to(PreferencesForTesting.class); + bind(ORPreferences.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 Preferences { + public static class PreferencesForTesting extends ORPreferences { private static java.util.prefs.Preferences root = null;