gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./TODO gfx/demo/gldemo.py gfx/libcoords/Coo...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./TODO gfx/demo/gldemo.py gfx/libcoords/Coo...
Date: Mon, 04 Nov 2002 17:15:05 -0500

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

Modified files:
        .              : TODO 
        gfx/demo       : gldemo.py 
        gfx/libcoords  : Coords.cxx 
        gzz/gfx/gl     : GLVobCoorder.java 
        gzz/modules/pp : PPView2.java demotest.py 
        gzz/view       : AbstractViewContext.java 
                         TextCellContentView.java 
        gzz/vob/vobs   : LineVob.java TextCursorVob.java TextVob.java 

Log message:
        progress

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.365&tr2=1.366&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/gldemo.py.diff?tr1=1.46&tr2=1.47&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.55&tr2=1.56&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PPView2.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/AbstractViewContext.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/TextCellContentView.java.diff?tr1=1.22&tr2=1.23&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/LineVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/TextCursorVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/vobs/TextVob.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/TODO
diff -u gzz/TODO:1.365 gzz/TODO:1.366
--- gzz/TODO:1.365      Mon Nov  4 14:23:20 2002
+++ gzz/TODO    Mon Nov  4 17:15:04 2002
@@ -99,18 +99,19 @@
     tjl:        
        - PP [deadline 5.11]
            - make it work again
-               - set text cursor from click
                - bindings
-                   - entering text
-                   - dragging texts
                    - linking
            - calendar bg
+           - fix getting coordinate in main frame (click -> move is now wrong)
            - images
            - fillets main<->buoy
-           - buoys' depth order
+           - dragging texts
+           - editing text -- can use Win.java code --> new Java file, with
+             AbstractViewContext and PPView2
            - nadir
            - fix directory geometry
            - HOME button
+       - fix LineVob for AWT
        - PEG getCS(parent, key), affineCoordsys -> affine, +affineCS in 
VobScene
        - PEG getCS hierarchy from either coordsys or matcher
        - better graphics for xupdf and pp
Index: gzz/gfx/demo/gldemo.py
diff -u gzz/gfx/demo/gldemo.py:1.46 gzz/gfx/demo/gldemo.py:1.47
--- gzz/gfx/demo/gldemo.py:1.46 Sat Nov  2 06:05:44 2002
+++ gzz/gfx/demo/gldemo.py      Mon Nov  4 17:15:04 2002
@@ -278,14 +278,19 @@
 
 replacingScene = None
 
+usingNormalBindings = 1
+
 class Bindings(AbstractBinder):
     def keystroke(self, s):
        print "KEY: '%s'"%s
-       if s == "q" or s == "Q":
-           System.exit(43)
-       elif s == "r" or s == "R":
-           loadScenes()
-       elif not globalkey(s):
+       if usingNormalBindings:
+           if s == "q" or s == "Q":
+               System.exit(43)
+           elif s == "r" or s == "R":
+               loadScenes()
+           elif not globalkey(s):
+               currentScene.key(s)
+       else:
            currentScene.key(s)
        AbstractUpdateManager.chg()
     def mouse(self, e):
Index: gzz/gfx/libcoords/Coords.cxx
diff -u gzz/gfx/libcoords/Coords.cxx:1.50 gzz/gfx/libcoords/Coords.cxx:1.51
--- gzz/gfx/libcoords/Coords.cxx:1.50   Mon Nov  4 08:45:47 2002
+++ gzz/gfx/libcoords/Coords.cxx        Mon Nov  4 17:15:04 2002
@@ -483,6 +483,8 @@
      * the upper coordinate system. This means that it
      * can't be implemented as a TransformCoordSys.
      * <p>
+     * The depth is between -1 (center) and 0 (edge)
+     * <p>
      * Parameter layout:
      *  x_circle, y_circle, radius, x_projpoint, y_projpoint, pointdir
      *  <p>
@@ -551,7 +553,7 @@
 
            newparams[0] = tr.x;
            newparams[1] = tr.y;
