/[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.15 by tjl, Thu Oct 3 17:30:09 2002 UTC revision 1.16 by benja, Thu Oct 3 17:44:47 2002 UTC
# Line 27  screensize = (1024, 768) # assuming XGA Line 27  screensize = (1024, 768) # assuming XGA
27  # center = little above physical center  # center = little above physical center
28  screenctr = (0.9 * screensize[0]/2, screensize[1]/2)  screenctr = (0.9 * screensize[0]/2, screensize[1]/2)
29    
30    # width for linebreaking text
31    TEXT_WIDTH = 200
32    
33  def enf2span(enf):  def enf2span(enf):
34      list = enf.getList()      list = enf.getList()
35      return list[0]      return list[0]
# Line 114  class XuPDFBuoy: Line 117  class XuPDFBuoy:
117    
118          # Make a coordinate system at the anchor point.          # Make a coordinate system at the anchor point.
119          # this is the parent coordsys of the buoy          # this is the parent coordsys of the buoy
120          mainlinkspan = self.link[1-self.linkindex].getList()[0]          
121          # XXX if cell not everything...          mainlinkspan = self.link[1-self.linkindex].getList()[0]
122          mainpage = mainlinkspan.offset() - globalspan.offset()          if hasattr(mainlinkspan, 'subArea'):
123          mainp = mainlinkspan.getLocation()              mainlinkspan = self.link[1-self.linkindex].getList()[0]
124          mainoffsp = globalspan.getLocation()              # XXX if cell not everything...
125          maind = mainlinkspan.getSize()              mainpage = mainlinkspan.offset() - globalspan.offset()
126          mainpoint = globalview.paperpoint(mainpage,  mainp.x-mainoffsp.x+0.5*maind.width,              mainp = mainlinkspan.getLocation()
127                mainoffsp = globalspan.getLocation()
128                maind = mainlinkspan.getSize()
129                mainpoint = globalview.paperpoint(mainpage,  mainp.x-mainoffsp.x+0.5*maind.width,
130                                                      mainp.y-mainoffsp.y+0.5*maind.height)                                                      mainp.y-mainoffsp.y+0.5*maind.height)
131            else:
132          main_end_cs = vs.coords.coordsys(maincs, -20, mainpoint[0], mainpoint[1], 0, 0)              mainpoint = (.5, .5)
133                
134            main_end_cs = vs.coords.coordsys(maincs, -20, mainpoint[0], mainpoint[1], 0, 0)
135    
136          src = array([mainpoint[0], mainpoint[1], 0], 'f')          src = array([mainpoint[0], mainpoint[1], 0], 'f')
137          dst = zeros(3, 'f')          dst = zeros(3, 'f')
# Line 199  def rotatelist(list): Line 207  def rotatelist(list):
207      x = list[-1]      x = list[-1]
208      del list[-1]      del list[-1]
209      list.insert(0, x)      list.insert(0, x)
210        
211    def ispdf(cell):
212        # xxx
213        return cell.t().startswith("?")
214    
215  class XuPDFScene_PDFContext:  class XuPDFScene_PDFContext:
216      def __init__(self, linkspace, win=None):      def __init__(self, linkspace, win=None):
# Line 238  class XuPDFScene_PDFContext: Line 250  class XuPDFScene_PDFContext:
250          self.currentvs = None          self.currentvs = None
251          self.corner1 = None          self.corner1 = None
252                    
253            style = GraphicsAPI.getInstance().getTextStyle("SansSerif", java.awt.Font.PLAIN, 14);
254            self.broken = gzz.view.LinebrokenCellContentView(style)
255            
256      def key(self, key):      def key(self, key):
257          global currentScene          global currentScene
258          if key == 'M':          if key == 'M':
# Line 389  class XuPDFScene_PDFContext: Line 404  class XuPDFScene_PDFContext:
404          global globalforw, globalback          global globalforw, globalback
405    
406          # Check type          # Check type
407          if 1: # PDF          if ispdf(cell): # PDF
408              self.view = getCellPDFView(cell)              self.view = getCellPDFView(cell)
409            else:
410                self.view = None
411    
412          self.cursor = cell          self.cursor = cell
413          globalx, globaly = nx, ny          globalx, globaly = nx, ny
# Line 454  class XuPDFScene_PDFContext: Line 471  class XuPDFScene_PDFContext:
471              clip = (-0.2+globalx, -0.2+globaly, 0.2+globalx, 0.2+globaly)              clip = (-0.2+globalx, -0.2+globaly, 0.2+globalx, 0.2+globaly)
472              self.cliprect = clip              self.cliprect = clip
473          else:          else:
474              w = self.view.scaledsize[0]              if self.view:
475                    w = self.view.scaledsize[0]
476                else:
477                    w = TEXT_WIDTH
478              extrax = 0.1              extrax = 0.1
479              extray = 0.1              extray = 0.1
480              clip = (0-extrax, -extray, w+extrax, 1+extray)              clip = (0-extrax, -extray, w+extrax, 1+extray)
481              self.cliprect = None              self.cliprect = None
482    
483          self.view.placepapers(vs, cs1_trans, cliprect = clip,          if ispdf(self.cursor):
484                self.view.placepapers(vs, cs1_trans, cliprect = clip,
485                  fancy = self.usefancypaper, showTessel = self.showtessel)                  fancy = self.usefancypaper, showTessel = self.showtessel)
486            else:
487                cs1_unscaled = vs.coords.scaleXYZ(cs1_trans, 1/200.0, 1/200.0, 1)
488                vs.matcher.add(cs1_unscaled, self.cursor.getId()+"__unscaled")
489                self.broken.place(self.cursor, vs, cs1_unscaled, TEXT_WIDTH, 500,
490                                  self.win, 1.6);
491    
492          self.buoys = []          self.buoys = []
493                            

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

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