gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] fenfire/org/fenfire modules/pp/PPCanvasCursor.j...


From: Matti Katila
Subject: [Gzz-commits] fenfire/org/fenfire modules/pp/PPCanvasCursor.j...
Date: Wed, 23 Apr 2003 19:40:41 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Matti Katila <address@hidden>   03/04/23 19:40:41

Modified files:
        org/fenfire/modules/pp: PPCanvasCursor.java PPCanvasNode.java 
                                Pp.java SinglePaper.java 
        org/fenfire/view: SimplePage.java 

Log message:
        get rid of pp uglines

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/PPCanvasCursor.java.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/PPCanvasNode.java.diff?tr1=1.21&tr2=1.22&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/Pp.java.diff?tr1=1.30&tr2=1.31&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/modules/pp/SinglePaper.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/SimplePage.java.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/modules/pp/PPCanvasCursor.java
diff -u fenfire/org/fenfire/modules/pp/PPCanvasCursor.java:1.27 
fenfire/org/fenfire/modules/pp/PPCanvasCursor.java:1.28
--- fenfire/org/fenfire/modules/pp/PPCanvasCursor.java:1.27     Wed Apr 23 
12:08:06 2003
+++ fenfire/org/fenfire/modules/pp/PPCanvasCursor.java  Wed Apr 23 19:40:40 2003
@@ -22,64 +22,11 @@
 /** PPCanvas which has been selected/created to be the focus one.
  */
 public class PPCanvasCursor implements BuoyViewMainNode {
-private static final String rcsid = "$Id: PPCanvasCursor.java,v 1.27 
2003/04/23 16:08:06 tjl Exp $";  
+private static final String rcsid = "$Id: PPCanvasCursor.java,v 1.28 
2003/04/23 23:40:40 mudyc Exp $";  
     public static boolean dbg = false;
     private static void p(String s) { if (dbg) pa(s); }
     private static void pa(String s) { 
System.out.println("PPCanvasCursor::"+s); }
 
-    // Geometry
-
-    /** The width of the main view.
-     */
-    public float mainWidth = 600;
-
-    /** The width of the left edge panel.
-     */
-    public float leftPanelWidth = 100;
-
-    /** The height of the entries in the left edge panel.
-     */
-    public float leftPanelObjectHeight = 100;
-
-    /** The "over-size" of the entries in the left panel
-     */
-    public float leftPanelRealHeight = 170,
-               leftPanelRealWidth = 230;
-
-    /** The zoom in the left panel
-     */
-    public float leftPanelZoom = .8f;
-
-    /** The height of the main view.
-     */
-    public float mainHeight = 600;
-
-    /** The Y position of the main view.
-     */
-    public float mainY = 100;
-
-    /** Buoy floater settings.
-     */
-    public float buoyCenterY = 400, buoyRadius = 400;
-
-    /** Buoy viewport geometry.
-     */
-    public float buoyVPWidth = 400, buoyVPHeight = 400;
-
-    /** Link buoy viewport geometry.
-     */
-    public float linkbuoyVPWidth = 200, linkbuoyVPHeight = 100;
-
-    /** The zoom to be used for the buoys.
-     */
-    public float buoyZoom = 1;
-
-    /** The zoom to be used for the link creation buoys.
-     */
-    public float linkbuoyZoom = .5f;
-
-
-    // Current state
 
     /** The current zoom.
      * Pixels for 1 paper coordinate unit.
@@ -163,49 +110,37 @@
                                       pt[1]+size[1]/2,
                                       size[0]/10,
                                       size[1]/10);
-           vs.put(new LineVob(0,0,0,1, java.awt.Color.white), cursor);
+           vs.put(new LineVob(0,0,0,1, java.awt.Color.yellow), cursor);
            p("Cursor");
        }
        
-       if (GraphicsAPI.getInstance() instanceof GLAPI) {
-
-           // Create the coordinate systems for the viewport.
-           // c2fCS = Canvas to frame, i.e. 
-           // the transformation from canvas coordinates
-           // to frame coordinates. Used for panning and zooming.
-           //
-           // The parameters for coordinate systems are set in setZoomPan:
-           // the numbers "42" below are placeholders which get replaced
-           // by the setOrthoParams code in setZoomPan
-           //
-           // Now, it is important that it is
-           // 1) transformation-descended from 0, since it is
-           //    just the pan-zoom part
-           c2fCS = vs.coords.ortho(0, 42, 42, 42, 42, 42);
-           // 2) Child of "into", for correct interpolation.
-           //    The canvas-to-frame coordinate system should
-           //    only be interpolated to another canvas-to-frame
-           //    cs IF their frames are interpolated into each other,
-           //    which is what this does.
-           vs.matcher.add(into, c2fCS, "C2F");
-
-           // The inverse of the previous transform; same
-           // rules apply.
-           int c2fCSInv = vs.coords.ortho(0, 42, 42, 42, 42, 42);
-           vs.matcher.add(into, c2fCSInv, "C2FINV");
-           
-           setZoomPan(vs, into);
-           SinglePaper.i(fen, node, window, nodeview)
-               .render(vs, into, c2fCS, c2fCSInv, hook);
-
-       } else {
-           int zo = (int)(zoom * 100000);
-           int geometry = vs.orthoBoxCS(into, "FocusGeometry",0, zo,0, 1,1, 
-panx, -pany);  
-           
-           vs.map.put(new UniquePaperVob(paper.toString()), into, geometry);
-           (new SpatialPlane(PP.Note, PP.contains)).renderAWT(vs, into, 
geometry,
-                                                                  node, 
nodeview, fen ,hook);
-       }
+       // Create the coordinate systems for the viewport.
+       // c2fCS = Canvas to frame, i.e. 
+       // the transformation from canvas coordinates
+       // to frame coordinates. Used for panning and zooming.
+       //
+       // The parameters for coordinate systems are set in setZoomPan:
+       // the numbers "42" below are placeholders which get replaced
+       // by the setOrthoParams code in setZoomPan
+       //
+       // Now, it is important that it is
+       // 1) transformation-descended from 0, since it is
+       //    just the pan-zoom part
+       c2fCS = vs.coords.ortho(0, 42, 42, 42, 42, 42);
+       // 2) Child of "into", for correct interpolation.
+       //    The canvas-to-frame coordinate system should
+       //    only be interpolated to another canvas-to-frame
+       //    cs IF their frames are interpolated into each other,
+       //    which is what this does.
+       vs.matcher.add(into, c2fCS, "C2F");
+       
+       // The inverse of the previous transform; same
+       // rules apply.
+       int c2fCSInv = vs.coords.ortho(0, 42, 42, 42, 42, 42);
+       vs.matcher.add(into, c2fCSInv, "C2FINV");
+       
+       setZoomPan(vs, into);
+       SinglePaper.i().render(node,vs, into, c2fCS, c2fCSInv, hook);
     }
 
     public void keystroke(String s) 
@@ -251,13 +186,8 @@
            zoom = m_state_zoom * (float) 
                Math.exp((m_state[1] - e.getY())/150.0);
            AbstractUpdateManager.setNoAnimation();
-           if (GraphicsAPI.getInstance() instanceof GLAPI) {
-               setZoomPan(oldVobScene, focusFrame);
-               return true;
-           } else {
-               AbstractUpdateManager.chg();
-               return false;
-           }
+           setZoomPan(oldVobScene, focusFrame);
+           return true;
        }
 
        // Move by dragging with button 1
@@ -265,13 +195,8 @@
            panx = pan[0] + (m_state[0] - e.getX())/zoom;
            pany = pan[1] + (m_state[1] - e.getY())/zoom;
 
-           if (GraphicsAPI.getInstance() instanceof GLAPI) {
-               setZoomPan(oldVobScene, focusFrame);
-               return true;
-           } else {
-               AbstractUpdateManager.chg();
-               return false;
-           }
+           setZoomPan(oldVobScene, focusFrame);
+           return true;
        }
        
        // Move around by clicking
@@ -279,41 +204,30 @@
 
            float[] pt = new float[] { e.getX(), e.getY(), 0 };
 
-           if (GraphicsAPI.getInstance() instanceof GLAPI) {
-               
-               // We must transform into Frame, and then the C2F coordinate 
system
-               int mainctrCS = 
((DefaultVobMatcher)oldVobScene.matcher).getCS(0, "FocusCenter");
-               //pa("mainctr"+ mainctrCS);
+           // We must transform into Frame, and then the C2F coordinate system
+           int mainctrCS = ((DefaultVobMatcher)oldVobScene.matcher).getCS(0, 
"FocusCenter");
+           //pa("mainctr"+ mainctrCS);
                
-               int frame = 
((DefaultVobMatcher)oldVobScene.matcher).getCS(mainctrCS, "FocusFrame");
-               //int frame = focusFrame;
-               int c2f = ((DefaultVobMatcher)oldVobScene.matcher).getCS(frame, 
"C2F");
-               if (c2f < 0) c2f = c2fCS;
-               if(frame < 0 || c2f < 0)
-                   throw new Error("No cs point!"+frame+" "+c2f);
+           int frame = 
((DefaultVobMatcher)oldVobScene.matcher).getCS(mainctrCS, "FocusFrame");
+           //int frame = focusFrame;
+           int c2f = ((DefaultVobMatcher)oldVobScene.matcher).getCS(frame, 
"C2F");
+           if (c2f < 0) c2f = c2fCS;
+           if(frame < 0 || c2f < 0)
+               throw new Error("No cs point!"+frame+" "+c2f);
                
-               // XXX vp, not frame!
-               oldVobScene.coords.inverseTransformPoints3(mainctrCS, pt, pt);
-               //oldVobScene.coords.inverseTransformPoints3(frame, pt, pt);
-               oldVobScene.coords.inverseTransformPoints3(c2f, pt, pt);
-               panx = pt[0]; pany = pt[1];
+           // XXX vp, not frame!
+           oldVobScene.coords.inverseTransformPoints3(mainctrCS, pt, pt);
+           //oldVobScene.coords.inverseTransformPoints3(frame, pt, pt);
+           oldVobScene.coords.inverseTransformPoints3(c2f, pt, pt);
+           panx = pt[0]; pany = pt[1];
                
-               // XXX current = current.h(d.contains);   
-               //setZoomPan(oldVobScene, focusFrame);
-               return false;
-           } else {
-               int focusFrame = oldVobScene.matcher.getCS("FocusFrame");
-               float box[] = new float[3];
-               box = oldVobScene.coords.transformPoints3(focusFrame, box, 
null);
-               float size[] = new float[2];
-               oldVobScene.coords.getSqSize(focusFrame, size);
-               panx += ((pt[0] - box[0]) - size[0]/2)/ zoom;
-               pany += ((pt[1] - box[1]) - size[1]/2)/ zoom;
-               
-               // XXX current = current.h(d.contains);   
-           }
+           // XXX current = current.h(d.contains);   
+           //setZoomPan(oldVobScene, focusFrame);
+           AbstractUpdateManager.chg();
+           return false;
        }
-       AbstractUpdateManager.chg();
+
+       p("nothing!");
        return false;
     }
 
Index: fenfire/org/fenfire/modules/pp/PPCanvasNode.java
diff -u fenfire/org/fenfire/modules/pp/PPCanvasNode.java:1.21 
fenfire/org/fenfire/modules/pp/PPCanvasNode.java:1.22
--- fenfire/org/fenfire/modules/pp/PPCanvasNode.java:1.21       Tue Apr 22 
08:14:32 2003
+++ fenfire/org/fenfire/modules/pp/PPCanvasNode.java    Wed Apr 23 19:40:40 2003
@@ -17,11 +17,13 @@
 
 
 public class PPCanvasNode implements NodeBuoyViewNodeType {
-private static final String rcsid = "$Id: PPCanvasNode.java,v 1.21 2003/04/22 
12:14:32 mudyc Exp $";  
+private static final String rcsid = "$Id: PPCanvasNode.java,v 1.22 2003/04/23 
23:40:40 mudyc Exp $";  
     public static boolean dbg = false;
     private static void p(String s) { if (dbg) pa(s); }
     private static void pa(String s) { System.out.println("PPCanvasNode::"+s); 
}
 
+    static private boolean paperReady = false;
+
     private Fen fen;
     private GraphicsAPI.Window win;
     private NodeView nodeview;
@@ -32,6 +34,10 @@
        this.win = w;
        this.nodeview = nodeview;
        this.context = context;
+       if (!paperReady) {
+           SinglePaper.i(fen, win, nodeview);
+           paperReady = true;
+       }
     }
     
     /** The zoom to be used for the buoys.
@@ -91,33 +97,14 @@
        pan[0] += bs[0]/2;
        pan[1] += bs[1]/2;
 
-       if (GraphicsAPI.getInstance() instanceof GLAPI) {
-           final int c2fCS = 
-               vs.coords.ortho(0,0, -pan[0]*buoyZoom, -pan[1]*buoyZoom, 
buoyZoom, buoyZoom);
-           vs.matcher.add(into, c2fCS, "C2F");
-           final int c2fCSInv = 
-               vs.coords.ortho(0,0, pan[0], pan[1], 1/buoyZoom, 1/buoyZoom);
-           vs.matcher.add(into, c2fCSInv, "C2FINV");
-           
-           SinglePaper.i(fen, node, win, nodeview)
-               .render(vs, into, c2fCS, c2fCSInv, null);
-           
-       } else {
-           int zo = (int)(buoyZoom * 100000);
-           int geometry = vs.orthoBoxCS(into, "FocusGeometry",0, zo,0, 1,1, 
pan[0], pan[1]);  
-
-           Object paper = node;
-           if (RDFUtil.isNodeType(fen, node, PP.Note)) {
-               paper = fen.constgraph.find1_X11(PP.contains, node);
-           }
-
-           p("vs:"+vs+" paper:"+paper+" into:"+into+" geometry:"+geometry);
-
-           vs.map.put(new UniquePaperVob(paper.toString()), into, geometry);
-           (new SpatialPlane(PP.Note, PP.contains)).renderAWT(vs, into, 
geometry,
-                                                                  node, 
nodeview, fen, null);
-       }
-
+       final int c2fCS = 
+           vs.coords.ortho(0,0, -pan[0]*buoyZoom, -pan[1]*buoyZoom, buoyZoom, 
buoyZoom);
+       vs.matcher.add(into, c2fCS, "C2F");
+       final int c2fCSInv = 
+           vs.coords.ortho(0,0, pan[0], pan[1], 1/buoyZoom, 1/buoyZoom);
+       vs.matcher.add(into, c2fCSInv, "C2FINV");
+       
+       SinglePaper.i().render(node, vs, into, c2fCS, c2fCSInv, null);
        return into;
     }
 
Index: fenfire/org/fenfire/modules/pp/Pp.java
diff -u fenfire/org/fenfire/modules/pp/Pp.java:1.30 
fenfire/org/fenfire/modules/pp/Pp.java:1.31
--- fenfire/org/fenfire/modules/pp/Pp.java:1.30 Wed Apr 23 13:04:06 2003
+++ fenfire/org/fenfire/modules/pp/Pp.java      Wed Apr 23 19:40:40 2003
@@ -28,7 +28,7 @@
 
 
 public class Pp implements BuoyLinkListener {
-public static final String rcsid = "$Id: Pp.java,v 1.30 2003/04/23 17:04:06 
mudyc Exp $";
+public static final String rcsid = "$Id: Pp.java,v 1.31 2003/04/23 23:40:40 
mudyc Exp $";
     public static final boolean dbg = false;
     protected static void p(String s) { if(dbg) pa(s); }
     protected static void pa(String s) { System.out.println("Pp::"+s); }
@@ -114,7 +114,7 @@
        AbstractUpdateManager.chg();
     }
 
-    // for zooming with gl
+    // for zooming
     private VobScene reUseVS = null;
     private final Shower shower = new Shower() {
            Screen screen;
Index: fenfire/org/fenfire/modules/pp/SinglePaper.java
diff -u fenfire/org/fenfire/modules/pp/SinglePaper.java:1.11 
fenfire/org/fenfire/modules/pp/SinglePaper.java:1.12
--- fenfire/org/fenfire/modules/pp/SinglePaper.java:1.11        Tue Apr 22 
08:14:32 2003
+++ fenfire/org/fenfire/modules/pp/SinglePaper.java     Wed Apr 23 19:40:40 2003
@@ -17,16 +17,18 @@
  * the background and the vobs inside the plane.
  */
 public class SinglePaper {
-private static final String rcsid = "$Id: SinglePaper.java,v 1.11 2003/04/22 
12:14:32 mudyc Exp $";  
+private static final String rcsid = "$Id: SinglePaper.java,v 1.12 2003/04/23 
23:40:40 mudyc Exp $";  
     public static boolean dbg = false;
     private static void p(String s) { if (dbg) pa(s); }
     private static void pa(String s) { System.out.println("SinglePaper::"+s); }
 
     // Singleton  <sigh> why do I do everything with singleton?
     // Even I hate globals..
+    private Vob black = null;
     private static SinglePaper paper;
     private SinglePaper() {
-       // ingenting
+       if (GraphicsAPI.getInstance() instanceof GLAPI)
+           black = GLCache.getCallList("Color 0 0 0\n");
     }
     public static SinglePaper i() {
        if (paper == null) paper = new SinglePaper();
@@ -35,27 +37,27 @@
 
     /** Get instance 
      */
-    public static SinglePaper i(Fen fen, Object node,
-                               GraphicsAPI.Window win, NodeView nodeview) {
-       i().set(fen, win, node, nodeview);
+    public static SinglePaper i(Fen fen, GraphicsAPI.Window win, 
+                               NodeView nodeview) 
+    {
+       i().set(fen, win, nodeview);
        return i();
     }
 
     /** Set the instance. This is usually made with i() method.
      */
     public void set(Fen fen, GraphicsAPI.Window win, 
-                   Object node, NodeView nodeview) {
+                   NodeView nodeview) {
        this.fen = fen;
-       //this.coordinatePlaneView = new CoordinatePlaneView();
        this.window = win;
-       this.node = node;
        this.nv = nodeview;
     }
 
-    private TextStyle style = GraphicsAPI.getInstance().getTextStyle("Sans", 
0, 20);
     private Fen fen;
-    private Object node;
     private NodeView nv;
+    private GraphicsAPI.Window window;
+    private SpatialPlane spatialplane = new SpatialPlane(PP.Note, PP.contains);
+
     // Visual characteristics of the virtual paper and ripple
 
     /** The scale of the background.
@@ -76,16 +78,6 @@
     public boolean useStencil = true;
 
 
-    private Vob black = GLCache.getCallList("Color 0 0 0\n");
-    //private CoordinatePlaneView coordinatePlaneView;
-    private SpatialPlane spatialplane = new SpatialPlane(PP.Note, PP.contains);
-
-    private GraphicsAPI.Window window;
-
-
-
-
-
 
     /** Render the plane.
      * @param frameCS The Box-coordinate system of the frame.
@@ -98,21 +90,15 @@
      *                 will be set to the center of the frameCS, and
      *                 the scale is 1 to 1 pixel.
      */
-    void render(final VobScene vs, final int frameCS, final int panZoom, 
-                   final int inversePanZoom,
-                   NodePlacementHook hook) 
+    void render(final Object node, final VobScene vs, final int frameCS, 
+               final int panZoom, final int inversePanZoom,
+               NodePlacementHook hook) 
     {
        p("render paper: "+node);
-
        final NodePlacementHook hook_final = hook;
 
-       // don't want to move this away from here..
-       // rest are set in CoordinatePlaneMultiView
-       //context.setCellView(cellview);
-
-       final GLVobCoorder_Gen glc = (GLVobCoorder_Gen)vs.coords;
        float[] sqs = new float[2];
-       glc.getSqSize(frameCS, sqs);
+       vs.coords.getSqSize(frameCS, sqs);
        p("Sqs frame: "+sqs[0]+" "+sqs[1]);
        //if (sqs[1] < 5) return;
 
@@ -120,7 +106,7 @@
        int framecenterCS = vs.translateCS(frameCS, "FCTR", sqs[0]/2, sqs[1]/2);
 
        // CS from virtualpaper to screen
-       final int paper2screen = glc.concat(framecenterCS, panZoom);
+       final int paper2screen = vs.coords.concat(framecenterCS, panZoom);
        vs.matcher.add(frameCS, paper2screen, "PAPER2S");
        final int bg2screen = vs.scaleCS(paper2screen, "BGSCA", 
                                         bgscale, bgscale);
@@ -129,8 +115,6 @@
        // frame2screen and paper2screen
        final BgVob bg = BgVob.create(node, window);
 
-       final IrregularFrame irregu = 
IrregularFrame.create(-16000,-16000,16000,16000,
-                                                      irreguBorder, 
irreguRipple, 2);
        final int frameUnit = vs.unitSqCS(frameCS, "USQ");
 
        final int frameUnit2paper = vs.orthoCS(inversePanZoom, "PZIN", 0, 
@@ -164,18 +148,33 @@
                                          node, frameCS, fen, hook_final, nv);
                }};
 
-       if(useStencil)
-           Stencil.drawStenciled(vs, 
-                                 new Putter(irregu.getContent()),
-                                 new Putter(irregu.getBlank()),
-                                 new Putter(irregu.getFrame()),
-                                 placeContent,
-                                 true);
-       else {
-           (new Putter(irregu.getContent())).run();
-           (new Putter(irregu.getFrame())).run();
-           (new Putter(irregu.getBlank())).run();
-           placeContent.run();
+       if (GraphicsAPI.getInstance() instanceof GLAPI) {
+           final IrregularFrame irregu = 
IrregularFrame.create(-16000,-16000,16000,16000,
+                                                               irreguBorder, 
irreguRipple, 2);
+           if(useStencil)
+               Stencil.drawStenciled(vs, 
+                                     new Putter(irregu.getContent()),
+                                     new Putter(irregu.getBlank()),
+                                     new Putter(irregu.getFrame()),
+                                     placeContent,
+                                     true);
+           else {
+               (new Putter(irregu.getContent())).run();
+               (new Putter(irregu.getFrame())).run();
+               (new Putter(irregu.getBlank())).run();
+               placeContent.run();
+           }
+       } else {
+           // XXX Need some work - later
+
+           int zoom = 1;
+           int panx=0, pany=0;
+           int into = 0;
+
+           int zo = (int)(zoom * 100000);
+           int geometry = vs.orthoBoxCS(into, "FocusGeometry",0, zo,0, 1,1, 
-panx, -pany);  
+           vs.map.put(new UniquePaperVob(paper.toString()), into, geometry);
+           spatialplane.renderAWT(vs, into, geometry, node, nv, fen ,hook);
        }
     }
 }
Index: fenfire/org/fenfire/view/SimplePage.java
diff -u fenfire/org/fenfire/view/SimplePage.java:1.2 
fenfire/org/fenfire/view/SimplePage.java:1.3
--- fenfire/org/fenfire/view/SimplePage.java:1.2        Wed Apr 23 17:07:30 2003
+++ fenfire/org/fenfire/view/SimplePage.java    Wed Apr 23 19:40:41 2003
@@ -4,6 +4,7 @@
 import org.fenfire.*;
 import org.nongnu.libvob.*;
 import org.nongnu.libvob.gl.*;
+import org.nongnu.libvob.impl.gl.*;
 import org.nongnu.libvob.util.CachingMap;
 
 import org.nongnu.alph.*;
@@ -15,7 +16,9 @@
 
     static private Vob frame = null;
     static {
-       if (frame == null) {
+       if (GraphicsAPI.getInstance() instanceof GLAPI &&
+           frame == null) 
+           {
            frame = GLRen.createCallListBoxCoorded(
                "PushAttrib ENABLE_BIT\n" +
                "Color 0 0 0\n" +




reply via email to

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