gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO gzz/gfx/gl/GLVobCoorder.java gzz/mod...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gzz/gfx/gl/GLVobCoorder.java gzz/mod...
Date: Mon, 04 Nov 2002 06:18:43 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/11/04 06:18:42

Modified files:
        .              : TODO 
        gzz/gfx/gl     : GLVobCoorder.java 
        gzz/modules/pp : PPView2.java demotest.py 

Log message:
        Getting there\!

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.360&tr2=1.361&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPView2.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.360 gzz/TODO:1.361
--- gzz/TODO:1.360      Mon Nov  4 03:45:58 2002
+++ gzz/TODO    Mon Nov  4 06:18:42 2002
@@ -101,15 +101,15 @@
        + new PEG for bubbleview, with some sketches
     tjl:        
        - PP [deadline 5.11]
-           - refactor
-               - implement using the new gzz.view classes
-                   - buoy pan
-                   - hopping to buoy - keying, animation
            - make it work again
                - bindings
-               - mouse click coordinates
+                   - entering text
+                   - dragging texts
+                   - linking
            - calendar bg
            - images
+           - fillets main<->buoy
+           - buoys' depth order
            - nadir
            - fix directory geometry
            - HOME button
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -u gzz/gzz/gfx/gl/GLVobCoorder.java:1.53 
gzz/gzz/gfx/gl/GLVobCoorder.java:1.54
--- gzz/gzz/gfx/gl/GLVobCoorder.java:1.53       Sun Nov  3 13:28:16 2002
+++ gzz/gzz/gfx/gl/GLVobCoorder.java    Mon Nov  4 06:18:42 2002
@@ -31,7 +31,7 @@
 import gzz.client.gl.*;
 
 public class GLVobCoorder extends AffineVobCoorder {
-public static final String rcsid = "$Id: GLVobCoorder.java,v 1.53 2002/11/03 
18:28:16 tjl Exp $";
+public static final String rcsid = "$Id: GLVobCoorder.java,v 1.54 2002/11/04 
11:18:42 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -176,6 +176,10 @@
        return was;
     }
 
