gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] fenfire/org/fenfire demo/buoyoing.py modules/pp...


From: Matti Katila
Subject: [Gzz-commits] fenfire/org/fenfire demo/buoyoing.py modules/pp...
Date: Sun, 04 May 2003 21:38:50 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Matti Katila <address@hidden>   03/05/04 21:38:50

Modified files:
        org/fenfire/demo: buoyoing.py 
        org/fenfire/modules/pp: RSTActions.java RSTActionsImpl.java 
        org/fenfire/view: CanvasView2D.java PageSpanLayout.java 
        org/fenfire/view/buoy: AbstractMainNode2D.java MainNode2D.java 
        org/fenfire/vocab: RST.java 
Added files:
        org/fenfire/view: FenPDFContext.java 

Log message:
        towards context

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/demo/buoyoing.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/RSTActions.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/RSTActionsImpl.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/FenPDFContext.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/CanvasView2D.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/PageSpanLayout.java.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/MainNode2D.java.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/vocab/RST.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/demo/buoyoing.py
diff -u fenfire/org/fenfire/demo/buoyoing.py:1.41 
fenfire/org/fenfire/demo/buoyoing.py:1.42
--- fenfire/org/fenfire/demo/buoyoing.py:1.41   Sat May  3 09:35:14 2003
+++ fenfire/org/fenfire/demo/buoyoing.py        Sun May  4 21:38:49 2003
@@ -103,11 +103,10 @@
     note = ff.swamp.Nodes.N()
     ff.util.AlphContent(fen).setText(note, 'This is rst canvas test', 1)
     rst.insertNode(senten, note, 0)
-    rst.generateBasicSpatialCoords(canvas)
 
     ppAct.assocNotes(noteA2, 1, Nodes.toString(note))
     ppAct.assocNotes(noteB1, -1, noteA1)
-    
+
 
 vob.view.FisheyeState.dbg = 1
 textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sans", 0, 24)
@@ -124,6 +123,15 @@
 
 ff.view.buoy.NodeType2D.effigy = 0
 ff.view.buoy.NodeType2DFull.effigy = 0
+
+rst.generateBasicSpatialCoords(canvas, nodeview)
+context = ff.view.FenPDFContext(fen, rst, nodeview)
+context.setAccursed(note)
+context.setRSTNode(senten)
+ff.view.buoy.MainNode2D.fen = fen
+ff.view.buoy.AbstractMainNode2D.context = context
+
+
 
 # irregu.debugFlags = irregu.DEBUG_CONTENT | irregu.DEBUG_CHILD
 # irregu.border = 10
Index: fenfire/org/fenfire/modules/pp/RSTActions.java
diff -u fenfire/org/fenfire/modules/pp/RSTActions.java:1.1 
fenfire/org/fenfire/modules/pp/RSTActions.java:1.2
--- fenfire/org/fenfire/modules/pp/RSTActions.java:1.1  Thu May  1 20:22:40 2003
+++ fenfire/org/fenfire/modules/pp/RSTActions.java      Sun May  4 21:38:49 2003
@@ -1,6 +1,7 @@
 // (c): Matti J. Katila
 
 package org.fenfire.modules.pp;
+import org.fenfire.swamp.NodeFunction;
 
 import java.io.IOException;
 import java.rmi.RemoteException;
@@ -44,7 +45,17 @@
 
     /** Generate the nodes' coordinates.
      */
-    void generateBasicSpatialCoords(Object rstCanvas) 
+    void generateBasicSpatialCoords(Object rstCanvas, 
+                                   NodeFunction nodef) 
        throws RemoteException;
 
+
+
+    // gets
+    Object getSentence(Object node)
+       throws RemoteException;
+    Object getParagraph(Object sentence)
+       throws RemoteException;
+    Object getRSTCanvas(Object paragraph)
+       throws RemoteException;
 }
