gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz gfx/gl/GLVobCoorder.java view/PlainVani...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gzz gfx/gl/GLVobCoorder.java view/PlainVani...
Date: Thu, 06 Feb 2003 06:53:17 -0500

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

Modified files:
        gzz/gfx/gl     : GLVobCoorder.java 
        gzz/view       : PlainVanishing.java VanishingClient.java 
                         VobVanishingClient.java 
        gzz/view/buoy  : buoymanager.py pagespanNodes.py zzNodes.py 
Removed files:
        gzz/gfx/gl     : GLVanishingClient.java 

Log message:
        Putting the vobs in the right place

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/PlainVanishing.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/VanishingClient.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/VobVanishingClient.java.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/buoy/buoymanager.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/buoy/pagespanNodes.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/buoy/zzNodes.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -u gzz/gzz/gfx/gl/GLVobCoorder.java:1.66 
gzz/gzz/gfx/gl/GLVobCoorder.java:1.67
--- gzz/gzz/gfx/gl/GLVobCoorder.java:1.66       Thu Feb  6 04:19:37 2003
+++ gzz/gzz/gfx/gl/GLVobCoorder.java    Thu Feb  6 06:53:14 2003
@@ -31,7 +31,7 @@
 import gzz.client.gl.*;
 
 public final class GLVobCoorder extends AffineVobCoorder {
-public static final String rcsid = "$Id: GLVobCoorder.java,v 1.66 2003/02/06 
09:19:37 tjl Exp $";
+public static final String rcsid = "$Id: GLVobCoorder.java,v 1.67 2003/02/06 
11:53:14 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -50,6 +50,7 @@
     }
 
     public int getCSAt(int parent, float x, float y, float[] targetcoords) {
+       if(dbg) pa("getCSAt "+parent+" "+x+" "+y);
        int[] inds = GL.getAllCSAt(ninds, this.inds, floats, parent, x, y);
 
        if (dbg) {
Index: gzz/gzz/view/PlainVanishing.java
diff -u gzz/gzz/view/PlainVanishing.java:1.4 
gzz/gzz/view/PlainVanishing.java:1.5
--- gzz/gzz/view/PlainVanishing.java:1.4        Sat Nov 23 08:44:20 2002
+++ gzz/gzz/view/PlainVanishing.java    Thu Feb  6 06:53:14 2003
@@ -42,14 +42,13 @@
  */
 
 public class PlainVanishing {
-public static final String rcsid = "$Id: PlainVanishing.java,v 1.4 2002/11/23 
13:44:20 benja Exp $";
+public static final String rcsid = "$Id: PlainVanishing.java,v 1.5 2003/02/06 
11:53:14 tjl Exp $";
     public static boolean dbg = false;
     protected static void p(String s) { if(dbg) pa(s); }
     protected static void pa(String s) { System.err.println(s); }
 
     // XXX Assume single-threaded
 
-    //public float[] shrink = new float[] {0.9f, 0.9f, 0.9f, 0.9f};
     public float[] shrink = new float[] {0.8f, 0.8f, 0.8f, 0.8f};
 
     public float initmul = 1.3f; // 3f;
@@ -57,15 +56,15 @@
     public float xgapmult = 1.3f;
     public float ygapmult = 1.5f;
 
+    public BFRaster raster = new BFRaster();
 
     VanishingClient client;
 
-    public BFRaster raster = new BFRaster();
 
     int ndims;
 
     public void render(VanishingClient client, ViewContext context,
-                       int px, int py) {
+                       float px, float py) {
         Cell center = context.getAccursed();
         Dim[] dims = context.getDims();
 
@@ -93,9 +92,9 @@
      * The recursive passthrough is the most convenient for vanishing-type
      * views.
      */
-    protected void paint(int index, int x, int y, int d, int rdepth,
+    protected void paint(int index, float x, float y, float d, float rdepth,
                        float fract, float xalign, float yalign,
-                       int pdx, int pdy, float rot) {
+                       float pdx, float pdy, float rot) {
        if(raster.cells[index] == null) return;
        if(!raster.used[index]) return;
        if(rdepth >= raster.depth) return;
@@ -106,11 +105,11 @@
                dim);
 
        // connection length taken into account
-       int w = (int)(dim.width*xgapmult) / 2;
-       int h = (int)(dim.height*ygapmult) / 2;
+       float w = (dim.width*xgapmult) / 2;
+       float h = (dim.height*ygapmult) / 2;
 
-       double c = Math.cos(rot);
-       double s = Math.sin(rot);
+       float c = (float)Math.cos(rot);
+       float s = (float)Math.sin(rot);
 
        x += c * (-xalign) * w + s * (-yalign) * h;
        y += c * (-yalign) * h - s * (-xalign) * w;
@@ -130,18 +129,18 @@
        }
        if(ndims > 1) {
            paint(raster.ptrs[index]+2, x, y + h,
-                       (int)(d + 50 + d * 0.05), rdepth, fract * shrink[1],
+                       (d + 50 + d * 0.05f), rdepth, fract * shrink[1],
                    0, -1.0f, 0, 1, 0);
            paint(raster.ptrs[index]+3, x, y - h,
-                   (int)(d + 50 + d * 0.05), rdepth, fract * shrink[1],
+                   (d + 50 + d * 0.05f), rdepth, fract * shrink[1],
                    0, 1.0f, 0, -1, 0);
        }
        if(ndims > 2) {
            paint(raster.ptrs[index]+4, x + w, y + h,
-                   (int)(d + 60 + d * 0.1), rdepth, fract * shrink[1],
+                   (d + 60 + d * 0.1f), rdepth, fract * shrink[1],
                    -1.0f, -1.0f, 0, 0, 0);
            paint(raster.ptrs[index]+5, x - w, y - h,
-                   (int)(d + 60 + d * 0.1), rdepth, fract * shrink[1],
+                   (d + 60 + d * 0.1f), rdepth, fract * shrink[1],
                    1.0f, 1.0f, 0, 0, 0);
        }
 
Index: gzz/gzz/view/VanishingClient.java
diff -u gzz/gzz/view/VanishingClient.java:1.3 
gzz/gzz/view/VanishingClient.java:1.4
--- gzz/gzz/view/VanishingClient.java:1.3       Fri Nov  1 20:23:45 2002
+++ gzz/gzz/view/VanishingClient.java   Thu Feb  6 06:53:14 2003
@@ -36,8 +36,8 @@
     final int CENTER = 1;
 
     Object getVobSize(Cell c, float fract, int flags, Dimension into);
-    void place(Cell c, Object o, float fract, int x0, int y0, int x1, int y1,
-               int depth, float rot);
+    void place(Cell c, Object o, float fract, float x0, float y0, float x1, 
float y1,
+               float depth, float rot);
 
     /** There should be a connection between the given cells.
      * If one of the cells hasn't yet been placed, this means that 
Index: gzz/gzz/view/VobVanishingClient.java
diff -u gzz/gzz/view/VobVanishingClient.java:1.29 
gzz/gzz/view/VobVanishingClient.java:1.30
--- gzz/gzz/view/VobVanishingClient.java:1.29   Tue Feb  4 07:38:49 2003
+++ gzz/gzz/view/VobVanishingClient.java        Thu Feb  6 06:53:14 2003
@@ -88,13 +88,15 @@
 
 
     public void render(VobScene vs, int into, ViewContext context) {
+       float[] size = new float[2];
+       vs.coords.getSqSize(into, size);
        this.into = vs;
        this.intoCS = into;
         this.context = context;
         this.cvf = context.getCellView();
        Dimension d = vs.getSize();
        if(dbg) pa("fallback: "+d+" "+context.getAccursed());
-       vanishing.render(this, context, d.width / 2, d.height / 2);
+       vanishing.render(this, context, size[0] / 2, size[1] / 2);
     }
 
     ViewContext context;
@@ -112,8 +114,8 @@
     Map cell2Box = new HashMap();
 
     public void place(Cell c, Object o, float fract, 
-                   int x0, int y0, int x1, int y1,
-                   int depth, float rot) {
+                   float x0, float y0, float x1, float y1,
+                   float depth, float rot) {
        Vob v = (Vob)o;
        if(fract > 1 && !enlargeScale) fract = 1;
        int box = into.orthoBoxCS(intoCS, c, depth, x0, y0, fract, fract,
Index: gzz/gzz/view/buoy/buoymanager.py
diff -u gzz/gzz/view/buoy/buoymanager.py:1.7 
gzz/gzz/view/buoy/buoymanager.py:1.8
--- gzz/gzz/view/buoy/buoymanager.py:1.7        Thu Feb  6 04:19:40 2003
+++ gzz/gzz/view/buoy/buoymanager.py    Thu Feb  6 06:53:14 2003
@@ -1,6 +1,7 @@
 from __future__ import nested_scopes
 
 from gfx.util.misc import *
+import gfx
 
 from gzz.view.buoy import zzNodes
 from gzz.view.buoy import pagespanNodes
@@ -33,6 +34,7 @@
     def scene(self, vs):
        print "SCENE"
        self.vs = vs
+       self.cs = { }
 
        self.nadirCS = vs.translateCS(0, "NADIRORIGIN", 400, 1500)
 
@@ -45,6 +47,7 @@
        self.vs.activate(main)
 
        self.mainNode.renderMain(vs, self.nadir(main))
+       self.cs[main] = None
 
 
     def link(self, direction, anchorCS, otherNode, linkId, otherAnchor):
@@ -64,6 +67,7 @@
        into = self.vs.orthoBoxCS(buoy, "V", 0, 0, 0, .5, .5, 100, 100)
        into = self.nadir(into)
        self.vs.activate(into)
+       self.cs[into] = (otherNode, linkId, otherAnchor)
        otherNode.renderBuoy(self.vs, into, linkId, otherAnchor, None)
 
     def key(self, key):
@@ -71,7 +75,17 @@
        pass
 
     def mouse(self, ev):
-       print ev
+       # print ev
        x, y = ev.getX(), ev.getY()
        cs = self.vs.getCSAt(0, x, y, None)
        print "IN CS: ",cs
+       link = self.cs.get(cs, None)
+       if link == None:
+           if self.mainNode.mouse(ev, self.vs):
+               gfx.util.demo.replaceNewScene(self.vs)
+               gzz.client.AbstractUpdateManager.setNoAnimation()
+           gzz.client.AbstractUpdateManager.chg()
+       else:
+           self.mainNode = link[0].createMainNode(link[1], link[2], self)
+           gzz.client.AbstractUpdateManager.chg()
+           
Index: gzz/gzz/view/buoy/pagespanNodes.py
diff -u gzz/gzz/view/buoy/pagespanNodes.py:1.14 
gzz/gzz/view/buoy/pagespanNodes.py:1.15
--- gzz/gzz/view/buoy/pagespanNodes.py:1.14     Thu Feb  6 04:19:40 2003
+++ gzz/gzz/view/buoy/pagespanNodes.py  Thu Feb  6 06:53:14 2003
@@ -68,7 +68,13 @@
        self.x = xywh[0] + .5 * xywh[2]
        self.y = xywh[1] + .5 * xywh[3]
     def renderMain(self, vs, into):
-       self.layout.place(vs, into, 1, 200)
+
+       # XXX This is not right: the distortion
+       # should be done here.
+       unit = vs.unitSqCS(into, "UNIT")
+       scaled = vs.scaleCS(unit, "SCALED", 
+               1.0 / self.layout.w, 1.0 / self.layout.h)
+       self.layout.place(vs, scaled, 1, 200)
 
        matches = (self.nodetype.scrollBlockLinker
                            .enfiladeOverlap.getMatches(self.enf))
Index: gzz/gzz/view/buoy/zzNodes.py
diff -u gzz/gzz/view/buoy/zzNodes.py:1.6 gzz/gzz/view/buoy/zzNodes.py:1.7
--- gzz/gzz/view/buoy/zzNodes.py:1.6    Tue Feb  4 08:47:54 2003
+++ gzz/gzz/view/buoy/zzNodes.py        Thu Feb  6 06:53:14 2003
@@ -6,8 +6,12 @@
 from gzz.util import Jython
 
 vanishing = gzz.view.VobVanishingClient()
+vanishing.vanishing.raster.depth = 2
 viewcontext = gzz.view.AbstractViewContext()
 
+mainvanishing = gzz.view.VobVanishingClient()
+
+
 
 viewcontext.setCellView(
     gzz.view.MultitypeCellContentView(
@@ -20,8 +24,9 @@
        """This generic view owns all cells.
        """
        return 1
-    def renderBuoy(self, vs, into, cell, content):
-       pass
+    def renderBuoy(self, vs, into, cell, content, foo):
+       viewcontext.setAccursed(cell)
+       vanishing.render(vs, into, viewcontext)
     def createMainNode(self, cell, content, hook):
        return VanishingMainNode(cell, hook)
 
@@ -31,9 +36,11 @@
 
        self.viewcontext = viewcontext.clone()
        self.viewcontext.setAccursed(cell)
-       self.vanishing = vanishing.clone()
+       self.vanishing = mainvanishing.clone()
        self.viewcontext.setCellView(
            gzz.view.CellViewPlugin(
                self.viewcontext.getCellView(), hook))
     def renderMain(self, vs, into):
        self.vanishing.render(vs, into, self.viewcontext)
+    def mouse(self, ev, vs):
+       return 0




reply via email to

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