/[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.13 by tjl, Thu Sep 19 01:20:04 2002 UTC revision 1.14 by tjl, Thu Sep 19 01:51:34 2002 UTC
# Line 145  def pdfpaper(pdfrect): Line 145  def pdfpaper(pdfrect):
145  def placepapers(vs, cs2, papers, key, x, y, paperx, papery, h, onlypages=None):  def placepapers(vs, cs2, papers, key, x, y, paperx, papery, h, onlypages=None):
146      # The height in coords      # The height in coords
147      ph = papers[0][2]      ph = papers[0][2]
148      expscale(vs, key+"__pscale_", h/ph)      scale = h/ph
149      curx = x - paperx      curx = x - paperx * scale
150      ycoord = y - papery      ycoord = y - papery * scale
151      print "x,y for place: ",curx, ycoord      print "x,y for place: ",curx, ycoord
152      for i in range(0, len(papers)):      for i in range(0, len(papers)):
153          # create always all cs, gets interpolation better          # create always all cs, gets interpolation better
154          cs1 = vs.coords.affineCoordsys(0, key+"_p_"+str(i), 10,          cs1 = vs.coords.affineCoordsys(0, key+"_p_"+str(i), 10,
155                  curx, ycoord, 1, 0, 0, 1)                  curx, ycoord, scale, 0, 0, scale)
156          if onlypages == None or i in onlypages:          if onlypages == None or i in onlypages:
157              pq = GZZGL.createFisheyePaperQuad(              pq = GZZGL.createFisheyePaperQuad(
158                  papers[i][0], 0, 0, papers[i][1], papers[i][2], 21, 21, 3)                  papers[i][0], 0, 0, papers[i][1], papers[i][2], 21, 21, 3)
159              vs.map.put(pq, cs1, cs2)              vs.map.put(pq, cs1, cs2)
160          curx += 1.02 *  papers[i][1]          curx += 1.02 *  papers[i][1] * scale
     poptrans(vs, key+"__pscale_")  
161    
162  def bg(vs):  def bg(vs):
163      putnoc(vs, background((0.3,0.5,0.4)))      putnoc(vs, background((0.3,0.5,0.4)))
# Line 232  class XuPDFScene_PDFContext: Line 231  class XuPDFScene_PDFContext:
231          print "Context"          print "Context"
232          # The non-moving bulge coordinate          # The non-moving bulge coordinate
233          cs2 = vs.coords.affineCoordsys(0, globalcursor.getId()+"__bulg",          cs2 = vs.coords.affineCoordsys(0, globalcursor.getId()+"__bulg",
234                      4,                      0.03,
235                      0,  0,                      0,  0,
236                      15, 0,0,30)                      5, 0,0, 9)
237    
238          class CentralB(Runnable):          class CentralB(Runnable):
239              def run(rself):              def run(rself):
# Line 251  class XuPDFScene_PDFContext: Line 250  class XuPDFScene_PDFContext:
250              addbuoy(vs, 0, 0, 1, bf, getattr(backlink,"from"))              addbuoy(vs, 0, 0, 1, bf, getattr(backlink,"from"))
251    
252  class XuPDFScene_PDFZoom:  class XuPDFScene_PDFZoom:
253        def __init__(self):
254            self.mag = [0.7, 10]
255      def key(self, key):      def key(self, key):
256          print "Key: ",key          print "Key: ",key
257          global currentScene          global currentScene
258          if key == 'z':          if key == 'z':
259              currentScene = XuPDFScene_PDFContext()              currentScene = XuPDFScene_PDFContext()
260          pass          if key == 'm':
261                rotatelist(self.mag)
262      def mouse(self, ev):      def mouse(self, ev):
263          global globalx, globaly          global globalx, globaly
264          if ev.getID() == ev.MOUSE_CLICKED:          if ev.getID() == ev.MOUSE_CLICKED:
# Line 268  class XuPDFScene_PDFZoom: Line 270  class XuPDFScene_PDFZoom:
270              AbstractUpdateManager.chg()              AbstractUpdateManager.chg()
271      def scene(self, vs):      def scene(self, vs):
272          bg(vs)          bg(vs)
273          cs2 = vs.coords.affineCoordsys(0, globalcursor.getId()+"__bulg", 0.5,          cs2 = vs.coords.affineCoordsys(0, globalcursor.getId()+"__bulg", self.mag[0],
274                  0, globaly / globalpap[0][2] * screensize[1] - screensize[1]/2,                  0, globaly / globalpap[0][2] * screensize[1] - screensize[1]/2,
275                      20, 0,0, 40)                      80 * self.mag[0], 0,0, 80 * self.mag[0])
276          bf = NadirCircleFloater_NoAnchor(vs,          bf = NadirCircleFloater_NoAnchor(vs,
277                  screenctr,  100, None, 1)                  screenctr,  100, None, 1)
278          class CentralB(Runnable):          class CentralB(Runnable):
279              def run(self):              def run(rself):
280                  placepapers(vs, cs2, globalpap, globalcursor.getId(), 0,                  placepapers(vs, cs2, globalpap, globalcursor.getId(), 0,
281                          globaly / globalpap[0][2] * screensize[1] -                          globaly / globalpap[0][2] * screensize[1] -
282                                                          screenctr[1],                                                          screenctr[1],
283                              globalx, globaly,                              globalx, globaly,
284                              screensize[1] * 0.7)                              screensize[1] * (self.mag[0]/(0.5+self.mag[0])))
285          bf.addCentralBuoy(globalcursor.getId(), CentralB())          bf.addCentralBuoy(globalcursor.getId(), CentralB())
286    
287  currentScene = XuPDFScene_PDFZoom()  currentScene = XuPDFScene_PDFZoom()

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

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