X better default size than 300x300 when starting up first time

This commit is contained in:
benfry
2002-11-19 20:16:24 +00:00
parent 0ad1b80994
commit 728a098377
3 changed files with 75 additions and 50 deletions
+5 -2
View File
@@ -178,8 +178,8 @@ public class PdeBase extends Frame implements ActionListener {
e.printStackTrace();
//System.exit(1);
}
int width = getInteger("window.width", 600);
int height = getInteger("window.height", 350);
// int width = getInteger("window.width", 600);
// int height = getInteger("window.height", 350);
/*
encoding = get("encoding");
@@ -330,12 +330,15 @@ public class PdeBase extends Frame implements ActionListener {
Dimension screen = tk.getScreenSize();
// THESE CAN BE REMOVED TO SOME EXTENT
/*
int frameX = getInteger("window.x", (screen.width - width) / 2);
int frameY = getInteger("window.y", (screen.height - height) / 2);
frame.setBounds(frameX, frameY,
width + insets.left + insets.right,
height + insets.top + insets.bottom);
*/
//frame.reshape(50, 50, width + insets.left + insets.right,
// height + insets.top + insets.bottom);
+37 -12
View File
@@ -2,6 +2,7 @@ import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.text.*;
import java.util.*;
import java.util.zip.*;
@@ -313,6 +314,9 @@ public class PdeEditor extends Panel {
public void init() {
// load the last program that was in use
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int windowX = -1, windowY = 0, windowW = 0, windowH = 0;
Properties skprops = new Properties();
try {
if (PdeBase.platform == PdeBase.MACOSX) {
@@ -327,21 +331,22 @@ public class PdeEditor extends Panel {
skprops.load(getClass().getResource("sketch.properties").openStream());
}
int windowX = Integer.parseInt(skprops.getProperty("window.x", "-1"));
int windowY = Integer.parseInt(skprops.getProperty("window.y", "-1"));
int windowW = Integer.parseInt(skprops.getProperty("window.w", "-1"));
int windowH = Integer.parseInt(skprops.getProperty("window.h", "-1"));
windowX = Integer.parseInt(skprops.getProperty("window.x", "-1"));
windowY = Integer.parseInt(skprops.getProperty("window.y", "-1"));
windowW = Integer.parseInt(skprops.getProperty("window.w", "-1"));
windowH = Integer.parseInt(skprops.getProperty("window.h", "-1"));
// if screen size has changed, the window coordinates no longer
// make sense, so don't use them unless they're identical
int screenW = Integer.parseInt(skprops.getProperty("screen.w", "-1"));
int screenH = Integer.parseInt(skprops.getProperty("screen.h", "-1"));
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
if ((windowX != -1) &&
(screen.width == screenW) && (screen.height == screenH)) {
//System.out.println("setting bounds of frame");
PdeBase.frame.setBounds(windowX, windowY, windowW, windowH);
//if ((windowX != -1) &&
// (screen.width == screenW) && (screen.height == screenH)) {
//} else {
if ((screen.width != screenW) || (screen.height != screenH)) {
// not valid for this machine, so invalidate sizing
windowX = -1;
}
String name = skprops.getProperty("sketch.name");
@@ -378,6 +383,15 @@ public class PdeEditor extends Panel {
// doesn't exist, not available, make my own
skNew();
}
if (windowX == -1) {
//System.out.println("using defaults for window size");
windowW = PdeBase.getInteger("window.width", 500);
windowH = PdeBase.getInteger("window.height", 500);
windowX = (screen.width - windowW) / 2;
windowY = (screen.height - windowH) / 2;
}
PdeBase.frame.setBounds(windowX, windowY, windowW, windowH);
//rebuildSketchbookMenu(PdeBase.sketchbookMenu);
}
@@ -777,10 +791,16 @@ afterwards, some of these steps need a cleanup function
File sketchDir = null;
String sketchName = null;
int index = 0;
//Calendar now = Calendar.getInstance();
SimpleDateFormat formatter = new SimpleDateFormat("yyMMdd");
String purty = formatter.format(new Date());
do {
int index = (int) (Math.random() * 1000);
sketchName = "sketch_" + pad3(index);
sketchName = "sketch_" + purty + ((char) ('a' + index));
//int index = (int) (Math.random() * 1000);
//sketchName = "sketch_" + pad3(index);
sketchDir = new File(sketchbookDir, sketchName);
index++;
} while (sketchDir.exists());
// mkdir for new project name
@@ -817,13 +837,18 @@ afterwards, some of these steps need a cleanup function
}
}
/*
static String pad2(int what) {
if (what < 10) return "0" + what;
else return String.valueOf(what);
}
static String pad3(int what) {
if (what < 10) return "00" + what;
else if (what < 100) return "0" + what;
else return String.valueOf(what);
}
/*
static String pad4(int what) {
if (what < 10) return "000" + what;
else if (what < 100) return "00" + what;
+33 -36
View File
@@ -87,22 +87,45 @@ X Using Apple-shift-arrowDown selects only from the beginning of this
selection when pressed twice. It also selects the line under the
current line.
X Pressing the tab key moves to the bottom of the text area.
X hopefully fixed, but needs to be tested
? Select All (Apple-A) closes the application
(Ctrl-Q) on Azerty-keyboards
X use date in the sketch name sketch_021104
X with a _2 if needed or '021104a' '021104b' etc
X when using save as, allow to remove the old (numbered) sketch
X better default size than 300x300 when starting up first time
FINISH for 46
pde
_ use date in the sketch name sketch_021104
_ with a _2 if needed or '021104a' '021104b' etc
_ when using save as, allow to remove the old (numbered) sketch
_ lots of problems with the console [maybe this needs to be a textarea?]
_ long lines seem to be trouble
_ also printing of objects, esp when null, in jdk 14
_ exception when trying to write to stdout
_ better default size than 300x300 when starting up first time
macosx
_ bug report from the site
resizing the editor window in Mac OS X leaves the status bar in
place. The result is an editor window with a grey bar layered on top,
obscuring the editable text.
_ update dist script for new layout
_ put mac rxtx inside the p5 folder (hide it?)
_ include more strongly worded message about rxtx
_ escape key not quitting presentation mode
_ no events seem to be coming through at all
macos9
_ update build/dist scripts to work with new layout
_ check to see if swing is working properly
linux
_ update build and dist scripts for new layout
_ build new release, look for jdk 1.4 to use instead of 1.3
LATER RELEASES
bagel
_ images don't load during setup()
_ make bagel usable on its own as a drawing surface
@@ -112,7 +135,6 @@ _ finish fill mode of flat circle function
_ make into oval function
_ font smoothing (unless hint SMOOTH_IMAGES enabled) is broken
pde
_ support 'classes' folder, through the use of a classloader
_ could also be done by launching external java app
@@ -127,43 +149,17 @@ _ how are line endings working during save?
_ get syntax coloring debugged?
_ talk to casey about better default colors
windows
_ need splash screen, startup takes a long time
_ windows 95/98/ME seems to be broken
_ ME seems to be very broken
_ lockup/freezes (mKoser and zeitgeist)
_ jre icon not appearing in the systray
macos9
_ update build/dist scripts to work with new layout
_ check to see if swing is working properly
macosx
_ update dist script for new layout
_ put mac rxtx inside the p5 folder (hide it?)
_ include more strongly worded message about rxtx
_ bug report from the site
resizing the editor window in Mac OS X leaves the status bar in
place. The result is an editor window with a grey bar layered on top,
obscuring the editable text.
_ escape key not quitting presentation mode
_ no events seem to be coming through at all
_ Event.consume() doesn't work on entry fields
_ manifests itself in sketch naming, can't be constrained
X hopefully fixed, but needs to be tested
_ Select All (Apple-A) closes the application
(Ctrl-Q) on Azerty-keyboards
maybe someday
* Rename the button options to verbs, e.g. instead of "Do you want to
save? yes/no", change it to "Document Has been modified -- Save
changes? Save/Cancel/Don't Save". Look at Aqua Human Interface
guidelines (http://developer.apple.com/ue/switch/windows.html, tip 9)
FURTHER AHEAD
_ 'image' is too generic a variable to have inside BApplet
@@ -181,9 +177,6 @@ _ still a threaded app? just doesn't update inside loop
_ get gcc tied into processing
_ java disassembly inside p5
_ and assmebling it back again
KEEP AN EYE OUT...
_ locking up on run (under win2k? others?)
_ rare but present, every 100th time or so
@@ -196,6 +189,10 @@ _ moving sketchbook folder for lab environments
_ lots of ui ideas from adrien in the bboard
_ can't copy text from console directly
o make note in readme about stderr.txt and stdout.txt
_ Rename the button options to verbs, e.g. instead of "Do you want to
save? yes/no", change it to "Document Has been modified -- Save
changes? Save/Cancel/Don't Save". Look at Aqua Human Interface
guidelines (http://developer.apple.com/ue/switch/windows.html, tip 9)
OTHER NOTES