Re: [AD] GUI - d_ctext_proc, file_select_ex, gui_textout_ex |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On Sun, 2003-06-15 at 15:06, Esaelon@xxxxxxxxxx wrote:
> > Does this fix the problem?
> Nope. See, the text is centered on the x. The scare_mouse_area() code
> scares the mouse out of the x to (x+w-1) and y to (y+h-1), yet the d_ctext_proc
> (optimally?) would use (x-w/2) to (x+w/2+1). Hence, with the scare_mouse_area()
> kludge code, d_ctext_proc (and the similar proc used by the file selectors)
> are fundamentally broken with regards to their own redraw.
Not in my version, there it centers around the center:
guiproc.c, line 262:
gui_textout_ex(screen, d->dp, d->x + d->w/2, d->y, fg, d->bg, TRUE);
So, if your box is from (0,0) to (100,10), then the text is centered
around (50,0). You just have to make sure w is big enough, like with any
other GUI element.
> > That's per design of the Allegro GUI. The docs tell that, to change the
> > font, you have to point the global 'font' pointer to your new font.
> > gui_textout_ex() is a GUI function, so it behaves the same.
> Not a very nice design, unfortunately, as getting the d_text_proc optimal
> size requires the same kludge that d_text_proc uses to draw non-default fonts,
> which is just that, a kludge.
True. I don't think it's worth adding yet another textout function
though. But maybe a general way to retrieve the dimensions of any GUI
element could be made, and this could then be used in your case.
Something like: get_minimum_dimensions (DIALOG *d, int *w, int *h). And
if you pass a DIALOG with proc == d_text_proc, it would return the
desired w and h. For other dialogs, like d_bitmap_proc, it would pass
the bitmap dimensions. For most dialogs, there would be a border added.
Not sure what custom dialogs should return though. Maybe implement it
with 2 new message D_GET_MIN_W and D_GET_MIN_H? I'm just thinking aloud
though, not sure it would be that useful..
> > > I believe there was another issue, but I can't recall it at the moment.
> > There's lots. Recently, someone reported that menus still block when you
> > hold the mouse button after exiting them - this should be fixed as
> > well..
> Yeah, that was me, also..
>
Heh, yes, I noticed when I was searching for the post.. seems Eric
already has a fix for it.
--
Elias Pschernig <elias@xxxxxxxxxx>