174 |
|
|
175 |
# print "APP",dir(ff.fenpdf.appearance) |
# print "APP",dir(ff.fenpdf.appearance) |
176 |
# import org.fenfire.fenpdf.appearance.papers |
# import org.fenfire.fenpdf.appearance.papers |
|
papers = ff.fenpdf.appearance.papers.Papers() |
|
|
views = ff.fenpdf.appearance.views.Views(fen, papers, mainMouse) |
|
|
|
|
|
|
|
|
context = Context(w, fen, ppActions, views, FILE) |
|
|
|
|
|
ff.view.buoy.MainNode2D.fen = fen |
|
|
ff.view.buoy.AbstractMainNode2D.context = context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# With button 1 |
|
|
mainMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \ |
|
|
actions.CanvasNodePressListener(context, \ |
|
|
actions.NodeMover(context), actions.PanMover(context))) |
|
|
mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK, |
|
|
'Selecting area of main view.', |
|
|
actions.SelectArea(context)) |
|
|
mainMouse.setListener(1, vob.VobMouseEvent.CONTROL_MASK, |
|
|
'Move the note.', |
|
|
actions.NodeMover(context)) |
|
|
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
|
|
actions.BrowseClick(context)) |
|
|
|
|
|
# With button 3 |
|
|
mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \ |
|
|
'Zooming the main view.', actions.ZoomPan(context)) |
|
|
mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \ |
|
|
'Changing the size of main view (currently only for pagescroll).', # text |
|
|
actions.ChangeSize(context)) |
|
|
mainMouse.setListener(3, vob.VobMouseEvent.SHIFT_MASK, |
|
|
'Select a node by click or unselect.', |
|
|
actions.IfSelectNodeOnPlane(context)) |
|
|
mainMouse.setListener(3, 0, 'Show context menu if available (should be).', |
|
|
actions.MouseMenu(context)) |
|
177 |
|
|
|
# With wheel |
|
|
mainMouse.setWheelListener(0, 'Moving the pan', \ |
|
|
actions.PanMover(context)) |
|
|
context.states.mainMouse = mainMouse |
|
|
|
|
|
|
|
|
# Default controls for buoys |
|
|
buoyMouse = vob.mouse.MouseMultiplexer() |
|
|
# With button 1 |
|
|
buoyMouse.setListener(1, 0, 'Follow the link buoy.', |
|
|
actions.BuoyFollowClick(context)) |
|
|
|
|
|
# With button 3 |
|
|
buoyMouse.setListener(3, 0, 'Show mouse menu for buoy', \ |
|
|
actions.BuoyMouseMenu(context)) |
|
178 |
|
|
179 |
|
|
180 |
|
|
194 |
|
|
195 |
|
|
196 |
|
|
|
mainNode = ff.view.buoy.MainNode2D(planeHome, |
|
|
views.getCanvasView2D(), mainMouse) |
|
|
mainNode2 = ff.view.buoy.MainNode2D(planeHome, |
|
|
views.getCanvasView2D(), mainMouse) |
|
|
|
|
197 |
|
|
198 |
class EventHandler: |
class EventHandler: |
199 |
def __init__(self, context): |
def __init__(self, context = None): |
200 |
self.context = context |
self.context = context |
201 |
|
|
202 |
|
|
291 |
|
|
292 |
|
|
293 |
|
|
294 |
|
papers = ff.fenpdf.appearance.papers.Papers() |
295 |
|
eventHandler = EventHandler() |
296 |
|
views = ff.fenpdf.appearance.views.Views(fen, papers, mainMouse, |
297 |
|
eventHandler, planeHome) |
298 |
|
|
299 |
|
context = Context(w, fen, ppActions, views, FILE) |
300 |
|
eventHandler.context = context |
301 |
|
|
302 |
|
ff.view.buoy.MainNode2D.fen = fen |
303 |
|
ff.view.buoy.AbstractMainNode2D.context = context |
304 |
|
|
305 |
|
|
306 |
|
|
307 |
|
# With button 1 |
308 |
|
mainMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \ |
309 |
|
actions.CanvasNodePressListener(context, \ |
310 |
|
actions.NodeMover(context), actions.PanMover(context))) |
311 |
|
mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK, |
312 |
|
'Selecting area of main view.', |
313 |
|
actions.SelectArea(context)) |
314 |
|
mainMouse.setListener(1, vob.VobMouseEvent.CONTROL_MASK, |
315 |
|
'Move the note.', |
316 |
|
actions.NodeMover(context)) |
317 |
|
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
318 |
|
actions.BrowseClick(context)) |
319 |
|
|
320 |
|
# With button 3 |
321 |
|
mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \ |
322 |
|
'Zooming the main view.', actions.ZoomPan(context)) |
323 |
|
mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \ |
324 |
|
'Changing the size of main view (currently only for pagescroll).', # text |
325 |
|
actions.ChangeSize(context)) |
326 |
|
mainMouse.setListener(3, vob.VobMouseEvent.SHIFT_MASK, |
327 |
|
'Select a node by click or unselect.', |
328 |
|
actions.IfSelectNodeOnPlane(context)) |
329 |
|
mainMouse.setListener(3, 0, 'Show context menu if available (should be).', |
330 |
|
actions.MouseMenu(context)) |
331 |
|
|
332 |
|
# With wheel |
333 |
|
mainMouse.setWheelListener(0, 'Moving the pan', \ |
334 |
|
actions.PanMover(context)) |
335 |
|
context.states.mainMouse = mainMouse |
336 |
|
|
337 |
|
|
338 |
|
# Default controls for buoys |
339 |
|
buoyMouse = vob.mouse.MouseMultiplexer() |
340 |
|
# With button 1 |
341 |
|
buoyMouse.setListener(1, 0, 'Follow the link buoy.', |
342 |
|
actions.BuoyFollowClick(context)) |
343 |
|
|
344 |
|
# With button 3 |
345 |
|
buoyMouse.setListener(3, 0, 'Show mouse menu for buoy', \ |
346 |
|
actions.BuoyMouseMenu(context)) |
347 |
|
|
348 |
|
|
349 |
|
|
350 |
class Scene: |
class Scene: |
351 |
def __init__(self): |
def __init__(self): |
352 |
global context |
global context |
|
self.eventHandler = EventHandler(context) |
|
|
self.buoyManager = None |
|
|
self.doubleGeometer = ff.view.buoy.doublegeometer.DoubleGeometer() |
|
|
|
|
|
self.buoyManager = vob.buoy.buoymanager.MultiBuoyManager( |
|
|
[mainNode, mainNode2], views.getConnectors(), self.eventHandler, |
|
|
self.doubleGeometer, |
|
|
ff.fenpdf.appearance.fenpdfgeometry.FenPDFGeometryConfiguration()) |
|
353 |
|
|
354 |
w.setCursor('default') |
w.setCursor('default') |
355 |
|
|
356 |
self.context = context |
self.context = context |
357 |
self.context.setBuoyManager(self.buoyManager) |
self.context.setBuoyManager(views.getBuoyManager()) |
358 |
|
|
359 |
def scene(self, vs): |
def scene(self, vs): |
360 |
self.context.states.vs = vs |
self.context.states.vs = vs |
361 |
scene = self.buoyManager.scene(vs) |
scene = views.scene(vs) |
362 |
self.context.renderContext(vs, 0) |
self.context.renderContext(vs, 0) |
363 |
return scene |
return scene |
364 |
|
|
365 |
def mouse(self, ev): |
def mouse(self, ev): |
366 |
if not self.eventHandler.contextMouse(ev, self.context.states.vs): |
if not eventHandler.contextMouse(ev, self.context.states.vs): |
367 |
self.buoyManager.mouse(ev) |
views.getBuoyManager().mouse(ev) |
368 |
def key(self, key): |
def key(self, key): |
369 |
|
|
370 |
if key == "Ctrl-P": |
if key == "Ctrl-P": |
380 |
print "Set single: ",currentScene.doubleGeometer.getSingle() |
print "Set single: ",currentScene.doubleGeometer.getSingle() |
381 |
vob.AbstractUpdateManager.chg() |
vob.AbstractUpdateManager.chg() |
382 |
|
|
383 |
self.eventHandler.key(key) |
eventHandler.key(key) |
384 |
|
|
385 |
|
|
386 |
|
|