/[gzz]/gzz/gzz/view/xubuoy.py
ViewVC logotype

Diff of /gzz/gzz/view/xubuoy.py

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

revision 1.22 by benja, Thu Oct 3 19:48:29 2002 UTC revision 1.23 by tjl, Fri Oct 4 06:54:11 2002 UTC
# Line 22  import gzz.util Line 22  import gzz.util
22  import gzz  import gzz
23  import traceback  import traceback
24    
25    # Slow animation for the demo.
26    AbstractUpdateManager.defaultAnimationTime = 3000
27    AbstractUpdateManager.fractCalc = AbstractUpdateManager.LinearCalculator()
28    
29  screensize = (1024, 768) # assuming XGA projector.  screensize = (1024, 768) # assuming XGA projector.
30    
31  # center = little above physical center  # center = little above physical center
# Line 239  class Mode: Line 243  class Mode:
243          self.__dict__ = args          self.__dict__ = args
244                    
245  def rotatelist(list):  def rotatelist(list):
246      x = list[-1]      list.append(list.pop(0))
     del list[-1]  
     list.insert(0, x)  
247            
248  def ispdf(cell):  def ispdf(cell):
249      # xxx      # xxx
# Line 277  class XuPDFScene_PDFContext: Line 279  class XuPDFScene_PDFContext:
279          self.ctrx = screensize[0]/2          self.ctrx = screensize[0]/2
280          self.ctry = screensize[1]/2          self.ctry = screensize[1]/2
281    
282          self.rad = screensize[0] /  2          self.rad = screensize[0] * 5/11  
283    
284          self.nadir = NadirAngler(self.ctrx, screensize[1]*2)          self.nadir = NadirAngler(self.ctrx, screensize[1]*2)
285          self.clip = 0          self.clip = 0
# Line 287  class XuPDFScene_PDFContext: Line 289  class XuPDFScene_PDFContext:
289                    
290      def key(self, key):      def key(self, key):
291          global currentScene          global currentScene
292          fallback = self.win.getFallback()          if self.win:
293          if fallback.mode != fallback.NORMAL: return 1              fallback = self.win.getFallback()
294                if fallback.mode != fallback.NORMAL: return 1
295                    
296          if key == 'M':          if key == 'M':
297              rotatelist(self.modes)              rotatelist(self.modes)
298                AbstractUpdateManager.chg()
299          elif key == 'm':          elif key == 'm':
300              if not self.corner1: return              if not self.corner1: return
301              print "Mark: %s; %s" % (self.corner1, self.corner2)              print "Mark: %s; %s" % (self.corner1, self.corner2)
# Line 318  class XuPDFScene_PDFContext: Line 322  class XuPDFScene_PDFContext:
322              AbstractUpdateManager.chg()              AbstractUpdateManager.chg()
323          elif key == 'c':          elif key == 'c':
324              self.clip = not self.clip              self.clip = not self.clip
325                AbstractUpdateManager.chg()
326          elif key == 'l':          elif key == 'l':
327              pagespanview.globalLOD = 1 - pagespanview.globalLOD              pagespanview.globalLOD = 1 - pagespanview.globalLOD
328              print "Lod: ",pagespanview.globalLOD              print "Lod: ",pagespanview.globalLOD
329                AbstractUpdateManager.setNoAnimation()
330              AbstractUpdateManager.chg()              AbstractUpdateManager.chg()
331          elif key == 'p':          elif key == 'p':
332              self.usefancypaper = not self.usefancypaper              self.usefancypaper = not self.usefancypaper
333                AbstractUpdateManager.setNoAnimation()
334                AbstractUpdateManager.chg()
335          elif key == ',':          elif key == ',':
336              pagespanview.globalseedoffs -= 1              pagespanview.globalseedoffs -= 1
337                AbstractUpdateManager.setNoAnimation()
338                AbstractUpdateManager.chg()
339              self.moveToCell(self.cursor)              self.moveToCell(self.cursor)
340          elif key == '.':          elif key == '.':
341              pagespanview.globalseedoffs += 1              pagespanview.globalseedoffs += 1
342                AbstractUpdateManager.setNoAnimation()
343                AbstractUpdateManager.chg()
344              self.moveToCell(self.cursor)              self.moveToCell(self.cursor)
345          elif key == 't':          elif key == 't':
346              self.showtessel = not self.showtessel              self.showtessel = not self.showtessel
347                AbstractUpdateManager.setNoAnimation()
348                AbstractUpdateManager.chg()
349          elif key == 's':          elif key == 's':
350              # select some rect at random              # select some rect at random
351              # for testing w/o mouse :-)              # for testing w/o mouse :-)
# Line 387  class XuPDFScene_PDFContext: Line 401  class XuPDFScene_PDFContext:
401                  h = b.hit(self.currentvs.coords, point)                  h = b.hit(self.currentvs.coords, point)
402                  if h:                  if h:
403                      print "BUOY HIT!\n"                      print "BUOY HIT!\n"
404                        global globalx, globaly
405                        globalx, globaly = h[0], h[1]
406                        if self.win:
407                            self.win.cursor = b.cell
408                      self.moveToCell(b.cell, h[0], h[1], redraw=1)                      self.moveToCell(b.cell, h[0], h[1], redraw=1)
409                      AbstractUpdateManager.chg()                      AbstractUpdateManager.chg()
410                      return                      return
411              h = self.view.hitClip(self.currentvs.coords, point, None)              h = self.view.hitClip(self.currentvs.coords, point, None)
412              if h:              if h:
413                    print "Move to ",globalx, globaly
414                  globalx,globaly = h                  globalx,globaly = h
415              else:              else:
416                  print "Didn't hit anything"                  print "Didn't hit anything"
# Line 437  class XuPDFScene_PDFContext: Line 456  class XuPDFScene_PDFContext:
456                  replaceNewScene(self.currentvs)                  replaceNewScene(self.currentvs)
457    
458    
459      def moveToCell(self, cell, nx=1, ny=1, redraw=1):      def moveToCell(self, cell, nx=None, ny=None, redraw=1):
460          global globalx, globaly          global globalx, globaly
461          global globalforw, globalback          global globalforw, globalback
462    
# Line 448  class XuPDFScene_PDFContext: Line 467  class XuPDFScene_PDFContext:
467              self.view = None              self.view = None
468    
469          self.cursor = cell          self.cursor = cell
470          globalx, globaly = nx, ny          if nx != None:
471                globalx, globaly = nx, ny
472    
473          content = cell.space.cellTexter.getEnfilade(cell, None)          content = cell.space.cellTexter.getEnfilade(cell, None)
474          self.span = enf2span(content)          self.span = enf2span(content)
# Line 568  class XuPDF_ViewBinder(gzz.view.View.Nam Line 588  class XuPDF_ViewBinder(gzz.view.View.Nam
588    
589      def windowClosed(self, win): pass      def windowClosed(self, win): pass
590      def mouse(self, ev, win):      def mouse(self, ev, win):
591            win.prioritize()
592          self._getview(win).mouse(ev)          self._getview(win).mouse(ev)
593      def keystroke(self, key, win):      def keystroke(self, key, win):
594            win.prioritize()
595          if self._getview(win).key(key):          if self._getview(win).key(key):
596              # event not handled              # event not handled
597              win.getFallback().binder.keystroke(key, win)              win.getFallback().binder.keystroke(key, win)

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

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