gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz ./Makefile ./TODO gfx/demo/xupdf.py gzz/vie...


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz ./Makefile ./TODO gfx/demo/xupdf.py gzz/vie...
Date: Wed, 02 Oct 2002 06:32:04 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/10/02 06:32:04

Modified files:
        .              : Makefile TODO 
        gfx/demo       : xupdf.py 
        gzz/view       : pagespanview.py 

Log message:
        Another one down

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Makefile.diff?tr1=1.175&tr2=1.176&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/TODO.diff?tr1=1.217&tr2=1.218&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/xupdf.py.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/pagespanview.py.diff?tr1=1.6&tr2=1.7&r1=text&r2=text

Patches:
Index: gzz/Makefile
diff -c gzz/Makefile:1.175 gzz/Makefile:1.176
*** gzz/Makefile:1.175  Tue Oct  1 06:14:47 2002
--- gzz/Makefile        Wed Oct  2 06:32:04 2002
***************
*** 348,361 ****
  batchtest-junit::
        $(JAVA) -Dzdir=$(Z_DIR) junit.textui.TestRunner $(TESTCLASS)
  
! 
  
  ifeq (,$(JYTHONPATH))
   
JYTHONPATH=$(GZZ_DEPENDS)/jythonlib.jar:$(GZZ_DEPENDS)/pythonlib.jar:$(GZZ_DEPENDS)/yaml.jar
  endif
  ifeq (,$(JYTHON))
  # python.verbose can be: "error", "warning", "message", "comment", "debug"
!  JYTHON=$(JAVA) -Xms128M -Xmx128M -Dpython.path=$(JYTHONPATH) 
-Dpython.verbose=message $(EDITOR_OPTION) org.python.util.jython
  endif
  
  runjython: 
--- 348,361 ----
  batchtest-junit::
        $(JAVA) -Dzdir=$(Z_DIR) junit.textui.TestRunner $(TESTCLASS)
  
! JVMFLAGS= -Xms64M -Xmx128M
  
  ifeq (,$(JYTHONPATH))
   
JYTHONPATH=$(GZZ_DEPENDS)/jythonlib.jar:$(GZZ_DEPENDS)/pythonlib.jar:$(GZZ_DEPENDS)/yaml.jar
  endif
  ifeq (,$(JYTHON))
  # python.verbose can be: "error", "warning", "message", "comment", "debug"
!  JYTHON=$(JAVA) $(JVMFLAGS) -Dpython.path=$(JYTHONPATH) 
-Dpython.verbose=message $(EDITOR_OPTION) org.python.util.jython
  endif
  
  runjython: 
***************
*** 424,430 ****
        $(JYTHON) gzz/modules/pp/ppserver.py
  PPSERVERHOST=127.0.0.1
  runppclient: 
!       $(GLLIB) $(JAVA) -Dgzzclient=gl -Xms128M -Xmx128M 
org.python.util.jython gzz/modules/pp/ppclient.py $(PPSERVERHOST)
  
  runpplocal: 
        $(GLLIB) $(JYTHON) gzz/modules/pp/localpp.py $(DBG) 
--- 424,430 ----
        $(JYTHON) gzz/modules/pp/ppserver.py
  PPSERVERHOST=127.0.0.1
  runppclient: 
!       $(GLLIB) $(JAVA) -Dgzzclient=gl $(JVMFLAGS) org.python.util.jython 
gzz/modules/pp/ppclient.py $(PPSERVERHOST)
  
  runpplocal: 
        $(GLLIB) $(JYTHON) gzz/modules/pp/localpp.py $(DBG) 
Index: gzz/TODO
diff -c gzz/TODO:1.217 gzz/TODO:1.218
*** gzz/TODO:1.217      Wed Oct  2 03:26:48 2002
--- gzz/TODO    Wed Oct  2 06:32:04 2002
***************
*** 70,76 ****
                - faster loading of pagespan images
                    - use lower resolution first, lazily load better
                        - deetsay's imagecache code?
