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

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

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

revision 1.8 by mudyc, Mon Dec 23 14:00:11 2002 UTC revision 1.9 by mudyc, Mon Dec 23 14:35:25 2002 UTC
# Line 65  public class PPMouseEvents { Line 65  public class PPMouseEvents {
65    
66          // Main paper object events          // Main paper object events
67          EventHandling.i().assign("DragObjectOfMainVP", new DragObjectOfMainVP() );          EventHandling.i().assign("DragObjectOfMainVP", new DragObjectOfMainVP() );
68            EventHandling.i().assign("SetCursorToObject", new SetCursorToObject());
69      }      }
70    
71      /* Save press state      /* Save press state
# Line 75  public class PPMouseEvents { Line 76  public class PPMouseEvents {
76    
77      private Cell accursed_obj = null;      private Cell accursed_obj = null;
78      private int[] orig_obj_pt = null;      private int[] orig_obj_pt = null;
79        private float[] hit = null;
80    
81      private float last_zoom, last_panx, last_pany;      private float last_zoom, last_panx, last_pany;
82      public class SavePressState implements EventHandling.EventMouseObj {      public class SavePressState implements EventHandling.EventMouseObj {
# Line 85  public class PPMouseEvents { Line 87  public class PPMouseEvents {
87              m_ev.last_pany = ppv.pany;              m_ev.last_pany = ppv.pany;
88    
89              m_ev.accursed_obj = null;              m_ev.accursed_obj = null;
90                m_ev.hit = null;
91    
92    
93              // KLUDGE!!!              // KLUDGE!!!
94              // there are no good way in gzz to handle events :/              // there are no good way in gzz to handle events :/
95              if (p_state.getCS() == kingCS) {              if (p_state.getCS() == kingCS) {
96                  if(notEmptyFrame(kingCS, p_state)) {                  if(notEmptyFrame(kingCS, p_state)) {
97                      float hit[] = new float[2];                      m_ev.hit = new float[3];
98                      int objCS = getTouchedCS(kingCS, p_state, hit);                      int objCS = getTouchedCS(kingCS, p_state, m_ev.hit);
99    
100                      Object k = vs.matcher.getKey(objCS);                      Object k = vs.matcher.getKey(objCS);
101                      if (k == null) {                      if (k == null) {
# Line 100  public class PPMouseEvents { Line 103  public class PPMouseEvents {
103                          return;                          return;
104                      }                      }
105    
106                      pa("Hit: "+objCS+" "+k+" "+hit[0]+" "+hit[1]);                      pa("Hit: "+objCS+" "+k+" "+m_ev.hit[0]+" "+m_ev.hit[1]);
107                      if(!(k instanceof Cell)) {                      if(!(k instanceof Cell)) {
108                          pa("Not a cell?!");                          pa("Not a cell?!");
109                          return ;                          return ;
# Line 224  public class PPMouseEvents { Line 227  public class PPMouseEvents {
227              int frameCS = ((Integer)obs[1]).intValue();              int frameCS = ((Integer)obs[1]).intValue();
228    
229              if (m_ev.accursed_obj != null) {              if (m_ev.accursed_obj != null) {
230                  pa("send event forwarded...");                  EventHandling.i().passEvent("SetCursorToObject", ev, null);
231                    return;
232              }              }
233    
234              float[] hit = new float[2];              float[] hit = new float[2];
# Line 244  public class PPMouseEvents { Line 248  public class PPMouseEvents {
248                  vs.coords.inverseTransformPoints3(c2f, pt, pt);                  vs.coords.inverseTransformPoints3(c2f, pt, pt);
249                  ppv.panx = pt[0]; ppv.pany = pt[1];                  ppv.panx = pt[0]; ppv.pany = pt[1];
250                  AbstractUpdateManager.chg();                  AbstractUpdateManager.chg();
251                  return ;              } else throw new Error("Unknown error");
252              }          }
253              Object k = vs.matcher.getKey(vobcs);      }
254              pa("Hit: "+vobcs+" "+k+" "+hit[0]+" "+hit[1]);  
255              if(!(k instanceof Cell)) {      
256                  pa("Not a cell?!");      public class SetCursorToObject implements EventHandling.EventMouseObj {
257                  return ;          public void event(MouseEvent ev, EventHandling.MousePressState p_state,
258              }                            Object[] obs) {
259              context.setAccursed((Cell)k);              context.setAccursed(m_ev.accursed_obj);
260              context.setCursorOffset(ppv.style.getOffsetInText(((Cell)k).t(), 1, hit[0]));              context.setCursorOffset(ppv.style.getOffsetInText((m_ev.accursed_obj).t(),
261                                                                  1, m_ev.hit[0]));
262              AbstractUpdateManager.chg();              AbstractUpdateManager.chg();
263          }          }
264      }      }
265    
266    
267    
268    
269      /* DRAGGING!      /* DRAGGING!
270       * =========       * =========
271       */       */
# Line 337  public class PPMouseEvents { Line 343  public class PPMouseEvents {
343    
344            
345      private int getTouchedCS(int frameCS, EventHandling.MousePressState p_state, float[] hit) {      private int getTouchedCS(int frameCS, EventHandling.MousePressState p_state, float[] hit) {
         hit = new float[2];  
346          return vs.coords.getCSAt( frameCS, p_state.getX(), p_state.getY(), hit);          return vs.coords.getCSAt( frameCS, p_state.getX(), p_state.getY(), hit);
347      }      }
348    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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