mirror of
https://github.com/processing/processing4.git
synced 2026-02-12 18:10:43 +01:00
minor cleanups and support for saving prefs whenever a new sketch opens
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
/*
|
||||
Part of the Processing project - http://processing.org
|
||||
|
||||
Copyright (c) 2004-07 Ben Fry and Casey Reas
|
||||
Copyright (c) 2004-08 Ben Fry and Casey Reas
|
||||
Copyright (c) 2001-04 Massachusetts Institute of Technology
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -395,64 +395,6 @@ public class Base {
|
||||
// .................................................................
|
||||
|
||||
|
||||
/*
|
||||
public void handleNew(boolean shiftDown) {
|
||||
// buttons.activate(EditorButtons.NEW);
|
||||
|
||||
boolean prompt = Preferences.getBoolean("sketchbook.prompt");
|
||||
if (shiftDown) prompt = !prompt; // reverse behavior if shift is down
|
||||
|
||||
// no sketch has been started, don't prompt for the name if it's
|
||||
// starting up, just make the farker. otherwise if the person hits
|
||||
// 'cancel' i'd have to add a thing to make p5 quit, which is silly.
|
||||
// instead give them an empty sketch, and they can look at examples.
|
||||
// i hate it when imovie makes you start with that goofy dialog box.
|
||||
// unless, ermm, they user tested it and people preferred that as
|
||||
// a way to get started. shite. now i hate myself.
|
||||
//if (disablePrompt) prompt = false;
|
||||
|
||||
try {
|
||||
if (prompt) {
|
||||
handleNewPrompt(activeEditor);
|
||||
} else {
|
||||
handleNewUntitled();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void handleNewPrompt(JFrame parent) throws IOException {
|
||||
File newbieDir = null;
|
||||
String newbieName = null;
|
||||
|
||||
// prompt for the filename and location for the new sketch
|
||||
FileDialog fd = new FileDialog(parent,
|
||||
"Create sketch folder named:",
|
||||
FileDialog.SAVE);
|
||||
//fd.setDirectory(getSketchbookPath());
|
||||
fd.setVisible(true);
|
||||
|
||||
String newbieParentDir = fd.getDirectory();
|
||||
newbieName = fd.getFile();
|
||||
if (newbieName != null) {
|
||||
newbieName = Sketch.sanitizeName(newbieName);
|
||||
newbieDir = new File(newbieParentDir, newbieName);
|
||||
|
||||
// Make the directory for the new sketch
|
||||
newbieDir.mkdirs();
|
||||
|
||||
// Make an empty pde file
|
||||
File newbieFile = new File(newbieDir, newbieName + ".pde");
|
||||
new FileOutputStream(newbieFile); // create the file
|
||||
|
||||
handleOpen(newbieFile.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Handle creating a sketch folder, return its base .pde file
|
||||
* or null if the operation was canceled.
|
||||
|
||||
@@ -1503,16 +1503,17 @@ public class Editor extends JFrame {
|
||||
}
|
||||
|
||||
sketch = new Sketch(this, path);
|
||||
header.rebuild();
|
||||
// TODO remove this, it's a moot point for separate windows
|
||||
if (Preferences.getBoolean("console.auto_clear")) {
|
||||
console.clear();
|
||||
}
|
||||
header.rebuild();
|
||||
// Set the title of the window to "sketch_070752a - Processing 0126"
|
||||
setTitle(sketch.name + " | " + WINDOW_TITLE);
|
||||
// Disable untitled setting from previous document, if any
|
||||
untitled = false;
|
||||
|
||||
// Store information on who's open and running
|
||||
// (in case there's a crash or something that can't be recovered)
|
||||
base.storeSketches();
|
||||
Preferences.save();
|
||||
|
||||
// opening was successful
|
||||
return true;
|
||||
|
||||
|
||||
@@ -624,6 +624,11 @@ public class Preferences {
|
||||
|
||||
static public void save() {
|
||||
try {
|
||||
// on startup, don't worry about it
|
||||
// this is trying to update the prefs for who is open
|
||||
// before Preferences.init() has been called.
|
||||
if (preferencesFile == null) return;
|
||||
|
||||
FileOutputStream output = new FileOutputStream(preferencesFile);
|
||||
PrintWriter writer = new PrintWriter(new OutputStreamWriter(output));
|
||||
|
||||
|
||||
@@ -191,13 +191,10 @@ public class PdePreprocessor {
|
||||
|
||||
// if the program ends with no CR or LF an OutOfMemoryError will happen.
|
||||
// not gonna track down the bug now, so here's a hack for it:
|
||||
// bug filed at http://dev.processing.org/bugs/show_bug.cgi?id=5
|
||||
//if ((program.length() > 0) &&
|
||||
//program.charAt(program.length()-1) != '\n') {
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=5
|
||||
program += "\n";
|
||||
//}
|
||||
|
||||
// if the program ends with an unterminated multiline comment,
|
||||
// if the program ends with an unterminated multi-line comment,
|
||||
// an OutOfMemoryError or NullPointerException will happen.
|
||||
// again, not gonna bother tracking this down, but here's a hack.
|
||||
// http://dev.processing.org/bugs/show_bug.cgi?id=16
|
||||
|
||||
18
todo.txt
18
todo.txt
@@ -16,8 +16,15 @@ o change the arrays of default imports (now using 1.5+, so no 1.1,1.3,1.4)
|
||||
X don't bother, they're cumulative
|
||||
X improvements to the linux startup script
|
||||
X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=os_core_pde;action=display;num=1202689238
|
||||
X update preferences.txt whenever opening/closing
|
||||
X otherwise recovery from restart can be annoying
|
||||
|
||||
_ two-tiered dialogs for everything - use osx style throughout
|
||||
_ sometimes not launching
|
||||
_ (in particular while cpu load is a little higher on g5?)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=775
|
||||
_ this may just be a macosx (ppc?) bug
|
||||
|
||||
_ two-tiered dialogs for everything - use big font/little font style throughout
|
||||
|
||||
_ disallow .java tabs with same name as the sketch
|
||||
_ a .java tab with same name as the sketch is allowed (oog!)
|
||||
@@ -40,9 +47,6 @@ _ include a note that 'applet' folder will get emptied/rewritten
|
||||
_ or rename the old applet folder to something else? (too messy)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=61
|
||||
|
||||
_ update preferences.txt whenever opening/closing
|
||||
_ otherwise recovery from restart can be annoying
|
||||
|
||||
_ make.sh creating work/lib dirs.. no longer necessary?
|
||||
_ don't copy hidden files (.svn especially) on export/save as
|
||||
|
||||
@@ -124,11 +128,6 @@ _ pdf not rendering unicode (though it renders to screen)
|
||||
_ try updating to newer itext
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=727
|
||||
|
||||
_ sometimes not launching
|
||||
_ (in particular while cpu load is a little higher on g5?)
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=775
|
||||
_ this may just be a macosx (ppc?) bug
|
||||
|
||||
_ implement windows registry lookups via reflection
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=723
|
||||
_ or move to jna for registry?
|
||||
@@ -713,7 +712,6 @@ _ non-matching curly brackets sometimes don't cause an error
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=507
|
||||
_ syntax highlighting error with // and /*
|
||||
_ http://dev.processing.org/bugs/show_bug.cgi?id=609
|
||||
|
||||
_ "missing a /* from the end of a comment" message
|
||||
_ enter a bug for this, it's bound to be found
|
||||
_ "multipart/*" produces the error
|
||||
|
||||
Reference in New Issue
Block a user