gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz gfx/demo/buoyoing.py gzz/view/PageSpanCellV...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz gfx/demo/buoyoing.py gzz/view/PageSpanCellV...
Date: Wed, 05 Feb 2003 09:09:03 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        03/02/05 09:09:03

Modified files:
        gfx/demo       : buoyoing.py 
        gzz/view       : PageSpanCellView.java 
        gzz/view/buoy  : ScrollblockCellLinker.java pagespanNodes.py 
        test/gzz/view/buoy: buoysys.test 

Log message:
        Important realization: xu links and transclusions need to be treated 
differently

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/buoyoing.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/PageSpanCellView.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/buoy/ScrollblockCellLinker.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/buoy/pagespanNodes.py.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/view/buoy/buoysys.test.diff?tr1=1.12&tr2=1.13&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/buoyoing.py
diff -u gzz/gfx/demo/buoyoing.py:1.4 gzz/gfx/demo/buoyoing.py:1.5
--- gzz/gfx/demo/buoyoing.py:1.4        Wed Feb  5 04:44:32 2003
+++ gzz/gfx/demo/buoyoing.py    Wed Feb  5 09:09:03 2003
@@ -35,7 +35,9 @@
 
 # Create the buoy view elements
 scrollblockLinker = ScrollblockCellLinker(space)
-scrollblockLinker.pageSpanNodeType = 
pagespanNodes.PageSpanNodeType(scrollblockLinker)
+scrollblockLinker.transclusionPageSpanNodeType = (
+       pagespanNodes.WholePageSpanNodeType(scrollblockLinker)
+       )
 adaptor = BuoyAdaptor()
 adaptor.cellNodes = [zzNodes.VanishingNodeType()]
 adaptor.cellLinkers = [scrollblockLinker]
Index: gzz/gzz/view/PageSpanCellView.java
diff -u gzz/gzz/view/PageSpanCellView.java:1.10 
gzz/gzz/view/PageSpanCellView.java:1.11
--- gzz/gzz/view/PageSpanCellView.java:1.10     Wed Feb  5 04:44:32 2003
+++ gzz/gzz/view/PageSpanCellView.java  Wed Feb  5 09:09:03 2003
@@ -45,8 +45,6 @@
        float w;
        float h;
 