+    public int getBuoyOnCircleAnchor(int cs) {
+       return inds[cs + 2];
+    }
+
     public int nadirOrigin(int into, int nadir) {
        int paramInd = nfloats;
        nfloats += 0;
@@ -275,7 +279,7 @@
     public void getSqSize(int cs, float[] into) {
        // XXX Dangerous: this needs to be updated whenever new non-unit box 
        // coordsys are added.
-       int type = inds[cs];
+       int type = inds[cs] & ~GL.CSFLAGS;
        int ind=-42;
        switch(type) {
            case 11: // box
Index: gzz/gzz/modules/pp/PPView2.java
diff -u gzz/gzz/modules/pp/PPView2.java:1.8 gzz/gzz/modules/pp/PPView2.java:1.9
--- gzz/gzz/modules/pp/PPView2.java:1.8 Mon Nov  4 03:45:58 2002
+++ gzz/gzz/modules/pp/PPView2.java     Mon Nov  4 06:18:42 2002
@@ -14,6 +14,8 @@
 import java.util.*;
 
 public class PPView2 implements View {
+    public static boolean dbg = true;
+    private static void pa(String s) { System.err.println(s); }
 
     // Geometry
 
@@ -111,6 +113,8 @@
            float[] sqs = new float[2];
            glc.getSqSize(frameCS, sqs);
 
+           pa("Sqs frame: "+sqs[0]+" "+sqs[1]);
+
            // CS from center of frameCS to screen
            int framecenterCS = vs.translateCS(frameCS, "FCTR", sqs[0]/2, 
sqs[1]/2);
 
@@ -177,6 +181,12 @@
      */
     List buoyqueue = new ArrayList(); // Try to pronounce *that*
 
+    private int[] getCoords(Cell c) {
+       Cell firstCoord = c.s(d.pan);
+       if(firstCoord == null) return null;
+       return gzz.client.Params.getInts(firstCoord, d.pan, 2, null);
+    }
+
     class BFloater implements Cell1DBuoyHook.Floater {
        int dir;
        VobScene vs;
@@ -203,7 +213,9 @@
                    buoyVPWidth, buoyVPHeight);
            vs.activate(frameCS);
            // XXX Pan
-           final int c2fCS = vs.coords.ortho(0, 0, 0, 0, buoyZoom, buoyZoom);
+           int[] pan = getCoords(c);
+           final int c2fCS = vs.coords.ortho(0, 0, 
+                   -pan[0]*buoyZoom, -pan[1]*buoyZoom, buoyZoom, buoyZoom);
            vs.matcher.addSub(buoycs, c2fCS, "C2F");
 
            buoyqueue.add(new Runnable() {
@@ -259,6 +271,12 @@
 
        int c2fCS = vs.coords.ortho(0, 0, 0, 0, 10, 10);
        vs.matcher.addSub(mainctr, c2fCS, "C2F");
+
+       int[] coords = getCoords(context.getAccursed());
+       if(coords != null) {
+           panx = coords[0];
+           pany = coords[1];
+       }
        setZoomPan(vs);
        pl.render(vs, frameCS, c2fCS);
 
@@ -275,5 +293,65 @@
        int main = m.getCS("MAINVP");
        int cs = m.getCS(main, "C2F");
        vs.coords.setOrthoParams(cs, 0, -panx*zoom, -pany*zoom, zoom, zoom);
+    }
+
+    /** 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
+     *                 DefaultVobMatcher.setKeyMap() method.
+     */
+    public Map setCursorTo(VobScene vs, float x, float y, ViewContext 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 - no reaction yet");
+           return null;
+       }
+       if(! (key instanceof Pair)) {
+           pa("Key is not pair!!! HELP "+key);
+           return null;
+       }
+       Pair p = (Pair)key;
+       Map r = new HashMap();
+       r.put("MAINVP", p);
+       r.put(p,  "MAINVP");
+       // Now, we have almost all the data.
+       // But we need to figure out WHICH one of the cells in the Pair
+       // is the one we are moving to. To do this, we have to look at
+       // the parent coordinate systems.
+       
+       int tr12 = ((GLVobCoorder)vs.coords).getBuoyOnCircleAnchor(vp); // 
XXX... reverse of BFloater
+       pa("tr12: "+tr12);
+       pa(" "+vs.matcher.getKey(tr12));
+
+       int ausq = ((GLVobCoorder)vs.coords).getParent(tr12);
+       pa("ausq: "+ausq);
+       pa(" "+vs.matcher.getKey(ausq));
+
+       int anchor = ((GLVobCoorder)vs.coords).getParent(ausq);
+       pa("anch: "+anchor);
+       pa(" "+vs.matcher.getKey(anchor));
+       Object cell = vs.matcher.getKey(anchor);
+
+       Object n;
+       if(cell.equals(p.first)) n = p.second;
+       else n = p.first;
+       pa("New: "+n);
+
+       ((AbstractViewContext)context).setAccursed((Cell)n);
+
+       return r;
     }
 }
Index: gzz/gzz/modules/pp/demotest.py
diff -u gzz/gzz/modules/pp/demotest.py:1.16 gzz/gzz/modules/pp/demotest.py:1.17
--- gzz/gzz/modules/pp/demotest.py:1.16 Mon Nov  4 03:45:58 2002
+++ gzz/gzz/modules/pp/demotest.py      Mon Nov  4 06:18:42 2002
@@ -11,6 +11,9 @@
 
 from gfx.libutil import effects
 
+AbstractUpdateManager.defaultAnimationTime = 3000
+# AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()
+
 obsTrigger = SimpleObsTrigger();
 cellTexter = SimpleVStreamTexter(FakeSpanMaker(), 
Enfilade1DImpl.Enfilade1DImplMaker())
 cellManager = PlainCellManager()
@@ -27,11 +30,16 @@
 
 
 n1 = ppactions.newNote(id, 100, 100, "WIgdqp")
-ppactions.newNote(id, 100, 200, "Foog")
-ppactions.newNote(id, 0, 0, "Abksefvu21249")
+n1_2 = ppactions.newNote(id, 100, 200, "Foog")
+n1_3 = ppactions.newNote(id, 0, 0, "Abksefvu21249")
+
+np = ppactions.newPaper()
+n2 = ppactions.newNote(np, 100, 50, "lijesf")
+ppactions.assocNotes(n1_2, 1, n2)
 
 np = ppactions.newPaper()
 n2 = ppactions.newNote(np, 50, 50, "blah")
+n3 = ppactions.newNote(np, 150, 250, "oijgsg")
 
 ppactions.assocNotes(n1, 1, n2)
 print "Assoc: ",n1,n2
@@ -116,9 +124,13 @@
 
 class PPView2Scene:
     def __init__(self):
+       w.setLocation(1600,0,1024,768)
        self.ppv = PPView2(space, w)
        self.ppv.bgscale = 500
        self.poly = ["FILL", "LINE"]
+       self.avc = gzz.view.AbstractViewContext()
+       self.avc.setAccursed(space.getCell(n1))
+       self.map = None
     def key(self, key):
        if key == "i":
            print "INTERPLIST"
@@ -134,18 +146,13 @@
        vs.map.put(getDListNocoords("""
            PolygonMode FRONT_AND_BACK %s
        """ % (self.poly[0],)))
-       avc = gzz.view.AbstractViewContext()
-       avc.setAccursed(space.getCell(n1))
-       self.ppv.render(vs, 0, avc)
+       self.ppv.render(vs, 0, self.avc)
+       vs.matcher.setKeyMap(self.map)
        self.vs = vs
     def mouse(self, ev):
        if ev.getID() == ev.MOUSE_CLICKED:
-           vs = self.vs
-           cs = vs.coords.getCSAt(0, ev.getX(), ev.getY(), None)
-           print "CS"
-           while cs > 0:
-               print cs, vs.matcher.getKey(cs)
-               cs = vs.coords.getParent(cs)
+           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())
            self.pzoom = self.ppv.zoom




reply via email to

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