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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Mar 6 12:14:57 UTC 2007


Revision: 1539
          http://svn.sourceforge.net/rkward/?rev=1539&view=rev
Author:   tfry
Date:     2007-03-06 04:14:57 -0800 (Tue, 06 Mar 2007)

Log Message:
-----------
Actions (with shortcuts) to activate the various tool windows

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rinterface.cpp
    trunk/rkward/rkward/rkglobals.cpp
    trunk/rkward/rkward/rkglobals.h
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h
    trunk/rkward/rkward/rkwardui.rc
    trunk/rkward/rkward/robjectbrowser.cpp
    trunk/rkward/rkward/robjectbrowser.h
    trunk/rkward/rkward/windows/rcontrolwindow.cpp
    trunk/rkward/rkward/windows/rcontrolwindow.h

Modified: trunk/rkward/rkward/rbackend/rinterface.cpp
===================================================================
--- trunk/rkward/rkward/rbackend/rinterface.cpp	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/rbackend/rinterface.cpp	2007-03-06 12:14:57 UTC (rev 1539)
@@ -146,7 +146,7 @@
 		}
 	} else if (e->type () == RCOMMAND_IN_EVENT) {
 		RKCommandLog::getLog ()->addInput (static_cast <RCommand *> (e->data ()));
-		RKGlobals::controlWindow ()->setCommandRunning (static_cast <RCommand *> (e->data ()));
+		RControlWindow::getControl ()->setCommandRunning (static_cast <RCommand *> (e->data ()));
 	} else if (e->type () == RCOMMAND_OUT_EVENT) {
 		RCommand *command = static_cast <RCommand *> (e->data ());
 		if (command->status & RCommand::Canceled) {
@@ -163,7 +163,7 @@
 				r_thread->unlock (RThread::Cancel);
 			}
 		}
-		RKGlobals::controlWindow ()->removeCommand (command);
+		RControlWindow::getControl ()->removeCommand (command);
 		command->finished ();
 		if (command->type () & RCommand::DirectToOutput) {
 			RKWorkplace::mainWorkplace ()->newOutput (false);
@@ -213,7 +213,7 @@
 	MUTEX_LOCK;
 	if (command->command ().isEmpty ()) command->_type |= RCommand::EmptyCommand;
 	RCommandStack::issueCommand (command, chain);
-	RKGlobals::controlWindow ()->addCommand (command, chain);
+	RControlWindow::getControl ()->addCommand (command, chain);
 	MUTEX_UNLOCK;
 }
 
@@ -222,7 +222,7 @@
 	RCommandChain *ret;
 	MUTEX_LOCK;
 	ret = RCommandStack::startChain (parent);
-	RKGlobals::controlWindow ()->addChain (ret);
+	RControlWindow::getControl ()->addChain (ret);
 	MUTEX_UNLOCK;
 	return ret;
 };
@@ -232,7 +232,7 @@
 	RCommandChain *ret;
 	MUTEX_LOCK;
 	ret = RCommandStack::closeChain (chain);
-	RKGlobals::controlWindow ()->updateChain (chain);
+	RControlWindow::getControl ()->updateChain (chain);
 	MUTEX_UNLOCK;
 	return ret;
 };
@@ -253,7 +253,7 @@
 		RK_ASSERT (false);
 	}
 	
-	RKGlobals::controlWindow ()->updateCommand (command);
+	RControlWindow::getControl ()->updateCommand (command);
 	MUTEX_UNLOCK;
 }
 
