[rkward-cvs] SF.net SVN: rkward:[2933] trunk/rkward/rkward/rbackend/rpackages/rkward/R/ public_graphics.R

kapatp at users.sourceforge.net kapatp at users.sourceforge.net
Sun Jul 4 03:47:32 UTC 2010


Revision: 2933
          http://rkward.svn.sourceforge.net/rkward/?rev=2933&view=rev
Author:   kapatp
Date:     2010-07-04 03:47:32 +0000 (Sun, 04 Jul 2010)

Log Message:
-----------
better version of rk.graph.history.gui

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R	2010-07-04 02:39:01 UTC (rev 2932)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/public_graphics.R	2010-07-04 03:47:32 UTC (rev 2933)
@@ -219,29 +219,20 @@
 		message ('Current positions: ', paste (unlist (histPositions), collapse = ', ')) 
 		message ('New plot exists? ', paste (unlist (newPlotExists), collapse = ', ')) 
 	}
-	.rk.graph.history.gui <- function (deviceId = NULL)
+	.rk.graph.history.gui <- function (deviceIds = names (histPositions))
 	{
 		# this function is called whenever the history length changes (ie, increases, for now)
 		# or the position changes in any device.
-		history_length <- length (recorded)
 		
-		if (is.null (deviceId)) {
-			# update all managed devices:
-			ndevs <- length (histPositions)
-			if (ndevs > 1) {
-				positions <- character (1 + 2 * ndevs)
-				positions [1] <- history_length # coerced as character
-				positions [2 * (1:ndevs)] <- names (histPositions)
-				positions [1 + 2 * (1:ndevs)] <- unlist (histPositions, use.names = FALSE)
-			}
-		} else {
-			# update only the one device: deviceId:
-			positions <- c(history_length, deviceId, histPositions [[as.character (deviceId)]])
-			positions <- as.character (positions)
-			names (positions) <- NULL
+		deviceIds <- deviceIds [deviceIds != "1"] # ignore NULL device
+		ndevs <- length (deviceIds)
+		if (ndevs>0) {
+			positions <- character (1 + 2 * ndevs)
+			positions [1] <- length (recorded) # coerced as character
+			positions [2 * (1:ndevs)] <- deviceIds
+			positions [1 + 2 * (1:ndevs)] <- unlist (histPositions[deviceIds], use.names = FALSE)
+			.rk.do.call ("updateDeviceHistory", positions);
 		}
-		
-		.rk.do.call ("updateDeviceHistory", positions);
 		invisible (NULL)
 	}
 


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