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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Nov 27 18:00:31 UTC 2006


Revision: 954
          http://svn.sourceforge.net/rkward/?rev=954&view=rev
Author:   tfry
Date:     2006-11-27 10:00:31 -0800 (Mon, 27 Nov 2006)

Log Message:
-----------
Roll back most of the changes to RKComponentMap.
The idea of multiple maps for multiple clients is flawed.
a) Each KXMLGUIClient can only embedded once
b) For plugins e.g. exporting an X11 device, we'd need a way to figure out, which X11 device this is about
c) Rather we need a more general notion of plugins dedicated to import / export tasks, selected according to context, and
given context information
Need a clear enough mind to attack this

Modified Paths:
--------------
    trunk/rkward/TODO
    trunk/rkward/rkward/plugin/rkcomponentmap.cpp
    trunk/rkward/rkward/plugin/rkcomponentmap.h
    trunk/rkward/rkward/plugins/all.pluginmap
    trunk/rkward/rkward/plugins/x11device/export.xml
    trunk/rkward/rkward/rkward.cpp
    trunk/rkward/rkward/windows/rkwindowcatcher.cpp

Modified: trunk/rkward/TODO
===================================================================
--- trunk/rkward/TODO	2006-11-27 17:57:22 UTC (rev 953)
+++ trunk/rkward/TODO	2006-11-27 18:00:31 UTC (rev 954)
@@ -151,6 +151,7 @@
 		- find out why an error in the backend often leads to a subsequent crash
 	- plugins (general)
 		- add import-filter plugins
+			- also export plugins, export x11 plugins, and probably more
 		- ODS filter (try to find someone to implement one in R)
 	- formula-widget:
 		- use smart sorting, esp. of generated string

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2006-11-27 17:57:22 UTC (rev 953)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.cpp	2006-11-27 18:00:31 UTC (rev 954)
@@ -27,16 +27,13 @@
 #include "../rkward.h"
 
 // static members
-RKComponentMap *RKComponentMap::regular_component_map = 0;
-RKComponentMap *RKComponentMap::x11_device_component_map = 0;;
+RKComponentMap *RKComponentMap::component_map = 0;
 
