[rkward-devel] updateHistoryActions and rInterface ()->issueCommand

Prasenjit Kapat kapatp at gmail.com
Sun Jul 4 01:42:57 UTC 2010


Hi,

A question regarding the following function  (or nextPlot() or
firstPlot() or ...) in rkwindowcatcher.cpp.

void RKCaughtX11Window::previousPlot () {
	RK_TRACE (MISC);

	RCommand* c = new RCommand ("rk.previous.plot (" + QString::number
(device_number) + ')', RCommand::App, i18n ("Load previous plot in
device number %1", device_number), error_dialog);
	//updateHistoryActions (history_length, history_position-1);
	setStatusMessage (i18n ("Loading plot from history"), c);
	RKGlobals::rInterface ()->issueCommand (c);
}


Does it matter if updateHistoryActions (...) is called before or after
calling RKGlobals::rInterface ()->issueCommand (...)?

If the R command (in the variable 'c') changes the length of the
history then, is the updateHistoryAction (....) call aware (or
unaware) of this change? I think it is not!

The reason I ask is this:
I was trying to avoid calling .rk.graph.history.gui () from the replay
(...) function (ie comment line 179 in public_graphics.R of rev. 2930)
and hoping that the (uncommented) updateHistoryActions (...) calls
would take care of the job. But, in a situation where the current plot
is unsaved and the user clicks the "previous" button, although
recordUnsaved () does save this plot, the updated history length (one
more plot was added) does not get passed on to
RKCaughtX11Window::previousPlot. As a result the updateHistoryActions
() call still uses the old history_length value (which is one less
than the updated length). And hence a little chaos.

This was not committed to svn, so the svn revisions are clean.

--
Prasenjit




More information about the Rkward-devel mailing list