/[fenfire]/fenfire/org/fenfire/demo/buoyoing.py
ViewVC logotype

Diff of /fenfire/org/fenfire/demo/buoyoing.py

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

revision 1.75 by benja, Thu Jun 19 15:24:00 2003 UTC revision 1.76 by mudyc, Sun Jun 22 16:17:18 2003 UTC
# Line 61  vob.buoy.buoymanager.w = vob.putil.demo. Line 61  vob.buoy.buoymanager.w = vob.putil.demo.
61    
62  DIR = 'myFenfire/'  DIR = 'myFenfire/'
63  os.system('mkdir -p '+DIR)  os.system('mkdir -p '+DIR)
 #pool = storm.impl.TransientPool(java.util.HashSet())  
64  pool = storm.impl.DirPool(java.io.File(DIR), java.util.HashSet())  pool = storm.impl.DirPool(java.io.File(DIR), java.util.HashSet())
65  myalph = alph.impl.StormAlph(pool)  myalph = alph.impl.StormAlph(pool)
66  sc = myalph.addFile(java.io.File('../alph/testdata/test1.pdf'), 'application/pdf')  sc = myalph.addFile(java.io.File('../alph/testdata/test1.pdf'), 'application/pdf')
# Line 326  class Scene(vob.buoy.buoymanager.MultiBu Line 325  class Scene(vob.buoy.buoymanager.MultiBu
325                  FenPDFActions(context, 2), context)                  FenPDFActions(context, 2), context)
326          w.setCursor('default')          w.setCursor('default')
327    
328    
329  class MovePanFast(ff.util.ControlBinding.AbstractController):  class MovePanFast(ff.util.ControlBinding.AbstractController):
330      def isChangeable(self): return 1      def isChangeable(self): return 1
331      def change(self, x, y):      def change(self, x, y):
# Line 338  class MovePanSlow(ff.util.ControlBinding Line 338  class MovePanSlow(ff.util.ControlBinding
338      def isChangeable(self): return 0      def isChangeable(self): return 0
339      def controlPoint(self, x, y, scale):      def controlPoint(self, x, y, scale):
340          self.obj.moveToPoint(int(x),int(y), self.oldVS)          self.obj.moveToPoint(int(x),int(y), self.oldVS)
341            
342    class ZoomPan(ff.util.ControlBinding.AbstractController):
343        def isChangeable(self): return 1
344        def change(self, x, y):
345            self.obj.changeZoom(x+y)
346            # because of PanSize() - do not call
347            #self.obj.chgFast(self.oldVS)
348    
349    class PanSize(ff.util.ControlBinding.AbstractController):
350        def isChangeable(self): return 1
351        def change(self, x, y):
352            self.obj.changeSize(x+y)
353            self.obj.chgFast(self.oldVS)
354    
355  class FenPDFActions:  class FenPDFActions:
356      def __init__(self, context, mainNodes):      def __init__(self, context, mainNodes):
357          self.context = context          self.context = context
         context = context  
358          self.context.initMainNodes(mainNodes)          self.context.initMainNodes(mainNodes)
359          self.lastIndex = 0          self.lastIndex = 0
360    
361          c = self.controlMains = ff.util.ControlBinding()          c = self.controlMains = ff.util.ControlBinding()
362          c.add(MovePanFast(), -1, c.WHEEL, 7,1)          c.add(MovePanFast(), -1, c.WHEEL, 7,0, c.VERTICAL)
363          c.add(MovePanFast(), 1, c.DRAG, 1.4, 1)          c.add(MovePanFast(), 1, c.DRAG, 1.4, 0, c.ALL)
364          c.add(MovePanSlow(), 1, c.CLICK, 1, 1)          c.add(MovePanSlow(), 1, c.CLICK)
365  #        c.dbg=1          c.add(ZoomPan(), 3, c.DRAG, 1, 0, c.VERTICAL)
366            c.add(PanSize(), 3, c.DRAG, 1, 0, c.HORIZONTAL)
367    
368            #c.dbg=1
369          self.controls = [ self.controlMains ]          self.controls = [ self.controlMains ]
370            
371      def key(self, mngr, key):      def key(self, mngr, key):
# Line 373  class FenPDFActions: Line 388  class FenPDFActions:
388              for ctrl in self.controls:              for ctrl in self.controls:
389                  ctrl.removePressState()                  ctrl.removePressState()
390              return              return
391          if ev.getID() == ev.MOUSE_PRESSED:          if ev.getID() == ev.MOUSE_DRAGGED:
392              self.oldEv = ev              for ctrl in self.controls:
393                    if ctrl.hasPressState():
394                        ctrl.handleEvent(None, ev, mngr.vs)
395                        mngr.replaceScene = mngr.vs
396                        vob.AbstractUpdateManager.setNoAnimation()
397                        vob.AbstractUpdateManager.chg()
398                        return
399                    
400          ### If there exist a buoy jump over there          ### If there exist a buoy jump over there
401          for single in mngr.singles:          for single in mngr.singles:
402              link = single.cs.get(cs, None)              link = single.cs.get(cs, None)
403              if link != None:              if link != None:
404                  # print "IN CS: ",cs, link                  # pa("IN CS: ",cs, link)
405                  if hasattr(mngr.geometer, 'buoyMouse') and \                  if hasattr(mngr.geometer, 'buoyMouse') and \
406                     mngr.geometer.buoyMouse(mngr, ev, single, link):                     mngr.geometer.buoyMouse(mngr, ev, single, link):
407                      return                      return
# Line 396  class FenPDFActions: Line 417  class FenPDFActions:
417              if mngr.singles[i].mainNode.isHitInsidePlane(x,y,mngr.vs):              if mngr.singles[i].mainNode.isHitInsidePlane(x,y,mngr.vs):
418                  self.context.setMainNodeIndex(i)                  self.context.setMainNodeIndex(i)
419                  self.lastIndex = i                  self.lastIndex = i
   
420                  if self.controlMains.handleEvent(mngr.singles[i].mainNode, ev, mngr.vs):                  if self.controlMains.handleEvent(mngr.singles[i].mainNode, ev, mngr.vs):
421                      mngr.replaceScene = mngr.vs                      mngr.replaceScene = mngr.vs
422                      vob.AbstractUpdateManager.setNoAnimation()                      vob.AbstractUpdateManager.setNoAnimation()
# Line 413  class FenPDFActions: Line 433  class FenPDFActions:
433          newPlanes = self.context.doMouse(ev, mngr.vs, planes)          newPlanes = self.context.doMouse(ev, mngr.vs, planes)
434          if newPlanes != None and planes != newPlanes:          if newPlanes != None and planes != newPlanes:
435              for i in range(0, len(newPlanes)):              for i in range(0, len(newPlanes)):
436                  mngr.singles[i] = SingleFocusManager(                  mngr.singles[i] = vob.buoy.buoymanager.SingleFocusManager(
437                      newPlanes[i],                      newPlanes[i],
438                      mngr.connectors)                      mngr.connectors)
439              vob.AbstractUpdateManager.chg()              vob.AbstractUpdateManager.chg()

Legend:
Removed from v.1.75  
changed lines
  Added in v.1.76

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