gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz ./Makefile ./TODO gfx/libcoords/Coords.cxx ...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./Makefile ./TODO gfx/libcoords/Coords.cxx ...
Date: Wed, 09 Oct 2002 10:38:42 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/09 10:38:42

Modified files:
        .              : Makefile TODO 
        gfx/libcoords  : Coords.cxx 
        gzz/gfx/gl     : GLVobCoorder.java 
        gzz/modules/pp : BuoyView.java PlaneView.java Win.java 
                         demotest.py 
        test           : testutil.py 
Added files:
        gzz/vob/buoy   : CircleFloater4.java 
        test/gzz/gfx/gl: basicrender.test 

Log message:
        Pre-demo changes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Makefile.diff?tr1=1.186&tr2=1.187&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.263&tr2=1.264&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/gfx/gl/GLVobCoorder.java.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/BuoyView.java.diff?tr1=1.28&tr2=1.29&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/PlaneView.java.diff?tr1=1.52&tr2=1.53&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/Win.java.diff?tr1=1.53&tr2=1.54&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/modules/pp/demotest.py.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/buoy/CircleFloater4.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/testutil.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/test/gzz/gfx/gl/basicrender.test?rev=1.1

Patches:
Index: gzz/Makefile
diff -c gzz/Makefile:1.186 gzz/Makefile:1.187
*** gzz/Makefile:1.186  Wed Oct  9 04:24:45 2002
--- gzz/Makefile        Wed Oct  9 10:38:41 2002
***************
*** 387,397 ****
  test::
        $(JYTHON) test/test.py
  testgl::
!       $(GLLIB) $(JYTHON) test/test.py jni
  runtest:  # Use: make runtest TEST=gzz/vob/vobmatcher, to run a single test.
        $(GLLIB) $(JYTHON) test/testutil.py $(DBG) test/$(TEST).test
  runtestjni: # In JNI-dependent test's requestJNI must be defined.
!       $(GLLIB) $(JYTHON) test/testutil.py $(DBG) jni test/$(TEST).test
  run:
        $(JYTHON) Gzz.py $(DBG) -Dgzzclient=awt $(Z)
  rungl:
--- 387,397 ----
  test::
        $(JYTHON) test/test.py
  testgl::
!       $(GLLIB) $(JYTHON) -Dgzzclient=gl test/test.py jni
  runtest:  # Use: make runtest TEST=gzz/vob/vobmatcher, to run a single test.
        $(GLLIB) $(JYTHON) test/testutil.py $(DBG) test/$(TEST).test
  runtestjni: # In JNI-dependent test's requestJNI must be defined.
!       $(GLLIB) $(JYTHON) test/testutil.py -Dgzzclient=gl $(DBG) jni 
test/$(TEST).test
  run:
        $(JYTHON) Gzz.py $(DBG) -Dgzzclient=awt $(Z)
  rungl:
***************
*** 452,457 ****
--- 452,459 ----
  compilegl: compile
        make -C gfx all
  
+ gzzgl: # Only for people who know what they're doing
+       make -C gfx all
  
  DATE:=$(shell date '+%Y%m%d%H%M%S')
  PPDIR:=pp-$(DATE)
Index: gzz/TODO
diff -c gzz/TODO:1.263 gzz/TODO:1.264
*** gzz/TODO:1.263      Wed Oct  9 06:57:49 2002
--- gzz/TODO    Wed Oct  9 10:38:41 2002
***************
*** 67,74 ****
        - culling of coordsys: coordsys may, at setparams time,
          decide not to be shown.
            - generalizes culledpaperquad
!           - Talk to Tjl: this needs coordsystems to have more
!             than one parent.
        - fix the way nonlinearity of coordsys is handled.
          Needs a slightly better approach, with also 
          direction of nonlinearity taken into account.
--- 67,73 ----
        - culling of coordsys: coordsys may, at setparams time,
          decide not to be shown.
            - generalizes culledpaperquad
!           - see CoordSys::shouldBeDrawn
        - fix the way nonlinearity of coordsys is handled.
          Needs a slightly better approach, with also 
          direction of nonlinearity taken into account.
***************
*** 84,90 ****
      tjl:
        - PP [deadline 9.10]
            - make it work again
-               - buoys
                - cs keys
                - bindings
            - fix directory geometry
--- 83,88 ----
***************
*** 93,98 ****
--- 91,98 ----
            - textured, colored frames
            - directory into global map?
            - speedups 
+       - abstract out the one-parent, one-defining, inherited-from-
+         normal-transofmration cs type as template
        - help Benja fixing AWT client [deadline: 7.10!]
              - Fix connections: currently from ul corner to ul corner
                of cells because of the way coordsys work now
Index: gzz/gfx/libcoords/Coords.cxx
diff -c gzz/gfx/libcoords/Coords.cxx:1.35 gzz/gfx/libcoords/Coords.cxx:1.36
*** gzz/gfx/libcoords/Coords.cxx:1.35   Tue Oct  8 15:02:34 2002
--- gzz/gfx/libcoords/Coords.cxx        Wed Oct  9 10:38:41 2002
***************
*** 76,81 ****
--- 76,97 ----
  
      };
  
+     template<class Transform, class Deriver> 
+               class DerivedTransformCoordSys : 
+                   public TransformCoordSys<Transform> {
+       CoordSys *dep;
+       virtual void setSuper(CoordSys **super) {
+           CoordSys::setSuper(super);
+           this->dep = super[1];
+       }
+       virtual void setParams(float *params) {
+           Deriver d;
+           float nparams[Transform::NParams];
+           d.derivedParams(params, nparams);
+           t.setParams(nparams, super);
+       }
+     };
+ 
      template<class Transform> class InverseTransformCoordSys : public 
