[rkward-devel] paginate onscreen graphics device

Prasenjit Kapat kapatp at gmail.com
Sun Jun 20 19:01:51 UTC 2010


On Sun, Jun 20, 2010 at 9:22 AM, Thomas Friedrichsmeier
<thomas.friedrichsmeier at ruhr-uni-bochum.de> wrote:
> Hi,
>
> On Saturday 19 June 2010, Prasenjit Kapat wrote:
>> Looking at Deepayan's reply:
>> http://article.gmane.org/gmane.comp.lang.r.debian/1268
>>
>> i think it might be "easy" to implement the history part (paginated
>> device may be more difficult) for our graphics device.
>>
>> The idea would be to store the plotting calls into a list
>> (.rk.something) and with two top level menu entries ('<' and '>') on
>> the graphics window we could flip through the list...
>>
>> Is it at all easy to implement, or am I hallucinating?
>
> first a technical note: The graphics device in RKWard is simply the native R
> device. All we do is to "capture" that window, and add our own menus to it.
>
> Thus, the difficult part remaining from Deepayan's mail is 1: figuring out just
> when R is about to overwrite the existing plot with something new
> (alternatively: figuring out, when a plot has been completed). Unfortunately,
> the hook in plot.new() gets called directly *after* the previous plot has been
> blanked, so that is too late for our purpose.

OK. I see the problem now. I have two questions: Is it possible for
rkward to know

1. when/if the current device is altered? For example, suppose abline
() is called after a plot() call, does rkward know the device has been
modified? My guess is No.

2. when/if the graphics window is closed? I can handle dev.off () and
graphics.off() but what happens if the close button on the window is
clicked? Or Window > Close (Ctl+W) is clicked? Do rlward still have a
chance to do _something_ (I've an idea of what to do) with existing
graphics?

> I suppose it might be possible to override plot.new() using
> assignInNamespace(). See the bottom of internal.R for our procedure to
> override "menu" and "select.list" in the "utils" package (rk.fix.assignments()
> is called during initialization).

Nice!! I've done exactly that and have a rudimentary code based on
Deepayan's rp () which is working! But yet to commit to svn. I've to
figure out where/what to add/modify in the C++ codes to add additional
GUI elements to the menu of the graphics window. May be you can help
here.

> (Of course there are some additional questions to find an answer for, such as:
> Keep a separate list for each device window, or a single list for all? Clear
> the list, when the corresponding device windows is closed?)

Yes, there are a lot of questions... We'll need to separate out (that
is not record) the devices which are not on-screen, such as pdf, png,
etc... But let me start with a global list and see where it goes... If
it is too flaky then we may scrap the idea completely.

Regards,
-- 
Prasenjit




More information about the Rkward-devel mailing list