gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./Gzz.py gzz/view/CellMagnifier.java gzz/vi...


From: Benja Fallenstein
Subject: [Gzz-commits] gzz ./Gzz.py gzz/view/CellMagnifier.java gzz/vi...
Date: Mon, 06 Jan 2003 19:57:00 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      03/01/06 19:57:00

Modified files:
        .              : Gzz.py 
        gzz/view       : CellMagnifier.java DimDecorator.java 
                         RowColView.java VobVanishingClient.java 
        lava/gzz/potion/potions: Delete.java Go.java Step.java 
                                 Types.java 

Log message:
        Email client work. --four-lines magnifies cells by 4 on the Y axis
        but only 3 on the X axis. --bounded-size never magnifies fonts
        by more than factor 1 in Vanishing (meaning, it shrinks
        but doesn't enlarge)-- this means more text fits in the cells
        near the center. Fixed a bug in RowColView that showed less cells
        than possible.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Gzz.py.diff?tr1=1.66&tr2=1.67&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellMagnifier.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/DimDecorator.java.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/RowColView.java.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/VobVanishingClient.java.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Delete.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Go.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Step.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/potion/potions/Types.java.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gzz/Gzz.py
diff -u gzz/Gzz.py:1.66 gzz/Gzz.py:1.67
--- gzz/Gzz.py:1.66     Mon Jan  6 10:01:45 2003
+++ gzz/Gzz.py  Mon Jan  6 19:56:59 2003
@@ -28,7 +28,8 @@
 # Flags that can be passed to Gzz.py
 # (prefix with '--' on the command line)
 flagset = ['multiline', 'double-size', 'triple-size', 'lollipop',
-           'python-bindings', 'potion-bindings']
+           'python-bindings', 'potion-bindings', 'four-lines',
+           'bounded-vanishing-scale']
 
 
 def call(list, type=gzz.potion.CommandCall):
