82 |
AbstractAction, ZoomPan, ChangeSize, \ |
AbstractAction, ZoomPan, ChangeSize, \ |
83 |
CanvasNodePressListener, \ |
CanvasNodePressListener, \ |
84 |
NodeMover, PanMover, \ |
NodeMover, PanMover, \ |
85 |
SelectArea, BrowseClick, IfSelectNodeOnPlane |
SelectArea, BrowseClick, IfSelectNodeOnPlane, \ |
86 |
|
MouseMenu |
87 |
|
|
88 |
|
|
89 |
from org.fenfire.demo.fenpdfcontext import Context |
from org.fenfire.demo.fenpdfcontext import Context |
202 |
ppAct.assocNotes(noteC1, 1, noteB3) |
ppAct.assocNotes(noteC1, 1, noteB3) |
203 |
ppAct.assocNotes(noteA4, 1, noteC2) |
ppAct.assocNotes(noteA4, 1, noteC2) |
204 |
|
|
205 |
|
# search a note for accursing one. |
206 |
it = fen.graph.findN_11X_Iter(paperA, ff.vocab.CANVAS2D.contains) |
it = fen.graph.findN_11X_Iter(paperA, ff.vocab.CANVAS2D.contains) |
207 |
noteA1 = it.next() |
noteA1 = it.next() |
208 |
|
|
242 |
# Default controls |
# Default controls |
243 |
## see http://himalia.it.jyu.fi/ffdoc/fenfire/pegboard/fenpdf_v1_spec_1--tjl/peg.gen.html and 'Bindings' |
## see http://himalia.it.jyu.fi/ffdoc/fenfire/pegboard/fenpdf_v1_spec_1--tjl/peg.gen.html and 'Bindings' |
244 |
mainMouse = vob.mouse.MouseMultiplexer() |
mainMouse = vob.mouse.MouseMultiplexer() |
245 |
mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \ |
# With button 1 |
|
'Zooming the main view.', ZoomPan(context)) |
|
|
mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \ |
|
|
'Changing the size of main view (currently only for pagescroll).', # text |
|
|
ChangeSize(context)) |
|
246 |
mainMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \ |
mainMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \ |
247 |
CanvasNodePressListener(context, \ |
CanvasNodePressListener(context, \ |
248 |
NodeMover(context), PanMover(context))) |
NodeMover(context), PanMover(context))) |
|
mainMouse.setWheelListener(0, 'Moving the pan', \ |
|
|
PanMover(context)) |
|
249 |
mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK, |
mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK, |
250 |
'Selecting area of main view.', |
'Selecting area of main view.', |
251 |
SelectArea(context)) |
SelectArea(context)) |
252 |
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
253 |
BrowseClick(context)) |
BrowseClick(context)) |
254 |
mainMouse.setListener(3, 0, 'Select a node by click or unselect.', |
|
255 |
|
# With button 3 |
256 |
|
mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \ |
257 |
|
'Zooming the main view.', ZoomPan(context)) |
258 |
|
mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \ |
259 |
|
'Changing the size of main view (currently only for pagescroll).', # text |
260 |
|
ChangeSize(context)) |
261 |
|
mainMouse.setListener(3, vob.VobMouseEvent.SHIFT_MASK, |
262 |
|
'Select a node by click or unselect.', |
263 |
IfSelectNodeOnPlane(context)) |
IfSelectNodeOnPlane(context)) |
264 |
|
mainMouse.setListener(3, 0, 'Show context menu if available (should be).', |
265 |
|
MouseMenu(context)) |
266 |
|
|
267 |
|
# With wheel |
268 |
|
mainMouse.setWheelListener(0, 'Moving the pan', \ |
269 |
|
PanMover(context)) |
270 |
|
|
271 |
|
|
272 |
plane = Nodes.get(paperA) |
plane = Nodes.get(paperA) |
405 |
|
|
406 |
# workaround.. |
# workaround.. |
407 |
if self.lastEvent.getType() == ev.MOUSE_PRESSED: |
if self.lastEvent.getType() == ev.MOUSE_PRESSED: |
408 |
p('workaround') |
p('workaround for a bug') |
409 |
return 1 |
return 1 |
410 |
|
|
411 |
# mainMouse XXX |
# release event must go to mainMouse MouseMultiplexer to work correctly! |
412 |
#ctrl.removePressState() |
mainMouse.deliverEvent(ev) |
413 |
|
|
414 |
self.context.states.clean() |
self.context.states.clean() |
415 |
w.setCursor('default') |
w.setCursor('default') |
416 |
# 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. |
417 |
#return 1 |
#return 1 |
418 |
return 0 |
return 0 |
|
#return 0 |
|
419 |
self.lastEvent = ev |
self.lastEvent = ev |
420 |
|
|
421 |
# ...then see context |
# ...then see context |
422 |
if ev.getType() != ev.MOUSE_CLICKED: |
if ev.getType() != ev.MOUSE_CLICKED: |
423 |
return 0 |
return 0 |
424 |
|
|
425 |
planes = [] |
planes = [] |
426 |
for single in self.mgr.singles: |
for single in self.mgr.singles: |
427 |
planes.append(single.getMainNode()) |
planes.append(single.getMainNode()) |
428 |
newPlanes = self.context.doMouse(ev, oldvs, planes, self.nv) |
newPlanes = self.context.doMouse(ev, oldvs, planes, self.nv) |
429 |
|
if newPlanes == 1: return 1 |
430 |
|
|
431 |
if newPlanes != None and planes != newPlanes: |
if newPlanes != None and planes != newPlanes: |
432 |
p('going to change the singles with new ones') |
p('going to change the singles with new ones') |
433 |
for i in range(0, len(newPlanes)): |
for i in range(0, len(newPlanes)): |