/[gzz]/gzz/gfx/demo/xupdf.py
ViewVC logotype

Diff of /gzz/gfx/demo/xupdf.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.20 by tjl, Mon Sep 23 08:37:04 2002 UTC revision 1.21 by tjl, Tue Sep 24 07:26:48 2002 UTC
# Line 4  from gzz.index import XuLink Line 4  from gzz.index import XuLink
4  # with Xanadu links between PDF and text.  # with Xanadu links between PDF and text.
5    
6  screensize = (1024, 768) # assuming XGA projector.  screensize = (1024, 768) # assuming XGA projector.
7    
8    # center = little above physical center
9  screenctr = (0.9 * screensize[0]/2, screensize[1]/2)  screenctr = (0.9 * screensize[0]/2, screensize[1]/2)
10    
11    # Slow animation for the demo.
12  AbstractUpdateManager.defaultAnimationTime = 3000  AbstractUpdateManager.defaultAnimationTime = 3000
13  AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()  AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()
14    
 from gzz.gfx.gl import GL,GLRen,GLSpans,Paper  
 import gzz  
15  from test.tools import tools  from test.tools import tools
16  execfile("gfx/libutil/effects.py")  execfile("gfx/libutil/effects.py")
17  execfile("gfx/libpaper/papermill.py")  execfile("gfx/libpaper/papermill.py")
# Line 73  globalseedoffs = 8 Line 74  globalseedoffs = 8
74    
75  globalcurlinks = {}  globalcurlinks = {}
76    
77    globalLOD = 1
78    
79  def takeLink(toenf, tocell):  def takeLink(toenf, tocell):
80      """Move along a xu connection to given cell (with given enf).      """Move along a xu connection to given cell (with given enf).
81    
# Line 131  def getPDFPapers(content): Line 134  def getPDFPapers(content):
134      scrollblockPaper = getScrollblockPaper(contentspan.getScrollBlock())      scrollblockPaper = getScrollblockPaper(contentspan.getScrollBlock())
135      ret = []      ret = []
136      for i in range(0, content.length()):      for i in range(0, content.length()):
137          rect = GLSpans.getRect(contentspan.subSpan(i,i+1))          rect = GLSpans.getRect(contentspan.subSpan(i,i+1), globalLOD)
138            print "Rect: ",globalLOD, rect
139          ret.append(          ret.append(
140              (scrollblockPaper, pdfpaper(rect))              (scrollblockPaper, pdfpaper(rect))
141          )          )
# Line 140  def getPDFPapers(content): Line 144  def getPDFPapers(content):
144            
145    
146  def globalkey(key):  def globalkey(key):
147      global globalusefancypaper, globalseedoffs      global globalusefancypaper, globalseedoffs, globalLOD
148      if '1' <= key <= '9':      if '1' <= key <= '9':
149          moveToCell(cells[int(key)-1])          moveToCell(cells[int(key)-1])
150        elif key == 'l':
151            globalLOD = 1 - globalLOD
152            print "Lod: ",globalLOD
153            AbstractUpdateManager.chg()
154      elif key == 'p':      elif key == 'p':
155          globalusefancypaper = not globalusefancypaper          globalusefancypaper = not globalusefancypaper
156      elif key == ',':      elif key == ',':
# Line 225  def placepapers(vs, cs2, papers, key, x, Line 233  def placepapers(vs, cs2, papers, key, x,
233      scale = h/ph      scale = h/ph
234      curx = x - paperx * scale      curx = x - paperx * scale
235      ycoord = y - papery * scale      ycoord = y - papery * scale
236      print "x,y for place: ",curx, ycoord      # print "x,y for place: ",curx, ycoord
237      print papers      # print papers
238      grid = 13      grid = 13
239      if cliprect == None:      if cliprect == None:
240          fishargs = (0, 0, papers[0][1][1], papers[0][1][2], grid, grid, 1)          fishargs = (0, 0, papers[0][1][1], papers[0][1][2], grid, grid, 1)
# Line 280  class PDFFloat(Runnable): Line 288  class PDFFloat(Runnable):
288          d = self.linkspan.getSize()          d = self.linkspan.getSize()
289          height = 400          height = 400
290          pt = paperpoint(pap, height, self.linkspan.offset(), p.x+0.5*d.width, p.y+0.5*d.height)          pt = paperpoint(pap, height, self.linkspan.offset(), p.x+0.5*d.width, p.y+0.5*d.height)
291          print "PT: ",pt          # print "PT: ",pt
292                    
293          cs2 = vs.coords.affineCoordsys(0, self.cell.getId()+"__bulg",          cs2 = vs.coords.affineCoordsys(0, self.cell.getId()+"__bulg",
294              0.05, 0, 0, bs, 0, 0, bs)              0.05, 0, 0, bs, 0, 0, bs)

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26