TransformCoordSysBase<Transform> {
      public:
        template<class Original> InverseTransformCoordSys(CoordSys *s, Original 
&o) : 
Index: gzz/gzz/gfx/gl/GLVobCoorder.java
diff -c gzz/gzz/gfx/gl/GLVobCoorder.java:1.39 
gzz/gzz/gfx/gl/GLVobCoorder.java:1.40
*** gzz/gzz/gfx/gl/GLVobCoorder.java:1.39       Tue Oct  8 14:23:43 2002
--- gzz/gzz/gfx/gl/GLVobCoorder.java    Wed Oct  9 10:38:41 2002
***************
*** 29,35 ****
  import gzz.client.gl.*;
  
  public class GLVobCoorder extends AffineVobCoorder {
! public static final String rcsid = "$Id: GLVobCoorder.java,v 1.39 2002/10/08 
18:23:43 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
--- 29,35 ----
  import gzz.client.gl.*;
  
  public class GLVobCoorder extends AffineVobCoorder {
! public static final String rcsid = "$Id: GLVobCoorder.java,v 1.40 2002/10/09 
14:38:41 tjl Exp $";
      public static boolean dbg = false;
      private static void pa(String s) { System.err.println(s); }
  
***************
*** 217,223 ****
                            boolean standardcoords, boolean showFinal) {
        GL.render(into, ninds, this.inds, this.floats,
                    csinds,
!                   other.inds, other.floats,
                    theVobs.list, fract, standardcoords, showFinal);
      }
      public float timeRender(GL.Window into, GLVobMap theVobs,
--- 217,224 ----
                            boolean standardcoords, boolean showFinal) {
        GL.render(into, ninds, this.inds, this.floats,
                    csinds,
!                   (other != null ? other.inds : null), 
!                   (other != null ? other.floats : null),
                    theVobs.list, fract, standardcoords, showFinal);
      }
      public float timeRender(GL.Window into, GLVobMap theVobs,
Index: gzz/gzz/modules/pp/BuoyView.java
diff -c gzz/gzz/modules/pp/BuoyView.java:1.28 
gzz/gzz/modules/pp/BuoyView.java:1.29
*** gzz/gzz/modules/pp/BuoyView.java:1.28       Tue Oct  8 03:34:54 2002
--- gzz/gzz/modules/pp/BuoyView.java    Wed Oct  9 10:38:41 2002
***************
*** 28,33 ****
--- 28,34 ----
  import gzz.*;
  import gzz.errors.*;
  import gzz.vob.*;
+ import gzz.vob.buoy.*;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Iterator;
***************
*** 49,55 ****
   */
  
  public class BuoyView implements View {
! public static final String rcsid = "$Id: BuoyView.java,v 1.28 2002/10/08 
07:34:54 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); }
--- 50,56 ----
   */
  
  public class BuoyView implements View {
! public static final String rcsid = "$Id: BuoyView.java,v 1.29 2002/10/09 
14:38:41 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); }
***************
*** 59,80 ****
      Object crosshairKey = new Object();
      CursorVob crosshair = new CursorVob();
  
-     // Seed for toArray to get the return type right
-     private Buoy[] seed = new Buoy[0];
- 
-     private Buoy2 buoy2 = new Buoy2();
- 
      private VobKeyer keyer;
  
      public BuoyView(VobKeyer keyer) {
          this.keyer = keyer;
-       planeView = new PlaneView(keyer);
      }
  
      static int bwid;
  
      static Object BGKEY = new Object();
  
      private void putBackground(VobScene into) {
        Dimension d = into.getSize();
  
--- 60,88 ----
      Object crosshairKey = new Object();
      CursorVob crosshair = new CursorVob();
  
      private VobKeyer keyer;
  
      public BuoyView(VobKeyer keyer) {
          this.keyer = keyer;
      }
  
      static int bwid;
  
      static Object BGKEY = new Object();
  
+     int mainviewCS;
+ 
+     public int offsetx = 0, offsety = 0;
+     public float scale = 0.01f;
+     VobScene currentvs;
+ 
+     public void setMainAffineParams() {
+       ((GLVobCoorder)currentvs.coords).setAffineParams(mainviewCS, 0, 
+               .5f - scale * offsetx,
+               .5f - scale * offsety,
+               scale, 0, 0, scale);
+     }
+ 
      private void putBackground(VobScene into) {
        Dimension d = into.getSize();
  
***************
*** 96,112 ****
        */
      }
  
      /** Draw the whole view into a <code>VobScene</code>.
       */
      public void render(VobScene into, int intoCS, ViewContext context) {
- 
-       putBackground(into);
- 
        Dimension d = into.getSize();
! 
! 
!       List leftBuoys = new ArrayList(),
!            rightBuoys = new ArrayList();
  
        int
            ctrw = d.width * 3/5,
--- 104,116 ----
        */
      }
  
+     CircleFloater4  lbf, rbf;
+ 
      /** Draw the whole view into a <code>VobScene</code>.
       */
      public void render(VobScene into, int intoCS, ViewContext context) {
        Dimension d = into.getSize();
!       float rad = d.height/2;
  
        int
            ctrw = d.width * 3/5,
***************
*** 116,144 ****
  
        bwid = d.width / 5;
  
        // Render the central view and gather the buoys.
        renderCenterView(into, context.getAccursed(),
                ctrx, ctry, ctrw, ctrh, leftBuoys, rightBuoys);
  
-       mapBuoySizes(leftBuoys);
-       mapBuoySizes(rightBuoys);
- 
        int cx = ctrx + ctrw/2;
        int cy = ctry + ctrh/2;
  
        into.put(crosshair, crosshairKey, 2, cx-5, cy-5, 10, 10);
  
-       // Render the left and right buoys
-       p("Place left buoys");
-       Buoy[] store = (Buoy[])leftBuoys.toArray(seed);
-       buoy2.place(into, store, new Rectangle(0, 0, bwid, d.height));
- 
-       p("Place right buoys");
-       store = (Buoy[])rightBuoys.toArray(seed);
-       buoy2.place(into, store, new Rectangle(d.width - bwid, 0,
-                                               bwid, d.height));
- 
- 
        renderDirectory(into, context.getWindow(), 0, 0, d.width, d.height/3,
                          keyer);
  
--- 120,148 ----
  
        bwid = d.width / 5;
  
+ 
+ 
+       lbf = new CircleFloater4(into, 0, ctrx, ctry, rad, ctrx+rad, ctry);
+       rbf = new CircleFloater4(into, 0, ctrx, ctry, rad, ctrx-rad, ctry);
+ 
+ 
+       planeView = new PlaneView(keyer, lbf, rbf);
+ 
+       putBackground(into);
+ 
+ 
+ 
+       List leftBuoys = new ArrayList(),
+            rightBuoys = new ArrayList();
        // Render the central view and gather the buoys.
        renderCenterView(into, context.getAccursed(),
                ctrx, ctry, ctrw, ctrh, leftBuoys, rightBuoys);
  
        int cx = ctrx + ctrw/2;
        int cy = ctry + ctrh/2;
  
        into.put(crosshair, crosshairKey, 2, cx-5, cy-5, 10, 10);
  
        renderDirectory(into, context.getWindow(), 0, 0, d.width, d.height/3,
                          keyer);
  
***************
*** 149,167 ****
        into.dump();
      }
  
-     void mapBuoySizes(List l) {
-       for(Iterator i = l.iterator(); i.hasNext(); ) {
-           AbstractBuoy buoy = (AbstractBuoy)i.next();
-           buoy.setPreferredSize(new Dimension(bwid, bwid * 8/10));
-       }
-     }
- 
      /** Draws the central view into a <code>VobScene</code>.
       */
      private void renderCenterView(VobScene into, Cell center,
                int x, int y, int w, int h, 
                List leftBuoys, List rightBuoys) {
  
        int panx = Win.xctr, pany = Win.yctr;
        float zoom = Win.zoom;
        VobKeyer.Entry keyEntry = 
--- 153,165 ----
        into.dump();
      }
  
      /** Draws the central view into a <code>VobScene</code>.
       */
      private void renderCenterView(VobScene into, Cell center,
                int x, int y, int w, int h, 
                List leftBuoys, List rightBuoys) {
  
+       /*
        int panx = Win.xctr, pany = Win.yctr;
        float zoom = Win.zoom;
        VobKeyer.Entry keyEntry = 
***************
*** 169,174 ****
--- 167,173 ----
        planeView.renderSinglePaper(into, center,  x, y, w, h, 15,
                    panx, pany, zoom,
                    leftBuoys, rightBuoys, keyEntry);
+                   */
      }
  
      /** Draws the view directory, which is currently a little funny,
***************
*** 192,203 ****
--- 191,204 ----
  
        while(plane != null)  {
  
+           /*
            planeView.renderSinglePaper(into, plane, 
                        vx, vy, vw, vh, vd,
                        0, 0, 400,
                        null, null,
                        keyer.getDirectoryEntry(plane)
                  );
+               */
            vd += 20;
            vx -= dx; vy += dy;
            vw *= 0.8; vh *= 0.8;
***************
*** 212,230 ****
  
        while(plane != null) {
  
            planeView.renderSinglePaper(into, plane, 
                        vx, vy, vw, vh, vd,
                        0, 0, 400,
                        null, null,
                        keyer.getDirectoryEntry(plane)
                  );
            vd += 20;
            vx += dx; vy += dy;
            vw *= 0.8; vh *= 0.8;
            plane = plane.s(d_1, 1);
        }
- 
- 
      }
  
      static TextStyle style = GraphicsAPI.getInstance()
--- 213,231 ----
  
        while(plane != null) {
  
+           /*
            planeView.renderSinglePaper(into, plane, 
                        vx, vy, vw, vh, vd,
                        0, 0, 400,
                        null, null,
                        keyer.getDirectoryEntry(plane)
                  );
+               */
            vd += 20;
            vx += dx; vy += dy;
            vw *= 0.8; vh *= 0.8;
            plane = plane.s(d_1, 1);
        }
      }
  
      static TextStyle style = GraphicsAPI.getInstance()
