/[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.22 by mudyc, Fri Jan 10 18:57:26 2003 UTC revision 1.23 by mudyc, Sat Jan 11 17:35:33 2003 UTC
# Line 54  public static final String rcsid = "$Id$ Line 54  public static final String rcsid = "$Id$
54          EventHandling.i().assign("Add new paper", new NewPaper() );          EventHandling.i().assign("Add new paper", new NewPaper() );
55          EventHandling.i().assign("Add photo to paper", new AddPhoto() );          EventHandling.i().assign("Add photo to paper", new AddPhoto() );
56          EventHandling.i().assign("Delete paper", new DeletePaper() );          EventHandling.i().assign("Delete paper", new DeletePaper() );
57            EventHandling.i().assign("Delete a note", new DeleteANote() );
58            EventHandling.i().assign("Link killing", new LinkKillingMode() );
59    
60          // Shortcut papers          // Shortcut papers
61          EventHandling.i().assign("Shortcut link", new ShortCutLink() );          EventHandling.i().assign("Shortcut link", new ShortCutLink() );
# Line 62  public static final String rcsid = "$Id$ Line 64  public static final String rcsid = "$Id$
64          EventHandling.i().assign("Link CLICK", new LinkPaper() );          EventHandling.i().assign("Link CLICK", new LinkPaper() );
65          EventHandling.i().assign("Assoc link", new AssocLink() );          EventHandling.i().assign("Assoc link", new AssocLink() );
66          EventHandling.i().assign("Drag buoy", new BuoyDrag() );          EventHandling.i().assign("Drag buoy", new BuoyDrag() );
67            EventHandling.i().assign("Kill link", new KillLink() );
68                    
69          // Main paper          // Main paper
70          EventHandling.i().assign("Click MAINVP", new SetCursorToMain() );          EventHandling.i().assign("Click MAINVP", new SetCursorToMain() );
# Line 183  public static final String rcsid = "$Id$ Line 186  public static final String rcsid = "$Id$
186              try {              try {
187                  pa("Deleting paper!");                  pa("Deleting paper!");
188                  Cell c = context.getAccursed();                  Cell c = context.getAccursed();
189                  if (ppv.space.getHomeCell() != c) {                  ppactions.deletePaper(c.getId() );
                     ppactions.deletePaper(c.getId() );  
                     context.setAccursed(ppv.space.getHomeCell());  
                 }  
190              } catch (Exception e) { pa(e.getMessage()); }              } catch (Exception e) { pa(e.getMessage()); }
191              context.setAccursed(ppv.space.getHomeCell().s(ppv.d.d1));              context.setAccursed(ppv.space.getHomeCell().s(ppv.d.d1));
192              AbstractUpdateManager.chg();              AbstractUpdateManager.chg();
193          }          }
194      }      }
195    
196        public class DeleteANote implements EventHandling.EventMouseObj {
197            public void event(MouseEvent ev, EventHandling.MousePressState p_state,
198                              Object[] obs) {
199                Cell c = context.getAccursed();
200                Cell paper = c.h(ppv.d.contains, -1);
201                try {
202                    pa("Deleting note!");
203                    if (c.s(ppv.d.pan) == null || c.s(ppv.d.pan).t() == ""){
204                        pa("Not a note");
205                        return;
206                    }
207                    ppactions.deleteNote(c.getId() );
208                } catch (Exception e) { pa(e.getMessage()); }
209                context.setAccursed(paper);
210                AbstractUpdateManager.chg();
211            }
212        }
213        public class LinkKillingMode implements EventHandling.EventMouseObj {
214            public void event(MouseEvent ev, EventHandling.MousePressState p_state,
215                              Object[] obs) {
216                // setup link killing mode not kills the link.
217                Cell c = context.getAccursed();
218                pa("Deleting note!");
219                if (c.s(ppv.d.pan) == null || c.s(ppv.d.pan).t() == ""){
220                    pa("Not a note");
221                    return;
222                }
223                ppv.viewMode = ppv.LINK_KILLING;
224                AbstractUpdateManager.chg();
225            }
226        }
227        public class KillLink implements EventHandling.EventMouseObj {
228            public void event(MouseEvent ev, EventHandling.MousePressState p_state,
229                              Object[] obs) {
230    
231                // swap 0 and 1
232                Cell c = (Cell)obs[1];
233                Cell other = (Cell)obs[0];
234                int dir = ((Integer)obs[2]).intValue();
235                context.setAccursed(c);
236                try {
237                    pa("nyt lähtee"+c.t()+" -"+dir+"- "+other.t());
238                    ppactions.detachNotes(c.getId(), dir, other.getId() );
239                } catch (Exception e) { pa(e.getMessage()); }
240                AbstractUpdateManager.chg();
241            }
242        }
243            
244      public class ShortCutLink implements EventHandling.EventMouseObj {      public class ShortCutLink implements EventHandling.EventMouseObj {
245          public void event(MouseEvent ev, EventHandling.MousePressState p_state,          public void event(MouseEvent ev, EventHandling.MousePressState p_state,
# Line 288  public static final String rcsid = "$Id$ Line 336  public static final String rcsid = "$Id$
336    
337              int frameCS = ((Integer)obs[1]).intValue();              int frameCS = ((Integer)obs[1]).intValue();
338    
339              // set pan  
             context.setAccursed(context.getAccursed().h(ppv.d.contains));  
     
340              // Zooming              // Zooming
341              if (p_state.getButtons() == ev.BUTTON3_MASK) {              if (p_state.getButtons() == ev.BUTTON3_MASK) {
342                  ppv.zoom = m_ev.last_zoom * (float)                  ppv.zoom = m_ev.last_zoom * (float)
# Line 313  public static final String rcsid = "$Id$ Line 359  public static final String rcsid = "$Id$
359                      ppv.panx = m_ev.last_panx - (ev.getX() - p_state.getX())/ppv.zoom;                      ppv.panx = m_ev.last_panx - (ev.getX() - p_state.getX())/ppv.zoom;
360                      ppv.pany = m_ev.last_pany - (ev.getY() - p_state.getY())/ppv.zoom;                      ppv.pany = m_ev.last_pany - (ev.getY() - p_state.getY())/ppv.zoom;
361                      ppv.replaceNewScene = true;                      ppv.replaceNewScene = true;
362                        context.setAccursed(context.getAccursed().h(ppv.d.contains));  
363                  }                  }
364              } else return;              } else return;
365    

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

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