From 8bee319ff311107ca9ec1a6fad55dcf12f9f0a68 Mon Sep 17 00:00:00 2001 From: benfry Date: Mon, 2 May 2005 00:29:56 +0000 Subject: [PATCH] rev c changes to getting sketch rename/saveas working properly --- processing/app/Sketch.java | 27 +++++++++++++++++++++++++-- processing/core/todo.txt | 5 +++-- processing/todo.txt | 5 ++++- 3 files changed, 32 insertions(+), 5 deletions(-) diff --git a/processing/app/Sketch.java b/processing/app/Sketch.java index 8b612e133..82c1f2022 100644 --- a/processing/app/Sketch.java +++ b/processing/app/Sketch.java @@ -304,8 +304,8 @@ public class Sketch { return; } + // don't allow blank names if (newName.trim().equals("")) { - // don't allow blank names return; } @@ -366,6 +366,15 @@ public class Sketch { if (renamingCode) { if (current == code[0]) { + // get the new folder name/location + File newFolder = new File(folder.getParentFile(), newName); + if (newFolder.exists()) { + Base.showWarning("Cannot Rename", + "Sorry, a sketch (or folder) named " + + "\"" + newName + "\" already exists.", null); + return; + } + // unfortunately this can't be a "save as" because that // only copies the sketch files and the data folder // however this *will* first save the sketch, then rename @@ -401,7 +410,6 @@ public class Sketch { } // now rename the sketch folder and re-open - File newFolder = new File(folder.getParentFile(), newName); boolean success = folder.renameTo(newFolder); if (!success) { Base.showWarning("Error", "Could not rename the sketch. (2)", null); @@ -769,6 +777,15 @@ public class Sketch { if (newName == null) return false; newName = Sketchbook.sanitizeName(newName); + // make sure there doesn't exist a tab with that name already + File checkAlready = new File(folder, newName + ".pde"); + if (checkAlready.exists()) { + Base.showMessage("Nope", + "You can't save the sketch as \"" + newName + "\"\n" + + "because the sketch already has a tab with that name."); + return false; + } + // new sketch folder File newFolder = new File(newParentDir, newName); @@ -830,6 +847,12 @@ public class Sketch { Base.copyDir(dataFolder, newDataFolder); } + // re-copy the code folder + if (codeFolder.exists()) { + File newCodeFolder = new File(newFolder, "code"); + Base.copyDir(codeFolder, newCodeFolder); + } + // save the main tab with its new name File newFile = new File(newFolder, newName + ".pde"); code[0].saveAs(newFile); diff --git a/processing/core/todo.txt b/processing/core/todo.txt index 349068b98..50d348492 100644 --- a/processing/core/todo.txt +++ b/processing/core/todo.txt @@ -9,6 +9,9 @@ X saveFrame with a filename still causing trouble: X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114097641;start=0 X fov should be in radians +_ not working on macosx 10.2? +_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114381302;start=0 + X ex on endshape if no calls to vertex X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1113940972 @@ -49,8 +52,6 @@ _ append(), shorten(), splice, slice, subset, concat, reverse _ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action=display;num=1114443601;start=0 present mode fixes -_ not working on macosx 10.2? -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114381302;start=0 _ for present mode, need to set a default display _ currently crashes if only --present is specified w/o --display _ present mode is flakey.. applet doesn't always come up diff --git a/processing/todo.txt b/processing/todo.txt index 13659ea79..a010a40b5 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -32,6 +32,8 @@ X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Suggestions;action= X maintain tab scroll and caret positions X save caret position when switching tabs +_ when holding down shift, show the alt behavior for EditorHeader + _ make simple tool for casey to rebuild all the examples at once _ need to rebuild with this release because of 1.3/1.4 issues @@ -67,6 +69,7 @@ _ creating a new file with the same name as a hidden file will cause trouble DOCUMENTATION +_ mention revisions.txt in changes.html _ quicktime 7 has not been tested, use at your own risk _ if you have trouble on mac, this is a qt 652 reinstaller _ http://www.apple.com/support/downloads/quicktime652reinstallerformac.html @@ -81,7 +84,7 @@ _ get(), set() and red() et al are one such example _ faq - not supporting windows 95 _ http://www.java.com/en/download/help/win95.xml _ faq - known bugs -_ put the jikes fix for 10.2 on the faq +_ put the jikes fix for 10.2 on the faq (mention update to 86) _ 1 pixel stroke weight in opengl (temporary) _ make clear that P2D is not working if not clear enough _ save/yes/no needs cancel