Index: gzz/gzz/modules/pp/PlaneView.java
diff -c gzz/gzz/modules/pp/PlaneView.java:1.52 
gzz/gzz/modules/pp/PlaneView.java:1.53
*** gzz/gzz/modules/pp/PlaneView.java:1.52      Tue Oct  8 14:23:43 2002
--- gzz/gzz/modules/pp/PlaneView.java   Wed Oct  9 10:38:41 2002
***************
*** 40,69 ****
   */
  
  public class PlaneView {
! public static final String rcsid = "$Id: PlaneView.java,v 1.52 2002/10/08 
18:23:43 tjl Exp $";
      public static boolean dbg = true;
      private static void pa(String s) { System.err.println(s); }
  
!     static TextStyle style = GraphicsAPI.getInstance()
                    .getTextStyle("SansSerif", Font.PLAIN, 24);
  
!     static int getLineOffset(float zoom) {
        return (int)(style.getHeight(1) * 1.1f);
      }
  
      public static final Object TEXTCURSORKEY = new Object();
  
      VobKeyer keyer;
  
!     public PlaneView(VobKeyer keyer) {
          this.keyer = keyer;
      }
  
      /** Render a single paper into the given coordinate system
       * @param into The coordinate system which has the paper coordinates to 
       */
!     public VobScene renderPaper(VobScene vs, Cell cursor, int offsetInCell,
!                   int viewport2screen, int paper2viewport, List leftBuoys, 
List rightBuoys) {
  
        if(dbg) pa("GetPaperscene: "+cursor);
  
--- 40,73 ----
   */
  
  public class PlaneView {
! public static final String rcsid = "$Id: PlaneView.java,v 1.53 2002/10/09 
14:38:41 tjl Exp $";
      public static boolean dbg = true;
      private static void pa(String s) { System.err.println(s); }
  
!     TextStyle style = GraphicsAPI.getInstance()
                    .getTextStyle("SansSerif", Font.PLAIN, 24);
  
!     int getLineOffset(float zoom) {
        return (int)(style.getHeight(1) * 1.1f);
      }
  
      public static final Object TEXTCURSORKEY = new Object();
  
      VobKeyer keyer;
+     Buoy4Floater rightfloater, leftfloater;
  
!     public PlaneView(VobKeyer keyer, Buoy4Floater leftfloater, 
!                           Buoy4Floater rightfloater) {
          this.keyer = keyer;
+       this.rightfloater = rightfloater;
+       this.leftfloater = leftfloater;
      }
  
      /** Render a single paper into the given coordinate system
       * @param into The coordinate system which has the paper coordinates to 
       */
!     public void renderPaper(VobScene vs, Cell cursor, int offsetInCell,
!                   int viewport2screen, int paper2viewport, boolean doBuoys) {
  
        if(dbg) pa("GetPaperscene: "+cursor);
  
***************
*** 101,107 ****
            int cs = vs.coordsys(into, note, 5, notex, notey, 10, 10);
            vs.map.put(v, cs);
  
!           if(note.equals(cursor)) {
                int cursorx = (int)style.getWidth(note.t()
                                             .substring(0,offsetInCell),
                                             1);
--- 105,112 ----
            int cs = vs.coordsys(into, note, 5, notex, notey, 10, 10);
            vs.map.put(v, cs);
  
!           if(note.equals(cursor) && 
!                   offsetInCell >= 0 && offsetInCell <= note.t().length() ) {
                int cursorx = (int)style.getWidth(note.t()
                                             .substring(0,offsetInCell),
                                             1);
***************
*** 111,190 ****
                         notey-dh/4, 0, 2*dh);
            }
  
!           if(Win.mode == 1 && rightBuoys != null && 
!              note.equals(cursor)
!              ) {
!               // show association candidates for the cell currently in edit
!               // search only planes on d.user-1, look for same prefix
! 
!               
!               Cell start = plane.h(d_1); //.s(Dims.d_user_1_id);
!               String cur = note.t();
!               if(cur.length() >= 1)  {
!                   while(start != null) {
!                       for(Cell otherNote = start.s(Win.d_contains); otherNote 
!= null;
!                           otherNote = otherNote.s(Win.d_contains)) {
!                           if(otherNote.equals(note)) continue;
!                           if(otherNote.t().startsWith(cur)) {
!                               rightBuoys.add(new PlaneBuoy(
!                                   new Point(notex, notey), 
!                                       otherNote,
!                                       keyer.getMakeAssocEntry(otherNote, 1)));
!                               leftBuoys.add(new PlaneBuoy(
!                                   new Point(notex, notey), 
!                                       otherNote,
!                                       keyer.getMakeAssocEntry(otherNote, 0)));
!                           }
!                       }
!                       start = start.s(d_1);
!                   }
!               }
!           } else if(Win.mode == 0 && (leftBuoys != null 
!                                          || rightBuoys != null)){
!               // insert the already associated things in their
!               // proper margins
!               for(Cell assoc = note; assoc != null; 
!                       assoc = assoc.s(d_clone)) {
!                   Cell left = assoc.s(Win.d_association, -1);
!                   Cell right = assoc.s(Win.d_association, 1);
!                   if(dbg) pa("BUOYS: LINKS");
!                   if(dbg) pa("left: "+left+" right: "+right);
!                   if(rightBuoys != null && right != null)
                        rightBuoys.add(new PlaneBuoy(
!                               new Point(notex, notey), 
!                               right.getRootclone(), 
!                               keyer.getBrowseEntry(
!                                       right.getRootclone(), assoc, right)
!                                   ));
!                   if(leftBuoys != null && left != null)
                        leftBuoys.add(new PlaneBuoy(
!                               new Point(notex, notey), 
!                               left.getRootclone(), 
!                               keyer.getBrowseEntry(
!                                       left.getRootclone(), assoc, left)
!                                   ));
                }
            }
-           note = note.s(Win.d_contains);
        }
-       return vs;
      }
  
!     void mapBuoys(List l, Vob.RenderInfo inf) {
!       if(l == null) return;
!       for(Iterator i = l.iterator(); i.hasNext(); ) {
!           AbstractBuoy buoy = (AbstractBuoy)i.next();
!           Point p = buoy.getAnchor();
!           Point n = new Point();
!           inf.xform(p.x, p.y, n);
!           buoy.setAnchor(n);
        }
      }
  
      /** Find the cell pointed to and the offset in the text of the cell,
       * given the vobscene.
       */
!     static public Cell getCellAndOffset(VobScene vs, float x, float y, int[] 
offsOut) {
        float[] ic = new float[2];
        Object k = vs.getKeyAt(x, y, ic);
        if(k == null || !(k instanceof Cell)) {
--- 116,213 ----
                         notey-dh/4, 0, 2*dh);
            }
  
!           if(doBuoys) {
!               if(dbg) pa("buoys:: "+note+" "+Win.mode);
!               if(Win.mode == 1 && note.equals(cursor))
!                   placeConnectingBuoys(vs, cs, note);
!               if(Win.mode == 0)
!                   placeNormalBuoys(vs, cs, note);
!           }
! 
!           note = note.s(Win.d_contains);
!       }
!     }
! 
!     public void placeConnectingBuoys(VobScene vs, int anchor, Cell note) {
!       Dim d_1 = note.space.getDim(Ids.d_1);
!       Dim d_clone = note.space.getDim(Ids.d_clone);
!       // show association candidates for the cell currently in edit
!       // search only planes on d.user-1, look for same prefix
!       
!       Cell plane = note.h(Win.d_contains);
!       Cell start = plane.h(d_1); //.s(Dims.d_user_1_id);
!       String cur = note.t();
!       if(cur.length() >= 1)  {
!           while(start != null) {
!               for(Cell otherNote = start.s(Win.d_contains); otherNote != null;
!                       
!                   otherNote = otherNote.s(Win.d_contains)) {
!                   /*
!                   if(otherNote.equals(note)) continue;
!                   if(otherNote.t().startsWith(cur)) {
                        rightBuoys.add(new PlaneBuoy(
!                           new Point(notex, notey), 
!                               otherNote,
!                               keyer.getMakeAssocEntry(otherNote, 1)));
                        leftBuoys.add(new PlaneBuoy(
!                           new Point(notex, notey), 
!                               otherNote,
!                               keyer.getMakeAssocEntry(otherNote, 0)));
!                   }
!                   */
                }
+               start = start.s(d_1);
            }
        }
      }
  
