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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Oct 9 15:27:30 UTC 2006


Revision: 837
          http://svn.sourceforge.net/rkward/?rev=837&view=rev
Author:   tfry
Date:     2006-10-09 08:27:23 -0700 (Mon, 09 Oct 2006)

Log Message:
-----------
Offer to search help on function objects in object browser

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/khelpdlg.cpp
    trunk/rkward/rkward/khelpdlg.h
    trunk/rkward/rkward/robjectbrowser.cpp
    trunk/rkward/rkward/robjectbrowser.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2006-10-09 15:17:43 UTC (rev 836)
+++ trunk/rkward/ChangeLog	2006-10-09 15:27:23 UTC (rev 837)
@@ -1,3 +1,4 @@
+- RMB option to search help on function objects in object browser
 - show tooltip information on objects in object browser
 - do not crash on call to "browser ()"
 - the object browser is updated automatically when needed

Modified: trunk/rkward/rkward/khelpdlg.cpp
===================================================================
--- trunk/rkward/rkward/khelpdlg.cpp	2006-10-09 15:17:43 UTC (rev 836)
+++ trunk/rkward/rkward/khelpdlg.cpp	2006-10-09 15:27:23 UTC (rev 837)
@@ -125,7 +125,10 @@
 	RKGlobals::rInterface ()->issueCommand ("help(\"" + result + "\", htmlhelp=TRUE)[1]", RCommand::App | RCommand::GetStringVector, QString::null, this, GET_HELP_URL, 0);
 }
 
