gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO gfx/liblines/Lines.cxx gfx/librender...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gfx/liblines/Lines.cxx gfx/librender...
Date: Tue, 05 Nov 2002 03:21:02 -0500

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

Modified files:
        .              : TODO 
        gfx/liblines   : Lines.cxx 
        gfx/librenderables: Renderables.cxx Renderables.hxx 
                            renderables.py 
        gzz/modules/pp : PPDims.java PPView2.java PlaneView.java 
                         demotest.py 
        gzz/modules/pp/vob: BgVob.java 
        gzz/util       : Pair.java 
        gzz/view       : MultitypeCellContentView.java 
Added files:
        gzz/modules/pp/vob: CalendarBg.java 

Log message:
        Lots of ppdemo stuff

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.366&tr2=1.367&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/liblines/Lines.cxx.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.cxx.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/Renderables.hxx.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.130&tr2=1.131&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPDims.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPView2.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PlaneView.java.diff?tr1=1.57&tr2=1.58&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/vob/CalendarBg.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/vob/BgVob.java.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/util/Pair.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/MultitypeCellContentView.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.366 gzz/TODO:1.367
--- gzz/TODO:1.366      Mon Nov  4 17:15:04 2002
+++ gzz/TODO    Tue Nov  5 03:21:01 2002
@@ -98,17 +98,15 @@
        + new PEG for bubbleview, with some sketches
     tjl:        
        - PP [deadline 5.11]
-           - make it work again
-               - bindings
-                   - linking
-           - calendar bg
            - fix getting coordinate in main frame (click -> move is now wrong)
            - images
            - fillets main<->buoy
            - dragging texts
            - editing text -- can use Win.java code --> new Java file, with
              AbstractViewContext and PPView2
+           - deleting links?!
            - nadir
+           - use jvk's new ellipse code
            - fix directory geometry
            - HOME button
        - fix LineVob for AWT
Index: gzz/gfx/liblines/Lines.cxx
diff -u gzz/gfx/liblines/Lines.cxx:1.12 gzz/gfx/liblines/Lines.cxx:1.13
--- gzz/gfx/liblines/Lines.cxx:1.12     Sat Nov  2 19:09:54 2002
+++ gzz/gfx/liblines/Lines.cxx  Tue Nov  5 03:21:01 2002
@@ -116,16 +116,16 @@
        glBegin(GL_QUADS);
          
            glTexCoord2f(t0, t1);
-           glVertex3f(a.x + l.x, a.y + l.y, 0);
+           glVertex3f(a.x + l.x, a.y + l.y, a.z);
 
            glTexCoord2f(t1, t1);
-           glVertex3f(a.x - l.x, a.y - l.y, 0);
+           glVertex3f(a.x - l.x, a.y - l.y, a.z);
 
            glTexCoord2f(t1, t0);
-           glVertex3f(b.x - l.x, b.y - l.y, 0);
+           glVertex3f(b.x - l.x, b.y - l.y, b.z);
 
            glTexCoord2f(t0, t0);
-           glVertex3f(b.x + l.x, b.y + l.y, 0);
+           glVertex3f(b.x + l.x, b.y + l.y, b.z);
 
        glEnd();
 
Index: gzz/gfx/librenderables/Renderables.cxx
diff -u gzz/gfx/librenderables/Renderables.cxx:1.9 
gzz/gfx/librenderables/Renderables.cxx:1.10
--- gzz/gfx/librenderables/Renderables.cxx:1.9  Tue Oct 22 12:28:22 2002
+++ gzz/gfx/librenderables/Renderables.cxx      Tue Nov  5 03:21:01 2002
@@ -23,6 +23,7 @@
     DBGVAR(dbg_paperquad, "Renderable.paperquad");
     DBGVAR(dbg_culledpaperquad, "Renderable.culledpaperquad");
     DBGVAR(dbg_irregularquad, "Renderable.irregularquad");
