[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz ./Gzz.py gfx/librenderables/renderables.py ...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] gzz ./Gzz.py gfx/librenderables/renderables.py ... |
Date: |
Sat, 05 Oct 2002 09:59:48 -0400 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Benja Fallenstein <address@hidden> 02/10/05 09:59:48
Modified files:
. : Gzz.py
gfx/librenderables: renderables.py
gzz/client : GraphicsAPI.java
gzz/view : CellVobFactory.java RowColView.java
gzz/vob : SimpleConnection.java TextVob.java
Log message:
make awt run again, no clipping yet
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/Gzz.py.diff?tr1=1.40&tr2=1.41&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/librenderables/renderables.py.diff?tr1=1.96&tr2=1.97&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/client/GraphicsAPI.java.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/CellVobFactory.java.diff?tr1=1.19&tr2=1.20&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/view/RowColView.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/SimpleConnection.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gzz/vob/TextVob.java.diff?tr1=1.34&tr2=1.35&r1=text&r2=text
Patches:
Index: gzz/Gzz.py
diff -c gzz/Gzz.py:1.40 gzz/Gzz.py:1.41
*** gzz/Gzz.py:1.40 Thu Oct 3 04:37:19 2002
--- gzz/Gzz.py Sat Oct 5 09:59:47 2002
***************
*** 30,47 ****
transient = 0
def run(self):
- # if System.getProperty("gzzclient") == "gl":
- # import gzz.gfx.gl.debugswitches
- # gzz.gfx.gl.debugswitches.DebugSwitches(gldbg)
self.style = self.graphicsAPI.getTextStyle("SansSerif",
java.awt.Font.PLAIN, 10);
- xubuoy = gzz.view.xubuoy.XuPDF_ViewBinder()
self.views = [gzz.view.VobVanishingClient(),
! # gzz.view.RowColView(0), gzz.view.RowColView(1),
#don't work
! gzz.view.FullScreenView(), xubuoy]
self.viewSpecificBinders = java.util.HashMap()
- self.viewSpecificBinders.put(xubuoy, xubuoy)
self.cellView = gzz.view.CellVobFactory()
! self.cellContentView =
gzz.view.MultitypeCellContentView(gzz.view.TextCellContentView(self.style),
gzz.view.pagespanview.ContentView())
gzz.client.Fallback(self.space.getHomeCell(), self.linkSpace,
self.dimensions, self.views,
self.viewSpecificBinders, self.cellView,
--- 30,49 ----
transient = 0
def run(self):
self.style = self.graphicsAPI.getTextStyle("SansSerif",
java.awt.Font.PLAIN, 10);
self.views = [gzz.view.VobVanishingClient(),
! gzz.view.RowColView(0), gzz.view.RowColView(1),
! ]
self.viewSpecificBinders = java.util.HashMap()
self.cellView = gzz.view.CellVobFactory()
! self.cellContentView = gzz.view.TextCellContentView(self.style)
! if self.gl:
! xubuoy = gzz.view.xubuoy.XuPDF_ViewBinder()
! self.views.append(xubuoy)
! self.viewSpecificBinders.put(xubuoy, xubuoy)
! self.cellContentView = gzz.view.MultitypeCellContentView(
! self.cellContentView, gzz.view.pagespanview.ContentView())
!
gzz.client.Fallback(self.space.getHomeCell(), self.linkSpace,
self.dimensions, self.views,
self.viewSpecificBinders, self.cellView,
***************
*** 53,60 ****
for o,a in self.opts:
if o in ("-C", "--commander"):
gzz.control.commander.AwtCommander(globals())
- if o in gzz.util.dbg.all:
- gzz.util.dbg.option(o,a)
if o in ("-t", "--transient"):
self.transient = 1
--- 55,60 ----
***************
*** 141,160 ****
except TypeError, t:
print t
! def __init__(self, opts, args):
self.opts, self.args = opts, args
self.parse_params()
self.set_defaults()
def run():
opts, args = getopt.getopt(sys.argv[1:], "Ct"+gzz.util.dbg.short,
["--commander"]+gzz.util.dbg.long)
! g = Gzz(opts, args)
! if java.lang.System.getProperty("gzzclient") == "gl":
print "Running GL..."
g.graphicsAPI.startUpdateManager(g)
else:
print "Running AWT..."
g.graphicsAPI.startUpdateManager(None)
g.run()
--- 141,167 ----
except TypeError, t:
print t
! def __init__(self, opts, args, gl):
self.opts, self.args = opts, args
+ self.gl = gl
self.parse_params()
self.set_defaults()
def run():
opts, args = getopt.getopt(sys.argv[1:], "Ct"+gzz.util.dbg.short,
["--commander"]+gzz.util.dbg.long)
!
! for o,a in opts:
! if o in gzz.util.dbg.all:
! gzz.util.dbg.option(o,a)
!
! if gzz.client.GraphicsAPI.getTypeString() == "gl":
print "Running GL..."
+ g = Gzz(opts, args, 1)
g.graphicsAPI.startUpdateManager(g)
else:
print "Running AWT..."
+ g = Gzz(opts, args, 0)
g.graphicsAPI.startUpdateManager(None)
g.run()
Index: gzz/gfx/librenderables/renderables.py
diff -c gzz/gfx/librenderables/renderables.py:1.96
gzz/gfx/librenderables/renderables.py:1.97
*** gzz/gfx/librenderables/renderables.py:1.96 Fri Oct 4 02:54:11 2002
--- gzz/gfx/librenderables/renderables.py Sat Oct 5 09:59:47 2002
***************
*** 284,293 ****
--- 284,296 ----
ZPt p2 = coords2.transform(ZPt(0,0,0));
p1.z += dz1;
p2.z += dz2;
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_TEXTURE_2D);
glBegin(GL_LINE_STRIP);
glVertex3f(p1.x, p1.y, p1.z);
glVertex3f(p2.x, p2.y, p2.z);
glEnd();
+ glPopAttrib();
"""
},
Index: gzz/gzz/client/GraphicsAPI.java
diff -c gzz/gzz/client/GraphicsAPI.java:1.20
gzz/gzz/client/GraphicsAPI.java:1.21
*** gzz/gzz/client/GraphicsAPI.java:1.20 Thu Sep 26 07:54:07 2002
--- gzz/gzz/client/GraphicsAPI.java Sat Oct 5 09:59:47 2002
***************
*** 42,61 ****
/** The singleton instance.
*/
private static GraphicsAPI gfxapi;
static {
String cl = System.getProperty("gzzclient");
! if(cl == null || cl.equals("awt"))
gfxapi = new gzz.client.awt.AWTAPI();
! else if(cl.equals("gl"))
gfxapi = new gzz.client.gl.GLAPI();
! else
throw new Error("Invalid client type '"+cl+"': should be awt or
gl");
}
/** Get the singleton instance.
*/
static public GraphicsAPI getInstance() { return gfxapi; }
/** Start the update manager thread and run r from that thread.
* Used because e.g. OpenGL and GLX are easier to manage if everything
--- 42,68 ----
/** The singleton instance.
*/
private static GraphicsAPI gfxapi;
+ private static String type;
static {
String cl = System.getProperty("gzzclient");
! if(cl == null || cl.equals("awt")) {
gfxapi = new gzz.client.awt.AWTAPI();
! type = "awt";
! } else if(cl.equals("gl")) {
gfxapi = new gzz.client.gl.GLAPI();
! type = "gl";
! } else
throw new Error("Invalid client type '"+cl+"': should be awt or
gl");
}
/** Get the singleton instance.
*/
static public GraphicsAPI getInstance() { return gfxapi; }
+
+ /** Return the type string of the API ("gl" or "awt").
+ */
+ static public String getTypeString() { return type; }
/** Start the update manager thread and run r from that thread.
* Used because e.g. OpenGL and GLX are easier to manage if everything
Index: gzz/gzz/view/CellVobFactory.java
diff -c gzz/gzz/view/CellVobFactory.java:1.19
gzz/gzz/view/CellVobFactory.java:1.20
*** gzz/gzz/view/CellVobFactory.java:1.19 Thu Oct 3 14:50:37 2002
--- gzz/gzz/view/CellVobFactory.java Sat Oct 5 09:59:47 2002
***************
*** 46,52 ****
*/
public class CellVobFactory implements CellView {
! public static final String rcsid = "$Id: CellVobFactory.java,v 1.19
2002/10/03 18:50:37 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
--- 46,52 ----
*/
public class CellVobFactory implements CellView {
! public static final String rcsid = "$Id: CellVobFactory.java,v 1.20
2002/10/05 13:59:47 benja Exp $";
public static boolean dbg = false;
private static void p(String s) { if(dbg) pa(s); }
private static void pa(String s) { System.err.println(s); }
***************
*** 168,181 ****
bg.setBg(new Color(bg.getBg().getRGB() & (int)0xff00ffffL));
*/
- final int cs_box = v.coordsys(cs, BOX_KEY, 0, 0, 0, w, h);
- v.map.put(bg, cs_box);
-
final int content_cs = v.coordsys(cs, CONTENT_KEY, 0, 5, 5, 2, 2);
if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
! ccv.place(c, v, content_cs, w, h, context, scale);
} else {
gzz.gfx.gl.Stencil.drawStenciled(
v,
new Runnable() { public void run() {
--- 168,181 ----
bg.setBg(new Color(bg.getBg().getRGB() & (int)0xff00ffffL));
*/
final int content_cs = v.coordsys(cs, CONTENT_KEY, 0, 5, 5, 2, 2);
+ final int cs_box = v.coordsys(cs, BOX_KEY, 0, 0, 0, w, h);
if(!(GraphicsAPI.getInstance() instanceof gzz.client.gl.GLAPI)) {
! ccv.place(c, v, content_cs, w-10, h-10, context, scale);
! v.map.put(bg, cs_box);
} else {
+ v.map.put(bg, cs_box);
gzz.gfx.gl.Stencil.drawStenciled(
v,
new Runnable() { public void run() {
Index: gzz/gzz/view/RowColView.java
diff -c gzz/gzz/view/RowColView.java:1.4 gzz/gzz/view/RowColView.java:1.5
*** gzz/gzz/view/RowColView.java:1.4 Fri Sep 27 05:07:56 2002
--- gzz/gzz/view/RowColView.java Sat Oct 5 09:59:47 2002
***************
*** 35,41 ****
* the vob system will give up on interpolation and will jump.
*/
public class RowColView implements View.NamedView {
- CellVobFactory fact = new CellVobFactory();
float spacing = 0.4f;
boolean column;
--- 35,40 ----
***************
*** 47,54 ****
}
public void render(VobScene sc, int into, ViewContext context) {
Dimension size = sc.getSize();
! Dimension cellSize = fact.getDefaultSize();
int main, second;
if(column) { main = 0; second = 1; }
--- 46,55 ----
}
public void render(VobScene sc, int into, ViewContext context) {
+ CellView fact = context.getCellView();
Dimension size = sc.getSize();
! Dimension cellSize = new Dimension();
! fact.getDefaultSize(1, cellSize);
int main, second;
if(column) { main = 0; second = 1; }
***************
*** 84,105 ****
int k[] = new int[2];
for(k[main]=0; k[main] < n[main]; k[main]++)
for(k[second]=0; k[second] < n[second]; k[second]++) {
! cs[k[main]][k[second]] = sc.coords.coordsys(
! into, 0,
! xoffs + k[0]*xroom, yoffs + k[1]*yroom,
! cellSize.width, cellSize.height);
! sc.matcher.add(cs[k[main]][k[second]],
! grid[k[main]][k[second]]);
}
- fact.setSpace(center.space);
for(int i=0; i<n[main]; i++)
for(int j=0; j<n[second]; j++)
if(grid[i][j] != null)
! break; // XXX
! /*
! fact.addCellVobs(grid[i][j], into, sc, cs[i][j], null,
context, 1);
! */
Vob conn[] = new Vob[] {
new SimpleConnection(1, 0, -1, 0),
--- 85,101 ----
int k[] = new int[2];
for(k[main]=0; k[main] < n[main]; k[main]++)
for(k[second]=0; k[second] < n[second]; k[second]++) {
! cs[k[main]][k[second]] = sc.coordsys(
! into, grid[k[main]][k[second]], 0,
! xoffs + k[0]*xroom, yoffs + k[1]*yroom, 2, 2);
}
for(int i=0; i<n[main]; i++)
for(int j=0; j<n[second]; j++)
if(grid[i][j] != null)
! fact.place(grid[i][j], sc, cs[i][j],
! cellSize.width, cellSize.height,
! context, 1);
Vob conn[] = new Vob[] {
new SimpleConnection(1, 0, -1, 0),
Index: gzz/gzz/vob/SimpleConnection.java
diff -c gzz/gzz/vob/SimpleConnection.java:1.3
gzz/gzz/vob/SimpleConnection.java:1.4
*** gzz/gzz/vob/SimpleConnection.java:1.3 Mon Sep 23 04:24:26 2002
--- gzz/gzz/vob/SimpleConnection.java Sat Oct 5 09:59:47 2002
***************
*** 30,36 ****
*/
public class SimpleConnection extends Vob {
! public static final String rcsid = "$Id: SimpleConnection.java,v 1.3
2002/09/23 08:24:26 tjl Exp $";
float x0, y0, x1, y1;
Color color;
--- 30,36 ----
*/
public class SimpleConnection extends Vob {
! public static final String rcsid = "$Id: SimpleConnection.java,v 1.4
2002/10/05 13:59:47 benja Exp $";
float x0, y0, x1, y1;
Color color;
***************
*** 75,82 ****
public int addToListGL(GraphicsAPI.Window win,
int[] list, int curs, int coordsys1,
int coordsys2) {
! if(line == null)
line = GLRen.createLineConnector(1, 1);
curs = line.addToListGL(win, list, curs, coordsys1, coordsys2);
return curs;
}
--- 75,83 ----
public int addToListGL(GraphicsAPI.Window win,
int[] list, int curs, int coordsys1,
int coordsys2) {
! if(line == null) {
line = GLRen.createLineConnector(1, 1);
+ }
curs = line.addToListGL(win, list, curs, coordsys1, coordsys2);
return curs;
}
Index: gzz/gzz/vob/TextVob.java
diff -c gzz/gzz/vob/TextVob.java:1.34 gzz/gzz/vob/TextVob.java:1.35
*** gzz/gzz/vob/TextVob.java:1.34 Sun Sep 29 12:21:12 2002
--- gzz/gzz/vob/TextVob.java Sat Oct 5 09:59:47 2002
***************
*** 31,37 ****
* from these and use a LineBreaker.
*/
public class TextVob extends HBox.VobHBox {
! String rcsid = "$Id: TextVob.java,v 1.34 2002/09/29 16:21:12 benja Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
--- 31,37 ----
* from these and use a LineBreaker.
*/
public class TextVob extends HBox.VobHBox {
! String rcsid = "$Id: TextVob.java,v 1.35 2002/10/05 13:59:47 benja Exp $";
public static boolean dbg = false;
private static void pa(String s) { System.err.println(s); }
***************
*** 81,104 ****
g.setColor(info1.getMixedFgColor());
info1.getClipRect(rect);
Shape oldClip = g.getClip();
! g.clipRect(rect.x, rect.y,
rect.width,
! rect.height + 3);
!
! info1.getExtRect(rect);
float scale = this.scale;
if(scale < 0)
! scale = style.getScaleByHeight(rect.height-3);
! if(dbg) pa("Render @ scale " + scale + ": '"+text+"' "+rect);
float fasc = style.getAscent(scale);
float fdsc = style.getDescent(scale);
float fh = fasc + fdsc;
! float ty = rect.y + rect.height/2 + fasc/2;
! ((AWTTextStyle)style).render(g, rect.x, (int)ty, text, scale, info1);
g.setClip(oldClip);
}
--- 81,109 ----
g.setColor(info1.getMixedFgColor());
info1.getClipRect(rect);
+ info1.getExtRect(rect);
+ float x = rect.x, y = rect.y;
+ info2.getExtRect(rect);
+ float w = rect.width, h = rect.height;
+
Shape oldClip = g.getClip();
! /*g.clipRect(rect.x, rect.y,
rect.width,
! rect.height + 3);*/
float scale = this.scale;
if(scale < 0)
! scale = style.getScaleByHeight(h-3);
! if(dbg) pa("Render @ scale " + scale + ": '"+text+"' "+x+" "+y+"
"+w+" "+h);
float fasc = style.getAscent(scale);
float fdsc = style.getDescent(scale);
float fh = fasc + fdsc;
! float ty = y + h/2 + fasc/2;
!
! if(dbg) g.drawRect((int)x, (int)y, (int)w, (int)h);
! ((AWTTextStyle)style).render(g, (int)x, (int)ty, text, scale, null);
g.setClip(oldClip);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz ./Gzz.py gfx/librenderables/renderables.py ...,
Benja Fallenstein <=