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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Oct 4 10:55:36 UTC 2006


Revision: 803
          http://svn.sourceforge.net/rkward/?rev=803&view=rev
Author:   tfry
Date:     2006-10-04 03:55:28 -0700 (Wed, 04 Oct 2006)

Log Message:
-----------
Add icons for environments, and small cleanup

Modified Paths:
--------------
    trunk/rkward/rkward/core/rcontainerobject.cpp
    trunk/rkward/rkward/core/renvironmentobject.cpp
    trunk/rkward/rkward/core/renvironmentobject.h
    trunk/rkward/rkward/core/robjectlist.cpp
    trunk/rkward/rkward/misc/rkobjectlistview.cpp
    trunk/rkward/rkward/misc/rkobjectlistview.h

Modified: trunk/rkward/rkward/core/rcontainerobject.cpp
===================================================================
--- trunk/rkward/rkward/core/rcontainerobject.cpp	2006-10-04 10:41:38 UTC (rev 802)
+++ trunk/rkward/rkward/core/rcontainerobject.cpp	2006-10-04 10:55:28 UTC (rev 803)
@@ -107,7 +107,6 @@
 	RObject *child_object;
 	if (child_type & RObject::Environment) {
 		child_object = new REnvironmentObject (this, child_name);
-		static_cast<REnvironmentObject *> (child_object)->namespace_name = makeChildName (child_name);
 	} else if (child_type & RObject::Container) {
 		child_object = new RContainerObject (this, child_name);
 	} else if (child_type & RObject::Function) {

Modified: trunk/rkward/rkward/core/renvironmentobject.cpp
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.cpp	2006-10-04 10:41:38 UTC (rev 802)
+++ trunk/rkward/rkward/core/renvironmentobject.cpp	2006-10-04 10:55:28 UTC (rev 803)
@@ -28,10 +28,15 @@
 	type = Environment;
 	if (parent == RObjectList::getObjectList ()) {
 		type |= ToplevelEnv;
+		if (name == ".GlobalEnv") {
+			type |= GlobalEnv;
+		} else if (name.contains (':')) {
+			namespace_name = name.section (':', 1);
+			type |= PackageEnv;
+		}
+	} else {
+		//namespace_name = parent->makeChildName (name);	// not needed, will not be used
 	}
-
-	// TODO: determine namespace_name
-	// TODO: determine if this is an environment var (or maybe this is done from the parent)
 }
 
 REnvironmentObject::~REnvironmentObject () {

Modified: trunk/rkward/rkward/core/renvironmentobject.h
===================================================================
--- trunk/rkward/rkward/core/renvironmentobject.h	2006-10-04 10:41:38 UTC (rev 802)
+++ trunk/rkward/rkward/core/renvironmentobject.h	2006-10-04 10:55:28 UTC (rev 803)
@@ -38,11 +38,7 @@
 	QString makeChildName (const QString &short_child_name, bool misplaced=false);
 /** reimplemented from RContainerObject: If this is an environment var, call RContainerObject::writeMetaData (). Else, do nothing. An environment has no meta data. */
 	void writeMetaData (RCommandChain *chain);
-
-	bool isGlobalEnv () { return (type & GlobalEnv); };
 protected:
-	friend class RObjectList;
-	friend class RContainerObject;
 	bool updateStructure (RData *new_data);
 /** reimplemented from RContainerObject to raise an assert if this is not the isGlobalEnv (). Otherwise calls "remove (objectname)" instead of objectname <- NULL" */
 	void renameChild (RObject *object, const QString &new_name);

Modified: trunk/rkward/rkward/core/robjectlist.cpp
===================================================================
--- trunk/rkward/rkward/core/robjectlist.cpp	2006-10-04 10:41:38 UTC (rev 802)
+++ trunk/rkward/rkward/core/robjectlist.cpp	2006-10-04 10:55:28 UTC (rev 803)
@@ -156,13 +156,6 @@
 	RK_ASSERT (childmap.find (name) == childmap.end ());
 	REnvironmentObject *envobj = new REnvironmentObject (this, name);
 
-	if (name == ".GlobalEnv") {
-		envobj->type |= GlobalEnv | PackageEnv;
-	} else if (name.contains (':')) {
-		envobj->namespace_name = name.section (':', 1);
-		envobj->type |= PackageEnv;
-	}
-
 	childmap.insert (name, envobj);
 	RKGlobals::tracker ()->addObject (envobj, 0);
 	envobj->updateFromR ();

Modified: trunk/rkward/rkward/misc/rkobjectlistview.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.cpp	2006-10-04 10:41:38 UTC (rev 802)
+++ trunk/rkward/rkward/misc/rkobjectlistview.cpp	2006-10-04 10:55:28 UTC (rev 803)
@@ -36,12 +36,16 @@
 // static
 QPixmap *RKObjectListView::icon_function = 0;
 QPixmap *RKObjectListView::icon_list = 0;
+QPixmap *RKObjectListView::package_environment = 0;
+QPixmap *RKObjectListView::environment = 0;
 
 RKObjectListView::RKObjectListView (QWidget *parent) : QListView (parent) {
 	RK_TRACE (APP);
 	if (icon_function == 0) {
 		icon_function = new QPixmap (QImage (KGlobal::dirs ()->findResourceDir ("data", "rkward/phpfiles/common.php") + "rkward/icons/function.png"));
 		icon_list = new QPixmap (QImage (KGlobal::dirs ()->findResourceDir ("data", "rkward/phpfiles/common.php") + "rkward/icons/list.png"));
+		package_environment = new QPixmap (SmallIcon ("ark", 12));
+		environment = new QPixmap (SmallIcon ("konqueror", 12));
 	}
 
 	setSorting (100);
@@ -245,6 +249,10 @@
 		item->setPixmap (0, *icon_list);
 	} else if (object->isType (RObject::Function)) {
 		item->setPixmap (0, *icon_function);
+	} else if (object->isType (RObject::PackageEnv)) {
+		item->setPixmap (0, *package_environment);
+	} else if (object->isType (RObject::Environment)) {
+		item->setPixmap (0, *environment);
 	}
 
 	if (!RKSettingsModuleObjectBrowser::showHiddenVars ()) {

Modified: trunk/rkward/rkward/misc/rkobjectlistview.h
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.h	2006-10-04 10:41:38 UTC (rev 802)
+++ trunk/rkward/rkward/misc/rkobjectlistview.h	2006-10-04 10:55:28 UTC (rev 803)
@@ -85,6 +85,8 @@
 
 	static QPixmap *icon_function;
 	static QPixmap *icon_list;
+	static QPixmap *package_environment;
+	static QPixmap *environment;
 };
 
 /** This subclass of RKListViewItem reimplements the width ()-function to return 0 if the item is not currently visible. This is needed to get a sane column width in the listview. Also limit maximum default width to 200 px (TODO: make this configurable)


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