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

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Oct 24 15:08:00 UTC 2012


Revision: 4391
          http://rkward.svn.sourceforge.net/rkward/?rev=4391&view=rev
Author:   tfry
Date:     2012-10-24 15:07:59 +0000 (Wed, 24 Oct 2012)
Log Message:
-----------
For R 2.14.0 and above, use the new before.grid.newpage hook

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal_graphics.R

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2012-10-24 13:41:30 UTC (rev 4390)
+++ trunk/rkward/ChangeLog	2012-10-24 15:07:59 UTC (rev 4391)
@@ -1,3 +1,4 @@
+- Fixed: Device history was not working with more recent versions of ggplot2 		(TODO: find out, which version broke it, exactly)
 - Fixed: Option to include suggested packages in install was mis-labelled "install dependencies"
 - rk.set.output.html.file() gains argument to allow addition of custom content to the html header
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal_graphics.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal_graphics.R	2012-10-24 13:41:30 UTC (rev 4390)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal_graphics.R	2012-10-24 15:07:59 UTC (rev 4391)
@@ -155,15 +155,25 @@
 			})
 	)
 
-	setHook (packageEvent ("grid", "attach"),
-		function (...)
-			rk.replace.function ("grid.newpage", as.environment ("package:grid"),
-				function () {
-					## TODO: add specific support for ggplots?
-					rk.record.plot$.plot.new.hook ()
-					ret <- eval (body (.rk.backups$grid.newpage))
-				})
-	)
+	if (compareVersion (as.character (getRversion ()), "2.14.0") < 0) {
+		setHook (packageEvent ("grid", "attach"),
+			function (...)
+				rk.replace.function ("grid.newpage", as.environment ("package:grid"),
+					function () {
+						## TODO: add specific support for ggplots?
+						rk.record.plot$.plot.new.hook ()
+						ret <- eval (body (.rk.backups$grid.newpage))
+					})
+		)
+	} else {
+		setHook ("before.grid.newpage",
+			function (...)
+			{
+				rk.record.plot$.plot.new.hook ()
+			},
+			action = "append"
+		)
+	}
 
 	## persp does not call plot.new (), so set a hook. Fortunately, the hook is placed after drawing the plot.
 	setHook ("persp",

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