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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Sep 27 17:12:21 UTC 2006


Revision: 770
          http://svn.sourceforge.net/rkward/?rev=770&view=rev
Author:   tfry
Date:     2006-09-27 10:12:10 -0700 (Wed, 27 Sep 2006)

Log Message:
-----------
Add (ugly) items for functions and lists to RObjectBrowser

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/core/robject.h
    trunk/rkward/rkward/icons/Makefile.am
    trunk/rkward/rkward/misc/rkobjectlistview.cpp
    trunk/rkward/rkward/misc/rkobjectlistview.h

Added Paths:
-----------
    trunk/rkward/rkward/icons/function.png
    trunk/rkward/rkward/icons/list.png

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2006-09-27 15:28:11 UTC (rev 769)
+++ trunk/rkward/ChangeLog	2006-09-27 17:12:10 UTC (rev 770)
@@ -1,3 +1,4 @@
+- add (ugly) items for functions and lists to object browser
 - internal cleanups (partially to make porting to KDE4/Qt4 easier)
 - when saving/loading the workspace, save / restore all windows (not just data editors)
 - remember workspace url after save as

Modified: trunk/rkward/rkward/core/robject.h
===================================================================
--- trunk/rkward/rkward/core/robject.h	2006-09-27 15:28:11 UTC (rev 769)
+++ trunk/rkward/rkward/core/robject.h	2006-09-27 17:12:10 UTC (rev 770)
@@ -60,6 +60,7 @@
 	bool isContainer () { return (type & Container); };
 	bool isDataFrame () { return (type & DataFrame); };
 	bool isVariable () { return (type & Variable); };
+	bool isType (int type) { return (RObject::type & type); };
 	bool hasMetaObject () { return (type & HasMetaObject); };
 
 	void rename (const QString &new_short_name);

Modified: trunk/rkward/rkward/icons/Makefile.am
===================================================================
--- trunk/rkward/rkward/icons/Makefile.am	2006-09-27 15:28:11 UTC (rev 769)
+++ trunk/rkward/rkward/icons/Makefile.am	2006-09-27 17:12:10 UTC (rev 770)
@@ -3,5 +3,5 @@
 KDE_ICON = rkward
 iconsdir = $(kde_datadir)/rkward/icons
 
-icons_DATA = rkward_logo.png
+icons_DATA = rkward_logo.png function.png list.png
 

Added: trunk/rkward/rkward/icons/function.png
===================================================================
(Binary files differ)


Property changes on: trunk/rkward/rkward/icons/function.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/rkward/rkward/icons/list.png
===================================================================
(Binary files differ)


Property changes on: trunk/rkward/rkward/icons/list.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: trunk/rkward/rkward/misc/rkobjectlistview.cpp
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.cpp	2006-09-27 15:28:11 UTC (rev 769)
+++ trunk/rkward/rkward/misc/rkobjectlistview.cpp	2006-09-27 17:12:10 UTC (rev 770)
@@ -17,9 +17,13 @@
 #include "rkobjectlistview.h"
 
 #include <klocale.h>
+#include <kglobal.h>
+#include <kstandarddirs.h>
 #include <kiconloader.h>
 
 #include <qpopupmenu.h>
+#include <qpixmap.h>
+#include <qimage.h>
 
 #include "../rkglobals.h"
 #include "../core/robjectlist.h"
@@ -29,8 +33,17 @@
 #include "../settings/rksettingsmoduleobjectbrowser.h"
 #include "../debug.h"
 
+// static
+QPixmap *RKObjectListView::icon_function = 0;
+QPixmap *RKObjectListView::icon_list = 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"));
+	}
+
 	setSorting (100);
 	addColumn (i18n("Name"));
 	addColumn (i18n("Label"));
@@ -207,7 +220,7 @@
 
 	if (object->isDataFrame ()) {
 		item->setPixmap (0, SmallIcon("spreadsheet"));
-	} else {
+	} else if (object->isVariable()) {
 		switch(static_cast<RKVariable*> (object)->getVarType ()) {
 			case RObject::Number:
 				item->setPixmap (0, SmallIcon("math_paren",12));
@@ -225,6 +238,10 @@
 				item->setPixmap (0, SmallIcon("help",12));
 				break;
 		}
+	} else if (object->isType (RObject::List)) {
+		item->setPixmap (0, *icon_list);
+	} else if (object->isType (RObject::Function)) {
+		item->setPixmap (0, *icon_function);
 	}
 
 	if (!RKSettingsModuleObjectBrowser::showHiddenVars ()) {

Modified: trunk/rkward/rkward/misc/rkobjectlistview.h
===================================================================
--- trunk/rkward/rkward/misc/rkobjectlistview.h	2006-09-27 15:28:11 UTC (rev 769)
+++ trunk/rkward/rkward/misc/rkobjectlistview.h	2006-09-27 17:12:10 UTC (rev 770)
@@ -21,6 +21,7 @@
 #include <qmap.h>
 
 class RObject;
+class QPixmap;
 class QPopupMenu;
 class RKListViewItem;
 
@@ -81,6 +82,9 @@
 
 	QPopupMenu *menu;
 	RObject *menu_object;
+
+	static QPixmap *icon_function;
+	static QPixmap *icon_list;
 };
 
 /** 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