-           - mouse clicks on buoys to work
            - text
            - multiple instances of same cell visible --> keys?
                - special matcher? or pp/VobKeyer?
--- 70,75 ----
***************
*** 198,203 ****
--- 197,203 ----
          for all demos as well.
        - unit tests for the designated demos. We REALLY need to
          avoid breakage on them from now on.
+           - MAKE SURE THAT THESE TESTS CATCH THE LOCALE BUG
        - sane exception if ../mstmpimg isn't found
        - clean up OpenGL demos and views and document, list
          so easy to look at.
Index: gzz/gfx/demo/xupdf.py
diff -c gzz/gfx/demo/xupdf.py:1.35 gzz/gfx/demo/xupdf.py:1.36
*** gzz/gfx/demo/xupdf.py:1.35  Wed Oct  2 03:07:37 2002
--- gzz/gfx/demo/xupdf.py       Wed Oct  2 06:32:04 2002
***************
*** 88,132 ****
  
  globalshowtessel = 0
  
- globalcurlinks = {}
- 
- 
- def takeLink(toenf, tocell):
-     """Move along a xu connection to given cell (with given enf).
- 
-     Calculates the location in the final cell to use.
-     XXX Assumes that cell contains whole scrollblock
-     """
-     s = enf2span(toenf)
-     page = s.offset()
-     p = s.getLocation()
-     d = s.getSize()
-     scale = 1 / 72.0 / 6
-     x = (p.x  + 0.5*d.width)
-     y = (p.y + 0.5*d.height)
-     (x,y) = globalview.paperpoint(page, x, y)
-     print "Takelink: to ",x,y
-     print ": ",page, p, d, scale, s
-     return (x,y)
- 
- 
  def moveToCell(cell, nx=1, ny=1):
!     global globalcursor, globalx, globaly, globalcurlinks, globalview
      global globalforw, globalback, globalspan
  
      # Check type
      if 1: # PDF
        globalview = getCellPDFView(cell)
  
- 
-     linktaken = globalcurlinks.get(cell.getId(), None)
-     if linktaken:
-       (nx, ny) = takeLink(linktaken, cell)
- 
      globalcursor = cell
      globalx, globaly = nx, ny
  
- 
      content = space.cellTexter.getEnfilade(cell, None)
      globalspan = enf2span(content)
      globalforw = xuindexer.getForwardIndex().getMatches(content)
--- 88,104 ----
  
  globalshowtessel = 0
  
  def moveToCell(cell, nx=1, ny=1):
!     global globalcursor, globalx, globaly, globalview
      global globalforw, globalback, globalspan
  
      # Check type
      if 1: # PDF
        globalview = getCellPDFView(cell)
  
      globalcursor = cell
      globalx, globaly = nx, ny
  
      content = space.cellTexter.getEnfilade(cell, None)
      globalspan = enf2span(content)
      globalforw = xuindexer.getForwardIndex().getMatches(content)
***************
*** 192,265 ****
  
  lineconn = GLRen.createLineConnector(0,0)
  
