[GRASS5] d.legend and d.out.png

Hamish hamish_nospam at yahoo.com
Thu Aug 19 19:53:45 EDT 2004

> > may it be possible that 'd.legend' doesn't add
> > itself completely to the XDRIVER list?
> 	if(!use_mouse)
> 	    D_add_to_list(G_recreate_command()) ;
> I.e. it should add itself to the list, unless you use the mouse for
> placement (obviously, adding interactive commands such as
> "d.legend -m ..." to the redraw list isn't a good idea).
> One possibility is to modify the string returned by
> G_recreate_command(), i.e. remove the -m switch and add an at= option
> corresponding to the the position that was selected using the mouse.
> Or just construct the command directly without using
> G_recreate_command() at all ("d.barscale -m" does this).

right, use at=.

Part of the reason for not saving it to the command history (ala
d.barscale) was for debugging purposes. It was easy to make a lot of
tests and then just tweak the edge of the window to clear them all.
Hopefully that time is mostly past now. I'm a bit dubious about messing
with the command line by hand like d.barscale does, maybe if it could be
done with a common library function somehow as there are many display
modules that could use this and it's ugly.

d.text.freetype also suffers from this in a way (loss of stdin data),
d.text at least saves the input text to a tmp file to survive the
redraw. Also, I was hoping to use the mouse placement code from
d.barscale for d.text and d.text.freetype at some point, but it hasn't
happened yet.

> Also, I'll use this space to note that tcltkgrass should use a
> terminal (or, at least, an output window) when runninng d.legend with
> the -m switch, so that the instructions can be seen.

Works for me, both 5.3 and 5.7.

Output to stderr should show up in the tcl window as you go, stdout once
the command is finished. (aside: possible way to test for finished


d.zoom from the menu also dumps mouse instructions to the main term
window, which was confusing for a new Mac user here who is just using
the menu system and not even looking at the command line yet.
(esp. when trying to work it with a one button mouse!)


More information about the grass-dev mailing list