diff --git a/processing/app/PdeBase.java b/processing/app/PdeBase.java index 4dee20554..3866ecf83 100644 --- a/processing/app/PdeBase.java +++ b/processing/app/PdeBase.java @@ -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) { diff --git a/processing/app/PdeEditor.java b/processing/app/PdeEditor.java index d176f721f..c9dff9b33 100644 --- a/processing/app/PdeEditor.java +++ b/processing/app/PdeEditor.java @@ -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); diff --git a/processing/build/shared/lib/pde.properties b/processing/build/shared/lib/pde.properties index 406662057..5c0a5d676 100644 --- a/processing/build/shared/lib/pde.properties +++ b/processing/build/shared/lib/pde.properties @@ -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 diff --git a/processing/todo.txt b/processing/todo.txt index 1b19db2ed..13ef68891 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -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