gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] fenfire/org/fenfire bin/fenpdf10.py demo/fenpdf...


From: Matti Katila
Subject: [Gzz-commits] fenfire/org/fenfire bin/fenpdf10.py demo/fenpdf...
Date: Fri, 08 Aug 2003 07:45:58 -0400

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Branch:         
Changes by:     Matti Katila <address@hidden>   03/08/08 07:45:58

Modified files:
        org/fenfire/bin: fenpdf10.py 
        org/fenfire/demo: fenpdfcontext.py 
        org/fenfire/view/buoy: actions.py 

Log message:
        mouse menu added, some fixes

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/bin/fenpdf10.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/demo/fenpdfcontext.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/view/buoy/actions.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/bin/fenpdf10.py
diff -u fenfire/org/fenfire/bin/fenpdf10.py:1.4 
fenfire/org/fenfire/bin/fenpdf10.py:1.5
--- fenfire/org/fenfire/bin/fenpdf10.py:1.4     Thu Aug  7 11:33:53 2003
+++ fenfire/org/fenfire/bin/fenpdf10.py Fri Aug  8 07:45:58 2003
@@ -82,7 +82,8 @@
      AbstractAction, ZoomPan, ChangeSize, \
      CanvasNodePressListener, \
      NodeMover, PanMover, \
-     SelectArea, BrowseClick, IfSelectNodeOnPlane
+     SelectArea, BrowseClick, IfSelectNodeOnPlane, \
+     MouseMenu
      
 
 from org.fenfire.demo.fenpdfcontext import Context
@@ -201,6 +202,7 @@
     ppAct.assocNotes(noteC1, 1, noteB3)
     ppAct.assocNotes(noteA4, 1, noteC2)
     
+# search a note for accursing one.
 it = fen.graph.findN_11X_Iter(paperA, ff.vocab.CANVAS2D.contains)
 noteA1 = it.next()
 
@@ -240,23 +242,31 @@
 # Default controls
 ## see 
http://himalia.it.jyu.fi/ffdoc/fenfire/pegboard/fenpdf_v1_spec_1--tjl/peg.gen.html
 and 'Bindings'
 mainMouse = vob.mouse.MouseMultiplexer()
-mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \
-                      'Zooming the main view.', ZoomPan(context))
-mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \
-                      'Changing the size of main view (currently only for 
pagescroll).', # text
-                      ChangeSize(context))
+# With button 1
 mainMouse.setListener(1, 0,'Moving the pan around or the node if accursed.', \
                       CanvasNodePressListener(context, \
                       NodeMover(context), PanMover(context)))
-mainMouse.setWheelListener(0, 'Moving the pan', \
-                           PanMover(context))
 mainMouse.setListener(1, vob.VobMouseEvent.SHIFT_MASK,
                       'Selecting area of main view.',
                       SelectArea(context))
 mainMouse.setListener(1, 0, 'Browse to clicked point in the main view',
                       BrowseClick(context))
-mainMouse.setListener(3, 0, 'Select a node by click or unselect.',
+
+# With button 3
+mainMouse.setListener(3, 0, mainMouse.VERTICAL, 1.0, \
+                      'Zooming the main view.', ZoomPan(context))
+mainMouse.setListener(3, 0, mainMouse.HORIZONTAL, 1.0, \
+                      'Changing the size of main view (currently only for 
pagescroll).', # text
+                      ChangeSize(context))
+mainMouse.setListener(3, vob.VobMouseEvent.SHIFT_MASK,
+                      'Select a node by click or unselect.',
                       IfSelectNodeOnPlane(context))
+mainMouse.setListener(3, 0, 'Show context menu if available (should be).',
+                      MouseMenu(context))
+
+# With wheel
+mainMouse.setWheelListener(0, 'Moving the pan', \
+                           PanMover(context))
 
 
 plane = Nodes.get(paperA)
@@ -395,26 +405,29 @@
 
             # workaround..
             if self.lastEvent.getType() == ev.MOUSE_PRESSED:
