[cells-devel] gui-geometry

Kenny Tilton kennytilton at optonline.net
Sat Jul 12 19:33:14 UTC 2008


Andy Chambers wrote:
> Hi Kenny,
> 
> Is the gui-geometry in cells what powers layout in cello? 

Yes, and all my GUIs other than the Celtk stuff where I played along and 
used the pack mechanism.

> Would it be
> worth somehow getting celtk to use this or should I just bite the
> bullet and jump to cello?

It depends on whether you want a widget set. With Cello one gets raw 
control, event, and rendering primitives one assembles as needed into 
interactive GUI elements. The True Lisp Way, all the power in the world.

With Celtk or Cells-Gtk you get a standard widget set but then are 
locked in to those.

If you are fine with a fixed widget set, I believe you can combine 
gui-geometry with the Tk "place" mechanism and have a more powerful 
scheme than the Tk "pack" mechanism. I would add geometer to some class 
at the top of the Celtk hierarchy work out how best to deal with Tk 
place capabilities. They look rough, so I think you would build a 
hierarchy of rows and stacks of Tk widgets where nothng correpsonded to 
the lisp rows/stacks (geo-inline) on the Tk side, then have teh 
observers on the six geo params translate to global values in the 
toplevel window (and always specify "-in ." when placing).

My only concern is whether you will then get "flashing" as things get 
repositioned dynamically, if you plan on doing that. Could turn out to 
be a lost cause.

> 
> If the former, when you have time, would you mind writing up a short
> guided tour of gui-geometry?  Even if it was just to explain what all
> the abbreviations like :lx, :ly etc meant.  Did you base it on some
> other framework and I could look up the docs for that?

I am pretty busy, so here goes (and i will start by saying my approach 
translates (haha, pun unintended) nicely to OpenGLs view of coordinates, 
but that doc wont help). No big deal, the idea could not be simpler:

I will describe an OpenGL-like geometry in which up is positive and 
negative is down, the opposite of most GUIs (so be careful!). I /do/ 
have some support in gui-geometry for the idea that the signs for up and 
down may vary -- look for macros like down and up that take care of 
using the right sign given some global parameter I forget.

Every geometer (widget) has its own coordinate system defined by a local 
bounding rectangle, left top right and bottom. The word "local" gives us 
the "l", the individual bounds give us another l for left then r, t, and 
b for an end result of ll, lt, lr, and lb. We allow ll and lb to be 
specified because sometimes it is useful to specify negative values. ie, 
the origin (0 0) would not be at the bottom left corner. As an aside, i 
have never tried making those positive such that the origin would lie 
outside the bounding box, but that should be OK.

In hierachies of geometers, their geometries nest. (px py) tell us where 
in our parent our origin falls.

That's it! The arithmetic gets confusing when one tries fancy things 
like "I want to /appear/ ten pixels below a nephew widget" because then 
you take their geometry and translate up to the nearest common ascendant 
and then back down, but it is straightforward in the end and I have 
scads of litte utilities in there doing that, one will usually work. But 
i rarely do that any more.


> 
> I was trying to port some of the demos in the tcl examples directory
> but I don't think the current celtk layout system is flexible enough
> to implement them exactly.

Do they use pack or place? I /thought/ I set up Celtk to handle any 
packing one might need... bottomline is that a design imperative of 
Celtk was to be able to use Tk geometry (and everything else) from Lisp, 
so if something won't port I Just Screwed Up(tm).

If they use place, I understand. Everything I found when I started was 
based on packing and i actually missed place at first.


> ps Openair is still coming along. 

Is it gone from c-l.net? I looked yesterday and did not see it. Someone 
mentioned they would like to do AJAX+Cells is why I looked. I keep 
hoping this happens, it could be big for Lisp if it turns out as well as 
it seemed it would.

> I got the xref stuff working on the
> lisp side but think I stumbled across a bug in jquery so nested
> widgets aren't being expanded properly. 

Glad to hear you got that far. Did you make a bug report?

  I'll come back to it again
> soon but I've got the GUI itch at the moment since I'm doing lots of
> xml stuff at work.
> 

OK, it's all good. You might consider Cello or Cells-Gtk where Peter H 
is doing amazing things including pulling in OpenGL and Cairo. But I 
like Cello. Well, brace yourself for OpenGL. :) Tho I do have a 
burgeoning DSL for making pretty things appear that hides OpenGL.

cheers, ken




More information about the cells-devel mailing list