|
From: <arj...@us...> - 2013-11-22 13:36:25
|
Revision: 12739
http://sourceforge.net/p/plplot/code/12739
Author: arjenmarkus
Date: 2013-11-22 13:36:22 +0000 (Fri, 22 Nov 2013)
Log Message:
-----------
Enable the ntk device for Windows.
The changes involved are:
- CMake accepts the ntk device on Windows, even though there is no X11 library
- interp->result is replaced by Tcl_GetStringResult(interp)
- the name of the plframe widget is always a fixed but valid widget name.
This part will have to be revisited - use the plwindow field as the title?
Modified Paths:
--------------
trunk/cmake/modules/tcl-related.cmake
trunk/drivers/ntk.c
Modified: trunk/cmake/modules/tcl-related.cmake
===================================================================
--- trunk/cmake/modules/tcl-related.cmake 2013-11-22 13:32:42 UTC (rev 12738)
+++ trunk/cmake/modules/tcl-related.cmake 2013-11-22 13:36:22 UTC (rev 12739)
@@ -179,8 +179,14 @@
endif(ENABLE_tk AND NOT TK_FOUND)
if(ENABLE_tk AND NOT X11_FOUND)
- message(STATUS "WARNING: X11 not found so disabling Tk interface code")
- set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
+ if(WIN32 AND NOT CYGWIN)
+ message(STATUS "WARNING: X11 not found, turning off Tk devices that depend on it")
+ set(PLD_tk OFF CACHE BOOL "Enable Tk device" FORCE)
+ set(PLD_tkwin OFF CACHE BOOL "Enable Tk device" FORCE)
+ else(WIN32 AND NOT CYGWIN)
+ message(STATUS "WARNING: X11 not found so disabling Tk interface code")
+ set(ENABLE_tk OFF CACHE BOOL "Enable Tk interface code" FORCE)
+ endif(WIN32 AND NOT CYGWIN)
endif(ENABLE_tk AND NOT X11_FOUND)
if(ENABLE_tk)
Modified: trunk/drivers/ntk.c
===================================================================
--- trunk/drivers/ntk.c 2013-11-22 13:32:42 UTC (rev 12738)
+++ trunk/drivers/ntk.c 2013-11-22 13:36:22 UTC (rev 12739)
@@ -115,7 +115,7 @@
//
sprintf( scmd, "send %s {%s}", rem_interp, cmd ); // mess! make it more efficient
if ( Tcl_Eval( interp, scmd ) != TCL_OK )
- fprintf( stderr, "%s\n", interp->result );
+ fprintf( stderr, "%s\n", Tcl_GetStringResult(interp) );
}
}
@@ -239,9 +239,9 @@
if ( pls->geometry != NULL )
sscanf( pls->geometry, "%dx%d", &xmax, &ymax );
- if ( pls->plwindow != NULL )
+/* if ( pls->plwindow != NULL )
strcpy( base, pls->plwindow );
- else
+ else */
strcpy( base, ".plf" ); // default frame containing the canvas
interp = Tcl_CreateInterp();
@@ -264,7 +264,7 @@
sprintf( cmd, "send %s \"set client [tk appname]; wm deiconify .\"", rem_interp );
if ( Tcl_Eval( interp, cmd ) != TCL_OK )
{
- fprintf( stderr, "%s\n", interp->result );
+ fprintf( stderr, "%s\n", Tcl_GetStringResult(interp) );
plexit( "No such tk server." );
}
}
@@ -301,9 +301,11 @@
// Set up device parameters
Tcl_Eval( interp, "tk scaling" ); // pixels per mm
- ppm = (PLFLT) atof( interp->result ) / ( 25.4 / 72. );
+ ppm = (PLFLT) atof( Tcl_GetStringResult(interp) ) / ( 25.4 / 72. );
plP_setpxl( ppm, ppm );
plP_setphy( xmin, xmax * scale, ymin, ymax * scale );
+
+ tk_cmd( "update" );
}
static void
@@ -371,11 +373,11 @@
{
tk_cmd( "update" );
tk_cmd( "info exists keypress" );
- sscanf( interp->result, "%d", &st );
+ sscanf( Tcl_GetStringResult(interp), "%d", &st );
}
tk_cmd( "set keypress" );
- sscanf( interp->result, "%d", &key );
+ sscanf( Tcl_GetStringResult(interp), "%d", &key );
//fprintf(stderr,"\n%d\n", key);fflush(stderr);
tk_cmd( "unset keypress" );
st = 0;
@@ -433,7 +435,7 @@
{
tk_cmd( "update" );
tk_cmd( "winfo exists $plf.f2.c$ccanv" );
- sscanf( interp->result, "%d", &st );
+ sscanf( Tcl_GetStringResult(interp), "%d", &st );
}
st = 0;
// this give a "Segmentation fault", even after checking for the canvas!
@@ -450,16 +452,16 @@
{
tk_cmd( "update" );
tk_cmd( "info exists xloc" );
- sscanf( interp->result, "%d", &st );
+ sscanf( Tcl_GetStringResult(interp), "%d", &st );
}
tk_cmd( "set xloc" );
- sscanf( interp->result, "%d", &gin.pX );
+ sscanf( Tcl_GetStringResult(interp), "%d", &gin.pX );
tk_cmd( "set yloc" );
- sscanf( interp->result, "%d", &gin.pY );
+ sscanf( Tcl_GetStringResult(interp), "%d", &gin.pY );
tk_cmd( "set bloc" );
- sscanf( interp->result, "%d", &gin.button );
+ sscanf( Tcl_GetStringResult(interp), "%d", &gin.button );
tk_cmd( "set sloc" );
- sscanf( interp->result, "%d", &gin.state );
+ sscanf( Tcl_GetStringResult(interp), "%d", &gin.state );
gin.dX = (PLFLT) gin.pX / xmax;
gin.dY = 1. - (PLFLT) gin.pY / ymax;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|