|
From: <arj...@us...> - 2013-11-27 08:41:28
|
Revision: 12762
http://sourceforge.net/p/plplot/code/12762
Author: arjenmarkus
Date: 2013-11-27 08:41:24 +0000 (Wed, 27 Nov 2013)
Log Message:
-----------
Insert a column break every 30 pages, mostly useful for example 33, as this has 100 pages in total. Some small glitch is left (first column runs from page 1 to 29, the next one from 30 to 59, so one more page), still the menu is now useable even with example 33.
Modified Paths:
--------------
trunk/drivers/ntk.c
Modified: trunk/drivers/ntk.c
===================================================================
--- trunk/drivers/ntk.c 2013-11-27 08:39:29 UTC (rev 12761)
+++ trunk/drivers/ntk.c 2013-11-27 08:41:24 UTC (rev 12762)
@@ -122,14 +122,17 @@
static void
create_canvas( PLStream *pls )
{
+ int columnbreak;
+
ccanv++;
+ columnbreak = (ccanv%30 == 0);
// create new canvas
sprintf( cmd, "set ccanv %d; canvas $plf.f2.c$ccanv -width $xmax -height $ymax -background #%02x%02x%02x -xscrollcommand \"$hs set\" -yscrollcommand \"$vs set\" -scrollregion \"0 0 $xmax $ymax\"", ccanv, pls->cmap0[0].r, pls->cmap0[0].g, pls->cmap0[0].b );
tk_cmd( cmd );
// add new canvas to option menu
- sprintf( cmd, "$plf.f1.mb.menu add command -label \"Page $ccanv\" -command {\n"
+ sprintf( cmd, "$plf.f1.mb.menu add command -label \"Page $ccanv\" -columnbreak %d -command {\n"
"set w $plf.f2.c%d;\n"
"$hs configure -command \"$w xview\";\n"
"$vs configure -command \"$w yview\";\n"
@@ -141,7 +144,7 @@
"$hs set $i $j;\n"
"scan [$w yview] \"%%f %%f\" i j;\n"
"$vs set $i $j;}",
- ccanv, ccanv, ccanv );
+ columnbreak, ccanv, ccanv, ccanv );
tk_cmd( cmd );
sprintf( cmd, "set item(%d) 0", ccanv );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2014-01-12 02:14:12
|
Revision: 12931
http://sourceforge.net/p/plplot/code/12931
Author: airwin
Date: 2014-01-12 02:14:07 +0000 (Sun, 12 Jan 2014)
Log Message:
-----------
Fix overflowed cmd buffer caused by example 27.
Modified Paths:
--------------
trunk/drivers/ntk.c
Modified: trunk/drivers/ntk.c
===================================================================
--- trunk/drivers/ntk.c 2014-01-10 20:05:57 UTC (rev 12930)
+++ trunk/drivers/ntk.c 2014-01-12 02:14:07 UTC (rev 12931)
@@ -77,11 +77,15 @@
static Tk_Window mainw; // tk main window
static char curcolor[80]; // current color in #rrggbb notation
-static char cmd[10000]; // buffer to build command to interp
-static int ccanv = 0; // current canvas number
-static char base[80]; // name of frame that contains the canvas
-static char dash[80]; // dash string, as <mark space>*
+// 12000 is large enough to satisfy example 27 needs without
+// erroring out in plD_polyline_ntk. Quadruple that to be conservative.
+#define PLPLOT_NTK_CMD_SIZE 48000
+static char cmd[PLPLOT_NTK_CMD_SIZE]; // buffer to build command to interp
+static int ccanv = 0; // current canvas number
+static char base[80]; // name of frame that contains the canvas
+static char dash[80]; // dash string, as <mark space>*
+
// line buffering
#define NPTS 1000
static short xold = -1, yold = -1; // last point of last 2 points line
@@ -103,7 +107,7 @@
static void
tk_cmd( const char *gcmd )
{
- static char scmd[10000];
+ static char scmd[PLPLOT_NTK_CMD_SIZE];
if ( local )
Tcl_Eval( interp, gcmd );
@@ -351,8 +355,14 @@
// there must exist a way to code this using the tk C API
j = sprintf( cmd, "$plf.f2.c%d create line ", ccanv );
for ( i = 0; i < npts; i++ )
+ {
+ // To be completely safe, assume 5 characters to the left of the
+ // decimal point ==> 2*(5+3) characters written per sprintf
+ // call.
+ if ( ( j + 16 ) > PLPLOT_NTK_CMD_SIZE )
+ plexit( "plD_polyline_ntk: too many x, y values to hold in static cmd array" );
j += sprintf( &cmd[j], "%.1f %.1f ", xa[i] / scale, ymax - ya[i] / scale );
-
+ }
j += sprintf( &cmd[j], " -fill %s", curcolor );
if ( dash[0] == '-' )
j += sprintf( &cmd[j], " %s", dash );
@@ -526,7 +536,7 @@
case PLESC_FILL:
if ( pls->patt != 0 )
{
- // this is a hack! The real solution is in the if(0) bellow
+ // this is a hack! The real solution is in the if(0) below
pls->xpmm *= scale;
pls->ypmm *= scale;
plfill_soft( pls->dev_x, pls->dev_y, pls->dev_npts );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ai...@us...> - 2014-01-12 02:18:44
|
Revision: 12932
http://sourceforge.net/p/plplot/code/12932
Author: airwin
Date: 2014-01-12 02:18:40 +0000 (Sun, 12 Jan 2014)
Log Message:
-----------
Get rid of debugging "flush" output to stderr.
Modified Paths:
--------------
trunk/drivers/ntk.c
Modified: trunk/drivers/ntk.c
===================================================================
--- trunk/drivers/ntk.c 2014-01-12 02:14:07 UTC (rev 12931)
+++ trunk/drivers/ntk.c 2014-01-12 02:18:40 UTC (rev 12932)
@@ -342,7 +342,7 @@
if ( curpts == NPTS )
{
- fprintf( stderr, "\nflush: %d ", curpts );
+ //fprintf( stderr, "\nflush: %d ", curpts );
flushbuffer( pls );
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|