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 20 // 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" );
375 plPlotterPtr->
tkwin = tkwin;
376 plPlotterPtr->
display = Tk_Display( tkwin );
379 Tcl_CreateCommand( interp, Tk_PathName( plPlotterPtr->
tkwin ),
381 (Tcl_CmdDeleteProc *) NULL );
382 plPlotterPtr->xorGC = NULL;
383 plPlotterPtr->border = NULL;
384 plPlotterPtr->cursor = None;
385 plPlotterPtr->xhair_cursor = None;
386 plPlotterPtr->flags = 0;
387 plPlotterPtr->width = Tk_Width( plPlotterPtr->tkwin );
388 plPlotterPtr->height = Tk_Height( plPlotterPtr->tkwin );
389 plPlotterPtr->prevWidth = 0;
390 plPlotterPtr->prevHeight = 0;
391 plPlotterPtr->continue_draw = 0;
392 plPlotterPtr->ipls = 0;
393 plPlotterPtr->ipls_save = 0;
394 plPlotterPtr->tkwin_initted = 0;
395 plPlotterPtr->plpr_cmd = NULL;
396 plPlotterPtr->bopCmd = NULL;
397 plPlotterPtr->eopCmd = NULL;
398 plPlotterPtr->xhairs = 0;
399 plPlotterPtr->active_plot = 1;
400 plPlotterPtr->isActive = 0;
401 plPlotterPtr->drawing_xhairs = 0;
402 plPlotterPtr->rband = 0;
403 plPlotterPtr->drawing_rband = 0;
404 plPlotterPtr->xScrollCmd = NULL;
405 plPlotterPtr->yScrollCmd = NULL;
406 plPlotterPtr->xl = 0.;
407 plPlotterPtr->yl = 0.;
408 plPlotterPtr->xr = 1.;
409 plPlotterPtr->yr = 1.;
410 plPlotterPtr->SaveFnam = NULL;
412 plPlotterPtr->plr = (
PLRDev *) malloc(
sizeof (
PLRDev ) );
413 plr = plPlotterPtr->plr;
421 plgpls( &plPlotterPtr->pls );
423 plPlotterPtr->pls->plPlotterPtr = plPlotterPtr;
427 plPlotterPtr->xhair_cursor =
428 Tk_GetCursor( plPlotterPtr->interp, plPlotterPtr->tkwin,
"crosshair" );
436 plPlotterPtr->devDesc = (
char **) malloc( (
size_t)
NDEV *
sizeof (
char ** ) );
437 plPlotterPtr->devName = (
char **) malloc( (
size_t)
NDEV *
sizeof (
char ** ) );
438 for ( i = 0; i <
NDEV; i++ )
440 plPlotterPtr->devDesc[i] = NULL;
441 plPlotterPtr->devName[i] = NULL;
444 plgFileDevs( (
const char ***) &plPlotterPtr->devDesc, (
const char ***) &plPlotterPtr->devName, &ndev );
448 Tk_CreateEventHandler( plPlotterPtr->tkwin, StructureNotifyMask,
451 Tk_CreateEventHandler( plPlotterPtr->tkwin, ExposureMask,
457 if (
ConfigurePlPlotter( interp, plPlotterPtr, argc - 2, (CONST
char **) argv + 2, 0 ) != TCL_OK )
459 Tk_DestroyWindow( plPlotterPtr->tkwin );
462 Tk_MakeWindowExist( plPlotterPtr->tkwin );
464 Tk_GeometryRequest( plPlotterPtr->tkwin, 200, 200 );
466 Tcl_SetResult( interp, Tk_PathName( plPlotterPtr->tkwin ), TCL_VOLATILE );
502 Tcl_AppendResult( interp,
"wrong # args: should be \"",
503 argv[0],
" option ?arg arg ...?\"", (
char *) NULL );
506 Tk_Preserve( (ClientData) plPlotterPtr );
508 length = (int) strlen( argv[1] );
512 if ( ( c ==
'c' ) && ( strncmp( argv[1],
"cmd", (
size_t) length ) == 0 ) )
514 result =
Cmd( interp, plPlotterPtr, argc - 2, argv + 2 );
519 else if ( ( c ==
'c' ) && ( strncmp( argv[1],
"cget", (
size_t) length ) == 0 )
524 Tcl_AppendResult( interp,
"wrong # args: should be \"",
525 argv[0],
" cget option\"",
530 result = Tk_ConfigureValue( interp, plPlotterPtr->tkwin,
configSpecs,
531 (
char *) plPlotterPtr, argv[2], 0 );
533 else if ( ( c ==
'c' ) && ( strncmp( argv[1],
"configure", (
size_t) length ) == 0 ) )
537 result = Tk_ConfigureInfo( interp, plPlotterPtr->tkwin,
configSpecs,
538 (
char *) plPlotterPtr, (
char *) NULL, 0 );
540 else if ( argc == 3 )
542 result = Tk_ConfigureInfo( interp, plPlotterPtr->tkwin,
configSpecs,
543 (
char *) plPlotterPtr, argv[2], 0 );
548 TK_CONFIG_ARGV_ONLY );
554 else if ( ( c ==
'c' ) && ( strncmp( argv[1],
"closelink", (
size_t) length ) == 0 ) )
558 Tcl_AppendResult( interp,
"wrong # args: should be \"",
559 argv[0], (
char *) NULL );
565 result =
Closelink( interp, plPlotterPtr, argc - 2, argv + 2 );
571 else if ( ( c ==
'd' ) && ( strncmp( argv[1],
"draw", (
size_t) length ) == 0 ) )
575 Tcl_AppendResult( interp,
"wrong # args: should be \"",
576 argv[0],
" draw op ?options?\"", (
char *) NULL );
582 result =
Draw( interp, plPlotterPtr, argc - 2, argv + 2 );
588 else if ( ( c ==
'i' ) && ( strncmp( argv[1],
"info", (
size_t) length ) == 0 ) )
590 result =
Info( interp, plPlotterPtr, argc - 2, argv + 2 );
595 else if ( ( c ==
'n' ) && ( strncmp( argv[1],
"nextpage", (
size_t) length ) == 0 ) )
597 result =
NextPage( interp, plPlotterPtr, argc - 2, argv + 2 );
602 else if ( ( c ==
'o' ) && ( strncmp( argv[1],
"orient", (
size_t) length ) == 0 ) )
604 result =
Orient( interp, plPlotterPtr, argc - 2, argv + 2 );
609 else if ( ( c ==
'o' ) && ( strncmp( argv[1],
"openlink", (
size_t) length ) == 0 ) )
613 Tcl_AppendResult( interp,
"wrong # args: should be \"",
614 argv[0],
" option ?arg arg ...?\"", (
char *) NULL );
620 result =
Openlink( interp, plPlotterPtr, argc - 2, argv + 2 );
626 else if ( ( c ==
'p' ) && ( strncmp( argv[1],
"page", (
size_t) length ) == 0 ) )
628 result =
Page( interp, plPlotterPtr, argc - 2, argv + 2 );
633 else if ( ( c ==
'p' ) && ( strncmp( argv[1],
"print", (
size_t) length ) == 0 ) )
635 result =
Print( interp, plPlotterPtr, argc - 2, argv + 2 );
640 else if ( ( c ==
'r' ) && ( strncmp( argv[1],
"redraw", (
size_t) length ) == 0 ) )
644 Tcl_AppendResult( interp,
"wrong # args: should be \"",
645 argv[0],
" redraw\"", (
char *) NULL );
651 result =
Redraw( interp, plPlotterPtr, argc - 2, argv + 2 );
657 else if ( ( c ==
'r' ) && ( strncmp( argv[1],
"report", (
size_t) length ) == 0 ) )
659 result =
report( interp, plPlotterPtr, argc - 2, argv + 2 );
664 else if ( ( c ==
's' ) && ( strncmp( argv[1],
"save", (
size_t) length ) == 0 ) )
666 result =
Save( interp, plPlotterPtr, argc - 2, argv + 2 );
671 else if ( ( c ==
'v' ) && ( strncmp( argv[1],
"view", (
size_t) length ) == 0 ) )
673 result =
View( interp, plPlotterPtr, argc - 2, argv + 2 );
678 else if ( ( c ==
'x' ) && ( strncmp( argv[1],
"xview", (
size_t) length ) == 0 ) )
681 double width = (double) ( plPlotterPtr->xr - plPlotterPtr->xl );
685 type = Tk_GetScrollInfo( interp, argc, argv, &fraction, &count );
688 case TK_SCROLL_ERROR:
691 case TK_SCROLL_MOVETO:
692 plPlotterPtr->xl = (
PLFLT) fraction;
693 plPlotterPtr->xr = (
PLFLT) ( fraction + width );
695 case TK_SCROLL_PAGES:
696 plPlotterPtr->xl += (
PLFLT) ( count * width * .9 );
697 plPlotterPtr->xr += (
PLFLT) ( count * width * .9 );
699 case TK_SCROLL_UNITS:
700 plPlotterPtr->xl += (
PLFLT) ( count * width / 50 );
701 plPlotterPtr->xr += (
PLFLT) ( count * width / 50 );
704 if ( plPlotterPtr->xr > 1.0 )
706 plPlotterPtr->xr = 1.0;
707 plPlotterPtr->xl = (
PLFLT) ( 1.0 - width );
709 else if ( plPlotterPtr->xl < 0.0 )
711 plPlotterPtr->xl = 0.0;
712 plPlotterPtr->xr = (
PLFLT) width;
714 Scroll( interp, plPlotterPtr );
719 else if ( ( c ==
'y' ) && ( strncmp( argv[1],
"yview", (
size_t) length ) == 0 ) )
722 double height = plPlotterPtr->yr - plPlotterPtr->yl;
726 type = Tk_GetScrollInfo( interp, argc, argv, &fraction, &count );
729 case TK_SCROLL_ERROR:
732 case TK_SCROLL_MOVETO:
733 plPlotterPtr->yl = (
PLFLT) ( 1.0 - fraction - height );
734 plPlotterPtr->yr = (
PLFLT) ( 1.0 - fraction );
736 case TK_SCROLL_PAGES:
737 plPlotterPtr->yl -= (
PLFLT) ( count * height * .9 );
738 plPlotterPtr->yr -= (
PLFLT) ( count * height * .9 );
740 case TK_SCROLL_UNITS:
741 plPlotterPtr->yl -= (
PLFLT) ( count * height / 50 );
742 plPlotterPtr->yr -= (
PLFLT) ( count * height / 50 );
745 if ( plPlotterPtr->yr > 1.0 )
747 plPlotterPtr->yr = 1.0;
748 plPlotterPtr->yl = (
PLFLT) ( 1.0 - height );
750 else if ( plPlotterPtr->yl < 0.0 )
752 plPlotterPtr->yl = 0.0;
753 plPlotterPtr->yr = (
PLFLT) height;
755 Scroll( interp, plPlotterPtr );
762 Tcl_AppendResult( interp,
"bad option \"", argv[1],
763 "\": must be closelink, cmd, configure, draw, info, nextpage ",
764 "openlink, orient, page, print, redraw, save, view, ",
765 "xview, or yview", (
char *) NULL );
771 Tk_Release( (ClientData) plPlotterPtr );
796 register PLRDev *plr = plPlotterPtr->
plr;
803 if ( plPlotterPtr->
border != NULL )
805 Tk_Free3DBorder( plPlotterPtr->
border );
807 if ( plPlotterPtr->
plpr_cmd != NULL )
809 free( (
char *) plPlotterPtr->
plpr_cmd );
811 if ( plPlotterPtr->
cursor != None )
813 Tk_FreeCursor( plPlotterPtr->
display, plPlotterPtr->
cursor );
819 if ( plPlotterPtr->
xorGC != NULL )
821 Tk_FreeGC( plPlotterPtr->
display, plPlotterPtr->
xorGC );
831 if ( plPlotterPtr->
SaveFnam != NULL )
833 free( (
char *) plPlotterPtr->
SaveFnam );
835 if ( plPlotterPtr->
devDesc != NULL )
837 free( (
char *) plPlotterPtr->
devDesc );
839 if ( plPlotterPtr->
devName != NULL )
841 free( (
char *) plPlotterPtr->
devName );
847 free( (
char *) plPlotterPtr->
plr->
iodev );
856 free( (
char *) plPlotterPtr->
plr );
857 free( (
char *) plPlotterPtr );
881 register Tk_Window tkwin = plPlotterPtr->
tkwin;
885 switch ( eventPtr->type )
887 case ConfigureNotify:
888 pldebug(
"PLFrameConfigureEH",
"ConfigureNotify\n" );
890 plPlotterPtr->
width = Tk_Width( tkwin );
891 plPlotterPtr->
height = Tk_Height( tkwin );
901 pldebug(
"PLFrameConfigureEH",
"DestroyNotify\n" );
902 Tcl_DeleteCommand( plPlotterPtr->
interp, Tk_PathName( tkwin ) );
903 plPlotterPtr->
tkwin = NULL;
908 Tk_EventuallyFree( (ClientData) plPlotterPtr, (Tcl_FreeProc *)
DestroyPlPlotter );
912 pldebug(
"PLFrameConfigureEH",
"MapNotify\n" );
926 if ( !plPlotterPtr->tkwin_initted )
928 Tcl_VarEval( plPlotterPtr->interp,
"update", (
char *) NULL );
963 XExposeEvent *
event = (XExposeEvent *) eventPtr;
964 register Tk_Window tkwin = plPlotterPtr->
tkwin;
968 pldebug(
"PLFrameExposeEH",
"Expose\n" );
974 int x0_old, x1_old, y0_old, y1_old, x0_new, x1_new, y0_new, y1_new;
976 x0_old = (int) plPlotterPtr->
pldis.
x;
977 y0_old = (
int) plPlotterPtr->
pldis.
y;
978 x1_old = x0_old + (int) plPlotterPtr->
pldis.
width;
979 y1_old = y0_old + (
int) plPlotterPtr->
pldis.
height;
983 x1_new = x0_new +
event->width;
984 y1_new = y0_new +
event->height;
986 plPlotterPtr->
pldis.
x = (
unsigned int)
MIN( x0_old, x0_new );
987 plPlotterPtr->
pldis.
y = (
unsigned int)
MIN( y0_old, y0_new );
994 if ( event->count == 0 )
999 plPlotterPtr->width = Tk_Width( tkwin );
1000 plPlotterPtr->height = Tk_Height( tkwin );
1027 XMotionEvent *
event = (XMotionEvent *) eventPtr;
1033 DrawXhairs( plPlotterPtr, event->x, event->y );
1037 DrawRband( plPlotterPtr, event->x, event->y );
1061 XCrossingEvent *crossingEvent = (XCrossingEvent *) eventPtr;
1065 if ( plPlotterPtr->
xhairs )
1067 DrawXhairs( plPlotterPtr, crossingEvent->x, crossingEvent->y );
1070 if ( plPlotterPtr->
rband )
1074 DrawRband( plPlotterPtr, crossingEvent->x, crossingEvent->y );
1117 XButtonEvent *
event = (XButtonEvent *) eventPtr;
1120 switch ( event->state )
1127 if ( plPlotterPtr->
rband )
1142 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1144 int root_x, root_y, win_x, win_y;
1151 if ( XQueryPointer( plPlotterPtr->
display, Tk_WindowId( tkwin ),
1152 &root, &child, &root_x, &root_y, &win_x, &win_y,
1158 Tk_GetRootCoords( tkwin, &win_x, &win_y );
1159 win_x = root_x - win_x;
1160 win_y = root_y - win_y;
1162 if ( win_x >= 0 && win_x < Tk_Width( tkwin ) &&
1163 win_y >= 0 && win_y < Tk_Height( tkwin ) )
1195 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1196 int xmin = 0,
xmax = Tk_Width( tkwin ) - 1;
1197 int ymin = 0,
ymax = Tk_Height( tkwin ) - 1;
1202 plPlotterPtr->
xhair_x[0].x = (short) xmin; plPlotterPtr->
xhair_x[0].y = (short) y0;
1205 plPlotterPtr->
xhair_y[0].x = (short) x0; plPlotterPtr->
xhair_y[0].y = (short) ymin;
1220 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1222 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1226 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1240 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1242 int root_x, root_y, win_x, win_y;
1247 if ( XQueryPointer( plPlotterPtr->
display, Tk_WindowId( tkwin ),
1248 &root, &child, &root_x, &root_y, &win_x, &win_y,
1254 Tk_GetRootCoords( tkwin, &win_x, &win_y );
1255 win_x = root_x - win_x;
1256 win_y = root_y - win_y;
1258 if ( win_x >= 0 && win_x < Tk_Width( tkwin ) &&
1259 win_y >= 0 && win_y < Tk_Height( tkwin ) )
1262 plPlotterPtr->
rband_pt[0].x = (short) win_x;
1263 plPlotterPtr->
rband_pt[0].y = (short) win_y;
1265 DrawRband( plPlotterPtr, win_x, win_y );
1277 DrawRband( plPlotterPtr, win_x, win_y );
1312 plPlotterPtr->
rband_pt[1].x = (short) x0; plPlotterPtr->
rband_pt[1].y = (short) y0;
1326 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1328 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1337 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1352 plPlotterPtr->
width = Tk_Width( tkwin );
1353 plPlotterPtr->
height = Tk_Height( tkwin );
1388 if ( plPlotterPtr->
xhairs )
1391 if ( plPlotterPtr->
rband )
1417 #define INSTALL_COLORMAP_IN_TK
1418 #ifdef INSTALL_COLORMAP_IN_TK
1420 Tk_SetWindowColormap( Tk_MainWindow( plPlotterPtr->
interp ), dev->
tkwd->
map );
1432 Window top, colormap_windows[5];
1434 top = Tk_WindowId( Tk_MainWindow( plPlotterPtr->
interp ) );
1436 colormap_windows[count++] = Tk_WindowId( plPlotterPtr->
tkwin );
1437 colormap_windows[count++] = top;
1439 if ( !XSetWMColormapWindows( plPlotterPtr->
display,
1440 top, colormap_windows, count ) )
1441 fprintf( stderr,
"Unable to set color map property!\n" );
1466 register Tk_Window tkwin = plPlotterPtr->
tkwin;
1484 if ( ( plPlotterPtr->
tkwin == NULL ) || !Tk_IsMapped( tkwin ) )
1509 if ( ( plPlotterPtr->
border != NULL ) &&
1510 ( plPlotterPtr->
relief != TK_RELIEF_FLAT ) )
1512 Tk_Draw3DRectangle( plPlotterPtr->
tkwin, Tk_WindowId( tkwin ),
1513 plPlotterPtr->
border, 0, 0, Tk_Width( tkwin ), Tk_Height( tkwin ),
1548 Tk_Draw3DRectangle( plPlotterPtr->
tkwin, Tk_WindowId( tkwin ),
1549 plPlotterPtr->
border, 0, 0, Tk_Width( tkwin ), Tk_Height( tkwin ),
1552 XClearWindow( plPlotterPtr->
display, Tk_WindowId( tkwin ) );
1554 XFlush( plPlotterPtr->
display );
1566 plPlotterPtr->
pldis.
x = (
unsigned int) ( Tk_X( tkwin ) + Tk_Width( tkwin ) );
1567 plPlotterPtr->
pldis.
y = (
unsigned int) ( Tk_Y( tkwin ) + Tk_Height( tkwin ) );
1568 plPlotterPtr->
pldis.
width = (
unsigned int) -Tk_Width( tkwin );
1569 plPlotterPtr->
pldis.
height = (
unsigned int) -Tk_Height( tkwin );
1600 int i, CONST
char *col,
int *p_changed )
1608 Tcl_AppendResult( interp,
"color value not specified",
1613 if ( !XParseColor( plPlotterPtr->
display,
1614 Tk_Colormap( plPlotterPtr->
tkwin ), col, &xcol ) )
1616 Tcl_AppendResult( interp,
"Couldn't parse color ", col,
1621 r = (unsigned) ( xcol.red & 0xFF00 ) >> 8;
1622 g = (unsigned) ( xcol.green & 0xFF00 ) >> 8;
1623 b = (unsigned) ( xcol.blue & 0xFF00 ) >> 8;
1625 if ( ( pls->
cmap0[i].
r != r ) ||
1626 ( pls->
cmap0[i].
g != g ) ||
1627 ( pls->
cmap0[i].
b != b ) )
1629 pls->
cmap0[i].
r = (
unsigned char) r;
1630 pls->
cmap0[i].
g = (
unsigned char) g;
1631 pls->
cmap0[i].
b = (
unsigned char) b;
1646 int i, CONST
char *col, CONST
char *pos, CONST
char *rev,
int *p_changed )
1650 PLFLT h, l, s, r, g, b, p;
1655 Tcl_AppendResult( interp,
"color value not specified",
1662 Tcl_AppendResult( interp,
"control point position not specified",
1669 Tcl_AppendResult( interp,
"interpolation sense not specified",
1674 if ( !XParseColor( plPlotterPtr->
display,
1675 Tk_Colormap( plPlotterPtr->
tkwin ), col, &xcol ) )
1677 Tcl_AppendResult( interp,
"Couldn't parse color ", col,
1682 r = (
PLFLT) ( ( (
unsigned) ( xcol.red & 0xFF00 ) >> 8 ) / 255.0 );
1683 g = (
PLFLT) ( ( (
unsigned) ( xcol.green & 0xFF00 ) >> 8 ) / 255.0 );
1684 b = (
PLFLT) ( ( (
unsigned) ( xcol.blue & 0xFF00 ) >> 8 ) / 255.0 );
1688 p = (
PLFLT) ( atof( pos ) / 100.0 );
1689 reverse = atoi( rev );
1722 int result = TCL_OK;
1723 char cmdlist[] =
"plgcmap0 plgcmap1 plscmap0 plscmap1 plscol0 plscol1";
1730 fprintf( stderr,
"There are %d arguments to Cmd:", argc );
1731 for ( i = 0; i <
argc; i++ )
1733 fprintf( stderr,
" %s", argv[i] );
1735 fprintf( stderr,
"\n" );
1742 return plTclCmd( cmdlist, interp, argc, argv );
1748 Tcl_VarEval( plPlotterPtr->
interp,
"update", (
char *) NULL );
1756 length = (int) strlen( argv[0] );
1761 if ( ( c3 ==
'g' ) && ( strncmp( argv[0],
"plgcmap0", (
size_t) length ) == 0 ) )
1764 unsigned long plcolor;
1767 sprintf( str,
"%d", (
int) pls->
ncol0 );
1768 Tcl_AppendElement( interp, str );
1769 for ( i = 0; i < pls->
ncol0; i++ )
1771 plcolor = (
unsigned long) ( ( pls->
cmap0[i].
r << 16 ) |
1772 ( pls->
cmap0[i].
g << 8 ) |
1775 sprintf( str,
"#%06lx", ( plcolor & 0xFFFFFF ) );
1776 Tcl_AppendElement( interp, str );
1785 else if ( ( c3 ==
'g' ) && ( strncmp( argv[0],
"plgcmap1", (
size_t) length ) == 0 ) )
1788 unsigned long plcolor;
1790 PLFLT h, l, s, r, g, b;
1793 sprintf( str,
"%d", (
int) pls->
ncp1 );
1794 Tcl_AppendElement( interp, str );
1795 for ( i = 0; i < pls->
ncp1; i++ )
1803 r1 =
MAX( 0,
MIN( 255, (
int) ( 256. * r ) ) );
1804 g1 =
MAX( 0,
MIN( 255, (
int) ( 256. * g ) ) );
1805 b1 =
MAX( 0,
MIN( 255, (
int) ( 256. * b ) ) );
1807 plcolor = (
unsigned long) ( ( r1 << 16 ) | ( g1 << 8 ) | ( b1 ) );
1809 sprintf( str,
"#%06lx", ( plcolor & 0xFFFFFF ) );
1810 Tcl_AppendElement( interp, str );
1812 sprintf( str,
"%02d", (
int) ( 100 * pls->
cmap1cp[i].
p ) );
1813 Tcl_AppendElement( interp, str );
1816 Tcl_AppendElement( interp, str );
1824 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscmap0", (
size_t) length ) == 0 ) )
1826 int i, changed = 1, ncol0 = atoi( argv[1] );
1829 if ( ncol0 > 16 || ncol0 < 1 )
1831 Tcl_AppendResult( interp,
"illegal number of colors in cmap0: ",
1832 argv[1], (
char *) NULL );
1837 for ( i = 0; i < pls->
ncol0; i++ )
1840 col = strtok( argv_cp,
" " );
1844 if (
scol0( interp, plPlotterPtr, i, col, &changed ) != TCL_OK )
1856 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscmap1", (
size_t) length ) == 0 ) )
1858 int i, changed = 1, ncp1 = atoi( argv[1] );
1859 char *col, *pos, *rev;
1861 if ( ncp1 > 32 || ncp1 < 1 )
1863 Tcl_AppendResult( interp,
1864 "illegal number of control points in cmap1: ",
1865 argv[1], (
char *) NULL );
1870 col = strtok( argv_cp,
" " );
1871 pos = strtok( NULL,
" " );
1872 rev = strtok( NULL,
" " );
1873 for ( i = 0; i < ncp1; i++ )
1878 if (
scol1( interp, plPlotterPtr,
1879 i, col, pos, rev, &changed ) != TCL_OK )
1882 col = strtok( NULL,
" " );
1883 pos = strtok( NULL,
" " );
1884 rev = strtok( NULL,
" " );
1899 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscol0", (
size_t) length ) == 0 ) )
1901 int i = atoi( argv[1] ), changed = 1;
1903 if ( i > pls->
ncol0 || i < 0 )
1905 Tcl_AppendResult( interp,
"illegal color number in cmap0: ",
1906 argv[1], (
char *) NULL );
1910 if (
scol0( interp, plPlotterPtr, i, argv[2], &changed ) != TCL_OK )
1920 else if ( ( c3 ==
's' ) && ( strncmp( argv[0],
"plscol1", (
size_t) length ) == 0 ) )
1922 int i = atoi( argv[1] ), changed = 1;
1924 if ( i > pls->
ncp1 || i < 0 )
1926 Tcl_AppendResult( interp,
"illegal control point number in cmap1: ",
1927 argv[1], (
char *) NULL );
1931 if (
scol1( interp, plPlotterPtr,
1932 i, argv[2], argv[3], argv[4], &changed ) != TCL_OK )
1940 #ifdef USING_PLESC_COPY
1944 else if ( ( c3 ==
'c' ) && ( strncmp( argv[0],
"plcopy", (
size_t) length ) == 0 ) )
1949 Tcl_AppendResult( interp,
"Need exactly 6 arguments to copy.",
1953 xx[0] = atof( argv[1] );
1954 yy[0] = atof( argv[2] );
1955 xx[1] = atof( argv[3] );
1956 yy[1] = atof( argv[4] );
1957 xx[2] = atof( argv[5] );
1958 yy[2] = atof( argv[6] );
1966 result =
plTclCmd( cmdlist, interp, argc, argv );
1978 Tk_CreateEventHandler( plPlotterPtr->
tkwin, ButtonPressMask,
1981 Tk_CreateEventHandler( plPlotterPtr->tkwin, PointerMotionMask,
1984 Tk_CreateEventHandler( plPlotterPtr->tkwin, EnterWindowMask,
1987 Tk_CreateEventHandler( plPlotterPtr->tkwin, LeaveWindowMask,
1991 Tk_DefineCursor( plPlotterPtr->tkwin, plPlotterPtr->xhair_cursor );
1998 Tk_DeleteEventHandler( plPlotterPtr->
tkwin, ButtonPressMask,
2000 Tk_DeleteEventHandler( plPlotterPtr->tkwin, PointerMotionMask,
2003 Tk_DeleteEventHandler( plPlotterPtr->tkwin, EnterWindowMask,
2006 Tk_DeleteEventHandler( plPlotterPtr->tkwin, LeaveWindowMask,
2010 Tk_DefineCursor( plPlotterPtr->tkwin, plPlotterPtr->cursor );
2039 int argc, CONST
char **
argv,
int flags )
2041 register Tk_Window tkwin = plPlotterPtr->
tkwin;
2047 int need_redisplay = 0;
2053 fprintf( stderr,
"Arguments to configure are:" );
2054 for ( i = 0; i <
argc; i++ )
2056 fprintf( stderr,
" %s", argv[i] );
2058 fprintf( stderr,
"\n" );
2064 if ( Tk_ConfigureWidget( interp, tkwin,
configSpecs,
2065 argc, argv, (
char *) plPlotterPtr, flags ) != TCL_OK )
2078 Tk_3DBorderColor( plPlotterPtr->
border ) ) )
2086 Tk_SetWindowBackground( tkwin, tkwd->cmap0[0].pixel );
2087 Tk_SetWindowBorder( tkwin, tkwd->cmap0[0].pixel );
2091 gcValues.background = tkwd->cmap0[0].pixel;
2092 gcValues.foreground = 0xFF;
2093 gcValues.function = GXxor;
2094 mask = GCForeground | GCBackground | GCFunction;
2096 if ( plPlotterPtr->
xorGC != NULL )
2097 Tk_FreeGC( plPlotterPtr->
display, plPlotterPtr->
xorGC );
2099 plPlotterPtr->
xorGC = Tk_GetGC( plPlotterPtr->
tkwin, mask, &gcValues );
2103 Tk_SetInternalBorder( tkwin, plPlotterPtr->
borderWidth );
2104 if ( ( plPlotterPtr->
width > 0 ) || ( plPlotterPtr->
height > 0 ) )
2106 Tk_GeometryRequest( tkwin, plPlotterPtr->
width, plPlotterPtr->
height );
2114 if ( Tk_IsMapped( tkwin ) )
2116 if ( plPlotterPtr->
xhairs )
2130 if ( Tk_IsMapped( tkwin ) )
2132 if ( plPlotterPtr->
rband )
2162 if ( need_redisplay && Tk_IsMapped( tkwin )
2184 register Tk_Window tkwin = plPlotterPtr->
tkwin;
2185 int result = TCL_OK;
2186 char c = argv[0][0];
2187 int length = (int) strlen( argv[0] );
2193 Tcl_VarEval( plPlotterPtr->
interp,
"update", (
char *) NULL );
2198 if ( ( c ==
'i' ) && ( strncmp( argv[0],
"init", (
size_t) length ) == 0 ) )
2205 else if ( ( c ==
'e' ) && ( strncmp( argv[0],
"end", (
size_t) length ) == 0 ) )
2207 Tk_DefineCursor( tkwin, plPlotterPtr->
cursor );
2210 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2211 plPlotterPtr->
xorGC, plPlotterPtr->
pts, 5,
2213 XSync( Tk_Display( tkwin ), 0 );
2222 else if ( ( c ==
'r' ) && ( strncmp( argv[0],
"rect", (
size_t) length ) == 0 ) )
2226 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2227 " draw rect x0 y0 x1 y1\"", (
char *) NULL );
2233 int xmin = 0,
xmax = Tk_Width( tkwin ) - 1;
2234 int ymin = 0,
ymax = Tk_Height( tkwin ) - 1;
2236 x0 = atoi( argv[1] );
2237 y0 = atoi( argv[2] );
2238 x1 = atoi( argv[3] );
2239 y1 = atoi( argv[4] );
2248 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2249 plPlotterPtr->
xorGC, plPlotterPtr->
pts, 5,
2251 XSync( Tk_Display( tkwin ), 0 );
2254 plPlotterPtr->
pts[0].x = (short) x0; plPlotterPtr->
pts[0].y = (short) y0;
2255 plPlotterPtr->
pts[1].x = (short) x1; plPlotterPtr->
pts[1].y = (short) y0;
2256 plPlotterPtr->
pts[2].x = (short) x1; plPlotterPtr->
pts[2].y = (short) y1;
2257 plPlotterPtr->
pts[3].x = (short) x0; plPlotterPtr->
pts[3].y = (short) y1;
2258 plPlotterPtr->
pts[4].x = (short) x0; plPlotterPtr->
pts[4].y = (short) y0;
2260 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2261 plPlotterPtr->
xorGC, plPlotterPtr->
pts, 5,
2263 XSync( Tk_Display( tkwin ), 0 );
2285 int result = TCL_OK;
2291 Tcl_SetResult( interp,
"devkeys devnames", TCL_STATIC );
2296 length = (int) strlen( argv[0] );
2300 if ( ( c ==
'd' ) && ( strncmp( argv[0],
"devkeys", (
size_t) length ) == 0 ) )
2303 while ( plPlotterPtr->
devName[i] != NULL )
2304 Tcl_AppendElement( interp, plPlotterPtr->
devName[i++] );
2311 else if ( ( c ==
'd' ) && ( strncmp( argv[0],
"devnames", (
size_t) length ) == 0 ) )
2314 while ( plPlotterPtr->
devDesc[i] != NULL )
2315 Tcl_AppendElement( interp, plPlotterPtr->
devDesc[i++] );
2324 Tcl_AppendResult( interp,
"bad option to \"info\": must be ",
2325 "devkeys, devnames", (
char *) NULL );
2345 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2346 register PLRDev *plr = plPlotterPtr->
plr;
2349 char c = argv[0][0];
2350 int length = (int) strlen( argv[0] );
2356 if ( ( c ==
'f' ) && ( strncmp( argv[0],
"fifo", (
size_t) length ) == 0 ) )
2360 Tcl_AppendResult( interp,
"bad command -- must be: ",
2361 "openlink fifo <pathname>",
2365 if ( ( iodev->
fd = open( argv[1], O_RDONLY ) ) == -1 )
2367 Tcl_AppendResult( interp,
"cannot open fifo ", argv[1],
2368 " for read", (
char *) NULL );
2373 iodev->
file = fdopen( iodev->
fd,
"rb" );
2378 else if ( ( c ==
's' ) && ( strncmp( argv[0],
"socket", (
size_t) length ) == 0 ) )
2382 Tcl_AppendResult( interp,
"bad command -- must be: ",
2383 "openlink socket <sock-id>",
2391 if ( Tcl_GetOpenFile( interp, iodev->
fileHandle,
2392 0, 1, ( ClientData ) & iodev->
file ) != TCL_OK )
2396 iodev->
fd = fileno( iodev->
file );
2403 Tcl_AppendResult( interp,
"bad option to \"openlink\": must be ",
2404 "fifo or socket", (
char *) NULL );
2410 Tcl_CreateFileHandler( iodev->
fd,
2411 TK_READABLE, (Tk_FileProc *)
ReadData,
2412 (ClientData) plPlotterPtr );
2430 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2431 register PLRDev *plr = plPlotterPtr->
plr;
2436 if ( iodev->
fd == 0 )
2438 Tcl_AppendResult( interp,
"no link currently open", (
char *) NULL );
2442 Tcl_DeleteFileHandler( iodev->
fd );
2458 register PLRDev *plr = plPlotterPtr->
plr;
2460 int result = TCL_OK;
2466 Tcl_AppendResult( interp,
"unable to read from ", iodev->
typeName,
2476 if ( Tcl_Eval( interp, plPlotterPtr->
bopCmd ) != TCL_OK )
2477 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2478 plPlotterPtr->
bopCmd, Tcl_GetStringResult( interp ) );
2486 if ( Tcl_Eval( interp, plPlotterPtr->
eopCmd ) != TCL_OK )
2487 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2488 plPlotterPtr->
eopCmd, Tcl_GetStringResult( interp ) );
2496 if ( plPlotterPtr->
eopCmd != NULL )
2498 if ( Tcl_Eval( interp, plPlotterPtr->
eopCmd ) != TCL_OK )
2499 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2500 plPlotterPtr->
eopCmd, Tcl_GetStringResult( interp ) );
2506 if ( plPlotterPtr->
bopCmd != NULL )
2508 if ( Tcl_Eval( interp, plPlotterPtr->
bopCmd ) != TCL_OK )
2509 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2510 plPlotterPtr->
bopCmd, Tcl_GetStringResult( interp ) );
2525 register Tcl_Interp *interp = plPlotterPtr->
interp;
2527 register PLRDev *plr = plPlotterPtr->
plr;
2530 int result = TCL_OK;
2532 if ( mask & TK_READABLE )
2544 Tcl_AppendResult( interp,
"Packet receive failed:\n\t %s\n",
2545 Tcl_GetStringResult( interp ), (
char *) NULL );
2553 if ( pdfs->
bp == 0 )
2575 int result = TCL_OK;
2584 char result_str[128];
2586 sprintf( result_str,
"%f", rot );
2587 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2595 result =
Redraw( interp, plPlotterPtr, argc - 1, argv + 1 );
2619 int result = TCL_OK;
2622 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2630 Tcl_AppendResult( interp,
"Error -- widget not plotted to yet",
2640 Tcl_AppendResult( interp,
"Error -- cannot create stream",
2651 Tcl_AppendResult( interp,
2652 "Error -- cannot open plot file for writing",
2655 if ( sfnam != NULL )
2675 if ( plPlotterPtr->
plpr_cmd == NULL )
2678 #if !defined ( MAC_TCL ) && !defined ( __WIN32__ )
2679 if ( ( plPlotterPtr->
plpr_cmd == NULL ) || ( pid = fork() ) < 0 )
2681 Tcl_AppendResult( interp,
2682 "Error -- cannot fork print process",
2686 else if ( pid == 0 )
2691 fprintf( stderr,
"Unable to exec print command.\n" );
2718 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2719 " nextpage\"", (
char *) NULL );
2735 int argc, CONST
char **
argv )
2743 PLFLT mar, aspect, jx, jy;
2744 char result_str[128];
2746 plgdidev( &mar, &aspect, &jx, &jy );
2747 sprintf( result_str,
"%g %g %g %g", mar, aspect, jx, jy );
2748 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2756 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2757 " page mar aspect jx jy\"", (
char *) NULL );
2762 (
PLFLT) atof( argv[2] ), (
PLFLT) atof( argv[3] ) );
2763 return (
Redraw( interp, plPlotterPtr, argc - 1, argv + 1 ) );
2781 if ( ( plPlotterPtr->
tkwin != NULL ) &&
2800 int argc, CONST
char **
argv )
2810 Tcl_AppendResult( interp,
"Error -- widget not plotted to yet",
2821 Tcl_AppendResult( interp,
"Error -- no current save file",
2835 length = (int) strlen( argv[0] );
2839 if ( ( c ==
'a' ) && ( strncmp( argv[0],
"as", (
size_t) length ) == 0 ) )
2843 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2844 " save as device file\"", (
char *) NULL );
2861 Tcl_AppendResult( interp,
"Error -- cannot create stream",
2869 if ( ( sfile = fopen( argv[2],
"wb+" ) ) == NULL )
2871 Tcl_AppendResult( interp,
"Error -- cannot open file ", argv[2],
2872 " for writing", (
char *) NULL );
2894 else if ( ( c ==
'c' ) && ( strncmp( argv[0],
"close", (
size_t) length ) == 0 ) )
2898 Tcl_AppendResult( interp,
"Error -- no current save file",
2914 Tcl_AppendResult( interp,
"bad option to \"save\": must be ",
2915 "as or close", (
char *) NULL );
2932 int argc, CONST
char **
argv )
2945 char result_str[128];
2947 sprintf( result_str,
"%g %g %g %g", xl, yl, xr, yr );
2948 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2953 length = (int) strlen( argv[0] );
2958 if ( ( c ==
'b' ) && ( strncmp( argv[0],
"bounds", (
size_t) length ) == 0 ) )
2960 char result_str[128];
2964 sprintf( result_str,
"%g %g %g %g", xl, yl, xr, yr );
2965 Tcl_SetResult( interp, result_str, TCL_VOLATILE );
2971 if ( ( c ==
'r' ) && ( strncmp( argv[0],
"reset", (
size_t) length ) == 0 ) )
2976 if ( argc > 1 && ( strcmp( argv[1],
"wait" ) == 0 ) )
2986 else if ( ( c ==
's' ) && ( strncmp( argv[0],
"select", (
size_t) length ) == 0 ) )
2990 Tcl_AppendResult( interp,
"wrong # args: should be \"",
2991 " view select xmin ymin xmax ymax\"",
2997 gbox( &xl, &yl, &xr, &yr, argv + 1 );
3005 else if ( ( c ==
'z' ) && ( strncmp( argv[0],
"zoom", (
size_t) length ) == 0 ) )
3009 Tcl_AppendResult( interp,
"wrong # args: should be \"",
3010 " view zoom xmin ymin xmax ymax\"",
3016 gbox( &xl, &yl, &xr, &yr, argv + 1 );
3019 if ( argc > 5 && ( strcmp( argv[5],
"wait" ) == 0 ) )
3031 Tcl_AppendResult( interp,
"bad option \"", argv[1],
3032 "\": options to \"view\" are: bounds, reset, select, or zoom",
3041 plPlotterPtr->
xl =
xl;
3042 plPlotterPtr->
yl =
yl;
3043 plPlotterPtr->
xr =
xr;
3044 plPlotterPtr->
yr =
yr;
3053 return Redraw( interp, plPlotterPtr, argc, argv );
3068 plsdiplt( plPlotterPtr->
xl, plPlotterPtr->
yl, plPlotterPtr->
xr, plPlotterPtr->
yr );
3071 return (
Redraw( interp, plPlotterPtr, 0, NULL ) );
3084 int argc, CONST
char **
argv )
3092 Tcl_SetResult( interp,
"report what?", TCL_STATIC );
3096 if ( !strcmp( argv[0],
"wc" ) )
3103 Tcl_SetResult( interp,
"Wrong # of args: report wc x y", TCL_STATIC );
3107 x = (
PLFLT) atof( argv[1] );
3108 y = (
PLFLT) atof( argv[2] );
3117 snprintf( res, 40,
"%f %f", gin->wX, gin->wY );
3118 Tcl_SetResult( interp, res, TCL_VOLATILE );
3122 Tcl_SetResult( interp,
"Cannot locate", TCL_STATIC );
3126 Tcl_SetResult( interp,
"nonsensical request.", TCL_STATIC );
3149 sprintf(
string,
" %f %f", 1. - plPlotterPtr->
yr, 1. - plPlotterPtr->
yl );
3151 result = Tcl_VarEval( plPlotterPtr->
interp, plPlotterPtr->
yScrollCmd,
string,
3154 if ( result != TCL_OK )
3156 Tcl_BackgroundError( plPlotterPtr->
interp );
3175 sprintf(
string,
" %f %f", plPlotterPtr->
xl, plPlotterPtr->
xr );
3177 result = Tcl_VarEval( plPlotterPtr->
interp, plPlotterPtr->
xScrollCmd,
string,
3180 if ( result != TCL_OK )
3182 Tcl_BackgroundError( plPlotterPtr->
interp );
3196 PLFLT x0, y0, x1, y1;
3198 x0 = (
PLFLT) atof( argv[0] );
3199 y0 = (
PLFLT) atof( argv[1] );
3200 x1 = (
PLFLT) atof( argv[2] );
3201 y1 = (
PLFLT) atof( argv[3] );
3210 *xl =
MIN( x0, x1 );
3211 *yl =
MIN( y0, y1 );
3212 *xr =
MAX( x0, x1 );
3213 *yr =
MAX( y0, y1 );
PLDLLIMPEXP_TCLTK int plTclCmd(char *cmdlist, Tcl_Interp *interp, int argc, const char **argv)
static int PlPlotterWidgetCmd(ClientData, Tcl_Interp *, int, CONST char **)
PLControlPt cmap1cp[PL_MAX_CMAP1CP]
static int Redraw(Tcl_Interp *, PlPlotter *, int, CONST char **)
static int Page(Tcl_Interp *, PlPlotter *, int, CONST char **)
int plr_process(PLRDev *plr)
static int scol0(Tcl_Interp *interp, register PlPlotter *plPlotterPtr, int i, CONST char *col, int *p_changed)
static int plplot_tkwin_ccmap
PDFstrm * pdf_bopen(U_CHAR *buffer, size_t bufmax)
static void PlPlotterConfigureEH(ClientData, XEvent *)
static void DrawRband(PlPlotter *, int, int)
static void PlPlotterLeaveEH(ClientData, register XEvent *)
void pldid2pc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax)
static int report(Tcl_Interp *, PlPlotter *, int, CONST char **)
FILE * pl_create_tempfile(char **fname)
static void DestroyXhairs(PlPlotter *)
static void DrawXhairs(PlPlotter *, int, int)
static void DestroyPlPlotter(ClientData)
#define DEF_PLFRAME_BORDER_WIDTH
static int Cmd(Tcl_Interp *, PlPlotter *, int, CONST char **)
void plr_start(PLRDev *plr)
static int scol1(Tcl_Interp *interp, register PlPlotter *plPlotterPtr, int i, CONST char *col, CONST char *pos, CONST char *rev, int *p_changed)
void PlplotterAtBop(Tcl_Interp *interp, register PlPlotter *plPlotterPtr)
void PLFLT PLINT PLINT PLFLT x
int plPlotterCmd(ClientData, Tcl_Interp *, int, const char **)
void pldip2dc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax)
#define DEF_PLFRAME_WIDTH
#define UPDATE_V_SCROLLBAR
static int NextPage(Tcl_Interp *, PlPlotter *, int, CONST char **)
char * plFindCommand(const char *fn)
static int process_data(Tcl_Interp *interp, register PlPlotter *plPlotterPtr)
void plD_open_tkwin(PLStream *pls)
static void DisplayPlPlotter(ClientData)
#define DEF_PLFRAME_BG_MONO
static int Closelink(Tcl_Interp *, PlPlotter *, int, CONST char **)
int plTranslateCursor(PLGraphicsIn *plg)
#define DEF_PLFRAME_CURSOR
int PLColor_from_TkColor_Changed(PLColor *plcolor, XColor *xcolor)
static void PlPlotterMotionEH(ClientData, register XEvent *)
static int Draw(Tcl_Interp *, PlPlotter *, int, CONST char **)
static Tk_ConfigSpec configSpecs[]
xl
set sign_dx [expr ($dx > 0) ? 1 : -1] set sign_dy [expr ($dy > 0) ? 1 : -1]
void PLFLT PLINT PLINT PLFLT PLFLT y
#define UPDATE_H_SCROLLBAR
static int Info(Tcl_Interp *, PlPlotter *, int, CONST char **)
struct PlPlotter PlPlotter
static int Orient(Tcl_Interp *, PlPlotter *, int, CONST char **)
#define DEF_PLFRAME_HEIGHT
static void UpdateHScrollbar(register PlPlotter *)
void PlplotterAtEop(Tcl_Interp *interp, register PlPlotter *plPlotterPtr)
void pl_cmd(PLINT op, void *ptr)
void plgFileDevs(const char ***p_menustr, const char ***p_devname, int *p_ndev)
static int View(Tcl_Interp *, PlPlotter *, int, CONST char **)
static void CreateXhairs(PlPlotter *)
char PLDLLIMPEXP * plstrdup(const char *src)
static int ConfigurePlPlotter(Tcl_Interp *, PlPlotter *, int, CONST char **, int)
static int ReadData(ClientData, int)
#define DEF_PLFRAME_RELIEF
PLDLLIMPEXP_TCLTK int pl_PacketReceive(Tcl_Interp *interp, PLiodev *iodev, PDFstrm *pdfs)
static void PlPlotterFirstInit(ClientData clientData)
static void UpdateVScrollbar(register PlPlotter *)
static void UpdateXhairs(PlPlotter *)
static void gbox(PLFLT *, PLFLT *, PLFLT *, PLFLT *, CONST char **)
static int Scroll(Tcl_Interp *, PlPlotter *)
int pdf_close(PDFstrm *pdfs)
static int Save(Tcl_Interp *, PlPlotter *, int, CONST char **)
static void UpdateRband(PlPlotter *)
#define DEF_PLFRAME_BG_COLOR
static void DestroyRband(PlPlotter *)
void pltkwin_setBGFG(PLStream *pls)
static Tcl_Interp * interp
static void PlPlotterEnterEH(ClientData, register XEvent *)
static void CreateRband(PlPlotter *)
static void PlPlotterButtonPressEH(ClientData clientData, register XEvent *)
static void PlPlotterInit(ClientData)
static void ActiveState(register PlPlotter *plPlotterPtr, int on)
static void PlPlotterExposeEH(ClientData, XEvent *)
void plgpls(PLStream **p_pls)
static int Openlink(Tcl_Interp *, PlPlotter *, int, CONST char **)
static void Install_cmap(PlPlotter *plPlotterPtr)
static int Print(Tcl_Interp *, PlPlotter *, int, CONST char **)