! def addbuoy(vs, anchorX, anchorY, importance, floater, linkindex, link, 
maincs = None):
!     print "Addbuoy ",link
!     linkspan = link[linkindex].getList()[0]
!     mat = enfoverlap.getMatches(link[linkindex])
!     l = []
!     for m in mat: l.append(m)
!     print l
!     if len(l) == 0: return
!     m = l[0]
!     print m
!     cell = m
!     global globalcurlinks
!     globalcurlinks[m.getId()] = link[linkindex]
!     view = getCellPDFView(m)
! 
!     p = linkspan.getLocation()
!     d = linkspan.getSize()
! 
!     p0 = view.paperpoint(linkspan.offset(), p.x, p.y)
!     p1 = view.paperpoint(linkspan.offset(), p.x+d.width, p.y+d.height)
! 
!     print "page, loc, size: ", linkspan.offset(), p, d
!     print "P0, P1: ",p0, p1
! 
!     cs1 = floater.addBuoy(anchorX, anchorY, importance, m.getId(), 0, 0)
!     eye = 0.2
!     buoyscale = 400
!     cs1_zoom= vs.coords.distort(cs1, 0, 0, eye, eye, buoyscale, buoyscale)
!     vs.matcher.add(cs1_zoom, cell.getId()+"__bulg") 
! 
!     cs1_trans = vs.coords.translateXY(cs1_zoom, - (p0[0]+p1[0])/2, - 
(p0[1]+p1[1])/2)
!     # cs1_trans = vs.coords.translateXY(cs1_zoom, 0, 0)
!     vs.matcher.add(cs1_trans, cell.getId()+"__trans") 
! 
!     view.placepapers(vs, cs1_trans, cliprect = (p0[0], p0[1], p1[0], p1[1]),
!           fancy = globalusefancypaper, showTessel = globalshowtessel)
! 
!     # Then, the xu link connector
!     if maincs != None:
!       mainlinkspan = link[1-linkindex].getList()[0]
!       # XXX if cell not everything...
!       mainpage = mainlinkspan.offset() - globalspan.offset()
!       mainp = mainlinkspan.getLocation()
!       mainoffsp = globalspan.getLocation()
!       maind = mainlinkspan.getSize()
!       mainpoint = globalview.paperpoint(mainpage,  
mainp.x-mainoffsp.x+0.5*maind.width,
!                                                   
mainp.y-mainoffsp.y+0.5*maind.height)
! 
!       main_end_cs = vs.coords.coordsys(maincs, -20, mainpoint[0], 
mainpoint[1], 0, 0)
! 
!       link_end_cs = vs.coords.coordsys(cs1_trans, -20, 0.5*(p0[0]+p1[0]), 
0.5*(p0[1]+p1[1]), 0, 0)
! 
!       vs.matcher.add(main_end_cs, "link"+str(link)+str(linkindex))
!       vs.matcher.add(link_end_cs, "link"+str(link)+str(1-linkindex))
! 
!       print "lineconn!"
!       putnoc(vs, getDListNocoords("""
!           PushAttrib ENABLE_BIT
!           Disable TEXTURE_2D
!           LineWidth 5
!           Enable BLEND
!           Color 0 0 0 0.6
!       """))
!       vs.map.put(lineconn, main_end_cs, link_end_cs)
!       putnoc(vs, getDListNocoords("""
!           PopAttrib
!       """))
  
  
  class XuPDFScene_PDFContext:
      def __init__(self):
--- 164,249 ----
  
  lineconn = GLRen.createLineConnector(0,0)
  
