22 |
|
|
23 |
# The FenPDF 1.0 ! |
# The FenPDF 1.0 ! |
24 |
|
|
25 |
|
from __future__ import nested_scopes |
26 |
|
|
27 |
dbg = 0 |
dbg = 0 |
28 |
|
|
29 |
def p(*s): |
def p(*s): |
78 |
|
|
79 |
from org.nongnu.alph.impl import PageImageScroll |
from org.nongnu.alph.impl import PageImageScroll |
80 |
|
|
81 |
from org.fenfire.view.buoy.actions import \ |
from org.fenfire.view.buoy import actions |
|
AbstractAction, ZoomPan, ChangeSize, \ |
|
|
CanvasNodePressListener, \ |
|
|
NodeMover, PanMover, \ |
|
|
SelectArea, BrowseClick, IfSelectNodeOnPlane, \ |
|
|
MouseMenu |
|
|
|
|
82 |
|
|
83 |
from org.fenfire.demo.fenpdfcontext import Context |
from org.fenfire.demo.fenpdfcontext import Context |
84 |
|
|
232 |
ff.view.buoy.AbstractMainNode2D.context = context |
ff.view.buoy.AbstractMainNode2D.context = context |
233 |
|
|
234 |
|
|
235 |
# Default controls |
# Default controls for main view |
236 |
## 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' |
237 |
mainMouse = vob.mouse.MouseMultiplexer() |
mainMouse = vob.mouse.MouseMultiplexer() |
238 |
# With button 1 |
# With button 1 |
239 |
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.', \ |
240 |
CanvasNodePressListener(context, \ |
actions.CanvasNodePressListener(context, \ |
241 |
NodeMover(context), PanMover(context))) |
actions.NodeMover(context), actions.PanMover(context))) |
242 |
mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK, |
mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK, |
243 |
'Selecting area of main view.', |
'Selecting area of main view.', |
244 |
SelectArea(context)) |
actions.SelectArea(context)) |
245 |
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
246 |
BrowseClick(context)) |
actions.BrowseClick(context)) |
247 |
|
|
248 |
# With button 3 |
# With button 3 |
249 |
mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \ |
mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \ |
250 |
'Zooming the main view.', ZoomPan(context)) |
'Zooming the main view.', actions.ZoomPan(context)) |
251 |
mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \ |
mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \ |
252 |
'Changing the size of main view (currently only for pagescroll).', # text |
'Changing the size of main view (currently only for pagescroll).', # text |
253 |
ChangeSize(context)) |
actions.ChangeSize(context)) |
254 |
mainMouse.setListener(3, vob.VobMouseEvent.SHIFT_MASK, |
mainMouse.setListener(3, vob.VobMouseEvent.SHIFT_MASK, |
255 |
'Select a node by click or unselect.', |
'Select a node by click or unselect.', |
256 |
IfSelectNodeOnPlane(context)) |
actions.IfSelectNodeOnPlane(context)) |
257 |
mainMouse.setListener(3, 0, 'Show context menu if available (should be).', |
mainMouse.setListener(3, 0, 'Show context menu if available (should be).', |
258 |
MouseMenu(context)) |
actions.MouseMenu(context)) |
259 |
|
|
260 |
# With wheel |
# With wheel |
261 |
mainMouse.setWheelListener(0, 'Moving the pan', \ |
mainMouse.setWheelListener(0, 'Moving the pan', \ |
262 |
PanMover(context)) |
actions.PanMover(context)) |
263 |
|
|
264 |
|
|
265 |
|
# Default controls for buoys |
266 |
|
buoyMouse = vob.mouse.MouseMultiplexer() |
267 |
|
# With button 1 |
268 |
|
buoyMouse.setListener(1, 0, 'Follow the link buoy.', |
269 |
|
actions.BuoyFollowClick(context)) |
270 |
|
|
271 |
|
# With button 3 |
272 |
|
buoyMouse.setListener(3, 0, 'Show mouse menu for buoy', \ |
273 |
|
actions.BuoyMouseMenu(context)) |
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
|
278 |
plane = Nodes.get(paperA) |
plane = Nodes.get(paperA) |
378 |
|
|
379 |
if ev.getType() == ev.MOUSE_RELEASED: |
if ev.getType() == ev.MOUSE_RELEASED: |
380 |
p('mainMouse released? - there\'s a bug in here!') |
p('mainMouse released? - there\'s a bug in here!') |
381 |
mousePrint(self.lastEvent, 'lastEvent') |
mousePrint(self.context.states.lastEvent, 'lastEvent') |
382 |
|
|
383 |
# release event must go to mainMouse MouseMultiplexer to work correctly! |
# release event must go to mainMouse MouseMultiplexer to work correctly! |
384 |
# mainMouse.deliverEvent(ev) |
# mainMouse.deliverEvent(ev) |
385 |
# flush implemented... |
# flush implemented... |
386 |
mainMouse.flush() |
mainMouse.flush() |
387 |
|
buoyMouse.flush() |
388 |
|
|
389 |
self.context.clean() |
self.context.clean() |
390 |
w.setCursor('default') |
w.setCursor('default') |
391 |
|
|
392 |
# workaround.. |
# workaround.. |
393 |
if self.lastEvent.getType() == ev.MOUSE_PRESSED: |
if self.context.states.lastEvent.getType() == ev.MOUSE_PRESSED: |
394 |
p('workaround for a bug') |
p('workaround for a bug') |
395 |
return 1 |
return 1 |
396 |
|
|
397 |
# 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. |
398 |
#return 1 |
#return 1 |
399 |
return 0 |
return 0 |
400 |
self.lastEvent = ev |
self.context.states.lastEvent = ev |
401 |
|
|
402 |
# ...then see context |
# ...then see context |
403 |
if ev.getType() != ev.MOUSE_CLICKED: |
if ev.getType() != ev.MOUSE_CLICKED: |
414 |
|
|
415 |
|
|
416 |
def buoyMouse(self, mgr, ev, single, link): |
def buoyMouse(self, mgr, ev, single, link): |
417 |
|
if buoyMouse.deliverEvent(ev): |
418 |
|
vob.AbstractUpdateManager.chg() |
419 |
|
return 1 |
420 |
|
|
421 |
if ev.getType() != ev.MOUSE_CLICKED: |
if ev.getType() != ev.MOUSE_CLICKED: |
422 |
return 1 |
return 1 |
423 |
|
|