[rkward-cvs] SF.net SVN: rkward: [1842] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Apr 24 14:52:20 UTC 2007
Revision: 1842
http://svn.sourceforge.net/rkward/?rev=1842&view=rev
Author: tfry
Date: 2007-04-24 07:52:20 -0700 (Tue, 24 Apr 2007)
Log Message:
-----------
Move a great deal of the common functionality/GUI of the main window and detached windows to a dedicated class.
First positive effect is that the Alt+Number actions now also work in detached windows
Modified Paths:
--------------
trunk/rkward/rkward/rkward.cpp
trunk/rkward/rkward/rkward.h
trunk/rkward/rkward/rkwardui.rc
trunk/rkward/rkward/windows/Makefile.am
trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
trunk/rkward/rkward/windows/detachedwindowcontainer.rc
trunk/rkward/rkward/windows/rkhelpwindow.rc
trunk/rkward/rkward/windows/rkworkplace.cpp
Added Paths:
-----------
trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp
trunk/rkward/rkward/windows/rktoplevelwindowgui.h
trunk/rkward/rkward/windows/rktoplevelwindowgui.rc
Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/rkward.cpp 2007-04-24 14:52:20 UTC (rev 1842)
@@ -66,6 +66,7 @@
#include "windows/rkworkplace.h"
#include "windows/rkcommandlog.h"
#include "windows/rkhelpsearchwindow.h"
+#include "windows/rktoplevelwindowgui.h"
#include "rkconsole.h"
#include "debug.h"
@@ -123,6 +124,7 @@
setHelpMenuEnabled (false);
setXMLFile ("rkwardui.rc");
+ insertChildClient (toplevel_actions = new RKTopLevelWindowGUI (this));
createShellGUI (true);
connect (this, SIGNAL (childWindowCloseRequest (KMdiChildView *)), this, SLOT (slotChildWindowCloseRequest (KMdiChildView *)));
@@ -255,7 +257,7 @@
}
if (RKSettingsModuleGeneral::showHelpOnStartup ()) {
- showRKWardHelp ();
+ toplevel_actions->showRKWardHelp ();
}
setCaption (QString::null); // our version of setCaption takes care of creating a correct caption, so we do not need to provide it here
@@ -345,22 +347,12 @@
createStandardStatusBarAction ();
close_all_editors = new KAction (i18n ("Close All Data"), 0, 0, this, SLOT (slotCloseAllEditors ()), actionCollection (), "close_all_editors");
- window_close = new KAction (i18n ("Close"), 0, KShortcut ("Ctrl+W"), this, SLOT (slotCloseWindow ()), actionCollection (), "window_close");
+ new KAction (i18n ("Close"), 0, KShortcut ("Ctrl+W"), this, SLOT (slotCloseWindow ()), actionCollection (), "window_close");
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/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");
- makeRKWardHelpMenu (this, actionCollection ());
-
new_data_frame->setStatusText (i18n ("Creates new empty dataset and opens it for editing"));
import_data->setStatusText (i18n ("Import data from a variety of file formats"));
fileOpenWorkspace->setStatusText(i18n("Opens an existing document"));
@@ -373,21 +365,6 @@
actionCollection ()->setHighlightingEnabled (true);
}
-void RKWardMainWindow::makeRKWardHelpMenu (QWidget *for_window, KActionCollection *ac) {
- KAction *help_invoke_r_help = new KAction (i18n ("Help on R"), 0, 0, this, SLOT (invokeRHelp ()), ac, "invoke_r_help");
- KAction *show_help_search = new KAction (i18n ("Search R Help"), 0, 0, this, SLOT (showHelpSearch ()), ac, "show_help_search");
- KAction *show_rkward_help = KStdAction::helpContents (this, SLOT (showRKWardHelp ()), ac);
- show_rkward_help->setText (i18n ("Help on RKWard"));
-
- KStdAction::aboutApp (this, SLOT (showAboutApplication ()), ac);
- KStdAction::whatsThis (for_window, SLOT (whatsThis ()), ac);
- KStdAction::reportBug (this, SLOT (reportRKWardBug ()), ac);
-
- help_invoke_r_help->setStatusText (i18n ("Shows the R help index"));
- show_help_search->setStatusText (i18n ("Shows/raises the R Help Search window"));
- show_rkward_help->setStatusText (i18n ("Show help on RKWard"));
-}
-
void RKWardMainWindow::partAdded (KParts::Part *part) {
RK_TRACE (APP);
@@ -576,90 +553,6 @@
return true;
}
-void RKWardMainWindow::invokeRHelp () {
- RK_TRACE (APP);
-
- RKGlobals::rInterface ()->issueCommand ("help.start ()", RCommand::App);
- topLevelWidget ()->raise ();
-}
-
-void RKWardMainWindow::reportRKWardBug () {
- RK_TRACE (APP);
-
-// TOOD: something pretty
- KMessageBox::information (this, i18n ("Please submit your bug reports or wishes at http://sourceforge.net/tracker/?group_id=50231&atid=459007 or send email to rkward-devel at lists.sourceforge.net"));
-}
-
-void RKWardMainWindow::showAboutApplication () {
- RK_TRACE (APP);
-
- KAboutApplication *about = new KAboutApplication ();
- about->exec ();
- delete about;
-}
-
-void RKWardMainWindow::toggleToolView (RKMDIWindow *tool_window) {
- RK_TRACE (APP);
- RK_ASSERT (tool_window);
-
- if (tool_window->isActive ()) {
- tool_window->close (false);
- setFocus (); // in case there is no active document window, focus the main window
- activateDocumentView ();
- } else {
- tool_window->activate ();
- }
-}
-
-void RKWardMainWindow::showHelpSearch () {
- RK_TRACE (APP);
-
- RKHelpSearchWindow::mainHelpSearch ()->activate ();
-}
-
-void RKWardMainWindow::toggleHelpSearch () {
- RK_TRACE (APP);
-
- toggleToolView (RKHelpSearchWindow::mainHelpSearch ());
-}
-
-void RKWardMainWindow::toggleConsole () {
- RK_TRACE (APP);
-
- toggleToolView (RKConsole::mainConsole ());
-}
-
-void RKWardMainWindow::toggleCommandLog () {
- RK_TRACE (APP);
-
- toggleToolView (RKCommandLog::getLog ());
-}
-
-void RKWardMainWindow::togglePendingJobs () {
- RK_TRACE (APP);
-
- toggleToolView (RControlWindow::getControl ());
-}
-
-void RKWardMainWindow::toggleWorkspace () {
- RK_TRACE (APP);
-
- toggleToolView (RObjectBrowser::mainBrowser ());
-}
-
-void RKWardMainWindow::activateDocumentView () {
- RK_TRACE (APP);
-
- RKMDIWindow *window = RKWorkplace::mainWorkplace ()->view ()->activePage ();
- if (window) window->activate ();
-}
-
-void RKWardMainWindow::showRKWardHelp () {
- RK_TRACE (APP);
-
- RKWorkplace::mainWorkplace ()->openHelpWindow ("rkward://page/rkward_welcome", true);
-}
-
void RKWardMainWindow::slotNewDataFrame () {
RK_TRACE (APP);
bool ok;
@@ -842,12 +735,6 @@
openHTML (url);
}
-void RKWardMainWindow::slotOutputShow () {
- RK_TRACE (APP);
-
- RKWorkplace::mainWorkplace ()->openOutputWindow (KURL ());
-}
-
void RKWardMainWindow::setCaption (const QString &) {
RK_TRACE (APP);
Modified: trunk/rkward/rkward/rkward.h
===================================================================
--- trunk/rkward/rkward/rkward.h 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/rkward.h 2007-04-24 14:52:20 UTC (rev 1842)
@@ -58,6 +58,7 @@
class KMdiToolViewAccessor;
class RKMDIWindow;
class QHBox;
+class RKTopLevelWindowGUI;
struct RKWardStartupOptions {
KURL *initial_url; /**< The workspace file to load on startup. If 0, show a dialog asking what to do. **/
@@ -92,8 +93,6 @@
static RKWardMainWindow *getMain () { return rkward_mainwin; };
- void makeRKWardHelpMenu (QWidget *for_window, KActionCollection *ac);
-
/** return pointer to startup options. WARNING: The options are deleted shortly after startup */
static RKWardStartupOptions* getStartupOptions () { return getMain()->startup_options; };
@@ -131,29 +130,6 @@
void childWindowCloseRequest (KMdiChildView *);
void aboutToQuitRKWard ();
public slots:
- /** Raise the help search window */
- void showHelpSearch ();
- /** 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 ();
-
- /** Show the starting page of RKWard help */
- void showRKWardHelp ();
- /** Invokes R help (help.start ()) */
- void invokeRHelp ();
- /** show instructions on reporting bugs in rkward */
- void reportRKWardBug ();
- /** not quite sure, why I have to reimplement this from KMainWindow */
- void showAboutApplication ();
/** creates a new (empty) data.frame */
void slotNewDataFrame ();
/** open a file and load it into the document*/
@@ -193,15 +169,13 @@
/** a child window has received a close event. Check, whether data needs to be saved. Ask if necessary. Close only if safe. */
void slotChildWindowCloseRequest (KMdiChildView * window);
-/** close current window (Windows->Close). Note: the only reason we need to implement this, is so we can set a default shortcut (Ctrl+W). Usually, KMdiMainFrm would provide an action like this by itselt */
+/** close current window (Windows->Close). */
void slotCloseWindow ();
/** close all windows (Windows->Close All) */
void slotCloseAllWindows ();
/** detach current window (Windows->Detach) */
void slotDetachWindow ();
-/** ensure output window is shown. */
- void slotOutputShow ();
/** reimplemented from KMainWindow, to additionally include the workspace url. Actually, we also ignore the caption-parameter, as it sometimes is not the one we want. Rather we create one according to the active view */
void setCaption (const QString &caption);
/** a view has been activated or deactivated. We should make sure to update the main caption to fix strange quirks */
@@ -212,8 +186,6 @@
/** connected to m_manager->partAdded (). Disconnects statusbar notifications */
void partRemoved (KParts::Part *part);
private:
- void toggleToolView (RKMDIWindow *tool_window);
-
QLabel* statusbar_r_status;
QLabel* statusbar_cwd;
QLabel* statusbar_ready;
@@ -237,9 +209,6 @@
KAction* editUndo;
KAction* editRedo;
- KAction* outputShow;
-
- KAction* window_close;
KAction* window_close_all;
KAction* window_detach;
@@ -261,6 +230,8 @@
void setRStatus (bool busy);
/** update the display for the current working directory */
void updateCWD ();
+
+ RKTopLevelWindowGUI *toplevel_actions;
};
#endif // RKWARD_H
Modified: trunk/rkward/rkward/rkwardui.rc
===================================================================
--- trunk/rkward/rkward/rkwardui.rc 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/rkwardui.rc 2007-04-24 14:52:20 UTC (rev 1842)
@@ -33,9 +33,8 @@
<Merge name="rkwardcomponents" />
- <Menu name="windows"><text>&Windows</text>
- <Action name="output_show"/>
- <Separator/>
+ <Menu name="window"><text>&Windows</text>
+ <Merge/>
<Action name="window_close"/>
<Action name="window_close_all"/>
<Action name="close_all_editors"/>
@@ -47,13 +46,7 @@
<Action name="left_window"/>
<Action name="right_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"/>
+ <Merge/>
</Menu>
<Separator/>
<Action name="window_detach"/>
@@ -65,8 +58,6 @@
</Menu>
<Menu name="help"><text>&Help</text>
- <Action name="invoke_r_help"/>
- <Action name="show_help_search"/>
<Merge/>
</Menu>
Modified: trunk/rkward/rkward/windows/Makefile.am
===================================================================
--- trunk/rkward/rkward/windows/Makefile.am 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/windows/Makefile.am 2007-04-24 14:52:20 UTC (rev 1842)
@@ -4,11 +4,11 @@
noinst_HEADERS = rkcommandeditorwindow.h rkcommandeditorwindowpart.h \
rkhtmlwindow.h rcontrolwindow.h detachedwindowcontainer.h rkmdiwindow.h \
rkworkplaceview.h rkworkplace.h qxembedcopy.h rkwindowcatcher.h rkcommandlog.h \
- rkhelpsearchwindow.h
+ rkhelpsearchwindow.h rktoplevelwindowgui.h
libwindows_a_SOURCES = rkcommandeditorwindow.cpp rkcommandeditorwindowpart.cpp \
rkhtmlwindow.cpp rcontrolwindow.cpp detachedwindowcontainer.cpp rkmdiwindow.cpp \
rkworkplaceview.cpp rkworkplace.cpp qxembedcopy.cpp rkwindowcatcher.cpp rkcommandlog.cpp \
- rkhelpsearchwindow.cpp
+ rkhelpsearchwindow.cpp rktoplevelwindowgui.cpp
rcdir = $(kde_datadir)/rkward
rc_DATA = rkcommandeditorwindowpart.rc rkoutputwindow.rc rkhelpwindow.rc detachedwindowcontainer.rc \
- rkcatchedx11windowpart.rc rkcommandlogpart.rc
+ rkcatchedx11windowpart.rc rkcommandlogpart.rc rktoplevelwindowgui.rc
Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.cpp
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.cpp 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.cpp 2007-04-24 14:52:20 UTC (rev 1842)
@@ -23,6 +23,7 @@
#include <qlayout.h>
#include <qwidget.h>
+#include "rktoplevelwindowgui.h"
#include "../rkward.h"
#include "rkworkplace.h"
#include "../rkglobals.h"
@@ -37,7 +38,7 @@
setXMLFile ("detachedwindowcontainer.rc");
KStdAction::close (this, SLOT (close ()), actionCollection (), "dwindow_close");
new KAction (i18n ("Attach to main window"), 0, this, SLOT (slotReattach ()), actionCollection (), "dwindow_attach");
- RKWardMainWindow::getMain ()->makeRKWardHelpMenu (this, actionCollection ());
+ insertChildClient (new RKTopLevelWindowGUI (this));
createShellGUI ();
// capture widget
Modified: trunk/rkward/rkward/windows/detachedwindowcontainer.rc
===================================================================
--- trunk/rkward/rkward/windows/detachedwindowcontainer.rc 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/windows/detachedwindowcontainer.rc 2007-04-24 14:52:20 UTC (rev 1842)
@@ -1,15 +1,16 @@
<!DOCTYPE kpartgui>
-<kpartgui name="rkward" version="0.4.2">
+<kpartgui name="rkward" version="0.4.8">
<MenuBar>
<Merge/>
<Menu name="window"><text>&Window</text>
+ <Merge/>
<Action name="dwindow_close"/>
<Separator/>
+ <Menu name="window_activate"><text>&Activate</text></Menu>
+ <Separator/>
<Action name="dwindow_attach"/>
</Menu>
- <Menu name="help">
- <Action name="invoke_r_help"/>
- <Action name="show_help_search"/>
+ <Menu name="help"><text>&Help</text>
<Merge/>
</Menu>
</MenuBar>
Modified: trunk/rkward/rkward/windows/rkhelpwindow.rc
===================================================================
--- trunk/rkward/rkward/windows/rkhelpwindow.rc 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/windows/rkhelpwindow.rc 2007-04-24 14:52:20 UTC (rev 1842)
@@ -1,15 +1,16 @@
<!DOCTYPE kpartgui>
-<kpartgui name="rkward" version="0.3.4">
+<kpartgui name="rkward" version="0.4.8">
<MenuBar>
- <Menu name="file">
+ <Menu name="file"><text>&File</text>
<Action name="print_help"/>
</Menu>
- <Menu name="edit">
+ <Menu name="edit"><text>&Edit</text>
<Action name="copy"/>
</Menu>
- <Menu name="run">
+ <Menu name="run"><text>&Run</text>
<Action name="run_selection"/>
</Menu>
+ <Merge/>
</MenuBar>
<ToolBar fullWidth="true" name="navigation_toolbar">
<Action name="help_back"/>
Added: trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp
===================================================================
--- trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp (rev 0)
+++ trunk/rkward/rkward/windows/rktoplevelwindowgui.cpp 2007-04-24 14:52:20 UTC (rev 1842)
@@ -0,0 +1,166 @@
+/***************************************************************************
+ rktoplevelwindowgui - description
+ -------------------
+ begin : Tue Apr 24 2007
+ copyright : (C) 2007 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#include "rktoplevelwindowgui.h"
+
+#include <klocale.h>
+#include <kmessagebox.h>
+#include <kaboutapplication.h>
+
+#include "../rkconsole.h"
+#include "../robjectbrowser.h"
+#include "../windows/rcontrolwindow.h"
+#include "../windows/rkhtmlwindow.h"
+#include "../windows/rkworkplaceview.h"
+#include "../windows/rkworkplace.h"
+#include "../windows/rkcommandlog.h"
+#include "../windows/rkhelpsearchwindow.h"
+#include "../windows/rkmdiwindow.h"
+#include "../rbackend/rinterface.h"
+#include "../rkglobals.h"
+#include "../rkward.h"
+
+#include "../debug.h"
+
+RKTopLevelWindowGUI::RKTopLevelWindowGUI (QWidget *for_window) : KXMLGUIClient () {
+ RK_TRACE (APP);
+
+ RKTopLevelWindowGUI::for_window = for_window;
+
+ setXMLFile ("rktoplevelwindowgui.rc");
+
+ // help menu
+ KAction *help_invoke_r_help = new KAction (i18n ("Help on R"), 0, 0, this, SLOT (invokeRHelp ()), actionCollection(), "invoke_r_help");
+ KAction *show_help_search = new KAction (i18n ("Search R Help"), 0, 0, this, SLOT (showHelpSearch ()), actionCollection(), "show_help_search");
+ KAction *show_rkward_help = KStdAction::helpContents (this, SLOT (showRKWardHelp ()), actionCollection(), "rkward_help");
+ show_rkward_help->setText (i18n ("Help on RKWard"));
+
+ KStdAction::aboutApp (this, SLOT (showAboutApplication ()), actionCollection(), "about_app");
+ KStdAction::whatsThis (for_window, SLOT (whatsThis ()), actionCollection(), "whats_this");
+ KStdAction::reportBug (this, SLOT (reportRKWardBug ()), actionCollection(), "report_bug");
+
+ help_invoke_r_help->setStatusText (i18n ("Shows the R help index"));
+ show_help_search->setStatusText (i18n ("Shows/raises the R Help Search window"));
+ show_rkward_help->setStatusText (i18n ("Show help on RKWard"));
+
+ // window menu
+ 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");
+
+ new KAction (i18n ("Show &Output"), 0, 0, this, SLOT (slotOutputShow ()), actionCollection (), "output_show");
+}
+
+RKTopLevelWindowGUI::~RKTopLevelWindowGUI () {
+ RK_TRACE (APP);
+
+ qDebug ("destroyed");
+}
+
+void RKTopLevelWindowGUI::invokeRHelp () {
+ RK_TRACE (APP);
+
+ RKGlobals::rInterface ()->issueCommand ("help.start ()", RCommand::App);
+ RKWardMainWindow::getMain ()->topLevelWidget ()->raise ();
+}
+
+void RKTopLevelWindowGUI::reportRKWardBug () {
+ RK_TRACE (APP);
+
+// TOOD: something pretty
+ KMessageBox::information (for_window, i18n ("Please submit your bug reports or wishes at http://sourceforge.net/tracker/?group_id=50231&atid=459007 or send email to rkward-devel at lists.sourceforge.net"));
+}
+
+void RKTopLevelWindowGUI::showAboutApplication () {
+ RK_TRACE (APP);
+
+ KAboutApplication *about = new KAboutApplication ();
+ about->exec ();
+ delete about;
+}
+
+void RKTopLevelWindowGUI::toggleToolView (RKMDIWindow *tool_window) {
+ RK_TRACE (APP);
+ RK_ASSERT (tool_window);
+
+ if (tool_window->isActive ()) {
+ tool_window->close (false);
+ activateDocumentView ();
+ } else {
+ tool_window->activate (true);
+ }
+}
+
+void RKTopLevelWindowGUI::showHelpSearch () {
+ RK_TRACE (APP);
+
+ RKHelpSearchWindow::mainHelpSearch ()->activate ();
+}
+
+void RKTopLevelWindowGUI::showRKWardHelp () {
+ RK_TRACE (APP);
+
+ RKWorkplace::mainWorkplace ()->openHelpWindow ("rkward://page/rkward_welcome", true);
+}
+
+void RKTopLevelWindowGUI::toggleHelpSearch () {
+ RK_TRACE (APP);
+
+ toggleToolView (RKHelpSearchWindow::mainHelpSearch ());
+}
+
+void RKTopLevelWindowGUI::toggleConsole () {
+ RK_TRACE (APP);
+
+ toggleToolView (RKConsole::mainConsole ());
+}
+
+void RKTopLevelWindowGUI::toggleCommandLog () {
+ RK_TRACE (APP);
+
+ toggleToolView (RKCommandLog::getLog ());
+}
+
+void RKTopLevelWindowGUI::togglePendingJobs () {
+ RK_TRACE (APP);
+
+ toggleToolView (RControlWindow::getControl ());
+}
+
+void RKTopLevelWindowGUI::toggleWorkspace () {
+ RK_TRACE (APP);
+
+ toggleToolView (RObjectBrowser::mainBrowser ());
+}
+
+void RKTopLevelWindowGUI::activateDocumentView () {
+ RK_TRACE (APP);
+
+ RKMDIWindow *window = RKWorkplace::mainWorkplace ()->view ()->activePage ();
+ if (window) window->activate ();
+}
+
+void RKTopLevelWindowGUI::slotOutputShow () {
+ RK_TRACE (APP);
+
+ RKWorkplace::mainWorkplace ()->openOutputWindow (KURL ());
+}
+
+#include "rktoplevelwindowgui.moc"
Added: trunk/rkward/rkward/windows/rktoplevelwindowgui.h
===================================================================
--- trunk/rkward/rkward/windows/rktoplevelwindowgui.h (rev 0)
+++ trunk/rkward/rkward/windows/rktoplevelwindowgui.h 2007-04-24 14:52:20 UTC (rev 1842)
@@ -0,0 +1,67 @@
+/***************************************************************************
+ rktoplevelwindowgui - description
+ -------------------
+ begin : Tue Apr 24 2007
+ copyright : (C) 2007 by Thomas Friedrichsmeier
+ email : tfry at users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef RKTOPLEVELWINDOWGUI_H
+#define RKTOPLEVELWINDOWGUI_H
+
+#include <kxmlguiclient.h>
+
+#include <qobject.h>
+
+class QWdiget;
+class RKMDIWindow;
+
+/** represents the common portions of the GUI for top level windows: The help menu, and the windows menu */
+class RKTopLevelWindowGUI : public QObject, public KXMLGUIClient {
+ Q_OBJECT
+public:
+ RKTopLevelWindowGUI (QWidget *for_window);
+ ~RKTopLevelWindowGUI ();
+public slots:
+ // windows menu
+ /** Raise the help search window */
+ void showHelpSearch ();
+ /** 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 ();
+ /** ensure output window is shown. */
+ void slotOutputShow ();
+
+ // help menu
+ /** Show the starting page of RKWard help */
+ void showRKWardHelp ();
+ /** Invokes R help (help.start ()) */
+ void invokeRHelp ();
+ /** show instructions on reporting bugs in rkward */
+ void reportRKWardBug ();
+ /** not quite sure, why I have to reimplement this from KMainWindow */
+ void showAboutApplication ();
+private:
+ QWidget *for_window;
+ void toggleToolView (RKMDIWindow *tool_window);
+};
+
+#endif
Added: trunk/rkward/rkward/windows/rktoplevelwindowgui.rc
===================================================================
--- trunk/rkward/rkward/windows/rktoplevelwindowgui.rc (rev 0)
+++ trunk/rkward/rkward/windows/rktoplevelwindowgui.rc 2007-04-24 14:52:20 UTC (rev 1842)
@@ -0,0 +1,32 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="rkward" version="0.4.8">
+ <MenuBar>
+ <Merge/>
+ <Menu name="window"><text>&Window</text>
+ <Merge/>
+ <Action name="output_show"/>
+ <Separator/>
+ <Menu name="window_activate"><text>&Activate</text>
+ <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>
+ <Merge/>
+ </Menu>
+ <Menu name="help"><text>&Help</text>
+ <Action name="rkward_help"/>
+ <Action name="whats_this"/>
+ <Separator/>
+ <Action name="invoke_r_help"/>
+ <Action name="show_help_search"/>
+ <Action name="report_bug"/>
+ <Separator/>
+ <Action name="about_app"/>
+ <Merge/>
+ </Menu>
+ </MenuBar>
+</kpartgui>
Modified: trunk/rkward/rkward/windows/rkworkplace.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkworkplace.cpp 2007-04-24 13:05:38 UTC (rev 1841)
+++ trunk/rkward/rkward/windows/rkworkplace.cpp 2007-04-24 14:52:20 UTC (rev 1842)
@@ -81,6 +81,8 @@
if (!window->isToolWindow ()) {
view ()->addPage (window);
}
+ view()->topLevelWidget ()->raise ();
+ view()->topLevelWidget ()->setActiveWindow ();
RK_ASSERT (window->getPart ());
RKWardMainWindow::getMain ()->partManager ()->addPart (window->getPart ());
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