summaryrefslogtreecommitdiff
path: root/sources/prefs
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-22 15:14:34 +0000
committerPaul Buetow <paul@buetow.org>2008-05-22 15:14:34 +0000
commitf7b023c5cff7dae854a015889bd217f3b84f6e07 (patch)
tree7e8767e18803da4928afad0f50760ba1efd2524d /sources/prefs
parent4de5343c60cc165cdf30121e0ed9eca96ac91a22 (diff)
Expert mode changable.
Diffstat (limited to 'sources/prefs')
-rw-r--r--sources/prefs/VSDefaultPrefs.java1
-rw-r--r--sources/prefs/editors/VSEditor.java28
-rw-r--r--sources/prefs/editors/VSSimulationEditor.java22
3 files changed, 45 insertions, 6 deletions
diff --git a/sources/prefs/VSDefaultPrefs.java b/sources/prefs/VSDefaultPrefs.java
index de5583c..a06f985 100644
--- a/sources/prefs/VSDefaultPrefs.java
+++ b/sources/prefs/VSDefaultPrefs.java
@@ -206,6 +206,7 @@ public class VSDefaultPrefs extends VSPrefs {
public void fillDefaultBooleans() {
//initBoolean("message.broadcast", false, "Nachrichten sind immer Broadcasts");
+ initBoolean("sim.mode.expert", false, "Expertenmodus aktivieren");
initBoolean("sim.message.own.recv", false, "Eigene Nachrichten empfangen");
}
}
diff --git a/sources/prefs/editors/VSEditor.java b/sources/prefs/editors/VSEditor.java
index 0d00bab..d8e3222 100644
--- a/sources/prefs/editors/VSEditor.java
+++ b/sources/prefs/editors/VSEditor.java
@@ -35,6 +35,7 @@ public abstract class VSEditor implements ActionListener {
public static final int SIMULATION_PREFERENCES = 1;
private VSFrame frame;
protected VSEditorTable editTable;
+ private boolean expertModeChanged;
public VSEditor(VSPrefs prefs, VSPrefs prefsToEdit) {
init(prefs, prefsToEdit);
@@ -91,10 +92,16 @@ public abstract class VSEditor implements ActionListener {
private ArrayList<String> filterKeys(Set<String> set) {
ArrayList<String> filtered = new ArrayList<String>();
-
- for (String elem : set)
- if (!elem.startsWith("lang.") && !elem.startsWith("keyevent"))
- filtered.add(elem);
+ boolean expertMode = prefs.getBoolean("sim.mode.expert");
+
+ for (String elem : set) {
+ if (!elem.startsWith("lang.") && !elem.startsWith("keyevent")) {
+ if (expertMode)
+ filtered.add(elem);
+ else if (!elem.startsWith("col.") && (!elem.startsWith("div.")))
+ filtered.add(elem);
+ }
+ }
return filtered;
}
@@ -394,6 +401,8 @@ public abstract class VSEditor implements ActionListener {
}
protected void savePrefs() {
+ boolean expertMode = prefs.getBoolean("sim.mode.expert");
+
int i = 0;
for (String key : integerKeys) {
JComboBox valComboBox = integerFields.get(key);
@@ -438,6 +447,17 @@ public abstract class VSEditor implements ActionListener {
JTextField valField = stringFields.get(key);
prefsToEdit.setString(key, valField.getText());
}
+
+ expertModeChanged = expertMode != prefs.getBoolean("sim.mode.expert");
+ }
+
+ public boolean expertModeChanged() {
+ boolean ret = expertModeChanged;
+
+ if (expertModeChanged)
+ expertModeChanged = false;
+
+ return ret;
}
public void actionPerformed(ActionEvent e) {
diff --git a/sources/prefs/editors/VSSimulationEditor.java b/sources/prefs/editors/VSSimulationEditor.java
index 8d3a010..f0106fd 100644
--- a/sources/prefs/editors/VSSimulationEditor.java
+++ b/sources/prefs/editors/VSSimulationEditor.java
@@ -14,7 +14,18 @@ import prefs.*;
public class VSSimulationEditor extends VSBetterEditor {
private VSSimulatorFrame simulatorFrame;
+ private VSSimulation simulation;
public static boolean TAKEOVER_BUTTON;
+ private boolean dontStartNewSimulation;
+
+ public VSSimulationEditor(VSPrefs prefs, VSSimulatorFrame simulatorFrame, VSSimulation simulation) {
+ super(prefs, prefs, prefs.getString("lang.name")
+ + " - " + prefs.getString("lang.prefs"));
+ this.dontStartNewSimulation = true;//simulation != null;
+ this.simulatorFrame = simulatorFrame;
+ this.simulation = simulation;
+ getInfoArea().setText(prefs.getString("lang.prefs.info!"));
+ }
public VSSimulationEditor(VSPrefs prefs, VSSimulatorFrame simulatorFrame) {
super(prefs, prefs, prefs.getString("lang.name")
@@ -39,11 +50,18 @@ public class VSSimulationEditor extends VSBetterEditor {
if (actionCommand.equals(prefs.getString("lang.takeover"))) {
savePrefs();
- simulatorFrame.getCurrentSimulation().updateFromPrefs();
+ if (expertModeChanged()) {
+ simulation.fireExpertModeChanged();
+ }
+ simulation.updateFromPrefs();
} else if (actionCommand.equals(prefs.getString("lang.ok"))) {
savePrefs();
- simulatorFrame.addSimulation(new VSSimulation(prefsToEdit, simulatorFrame));
+ if (expertModeChanged()) {
+ simulation.fireExpertModeChanged();
+ }
+ if (!dontStartNewSimulation)
+ simulatorFrame.addSimulation(new VSSimulation(prefsToEdit, simulatorFrame));
} else {
super.actionPerformed(e);