! class XuPDFBuoy:
!     def __init__(self, linkindex, link):
!       self.link = link
!       self.linkindex = linkindex
!       self.linkspan = link[linkindex].getList()[0]
!       self.mat = enfoverlap.getMatches(link[linkindex])
!       l = [m for m in self.mat]
!       if len(l) == 0: 
!           self.cell = None
!           return
!       m = l[0]
!       print m
!       self.cell = m
!       self.view = getCellPDFView(self.cell)
! 
!       p = self.linkspan.getLocation()
!       d = self.linkspan.getSize()
!       o = self.linkspan.offset()
!       # print "page, loc, size: ", linkspan.offset(), p, d
!       # print "P0, P1: ",p0, p1
! 
!       self.p0 = self.view.paperpoint(o, p.x, p.y)
!       self.p1 = self.view.paperpoint(o, p.x+d.width, p.y+d.height)
!       self.pctr = [0.5 * (self.p0[i] + self.p1[i]) for i in range(0,2)]
! 
!       self.eye = 0.2
!       self.buoyscale = 400
! 
!     def add(self, vs, anchorX, anchorY, importance, floater, 
!                       maincs = None):
!       if not self.cell:
!           return
!       cell = self.cell
! 
!       cs1 = floater.addBuoy(anchorX, anchorY, importance, self.cell.getId(), 
0, 0)
!       cs1_zoom= vs.coords.distort(cs1, 0, 0, self.eye, self.eye, 
self.buoyscale, self.buoyscale)
!       vs.matcher.add(cs1_zoom, cell.getId()+"__bulg") 
! 
!       cs1_trans = vs.coords.translateXY(cs1_zoom, -self.pctr[0], 
-self.pctr[1])
!       # cs1_trans = vs.coords.translateXY(cs1_zoom, 0, 0)
!       vs.matcher.add(cs1_trans, cell.getId()+"__trans") 
! 
!       self.cliprect = (self.p0[0], self.p0[1], self.p1[0], self.p1[1])
! 
!       self.view.placepapers(vs, cs1_trans, cliprect = self.cliprect,
!               fancy = globalusefancypaper, showTessel = globalshowtessel)
! 
!       # Then, the xu link connector
!       if maincs != None:
!           mainlinkspan = self.link[1-self.linkindex].getList()[0]
!           # XXX if cell not everything...
!           mainpage = mainlinkspan.offset() - globalspan.offset()
!           mainp = mainlinkspan.getLocation()
!           mainoffsp = globalspan.getLocation()
!           maind = mainlinkspan.getSize()
!           mainpoint = globalview.paperpoint(mainpage,  
mainp.x-mainoffsp.x+0.5*maind.width,
!                                                       
mainp.y-mainoffsp.y+0.5*maind.height)
! 
!           main_end_cs = vs.coords.coordsys(maincs, -20, mainpoint[0], 
mainpoint[1], 0, 0)
! 
!           link_end_cs = vs.coords.coordsys(cs1_trans, -20, self.pctr[0], 
self.pctr[1], 0, 0)
! 
!           vs.matcher.add(main_end_cs, 
"link"+str(self.link)+str(self.linkindex))
!           vs.matcher.add(link_end_cs, 
"link"+str(self.link)+str(1-self.linkindex))
! 
!           print "lineconn!"
!           putnoc(vs, getDListNocoords("""
!               PushAttrib ENABLE_BIT
!               Disable TEXTURE_2D
!               LineWidth 5
!               Enable BLEND
!               Color 0 0 0 0.6
!           """))
!           vs.map.put(lineconn, main_end_cs, link_end_cs)
!           putnoc(vs, getDListNocoords("""
!               PopAttrib
!           """))
  
+     def hit(self, coords, point3):
+       return self.view.hitClip(coords, point3, self.cliprect)
  
  class XuPDFScene_PDFContext:
      def __init__(self):
***************
*** 283,291 ****
      def mouse(self, ev):
        global globalx, globaly
        if ev.getID() == ev.MOUSE_CLICKED:
!           scale = 0.01
!           globalx += (ev.getX() - screensize[0]/2) * scale
!           globaly += (ev.getY() - screensize[1]/2)  * scale
            checkGlobalCoords()
            print "Mouse ",globalx, globaly
            AbstractUpdateManager.chg()
--- 267,288 ----
      def mouse(self, ev):
        global globalx, globaly
        if ev.getID() == ev.MOUSE_CLICKED:
! #         scale = 0.01
! #         globalx += (ev.getX() - screensize[0]/2) * scale
! #         globaly += (ev.getY() - screensize[1]/2)  * scale
!           point = array([ev.getX(), ev.getY(), 0], 'f')
!           for b in self.buoys:
!               h = b.hit(self.currentvs.coords, point)
!               if h:
!                   print "BUOY HIT!\n"
!                   moveToCell(b.cell, *h)
!                   AbstractUpdateManager.chg()
!                   return
!           h = globalview.hitClip(self.currentvs.coords, point, None)
!           if h:
!               globalx,globaly = h
!           else:
!               print "Didn't hit anything"
            checkGlobalCoords()
            print "Mouse ",globalx, globaly
            AbstractUpdateManager.chg()
