|
From: <and...@us...> - 2010-01-14 21:50:21
|
Revision: 10754
http://plplot.svn.sourceforge.net/plplot/?rev=10754&view=rev
Author: andrewross
Date: 2010-01-14 21:34:06 +0000 (Thu, 14 Jan 2010)
Log Message:
-----------
Fix window name bug in tk driver. tk driver now correctly displays the window name (including the -plwindow option). Note that tk has some rules over what is a valid names so all spaces and . are converted to _ . Also any window name which starts with an upper case letter will have it converted to lower case.
Modified Paths:
--------------
trunk/drivers/tk.c
Modified: trunk/drivers/tk.c
===================================================================
--- trunk/drivers/tk.c 2010-01-14 19:43:31 UTC (rev 10753)
+++ trunk/drivers/tk.c 2010-01-14 21:34:06 UTC (rev 10754)
@@ -1374,10 +1374,24 @@
TkDev *dev = (TkDev *) pls->dev;
char command[CMD_LEN];
unsigned int bg;
+ char *tmp;
+ int i,n;
dbug_enter( "plwindow_init" );
- Tcl_SetVar( dev->interp, "plwindow", pls->plwindow, 0 );
+ /* Set tcl plwindow variable to be pls->plwindow with a . prepended and
+ * and with ' ' replaced by '_' and all other '.' by '_' to avoid
+ * quoting and bad window name problems. Also avoid name starting with
+ * an upper case letter. */
+ n = strlen(pls->plwindow)+1;
+ tmp = (char *)malloc(sizeof(char)*(n+1));
+ sprintf(tmp,".%s",pls->plwindow);
+ for (i=1;i<n;i++) {
+ if ( (tmp[i] == ' ') || (tmp[i] == '.') ) tmp[i] = '_';
+ }
+ if (isupper(tmp[1])) tmp[1] = tolower(tmp[1]);
+ Tcl_SetVar( dev->interp, "plwindow", tmp, 0 );
+ free(tmp);
/* Create the plframe widget & anything else you want with it. */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|