24 |
|
|
25 |
dbg = 0 |
dbg = 0 |
26 |
|
|
27 |
def pa(*s): |
def p(*s): |
28 |
print 'fenfire.demo.buoyoing::',s |
print 'fenfire.demo.buoyoing::',s |
29 |
|
|
30 |
import sys |
import sys |
34 |
print "LOADING BUOYOING" |
print "LOADING BUOYOING" |
35 |
if dbg: |
if dbg: |
36 |
for (k,v) in sys.modules.items(): |
for (k,v) in sys.modules.items(): |
37 |
pa( k,"\t",v) |
p( k,"\t",v) |
38 |
|
|
39 |
from org import fenfire as ff |
from org import fenfire as ff |
40 |
from org.fenfire.swamp import Nodes |
from org.fenfire.swamp import Nodes |
47 |
|
|
48 |
from org.nongnu.alph.impl import PageImageScroll |
from org.nongnu.alph.impl import PageImageScroll |
49 |
|
|
50 |
from org.fenfire.view.buoy.actions import * |
from org.fenfire.view.buoy.actions import \ |
51 |
|
AbstractAction, ZoomPan, ChangeSize, \ |
52 |
|
CanvasNodePressListener, \ |
53 |
|
NodeMover, PanMover, \ |
54 |
|
SelectArea, BrowseClick, IfSelectNodeOnPlane |
55 |
|
|
56 |
|
|
57 |
from org.fenfire.demo.fenpdfcontext import Context |
from org.fenfire.demo.fenpdfcontext import Context |
58 |
|
|
59 |
|
|
149 |
|
|
150 |
spanImageFactory = ff.spanimages.gl.DefaultSpanImageFactory( |
spanImageFactory = ff.spanimages.gl.DefaultSpanImageFactory( |
151 |
ff.spanimages.gl.PageScrollBlockImager()) |
ff.spanimages.gl.PageScrollBlockImager()) |
152 |
spanImageFactory.paperMaker = ff.spanimages.gl.papermakers.fancyBlend(w) |
spanImageFactory.paperMaker = ff.spanimages.gl.papermakers.fancyBlend() |
153 |
textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sans", 0, 24) |
textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sans", 0, 24) |
154 |
textnodeview = ff.view.TextNodeView(fen.txtfunc, textstyle, 1) |
textnodeview = ff.view.TextNodeView(fen.txtfunc, textstyle, 1) |
155 |
#textnodeview = ff.view.lava.RSTText(fen.txtfunc, textstyle, 1) |
#textnodeview = ff.view.lava.RSTText(fen.txtfunc, textstyle, 1) |
161 |
nodeview = ff.view.lava.ContextNodeView(dispnodeview, fen.constgraph, 150) |
nodeview = ff.view.lava.ContextNodeView(dispnodeview, fen.constgraph, 150) |
162 |
view = ff.view.CanvasView2D(fen, nodeview) |
view = ff.view.CanvasView2D(fen, nodeview) |
163 |
view.cull = 1 |
view.cull = 1 |
164 |
paperview = ff.view.PaperView2D(vob.putil.demowindow.w, view) |
paperview = ff.view.PaperView2D(view) |
165 |
selection = ff.view.AreaSelectingView2D(paperview) |
selection = ff.view.AreaSelectingView2D(paperview) |
166 |
irregu = ff.view.IrregularViewportView2D(selection) |
irregu = ff.view.IrregularViewportView2D(selection) |
167 |
|
|
168 |
ff.view.buoy.NodeType2D.effigy = 0 |
ff.view.buoy.NodeType2D.effigy = 0 |
169 |
ff.view.buoy.NodeType2DFull.effigy = 0 |
ff.view.buoy.NodeType2DFull.effigy = 0 |
170 |
|
|
|
main_ctrl = ff.util.ControlBinding() |
|
|
node_ctrl = ff.util.ControlBinding() |
|
|
ctrlkey_ctrl = ff.util.ControlBinding() |
|
|
ctrl = ControlsDispatcher(main_ctrl, node_ctrl, ctrlkey_ctrl, |
|
|
fen.graph, ppAct) |
|
|
|
|
|
#context = ff.view.lava.FenPDFContext(fen, ppAct, nodeview, ctrl) |
|
|
context = Context(w, fen, ppAct, nodeview, ctrl, spanImageFactory) |
|
171 |
|
|
172 |
context.initMainNodes(2) |
context = Context(w, fen, ppAct, nodeview, spanImageFactory) |
173 |
nodeview.setContext(context) |
nodeview.setContext(context) |
174 |
textnodeview.setContext(context) |
textnodeview.setContext(context) |
175 |
context.states.cursor.setAccursed(noteA1) |
context.states.cursor.setAccursed(noteA1) |
182 |
|
|
183 |
|
|
184 |
# Default controls |
# Default controls |
185 |
|
mainMouse = vob.mouse.MouseMultiplexer() |
186 |
|
mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \ |
187 |
|
'Zooming the main view.', ZoomPan(context)) |
188 |
|
mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \ |
189 |
|
'Changing the size of main view (currently only for pagescroll).', # text |
190 |
|
ChangeSize(context)) |
191 |
|
mainMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \ |
192 |
|
CanvasNodePressListener(context, \ |
193 |
|
NodeMover(context), PanMover(context))) |
194 |
|
mainMouse.setWheelListener(0, 'Moving the pan', \ |
195 |
|
PanMover(context)) |
196 |
|
mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK, |
197 |
|
'Selecting area of main view.', |
198 |
|
SelectArea(context)) |
199 |
|
mainMouse.setListener(1, 0, 'Browse to clicked point in the main view', |
200 |
|
BrowseClick(context)) |
201 |
|
|
|
ctrl.setContext(context) |
|
|
main_ctrl.add(MovePanFast(context), -1, 0, ctrl.WHEEL, 13,1, ctrl.VERTICAL) |
|
|
main_ctrl.add(MovePanFast(context), 1, 0, ctrl.DRAG, 1, 0, ctrl.ALL) |
|
|
main_ctrl.add(MovePanSlow(), 1, ctrl.CLICK) |
|
|
main_ctrl.add(ZoomPan(), 3, 0, ctrl.DRAG, 1, 0, ctrl.VERTICAL) |
|
|
main_ctrl.add(PanSize(context), 3, 0, ctrl.DRAG, 1, 0, ctrl.HORIZONTAL) |
|
|
main_ctrl.add(UnSelectNodeOnPlane(context), 3, ctrl.CLICK) |
|
|
main_ctrl.add(ShowMouseMenu(context), 2, ctrl.CLICK) |
|
|
|
|
|
node_ctrl.add(SelectNodeOnPlane(context), 3, ctrl.CLICK) |
|
|
node_ctrl.add(MoveNodeOnPlane(context), 1, ctrl.DRAG) |
|
202 |
|
|
|
ctrlkey_ctrl.add(SelectArea(context), 1, ctrl.DRAG) |
|
203 |
|
|
204 |
|
if 0: |
205 |
|
ctrl.setContext(context) |
206 |
|
main_ctrl.add(MovePanSlow(), 1, ctrl.CLICK) |
207 |
|
main_ctrl.add(UnSelectNodeOnPlane(context), 3, ctrl.CLICK) |
208 |
|
main_ctrl.add(ShowMouseMenu(context), 2, ctrl.CLICK) |
209 |
|
|
210 |
|
node_ctrl.add(SelectNodeOnPlane(context), 3, ctrl.CLICK) |
211 |
|
node_ctrl.add(MoveNodeOnPlane(context), 1, ctrl.DRAG) |
212 |
|
|
213 |
|
ctrlkey_ctrl.add(SelectArea(context), 1, ctrl.DRAG) |
214 |
|
|
215 |
|
|
216 |
|
|
222 |
plane = Nodes.get(paperA) |
plane = Nodes.get(paperA) |
223 |
planeHome = Nodes.get(paperHome) |
planeHome = Nodes.get(paperHome) |
224 |
|
|
225 |
mainNode = ff.view.buoy.MainNode2D(plane, irregu, ctrl) |
mainNode = ff.view.buoy.MainNode2D(plane, irregu, mainMouse) |
226 |
mainNode2 = ff.view.buoy.MainNode2D(planeHome, irregu, ctrl) |
mainNode2 = ff.view.buoy.MainNode2D(planeHome, irregu, mainMouse) |
|
#mainNode = ff.view.buoy.MainNode2D(plane, paperview, ctrl) |
|
227 |
|
|
228 |
|
|
229 |
### MindMap |
### MindMap |
230 |
mmview = ff.view.lava.mindMapView2D.MindMapView2D(fen, nodeview) |
mmview = ff.view.lava.mindMapView2D.MindMapView2D(fen, nodeview) |
231 |
mmview = ff.view.AreaSelectingView2D(mmview) |
mmview = ff.view.AreaSelectingView2D(mmview) |
232 |
|
|
233 |
|
|
234 |
|
### Connectors |
235 |
|
# MindMap |
236 |
mmconnector = ff.view.buoy.lava.MindMapConnector(fen) |
mmconnector = ff.view.buoy.lava.MindMapConnector(fen) |
237 |
mmconnector.normalNodeNodeType = ff.view.buoy.NodeType2D(irregu, \ |
mmconnector.normalNodeNodeType = ff.view.buoy.NodeType2D(irregu, \ |
238 |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, ctrl)) |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, mainMouse)) |
239 |
mmconnector.mindMapNodeType = ff.view.buoy.NodeType2DFull(mmview, \ |
mmconnector.mindMapNodeType = ff.view.buoy.NodeType2DFull(mmview, \ |
240 |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, ctrl)) |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, mainMouse)) |
241 |
|
|
242 |
|
|
243 |
|
# PP(Canvas) |
244 |
ppconnector = ff.view.buoy.PPConnector(fen, irregu, |
ppconnector = ff.view.buoy.PPConnector(fen, irregu, |
245 |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, ctrl), |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, mainMouse), |
246 |
nodeview) |
nodeview) |
247 |
|
# Transclusion |
248 |
tconnector = ff.view.buoy.TransclusionConnector(fen, nodeview) |
tconnector = ff.view.buoy.TransclusionConnector(fen, nodeview) |
249 |
#pagescroll2d = ff.view.IrregularViewportView2D( |
#pagescroll2d = ff.view.IrregularViewportView2D( |
250 |
# ff.view.PaperView2D(vob.putil.demowindow.w, |
# ff.view.PaperView2D(vob.putil.demowindow.w, |
254 |
pagescroll2d = ff.view.AreaSelectingView2D(pagescroll2d) |
pagescroll2d = ff.view.AreaSelectingView2D(pagescroll2d) |
255 |
|
|
256 |
tconnector.normalNodeNodeType = ff.view.buoy.NodeType2D(irregu, |
tconnector.normalNodeNodeType = ff.view.buoy.NodeType2D(irregu, |
257 |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, ctrl)) |
ff.view.buoy.MainNode2D.MainNode2DFactory(1, mainMouse)) |
258 |
tconnector.pageImageScrollNodeType = ff.view.buoy.NodeType2DFull(pagescroll2d, \ |
tconnector.pageImageScrollNodeType = ff.view.buoy.NodeType2DFull(pagescroll2d, \ |
259 |
ff.view.buoy.FisheyeMainNode2D.FisheyeMainNode2DFactory(ctrl)) |
ff.view.buoy.FisheyeMainNode2D.FisheyeMainNode2DFactory(mainMouse)) |
260 |
|
|
261 |
|
|
262 |
class DoubleGeometer: |
class DoubleGeometer: |
313 |
buoywidth1 = w1 * .7 |
buoywidth1 = w1 * .7 |
314 |
buoyheight1 = h1 * 1 |
buoyheight1 = h1 * 1 |
315 |
|
|
316 |
if (dbg): pa("SET DOUBLE ", h0, h1, w0, w1, s0, s1, buoywidth0, buoywidth1) |
if (dbg): p("SET DOUBLE ", h0, h1, w0, w1, s0, s1, buoywidth0, buoywidth1) |
317 |
|
|
318 |
vs.coords.setOrthoBoxParams(self.into1, 1, |
vs.coords.setOrthoBoxParams(self.into1, 1, |
319 |
ctrx - .5*w0*s0, |
ctrx - .5*w0*s0, |
354 |
return [(self.into1, self.buoyinto1), (self.into2, self.buoyinto2)] |
return [(self.into1, self.buoyinto1), (self.into2, self.buoyinto2)] |
355 |
|
|
356 |
def mouse(self, ev, oldvs): |
def mouse(self, ev, oldvs): |
357 |
if dbg: pa(ev) |
if dbg: p(ev) |
358 |
|
|
359 |
if ev.getType() == ev.MOUSE_RELEASED: |
if ev.getType() == ev.MOUSE_RELEASED: |
360 |
ctrl.removePressState() |
p('mainMouse released?') |
361 |
|
# mainMouse XXX |
362 |
|
#ctrl.removePressState() |
363 |
self.context.states.clean() |
self.context.states.clean() |
364 |
w.setCursor('default') |
w.setCursor('default') |
365 |
# 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. |
366 |
return 1 |
# return 1 |
367 |
|
return 0 |
368 |
#return 0 |
#return 0 |
369 |
|
|
370 |
# ...then see context |
# ...then see context |
447 |
buoywidth0 = w0 * 1.2 |
buoywidth0 = w0 * 1.2 |
448 |
buoyheight0 = h0 * 1.2 |
buoyheight0 = h0 * 1.2 |
449 |
|
|
450 |
if (dbg): pa("SET SINGLE ", h0, w0, s0, buoywidth0) |
if (dbg): p("SET SINGLE ", h0, w0, s0, buoywidth0) |
451 |
|
|
452 |
vs.coords.setOrthoBoxParams(self.into1, 1, |
vs.coords.setOrthoBoxParams(self.into1, 1, |
453 |
ctrx - .5*w0*s0, |
ctrx - .5*w0*s0, |
478 |
if single: |
if single: |
479 |
vob.buoy.buoymanager.MultiBuoyManager.__init__(self, |
vob.buoy.buoymanager.MultiBuoyManager.__init__(self, |
480 |
[mainNode], [ppconnector, mmconnector, tconnector], |
[mainNode], [ppconnector, mmconnector, tconnector], |
481 |
SingleGeometer(self, context, nodeview), |
SingleGeometer(self, context, nodeview)) |
|
context=context) |
|
482 |
else: |
else: |
483 |
vob.buoy.buoymanager.MultiBuoyManager.__init__(self, |
vob.buoy.buoymanager.MultiBuoyManager.__init__(self, |
484 |
[mainNode, mainNode2], |
[mainNode, mainNode2], |
485 |
[ppconnector, mmconnector, tconnector], |
[ppconnector, mmconnector, tconnector], |
486 |
DoubleGeometer(self, context, nodeview), |
DoubleGeometer(self, context, nodeview)) |
|
context=context) |
|
487 |
|
|
488 |
w.setCursor('default') |
w.setCursor('default') |
489 |
|
|