mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 21:59:20 +01:00
bug fixes
X fill(#ffcc00) wasn't working for rect, calci not being set 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
This commit is contained in:
@@ -226,57 +226,106 @@ public class KjcEngine extends PdeEngine {
|
||||
if (programType == BEGINNER) {
|
||||
if (!kjc) writer.println();
|
||||
|
||||
// first determine the size of the program
|
||||
PatternMatcher matcher = new Perl5Matcher();
|
||||
PatternCompiler compiler = new Perl5Compiler();
|
||||
// hack so that the regexp below works
|
||||
//if (program.indexOf("size(") == 0) program = " " + program;
|
||||
if ((program.indexOf("size(") == 0) ||
|
||||
(program.indexOf("background(") == 0)) {
|
||||
program = " " + program;
|
||||
}
|
||||
|
||||
|
||||
PatternMatcher matcher = null;
|
||||
PatternCompiler compiler = null;
|
||||
Pattern pattern = null;
|
||||
Perl5Substitution subst = null;
|
||||
PatternMatcherInput input = null;
|
||||
|
||||
|
||||
///////// grab (first) reference to size()
|
||||
|
||||
|
||||
// hack so that the regexp below works
|
||||
if (program.indexOf("size(") == 0) program = " " + program;
|
||||
|
||||
matcher = new Perl5Matcher();
|
||||
compiler = new Perl5Compiler();
|
||||
try {
|
||||
pattern =
|
||||
compiler.compile("^([^A-Za-z0-9_]+)(size\\(\\s*\\d+,\\s*\\d+\\s*\\);)");
|
||||
|
||||
} catch (MalformedPatternException e){
|
||||
System.err.println("Bad pattern.");
|
||||
System.err.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
//System.err.println("Bad pattern.");
|
||||
//System.err.println(e.getMessage());
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
//PatternMatcher matcher = new Perl5Matcher();
|
||||
String sizeInfo = "";
|
||||
PatternMatcherInput input =
|
||||
new PatternMatcherInput(program);
|
||||
String sizeInfo = null;
|
||||
input = new PatternMatcherInput(program);
|
||||
if (matcher.contains(input, pattern)) {
|
||||
MatchResult result = matcher.getMatch();
|
||||
//int wide = Integer.parseInt(result.group(1).toString());
|
||||
//int high = Integer.parseInt(result.group(2).toString());
|
||||
sizeInfo = "void setup() { " + result.group(0) + " } ";
|
||||
//sizeInfo = result.group(0);
|
||||
//sizeInfo = "void setup() { " + result.group(0) + " } ";
|
||||
sizeInfo = result.group(0);
|
||||
|
||||
} else {
|
||||
// no size() defined, make it 100x100
|
||||
// no size() defined, make it default
|
||||
sizeInfo = "size(" + BApplet.DEFAULT_WIDTH + ", " +
|
||||
BApplet.DEFAULT_HEIGHT + "); ";
|
||||
}
|
||||
|
||||
|
||||
// grab (first) reference to background()
|
||||
|
||||
|
||||
// remove references to size()
|
||||
// this winds up removing every reference to size()
|
||||
// not really intended, but will help things work
|
||||
Perl5Substitution subst =
|
||||
new Perl5Substitution("$1", Perl5Substitution.INTERPOLATE_ALL);
|
||||
|
||||
subst = new Perl5Substitution("$1", Perl5Substitution.INTERPOLATE_ALL);
|
||||
program = Util.substitute(matcher, pattern, subst, program,
|
||||
Util.SUBSTITUTE_ALL);
|
||||
//System.out.println(program);
|
||||
|
||||
|
||||
/////////// grab (first) reference to background()
|
||||
|
||||
matcher = new Perl5Matcher();
|
||||
compiler = new Perl5Compiler();
|
||||
try {
|
||||
pattern =
|
||||
compiler.compile("^([^A-Za-z0-9_]+)(background\\(.*\\);)");
|
||||
|
||||
} catch (MalformedPatternException e){
|
||||
//System.err.println("Bad pattern.");
|
||||
//System.err.println(e.getMessage());
|
||||
e.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
String backgroundInfo = "";
|
||||
input = new PatternMatcherInput(program);
|
||||
if (matcher.contains(input, pattern)) {
|
||||
MatchResult result = matcher.getMatch();
|
||||
//int wide = Integer.parseInt(result.group(1).toString());
|
||||
//int high = Integer.parseInt(result.group(2).toString());
|
||||
//sizeInfo = "void setup() { " + result.group(0) + " } ";
|
||||
backgroundInfo = result.group(0);
|
||||
|
||||
//} else {
|
||||
// no size() defined, make it default
|
||||
//sizeInfo = "size(" + BApplet.DEFAULT_WIDTH + ", " +
|
||||
//BApplet.DEFAULT_HEIGHT + "); ";
|
||||
}
|
||||
|
||||
// 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);
|
||||
program = Util.substitute(matcher, pattern, subst, program,
|
||||
Util.SUBSTITUTE_ALL);
|
||||
|
||||
|
||||
//////// spew out the size and background info
|
||||
|
||||
writer.print("void setup() { ");
|
||||
writer.print(sizeInfo);
|
||||
writer.print(backgroundInfo);
|
||||
writer.print("} ");
|
||||
writer.print("void draw() {");
|
||||
}
|
||||
|
||||
|
||||
@@ -1076,7 +1076,8 @@ public class PdeEditor extends Panel {
|
||||
}
|
||||
|
||||
// files to include
|
||||
if (dataDir != null) {
|
||||
//if (dataDir != null) {
|
||||
if ((dataDir != null) && (dataDir.exists())) {
|
||||
String datafiles[] = dataDir.list();
|
||||
for (int i = 0; i < datafiles.length; i++) {
|
||||
if (datafiles[i].equals(".") || datafiles[i].equals("..")) {
|
||||
|
||||
@@ -47,10 +47,8 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
int imageW, imageH;
|
||||
|
||||
|
||||
public PdeEditorHeader(PdeEditor editor /*, String sketch, String user*/) {
|
||||
this.editor = editor;
|
||||
//this.sketch = sketch;
|
||||
//this.user = user;
|
||||
public PdeEditorHeader(PdeEditor eddie) {
|
||||
this.editor = eddie; // weird name for listener
|
||||
|
||||
if (primaryColor == null) {
|
||||
backgroundColor = PdeBase.getColor("editor.header.bgcolor",
|
||||
@@ -60,6 +58,16 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
secondaryColor = PdeBase.getColor("editor.header.fgcolor.secondary",
|
||||
new Color(153, 153, 153));
|
||||
}
|
||||
|
||||
addMouseListener(new MouseAdapter() {
|
||||
public void mousePressed(MouseEvent e) {
|
||||
//System.out.println("got mouse");
|
||||
if ((sketchRight != 0) &&
|
||||
(e.getX() > sketchLeft) && (e.getX() < sketchRight)) {
|
||||
editor.skSaveAs();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +141,10 @@ public class PdeEditorHeader extends Panel /* implements ActionListener*/ {
|
||||
sketchTitleLeft = PdeEditor.INSET_SIZE;
|
||||
sketchLeft = sketchTitleLeft +
|
||||
metrics.stringWidth(SKETCH_TITLER) + PdeEditor.INSET_SIZE;
|
||||
|
||||
int modifiedLeft = sketchLeft +
|
||||
metrics.stringWidth(editor.sketchName) + PdeEditor.INSET_SIZE;
|
||||
sketchRight = sketchLeft + metrics.stringWidth(editor.sketchName);
|
||||
int modifiedLeft = sketchLeft + PdeEditor.INSET_SIZE;
|
||||
//int modifiedLeft = sketchLeft +
|
||||
//metrics.stringWidth(editor.sketchName) + PdeEditor.INSET_SIZE;
|
||||
|
||||
//sketch = editor.sketchName;
|
||||
//if (sketch == null) sketch = "";
|
||||
|
||||
4
done.txt
4
done.txt
@@ -1,3 +1,7 @@
|
||||
0040
|
||||
X fix problem with pde.properties
|
||||
|
||||
|
||||
0039
|
||||
X left PdeBase out of the run.bat in windows.. piss me.
|
||||
X need comprehensive set of tests for 'f' substitution scenarios
|
||||
|
||||
17
todo.txt
17
todo.txt
@@ -1,24 +1,23 @@
|
||||
0040
|
||||
X fix problem with pde.properties
|
||||
0041
|
||||
X fill(#ffcc00) wasn't working for rect, calci not being set
|
||||
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
|
||||
|
||||
|
||||
pde
|
||||
a _ move background() out of draw() for draw mode apps
|
||||
a _ click on project name to quickly go to rename mode
|
||||
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?
|
||||
a _ make win/linux write stderr to stderr.txt like the mac
|
||||
a _ this will be useful until i implement scrollbar
|
||||
|
||||
macosx
|
||||
a _ arrow keys don't work in the textarea
|
||||
|
||||
windows
|
||||
a _ splash screen.. check win95 book for simple code
|
||||
|
||||
web / docs
|
||||
a _ finish writing 'readme.txt'
|
||||
a _ change download/index.html to not describe dates but process
|
||||
|
||||
Reference in New Issue
Block a user