34 |
def __init__(self, context): |
def __init__(self, context): |
35 |
self.context = context |
self.context = context |
36 |
def super(self): |
def super(self): |
37 |
self.main = self.context.states.buoymanager.getLastMain() |
self.mainNode = self.context.states.buoymanager.getLastMain() |
38 |
self.oldVS = self.context.states.buoymanager.getVs() |
self.oldVS = self.context.states.buoymanager.getVs() |
39 |
|
|
40 |
|
|
46 |
# grrr.. pythonism, overloading of own method is sicknes |
# grrr.. pythonism, overloading of own method is sicknes |
47 |
if y=='foo': return self._changedRelative(x) |
if y=='foo': return self._changedRelative(x) |
48 |
self.super() |
self.super() |
49 |
f = self.main.getFocus() |
f = self.mainNode.getFocus() |
50 |
fX, fY = f.getPanX(), f.getPanY() |
fX, fY = f.getPanX(), f.getPanY() |
51 |
f.setPan(fX-x/f.zoom, |
f.setPan(fX-x/f.zoom, |
52 |
fY-y/f.zoom) |
fY-y/f.zoom) |
53 |
self.main.chgFast(self.oldVS, -1) |
self.mainNode.chgFast(self.oldVS, -1) |
54 |
def _changedRelative(self, d): |
def _changedRelative(self, d): |
55 |
self.super() |
self.super() |
56 |
f = self.main.getFocus() |
f = self.mainNode.getFocus() |
57 |
fY = f.getPanY() |
fY = f.getPanY() |
58 |
f.setPan(0, fY-d/f.zoom) |
f.setPan(0, fY-d/f.zoom) |
59 |
self.main.chgFast(self.oldVS, -1) |
self.mainNode.chgFast(self.oldVS, -1) |
60 |
|
|
61 |
class BrowseClick(AbstractAction, vob.mouse.MouseClickListener): |
class BrowseClick(AbstractAction, vob.mouse.MouseClickListener): |
62 |
def clicked(self, x, y): |
def clicked(self, x, y): |
63 |
if dbg: p('move pan slow') |
if dbg: p('move pan slow') |
64 |
self.super() |
self.super() |
65 |
obj = self.main.getNodeOnPlane(self.oldVS, x,y) |
obj = self.mainNode.getNodeOnPlane(self.oldVS, x,y) |
66 |
self.context.states.cursor.setAccursed(obj) |
self.context.states.cursor.setAccursed(obj) |
67 |
self.main.moveToPoint(int(x),int(y), self.oldVS) |
self.mainNode.moveToPoint(int(x),int(y), self.oldVS) |
68 |
self.context.states.fastChg = 0 |
self.context.states.fastChg = 0 |
69 |
|
|
70 |
|
|
71 |
class ZoomPan(vob.input.RelativeAxisListener, AbstractAction): |
class ZoomPan(vob.input.RelativeAxisListener, AbstractAction): |
72 |
def changedRelative(self, x): |
def changedRelative(self, x): |
73 |
self.super() |
self.super() |
74 |
self.main.changeZoom(x) |
self.mainNode.changeZoom(x) |
75 |
self.main.chgFast(self.oldVS, -1) |
self.mainNode.chgFast(self.oldVS, -1) |
76 |
self.context.states.fastChg = 1 |
self.context.states.fastChg = 1 |
77 |
|
|
78 |
class ChangeSize(vob.input.RelativeAxisListener, AbstractAction): |
class ChangeSize(vob.input.RelativeAxisListener, AbstractAction): |
79 |
def changedRelative(self, x): |
def changedRelative(self, x): |
80 |
self.super() |
self.super() |
81 |
self.main.changeSize(x) |
self.mainNode.changeSize(x) |
82 |
self.main.chgFast(self.oldVS, -1) |
self.mainNode.chgFast(self.oldVS, -1) |
83 |
self.context.states.fastChg = 1 |
self.context.states.fastChg = 1 |
84 |
|
|
85 |
class IfSelectNodeOnPlane(AbstractAction, vob.mouse.MouseClickListener): |
class IfSelectNodeOnPlane(AbstractAction, vob.mouse.MouseClickListener): |
86 |
def clicked(self, x, y): |
def clicked(self, x, y): |
87 |
self.super() |
self.super() |
88 |
obj = self.main.getNodeOnPlane(self.oldVS, x,y) |
obj = self.mainNode.getNodeOnPlane(self.oldVS, x,y) |
89 |
self.context.states.cursor.setAccursed(obj) |
self.context.states.cursor.setAccursed(obj) |
90 |
self.context.states.fastChg = 0 |
self.context.states.fastChg = 0 |
91 |
|
|
92 |
class MouseMenu(AbstractAction, vob.mouse.MouseClickListener): |
class MouseMenu(AbstractAction, vob.mouse.MouseClickListener): |
93 |
def clicked(self, x, y): |
def clicked(self, x, y): |
94 |
self.super() |
self.super() |
95 |
obj = self.main.getNodeOnPlane(self.oldVS, x,y) |
obj = self.mainNode.getNodeOnPlane(self.oldVS, x,y) |
96 |
if obj != None: |
if obj != None: |
97 |
self.context.states.objectOnPlane = obj |
self.context.states.objectOnPlane = obj |
98 |
self.context.mousemenu.link = 1 |
self.context.mousemenu.link = 1 |
107 |
vob.mouse.MousePressListener): |
vob.mouse.MousePressListener): |
108 |
def pressed(self, x,y): |
def pressed(self, x,y): |
109 |
self.super() |
self.super() |
110 |
self.set(self.main.getNodeOnPlane(self.oldVS, x,y)) |
self.set(self.mainNode.getNodeOnPlane(self.oldVS, x,y)) |
111 |
return self |
return self |
112 |
def set(self, node): |
def set(self, node): |
113 |
self.super() |
self.super() |
115 |
self.node, self.pp, self.graph = node, s.ppActions, s.fen.graph |
self.node, self.pp, self.graph = node, s.ppActions, s.fen.graph |
116 |
def changedRelative(self, x,y): |
def changedRelative(self, x,y): |
117 |
self.super() |
self.super() |
118 |
f = self.main.getFocus() |
f = self.mainNode.getFocus() |
119 |
fX, fY = f.getPanX(), f.getPanY() |
fX, fY = f.getPanX(), f.getPanY() |
120 |
f.setPan(fX+x/f.zoom, |
f.setPan(fX+x/f.zoom, |
121 |
fY+y/f.zoom) |
fY+y/f.zoom) |
123 |
ox = ff.util.RDFUtil.getFloat(g, self.node, CANVAS2D.x) |
ox = ff.util.RDFUtil.getFloat(g, self.node, CANVAS2D.x) |
124 |
oy = ff.util.RDFUtil.getFloat(g, self.node, CANVAS2D.y) |
oy = ff.util.RDFUtil.getFloat(g, self.node, CANVAS2D.y) |
125 |
self.pp.moveNote(self.node, ox+x/f.zoom, oy+y/f.zoom ) |
self.pp.moveNote(self.node, ox+x/f.zoom, oy+y/f.zoom ) |
126 |
self.main.chgFast(self.oldVS, -1) |
self.mainNode.chgFast(self.oldVS, -1) |
127 |
|
|
128 |
|
|
129 |
class LinkClick(AbstractAction, vob.mouse.MouseClickListener): |
class LinkClick(AbstractAction, vob.mouse.MouseClickListener): |
130 |
def clicked(self, x,y): |
def clicked(self, x,y): |
131 |
self.super() |
self.super() |
132 |
obj = self.main.getNodeOnPlane(self.oldVS, x,y) |
obj = self.mainNode.getNodeOnPlane(self.oldVS, x,y) |
133 |
pp = self.context.states.ppActions |
pp = self.context.states.ppActions |
134 |
pp.assocNotes(obj, 1, self.context.states.cursor.getAccursed()) |
pp.assocNotes(obj, 1, self.context.states.cursor.getAccursed()) |
135 |
self.context.states.fastChg = 0 |
self.context.states.fastChg = 0 |
144 |
return self |
return self |
145 |
def startDrag(self, x,y): |
def startDrag(self, x,y): |
146 |
self.super() |
self.super() |
147 |
self.oldxy = self.main.getXYHit(self.oldVS, y, y) |
self.oldxy = self.mainNode.getXYHit(self.oldVS, y, y) |
148 |
p('old', self.oldxy) |
p('old', self.oldxy) |
149 |
def drag(self, x, y): |
def drag(self, x, y): |
150 |
v = ff.util.lava.view.getView(self.main, ff.view.AreaSelectingView2D) |
v = ff.util.lava.view.getView(self.mainNode, ff.view.AreaSelectingView2D) |
151 |
v.setCurrentPlane(self.main.getPlane()) |
v.setCurrentPlane(self.mainNode.getPlane()) |
152 |
xy = self.main.getXYHit(self.oldVS, x,y) |
xy = self.mainNode.getXYHit(self.oldVS, x,y) |
153 |
v.setArea(self.oldxy[0], self.oldxy[1], xy[0], xy[1]) |
v.setArea(self.oldxy[0], self.oldxy[1], xy[0], xy[1]) |
154 |
self.main.chgFast(self.oldVS, -1) |
self.mainNode.chgFast(self.oldVS, -1) |
155 |
self.context.states.fastChg = 1 |
self.context.states.fastChg = 1 |
156 |
def endDrag(self, x,y): |
def endDrag(self, x,y): |
157 |
self.drag(x,y) |
self.drag(x,y) |
166 |
def pressed(self, x, y): |
def pressed(self, x, y): |
167 |
self.super() |
self.super() |
168 |
self.context.states.fastChg = 1 |
self.context.states.fastChg = 1 |
169 |
obj = self.main.getNodeOnPlane(self.oldVS, x,y) |
obj = self.mainNode.getNodeOnPlane(self.oldVS, x,y) |
170 |
|
|
171 |
if obj != None and obj == self.context.states.cursor.getAccursed(): |
if obj != None and obj == self.context.states.cursor.getAccursed(): |
172 |
p('accursed!') |
p('accursed!') |