-       // XXX KLUDGE!
-       public float xoffs, yoffs;
 
        public Layout(Enfilade1D enf) {
            npages = enf.length();
@@ -58,8 +56,6 @@
            h = 0;
 
            boolean foundCenter = false;
-           xoffs = 0;
-           yoffs = 0;
 
            for(int p = 0; p < npages; p++) {
                pages[p] = (PageSpan)enf.sub(p, p+1).getList().get(0); // XXX 
INEFFICIENT!
@@ -95,20 +91,32 @@
         * Currently, only the first intersecting page
         * is used, but this may change.
         */
-       public void getExtents(PageSpan s, float[] xywh_out) {
+       public float[] getExtents(PageSpan s, float[] xywh_out) {
+           if(xywh_out == null) xywh_out = new float[4];
+
+           float curw = 0;
 
            for(int p = 0; p < npages; p++) {
                if(s.intersects(pages[p])) {
                    Point l_c = s.getLocation(); 
                    Dimension d_c = s.getSize(); 
 
-                   xoffs = w + scale * (psps[p].getX(l_c.x + .5f * d_c.width) 
- xywh[4*p + 0]);
-                   yoffs = scale * (psps[p].getY(l_c.y + .5f * d_c.height) - 
xywh[4*p + 1]);
+                   xywh_out[0] = curw + scale * psps[p].getX(l_c.x);
+                   xywh_out[2] = curw + scale * psps[p].getX(d_c.width);
+
+                   xywh_out[1] = scale * (
+                                   psps[p].getX(l_c.x) - xywh[4*p + 1]);
+                   xywh_out[3] = scale * psps[p].getX(d_c.width);
+
                    if(dbg) pa("Center found: "+p+" "+pages[p]+" "+
-                               xoffs + " " + yoffs);
+                               xywh_out[0] + " " + xywh_out[1] + " " +
+                               xywh_out[2] + " " + xywh_out[3] + " " );
                    
+                   return xywh_out;
                }
+               curw += scale * xywh[4*p + 2];
            }
+           return null;
        }
 
        /** Place this layout into the given coordinate system.
@@ -122,7 +130,7 @@
                // We want a coordinate system
                // whose box is exactly the span
                int around = vs.orthoBoxCS(into, pages[p], 0, 
-                               curx, -yoffs, scale, scale,
+                               curx, 0, scale, scale,
                                xywh[4*p+2], xywh[4*p+3]);
                // and then translate to the whole page.
                int tr = vs.translateCS(around, "T", -xywh[4*p+0], 
-xywh[4*p+1]);
Index: gzz/gzz/view/buoy/ScrollblockCellLinker.java
diff -u gzz/gzz/view/buoy/ScrollblockCellLinker.java:1.8 
gzz/gzz/view/buoy/ScrollblockCellLinker.java:1.9
--- gzz/gzz/view/buoy/ScrollblockCellLinker.java:1.8    Tue Feb  4 10:02:59 2003
+++ gzz/gzz/view/buoy/ScrollblockCellLinker.java        Wed Feb  5 09:09:03 2003
@@ -26,7 +26,7 @@
        enfiladeOverlap = gzz.index.IndexManager.getEnfiladeOverlap(s);
     }
 
-    public BuoyViewNodeType pageSpanNodeType;
+    public BuoyViewNodeType transclusionPageSpanNodeType;
 
     public BuoyViewNodeType cellNodeType;
 
@@ -38,6 +38,10 @@
        // Fix architecture
        this.cellNodeType = cellNodeType;
 
+
+       // Find all transclusion and put buoys of scrollblocks
+       // of pagespans
+       //
        Enfilade1D enf = ((VStreamCellTexter)c.space.getCellTexter()).
                                getEnfilade(c, null);
        List l = enf.getList();
@@ -50,7 +54,8 @@
            if(s instanceof PageSpan) {
                sb.getCurrent();
 
-               listener.link(1, cs, pageSpanNodeType, new Pair(c, sb), s);
+               listener.link(1, cs, transclusionPageSpanNodeType, 
+                               new Pair(c, sb), s);
            }
        }
     }
Index: gzz/gzz/view/buoy/pagespanNodes.py
diff -u gzz/gzz/view/buoy/pagespanNodes.py:1.10 
gzz/gzz/view/buoy/pagespanNodes.py:1.11
--- gzz/gzz/view/buoy/pagespanNodes.py:1.10     Wed Feb  5 07:27:36 2003
+++ gzz/gzz/view/buoy/pagespanNodes.py  Wed Feb  5 09:09:03 2003
@@ -1,3 +1,11 @@
+"""A pagespan scroll shown in a buoy view.
+
+An interesting point: if this is from a transclusion, we
+want to show the *whole* scrollblock always, in small scale.
+If this is from a xanadu link, we want to show the linked-to
+area.
+"""
+
 import jarray
 
 # Page span scrollblock as a whole;
@@ -11,9 +19,23 @@
 def makeEnf(span):
     return gzz.media.impl.Enfilade1DImpl.theMaker.makeEnfilade(span)
 
-class PageSpanNodeType(BuoyViewNodeType):
+class AbstractPageSpanNodeType(BuoyViewNodeType):
     def __init__(self, scrollBlockLinker):
        self.scrollBlockLinker = scrollBlockLinker
+    def createMainNode(self, linkId, anchorSpan, listener):
+       return PageSpanMainNode(self, anchorSpan, listener)
+
+class WholePageSpanNodeType(AbstractPageSpanNodeType):
+    def renderBuoy(self, vs, into, linkId, anchorSpan):
+       # XXX!!!!
+       # Irregu!
+       # find edges of span
+       # should place only that region surrounded by irregu
+       sb = anchorSpan.getScrollBlock();
+       pscv.place(makeEnf(sb.getCurrent()), vs, into, 
+                   .5, 200);
+
+class AnchorPageSpanNodeType(AbstractPageSpanNodeType):
     def renderBuoy(self, vs, into, linkId, anchorSpan):
        # XXX!!!!
        # Irregu!
@@ -22,8 +44,6 @@
        sb = anchorSpan.getScrollBlock();
        pscv.place(makeEnf(sb.getCurrent()), vs, into, 
                    .5, 200);
-    def createMainNode(self, linkId, anchorSpan, listener):
-       return PageSpanMainNode(self, anchorSpan, listener)
 
 class PageSpanMainNode(BuoyViewMainNode):
     def __init__(self, nodetype, anchorSpan, listener):
@@ -32,12 +52,16 @@
        self.scrollBlock = anchorSpan.getScrollBlock()
        self.enf = makeEnf(self.scrollBlock.getCurrent())
        self.size = jarray.zeros(2, "f")
-       # Get location of span
-       pscv.getSize(self.enf, self.size, anchorSpan)
-       self.x = pscv.xoffs
-       self.y = pscv.yoffs
+
+       self.layout = pscv.getLayout(self.enf)
+
+       xywh = self.layout.getExtents(anchorSpan, None)
+
+       self.x = xywh[0] + .5 * xywh[2]
+       self.y = xywh[1] + .5 * xywh[3]
     def renderMain(self, vs, into):
-       pscv.placeCentered(self.enf, vs, into, None, 1, 200)
+       self.layout.place(vs, into, 1, 200)
+
        matches = (self.nodetype.scrollBlockLinker
                            .enfiladeOverlap.getMatches(self.enf))
        for m in matches:
Index: gzz/test/gzz/view/buoy/buoysys.test
diff -u gzz/test/gzz/view/buoy/buoysys.test:1.12 
gzz/test/gzz/view/buoy/buoysys.test:1.13
--- gzz/test/gzz/view/buoy/buoysys.test:1.12    Tue Feb  4 16:16:31 2003
+++ gzz/test/gzz/view/buoy/buoysys.test Wed Feb  5 09:09:03 2003
@@ -32,7 +32,6 @@
     """Test that buoying between vanishing and scrollblock works.
     Doesn't run yet but is good for noticing which pieces are missing.
 
-    fail: *
     """
 
     # Create a space
@@ -51,7 +50,7 @@
 
     # Create the buoy view elements
     scrollblockLinker = ScrollblockCellLinker(space)
-    scrollblockLinker.pageSpanNodeType = 
pagespanNodes.PageSpanNodeType(scrollblockLinker)
+    scrollblockLinker.transclusionPageSpanNodeType = 
pagespanNodes.WholePageSpanNodeType(scrollblockLinker)
     adaptor = BuoyAdaptor()
     adaptor.cellNodes = [zzNodes.VanishingNodeType()]
     adaptor.cellLinkers = [scrollblockLinker]
@@ -71,7 +70,7 @@
     # for putting a buoy with the scrollblock in it.
     failUnlessEqual(testbll.calls, 1)
 
-    failUnlessEqual(testbll.args[2], scrollblockLinker.pageSpanNodeType)
+    failUnlessEqual(testbll.args[2], 
scrollblockLinker.transclusionPageSpanNodeType)
     failUnlessEqual(testbll.args[4], span)
 
     # Next, the big invariant test:




reply via email to

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