@@ -267,7 +267,7 @@
 void RInterface::processREvalRequest (REvalRequest *request) {
 	RK_TRACE (RBACKEND);
 
-	RKGlobals::controlWindow()->addChain (request->in_chain);
+	RControlWindow::getControl ()->addChain (request->in_chain);
 
 	// clear reply object
 	issueCommand (".rk.set.reply (NULL)", RCommand::App | RCommand::Sync, QString::null, 0, 0, request->in_chain);

Modified: trunk/rkward/rkward/rkglobals.cpp
===================================================================
--- trunk/rkward/rkward/rkglobals.cpp	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/rkglobals.cpp	2007-03-06 12:14:57 UTC (rev 1539)
@@ -20,7 +20,6 @@
 
 RInterface *RKGlobals::rinter;
 RKModificationTracker *RKGlobals::mtracker;
-RControlWindow *RKGlobals::rcontrol;
 
 double RKGlobals::na_double;
 

Modified: trunk/rkward/rkward/rkglobals.h
===================================================================
--- trunk/rkward/rkward/rkglobals.h	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/rkglobals.h	2007-03-06 12:14:57 UTC (rev 1539)
@@ -43,8 +43,6 @@
 	static RInterface *rInterface () { return rinter; };
 /// static pointer to the RKModificationTracker
 	static RKModificationTracker *tracker () { return mtracker; };
-/// static pointer to the RControlWindow
-	static RControlWindow *controlWindow () { return rcontrol; };
 
 /// a NA double
 	static double na_double;
@@ -60,7 +58,6 @@
 	friend class RKWardMainWindow;
 	static RInterface *rinter;
 	static RKModificationTracker *mtracker;
-	static RControlWindow *rcontrol;
 };
 
 #endif

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/rkward.cpp	2007-03-06 12:14:57 UTC (rev 1539)
@@ -158,9 +158,14 @@
 RKWardMainWindow::~RKWardMainWindow() {
 	RK_TRACE (APP);
 	closeAllViews ();
+
+	// these would not be strictly necessary, as we're exiting the app, anyway.
 	delete RKGlobals::rInterface ();
 	delete RObjectList::getObjectList ();
-	delete object_browser;
+	delete RObjectBrowser::mainBrowser ();
+	delete RKCommandLog::getLog ();
+	delete RKConsole::mainConsole ();
+	delete RKHelpSearchWindow::mainHelpSearch ();
 	delete RKGlobals::tracker ();
 }
 
@@ -182,9 +187,9 @@
 
 	readOptions();
 	//It's necessary to give a different name to all tool windows, or they won't be properly displayed
-	object_browser = new RObjectBrowser (0, true, "workspace");
+	RObjectBrowser::object_browser = new RObjectBrowser (0, true, "workspace");
 
-	RKGlobals::rcontrol = new RControlWindow (0, true, "rcontrol");		// the control window needs to be initialized before startR () is called.
+	RControlWindow::control_window = new RControlWindow (0, true, "rcontrol");		// the control window needs to be initialized before startR () is called.
 
 	RKCommandLog *log = new RKCommandLog (0, true, "Command log");
 	log->setIcon (SmallIcon ("text_block"));	
@@ -199,13 +204,13 @@
 	
 	initPlugins ();
 
-	object_browser->setIcon(SmallIcon("view_tree"));
-	object_browser->setToolWrapper (addToolWindow(object_browser,KDockWidget::DockLeft, getMainDockWidget(), 30, i18n ("Existing objects in your workspace."), i18n ("Workspace")));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (object_browser);
+	RObjectBrowser::mainBrowser ()->setIcon(SmallIcon("view_tree"));
+	RObjectBrowser::mainBrowser ()->setToolWrapper (addToolWindow(RObjectBrowser::mainBrowser (), KDockWidget::DockLeft, getMainDockWidget(), 30, i18n ("Existing objects in your workspace."), i18n ("Workspace")));
+	RKWorkplace::mainWorkplace ()->registerToolWindow (RObjectBrowser::mainBrowser ());
 
-	RKGlobals::rcontrol->setCaption (i18n ("Pending Jobs"));
-	RKGlobals::rcontrol->setToolWrapper (addToolWindow (RKGlobals::rcontrol, KDockWidget::DockBottom, getMainDockWidget (), 10));
-	RKWorkplace::mainWorkplace ()->registerToolWindow (RKGlobals::rcontrol);
+	RControlWindow::getControl ()->setCaption (i18n ("Pending Jobs"));
+	RControlWindow::getControl ()->setToolWrapper (addToolWindow (RControlWindow::getControl (), KDockWidget::DockBottom, getMainDockWidget (), 10));
+	RKWorkplace::mainWorkplace ()->registerToolWindow (RControlWindow::getControl ());
 
 	RKConsole *console = new RKConsole (0, true, "r_console");
 	console->setIcon (SmallIcon ("konsole"));
@@ -220,7 +225,7 @@
 	RKHelpSearchWindow::main_help_search = help_search;
 
 	RKOutputWindow::initialize ();
