mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
allow dots in filename so ppl can make .pde/.java decision.. but sanitize
later.. also some tweaks for multi-file
This commit is contained in:
@@ -333,7 +333,7 @@ public class PdeEditorStatus extends JPanel implements ActionListener {
|
||||
//System.out.println("consuming event");
|
||||
event.consume();
|
||||
|
||||
} else if ((c == '_') ||
|
||||
} else if ((c == '_') || (c == '.') || // allow .pde and .java
|
||||
((c >= 'A') && (c <= 'Z')) ||
|
||||
((c >= 'a') && (c <= 'z'))) {
|
||||
// everything fine, catches upper and lower
|
||||
|
||||
+22
-21
@@ -241,15 +241,6 @@ public class PdeSketch {
|
||||
|
||||
boolean renamingCode;
|
||||
|
||||
/*
|
||||
public void nameCode(String newName) {
|
||||
if (renamingCode) {
|
||||
renameCode2(newName);
|
||||
} else {
|
||||
newCode2(newName);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
public void newCode() {
|
||||
//System.out.println("new code");
|
||||
@@ -279,8 +270,12 @@ public class PdeSketch {
|
||||
* where they diverge.
|
||||
*/
|
||||
public void nameCode(String newName) {
|
||||
// if renaming to the same thing as before, just ignore
|
||||
if (renamingCode && newName.equals(current.name)) {
|
||||
// if renaming to the same thing as before, just ignore.
|
||||
// also ignoring case here, because i don't want to write
|
||||
// a bunch of special stuff for each platform
|
||||
// (osx is case insensitive but preserving, windows insensitive,
|
||||
// *nix is sensitive and preserving.. argh)
|
||||
if (renamingCode && newName.equalsIgnoreCase(current.name)) {
|
||||
// exit quietly for the 'rename' case.
|
||||
// if it's a 'new' then an error will occur down below
|
||||
return;
|
||||
@@ -305,6 +300,14 @@ public class PdeSketch {
|
||||
newFlavor = PDE;
|
||||
}
|
||||
|
||||
// dots are allowed for the .pde and .java, but not in general
|
||||
// so make sure the user didn't name things poo.time.pde
|
||||
// or something like that (nothing against poo time)
|
||||
if (newName.indexOf('.') != -1) {
|
||||
newName = PdeSketchbook.sanitizedName(newName);
|
||||
newFilename = newName + ((newFlavor == PDE) ? ".pde" : ".java");
|
||||
}
|
||||
|
||||
// create the new file, new PdeCode object and load it
|
||||
File newFile = new File(folder, newFilename);
|
||||
if (newFile.exists()) { // yay! users will try anything
|
||||
@@ -1016,14 +1019,12 @@ public class PdeSketch {
|
||||
(i == 0) ? suggestedClassName : null,
|
||||
importPackageList);
|
||||
if (className == null) {
|
||||
// TODO this is temporary for debugging
|
||||
System.err.println("no class found in " + code[i].name);
|
||||
/*
|
||||
System.err.println("class could not be determined for " +
|
||||
code[i].name + " hopefully an error has " +
|
||||
"already been reported.");
|
||||
return null;
|
||||
*/
|
||||
// this situation might be perfectly fine,
|
||||
// (i.e. if the file is empty)
|
||||
System.out.println("No class found in " + code[i].name);
|
||||
System.out.println("(any code in that file will be ignored)");
|
||||
System.out.println();
|
||||
|
||||
} else {
|
||||
code[i].preprocName = className + ".java";
|
||||
}
|
||||
@@ -1031,7 +1032,7 @@ public class PdeSketch {
|
||||
if (i == 0) {
|
||||
// store this for the compiler and the runtime
|
||||
primaryClassName = className;
|
||||
System.out.println("primary class " + primaryClassName);
|
||||
//System.out.println("primary class " + primaryClassName);
|
||||
|
||||
// check if the 'main' file is in java mode
|
||||
if (PdePreprocessor.programType == PdePreprocessor.JAVA) {
|
||||
@@ -1095,7 +1096,7 @@ public class PdeSketch {
|
||||
//
|
||||
PdeCompiler compiler = new PdeCompiler();
|
||||
boolean success = compiler.compile(this, buildPath);
|
||||
System.out.println("success = " + success + " ... " + primaryClassName);
|
||||
//System.out.println("success = " + success + " ... " + primaryClassName);
|
||||
return success ? primaryClassName : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ X sketch is changing before the "save changes?" is complete
|
||||
X as a result, 'cancel' does nothing
|
||||
X always ask save changes, even if nothing changed
|
||||
|
||||
040621 sunday
|
||||
040620 sunday
|
||||
X remove 'sketchbook.prompt' (comment it out)
|
||||
X not really needed
|
||||
X remove prompt stuff from the preferences panel
|
||||
@@ -24,7 +24,7 @@ X to use JLabel instead of JTextArea
|
||||
X font was wrong on windows
|
||||
X start working on "save as"
|
||||
|
||||
040622 monday morning
|
||||
040621 monday morning
|
||||
X finish "save as"
|
||||
X adding files to data folder that are already in the data folder
|
||||
X makes the file zero, because of internal error
|
||||
@@ -41,7 +41,7 @@ X set examples somehow read-only
|
||||
X 'save as' from examples puts into examples dir.. :(
|
||||
X make it default to the user's sketch dir
|
||||
|
||||
040622 monday mid-day
|
||||
040621 monday mid-day
|
||||
X see if changing the sketchbook location actually works
|
||||
X after changing sketchbook location, need to rebuild the menu
|
||||
X hide the editor window while prefs is open
|
||||
@@ -69,7 +69,7 @@ X on application open, override 'open' mode
|
||||
X and just open an empty sketch in the sketchbook folder
|
||||
X when 'skNew' is cancelled in 'open' mode, nullpointerex at the top
|
||||
|
||||
040622 monday afternoon
|
||||
040621 monday afternoon
|
||||
X if a "save as" is forced, make sure that the sketchbook menu is updated
|
||||
X sort sketch names in the open menu
|
||||
X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1074981609
|
||||
@@ -79,7 +79,7 @@ X was adding all folders in the classpath
|
||||
X workaround for the // causing an OutOfMemoryError
|
||||
X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1067717095
|
||||
|
||||
040622 monday evening/night
|
||||
040621 monday evening/night
|
||||
X jikes errors have no newlines because it's a buffered reader
|
||||
X and the newlines are removed when read
|
||||
X make the filedialog come up with the p5 window on handlenew
|
||||
@@ -127,7 +127,7 @@ X i.e. when double-clicking on them.. downloaded off web..
|
||||
X but need to deal with simply, not providing a new exception case
|
||||
X begin writing 'new text file'
|
||||
|
||||
040623 tuesday morning / early afternoon
|
||||
040622 tuesday morning / early afternoon
|
||||
X write 'new text file' (ctrl-t)
|
||||
X hitting return/enter on the status.edit() not always working
|
||||
X it had been disabled, now re-enabled
|
||||
@@ -138,10 +138,17 @@ X see if multiple files are actually compiling
|
||||
X nope, they aren't properly.. need to figure this out
|
||||
X empty files = no class name found.. that's a problem
|
||||
|
||||
040623 tuesday afternoon
|
||||
040623 wednesday afternoon
|
||||
_ continue work on multi-file compile
|
||||
X test that .java files can be created
|
||||
X allow user to type a period '.' when entering filename
|
||||
X but remove it again if it's not .pde or .java
|
||||
X clean up error handling for empty files (quiet error)
|
||||
|
||||
_ errors in other files aren't bubbling up
|
||||
|
||||
_ see if sonia project can compile
|
||||
_ write options dialog for export
|
||||
_ write export-to-application
|
||||
_ write export-to-library
|
||||
_ need to be able to produce the serial, video, etc libs
|
||||
@@ -152,7 +159,7 @@ _ after using the popup menu once, it stops working
|
||||
|
||||
_ running present mode with a bug in the program hoses things
|
||||
_ make sure the program compiles before starting present mode
|
||||
|
||||
_ make some fancy extendo things because the tabs get too big
|
||||
|
||||
now implemented for [url=http://processing.org/discourse/yabb/YaBB.cgi?board=Collaboration;action=display;num=1084285917]megabucket[/url].
|
||||
|
||||
|
||||
Reference in New Issue
Block a user