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

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

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

revision 1.18 by mudyc, Thu Nov 21 14:30:31 2002 UTC revision 1.19 by mudyc, Tue Nov 26 07:48:49 2002 UTC
# Line 131  public class PPView2 implements View { Line 131  public class PPView2 implements View {
131       */       */
132      public boolean useStencil = true;      public boolean useStencil = true;
133    
134        private PPActions ppactions;
135      Space space;      Space space;
136      public PPDims d;      public PPDims d;
137    
# Line 292  public class PPView2 implements View { Line 293  public class PPView2 implements View {
293          }          }
294      }      }
295    
296      public PPView2(Space space, GraphicsAPI.Window w) {      public PPView2(Space space, GraphicsAPI.Window w, PPActions ppactions) {
297          this.space = space;          this.space = space;
298          this.d = new PPDims(space);          this.d = new PPDims(space);
299          this.window = w;          this.window = w;
300          this.coordinatePlaneView = new CoordinatePlaneView(d.contains, d.pan);          this.coordinatePlaneView = new CoordinatePlaneView(d.contains, d.pan);
301            this.ppactions = ppactions;
302      }      }
303    
304      TextStyle style = GraphicsAPI.getInstance().getTextStyle("Sans", 0, 20);      TextStyle style = GraphicsAPI.getInstance().getTextStyle("Sans", 0, 20);
# Line 347  public class PPView2 implements View { Line 349  public class PPView2 implements View {
349                  mainWidth, mainHeight);                  mainWidth, mainHeight);
350          vs.activate(frameCS);          vs.activate(frameCS);
351    
352            // cell to frame CS
353          int c2fCS = vs.coords.ortho(0, 0, 0, 0, 10, 10);          int c2fCS = vs.coords.ortho(0, 0, 0, 0, 10, 10);
354          vs.matcher.addSub(mainctr, c2fCS, "C2F");          vs.matcher.addSub(mainctr, c2fCS, "C2F");
355    
# Line 384  public class PPView2 implements View { Line 387  public class PPView2 implements View {
387              }              }
388          } else {          } else {
389              // the left panel              // the left panel
             Cell p = main_vc.getAccursed().h(d.contains).h(d.d1).s(d.d1);  
             float x = 0.5f * leftPanelWidth;  
390    
391              // put the "New paper" -text              // put the "New paper" -text
392              TextVob new_button = new TextVob(style, "New paper");              TextVob new_button = new TextVob(style, "Uusi paperi");
393              float scale = style.getScaleByHeight(40);              float scale = style.getScaleByHeight(40);
394              int button_cs = vs.orthoCS(0, "NEW_BUTTON", 0, 0, 0,              float width = new_button.getWidth(scale);
395                int button_frame = vs.orthoBoxCS(0, "new_button_frame", 0, 0, 0, 1, 1,
396                                       width, new_button.getHeight(scale) + new_button.getDepth(scale));
397                int button_cs = vs.scaleCS(button_frame, "new_button_cs",
398                        new_button.getHeight(scale) + new_button.getDepth(scale),                        new_button.getHeight(scale) + new_button.getDepth(scale),
399                        new_button.getHeight(scale) + new_button.getDepth(scale));                        new_button.getHeight(scale) + new_button.getDepth(scale));
400                vs.activate(button_frame);
401              vs.map.put(new_button, button_cs);              vs.map.put(new_button, button_cs);
402    
403    
404                Cell p = main_vc.getAccursed().h(d.contains).h(d.d1).s(d.d1);
405                float x = 0.5f * leftPanelWidth;
406    
407              for(float y = 1.5f*leftPanelObjectHeight; p != null;              for(float y = 1.5f*leftPanelObjectHeight; p != null;
408                              y += leftPanelObjectHeight) {                  y += leftPanelObjectHeight) {
409                  int ctr = ((GLVobCoorder)vs.coords).affineCoordsys(0, 0,                  int ctr = ((GLVobCoorder)vs.coords).affineCoordsys(0, 0,
410                              x, y, 1, 0, 0, 1);                                                                     x, y, 1, 0, 0, 1);
411                  vs.matcher.add(ctr, new Pair(p, null));                  vs.matcher.add(ctr, new Pair(p, null));
412    
413                  int fr = vs.orthoBoxCS(ctr, "frame", 10,                  int fr = vs.orthoBoxCS(ctr, "frame", 10,
414                          -leftPanelRealWidth/2, -leftPanelRealHeight/2,                                         -leftPanelRealWidth/2, -leftPanelRealHeight/2,
415                          1, 1, leftPanelRealWidth, leftPanelRealHeight);                                         1, 1, leftPanelRealWidth, leftPanelRealHeight);
416                  vs.activate(fr);                  vs.activate(fr);
417    
418                  int c2f = vs.coords.ortho(0, 0, 0, 0,                  int c2f = vs.coords.ortho(0, 0, 0, 0,
419                              leftPanelZoom, leftPanelZoom);                                            leftPanelZoom, leftPanelZoom);
420                  vs.matcher.addSub(ctr, c2f, "C2F");                  vs.matcher.addSub(ctr, c2f, "C2F");
421    
422    
423                  buoy_vc.setAccursed(p);                  buoy_vc.setAccursed(p);
424                  buoy_singlePlane.render(vs, fr, c2f);                  buoy_singlePlane.render(vs, fr, c2f);
425                  p = p.s(d.d1);                  p = p.s(d.d1);
# Line 432  public class PPView2 implements View { Line 442  public class PPView2 implements View {
442      }      }
443    
444      private void placeLinkbuoy(VobScene vs, Cell otherNote,      private void placeLinkbuoy(VobScene vs, Cell otherNote,
445                  int[] coords, Pair key, int dir) {                                 int[] coords, Pair key, int dir) {
446    
447          int ctr = ((GLVobCoorder)vs.coords).affineCoordsys(0, 0,          int ctr = ((GLVobCoorder)vs.coords).affineCoordsys(0, 0,
448                      centerX(vs) + dir * buoyRadius,                                                             centerX(vs) + dir * buoyRadius,
449                      mainY + mainHeight/2 + curlinkY * linkbuoyVPHeight,                                                             mainY + mainHeight/2 + curlinkY * linkbuoyVPHeight,
450                      1, 0, 0, 1);                                                             1, 0, 0, 1);
451          vs.matcher.add(ctr, key);          vs.matcher.add(ctr, key);
452    
453          int frameCS = vs.orthoBoxCS(ctr, "frame", 10,          int frameCS = vs.orthoBoxCS(ctr, "frame", 10,
454                  (-linkbuoyVPWidth)/2, -linkbuoyVPHeight/2, 1, 1,                                      (-linkbuoyVPWidth)/2, -linkbuoyVPHeight/2, 1, 1,
455                  linkbuoyVPWidth, linkbuoyVPHeight);                                      linkbuoyVPWidth, linkbuoyVPHeight);
456          vs.activate(frameCS);          vs.activate(frameCS);
457    
458          int c2f = vs.coords.ortho(0, 0,          int c2f = vs.coords.ortho(0, 0,
459                      -linkbuoyZoom*coords[0], -linkbuoyZoom*coords[1],                                    -linkbuoyZoom*coords[0], -linkbuoyZoom*coords[1],
460                      linkbuoyZoom, linkbuoyZoom);                                    linkbuoyZoom, linkbuoyZoom);
461          vs.matcher.addSub(ctr, c2f, "C2F");          vs.matcher.addSub(ctr, c2f, "C2F");
462    
463          buoy_vc.setAccursed(otherNote);          buoy_vc.setAccursed(otherNote);
# Line 469  public class PPView2 implements View { Line 479  public class PPView2 implements View {
479      /** Set the cursor clicked in the main view.      /** Set the cursor clicked in the main view.
480       */       */
481      public void setCursorToMain(VobScene vs, float x, float y,      public void setCursorToMain(VobScene vs, float x, float y,
482                  AbstractViewContext context, int cs, int vp) {                                  AbstractViewContext context, int cs, int vp) {
483          float[] hit = new float[2];          float[] hit = new float[2];
484          int vobcs = vs.coords.getCSAt(cs, x, y, hit);          int vobcs = vs.coords.getCSAt(cs, x, y, hit);
485          if(vobcs < 0) {          if(vobcs < 0) {
# Line 537  public class PPView2 implements View { Line 547  public class PPView2 implements View {
547              pa("No hit "+x+" "+y);              pa("No hit "+x+" "+y);
548              return null;              return null;
549          }          }
550    
551          if(!"frame".equals(vs.matcher.getKey(cs))) {          if(!"frame".equals(vs.matcher.getKey(cs))) {
552              pa("WRONG KEY! "+vs.matcher.getKey(cs));              if ("new_button_frame".equals(vs.matcher.getKey(cs)) ) {
553                    try {
554                        ppactions.newPaper();
555                    }
556                    catch (Exception e) { pa(e.getMessage()); }
557                } else {
558                    pa("WRONG KEY! "+vs.matcher.getKey(cs));
559                }
560              return null;              return null;
561          }          }
562    
563          // Get its parent          // Get its parent
564          int vp = ((GLVobCoorder)vs.coords).getParent(cs);          int vp = ((GLVobCoorder)vs.coords).getParent(cs);
565          Object key = vs.matcher.getKey(vp);          Object key = vs.matcher.getKey(vp);
566    
567            pa("pushed key: "+ key +" parent vp: " +vp);
568    
569          if("MAINVP".equals(key)) {          if("MAINVP".equals(key)) {
570              pa("Main viewport");              pa("Main viewport");
571              setCursorToMain(vs, x, y, context, cs, vp);              setCursorToMain(vs, x, y, context, cs, vp);
# Line 556  public class PPView2 implements View { Line 578  public class PPView2 implements View {
578          Map r = new HashMap();          Map r = new HashMap();
579          r.put("MAINVP", p);          r.put("MAINVP", p);
580          r.put(p,  "MAINVP");          r.put(p,  "MAINVP");
581    
582          // Now, we have almost all the data.          // Now, we have almost all the data.
583          // But we need to figure out WHICH one of the cells in the Pair          // But we need to figure out WHICH one of the cells in the Pair
584          // is the one we are moving to. To do this, we have to look at          // is the one we are moving to. To do this, we have to look at
585          // the parent coordinate systems.          // the parent coordinate systems.
           
         int tr12 = ((GLVobCoorder)vs.coords).getBuoyOnCircleAnchor(vp); // XXX... reverse of BFloater  
         pa("tr12: "+tr12);  
         pa(" "+vs.matcher.getKey(tr12));  
   
         int ausq = ((GLVobCoorder)vs.coords).getParent(tr12);  
         pa("ausq: "+ausq);  
         pa(" "+vs.matcher.getKey(ausq));  
   
         int anchor = ((GLVobCoorder)vs.coords).getParent(ausq);  
         pa("anch: "+anchor);  
         pa(" "+vs.matcher.getKey(anchor));  
         Object cell = vs.matcher.getKey(anchor);  
   
         Object n;  
         if(cell.equals(p.first)) n = p.second;  
         else n = p.first;  
         pa("New: "+n);  
586    
587          ((AbstractViewContext)context).setAccursed((Cell)n);          if ("BuoyOnCircle".equals(((GLVobCoorder)vs.coords).getCoordSystemStr(vp))) {
588                int tr12 = ((GLVobCoorder)vs.coords).getBuoyOnCircleAnchor(vp); // XXX... reverse of BFloater
589                pa("tr12: "+tr12);
590                pa(" "+vs.matcher.getKey(tr12));
591    
592                int ausq = ((GLVobCoorder)vs.coords).getParent(tr12);
593                pa("ausq: "+ausq);
594                pa(" "+vs.matcher.getKey(ausq));
595    
596                int anchor = ((GLVobCoorder)vs.coords).getParent(ausq);
597                pa("anch: "+anchor);
598                pa(" "+vs.matcher.getKey(anchor));
599                Object cell = vs.matcher.getKey(anchor);
600    
601                Object n;
602                if(cell.equals(p.first)) n = p.second;
603                else n = p.first;
604                pa("New: "+n);
605    
606                ((AbstractViewContext)context).setAccursed((Cell)n);
607    
608                return r;
609            } else {
610                // Change to paper which has been selected from the left panel.
611                ((AbstractViewContext)context).setAccursed((Cell)p.first);
612            }
613          return r;          return r;
614      }      }
615  }  }

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

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