!     public void placeNormalBuoys(VobScene vs, int anchor, Cell note) {
!       Dim d_1 = note.space.getDim(Ids.d_1);
!       Dim d_clone = note.space.getCloneDim();
!       // insert the already associated things in their
!       // proper margins
!       for(Cell assoc = note; assoc != null; 
!               assoc = assoc.s(d_clone)) {
!           Cell left = assoc.s(Win.d_association, -1);
!           Cell right = assoc.s(Win.d_association, 1);
!           if(dbg) pa("BUOYS: LINKS");
!           if(dbg) pa("left: "+left+" right: "+right);
!           if(right != null) {
!               int cs = rightfloater.buoyCoordsys(anchor,
!                           keyer.getBrowseEntry(
!                               right.getRootclone(), assoc, right));
!               placeBuoyContents(vs, cs, right);
!           }
!           if(left != null) {
!               int cs = leftfloater.buoyCoordsys(anchor,
!                           keyer.getBrowseEntry(
!                               left.getRootclone(), assoc, left));
!               placeBuoyContents(vs, cs, left);
!           }
        }
      }
  
+     public void placeBuoyContents(VobScene vs, int cs, Cell center) {
+       int w = 200, h = 200;
+       int magcs = vs.matcher.addSub(cs,
+               vs.coords.coordsys(cs, -10, -w/2, -h/2, w, h),
+               "Mag");
+       center = center.getRootclone();
+       int place[] = Params.getInts(center.s(Win.d_pan, 1), Win.d_pan, 2, 
null);
+       float scale = 0.01f;
+       int p2v = vs.matcher.addSub(cs,
+               vs.coords.coordsys(0, 0, 
+                   -scale*place[0]+0.5f, -scale*place[1]+0.5f,
+                       scale, scale),
+           "Trans");
+       renderPaper(vs, center, -1, magcs, p2v, false);
+ 
+     }
+ 
      /** Find the cell pointed to and the offset in the text of the cell,
       * given the vobscene.
       */
