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() ); |
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() ); |
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, |
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) |
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 |
|
|