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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Mar 6 12:45:28 UTC 2007


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

Log Message:
-----------
Toggle tool windows instead of just showing them

Modified Paths:
--------------
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/rkward.h
    trunk/rkward/rkward/windows/rkmdiwindow.cpp

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2007-03-06 12:23:21 UTC (rev 1541)
+++ trunk/rkward/rkward/rkward.cpp	2007-03-06 12:45:27 UTC (rev 1542)
@@ -342,11 +342,11 @@
 	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 ("Show/Hide Workspace Browser"), 0, KShortcut ("Alt+1"), this, SLOT (toggleWorkspace()), actionCollection (), "window_show_workspace");
+	new KAction (i18n ("Show/Hide Command Log"), 0, KShortcut ("Alt+2"), this, SLOT (toggleCommandLog()), actionCollection (), "window_show_commandlog");
+	new KAction (i18n ("Show/Hide Pending Jobs"), 0, KShortcut ("Alt+3"), this, SLOT (togglePendingJobs()), actionCollection (), "window_show_pendingjobs");
+	new KAction (i18n ("Show/Hide Console"), 0, KShortcut ("Alt+4"), this, SLOT (toggleConsole()), actionCollection (), "window_show_console");
+	new KAction (i18n ("Show/Hide R Help Search"), 0, KShortcut ("Alt+5"), this, SLOT (toggleHelpSearch()), 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");
@@ -575,36 +575,54 @@
 	delete about;
 }
 
+void RKWardMainWindow::toggleToolView (RKMDIWindow *tool_window) {
+	RK_TRACE (APP);
+	RK_ASSERT (tool_window);
+
+	if (tool_window->hasFocus ()) {
+		tool_window->close (false);
+		setFocus ();
+		activateDocumentView ();
+	}
+	else tool_window->activate ();
+}
+
 void RKWardMainWindow::showHelpSearch () {
 	RK_TRACE (APP);
 
 	RKHelpSearchWindow::mainHelpSearch ()->activate ();
 }
 
-void RKWardMainWindow::showConsole () {
+void RKWardMainWindow::toggleHelpSearch () {
 	RK_TRACE (APP);
 
-	RKConsole::mainConsole ()->activate ();
+	toggleToolView (RKHelpSearchWindow::mainHelpSearch ());
 }
 
-void RKWardMainWindow::showCommandLog () {
+void RKWardMainWindow::toggleConsole () {
 	RK_TRACE (APP);
 
-	RKCommandLog::getLog ()->activate ();
+	toggleToolView (RKConsole::mainConsole ());
 }
 
-void RKWardMainWindow::showPendingJobs () {
+void RKWardMainWindow::toggleCommandLog () {
 	RK_TRACE (APP);
 
-	RControlWindow::getControl ()->activate ();
+	toggleToolView (RKCommandLog::getLog ());
 }
 
-void RKWardMainWindow::showWorkspace () {
+void RKWardMainWindow::togglePendingJobs () {
 	RK_TRACE (APP);
 
-	RObjectBrowser::mainBrowser ()->activate ();
+	toggleToolView (RControlWindow::getControl ());
 }
 
+void RKWardMainWindow::toggleWorkspace () {
+	RK_TRACE (APP);
+
+	toggleToolView (RObjectBrowser::mainBrowser ());
+}
+
 void RKWardMainWindow::activateDocumentView () {
 	RK_TRACE (APP);
 

Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h	2007-03-06 12:23:21 UTC (rev 1541)
+++ trunk/rkward/rkward/rkward.h	2007-03-06 12:45:27 UTC (rev 1542)
@@ -56,6 +56,7 @@
 class RKMenuList;
 class RKCommandEditorWindow;
 class KMdiToolViewAccessor;
+class RKMDIWindow;
 
 /**
 The main class of rkward. This is where all strings are tied togther, controlls the initialization, and there are some of the most important slots for user actions. All real work is done elsewhere.
@@ -124,14 +125,16 @@
 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 ();
+	/** Toggle the help search window */
+	void toggleHelpSearch ();
+	/** Toggle the console window */
+	void toggleConsole ();
+	/** Toggle the command log window */
+	void toggleCommandLog ();
+	/** Toggle the pending jobs window */
+	void togglePendingJobs ();
+	/** Toggle the workspace browser window */
+	void toggleWorkspace ();
 	/** Activate the current (non tools) window in the workspace */
 	void activateDocumentView ();
 
@@ -201,6 +204,8 @@
 /** connected to m_manager->partAdded (). Disconnects statusbar notifications */
 	void partRemoved (KParts::Part *part);
 private:
+	void toggleToolView (RKMDIWindow *tool_window);
+
 	QLabel* r_status_label;
 	KParts::PartManager *part_manager;
 

Modified: trunk/rkward/rkward/windows/rkmdiwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-03-06 12:23:21 UTC (rev 1541)
+++ trunk/rkward/rkward/windows/rkmdiwindow.cpp	2007-03-06 12:45:27 UTC (rev 1542)
@@ -67,9 +67,9 @@
 
 	if (isToolWindow ()) {
 		RK_ASSERT (wrapper);
+		wrapper->show ();
 		wrapper->wrapperWidget ()->topLevelWidget ()->show ();
 		wrapper->wrapperWidget ()->topLevelWidget ()->raise ();
-		wrapper->show ();
 	} else {
 		if (isAttached ()) {
 			RKWorkplace::mainWorkplace ()->view ()->setActivePage (this);


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