+    DBGVAR(dbg_calendar, "Renderable.calendar");
 
     void setStandardCoordinates(Vec windowSize) {
        int w = (int)windowSize.x;
Index: gzz/gfx/librenderables/Renderables.hxx
diff -u gzz/gfx/librenderables/Renderables.hxx:1.22 
gzz/gfx/librenderables/Renderables.hxx:1.23
--- gzz/gfx/librenderables/Renderables.hxx:1.22 Sat Nov  2 06:05:44 2002
+++ gzz/gfx/librenderables/Renderables.hxx      Tue Nov  5 03:21:01 2002
@@ -72,6 +72,7 @@
     PREDBGVAR(dbg_culledpaperquad);
     PREDBGVAR(dbg_horiztext2);
     PREDBGVAR(dbg_irregularquad);
+    PREDBGVAR(dbg_calendar);
 
     using namespace Vec23;
 
Index: gzz/gfx/librenderables/renderables.py
diff -u gzz/gfx/librenderables/renderables.py:1.130 
gzz/gfx/librenderables/renderables.py:1.131
--- gzz/gfx/librenderables/renderables.py:1.130 Mon Nov  4 10:47:07 2002
+++ gzz/gfx/librenderables/renderables.py       Tue Nov  5 03:21:01 2002
@@ -1336,18 +1336,15 @@
 
                 ZPt tmp(x*scale, y*scale, 0);
 
-                tmp = c.transform(tmp);
-
                 tmp.x += orig.x;
                 tmp.y += orig.y;
 
-                // already transformed from coords1, so:
-                glVertex3f(tmp.x, tmp.y, tmp.z);
+                c.vertex(tmp);
            }
        };
        """,
     "RenderCode" : """
-            if (dbg) cout << "Calendar - linewidth: " << linewidth << "\\n"; 
+            DBG(dbg_calendar) << "Calendar - linewidth: " << linewidth << 
"\\n"; 
     
            glPushAttrib(GL_ENABLE_BIT);
            glEnable(GL_BLEND);
@@ -1412,6 +1409,8 @@
             glEnable(GL_TEXTURE_2D);
             float date_scale = scales[0];
 
