22 |
pscv = gzz.view.PageSpanCellView() |
pscv = gzz.view.PageSpanCellView() |
23 |
pscv.useBg = 1 |
pscv.useBg = 1 |
24 |
|
|
25 |
|
class ScrollblockData: |
26 |
|
def __init__(self, scrollBlock): |
27 |
|
self.layout = pscv.getLayout(scrollBlock) |
28 |
|
self.irregu = gfx.libutil.effects.IrreguFrame(0, 0, |
29 |
|
self.layout.w, self.layout.h, 50, 200) |
30 |
|
|
31 |
|
|
32 |
|
scrollblockDatas = gzz.util.CachingMap(40) |
33 |
|
def getScrollblockData(scrollBlock): |
34 |
|
data = scrollblockDatas.get(scrollBlock) |
35 |
|
if data == None: |
36 |
|
data = ScrollblockData(scrollBlock) |
37 |
|
scrollblockDatas.put(scrollBlock, data) |
38 |
|
return data |
39 |
|
|
40 |
def makeEnf(span): |
def makeEnf(span): |
41 |
return gzz.media.impl.Enfilade1DImpl.theMaker.makeEnfilade(span) |
return gzz.media.impl.Enfilade1DImpl.theMaker.makeEnfilade(span) |
42 |
|
|
54 |
class WholePageSpanNodeType(AbstractPageSpanNodeType): |
class WholePageSpanNodeType(AbstractPageSpanNodeType): |
55 |
def getSize(self, linkId, anchorSpan, wh): |
def getSize(self, linkId, anchorSpan, wh): |
56 |
sb = anchorSpan.getScrollBlock(); |
sb = anchorSpan.getScrollBlock(); |
57 |
layout = pscv.getLayout(sb) |
data = getScrollblockData(sb) |
58 |
wh[0] = layout.w |
layout = getLayout(sb) |
59 |
wh[1] = layout.h |
wh[0] = data.layout.w |
60 |
return layout |
wh[1] = data.layout.h |
61 |
|
return data |
62 |
|
|
63 |
def renderBuoy(self, vs, into, linkId, anchorSpan, layout): |
def renderBuoy(self, vs, into, linkId, anchorSpan, data): |
64 |
if layout == None: |
if data == None: |
65 |
layout = pscv.getLayout(anchorSpan.getScrollBlock()) |
data = getScrollblockData(anchorSpan.getScrollBlock) |
66 |
# For now, we'll just squish to fit |
# For now, we'll just squish to fit |
67 |
layout.placeBoxed(vs, into, .3, 100) |
data.layout.placeBoxed(vs, into, .3, 100) |
68 |
|
|
69 |
return into |
return into |
70 |
|
|
71 |
class AnchorPageSpanNodeType(AbstractPageSpanNodeType): |
class AnchorPageSpanNodeType(AbstractPageSpanNodeType): |
72 |
def renderBuoy(self, vs, into, linkId, anchorSpan, layout): |
def renderBuoy(self, vs, into, linkId, anchorSpan, data): |
73 |
if 0: |
if 0: |
74 |
dbg1 = vs.unitSqCS(into, "U") |
dbg1 = vs.unitSqCS(into, "U") |
75 |
vs.put(coloredQuad((1,0,0)), dbg1) |
vs.put(coloredQuad((1,0,0)), dbg1) |
76 |
|
|
77 |
if layout == None: |
if data == None: |
78 |
layout = pscv.getLayout(anchorSpan.getScrollBlock()) |
data = getScrollblockData(anchorSpan.getScrollBlock()) |
79 |
vs.coords.getSqSize(into, size) |
vs.coords.getSqSize(into, size) |
80 |
extents = layout.getExtents(anchorSpan, None) |
extents = data.layout.getExtents(anchorSpan, None) |
81 |
print "ExtentsInit: ", [i for i in extents] |
print "ExtentsInit: ", [i for i in extents] |
82 |
print "size: ", [s for s in size] |
print "size: ", [s for s in size] |
83 |
scalex = size[0] / extents[2] |
scalex = size[0] / extents[2] |
95 |
paperCS = vs.orthoCS(into, "paper", 0, -extents[0] * scale, |
paperCS = vs.orthoCS(into, "paper", 0, -extents[0] * scale, |
96 |
-extents[1] * scale, scale, scale) |
-extents[1] * scale, scale, scale) |
97 |
|
|
|
irregu = gfx.libutil.effects.IrreguFrame(0, 0, layout.w, layout.h, |
|
|
50, 200, type="square") |
|
|
# irregu = gfx.libutil.effects.IrreguFrame(-100, -100, 100*layout.w, 100*layout.h, |
|
|
# .05, .25, type="square") |
|
|
|
|
98 |
paperLoc = vs.coords.ortho(0, 0, extents[0], extents[1], extents[2], extents[3]) |
paperLoc = vs.coords.ortho(0, 0, extents[0], extents[1], extents[2], extents[3]) |
99 |
vs.matcher.add(paperCS, paperLoc, "VIEWPORT") |
vs.matcher.add(paperCS, paperLoc, "VIEWPORT") |
100 |
|
|
101 |
class FrameR(java.lang.Runnable): |
class FrameR(java.lang.Runnable): |
102 |
def run(rself): |
def run(rself): |
103 |
vs.map.put(irregu.frame, paperCS, paperLoc) |
vs.map.put(data.irregu.frame, paperCS, paperLoc) |
104 |
class ContentR(java.lang.Runnable): |
class ContentR(java.lang.Runnable): |
105 |
def run(rself): |
def run(rself): |
106 |
vs.map.put(irregu.content, paperCS, paperLoc) |
vs.map.put(data.irregu.content, paperCS, paperLoc) |
107 |
class LayoutR(java.lang.Runnable): |
class LayoutR(java.lang.Runnable): |
108 |
def run(rself): |
def run(rself): |
109 |
layout.place(vs, paperCS, .6, 200, into) |
data.layout.place(vs, paperCS, .6, 200, into) |
110 |
|
|
111 |
gzz.gfx.gl.Stencil.drawStenciled(vs, ContentR(), None, FrameR(), LayoutR(), 1) |
gzz.gfx.gl.Stencil.drawStenciled(vs, ContentR(), None, FrameR(), LayoutR(), 1) |
112 |
# LayoutR().run() |
# LayoutR().run() |
128 |
self.enf = makeEnf(self.scrollBlock.getCurrent()) |
self.enf = makeEnf(self.scrollBlock.getCurrent()) |
129 |
self.size = jarray.zeros(2, "f") |
self.size = jarray.zeros(2, "f") |
130 |
|
|
131 |
self.layout = pscv.getLayout(self.enf) |
self.data = getScrollblockData(self.scrollBlock) |
132 |
|
|
133 |
xywh = self.layout.getExtents(anchorSpan, None) |
xywh = self.data.layout.getExtents(anchorSpan, None) |
134 |
|
|
135 |
self.fisheye = gzz.view.FisheyeState( |
self.fisheye = gzz.view.FisheyeState( |
136 |
1.1, .04, 5, 2, 1000 |
1.1, .04, 5, 2, 1000 |
144 |
""" |
""" |
145 |
for repr in gzz.zzutil.Media.getScrollBlockRepresentatives(enf): |
for repr in gzz.zzutil.Media.getScrollBlockRepresentatives(enf): |
146 |
if repr.getScrollBlock() == self.scrollBlock: |
if repr.getScrollBlock() == self.scrollBlock: |
147 |
xywh = self.layout.getExtents(repr, None) |
xywh = self.data.layout.getExtents(repr, None) |
148 |
return self.vs.orthoBoxCS(self.shift, key, -20, |
return self.vs.orthoBoxCS(self.shift, key, -20, |
149 |
xywh[0], xywh[1], 1, 1,xywh[2], xywh[3]) |
xywh[0], xywh[1], 1, 1,xywh[2], xywh[3]) |
150 |
|
|
155 |
vs.coords.getSqSize(into, size) |
vs.coords.getSqSize(into, size) |
156 |
print "SQ:", size[0], size[1] |
print "SQ:", size[0], size[1] |
157 |
|
|
158 |
self.scale = size[1] / self.layout.h |
self.scale = size[1] / self.data.layout.h |
159 |
self.ctr = vs.translateCS(into, "ORIGIN", .5 * size[0], |
self.ctr = vs.translateCS(into, "ORIGIN", .5 * size[0], |
160 |
.5 * size[1]) |
.5 * size[1]) |
161 |
self.scale = vs.scaleCS(self.ctr, "SCALE", self.scale, self.scale) |
self.scale = vs.scaleCS(self.ctr, "SCALE", self.scale, self.scale) |
164 |
|
|
165 |
# XXX This is not right: the distortion |
# XXX This is not right: the distortion |
166 |
# should be done here. |
# should be done here. |
167 |
self.layout.place(vs, self.shift, .7, 300) |
self.data.layout.place(vs, self.shift, .7, 300) |
168 |
|
|
169 |
if self.nodetype.scrollBlockLinker.enfiladeOverlap != None: |
if self.nodetype.scrollBlockLinker.enfiladeOverlap != None: |
170 |
matches = (self.nodetype.scrollBlockLinker |
matches = (self.nodetype.scrollBlockLinker |
193 |
self.doReq() |
self.doReq() |
194 |
|
|
195 |
def doReq(self): |
def doReq(self): |
196 |
self.layout.request(self.fisheye.curx, self.fisheye.cury, 0, 1, 2000) |
self.data.layout.request(self.fisheye.curx, self.fisheye.cury, 0, 1, 2000) |
197 |
|
|
198 |
def mouse(self, mouseEvent, oldVS): |
def mouse(self, mouseEvent, oldVS): |
199 |
if self.fisheye.event(mouseEvent): |
if self.fisheye.event(mouseEvent): |
220 |
y = size[1] |
y = size[1] |
221 |
if x < 0: x = 0 |
if x < 0: x = 0 |
222 |
if y < 0: y = 0 |
if y < 0: y = 0 |
223 |
if x > self.layout.w: x = self.layout.w |
if x > self.data.layout.w: x = self.data.layout.w |
224 |
if y > self.layout.h: y = self.layout.h |
if y > self.data.layout.h: y = self.data.layout.h |
225 |
self.fisheye.setCenter(x, y) |
self.fisheye.setCenter(x, y) |
226 |
gzz.client.AbstractUpdateManager.chg() |
gzz.client.AbstractUpdateManager.chg() |
227 |
self.doReq() |
self.doReq() |