[rkward-cvs] SF.net SVN: rkward:[2901] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Jun 24 15:14:46 UTC 2010


Revision: 2901
          http://rkward.svn.sourceforge.net/rkward/?rev=2901&view=rev
Author:   tfry
Date:     2010-06-24 15:14:46 +0000 (Thu, 24 Jun 2010)

Log Message:
-----------
Add more history navigation actions, and use proper icons.

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-06-24 15:13:40 UTC (rev 2900)
+++ trunk/rkward/rkward/misc/rkstandardicons.cpp	2010-06-24 15:14:46 UTC (rev 2901)
@@ -2,7 +2,7 @@
                           rkstandardicons  -  description
                              -------------------
     begin                : Wed Oct 24 2007
-    copyright            : (C) 2007, 2009 by Thomas Friedrichsmeier
+    copyright            : (C) 2007, 2009, 2010 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -57,9 +57,15 @@
 
 	icons[ActionMoveLeft] = KIcon ("go-previous");
 	icons[ActionMoveRight] = KIcon ("go-next");
+	icons[ActionMoveFirst] = KIcon ("go-first");
+	icons[ActionMoveLast] = KIcon ("go-last");
 	icons[ActionMoveUp] = KIcon ("go-up");
 	icons[ActionMoveDown] = KIcon ("go-down");
 
+	icons[ActionSnapshot] = KIcon ("flag.png");
+
+	icons[ActionClear] = KIcon ("edit-clear.png");
+
 	icons[ActionDetachWindow] = KIcon ("view-fullscreen");
 	icons[ActionAttachWindow] = KIcon ("view-restore");
 

Modified: trunk/rkward/rkward/misc/rkstandardicons.h
===================================================================
--- trunk/rkward/rkward/misc/rkstandardicons.h	2010-06-24 15:13:40 UTC (rev 2900)
+++ trunk/rkward/rkward/misc/rkstandardicons.h	2010-06-24 15:14:46 UTC (rev 2901)
@@ -2,7 +2,7 @@
                           rkstandardicons  -  description
                              -------------------
     begin                : Wed Oct 24 2007
-    copyright            : (C) 2007, 2009 by Thomas Friedrichsmeier
+    copyright            : (C) 2007, 2009, 2010 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -57,9 +57,15 @@
 
 		ActionMoveLeft,
 		ActionMoveRight,
+		ActionMoveFirst,
+		ActionMoveLast,
 		ActionMoveUp,
 		ActionMoveDown,
 
+		ActionSnapshot,
+
+		ActionClear,
+
 		ActionDetachWindow,
 		ActionAttachWindow,
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R	2010-06-24 15:13:40 UTC (rev 2900)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R	2010-06-24 15:14:46 UTC (rev 2901)
@@ -134,6 +134,7 @@
 	{
 		recorded <<- list()
 		current <<- as.list(0)
+		for (dev_num in dev.list()) current[[dev_num]] <<- 0
 		newPlotExists <<- as.list(FALSE)
 		.rk.graph.history.gui ()
 	}

Modified: trunk/rkward/rkward/windows/rkcatchedx11windowpart.rc
===================================================================
--- trunk/rkward/rkward/windows/rkcatchedx11windowpart.rc	2010-06-24 15:13:40 UTC (rev 2900)
+++ trunk/rkward/rkward/windows/rkcatchedx11windowpart.rc	2010-06-24 15:14:46 UTC (rev 2901)
@@ -9,10 +9,16 @@
 			<Action name="device_copy_to_output"/>
 			<Action name="device_copy_to_r_object"/>
 			<Merge/>
+			<Separator/>
 			<Menu name="history"><text>&History</text>
+				<Action name="plot_first"/>
 				<Action name="plot_prev"/>
+				<Action name="plot_next"/>
+				<Action name="plot_last"/>
+				<Separator/>
 				<Action name="plot_record"/>
-				<Action name="plot_next"/>
+				<Separator/>
+				<Action name="plot_clear_history"/>
 			</Menu>
 		</Menu>
 		<Menu name="view"><text>&View</text>
@@ -28,8 +34,13 @@
 		<Merge/>
 	</MenuBar>
 	<ToolBar name="mdiToolBar">
+		<Action name="plot_first"/>
 		<Action name="plot_prev"/>
+		<Action name="plot_next"/>
+		<Action name="plot_last"/>
+		<Separator/>
 		<Action name="plot_record"/>
-		<Action name="plot_next"/>
+		<Separator/>
+		<Action name="plot_clear_history"/>
 	</ToolBar>
 </kpartgui>
\ No newline at end of file

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2010-06-24 15:13:40 UTC (rev 2900)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2010-06-24 15:14:46 UTC (rev 2901)
@@ -26,6 +26,7 @@
 
 #include "../rkwardapplication.h"
 #include "rkworkplace.h"
+#include "../misc/rkstandardicons.h"
 #include "../debug.h"
 
 RKWindowCatcher::RKWindowCatcher () {
@@ -349,18 +350,41 @@
 	updateHistoryActions (history_length, history_position+1);
 }
 
