Re: [AD] Changes in CVS and some comments about patches |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Michael Bukin <M.A.Bukin@xxxxxxxxxx> wrote:
>
> About stddlg-override: maybe standard dialog procedures should be
> changed, instead of adding new dprocs and changing standard dialogs?
> For example:
>
> int (*d_custom_button_proc) (...) = 0;
>
> /* Renamed from d_button_proc and made static. */
> static int d_standard_button_proc (...)
> {
> }
>
> /* New d_button_proc with custom proc hook. */
> int d_button_proc (...)
> {
> if (d_custom_button_proc)
> return (*d_custom_button_proc) (...);
> else
> return d_standard_button_proc (...);
> }
But then you can't chain back to the original function without doing
something dirty, e.g.
d_custom_button_proc = my_button_proc;
int my_button_proc (...)
{
if (msg == MSG_DRAW)
return draw_pretty_button ();
else {
int ret;
d_custom_button_proc = 0;
ret = d_button_proc (...);
d_custom_button_proc = my_button_proc;
return ret;
}
}
> Another option is to place all dialog procedures each to its own
> file and allow users to override them by linking their own version.
This suffers from the same problem as above, e.g.
int d_button_proc (...)
{
if (msg == MSG_DRAW)
return draw_pretty_button ();
else
return d_button_proc (...); /* bzzt! */
}
... right?
--
EXPRESSHOLES (eks PRES holz), n. People who try to sneak more than the
"eight items or less" into the express checkout line.
-- Rich Hall, "Sniglets"