1 |
|
"""A pagespan scroll shown in a buoy view. |
2 |
|
|
3 |
|
An interesting point: if this is from a transclusion, we |
4 |
|
want to show the *whole* scrollblock always, in small scale. |
5 |
|
If this is from a xanadu link, we want to show the linked-to |
6 |
|
area. |
7 |
|
""" |
8 |
|
|
9 |
import jarray |
import jarray |
10 |
|
|
11 |
# Page span scrollblock as a whole; |
# Page span scrollblock as a whole; |
19 |
def makeEnf(span): |
def makeEnf(span): |
20 |
return gzz.media.impl.Enfilade1DImpl.theMaker.makeEnfilade(span) |
return gzz.media.impl.Enfilade1DImpl.theMaker.makeEnfilade(span) |
21 |
|
|
22 |
class PageSpanNodeType(BuoyViewNodeType): |
class AbstractPageSpanNodeType(BuoyViewNodeType): |
23 |
def __init__(self, scrollBlockLinker): |
def __init__(self, scrollBlockLinker): |
24 |
self.scrollBlockLinker = scrollBlockLinker |
self.scrollBlockLinker = scrollBlockLinker |
25 |
|
def createMainNode(self, linkId, anchorSpan, listener): |
26 |
|
return PageSpanMainNode(self, anchorSpan, listener) |
27 |
|
|
28 |
|
class WholePageSpanNodeType(AbstractPageSpanNodeType): |
29 |
|
def renderBuoy(self, vs, into, linkId, anchorSpan): |
30 |
|
# XXX!!!! |
31 |
|
# Irregu! |
32 |
|
# find edges of span |
33 |
|
# should place only that region surrounded by irregu |
34 |
|
sb = anchorSpan.getScrollBlock(); |
35 |
|
pscv.place(makeEnf(sb.getCurrent()), vs, into, |
36 |
|
.5, 200); |
37 |
|
|
38 |
|
class AnchorPageSpanNodeType(AbstractPageSpanNodeType): |
39 |
def renderBuoy(self, vs, into, linkId, anchorSpan): |
def renderBuoy(self, vs, into, linkId, anchorSpan): |
40 |
# XXX!!!! |
# XXX!!!! |
41 |
# Irregu! |
# Irregu! |
44 |
sb = anchorSpan.getScrollBlock(); |
sb = anchorSpan.getScrollBlock(); |
45 |
pscv.place(makeEnf(sb.getCurrent()), vs, into, |
pscv.place(makeEnf(sb.getCurrent()), vs, into, |
46 |
.5, 200); |
.5, 200); |
|
def createMainNode(self, linkId, anchorSpan, listener): |
|
|
return PageSpanMainNode(self, anchorSpan, listener) |
|
47 |
|
|
48 |
class PageSpanMainNode(BuoyViewMainNode): |
class PageSpanMainNode(BuoyViewMainNode): |
49 |
def __init__(self, nodetype, anchorSpan, listener): |
def __init__(self, nodetype, anchorSpan, listener): |
52 |
self.scrollBlock = anchorSpan.getScrollBlock() |
self.scrollBlock = anchorSpan.getScrollBlock() |
53 |
self.enf = makeEnf(self.scrollBlock.getCurrent()) |
self.enf = makeEnf(self.scrollBlock.getCurrent()) |
54 |
self.size = jarray.zeros(2, "f") |
self.size = jarray.zeros(2, "f") |
55 |
# Get location of span |
|
56 |
pscv.getSize(self.enf, self.size, anchorSpan) |
self.layout = pscv.getLayout(self.enf) |
57 |
self.x = pscv.xoffs |
|
58 |
self.y = pscv.yoffs |
xywh = self.layout.getExtents(anchorSpan, None) |
59 |
|
|
60 |
|
self.x = xywh[0] + .5 * xywh[2] |
61 |
|
self.y = xywh[1] + .5 * xywh[3] |
62 |
def renderMain(self, vs, into): |
def renderMain(self, vs, into): |
63 |
pscv.placeCentered(self.enf, vs, into, None, 1, 200) |
self.layout.place(vs, into, 1, 200) |
64 |
|
|
65 |
matches = (self.nodetype.scrollBlockLinker |
matches = (self.nodetype.scrollBlockLinker |
66 |
.enfiladeOverlap.getMatches(self.enf)) |
.enfiladeOverlap.getMatches(self.enf)) |
67 |
for m in matches: |
for m in matches: |