[rkward-cvs] SF.net SVN: rkward:[2977] trunk/rkward/rkward
kapatp at users.sourceforge.net
kapatp at users.sourceforge.net
Mon Aug 30 03:26:33 UTC 2010
Revision: 2977
http://rkward.svn.sourceforge.net/rkward/?rev=2977&view=rev
Author: kapatp
Date: 2010-08-30 03:26:32 +0000 (Mon, 30 Aug 2010)
Log Message:
-----------
Add a toolbar action for device/plot properties/info
Modified Paths:
--------------
trunk/rkward/rkward/misc/rkstandardicons.cpp
trunk/rkward/rkward/misc/rkstandardicons.h
trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R
trunk/rkward/rkward/windows/rkcatchedx11windowpart.rc
trunk/rkward/rkward/windows/rkwindowcatcher.cpp
trunk/rkward/rkward/windows/rkwindowcatcher.h
Modified: trunk/rkward/rkward/misc/rkstandardicons.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkstandardicons.cpp 2010-08-30 02:22:27 UTC (rev 2976)
+++ trunk/rkward/rkward/misc/rkstandardicons.cpp 2010-08-30 03:26:32 UTC (rev 2977)
@@ -62,6 +62,7 @@
icons[ActionMoveUp] = KIcon ("go-up");
icons[ActionMoveDown] = KIcon ("go-down");
+ icons[ActionDocumentInfo] = KIcon ("documentinfo.png");
icons[ActionFlagGreen] = KIcon ("flag-green.png");
icons[ActionSnapshot] = KIcon ("list-add.png");
icons[ActionRemovePlot] = KIcon ("list-remove.png");
Modified: trunk/rkward/rkward/misc/rkstandardicons.h
===================================================================
--- trunk/rkward/rkward/misc/rkstandardicons.h 2010-08-30 02:22:27 UTC (rev 2976)
+++ trunk/rkward/rkward/misc/rkstandardicons.h 2010-08-30 03:26:32 UTC (rev 2977)
@@ -62,6 +62,7 @@
ActionMoveUp,
ActionMoveDown,
+ ActionDocumentInfo,
ActionFlagGreen,
ActionSnapshot,
ActionRemovePlot,
Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R 2010-08-30 02:22:27 UTC (rev 2976)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R 2010-08-30 03:26:32 UTC (rev 2977)
@@ -380,19 +380,14 @@
cur.deviceId <- dev.cur ()
dev.set (as.numeric(deviceId))
- status.display <- paste ("Dev: ", deviceId, ", Pos: ", n, sep = '')
if (n > 0 && n <= length(recorded)) {
if (gType [[n]] == "standard") {
- status.display <- paste (status.display, ", Call: Standard graphics", sep = "")
replayPlot (recorded[[n]])
} else if (gType [[n]] == "lattice") {
- status.display <- paste (status.display, ", Call: ", deparse (recorded[[n]]$call), sep = "")
# (re-)plot the lattice object but, if the current window is NOT active, then do not save
# it to lattice:::.LatticeEnv$last.object ("trellis.last.object")
plot (recorded[[n]], save.object = (cur.deviceId == as.numeric (deviceId)))
}
- status.display <- paste (status.display, ", Size: ", round (object.size (recorded[[n]])/1024, 2), " Kb", sep = "")
- message ("--\n", status.display, "\n--\n") # add to a new status bar?
histPositions [[deviceId]] <<- n
.rk.graph.history.gui () # (deviceId)
}
@@ -466,6 +461,32 @@
}
invisible (NULL)
}
+ .get.oldplot.call <- function (deviceId)
+ {
+ switch (gType [[histPositions [[deviceId]]]],
+ standard = "\"standard graphics\"",
+ lattice = deparse (recorded [[histPositions [[deviceId]]]]$call),
+ "Unknown")
+ }
+ .get.plot.info.str <- function (deviceId = dev.cur ())
+ {
+ deviceId <- as.character (deviceId)
+ if (newPlotExists [[deviceId]]) {
+ info.str <- paste ("Dev: ", deviceId, ", Pos: ?, Size: ?, Type: ", gType.newplot [[deviceId]], sep = "")
+ } else {
+ # else if (!is.null (histPositions [[deviceId]]))?
+ info.str <- paste ("Dev: ", deviceId,
+ ", Pos: ", histPositions [[deviceId]],
+ ", Size: ", round (object.size (recorded [[histPositions [[deviceId]]]])/1024, 2), " KB",
+ ", Call: ", .get.oldplot.call (deviceId), sep = "")
+ } # else info.str <- NULL
+ info.str
+ }
+ showPlotInfo <- function (deviceId = dev.cur ())
+ {
+ ## TODO: update to either a proper message box, or move to a 'status bar'
+ readline (prompt = .get.plot.info.str (deviceId))
+ }
.verify.hist.limits <- function ()
{
# Length restriction:
Modified: trunk/rkward/rkward/windows/rkcatchedx11windowpart.rc
===================================================================
--- trunk/rkward/rkward/windows/rkcatchedx11windowpart.rc 2010-08-30 02:22:27 UTC (rev 2976)
+++ trunk/rkward/rkward/windows/rkcatchedx11windowpart.rc 2010-08-30 03:26:32 UTC (rev 2977)
@@ -21,6 +21,8 @@
<Separator/>
<Action name="plot_clear_history"/>
</Menu>
+ <Separator/>
+ <Action name="device_properties"/>
</Menu>
<Menu name="view"><text>&View</text>
<Action name="toggle_fixed_size"/>
@@ -49,5 +51,7 @@
<Action name="plot_remove"/>
<Separator/>
<Action name="plot_clear_history"/>
+ <Separator/>
+ <Action name="device_properties"/>
</ToolBar>
</kpartgui>
\ No newline at end of file
Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp 2010-08-30 02:22:27 UTC (rev 2976)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp 2010-08-30 03:26:32 UTC (rev 2977)
@@ -436,6 +436,12 @@
//updateHistoryActions (0, 0);
}
+void RKCaughtX11Window::showPlotInfo () {
+ RK_TRACE (MISC);
+
+ RKGlobals::rInterface ()->issueCommand ("rk.record.plot$showPlotInfo (" + QString::number (device_number) + ")", RCommand::App, i18n ("Device properties (device number %1)", device_number), error_dialog);
+}
+
void RKCaughtX11Window::updateHistoryActions (int history_length, int position) {
RK_TRACE (MISC);
@@ -535,6 +541,11 @@
action->setText (i18n ("Clear history"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionClear));
+ action = actionCollection ()->addAction ("device_properties", window, SLOT (showPlotInfo()));
+ window->device_properties_action = (KAction*) action;
+ action->setText (i18n ("Device properties"));
+ action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionDocumentInfo));
+
action = actionCollection ()->addAction ("device_activate", window, SLOT (activateDevice()));
action->setText (i18n ("Make active"));
action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionFlagGreen));
Modified: trunk/rkward/rkward/windows/rkwindowcatcher.h
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.h 2010-08-30 02:22:27 UTC (rev 2976)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.h 2010-08-30 03:26:32 UTC (rev 2977)
@@ -141,18 +141,13 @@
/** history navigation */
void firstPlot ();
-/** history navigation */
void previousPlot ();
-/** history navigation */
void nextPlot ();
-/** history navigation */
void lastPlot ();
-/** history navigation */
void recordCurrentPlot ();
-/** history navigation */
void removeCurrentPlot ();
-/** history navigation */
void clearHistory ();
+ void showPlotInfo ();
/** reimplemented to keep window alive while saving history */
bool close (bool also_delete);
@@ -188,6 +183,7 @@
KAction *plot_last_action;
KAction *plot_remove_action;
KAction *plot_clear_history_action;
+ KAction *device_properties_action;
KPassivePopup* status_popup;
RCommand* status_change_command;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list