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

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

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

revision 1.13 by mudyc, Wed Jul 30 15:04:21 2003 UTC revision 1.14 by mudyc, Wed Aug 6 16:02:31 2003 UTC
# Line 14  def p(*s): Line 14  def p(*s):
14  global w  global w
15    
16    
 # mixin interface for superclass proxy creation  
 class SuperCaller:  
     def superproxy(self, superclass):  
         return SuperProxy(self, superclass)  
   
 # this class lets you reference your superclass's methods, wrapping them in  
 # SuperMethod objects  
 class SuperProxy:  
     def __init__(self, instance, superclass):  
         self.instance = instance  
         self.superclass = superclass  
     def __getattr__(self, attrname):  
         return SuperMethod(getattr(self.superclass, attrname), self.instance)  
   
 # This class is a Python-level mockup of a built-in instance method object: it  
 # points to an instance and a method, and when called, calls the method with  
 # the instance prepended to the argument list.  It would be nice if I could  
 # just use the built-in instance method type and change its im_self to point to  
 # a different Python object, but there doesn't appear to be any way to do that.  
 class SuperMethod:  
     def __init__(self, method, instance):  
         self.method = method  
         self.instance = instance  
     def __call__(self, *args, **argdict):  
         nargs = list(args)  
         nargs.insert(0, self.instance)  
         return apply(self.method, nargs, argdict)  
   
   
17  class KeyHandler:  class KeyHandler:
18      def __init__(self, states):      def __init__(self, states):
19          self.states = states          self.states = states
20          self.makerTypes = [          self.makerTypes = [
21              papermakers.white(w),              papermakers.white(),
22              papermakers.fancyBlend(w),              papermakers.fancyBlend(),
23              papermakers.fancyHalo(w),              papermakers.fancyHalo(),
24              papermakers.fancyBlur(w),              papermakers.fancyBlur(),
25              ]              ]
26      def key(self, stroke, main):      def key(self, stroke, main):
27          p('KEY', stroke,', v:',main)          p('KEY', stroke,', v:',main)
# Line 147  class ContextStates: Line 118  class ContextStates:
118          self.spanImageFactory = spanImageFactory          self.spanImageFactory = spanImageFactory
119          self.nodeview = nodeview          self.nodeview = nodeview
120          self.pageview = None          self.pageview = None
121          self.lastMain = None  
122            # buoymanager, set with setMgr()
123            self.mgr = None
124    
125          class Selection:          class Selection:
126              def __init__(self):              def __init__(self):
# Line 202  class MouseMenu: Line 175  class MouseMenu:
175    
176    
177  class Context(ff.view.lava.ContextNodeView.Context,  class Context(ff.view.lava.ContextNodeView.Context,
178                ff.view.buoy.AbstractMainNode2D.Render,                ff.view.buoy.AbstractMainNode2D.Context,
179                ff.view.lava.TextHandler.Context,                ff.view.lava.TextHandler.Context):
180                ff.view.lava.FenPDFContext,      def __init__(self, win, fen, pp, nv, spanImageFactory):
               SuperCaller):  
     def __init__(self, win, fen, pp, nv, ctrl, spanImageFactory):  
         self.super = self.superproxy(ff.view.lava.FenPDFContext)  
         ff.view.lava.FenPDFContext.__init__(self, fen, pp, nv, ctrl)  
181          global w          global w
182          w = win          w = win
183          self.states = ContextStates(fen, pp, spanImageFactory, nv)          self.states = ContextStates(fen, pp, spanImageFactory, nv)
# Line 217  class Context(ff.view.lava.ContextNodeVi Line 186  class Context(ff.view.lava.ContextNodeVi
186                    
187                    
188      def setMngr(self, mngr):      def setMngr(self, mngr):
189          self.mgr = mngr          self.states.mgr = mngr
190                    
191      def key(self, key):      def key(self, key):
192          self.keys.key(key, self.mgr.getLastMain())          self.keys.key(key, self.states.mgr.getLastMain())
193    
194        # call back from AbstractMainNode2D
195        def changeFastAfterMouseEvent(self):
196            return self.states.fastChg
197    
198      # call back from AbstractMainNode2D      # call back from AbstractMainNode2D
199      def mainNodeToBeRender(self, vs, into, main):      def mainNodeToBeRender(self, vs, into, main):
# Line 235  class Context(ff.view.lava.ContextNodeVi Line 208  class Context(ff.view.lava.ContextNodeVi
208          #self.super.mainNodeToBeRender(vs, into, main)          #self.super.mainNodeToBeRender(vs, into, main)
209    
210          # draw cursor          # draw cursor
211          if not self.states.cursor.hasAccursed() and main == self.states.lastMain:          if not self.states.cursor.hasAccursed() and main == self.states.mgr.getLastMain():
212              tmp = jarray.zeros(2, 'f')              tmp = jarray.zeros(2, 'f')
213              vs.coords.getSqSize(into, tmp)              vs.coords.getSqSize(into, tmp)
214              cursorCS = vs.orthoBoxCS(into, "CURSOR", 0,              cursorCS = vs.orthoBoxCS(into, "CURSOR", 0,
# Line 245  class Context(ff.view.lava.ContextNodeVi Line 218  class Context(ff.view.lava.ContextNodeVi
218                    
219    
220      def chgFast(self, oldVS):      def chgFast(self, oldVS):
221          s = self.mgr.getSingles()          s = self.states.mgr.getSingles()
222          for i in s:          for i in s:
223              i.getMainNode().chgFast(oldVS)              i.getMainNode().chgFast(oldVS)
224    
# Line 273  class Context(ff.view.lava.ContextNodeVi Line 246  class Context(ff.view.lava.ContextNodeVi
246          b.add("[New paper]",     "NEW_PAPER");          b.add("[New paper]",     "NEW_PAPER");
247          b.add("[Save]", "SAVE");          b.add("[Save]", "SAVE");
248          b.add("[Load]", "LOAD");          b.add("[Load]", "LOAD");
249    
250        def doMouse(self, ev, oldVS, mainNodes, contextNodeView):
251            pass
252    
253        

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