From aa18a7498ade86669d3bf52d869487fa074204e9 Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Wed, 11 Jul 2007 15:39:43 +0000 Subject: [PATCH] Color to AColor svn: r6892 --- .../htdch/Examples/draw-multiple-worlds.ss | 8 +-- .../htdch/Examples/draw-world-close-canvas.ss | 6 +-- collects/htdch/colors/AColor.java | 3 ++ collects/htdch/colors/Black.java | 2 +- collects/htdch/colors/Blue.java | 2 +- collects/htdch/colors/Color.java | 3 -- collects/htdch/colors/Green.java | 2 +- collects/htdch/colors/Red.java | 2 +- collects/htdch/colors/White.java | 2 +- collects/htdch/colors/Yellow.java | 2 +- collects/htdch/colors/installer.ss | 2 +- collects/htdch/draw/Canvas.java | 16 +++--- collects/htdch/draw/support.scm | 51 ++++++++++--------- collects/htdch/idraw/Canvas.java | 16 +++--- collects/htdch/idraw/installer.ss | 2 +- 15 files changed, 60 insertions(+), 59 deletions(-) create mode 100644 collects/htdch/colors/AColor.java delete mode 100644 collects/htdch/colors/Color.java diff --git a/collects/htdch/Examples/draw-multiple-worlds.ss b/collects/htdch/Examples/draw-multiple-worlds.ss index d1fdcd4da5..dcaecd71d4 100644 --- a/collects/htdch/Examples/draw-multiple-worlds.ss +++ b/collects/htdch/Examples/draw-multiple-worlds.ss @@ -6,16 +6,16 @@ class SW extends World { int x = 50; int y; int low; - Color c; - Color white = new White(); + AColor c; + AColor white = new White(); - SW(int y, int low, Color c) { this.y = y; this.low = low; this.c = c; } + SW(int y, int low, AColor c) { this.y = y; this.low = low; this.c = c; } boolean go() { return this.bigBang(100,100,.1); } World onTick() { if (y >= low) - return endOfWorld(); + return endOfWorld("the end"); else return new SW(this.y+1,this.low,this.c); } diff --git a/collects/htdch/Examples/draw-world-close-canvas.ss b/collects/htdch/Examples/draw-world-close-canvas.ss index d8ef26e91b..2558cbde4f 100644 --- a/collects/htdch/Examples/draw-world-close-canvas.ss +++ b/collects/htdch/Examples/draw-world-close-canvas.ss @@ -10,8 +10,8 @@ import geometry.*; class SW extends World { int x = 50; int y; - Color red = new Red(); - Color white = new White(); + AColor red = new Red(); + AColor white = new White(); SW(int v) { y = v; } @@ -21,7 +21,7 @@ class SW extends World { World onKeyEvent(String ke) { if (ke.equals("s")) - return this.endOfWorld(); + return this.endOfWorld("the end"); else if (ke.equals("*")) return new SW(99); else diff --git a/collects/htdch/colors/AColor.java b/collects/htdch/colors/AColor.java new file mode 100644 index 0000000000..a7383e26f4 --- /dev/null +++ b/collects/htdch/colors/AColor.java @@ -0,0 +1,3 @@ +package colors; + +public abstract class AColor { } diff --git a/collects/htdch/colors/Black.java b/collects/htdch/colors/Black.java index 3bfd25a216..6ebbd360a2 100644 --- a/collects/htdch/colors/Black.java +++ b/collects/htdch/colors/Black.java @@ -1,3 +1,3 @@ package colors; -public class Black extends Color { } +public class Black extends AColor { } diff --git a/collects/htdch/colors/Blue.java b/collects/htdch/colors/Blue.java index 2d3302ba31..af5806748a 100644 --- a/collects/htdch/colors/Blue.java +++ b/collects/htdch/colors/Blue.java @@ -1,3 +1,3 @@ package colors; -public class Blue extends Color { } +public class Blue extends AColor { } diff --git a/collects/htdch/colors/Color.java b/collects/htdch/colors/Color.java deleted file mode 100644 index bcb8dbf0cc..0000000000 --- a/collects/htdch/colors/Color.java +++ /dev/null @@ -1,3 +0,0 @@ -package colors; - -public abstract class Color { } diff --git a/collects/htdch/colors/Green.java b/collects/htdch/colors/Green.java index 4c43747a2d..5b893c20d3 100644 --- a/collects/htdch/colors/Green.java +++ b/collects/htdch/colors/Green.java @@ -1,3 +1,3 @@ package colors; -public class Green extends Color { } +public class Green extends AColor { } diff --git a/collects/htdch/colors/Red.java b/collects/htdch/colors/Red.java index f07f33ef9f..bb2f68b37d 100644 --- a/collects/htdch/colors/Red.java +++ b/collects/htdch/colors/Red.java @@ -1,3 +1,3 @@ package colors; -public class Red extends Color { } +public class Red extends AColor { } diff --git a/collects/htdch/colors/White.java b/collects/htdch/colors/White.java index 78723c7d15..bda629cf06 100644 --- a/collects/htdch/colors/White.java +++ b/collects/htdch/colors/White.java @@ -1,3 +1,3 @@ package colors; -public class White extends Color { } +public class White extends AColor { } diff --git a/collects/htdch/colors/Yellow.java b/collects/htdch/colors/Yellow.java index 01e0282e3a..cf33ecb150 100644 --- a/collects/htdch/colors/Yellow.java +++ b/collects/htdch/colors/Yellow.java @@ -1,3 +1,3 @@ package colors; -public class Yellow extends Color { } +public class Yellow extends AColor { } diff --git a/collects/htdch/colors/installer.ss b/collects/htdch/colors/installer.ss index f94ef2c8d2..16b69b754f 100644 --- a/collects/htdch/colors/installer.ss +++ b/collects/htdch/colors/installer.ss @@ -14,7 +14,7 @@ (compile-java 'file 'file 'full (build-path draw-path file) #f #f))))) - (javac "Color.java") + (javac "AColor.java") (javac "Red.java") (javac "White.java") (javac "Blue.java") diff --git a/collects/htdch/draw/Canvas.java b/collects/htdch/draw/Canvas.java index d35fdbf7e4..c1511384c1 100644 --- a/collects/htdch/draw/Canvas.java +++ b/collects/htdch/draw/Canvas.java @@ -34,13 +34,13 @@ public class Canvas { public native boolean xshow(); public native boolean xclose(); - public native boolean drawCircle(Posn p, int r, Color c); - public native boolean drawDisk(Posn p, int r, Color c); - public native boolean drawRect(Posn p, int width, int height, Color c); - public native boolean drawLine(Posn p0, Posn p1, Color c); + public native boolean drawCircle(Posn p, int r, AColor c); + public native boolean drawDisk(Posn p, int r, AColor c); + public native boolean drawRect(Posn p, int width, int height, AColor c); + public native boolean drawLine(Posn p0, Posn p1, AColor c); public native boolean drawString(Posn p, String s); - public native boolean clearCircle(Posn p, int r, Color c); - public native boolean clearDisk(Posn p, int r, Color c); - public native boolean clearRect(Posn p, int width, int height, Color c); - public native boolean clearLine(Posn p0, Posn p1, Color c); + public native boolean clearCircle(Posn p, int r, AColor c); + public native boolean clearDisk(Posn p, int r, AColor c); + public native boolean clearRect(Posn p, int width, int height, AColor c); + public native boolean clearLine(Posn p0, Posn p1, AColor c); } diff --git a/collects/htdch/draw/support.scm b/collects/htdch/draw/support.scm index e741e7e890..428b2b7149 100644 --- a/collects/htdch/draw/support.scm +++ b/collects/htdch/draw/support.scm @@ -21,15 +21,15 @@ xclose-native stop-native copy-native - drawCircle-geometry.Posn-int-colors.Color-native - drawDisk-geometry.Posn-int-colors.Color-native - drawRect-geometry.Posn-int-int-colors.Color-native - drawLine-geometry.Posn-geometry.Posn-colors.Color-native + drawCircle-geometry.Posn-int-colors.AColor-native + drawDisk-geometry.Posn-int-colors.AColor-native + drawRect-geometry.Posn-int-int-colors.AColor-native + drawLine-geometry.Posn-geometry.Posn-colors.AColor-native drawString-geometry.Posn-java.lang.String-native - clearCircle-geometry.Posn-int-colors.Color-native - clearDisk-geometry.Posn-int-colors.Color-native - clearRect-geometry.Posn-int-int-colors.Color-native - clearLine-geometry.Posn-geometry.Posn-colors.Color-native)) + clearCircle-geometry.Posn-int-colors.AColor-native + clearDisk-geometry.Posn-int-colors.AColor-native + clearRect-geometry.Posn-int-int-colors.AColor-native + clearLine-geometry.Posn-geometry.Posn-colors.AColor-native)) (define-signature support^ (void-or-true imperative)) @@ -120,23 +120,23 @@ (define (copy-native this accs gets privates) (wrap-start-check ([hash-table-get privates 'copy]))) - (define (drawCircle-geometry.Posn-int-colors.Color-native this accs gets privates posn r c) + (define (drawCircle-geometry.Posn-int-colors.AColor-native this accs gets privates posn r c) (wrap-start-check - (check-arg r "drawCircle(Posn, int, Color)" "second") + (check-arg r "drawCircle(Posn, int, AColor)" "second") ([hash-table-get privates '%draw-circle] (build-posn posn) r (color->symbol c)))) - (define (drawDisk-geometry.Posn-int-colors.Color-native this accs gets privates posn r c) + (define (drawDisk-geometry.Posn-int-colors.AColor-native this accs gets privates posn r c) (wrap-start-check - (check-arg r "drawDisk(Posn, int, Color)" "second") + (check-arg r "drawDisk(Posn, int, AColor)" "second") ([hash-table-get privates '%draw-solid-disk] (build-posn posn) r (color->symbol c)))) - (define (drawRect-geometry.Posn-int-int-colors.Color-native this accs gets privates posn w h c) + (define (drawRect-geometry.Posn-int-int-colors.AColor-native this accs gets privates posn w h c) (wrap-start-check - (check-arg w "drawRect(Posn, int, int, Color)" "second") - (check-arg h "drawRect(Posn, int, int, Color)" "third") + (check-arg w "drawRect(Posn, int, int, AColor)" "second") + (check-arg h "drawRect(Posn, int, int, AColor)" "third") ([hash-table-get privates '%draw-solid-rect] (build-posn posn) w h (color->symbol c)))) - (define (drawLine-geometry.Posn-geometry.Posn-colors.Color-native this accs gets privates p0 p1 c) + (define (drawLine-geometry.Posn-geometry.Posn-colors.AColor-native this accs gets privates p0 p1 c) (wrap-start-check ([hash-table-get privates '%draw-solid-line] (build-posn p0) (build-posn p1) (color->symbol c)))) @@ -146,23 +146,23 @@ (wrap-start-check ([hash-table-get privates '%draw-string] (build-posn p) s*))) - (define (clearCircle-geometry.Posn-int-colors.Color-native this accs gets privates p r c) + (define (clearCircle-geometry.Posn-int-colors.AColor-native this accs gets privates p r c) (wrap-start-check - (check-arg r "clearCircle(Posn, int, Color)" "second") + (check-arg r "clearCircle(Posn, int, AColor)" "second") ([hash-table-get privates '%clear-circle] (build-posn p) r (color->symbol c)))) - (define (clearDisk-geometry.Posn-int-colors.Color-native this accs gets privates p r c) + (define (clearDisk-geometry.Posn-int-colors.AColor-native this accs gets privates p r c) (wrap-start-check - (check-arg r "clearDisk(Posn, int, Color)" "second") + (check-arg r "clearDisk(Posn, int, AColor)" "second") ([hash-table-get privates '%clear-solid-disk] (build-posn p) r (color->symbol c)))) - (define (clearRect-geometry.Posn-int-int-colors.Color-native this accs gets privates p w h c) + (define (clearRect-geometry.Posn-int-int-colors.AColor-native this accs gets privates p w h c) (wrap-start-check - (check-arg w "clearRect(Posn, int, int, Color)" "second") - (check-arg h "clearRect(Posn, int, int, Color)" "third") + (check-arg w "clearRect(Posn, int, int, AColor)" "second") + (check-arg h "clearRect(Posn, int, int, AColor)" "third") ([hash-table-get privates '%clear-solid-rect] (build-posn p) w h (color->symbol c)))) - (define (clearLine-geometry.Posn-geometry.Posn-colors.Color-native this accs gets privates p0 p1 c) + (define (clearLine-geometry.Posn-geometry.Posn-colors.AColor-native this accs gets privates p0 p1 c) (wrap-start-check ([hash-table-get privates '%clear-solid-line] (build-posn p0) (build-posn p1) (color->symbol c)))) ) @@ -209,7 +209,8 @@ (define (endOfWorld-java.lang.String-native this accs gets privates s) (define theCanvas ((hash-table-get accs 'theCanvas) this)) (define _ (check-string s "endOfWorld(String)" "first")) - (message-box "end of world" (send s get-mzscheme-string)) + (parameterize ([current-eventspace (make-eventspace)]) + (message-box "end of world" (send s get-mzscheme-string))) (send theCanvas stop) this)) ) diff --git a/collects/htdch/idraw/Canvas.java b/collects/htdch/idraw/Canvas.java index db23189c90..6eacd037ee 100644 --- a/collects/htdch/idraw/Canvas.java +++ b/collects/htdch/idraw/Canvas.java @@ -35,13 +35,13 @@ public class Canvas { public native void xshow(); public native void xclose(); - public native void drawCircle(Posn p, int r, Color c); - public native void drawDisk(Posn p, int r, Color c); - public native void drawRect(Posn p, int width, int height, Color c); - public native void drawLine(Posn p0, Posn p1, Color c); + public native void drawCircle(Posn p, int r, AColor c); + public native void drawDisk(Posn p, int r, AColor c); + public native void drawRect(Posn p, int width, int height, AColor c); + public native void drawLine(Posn p0, Posn p1, AColor c); public native void drawString(Posn p, String s); - public native void clearCircle(Posn p, int r, Color c); - public native void clearDisk(Posn p, int r, Color c); - public native void clearRect(Posn p, int width, int height, Color c); - public native void clearLine(Posn p0, Posn p1, Color c); + public native void clearCircle(Posn p, int r, AColor c); + public native void clearDisk(Posn p, int r, AColor c); + public native void clearRect(Posn p, int width, int height, AColor c); + public native void clearLine(Posn p0, Posn p1, AColor c); } diff --git a/collects/htdch/idraw/installer.ss b/collects/htdch/idraw/installer.ss index 79e18091af..3ca74e14da 100644 --- a/collects/htdch/idraw/installer.ss +++ b/collects/htdch/idraw/installer.ss @@ -15,7 +15,7 @@ (javac "World.java") #| (javac "Posn.java") - (javac "Color.java") + (javac "AColor.java") (javac "Red.java") (javac "White.java") (javac "Blue.java")