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

kapatp at users.sourceforge.net kapatp at users.sourceforge.net
Wed May 11 05:16:44 UTC 2011


Revision: 3544
          http://rkward.svn.sourceforge.net/rkward/?rev=3544&view=rev
Author:   kapatp
Date:     2011-05-11 05:16:44 +0000 (Wed, 11 May 2011)

Log Message:
-----------
Add a str() tab to the View context menu in workspace

Modified Paths:
--------------
    trunk/rkward/rkward/robjectviewer.cpp
    trunk/rkward/rkward/robjectviewer.h

Modified: trunk/rkward/rkward/robjectviewer.cpp
===================================================================
--- trunk/rkward/rkward/robjectviewer.cpp	2011-05-10 11:27:12 UTC (rev 3543)
+++ trunk/rkward/rkward/robjectviewer.cpp	2011-05-11 05:16:44 UTC (rev 3544)
@@ -57,6 +57,7 @@
 	tabs = new QTabWidget (this);
 	tabs->insertTab (SummaryPage, summary_widget = new RObjectSummaryWidget (tabs, object), i18n ("summary (x)"));
 	tabs->insertTab (PrintPage, print_widget = new RObjectPrintWidget (tabs, object), i18n ("print (x)"));
+	tabs->insertTab (StructurePage, structure_widget = new RObjectStructureWidget (tabs, object), i18n ("str (x)"));
 	layout->addWidget (tabs);
 
 	tabs->setFocusPolicy (Qt::StrongFocus);
@@ -82,10 +83,12 @@
 	if (object == _object) {
 		summary_widget->objectKilled ();
 		print_widget->objectKilled ();
+		structure_widget->objectKilled ();
 
 		QString reason = i18n ("<b>Object was deleted!</b>");
 		summary_widget->invalidate (reason);
 		print_widget->invalidate (reason);
+		structure_widget->invalidate (reason);
 
 		QPalette palette = status_label->palette ();
 		palette.setColor (status_label->foregroundRole (), Qt::red);
@@ -132,6 +135,7 @@
 		QString reason = i18n ("The object was changed. You may want to click \"Update\"");
 		summary_widget->invalidate (reason);
 		print_widget->invalidate (reason);
+		structure_widget->invalidate (reason);
 	}
 }
 
@@ -142,6 +146,8 @@
 		summary_widget->initialize ();
 	} else if (new_current == PrintPage) {
 		print_widget->initialize ();
+	} else if (new_current == StructurePage) {
+		structure_widget->initialize ();
 	} else {
 		RK_ASSERT (false);
 	}
@@ -296,4 +302,20 @@
 	RKGlobals::rInterface ()->issueCommand (command, 0);
 }
 
+////////////////// structure widget /////////////////
+
+void RObjectStructureWidget::update () {
+	RK_TRACE (APP);
+
+	if (!_object) {
+		RK_ASSERT (false);
+		return;
+	}
+
+	RObjectViewerWidget::update ();
+
+	RCommand *command = new RCommand ("str(" + _object->getFullName () + ")", RCommand::App, QString (), this);
+	RKGlobals::rInterface ()->issueCommand (command, 0);
+}
+
 #include "robjectviewer.moc"

Modified: trunk/rkward/rkward/robjectviewer.h
===================================================================
--- trunk/rkward/rkward/robjectviewer.h	2011-05-10 11:27:12 UTC (rev 3543)
+++ trunk/rkward/rkward/robjectviewer.h	2011-05-11 05:16:44 UTC (rev 3544)
@@ -45,7 +45,8 @@
 
 	enum ViewerPage {
 		SummaryPage = 0,
-		PrintPage = 1
+		PrintPage = 1,
+		StructurePage = 2
 	};
 public slots:
 	void currentTabChanged (int new_current);
@@ -64,6 +65,7 @@
 	QTabWidget* tabs;
 	RObjectViewerWidget* summary_widget;
 	RObjectViewerWidget* print_widget;
+	RObjectViewerWidget* structure_widget;
 
 	RObject *_object;
 };
@@ -120,4 +122,14 @@
 	void update ();
 };
 
+/** Represents the "str" area in an RObjectViewer */
+class RObjectStructureWidget : public RObjectViewerWidget {
+public:
+	RObjectStructureWidget (QWidget* parent, RObject* object) : RObjectViewerWidget (parent, object) {};
+	~RObjectStructureWidget () {};
+
+	/** reimplemented from RObjectViewerWidget to call "str" */
+	void update ();
+};
+
 #endif


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