/[gzz]/gzz/gzz/modules/pp/PlaneView.java
ViewVC logotype

Diff of /gzz/gzz/modules/pp/PlaneView.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.45 by tjl, Wed Sep 25 14:45:43 2002 UTC revision 1.46 by tjl, Sun Oct 6 13:45:46 2002 UTC
# Line 1  Line 1 
1  /*  /*
2  PlaneView.java  PlaneView.java
3   *       *    
4   *    Copyright (c) 1999-2001, Ted Nelson and Tuomas Lukka   *    Copyright (c) 1999-2002, Ted Nelson and Tuomas Lukka
5   *   *
6   *    You may use and distribute under the terms of either the GNU Lesser   *    You may use and distribute under the terms of either the GNU Lesser
7   *    General Public License, either version 2 of the license or,   *    General Public License, either version 2 of the license or,
# Line 41  import java.awt.*; Line 41  import java.awt.*;
41  public class PlaneView {  public class PlaneView {
42  public static final String rcsid = "$Id$";  public static final String rcsid = "$Id$";
43      public static boolean dbg = true;      public static boolean dbg = true;
     private static void p(String s) { if(dbg) pa(s); }  
44      private static void pa(String s) { System.err.println(s); }      private static void pa(String s) { System.err.println(s); }
45    
46      static TextStyle style = GraphicsAPI.getInstance()      static TextStyle style = GraphicsAPI.getInstance()
# Line 51  public static final String rcsid = "$Id$ Line 50  public static final String rcsid = "$Id$
50          return (int)(style.getHeight(1) * 1.1f);          return (int)(style.getHeight(1) * 1.1f);
51      }      }
52    
   
53      public static final Object TEXTCURSORKEY = new Object();      public static final Object TEXTCURSORKEY = new Object();
54    
   
   
55      VobKeyer keyer;      VobKeyer keyer;
56    
57      public PlaneView(VobKeyer keyer) {      public PlaneView(VobKeyer keyer) {
58          this.keyer = keyer;          this.keyer = keyer;
59      }      }
60    
61      /** Get the vobscene to be put into a viewport vob.      /** Render a single paper into the given coordinate system
      * The vobscene contains, in straight vobscene coordinates,  
      * the paper contents.  
      * The idea is that these could be cached using Obs's...  
62       */       */
63      VobScene getPaperScene(VobScene parent, Cell cursor, List leftBuoys,      public VobScene renderPaper(VobScene vs, Cell cursor, int into, List leftBuoys,
64                      List rightBuoys) {                      List rightBuoys) {
65    
66          p("GetPaperscene: "+cursor);          if(dbg) pa("GetPaperscene: "+cursor);
67    
         VobScene vs = parent.window.createVobScene(new Dimension(42, 42));  
68          Cell plane = cursor.h(Win.d_contains);          Cell plane = cursor.h(Win.d_contains);
69          Cell note = plane.s(Win.d_contains);          Cell note = plane.s(Win.d_contains);
70    
# Line 81  public static final String rcsid = "$Id$ Line 73  public static final String rcsid = "$Id$
73          Dim d_clone = space.getDim(Ids.d_clone);          Dim d_clone = space.getDim(Ids.d_clone);
74    
75          while(note != null) { // For every note on the paper          while(note != null) { // For every note on the paper
76              p("Note: "+note);              if(dbg) pa("Note: "+note);
77              int place[] = Params.getInts(note.s(Win.d_pan, 1), Win.d_pan, 2, null);              int place[] = Params.getInts(note.s(Win.d_pan, 1), Win.d_pan, 2, null);
78    
79              int notex = place[0];              int notex = place[0];
80              int notey = place[1];              int notey = place[1];
               
81    
82              int dw = (int)style.getWidth(note.t(), 1);              int dw = (int)style.getWidth(note.t(), 1);
83              int dh = (int)style.getHeight(1);              int dh = (int)style.getHeight(1);
# Line 99  public static final String rcsid = "$Id$ Line 90  public static final String rcsid = "$Id$
90                  int cursorx = (int)style.getWidth(note.t()                  int cursorx = (int)style.getWidth(note.t()
91                                               .substring(0,Win.offsetInCell),                                               .substring(0,Win.offsetInCell),
92                                               1);                                               1);
93                  p("Placing text cursor "+notex+" "+cursorx+" "+notey+" "+dh);                  if(dbg) pa("Placing text cursor "+notex+" "+cursorx+" "+notey+" "+dh);
94                  vs.put(new TextCursorVob(), TEXTCURSORKEY,                  vs.put(new TextCursorVob(), TEXTCURSORKEY,
95                           6, notex+cursorx,                           6, notex+cursorx,
96                           notey-dh/4, 0, 2*dh);                           notey-dh/4, 0, 2*dh);
# Line 190  public static final String rcsid = "$Id$ Line 181  public static final String rcsid = "$Id$
181          if(offsOut != null)          if(offsOut != null)
182              offsOut[0] = style.getOffsetInText(cell.t(), 1, (ic[0]+1)/2 * w);              offsOut[0] = style.getOffsetInText(cell.t(), 1, (ic[0]+1)/2 * w);
183                    
184          if(dbg) p("getCellAndOffset: "+x+" "+y+" --> "+ic[0]+" "+ic[1] +"("+w+") --> ");          if(dbg) pa("getCellAndOffset: "+x+" "+y+" --> "+ic[0]+" "+ic[1] +"("+w+") --> ");
185    
186          return cell;          return cell;
187      }      }
# Line 207  public static final String rcsid = "$Id$ Line 198  public static final String rcsid = "$Id$
198              VobKeyer.Entry keys) {              VobKeyer.Entry keys) {
199          Cell plane = cursor.h(Win.d_contains);          Cell plane = cursor.h(Win.d_contains);
200    
201          p("Planeview render");          if(dbg) pa("Planeview render");
202    
203          if(dbg) {          if(dbg) {
204              pa("View render: "+x+" "+y+" "+w+" "+h);              pa("View render: "+x+" "+y+" "+w+" "+h);
# Line 243  public static final String rcsid = "$Id$ Line 234  public static final String rcsid = "$Id$
234                  2*zoom/1000.0f, 2*zoom/1000.0f);                  2*zoom/1000.0f, 2*zoom/1000.0f);
235          into.matcher.add(cs2, keys.coordKey);          into.matcher.add(cs2, keys.coordKey);
236    
237          VobScene subvs = getPaperScene(into, cursor, leftBuoys, rightBuoys);          // XXX VobScene subvs = getPaperScene(into, cursor, leftBuoys, rightBuoys);
238            VobScene subvs = null;
239    
240          keys.setVobScene(subvs);          keys.setVobScene(subvs);
241          ViewportVob viewport = new ViewportVob(subvs);          ViewportVob viewport = new ViewportVob(subvs);
242          Vob.RenderInfo inf2 = into.coords.getRenderInfo(cs2);          Vob.RenderInfo inf2 = into.coords.getRenderInfo(cs2);
# Line 257  public static final String rcsid = "$Id$ Line 250  public static final String rcsid = "$Id$
250    
251          // into.dump();          // into.dump();
252          // pa("Buoys AT END: "+leftBuoys+" "+rightBuoys);          // pa("Buoys AT END: "+leftBuoys+" "+rightBuoys);
253          p("Planeview render end");          if(dbg) pa("Planeview render end");
254      }      }
255    
256      /** A buoy which contains a plane.      /** A buoy which contains a plane.

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.46

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26