-/*$SPECIALIZATION$*/
+void KHelpDlg::getFunctionHelp (const QString &function_name) {
+	RKGlobals::rInterface ()->issueCommand ("help(\"" + function_name + "\", htmlhelp=TRUE)[1]", RCommand::App | RCommand::GetStringVector, QString::null, this, GET_HELP_URL, 0);
+}
+
 void KHelpDlg::slotFindButtonClicked () {
 
 	if (field->currentText ().isEmpty ()) {

Modified: trunk/rkward/rkward/khelpdlg.h
===================================================================
--- trunk/rkward/rkward/khelpdlg.h	2006-10-09 15:17:43 UTC (rev 836)
+++ trunk/rkward/rkward/khelpdlg.h	2006-10-09 15:27:23 UTC (rev 837)
@@ -47,7 +47,7 @@
 @param cursor_pos cursor position in the current line
 Will figure out the word under the cursor, and provide help on that (if there is such a word, and such help exists) */
 	void getContextHelp (const QString &context_line, int cursor_pos);
-
+	void getFunctionHelp (const QString &function_name);
 public slots:
 	void slotFindButtonClicked();
 	void slotResultsListDblClicked( QListViewItem *item, const QPoint &, int );

Modified: trunk/rkward/rkward/robjectbrowser.cpp
===================================================================
--- trunk/rkward/rkward/robjectbrowser.cpp	2006-10-09 15:17:43 UTC (rev 836)
+++ trunk/rkward/rkward/robjectbrowser.cpp	2006-10-09 15:27:23 UTC (rev 837)
@@ -29,6 +29,7 @@
 #include <kmessagebox.h>
 
 #include "rkward.h"
+#include "khelpdlg.h"
 #include "windows/rkcommandeditorwindow.h"
 #include "rkglobals.h"
 #include "core/robjectlist.h"
@@ -56,13 +57,14 @@
 	
 	setCaption (i18n ("Objects in the R workspace"));
 
-	list_view->contextMenu ()->insertItem (i18n ("Edit"), this, SLOT (popupEdit ()), 0, Edit, 0);
-	list_view->contextMenu ()->insertItem (i18n ("View"), this, SLOT (popupView ()), 0, View, 1);
-	list_view->contextMenu ()->insertItem (i18n ("Rename"), this, SLOT (popupRename ()), 0, Rename, 2);
-	list_view->contextMenu ()->insertItem (i18n ("Copy to new symbol"), this, SLOT (popupCopy ()), 0, Copy, 3);
-	list_view->contextMenu ()->insertItem (i18n ("Copy to .GlobalEnv"), this, SLOT (popupCopyToGlobalEnv ()), 0, CopyToGlobalEnv, 4);
-	list_view->contextMenu ()->insertItem (i18n ("Delete"), this, SLOT (popupDelete ()), 0, Delete, 5);
-	list_view->contextMenu ()->insertSeparator (6);
+	list_view->contextMenu ()->insertItem (i18n ("Search Help"), this, SLOT (popupHelp ()), 0, Help, 0);
+	list_view->contextMenu ()->insertItem (i18n ("Edit"), this, SLOT (popupEdit ()), 0, Edit, 1);
+	list_view->contextMenu ()->insertItem (i18n ("View"), this, SLOT (popupView ()), 0, View, 2);
+	list_view->contextMenu ()->insertItem (i18n ("Rename"), this, SLOT (popupRename ()), 0, Rename, 3);
+	list_view->contextMenu ()->insertItem (i18n ("Copy to new symbol"), this, SLOT (popupCopy ()), 0, Copy, 4);
+	list_view->contextMenu ()->insertItem (i18n ("Copy to .GlobalEnv"), this, SLOT (popupCopyToGlobalEnv ()), 0, CopyToGlobalEnv, 5);
+	list_view->contextMenu ()->insertItem (i18n ("Delete"), this, SLOT (popupDelete ()), 0, Delete, 6);
+	list_view->contextMenu ()->insertSeparator (7);
 	connect (list_view, SIGNAL (aboutToShowContextMenu (RKListViewItem*, bool*)), this, SLOT (contextMenuCallback (RKListViewItem*, bool*)));
 	
 	connect (list_view, SIGNAL (doubleClicked (QListViewItem *, const QPoint &, int )), this, SLOT (slotListDoubleClicked (QListViewItem *, const QPoint &, int)));
@@ -87,6 +89,12 @@
 	RObjectList::getObjectList ()->updateFromR ();
 }
 
+void RObjectBrowser::popupHelp () {
+	RK_TRACE (APP);
+
+	if (list_view->menuObject ()) RKGlobals::helpDialog ()->getFunctionHelp (list_view->menuObject ()->getShortName ());
+}
+
 void RObjectBrowser::popupEdit () {
 	RK_TRACE (APP);
 	if (list_view->menuObject ()) RKWorkplace::mainWorkplace ()->editObject (list_view->menuObject ());
@@ -151,6 +159,7 @@
 	QPopupMenu *menu = list_view->contextMenu ();
 
 	if (!object) {
+		menu->setItemVisible (Help, false);
 		menu->setItemVisible (Edit, false);
 		menu->setItemVisible (View, false);
 		menu->setItemVisible (Rename, false);
@@ -161,6 +170,7 @@
 		return;
 	}
 
+	menu->setItemVisible (Help, object->isType (RObject::Function));
 	menu->setItemVisible (Edit, object->canEdit () && RKWorkplace::mainWorkplace ()->canEditObject (object));
 	menu->setItemVisible (View, object->canRead ());
 	menu->setItemVisible (Rename, object->canRename ());

Modified: trunk/rkward/rkward/robjectbrowser.h
===================================================================
--- trunk/rkward/rkward/robjectbrowser.h	2006-10-09 15:17:43 UTC (rev 836)
+++ trunk/rkward/rkward/robjectbrowser.h	2006-10-09 15:27:23 UTC (rev 837)
@@ -44,12 +44,13 @@
 
     ~RObjectBrowser ();
 	
-	enum PopupItems { Edit=1, View=2, Rename=3, Copy=4, CopyToGlobalEnv=5, Delete=6 };
+	enum PopupItems { Help=1, Edit=2, View=3, Rename=4, Copy=5, CopyToGlobalEnv=6, Delete=7 };
 	
 public slots:
 	void updateButtonClicked ();
 	void contextMenuCallback (RKListViewItem *item, bool *suppress);
 	
+	void popupHelp ();
 	void popupEdit ();
 	void popupCopy ();
 /** essentially like popupCopy, but does not ask for a name */


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