***************
*** 308,329 ****
  
        if self.clip:
            clip = (-0.2+globalx, -0.2+globaly, 0.2+globalx, 0.2+globaly)
        else:
            w = globalview.papersize[0]
            extrax = 0.1
            extray = 0.1
            clip = (0-extrax, -extray, w+extrax, 1+extray)
  
        globalview.placepapers(vs, cs1_trans, cliprect = clip,
                fancy = globalusefancypaper, showTessel = globalshowtessel)
            
        if self.showcontext:
            for forwlink in globalforw:
!               addbuoy(vs, 0, 0, 1, bfforw, 1, (getattr(forwlink, "from"), 
forwlink.to), 
!                                               maincs = cs1_trans)
            for backlink in globalback:
!               addbuoy(vs, 0, 0, 1, bf, 0, (getattr(backlink,"from"), 
backlink.to),
!                                               maincs = cs1_trans)
  
  class XuPDFScene_PDFZoom:
      def __init__(self):
--- 305,333 ----
  
        if self.clip:
            clip = (-0.2+globalx, -0.2+globaly, 0.2+globalx, 0.2+globaly)
+           self.cliprect = cliprect
        else:
            w = globalview.papersize[0]
            extrax = 0.1
            extray = 0.1
            clip = (0-extrax, -extray, w+extrax, 1+extray)
+           self.cliprect = None
  
        globalview.placepapers(vs, cs1_trans, cliprect = clip,
                fancy = globalusefancypaper, showTessel = globalshowtessel)
+ 
+       self.buoys = []
            
        if self.showcontext:
            for forwlink in globalforw:
!               b = XuPDFBuoy(1, (getattr(forwlink, "from"), forwlink.to))
!               b.add(vs, 0, 0, 1, bfforw, maincs = cs1_trans)
!               self.buoys.append(b)
            for backlink in globalback:
!               b = XuPDFBuoy(0,(getattr(backlink,"from"), backlink.to))
!               b.add(vs, 0, 0, 1, bf, maincs = cs1_trans)
!               self.buoys.append(b)
!       self.currentvs = vs
  
  class XuPDFScene_PDFZoom:
      def __init__(self):
Index: gzz/gzz/view/pagespanview.py
diff -c gzz/gzz/view/pagespanview.py:1.6 gzz/gzz/view/pagespanview.py:1.7
*** gzz/gzz/view/pagespanview.py:1.6    Tue Oct  1 13:40:36 2002
--- gzz/gzz/view/pagespanview.py        Wed Oct  2 06:32:04 2002
***************
*** 5,10 ****
--- 5,11 ----
  from gfx.libutil import effects
  import gzz
  import java
+ from jarray import zeros
  
  papermill = gfx.libpaper.papermill.ThePaperMill()
  
***************
*** 136,141 ****
--- 137,144 ----
                    cliprect = None,
                    fancy = 1,
                    showTessel = 0):
+       self.papercoordsys = cs1into
+       self.cliprect = cliprect
        key = self.cell.getId()
        # The height in coords
        papers = self.pap
***************
*** 211,216 ****
--- 214,231 ----
        return (
            page * self.scaledsheetsize[0] + self.scale * pointx/72.0/6, 
self.scale * pointy/72.0/6
        )
+     def hitClip(self, coords, point3, cliprect):
+       src = zeros(3, 'f') # assume only one point
+       coords.inverseTransformPoints3(self.papercoordsys, point3, src)
+       x = src[0]
+       y = src[1]
+       print "hitclip: ",point3, src, x, y
+       if not cliprect:
+           cliprect = (0, 0, self.scaledsize, 1)
+       if cliprect[0] < x < cliprect[2] and cliprect[1] < y < cliprect[3]:
+           return (x,y)
+       return None
+       
  
  class KEY: pass
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]