gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gzz/view xubuoy.py


From: Benja Fallenstein
Subject: [Gzz-commits] gzz/gzz/view xubuoy.py
Date: Thu, 14 Nov 2002 09:10:21 -0500

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Benja Fallenstein <address@hidden>      02/11/14 09:10:21

Modified files:
        gzz/view       : xubuoy.py 

Log message:
        Key binding to follow links in xupdf. Very nice.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/xubuoy.py.diff?tr1=1.30&tr2=1.31&r1=text&r2=text

Patches:
Index: gzz/gzz/view/xubuoy.py
diff -u gzz/gzz/view/xubuoy.py:1.30 gzz/gzz/view/xubuoy.py:1.31
--- gzz/gzz/view/xubuoy.py:1.30 Thu Nov 14 08:14:14 2002
+++ gzz/gzz/view/xubuoy.py      Thu Nov 14 09:10:20 2002
@@ -353,6 +353,38 @@
             if key == 'Up': globaly -= delta
             if key == 'Down': globaly += delta
             self.checkGlobalCoords()
+        elif key == ' ':
+            page, x, y = self.view.paperpoint_inv(globalx, globaly)
+            span = self.span.subArea(page, page+1, int(x), int(y), 1, 1)
+            
+            space = self.cursor.space
+            enf = space.getCellTexter().getEnfilade(self.cursor, None)
+            enf = enf.getMaker().makeEnfilade(span)
+
+            xuindexer = gzz.index.IndexManager.getXuIndexer(self.linkspace)
+            forw = [x for x in xuindexer.getForwardIndex().getMatches(enf)]
+            back = [x for x in xuindexer.getBackwardIndex().getMatches(enf)]
+
+            if len(forw) > 0: link = getattr(forw[0], 'to')
+            elif len(back) > 0: link = getattr(back[0], 'from')
+            else: link = None
+
+            if link:
+                enfoverlap = gzz.index.IndexManager.getEnfiladeOverlap(
+                    self.cursor.space)
+                overlaps = [x for x in enfoverlap.getMatches(link)]
+                if len(overlaps) > 0:
+                    cell = overlaps[0]
+                    span = link.getList()[0]
+                    page = span.offset()
+                    pt = span.getLocation()
+                    size = span.getSize()
+                    x,y = self.view.paperpoint(page,
+                                               pt.x + size.width/2.0,
+                                               pt.y + size.height/2.0)
+
+                    self.moveToCell(cell, x, y)
+                
        elif key == 'c':
            self.clip = not self.clip
            AbstractUpdateManager.chg()




reply via email to

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