From 0606e2ef329ea8577c9536169d13d589a2fafa56 Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 10 Jun 2007 17:28:02 +0000 Subject: [PATCH] fixes to sketchbook reloading, plus notes on changes to core --- app/Editor.java | 14 ++++++-- app/Sketch.java | 86 ++----------------------------------------------- core/todo.txt | 5 +++ todo.txt | 34 +++++++++++-------- 4 files changed, 39 insertions(+), 100 deletions(-) diff --git a/app/Editor.java b/app/Editor.java index 894b9d790..483be0112 100644 --- a/app/Editor.java +++ b/app/Editor.java @@ -479,7 +479,9 @@ public class Editor extends JFrame listener.applyPreferences(); // in case moved to a new location - sketchbook.rebuildMenus(); + // For 0125, changing to async version (to be implemented later) + //sketchbook.rebuildMenus(); + sketchbook.rebuildMenusAsync(); } @@ -1739,8 +1741,11 @@ public class Editor extends JFrame message(EMPTY); } // rebuild sketch menu in case a save-as was forced + // Disabling this for 0125, instead rebuild the menu inside + // the Save As method of the Sketch object, since that's the + // only one who knows whether something was renamed. //sketchbook.rebuildMenus(); - sketchbook.rebuildMenusAsync(); + //sketchbook.rebuildMenusAsync(); } catch (Exception e) { // show the error as a message in the window @@ -1765,7 +1770,10 @@ public class Editor extends JFrame try { if (sketch.saveAs()) { message("Done Saving."); - sketchbook.rebuildMenusAsync(); + // Disabling this for 0125, instead rebuild the menu inside + // the Save As method of the Sketch object, since that's the + // only one who knows whether something was renamed. + //sketchbook.rebuildMenusAsync(); } else { message("Save Cancelled."); } diff --git a/app/Sketch.java b/app/Sketch.java index d2f9ff4c8..f32fc1ef3 100644 --- a/app/Sketch.java +++ b/app/Sketch.java @@ -498,40 +498,6 @@ public class Sketch { editor.textarea.getSelectionEnd(), editor.textarea.getScrollPosition()); - /* - // backtrack and don't rename the sketch folder - success = newFolder.renameTo(folder); - if (!success) { - String msg = - "Started renaming sketch and then ran into\n" + - "nasty trouble. Try to salvage with Copy & Paste\n" + - "or attempt a \"Save As\" to see if that works."; - Base.showWarning("Serious Error", msg, null); - } - return; - } - */ - - /* - // set the sketch name... used by the pde and whatnot. - // the name is only set in the sketch constructor, - // so it's important here - name = newName; - - code[0].name = newName; - code[0].file = mainFile; - code[0].program = editor.getText(); - code[0].save(); - - folder = newFolder; - - // get the changes into the sketchbook menu - editor.sketchbook.rebuildMenus(); - - // reload the sketch - load(); - */ - // get the changes into the sketchbook menu // (re-enabled in 0115 to fix bug #332) editor.sketchbook.rebuildMenus(); @@ -949,55 +915,8 @@ public class Sketch { editor.textarea.getSelectionEnd(), editor.textarea.getScrollPosition()); - /* - // copy the entire contents of the sketch folder - Base.copyDir(folder, newFolder); - - // change the references to the dir location in SketchCode files - for (int i = 0; i < codeCount; i++) { - code[i].file = new File(newFolder, code[i].file.getName()); - } - for (int i = 0; i < hiddenCount; i++) { - hidden[i].file = new File(newFolder, hidden[i].file.getName()); - } - - // remove the old sketch file from the new dir - code[0].file.delete(); - // name for the new main .pde file - code[0].file = new File(newFolder, newName + ".pde"); - code[0].name = newName; - // write the contents to the renamed file - // (this may be resaved if the code is modified) - code[0].modified = true; - //code[0].save(); - //System.out.println("modified is " + modified); - - // change the other paths - String oldName = name; - name = newName; - File oldFolder = folder; - folder = newFolder; - dataFolder = new File(folder, "data"); - codeFolder = new File(folder, "code"); - - // remove the 'applet', 'application', 'library' folders - // from the copied version. - // otherwise their .class and .jar files can cause conflicts. - Base.removeDir(new File(folder, "applet")); - Base.removeDir(new File(folder, "application")); - //Base.removeDir(new File(folder, "library")); - - // do a "save" - // this will take care of the unsaved changes in each of the tabs - save(); - - // get the changes into the sketchbook menu - //sketchbook.rebuildMenu(); - // done inside Editor instead - - // update the tabs for the name change - editor.header.repaint(); - */ + // Name changed, rebuild the sketch menus + editor.sketchbook.rebuildMenusAsync(); // let Editor know that the save was successful return true; @@ -2587,7 +2506,6 @@ public class Sketch { for (int i = 0; i < pieces.length; i++) { if (pieces[i].length() == 0) continue; - //System.out.println("checking piece " + pieces[i]); // is it a jar file or directory? if (pieces[i].toLowerCase().endsWith(".jar") || diff --git a/core/todo.txt b/core/todo.txt index 826768d6f..46139da55 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -72,6 +72,11 @@ X added min() and max() for float and int arrays _ need to update reference X moved around min/max functions +_ loadBytes() doesn't do auto gunzip? but loadStrings and createReader do? +_ this might be a good solution for dealing with the differences +_ with loadBytes(), they can use gzipInput (or loadBytesGZ?) +_ although what does openStream do? (doesn't do auto?) + _ add gluegen-rt back to the applet export _ http://download.java.net/media/jogl/builds/nightly/javadoc_public/com/sun/opengl/util/JOGLAppletLauncher.html diff --git a/todo.txt b/todo.txt index 4c884b5dd..486bcea19 100644 --- a/todo.txt +++ b/todo.txt @@ -31,8 +31,24 @@ X moved around constructors (to be on par with other video lib stuff) X cleaned up constant names (i.e. MSVideo -> MS_VIDEO) X added constant for h264 encoding _ add documentation +X find/replace - replace should do auto find next(?) +X or have a replace & find button +X placing "replace" next to "find" ... (hitting "replace all" by accident) +X have a button "replace & find next" +X http://dev.processing.org/bugs/show_bug.cgi?id=68 +X only rebuild sketchbook on "save as" or "rename" of sketch +X currently it's rebuilding whenever "save" called too +X http://dev.processing.org/bugs/show_bug.cgi?id=357 +X ignore ._ files when reading jar and zip +X Ignoring /Users/fry/coconut/processing/build/macosx/work/libraries/opengl/library/._jogl-natives-linux-i586.jar (error in opening zip file) +_ xml element needs to be readable from other charsets +_ same with the other methods like loadStrings() +_ could also be a way to handle gzip too? +_ tho charset + gzip would be a problem +_ hint(ENABLE_AUTO_GUNZIP) or rather hint(DISABLE_AUTO_GUNZIP) + _ look into deleting from p5 bugs db _ ? doesn't work with find in reference @@ -51,9 +67,6 @@ _ the contents in the files are not the same, but the main-tab is _ showing the contents of the .java tab, so if you press save _ you will overwrite your original code from the main-tab. -_ show progress bar while rebuilding sketch menu -_ startup is very slow on g4 - _ "find in ref" on XMLElement brings up ref for null (ha) @@ -716,15 +729,11 @@ _ .java files are copied to the root folder as well as the source folder PDE / Find & Replace -_ find/replace - replace should do auto find next(?) -_ or have a replace & find button _ all around very ugly, fix it up _ http://dev.processing.org/bugs/show_bug.cgi?id=67 _ several tweaks _ http://dev.processing.org/bugs/show_bug.cgi?id=68 _ only enable "find next" in menu after a find has happened -_ placing "replace" next to "find" ... (hitting "replace all" by accident) -_ have a button "replace & find next" _ allowing to find & replace over multiple tabs _ http://dev.processing.org/bugs/show_bug.cgi?id=69 @@ -802,13 +811,15 @@ _ because there's a dash in the name _ and instead only loads StemCell.pde _ show progress dialog during export and save _ slow save/new because of large sketchbook -_ only rebuild sketchbook on "save as" or "rename" of sketch -_ currently it's rebuilding whenever "save" called too _ this is a total cluster, the rebuild is being called incessantly +_ startup is very slow on g4 +_ show progress bar while rebuilding sketch menu? _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1162801212 _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1141126582 -_ http://dev.processing.org/bugs/show_bug.cgi?id=357 _ even more of a problem becase set modified set true all the time +_ in 0125, only rebuilding on rename or save as, but still a problem +_ don't re-scan all jar files whenever rebuilding sketch menu (cache) +_ http://dev.processing.org/bugs/show_bug.cgi?id=579 _ in rebuild sketch menu - disable subfolders working as libraries _ if a sketch, don't allow subfolders o or maybe just that libraries must be in the root? @@ -1162,9 +1173,6 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=539 DIST / Linux -_ size of sketch different in setup() and draw() on linux -_ make sure that the sketch isn't being sized based on bad insets -_ http://dev.processing.org/bugs/show_bug.cgi?id=341 _ not being able to make a link to the processing app _ argh.. more path and shell issues.. _ computationally intensive stuff runs really slow inside p5