properly storing window settings

This commit is contained in:
benfry
2003-11-12 02:02:16 +00:00
parent be313e12ae
commit d7ea3a7752
2 changed files with 6 additions and 28 deletions

View File

@@ -477,6 +477,8 @@ public class PdeEditor extends JFrame
* Called when the application is quitting.
*/
public void storePreferences() {
System.out.println("storing preferences");
// window location information
Rectangle bounds = getBounds();
PdePreferences.setInteger("last.window.x", bounds.x);
@@ -484,6 +486,10 @@ public class PdeEditor extends JFrame
PdePreferences.setInteger("last.window.width", bounds.width);
PdePreferences.setInteger("last.window.height", bounds.height);
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
PdePreferences.setInteger("last.screen.width", screen.width);
PdePreferences.setInteger("last.screen.height", screen.height);
// last sketch that was in use
PdePreferences.set("last.sketch.name", sketchName);
PdePreferences.set("last.sketch.path", sketchDir.getAbsolutePath());

View File

@@ -37,14 +37,6 @@ import javax.swing.filechooser.*;
import javax.swing.text.*;
import javax.swing.undo.*;
/*
#ifndef RXTX
import javax.comm.*;
#else
import gnu.io.*;
#endif
*/
/*
need to bring all the prefs into here
@@ -111,28 +103,12 @@ public class PdePreferences extends JComponent {
// start by loading the defaults, in case something
// important was deleted from the user prefs
try {
load(PdeBase.getStream("pde.properties"));
/*
if ((PdeBase.platform == PdeBase.MACOSX) ||
(PdeBase.platform == PdeBase.MACOS9)) {
//load(new FileInputStream("lib/pde.properties"));
} else {
// under win95, current dir not set properly
// so using a relative url like "lib/" won't work
load(getClass().getResource("pde.properties").openStream());
}
*/
} catch (Exception e) {
PdeBase.showError(null, "Could not read default settings.\n" +
"You'll need to reinstall Processing.", e);
//System.exit(1);
//System.err.println("Error reading default settings");
//e.printStackTrace();
}
@@ -148,11 +124,7 @@ public class PdePreferences extends JComponent {
// this is a key specific to a particular platform
String actualKey = key.substring(0, key.length() - extensionLength);
String value = get(key);
//System.out.println("found platform specific prop \"" +
// actualKey + "\" \"" + value + "\"");
table.put(actualKey, value);
//System.out.println("now set to " + table.get(actualKey));
}
}