!     public Cell getCellAndOffset(VobScene vs, float x, float y, int[] 
offsOut) {
        float[] ic = new float[2];
        Object k = vs.getKeyAt(x, y, ic);
        if(k == null || !(k instanceof Cell)) {
***************
*** 199,304 ****
        if(dbg) pa("getCellAndOffset: "+x+" "+y+" --> "+ic[0]+" "+ic[1] 
+"("+w+") --> ");
  
        return cell;
-     }
- 
-     /** Draws the view as a subview. The caller gives view position (pan and
-      *  zoom) instead of it being read from the structure. This is used for
-      *  smaller versions and to reference to some point in the view.
-      *  @param zoom If zoom = 1000, we will render pixel-for-pixel.
-      */
-     public void renderSinglePaper(VobScene into, Cell cursor,
-           float x, float y, float w, float h, float d,
-           float panx, float pany, float zoom,
-           List leftBuoys, List rightBuoys,
-             VobKeyer.Entry keys) {
-       Cell plane = cursor.h(Win.d_contains);
- 
-       if(dbg) pa("Planeview render");
- 
-       if(dbg) {
-           pa("View render: "+x+" "+y+" "+w+" "+h);
-           pa("PanZoom: "+panx+" "+pany+" "+zoom);
-           pa("Buoys: "+leftBuoys+" "+rightBuoys);
-       }
- 
-       if(cursor==null) {
-           pa("No cursor for PlaneView!!!");
-           return;
-       }
- 
- 
-       BgVob bg = BgVob.create(plane);
- 
-       // Coordinate system 1: the viewport
-       int cs1_bg = into.coords.coordsys(0, d+1, x, y, w, h);
-       into.matcher.add(cs1_bg, keys.portBgKey);
-       int cs1 = into.coords.coordsys(0, d, x, y, w, h);
-       into.matcher.add(cs1, keys.portKey);
- 
-       // Coordinate system 2: internals.
-       // 1) the x and y coordinates in real screen space corresponding to 
panx, pany
-       float xorig = x + w/2.0f;
-       float yorig = y + h/2.0f;
- 
-       // 2) move this to correspond to the real origin on paper
-       xorig -= panx * zoom / 1000.0f;
-       yorig -= pany * zoom / 1000.0f;
- 
-       int cs2 = into.coords.coordsys(0, 10000,
-               xorig-zoom/1000.0f, yorig-zoom/1000.0f,
-               2*zoom/1000.0f, 2*zoom/1000.0f);
-       into.matcher.add(cs2, keys.coordKey);
- 
-       // XXX VobScene subvs = getPaperScene(into, cursor, leftBuoys, 
rightBuoys);
-       VobScene subvs = null;
- 
-       keys.setVobScene(subvs);
-       ViewportVob viewport = new ViewportVob(subvs);
-       Vob.RenderInfo inf2 = into.coords.getRenderInfo(cs2);
-       mapBuoys(leftBuoys, inf2);
-       mapBuoys(rightBuoys, inf2);
- 
-       // bg.clip = clip; not needed
-       into.map.put(bg, cs1_bg, cs2);
-       into.map.put(viewport, cs1, cs2);
- 
- 
-       // into.dump();
-       // pa("Buoys AT END: "+leftBuoys+" "+rightBuoys);
-       if(dbg) pa("Planeview render end");
-     }
- 
-     /** A buoy which contains a plane.
-      */
-     class PlaneBuoy extends AbstractBuoy {
-       /** The center cell of this buoy.
-        */
-       Cell center;
- 
-       /** The identity to put on the view.
-        */
-       VobKeyer.Entry entry;
- 
-       public PlaneBuoy(Point anchor, Cell center,
-                                       VobKeyer.Entry entry)
-               {
-           super(anchor, new Dimension(100, 60));
-           this.center = center.getRootclone();
-           this.entry = entry;
-       }
-       public void put(VobScene into, int depth,
-                       int x, int y, int w, int h) {
-           int place[] = Params.getInts(center.s(Win.d_pan, 1), Win.d_pan, 2, 
null);
-           if(dbg) {
-               pa("PlaneBuoy: center place: "+ place[0] + " "+ place[1]+
-                       " " + center.t());
-           }
-           renderSinglePaper(into, center.h(Win.d_contains), x, y, w, h, 30,
-                   place[0], place[1], // coordinates of the note at center
-                   500, // smaller
-                   null, null, entry
-                   );
-       }
      }
  
  }