@@ -50,7 +51,7 @@
 
     def run(self):
         self.style = self.graphicsAPI.getTextStyle("SansSerif", 
java.awt.Font.PLAIN, 13);
-        self.views = [gzz.view.VobVanishingClient(),
+        self.views = [gzz.view.VobVanishingClient('bounded-vanishing-scale' 
not in self.flags),
                       gzz.view.RowColView(0), gzz.view.RowColView(1),
                       ]
         self.viewSpecificBinders = java.util.HashMap()
@@ -60,7 +61,10 @@
             self.cellContentView = \
                 gzz.view.LinebrokenCellContentView(self.style)
 
-        if 'triple-size' in self.flags:
+        if 'four-lines' in self.flags:
+            self.cellContentView = \
+                gzz.view.CellMagnifier(self.cellContentView, 3, 5)
+        elif 'triple-size' in self.flags:
             self.cellContentView = \
                 gzz.view.CellMagnifier(self.cellContentView, 3)
         elif 'double-size' in self.flags:
@@ -131,7 +135,7 @@
                                           TextCursorRight, SwitchToTextMode, \
                                           SwitchToNormalMode, MarkHalfRank, \
                                            ExtEdit, ViewContainedText, 
AndFilterFn, \
-                                           OrFilterFn
+                                           OrFilterFn, RootClone, Step
 
             from gzz.modules.email import AllEmailsThat, SubjectFilterFn, 
FromFilterFn, \
                                           ToFilterFn, OlderFilterFn, 
NewerFilterFn
@@ -153,7 +157,7 @@
                 'n': action([NewCell, None]),
                 '-': action([Connect, [PrefixOrOther], None]),
                'h': action([Hop2, None]),
-               'p': action([Put,[ThisWindow], [PrefixOrOther]], 1),
+                'p': action([Put,[ThisWindow], [PrefixOrOther]], 1),
                 'P': action([Put,[ThisWindow], [PrefixOrOther]], 0),
                'g': action([Go, [PrefixOrOther]], 1),
                'G': action([Go, [PrefixOrOther]], 0),
@@ -183,9 +187,9 @@
                 'Delete': action(call([Delete, [PrefixOrThis]])),
                 'Alt-Backspace': action(call([Delete, [PrefixOrThis]])),
                 'Shift-Delete': action(call([Delete, [PrefixOrThis]])),
-                'Alt-Shift-Delete': action(call([Delete, [PrefixOrThis]])),
-                'o': action(call([GoToOriginal, [ThisWindow]]), 1),
-                'O': action(call([GoToOriginal, [ThisWindow]]), 0),
+                'Alt-Shift-Backspace': action(call([Delete, [PrefixOrThis]])),
+                'o': action(call([Go, [RootClone, [ThisWindow]]]), 1),
+                'O': action(call([Go, [RootClone, [ThisWindow]]]), 0),
                'Tab': action(call([SwitchToTextMode])),
                'Tabulator': action(call([SwitchToTextMode])),
                 'Ctrl-E': action(call([ExtEdit, [PrefixOrThis]]), 1),
Index: gzz/gzz/view/CellMagnifier.java
diff -u gzz/gzz/view/CellMagnifier.java:1.3 gzz/gzz/view/CellMagnifier.java:1.4
--- gzz/gzz/view/CellMagnifier.java:1.3 Thu Dec  5 20:03:51 2002
+++ gzz/gzz/view/CellMagnifier.java     Mon Jan  6 19:57:00 2003
@@ -40,11 +40,16 @@
  */
 public class CellMagnifier extends CellView {
     protected CellView sub;
-    protected float factor;
+    protected float xfactor, yfactor;
 
     public CellMagnifier(CellView sub, float factor) {
+       this(sub, factor, factor);
+    }
+
+    public CellMagnifier(CellView sub, float xfactor, float yfactor) {
        this.sub = sub;
-       this.factor = factor;
+       this.xfactor = xfactor;
+       this.yfactor = yfactor;
     }
 
     public void place(Cell c, VobScene sc, int box,
@@ -53,13 +58,13 @@
     }
     public void getSize(Cell c, ViewContext context, float[] out) {
        sub.getSize(c, context, out);
-       out[0] *= factor;
-       out[1] *= factor;
+       out[0] *= xfactor;
+       out[1] *= yfactor;
     }
     public void getSize(Cell c, float scale, ViewContext context,
                        float[] out) {
        sub.getSize(c, scale, context, out);
-       out[0] *= factor;
-       out[1] *= factor;
+       out[0] *= xfactor;
+       out[1] *= yfactor;
     }
 }
Index: gzz/gzz/view/DimDecorator.java
diff -u gzz/gzz/view/DimDecorator.java:1.21 gzz/gzz/view/DimDecorator.java:1.22
--- gzz/gzz/view/DimDecorator.java:1.21 Wed Nov 27 11:35:41 2002
+++ gzz/gzz/view/DimDecorator.java      Mon Jan  6 19:57:00 2003
@@ -34,7 +34,7 @@
  *  vob scene.
  */
 public class DimDecorator implements FallbackSceneDecorator {
-String rcsid = "$Id: DimDecorator.java,v 1.21 2002/11/27 16:35:41 humppake Exp 
$";
+String rcsid = "$Id: DimDecorator.java,v 1.22 2003/01/07 00:57:00 benja Exp $";
     public static boolean dbg = true;
     private static void p(String s) { if(dbg) pa(s); }
     private static void pa(String s) { System.err.println(s); }
@@ -56,16 +56,13 @@
     public void render(VobScene sc, int into, Fallback fallback, Fallback.Win 
win) {
         //p("Placing DimDecorations");
 
-       float[] size = new float[2];
-       win.getCellView().getSize(null, win, size);
-
        int ndims = win.dimsIndices.length;
        Fallback.FallbackDim[] dims = new Fallback.FallbackDim[ndims];
 
        for(int i=0; i<ndims; i++)
            dims[i] = fallback.dimList[win.dimsIndices[i]];
 
-       float w = size[0], h = size[1];
+       float w = style.getWidth("XXXXXXXXX", 1) + 10, h = style.getHeight(1) + 
10;
 
        // The coordinate system where the lines start
        int orig = sc.orthoBoxCS(into, origKey, 0, 0, 0, 1, 1, w, h);
Index: gzz/gzz/view/RowColView.java
diff -u gzz/gzz/view/RowColView.java:1.15 gzz/gzz/view/RowColView.java:1.16
--- gzz/gzz/view/RowColView.java:1.15   Thu Dec  5 20:03:51 2002
+++ gzz/gzz/view/RowColView.java        Mon Jan  6 19:57:00 2003
@@ -69,8 +69,8 @@
             (int)(size.height / yroom),
         };
 
-        if(n[0] % 2 == 0) n[0]--;
-        if(n[1] % 2 == 0) n[1]--;
+        if(n[0] % 2 == 0) n[0]++;
+        if(n[1] % 2 == 0) n[1]++;
 
         float xoffs =
             (size.width - (n[0] * xroom) + (cellSize.width * spacing)) / 2;
Index: gzz/gzz/view/VobVanishingClient.java
diff -u gzz/gzz/view/VobVanishingClient.java:1.24 
gzz/gzz/view/VobVanishingClient.java:1.25
--- gzz/gzz/view/VobVanishingClient.java:1.24   Thu Dec  5 20:03:51 2002
+++ gzz/gzz/view/VobVanishingClient.java        Mon Jan  6 19:57:00 2003
@@ -42,12 +42,24 @@
     VobScene into;
     int intoCS;
 
+    /** Whether ever to create cells with a scale > 1.
+     *  This doesn't affect the size of cells,
+     *  just their scaling, i.e. the size of things
+     *  inside the box. By not allowing scale > 1,
+     *  more will fit in the bigger boxes at the center.
+     */
+    boolean enlargeScale;
+
 
     /** The SimpleConnection objects we use to connect cells */
     SimpleConnection[][] connections = new SimpleConnection[2][2];
     TDecor[] pstubs = new TDecor[2], nstubs = new TDecor[2];
 
     public VobVanishingClient() {
+       this(true);
+    }
+
+    public VobVanishingClient(boolean enlargeScale) {
         for(int i=0; i<2; i++)
             for(int j=0; j<2; j++) {
                float xloc = 0.5f + i/2.0f;
@@ -59,6 +71,8 @@
         pstubs[1] = new TDecor(true, 1);
         nstubs[0] = new TDecor(false, -1);
         nstubs[1] = new TDecor(true, -1);
+
+       this.enlargeScale = enlargeScale;
     }
 
     public String getDefaultName() { return "Vanishing view"; }
@@ -91,6 +105,7 @@
     public void place(Cell c, Object o, float fract, int x0, int y0, int x1, 
int y1,
                int depth, float rot) {
        Vob v = (Vob)o;
+       if(fract > 1 && !enlargeScale) fract = 1;
        int box = into.orthoBoxCS(intoCS, c, depth, x0, y0, fract, fract,
                    (x1-x0)/fract, (y1-y0)/fract);
        cell2Box.put(c, new Integer(box));
Index: gzz/lava/gzz/potion/potions/Delete.java
diff -u gzz/lava/gzz/potion/potions/Delete.java:1.3 
gzz/lava/gzz/potion/potions/Delete.java:1.4
--- gzz/lava/gzz/potion/potions/Delete.java:1.3 Sun Jan  5 11:32:28 2003
+++ gzz/lava/gzz/potion/potions/Delete.java     Mon Jan  6 19:57:00 2003
@@ -10,55 +10,55 @@
 
 public class Delete implements Command {
 
-       public String getString(Expression[] params, Map context) {
-               String s = params[0].getString(context);
-               return "Delete "+s;
-       }
+    public String getString(Expression[] params, Map context) {
+       String s = params[0].getString(context);
+       return "Delete "+s;
+    }
 
-       public void render(Expression[] params, Map context, HChain into) {
-       }
+    public void render(Expression[] params, Map context, HChain into) {
+    }
        
     public Type[] getParams() {
-               return null;
-       }
+       return null;
+    }
 
-       public void execute(List [] params, Map context) {
+    public void execute(List [] params, Map context) {
        
-               List cells = params[0];
+       List cells = params[0];
                           
-               for(Iterator i = cells.iterator(); i.hasNext();) {
-                       Cell c = (Cell)i.next();
+       for(Iterator i = cells.iterator(); i.hasNext();) {
+           Cell c = (Cell)i.next();
                        
-                       if(c.equals(c.space.getHomeCell())) {
-                           continue;
-                       } 
+           if(c.equals(c.space.getHomeCell())) {
+               continue;
+           } 
 
-                       Fallback.Win win = 
(Fallback.Win)context.get(ViewContext.class); 
-                       Dim[] d = win.dims;
-                       Cell cell = null;
-                       
-                       for(int j = 0; j < d.length; j++){
-                           cell = c.s(d[j]);   
-                           if(cell != null) {
-                                       win.cursor = cell;
-                               break;
-                           }
-                               
-                           cell = c.s(d[j],-1);        
-                           if(cell != null) {
-                                win.cursor = cell;
-                               break;
-                           }
-                           
-                       }
-                       
-                       if(cell == null) {
-                           win.cursor = c.space.getHomeCell();
-                       }
-                       
-                       c.delete();
-                        
+           Fallback.Win win = (Fallback.Win)context.get(ViewContext.class); 
+           Dim[] d = win.dims;
+           Cell cell = null;
+           
+           for(int j = 0; j < d.length; j++){
+               cell = c.s(d[j]);   
+               if(cell != null) {
+                   win.cursor = cell;
+                   break;
+               }
+               
+               cell = c.s(d[j],-1);    
+               if(cell != null) {
+                   win.cursor = cell;
+                   break;
                }
                
+           }
+           
+           if(cell == null) {
+               win.cursor = c.space.getHomeCell();
+           }
+           
+           c.delete();
+           
        }
-}
\ No newline at end of file
+       
+    }
+}
Index: gzz/lava/gzz/potion/potions/Go.java
diff -u gzz/lava/gzz/potion/potions/Go.java:1.1 
gzz/lava/gzz/potion/potions/Go.java:1.2
--- gzz/lava/gzz/potion/potions/Go.java:1.1     Sat Jan  4 11:25:15 2003
+++ gzz/lava/gzz/potion/potions/Go.java Mon Jan  6 19:57:00 2003
@@ -12,7 +12,7 @@
 
        public Go() {
           super(new Object[] {
-              "Go to", Types.CELL });
+              "Go to ", Types.CELL });
        }
 
        public void execute(List[] params, Map context) {
@@ -20,10 +20,11 @@
           for(Iterator i=params[0].iterator(); i.hasNext();) {
               Cell c = (Cell)i.next();
 
-
-              Fallback.Win win = (Fallback.Win)context.get(ViewContext.class);
-              win.cursor = c;
+               if(c != null){
+                  Fallback.Win win = 
(Fallback.Win)context.get(ViewContext.class);
+                  win.cursor = c;
+               }
           }
         }
 
-}
\ No newline at end of file
+}
Index: gzz/lava/gzz/potion/potions/Step.java
diff -u gzz/lava/gzz/potion/potions/Step.java:1.3 
gzz/lava/gzz/potion/potions/Step.java:1.4
--- gzz/lava/gzz/potion/potions/Step.java:1.3   Mon Dec 30 12:47:33 2002
+++ gzz/lava/gzz/potion/potions/Step.java       Mon Jan  6 19:57:00 2003
@@ -6,42 +6,35 @@
 import gzz.*;
 import gzz.potion.*;
 