-           newparams[2] = tr.z;
+           newparams[2] = tr.z - scale;
            newparams[3] = scale;
            newparams[4] = 0;
            newparams[5] = 0;
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -u gzz/gzz/gfx/gl/GLVobCoorder.java:1.55 
gzz/gzz/gfx/gl/GLVobCoorder.java:1.56
--- gzz/gzz/gfx/gl/GLVobCoorder.java:1.55       Mon Nov  4 07:52:49 2002
+++ gzz/gzz/gfx/gl/GLVobCoorder.java    Mon Nov  4 17:15:04 2002
@@ -31,7 +31,7 @@
 import gzz.client.gl.*;
 
 public class GLVobCoorder extends AffineVobCoorder {
-public static final String rcsid = "$Id: GLVobCoorder.java,v 1.55 2002/11/04 
12:52:49 tjl Exp $";
+public static final String rcsid = "$Id: GLVobCoorder.java,v 1.56 2002/11/04 
22:15:04 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -52,8 +52,16 @@
     public int getCSAt(int parent, float x, float y, float[] targetcoords) {
        int[] inds = GL.getAllCSAt(ninds, this.inds, floats, parent, x, y);
        for(int i=0; i<inds.length; i++)
-           if(isNearestActiveAncestor(inds[i], parent))
-               return inds[i];
+           if(isNearestActiveAncestor(inds[i], parent)) {
+               int cs = inds[i];
+               if(targetcoords != null) {
+                   float[] coords = new float[] {x, y, 0};
+                   inverseTransformPoints3(cs, coords, coords);
+                   targetcoords[0] = coords[0];
+                   targetcoords[1] = coords[1];
+               }
+               return cs;
+           }
        return -1;
     }
 
Index: gzz/gzz/modules/pp/PPView2.java
diff -u gzz/gzz/modules/pp/PPView2.java:1.10 
gzz/gzz/modules/pp/PPView2.java:1.11
--- gzz/gzz/modules/pp/PPView2.java:1.10        Mon Nov  4 08:45:47 2002
+++ gzz/gzz/modules/pp/PPView2.java     Mon Nov  4 17:15:04 2002
@@ -80,7 +80,7 @@
     public boolean useStencil = true;
 
     Space space;
-    PPDims d;
+    public PPDims d;
 
     Vob black = GLCache.getCallList("Color 0 0 0\n");
 
@@ -209,7 +209,7 @@
            int buoycs = floater.buoyCoordsys(actr, key);
 
            final int frameCS = vs.orthoBoxCS(buoycs, "frame", 0, 
-                   -buoyVPWidth/2, -buoyVPHeight, 1, 1, 
+                   -buoyVPWidth/2, -buoyVPHeight/2, 1, 1, 
                    buoyVPWidth, buoyVPHeight);
            vs.activate(frameCS);
            // XXX Pan
@@ -234,9 +234,10 @@
        this.coordinatePlaneView = new CoordinatePlaneView(d.contains, d.pan);
     }
 
