[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/gfx demo/gldemo.py demo/xupdf.py libutil/ef...
From: |
Tuomas J. Lukka |
Subject: |
[Gzz-commits] gzz/gfx demo/gldemo.py demo/xupdf.py libutil/ef... |
Date: |
Thu, 19 Sep 2002 03:15:21 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Tuomas J. Lukka <address@hidden> 02/09/19 03:15:21
Modified files:
gfx/demo : gldemo.py xupdf.py
gfx/libutil : effects.py
Log message:
The demo in the form we're going to show it this time
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/gldemo.py.diff?tr1=1.18&tr2=1.19&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/xupdf.py.diff?tr1=1.17&tr2=1.18&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libutil/effects.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gzz/gfx/demo/gldemo.py
diff -c gzz/gfx/demo/gldemo.py:1.18 gzz/gfx/demo/gldemo.py:1.19
*** gzz/gfx/demo/gldemo.py:1.18 Wed Sep 18 21:20:04 2002
--- gzz/gfx/demo/gldemo.py Thu Sep 19 03:15:20 2002
***************
*** 235,245 ****
return vs
- b,s = (Bindings(), Show())
class Main(Runnable):
def run(self):
! global w, b, s
w = gfxapi.createWindow()
w.setLocation(0,0,600,600)
loadScenes()
--- 235,245 ----
return vs
class Main(Runnable):
def run(self):
! b,s = (Bindings(), Show())
! global w
w = gfxapi.createWindow()
w.setLocation(0,0,600,600)
loadScenes()
Index: gzz/gfx/demo/xupdf.py
diff -c gzz/gfx/demo/xupdf.py:1.17 gzz/gfx/demo/xupdf.py:1.18
*** gzz/gfx/demo/xupdf.py:1.17 Wed Sep 18 23:24:31 2002
--- gzz/gfx/demo/xupdf.py Thu Sep 19 03:15:20 2002
***************
*** 21,35 ****
enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker()
! # A PDF file
! pagescroll1 = gzz.media.impl.PageImageScroll(None,
! gzz.mediaserver.Mediaserver.Id(
!
"0000000008000000E9573F43E00004CB42D4BEFEBAA27C20403F7D57693141B9E4D9A46329AC9C"))
!
! # A second one
! pagescroll2 = gzz.media.impl.PageImageScroll(None,
! gzz.mediaserver.Mediaserver.Id(
!
"0000000008000000E9573F40460004592C0AC2038D1250E0ED08F865D8C9148654B87A7AA82CC6"))
def enf2span(enf):
list = enf.getList()
--- 21,36 ----
enfMaker = gzz.media.impl.Enfilade1DImpl.Enfilade1DImplMaker()
! # PDF files
! pagescrolls = (
! gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(
!
"0000000008000000E9573F43E00004CB42D4BEFEBAA27C20403F7D57693141B9E4D9A46329AC9C")),
! gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(
!
"0000000008000000E9573F40460004592C0AC2038D1250E0ED08F865D8C9148654B87A7AA82CC6")),
! gzz.media.impl.PageImageScroll(None, gzz.mediaserver.Mediaserver.Id(
!
"0000000008000000E9573F38AE000410A88E08C0C3AB6E45E102B9921BBE71DC74E1A7492D70AE")),
! )
!
def enf2span(enf):
list = enf.getList()
***************
*** 40,60 ****
# Two cells, with one PDF span in each
home = space.getHomeCell()
- c1 = home.N(d1)
- c2 = c1.N(d1)
! pages1span = pagescroll1.getCurrent()
! pages2span = pagescroll2.getCurrent()
! pages1 = enfMaker.makeEnfilade(pages1span)
! pages2 = enfMaker.makeEnfilade(pages2span)
xuindexer.add(XuLink(
! enfMaker.makeEnfilade(pages1span.subSpan(1,2).subArea(100,100,300,100)),
! enfMaker.makeEnfilade(pages2span.subSpan(2,3).subArea(200,100,200,200))
))
! space.cellTexter.setEnfilade(c1, pages1)
! space.cellTexter.setEnfilade(c2, pages2)
globalcursor = None
--- 41,66 ----
# Two cells, with one PDF span in each
home = space.getHomeCell()
! pagespans = [s.getCurrent() for s in pagescrolls]
! pages = [enfMaker.makeEnfilade(sp) for sp in pagespans]
!
!
! xuindexer.add(XuLink(
! enfMaker.makeEnfilade(pagespans[0].subSpan(1,2).subArea(0,100,400,100)),
! enfMaker.makeEnfilade(pagespans[1].subSpan(2,3).subArea(20,500,350,200))
! ))
xuindexer.add(XuLink(
! enfMaker.makeEnfilade(pagespans[0].subSpan(2,3).subArea(0,100,400,100)),
! enfMaker.makeEnfilade(pagespans[2].subSpan(1,2).subArea(0,300,350,300))
))
! cells = []
! for p in pages:
! cell = home.N(d1)
! space.cellTexter.setEnfilade(cell, p)
! cells.append(cell)
globalcursor = None
***************
*** 65,81 ****
globalusefancypaper = 0
globalseedoffs = 8
! def moveToCell(cell):
! global globalcursor, globalx, globaly, globalpap
! global globalforw, globalback
! globalcursor = cell
! content = space.cellTexter.getEnfilade(cell, None)
# Check type
if 1: # PDF
globalpap = getPDFPapers(content)
globalforw = xuindexer.getForwardIndex().getMatches(content)
globalback = xuindexer.getBackwardIndex().getMatches(content)
--- 71,113 ----
globalusefancypaper = 0
globalseedoffs = 8
! 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) * scale + globalpap[0][1][1] * 1.02 * page
! y = (p.y + 0.5*d.height) * scale
! 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, globalpap, globalcurlinks
! global globalforw, globalback
+ content = space.cellTexter.getEnfilade(cell, None)
# Check type
if 1: # PDF
globalpap = getPDFPapers(content)
+
+ linktaken = globalcurlinks.get(cell.getId(), None)
+ if linktaken:
+ (nx, ny) = takeLink(linktaken, cell)
+
+ globalcursor = cell
+ globalx, globaly = nx, ny
+
+
globalforw = xuindexer.getForwardIndex().getMatches(content)
globalback = xuindexer.getBackwardIndex().getMatches(content)
***************
*** 109,118 ****
def globalkey(key):
global globalusefancypaper, globalseedoffs
! if key == '1':
! moveToCell(c1)
! elif key == '2':
! moveToCell(c2)
elif key == 'p':
globalusefancypaper = not globalusefancypaper
elif key == ',':
--- 141,148 ----
def globalkey(key):
global globalusefancypaper, globalseedoffs
! if '1' <= key <= '9':
! moveToCell(cells[int(key)-1])
elif key == 'p':
globalusefancypaper = not globalusefancypaper
elif key == ',':
***************
*** 179,185 ****
return (papw, pw, ph, papo)
! def placepapers(vs, cs2, papers, key, x, y, paperx, papery, h,
onlypages=None, depth=10):
# The height in coords
ph = papers[0][1][2]
scale = h/ph
--- 209,225 ----
return (papw, pw, ph, papo)
! def paperpoint(papers, h, page, pointx, pointy):
! ph = papers[0][1][2]
! scale = h / ph
! pscale = 1/72.0/6
! return (
! page * 1.02 * papers[0][1][1] * scale + pointx * pscale * scale,
! pointy * pscale * scale,
! )
!
! def placepapers(vs, cs2, papers, key, x, y, paperx, papery, h,
onlypages=None, depth=10,
! cliprect = None):
# The height in coords
ph = papers[0][1][2]
scale = h/ph
***************
*** 187,208 ****
ycoord = y - papery * scale
print "x,y for place: ",curx, ycoord
print papers
for i in range(0, len(papers)):
# create always all cs, gets interpolation better
! cs1 = vs.coords.affineCoordsys(0, key+"_p_"+str(i), 10,
curx, ycoord, scale, 0, 0, scale)
if onlypages == None or i in onlypages:
- grid = 11
if globalusefancypaper:
pq = GZZGL.createFisheyePaperQuad(
! papers[i][0], 0, 0, papers[i][1][1], papers[i][1][2], grid,
grid, 3)
vs.map.put(pq, cs1, cs2)
pq = GZZGL.createFisheyePaperQuad(
! papers[i][1][3], 0, 0, papers[i][1][1], papers[i][1][2],
grid, grid, 3)
vs.map.put(pq, cs1, cs2)
else:
pq = GZZGL.createFisheyePaperQuad(
! papers[i][1][0], 0, 0, papers[i][1][1], papers[i][1][2],
grid, grid, 3)
vs.map.put(pq, cs1, cs2)
curx += 1.02 * papers[i][1][1] * scale
--- 227,254 ----
ycoord = y - papery * scale
print "x,y for place: ",curx, ycoord
print papers
+ grid = 13
+ if cliprect == None:
+ fishargs = (0, 0, papers[0][1][1], papers[0][1][2], grid, grid, 3)
+ else:
+ pscale = 1 / 72.0 / 6
+ fishargs = (cliprect[0]*pscale, cliprect[1]*pscale,
+ cliprect[2]*pscale, cliprect[3]*pscale, grid, grid, 3)
for i in range(0, len(papers)):
# create always all cs, gets interpolation better
! cs1 = vs.coords.affineCoordsys(0, key+"_p_"+str(i), 100,
curx, ycoord, scale, 0, 0, scale)
if onlypages == None or i in onlypages:
if globalusefancypaper:
pq = GZZGL.createFisheyePaperQuad(
! papers[i][0], *fishargs)
vs.map.put(pq, cs1, cs2)
pq = GZZGL.createFisheyePaperQuad(
! papers[i][1][3], *fishargs)
vs.map.put(pq, cs1, cs2)
else:
pq = GZZGL.createFisheyePaperQuad(
! papers[i][1][0], *fishargs)
vs.map.put(pq, cs1, cs2)
curx += 1.02 * papers[i][1][1] * scale
***************
*** 230,241 ****
vs = self.vs
pap = getPDFPapers(space.cellTexter.getEnfilade(self.cell, None))
bs = 0.01
cs2 = vs.coords.affineCoordsys(0, self.cell.getId()+"__bulg",
0.05, 0, 0, bs, 0, 0, bs)
placepapers(vs, cs2, pap, self.cell.getId(),
0, 0,
! 0, 0,
! 100, onlypages=[0], depth=5)
def addbuoy(vs, anchorX, anchorY, importance, floater, link):
--- 276,295 ----
vs = self.vs
pap = getPDFPapers(space.cellTexter.getEnfilade(self.cell, None))
bs = 0.01
+ p = self.linkspan.getLocation()
+ d = self.linkspan.getSize()
+ height = 400
+ pt = paperpoint(pap, height, self.linkspan.offset(), p.x+0.5*d.width,
p.y+0.5*d.height)
+ print "PT: ",pt
+
cs2 = vs.coords.affineCoordsys(0, self.cell.getId()+"__bulg",
0.05, 0, 0, bs, 0, 0, bs)
+ cliprect = (p.x, p.y, p.x+d.width, p.y+d.height)
placepapers(vs, cs2, pap, self.cell.getId(),
+ -pt[0], -pt[1],
0, 0,
! height, onlypages=[self.linkspan.offset()], depth=5,
! cliprect = cliprect)
def addbuoy(vs, anchorX, anchorY, importance, floater, link):
***************
*** 248,262 ****
if len(l) == 0: return
m = l[0]
print m
floater.addBuoy(anchorX, anchorY, importance, m.getId(),
PDFFloat(vs, m, linkspan), 0, 0)
class XuPDFScene_PDFContext:
def __init__(self):
! self.yheight = 25
self.ctrx = screensize[0]/2
self.ctry = screensize[1]/2
! self.rad = screensize[0]/2
self.nadir = NadirAngler(self.ctrx, screensize[1]*2)
def key(self, key):
global currentScene
--- 302,318 ----
if len(l) == 0: return
m = l[0]
print m
+ global globalcurlinks
+ globalcurlinks[m.getId()] = link
floater.addBuoy(anchorX, anchorY, importance, m.getId(),
PDFFloat(vs, m, linkspan), 0, 0)
class XuPDFScene_PDFContext:
def __init__(self):
! self.yheight = 50
self.ctrx = screensize[0]/2
self.ctry = screensize[1]/2
! self.rad = screensize[1]/2
self.nadir = NadirAngler(self.ctrx, screensize[1]*2)
def key(self, key):
global currentScene
***************
*** 279,287 ****
print "Context"
# The non-moving bulge coordinate
cs2 = vs.coords.affineCoordsys(0, globalcursor.getId()+"__bulg",
! 0.03,
0, 0,
! 5, 0,0, 9)
class CentralB(Runnable):
def run(rself):
--- 335,343 ----
print "Context"
# The non-moving bulge coordinate
cs2 = vs.coords.affineCoordsys(0, globalcursor.getId()+"__bulg",
! 0.06,
0, 0,
! 7, 0,0, 9)
class CentralB(Runnable):
def run(rself):
***************
*** 334,338 ****
bf.addCentralBuoy(globalcursor.getId(), CentralB())
currentScene = XuPDFScene_PDFZoom()
! moveToCell(c1)
--- 390,394 ----
bf.addCentralBuoy(globalcursor.getId(), CentralB())
currentScene = XuPDFScene_PDFZoom()
! moveToCell(cells[0])
Index: gzz/gfx/libutil/effects.py
diff -c gzz/gfx/libutil/effects.py:1.2 gzz/gfx/libutil/effects.py:1.3
*** gzz/gfx/libutil/effects.py:1.2 Wed Sep 18 21:20:04 2002
--- gzz/gfx/libutil/effects.py Thu Sep 19 03:15:21 2002
***************
*** 61,72 ****
self.vs, self.c, self.r, self.nadir = vs, center, radius, nadir
self.dir = dir
self.ind = 0
def addBuoy(self, anchorX, anchorY, importance, key, buoy, w, h):
size = importance
# 1. find the buoy point
! angle = 2.6*math.pi/2 + self.ind / 5
angle *= self.dir
self.ind += 1
--- 61,73 ----
self.vs, self.c, self.r, self.nadir = vs, center, radius, nadir
self.dir = dir
self.ind = 0
+ self.angles = [0.2 * 2*math.pi, 0.4 * 2*math.pi]
def addBuoy(self, anchorX, anchorY, importance, key, buoy, w, h):
size = importance
# 1. find the buoy point
! angle = self.angles[self.ind]
angle *= self.dir
self.ind += 1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/gfx demo/gldemo.py demo/xupdf.py libutil/ef...,
Tuomas J. Lukka <=