-public class Step implements Function {
+public class Step extends AbstractHead  implements Function {
        
-       public List evaluate(List[] params, Map context) {
+    public Step() {
+       super(new Object[] {
+           "The cell ", Types.COUNT, " steps ", Types.DIR, " of  ",Types.CELL,
+       });
+    }
+
+    public List evaluate(List[] params, Map context) {
                        
-               List result = new ArrayList();
+       List result = new ArrayList();
 
-               for(Iterator i = params[0].iterator(); i.hasNext();) {
-                       Integer n = (Integer)i.next();
+       for(Iterator i = params[0].iterator(); i.hasNext();) {
+           Integer n = (Integer)i.next();
                
-                       for(Iterator j= params[1].iterator(); j.hasNext();) {
-                               Direction dir = (Direction)j.next();
-
-                               for(Iterator k = params[2].iterator(); 
k.hasNext();) {
-                                       Cell c = (Cell)k.next();
-                       
-                                       if(dir.dir >= 0) 
-                                               result.add(c.s(dir.dim, 
n.intValue()));                 
-                                       else 
-                                               result.add(c.s(dir.dim, 
-n.intValue()));
-                               }
-                       }
+           for(Iterator j= params[1].iterator(); j.hasNext();) {
+               Direction dir = (Direction)j.next();
+               
+               for(Iterator k = params[2].iterator(); k.hasNext();) {
+                   Cell c = (Cell)k.next();
+                   
+                   if(dir.dir >= 0) 
+                       result.add(c.s(dir.dim, n.intValue()));                 
+                   else 
+                       result.add(c.s(dir.dim, -n.intValue()));
                }
-               return result;
+           }
        }
+       return result;
+    }
 
-       public String getString(Expression[] params, Map context) {
-               String s = params[0].getString(context);
-               String t = params[1].getString(context);
-               String u = params[2].getString(context);
-               return "the cell "+s+" steps "+t+" of "+u ;
-       }
-       
-       public void render(Expression[] params,Map context, HChain into) {
-       }
-       
-       public Type[] getParams() {
-               return null;
-       }
 }
Index: gzz/lava/gzz/potion/potions/Types.java
diff -u gzz/lava/gzz/potion/potions/Types.java:1.7 
gzz/lava/gzz/potion/potions/Types.java:1.8
--- gzz/lava/gzz/potion/potions/Types.java:1.7  Mon Jan  6 06:42:54 2003
+++ gzz/lava/gzz/potion/potions/Types.java      Mon Jan  6 19:57:00 2003
@@ -35,8 +35,9 @@
     public static Type POS_OR_NEG = new SimpleType("posward or negward?");
     public static Type FILTER = new SimpleType("which filter?");
     public static Type PERSON = new SimpleType("whom?");
-    public static Type TEXT = new SimpleType("which text");
-    public static Type DATE = new SimpleType("which date");
+    public static Type TEXT = new SimpleType("which text?");
+    public static Type DATE = new SimpleType("which date?");
+    public static Type COUNT = new SimpleType("how many?");
 
     public static Type DIR = new SimpleType("which direction?") {
            public FunctionExpression readDir(int win, int axis, int dir,




reply via email to

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