+    TextStyle style = GraphicsAPI.getInstance().getTextStyle("Sans", 0, 20);
+    CellInBox cellview = new TextCellContentView(style);
+
     public void render(VobScene vs, int intoCS, ViewContext context) {
-       TextStyle style = vs.gfxapi.getTextStyle("Sans", 0, 20);
-       CellInBox cellview = new TextCellContentView(style);
 
        buoy_vc.setCellView(cellview);
 
@@ -248,6 +249,7 @@
 
        AbstractViewContext main_vc = new AbstractViewContext();
        main_vc.setAccursed(context.getAccursed());
+       main_vc.setCursorOffset(context.getCursorOffset(context.getAccursed()));
 
        main_vc.setCellView(
                new CellInBoxPlugin(cellview,
@@ -318,15 +320,24 @@
        Object key = vs.matcher.getKey(vp);
        if("MAINVP".equals(key)) {
            pa("Main viewport");
-           cs = vs.coords.getCSAt(cs, x, y, null);
-           Object k = vs.matcher.getKey(cs);
-           pa("Hit: "+cs+" "+k);
+           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(1);
+           context.setCursorOffset(style.getOffsetInText(((Cell)k).t(), 1, 
hit[0]));
            return null;
        }
        if(! (key instanceof Pair)) {
Index: gzz/gzz/modules/pp/demotest.py
diff -u gzz/gzz/modules/pp/demotest.py:1.17 gzz/gzz/modules/pp/demotest.py:1.18
--- gzz/gzz/modules/pp/demotest.py:1.17 Mon Nov  4 06:18:42 2002
+++ gzz/gzz/modules/pp/demotest.py      Mon Nov  4 17:15:04 2002
@@ -131,16 +131,37 @@
        self.avc = gzz.view.AbstractViewContext()
        self.avc.setAccursed(space.getCell(n1))
        self.map = None
+       self.mode = 0
     def key(self, key):
-       if key == "i":
+       if key == "Ctrl-I":
            print "INTERPLIST"
            self.vs.dump()
            print self.vs.matcher.interpList(self.vs.matcher)
-       if key == "p":
+       if key == "Ctrl-P":
            rotatelist(self.poly)
-       if key == "s":
+       if key == "Ctrl-S":
            self.ppv.useStencil = not self.ppv.useStencil
-       pass
+       if len(key) == 1 or key == "Backspace" or key == "Delete":
+           d = self.ppv.d
+           mode = 1
+           if not 32 <= ord(key[0]) <= 254:
+               return
+           c = self.avc.getAccursed()
+           print "Acc: ",c
+           if self.avc.getCursorOffset(c) < 0 or c.s(d.contains, -1) == None:
+               c = space.getCell(ppactions.newNote(c.h(d.contains).getId(), 
+                                   int(self.ppv.panx), int(self.ppv.pany), ""))
+               print "NN: ",c
+               self.avc.setAccursed(c)
+               self.avc.setCursorOffset(0)
+           offs = self.avc.getCursorOffset(c)
+           print "OFss:", offs
+
+           AbstractUpdateManager.setNoAnimation()
+           if len(key) == 1:
+               ppactions.insertText(c.getId(), offs, key)
+               self.avc.setCursorOffset(offs+1)
+
     def scene(self, vs):
        vs.map.put(background((0.4,0.5,0.8)))
        vs.map.put(getDListNocoords("""
Index: gzz/gzz/view/AbstractViewContext.java
diff -u gzz/gzz/view/AbstractViewContext.java:1.2 
gzz/gzz/view/AbstractViewContext.java:1.3
--- gzz/gzz/view/AbstractViewContext.java:1.2   Fri Nov  1 20:23:45 2002
+++ gzz/gzz/view/AbstractViewContext.java       Mon Nov  4 17:15:04 2002
@@ -30,7 +30,7 @@
     
     public void setCursorOffset(int offs) { cursorOffset = offs; }
     public int getCursorOffset(Cell c) { 
-       if(c == accursed) return cursorOffset; 
+       if(c.equals(accursed)) return cursorOffset; 
        return -1;
     }
 
Index: gzz/gzz/view/TextCellContentView.java
diff -u gzz/gzz/view/TextCellContentView.java:1.22 
gzz/gzz/view/TextCellContentView.java:1.23
--- gzz/gzz/view/TextCellContentView.java:1.22  Sun Nov  3 13:28:16 2002
+++ gzz/gzz/view/TextCellContentView.java       Mon Nov  4 17:15:04 2002
@@ -39,9 +39,8 @@
  */
 
 public class TextCellContentView extends CellContentView {
-public static final String rcsid = "$Id: TextCellContentView.java,v 1.22 
2002/11/03 18:28:16 tjl Exp $";
+public static final String rcsid = "$Id: TextCellContentView.java,v 1.23 
2002/11/04 22:15:04 tjl Exp $";
     public static boolean dbg = false;
-    private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
 
     TextStyle style;
@@ -65,6 +64,7 @@
        String s = c.t();
         if (s == null) s = "";
         int offs = context.getCursorOffset(c);
+       if(dbg) pa("TextCellContentview: '"+s+"' "+offs);
         if(offs > s.length()) offs = s.length();
         int center = offs >= 0 ? offs : 0;
 
@@ -105,13 +105,20 @@
     }
 
     static Object WH_KEY = new Object();
-    protected void placeVob(Cell c, VobScene v, int cs, float w, float h, int 
start, int end,
+    static Object CURS_KEY = new Object();
+    LineVob cursorVob = new LineVob(0, 0, 0, 1, Color.black);
+    protected void placeVob(Cell c, VobScene vs, int cs, float w, float h, int 
start, int end,
                             int offs, ViewContext context, float scale) {
+           // XXX should optimize for common case: no substring()
         TextVob vob = new TextVob(style, c.t().substring(start, end));
-        int cs_scaled = v.orthoCS(cs, WH_KEY, 0, 0, 0, h, h);
-        v.map.put(vob, cs_scaled);
+        int cs_scaled = vs.orthoCS(cs, WH_KEY, 0, 0, 0, h, h);
+        vs.map.put(vob, cs_scaled);
 
-        if(offs >= 0)
-            v.map.put(new TextCursorVob(vob, offs), cs);
+        if(offs >= 0 && offs >= start && offs <= end) {
+           float x = style.getWidth(c.t().substring(start, offs), 1);
+           int cs_cursor = vs.orthoCS(cs, CURS_KEY, -1, x, 0, 0,h);
+            // v.map.put(new TextCursorVob(vob, offs), cs);
+           vs.map.put(cursorVob, cs_cursor);
+       }
     }
 }
Index: gzz/gzz/vob/vobs/LineVob.java
diff -u gzz/gzz/vob/vobs/LineVob.java:1.1 gzz/gzz/vob/vobs/LineVob.java:1.2
--- gzz/gzz/vob/vobs/LineVob.java:1.1   Fri Nov  1 20:23:46 2002
+++ gzz/gzz/vob/vobs/LineVob.java       Mon Nov  4 17:15:04 2002
@@ -1,7 +1,7 @@
 /*   
 LineVob.java
  *    
- *    Copyright (c) 2001, Tuomas Lukka
+ *    Copyright (c) 2001-2002, Tuomas Lukka
  *
  *    You may use and distribute under the terms of either the GNU Lesser
  *    General Public License, either version 2 of the license or,
@@ -23,12 +23,13 @@
 package gzz.vob.vobs;
 import gzz.vob.*;
 import java.awt.*;
+import gzz.gfx.gl.GLCache;
 
 /** A plain line drawn in given color.
  */
 
 public class LineVob extends Vob {
-public static final String rcsid = "$Id: LineVob.java,v 1.1 2002/11/02 
01:23:46 benja Exp $";
+public static final String rcsid = "$Id: LineVob.java,v 1.2 2002/11/04 
22:15:04 tjl Exp $";
 
     int x0, y0, x1, y1;
     Color color;
@@ -53,7 +54,19 @@
                                Vob.RenderInfo info2) {
        if(fast) return;
        if(color != null) g.setColor(color);
-       g.drawLine(x0, y0, x1, y1);
+       g.drawLine(x0, y0, x1, y1); // XXX transform properly
+    }
+
+    Vob dlist;
+    public int addToListGL(gzz.client.GraphicsAPI.Window win,
+                       int[] list, int curs, int coordsys1,
+                               int coordsys2) { 
+       if(dlist == null)
+           dlist = GLCache.getCallListCoorded(
+               "Begin LINE_STRIP\nVertex "+x0+" "+y0+
+                   "\nVertex "+x1+" "+y1+"\nEnd\n");
+       curs = dlist.addToListGL(win, list, curs, coordsys1, coordsys2);
+       return curs;
     }
 
 }
Index: gzz/gzz/vob/vobs/TextCursorVob.java
diff -u gzz/gzz/vob/vobs/TextCursorVob.java:1.1 
gzz/gzz/vob/vobs/TextCursorVob.java:1.2
--- gzz/gzz/vob/vobs/TextCursorVob.java:1.1     Fri Nov  1 20:23:46 2002
+++ gzz/gzz/vob/vobs/TextCursorVob.java Mon Nov  4 17:15:04 2002
@@ -23,6 +23,7 @@
 package gzz.vob.vobs;
 import gzz.vob.*;
 import gzz.gfx.gl.GLRen;
+import gzz.gfx.gl.GLCache;
 import java.awt.Rectangle;
 import java.awt.Shape;
 import gzz.client.*;
@@ -38,7 +39,7 @@
  */
 
 public class TextCursorVob extends Vob {
-String rcsid = "$Id: TextCursorVob.java,v 1.1 2002/11/02 01:23:46 benja Exp $";
+String rcsid = "$Id: TextCursorVob.java,v 1.2 2002/11/04 22:15:04 tjl Exp $";
     public static boolean dbg = false;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -88,6 +89,17 @@
         g.drawLine(x, y, x, y + (int)h);
 
        //g.setClip(oldClip);
+    }
+
+    Vob dlist;
+    public int addToListGL(gzz.client.GraphicsAPI.Window win,
+                       int[] list, int curs, int coordsys1,
+                               int coordsys2) { 
+       if(dlist == null)
+           dlist = GLCache.getCallListCoorded(
+                   "Begin LINE_STRIP\nVertex 0 -.1\nVertex 0 1.1\nEnd\n");
+       curs = dlist.addToListGL(win, list, curs, coordsys1, coordsys2);
+       return curs;
     }
 }
 
Index: gzz/gzz/vob/vobs/TextVob.java
diff -u gzz/gzz/vob/vobs/TextVob.java:1.1 gzz/gzz/vob/vobs/TextVob.java:1.2
--- gzz/gzz/vob/vobs/TextVob.java:1.1   Fri Nov  1 20:23:46 2002
+++ gzz/gzz/vob/vobs/TextVob.java       Mon Nov  4 17:15:04 2002
@@ -48,7 +48,7 @@
  * XXX Diagram!
  */
 public class TextVob extends HBox.VobHBox {
-String rcsid = "$Id: TextVob.java,v 1.1 2002/11/02 01:23:46 benja Exp $";
+String rcsid = "$Id: TextVob.java,v 1.2 2002/11/04 22:15:04 tjl Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.err.println(s); }
 
@@ -82,6 +82,8 @@
         this(style, text, baselined);
        this.key = key;
     }
+
+    public TextStyle getTextStyle() { return style; }
 
     public String getText() { return text; }
 




reply via email to

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