-                p('workaround')
+                p('workaround for a bug')
                 return 1
 
-            # mainMouse XXX
-            #ctrl.removePressState()
+            # release event must go to mainMouse MouseMultiplexer to work 
correctly!
+            mainMouse.deliverEvent(ev)
+            
             self.context.states.clean()
             w.setCursor('default')
             # There is a bug in AbstractUpdateManager code(?) and that's why 
now is must to return.
             #return 1
             return 0
-       #return 0
         self.lastEvent = ev
 
         # ...then see context
         if ev.getType() != ev.MOUSE_CLICKED:
             return 0
+
         planes = []
         for single in self.mgr.singles:
             planes.append(single.getMainNode())
         newPlanes = self.context.doMouse(ev, oldvs, planes, self.nv)
+        if newPlanes == 1: return 1
+        
         if newPlanes != None and planes != newPlanes:
             p('going to change the singles with new ones')
             for i in range(0, len(newPlanes)):
Index: fenfire/org/fenfire/demo/fenpdfcontext.py
diff -u fenfire/org/fenfire/demo/fenpdfcontext.py:1.16 
fenfire/org/fenfire/demo/fenpdfcontext.py:1.17
--- fenfire/org/fenfire/demo/fenpdfcontext.py:1.16      Thu Aug  7 11:33:54 2003
+++ fenfire/org/fenfire/demo/fenpdfcontext.py   Fri Aug  8 07:45:58 2003
@@ -167,10 +167,15 @@
         self.list = vob.vobs.SelectListVob(style)
         self.list.add('Test', 'test')
         self.list.add('2. Test', 'test2')
+        self.list.add('3. Test', 'test3')
+        self.list.add('4. Test', 'test4')
+        self.list.add('Go to home', 'home')
+        self.list.add('Save & Quit', 'save_quit')
+        self.list.add('Quit without save', 'quit')
         self.hideList()
 
     def render(self, vs):
-        cs = vs.orthoBoxCS(0, "MENU",0, self.x, self.y-self.h/2,
+        cs = vs.orthoBoxCS(0, "MOUSE_MENU",0, self.x, self.y-self.h/2,
                            1,1, self.w, self.h)
         vs.put(self.list, cs)
 
@@ -182,6 +187,14 @@
         self.x, self.y = 0,0
         self.w, self.h = .0, .0
 
+    def mouse(self, ev, vs):
+        cs = vs.matcher.getCS(0, 'MOUSE_MENU')
+        key = vs.getKeyAt(cs, ev.getX(), ev.getY(), None)
+        if key != None:
+            key = key.object
+            p('mouse menu key is: ', key)
+            self.hideList()
+            return 1
 
 
 
@@ -259,6 +272,7 @@
        b.add("[Load]", "LOAD");
 
     def doMouse(self, ev, oldVS, mainNodes, contextNodeView):
+        if self.mousemenu.mouse(ev, oldVS): return 1
         pass
 
     
Index: fenfire/org/fenfire/view/buoy/actions.py
diff -u fenfire/org/fenfire/view/buoy/actions.py:1.4 
fenfire/org/fenfire/view/buoy/actions.py:1.5
--- fenfire/org/fenfire/view/buoy/actions.py:1.4        Thu Aug  7 07:10:07 2003
+++ fenfire/org/fenfire/view/buoy/actions.py    Fri Aug  8 07:45:58 2003
@@ -85,11 +85,11 @@
         self.context.states.cursor.setAccursed(obj)
         self.context.states.fastChg = 0
 
-# XXX
-class ShowMouseMenu(AbstractAction):
-    def isChangeable(self): return 0
-    def controlPoint(self, x, y, scale):
+class MouseMenu(AbstractAction, vob.mouse.MouseClickListener):
+    def clicked(self, x, y):
+        self.super()
         self.context.mousemenu.showList(x,y)
+        self.context.states.fastChg = 0
         vob.AbstractUpdateManager.setNoAnimation()
 
 ####### Actions to control nodes on main node plane




reply via email to

[Prev in Thread] Current Thread [Next in Thread]