-	RKGlobals::rcontrol->initialize ();
+	RControlWindow::getControl ()->initialize ();
 
 	if (initial_url) {
 		openWorkspace (*initial_url);
@@ -293,7 +298,7 @@
 
 	RKGlobals::rInterface ()->startThread ();
 
-	object_browser->initialize ();
+	RObjectBrowser::mainBrowser ()->initialize ();
 }
 
 void RKWardMainWindow::slotConfigure () {
@@ -336,6 +341,14 @@
 	window_close_all = new KAction (i18n ("Close All"), 0, 0, this, SLOT (slotCloseAllWindows ()), actionCollection (), "window_close_all");
 	window_detach = new KAction (i18n ("Detach"), 0, 0, this, SLOT (slotDetachWindow ()), actionCollection (), "window_detach");
 	outputShow= new KAction (i18n ("Show &Output"), 0, 0, this, SLOT (slotOutputShow ()), actionCollection (), "output_show");
+
+	new KAction (i18n ("Show Workspace Browser"), 0, KShortcut ("Alt+1"), this, SLOT (showWorkspace()), actionCollection (), "window_show_workspace");
+	new KAction (i18n ("Show Command Log"), 0, KShortcut ("Alt+2"), this, SLOT (showCommandLog()), actionCollection (), "window_show_commandlog");
+	new KAction (i18n ("Show Pending Jobs"), 0, KShortcut ("Alt+3"), this, SLOT (showPendingJobs()), actionCollection (), "window_show_pendingjobs");
+	new KAction (i18n ("Show Console"), 0, KShortcut ("Alt+4"), this, SLOT (showConsole()), actionCollection (), "window_show_console");
+	new KAction (i18n ("Show R Help Search"), 0, KShortcut ("Alt+5"), this, SLOT (showHelpSearch()), actionCollection (), "window_show_helpsearch");
+	new KAction (i18n ("Activate Document view"), 0, KShortcut ("Alt+0"), this, SLOT (activateDocumentView()), actionCollection (), "window_activate_docview");
+
 	configure = new KAction (i18n ("Configure RKWard"), 0, 0, this, SLOT (slotConfigure ()), actionCollection (), "configure");
 
 	makeRKWardHelpMenu (this, actionCollection ());
@@ -568,6 +581,37 @@
 	RKHelpSearchWindow::mainHelpSearch ()->activate ();
 }
 
