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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Mar 25 22:53:24 UTC 2007


Revision: 1729
          http://svn.sourceforge.net/rkward/?rev=1729&view=rev
Author:   tfry
Date:     2007-03-25 15:53:23 -0700 (Sun, 25 Mar 2007)

Log Message:
-----------
slightly more safety in RControlWindow. We should base this whole thing on the command ids, instead of the command pointers, though

Modified Paths:
--------------
    trunk/rkward/TODO
    trunk/rkward/rkward/windows/rcontrolwindow.cpp
    trunk/rkward/rkward/windows/rcontrolwindow.h

Modified: trunk/rkward/TODO
===================================================================
--- trunk/rkward/TODO	2007-03-25 22:42:06 UTC (rev 1728)
+++ trunk/rkward/TODO	2007-03-25 22:53:23 UTC (rev 1729)
@@ -6,6 +6,10 @@
 	- Around March 1st, write to R-devel to achieve having IS_UTF8 and IS_LATIN1 in public API (if not already available, then).
 		- Is Rf_translateChar() what we are looking for?
 
+Should be fixed for 0.4.8:
+	- A way to define dependencies between pluginmaps
+		- Put the embeddable plugins a .pluginmap that is required by most others
+
 Advertizing:
 	- start being a bit bolder about RKWard (descriptions, startup notification, etc.)
 

Modified: trunk/rkward/rkward/windows/rcontrolwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rcontrolwindow.cpp	2007-03-25 22:42:06 UTC (rev 1728)
+++ trunk/rkward/rkward/windows/rcontrolwindow.cpp	2007-03-25 22:53:23 UTC (rev 1729)
@@ -98,6 +98,18 @@
 	MUTEX_UNLOCK;
 }
 
+RControlWindowListViewItem *RControlWindow::itemForCommand (RCommand *command) {
+	QMap <RCommand *, RControlWindowListViewItem *>::const_iterator it = command_map.find (command);
+	if (it == command_map.constEnd ()) return 0;
+	return (*it);
+}
+
+RControlWindowListViewItem *RControlWindow::itemForChain (RCommandChain *chain) {
+	QMap <RCommandChain *, RControlWindowListViewItem *>::const_iterator it = chain_map.find (chain);
+	if (it == chain_map.constEnd ()) return 0;
+	return (*it);
+}
+
 void RControlWindow::addChain (RCommandChain *chain) {
 	if (!isActive ()) return;	// do expensive GUI stuff only when visible
 	RK_TRACE (APP);
@@ -105,7 +117,7 @@
 	RChainOrCommand *dummy = new RChainOrCommand;
 	dummy->command = 0;
 	dummy->chain = chain;
-	addCommands (dummy, chain_map[chain->parent]);
+	addCommands (dummy, itemForChain (chain->parent));
 	delete dummy;
 }
 
@@ -114,14 +126,14 @@
 	RK_TRACE (APP);
 
 	if (!parent) parent = RCommandStack::regular_stack;
-	addCommand (command, chain_map[parent]);
+	addCommand (command, itemForChain (parent));
 }
 
 void RControlWindow::updateChain (RCommandChain *chain) {
 	if (!isActive ()) return;	// do expensive GUI stuff only when visible
 	RK_TRACE (APP);
 
-	RControlWindowListViewItem *chainitem = chain_map[chain];
+	RControlWindowListViewItem *chainitem = itemForChain (chain);
 	chainitem->update (chain);
 	checkCleanChain (chainitem);
 }
@@ -130,7 +142,7 @@
 	if (!isActive ()) return;	// do expensive GUI stuff only when visible
 	RK_TRACE (APP);
 
-	RControlWindowListViewItem *item = command_map[command];
+	RControlWindowListViewItem *item = itemForCommand (command);
 	if (!item) {
 		RK_ASSERT (false);
 		// unfortunately, yes, this can happen! Namely when the command is in the reply stack. We do not find commands in (the) reply stack(s), in refreshCommands.
@@ -144,7 +156,7 @@
 	if (!isActive ()) return;	// do expensive GUI stuff only when visible
 	RK_TRACE (APP);
 
-	RControlWindowListViewItem *item = command_map[command];
+	RControlWindowListViewItem *item = itemForCommand (command);
 	if (!item) {
 		RK_ASSERT (false);
 		// TODO: see updateCommand ()
@@ -174,7 +186,7 @@
 	if (!isActive ()) return;	// do expensive GUI stuff only when visible
 	RK_TRACE (APP);
 
-	RControlWindowListViewItem *item = command_map[command];
+	RControlWindowListViewItem *item = itemForCommand (command);
 	if (!item) {
 		RK_ASSERT (false);
 		// TODO: see updateCommand ()

Modified: trunk/rkward/rkward/windows/rcontrolwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rcontrolwindow.h	2007-03-25 22:42:06 UTC (rev 1728)
+++ trunk/rkward/rkward/windows/rcontrolwindow.h	2007-03-25 22:53:23 UTC (rev 1729)
@@ -88,6 +88,9 @@
 	QPushButton *cancel_button;
 	QPushButton *pause_button;
 
+	RControlWindowListViewItem *itemForCommand (RCommand *command);
+	RControlWindowListViewItem *itemForChain (RCommandChain *chain);
+
 /** internal: recursively add commands/chains */
 	void addCommands (RChainOrCommand *coc, RControlWindowListViewItem *parent);
 /** internal: add single command */


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