-void RKComponentMap::initializeMaps () {
+void RKComponentMap::initialize () {
 	RK_TRACE (PLUGIN);
 
-	RK_ASSERT (regular_component_map == 0);
-	RK_ASSERT (x11_device_component_map == 0);
-	regular_component_map = new RKComponentMap ();
-	x11_device_component_map = new RKComponentMap ();
+	RK_ASSERT (component_map == 0);
+	component_map = new RKComponentMap ();
 }
 
 RKComponentMap::RKComponentMap () : KXMLGUIClient () {
@@ -68,17 +65,14 @@
 void RKComponentMap::clearAll () {
 	RK_TRACE (PLUGIN);
 
-	getRegularMap ()->clearLocal ();
-	getX11DeviceMap ()->clearLocal ();
+	getMap ()->clearLocal ();
 }
 
 RKComponentHandle* RKComponentMap::getComponentHandle (const QString &id) {
 	RK_TRACE (PLUGIN);
 
-	RKComponentHandle *handle = getRegularMap ()->getComponentHandleLocal (id);
+	RKComponentHandle *handle = getMap ()->getComponentHandleLocal (id);
 	if (handle) return handle;
-	handle = getX11DeviceMap ()->getComponentHandleLocal (id);
-	if (handle) return handle;
 
 	RK_DO (qDebug ("no such component %s", id.latin1 ()), PLUGIN, DL_WARNING);
 	return (0);
@@ -159,25 +153,19 @@
 int RKComponentMap::addPluginMap (const QString& plugin_map_file) {
 	RK_TRACE (PLUGIN);
 
-	XMLHelper* xml = XMLHelper::getStaticHelper ();
-	QDomElement element;
-	XMLChildList list;
-
-	QDomElement document_element = xml->openXMLFile (plugin_map_file, DL_ERROR);
-	if (xml->highestError () >= DL_ERROR) return (0);
-
-	int type = xml->getMultiChoiceAttribute (document_element, "type", "regular;x11", 0, DL_INFO);
-	if (type == 0) return getRegularMap()->addPluginMapLocal (plugin_map_file, document_element);
-	else return getX11DeviceMap()->addPluginMapLocal (plugin_map_file, document_element);
+	return getMap()->addPluginMapLocal (plugin_map_file);
 }
 
-int RKComponentMap::addPluginMapLocal (const QString& plugin_map_file, const QDomElement &document_element) {
+int RKComponentMap::addPluginMapLocal (const QString& plugin_map_file) {
 	RK_TRACE (PLUGIN);
 
 	XMLHelper* xml = XMLHelper::getStaticHelper ();
 	QDomElement element;
-	XMLChildList list;	
+	XMLChildList list;
 
+	QDomElement document_element = xml->openXMLFile (plugin_map_file, DL_ERROR);
+	if (xml->highestError () >= DL_ERROR) return (0);
+
 	QString prefix = QFileInfo (plugin_map_file).dirPath (true) + "/" + xml->getStringAttribute (document_element, "base_prefix", QString::null, DL_INFO);
 	QString cnamespace = xml->getStringAttribute (document_element, "namespace", "rkward", DL_INFO) + "::";
 

Modified: trunk/rkward/rkward/plugin/rkcomponentmap.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponentmap.h	2006-11-27 17:57:22 UTC (rev 953)
+++ trunk/rkward/rkward/plugin/rkcomponentmap.h	2006-11-27 18:00:31 UTC (rev 954)
@@ -80,9 +80,8 @@
 
 /** returns the component identified by id */
 	static RKComponentHandle* getComponentHandle (const QString &id);
-	static RKComponentMap *getRegularMap () { return regular_component_map; };
-	static RKComponentMap *getX11DeviceMap () { return x11_device_component_map; };
-	static void initializeMaps ();
+	static RKComponentMap *getMap () { return component_map; };
+	static void initialize ();
 private:
 /** recurse into a lower menu-level 
 @param parent the parent menu (in the KXMLGUI)
@@ -104,12 +103,11 @@
 	ComponentMap components;
 
 	RKComponentHandle* getComponentHandleLocal (const QString &id);
-	int addPluginMapLocal (const QString& plugin_map_file, const QDomElement &document_element);
+	int addPluginMapLocal (const QString& plugin_map_file);
 
 	void clearLocal ();
 
-	static RKComponentMap *regular_component_map;
-	static RKComponentMap *x11_device_component_map;
+	static RKComponentMap *component_map;
 };
 
 #include <qobject.h>

Modified: trunk/rkward/rkward/plugins/all.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/all.pluginmap	2006-11-27 17:57:22 UTC (rev 953)
+++ trunk/rkward/rkward/plugins/all.pluginmap	2006-11-27 18:00:31 UTC (rev 954)
@@ -55,6 +55,5 @@
 
 	<include file="distributions.pluginmap"/>
 	<include file="plots.pluginmap"/>
-	<include file="x11device.pluginmap"/>
 </document>
  

Modified: trunk/rkward/rkward/plugins/x11device/export.xml
===================================================================
--- trunk/rkward/rkward/plugins/x11device/export.xml	2006-11-27 17:57:22 UTC (rev 953)
+++ trunk/rkward/rkward/plugins/x11device/export.xml	2006-11-27 18:00:31 UTC (rev 954)
@@ -6,6 +6,7 @@
 		<connect client="specifiedformat.enabled" governor="formatother" />
 	</logic>
 	<dialog label="Export contents of graphics device">
+		<text>This plugin is bogus/unfinished. Do not use!</text>
 		<browser size="small" id="file" label="File name" initial="Rplot.pdf" />
 		<radio id="format" label="Output format" >
 			<option value="pdf" label="PDF" />

Modified: trunk/rkward/rkward/rkward.cpp
===================================================================
--- trunk/rkward/rkward/rkward.cpp	2006-11-27 17:57:22 UTC (rev 953)
+++ trunk/rkward/rkward/rkward.cpp	2006-11-27 18:00:31 UTC (rev 954)
@@ -124,7 +124,7 @@
 	connect (this, SIGNAL (childWindowCloseRequest (KMdiChildView *)), this, SLOT (slotChildWindowCloseRequest (KMdiChildView *)));
 
 	RKGlobals::mtracker = new RKModificationTracker (this);
-	RKComponentMap::initializeMaps ();
+	RKComponentMap::initialize ();
 
 	initial_url = load_url;
 
@@ -225,7 +225,7 @@
 	RK_TRACE (APP);
 	slotSetStatusBarText(i18n("Setting up plugins..."));
 	
-	factory ()->removeClient (RKComponentMap::getRegularMap ());
+	factory ()->removeClient (RKComponentMap::getMap ());
 	RKComponentMap::clearAll ();
 
 	QStringList list = RKSettingsModulePlugins::pluginMaps ();
@@ -238,7 +238,7 @@
 		KMessageBox::information (0, i18n ("Plugins are needed: you may manage these through \"Settings->Configure RKWard\".\n"), i18n ("No (valid) plugins found"));
 	}
 
-	factory ()->addClient (RKComponentMap::getRegularMap ());
+	factory ()->addClient (RKComponentMap::getMap ());
 
 	slotSetStatusReady ();
 }

Modified: trunk/rkward/rkward/windows/rkwindowcatcher.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2006-11-27 17:57:22 UTC (rev 953)
+++ trunk/rkward/rkward/windows/rkwindowcatcher.cpp	2006-11-27 18:00:31 UTC (rev 954)
@@ -268,7 +268,6 @@
 /**************************************************************************************/
 //////////////////////////////// BEGIN RKCatchedX11WindowPart //////////////////////////
 
-#include "../plugin/rkcomponentmap.h"
 
 RKCatchedX11WindowPart::RKCatchedX11WindowPart (RKCatchedX11Window *window) : KParts::Part (0) {
 	RK_TRACE (MISC);
@@ -293,8 +292,6 @@
 	new KAction (i18n ("Print"), 0, window, SLOT (printDevice ()), actionCollection (), "device_print");
 	new KAction (i18n ("Store as R object..."), 0, window, SLOT (copyDeviceToRObject ()), actionCollection (), "device_copy_to_r_object");
 	new KAction (i18n ("Duplicate"), 0, window, SLOT (duplicateDevice ()), actionCollection (), "device_duplicate");
-
-	insertChildClient (RKComponentMap::getX11DeviceMap ());
 }
 
 RKCatchedX11WindowPart::~RKCatchedX11WindowPart () {


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