/[gzz]/gzz/gzz/view/buoy/pagespanNodes.py
ViewVC logotype

Diff of /gzz/gzz/view/buoy/pagespanNodes.py

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

revision 1.23 by tjl, Tue Feb 11 07:42:26 2003 UTC revision 1.24 by tjl, Tue Feb 11 10:36:13 2003 UTC
# Line 1  Line 1 
1    from __future__ import nested_scopes
2    
3  """A pagespan scroll shown in a buoy view.  """A pagespan scroll shown in a buoy view.
4    
5  An interesting point: if this is from a transclusion, we  An interesting point: if this is from a transclusion, we
# Line 7  area. Line 9  area.
9  """  """
10    
11  import jarray  import jarray
12    import java
13    
14  # Page span scrollblock as a whole;  # Page span scrollblock as a whole;
15  # in buoys, a part is shown.  # in buoys, a part is shown.
16    
17  import gzz  import gzz
18    import gfx
19  from gzz.view.buoy import BuoyViewNodeType, BuoyViewMainNode  from gzz.view.buoy import BuoyViewNodeType, BuoyViewMainNode
20    from gfx.util.misc import coloredQuad
21    
22  pscv = gzz.view.PageSpanCellView()  pscv = gzz.view.PageSpanCellView()
23  pscv.useBg = 0  pscv.useBg = 0
# Line 49  class WholePageSpanNodeType(AbstractPage Line 54  class WholePageSpanNodeType(AbstractPage
54    
55  class AnchorPageSpanNodeType(AbstractPageSpanNodeType):  class AnchorPageSpanNodeType(AbstractPageSpanNodeType):
56      def renderBuoy(self, vs, into, linkId, anchorSpan, layout):      def renderBuoy(self, vs, into, linkId, anchorSpan, layout):
57            if 1:
58                dbg1 = vs.unitSqCS(into, "U")
59                vs.put(coloredQuad((1,0,0)), dbg1)
60    
61          if layout == None:          if layout == None:
62              layout = pscv.getLayout(anchorSpan.getScrollBlock())              layout = pscv.getLayout(anchorSpan.getScrollBlock())
63            vs.coords.getSqSize(into, size)
64            extents = layout.getExtents(anchorSpan, None)
65            print "ExtentsInit: ", [i for i in extents]
66            print "size: ", [s for s in size]
67            scalex = size[0] / extents[2]
68            scaley = size[1] / extents[3]
69            scale = min(scalex, scaley)
70    
71            # Shift it so we hit the given cs exactly
72            # extents[0] -= .5 * (scalex / scale - 1) * extents[2]
73            # extents[1] -= .5 * (scaley / scale - 1) * extents[3]
74            extents[2] *= scalex / scale
75            extents[3] *= scaley / scale
76    
77            print "Extents: ", [i for i in extents]
78    
79            paperCS = vs.orthoCS(into, "paper", 0, -extents[0] * scale,
80                                    -extents[1] * scale, scale, scale)
81    
82            irregu = gfx.libutil.effects.IrreguFrame(0, 0, layout.w, layout.h,
83                        .05, .25, type="square")
84    #       irregu = gfx.libutil.effects.IrreguFrame(-100, -100, 100*layout.w, 100*layout.h,
85    #                   .05, .25, type="square")
86            
87            paperLoc = vs.coords.ortho(0, 0, extents[0], extents[1], extents[2], extents[3])
88            vs.matcher.add(paperCS, paperLoc, "VIEWPORT")
89    
90            class FrameR(java.lang.Runnable):
91                def run(rself):
92                    vs.map.put(irregu.frame, paperCS, paperLoc)
93            class ContentR(java.lang.Runnable):
94                def run(rself):
95                    vs.map.put(irregu.content, paperCS, paperLoc)
96            class LayoutR(java.lang.Runnable):
97                def run(rself):
98                    layout.place(vs, paperCS, .5, 200, into)
99            
100            gzz.gfx.gl.Stencil.drawStenciled(vs, ContentR(), None, FrameR(), LayoutR(), 1)
101    
102    
103          # XXX!!!!          # XXX!!!!
104          # Irregu!          # Irregu!
105          # find edges of span          # find edges of span
106          # should place only that region surrounded by irregu          # should place only that region surrounded by irregu
         layout.place(vs, into, .5, 200, into)  
107          return into          return into
108    
109  size = jarray.zeros(3, 'f')  size = jarray.zeros(3, 'f')

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

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