[rkward-devel] paginate onscreen graphics device

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Jun 28 15:01:40 UTC 2010


Hi,

On Monday 21 June 2010, Prasenjit Kapat wrote:
> Basically, something along the following lines:
> 
> RKGlobals::rInterface ()->issueCommand ("rk.record.plot$onDelDevice ("
> + QString::number (device_number) + ')', RCommand::App, i18n ("Add
> current plot before closing device number %1", device_number),
> error_dialog);

what I have done now, is to simply call dev.off() when the user tries to close 
the device using Window->Close or the close-button. That way, we have only a 
single place where onDelDevice() is called from, which is always a good idea.

> 2a. A better solution would be provide a toolbar for the graphics
> window. Then have them under View and add them to the toolbar as well.
> The toolbar, in far enough future, could be used to add more "editing"
> features!

As you can see, I've added a toolbar, although I guess the "First plot", "Last 
plot", and "Clear History" actions should not go into the toolbar by default, 
in the final version. Suggestions on better icons are always welcome, at this 
and all other places.

> Opinions, suggestions, criticisms are welcomed.

A few more things:
- On line 75 of public_graphics.R, I think it should be
		current [[deviceId]] <<- length (recorded)+1L
(if the previous device *was* the null device, the new window should still be 
at the end of the current history). I don't really understand the 
newPlotExists-list. No idea, whether or not the same problem applies, there.
- In dev.off(): I believe my suggestion to use dev.interactive() was not a good 
idea, after all. dev.off() allows to specify a device number which is not 
currently active, but dev.interactive only returns info on the active device. 
Alternative suggestion: If a known current index exists, then obviously this 
device was "managed" in the history. If the index is NA/NULL, then it was 
probably unrelated. I.e. always call onDelDevice from dev.off(), but make 
onDelDevice smarter.
- Perhaps some code could be made easier by casting the device numbers to 
string using as.character(). Then the device numbers could be used as "real" 
names in the list, instead of indexing. But this concerns aesthetics, only, 
and may not be worth the trouble.
- Once the details of your code are sufficiently stable, it would be good, if 
you could add one or more tests to rkward_application_tests.R. Naturally, not 
all things can be tested from there, but you could add some checks, whether 
all indices are correct after adding/removing devices, etc.

Regards
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/rkward-devel/attachments/20100628/1df7cb84/attachment.sig>


More information about the Rkward-devel mailing list