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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon May 9 07:30:49 UTC 2011


Revision: 3541
          http://rkward.svn.sourceforge.net/rkward/?rev=3541&view=rev
Author:   tfry
Date:     2011-05-09 07:30:49 +0000 (Mon, 09 May 2011)

Log Message:
-----------
Hide the '.GlobalEnv'-item, when no other environments are shown.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/misc/rkobjectlistview.cpp
    trunk/rkward/rkward/misc/rkobjectlistview.h

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2011-05-09 06:43:53 UTC (rev 3540)
+++ trunk/rkward/ChangeLog	2011-05-09 07:30:49 UTC (rev 3541)
@@ -1,3 +1,4 @@
+- Object browsers that show only the global environment now hide the ".GlobalEnv" item
 - Fixed: Function argument hints would not be shown in some corner cases
 - Added function rk.print.code() to write highlighted R code to the output window		# TODO: Next, implement the 'carbon copy' feature
 - Box plot plugin gains support for grouped outcome data

Modified: trunk/rkward/rkward/misc/rkobjectlistview.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.cpp	2011-05-09 06:43:53 UTC (rev 3540)
+++ trunk/rkward/rkward/misc/rkobjectlistview.cpp	2011-05-09 07:30:49 UTC (rev 3541)
@@ -2,7 +2,7 @@
                           rkobjectlistview  -  description
                              -------------------
     begin                : Wed Sep 1 2004
-    copyright            : (C) 2004, 2006, 2007, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2006, 2007, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -33,6 +33,7 @@
 RKObjectListView::RKObjectListView (QWidget *parent) : QTreeView (parent) {
 	RK_TRACE (APP);
 
+	root_object = 0;
 	settings = new RKObjectListViewSettings (this);
 	setSortingEnabled (true);
 
@@ -66,10 +67,14 @@
 	RK_TRACE (APP);
 
 	if (!root) return;
+	root_object = root;
+	if (root == RObjectList::getObjectList () && !settings->getSetting (RKObjectListViewSettings::ShowObjectsAllEnvironments)) root = RObjectList::getGlobalEnv ();
 	QModelIndex index = settings->mapFromSource (RKGlobals::tracker ()->indexFor (root));
 	if (index.isValid ()) {
-		setRootIndex (index);
-		resizeColumnToContents (0);
+		if (index != rootIndex ()) {
+			setRootIndex (index);
+			resizeColumnToContents (0);
+		}
 	} else {
 		RK_ASSERT (false);
 	}
@@ -127,16 +132,15 @@
 	setModel (settings);
 
 	QModelIndex genv = settings->mapFromSource (RKGlobals::tracker ()->indexFor (RObjectList::getGlobalEnv ()));
-	QModelIndex olist = settings->mapFromSource (RKGlobals::tracker ()->indexFor (RObjectList::getObjectList ()));
-	setRootIndex (olist);
+	setRootObject (RObjectList::getObjectList ());
 	setExpanded (genv, true);
 	setMinimumHeight (rowHeight (genv) * 5);
-	resetWidths ();
+	settingsChanged ();
 
 	connect (RObjectList::getObjectList (), SIGNAL (updateComplete ()), this, SLOT (updateComplete ()));
 	connect (RObjectList::getObjectList (), SIGNAL (updateStarted ()), this, SLOT (updateStarted ()));
 	connect (selectionModel (), SIGNAL (selectionChanged(const QItemSelection&, const QItemSelection&)), this, SLOT (selectionChanged(const QItemSelection&, const QItemSelection&)));
-	connect (settings, SIGNAL (settingsChanged()), this, SLOT (resetWidths()));
+	connect (settings, SIGNAL (settingsChanged()), this, SLOT (settingsChanged()));
 
 	updateComplete ();
 }
@@ -153,9 +157,10 @@
 	setEnabled (false);
 }
 
-void RKObjectListView::resetWidths () {
+void RKObjectListView::settingsChanged () {
 	RK_TRACE (APP);
 
+	setRootObject (root_object);
 	resizeColumnToContents (0);
 }
 

Modified: trunk/rkward/rkward/misc/rkobjectlistview.h
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.h	2011-05-09 06:43:53 UTC (rev 3540)
+++ trunk/rkward/rkward/misc/rkobjectlistview.h	2011-05-09 07:30:49 UTC (rev 3541)
@@ -2,7 +2,7 @@
                           rkobjectlistview  -  description
                              -------------------
     begin                : Wed Sep 1 2004
-    copyright            : (C) 2004, 2006, 2007, 2010 by Thomas Friedrichsmeier
+    copyright            : (C) 2004, 2006, 2007, 2010, 2011 by Thomas Friedrichsmeier
     email                : tfry at users.sourceforge.net
  ***************************************************************************/
 
@@ -69,7 +69,7 @@
 	void updateComplete ();
 	void updateStarted ();
 	void selectionChanged (const QItemSelection & selected, const QItemSelection & deselected);
-	void resetWidths ();
+	void settingsChanged ();
 
 	virtual void popupConfigure ();
 protected:
@@ -77,6 +77,7 @@
 private:
 	QMenu *menu;
 	RObject *menu_object;
+	RObject *root_object;
 
 	RKObjectListViewSettings *settings;
 };


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