gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/lava gzz/loom/SimpleView.java test/gzz/loom...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/lava gzz/loom/SimpleView.java test/gzz/loom...
Date: Sat, 22 Feb 2003 11:07:09 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      03/02/22 11:07:09

Modified files:
        lava/gzz/loom  : SimpleView.java 
        lava/test/gzz/loom: SimpleView.test 

Log message:
        show in middle of window

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/loom/SimpleView.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/test/gzz/loom/SimpleView.test.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gzz/lava/gzz/loom/SimpleView.java
diff -u gzz/lava/gzz/loom/SimpleView.java:1.10 
gzz/lava/gzz/loom/SimpleView.java:1.11
--- gzz/lava/gzz/loom/SimpleView.java:1.10      Sat Feb 22 10:44:15 2003
+++ gzz/lava/gzz/loom/SimpleView.java   Sat Feb 22 11:07:08 2003
@@ -51,18 +51,20 @@
     public void render(VobScene sc, int into, Resource focus, 
                       RDFNode rotation) {
        try {
-           int cs = sc.boxCS(into, focus, 0, 0, 50, 20);
+           int midx = sc.size.width/2, midy = sc.size.height/2;
+
+           int cs = sc.boxCS(into, focus, midx-25, midy-10, 50, 20);
+           int x = midx + 75, y = midy-10;
            sc.map.put(bg, cs);
-           cs = sc.boxCS(into, rotation, 100, 0, 50, 20);
+           cs = sc.boxCS(into, rotation, x, y, 50, 20);
            sc.map.put(bg, cs);
            StmtIterator i=focus.listProperties();
-           int y = 50;
            for(; i.hasNext();) {
+               y += 50;
                Statement s = i.next();
                if(s.getObject().equals(rotation)) continue;
-               cs = sc.boxCS(into, s.getObject(), 100, y, 50, 20);
+               cs = sc.boxCS(into, s.getObject(), x, y, 50, 20);
                sc.map.put(bg, cs);
-               y += 50;
            }
            i.close();
        } catch(RDFException e) {
Index: gzz/lava/test/gzz/loom/SimpleView.test
diff -u gzz/lava/test/gzz/loom/SimpleView.test:1.7 
gzz/lava/test/gzz/loom/SimpleView.test:1.8
--- gzz/lava/test/gzz/loom/SimpleView.test:1.7  Sat Feb 22 07:27:11 2003
+++ gzz/lava/test/gzz/loom/SimpleView.test      Sat Feb 22 11:07:09 2003
@@ -20,6 +20,7 @@
 #
 
 import gzz, java
+import jarray
 from test.tools.gfx import getvs
 from com.hp.hpl.mesa.rdf import jena
 
@@ -43,8 +44,17 @@
     pr, ps, pt = [vs.coords.transformPoint(cs, 0, 0, None)
                   for cs in [cs_r, cs_s, cs_t]]
 
+    arr = jarray.zeros(2, 'f')
+    vs.coords.getSqSize(cs_r, arr)
+    w_r, h_r = arr
+
+    middle_x, middle_y = vs.size.width/2, vs.size.height/2
+
     assert ps.x > pr.x
     assert pt.x > pr.x
+
+    assert abs(pr.x+w_r/2-middle_x) < 3
+    assert abs(pr.y+h_r/2-middle_y) < 3
 
     # s and t should be same size and on a single vertical line
     assert ps.x == pt.x




reply via email to

[Prev in Thread] Current Thread [Next in Thread]