From 75b33996b10c1cef014c3d16cb752f84819e7f8f Mon Sep 17 00:00:00 2001 From: Matthias Felleisen Date: Sat, 20 Oct 2007 17:47:27 +0000 Subject: [PATCH] AColor went to IColor svn: r7541 --- collects/htdch/colors/AColor.java | 3 --- collects/htdch/colors/Black.java | 2 +- collects/htdch/colors/Blue.java | 2 +- collects/htdch/colors/Green.java | 2 +- collects/htdch/colors/IColor.java | 3 +++ 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 | 8 +++--- collects/htdch/draw/SillyCanvas.java | 8 +++--- collects/htdch/draw/support.scm | 40 ++++++++++++++-------------- collects/htdch/idraw/Canvas.java | 35 ++++++++++++------------ collects/htdch/idraw/installer.ss | 13 +-------- 14 files changed, 57 insertions(+), 67 deletions(-) delete mode 100644 collects/htdch/colors/AColor.java create mode 100644 collects/htdch/colors/IColor.java diff --git a/collects/htdch/colors/AColor.java b/collects/htdch/colors/AColor.java deleted file mode 100644 index a7383e26f4..0000000000 --- a/collects/htdch/colors/AColor.java +++ /dev/null @@ -1,3 +0,0 @@ -package colors; - -public abstract class AColor { } diff --git a/collects/htdch/colors/Black.java b/collects/htdch/colors/Black.java index 6ebbd360a2..6bebc6d158 100644 --- a/collects/htdch/colors/Black.java +++ b/collects/htdch/colors/Black.java @@ -1,3 +1,3 @@ package colors; -public class Black extends AColor { } +public class Black implements IColor { } diff --git a/collects/htdch/colors/Blue.java b/collects/htdch/colors/Blue.java index af5806748a..7c02859466 100644 --- a/collects/htdch/colors/Blue.java +++ b/collects/htdch/colors/Blue.java @@ -1,3 +1,3 @@ package colors; -public class Blue extends AColor { } +public class Blue implements IColor { } diff --git a/collects/htdch/colors/Green.java b/collects/htdch/colors/Green.java index 5b893c20d3..ee3137c7b0 100644 --- a/collects/htdch/colors/Green.java +++ b/collects/htdch/colors/Green.java @@ -1,3 +1,3 @@ package colors; -public class Green extends AColor { } +public class Green implements IColor { } diff --git a/collects/htdch/colors/IColor.java b/collects/htdch/colors/IColor.java new file mode 100644 index 0000000000..070bcdd3da --- /dev/null +++ b/collects/htdch/colors/IColor.java @@ -0,0 +1,3 @@ +package colors; + +public interface IColor { } diff --git a/collects/htdch/colors/Red.java b/collects/htdch/colors/Red.java index bb2f68b37d..d0b84c3fdd 100644 --- a/collects/htdch/colors/Red.java +++ b/collects/htdch/colors/Red.java @@ -1,3 +1,3 @@ package colors; -public class Red extends AColor { } +public class Red implements IColor { } diff --git a/collects/htdch/colors/White.java b/collects/htdch/colors/White.java index bda629cf06..b37f81e697 100644 --- a/collects/htdch/colors/White.java +++ b/collects/htdch/colors/White.java @@ -1,3 +1,3 @@ package colors; -public class White extends AColor { } +public class White implements IColor { } diff --git a/collects/htdch/colors/Yellow.java b/collects/htdch/colors/Yellow.java index cf33ecb150..6f82200a73 100644 --- a/collects/htdch/colors/Yellow.java +++ b/collects/htdch/colors/Yellow.java @@ -1,3 +1,3 @@ package colors; -public class Yellow extends AColor { } +public class Yellow implements IColor { } diff --git a/collects/htdch/colors/installer.ss b/collects/htdch/colors/installer.ss index 16b69b754f..2e2a5e575a 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 "AColor.java") + (javac "IColor.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 b7ce3cdf55..e7304d224d 100644 --- a/collects/htdch/draw/Canvas.java +++ b/collects/htdch/draw/Canvas.java @@ -60,7 +60,7 @@ public class Canvas { *@param c its outline color *@return true, if it can draw the circle into this canvas */ - public native boolean drawCircle(Posn p, int r, AColor c); + public native boolean drawCircle(Posn p, int r, IColor c); /** *@param p the center of the disk @@ -68,7 +68,7 @@ public class Canvas { *@param c its fill and outline color *@return true, if it can draw the disk into this canvas */ - public native boolean drawDisk(Posn p, int r, AColor c); + public native boolean drawDisk(Posn p, int r, IColor c); /** *@param p the upper left of the rectangle @@ -77,7 +77,7 @@ public class Canvas { *@param c its outline color *@return true, if it can draw the rectangle into this canvas */ - public native boolean drawRect(Posn p, int width, int height, AColor c); + public native boolean drawRect(Posn p, int width, int height, IColor c); /** *@param p0 the first point on the line @@ -85,7 +85,7 @@ public class Canvas { *@param c its color *@return true, if it can draw the line into this canvas */ - public native boolean drawLine(Posn p0, Posn p1, AColor c); + public native boolean drawLine(Posn p0, Posn p1, IColor c); /** *@param p the position of the baseline of the string diff --git a/collects/htdch/draw/SillyCanvas.java b/collects/htdch/draw/SillyCanvas.java index 6ac73113b8..29776b8b3d 100644 --- a/collects/htdch/draw/SillyCanvas.java +++ b/collects/htdch/draw/SillyCanvas.java @@ -17,19 +17,19 @@ public class SillyCanvas extends Canvas { throw new RuntimeException("SillyCanvas: bad size"); } - public boolean drawCircle(Posn p, int r, AColor c) { + public boolean drawCircle(Posn p, int r, IColor c) { return super.drawCircle(p,r,c) && warning(); } - public boolean drawDisk(Posn p, int r, AColor c) { + public boolean drawDisk(Posn p, int r, IColor c) { return super.drawDisk(p,r,c) && warning(); } - public boolean drawRect(Posn p, int width, int height, AColor c) { + public boolean drawRect(Posn p, int width, int height, IColor c) { return super.drawRect(p,width,height,c) && warning(); } - public boolean drawLine(Posn p0, Posn p1, AColor c) { + public boolean drawLine(Posn p0, Posn p1, IColor c) { return super.drawLine(p0,p1,c) && warning(); } diff --git a/collects/htdch/draw/support.scm b/collects/htdch/draw/support.scm index 656b25a6dd..a2cc705975 100644 --- a/collects/htdch/draw/support.scm +++ b/collects/htdch/draw/support.scm @@ -21,10 +21,10 @@ xclose-native stop-native copy-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 + drawCircle-geometry.Posn-int-colors.IColor-native + drawDisk-geometry.Posn-int-colors.IColor-native + drawRect-geometry.Posn-int-int-colors.IColor-native + drawLine-geometry.Posn-geometry.Posn-colors.IColor-native drawString-geometry.Posn-java.lang.String-native )) @@ -117,23 +117,23 @@ (define (copy-native this accs gets privates) (wrap-start-check ([hash-table-get privates 'copy]))) - (define (drawCircle-geometry.Posn-int-colors.AColor-native this accs gets privates posn r c) + (define (drawCircle-geometry.Posn-int-colors.IColor-native this accs gets privates posn r c) (wrap-start-check - (check-arg r "drawCircle(Posn, int, AColor)" "second") + (check-arg r "drawCircle(Posn, int, IColor)" "second") ([hash-table-get privates '%draw-circle] (build-posn posn) r (color->symbol c)))) - (define (drawDisk-geometry.Posn-int-colors.AColor-native this accs gets privates posn r c) + (define (drawDisk-geometry.Posn-int-colors.IColor-native this accs gets privates posn r c) (wrap-start-check - (check-arg r "drawDisk(Posn, int, AColor)" "second") + (check-arg r "drawDisk(Posn, int, IColor)" "second") ([hash-table-get privates '%draw-solid-disk] (build-posn posn) r (color->symbol c)))) - (define (drawRect-geometry.Posn-int-int-colors.AColor-native this accs gets privates posn w h c) + (define (drawRect-geometry.Posn-int-int-colors.IColor-native this accs gets privates posn w h c) (wrap-start-check - (check-arg w "drawRect(Posn, int, int, AColor)" "second") - (check-arg h "drawRect(Posn, int, int, AColor)" "third") + (check-arg w "drawRect(Posn, int, int, IColor)" "second") + (check-arg h "drawRect(Posn, int, int, IColor)" "third") ([hash-table-get privates '%draw-solid-rect] (build-posn posn) w h (color->symbol c)))) - (define (drawLine-geometry.Posn-geometry.Posn-colors.AColor-native this accs gets privates p0 p1 c) + (define (drawLine-geometry.Posn-geometry.Posn-colors.IColor-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)))) @@ -144,26 +144,26 @@ ([hash-table-get privates '%draw-string] (build-posn p) s*))) #; - (define (clearCircle-geometry.Posn-int-colors.AColor-native this accs gets privates p r c) + (define (clearCircle-geometry.Posn-int-colors.IColor-native this accs gets privates p r c) (wrap-start-check - (check-arg r "clearCircle(Posn, int, AColor)" "second") + (check-arg r "clearCircle(Posn, int, IColor)" "second") ([hash-table-get privates '%clear-circle] (build-posn p) r (color->symbol c)))) #; - (define (clearDisk-geometry.Posn-int-colors.AColor-native this accs gets privates p r c) + (define (clearDisk-geometry.Posn-int-colors.IColor-native this accs gets privates p r c) (wrap-start-check - (check-arg r "clearDisk(Posn, int, AColor)" "second") + (check-arg r "clearDisk(Posn, int, IColor)" "second") ([hash-table-get privates '%clear-solid-disk] (build-posn p) r (color->symbol c)))) #; - (define (clearRect-geometry.Posn-int-int-colors.AColor-native this accs gets privates p w h c) + (define (clearRect-geometry.Posn-int-int-colors.IColor-native this accs gets privates p w h c) (wrap-start-check - (check-arg w "clearRect(Posn, int, int, AColor)" "second") - (check-arg h "clearRect(Posn, int, int, AColor)" "third") + (check-arg w "clearRect(Posn, int, int, IColor)" "second") + (check-arg h "clearRect(Posn, int, int, IColor)" "third") ([hash-table-get privates '%clear-solid-rect] (build-posn p) w h (color->symbol c)))) #; - (define (clearLine-geometry.Posn-geometry.Posn-colors.AColor-native this accs gets privates p0 p1 c) + (define (clearLine-geometry.Posn-geometry.Posn-colors.IColor-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)))) ) diff --git a/collects/htdch/idraw/Canvas.java b/collects/htdch/idraw/Canvas.java index 64a0766050..8750267dc0 100644 --- a/collects/htdch/idraw/Canvas.java +++ b/collects/htdch/idraw/Canvas.java @@ -4,22 +4,22 @@ import colors.*; import geometry.*; public class Canvas { - private int width = 0; - private int height = 0; + private int width = 0; + private int height = 0; - public Canvas(int width, int height) { - this.width = width; - this.height = height; - } + public Canvas(int width, int height) { + this.width = width; + this.height = height; + } - // these two are cheats: - protected native void copy(); - protected native void stop(); + // these two are cheats: + protected native void copy(); + protected native void stop(); // MF: I need to figure out how to accomplish these two things, especially // stop, directly at the Scheme level w/o going thru the Java layer. - private boolean showing = false; + public void show() { if (!showing) { xshow(); @@ -27,17 +27,18 @@ public class Canvas { } return ; } + public void close() { xclose(); showing = false; return ; } - public native void xshow(); - public native void xclose(); - 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 xshow(); + public native void xclose(); + public native void drawCircle(Posn p, int r, IColor c); + public native void drawDisk(Posn p, int r, IColor c); + public native void drawRect(Posn p, int width, int height, IColor c); + public native void drawLine(Posn p0, Posn p1, IColor c); + public native void drawString(Posn p, String s); } diff --git a/collects/htdch/idraw/installer.ss b/collects/htdch/idraw/installer.ss index 3ca74e14da..ebf4af3306 100644 --- a/collects/htdch/idraw/installer.ss +++ b/collects/htdch/idraw/installer.ss @@ -12,15 +12,4 @@ (build-path draw-path file) #f #f))))) (javac "Canvas.java") - (javac "World.java") - #| - (javac "Posn.java") - (javac "AColor.java") - (javac "Red.java") - (javac "White.java") - (javac "Blue.java") - (javac "Black.java") - (javac "Green.java") - (javac "Yellow.java") - |# - )))) + (javac "World.java")))))