72 #define XSynchronize( display, bool ) { display->request++; }
73 #define XSync( display, bool ) { display->request++; }
74 #define XFlush( display )
80 #define dbug_enter( a ) if ( plsc->debug ) { \
81 Tcl_Write( Tcl_GetStdChannel( TCL_STDERR ), a, -1 ); }
85 #ifdef PL_HAVE_UNISTD_H
94 #define NDEV 100 // Max number of output device types
207 #define REFRESH_PENDING 1
208 #define RESIZE_PENDING 2
209 #define REDRAW_PENDING 4
210 #define UPDATE_V_SCROLLBAR 8
211 #define UPDATE_H_SCROLLBAR 16
215 #define DEF_PLFRAME_BG_COLOR "Black"
216 #define DEF_PLFRAME_BG_MONO "White"
217 #define DEF_PLFRAME_BORDER_WIDTH "0"
218 #define DEF_PLFRAME_CURSOR ( (char *) NULL )
219 #define DEF_PLFRAME_HEIGHT "250"
220 #define DEF_PLFRAME_RELIEF "flat"
221 #define DEF_PLFRAME_WIDTH "250"
226 { TK_CONFIG_BOOLEAN,
"-activeplot", (
char *) NULL, (
char *) NULL,
227 "1", Tk_Offset(
PlPlotter, active_plot ), TK_CONFIG_DONT_SET_DEFAULT },
228 { TK_CONFIG_BORDER,
"-background",
"background",
"Background",
230 TK_CONFIG_COLOR_ONLY },
231 { TK_CONFIG_BORDER,
"-background",
"background",
"Background",
233 TK_CONFIG_MONO_ONLY },
234 { TK_CONFIG_SYNONYM,
"-bd",
"borderWidth", (
char *) NULL,
235 (
char *) NULL, 0, 0 },
236 { TK_CONFIG_SYNONYM,
"-bg",
"background", (
char *) NULL,
237 (
char *) NULL, 0, 0 },
238 { TK_CONFIG_STRING,
"-bopcmd",
"bopcmd",
"PgCommand",
239 (
char *) NULL, Tk_Offset(
PlPlotter, bopCmd ), TK_CONFIG_NULL_OK },
240 { TK_CONFIG_PIXELS,
"-borderwidth",
"borderWidth",
"BorderWidth",
242 { TK_CONFIG_BOOLEAN,
"-doublebuffer", (
char *) NULL, (
char *) NULL,
243 "0", Tk_Offset(
PlPlotter, double_buffer ), TK_CONFIG_DONT_SET_DEFAULT },
244 { TK_CONFIG_ACTIVE_CURSOR,
"-cursor",
"cursor",
"Cursor",
246 { TK_CONFIG_STRING,
"-eopcmd",
"eopcmd",
"PgCommand",
247 (
char *) NULL, Tk_Offset(
PlPlotter, eopCmd ), TK_CONFIG_NULL_OK },
248 { TK_CONFIG_PIXELS,
"-height",
"height",
"Height",
250 { TK_CONFIG_RELIEF,
"-relief",
"relief",
"Relief",
252 { TK_CONFIG_PIXELS,
"-width",
"width",
"Width",
254 { TK_CONFIG_BOOLEAN,
"-xhairs", (
char *) NULL, (
char *) NULL,
255 "0", Tk_Offset(
PlPlotter, xhairs ), TK_CONFIG_DONT_SET_DEFAULT },
256 { TK_CONFIG_BOOLEAN,
"-rubberband", (
char *) NULL, (
char *) NULL,
257 "0", Tk_Offset(
PlPlotter, rband ), TK_CONFIG_DONT_SET_DEFAULT },
258 { TK_CONFIG_STRING,
"-xscrollcommand",
"xScrollCommand",
"ScrollCommand",
259 (
char *) NULL, Tk_Offset(
PlPlotter, xScrollCmd ), TK_CONFIG_NULL_OK },
260 { TK_CONFIG_STRING,
"-yscrollcommand",
"yScrollCommand",
"ScrollCommand",
261 (
char *) NULL, Tk_Offset(
PlPlotter, yScrollCmd ), TK_CONFIG_NULL_OK },
262 { TK_CONFIG_END, (
char *) NULL, (
char *) NULL, (
char *) NULL,
263 (
char *) NULL, 0, 0 }
270 int plPlotterCmd( ClientData, Tcl_Interp *,
int,
const char ** );
287 static int ReadData( ClientData,
int );
293 static int Cmd( Tcl_Interp *,
PlPlotter *,
int, CONST
char ** );
295 static int Draw( Tcl_Interp *,
PlPlotter *,
int, CONST
char ** );
296 static int Info( Tcl_Interp *,
PlPlotter *,
int, CONST
char ** );
299 static int Page( Tcl_Interp *,
PlPlotter *,
int, CONST
char ** );
301 static int Print( Tcl_Interp *,
PlPlotter *,
int, CONST
char ** );
303 static int Save( Tcl_Interp *,
PlPlotter *,
int, CONST
char ** );
304 static int View( Tcl_Interp *,
PlPlotter *,
int, CONST
char ** );
360 Tcl_AppendResult( interp,
"wrong # args: should be \"",
361 argv[0],
" pathName ?options?\"", (
char *) NULL );
367 tkwin = Tk_CreateWindowFromPath( interp, Tk_MainWindow( interp ), argv[1], (
char *) NULL );
372 Tk_SetClass( tkwin,
"Plframe" );
378 plPlotterPtr->
tkwin = tkwin;
379 plPlotterPtr->
display = Tk_Display( tkwin );
382 Tcl_CreateCommand( interp, Tk_PathName( plPlotterPtr->
tkwin ),
384 (Tcl_CmdDeleteProc *) NULL );
385 plPlotterPtr->border = NULL;
388 plPlotterPtr->width = Tk_Width( plPlotterPtr->tkwin );
389 plPlotterPtr->height = Tk_Height( plPlotterPtr->tkwin );
390 plPlotterPtr->cursor = None;
391 plPlotterPtr->flags = 0;
392 plPlotterPtr->tkwin_initted = 0;
395 plgpls( &plPlotterPtr->pls );
396 plPlotterPtr->ipls_save = 0;
397 plPlotterPtr->plr = (
PLRDev *) malloc(
sizeof (
PLRDev ) );
398 plPlotterPtr->plpr_cmd = NULL;
399 plPlotterPtr->active_plot = 1;
400 plPlotterPtr->isActive = 0;
401 plPlotterPtr->pldis.x = 0;
402 plPlotterPtr->pldis.y = 0;
403 plPlotterPtr->pldis.width = 0;
404 plPlotterPtr->pldis.height = 0;
405 plPlotterPtr->prevWidth = 0;
406 plPlotterPtr->prevHeight = 0;
407 plPlotterPtr->SaveFnam = NULL;
410 plPlotterPtr->xorGC = NULL;
412 plPlotterPtr->continue_draw = 0;
413 plPlotterPtr->xhair_cursor = None;
414 plPlotterPtr->xl = 0.;
415 plPlotterPtr->yl = 0.;
416 plPlotterPtr->xr = 1.;
417 plPlotterPtr->yr = 1.;
418 plPlotterPtr->xScrollCmd = NULL;
419 plPlotterPtr->yScrollCmd = NULL;
420 plPlotterPtr->bopCmd = NULL;
421 plPlotterPtr->eopCmd = NULL;
422 plPlotterPtr->xhairs = 0;
423 plPlotterPtr->drawing_xhairs = 0;
426 plPlotterPtr->rband = 0;
427 plPlotterPtr->drawing_rband = 0;
429 plPlotterPtr->double_buffer = 1;
431 plr = plPlotterPtr->plr;
437 plPlotterPtr->pls->plPlotterPtr = plPlotterPtr;
441 plPlotterPtr->xhair_cursor =
442 Tk_GetCursor( plPlotterPtr->interp, plPlotterPtr->tkwin,
"crosshair" );
450 plPlotterPtr->devDesc = (
const char **) malloc( (
size_t)
NDEV *
sizeof (
char ** ) );
451 plPlotterPtr->devName = (
const char **) malloc( (
size_t)
NDEV *
sizeof (
char ** ) );
452 for ( i = 0; i <
NDEV; i++ )
454 plPlotterPtr->devDesc[i] = NULL;
455 plPlotterPtr->devName[i] = NULL;
458 plgFileDevs( &plPlotterPtr->devDesc, &plPlotterPtr->devName, &ndev );
462 Tk_CreateEventHandler( plPlotterPtr->tkwin, StructureNotifyMask,
465 Tk_CreateEventHandler( plPlotterPtr->tkwin, ExposureMask,
471 if (
ConfigurePlPlotter( interp, plPlotterPtr, argc - 2, (CONST
char **) argv + 2, 0 ) != TCL_OK )
473 Tk_DestroyWindow( plPlotterPtr->tkwin );
476 Tk_MakeWindowExist( plPlotterPtr->tkwin );
478 Tk_GeometryRequest( plPlotterPtr->tkwin, 200, 200 );
480 Tcl_SetResult( interp, Tk_PathName( plPlotterPtr->tkwin ), TCL_VOLATILE );
516 Tcl_AppendResult( interp,
"wrong # args: should be \"",
517 argv[0],
" option ?arg arg ...?\"", (
char *) NULL );
520 Tk_Preserve( (ClientData) plPlotterPtr );
522 length = (int) strlen( argv[1] );
526 if ( ( c ==
'c' ) && ( strncmp( argv[1],
"cmd", (
size_t) length ) == 0 ) )
528 result =
Cmd( interp, plPlotterPtr, argc - 2, argv + 2 );
533 else if ( ( c ==
'c' ) && ( strncmp( argv[1],
"cget", (
size_t) length ) == 0 )
538 Tcl_AppendResult( interp,
"wrong # args: should be \"",
539 argv[0],
" cget option\"",
544 result = Tk_ConfigureValue( interp, plPlotterPtr->tkwin,
configSpecs,
545 (
char *) plPlotterPtr, argv[2], 0 );
547 else if ( ( c ==
'c' ) && ( strncmp( argv[1],
"configure", (
size_t) length ) == 0 ) )
551 result = Tk_ConfigureInfo( interp, plPlotterPtr->tkwin,
configSpecs,
552 (
char *) plPlotterPtr, (
char *) NULL, 0 );
554 else if ( argc == 3 )
556 result = Tk_ConfigureInfo( interp, plPlotterPtr->tkwin,
configSpecs,
557 (
char *) plPlotterPtr, argv[2], 0 );
562 TK_CONFIG_ARGV_ONLY );
568 else if ( ( c ==
'c' ) && ( strncmp( argv[1],
"closelink", (
size_t) length ) == 0 ) )
572 Tcl_AppendResult( interp,
"wrong # args: should be \"",
573 argv[0], (
char *) NULL );
579 result =
Closelink( interp, plPlotterPtr, argc - 2, argv + 2 );
585 else if ( ( c ==
'd' ) && ( strncmp( argv[1],
"draw", (
size_t) length ) == 0 ) )
589 Tcl_AppendResult( interp,
"wrong # args: should be \"",
590 argv[0],
" draw op ?options?\"", (
char *) NULL );
596 result =
Draw( interp, plPlotterPtr, argc - 2, argv + 2 );
602 else if ( ( c ==
'i' ) && ( strncmp( argv[1],
"info", (
size_t) length ) == 0 ) )
604 result =
Info( interp, plPlotterPtr, argc - 2, argv + 2 );
609 else if ( ( c ==
'n' ) && ( strncmp( argv[1],
"nextpage", (
size_t) length ) == 0 ) )
611 result =
NextPage( interp, plPlotterPtr, argc - 2, argv + 2 );
616 else if ( ( c ==
'o' ) && ( strncmp( argv[1],
"orient", (
size_t) length ) == 0 ) )
618 result =
Orient( interp, plPlotterPtr, argc - 2, argv + 2 );
623 else if ( ( c ==
'o' ) && ( strncmp( argv[1],
"openlink", (
size_t) length ) == 0 ) )
627 Tcl_AppendResult( interp,
"wrong # args: should be \"",
628 argv[0],
" option ?arg arg ...?\"", (
char *) NULL );
634 result =
Openlink( interp, plPlotterPtr, argc - 2, argv + 2 );
640 else if ( ( c ==
'p' ) && ( strncmp( argv[1],
"page", (
size_t) length ) == 0 ) )
642 result =
Page( interp, plPlotterPtr, argc - 2, argv + 2 );
647 else if ( ( c ==
'p' ) && ( strncmp( argv[1],
"print", (
size_t) length ) == 0 ) )
649 result =
Print( interp, plPlotterPtr, argc - 2, argv + 2 );
654 else if ( ( c ==
'r' ) && ( strncmp( argv[1],
"redraw", (
size_t) length ) == 0 ) )
658 Tcl_AppendResult( interp,
"wrong # args: should be \"",
659 argv[0],
" redraw\"", (
char *) NULL );
665 result =
Redraw( interp, plPlotterPtr, argc - 2, argv + 2 );
671 else if ( ( c ==
'r' ) && ( strncmp( argv[1],
"report", (
size_t) length ) == 0 ) )
673 result =
report( interp, plPlotterPtr, argc - 2, argv + 2 );
678 else if ( ( c ==
's' ) && ( strncmp( argv[1],
"save", (
size_t) length ) == 0 ) )
680 result =
Save( interp, plPlotterPtr, argc - 2, argv + 2 );
685 else if ( ( c ==
'v' ) && ( strncmp( argv[1],
"view", (
size_t) length ) == 0 ) )
687 result =
View( interp, plPlotterPtr, argc - 2, argv + 2 );
692 else if ( ( c ==
'x' ) && ( strncmp( argv[1],
"xview", (
size_t) length ) == 0 ) )
695 double width = (double) ( plPlotterPtr->xr - plPlotterPtr->xl );
699 type = Tk_GetScrollInfo( interp, argc, argv, &fraction, &count );
702 case TK_SCROLL_ERROR:
705 case TK_SCROLL_MOVETO:
706 plPlotterPtr->xl = (
PLFLT) fraction;
707 plPlotterPtr->xr = (
PLFLT) ( fraction + width );
709 case TK_SCROLL_PAGES:
710 plPlotterPtr->xl += (
PLFLT) ( count * width * .9 );
711 plPlotterPtr->xr += (
PLFLT) ( count * width * .9 );
713 case TK_SCROLL_UNITS:
714 plPlotterPtr->xl += (
PLFLT) ( count * width / 50 );
715 plPlotterPtr->xr += (
PLFLT) ( count * width / 50 );
718 if ( plPlotterPtr->xr > 1.0 )
720 plPlotterPtr->xr = 1.0;
721 plPlotterPtr->xl = (
PLFLT) ( 1.0 - width );
723 else if ( plPlotterPtr->xl < 0.0 )
725 plPlotterPtr->xl = 0.0;
726 plPlotterPtr->xr = (
PLFLT) width;
728 Scroll( interp, plPlotterPtr );
733 else if ( ( c ==
'y' ) && ( strncmp( argv[1],
"yview", (
size_t) length ) == 0 ) )
736 double height = plPlotterPtr->yr - plPlotterPtr->yl;
740 type = Tk_GetScrollInfo( interp, argc, argv, &fraction, &count );
743 case TK_SCROLL_ERROR:
746 case TK_SCROLL_MOVETO:
747 plPlotterPtr->yl = (
PLFLT) ( 1.0 - fraction - height );
748 plPlotterPtr->yr = (
PLFLT) ( 1.0 - fraction );
750 case TK_SCROLL_PAGES:
751 plPlotterPtr->yl -= (
PLFLT) ( count * height * .9 );
752 plPlotterPtr->yr -= (
PLFLT) ( count * height * .9 );
754 case TK_SCROLL_UNITS:
755 plPlotterPtr->yl -= (
PLFLT) ( count * height / 50 );
756 plPlotterPtr->yr -= (
PLFLT) ( count * height / 50 );
759 if ( plPlotterPtr->yr > 1.0 )
761 plPlotterPtr->yr = 1.0;
762 plPlotterPtr->yl = (
PLFLT) ( 1.0 - height );
764 else if ( plPlotterPtr->yl < 0.0 )
766 plPlotterPtr->yl = 0.0;
767 plPlotterPtr->yr = (
PLFLT) height;
769 Scroll( interp, plPlotterPtr );
776 Tcl_AppendResult( interp,
"bad option \"", argv[1],
777 "\": must be closelink, cmd, configure, draw, info, nextpage ",
778 "openlink, orient, page, print, redraw, save, view, ",
779 "xview, or yview", (
char *) NULL );
785 Tk_Release( (ClientData) plPlotterPtr );
810 register PLRDev *plr = plPlotterPtr->
plr;
817 if ( plPlotterPtr->
border != NULL )
819 Tk_Free3DBorder( plPlotterPtr->
border );
821 if ( plPlotterPtr->
plpr_cmd != NULL )
823 free( (
char *) plPlotterPtr->
plpr_cmd );
825 if ( plPlotterPtr->
cursor != None )
827 Tk_FreeCursor( plPlotterPtr->
display, plPlotterPtr->
cursor );
833 if ( plPlotterPtr->
xorGC != NULL )
835 Tk_FreeGC( plPlotterPtr->
display, plPlotterPtr->
xorGC );
845 if ( plPlotterPtr->
SaveFnam != NULL )
847 free( (
char *) plPlotterPtr->
SaveFnam );
849 if ( plPlotterPtr->
devDesc != NULL )
851 free( (
char *) plPlotterPtr->
devDesc );
853 if ( plPlotterPtr->
devName != NULL )
855 free( (
char *) plPlotterPtr->
devName );
861 free( (
char *) plPlotterPtr->
plr->
iodev );
870 free( (
char *) plPlotterPtr->
plr );
871 free( (
char *) plPlotterPtr );
895 register Tk_Window tkwin = plPlotterPtr->
tkwin;
899 switch ( eventPtr->type )
901 case ConfigureNotify:
902 pldebug(
"PLFrameConfigureEH",
"ConfigureNotify\n" );
904 plPlotterPtr->
width = Tk_Width( tkwin );
905 plPlotterPtr->
height = Tk_Height( tkwin );
915 pldebug(
"PLFrameConfigureEH",
"DestroyNotify\n" );
916 Tcl_DeleteCommand( plPlotterPtr->
interp, Tk_PathName( tkwin ) );
917 plPlotterPtr->
tkwin = NULL;
922 Tk_EventuallyFree( (ClientData) plPlotterPtr, (Tcl_FreeProc *)
DestroyPlPlotter );
926 pldebug(
"PLFrameConfigureEH",
"MapNotify\n" );
940 if ( !plPlotterPtr->tkwin_initted )
942 Tcl_VarEval( plPlotterPtr->interp,
"update", (
char *) NULL );
977 XExposeEvent *
event = (XExposeEvent *) eventPtr;
978 register Tk_Window tkwin = plPlotterPtr->
tkwin;
982 pldebug(
"PLFrameExposeEH",
"Expose\n" );
988 int x0_old, x1_old, y0_old, y1_old, x0_new, x1_new, y0_new, y1_new;
990 x0_old = (int) plPlotterPtr->
pldis.
x;
991 y0_old = (
int) plPlotterPtr->
pldis.
y;
992 x1_old = x0_old + (int) plPlotterPtr->
pldis.
width;
993 y1_old = y0_old + (
int) plPlotterPtr->
pldis.
height;
997 x1_new = x0_new +
event->width;
998 y1_new = y0_new +
event->height;
1000 plPlotterPtr->
pldis.
x = (
unsigned int)
MIN( x0_old, x0_new );
1001 plPlotterPtr->
pldis.
y = (
unsigned int)
MIN( y0_old, y0_new );
1008 if ( event->count == 0 )
1013 plPlotterPtr->width = Tk_Width( tkwin );
1014 plPlotterPtr->height = Tk_Height( tkwin );
1041 XMotionEvent *
event = (XMotionEvent *) eventPtr;
1047 DrawXhairs( plPlotterPtr, event->x, event->y );
1051 DrawRband( plPlotterPtr, event->x, event->y );
1075 XCrossingEvent *crossingEvent = (XCrossingEvent *) eventPtr;
1079 if ( plPlotterPtr->
xhairs )
1081 DrawXhairs( plPlotterPtr, crossingEvent->x, crossingEvent->y );
1084 if ( plPlotterPtr->
rband )
1088 DrawRband( plPlotterPtr, crossingEvent->x, crossingEvent->y );
1131 XButtonEvent *
event = (XButtonEvent *) eventPtr;
1134 switch ( event->state )
1141 if ( plPlotterPtr->
rband )
1156 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1158 int root_x, root_y, win_x, win_y;
1165 if ( XQueryPointer( plPlotterPtr->
display, Tk_WindowId( tkwin ),
1166 &root, &child, &root_x, &root_y, &win_x, &win_y,
1172 Tk_GetRootCoords( tkwin, &win_x, &win_y );
1173 win_x = root_x - win_x;
1174 win_y = root_y - win_y;
1176 if ( win_x >= 0 && win_x < Tk_Width( tkwin ) &&
1177 win_y >= 0 && win_y < Tk_Height( tkwin ) )
1209 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1210 int xmin = 0,
xmax = Tk_Width( tkwin ) - 1;
1211 int ymin = 0,
ymax = Tk_Height( tkwin ) - 1;
1216 plPlotterPtr->
xhair_x[0].x = (short) xmin; plPlotterPtr->
xhair_x[0].y = (short) y0;
1219 plPlotterPtr->
xhair_y[0].x = (short) x0; plPlotterPtr->
xhair_y[0].y = (short) ymin;
1234 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1236 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1240 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1254 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1256 int root_x, root_y, win_x, win_y;
1261 if ( XQueryPointer( plPlotterPtr->
display, Tk_WindowId( tkwin ),
1262 &root, &child, &root_x, &root_y, &win_x, &win_y,
1268 Tk_GetRootCoords( tkwin, &win_x, &win_y );
1269 win_x = root_x - win_x;
1270 win_y = root_y - win_y;
1272 if ( win_x >= 0 && win_x < Tk_Width( tkwin ) &&
1273 win_y >= 0 && win_y < Tk_Height( tkwin ) )
1276 plPlotterPtr->
rband_pt[0].x = (short) win_x;
1277 plPlotterPtr->
rband_pt[0].y = (short) win_y;
1279 DrawRband( plPlotterPtr, win_x, win_y );
1291 DrawRband( plPlotterPtr, win_x, win_y );
1326 plPlotterPtr->
rband_pt[1].x = (short) x0; plPlotterPtr->
rband_pt[1].y = (short) y0;
1340 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1342 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1351 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1366 plPlotterPtr->
width = Tk_Width( tkwin );
1367 plPlotterPtr->
height = Tk_Height( tkwin );
1402 if ( plPlotterPtr->
xhairs )
1405 if ( plPlotterPtr->
rband )
1431 #define INSTALL_COLORMAP_IN_TK
1432 #ifdef INSTALL_COLORMAP_IN_TK
1434 Tk_SetWindowColormap( Tk_MainWindow( plPlotterPtr->
interp ), dev->
tkwd->
map );
1446 Window top, colormap_windows[5];
1448 top = Tk_WindowId( Tk_MainWindow( plPlotterPtr->
interp ) );
1450 colormap_windows[count++] = Tk_WindowId( plPlotterPtr->
tkwin );
1451 colormap_windows[count++] = top;
1453 if ( !XSetWMColormapWindows( plPlotterPtr->
display,
1454 top, colormap_windows, count ) )
1455 fprintf( stderr,
"Unable to set color map property!\n" );
1480 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1498 if ( ( plPlotterPtr->
tkwin == NULL ) || !Tk_IsMapped( tkwin ) )
1523 if ( ( plPlotterPtr->
border != NULL ) &&
1524 ( plPlotterPtr->
relief != TK_RELIEF_FLAT ) )
1526 Tk_Draw3DRectangle( plPlotterPtr->
tkwin, Tk_WindowId( tkwin ),
1527 plPlotterPtr->
border, 0, 0, Tk_Width( tkwin ), Tk_Height( tkwin ),
1562 Tk_Draw3DRectangle( plPlotterPtr->
tkwin, Tk_WindowId( tkwin ),
1563 plPlotterPtr->
border, 0, 0, Tk_Width( tkwin ), Tk_Height( tkwin ),
1566 XClearWindow( plPlotterPtr->
display, Tk_WindowId( tkwin ) );
1568 XFlush( plPlotterPtr->
display );
1580 plPlotterPtr->
pldis.
x = (
unsigned int) ( Tk_X( tkwin ) + Tk_Width( tkwin ) );
1581 plPlotterPtr->
pldis.
y = (
unsigned int) ( Tk_Y( tkwin ) + Tk_Height( tkwin ) );
1582 plPlotterPtr->
pldis.
width = (
unsigned int) -Tk_Width( tkwin );
1583 plPlotterPtr->
pldis.
height = (
unsigned int) -Tk_Height( tkwin );
1614 int i, CONST
char *col,
int *p_changed )
1622 Tcl_AppendResult( interp,
"color value not specified",
1627 if ( !XParseColor( plPlotterPtr->
display,
1628 Tk_Colormap( plPlotterPtr->
tkwin ), col, &xcol ) )
1630 Tcl_AppendResult( interp,
"Couldn't parse color ", col,
1635 r = (unsigned) ( xcol.red & 0xFF00 ) >> 8;
1636 g = (unsigned) ( xcol.green & 0xFF00 ) >> 8;
1637 b = (unsigned) ( xcol.blue & 0xFF00 ) >> 8;
1639 if ( ( pls->
cmap0[i].
r != r ) ||
1640 ( pls->
cmap0[i].
g != g ) ||
1641 ( pls->
cmap0[i].
b != b ) )
1643 pls->
cmap0[i].
r = (
unsigned char) r;
1644 pls->
cmap0[i].
g = (
unsigned char) g;
1645 pls->
cmap0[i].
b = (
unsigned char) b;
1660 int i, CONST
char *col, CONST
char *pos, CONST
char *rev,
int *p_changed )
1664 PLFLT h, l, s, r, g, b, p;
1669 Tcl_AppendResult( interp,
"color value not specified",
1676 Tcl_AppendResult( interp,
"control point position not specified",
1683 Tcl_AppendResult( interp,
"interpolation sense not specified",
1688 if ( !XParseColor( plPlotterPtr->
display,
1689 Tk_Colormap( plPlotterPtr->
tkwin ), col, &xcol ) )
1691 Tcl_AppendResult( interp,
"Couldn't parse color ", col,
1696 r = (
PLFLT) ( ( (
unsigned) ( xcol.red & 0xFF00 ) >> 8 ) / 255.0 );
1697 g = (
PLFLT) ( ( (
unsigned) ( xcol.green & 0xFF00 ) >> 8 ) / 255.0 );
1698 b = (
PLFLT) ( ( (
unsigned) ( xcol.blue & 0xFF00 ) >> 8 ) / 255.0 );
1702 p = (
PLFLT) ( atof( pos ) / 100.0 );
1703 reverse = atoi( rev );
1736 int result = TCL_OK;
1737 char cmdlist[] =
"plgcmap0 plgcmap1 plscmap0 plscmap1 plscol0 plscol1";
1744 fprintf( stderr,
"There are %d arguments to Cmd:", argc );
1745 for ( i = 0; i <
argc; i++ )
1747 fprintf( stderr,
" %s", argv[i] );
1749 fprintf( stderr,
"\n" );
1756 return plTclCmd( cmdlist, interp, argc, argv );
1762 Tcl_VarEval( plPlotterPtr->
interp,
"update", (
char *) NULL );
1770 length = (int) strlen( argv[0] );
1775 if ( ( c3 ==
'g' ) && ( strncmp( argv[0],
"plgcmap0", (
size_t) length ) == 0 ) )
1778 unsigned long plcolor;
1781 sprintf( str,
"%d", (
int) pls->
ncol0 );
1782 Tcl_AppendElement( interp, str );
1783 for ( i = 0; i < pls->
ncol0; i++ )
1785 plcolor = (
unsigned long) ( ( pls->
cmap0[i].
r << 16 ) |
1786 ( pls->
cmap0[i].
g << 8 ) |
1789 sprintf( str,
"#%06lx", ( plcolor & 0xFFFFFF ) );
1790 Tcl_AppendElement( interp, str );
1799 else if ( ( c3 ==
'g' ) && ( strncmp( argv[0],
"plgcmap1", (
size_t) length ) == 0 ) )
1802 unsigned long plcolor;
1804 PLFLT h, l, s, r, g, b;
1807 sprintf( str,
"%d", (
int) pls->
ncp1 );
1808 Tcl_AppendElement( interp, str );
1809 for ( i = 0; i < pls->
ncp1; i++ )
1817 r1 =
MAX( 0,
MIN( 255, (
int) ( 256. * r ) ) );
1818 g1 =
MAX( 0,
MIN( 255, (
int) ( 256. * g ) ) );
1819 b1 =
MAX( 0,
MIN( 255, (
int) ( 256. * b ) ) );
1821 plcolor = (
unsigned long) ( ( r1 << 16 ) | ( g1 << 8 ) | ( b1 ) );
1823 sprintf( str,
"#%06lx", ( plcolor & 0xFFFFFF ) );
1824 Tcl_AppendElement( interp, str );
1826 sprintf( str,
"%02d", (
int) ( 100 * pls->
cmap1cp[i].
p ) );
1827 Tcl_AppendElement( interp, str );
1830 Tcl_AppendElement( interp, str );
1838 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscmap0", (
size_t) length ) == 0 ) )
1840 int i, changed = 1, ncol0 = atoi( argv[1] );
1843 if ( ncol0 > 16 || ncol0 < 1 )
1845 Tcl_AppendResult( interp,
"illegal number of colors in cmap0: ",
1846 argv[1], (
char *) NULL );
1851 for ( i = 0; i < pls->
ncol0; i++ )
1854 col = strtok( argv_cp,
" " );
1858 if (
scol0( interp, plPlotterPtr, i, col, &changed ) != TCL_OK )
1870 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscmap1", (
size_t) length ) == 0 ) )
1872 int i, changed = 1, ncp1 = atoi( argv[1] );
1873 char *col, *pos, *rev;
1875 if ( ncp1 > 32 || ncp1 < 1 )
1877 Tcl_AppendResult( interp,
1878 "illegal number of control points in cmap1: ",
1879 argv[1], (
char *) NULL );
1884 col = strtok( argv_cp,
" " );
1885 pos = strtok( NULL,
" " );
1886 rev = strtok( NULL,
" " );
1887 for ( i = 0; i < ncp1; i++ )
1892 if (
scol1( interp, plPlotterPtr,
1893 i, col, pos, rev, &changed ) != TCL_OK )
1896 col = strtok( NULL,
" " );
1897 pos = strtok( NULL,
" " );
1898 rev = strtok( NULL,
" " );
1913 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscol0", (
size_t) length ) == 0 ) )
1915 int i = atoi( argv[1] ), changed = 1;
1917 if ( i > pls->
ncol0 || i < 0 )
1919 Tcl_AppendResult( interp,
"illegal color number in cmap0: ",
1920 argv[1], (
char *) NULL );
1924 if (
scol0( interp, plPlotterPtr, i, argv[2], &changed ) != TCL_OK )
1934 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscol1", (
size_t) length ) == 0 ) )
1936 int i = atoi( argv[1] ), changed = 1;
1938 if ( i > pls->
ncp1 || i < 0 )
1940 Tcl_AppendResult( interp,
"illegal control point number in cmap1: ",
1941 argv[1], (
char *) NULL );
1945 if (
scol1( interp, plPlotterPtr,
1946 i, argv[2], argv[3], argv[4], &changed ) != TCL_OK )
1954 #ifdef USING_PLESC_COPY
1958 else if ( ( c3 ==
'c' ) && ( strncmp( argv[0],
"plcopy", (
size_t) length ) == 0 ) )
1963 Tcl_AppendResult( interp,
"Need exactly 6 arguments to copy.",
1967 xx[0] = atof( argv[1] );
1968 yy[0] = atof( argv[2] );
1969 xx[1] = atof( argv[3] );
1970 yy[1] = atof( argv[4] );
1971 xx[2] = atof( argv[5] );
1972 yy[2] = atof( argv[6] );
1980 result =
plTclCmd( cmdlist, interp, argc, argv );
1992 Tk_CreateEventHandler( plPlotterPtr->
tkwin, ButtonPressMask,
1995 Tk_CreateEventHandler( plPlotterPtr->tkwin, PointerMotionMask,
1998 Tk_CreateEventHandler( plPlotterPtr->tkwin, EnterWindowMask,
2001 Tk_CreateEventHandler( plPlotterPtr->tkwin, LeaveWindowMask,
2005 Tk_DefineCursor( plPlotterPtr->tkwin, plPlotterPtr->xhair_cursor );
2012 Tk_DeleteEventHandler( plPlotterPtr->
tkwin, ButtonPressMask,
2014 Tk_DeleteEventHandler( plPlotterPtr->tkwin, PointerMotionMask,
2017 Tk_DeleteEventHandler( plPlotterPtr->tkwin, EnterWindowMask,
2020 Tk_DeleteEventHandler( plPlotterPtr->tkwin, LeaveWindowMask,
2024 Tk_DefineCursor( plPlotterPtr->tkwin, plPlotterPtr->cursor );
2053 int argc, CONST
char **
argv,
int flags )
2055 register Tk_Window tkwin = plPlotterPtr->
tkwin;
2061 int need_redisplay = 0;
2067 fprintf( stderr,
"Arguments to configure are:" );
2068 for ( i = 0; i <
argc; i++ )
2070 fprintf( stderr,
" %s", argv[i] );
2072 fprintf( stderr,
"\n" );
2078 if ( Tk_ConfigureWidget( interp, tkwin,
configSpecs,
2079 argc, argv, (
char *) plPlotterPtr, flags ) != TCL_OK )
2092 Tk_3DBorderColor( plPlotterPtr->
border ) ) )
2100 Tk_SetWindowBackground( tkwin, tkwd->cmap0[0].pixel );
2101 Tk_SetWindowBorder( tkwin, tkwd->cmap0[0].pixel );
2105 gcValues.background = tkwd->cmap0[0].pixel;
2106 gcValues.foreground = 0xFF;
2107 gcValues.function = GXxor;
2108 mask = GCForeground | GCBackground | GCFunction;
2110 if ( plPlotterPtr->
xorGC != NULL )
2111 Tk_FreeGC( plPlotterPtr->
display, plPlotterPtr->
xorGC );
2113 plPlotterPtr->
xorGC = Tk_GetGC( plPlotterPtr->
tkwin, mask, &gcValues );
2117 Tk_SetInternalBorder( tkwin, plPlotterPtr->
borderWidth );
2118 if ( ( plPlotterPtr->
width > 0 ) || ( plPlotterPtr->
height > 0 ) )
2120 Tk_GeometryRequest( tkwin, plPlotterPtr->
width, plPlotterPtr->
height );
2128 if ( Tk_IsMapped( tkwin ) )
2130 if ( plPlotterPtr->
xhairs )
2144 if ( Tk_IsMapped( tkwin ) )
2146 if ( plPlotterPtr->
rband )
2176 if ( need_redisplay && Tk_IsMapped( tkwin )
2198 register Tk_Window tkwin = plPlotterPtr->
tkwin;
2199 int result = TCL_OK;
2200 char c = argv[0][0];
2201 int length = (int) strlen( argv[0] );
2207 Tcl_VarEval( plPlotterPtr->
interp,
"update", (
char *) NULL );
2212 if ( ( c ==
'i' ) && ( strncmp( argv[0],
"init", (
size_t) length ) == 0 ) )
2219 else if ( ( c ==
'e' ) && ( strncmp( argv[0],
"end", (
size_t) length ) == 0 ) )
2221 Tk_DefineCursor( tkwin, plPlotterPtr->
cursor );
2224 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2225 plPlotterPtr->
xorGC, plPlotterPtr->
pts, 5,
2227 XSync( Tk_Display( tkwin ), 0 );
2236 else if ( ( c ==
'r' ) && ( strncmp( argv[0],
"rect", (
size_t) length ) == 0 ) )
2240 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2241 " draw rect x0 y0 x1 y1\"", (
char *) NULL );
2247 int xmin = 0,
xmax = Tk_Width( tkwin ) - 1;
2248 int ymin = 0,
ymax = Tk_Height( tkwin ) - 1;
2250 x0 = atoi( argv[1] );
2251 y0 = atoi( argv[2] );
2252 x1 = atoi( argv[3] );
2253 y1 = atoi( argv[4] );
2262 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2263 plPlotterPtr->
xorGC, plPlotterPtr->
pts, 5,
2265 XSync( Tk_Display( tkwin ), 0 );
2268 plPlotterPtr->
pts[0].x = (short) x0; plPlotterPtr->
pts[0].y = (short) y0;
2269 plPlotterPtr->
pts[1].x = (short) x1; plPlotterPtr->
pts[1].y = (short) y0;
2270 plPlotterPtr->
pts[2].x = (short) x1; plPlotterPtr->
pts[2].y = (short) y1;
2271 plPlotterPtr->
pts[3].x = (short) x0; plPlotterPtr->
pts[3].y = (short) y1;
2272 plPlotterPtr->
pts[4].x = (short) x0; plPlotterPtr->
pts[4].y = (short) y0;
2274 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2275 plPlotterPtr->
xorGC, plPlotterPtr->
pts, 5,
2277 XSync( Tk_Display( tkwin ), 0 );
2299 int result = TCL_OK;
2305 Tcl_SetResult( interp,
"devkeys devnames", TCL_STATIC );
2310 length = (int) strlen( argv[0] );
2314 if ( ( c ==
'd' ) && ( strncmp( argv[0],
"devkeys", (
size_t) length ) == 0 ) )
2317 while ( plPlotterPtr->
devName[i] != NULL )
2318 Tcl_AppendElement( interp, plPlotterPtr->
devName[i++] );
2325 else if ( ( c ==
'd' ) && ( strncmp( argv[0],
"devnames", (
size_t) length ) == 0 ) )
2328 while ( plPlotterPtr->
devDesc[i] != NULL )
2329 Tcl_AppendElement( interp, plPlotterPtr->
devDesc[i++] );
2338 Tcl_AppendResult( interp,
"bad option to \"info\": must be ",
2339 "devkeys, devnames", (
char *) NULL );
2359 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2360 register PLRDev *plr = plPlotterPtr->
plr;
2363 char c = argv[0][0];
2364 int length = (int) strlen( argv[0] );
2370 if ( ( c ==
'f' ) && ( strncmp( argv[0],
"fifo", (
size_t) length ) == 0 ) )
2374 Tcl_AppendResult( interp,
"bad command -- must be: ",
2375 "openlink fifo <pathname>",
2379 if ( ( iodev->
fd = open( argv[1], O_RDONLY ) ) == -1 )
2381 Tcl_AppendResult( interp,
"cannot open fifo ", argv[1],
2382 " for read", (
char *) NULL );
2387 iodev->
file = fdopen( iodev->
fd,
"rb" );
2392 else if ( ( c ==
's' ) && ( strncmp( argv[0],
"socket", (
size_t) length ) == 0 ) )
2396 Tcl_AppendResult( interp,
"bad command -- must be: ",
2397 "openlink socket <sock-id>",
2405 if ( Tcl_GetOpenFile( interp, iodev->
fileHandle,
2406 0, 1, ( ClientData ) & iodev->
file ) != TCL_OK )
2410 iodev->
fd = fileno( iodev->
file );
2417 Tcl_AppendResult( interp,
"bad option to \"openlink\": must be ",
2418 "fifo or socket", (
char *) NULL );
2424 Tcl_CreateFileHandler( iodev->
fd,
2425 TK_READABLE, (Tk_FileProc *)
ReadData,
2426 (ClientData) plPlotterPtr );
2444 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2445 register PLRDev *plr = plPlotterPtr->
plr;
2450 if ( iodev->
fd == 0 )
2452 Tcl_AppendResult( interp,
"no link currently open", (
char *) NULL );
2456 Tcl_DeleteFileHandler( iodev->
fd );
2472 register PLRDev *plr = plPlotterPtr->
plr;
2474 int result = TCL_OK;
2480 Tcl_AppendResult( interp,
"unable to read from ", iodev->
typeName,
2490 if ( Tcl_Eval( interp, plPlotterPtr->
bopCmd ) != TCL_OK )
2491 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2492 plPlotterPtr->
bopCmd, Tcl_GetStringResult( interp ) );
2500 if ( Tcl_Eval( interp, plPlotterPtr->
eopCmd ) != TCL_OK )
2501 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2502 plPlotterPtr->
eopCmd, Tcl_GetStringResult( interp ) );
2510 if ( plPlotterPtr->
eopCmd != NULL )
2512 if ( Tcl_Eval( interp, plPlotterPtr->
eopCmd ) != TCL_OK )
2513 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2514 plPlotterPtr->
eopCmd, Tcl_GetStringResult( interp ) );
2520 if ( plPlotterPtr->
bopCmd != NULL )
2522 if ( Tcl_Eval( interp, plPlotterPtr->
bopCmd ) != TCL_OK )
2523 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2524 plPlotterPtr->
bopCmd, Tcl_GetStringResult( interp ) );
2539 register Tcl_Interp *interp = plPlotterPtr->
interp;
2541 register PLRDev *plr = plPlotterPtr->
plr;
2544 int result = TCL_OK;
2546 if ( mask & TK_READABLE )
2558 Tcl_AppendResult( interp,
"Packet receive failed:\n\t %s\n",
2559 Tcl_GetStringResult( interp ), (
char *) NULL );
2567 if ( pdfs->
bp == 0 )
2589 int result = TCL_OK;
2598 char result_str[128];
2600 sprintf( result_str,
"%f", rot );
2601 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2609 result =
Redraw( interp, plPlotterPtr, argc - 1, argv + 1 );
2633 int result = TCL_OK;
2636 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2644 Tcl_AppendResult( interp,
"Error -- widget not plotted to yet",
2654 Tcl_AppendResult( interp,
"Error -- cannot create stream",
2665 Tcl_AppendResult( interp,
2666 "Error -- cannot open plot file for writing",
2669 if ( sfnam != NULL )
2689 if ( plPlotterPtr->
plpr_cmd == NULL )
2692 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2693 if ( ( plPlotterPtr->
plpr_cmd == NULL ) || ( pid = fork() ) < 0 )
2695 Tcl_AppendResult( interp,
2696 "Error -- cannot fork print process",
2700 else if ( pid == 0 )
2705 fprintf( stderr,
"Unable to exec print command.\n" );
2732 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2733 " nextpage\"", (
char *) NULL );
2749 int argc, CONST
char **
argv )
2757 PLFLT mar, aspect, jx, jy;
2758 char result_str[128];
2760 plgdidev( &mar, &aspect, &jx, &jy );
2761 sprintf( result_str,
"%g %g %g %g", mar, aspect, jx, jy );
2762 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2770 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2771 " page mar aspect jx jy\"", (
char *) NULL );
2776 (
PLFLT) atof( argv[2] ), (
PLFLT) atof( argv[3] ) );
2777 return (
Redraw( interp, plPlotterPtr, argc - 1, argv + 1 ) );
2795 if ( ( plPlotterPtr->
tkwin != NULL ) &&
2814 int argc, CONST
char **
argv )
2824 Tcl_AppendResult( interp,
"Error -- widget not plotted to yet",
2835 Tcl_AppendResult( interp,
"Error -- no current save file",
2849 length = (int) strlen( argv[0] );
2853 if ( ( c ==
'a' ) && ( strncmp( argv[0],
"as", (
size_t) length ) == 0 ) )
2857 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2858 " save as device file\"", (
char *) NULL );
2875 Tcl_AppendResult( interp,
"Error -- cannot create stream",
2883 if ( ( sfile = fopen( argv[2],
"wb+" ) ) == NULL )
2885 Tcl_AppendResult( interp,
"Error -- cannot open file ", argv[2],
2886 " for writing", (
char *) NULL );
2908 else if ( ( c ==
'c' ) && ( strncmp( argv[0],
"close", (
size_t) length ) == 0 ) )
2912 Tcl_AppendResult( interp,
"Error -- no current save file",
2928 Tcl_AppendResult( interp,
"bad option to \"save\": must be ",
2929 "as or close", (
char *) NULL );
2946 int argc, CONST
char **
argv )
2959 char result_str[128];
2961 sprintf( result_str,
"%g %g %g %g", xl, yl, xr, yr );
2962 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2967 length = (int) strlen( argv[0] );
2972 if ( ( c ==
'b' ) && ( strncmp( argv[0],
"bounds", (
size_t) length ) == 0 ) )
2974 char result_str[128];
2978 sprintf( result_str,
"%g %g %g %g", xl, yl, xr, yr );
2979 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2985 if ( ( c ==
'r' ) && ( strncmp( argv[0],
"reset", (
size_t) length ) == 0 ) )
2990 if ( argc > 1 && ( strcmp( argv[1],
"wait" ) == 0 ) )
3000 else if ( ( c ==
's' ) && ( strncmp( argv[0],
"select", (
size_t) length ) == 0 ) )
3004 Tcl_AppendResult( interp,
"wrong # args: should be \"",
3005 " view select xmin ymin xmax ymax\"",
3011 gbox( &xl, &yl, &xr, &yr, argv + 1 );
3019 else if ( ( c ==
'z' ) && ( strncmp( argv[0],
"zoom", (
size_t) length ) == 0 ) )
3023 Tcl_AppendResult( interp,
"wrong # args: should be \"",
3024 " view zoom xmin ymin xmax ymax\"",
3030 gbox( &xl, &yl, &xr, &yr, argv + 1 );
3033 if ( argc > 5 && ( strcmp( argv[5],
"wait" ) == 0 ) )
3045 Tcl_AppendResult( interp,
"bad option \"", argv[1],
3046 "\": options to \"view\" are: bounds, reset, select, or zoom",
3055 plPlotterPtr->
xl =
xl;
3056 plPlotterPtr->
yl =
yl;
3057 plPlotterPtr->
xr =
xr;
3058 plPlotterPtr->
yr =
yr;
3067 return Redraw( interp, plPlotterPtr, argc, argv );
3082 plsdiplt( plPlotterPtr->
xl, plPlotterPtr->
yl, plPlotterPtr->
xr, plPlotterPtr->
yr );
3085 return (
Redraw( interp, plPlotterPtr, 0, NULL ) );
3098 int argc, CONST
char **
argv )
3106 Tcl_SetResult( interp,
"report what?", TCL_STATIC );
3110 if ( !strcmp( argv[0],
"wc" ) )
3117 Tcl_SetResult( interp,
"Wrong # of args: report wc x y", TCL_STATIC );
3121 x = (
PLFLT) atof( argv[1] );
3122 y = (
PLFLT) atof( argv[2] );
3131 snprintf( res, 40,
"%f %f", gin->wX, gin->wY );
3132 Tcl_SetResult( interp, res, TCL_VOLATILE );
3136 Tcl_SetResult( interp,
"Cannot locate", TCL_STATIC );
3140 Tcl_SetResult( interp,
"nonsensical request.", TCL_STATIC );
3163 sprintf(
string,
" %f %f", 1. - plPlotterPtr->
yr, 1. - plPlotterPtr->
yl );
3165 result = Tcl_VarEval( plPlotterPtr->
interp, plPlotterPtr->
yScrollCmd,
string,
3168 if ( result != TCL_OK )
3170 Tcl_BackgroundError( plPlotterPtr->
interp );
3189 sprintf(
string,
" %f %f", plPlotterPtr->
xl, plPlotterPtr->
xr );
3191 result = Tcl_VarEval( plPlotterPtr->
interp, plPlotterPtr->
xScrollCmd,
string,
3194 if ( result != TCL_OK )
3196 Tcl_BackgroundError( plPlotterPtr->
interp );
3210 PLFLT x0, y0, x1, y1;
3212 x0 = (
PLFLT) atof( argv[0] );
3213 y0 = (
PLFLT) atof( argv[1] );
3214 x1 = (
PLFLT) atof( argv[2] );
3215 y1 = (
PLFLT) atof( argv[3] );
3224 *xl =
MIN( x0, x1 );
3225 *yl =
MIN( y0, y1 );
3226 *xr =
MAX( x0, x1 );
3227 *yr =
MAX( y0, y1 );