101 |
pass |
pass |
102 |
|
|
103 |
class Context(ff.view.lava.ContextNodeView.Context, |
class Context(ff.view.lava.ContextNodeView.Context, |
104 |
ff.view.buoy.AbstractMainNode2D.Context, |
ff.view.buoy.AbstractMainNode2D.Context): |
|
ff.view.lava.TextHandler.Context): |
|
105 |
def __init__(self, win, fen, pp, filename): |
def __init__(self, win, fen, pp, filename): |
106 |
global w |
global w |
107 |
w = win |
w = win |
115 |
return self.states.fastChg |
return self.states.fastChg |
116 |
|
|
117 |
# call back from AbstractMainNode2D |
# call back from AbstractMainNode2D |
118 |
def mainNodeToBeRender(self, vs, into, main): |
def mainNodeToBeRender(self, vs, into, mainNode): |
119 |
self.selection = ff.util.lava.view.getView(main, ff.view.AreaSelectingView2D) |
self.selection = ff.util.lava.view.getView(mainNode, ff.view.AreaSelectingView2D) |
120 |
|
|
121 |
|
if mainNode != self.states.buoymanager.getLastMain(): return |
|
|
|
|
#self.super.mainNodeToBeRender(vs, into, main) |
|
122 |
|
|
123 |
# draw cursor |
# draw cursor |
124 |
if not self.states.cursor.hasAccursed() and main == self.fenPDF.views.getBuoyManager().getLastMain(): |
mainNode = self.states.buoymanager.getLastMain() |
125 |
tmp = jarray.zeros(2, 'f') |
canvas = ff.util.lava.view.getView(mainNode, ff.view.CanvasView2D) |
126 |
vs.coords.getSqSize(into, tmp) |
if not isinstance(canvas, ff.view.CanvasView2D): return |
|
cursorCS = vs.orthoBoxCS(into, "CURSOR", 0, |
|
|
tmp[0]/2, tmp[1]/2, 1,1, tmp[0]/12, tmp[1]/12) |
|
|
vs.put(vob.vobs.LineVob(0,0,0,1, java.awt.Color.darkGray), cursorCS) |
|
127 |
|
|
128 |
|
xy = jarray.zeros(2, 'f') |
129 |
|
if not self.states.cursor.hasAccursed(): |
130 |
|
focus = mainNode.getFocus() |
131 |
|
cs = vs.matcher.getCS(into, 'canvasview_conc') |
132 |
|
cs = vs.coords.orthoBox(cs,0, focus.getPanX(), focus.getPanY(), 1,1, 1,1) |
133 |
|
else: |
134 |
|
# draw the cursor in somewhere where node is. |
135 |
|
containerCS = canvas.getContainerCS(vs, into) |
136 |
|
cs = vs.matcher.getCS(containerCS, self.states.cursor.getAccursed()) |
137 |
|
if cs < 0: return |
138 |
|
|
139 |
|
viewFunction = self.states.fenPDF.views.getMultiplexerNodeContentFunction() |
140 |
|
p = viewFunction.f(self.states.fen.graph, self.states.cursor.getAccursed()) |
141 |
|
if isinstance(p, vob.lava.placeable.TextPlaceable): |
142 |
|
p.getCursorXY(self.states.cursor.getCursorOffset(), xy) |
143 |
|
else: return |
144 |
|
|
145 |
|
# XXX ugly |
146 |
|
height = 24 |
147 |
|
cs = vs.coords.ortho(cs, 0,xy[0],xy[1], 1, -height) |
148 |
|
vs.put(vob.vobs.ContinuousLineVob(5, [0,0,0 , 0,1,0]), cs) |
149 |
|
|
150 |
|
|
151 |
|
|