51 |
AbstractAction, ZoomPan, ChangeSize, \ |
AbstractAction, ZoomPan, ChangeSize, \ |
52 |
CanvasNodePressListener, \ |
CanvasNodePressListener, \ |
53 |
NodeMover, PanMover, \ |
NodeMover, PanMover, \ |
54 |
SelectArea, BrowseClick, IfSelectNodeOnPlane |
SelectArea, BrowseClick, IfSelectNodeOnPlane, \ |
55 |
|
LinkClick |
56 |
|
|
57 |
|
|
58 |
from org.fenfire.demo.fenpdfcontext import Context |
from org.fenfire.demo.fenpdfcontext import Context |
199 |
SelectArea(context)) |
SelectArea(context)) |
200 |
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
201 |
BrowseClick(context)) |
BrowseClick(context)) |
202 |
|
mainMouse.setListener(1, vob.VobMouseEvent.CONTROL_MASK, |
203 |
|
'linking', |
204 |
|
LinkClick(context)) |
205 |
mainMouse.setListener(3, 0, 'Select a node by click or unselect.', |
mainMouse.setListener(3, 0, 'Select a node by click or unselect.', |
206 |
IfSelectNodeOnPlane(context)) |
IfSelectNodeOnPlane(context)) |
207 |
|
|
239 |
|
|
240 |
### Connectors |
### Connectors |
241 |
# MindMap |
# MindMap |
242 |
mmconnector = ff.view.buoy.lava.MindMapConnector(fen) |
mmconnector = ff.view.buoy.lava.MindMapConnector(fen, nodeview) |
243 |
mmconnector.normalNodeNodeType = ff.view.buoy.NodeType2D(irregu, \ |
mmconnector.normalNodeNodeType = ff.view.buoy.NodeType2D(irregu, \ |
244 |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, mainMouse)) |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, mainMouse)) |
245 |
mmconnector.mindMapNodeType = ff.view.buoy.NodeType2DFull(mmview, \ |
mmconnector.mindMapNodeType = ff.view.buoy.NodeType2DFull(mmview, \ |
361 |
|
|
362 |
def mouse(self, ev, oldvs): |
def mouse(self, ev, oldvs): |
363 |
if dbg: p(ev) |
if dbg: p(ev) |
364 |
|
|
365 |
if ev.getType() == ev.MOUSE_RELEASED: |
if ev.getType() == ev.MOUSE_RELEASED: |
366 |
p('mainMouse released?') |
p('mainMouse released? - there\'s a bug in here!') |
367 |
# mainMouse XXX |
#mousePrint(self.lastEvent, 'lastEvent') |
368 |
#ctrl.removePressState() |
|
369 |
self.context.states.clean() |
# release event must go to mainMouse MouseMultiplexer to work correctly! |
370 |
|
# mainMouse.deliverEvent(ev) |
371 |
|
# flush implemented... |
372 |
|
mainMouse.flush() |
373 |
|
|
374 |
|
self.context.clean() |
375 |
w.setCursor('default') |
w.setCursor('default') |
376 |
|
|
377 |
|
# workaround.. |
378 |
|
if self.lastEvent.getType() == ev.MOUSE_PRESSED: |
379 |
|
p('workaround for a bug') |
380 |
|
return 1 |
381 |
|
|
382 |
# There is a bug in AbstractUpdateManager code(?) and that's why now is must to return. |
# There is a bug in AbstractUpdateManager code(?) and that's why now is must to return. |
383 |
# return 1 |
#return 1 |
384 |
return 0 |
return 0 |
385 |
#return 0 |
self.lastEvent = ev |
386 |
|
|
387 |
# ...then see context |
# ...then see context |
388 |
if ev.getType() != ev.MOUSE_CLICKED: |
if ev.getType() != ev.MOUSE_CLICKED: |
389 |
return 0 |
return 0 |
390 |
planes = [] |
|
391 |
for single in self.mgr.singles: |
if self.context.doMouse(ev, oldvs): |
392 |
planes.append(single.getMainNode()) |
mainMouse.flush() |
393 |
newPlanes = self.context.doMouse(ev, oldvs, planes, self.nv) |
vob.AbstractUpdateManager.chg() |
|
if newPlanes != None and planes != newPlanes: |
|
|
p('going to change the singles with new ones') |
|
|
for i in range(0, len(newPlanes)): |
|
|
self.mgr.singles[i] = vob.buoy.buoymanager.SingleFocusManager( |
|
|
newPlanes[i], |
|
|
self.mgr.connectors) |
|
|
vob.AbstractUpdateManager.chg() |
|
394 |
return 1 |
return 1 |
395 |
|
|
396 |
return 0 |
return 0 |
397 |
|
|
|
|
|
398 |
|
|
399 |
|
|
400 |
def buoyMouse(self, mgr, ev, single, link): |
def buoyMouse(self, mgr, ev, single, link): |