recursive sketch folders now work

but coloring seems to be pretty flakey
This commit is contained in:
benfry
2002-10-23 01:45:43 +00:00
parent 0b59252e90
commit fa10b78e59
4 changed files with 78 additions and 26 deletions

View File

@@ -513,7 +513,7 @@ public class PdeBase extends Frame implements ActionListener {
menu.addSeparator();
// other available subdirectories
/*
String toplevel[] = sketchbookFolder.list();
added = false;
for (int i = 0; i < toplevel.length; i++) {
@@ -550,10 +550,17 @@ public class PdeBase extends Frame implements ActionListener {
menu.add(subMenu);
}
if (added) menu.addSeparator();
*/
addSketches(menu, sketchbookFolder, true);
/*
// doesn't seem that refresh is worthy of its own menu item
// people can stop and restart p5 if they want to muck with it
menu.addSeparator();
MenuItem item = new MenuItem("Refresh");
item.addActionListener(this);
menu.add(item);
*/
} catch (IOException e) {
e.printStackTrace();
@@ -561,6 +568,35 @@ public class PdeBase extends Frame implements ActionListener {
}
protected void addSketches(Menu menu, File folder, boolean root)
throws IOException {
String list[] = folder.list();
SketchbookMenuListener listener =
new SketchbookMenuListener(folder.getCanonicalPath());
for (int i = 0; i < list.length; i++) {
if (list[i].equals(editor.userName) && root) continue;
if (list[i].equals(".") ||
list[i].equals("..") ||
list[i].equals("CVS") ||
list[i].equals(".cvsignore")) continue;
File subfolder = new File(folder, list[i]);
if (new File(subfolder, list[i] + ".pde").exists()) {
MenuItem item = new MenuItem(list[i]);
item.addActionListener(listener);
menu.add(item);
} else { // might contain other dirs, get recursive
Menu submenu = new Menu(list[i]);
menu.add(submenu);
addSketches(submenu, subfolder, false);
}
}
}
/*
class HistoryMenuListener implements ActionListener {
public void actionPerformed(ActionEvent e) {

View File

@@ -125,13 +125,13 @@ public class PdeEditor extends Panel {
viewport.add(textarea);
// viewport.setScrollMode(JViewport.BLIT_SCROLL_MODE);
//textarea.setFont(PdeBase.getFont("editor.program.font",
// new Font("Monospaced",
// Font.PLAIN, 12)));
//textarea.setForeground(PdeBase.getColor("editor.program.fgcolor",
// Color.black));
//textarea.setBackground(PdeBase.getColor("editor.program.bgcolor",
// Color.white));
textarea.setFont(PdeBase.getFont("editor.program.font",
new Font("Monospaced",
Font.PLAIN, 12)));
textarea.setForeground(PdeBase.getColor("editor.program.fgcolor",
Color.black));
textarea.setBackground(PdeBase.getColor("editor.program.bgcolor",
Color.white));
rightPanel.add("Center", scroller);
//rightPanel.add("Center", textarea);

View File

@@ -11,22 +11,37 @@
#editor.program.columns = 60
#editor.program.font = Monospaced,plain,12
#editor.program.body.style = Monospaced,plain,12,#000000,#ffffff
editor.program.tag.style = Monospaced,plain,12,#800000,#ffffff
#editor.program.reference.style = Monospaced,plain,12,#000000,#ffffff
editor.program.name.style = Monospaced,plain,12,#b03060,#ffffff
editor.program.value.style = Monospaced,plain,12,#b03060,#ffffff
#editor.program.text.style = Monospaced,plain,12,#000000,#ffffff
editor.program.reserved_word.style = Monospaced,plain,12,#800000,#ffffff
# int, void, public, etc..
editor.program.reserved_word.style = Monospaced,plain,12,#000080,#ffffff
# numbers, quoted tidbits
editor.program.literal.style = Monospaced,plain,12,#800000,#ffffff
# self explanatory
editor.program.comment.style = Monospaced,plain,12,#808080,#ffffff
editor.program.whitespace.style = Monospaced,plain,12,#000000,#ffffff
# brackets, semicolons, etc
#editor.program.separator.style = Monospaced,plain,12,#008000,#ffffff
# math guys + - / *
#editor.program.operator.style = Monospaced,plain,12,#008000,#ffffff
# just about everything else
#editor.program.identifier.style = Monospaced,plain,12,#000000,#ffffff
editor.program.literal.style = Monospaced,plain,12,#b03060,#ffffff
editor.program.separator.style = Monospaced,plain,12,#000080,#ffffff
#editor.program.operator.style = Monospaced,plain,12,#000000,#ffffff
editor.program.comment.style = Monospaced,plain,12,#000080,#ffffff
editor.program.preprocessor.style = Monospaced,plain,12,#a020f0,#ffffff
#editor.program.whitespace.style = Monospaced,plain,12,#000000,#ffffff
editor.program.error.style = Monospaced,plain,12,#800000,#ffffff
editor.program.unknown.style = Monospaced,plain,12,#804000,#ffffff
# unused for java editor
#editor.program.body.style = Monospaced,plain,12,#000000,#ffffff
#editor.program.tag.style = Monospaced,plain,12,#800000,#ffffff
#editor.program.reference.style = Monospaced,plain,12,#000000,#ffffff
#editor.program.name.style = Monospaced,plain,12,#b03060,#ffffff
#editor.program.value.style = Monospaced,plain,12,#b03060,#ffffff
#editor.program.text.style = Monospaced,plain,12,#000000,#ffffff
#editor.program.preprocessor.style = Monospaced,plain,12,#a020f0,#ffffff
#editor.program.error.style = Monospaced,plain,12,#800000,#ffffff
#editor.program.unknown.style = Monospaced,plain,12,#804000,#ffffff
#editor.header.bgcolor = #333333
#editor.header.fgcolor.primary = #ffffff

View File

@@ -16,8 +16,10 @@ rect(80, 0, thick, height/2);
fill(102, 112, 0.0);
rect(100, height/2, thick, height/2);
X re-implement sketchModified yet again (using keylistener)
X set font on textarea in case things break
X need examples to work for submenus (casey's got too many)
_ exception when trying to write to stdout
bagel
_ font smoothing (unless hint SMOOTH_IMAGES enabled) is broken
@@ -35,9 +37,8 @@ _ auto indent on next line no longer works
_ tabs no longer convert to 2 spaces
_ balance parens is no longer available
_ need examples to work for submenus (casey's got too many)
_ "color.jpg" or "int.jpg" causes trouble
_ better default size than 300x300 when starting up first time
_ "color.jpg" or "int.jpg" causes trouble
_ subst Image -> BImage, Font -> BFont
_ better message for PortInUseException (full explanation)
_ split KjcEngine into three parts