more tastiness towards 41

This commit is contained in:
benfry
2002-08-02 03:14:14 +00:00
parent dddd05742c
commit 2aa42e497a
5 changed files with 119 additions and 30 deletions
+9 -4
View File
@@ -248,7 +248,8 @@ public class KjcEngine extends PdeEngine {
compiler = new Perl5Compiler();
try {
pattern =
compiler.compile("^([^A-Za-z0-9_]+)(size\\(\\s*\\d+,\\s*\\d+\\s*\\);)");
compiler.compile("[\\s\\;](size\\(\\s*\\d+,\\s*\\d+\\s*\\);)");
//compiler.compile("^([^A-Za-z0-9_]+)(size\\(\\s*\\d+,\\s*\\d+\\s*\\);)");
} catch (MalformedPatternException e){
e.printStackTrace();
@@ -277,7 +278,8 @@ public class KjcEngine extends PdeEngine {
// this winds up removing every reference to size()
// not really intended, but will help things work
subst = new Perl5Substitution("$1", Perl5Substitution.INTERPOLATE_ALL);
subst = new Perl5Substitution("", Perl5Substitution.INTERPOLATE_ALL);
//subst = new Perl5Substitution("$1", Perl5Substitution.INTERPOLATE_ALL);
program = Util.substitute(matcher, pattern, subst, program,
Util.SUBSTITUTE_ALL);
@@ -288,7 +290,9 @@ public class KjcEngine extends PdeEngine {
compiler = new Perl5Compiler();
try {
pattern =
compiler.compile("^([^A-Za-z0-9_]+)(background\\(.*\\);)");
compiler.compile("[\\s\\;](background\\(.*\\);)");
//[\\s\\;]
//compiler.compile("([^A-Za-z0-9_]+)(background\\(.*\\);)");
} catch (MalformedPatternException e){
//System.err.println("Bad pattern.");
@@ -315,7 +319,8 @@ public class KjcEngine extends PdeEngine {
// remove references to size()
// this winds up removing every reference to size()
// not really intended, but will help things work
subst = new Perl5Substitution("$1", Perl5Substitution.INTERPOLATE_ALL);
subst = new Perl5Substitution("", Perl5Substitution.INTERPOLATE_ALL);
//subst = new Perl5Substitution("$1", Perl5Substitution.INTERPOLATE_ALL);
program = Util.substitute(matcher, pattern, subst, program,
Util.SUBSTITUTE_ALL);
+30
View File
@@ -105,6 +105,11 @@ public class PdeEditor extends Panel {
textarea.setFont(PdeBase.getFont("editor.program.font",
new Font("Monospaced",
Font.PLAIN, 12)));
textarea.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseMoved(MouseEvent e) {
frame.setCursor(Frame.CROSSHAIR_CURSOR);
}
});
rightPanel.add("Center", textarea);
Panel statusPanel = new Panel();
@@ -1174,6 +1179,31 @@ public class PdeEditor extends Panel {
protected void doQuit2() {
doStop();
// clear out projects that are empty
if (PdeBase.getBoolean("sketchbook.auto_clean", true)) {
String userPath = base.sketchbookPath + File.separator + userName;
File userFolder = new File(userPath);
if (userFolder.exists()) { // huh?
String entries[] = new File(userPath).list();
if (entries != null) {
for (int j = 0; j < entries.length; j++) {
if ((entries[j].equals(".")) ||
(entries[j].equals(".."))) continue;
File preyDir = new File(userPath, entries[j]);
File prey = new File(preyDir, entries[j] + ".pde");
if (prey.exists()) {
if (prey.length() == 0) {
//System.out.println("remove: " + prey);
removeDir(preyDir);
}
} else {
//System.out.println(prey + " doesn't exist.. weird");
}
}
}
}
}
// write sketch.properties
try {
FileOutputStream output = null;
+63 -3
View File
@@ -1,4 +1,5 @@
import java.awt.*;
import java.awt.event.*;
import java.io.*;
@@ -28,6 +29,7 @@ public class PdeEditorConsole extends Component {
String lines[];
boolean isError[];
int firstLine;
int scrollOffset;
byte cline[] = new byte[1024];
byte clength;
@@ -36,6 +38,12 @@ public class PdeEditorConsole extends Component {
Color bgColor;
Color fgColorErr;
Color fgColorOut;
Color scrollEnabledColor;
Color scrollDisabledColor;
int scrollLeft, scrollRight;
int scrollUpTop, scrollUpBottom;
int scrollDownTop, scrollDownBottom;
Font font;
FontMetrics metrics;
@@ -68,7 +76,11 @@ public class PdeEditorConsole extends Component {
systemOut = System.out;
systemErr = System.err;
if (PdeBase.getBoolean("editor.console.out.enabled", false)) {
// not text thing on macos
boolean tod = ((PdeBase.platform != PdeBase.MACOSX) &&
(PdeBase.platform != PdeBase.MACOS9));
if (PdeBase.getBoolean("editor.console.out.enabled", tod)) {
String outFileName =
PdeBase.get("editor.console.out.file", "lib/stdout.txt");
try {
@@ -78,7 +90,7 @@ public class PdeEditorConsole extends Component {
}
}
if (PdeBase.getBoolean("editor.console.err.enabled", false)) {
if (PdeBase.getBoolean("editor.console.err.enabled", tod)) {
String errFileName =
PdeBase.get("editor.console.err.file", "lib/stderr.txt");
try {
@@ -105,6 +117,25 @@ public class PdeEditorConsole extends Component {
isError[i] = false;
}
firstLine = 0;
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
int x = e.getX();
int y = e.getY();
if (!((x > scrollLeft) && (x < scrollRight)))
return;
if ((y > scrollUpTop) && (y < scrollUpBottom)) {
scrollOffset -= lineCount;
update();
} else if ((y > scrollDownTop) && (y < scrollDownBottom)) {
scrollOffset += lineCount;
if (scrollOffset > 0) scrollOffset = 0;
update();
}
}
});
}
@@ -127,6 +158,12 @@ public class PdeEditorConsole extends Component {
new Color(153, 153, 153));
fgColorErr = PdeBase.getColor("editor.console.fgcolor.error",
new Color(204, 51, 0));
scrollEnabledColor =
PdeBase.getColor("editor.console.scrollbox.color.enabled",
new Color(51, 51, 51));
scrollDisabledColor =
PdeBase.getColor("editor.console.scrollbox.color.disabled",
new Color(35, 35, 35));
screen.setFont(font);
metrics = screen.getFontMetrics();
ascent = metrics.getAscent();
@@ -178,12 +215,34 @@ public class PdeEditorConsole extends Component {
g.fillRect(0, 0, imageW, imageH);
for (int i = 0; i < lineCount; i++) {
int ii = (firstLine + i) % maxLineCount;
//int ii = (firstLine + i) % maxLineCount;
int ii = (firstLine + i) + scrollOffset;
while (ii < 0) ii += maxLineCount;
if (ii > maxLineCount) ii = ii % maxLineCount;
g.setColor(isError[ii] ? fgColorErr : fgColorOut);
//System.out.println(leading);
g.drawString(lines[ii], HINSET, VINSET + ascent + i*ascent);
}
final int SCROLL_INSET = 4;
final int SCROLL_SIZE = 12;
scrollRight = sizeW - SCROLL_INSET;
scrollLeft = scrollRight - SCROLL_SIZE;
scrollUpTop = SCROLL_INSET;
scrollUpBottom = scrollUpTop + SCROLL_SIZE;
scrollDownBottom = sizeH - SCROLL_INSET;
scrollDownTop = scrollDownBottom - SCROLL_SIZE;
g.setColor(scrollEnabledColor);
g.fillRect(scrollLeft, scrollUpTop, SCROLL_SIZE, SCROLL_SIZE);
g.setColor((scrollOffset != 0) ?
scrollEnabledColor : scrollDisabledColor);
g.fillRect(scrollLeft, scrollDownTop, SCROLL_SIZE, SCROLL_SIZE);
screen.drawImage(offscreen, 0, 0, null);
}
@@ -242,6 +301,7 @@ public class PdeEditorConsole extends Component {
firstLine = (firstLine + 1) % maxLineCount;
//systemOut.println((err ? "ERR: " : "OUT: ") + what);
systemOut.println(what);
scrollOffset = 0;
}
update();
}
+1 -1
View File
@@ -142,7 +142,7 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
sketchLeft = sketchTitleLeft +
metrics.stringWidth(SKETCH_TITLER) + PdeEditor.INSET_SIZE;
sketchRight = sketchLeft + metrics.stringWidth(editor.sketchName);
int modifiedLeft = sketchLeft + PdeEditor.INSET_SIZE;
int modifiedLeft = sketchRight + PdeEditor.INSET_SIZE;
//int modifiedLeft = sketchLeft +
//metrics.stringWidth(editor.sketchName) + PdeEditor.INSET_SIZE;
+16 -22
View File
@@ -4,16 +4,23 @@ X also affected background and stroke
X export was failing if no data dir
X move background() out of draw() for draw mode apps
X click on project name to quickly go to rename mode
X cursor goes away during edits (java bug, fix with hack)
X handling of key/mouse events smoothed out
X removed 'briefly' versions of mouse/key
X make scrollbar for console
X make win/linux write stderr to stderr.txt like the mac
X this will be useful until i implement scrollbar
X -> this might be problematic, watch out for lockups
X remove projects if created but nothing happens to them
X maybe do this on open or quit?
X first a syntax error, when fixed, causes NullPointerException 
X quitting the app makes things all better. argh.
X this just started with version37, it happens extrememely
X frequently and should be easy to reproduce the error
pde
a _ make win/linux write stderr to stderr.txt like the mac
a _ this will be useful until i implement scrollbar
a _ make scrollbar for console
a _ remove projects if created but nothing happens to them
a _ see if play being highlighted can be implemented again
a _ especially important because of speed issues
a _ text editor? jedit's textarea class? hmm? hmm?
macosx
a _ arrow keys don't work in the textarea
@@ -46,22 +53,6 @@ vertex(80, 20);
vertex(90, 75);
endShape();
a _ first a syntax error, when fixed, causes NullPointerException 
a _ quitting the app makes things all better. argh.
a _ this just started with version37, it happens extrememely
a _ frequently and should be easy to reproduce the error
// problematic version
color rr = #FFCC00;
fill(255);
rect(20, 20, 50, 50);
fill(rr);
rect(50, 50, 50, 50);
// then fix the error and run again:
color rr = #FFCC00;
fill(255);
rect(20, 20, 50, 50);
fill(rr);
rect(50, 50, 50, 50);
////////////////////////////////////////////////////////////////////
@@ -213,6 +204,7 @@ _ fill, background, stroke all with int version for packed rgb
PDE / high
a _ text editor? jedit's textarea class? hmm? hmm?
b _ for 'java' mode, try run using external vm
b _ would need to get error output stream from app.. argh
b _ only allow under win/osx/linux
@@ -229,9 +221,11 @@ b _ see about setting up simple bug tracker/feature system
b _ queue for people reporting things externally
b _ bugzilla but simpler
b _ would also be nice for people to be able to vote on features
b _ save serial port on close
PDE / medium
b _ 'save as' from examples puts into examples dir.. :(
b _ option to delete current project (trickier)
b _ also needs to have method for verify.. blech
b _ beautify is broken