[Bf-committers] UI layout engine

Alexander Ewering blender at instinctive.de
Wed Nov 28 04:55:16 CET 2007


On Wed, 28 Nov 2007, Matt Ebb wrote:

> On Nov 27, 2007 4:41 PM, Alexander Ewering <blender at instinctive.de> wrote:
> So, I'd say, this brings it to the point - now someone to implement it is
>> needed :)
>> As Matt seems to have some UI plans anyway (like always :), he seems like a
>> good candidate :)
>
> Ah well that's settled then! *cough* I mean, uhh... what? :P

Well. As people always seem afraid of delegating, and I have to delegate
MYSELF all the time (and believe me, that's NOT easy), I thought it was worth a try :)

> It worked something like this (from memory):
> sblock = uiSimpleBlockCreate()
> uiSimpleBlockSettings(sblock, COLUMNS, 2); // or whatever per-block settings
> uiSimpleBlockAdd(sblock, BUT, poin, tooltip, etc...)

[...]

> uiSimpleBlockRowBegin(sblock);
> uiSimpleBlockAdd(sblock, SLIDER, poin, tooltip, etc...)
> uiSimpleBlockRowEnd(sblock);

[...]

> uiSimpleBlockCreate(sblock, BUTTONS);

[...]

> clever_numbuts() does. One of the annoying things though was having to
> free the sblock pointer at the end, though I guess doing it similarly

OK, that's a start. For one, though, I don't understand why all this
blah = uiSimpleBlockCreate, and free(blah) stuff is going on. Is the buttons
code in any way threaded, or does it need to be thread-safe at all? If not,
why doesn't that get ditched altogether, and just use globals (EVIL! HELL!
666! I know! Who cares!) for storing the stuff? So, the UI coder wouldn't
need to know about these implementation details, and could just go ahead
doing (let's skip the "Simple")

uiBlockBegin(); 	/* Stores itself in G.uiblock */
  uiBlockSet(COLUMNS, 2);
  uiBlockAdd(BUT, poin ...);
  uiBlockRowBegin();
   uiBlockAdd(...);
  uiBlockRowEnd();
uiBlockEnd();	/* Creates the block from G.uiblock, frees G.uiblock */

Of course, I agree including external toolkits (which, by the way, are worse
in terms of usability in almost any respect) is a totally awkward idea.

Alexander Ewering


[ i n s t i n c t i v e . ]   http://www.instinctive.de

Zur Waldeshoehe 6                    Tel.: 02393-220558
59846 Sundern                         Fax: 02393-220559
Germany                xx-mail: xx-mail.com/instinctive


More information about the Bf-committers mailing list