+           Coords &coords2inv = *coords2.getInverse();
+
             for (int i=1; i<=days; i++) {
                 int column = (empty_days + i -1) % 7;
                 int row  =1+ (empty_days + i -1) / 7; 
@@ -1433,7 +1432,8 @@
                 glColor3f(1.0, 1.0, 1.0);
 
                 Vertexer<Coords> v_date(coords2, date_scale,
-                                        coords1.transform(ZPt(fcol, frow,0))
+                                        coords2inv.transform(
+                                           coords1.transform(ZPt(fcol, 
frow,0)))
                 );
                 
                Text::renderIter(*r_date, buffer, buffer+strlen(buffer), 
@@ -1458,7 +1458,9 @@
             float week_num_scale = scales[1];
             for (int i=0; i<weeks; i++) {
                Vertexer<Coords> v_week_num(coords2, week_num_scale,
-                    coords1.transform(ZPt(0, month_name_h + weekday_h + i,0))
+                   coords2inv.transform(
+                       coords1.transform(ZPt(0, month_name_h + weekday_h + 
i,0))
+                       )
                 );
                     
                 static char buffer[64];
@@ -1477,7 +1479,9 @@
             for (int i=0; i<7; i++) {
 
                Vertexer<Coords> v_weekday(coords2, weekday_scale,
-                    coords1.transform(ZPt(week_num_w + i + 0.1, month_name_h + 
weekday_h - 0.15, 0 ))
+                    coords2inv.transform(
+                       coords1.transform(ZPt(week_num_w + i + 0.1, 
month_name_h + weekday_h - 0.15, 0 ))
+                       )
                 );
             
                Text::renderIter(*r, d_txt[i].begin(), d_txt[i].end(), 
@@ -1490,7 +1494,9 @@
             // Month name
             float month_name_scale = scales[3];
            Vertexer<Coords> v_month(coords2, month_name_scale,
+               coords2inv.transform(
                 coords1.transform(ZPt(week_num_w, month_name_h - 0.15, 0))
+               )
             );
 
             Text::renderIter(*r, m_txt.begin(), m_txt.end(), 
Index: gzz/gzz/modules/pp/PPDims.java
diff -u gzz/gzz/modules/pp/PPDims.java:1.3 gzz/gzz/modules/pp/PPDims.java:1.4
--- gzz/gzz/modules/pp/PPDims.java:1.3  Sun Nov  3 23:35:39 2002
+++ gzz/gzz/modules/pp/PPDims.java      Tue Nov  5 03:21:01 2002
@@ -30,7 +30,8 @@
 
 public class PPDims {
 
-    public final Dim contains, pan, association, d1, clone;
+    public final Dim contains, pan, association, d1, clone,
+           bgtype;
 
     public PPDims(Space space) {
        contains = 
space.getDim("0000000008000000E99BD882A20004A0AD6630BFDA693D810DED76CAE65DA9B7E873053466C52E-5");
@@ -38,6 +39,7 @@
        association = 
space.getDim("0000000008000000E99BD882A20004A0AD6630BFDA693D810DED76CAE65DA9B7E873053466C52E-7");
        d1 = space.getDim(Ids.d_1);
        clone = space.getCloneDim();
+       bgtype = space.getDim("urn:urn-5:Iwg5eGN0McSpIvXV4Cx1DP+iUrft");
     }
 
 }
Index: gzz/gzz/modules/pp/PPView2.java
diff -u gzz/gzz/modules/pp/PPView2.java:1.11 
gzz/gzz/modules/pp/PPView2.java:1.12
--- gzz/gzz/modules/pp/PPView2.java:1.11        Mon Nov  4 17:15:04 2002
+++ gzz/gzz/modules/pp/PPView2.java     Tue Nov  5 03:21:01 2002
@@ -43,10 +43,23 @@
      */
     public float buoyVPWidth = 400, buoyVPHeight = 400;
 
+    /** Link buoy viewport geometry.
+     */
+    public float linkbuoyVPWidth = 200, linkbuoyVPHeight = 100;
+
     /** The center of the visible area.
      */
     float centerX(VobScene vs) { return (vs.size.width-leftPanelWidth)/2; }
 
+    /** The zoom to be used for the buoys.
+     */
+    public float buoyZoom = 1;
+
+    /** The zoom to be used for the link creation buoys.
+     */
+    public float linkbuoyZoom = .5f;
+
+
     // Current state
 
     /** The current zoom.
@@ -58,9 +71,11 @@
      */
     public float panx=0, pany=0;
 
-    /** The zoom to be used for the buoys.
+    /** Whether showing normal or link-making buoys.
      */
-    public float buoyZoom = 1;
+    public boolean showLinkbuoys = false;
+
+    // Visual characteristics of the virtual paper and ripple
 
     /** The scale of the background.
      * bgscale in paper coordinates = 1 in background coords.
@@ -145,6 +160,10 @@
            final int frameUnit2paper = glc.concat(screen2paper, frameUnit);
            vs.matcher.addSub(screen2paper, frameUnit2paper, "f2pap");
 
+           final int paper2screen_shifted = vs.translateCS(paper2screen,
+                           "SHIFTUP",
+                               0, 0, -30);
+
            class Putter implements Runnable {
                Vob v;
                Putter(Vob v) { this.v = v; }
@@ -155,9 +174,12 @@
 
            Runnable placeContent = new Runnable() {
                        public void run() {
-                           vs.map.put(bg, frameUnit, bg2screen);
+                           // XXX Unclean!
+                           // vs.map.put(bg, frameUnit, bg2screen);
+                           bg.put(vs, frameUnit, bg2screen);
                            vs.map.put(black);
-                           coordinatePlaneView.render(vs, paper2screen, 
context);
+                           coordinatePlaneView.render(vs, 
paper2screen_shifted, 
+                                   context);
                        }};
 
            if(useStencil)
@@ -251,7 +273,10 @@
        main_vc.setAccursed(context.getAccursed());
        main_vc.setCursorOffset(context.getCursorOffset(context.getAccursed()));
 
-       main_vc.setCellView(
+       if(showLinkbuoys)
+           main_vc.setCellView(cellview);
+       else
+           main_vc.setCellView(
                new CellInBoxPlugin(cellview,
                                    new Cell1DBuoyHook(leftFloater, 
rightFloater,
                                                d.clone, d.association)));
@@ -285,6 +310,64 @@
        for(Iterator i = buoyqueue.iterator(); i.hasNext(); ) 
            ((Runnable)i.next()).run();
        buoyqueue = new ArrayList();
+
+       if(showLinkbuoys) {
+           Cell cursor = main_vc.getAccursed();
+           Cell plane = cursor.h(d.contains);
+           plane = plane.h(d.d1);
+           String cur = cursor.t();
+           curlinkY = 0;
+           if(cur.length() >= 1)  { // XXX More
+               while(plane != null) {
+                   for(Cell otherNote = plane.s(d.contains); otherNote != null;
+                           
+                       otherNote = otherNote.s(d.contains)) {
+                       if(otherNote.equals(cursor)) continue;
+
+                       if(otherNote.t().startsWith(cur)) {
+                           placeLinkbuoys(vs, otherNote);
+                       }
+                   }
+                   plane = plane.s(d.d1);
+               }
+           }
+       }
+    }
+
+    int curlinkY = 0;
+    // XXX more params!
+    private void placeLinkbuoys(VobScene vs, Cell otherNote) {
+       int[] coords = getCoords(otherNote);
+
+       placeLinkbuoy(vs, otherNote, coords, new Pair(otherNote, null), -1);
+       placeLinkbuoy(vs, otherNote, coords, new Pair(null, otherNote), 1);
+       // 0  -1   1  -2  2 ...
+       if(curlinkY < 0) curlinkY = -curlinkY;
+       else { curlinkY ++; curlinkY = -curlinkY; }
+    }
+
+    private void placeLinkbuoy(VobScene vs, Cell otherNote, 
+               int[] coords, Pair key, int dir) {
+
+       int ctr = ((GLVobCoorder)vs.coords).affineCoordsys(0, 0,
+                   centerX(vs) + dir * buoyRadius, 
+                   mainY + mainHeight/2 + curlinkY * linkbuoyVPHeight,
+                   1, 0, 0, 1);
+       vs.matcher.add(ctr, key);
+
+       int frameCS = vs.orthoBoxCS(ctr, "frame", 10, 
+               (-linkbuoyVPWidth)/2, -linkbuoyVPHeight/2, 1, 1, 
+               linkbuoyVPWidth, linkbuoyVPHeight);
+       vs.activate(frameCS);
+
+       int c2f = vs.coords.ortho(0, 0, 
+                   -linkbuoyZoom*coords[0], -linkbuoyZoom*coords[1],
+                   linkbuoyZoom, linkbuoyZoom);
+       vs.matcher.addSub(ctr, c2f, "C2F");
+
+       buoy_vc.setAccursed(otherNote);
+       buoy_singlePlane.render(vs, frameCS, c2f);
+
     }
 
     /** Cause the changes to the zooming and panning variables
@@ -298,6 +381,57 @@
        vs.coords.setOrthoParams(cs, 0, -panx*zoom, -pany*zoom, zoom, zoom);
     }
 
+    /** Set the cursor clicked in the main view.
+     */
+    public void setCursorToMain(VobScene vs, float x, float y, 
+               AbstractViewContext context, int cs) {
+       float[] hit = new float[2];
+       int vobcs = vs.coords.getCSAt(cs, x, y, hit);
+       if(vobcs < 0) {
+           // No hit --> go to root paper cell, set pan
+           context.setAccursed(context.getAccursed().h(d.contains));
+           float[] pt = new float[] { x, y, 0 };
+           vs.coords.inverseTransformPoints3(cs, pt, pt);
+           panx = pt[0]; pany = pt[1];
+           return ;
+       }
+       Object k = vs.matcher.getKey(vobcs);
+       pa("Hit: "+vobcs+" "+k+" "+hit[0]+" "+hit[1]);
+       if(!(k instanceof Cell)) {
+           pa("Not a cell?!");
+           return ;
+       }
+       context.setAccursed((Cell)k);
+       context.setCursorOffset(style.getOffsetInText(((Cell)k).t(), 1, 
hit[0]));
+    }
+
+    public Pair getMakeLinkOrSetCursor(VobScene vs, float x, float y, 
AbstractViewContext context) {
+       // First, get the frame that was hit.
+       // This gives the "frame" coordsys.
+       int cs = vs.coords.getCSAt(0, x, y, null);
+       if(cs < 0) {
+           pa("No hit "+x+" "+y);
+           return null;
+       }
+       if(!"frame".equals(vs.matcher.getKey(cs))) {
+           pa("WRONG KEY! "+vs.matcher.getKey(cs));
+           return null;
+       }
+       // Get its parent
+       int vp = ((GLVobCoorder)vs.coords).getParent(cs);
+       Object key = vs.matcher.getKey(vp);
+       if("MAINVP".equals(key)) {
+           pa("Main viewport");
+           setCursorToMain(vs, x, y, context, cs);
+       }
+       if(! (key instanceof Pair)) {
+           pa("Key is not pair!!! HELP "+key);
+           return null;
+       }
+       Pair p = (Pair)key;
+       return p;
+    }
+
     /** Set the cursor of the given view context to the clicked point.
      * @param context The viewcontext whose accursed cell should be changed.
      * @return A map, to be used for the next generated vobscene's
@@ -320,25 +454,7 @@
        Object key = vs.matcher.getKey(vp);
        if("MAINVP".equals(key)) {
            pa("Main viewport");
-           float[] hit = new float[2];
-           int vobcs = vs.coords.getCSAt(cs, x, y, hit);
-           if(vobcs < 0) {
-               // No hit --> go to root paper cell, set pan
-               context.setAccursed(context.getAccursed().h(d.contains));
-               float[] pt = new float[] { x, y, 0 };
-               vs.coords.inverseTransformPoints3(cs, pt, pt);
-               panx = pt[0]; pany = pt[1];
-               return null;
-           }
-           Object k = vs.matcher.getKey(vobcs);
-           pa("Hit: "+vobcs+" "+k+" "+hit[0]+" "+hit[1]);
-           if(!(k instanceof Cell)) {
-               pa("Not a cell?!");
-               return null;
-           }
-           context.setAccursed((Cell)k);
-           context.setCursorOffset(style.getOffsetInText(((Cell)k).t(), 1, 
hit[0]));
-           return null;
+           setCursorToMain(vs, x, y, context, cs);
        }
        if(! (key instanceof Pair)) {
            pa("Key is not pair!!! HELP "+key);
Index: gzz/gzz/modules/pp/PlaneView.java
diff -u gzz/gzz/modules/pp/PlaneView.java:1.57 
gzz/gzz/modules/pp/PlaneView.java:1.58
--- gzz/gzz/modules/pp/PlaneView.java:1.57      Sun Nov  3 13:28:16 2002
+++ gzz/gzz/modules/pp/PlaneView.java   Tue Nov  5 03:21:01 2002
@@ -41,7 +41,7 @@
  */
 
 public class PlaneView {
-public static final String rcsid = "$Id: PlaneView.java,v 1.57 2002/11/03 
18:28:16 tjl Exp $";
+public static final String rcsid = "$Id: PlaneView.java,v 1.58 2002/11/05 
08:21:01 tjl Exp $";
     public static boolean dbg = true;
     private static void pa(String s) { System.err.println(s); }
 
@@ -144,7 +144,6 @@
        if(cur.length() >= 1)  {
            while(start != null) {
                for(Cell otherNote = start.s(d.contains); otherNote != null;
-                       
                    otherNote = otherNote.s(d.contains)) {
                    /*
                    if(otherNote.equals(note)) continue;
Index: gzz/gzz/modules/pp/demotest.py
diff -u gzz/gzz/modules/pp/demotest.py:1.18 gzz/gzz/modules/pp/demotest.py:1.19
--- gzz/gzz/modules/pp/demotest.py:1.18 Mon Nov  4 17:15:04 2002
+++ gzz/gzz/modules/pp/demotest.py      Tue Nov  5 03:21:01 2002
@@ -27,6 +27,7 @@
 
 id = ppactions.newPaper()
 
+d = PPDims(space)
 
 
 n1 = ppactions.newNote(id, 100, 100, "WIgdqp")
@@ -38,6 +39,7 @@
 ppactions.assocNotes(n1_2, 1, n2)
 
 np = ppactions.newPaper()
+space.getCell(np).N(d.bgtype)
 n2 = ppactions.newNote(np, 50, 50, "blah")
 n3 = ppactions.newNote(np, 150, 250, "oijgsg")
 
@@ -141,8 +143,9 @@
            rotatelist(self.poly)
        if key == "Ctrl-S":
            self.ppv.useStencil = not self.ppv.useStencil
+       if key == "Ctrl-L":
+           self.ppv.showLinkbuoys = not self.ppv.showLinkbuoys
        if len(key) == 1 or key == "Backspace" or key == "Delete":
-           d = self.ppv.d
            mode = 1
            if not 32 <= ord(key[0]) <= 254:
                return
@@ -172,7 +175,19 @@
        self.vs = vs
     def mouse(self, ev):
        if ev.getID() == ev.MOUSE_CLICKED:
-           self.map = self.ppv.setCursorTo(self.vs, ev.getX(), ev.getY(), 
self.avc)
+           if self.ppv.showLinkbuoys:
+               p = self.ppv.getMakeLinkOrSetCursor(self.vs, ev.getX(), 
ev.getY(),
+                               self.avc)
+               if p:
+                   if p.first != None:
+                       ppactions.assocNotes(self.avc.getAccursed().getId(), 
+                               -1, p.first.getId())
+                   else:
+                       ppactions.assocNotes(self.avc.getAccursed().getId(), 
+                               1, p.second.getId())
+               self.ppv.showLinkbuoys = 0
+           else:
+               self.map = self.ppv.setCursorTo(self.vs, ev.getX(), ev.getY(), 
self.avc)
            AbstractUpdateManager.chg()
        elif ev.getID() == ev.MOUSE_PRESSED:
            self.press = (ev.getX(), ev.getY())
@@ -195,7 +210,9 @@
            AbstractUpdateManager.chg()
 
 gzz.view.CoordinatePlaneView.dbg = 0
-gzz.view.Cell1DBuoyHook.dbg = 1
+gzz.view.Cell1DBuoyHook.dbg = 0
+gzz.modules.pp.vob.BgVob.dbg = 0
+gzz.modules.pp.vob.CalendarBg.dbg = 0
 
 # currentScene = PlaneViewScene()
 currentScene = PPView2Scene()
Index: gzz/gzz/modules/pp/vob/BgVob.java
diff -u gzz/gzz/modules/pp/vob/BgVob.java:1.30 
gzz/gzz/modules/pp/vob/BgVob.java:1.31
--- gzz/gzz/modules/pp/vob/BgVob.java:1.30      Sun Nov  3 13:28:16 2002
+++ gzz/gzz/modules/pp/vob/BgVob.java   Tue Nov  5 03:21:01 2002
@@ -30,29 +30,45 @@
 import gzz.gfx.gl.*;
 import gzz.client.GraphicsAPI;
 import java.util.*;
+import gzz.modules.pp.PPDims;
 
 /** A vob that is the background paper.
  * This vob stores the inside coordinates so clicks on it can be 
  * used to pan pretty easily.
  */
 public class BgVob extends gzz.vob.Vob {
-public static final String rcsid = "$Id: BgVob.java,v 1.30 2002/11/03 18:28:16 
tjl Exp $";
+public static final String rcsid = "$Id: BgVob.java,v 1.31 2002/11/05 08:21:01 
tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
+    static HashMap bgvobs = new HashMap();
+
     //    public Rectangle clip;
     Color bgcolor;
 
     Cell papercode;
 
     GLRen.PaperQuad pq;
+
+    CalendarBg other; // E.g. calendar background
     
     public static BgVob create(Cell cell, GraphicsAPI.Window w) {
-       return new BgVob(cell, w);
+       BgVob v = (BgVob)bgvobs.get(cell);
+       if(v == null) {
+           v = new BgVob(cell, w);
+           PPDims d = new PPDims(cell.space);
+           if(dbg) pa("Creating bgvob: "+cell+" "+cell.s(d.bgtype));
+           if(cell.s(d.bgtype) != null) {
+               // Currently always calendar
+               CalendarBg.init();
+               v.other = new CalendarBg();
+           }
+           bgvobs.put(cell, v);
+       }
+       return v;
     }
     
     public BgVob(Cell cell, GraphicsAPI.Window w) {
-
        papercode = cell;
        pq = getPaperQuad(papercode, w);
     }
@@ -76,36 +92,28 @@
        g.setColor(old);
     }
 
-    static HashMap papers = new HashMap();
-    static GL.DisplayList list;
-    static Vob triangle;
 
     GLRen.PaperQuad getPaperQuad(Cell c, GraphicsAPI.Window win) {
-       GLRen.PaperQuad ret = (GLRen.PaperQuad)papers.get(c);
-       if(ret == null) {
-           Paper  pap;
-           GLRen.PaperQuad pq;
-           pap = PaperMill.getInstance().getOptimizedPaper(c.hashCode(), win);
-           ret = GLRen.createPaperQuad(pap, 0, 0, 1, 1, 0, 
GLRen.PAPERQUAD_CS2_TO_SCREEN);
-           papers.put(c, ret);
-
-           list = GL.createDisplayList(
-                   "Disable TEXTURE_2D\nColor 1 0 0 1\nBegin TRIANGLES\nVertex 
-1 -1\n" +
-                   "Vertex 1 -1\nVertex 1 1\nEnd\n"
-               );
+       Paper  pap;
+       GLRen.PaperQuad pq;
+       pap = PaperMill.getInstance().getOptimizedPaper(c.hashCode(), win);
+       return GLRen.createPaperQuad(pap, 0, 0, 1, 1, 0, 
GLRen.PAPERQUAD_CS2_TO_SCREEN);
+    }
 
-           // triangle = GZZGL.createCallListCoorded(list);
+    public void put(VobScene vs, int cs1, int cs2) {
+       vs.map.put(this, cs1, cs2);
+       if(dbg) pa("BgVob.put: "+papercode+" "+other);
+       if(other != null) {
+           // other.put(vs, cs1);
+           other.put(vs, cs2);
        }
-       return ret;
     }
 
-
      public int addToListGL(GraphicsAPI.Window win,
                    int[] list, int curs, int coordsys1,
                    int coordsys2) {
 
        curs = pq.addToListGL(win, list, curs, coordsys1, coordsys2);
-       // curs = triangle.addToListGL(win, list, curs, coordsys1, -1);
        return curs;
     }
     
Index: gzz/gzz/util/Pair.java
diff -u gzz/gzz/util/Pair.java:1.1 gzz/gzz/util/Pair.java:1.2
--- gzz/gzz/util/Pair.java:1.1  Sat Nov  2 13:30:18 2002
+++ gzz/gzz/util/Pair.java      Tue Nov  5 03:21:02 2002
@@ -13,12 +13,16 @@
     }
 
     public int hashCode() {
-       return (first.hashCode()*317501) ^ (second.hashCode()*1941);
+       return 
+           (first == null ? 23472861 : first.hashCode()*317501) ^ 
+           (second == null ? 97124109 : second.hashCode()*1941);
     }
 
     public boolean equals(Object o) {
        if(!(o instanceof Pair)) return false;
        Pair p = (Pair)o;
-       return first.equals(p.first) && second.equals(p.second);
+       if(first == null || !first.equals(p.first) ||
+          second == null || !second.equals(p.second)) return false;
+       return true;
     }
 }
Index: gzz/gzz/view/MultitypeCellContentView.java
diff -u gzz/gzz/view/MultitypeCellContentView.java:1.8 
gzz/gzz/view/MultitypeCellContentView.java:1.9
--- gzz/gzz/view/MultitypeCellContentView.java:1.8      Mon Nov  4 15:37:26 2002
+++ gzz/gzz/view/MultitypeCellContentView.java  Tue Nov  5 03:21:02 2002
@@ -39,18 +39,27 @@
         this.pageView = pageView;
        this.imageView = imageView;
     }
-    
-    public void place(Cell c, VobScene sc, int box,
-                      ViewContext context) {
+
+    private CellContentView v(Cell c) {
         VStreamCellTexter tex = (VStreamCellTexter)c.space.getCellTexter();
         Enfilade1D enf = tex.getEnfilade(c, null);
-        if(enf.length() == 0) return;
+        if(enf.length() == 0) return textView;
         Object firstSpan = enf.getList().get(0);
         if(firstSpan instanceof PageSpan)
-            pageView.place(c, sc, box, context);
+            return pageView;
        else if(firstSpan instanceof ImageSpan)
-           imageView.place(c, sc, box, context);
+           return imageView;
         else
-            textView.place(c, sc, box, context);
+            return textView;
+    }
+    
+    public void place(Cell c, VobScene sc, int box,
+                      ViewContext context) {
+       v(c).place(c, sc, box, context);
+    }
+
+    public void getSize(Cell c, float[] out) {
+       v(c).getSize(c, out);
     }
+
 }




reply via email to

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