[GRASS5] g51 v.digit
Glynn Clements
glynn.clements at virgin.net
Wed Oct 9 14:04:12 EDT 2002
Radim Blazek wrote:
> I started update of v.digit. Currently almost nothing -
> only one tool "new line" exists. But because I modified rasterlib
> for this purpose, I would welcome if others, who know more about
> xdriver, could look at it and comment or improve.
>
> As I wanted to enable GUI to break running tools and change parameters
> when tool is running, I added function R_set_update_function ()
> which sets pointer to function which is regularly called by
> running R_get_location_with_pointer/line(). Such function
> can break running R_get_location_with* by calling R_set_cancel(1)
>
> Tools in v.digit are started by loop in C part and GUI only sets
> variable to the next tool it wants to start.
>
> Driver is opened/closed for each tool. That enables to resize xdriver
> and run other modules while v.digit is runnig but introduces new problems.
> I don't know how to get information if xdriver was resized etc.
>
> http://mpa.itc.it/radim/g51/v.digit1.png
>
> Sorry Glynn, I must commit first, otherwise you would tell me, that it
> is just hack, and I should wait for a new display architecture. But I cannot
> wait 5-10 years :-)
It *is* just a hack. But you don't need to wait 5-10 years. Removing
the R_get_location_with* stuff altogether shouldn't take more than
5-10 minutes.
And removing it *is* the right solution for the monitor API. For
v.digit, the right solution is to use a real UI toolkit. Trying to
build something like v.digit on top of R_get_location_with* is a
mistake.
Of all of the possibilities which I've considered for a future display
architecture, none of them deal with input in any way; it's meant to
be a *display* architecture.
In short, modal input sucks. Big time. Every real-world UI toolkit
which I've ever seen uses a single main loop which reads events and
dispatches them to application-registered callbacks.
For trivial cases such as d.measure or "d.legend -m" you can just
about get away with it. For complex applications such as v.digit or
d.display, it just doesn't make sense.
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-dev
mailing list