44 |
return into |
return into |
45 |
|
|
46 |
class AnchorPageSpanNodeType(AbstractPageSpanNodeType): |
class AnchorPageSpanNodeType(AbstractPageSpanNodeType): |
47 |
def renderBuoy(self, vs, into, linkId, anchorSpan): |
def renderBuoy(self, vs, into, linkId, anchorSpan, layout): |
48 |
# XXX!!!! |
# XXX!!!! |
49 |
# Irregu! |
# Irregu! |
50 |
# find edges of span |
# find edges of span |
53 |
pscv.place(makeEnf(sb.getCurrent()), vs, into, |
pscv.place(makeEnf(sb.getCurrent()), vs, into, |
54 |
.5, 200); |
.5, 200); |
55 |
|
|
56 |
|
size = jarray.zeros(3, 'f') |
57 |
|
|
58 |
class PageSpanMainNode(BuoyViewMainNode): |
class PageSpanMainNode(BuoyViewMainNode): |
59 |
def __init__(self, nodetype, anchorSpan, listener): |
def __init__(self, nodetype, anchorSpan, listener): |
60 |
self.nodetype = nodetype |
self.nodetype = nodetype |
69 |
|
|
70 |
self.x = xywh[0] + .5 * xywh[2] |
self.x = xywh[0] + .5 * xywh[2] |
71 |
self.y = xywh[1] + .5 * xywh[3] |
self.y = xywh[1] + .5 * xywh[3] |
72 |
|
def setShift(self, vs): |
73 |
|
vs.coords.setTranslateParams(self.shift, -self.x, -self.y) |
74 |
|
|
75 |
def renderMain(self, vs, into): |
def renderMain(self, vs, into): |
76 |
|
self.vs = vs |
77 |
|
vs.coords.getSqSize(into, size) |
78 |
|
print "SQ:", size[0], size[1] |
79 |
|
|
80 |
|
self.scale = size[1] / self.layout.h |
81 |
|
self.ctr = vs.translateCS(into, "ORIGIN", .5 * size[0], |
82 |
|
.5 * size[1]) |
83 |
|
self.scale = vs.scaleCS(self.ctr, "SCALE", self.scale, self.scale) |
84 |
|
self.shift = vs.translateCS(self.scale, "TR", -self.x, -self.y) |
85 |
|
|
86 |
|
|
87 |
# XXX This is not right: the distortion |
# XXX This is not right: the distortion |
88 |
# should be done here. |
# should be done here. |
89 |
self.layout.placeBoxed(vs, into, 1, 200) |
self.layout.place(vs, self.shift, 1, 200) |
90 |
|
|
91 |
|
if self.nodetype.scrollBlockLinker.enfiladeOverlap != None: |
92 |
|
matches = (self.nodetype.scrollBlockLinker |
93 |
|
.enfiladeOverlap.getMatches(self.enf)) |
94 |
|
for m in matches: |
95 |
|
self.listener.link(-1, into, |
96 |
|
self.nodetype.scrollBlockLinker.cellNodeType, |
97 |
|
gzz.util.Pair(m, self.scrollBlock), m) |
98 |
|
|
99 |
|
if self.nodetype.scrollBlockLinker.xuIndex != None: |
100 |
|
xuIndex = self.nodetype.scrollBlockLinker.xuIndex |
101 |
|
for dir, index, otherEndName in [ |
102 |
|
(1, xuIndex.getForwardIndex(), "to"), |
103 |
|
(-1, xuIndex.getBackwardIndex(), "from")]: |
104 |
|
for xulink in index.getMatches(self.enf): |
105 |
|
endenf = getattr(xulink, otherEndName) |
106 |
|
for repr in gzz.zzutil.Media.getScrollBlockRepresentatives(endenf): |
107 |
|
self.listener.link(dir, into, |
108 |
|
self.nodetype.scrollBlockLinker.xulinkPageSpanNodeType, |
109 |
|
xulink, repr) |
110 |
|
|
|
matches = (self.nodetype.scrollBlockLinker |
|
|
.enfiladeOverlap.getMatches(self.enf)) |
|
|
for m in matches: |
|
|
self.listener.link(-1, into, |
|
|
self.nodetype.scrollBlockLinker.cellNodeType, |
|
|
gzz.util.Pair(m, self.scrollBlock), m) |
|
111 |
def mouse(self, mouseEvent, oldVS): |
def mouse(self, mouseEvent, oldVS): |
112 |
pass |
if mouseEvent.getID() == mouseEvent.MOUSE_CLICKED: |
113 |
|
print "MOUSE PSPMAIN ",mouseEvent |
114 |
|
size[0] = mouseEvent.getX() |
115 |
|
size[1] = mouseEvent.getY() |
116 |
|
size[2] = 0 |
117 |
|
tmp = jarray.zeros(3, 'f') |
118 |
|
oldVS.coords.inverseTransformPoints3(self.ctr, size, tmp) |
119 |
|
print "Ev - ctr: ",mouseEvent, tmp[0], tmp[1], tmp[2] |
120 |
|
oldVS.coords.inverseTransformPoints3(self.scale, size, tmp) |
121 |
|
print "Ev - scale: ",mouseEvent, tmp[0], tmp[1], tmp[2] |
122 |
|
|
123 |
|
oldVS.coords.inverseTransformPoints3(self.shift, size, size) |
124 |
|
print "Ev: ",size[0], size[1], size[2] |
125 |
|
print "Self.xy was",self.x,self.y |
126 |
|
oldVS.coords.transformPoints3(self.shift, size, tmp) |
127 |
|
print "Retransformed:", tmp[0], tmp[1], tmp[2] |
128 |
|
self.x = size[0] |
129 |
|
self.y = size[1] |
130 |
|
if self.x < 0: self.x = 0 |
131 |
|
if self.y < 0: self.y = 0 |
132 |
|
if self.x > self.layout.w: self.x = self.layout.w |
133 |
|
if self.y > self.layout.h: self.y = self.layout.h |
134 |
|
self.setShift(oldVS) |
135 |
|
gzz.client.AbstractUpdateManager.chg() |
136 |
|
return 0 |
137 |
def keystroke(self, key): |
def keystroke(self, key): |
138 |
pass |
pass |
139 |
|
|