Rename Preferences to ORReferences
To not cause confusion with java.util.prefs
This commit is contained in:
parent
4411cb1b35
commit
464d42fb81
@ -5,7 +5,7 @@ import java.util.*;
|
|||||||
|
|
||||||
import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions;
|
import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions;
|
||||||
import info.openrocket.core.rocketcomponent.*;
|
import info.openrocket.core.rocketcomponent.*;
|
||||||
import info.openrocket.core.startup.Preferences;
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import info.openrocket.core.util.StateChangeListener;
|
import info.openrocket.core.util.StateChangeListener;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -37,7 +37,7 @@ import info.openrocket.core.util.ArrayList;
|
|||||||
*/
|
*/
|
||||||
public class OpenRocketDocument implements ComponentChangeListener, StateChangeListener {
|
public class OpenRocketDocument implements ComponentChangeListener, StateChangeListener {
|
||||||
private static final Logger log = LoggerFactory.getLogger(OpenRocketDocument.class);
|
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<String> file_extensions = Arrays.asList("ork", "ork.gz", "rkt", "rkt.gz"); // Possible extensions of an OpenRocket document
|
private final List<String> 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.
|
* The minimum number of undo levels that are stored.
|
||||||
|
@ -8,7 +8,7 @@ import info.openrocket.core.logging.ErrorSet;
|
|||||||
import info.openrocket.core.logging.WarningSet;
|
import info.openrocket.core.logging.WarningSet;
|
||||||
import info.openrocket.core.simulation.SimulationOptions;
|
import info.openrocket.core.simulation.SimulationOptions;
|
||||||
import info.openrocket.core.startup.Application;
|
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.XmlAccessType;
|
||||||
import jakarta.xml.bind.annotation.XmlAccessorType;
|
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
|
// 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);
|
setAltitude(prefs.getLaunchAltitude() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_ALTITUDE);
|
||||||
setPressure(prefs.getLaunchPressure() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_PRESSURE);
|
setPressure(prefs.getLaunchPressure() * RASAeroCommonConstants.OPENROCKET_TO_RASAERO_PRESSURE);
|
||||||
setTemperature(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_TEMPERATURE(prefs.getLaunchTemperature()));
|
setTemperature(RASAeroCommonConstants.OPENROCKET_TO_RASAERO_TEMPERATURE(prefs.getLaunchTemperature()));
|
||||||
|
@ -6,7 +6,7 @@ import info.openrocket.core.file.wavefrontobj.ObjUtils;
|
|||||||
import info.openrocket.core.rocketcomponent.Rocket;
|
import info.openrocket.core.rocketcomponent.Rocket;
|
||||||
|
|
||||||
public class OBJExportOptions {
|
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
|
* If true, export all children of the components as well
|
||||||
|
@ -17,7 +17,7 @@ import info.openrocket.core.aerodynamics.FlightConditions;
|
|||||||
import info.openrocket.core.logging.WarningSet;
|
import info.openrocket.core.logging.WarningSet;
|
||||||
import info.openrocket.core.rocketcomponent.position.AnglePositionable;
|
import info.openrocket.core.rocketcomponent.position.AnglePositionable;
|
||||||
import info.openrocket.core.startup.Application;
|
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 info.openrocket.core.util.ORColor;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -770,7 +770,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
|||||||
public final double getOverrideCD() {
|
public final double getOverrideCD() {
|
||||||
mutex.verify();
|
mutex.verify();
|
||||||
if (!isCDOverridden()) {
|
if (!isCDOverridden()) {
|
||||||
Preferences preferences = Application.getPreferences();
|
ORPreferences preferences = Application.getPreferences();
|
||||||
overrideCD = getComponentCD(0, 0, preferences.getDefaultMach(), 0);
|
overrideCD = getComponentCD(0, 0, preferences.getDefaultMach(), 0);
|
||||||
}
|
}
|
||||||
return overrideCD;
|
return overrideCD;
|
||||||
@ -840,7 +840,7 @@ public abstract class RocketComponent implements ChangeSource, Cloneable, Iterab
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cdOverridden) {
|
if (!cdOverridden) {
|
||||||
Preferences preferences = Application.getPreferences();
|
ORPreferences preferences = Application.getPreferences();
|
||||||
overrideCD = getComponentCD(0, 0, preferences.getDefaultMach(), 0);
|
overrideCD = getComponentCD(0, 0, preferences.getDefaultMach(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package info.openrocket.core.simulation;
|
package info.openrocket.core.simulation;
|
||||||
|
|
||||||
import info.openrocket.core.startup.Preferences;
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
public class DefaultSimulationOptionFactory {
|
public class DefaultSimulationOptionFactory {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private final Preferences prefs;
|
private final ORPreferences prefs;
|
||||||
|
|
||||||
public static final String SIMCONDITION_WIND_SPEED = "SimConditionWindSpeed";
|
public static final String SIMCONDITION_WIND_SPEED = "SimConditionWindSpeed";
|
||||||
public static final String SIMCONDITION_WIND_STDDEV = "SimConditionWindStdDev";
|
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_ANGLE = "SimConditionsRodAngle";
|
||||||
public static final String SIMCONDITION_ROD_DIRECTION = "SimConditionsRodDirection";
|
public static final String SIMCONDITION_ROD_DIRECTION = "SimConditionsRodDirection";
|
||||||
|
|
||||||
public DefaultSimulationOptionFactory(Preferences prefs) {
|
public DefaultSimulationOptionFactory(ORPreferences prefs) {
|
||||||
this.prefs = prefs;
|
this.prefs = prefs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ import java.util.EventObject;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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.gravity.WGSGravityModel;
|
||||||
import info.openrocket.core.models.wind.PinkNoiseWindModel;
|
import info.openrocket.core.models.wind.PinkNoiseWindModel;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.util.BugException;
|
import info.openrocket.core.util.BugException;
|
||||||
import info.openrocket.core.util.ChangeSource;
|
import info.openrocket.core.util.ChangeSource;
|
||||||
import info.openrocket.core.util.GeodeticComputationStrategy;
|
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();
|
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
|
* NOTE: When adding/modifying parameters, they must also be added to the
|
||||||
* equals and copyFrom methods!!
|
* equals and copyFrom methods!!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private double launchRodLength = preferences.getDouble(Preferences.LAUNCH_ROD_LENGTH, 1);
|
private double launchRodLength = preferences.getDouble(ORPreferences.LAUNCH_ROD_LENGTH, 1);
|
||||||
private boolean launchIntoWind = preferences.getBoolean(Preferences.LAUNCH_INTO_WIND, true);
|
private boolean launchIntoWind = preferences.getBoolean(ORPreferences.LAUNCH_INTO_WIND, true);
|
||||||
private double launchRodAngle = preferences.getDouble(Preferences.LAUNCH_ROD_ANGLE, 0);
|
private double launchRodAngle = preferences.getDouble(ORPreferences.LAUNCH_ROD_ANGLE, 0);
|
||||||
private double windDirection = preferences.getDouble(Preferences.WIND_DIRECTION, Math.PI / 2);
|
private double windDirection = preferences.getDouble(ORPreferences.WIND_DIRECTION, Math.PI / 2);
|
||||||
private double launchRodDirection = preferences.getDouble(Preferences.LAUNCH_ROD_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 windAverage = preferences.getDouble(ORPreferences.WIND_AVERAGE, 2.0);
|
||||||
private double windTurbulence = preferences.getDouble(Preferences.WIND_TURBULENCE, 0.1);
|
private double windTurbulence = preferences.getDouble(ORPreferences.WIND_TURBULENCE, 0.1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* SimulationOptions maintains the launch site parameters as separate double values,
|
* SimulationOptions maintains the launch site parameters as separate double values,
|
||||||
|
@ -12,7 +12,7 @@ import javax.script.ScriptEngineFactory;
|
|||||||
|
|
||||||
import info.openrocket.core.scripting.ScriptEngineManagerRedux;
|
import info.openrocket.core.scripting.ScriptEngineManagerRedux;
|
||||||
import info.openrocket.core.scripting.GraalJSScriptEngineFactory;
|
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.ArrayList;
|
||||||
import info.openrocket.core.util.BugException;
|
import info.openrocket.core.util.BugException;
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ public class ScriptingUtil {
|
|||||||
private static ScriptEngineManagerRedux manager;
|
private static ScriptEngineManagerRedux manager;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
Preferences prefs;
|
ORPreferences prefs;
|
||||||
|
|
||||||
public ScriptingUtil() {
|
public ScriptingUtil() {
|
||||||
if (manager == null) {
|
if (manager == null) {
|
||||||
|
@ -58,8 +58,8 @@ public final class Application {
|
|||||||
/**
|
/**
|
||||||
* @return the preferences
|
* @return the preferences
|
||||||
*/
|
*/
|
||||||
public static Preferences getPreferences() {
|
public static ORPreferences getPreferences() {
|
||||||
return injector.getInstance(Preferences.class);
|
return injector.getInstance(ORPreferences.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ import info.openrocket.core.util.MathUtil;
|
|||||||
import info.openrocket.core.util.StateChangeListener;
|
import info.openrocket.core.util.StateChangeListener;
|
||||||
import info.openrocket.core.util.UniqueID;
|
import info.openrocket.core.util.UniqueID;
|
||||||
|
|
||||||
public abstract class Preferences implements ChangeSource {
|
public abstract class ORPreferences implements ChangeSource {
|
||||||
private static final String SPLIT_CHARACTER = "|";
|
private static final String SPLIT_CHARACTER = "|";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -319,28 +319,28 @@ public abstract class Preferences implements ChangeSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final double getDefaultMach() {
|
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) {
|
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))
|
if (MathUtil.equals(oldDFN, dfn))
|
||||||
return;
|
return;
|
||||||
this.putDouble(Preferences.DEFAULT_MACH_NUMBER, dfn);
|
this.putDouble(ORPreferences.DEFAULT_MACH_NUMBER, dfn);
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
public final double getWindTurbulenceIntensity() {
|
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) {
|
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))
|
if (MathUtil.equals(oldWTI, wti))
|
||||||
return;
|
return;
|
||||||
this.putDouble(Preferences.WIND_TURBULENCE, wti);
|
this.putDouble(ORPreferences.WIND_TURBULENCE, wti);
|
||||||
fireChangeEvent();
|
fireChangeEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ public abstract class Preferences implements ChangeSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getTimeStep() {
|
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) {
|
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
|
* @return true to display designation, false to display common name
|
||||||
*/
|
*/
|
||||||
public boolean getMotorNameColumn() {
|
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
|
* @param value if true, display designation, if false, display common name
|
||||||
*/
|
*/
|
||||||
public void setMotorNameColumn(boolean value) {
|
public void setMotorNameColumn(boolean value) {
|
||||||
putBoolean(info.openrocket.core.startup.Preferences.MOTOR_NAME_COLUMN, value);
|
putBoolean(ORPreferences.MOTOR_NAME_COLUMN, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
@ -14,7 +14,7 @@ import info.openrocket.core.l10n.Translator;
|
|||||||
import info.openrocket.core.material.Material;
|
import info.openrocket.core.material.Material;
|
||||||
import info.openrocket.core.preset.ComponentPreset;
|
import info.openrocket.core.preset.ComponentPreset;
|
||||||
import info.openrocket.core.preset.ComponentPreset.Type;
|
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.AbstractModule;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
@ -23,7 +23,7 @@ public class ServicesForTesting extends AbstractModule {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(Preferences.class).to(PreferencesForTesting.class);
|
bind(ORPreferences.class).to(PreferencesForTesting.class);
|
||||||
bind(Translator.class).toProvider(TranslatorProviderForTesting.class);
|
bind(Translator.class).toProvider(TranslatorProviderForTesting.class);
|
||||||
bind(RocketDescriptor.class).to(RocketDescriptorImpl.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;
|
private static java.util.prefs.Preferences root = null;
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import info.openrocket.core.l10n.Translator;
|
|||||||
import info.openrocket.core.plugin.PluginModule;
|
import info.openrocket.core.plugin.PluginModule;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.MockPreferences;
|
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 info.openrocket.core.util.MathUtil;
|
||||||
import org.junit.jupiter.api.BeforeAll;
|
import org.junit.jupiter.api.BeforeAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
@ -73,7 +73,7 @@ public class SimulationConditionsTest {
|
|||||||
private static class PreferencesModule extends AbstractModule {
|
private static class PreferencesModule extends AbstractModule {
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(Preferences.class).to(MockPreferences.class);
|
bind(ORPreferences.class).to(MockPreferences.class);
|
||||||
bind(Translator.class).toProvider(ServicesForTesting.TranslatorProviderForTesting.class);
|
bind(Translator.class).toProvider(ServicesForTesting.TranslatorProviderForTesting.class);
|
||||||
bind(RocketDescriptor.class).to(RocketDescriptorImpl.class);
|
bind(RocketDescriptor.class).to(RocketDescriptorImpl.class);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import info.openrocket.core.preset.ComponentPreset.Type;
|
|||||||
import info.openrocket.core.util.BugException;
|
import info.openrocket.core.util.BugException;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class MockPreferences extends Preferences {
|
public class MockPreferences extends ORPreferences {
|
||||||
|
|
||||||
private final String NODENAME = "OpenRocket-test-mock";
|
private final String NODENAME = "OpenRocket-test-mock";
|
||||||
private final java.util.prefs.Preferences NODE;
|
private final java.util.prefs.Preferences NODE;
|
||||||
|
@ -6,17 +6,15 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.prefs.BackingStoreException;
|
import java.util.prefs.BackingStoreException;
|
||||||
|
|
||||||
import com.google.inject.multibindings.Multibinder;
|
|
||||||
import info.openrocket.core.formatting.RocketDescriptor;
|
import info.openrocket.core.formatting.RocketDescriptor;
|
||||||
import info.openrocket.core.formatting.RocketDescriptorImpl;
|
import info.openrocket.core.formatting.RocketDescriptorImpl;
|
||||||
import info.openrocket.core.formatting.RocketSubstitutor;
|
|
||||||
import info.openrocket.core.l10n.DebugTranslator;
|
import info.openrocket.core.l10n.DebugTranslator;
|
||||||
import info.openrocket.core.l10n.ResourceBundleTranslator;
|
import info.openrocket.core.l10n.ResourceBundleTranslator;
|
||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.material.Material;
|
import info.openrocket.core.material.Material;
|
||||||
import info.openrocket.core.preset.ComponentPreset;
|
import info.openrocket.core.preset.ComponentPreset;
|
||||||
import info.openrocket.core.preset.ComponentPreset.Type;
|
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.AbstractModule;
|
||||||
import com.google.inject.Provider;
|
import com.google.inject.Provider;
|
||||||
@ -25,7 +23,7 @@ public class ServicesForTesting extends AbstractModule {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(Preferences.class).to(PreferencesForTesting.class);
|
bind(ORPreferences.class).to(PreferencesForTesting.class);
|
||||||
bind(Translator.class).toProvider(TranslatorProviderForTesting.class);
|
bind(Translator.class).toProvider(TranslatorProviderForTesting.class);
|
||||||
bind(RocketDescriptor.class).to(RocketDescriptorImpl.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;
|
private static java.util.prefs.Preferences root = null;
|
||||||
|
|
||||||
|
@ -9,10 +9,10 @@ import javax.swing.JSpinner;
|
|||||||
import javax.swing.SpinnerModel;
|
import javax.swing.SpinnerModel;
|
||||||
import javax.swing.SpinnerNumberModel;
|
import javax.swing.SpinnerNumberModel;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.util.TextUtil;
|
import info.openrocket.core.util.TextUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,7 +67,7 @@ public class CsvOptionPanel extends JPanel {
|
|||||||
|
|
||||||
fieldSeparator = new JComboBox<String>(new String[] { ",", ";", SPACE, TAB });
|
fieldSeparator = new JComboBox<String>(new String[] { ",", ";", SPACE, TAB });
|
||||||
fieldSeparator.setEditable(true);
|
fieldSeparator.setEditable(true);
|
||||||
fieldSeparator.setSelectedItem(Application.getPreferences().getString(Preferences.EXPORT_FIELD_SEPARATOR, ","));
|
fieldSeparator.setSelectedItem(Application.getPreferences().getString(ORPreferences.EXPORT_FIELD_SEPARATOR, ","));
|
||||||
fieldSeparator.setToolTipText(tip);
|
fieldSeparator.setToolTipText(tip);
|
||||||
panel.add(fieldSeparator, "growx, wrap");
|
panel.add(fieldSeparator, "growx, wrap");
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ public class CsvOptionPanel extends JPanel {
|
|||||||
label.setToolTipText(trans.get("SimExpPan.lbl.DecimalPlaces.ttip"));
|
label.setToolTipText(trans.get("SimExpPan.lbl.DecimalPlaces.ttip"));
|
||||||
panel.add(label, "gapright unrel");
|
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);
|
0, 15, 1);
|
||||||
decimalPlacesSpinner = new JSpinner(dpModel);
|
decimalPlacesSpinner = new JSpinner(dpModel);
|
||||||
decimalPlacesSpinner.setToolTipText(trans.get("SimExpPan.lbl.DecimalPlaces.ttip"));
|
decimalPlacesSpinner.setToolTipText(trans.get("SimExpPan.lbl.DecimalPlaces.ttip"));
|
||||||
@ -85,7 +85,7 @@ public class CsvOptionPanel extends JPanel {
|
|||||||
//// Exponential notation
|
//// Exponential notation
|
||||||
exponentialNotationCheckbox = new JCheckBox(trans.get("SimExpPan.lbl.ExponentialNotation"));
|
exponentialNotationCheckbox = new JCheckBox(trans.get("SimExpPan.lbl.ExponentialNotation"));
|
||||||
exponentialNotationCheckbox.setToolTipText(trans.get("SimExpPan.lbl.ExponentialNotation.ttip"));
|
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);
|
panel.add(exponentialNotationCheckbox);
|
||||||
|
|
||||||
this.add(panel, "growx, wrap unrel");
|
this.add(panel, "growx, wrap unrel");
|
||||||
@ -117,7 +117,7 @@ public class CsvOptionPanel extends JPanel {
|
|||||||
|
|
||||||
commentCharacter = new JComboBox<String>(new String[] { "#", "%", ";" });
|
commentCharacter = new JComboBox<String>(new String[] { "#", "%", ";" });
|
||||||
commentCharacter.setEditable(true);
|
commentCharacter.setEditable(true);
|
||||||
commentCharacter.setSelectedItem(Application.getPreferences().getString(Preferences.EXPORT_COMMENT_CHARACTER, "#"));
|
commentCharacter.setSelectedItem(Application.getPreferences().getString(ORPreferences.EXPORT_COMMENT_CHARACTER, "#"));
|
||||||
commentCharacter.setToolTipText(tip);
|
commentCharacter.setToolTipText(tip);
|
||||||
panel.add(commentCharacter, "growx");
|
panel.add(commentCharacter, "growx");
|
||||||
|
|
||||||
@ -149,10 +149,10 @@ public class CsvOptionPanel extends JPanel {
|
|||||||
* Store the selected options to the user preferences.
|
* Store the selected options to the user preferences.
|
||||||
*/
|
*/
|
||||||
public void storePreferences() {
|
public void storePreferences() {
|
||||||
Application.getPreferences().putString(Preferences.EXPORT_FIELD_SEPARATOR, getFieldSeparator());
|
Application.getPreferences().putString(ORPreferences.EXPORT_FIELD_SEPARATOR, getFieldSeparator());
|
||||||
Application.getPreferences().putInt(Preferences.EXPORT_DECIMAL_PLACES, getDecimalPlaces());
|
Application.getPreferences().putInt(ORPreferences.EXPORT_DECIMAL_PLACES, getDecimalPlaces());
|
||||||
Application.getPreferences().putBoolean(Preferences.EXPORT_EXPONENTIAL_NOTATION, isExponentialNotation());
|
Application.getPreferences().putBoolean(ORPreferences.EXPORT_EXPONENTIAL_NOTATION, isExponentialNotation());
|
||||||
Application.getPreferences().putString(Preferences.EXPORT_COMMENT_CHARACTER, getCommentCharacter());
|
Application.getPreferences().putString(ORPreferences.EXPORT_COMMENT_CHARACTER, getCommentCharacter());
|
||||||
for (int i = 0; i < options.length; i++) {
|
for (int i = 0; i < options.length; i++) {
|
||||||
Application.getPreferences().putBoolean("csvOptions." + baseClassName + "." + i, options[i].isSelected());
|
Application.getPreferences().putBoolean("csvOptions." + baseClassName + "." + i, options[i].isSelected());
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package info.openrocket.swing.gui.components;
|
package info.openrocket.swing.gui.components;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
import javax.swing.BorderFactory;
|
||||||
import javax.swing.JCheckBox;
|
import javax.swing.JCheckBox;
|
||||||
@ -16,7 +16,7 @@ import java.awt.event.ItemListener;
|
|||||||
*/
|
*/
|
||||||
public class PreferencesOptionPanel extends JPanel {
|
public class PreferencesOptionPanel extends JPanel {
|
||||||
private static final Translator trans = Application.getTranslator();
|
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 exportUserDirectories;
|
||||||
private final JCheckBox exportWindowInfo;
|
private final JCheckBox exportWindowInfo;
|
||||||
|
@ -5,7 +5,7 @@ import info.openrocket.swing.gui.SpinnerEditor;
|
|||||||
import info.openrocket.swing.gui.adaptors.DoubleModel;
|
import info.openrocket.swing.gui.adaptors.DoubleModel;
|
||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.startup.Application;
|
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.unit.UnitGroup;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
@ -15,7 +15,7 @@ import java.awt.Color;
|
|||||||
|
|
||||||
public class SVGOptionPanel extends JPanel {
|
public class SVGOptionPanel extends JPanel {
|
||||||
private static final Translator trans = Application.getTranslator();
|
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 final ColorChooserButton colorChooser;
|
||||||
private double strokeWidth = 0.1;
|
private double strokeWidth = 0.1;
|
||||||
|
@ -21,7 +21,7 @@ import javax.swing.SwingUtilities;
|
|||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
import javax.xml.transform.TransformerException;
|
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.components.SVGOptionPanel;
|
||||||
import info.openrocket.swing.gui.util.FileHelper;
|
import info.openrocket.swing.gui.util.FileHelper;
|
||||||
import info.openrocket.swing.gui.util.SwingPreferences;
|
import info.openrocket.swing.gui.util.SwingPreferences;
|
||||||
@ -62,7 +62,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
public abstract class FinSetConfig extends RocketComponentConfig {
|
public abstract class FinSetConfig extends RocketComponentConfig {
|
||||||
private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class);
|
private static final Logger log = LoggerFactory.getLogger(FinSetConfig.class);
|
||||||
private static final Translator trans = Application.getTranslator();
|
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;
|
private JButton split = null;
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ import info.openrocket.core.rocketcomponent.MotorMount;
|
|||||||
import info.openrocket.core.rocketcomponent.RingComponent;
|
import info.openrocket.core.rocketcomponent.RingComponent;
|
||||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||||
import info.openrocket.core.startup.Application;
|
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.unit.UnitGroup;
|
||||||
import info.openrocket.core.util.BugException;
|
import info.openrocket.core.util.BugException;
|
||||||
import info.openrocket.core.util.Coordinate;
|
import info.openrocket.core.util.Coordinate;
|
||||||
@ -65,7 +65,7 @@ import info.openrocket.swing.gui.widgets.SelectColorButton;
|
|||||||
public class InnerTubeConfig extends RocketComponentConfig {
|
public class InnerTubeConfig extends RocketComponentConfig {
|
||||||
private static final long serialVersionUID = 7900041420864324470L;
|
private static final long serialVersionUID = 7900041420864324470L;
|
||||||
private static final Translator trans = Application.getTranslator();
|
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";
|
private static final String PREF_SEPARATION_RELATIVE = "InnerTubeSeparationRelative";
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ import javax.swing.JTabbedPane;
|
|||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.UIManager;
|
|
||||||
import javax.swing.border.Border;
|
import javax.swing.border.Border;
|
||||||
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeEvent;
|
||||||
import javax.swing.event.ChangeListener;
|
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.*;
|
||||||
import info.openrocket.core.rocketcomponent.position.AxialMethod;
|
import info.openrocket.core.rocketcomponent.position.AxialMethod;
|
||||||
import info.openrocket.core.startup.Application;
|
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.unit.UnitGroup;
|
||||||
import info.openrocket.core.util.Invalidatable;
|
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 long serialVersionUID = -2925484062132243982L;
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
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 OpenRocketDocument document;
|
||||||
protected final RocketComponent component;
|
protected final RocketComponent component;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package info.openrocket.swing.gui.configdialog;
|
package info.openrocket.swing.gui.configdialog;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import info.openrocket.core.document.OpenRocketDocument;
|
import info.openrocket.core.document.OpenRocketDocument;
|
||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
|
|
||||||
import info.openrocket.swing.gui.components.StyledLabel;
|
import info.openrocket.swing.gui.components.StyledLabel;
|
||||||
import info.openrocket.swing.gui.widgets.SelectColorButton;
|
import info.openrocket.swing.gui.widgets.SelectColorButton;
|
||||||
@ -25,7 +25,7 @@ import java.awt.event.ActionListener;
|
|||||||
*/
|
*/
|
||||||
public class SaveDesignInfoPanel extends RocketConfig {
|
public class SaveDesignInfoPanel extends RocketConfig {
|
||||||
private static final Translator trans = Application.getTranslator();
|
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) {
|
public SaveDesignInfoPanel(OpenRocketDocument d, RocketComponent c, JDialog parent) {
|
||||||
super(d, c, parent);
|
super(d, c, parent);
|
||||||
|
@ -44,6 +44,7 @@ import javax.swing.event.RowSorterListener;
|
|||||||
import javax.swing.table.TableModel;
|
import javax.swing.table.TableModel;
|
||||||
import javax.swing.table.TableRowSorter;
|
import javax.swing.table.TableRowSorter;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import info.openrocket.swing.gui.plot.Util;
|
import info.openrocket.swing.gui.plot.Util;
|
||||||
import info.openrocket.swing.gui.theme.UITheme;
|
import info.openrocket.swing.gui.theme.UITheme;
|
||||||
import org.jfree.chart.ChartColor;
|
import org.jfree.chart.ChartColor;
|
||||||
@ -217,11 +218,11 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
|
|||||||
{
|
{
|
||||||
hideSimilarBox = new JCheckBox(trans.get("TCMotorSelPan.checkbox.hideSimilar"));
|
hideSimilarBox = new JCheckBox(trans.get("TCMotorSelPan.checkbox.hideSimilar"));
|
||||||
GUIUtil.changeFontSize(hideSimilarBox, -1);
|
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() {
|
hideSimilarBox.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
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();
|
updateData();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -232,11 +233,11 @@ public class ThrustCurveMotorSelectionPanel extends JPanel implements MotorSelec
|
|||||||
{
|
{
|
||||||
hideUnavailableBox = new JCheckBox(trans.get("TCMotorSelPan.checkbox.hideUnavailable"));
|
hideUnavailableBox = new JCheckBox(trans.get("TCMotorSelPan.checkbox.hideUnavailable"));
|
||||||
GUIUtil.changeFontSize(hideUnavailableBox, -1);
|
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() {
|
hideUnavailableBox.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
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());
|
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
|
// 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()) {
|
for (ThrustCurveMotor m : set.getMotors()) {
|
||||||
String digest = m.getDigest();
|
String digest = m.getDigest();
|
||||||
prefs.putBoolean(digest, m == motor);
|
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
|
// Find which motor has been used the most recently
|
||||||
List<ThrustCurveMotor> list = set.getMotors();
|
List<ThrustCurveMotor> 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) {
|
for (ThrustCurveMotor m : list) {
|
||||||
String digest = m.getDigest();
|
String digest = m.getDigest();
|
||||||
if (prefs.getBoolean(digest, false)) {
|
if (prefs.getBoolean(digest, false)) {
|
||||||
|
@ -10,11 +10,11 @@ import javax.swing.JComboBox;
|
|||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JSpinner;
|
import javax.swing.JSpinner;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import info.openrocket.swing.gui.SpinnerEditor;
|
import info.openrocket.swing.gui.SpinnerEditor;
|
||||||
import info.openrocket.swing.gui.adaptors.DoubleModel;
|
import info.openrocket.swing.gui.adaptors.DoubleModel;
|
||||||
import info.openrocket.swing.gui.main.BasicFrame;
|
import info.openrocket.swing.gui.main.BasicFrame;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.unit.UnitGroup;
|
import info.openrocket.core.unit.UnitGroup;
|
||||||
|
|
||||||
public class DesignPreferencesPanel extends PreferencesPanel {
|
public class DesignPreferencesPanel extends PreferencesPanel {
|
||||||
@ -27,7 +27,7 @@ public class DesignPreferencesPanel extends PreferencesPanel {
|
|||||||
"gapright para");
|
"gapright para");
|
||||||
this.add(
|
this.add(
|
||||||
new JComboBox<Object>(new PrefChoiceSelector(
|
new JComboBox<Object>(new PrefChoiceSelector(
|
||||||
Preferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
ORPreferences.BODY_COMPONENT_INSERT_POSITION_KEY,
|
||||||
// // Always ask
|
// // Always ask
|
||||||
// // Insert in middle
|
// // Insert in middle
|
||||||
// // Add to end
|
// // Add to end
|
||||||
@ -41,7 +41,7 @@ public class DesignPreferencesPanel extends PreferencesPanel {
|
|||||||
"gapright para");
|
"gapright para");
|
||||||
this.add(
|
this.add(
|
||||||
new JComboBox<Object>(new PrefChoiceSelector(
|
new JComboBox<Object>(new PrefChoiceSelector(
|
||||||
Preferences.STAGE_INSERT_POSITION_KEY,
|
ORPreferences.STAGE_INSERT_POSITION_KEY,
|
||||||
// // Always ask
|
// // Always ask
|
||||||
// // Insert in middle
|
// // Insert in middle
|
||||||
// // Add to end
|
// // Add to end
|
||||||
@ -56,7 +56,7 @@ public class DesignPreferencesPanel extends PreferencesPanel {
|
|||||||
|
|
||||||
this.add(
|
this.add(
|
||||||
new JComboBox<Object>(new PrefChoiceSelector(
|
new JComboBox<Object>(new PrefChoiceSelector(
|
||||||
Preferences.ROCKET_INFO_FONT_SIZE,
|
ORPreferences.ROCKET_INFO_FONT_SIZE,
|
||||||
// // Small
|
// // Small
|
||||||
// // Medium
|
// // Medium
|
||||||
// // Large
|
// // Large
|
||||||
|
@ -6,8 +6,8 @@ package info.openrocket.swing.gui.dialogs.preferences;
|
|||||||
import javax.swing.JComboBox;
|
import javax.swing.JComboBox;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author cpearls
|
* @author cpearls
|
||||||
@ -23,7 +23,7 @@ public class DisplayPreferencesPanel extends PreferencesPanel {
|
|||||||
|
|
||||||
this.add(
|
this.add(
|
||||||
new JComboBox<Object>(new PrefChoiceSelector(
|
new JComboBox<Object>(new PrefChoiceSelector(
|
||||||
Preferences.ROCKET_INFO_FONT_SIZE,
|
ORPreferences.ROCKET_INFO_FONT_SIZE,
|
||||||
// // Small
|
// // Small
|
||||||
// // Medium
|
// // Medium
|
||||||
// // Large
|
// // Large
|
||||||
|
@ -38,7 +38,7 @@ import info.openrocket.core.communication.UpdateInfoRetriever.ReleaseStatus;
|
|||||||
import info.openrocket.core.gui.util.SimpleFileFilter;
|
import info.openrocket.core.gui.util.SimpleFileFilter;
|
||||||
import info.openrocket.core.l10n.L10N;
|
import info.openrocket.core.l10n.L10N;
|
||||||
import info.openrocket.core.logging.Markers;
|
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.BuildProperties;
|
||||||
import info.openrocket.core.util.Named;
|
import info.openrocket.core.util.Named;
|
||||||
import info.openrocket.core.util.Utils;
|
import info.openrocket.core.util.Utils;
|
||||||
@ -93,7 +93,7 @@ public class GeneralPreferencesPanel extends PreferencesPanel {
|
|||||||
Named<Locale> selection = (Named<Locale>) languageCombo.getSelectedItem();
|
Named<Locale> selection = (Named<Locale>) languageCombo.getSelectedItem();
|
||||||
if (selection == null) return;
|
if (selection == null) return;
|
||||||
Locale l = selection.get();
|
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");
|
this.add(new JLabel(trans.get("generalprefs.lbl.language")), "gapright para");
|
||||||
|
@ -22,12 +22,12 @@ import javax.swing.event.ChangeListener;
|
|||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import info.openrocket.core.arch.SystemInfo;
|
import info.openrocket.core.arch.SystemInfo;
|
||||||
import info.openrocket.core.arch.SystemInfo.Platform;
|
import info.openrocket.core.arch.SystemInfo.Platform;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
|
|
||||||
import info.openrocket.swing.gui.adaptors.BooleanModel;
|
import info.openrocket.swing.gui.adaptors.BooleanModel;
|
||||||
import info.openrocket.swing.gui.components.StyledLabel;
|
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),
|
trans.get("pref.dlg.lbl.effect1"), -2, Style.ITALIC),
|
||||||
"spanx, wrap");
|
"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);
|
final JCheckBox enableGL = new JCheckBox(enableGLModel);
|
||||||
enableGL.setText(trans.get("pref.dlg.opengl.but.enableGL"));
|
enableGL.setText(trans.get("pref.dlg.opengl.but.enableGL"));
|
||||||
enableGL.addActionListener(new ActionListener() {
|
enableGL.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
preferences.putBoolean(Preferences.OPENGL_ENABLED, enableGL.isSelected());
|
preferences.putBoolean(ORPreferences.OPENGL_ENABLED, enableGL.isSelected());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
add(enableGL, "wrap");
|
add(enableGL, "wrap");
|
||||||
|
|
||||||
final JCheckBox enableAA = new JCheckBox(trans.get("pref.dlg.opengl.but.enableAA"));
|
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() {
|
enableAA.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
preferences.putBoolean(Preferences.OPENGL_ENABLE_AA, enableAA.isSelected());
|
preferences.putBoolean(ORPreferences.OPENGL_ENABLE_AA, enableAA.isSelected());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
enableGLModel.addEnableComponent(enableAA);
|
enableGLModel.addEnableComponent(enableAA);
|
||||||
add(enableAA, "wrap");
|
add(enableAA, "wrap");
|
||||||
|
|
||||||
final JCheckBox useFBO = new JCheckBox(trans.get("pref.dlg.opengl.lbl.useFBO"));
|
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() {
|
useFBO.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
preferences.putBoolean(Preferences.OPENGL_USE_FBO, useFBO.isSelected());
|
preferences.putBoolean(ORPreferences.OPENGL_USE_FBO, useFBO.isSelected());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
enableGLModel.addEnableComponent(useFBO);
|
enableGLModel.addEnableComponent(useFBO);
|
||||||
|
@ -34,6 +34,7 @@ import javax.swing.JPopupMenu;
|
|||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.event.MouseInputAdapter;
|
import javax.swing.event.MouseInputAdapter;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import info.openrocket.swing.gui.util.GUIUtil;
|
import info.openrocket.swing.gui.util.GUIUtil;
|
||||||
import info.openrocket.swing.gui.theme.UITheme;
|
import info.openrocket.swing.gui.theme.UITheme;
|
||||||
import org.slf4j.Logger;
|
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.Rocket;
|
||||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.util.Coordinate;
|
import info.openrocket.core.util.Coordinate;
|
||||||
import info.openrocket.core.util.MathUtil;
|
import info.openrocket.core.util.MathUtil;
|
||||||
import info.openrocket.core.util.BoundingBox;
|
import info.openrocket.core.util.BoundingBox;
|
||||||
@ -152,7 +152,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
if (System.getProperty("openrocket.3d.disable") != null)
|
if (System.getProperty("openrocket.3d.disable") != null)
|
||||||
return false;
|
return false;
|
||||||
//return by preference
|
//return by preference
|
||||||
return Application.getPreferences().getBoolean(Preferences.OPENGL_ENABLED, true);
|
return Application.getPreferences().getBoolean(ORPreferences.OPENGL_ENABLED, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initGLCanvas() {
|
private void initGLCanvas() {
|
||||||
@ -166,7 +166,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
log.trace("GL - creating GLCapabilities");
|
log.trace("GL - creating GLCapabilities");
|
||||||
final GLCapabilities caps = new GLCapabilities(glp);
|
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");
|
log.trace("GL - setSampleBuffers");
|
||||||
caps.setSampleBuffers(true);
|
caps.setSampleBuffers(true);
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ public class RocketFigure3d extends JPanel implements GLEventListener {
|
|||||||
log.trace("GL - Not enabling AA by user pref");
|
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");
|
log.trace("GL - Creating GLJPanel");
|
||||||
canvas = new GLJPanel(caps);
|
canvas = new GLJPanel(caps);
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +27,7 @@ import com.jogamp.opengl.awt.GLJPanel;
|
|||||||
import com.jogamp.opengl.fixedfunc.GLLightingFunc;
|
import com.jogamp.opengl.fixedfunc.GLLightingFunc;
|
||||||
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
|
import com.jogamp.opengl.fixedfunc.GLMatrixFunc;
|
||||||
import com.jogamp.opengl.glu.GLU;
|
import com.jogamp.opengl.glu.GLU;
|
||||||
import com.jogamp.common.type.WriteCloneable;
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JPopupMenu;
|
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.MotorMount;
|
||||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||||
import info.openrocket.core.startup.Application;
|
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.Coordinate;
|
||||||
import info.openrocket.core.util.MathUtil;
|
import info.openrocket.core.util.MathUtil;
|
||||||
import info.openrocket.core.util.StateChangeListener;
|
import info.openrocket.core.util.StateChangeListener;
|
||||||
@ -162,7 +162,7 @@ public class PhotoPanel extends JPanel implements GLEventListener {
|
|||||||
caps.setBackgroundOpaque(false);
|
caps.setBackgroundOpaque(false);
|
||||||
|
|
||||||
if (Application.getPreferences().getBoolean(
|
if (Application.getPreferences().getBoolean(
|
||||||
Preferences.OPENGL_ENABLE_AA, true)) {
|
ORPreferences.OPENGL_ENABLE_AA, true)) {
|
||||||
caps.setSampleBuffers(true);
|
caps.setSampleBuffers(true);
|
||||||
caps.setNumSamples(6);
|
caps.setNumSamples(6);
|
||||||
} else {
|
} else {
|
||||||
@ -170,7 +170,7 @@ public class PhotoPanel extends JPanel implements GLEventListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (Application.getPreferences().getBoolean(
|
if (Application.getPreferences().getBoolean(
|
||||||
Preferences.OPENGL_USE_FBO, false)) {
|
ORPreferences.OPENGL_USE_FBO, false)) {
|
||||||
log.trace("GL - Creating GLJPanel");
|
log.trace("GL - Creating GLJPanel");
|
||||||
canvas = new GLJPanel(caps);
|
canvas = new GLJPanel(caps);
|
||||||
((GLJPanel) canvas).setOpaque(false);
|
((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
|
// in an off-screen framebuffer object (FBO), otherwise the fake transparency rendering will cause the
|
||||||
// exported image to have a fully white background.
|
// exported image to have a fully white background.
|
||||||
if (!Application.getPreferences().getBoolean(
|
if (!Application.getPreferences().getBoolean(
|
||||||
Preferences.OPENGL_USE_FBO, false) && p.getSkyColorOpacity() < 100) {
|
ORPreferences.OPENGL_USE_FBO, false) && p.getSkyColorOpacity() < 100) {
|
||||||
i = drawToBufferedImage(drawable);
|
i = drawToBufferedImage(drawable);
|
||||||
} else {
|
} else {
|
||||||
i = (new AWTGLReadBufferUtil(
|
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
|
// 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)
|
// artificially by blending the sky color with white (= color that is rendered as transparent background)
|
||||||
if (useFakeTransparencyRendering && !Application.getPreferences().getBoolean(
|
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()),
|
convertColor(blendColors(p.getSkyColor(), new ORColor(255, 255, 255, 0), 1-p.getSkyColorOpacity()),
|
||||||
color);
|
color);
|
||||||
} else {
|
} else {
|
||||||
|
@ -48,12 +48,12 @@ import javax.swing.filechooser.FileFilter;
|
|||||||
import javax.swing.tree.DefaultTreeSelectionModel;
|
import javax.swing.tree.DefaultTreeSelectionModel;
|
||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
import javax.swing.tree.TreeSelectionModel;
|
import javax.swing.tree.TreeSelectionModel;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions;
|
import info.openrocket.core.file.wavefrontobj.export.OBJExportOptions;
|
||||||
import info.openrocket.core.file.wavefrontobj.export.OBJExporterFactory;
|
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.ErrorSet;
|
||||||
import info.openrocket.core.logging.WarningSet;
|
import info.openrocket.core.logging.WarningSet;
|
||||||
import info.openrocket.core.appearance.DecalImage;
|
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.Rocket;
|
||||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.util.BugException;
|
import info.openrocket.core.util.BugException;
|
||||||
import info.openrocket.core.util.DecalNotFoundException;
|
import info.openrocket.core.util.DecalNotFoundException;
|
||||||
import info.openrocket.core.util.MemoryManagement;
|
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 GeneralRocketSaver ROCKET_SAVER = new GeneralRocketSaver();
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
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();
|
public static final int SHORTCUT_KEY = Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx();
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ package info.openrocket.swing.gui.main;
|
|||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
@ -26,6 +25,7 @@ import javax.swing.event.TreeSelectionListener;
|
|||||||
import javax.swing.tree.TreePath;
|
import javax.swing.tree.TreePath;
|
||||||
import javax.swing.tree.TreeSelectionModel;
|
import javax.swing.tree.TreeSelectionModel;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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.TubeCoupler;
|
||||||
import info.openrocket.core.rocketcomponent.TubeFinSet;
|
import info.openrocket.core.rocketcomponent.TubeFinSet;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.util.BugException;
|
import info.openrocket.core.util.BugException;
|
||||||
import info.openrocket.core.util.Pair;
|
import info.openrocket.core.util.Pair;
|
||||||
import info.openrocket.core.util.Reflection;
|
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.
|
// Check whether to insert between or at the end.
|
||||||
// 0 = ask, 1 = in between, 2 = 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 (pos == 0) {
|
||||||
if (parent.getChildPosition(c) == parent.getChildCount() - 1)
|
if (parent.getChildPosition(c) == parent.getChildCount() - 1)
|
||||||
pos = 2; // Selected component is the last component
|
pos = 2; // Selected component is the last component
|
||||||
@ -624,7 +623,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
|||||||
|
|
||||||
if (check.isSelected()) {
|
if (check.isSelected()) {
|
||||||
// Save the preference
|
// 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;
|
return sel;
|
||||||
}
|
}
|
||||||
@ -676,7 +675,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
|||||||
|
|
||||||
// Check whether to insert between or at the end.
|
// Check whether to insert between or at the end.
|
||||||
// 0 = ask, 1 = in between, 2 = 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 (pos == 0) {
|
||||||
if (document.getRocket().getChildPosition(parentStage) == document.getRocket().getChildCount() - 1)
|
if (document.getRocket().getChildPosition(parentStage) == document.getRocket().getChildCount() - 1)
|
||||||
pos = 2; // Selected component is the last component
|
pos = 2; // Selected component is the last component
|
||||||
@ -748,7 +747,7 @@ public class ComponentAddButtons extends JPanel implements Scrollable {
|
|||||||
|
|
||||||
if (check.isSelected()) {
|
if (check.isSelected()) {
|
||||||
// Save the preference
|
// Save the preference
|
||||||
Application.getPreferences().putInt(Preferences.STAGE_INSERT_POSITION_KEY, sel);
|
Application.getPreferences().putInt(ORPreferences.STAGE_INSERT_POSITION_KEY, sel);
|
||||||
}
|
}
|
||||||
return sel;
|
return sel;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import info.openrocket.core.gui.util.SimpleFileFilter;
|
|||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.rocketcomponent.RocketComponent;
|
import info.openrocket.core.rocketcomponent.RocketComponent;
|
||||||
import info.openrocket.core.startup.Application;
|
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.core.util.FileUtils;
|
||||||
|
|
||||||
import info.openrocket.swing.file.wavefrontobj.OBJOptionChooser;
|
import info.openrocket.swing.file.wavefrontobj.OBJOptionChooser;
|
||||||
@ -33,7 +33,7 @@ public class DesignFileSaveAsFileChooser extends SaveFileChooser {
|
|||||||
private final OpenRocketDocument document;
|
private final OpenRocketDocument document;
|
||||||
|
|
||||||
private static final Translator trans = Application.getTranslator();
|
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) {
|
public static DesignFileSaveAsFileChooser build(OpenRocketDocument document, FileType type) {
|
||||||
return new DesignFileSaveAsFileChooser(document, type, null);
|
return new DesignFileSaveAsFileChooser(document, type, null);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package info.openrocket.swing.gui.main;
|
package info.openrocket.swing.gui.main;
|
||||||
|
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
|
|
||||||
import javax.swing.event.EventListenerList;
|
import javax.swing.event.EventListenerList;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
@ -115,7 +115,7 @@ public class MRUDesignFile {
|
|||||||
* Clear all existing MRU references in the preferences backing store.
|
* Clear all existing MRU references in the preferences backing store.
|
||||||
*/
|
*/
|
||||||
private void clear() {
|
private void clear() {
|
||||||
Preferences prefs = getPreferences();
|
ORPreferences prefs = getPreferences();
|
||||||
|
|
||||||
for (int i = 0; i < MAX_SIZE; i++) {
|
for (int i = 0; i < MAX_SIZE; i++) {
|
||||||
prefs.putString(MRU_FILE_LIST_PROPERTY + i, null);
|
prefs.putString(MRU_FILE_LIST_PROPERTY + i, null);
|
||||||
@ -126,7 +126,7 @@ public class MRUDesignFile {
|
|||||||
* Store the MRU list into the preferences backing store.
|
* Store the MRU list into the preferences backing store.
|
||||||
*/
|
*/
|
||||||
protected void store() {
|
protected void store() {
|
||||||
Preferences prefs = getPreferences();
|
ORPreferences prefs = getPreferences();
|
||||||
|
|
||||||
// clear the backing store
|
// clear the backing store
|
||||||
clear();
|
clear();
|
||||||
@ -142,7 +142,7 @@ public class MRUDesignFile {
|
|||||||
*/
|
*/
|
||||||
protected void retrieve() {
|
protected void retrieve() {
|
||||||
mruFileList.clear();
|
mruFileList.clear();
|
||||||
Preferences prefs = getPreferences();
|
ORPreferences prefs = getPreferences();
|
||||||
|
|
||||||
for (int i = 0; i < MAX_SIZE; i++) {
|
for (int i = 0; i < MAX_SIZE; i++) {
|
||||||
String str = prefs.getString(MRU_FILE_LIST_PROPERTY + i, null);
|
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();
|
return Application.getPreferences();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -63,7 +63,7 @@ import info.openrocket.core.rocketcomponent.Rocket;
|
|||||||
import info.openrocket.core.simulation.FlightData;
|
import info.openrocket.core.simulation.FlightData;
|
||||||
import info.openrocket.core.simulation.FlightEvent;
|
import info.openrocket.core.simulation.FlightEvent;
|
||||||
import info.openrocket.core.startup.Application;
|
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.unit.UnitGroup;
|
||||||
import info.openrocket.core.util.AlphanumComparator;
|
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.
|
/// when the simulation tab is selected this run outdated simulated if appropriate.
|
||||||
public void activating(){
|
public void activating(){
|
||||||
if( ((Preferences) Application.getPreferences()).getAutoRunSimulations()){
|
if( ((ORPreferences) Application.getPreferences()).getAutoRunSimulations()){
|
||||||
int nSims = simulationTable.getRowCount();
|
int nSims = simulationTable.getRowCount();
|
||||||
int outdated = 0;
|
int outdated = 0;
|
||||||
if (nSims == 0) {
|
if (nSims == 0) {
|
||||||
|
@ -25,7 +25,7 @@ import info.openrocket.core.simulation.FlightDataBranch;
|
|||||||
import info.openrocket.core.simulation.FlightDataType;
|
import info.openrocket.core.simulation.FlightDataType;
|
||||||
import info.openrocket.core.simulation.FlightEvent;
|
import info.openrocket.core.simulation.FlightEvent;
|
||||||
import info.openrocket.core.startup.Application;
|
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.Unit;
|
||||||
import info.openrocket.core.unit.UnitGroup;
|
import info.openrocket.core.unit.UnitGroup;
|
||||||
import info.openrocket.core.util.LinearInterpolator;
|
import info.openrocket.core.util.LinearInterpolator;
|
||||||
@ -421,7 +421,7 @@ public class SimulationPlot {
|
|||||||
List<Image> eventImages = new ArrayList<>();
|
List<Image> eventImages = new ArrayList<>();
|
||||||
|
|
||||||
// Plot the markers
|
// 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);
|
fillEventLists(branch, eventTimes, eventLabels, eventColors, eventImages);
|
||||||
plotVerticalLineMarkers(plot, eventTimes, eventLabels, eventColors);
|
plotVerticalLineMarkers(plot, eventTimes, eventLabels, eventColors);
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import info.openrocket.core.document.Simulation;
|
|||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.simulation.FlightDataType;
|
import info.openrocket.core.simulation.FlightDataType;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import info.openrocket.swing.gui.components.StyledLabel;
|
import info.openrocket.swing.gui.components.StyledLabel;
|
||||||
@ -58,7 +58,7 @@ public class SimulationPlotDialog extends JDialog {
|
|||||||
super(parent, simulation.getName());
|
super(parent, simulation.getName());
|
||||||
this.setModalityType(ModalityType.DOCUMENT_MODAL);
|
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);
|
final SimulationPlot myPlot = new SimulationPlot(simulation, config, initialShowPoints);
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ public class SimulationPlotDialog extends JDialog {
|
|||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
boolean show = checkData.isSelected();
|
boolean show = checkData.isSelected();
|
||||||
Application.getPreferences().putBoolean(Preferences.PLOT_SHOW_POINTS, show);
|
Application.getPreferences().putBoolean(ORPreferences.PLOT_SHOW_POINTS, show);
|
||||||
myPlot.setShowPoints(show);
|
myPlot.setShowPoints(show);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package info.openrocket.swing.gui.simulation;
|
package info.openrocket.swing.gui.simulation;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
import info.openrocket.core.document.OpenRocketDocument;
|
import info.openrocket.core.document.OpenRocketDocument;
|
||||||
import info.openrocket.core.document.Simulation;
|
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.rocketcomponent.Rocket;
|
||||||
import info.openrocket.core.simulation.extension.SimulationExtension;
|
import info.openrocket.core.simulation.extension.SimulationExtension;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.util.StateChangeListener;
|
import info.openrocket.core.util.StateChangeListener;
|
||||||
|
|
||||||
import javax.swing.JButton;
|
import javax.swing.JButton;
|
||||||
@ -54,7 +54,7 @@ public class SimulationConfigDialog extends JDialog {
|
|||||||
private JButton okButton;
|
private JButton okButton;
|
||||||
private JButton cancelButton;
|
private JButton cancelButton;
|
||||||
private static final Translator trans = Application.getTranslator();
|
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;
|
private final WindowListener applyChangesToSimsListener;
|
||||||
|
@ -31,7 +31,7 @@ import info.openrocket.core.simulation.SimulationOptions;
|
|||||||
import info.openrocket.core.simulation.extension.SimulationExtension;
|
import info.openrocket.core.simulation.extension.SimulationExtension;
|
||||||
import info.openrocket.core.simulation.extension.SimulationExtensionProvider;
|
import info.openrocket.core.simulation.extension.SimulationExtensionProvider;
|
||||||
import info.openrocket.core.startup.Application;
|
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.unit.UnitGroup;
|
||||||
import info.openrocket.core.util.GeodeticComputationStrategy;
|
import info.openrocket.core.util.GeodeticComputationStrategy;
|
||||||
|
|
||||||
@ -180,12 +180,12 @@ class SimulationOptionsPanel extends JPanel {
|
|||||||
button.addActionListener(new ActionListener() {
|
button.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Preferences preferences = Application.getPreferences();
|
ORPreferences preferences = Application.getPreferences();
|
||||||
conditions.setTimeStep(preferences.getDouble(
|
conditions.setTimeStep(preferences.getDouble(
|
||||||
Preferences.SIMULATION_TIME_STEP,
|
ORPreferences.SIMULATION_TIME_STEP,
|
||||||
RK4SimulationStepper.RECOMMENDED_TIME_STEP));
|
RK4SimulationStepper.RECOMMENDED_TIME_STEP));
|
||||||
conditions.setGeodeticComputation(preferences.getEnum(
|
conditions.setGeodeticComputation(preferences.getEnum(
|
||||||
Preferences.GEODETIC_COMPUTATION,
|
ORPreferences.GEODETIC_COMPUTATION,
|
||||||
GeodeticComputationStrategy.SPHERICAL));
|
GeodeticComputationStrategy.SPHERICAL));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -20,7 +20,6 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JRadioButton;
|
import javax.swing.JRadioButton;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.border.Border;
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
import javax.swing.table.TableColumn;
|
import javax.swing.table.TableColumn;
|
||||||
import javax.swing.table.TableColumnModel;
|
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.FlightDataTypeGroup;
|
||||||
import info.openrocket.core.simulation.FlightEvent;
|
import info.openrocket.core.simulation.FlightEvent;
|
||||||
import info.openrocket.core.startup.Application;
|
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.Unit;
|
||||||
import info.openrocket.core.util.Utils;
|
import info.openrocket.core.util.Utils;
|
||||||
|
|
||||||
@ -284,7 +283,7 @@ public class SimulationPlotPanel extends JPanel {
|
|||||||
bg.add(radioVerticalMarker);
|
bg.add(radioVerticalMarker);
|
||||||
bg.add(radioIcon);
|
bg.add(radioIcon);
|
||||||
|
|
||||||
boolean useIcon = preferences.getBoolean(Preferences.MARKER_STYLE_ICON, false);
|
boolean useIcon = preferences.getBoolean(ORPreferences.MARKER_STYLE_ICON, false);
|
||||||
if (useIcon) {
|
if (useIcon) {
|
||||||
radioIcon.setSelected(true);
|
radioIcon.setSelected(true);
|
||||||
} else {
|
} else {
|
||||||
@ -296,7 +295,7 @@ public class SimulationPlotPanel extends JPanel {
|
|||||||
public void itemStateChanged(ItemEvent e) {
|
public void itemStateChanged(ItemEvent e) {
|
||||||
if (modifying > 0)
|
if (modifying > 0)
|
||||||
return;
|
return;
|
||||||
preferences.putBoolean(Preferences.MARKER_STYLE_ICON, radioIcon.isSelected());
|
preferences.putBoolean(ORPreferences.MARKER_STYLE_ICON, radioIcon.isSelected());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Enumeration;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -45,13 +44,11 @@ import javax.swing.JTable;
|
|||||||
import javax.swing.JTree;
|
import javax.swing.JTree;
|
||||||
import javax.swing.KeyStroke;
|
import javax.swing.KeyStroke;
|
||||||
import javax.swing.ListSelectionModel;
|
import javax.swing.ListSelectionModel;
|
||||||
import javax.swing.LookAndFeel;
|
|
||||||
import javax.swing.RootPaneContainer;
|
import javax.swing.RootPaneContainer;
|
||||||
import javax.swing.SpinnerModel;
|
import javax.swing.SpinnerModel;
|
||||||
import javax.swing.SpinnerNumberModel;
|
import javax.swing.SpinnerNumberModel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
import javax.swing.UIManager;
|
|
||||||
import javax.swing.border.TitledBorder;
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.event.ChangeListener;
|
import javax.swing.event.ChangeListener;
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
@ -67,13 +64,11 @@ import javax.swing.tree.DefaultTreeSelectionModel;
|
|||||||
import javax.swing.tree.TreeModel;
|
import javax.swing.tree.TreeModel;
|
||||||
import javax.swing.tree.TreeSelectionModel;
|
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.swing.gui.Resettable;
|
||||||
|
|
||||||
import info.openrocket.core.arch.SystemInfo;
|
|
||||||
import info.openrocket.core.logging.Markers;
|
import info.openrocket.core.logging.Markers;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.core.util.BugException;
|
import info.openrocket.core.util.BugException;
|
||||||
import info.openrocket.core.util.Invalidatable;
|
import info.openrocket.core.util.Invalidatable;
|
||||||
import info.openrocket.core.util.MemoryManagement;
|
import info.openrocket.core.util.MemoryManagement;
|
||||||
@ -285,7 +280,7 @@ public class GUIUtil {
|
|||||||
* @return the current theme
|
* @return the current theme
|
||||||
*/
|
*/
|
||||||
public static UITheme.Theme getUITheme() {
|
public static UITheme.Theme getUITheme() {
|
||||||
Preferences prefs = Application.getPreferences();
|
ORPreferences prefs = Application.getPreferences();
|
||||||
Object theme = prefs.getUITheme();
|
Object theme = prefs.getUITheme();
|
||||||
if (theme instanceof UITheme.Theme) {
|
if (theme instanceof UITheme.Theme) {
|
||||||
return (UITheme.Theme) theme;
|
return (UITheme.Theme) theme;
|
||||||
|
@ -4,6 +4,7 @@ import info.openrocket.core.arch.SystemInfo;
|
|||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
|
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import info.openrocket.swing.gui.components.PreferencesOptionPanel;
|
import info.openrocket.swing.gui.components.PreferencesOptionPanel;
|
||||||
import info.openrocket.swing.gui.main.MRUDesignFile;
|
import info.openrocket.swing.gui.main.MRUDesignFile;
|
||||||
import info.openrocket.swing.gui.theme.UITheme;
|
import info.openrocket.swing.gui.theme.UITheme;
|
||||||
@ -40,11 +41,11 @@ import java.util.prefs.Preferences;
|
|||||||
public abstract class PreferencesExporter {
|
public abstract class PreferencesExporter {
|
||||||
private static final Translator trans = Application.getTranslator();
|
private static final Translator trans = Application.getTranslator();
|
||||||
private static final Logger log = LoggerFactory.getLogger(PreferencesExporter.class);
|
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<String> keysToIgnore = new ArrayList<>(); // Preference keys to ignore when exporting user directories (= keys that export user directories)
|
private static final List<String> keysToIgnore = new ArrayList<>(); // Preference keys to ignore when exporting user directories (= keys that export user directories)
|
||||||
private static final List<String> prefixKeysToIgnore = new ArrayList<>(); // Preference keys to ignore when exporting user directories (= keys that start with these prefixes), e.g.
|
private static final List<String> prefixKeysToIgnore = new ArrayList<>(); // Preference keys to ignore when exporting user directories (= keys that start with these prefixes), e.g.
|
||||||
private static final List<String> nodesToIgnore = new ArrayList<>(); // Preferences nodes that should not be exported
|
private static final List<String> nodesToIgnore = new ArrayList<>(); // ORPreferences nodes that should not be exported
|
||||||
|
|
||||||
public static boolean exportPreferences(Window parent, Preferences preferences) {
|
public static boolean exportPreferences(Window parent, Preferences preferences) {
|
||||||
JFileChooser chooser = new SaveFileChooser();
|
JFileChooser chooser = new SaveFileChooser();
|
||||||
@ -96,7 +97,7 @@ public abstract class PreferencesExporter {
|
|||||||
// Export all preferences except user directories
|
// Export all preferences except user directories
|
||||||
exportFilteredPreferences(preferences, fos);
|
exportFilteredPreferences(preferences, fos);
|
||||||
}
|
}
|
||||||
log.info("Preferences exported successfully.");
|
log.info("ORPreferences exported successfully.");
|
||||||
} catch (IOException | BackingStoreException e) {
|
} catch (IOException | BackingStoreException e) {
|
||||||
log.warn("Error while importing preferences: " + e.getMessage());
|
log.warn("Error while importing preferences: " + e.getMessage());
|
||||||
}
|
}
|
||||||
@ -110,8 +111,8 @@ public abstract class PreferencesExporter {
|
|||||||
nodesToIgnore.clear();
|
nodesToIgnore.clear();
|
||||||
|
|
||||||
if (ignoreUserDirectories) {
|
if (ignoreUserDirectories) {
|
||||||
keysToIgnore.add(info.openrocket.core.startup.Preferences.USER_THRUST_CURVES_KEY);
|
keysToIgnore.add(ORPreferences.USER_THRUST_CURVES_KEY);
|
||||||
keysToIgnore.add(info.openrocket.core.startup.Preferences.DEFAULT_DIRECTORY);
|
keysToIgnore.add(ORPreferences.DEFAULT_DIRECTORY);
|
||||||
prefixKeysToIgnore.add(MRUDesignFile.MRU_FILE_LIST_PROPERTY);
|
prefixKeysToIgnore.add(MRUDesignFile.MRU_FILE_LIST_PROPERTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import java.util.prefs.Preferences;
|
|||||||
|
|
||||||
import info.openrocket.core.database.Databases;
|
import info.openrocket.core.database.Databases;
|
||||||
import info.openrocket.core.rocketcomponent.NoseCone;
|
import info.openrocket.core.rocketcomponent.NoseCone;
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import info.openrocket.swing.gui.theme.UITheme;
|
import info.openrocket.swing.gui.theme.UITheme;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -56,7 +57,7 @@ import info.openrocket.core.util.BuildProperties;
|
|||||||
import info.openrocket.swing.communication.AssetHandler.UpdatePlatform;
|
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);
|
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() {
|
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
|
if (themeName == null) return UITheme.Themes.LIGHT; // Default theme
|
||||||
try {
|
try {
|
||||||
return UITheme.Themes.valueOf(themeName);
|
return UITheme.Themes.valueOf(themeName);
|
||||||
@ -374,7 +375,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i
|
|||||||
@Override
|
@Override
|
||||||
public void setUITheme(Object theme) {
|
public void setUITheme(Object theme) {
|
||||||
if (!(theme instanceof UITheme.Theme)) return;
|
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();
|
storeVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -387,7 +388,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final float getRocketInfoFontSize() {
|
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() {
|
private static int getDefaultFontSize() {
|
||||||
@ -429,7 +430,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i
|
|||||||
}
|
}
|
||||||
|
|
||||||
public File getDefaultDirectory() {
|
public File getDefaultDirectory() {
|
||||||
String file = getString(info.openrocket.core.startup.Preferences.DEFAULT_DIRECTORY, null);
|
String file = getString(ORPreferences.DEFAULT_DIRECTORY, null);
|
||||||
if (file == null)
|
if (file == null)
|
||||||
return null;
|
return null;
|
||||||
return new File(file);
|
return new File(file);
|
||||||
@ -442,7 +443,7 @@ public class SwingPreferences extends info.openrocket.core.startup.Preferences i
|
|||||||
} else {
|
} else {
|
||||||
d = dir.getAbsolutePath();
|
d = dir.getAbsolutePath();
|
||||||
}
|
}
|
||||||
putString(info.openrocket.core.startup.Preferences.DEFAULT_DIRECTORY, d);
|
putString(ORPreferences.DEFAULT_DIRECTORY, d);
|
||||||
storeVersion();
|
storeVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import info.openrocket.core.formatting.RocketDescriptor;
|
|||||||
import info.openrocket.core.formatting.RocketDescriptorImpl;
|
import info.openrocket.core.formatting.RocketDescriptorImpl;
|
||||||
import info.openrocket.core.l10n.Translator;
|
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.ComponentPresetDatabaseLoader;
|
||||||
import info.openrocket.core.database.MotorDatabaseLoader;
|
import info.openrocket.core.database.MotorDatabaseLoader;
|
||||||
import info.openrocket.swing.gui.util.SwingPreferences;
|
import info.openrocket.swing.gui.util.SwingPreferences;
|
||||||
@ -47,7 +47,7 @@ public class GuiModule extends AbstractModule {
|
|||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
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(Translator.class).toProvider(TranslatorProvider.class).in(Scopes.SINGLETON);
|
||||||
bind(RocketDescriptor.class).to(RocketDescriptorImpl.class).in(Scopes.SINGLETON);
|
bind(RocketDescriptor.class).to(RocketDescriptorImpl.class).in(Scopes.SINGLETON);
|
||||||
bind(WatchService.class).to(WatchServiceImpl.class).in(Scopes.SINGLETON);
|
bind(WatchService.class).to(WatchServiceImpl.class).in(Scopes.SINGLETON);
|
||||||
|
@ -15,7 +15,7 @@ import javax.swing.Timer;
|
|||||||
import javax.swing.ToolTipManager;
|
import javax.swing.ToolTipManager;
|
||||||
|
|
||||||
import info.openrocket.core.startup.Application;
|
import info.openrocket.core.startup.Application;
|
||||||
import info.openrocket.core.startup.Preferences;
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import net.miginfocom.layout.LayoutUtil;
|
import net.miginfocom.layout.LayoutUtil;
|
||||||
import info.openrocket.core.arch.SystemInfo;
|
import info.openrocket.core.arch.SystemInfo;
|
||||||
import info.openrocket.core.arch.SystemInfo.Platform;
|
import info.openrocket.core.arch.SystemInfo.Platform;
|
||||||
@ -206,7 +206,7 @@ public class SwingStartup {
|
|||||||
String cmdLAF = System.getProperty("openrocket.laf");
|
String cmdLAF = System.getProperty("openrocket.laf");
|
||||||
if (cmdLAF != null) {
|
if (cmdLAF != null) {
|
||||||
log.info("Setting cmd line LAF '{}'", cmdLAF);
|
log.info("Setting cmd line LAF '{}'", cmdLAF);
|
||||||
Preferences prefs = Application.getPreferences();
|
ORPreferences prefs = Application.getPreferences();
|
||||||
prefs.setUITheme(UITheme.Themes.valueOf(cmdLAF));
|
prefs.setUITheme(UITheme.Themes.valueOf(cmdLAF));
|
||||||
}
|
}
|
||||||
GUIUtil.applyLAF();
|
GUIUtil.applyLAF();
|
||||||
|
@ -2,9 +2,9 @@ package info.openrocket.swing.utils;
|
|||||||
|
|
||||||
import info.openrocket.core.formatting.RocketDescriptor;
|
import info.openrocket.core.formatting.RocketDescriptor;
|
||||||
import info.openrocket.core.formatting.RocketDescriptorImpl;
|
import info.openrocket.core.formatting.RocketDescriptorImpl;
|
||||||
|
import info.openrocket.core.startup.ORPreferences;
|
||||||
import info.openrocket.swing.gui.util.SwingPreferences;
|
import info.openrocket.swing.gui.util.SwingPreferences;
|
||||||
import info.openrocket.core.l10n.Translator;
|
import info.openrocket.core.l10n.Translator;
|
||||||
import info.openrocket.core.startup.Preferences;
|
|
||||||
import info.openrocket.swing.startup.providers.TranslatorProvider;
|
import info.openrocket.swing.startup.providers.TranslatorProvider;
|
||||||
|
|
||||||
import com.google.inject.AbstractModule;
|
import com.google.inject.AbstractModule;
|
||||||
@ -13,7 +13,7 @@ public class CoreServicesModule extends AbstractModule {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(Preferences.class).to(SwingPreferences.class);
|
bind(ORPreferences.class).to(SwingPreferences.class);
|
||||||
bind(Translator.class).toProvider(TranslatorProvider.class);
|
bind(Translator.class).toProvider(TranslatorProvider.class);
|
||||||
bind(RocketDescriptor.class).to(RocketDescriptorImpl.class);
|
bind(RocketDescriptor.class).to(RocketDescriptorImpl.class);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import info.openrocket.core.l10n.Translator;
|
|||||||
import info.openrocket.core.material.Material;
|
import info.openrocket.core.material.Material;
|
||||||
import info.openrocket.core.preset.ComponentPreset;
|
import info.openrocket.core.preset.ComponentPreset;
|
||||||
import info.openrocket.core.preset.ComponentPreset.Type;
|
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.Collections;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -22,7 +22,7 @@ public class ServicesForTesting extends AbstractModule {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
bind(Preferences.class).to(PreferencesForTesting.class);
|
bind(ORPreferences.class).to(PreferencesForTesting.class);
|
||||||
bind(Translator.class).toProvider(TranslatorProviderForTesting.class);
|
bind(Translator.class).toProvider(TranslatorProviderForTesting.class);
|
||||||
bind(RocketDescriptor.class).to(RocketDescriptorImpl.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;
|
private static java.util.prefs.Preferences root = null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user