+void RKWardMainWindow::showConsole () {
+	RK_TRACE (APP);
+
+	RKConsole::mainConsole ()->activate ();
+}
+
+void RKWardMainWindow::showCommandLog () {
+	RK_TRACE (APP);
+
+	RKCommandLog::getLog ()->activate ();
+}
+
+void RKWardMainWindow::showPendingJobs () {
+	RK_TRACE (APP);
+
+	RControlWindow::getControl ()->activate ();
+}
+
+void RKWardMainWindow::showWorkspace () {
+	RK_TRACE (APP);
+
+	RObjectBrowser::mainBrowser ()->activate ();
+}
+
+void RKWardMainWindow::activateDocumentView () {
+	RK_TRACE (APP);
+
+	RKMDIWindow *window = RKWorkplace::mainWorkplace ()->activeAttachedWindow ();
+	if (window) window->activate ();
+}
+
 void RKWardMainWindow::showRKWardHelp () {
 	RK_TRACE (APP);
 

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/rkward.h	2007-03-06 12:14:57 UTC (rev 1539)
@@ -83,8 +83,6 @@
 /** opens the given url, assuming it is an HTML-help page. */
 	void openHTML (const KURL &url);
 
-/** returns a pointer to the menu-list (in essence the menu-bar) */
-	RKMenuList* getMenuList () { return menu_list; };
 	KParts::PartManager *partManager () { return part_manager; };
 
 	static RKWardMainWindow *getMain () { return rkward_mainwin; };
@@ -126,6 +124,17 @@
 public slots:
 	/** Raise the help search window */
 	void showHelpSearch ();
+	/** Raise the console window */
+	void showConsole ();
+	/** Raise the command log window */
+	void showCommandLog ();
+	/** Raise the pending jobs window */
+	void showPendingJobs ();
+	/** Raise the workspace browser window */
+	void showWorkspace ();
+	/** Activate the current (non tools) window in the workspace */
+	void activateDocumentView ();
+
 	/** Show the starting page of RKWard help */
 	void showRKWardHelp ();
 	/** Invokes R help (help.start ()) */
@@ -227,11 +236,7 @@
 	/** Finds plugins and inserts them into the menu-structure */
 	void initPlugins ();
 
-	RObjectBrowser *object_browser;
-	
 	KURL *initial_url;
-	
-	RKMenuList *menu_list;
 
 	static RKWardMainWindow *rkward_mainwin;
 

Modified: trunk/rkward/rkward/rkwardui.rc
===================================================================
--- trunk/rkward/rkward/rkwardui.rc	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/rkwardui.rc	2007-03-06 12:14:57 UTC (rev 1539)
@@ -40,8 +40,18 @@
 		<Action name="window_close_all"/>
 		<Action name="close_all_editors"/>
 		<Separator/>
-		<Action name="prev_window"/>
-		<Action name="next_window"/>
+		<Menu name="window_activate"><text>&Activate</text>
+			<Action name="prev_window"/>
+			<Action name="next_window"/>
+			<Separator/>
+			<Action name="window_show_workspace"/>
+			<Action name="window_show_commandlog"/>
+			<Action name="window_show_pendingjobs"/>
+			<Action name="window_show_console"/>
+			<Action name="window_show_helpsearch"/>
+			<Separator/>
+			<Action name="window_activate_docview"/>
+		</Menu>
 		<Separator/>
 		<Action name="window_detach"/>
 	</Menu>

Modified: trunk/rkward/rkward/robjectbrowser.cpp
===================================================================
--- trunk/rkward/rkward/robjectbrowser.cpp	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/robjectbrowser.cpp	2007-03-06 12:14:57 UTC (rev 1539)
@@ -44,6 +44,9 @@
 
 #include "debug.h"
 
+// static
+RObjectBrowser* RObjectBrowser::object_browser = 0;
+
 RObjectBrowser::RObjectBrowser (QWidget *parent, bool tool_window, char *name) : RKMDIWindow (parent, WorkspaceBrowserWindow, tool_window, name) {
 	RK_TRACE (APP);
 	setPart (new RKDummyPart (0, this));

Modified: trunk/rkward/rkward/robjectbrowser.h
===================================================================
--- trunk/rkward/rkward/robjectbrowser.h	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/robjectbrowser.h	2007-03-06 12:14:57 UTC (rev 1539)
@@ -43,6 +43,7 @@
 	~RObjectBrowser ();
 
 	enum PopupItems { Help=1, Edit=2, View=3, Rename=4, Copy=5, CopyToGlobalEnv=6, Delete=7 };
+	static RObjectBrowser *mainBrowser () { return object_browser; };
 public slots:
 	void updateButtonClicked ();
 	void contextMenuCallback (RKListViewItem *item, bool *suppress);
@@ -58,11 +59,12 @@
 /** when an object in the list is double clicked, insert its name in the current RKCommandEditor window */
 	void slotListDoubleClicked (QListViewItem *item, const QPoint &pos, int);
 private:
+	QPushButton *update_button;
+	RKObjectListView *list_view;
+
 	friend class RKWardMainWindow;
 	void initialize ();
-
-	QPushButton *update_button;
-	RKObjectListView *list_view;
+	static RObjectBrowser *object_browser;
 };
 
 /** This class provides a widget to switch quickly between the most important RKObjectListViewSettings */

Modified: trunk/rkward/rkward/windows/rcontrolwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rcontrolwindow.cpp	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/windows/rcontrolwindow.cpp	2007-03-06 12:14:57 UTC (rev 1539)
@@ -32,6 +32,9 @@
 #include "../rkward.h"
 #include "../debug.h"
 
+//static
+RControlWindow *RControlWindow::control_window = 0;
+
 RControlWindow::RControlWindow (QWidget *parent, bool tool_window, char *name) : RKMDIWindow (parent, PendingJobsWindow, tool_window, name) {
 	RK_TRACE (APP);
 	setPart (new RControlWindowPart (this));

Modified: trunk/rkward/rkward/windows/rcontrolwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rcontrolwindow.h	2007-03-04 21:23:30 UTC (rev 1538)
+++ trunk/rkward/rkward/windows/rcontrolwindow.h	2007-03-06 12:14:57 UTC (rev 1539)
@@ -72,6 +72,8 @@
 	void show ();
 /** Call this once, when the RInterface is ready, and it is ok to try showing commands */
 	void initialize ();
+/** Static reference to the control window */
+	static RControlWindow* getControl () { return control_window; };
 public slots:
 /** command selection was changed. Automatically select sub-items of selected chains. Enable/disable "Cancel" button */
 	void commandSelectionChanged ();
@@ -102,6 +104,8 @@
 	bool paused;
 	bool isActive ();
 	bool initialized;
+friend class RKWardMainWindow;
+	static RControlWindow *control_window;
 };
 
 /**


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