13 |
# |
# |
14 |
# "LAYOUT" - the coordinate system in which the pagespan layout |
# "LAYOUT" - the coordinate system in which the pagespan layout |
15 |
# is rendered into. |
# is rendered into. |
16 |
# "VIEWPORT" - the edges of the viewport |
# "VIEWPORT" - the edges of the viewport, w.r.t. LAYOUT |
17 |
|
|
18 |
import jarray |
import jarray |
19 |
import java |
import java |
26 |
pscv = gzz.view.PageSpanCellView() |
pscv = gzz.view.PageSpanCellView() |
27 |
pscv.useBg = 1 |
pscv.useBg = 1 |
28 |
|
|
29 |
|
def placeFramed(vs, data, paperCS, viewport, cull=-1): |
30 |
|
class FrameR(java.lang.Runnable): |
31 |
|
def run(rself): |
32 |
|
vs.map.put(data.irregu.frame, paperCS, viewport) |
33 |
|
class ContentR(java.lang.Runnable): |
34 |
|
def run(rself): |
35 |
|
vs.map.put(data.irregu.content, paperCS, viewport) |
36 |
|
class LayoutR(java.lang.Runnable): |
37 |
|
def run(rself): |
38 |
|
data.layout.place(vs, paperCS, .6, 200, cull) |
39 |
|
|
40 |
|
gzz.gfx.gl.Stencil.drawStenciled(vs, ContentR(), None, FrameR(), LayoutR(), 1) |
41 |
|
|
42 |
|
|
43 |
class ScrollblockData: |
class ScrollblockData: |
44 |
def __init__(self, scrollBlock): |
def __init__(self, scrollBlock): |
45 |
self.layout = pscv.getLayout(scrollBlock) |
self.layout = pscv.getLayout(scrollBlock) |
66 |
self.scrollBlockLinker = scrollBlockLinker |
self.scrollBlockLinker = scrollBlockLinker |
67 |
def createMainNode(self, linkId, anchorSpan, listener): |
def createMainNode(self, linkId, anchorSpan, listener): |
68 |
return PageSpanMainNode(self, anchorSpan, listener) |
return PageSpanMainNode(self, anchorSpan, listener) |
|
|
|
69 |
size = jarray.zeros(2, 'f') |
size = jarray.zeros(2, 'f') |
70 |
|
|
71 |
class WholePageSpanNodeType(AbstractPageSpanNodeType): |
class WholePageSpanNodeType(AbstractPageSpanNodeType): |
116 |
paperCS = vs.orthoCS(into, "paper", 0, -extents[0] * scale, |
paperCS = vs.orthoCS(into, "paper", 0, -extents[0] * scale, |
117 |
-extents[1] * scale, scale, scale) |
-extents[1] * scale, scale, scale) |
118 |
|
|
119 |
paperLoc = vs.coords.ortho(0, 0, extents[0], extents[1], extents[2], extents[3]) |
viewport = vs.coords.ortho(0, 0, extents[0], extents[1], extents[2], extents[3]) |
120 |
vs.matcher.add(paperCS, paperLoc, "VIEWPORT") |
vs.matcher.add(into, viewport, "VIEWPORT") |
121 |
|
|
122 |
class FrameR(java.lang.Runnable): |
placeFramed(vs, data, paperCS, viewport, into) |
|
def run(rself): |
|
|
vs.map.put(data.irregu.frame, paperCS, paperLoc) |
|
|
class ContentR(java.lang.Runnable): |
|
|
def run(rself): |
|
|
vs.map.put(data.irregu.content, paperCS, paperLoc) |
|
|
class LayoutR(java.lang.Runnable): |
|
|
def run(rself): |
|
|
data.layout.place(vs, paperCS, .6, 200, into) |
|
|
|
|
|
gzz.gfx.gl.Stencil.drawStenciled(vs, ContentR(), None, FrameR(), LayoutR(), 1) |
|
123 |
# LayoutR().run() |
# LayoutR().run() |
124 |
|
|
125 |
|
|
144 |
xywh = self.data.layout.getExtents(anchorSpan, None) |
xywh = self.data.layout.getExtents(anchorSpan, None) |
145 |
|
|
146 |
self.fisheye = gzz.view.FisheyeState( |
self.fisheye = gzz.view.FisheyeState( |
147 |
1.1, .04, 5, 2, 1000 |
1.1, .1, 5, 2, 1000 |
148 |
) |
) |
149 |
|
|
150 |
self.fisheye.setCenter(xywh[0] + .5 * xywh[2], |
self.fisheye.setCenter(xywh[0] + .5 * xywh[2], |
174 |
self.shift = self.fisheye.getCoordsys(vs, self.scale, "TR") |
self.shift = self.fisheye.getCoordsys(vs, self.scale, "TR") |
175 |
vs.matcher.add(into, self.shift, "LAYOUT") |
vs.matcher.add(into, self.shift, "LAYOUT") |
176 |
|
|
177 |
self.data.layout.place(vs, self.shift, .7, 300) |
w,h = self.data.layout.w, self.data.layout.h |
178 |
|
shi = .2 |
179 |
|
viewport = vs.coords.ortho(0, 0, -shi*w, -shi*h, (1+2*shi)*w, (1+2*shi)*h) |
180 |
|
vs.matcher.add(into, viewport, "VIEWPORT") |
181 |
|
|
182 |
|
placeFramed(vs, self.data, self.shift, viewport) |
183 |
|
|
184 |
|
|
185 |
if self.nodetype.scrollBlockLinker.enfiladeOverlap != None: |
if self.nodetype.scrollBlockLinker.enfiladeOverlap != None: |
186 |
matches = (self.nodetype.scrollBlockLinker |
matches = (self.nodetype.scrollBlockLinker |