[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] fenfire/org/fenfire/demo actions.py buoyoing.py...
From: |
Matti Katila |
Subject: |
[Gzz-commits] fenfire/org/fenfire/demo actions.py buoyoing.py... |
Date: |
Wed, 25 Jun 2003 22:29:02 -0400 |
CVSROOT: /cvsroot/fenfire
Module name: fenfire
Branch:
Changes by: Matti Katila <address@hidden> 03/06/25 22:29:02
Modified files:
org/fenfire/demo: actions.py buoyoing.py
Added files:
org/fenfire/demo: fenpdfcontext.py
Log message:
more events
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/demo/fenpdfcontext.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/demo/actions.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/demo/buoyoing.py.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
Patches:
Index: fenfire/org/fenfire/demo/actions.py
diff -u fenfire/org/fenfire/demo/actions.py:1.2
fenfire/org/fenfire/demo/actions.py:1.3
--- fenfire/org/fenfire/demo/actions.py:1.2 Wed Jun 25 20:29:25 2003
+++ fenfire/org/fenfire/demo/actions.py Wed Jun 25 22:29:01 2003
@@ -28,17 +28,25 @@
def p(*s):
print 'actions.py::', s
+class AbstractContextController(ff.util.ControlBinding.AbstractController):
+ def __init__(self, context):
+ self.context = context
+
+
######## Actions to control pan of main nodes etc.
-class MovePanFast(ff.util.ControlBinding.AbstractController):
+class MovePanFast(AbstractContextController):
def isChangeable(self): return 1
def change(self, x, y):
if dbg: p('move pan fast')
f = self.obj.getFocus()
+ if dbg: p('zoom:',f.zoom)
fX, fY = f.getPanX(), f.getPanY()
- f.setPan( fX-x/f.getZoom(), fY-y/f.getZoom())
+ f.setPan( fX-x/f.zoom, fY-y/f.zoom)
self.obj.chgFast(self.oldVS)
+ self.context.states.p()
+
class MovePanSlow(ff.util.ControlBinding.AbstractController):
def isChangeable(self): return 0
def controlPoint(self, x, y, scale):
@@ -58,11 +66,6 @@
self.obj.changeSize(x+y)
self.obj.chgFast(self.oldVS)
-class AbstractContextController(ff.util.ControlBinding.AbstractController):
- pass
- def __init__(self, context):
- self.context = context
-
class UnSelectNodeOnPlane(AbstractContextController):
def isChangeable(self): return 0
def controlPoint(self, x, y, scale):
@@ -107,6 +110,9 @@
if ev.getID() == ev.MOUSE_DRAGGED:
if dbg: p('drag')
return self.last.handleEvent(main, ev, vs)
+ elif ev.getID() == ev.MOUSE_PRESSED:
+ f = main.getFocus()
+ self.context.states.setPressPans(f.getPanX(),f.getPanY())
if dbg: p('event', ev)
obj = main.getNodeOnPlane(vs, ev.getX(), ev.getY())
Index: fenfire/org/fenfire/demo/buoyoing.py
diff -u fenfire/org/fenfire/demo/buoyoing.py:1.81
fenfire/org/fenfire/demo/buoyoing.py:1.82
--- fenfire/org/fenfire/demo/buoyoing.py:1.81 Wed Jun 25 20:29:25 2003
+++ fenfire/org/fenfire/demo/buoyoing.py Wed Jun 25 22:29:01 2003
@@ -48,6 +48,7 @@
from org.nongnu.alph.impl import PageImageScroll
from org.fenfire.demo.actions import *
+from org.fenfire.demo.fenpdfcontext import Context
import vob
@@ -109,11 +110,6 @@
-
-
-
-
-
textstyle = vob.GraphicsAPI.getInstance().getTextStyle("sans", 0, 24)
textnodeview = ff.view.TextNodeView(fen.txtfunc, textstyle, 1)
pagenodeview = ff.view.PageNodeView(fen.txtfunc)
@@ -134,8 +130,9 @@
node_ctrl = ff.util.ControlBinding()
ctrl = PlaneDispatcher(main_ctrl, node_ctrl, fen.graph, ppAct)
-global context
-context = ff.view.lava.FenPDFContext(fen, ppAct, nodeview, ctrl)
+#context = ff.view.lava.FenPDFContext(fen, ppAct, nodeview, ctrl)
+context = Context(w, fen, ppAct, nodeview, ctrl)
+
context.initMainNodes(2)
nodeview.setContext(context)
textnodeview.setContext(context)
@@ -151,8 +148,8 @@
# Default controls
ctrl.setContext(context)
-main_ctrl.add(MovePanFast(), -1, ctrl.WHEEL, 7,0, ctrl.VERTICAL)
-main_ctrl.add(MovePanFast(), 1, ctrl.DRAG, 1, 0, ctrl.ALL)
+main_ctrl.add(MovePanFast(context), -1, ctrl.WHEEL, 7,0, ctrl.VERTICAL)
+main_ctrl.add(MovePanFast(context), 1, ctrl.DRAG, 1, 0, ctrl.ALL)
main_ctrl.add(MovePanSlow(), 1, ctrl.CLICK)
main_ctrl.add(ZoomPan(), 3, ctrl.DRAG, 1, 0, ctrl.VERTICAL)
main_ctrl.add(PanSize(), 3, ctrl.DRAG, 1, 0, ctrl.HORIZONTAL)
@@ -203,6 +200,7 @@
self.width = 100
self.mgr = mgr
self.context = context
+ self.context.setMngr(mgr)
def _doset(self, vs):
w,h = vs.size.width, vs.size.height
@@ -232,7 +230,7 @@
#h1 = (1-self.split) * h
w0 = w*2/3
- h0 = w/2 - 20
+ h0 = w/2 - 40
w1 = w+100
h1 = h/5+100
@@ -336,6 +334,8 @@
return 1
def key(self, key):
+ self.context.key(key)
+
if key == "+":
self.split += .03
elif key == "-":
@@ -366,9 +366,6 @@
w.setCursor('default')
currentScene = Scene()
-
-
-
def screenshots():
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] fenfire/org/fenfire/demo actions.py buoyoing.py...,
Matti Katila <=