fenfire-commits
[Top][All Lists]
Advanced

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

[ff-cvs] libvob/vob/buoy buoymanager.py


From: Tuomas J. Lukka
Subject: [ff-cvs] libvob/vob/buoy buoymanager.py
Date: Sat, 23 Aug 2003 06:49:21 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/08/23 06:49:21

Modified files:
        vob/buoy       : buoymanager.py 

Log message:
        Arch: patch-1
        tags
        patch-2
        Start refactoring mouse away from buoyManager.
        patch-3
        Refactor finding topmost node out.
        patch-4
        Include vs as parameter to make the routine usable post-refactorization 
of mouse out of buoymanager
        patch-5
        Refactor buoy finding code
        patch-6
        Rm crud
        patch-7
        Move the mouse code out.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/vob/buoy/buoymanager.py.diff?tr1=1.62&tr2=1.63&r1=text&r2=text

Patches:
Index: libvob/vob/buoy/buoymanager.py
diff -u libvob/vob/buoy/buoymanager.py:1.62 libvob/vob/buoy/buoymanager.py:1.63
--- libvob/vob/buoy/buoymanager.py:1.62 Wed Aug 20 12:36:22 2003
+++ libvob/vob/buoy/buoymanager.py      Sat Aug 23 06:49:20 2003
@@ -247,40 +247,11 @@
                self.singles[i].drawScene(vs, 
                        geoms[i][0])
 
-    def mouse(self, ev):
-        """ Returns true if buoymanager has eaten the event ;)"""
-        if not hasattr(self, 'vs'):
-            vob.AbstractUpdateManager.setNoAnimation()
-            vob.AbstractUpdateManager.chg()
-            return 1
-
-        # workaround for click bug
-       if self.eventHandler.mouse(ev, self.vs):
-           return 1
-
-        if ev.getType() == ev.MOUSE_DRAGGED:
-            if self.singles[self.lastIndex].mainNode.mouse(ev, self.vs):
-                self.replaceScene = self.vs
-                vob.AbstractUpdateManager.setNoAnimation()
-            vob.AbstractUpdateManager.chg()
-            return 1
-
-       x, y = ev.getX(), ev.getY()
-       cs = self.vs.getCSAt(0, x, y, None)
-       for single in self.singles:
-           link = single.cs.get(cs, None)
-           if link != None:
-                # pa("IN CS: ",cs, link)
-                self.buoyHit.set(single, link)
-                if self.eventHandler.buoyMouse(self, ev, single, link):
-                    return 1
-                
-               if ev.getType() != ev.MOUSE_CLICKED:
-                   return 0
-               single.followLink(link)
-               vob.AbstractUpdateManager.chg()
-               return 1
+    def findTopmostMainNode(self, vs, x, y):
+       """Get the topmost main node at x, y.
 
+       XXX Clean up the code, it's dreadful.
+       """
         hits = []
         for i in self.singles: hits.append(jarray.zeros(1, 'f'))
 
@@ -288,7 +259,7 @@
         # See if anyone hit.
        for i in range(0, len(self.singles)):
             if not self.singles[i].mainNode. \
-                   hasMouseHit(self.vs, ev.getX(), ev.getY(), hits[i]):
+                   hasMouseHit(vs, x, y, hits[i]):
                 hits[i] = None
 
 
@@ -301,14 +272,16 @@
                     self.lastIndex = i
                     mostUpDepth = hits[i][0]
                     theMostUpMainNode = self.singles[i].mainNode
+       return theMostUpMainNode
         
-        # If the most upper main node is available use it.
-        if theMostUpMainNode:
-            if theMostUpMainNode.mouse(ev, self.vs):
-                self.replaceScene = self.vs
-                vob.AbstractUpdateManager.setNoAnimation()
-            vob.AbstractUpdateManager.chg()
-            return 1
-        return 0
+    def findIfBuoyHit(self, vs, x, y):
+       """If a buoy was hit by the coordinates, return the 
+       tuple (index, (otherNode, linkId, otherAnchor, buoyCoordsys)).
+       """
+       cs = vs.getCSAt(0, x, y, None)
+       for single in range(0, len(self.singles)):
+           link = self.singles[single].cs.get(cs, None)
+           if link != None:
+               return (single, link)
 
 vob.impl.gl.GLScreen.dbg = 0




reply via email to

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