--- 222,227 ----
Index: gzz/gzz/modules/pp/Win.java
diff -c gzz/gzz/modules/pp/Win.java:1.53 gzz/gzz/modules/pp/Win.java:1.54
*** gzz/gzz/modules/pp/Win.java:1.53    Sun Oct  6 09:45:46 2002
--- gzz/gzz/modules/pp/Win.java Wed Oct  9 10:38:41 2002
***************
*** 36,42 ****
   */
  
  public class Win extends AbstractBinder implements Shower {
! public static final String rcsid = "$Id: Win.java,v 1.53 2002/10/06 13:45:46 
tjl Exp $";
      public static final boolean dbg = true;
      protected static void p(String s) { if(dbg) pa(s); }
      protected static void pa(String s) { System.err.println(s); }
--- 36,42 ----
   */
  
  public class Win extends AbstractBinder implements Shower {
! public static final String rcsid = "$Id: Win.java,v 1.54 2002/10/09 14:38:41 
tjl Exp $";
      public static final boolean dbg = true;
      protected static void p(String s) { if(dbg) pa(s); }
      protected static void pa(String s) { System.err.println(s); }
***************
*** 262,267 ****
--- 262,268 ----
  
        final int id = me.getID();
  
+       /*
        if(id == MouseEvent.MOUSE_PRESSED) { // Possibly start drag
            Cell clicked  = null;
            VobKeyer.Entry entry = keyer.getEntryByViewport(key);
***************
*** 318,325 ****
                entry.clicked(this);
            }
        }
!     } catch(RemoteException e) { remoteException(e); }
!     }
  
      void updateSpace() { 
        if(updateSpaceRun != null) updateSpaceRun.run();
--- 319,328 ----
                entry.clicked(this);
            }
        }
!       */
!     } // catch(RemoteException e) { remoteException(e); }
!     finally { }
!     } 
  
      void updateSpace() { 
        if(updateSpaceRun != null) updateSpaceRun.run();
***************
*** 402,408 ****
            if(xy != null) {
                x = xy[0]; y = xy[1];
            }
!           createNewNote(cursor, x, y + PlaneView.getLineOffset(zoom));
            if(oldNote.s(d_pan) != null) {
                // There was the earlier note; split the text
                int l = oldNote.t().length();
--- 405,411 ----
            if(xy != null) {
                x = xy[0]; y = xy[1];
            }
!           // createNewNote(cursor, x, y + PlaneView.getLineOffset(zoom));
            if(oldNote.s(d_pan) != null) {
                // There was the earlier note; split the text
                int l = oldNote.t().length();
Index: gzz/gzz/modules/pp/demotest.py
diff -c gzz/gzz/modules/pp/demotest.py:1.7 gzz/gzz/modules/pp/demotest.py:1.8
*** gzz/gzz/modules/pp/demotest.py:1.7  Tue Oct  8 14:23:43 2002
--- gzz/gzz/modules/pp/demotest.py      Wed Oct  9 10:38:41 2002
***************
*** 6,11 ****
--- 6,12 ----
  from gzz.modules.pp import *
  import math
  from java.lang import Math
+ from java.awt.event import MouseEvent
  
  from gfx.libutil import effects
  
***************
*** 19,36 ****
  space = ModularSpace(cellTexter, cellManager, dimManager, identityManager, 
slicer, obsTrigger)
  
  ppactions = gzz.modules.pp.PPActionsImpl(space)
  
  id = ppactions.newPaper()
  
- cursor = space.getCell(id)
  
- Win.initDims(space)
  
! ppactions.newNote(id, 100, 100, "WIgdqp")
  ppactions.newNote(id, 100, 200, "Foog")
- 
  ppactions.newNote(id, 0, 0, "Abksefvu21249")
  
  clip = GLRen.createClipSquare()
  stopclip = GLRen.createStopClipSquare()
  
--- 20,43 ----
  space = ModularSpace(cellTexter, cellManager, dimManager, identityManager, 
slicer, obsTrigger)
  
  ppactions = gzz.modules.pp.PPActionsImpl(space)
+ Win.initDims(space)
  
  id = ppactions.newPaper()
  
  
  
! n1 = ppactions.newNote(id, 100, 100, "WIgdqp")
  ppactions.newNote(id, 100, 200, "Foog")
  ppactions.newNote(id, 0, 0, "Abksefvu21249")
  
+ np = ppactions.newPaper()
+ n2 = ppactions.newNote(np, 50, 50, "blah")
+ 
+ ppactions.assocNotes(n1, 1, n2)
+ print "Assoc: ",n1,n2
+ 
+ cursor = [space.getCell(n1), space.getCell(n2)]
+ 
  clip = GLRen.createClipSquare()
  stopclip = GLRen.createStopClipSquare()
  
***************
*** 42,51 ****
  
  class PlaneViewScene:
      def __init__(self):
-       self.pv = PlaneView(VobKeyer())
        self.scale = 0.01
        self.floatbuoys = 1
      def scene(self, vs):
        dim = vs.getSize()
  
        ctr = (dim.width/2, dim.height/2)
--- 49,59 ----
  
  class PlaneViewScene:
      def __init__(self):
        self.scale = 0.01
        self.floatbuoys = 1
+       self.offset = (0,0)
      def scene(self, vs):
+       self.currentvs = vs
        dim = vs.getSize()
  
        ctr = (dim.width/2, dim.height/2)
***************
*** 54,117 ****
        (w,h) = 600, 600
  
        r = 400
!       bf = effects.CircleFloater4(vs, 0, ctr, r, (ctr[0]-r,ctr[1]))
  
        vs.map.put(background((0.4,0.5,0.8)))
        # Viewport
        self.cs1 = vs.coords.coordsys(0, 0, ctr[0]-w/2, ctr[1]-h/2, w, h)
        # Paper to viewport
!       self.cs2 = vs.coords.affineCoordsys(0, 0, 0, 0, self.scale, 0, 0, 
self.scale)
        vs.matcher.add(self.cs1, "Global")
        vs.matcher.add(self.cs2, "p")
!       vs.map.put(clip, self.cs1)
!       if 1:
!           self.pv.renderPaper(vs, cursor, -1, self.cs1, self.cs2, None, None)
        # vs.map.put(getDListNocoords("""Disable TEXTURE_2D"""))
        # vs.map.put(coloredQuad((1,0,0)), self.cs1)
!       vs.map.put(stopclip, self.cs1)
! 
!       into = vs.coords.concat(self.cs1, self.cs2)
!       vs.matcher.add(into, "fouisesge")
! 
!       for a in anchors:
!           anchor = vs.coords.coordsys(into, 0, a[1], a[2], 10, 20)
!       
!           if self.floatbuoys:
!               flo = bf.buoyCoordsys(anchor, a[0])
!           else:
!               flo = vs.coords.affineCoordsys(0, 
!                   0, 0, 700*Math.random(), 1, 0, 0, 1)
!               vs.matcher.add(flo, a[0])
!           (w,h) = (100,100)
! 
!           mag = vs.coords.coordsys(flo, -5, -w/2, -h/2, w, h)
!           vs.matcher.addSub(flo, mag, "M")
! 
!           vs.map.put(coloredQuad((1,0,0)), mag)
! 
!           vs.map.put(getDListNocoords("""
!               Color 0 0 0
!               LineWidth 2
!           """))
  
-           vs.map.put(lineconn, anchor, flo)
- 
-       self.currentvs = vs
      def key(self, key):
!       if key == "f":
!           self.floatbuoys = not self.floatbuoys
      def mouse(self, ev):
        if ev.getID() == ev.MOUSE_CLICKED:
            pass
        elif ev.getID() == ev.MOUSE_PRESSED:
            self.press = (ev.getX(), ev.getY())
            self.pscale = self.scale
        elif ev.getID() == ev.MOUSE_DRAGGED:
!           self.scale = self.pscale * math.exp((self.press[1] - 
ev.getY())/150.0)
!           self.currentvs.coords.setAffineParams(self.cs2,
!                   0, 0, 0, self.scale, 0, 0, self.scale)
!           replaceNewScene(self.currentvs)
!           AbstractUpdateManager.setNoAnimation()
!           AbstractUpdateManager.chg()
  
  currentScene = PlaneViewScene()
--- 62,117 ----
        (w,h) = 600, 600
  
        r = 400
!       lbf = effects.CircleFloater4(vs, 0, ctr, r, (ctr[0]+r,ctr[1]))
!       rbf = effects.CircleFloater4(vs, 0, ctr, r, (ctr[0]-r,ctr[1]))
!       self.pv = PlaneView(VobKeyer(), lbf, rbf)
  
        vs.map.put(background((0.4,0.5,0.8)))
        # Viewport
        self.cs1 = vs.coords.coordsys(0, 0, ctr[0]-w/2, ctr[1]-h/2, w, h)
        # Paper to viewport
!       self.cs2 = vs.coords.affineCoordsys(0, 0, 0, 0, 0, 0, 0, 0)
!       self.sap()
        vs.matcher.add(self.cs1, "Global")
        vs.matcher.add(self.cs2, "p")
!       # vs.map.put(clip, self.cs1)
!       self.pv.renderPaper(vs, cursor[0], -1, self.cs1, self.cs2, 1)
        # vs.map.put(getDListNocoords("""Disable TEXTURE_2D"""))
        # vs.map.put(coloredQuad((1,0,0)), self.cs1)
!       # vs.map.put(stopclip, self.cs1)
  
      def key(self, key):
!       if key == "c":
!           rotatelist(cursor)
      def mouse(self, ev):
        if ev.getID() == ev.MOUSE_CLICKED:
            pass
        elif ev.getID() == ev.MOUSE_PRESSED:
            self.press = (ev.getX(), ev.getY())
            self.pscale = self.scale
+           self.poffset = self.offset
+           self.but = ev.getModifiers()
        elif ev.getID() == ev.MOUSE_DRAGGED:
!           if self.but == MouseEvent.BUTTON3_MASK:
!               self.scale = self.pscale * math.exp(
!                       (self.press[1] - ev.getY())/150.0)
!               self.sap()
!               replaceNewScene(self.currentvs)
!               AbstractUpdateManager.setNoAnimation()
!               AbstractUpdateManager.chg()
!           elif self.but == MouseEvent.BUTTON1_MASK:
!               self.offset = (
!                self.poffset[0] - (ev.getX() - self.press[0]),
!                self.poffset[1] - (ev.getY() - self.press[1]),
!                )
!               self.sap()
!               replaceNewScene(self.currentvs)
!               AbstractUpdateManager.setNoAnimation()
!               AbstractUpdateManager.chg()
!     def sap(self):
!       self.currentvs.coords.setAffineParams(self.cs2,
!               0, -self.scale*self.offset[0]+.5, 
!                  -self.scale*self.offset[1]+.5, 
!               self.scale, 0, 0, self.scale)
  
  currentScene = PlaneViewScene()
Index: gzz/test/testutil.py
diff -c gzz/test/testutil.py:1.16 gzz/test/testutil.py:1.17
*** gzz/test/testutil.py:1.16   Wed Oct  9 04:46:04 2002
--- gzz/test/testutil.py        Wed Oct  9 10:38:42 2002
***************
*** 30,39 ****
--- 30,48 ----
  NOTE: testutil.py itself runs all tests in test/ when run as main.
        test.py runs only tests in the test/gzz/ subtree.
  """
+ import sys
+ sys.path.insert(0, ".")
  
  import unittest, os.path, fnmatch, string, imp
  import java
  
+ graphicswindow = None
+ def getGraphicsWindow():
+     global graphicswindow
+     if not graphicswindow:
+       graphicswindow = GraphicsAPI.getInstance().createWindow()
+     return graphicswindow
+ 
  true = 1
  false = 0
  enableJNI = false
***************
*** 58,63 ****
--- 67,74 ----
      return tests
  
  faildefs = compile("""
+ def failUnlessApprox(delta, first, second, msg = None):
+     unittestObject.failUnless(abs(first-second) <= delta, msg)
  def failUnlessEqual(first, second, msg = None):
      unittestObject.failUnlessEqual(first, second, msg)
  def failIf(expr, msg = None):
***************
*** 94,99 ****
--- 105,111 ----
          def setUp(self):
              self.module = imp.new_module(%s)
            self.module.unittestObject = self
+           self.module.getGraphicsWindow = getGraphicsWindow
            exec faildefs in self.module.__dict__
              exec self.code in self.module.__dict__
      '''
***************
*** 144,150 ****
  
  if __name__ == '__main__':
      test = ['test/']
-     import sys
      if len(sys.argv) > 1:
        sys.path.insert(0, ".")
        import getopt
--- 156,161 ----
***************
*** 164,170 ****
              test.remove('jni')
      except ValueError:
          pass
!     unittest.TextTestRunner(verbosity=2).run(suite(test))
  
  
  
--- 175,185 ----
              test.remove('jni')
      except ValueError:
          pass
!     from gzz.client import GraphicsAPI
!     class Starter(java.lang.Runnable):
!       def run(self):
!           unittest.TextTestRunner(verbosity=2).run(suite(test))
!     GraphicsAPI.getInstance().startUpdateManager(Starter())
  
  
  




reply via email to

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