[Vegan-commits] r334 - in pkg: . R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 1 07:36:15 CEST 2008


Author: jarioksa
Date: 2008-05-01 07:36:15 +0200 (Thu, 01 May 2008)
New Revision: 334

Modified:
   pkg/DESCRIPTION
   pkg/R/orditkplot.R
   pkg/inst/ChangeLog
   pkg/man/orditkplot.Rd
Log:
double clicking allows editing a label in orditkplot

Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2008-04-30 07:39:03 UTC (rev 333)
+++ pkg/DESCRIPTION	2008-05-01 05:36:15 UTC (rev 334)
@@ -1,7 +1,7 @@
 Package: vegan
 Title: Community Ecology Package
-Version: 1.12-12
-Date: Apr 23, 2008
+Version: 1.12-13
+Date: May 1, 2008
 Author: Jari Oksanen, Roeland Kindt, Pierre Legendre, Bob O'Hara, Gavin L. Simpson, 
   M. Henry H. Stevens  
 Maintainer: Jari Oksanen <jari.oksanen at oulu.fi>

Modified: pkg/R/orditkplot.R
===================================================================
--- pkg/R/orditkplot.R	2008-04-30 07:39:03 UTC (rev 333)
+++ pkg/R/orditkplot.R	2008-05-01 05:36:15 UTC (rev 334)
@@ -160,7 +160,7 @@
                pdf = pdf(file=fname, width=xy$dim[1], height=xy$dim[2]),
                png = png(file=fname, width=pixdim[1], height=pixdim[2]),
                jpg = jpeg(file=fname, width=pixdim[1], height=pixdim[2],
-                     quality = 100),
+                     quality = 100), 
                bmp = bmp(file=fname, width=pixdim[1], height=pixdim[2]),
                fig = xfig(file=fname, width=xy$dim[1], height=xy$dim[2]))
         plot.orditkplot(xy)
@@ -289,6 +289,7 @@
         id[[lab]] <- i
     }
     ## Plotting and Moving
+    ## Select label
     pDown <- function(x, y) {
         x <- as.numeric(x)
         y <- as.numeric(y)
@@ -302,6 +303,7 @@
         .lastX <<- x
         .lastY <<- y
     }
+    ## Move label
     pMove <- function(x, y) {
         x <- as.numeric(x)
         y <- as.numeric(y)
@@ -315,6 +317,26 @@
                          .pX, .pY, fill="red")
         tkaddtag(can, "ptr", "withtag", conn)
     }
+    ## Edit label
+    pEdit <- function() {
+        tkdtag(can, "selected")
+        tkaddtag(can, "selected", "withtag", "current")
+        tkitemraise(can, "current")
+        click <- tkfind(can, "withtag", "current")
+        txt <- tclVar(labtext[[click]])
+        i <- as.numeric(id[[click]])
+        tt <- tktoplevel()
+        labEd <- tkentry(tt, width=20, textvariable=txt)
+        tkgrid(tklabel(tt, text = "Edit label"))
+        tkgrid(labEd, pady="5m", padx="5m")
+        isDone <- function() {
+            txt <- tclvalue(txt)
+            tkitemconfigure(can, click, text = txt)
+            rownames(sco)[i] <<- txt
+            tkdestroy(tt)
+        }
+        tkbind(labEd, "<Return>", isDone)
+    }   
     ## Dummy location of the mouse
     .lastX <- 0
     .lastY <- 0
@@ -328,6 +350,6 @@
     tkitembind(can, "label", "<1>", pDown)
     tkitembind(can, "label", "<ButtonRelease-1>",
                function() {tkdtag(can, "selected"); tkdelete(can, "ptr")})
-    
+    tkitembind(can, "label", "<Double-Button-1>", pEdit) 
     tkbind(can, "<B1-Motion>", pMove)
 }

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2008-04-30 07:39:03 UTC (rev 333)
+++ pkg/inst/ChangeLog	2008-05-01 05:36:15 UTC (rev 334)
@@ -2,8 +2,12 @@
 
 VEGAN DEVEL VERSIONS at http://r-forge.r-project.org/
 
-Version 1.12-12 (opened April 23, 2008)
+Version 1.12-13 (opened May 1, 2008)
 
+	* orditkplot: labels can be edited with double clicking.
+	
+Version 1.12-12 (closed May 1, 2008)
+
 	* adonis: added calculation of coefficients both for the species
 	(when data matrix was given) and for sites (both with the data
 	matrices and dissimilarities).

Modified: pkg/man/orditkplot.Rd
===================================================================
--- pkg/man/orditkplot.Rd	2008-04-30 07:39:03 UTC (rev 333)
+++ pkg/man/orditkplot.Rd	2008-05-01 05:36:15 UTC (rev 334)
@@ -49,7 +49,8 @@
 \details{ Function \code{orditkplot} uses \pkg{tcltk} package to draw
   Tcl/Tk based ordination graphics with points and labels. The function
   opens an editable canvas with fixed points, but the labels can be
-  moved with mouse to better positions. In addition there are buttons
+  \strong{dragged with mouse} to better positions. The label can be
+  edited with \strong{double clicking} a label.  In addition there are buttons
   for the following tasks: \strong{Copy to EPS} copies the current plot
   to an encapsulated postscript (eps) file using standard Tcl/Tk
   utilities. The faithfullness of this copy is system dependent. Button



More information about the Vegan-commits mailing list