+void RKCaughtX11Window::previousPlot () {
+	RK_TRACE (MISC);
+
+	RKGlobals::rInterface ()->issueCommand ("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);
+}
+
+void RKCaughtX11Window::firstPlot () {
+	RK_TRACE (MISC);
+
+	RKGlobals::rInterface ()->issueCommand ("rk.first.plot (" + QString::number (device_number) + ')', RCommand::App, i18n ("Load first plot in device number %1", device_number), error_dialog);
+	updateHistoryActions (history_length, 1);
+}
+
+void RKCaughtX11Window::lastPlot () {
+	RK_TRACE (MISC);
+
+	RKGlobals::rInterface ()->issueCommand ("rk.last.plot (" + QString::number (device_number) + ')', RCommand::App, i18n ("Load last plot in device number %1", device_number), error_dialog);
+	updateHistoryActions (history_length, history_length);
+}
+
 void RKCaughtX11Window::recordCurrentPlot () {
 	RK_TRACE (MISC);
 
-	RKGlobals::rInterface ()->issueCommand ("rk.current.plot (" + QString::number (device_number) + ')', RCommand::App, i18n ("Add current plot in device number %1", device_number), error_dialog);
-	updateHistoryActions (history_length+1, history_length);
+	RKGlobals::rInterface ()->issueCommand ("rk.current.plot (" + QString::number (device_number) + ')', RCommand::App, i18n ("Add current plot to history (device number %1)", device_number), error_dialog);
+	updateHistoryActions (history_length+1, history_length+1);
 }
 
-void RKCaughtX11Window::previousPlot () {
+void RKCaughtX11Window::clearHistory () {
 	RK_TRACE (MISC);
 
-	RKGlobals::rInterface ()->issueCommand ("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);
+	if (KMessageBox::warningContinueCancel (this, i18n ("This will clear the plot history for all devices windows, not only this one. If this is not your intent, press cancel, below.")) != KMessageBox::Continue) return;
+
+	RKGlobals::rInterface ()->issueCommand ("rk.record.plot$resetHistory ()", RCommand::App, i18n ("Clear plot history"), error_dialog);
+	updateHistoryActions (0, 0);
 }
 
 void RKCaughtX11Window::updateHistoryActions (int history_length, int position) {
@@ -369,8 +393,10 @@
 	RKCaughtX11Window::history_length = history_length;
 	RKCaughtX11Window::history_position = position;
 
+	plot_first_action->setEnabled (position > 1);
 	plot_prev_action->setEnabled (position > 1);
 	plot_next_action->setEnabled ((history_length > 0) && (position < history_length));
+	plot_last_action->setEnabled ((history_length > 0) && (position < history_length));
 }
 
 ///////////////////////////////// END RKCaughtX11Window ///////////////////////////////
@@ -403,18 +429,29 @@
 	action->setText (i18n ("Set specified fixed size..."));
 
 	action = actionCollection ()->addAction ("plot_prev", window, SLOT (previousPlot()));
-// 	action->setText (i18n ("Restore previous plot"));
-	action->setText (i18n ("<"));
+ 	action->setText (i18n ("Previous plot"));
+	action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveLeft));
 	window->plot_prev_action = (KAction*) action;
-	action = actionCollection ()->addAction ("plot_record", window, SLOT (recordCurrentPlot()));
-// 	action->setText (i18n ("Add current plot to history"));
-	action->setText (i18n ("+"));
-	window->plot_record_action = (KAction*) action;
+	action = actionCollection ()->addAction ("plot_first", window, SLOT (firstPlot()));
+ 	action->setText (i18n ("First plot"));
+	action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveFirst));
+	window->plot_first_action = (KAction*) action;
 	action = actionCollection ()->addAction ("plot_next", window, SLOT (nextPlot()));
-// 	action->setText (i18n ("Advance to next plot"));
-	action->setText (i18n (">"));
+ 	action->setText (i18n ("Next plot"));
+	action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveRight));
 	window->plot_next_action = (KAction*) action;
+	action = actionCollection ()->addAction ("plot_last", window, SLOT (lastPlot()));
+ 	action->setText (i18n ("Last plot"));
+	action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionMoveLast));
+	window->plot_last_action = (KAction*) action;
 
+	action = actionCollection ()->addAction ("plot_record", window, SLOT (recordCurrentPlot()));
+ 	action->setText (i18n ("Add to history"));
+	action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionSnapshot));
+	action = actionCollection ()->addAction ("plot_clear_history", window, SLOT (clearHistory()));
+ 	action->setText (i18n ("Clear history"));
+	action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionClear));
+
 	action = actionCollection ()->addAction ("device_activate", window, SLOT (activateDevice()));
 	action->setText (i18n ("Make active"));
 	action = actionCollection ()->addAction ("device_copy_to_output", window, SLOT (copyDeviceToOutput()));

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.h
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.h	2010-06-24 15:13:40 UTC (rev 2900)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.h	2010-06-24 15:14:46 UTC (rev 2901)
@@ -130,9 +130,18 @@
 	void copyDeviceToRObject ();
 	void duplicateDevice ();
 
+/** history navigation */
+	void firstPlot ();
+/** history navigation */
 	void previousPlot ();
+/** history navigation */
+	void nextPlot ();
+/** history navigation */
+	void lastPlot ();
+/** history navigation */
 	void recordCurrentPlot ();
-	void nextPlot ();
+/** history navigation */
+	void clearHistory ();
 private slots:
 	void doEmbed ();
 private:
@@ -158,7 +167,8 @@
 	KToggleAction *dynamic_size_action;
 	KAction *plot_prev_action;
 	KAction *plot_next_action;
-	KAction *plot_record_action;
+	KAction *plot_first_action;
+	KAction *plot_last_action;
 
 	int history_length;
 	int history_position;


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