From c7cfbbf154ff3e13abb250a14cb12ebdbd2fc7ac Mon Sep 17 00:00:00 2001 From: benfry Date: Sun, 10 Oct 2004 01:14:47 +0000 Subject: [PATCH] fixing up editor for 71 --- processing/app/PdeEditorHeader.java | 6 ++++++ processing/app/PdeSketch.java | 18 +++++++++++------- processing/todo.txt | 15 ++++++--------- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/processing/app/PdeEditorHeader.java b/processing/app/PdeEditorHeader.java index a50fb1cd4..7b0264860 100644 --- a/processing/app/PdeEditorHeader.java +++ b/processing/app/PdeEditorHeader.java @@ -46,6 +46,8 @@ public class PdeEditorHeader extends JComponent { JMenu menu; JPopupMenu popup; + JMenuItem renameItem; + int menuLeft; int menuRight; @@ -166,6 +168,9 @@ public class PdeEditorHeader extends JComponent { tabRight = new int[sketch.codeCount]; } + // disable rename on the first tab + renameItem.setEnabled(sketch.current != sketch.code[0]); + int x = PdePreferences.GUI_SMALL; for (int i = 0; i < sketch.codeCount; i++) { PdeCode code = sketch.code[i]; @@ -293,6 +298,7 @@ public class PdeEditorHeader extends JComponent { } }); menu.add(item); + renameItem = item; item = new JMenuItem("Delete"); item.addActionListener(new ActionListener() { diff --git a/processing/app/PdeSketch.java b/processing/app/PdeSketch.java index e1fed4db4..428f7616b 100644 --- a/processing/app/PdeSketch.java +++ b/processing/app/PdeSketch.java @@ -704,7 +704,7 @@ public class PdeSketch { } // make sure they aren't the same file - if (sourceFile.equals(destFile)) { + if (!addingCode && sourceFile.equals(destFile)) { PdeBase.showWarning("You can't fool me", "This file has already been copied to the\n" + "location where you're trying to add it.\n" + @@ -712,12 +712,16 @@ public class PdeSketch { return; } - try { - PdeBase.copyFile(sourceFile, destFile); - } catch (IOException e) { - PdeBase.showWarning("Error adding file", - "Could not add '" + filename + - "' to the sketch.", e); + // in case the user is "adding" the code in an attempt + // to update the sketch's tabs + if (!sourceFile.equals(destFile)) { + try { + PdeBase.copyFile(sourceFile, destFile); + } catch (IOException e) { + PdeBase.showWarning("Error adding file", + "Could not add '" + filename + + "' to the sketch.", e); + } } // make the tabs update after this guy is added diff --git a/processing/todo.txt b/processing/todo.txt index cb965b59a..8771011df 100644 --- a/processing/todo.txt +++ b/processing/todo.txt @@ -20,13 +20,15 @@ X don't enable externalRuntime with multiple code files that are pde X no longer separate classes X remove "file" from "new file".. maybe just "new tab"? X not really separate files, so that could be trouble. +X add file of a .pde or .java file should update the tabs bar +X and prolly not really complain if it's in the same folder +X dim "rename" when the main tab is selected (since user needs to "save as") -_ add file of a .pde or .java file should update the tabs bar -_ and prolly not really complain if it's in the same folder - +saving issues _ "save as" not properly updating the tab header - _ also include the name of the previous sketch for "save as" +_ prevent folks from saving a sketch inside its own folder +_ will cause bizarro recursive folder action _ allow to use doubles on casting -- particularly for Math.cos() et al @@ -47,9 +49,6 @@ _ see why coords are going negative _ remove grow box from applet frame on macosx -_ prevent folks from saving a sketch inside its own folder -_ will cause bizarro recursive folder action - _ "save as" shouldn't show save as dialog for sketches _ unless that's the current mode that's being used @@ -63,8 +62,6 @@ _ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs _ mouse wheel broken in the text editor? (windows jdk 1.5?) -_ dim "rename" when the main tab is selected (since user needs to "save as") - _ make font builder vertically resizable _ 200 pt font hoses things / hides buttons