Index: fenfire/org/fenfire/modules/pp/RSTActionsImpl.java
diff -u fenfire/org/fenfire/modules/pp/RSTActionsImpl.java:1.1 
fenfire/org/fenfire/modules/pp/RSTActionsImpl.java:1.2
--- fenfire/org/fenfire/modules/pp/RSTActionsImpl.java:1.1      Thu May  1 
20:22:40 2003
+++ fenfire/org/fenfire/modules/pp/RSTActionsImpl.java  Sun May  4 21:38:49 2003
@@ -10,21 +10,19 @@
 import java.rmi.server.*;
 import java.util.Iterator;
 
-//import org.nongnu.alph.impl.*;
+import org.nongnu.libvob.lava.placeable.Placeable;
 import org.fenfire.impl.*;
 
 /** The implementation of RSTActions.
  */
 public class RSTActionsImpl extends UnicastRemoteObject implements RSTActions {
-public static final String rcsid = "$Id: RSTActionsImpl.java,v 1.1 2003/05/02 
00:22:40 mudyc Exp $";
+public static final String rcsid = "$Id: RSTActionsImpl.java,v 1.2 2003/05/05 
01:38:49 mudyc Exp $";
     public static final boolean dbg = true;
-    protected static void pa(String s) { System.out.println("RSTActionsImpl: 
"+s); }
+    protected static void p(String s) { System.out.println("RSTActionsImpl: 
"+s); }
 
     private Fen fen = null;
-    private AlphContent alphContent;
     public void setFen(Fen fen) { 
        this.fen = fen; 
-       this.alphContent = new AlphContent(fen);
     }
 
     public RSTActionsImpl(Fen fen)  throws RemoteException {
@@ -40,7 +38,7 @@
 
     public Object newRSTCanvas() throws RemoteException 
     { synchronized(fen) {
-       if(dbg) pa("make a new rst canvas");
+       if(dbg) p("make a new rst canvas");
        Object canvas = RDFUtil.N(fen, RST.Canvas);
        fen.graph.add(canvas, RDF.type, PAPER.Canvas);
        return canvas;
@@ -110,7 +108,7 @@
        return;
     }}
 
-    private Object getRSTCanvas(Object paragraph)
+    public Object getRSTCanvas(Object paragraph)
     { synchronized(fen) {
        if (! RDFUtil.isNodeType(fen, paragraph, RST.Paragraph)) 
            throw new Error("paragraph is not paragraph! "+paragraph);
@@ -120,7 +118,7 @@
            return canvas;
        else throw new Error("Big mistake, canvas isn't canvas!"+ canvas);
     }}
-    private Object getParagraph(Object sentence)
+    public Object getParagraph(Object sentence)
     { synchronized(fen) {
        if (! RDFUtil.isNodeType(fen, sentence, RST.Sentence)) 
            throw new Error("sentence is not sentence! "+sentence);
@@ -131,15 +129,17 @@
            curr = prev;
            prev = fen.graph.find1_X11(RST.nextNode, curr);
        }
-       pa("curr: "+curr);
+       p("curr: "+curr);
        Object parag = fen.graph.find1_X11(RST.firstSentence, curr);
        if (RDFUtil.isNodeType(fen, parag, RST.Paragraph)) 
            return parag;
        else throw new Error("paragraph is not paragraph! "+parag);
     }}
-    private Object getSentence(Object node)
+    public Object getSentence(Object node)
     { synchronized(fen) {
        if (node == null) throw new Error("node is null!"+ node);
+       if (! RDFUtil.isNodeType(fen, node, RST.Node)) 
+           throw new Error("node is not a node! "+node);
 
        Object sentence = fen.graph.find1_X11(RST.nextNode, node);
        Object prev = sentence;
@@ -187,6 +187,9 @@
            if (next != null)
                fen.graph.set1_11X(node, RST.nextNode, next);
        }           
+       if (! RDFUtil.isNodeType(fen, node, RST.Node)) 
+           fen.graph.add(node, RDF.type, RST.Node);
+
        Object canvas = getRSTCanvas(getParagraph(getSentence(node)));
        fen.graph.add(canvas, PAPER.contains, node);
     }}
@@ -200,27 +203,31 @@
 
     /** Generate the nodes' coordinates.
      */
-    public void generateBasicSpatialCoords(Object rstCanvas) 
+    public void generateBasicSpatialCoords(Object rstCanvas, NodeFunction 
nodef) 
        throws RemoteException
     { synchronized(fen) {
        if (! RDFUtil.isNodeType(fen, rstCanvas, RST.Canvas)) 
            throw new Error("canvas is not canvas! "+rstCanvas);
 
-       if (dbg) pa("generate");
+       if (dbg) p("generate");
 
        Iterator iter = fen.constgraph.findN_11X_Iter(rstCanvas, 
RST.beginParagraph);
        while (iter.hasNext() ) {
-           pa("paragraph");
+           if (dbg) p("paragraph");
            Object parag = iter.next();
            int paragX = RDFUtil.getInt(fen, parag, SPATIAL.coordX);
            int paragY = RDFUtil.getInt(fen, parag, SPATIAL.coordY);
            Object senten = fen.graph.find1_11X(parag, RST.firstSentence);
            for (int iy=0; senten != null; iy++) {
-               pa("senten"+iy);
+               if (dbg) p("senten, "+iy);
                Object node = fen.graph.find1_11X(senten, RST.nextNode);
+               int x = paragX;
                for (int ix=0; node != null; ix++) {
-                   pa("senten"+ix);
-                   int x = paragX + ix*60;
+                   if (dbg) p("node, "+ix);
+
+                   Placeable p = (Placeable)nodef.f(fen.constgraph, node);
+
+                   x += p.getWidth();
                    int y = paragY + iy*30;
                    // set coords
                    fen.graph.set1_11X(node, SPATIAL.coordX, 
Nodes.getStringLiteral(""+x) );
@@ -231,7 +238,7 @@
                senten = fen.graph.find1_11X(senten, RST.nextSentence);
            }
        }
-       if (dbg) pa("generate..DONE");
+       if (dbg) p("generate..DONE");
        return;
     }}
 
Index: fenfire/org/fenfire/view/CanvasView2D.java
diff -u fenfire/org/fenfire/view/CanvasView2D.java:1.10 
fenfire/org/fenfire/view/CanvasView2D.java:1.11
--- fenfire/org/fenfire/view/CanvasView2D.java:1.10     Fri May  2 20:57:00 2003
+++ fenfire/org/fenfire/view/CanvasView2D.java  Sun May  4 21:38:49 2003
@@ -20,7 +20,7 @@
 /** A View2D on a PP-like canvas.
  */
 public class CanvasView2D extends View2D {
-public static final String rcsid = "$Id: CanvasView2D.java,v 1.10 2003/05/03 
00:57:00 mudyc Exp $";
+public static final String rcsid = "$Id: CanvasView2D.java,v 1.11 2003/05/05 
01:38:49 mudyc Exp $";
     public static boolean dbg = false;
     private static void pa(String s) { System.out.println("CanvasView2D::"+s); 
}
     
@@ -32,7 +32,6 @@
        this.fen = fen;
        this.nodeView = nodeView;
     }
-
 
     public void render(VobScene vs, Object container,
                       int matchingParent, int box2screen, int box2plane)
Index: fenfire/org/fenfire/view/PageSpanLayout.java
diff -u fenfire/org/fenfire/view/PageSpanLayout.java:1.8 
fenfire/org/fenfire/view/PageSpanLayout.java:1.9
--- fenfire/org/fenfire/view/PageSpanLayout.java:1.8    Mon Apr 28 07:46:49 2003
+++ fenfire/org/fenfire/view/PageSpanLayout.java        Sun May  4 21:38:49 2003
@@ -17,7 +17,7 @@
     implements org.nongnu.libvob.lava.placeable.Placeable {
 
     public static boolean dbg = false;
-    private void pa(String s) { System.out.println(s); }
+    private void p(String s) { System.out.println("PageSpanLayout:: "+s); }
 
     public static final float scale = 72 * 6;
 
@@ -75,12 +75,12 @@
        xywh[4*p + 2] = psps[p].getX(d_p.width);
        xywh[4*p + 3] = psps[p].getY(d_p.height);
 
-       if(dbg) pa("Page "+p+" "+
-                   xywh[4*p+0]+" "+
-                   xywh[4*p+1]+" "+
-                   xywh[4*p+2]+" "+
-                   xywh[4*p+3]+" "+
-                   pages[p]);
+       if(dbg) p("Page "+p+" "+
+                 xywh[4*p+0]+" "+
+                 xywh[4*p+1]+" "+
+                 xywh[4*p+2]+" "+
+                 xywh[4*p+3]+" "+
+                 pages[p]);
 
        w += scale * xywh[4*p + 2];
        if(h < scale * xywh[4*p + 3])
@@ -146,9 +146,9 @@
                                psps[p].getY(l_c.y) - xywh[4*p + 1]);
                xywh_out[3] = scale * psps[p].getY(d_c.height);
 
-               if(dbg) pa("Center found: "+p+" "+pages[p]+" "+
-                           xywh_out[0] + " " + xywh_out[1] + " " +
-                           xywh_out[2] + " " + xywh_out[3] + " " );
+               if(dbg) p("Center found: "+p+" "+pages[p]+" "+
+                         xywh_out[0] + " " + xywh_out[1] + " " +
+                         xywh_out[2] + " " + xywh_out[3] + " " );
                
                return xywh_out;
            }
@@ -222,18 +222,18 @@
                    float importanceAt, 
                    float importanceOutside,
                    float pixelscale) {
-       if(dbg) pa("Request: "+x+" "+y+" "+radius);
+       if(dbg) p("Request: "+x+" "+y+" "+radius);
        float curx = 0;
        for(int p = 0; p < npages; p++) {
            float dx = Math.abs((curx + .5f * scale * xywh[4*p+2]) - x) - 
.5f*scale * xywh[4*p+2];
            float dy = Math.abs((.5f * scale * xywh[4*p+3]) - y) - .5f*scale * 
xywh[4*p+3];
-           if(dbg) pa("RequestCoords: "+xywh[4*p+0]+" "+xywh[4*p+1]+" "+
+           if(dbg) p("RequestCoords: "+xywh[4*p+0]+" "+xywh[4*p+1]+" "+
                                    xywh[4*p+2]+" "+xywh[4*p+3]);
            float dist = Math.max(dx, dy);
            if(dist < 0) {
                psps[p].request(importanceAt, pixelscale);
            } else if(dist < radius) {
-               if(dbg) pa("Request DO: "+dx+" "+dy);
+               if(dbg) p("Request DO: "+dx+" "+dy);
                psps[p].request(importanceOutside * (1-dist/radius),
                                 pixelscale);
            }
Index: fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.4 
fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.5
--- fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java:1.4   Sat May  3 
07:17:43 2003
+++ fenfire/org/fenfire/view/buoy/AbstractMainNode2D.java       Sun May  4 
21:38:50 2003
@@ -47,6 +47,15 @@
        this.panX = panX; this.panY = panY;
     }
 
+
+    /** Ugly hack! Fix fix fix..
+     */
+    static public org.fenfire.view.FenPDFContext context = null;
+    public void keystroke(String s) {
+       context.handleKeyStroke(s, view2d);
+    }
+
+
     /** Cause the changes to the zooming and panning variables
      * to be shown in the given vobscene.
      * This changes the parameters of the coordinate systems 
@@ -84,19 +93,6 @@
        AbstractUpdateManager.chg();
     }
 
-
-
-    /** Ugly hack! Fix fix fix..
-     */
-    static public org.fenfire.Fen fen = null;
-    /** Ugly hack! Fix fix fix..
-     */
-    static public org.fenfire.modules.pp.RSTActionsImpl rst = null;
-
-
-    public void keystroke(String s) {
-       pa("Key:"+s);
-    }
 
     // Mouse press state
     // x, y, buttons
Index: fenfire/org/fenfire/view/buoy/MainNode2D.java
diff -u fenfire/org/fenfire/view/buoy/MainNode2D.java:1.16 
fenfire/org/fenfire/view/buoy/MainNode2D.java:1.17
--- fenfire/org/fenfire/view/buoy/MainNode2D.java:1.16  Sat May  3 07:17:43 2003
+++ fenfire/org/fenfire/view/buoy/MainNode2D.java       Sun May  4 21:38:50 2003
@@ -33,13 +33,20 @@
 
 import java.awt.event.MouseEvent;
 
+import org.fenfire.util.*;
+import org.fenfire.vocab.*;
+
 /** A BuoyViewMainNode showing a 2D plane rendered through
  *  a View2D. This class implements the keyboard and mouse
  *  command for moving on the spatial plane.
  */
 public class MainNode2D extends AbstractMainNode2D {
     public static boolean dbg = true;
-    private static void pa(String s) { System.out.println("MainNode2D:: "+s); }
+    private static void p(String s) { System.out.println("MainNode2D:: "+s); }
+
+    /** Ugly hack!!! XXX
+     */
+    static public org.fenfire.Fen fen = null;
     
     protected float zoom;
 
@@ -85,6 +92,10 @@
        box2paper = vs.coords.orthoBox(0,0,0,0,0,0,0,0);
        vs.matcher.add(box2screen, box2paper, "BOX2PAPER");
        setZoomPan(vs, box2paper);
+
+       if (RDFUtil.isNodeType(fen, plane, PP.Paper) ||
+           RDFUtil.isNodeType(fen, plane, RST.Canvas)) ;
+       else throw new Error("plane is NOT a container!");
 
        view2d.render(vs, plane, into, into, box2paper);
     }
Index: fenfire/org/fenfire/vocab/RST.java
diff -u fenfire/org/fenfire/vocab/RST.java:1.1 
fenfire/org/fenfire/vocab/RST.java:1.2
--- fenfire/org/fenfire/vocab/RST.java:1.1      Thu May  1 20:26:54 2003
+++ fenfire/org/fenfire/vocab/RST.java  Sun May  4 21:38:50 2003
@@ -6,7 +6,7 @@
 
 /** Vocabulary for RST text like canvas */
 public class RST {
-public static final String rcsid = "$Id: RST.java,v 1.1 2003/05/02 00:26:54 
mudyc Exp $";
+public static final String rcsid = "$Id: RST.java,v 1.2 2003/05/05 01:38:50 
mudyc Exp $";
     protected static void pa(String s) { System.out.println("RST: "+s); }
 
     // Propertys
@@ -20,20 +20,21 @@
     static public Object Canvas;
     static public Object Paragraph;
     static public Object Sentence;
-
+    static public Object Node;
 
     static {
-       String rst = "http://fenfire.org/vocabulary/rst.html";;
+       String rst = "http://fenfire.org/vocabulary/rst.html#";;
 
        // Propertys
-       beginParagraph = Nodes.get(rst+"#beginParagraph");
-       nextNode = Nodes.get(rst+"#nextNode");
-       nextSentence = Nodes.get(rst+"#nextSentence");
+       beginParagraph = Nodes.get(rst+"beginParagraph");
+       nextNode = Nodes.get(rst+"nextNode");
+       nextSentence = Nodes.get(rst+"nextSentence");
        firstSentence = Nodes.get(rst+"firstSentence");
 
        // Resources
-       Canvas = Nodes.get(rst+"#Canvas");
-       Paragraph = Nodes.get(rst+"#Paragraph");
-       Sentence = Nodes.get(rst+"#Sentence");
+       Canvas = Nodes.get(rst+"Canvas");
+       Paragraph = Nodes.get(rst+"Paragraph");
+       Sentence = Nodes.get(rst+"Sentence");
+       Node = Nodes.get(rst+"Node");
     }
 }




reply via email to

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