sort sketches in their menu, also rebuild sketch menu after save just in

case
This commit is contained in:
benfry
2004-06-21 19:43:20 +00:00
parent 02ed417869
commit 7d3bf8bb24
3 changed files with 33 additions and 11 deletions

View File

@@ -1235,6 +1235,8 @@ public class PdeEditor extends JFrame
try {
sketch.save();
message("Done Saving.");
// rebuild sketch menu in case a save-as was forced
sketchbook.rebuildMenu();
} catch (Exception e) {
// show the error as a message in the window

View File

@@ -4,8 +4,8 @@
PdeSketchbook - handles sketchbook mechanics for the sketch menu
Part of the Processing project - http://processing.org
Except where noted, code is written by Ben Fry
Copyright (c) 2001-03 Massachusetts Institute of Technology
Except where noted, code is written by Ben Fry and is
Copyright (c) 2001-04 Massachusetts Institute of Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -247,6 +247,24 @@ public class PdeSketchbook {
if (!folder.isDirectory()) return false;
String list[] = folder.list();
// alphabetize list, since it's not always alpha order
// use cheapie bubble-style sort which should be fine
// since not a tone of files, and things will mostly be sorted
// or may be completely sorted already by the os
for (int i = 0; i < list.length; i++) {
int who = i;
for (int j = i+1; j < list.length; j++) {
if (list[j].compareTo(list[who]) < 0) {
who = j; // this guy is earlier in the alphabet
}
}
if (who != i) { // swap with someone if changes made
String temp = list[who];
list[who] = list[i];
list[i] = temp;
}
}
//SketchbookMenuListener listener =
//new SketchbookMenuListener(folder.getAbsolutePath());

View File

@@ -69,8 +69,15 @@ X on application open, override 'open' mode
X and just open an empty sketch in the sketchbook folder
X when 'skNew' is cancelled in 'open' mode, nullpointerex at the top
040622 monday afternoon
X if a "save as" is forced, make sure that the sketchbook menu is updated
X sort sketch names in the open menu
X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1074981609
_ warn about writing non-1.1 code.
_ will jikes do it if the -source is set to 1.1?
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1079867179;start=0
_ if a "save as" is forced, make sure that the sketchbook menu is updated
_ dashes shouldn't be allowed in filenames for sketches
_ actually, lost the naming stuff because now using FileDialog
_ can this requirement just be on the pde file, not the directory?
@@ -97,7 +104,9 @@ _ i.e. flash programs 'import' all data, etc
_ same with how imovie works
_ comments -> embedding in applet text? (ala javadoc)
_ would this help casey with the examples?
_ how to handle .pde vs .java
_ how to determine what the 'main' file is
_ sun won't want us to say things are .java when they aren't
_ NullPointerException when alt is pressed
_ might be something to do with the applet frame being an awt not swing
@@ -137,13 +146,6 @@ _ include 'netscape.javascript' as a library to be added
_ but don't export it.. ugh..
SKETCHBOOK
_ sort sketch names in the open menu
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1074981609
_ warn about writing non-1.1 code.
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_Software;action=display;num=1079867179;start=0
LIBRARIES
_ "add library" menu item and submenu
_ iterate through the 'library' folders