fixing auto-indent and random sketchbook error

This commit is contained in:
benfry
2001-09-26 20:13:48 +00:00
parent 95d6da006d
commit 9c41ec940a
4 changed files with 57 additions and 21 deletions
+32 -16
View File
@@ -200,7 +200,7 @@ public class PdeEditor extends Panel implements PdeEnvironment {
"Open a PDE program...",
FileDialog.LOAD);
fd.setDirectory(lastDirectory);
fd.setFile(lastFile);
//fd.setFile(lastFile);
fd.show();
String directory = fd.getDirectory();
@@ -215,7 +215,7 @@ public class PdeEditor extends Panel implements PdeEnvironment {
FileInputStream input = new FileInputStream(file);
int length = (int) file.length();
byte data[] = new byte[length];
int count = 0;
while (count != length) {
data[count++] = (byte) input.read();
@@ -224,10 +224,11 @@ public class PdeEditor extends Panel implements PdeEnvironment {
// the defaults when you try to save again
lastDirectory = directory;
lastFile = filename;
// once read all the bytes, convert it to the proper
// local encoding for this system.
//textarea.setText(app.languageEncode(data));
// what the hell was i thinking when i wrote this code
if (app.encoding == null)
textarea.setText(new String(data));
else
@@ -244,21 +245,36 @@ public class PdeEditor extends Panel implements PdeEnvironment {
public void doSave() {
// true if lastfile not set, otherwise false, meaning no prompt
handleSave(lastFile == null);
}
public void doSaveAs() {
handleSave(true);
}
public void handleSave(boolean promptUser) {
message("Saving file...");
String s = textarea.getText();
FileDialog fd = new FileDialog(new Frame(),
"Save PDE program as...",
FileDialog.SAVE);
fd.setDirectory(lastDirectory);
fd.setFile(lastFile);
fd.show();
String directory = fd.getDirectory();
String filename = fd.getFile();
if (filename == null) {
message(EMPTY);
buttons.clear();
return; // user cancelled
String directory = lastDirectory;
String filename = lastFile;
if (promptUser) {
FileDialog fd = new FileDialog(new Frame(),
"Save PDE program as...",
FileDialog.SAVE);
fd.setDirectory(lastDirectory);
fd.setFile(lastFile);
fd.show();
directory = fd.getDirectory();
filename = fd.getFile();
if (filename == null) {
message(EMPTY);
buttons.clear();
return; // user cancelled
}
}
File file = new File(directory, filename);
+1 -1
View File
@@ -286,7 +286,7 @@ public class PdeEditorButtons extends Panel {
case CLOSE: editor.doClose(); break;
case OPEN: editor.doOpen(); break;
case SAVE: editor.doSave(); break;
case SAVE: editor.doSaveAs(); break;
case EXPORT: editor.doExport(); break;
case PRINT: editor.doPrint(); break;
case BEAUTIFY: editor.doBeautify(); break;
+4 -1
View File
@@ -112,7 +112,10 @@ public class PdeEditorListener extends KeyAdapter implements FocusListener {
String insertion = newline + spaces.substring(0, spaceCount);
int oldCarrot = tc.getSelectionStart();
tc.replaceRange(insertion, oldCarrot, tc.getSelectionEnd());
tc.setCaretPosition(oldCarrot + insertion.length() - 1);
// microsoft vm version:
//tc.setCaretPosition(oldCarrot + insertion.length() - 1);
// sun vm version:
tc.setCaretPosition(oldCarrot + insertion.length());
event.consume();
}
break;
+20 -3
View File
@@ -2,9 +2,10 @@ iprocessing todo list // last updated 17 september 2001
(most up-to-date version of this file is in processing cvs)
for 0008
_ getMillis() doesn't seem to work
for 0009
_ ability to include other code from sketchbook directory
_ stop required before kill for applets that use serial
_ this is behaving strangely
_ option to enable/disable frame
_ new objects draw behind old objects with noBackground()
_ enable/disable full screen leaves windows in back
@@ -13,10 +14,15 @@ _ breaks on every 2nd run when using serial apps (or others?)
_ try calling gc on stop as well
_ post new macintosh version
_ with serial port support
_ when applet window is too large to fit, center and put in back
_ add a note about editor.expandTabs,balanceParens,tabSize,autoIndent
_ also add note about paren balancing doing strange things
_ leave the others turned on, but parens off by default
PROCESSING - HIGH
_ when applet window is too large to fit, center and put in back
_ bug in paren balancing
_ getMillis() doesn't seem to work
_ shift-click on play for 'presentation mode'
_ does full screen and hides editor window
_ export doesn't work properly for stuff included from scrapbook
@@ -84,6 +90,10 @@ PROCESSING - FEATURES
_ anti-aliasing
_ alpha
_ regexps: http://javaregex.com/cgi-bin/pat/tutorial.asp
_ a better editor:
_ syntax coloring
_ emacs indents and key commands
_ http://mathsrv.ku-eichstaett.de/MGF/homes/grothmann/je/index.html
PROCESSING - LOWER
@@ -139,6 +149,12 @@ String binary(int value) {
---------------------------------------------
0008
X ctrl-s does 'save', button on toolbar does 'save as'
X fixed auto-indent bug for editor
X SimpleSerialDemo.pde had a bug (was old version)
0007
X serial bugs
X ability to control sleep time from simple
@@ -170,3 +186,4 @@ X put debugging stuff back into Kjc (i disabled some stuff)
0001
X convert documentation to html
o setup imrf linux machine?