55#ifdef PL_HAVE_UNISTD_H
74#define plframe_cmd( code ) \
75 if ( ( code ) == TCL_ERROR ) return ( TCL_ERROR );
79#if TCL_MAJOR_VERSION <= 7 && TCL_MINOR_VERSION <= 4
80#define Tk_Cursor Cursor
103 Tcl_Command widgetCmd;
192#define REFRESH_PENDING 1
193#define RESIZE_PENDING 2
194#define REDRAW_PENDING 4
195#define UPDATE_V_SCROLLBAR 8
196#define UPDATE_H_SCROLLBAR 16
200#define DEF_PLFRAME_BG_COLOR "Black"
201#define DEF_PLFRAME_BG_MONO "White"
202#define DEF_PLFRAME_BORDER_WIDTH "0"
203#define DEF_PLFRAME_CURSOR ( (char *) NULL )
204#define DEF_PLFRAME_HEIGHT "0"
205#define DEF_PLFRAME_RELIEF "flat"
206#define DEF_PLFRAME_WIDTH "0"
211 { TK_CONFIG_BORDER,
"-background",
"background",
"Background",
213 TK_CONFIG_COLOR_ONLY, NULL },
220 { TK_CONFIG_COLOR,
"-plbg",
"plbackground",
"Plbackground",
222 TK_CONFIG_COLOR_ONLY, NULL },
224 { TK_CONFIG_BORDER,
"-background",
"background",
"Background",
226 TK_CONFIG_MONO_ONLY, NULL },
233 { TK_CONFIG_COLOR,
"-plbg", (
char *) NULL, (
char *) NULL,
235 TK_CONFIG_MONO_ONLY, NULL },
237 { TK_CONFIG_SYNONYM,
"-bd",
"borderWidth", (
char *) NULL,
238 (
char *) NULL, 0, 0, NULL },
239 { TK_CONFIG_SYNONYM,
"-bg",
"background", (
char *) NULL,
240 (
char *) NULL, 0, 0, NULL },
241 { TK_CONFIG_PIXELS,
"-borderwidth",
"borderWidth",
"BorderWidth",
243 { TK_CONFIG_ACTIVE_CURSOR,
"-cursor",
"cursor",
"Cursor",
245 { TK_CONFIG_STRING,
"-bopcmd",
"bopcmd",
"PgCommand",
246 (
char *) NULL, offsetof(
PlFrame, bopCmd ), TK_CONFIG_NULL_OK, NULL },
247 { TK_CONFIG_STRING,
"-eopcmd",
"eopcmd",
"PgCommand",
248 (
char *) NULL, offsetof(
PlFrame, eopCmd ), TK_CONFIG_NULL_OK, NULL },
249 { TK_CONFIG_PIXELS,
"-height",
"height",
"Height",
251 { TK_CONFIG_RELIEF,
"-relief",
"relief",
"Relief",
253 { TK_CONFIG_PIXELS,
"-width",
"width",
"Width",
255 { TK_CONFIG_BOOLEAN,
"-xhairs", (
char *) NULL, (
char *) NULL,
256 "0", offsetof(
PlFrame, xhairs ), TK_CONFIG_DONT_SET_DEFAULT, NULL },
257 { TK_CONFIG_BOOLEAN,
"-rubberband", (
char *) NULL, (
char *) NULL,
258 "0", offsetof(
PlFrame, rband ), TK_CONFIG_DONT_SET_DEFAULT, NULL },
259 { TK_CONFIG_STRING,
"-xscrollcommand",
"xScrollCommand",
"ScrollCommand",
260 (
char *) NULL, offsetof(
PlFrame, xScrollCmd ), TK_CONFIG_NULL_OK, NULL },
261 { TK_CONFIG_STRING,
"-yscrollcommand",
"yScrollCommand",
"ScrollCommand",
262 (
char *) NULL, offsetof(
PlFrame, yScrollCmd ), TK_CONFIG_NULL_OK, NULL },
263 { TK_CONFIG_END, (
char *) NULL, (
char *) NULL, (
char *) NULL,
264 (
char *) NULL, 0, 0, NULL }
271int plFrameCmd( ClientData, Tcl_Interp *,
int,
const char ** );
275#if TK_MAJOR_VERSION >= 9
276#define FreeProcArg void *
278#define FreeProcArg char *
289static void PlFrameKeyEH( ClientData,
register XEvent * );
291static int ReadData( ClientData,
int );
297static int Cmd( Tcl_Interp *,
PlFrame *,
int,
const char ** );
369 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
370 argv[0],
" pathName ?options?\"", (
char *) NULL );
376 new = Tk_CreateWindowFromPath(
interp, Tk_MainWindow(
interp ),
377 argv[1], (
char *) NULL );
388 plFramePtr->
tkwin =
new;
389 plFramePtr->
display = Tk_Display(
new );
392 plFramePtr->
border = NULL;
395 plFramePtr->
width = Tk_Width( plFramePtr->
tkwin );
396 plFramePtr->
height = Tk_Height( plFramePtr->
tkwin );
397 plFramePtr->
cursor = None;
398 plFramePtr->
flags = 0;
416 plFramePtr->
xorGC = NULL;
426 plFramePtr->
bopCmd = NULL;
427 plFramePtr->
eopCmd = NULL;
432 plFramePtr->
rband = 0;
436 plr = plFramePtr->
plr;
446 Tk_GetCursor( plFramePtr->
interp, plFramePtr->
tkwin,
"crosshair" );
458 plFramePtr->
devDesc = (
const char **) ckalloc(
NDEV *
sizeof (
char ** ) );
459 plFramePtr->
devName = (
const char **) ckalloc(
NDEV *
sizeof (
char ** ) );
460 for ( i = 0; i <
NDEV; i++ )
470 Tk_SetClass( plFramePtr->
tkwin,
"Plframe" );
472 Tk_CreateEventHandler( plFramePtr->
tkwin, StructureNotifyMask,
475 Tk_CreateEventHandler( plFramePtr->
tkwin, ExposureMask,
479 plFramePtr->widgetCmd =
481 Tcl_CreateCommand(
interp, Tk_PathName( plFramePtr->
tkwin ),
482 (Tcl_CmdProc *)
PlFrameWidgetCmd, (ClientData) plFramePtr, (Tcl_CmdDeleteProc *) NULL );
484 Itk_SetWidgetCommand( plFramePtr->
tkwin, plFramePtr->widgetCmd );
490 Itk_SetWidgetCommand( plFramePtr->
tkwin, (Tcl_Command) NULL );
492 Tk_DestroyWindow( plFramePtr->
tkwin );
495 Tcl_SetResult(
interp, Tk_PathName( plFramePtr->
tkwin ), TCL_VOLATILE );
535 printf(
"Current stream %d, frame stream %d\n",
537 printf(
"PlFrameWidgetCmd: " );
538 for ( i = 0; i <
argc; i++ )
539 printf(
" %s",
argv[i] );
546 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
547 argv[0],
" option ?arg arg ...?\"", (
char *) NULL );
550 Tcl_Preserve( (ClientData) plFramePtr );
552 length = (int) strlen(
argv[1] );
560 if ( ( c ==
'c' ) && ( strncmp(
argv[1],
"cmd", (
size_t) length ) == 0 ) )
567 else if ( ( c ==
'c' ) && ( strncmp(
argv[1],
"cget", (
size_t) length ) == 0 ) )
571 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
572 argv[0],
" cget <option>\"", (
char *) NULL );
579 (
char *) plFramePtr, (
char *) NULL, 0 );
585 else if ( ( c ==
'c' ) && ( strncmp(
argv[1],
"configure", (
size_t) length ) == 0 ) )
590 (
char *) plFramePtr, (
char *) NULL, 0 );
592 else if (
argc == 3 )
595 (
char *) plFramePtr,
argv[2], 0 );
600 TK_CONFIG_ARGV_ONLY );
606 else if ( ( c ==
'd' ) &&
607 ( ( strncmp(
argv[1],
"db", (
size_t) length ) == 0 ) ||
608 ( strncmp(
argv[1],
"doublebuffering", (
size_t) length == 0 ) ) ) )
614 if ( strcmp(
argv[2],
"on" ) == 0 )
619 if ( strcmp(
argv[2],
"off" ) == 0 )
624 if ( strcmp(
argv[2],
"query" ) == 0 )
628 snprintf( res, 20,
"%d", bcb.
result );
629 Tcl_SetResult(
interp, res, TCL_VOLATILE );
638 else if ( ( c ==
'c' ) && ( strncmp(
argv[1],
"closelink", (
size_t) length ) == 0 ) )
642 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
643 argv[0], (
char *) NULL );
655 else if ( ( c ==
'd' ) && ( strncmp(
argv[1],
"draw", (
size_t) length ) == 0 ) )
659 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
660 argv[0],
" draw op ?options?\"", (
char *) NULL );
672 else if ( ( ( c ==
'g' ) && ( ( strncmp(
argv[1],
"gcmap0", (
size_t) length ) == 0 ) ||
673 ( strncmp(
argv[1],
"gcmap1", (
size_t) length ) == 0 ) ) ) ||
674 ( ( c ==
's' ) && ( ( strncmp(
argv[1],
"scmap0", (
size_t) length ) == 0 ) ||
675 ( strncmp(
argv[1],
"scmap1", (
size_t) length ) == 0 ) ||
676 ( strncmp(
argv[1],
"scol0", (
size_t) length ) == 0 ) ||
677 ( strncmp(
argv[1],
"scol1", (
size_t) length ) == 0 ) ) ) )
682 else if ( ( c ==
'i' ) && ( strncmp(
argv[1],
"info", (
size_t) length ) == 0 ) )
689 else if ( ( c ==
'o' ) && ( strncmp(
argv[1],
"orient", (
size_t) length ) == 0 ) )
696 else if ( ( c ==
'o' ) && ( strncmp(
argv[1],
"openlink", (
size_t) length ) == 0 ) )
700 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
701 argv[0],
" option ?arg arg ...?\"", (
char *) NULL );
713 else if ( ( c ==
'p' ) && ( strncmp(
argv[1],
"page", (
size_t) length ) == 0 ) )
720 else if ( ( c ==
'p' ) && ( strncmp(
argv[1],
"print", (
size_t) length ) == 0 ) )
727 else if ( ( c ==
'r' ) && ( strncmp(
argv[1],
"redraw", (
size_t) length ) == 0 ) )
731 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
732 argv[0],
" redraw\"", (
char *) NULL );
744 else if ( ( c ==
'r' ) && ( strncmp(
argv[1],
"report", (
size_t) length ) == 0 ) )
751 else if ( ( c ==
's' ) && ( strncmp(
argv[1],
"save", (
size_t) length ) == 0 ) )
758 else if ( ( c ==
'v' ) && ( strncmp(
argv[1],
"view", (
size_t) length ) == 0 ) )
765 else if ( ( c ==
'x' ) && ( strncmp(
argv[1],
"xscroll", (
size_t) length ) == 0 ) )
769 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
770 argv[0],
" xscroll pixel\"", (
char *) NULL );
782 else if ( ( c ==
'y' ) && ( strncmp(
argv[1],
"yscroll", (
size_t) length ) == 0 ) )
786 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
787 argv[0],
" yscroll pixel\"", (
char *) NULL );
801 Tcl_AppendResult(
interp,
"bad option \"",
argv[1],
802 "\": must be closelink, cmd, configure, draw, ",
804 "info, openlink, orient, page, print, redraw, save, ",
805 "scmap0, scmap1, scol0, scol1, ",
806 "view, xscroll, or yscroll", (
char *) NULL );
810 printf(
"bad option!\n" );
815 printf(
"result=%d current stream=%d\n", result, plsc->ipls );
819 Tcl_Release( (ClientData) plFramePtr );
849 if ( plFramePtr->
border != NULL )
851 Tk_Free3DBorder( plFramePtr->
border );
853 if ( plFramePtr->
bgColor != NULL )
855 Tk_FreeColor( plFramePtr->
bgColor );
859 ckfree( (
char *) plFramePtr->
plpr_cmd );
861 if ( plFramePtr->
cursor != None )
869 if ( plFramePtr->
xorGC != NULL )
883 ckfree( (
char *) plFramePtr->
SaveFnam );
885 if ( plFramePtr->
devDesc != NULL )
887 ckfree( (
char *) plFramePtr->
devDesc );
889 if ( plFramePtr->
devName != NULL )
891 ckfree( (
char *) plFramePtr->
devName );
897 ckfree( (
char *) plFramePtr->
plr->
iodev );
906 ckfree( (
char *) plFramePtr->
plr );
907 ckfree( (
char *) plFramePtr );
931 register Tk_Window tkwin = plFramePtr->
tkwin;
935 switch ( eventPtr->type )
937 case ConfigureNotify:
938 pldebug(
"PLFrameConfigureEH",
"ConfigureNotify\n" );
940 plFramePtr->
width = Tk_Width( tkwin );
941 plFramePtr->
height = Tk_Height( tkwin );
951 pldebug(
"PLFrameConfigureEH",
"DestroyNotify\n" );
953 Itk_SetWidgetCommand( plFramePtr->
tkwin, (Tcl_Command) NULL );
954 Tcl_DeleteCommand2( plFramePtr->
interp, plFramePtr->widgetCmd );
956 Tcl_DeleteCommand( plFramePtr->
interp, Tk_PathName( tkwin ) );
958 plFramePtr->
tkwin = NULL;
967 pldebug(
"PLFrameConfigureEH",
"MapNotify\n" );
978 if ( !plFramePtr->tkwin_initted )
980 Tcl_VarEval( plFramePtr->interp,
"update", (
char *) NULL );
982 Tcl_DoWhenIdle(
PlFrameInit, (ClientData) plFramePtr );
1012 XExposeEvent *
event = (XExposeEvent *) eventPtr;
1013 register Tk_Window tkwin = plFramePtr->
tkwin;
1017 pldebug(
"PLFrameExposeEH",
"Expose\n" );
1023 int x0_old, x1_old, y0_old, y1_old, x0_new, x1_new, y0_new, y1_new;
1025 x0_old = (int) plFramePtr->
pldis.
x;
1026 y0_old = (int) plFramePtr->
pldis.
y;
1027 x1_old = x0_old + (int) plFramePtr->
pldis.
width;
1032 x1_new = x0_new +
event->width;
1033 y1_new = y0_new +
event->height;
1035 plFramePtr->
pldis.
x = (
unsigned int)
MIN( x0_old, x0_new );
1036 plFramePtr->
pldis.
y = (
unsigned int)
MIN( y0_old, y0_new );
1043 if ( event->count == 0 )
1048 plFramePtr->width = Tk_Width( tkwin );
1049 plFramePtr->height = Tk_Height( tkwin );
1076 XMotionEvent *
event = (XMotionEvent *) eventPtr;
1082 DrawXhairs( plFramePtr, event->x, event->y );
1086 DrawRband( plFramePtr, event->x, event->y );
1110 XCrossingEvent *crossingEvent = (XCrossingEvent *) eventPtr;
1114 if ( plFramePtr->
xhairs )
1116 DrawXhairs( plFramePtr, crossingEvent->x, crossingEvent->y );
1119 if ( plFramePtr->
rband )
1123 DrawRband( plFramePtr, crossingEvent->x, crossingEvent->y );
1186 XKeyEvent *
event = (XKeyEvent *) eventPtr;
1187 register Tk_Window tkwin = plFramePtr->
tkwin;
1196#if !defined ( _WIN32 )
1197 nchars = XLookupString( event,
string, 10, &keysym, &cs );
1201 string[nchars] =
'\0';
1202 pldebug(
"PlFrameKeyEH",
"Keysym %x, translation: %s\n", keysym,
string );
1204 if ( IsModifierKey( keysym ) )
1208 else if ( IsCursorKey( keysym ) )
1210 int x1, y1, dx = 0, dy = 0;
1211 int x0 =
event->x, y0 =
event->y;
1212 int xmin = 0, xmax = Tk_Width( tkwin ) - 1;
1213 int ymin = 0, ymax = Tk_Height( tkwin ) - 1;
1235 if ( event->state & 0x01 )
1243 if ( event->state & 0x02 )
1251 if ( event->state & 0x04 )
1259 if ( event->state & 0x08 )
1281 XWarpPointer( plFramePtr->
display, Tk_WindowId( tkwin ),
1282 None, 0, 0, 0, 0, dx, dy );
1296 register Tk_Window tkwin = plFramePtr->
tkwin;
1298 int root_x, root_y, win_x, win_y;
1308 if ( XQueryPointer( plFramePtr->
display, Tk_WindowId( tkwin ),
1309 &root, &
child, &root_x, &root_y, &win_x, &win_y,
1312 if ( win_x >= 0 && win_x < Tk_Width( tkwin ) &&
1313 win_y >= 0 && win_y < Tk_Height( tkwin ) )
1324 Tk_CreateEventHandler( tkwin, PointerMotionMask,
1327 Tk_CreateEventHandler( tkwin, EnterWindowMask,
1330 Tk_CreateEventHandler( tkwin, LeaveWindowMask,
1336 Tk_CreateEventHandler( tkwin, KeyPressMask,
1349 register Tk_Window tkwin = plFramePtr->
tkwin;
1353 Tk_DefineCursor( tkwin, plFramePtr->
cursor );
1359 Tk_DeleteEventHandler( tkwin, PointerMotionMask,
1362 Tk_DeleteEventHandler( tkwin, EnterWindowMask,
1365 Tk_DeleteEventHandler( tkwin, LeaveWindowMask,
1369 Tk_DeleteEventHandler( tkwin, KeyPressMask,
1387 register Tk_Window tkwin = plFramePtr->
tkwin;
1388 int xmin = 0, xmax = Tk_Width( tkwin ) - 1;
1389 int ymin = 0, ymax = Tk_Height( tkwin ) - 1;
1394 plFramePtr->
xhair_x[0].x = (short) xmin; plFramePtr->
xhair_x[0].y = (short) y0;
1395 plFramePtr->
xhair_x[1].x = (short) xmax; plFramePtr->
xhair_x[1].y = (short) y0;
1397 plFramePtr->
xhair_y[0].x = (short) x0; plFramePtr->
xhair_y[0].y = (short) ymin;
1398 plFramePtr->
xhair_y[1].x = (short) x0; plFramePtr->
xhair_y[1].y = (short) ymax;
1412 register Tk_Window tkwin = plFramePtr->
tkwin;
1414 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1418 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1432 register Tk_Window tkwin = plFramePtr->
tkwin;
1434 int root_x, root_y, win_x, win_y;
1439 if ( XQueryPointer( plFramePtr->
display, Tk_WindowId( tkwin ),
1440 &root, &
child, &root_x, &root_y, &win_x, &win_y,
1443 if ( win_x >= 0 && win_x < Tk_Width( tkwin ) &&
1444 win_y >= 0 && win_y < Tk_Height( tkwin ) )
1447 plFramePtr->
rband_pt[0].x = (short) win_x;
1448 plFramePtr->
rband_pt[0].y = (short) win_y;
1471 Tk_CreateEventHandler( tkwin, PointerMotionMask,
1474 Tk_CreateEventHandler( tkwin, EnterWindowMask,
1477 Tk_CreateEventHandler( tkwin, LeaveWindowMask,
1491 register Tk_Window tkwin = plFramePtr->
tkwin;
1497 Tk_DeleteEventHandler( tkwin, PointerMotionMask,
1500 Tk_DeleteEventHandler( tkwin, EnterWindowMask,
1503 Tk_DeleteEventHandler( tkwin, LeaveWindowMask,
1527 plFramePtr->
rband_pt[1].x = (short) x0; plFramePtr->
rband_pt[1].y = (short) y0;
1541 register Tk_Window tkwin = plFramePtr->
tkwin;
1543 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
1568 register Tk_Window tkwin = plFramePtr->
tkwin;
1589 if ( plFramePtr->
bopCmd != NULL )
1591 if ( plFramePtr->eopCmd != NULL )
1596 plFramePtr->tkwin_initted = 1;
1597 plFramePtr->width = Tk_Width( tkwin );
1598 plFramePtr->height = Tk_Height( tkwin );
1599 plFramePtr->prevWidth = plFramePtr->width;
1600 plFramePtr->prevHeight = plFramePtr->height;
1607 if ( plFramePtr->
xhairs )
1610 if ( plFramePtr->
rband )
1636#define INSTALL_COLORMAP_IN_TK
1637#ifdef INSTALL_COLORMAP_IN_TK
1639 Tk_SetWindowColormap( Tk_MainWindow( plFramePtr->
interp ), dev->
xwd->
map );
1651 Window top, colormap_windows[5];
1653 top = Tk_WindowId( Tk_MainWindow( plFramePtr->
interp ) );
1655 colormap_windows[count++] = Tk_WindowId( plFramePtr->
tkwin );
1656 colormap_windows[count++] = top;
1658 if ( !XSetWMColormapWindows( plFramePtr->
display,
1659 top, colormap_windows, count ) )
1660 fprintf( stderr,
"Unable to set color map property!\n" );
1685 register Tk_Window tkwin = plFramePtr->
tkwin;
1703 if ( ( plFramePtr->
tkwin == NULL ) || !Tk_IsMapped( tkwin ) )
1711 if ( ( plFramePtr->
border != NULL ) &&
1712 ( plFramePtr->
relief != TK_RELIEF_FLAT ) )
1714#if TK_MAJOR_VERSION >= 4 && TK_MINOR_VERSION >= 0
1715 Tk_Draw3DRectangle( plFramePtr->
tkwin, Tk_WindowId( tkwin ),
1716 plFramePtr->
border, 0, 0, Tk_Width( tkwin ), Tk_Height( tkwin ),
1719 Tk_Draw3DRectangle( plFramePtr->
display, Tk_WindowId( tkwin ),
1720 plFramePtr->
border, 0, 0, Tk_Width( tkwin ), Tk_Height( tkwin ),
1772 XClearWindow( plFramePtr->
display, Tk_WindowId( tkwin ) );
1773 XFlush( plFramePtr->
display );
1783 plFramePtr->
pldis.
x = (
unsigned int) ( Tk_X( tkwin ) + Tk_Width( tkwin ) );
1784 plFramePtr->
pldis.
y = (
unsigned int) ( Tk_Y( tkwin ) + Tk_Height( tkwin ) );
1785 plFramePtr->
pldis.
width = (
unsigned int) ( -Tk_Width( tkwin ) );
1786 plFramePtr->
pldis.
height = (
unsigned int) ( -Tk_Height( tkwin ) );
1817 int i,
const char *col,
int *p_changed )
1825 Tcl_AppendResult(
interp,
"color value not specified",
1830 if ( !XParseColor( plFramePtr->
display,
1831 Tk_Colormap( plFramePtr->
tkwin ), col, &xcol ) )
1833 Tcl_AppendResult(
interp,
"Couldn't parse color ", col,
1838 r = (unsigned) ( xcol.red & 0xFF00 ) >> 8;
1839 g = (unsigned) ( xcol.green & 0xFF00 ) >> 8;
1840 b = (unsigned) ( xcol.blue & 0xFF00 ) >> 8;
1842 if ( (
pls->cmap0[i].r != r ) ||
1843 (
pls->cmap0[i].g != g ) ||
1844 (
pls->cmap0[i].b != b ) )
1846 pls->cmap0[i].r = (
unsigned char) r;
1847 pls->cmap0[i].g = (
unsigned char) g;
1848 pls->cmap0[i].b = (
unsigned char) b;
1863 int i,
const char *col,
const char *pos,
const char *rev,
int *p_changed )
1867 PLFLT h, l, s, r, g, b, p;
1872 Tcl_AppendResult(
interp,
"color value not specified",
1879 Tcl_AppendResult(
interp,
"control point position not specified",
1886 Tcl_AppendResult(
interp,
"interpolation sense not specified",
1891 if ( !XParseColor( plFramePtr->
display,
1892 Tk_Colormap( plFramePtr->
tkwin ), col, &xcol ) )
1894 Tcl_AppendResult(
interp,
"Couldn't parse color ", col,
1899 r = ( (unsigned) ( xcol.red & 0xFF00 ) >> 8 ) / 255.0;
1900 g = ( (unsigned) ( xcol.green & 0xFF00 ) >> 8 ) / 255.0;
1901 b = ( (unsigned) ( xcol.blue & 0xFF00 ) >> 8 ) / 255.0;
1905 p = atof( pos ) / 100.0;
1906 reverse = atoi( rev );
1908 if ( (
pls->cmap1cp[i].c1 != h ) ||
1909 (
pls->cmap1cp[i].c2 != l ) ||
1910 (
pls->cmap1cp[i].c3 != s ) ||
1911 (
pls->cmap1cp[i].p != p ) ||
1912 (
pls->cmap1cp[i].alt_hue_path != reverse ) )
1914 pls->cmap1cp[i].c1 = h;
1915 pls->cmap1cp[i].c2 = l;
1916 pls->cmap1cp[i].c3 = s;
1917 pls->cmap1cp[i].p = p;
1918 pls->cmap1cp[i].alt_hue_path = reverse;
1949 int result = TCL_OK;
1956 fprintf( stderr,
"There are %d arguments to ColorManip:",
argc );
1957 for ( i = 0; i <
argc; i++ )
1959 fprintf( stderr,
" %s",
argv[i] );
1961 fprintf( stderr,
"\n" );
1971 Tcl_VarEval( plFramePtr->
interp,
"update", (
char *) NULL );
1979 length = (int) strlen(
argv[0] );
1984 if ( ( c ==
'g' ) && ( strncmp(
argv[0],
"gcmap0", (
size_t) length ) == 0 ) )
1987 unsigned long plcolor;
1990 sprintf( str,
"%d", (
int)
pls->ncol0 );
1991 Tcl_AppendElement(
interp, str );
1992 for ( i = 0; i <
pls->ncol0; i++ )
1994 plcolor = (
unsigned long) ( (
pls->cmap0[i].r << 16 ) |
1995 (
pls->cmap0[i].g << 8 ) |
1996 (
pls->cmap0[i].b ) );
1998 sprintf( str,
"#%06lx", ( plcolor & 0xFFFFFF ) );
1999 Tcl_AppendElement(
interp, str );
2008 else if ( ( c ==
'g' ) && ( strncmp(
argv[0],
"gcmap1", (
size_t) length ) == 0 ) )
2011 unsigned long plcolor;
2013 PLFLT h, l, s, r, g, b;
2016 sprintf( str,
"%d", (
int)
pls->ncp1 );
2017 Tcl_AppendElement(
interp, str );
2018 for ( i = 0; i <
pls->ncp1; i++ )
2020 h =
pls->cmap1cp[i].c1;
2021 l =
pls->cmap1cp[i].c2;
2022 s =
pls->cmap1cp[i].c3;
2026 r1 =
MAX( 0,
MIN( 255, (
int) ( 256. * r ) ) );
2027 g1 =
MAX( 0,
MIN( 255, (
int) ( 256. * g ) ) );
2028 b1 =
MAX( 0,
MIN( 255, (
int) ( 256. * b ) ) );
2030 plcolor = (
unsigned long) ( ( r1 << 16 ) | ( g1 << 8 ) | (
b1 ) );
2032 sprintf( str,
"#%06lx", ( plcolor & 0xFFFFFF ) );
2033 Tcl_AppendElement(
interp, str );
2035 sprintf( str,
"%02d", (
int) ( 100 *
pls->cmap1cp[i].p ) );
2036 Tcl_AppendElement(
interp, str );
2038 sprintf( str,
"%01d", (
int) (
pls->cmap1cp[i].alt_hue_path ) );
2039 Tcl_AppendElement(
interp, str );
2047 else if ( ( c ==
's' ) && ( strncmp(
argv[0],
"scmap0", (
size_t) length ) == 0 ) )
2049 int i, changed = 1, ncol0 = atoi(
argv[1] );
2052 if ( ncol0 > 16 || ncol0 < 1 )
2054 Tcl_AppendResult(
interp,
"illegal number of colors in cmap0: ",
2055 argv[1], (
char *) NULL );
2060 tmpstring = (
char *) malloc( strlen(
argv[2] ) + 1 );
2062 col = strtok( tmpstring,
" " );
2063 for ( i = 0; i <
pls->ncol0; i++ )
2068 if (
scol0(
interp, plFramePtr, i, col, &changed ) != TCL_OK )
2071 col = strtok( NULL,
" " );
2082 else if ( ( c ==
's' ) && ( strncmp(
argv[0],
"scmap1", (
size_t) length ) == 0 ) )
2084 int i, changed = 1, ncp1 = atoi(
argv[1] );
2085 char *col, *pos, *rev;
2087 if ( ncp1 > 32 || ncp1 < 1 )
2089 Tcl_AppendResult(
interp,
2090 "illegal number of control points in cmap1: ",
2091 argv[1], (
char *) NULL );
2095 tmpstring = (
char *) malloc( strlen(
argv[2] ) + 1 );
2097 col = strtok( tmpstring,
" " );
2098 pos = strtok( NULL,
" " );
2099 rev = strtok( NULL,
" " );
2100 for ( i = 0; i < ncp1; i++ )
2106 i, col, pos, rev, &changed ) != TCL_OK )
2109 col = strtok( NULL,
" " );
2110 pos = strtok( NULL,
" " );
2111 rev = strtok( NULL,
" " );
2125 else if ( ( c ==
's' ) && ( strncmp(
argv[0],
"scol0", (
size_t) length ) == 0 ) )
2127 int i = atoi(
argv[1] ), changed = 1;
2129 if ( i >
pls->ncol0 || i < 0 )
2131 Tcl_AppendResult(
interp,
"illegal color number in cmap0: ",
2132 argv[1], (
char *) NULL );
2146 else if ( ( c ==
's' ) && ( strncmp(
argv[0],
"scol1", (
size_t) length ) == 0 ) )
2148 int i = atoi(
argv[1] ), changed = 1;
2150 if ( i >
pls->ncp1 || i < 0 )
2152 Tcl_AppendResult(
interp,
"illegal control point number in cmap1: ",
2153 argv[1], (
char *) NULL );
2181 int result = TCL_OK;
2182 char cmdlist[] =
"";
2189 fprintf( stderr,
"There are %d arguments to Cmd:",
argc );
2190 for ( i = 0; i <
argc; i++ )
2192 fprintf( stderr,
" %s",
argv[i] );
2194 fprintf( stderr,
"\n" );
2207 Tcl_VarEval( plFramePtr->
interp,
"update", (
char *) NULL );
2236 int argc,
const char **
argv,
char *widgRec,
int flags )
2238#if TK_MAJOR_VERSION >= 9
2239 Tcl_Obj **objv = NULL;
2245 objv = (Tcl_Obj **) Tcl_Alloc( (
size_t)
argc *
sizeof( Tcl_Obj * ) );
2248 Tcl_SetResult(
interp,
"out of memory", TCL_STATIC );
2252 for ( i = 0; i <
argc; i++ )
2254 objv[i] = Tcl_NewStringObj(
argv[i], -1 );
2259 (Tcl_Obj *
const *) objv, widgRec, flags );
2263 for ( i = 0; i <
argc; i++ )
2265 Tcl_DecrRefCount( objv[i] );
2267 Tcl_Free( (
char *) objv );
2279 int argc,
const char **
argv,
int flags )
2281 register Tk_Window tkwin = plFramePtr->
tkwin;
2287 int need_redisplay = 0;
2293 fprintf( stderr,
"Arguments to configure are:" );
2294 for ( i = 0; i <
argc; i++ )
2296 fprintf( stderr,
" %s",
argv[i] );
2298 fprintf( stderr,
"\n" );
2305 argc, (
const char **)
argv, (
char *) plFramePtr, flags ) != TCL_OK )
2321 Tk_SetWindowBackground( tkwin, xwd->
cmap0[0].pixel );
2322 Tk_SetWindowBorder( tkwin, xwd->
cmap0[0].pixel );
2326 gcValues.background = xwd->
cmap0[0].pixel;
2327 gcValues.foreground = 0xFF;
2328 gcValues.function = GXxor;
2329 mask = GCForeground | GCBackground | GCFunction;
2331 if ( plFramePtr->
xorGC != NULL )
2334 plFramePtr->
xorGC = Tk_GetGC( plFramePtr->
tkwin, mask, &gcValues );
2338 Tk_SetInternalBorder( tkwin, plFramePtr->
borderWidth );
2339 if ( ( plFramePtr->
width > 0 ) || ( plFramePtr->
height > 0 ) )
2341 Tk_GeometryRequest( tkwin, plFramePtr->
width, plFramePtr->
height );
2349 if ( Tk_IsMapped( tkwin ) )
2351 if ( plFramePtr->
xhairs )
2365 if ( Tk_IsMapped( tkwin ) )
2367 if ( plFramePtr->
rband )
2381 if ( need_redisplay && Tk_IsMapped( tkwin )
2403 register Tk_Window tkwin = plFramePtr->
tkwin;
2404 int result = TCL_OK;
2405 char c =
argv[0][0];
2406 int length = (int) strlen(
argv[0] );
2412 Tcl_VarEval( plFramePtr->
interp,
"update", (
char *) NULL );
2417 if ( ( c ==
'i' ) && ( strncmp(
argv[0],
"init", (
size_t) length ) == 0 ) )
2424 else if ( ( c ==
'e' ) && ( strncmp(
argv[0],
"end", (
size_t) length ) == 0 ) )
2426 Tk_DefineCursor( tkwin, plFramePtr->
cursor );
2429 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2430 plFramePtr->
xorGC, plFramePtr->
pts, 5,
2432 XSync( Tk_Display( tkwin ), 0 );
2441 else if ( ( c ==
'r' ) && ( strncmp(
argv[0],
"rect", (
size_t) length ) == 0 ) )
2445 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
2446 " draw rect x0 y0 x1 y1\"", (
char *) NULL );
2452 int xmin = 0, xmax = Tk_Width( tkwin ) - 1;
2453 int ymin = 0, ymax = Tk_Height( tkwin ) - 1;
2455 x0 = atoi(
argv[1] );
2456 y0 = atoi(
argv[2] );
2457 x1 = atoi(
argv[3] );
2458 y1 = atoi(
argv[4] );
2460 x0 =
MAX( xmin,
MIN( xmax, x0 ) );
2461 y0 =
MAX( ymin,
MIN( ymax, y0 ) );
2462 x1 =
MAX( xmin,
MIN( xmax, x1 ) );
2463 y1 =
MAX( ymin,
MIN( ymax, y1 ) );
2467 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2468 plFramePtr->
xorGC, plFramePtr->
pts, 5,
2470 XSync( Tk_Display( tkwin ), 0 );
2473 plFramePtr->
pts[0].x = (short) x0; plFramePtr->
pts[0].y = (short) y0;
2474 plFramePtr->
pts[1].x = (short) x1; plFramePtr->
pts[1].y = (short) y0;
2475 plFramePtr->
pts[2].x = (short) x1; plFramePtr->
pts[2].y = (short) y1;
2476 plFramePtr->
pts[3].x = (short) x0; plFramePtr->
pts[3].y = (short) y1;
2477 plFramePtr->
pts[4].x = (short) x0; plFramePtr->
pts[4].y = (short) y0;
2479 XDrawLines( Tk_Display( tkwin ), Tk_WindowId( tkwin ),
2480 plFramePtr->
xorGC, plFramePtr->
pts, 5,
2482 XSync( Tk_Display( tkwin ), 0 );
2504 int result = TCL_OK;
2510 Tcl_SetResult(
interp,
"devkeys devnames", TCL_STATIC );
2515 length = (int) strlen(
argv[0] );
2519 if ( ( c ==
'd' ) && ( strncmp(
argv[0],
"devkeys", (
size_t) length ) == 0 ) )
2522 while ( plFramePtr->
devName[i] != NULL )
2530 else if ( ( c ==
'd' ) && ( strncmp(
argv[0],
"devnames", (
size_t) length ) == 0 ) )
2533 while ( plFramePtr->
devDesc[i] != NULL )
2543 Tcl_AppendResult(
interp,
"bad option to \"info\": must be ",
2544 "devkeys, devnames", (
char *) NULL );
2567 char c =
argv[0][0];
2568 int length = (int) strlen(
argv[0] );
2574 if ( ( c ==
'f' ) && ( strncmp(
argv[0],
"fifo", (
size_t) length ) == 0 ) )
2578 Tcl_AppendResult(
interp,
"bad command -- must be: ",
2579 "openlink fifo <pathname>",
2583#if !defined ( _WIN32 )
2584 if ( ( iodev->
fd = open(
argv[1], O_RDONLY ) ) == -1 )
2589 Tcl_AppendResult(
interp,
"cannot open fifo ",
argv[1],
2590 " for read", (
char *) NULL );
2595#if !defined ( _WIN32 )
2596 iodev->
file = fdopen( iodev->
fd,
"rb" );
2604 else if ( ( c ==
's' ) && ( strncmp(
argv[0],
"socket", (
size_t) length ) == 0 ) )
2608 Tcl_AppendResult(
interp,
"bad command -- must be: ",
2609 "openlink socket <sock-id>",
2617#if TCL_MAJOR_VERSION < 7 || ( TCL_MAJOR_VERSION == 7 && TCL_MINOR_VERSION == 4 )
2620#define FILECAST ( ClientData )
2624#if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
2631 iodev->
fd = fileno( iodev->
file );
2638 Tcl_AppendResult(
interp,
"bad option to \"openlink\": must be ",
2639 "fifo or socket", (
char *) NULL );
2647#if TK_MAJOR_VERSION < 4 || \
2648 ( TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION == 0 ) || \
2649 TK_MAJOR_VERSION > 7
2650#if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
2651#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
2652 Tcl_CreateFileHandler( iodev->
fd, TCL_READABLE, (Tcl_FileProc *)
ReadData,
2653 (
void *) plFramePtr );
2655 Tcl_CreateFileHandler( iodev->
fd, TCL_READABLE, (Tcl_FileProc *)
ReadData,
2656 (ClientData) plFramePtr );
2660#if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
2661#if defined( TCL_MAJOR_VERSION ) && TCL_MAJOR_VERSION >= 9
2662 Tcl_CreateFileHandler( Tcl_GetFile( (ClientData) iodev->
fd, TCL_UNIX_FD ),
2663 TCL_READABLE, (Tcl_FileProc *)
ReadData,
2664 (
void *) plFramePtr );
2666 Tcl_CreateFileHandler( Tcl_GetFile( (ClientData) iodev->
fd, TCL_UNIX_FD ),
2667 TCL_READABLE, (Tcl_FileProc *)
ReadData,
2668 (ClientData) plFramePtr );
2692 if ( iodev->
fd == 0 )
2694 Tcl_AppendResult(
interp,
"no link currently open", (
char *) NULL );
2698#if TK_MAJOR_VERSION < 4 || \
2699 ( TK_MAJOR_VERSION == 4 && TK_MINOR_VERSION == 0 ) || \
2700 TK_MAJOR_VERSION > 7
2701#if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
2702 Tcl_DeleteFileHandler( iodev->
fd );
2706#if !defined ( MAC_TCL ) && !defined ( _WIN32 ) && !defined ( __CYGWIN__ )
2707 Tcl_DeleteFileHandler( Tcl_GetFile( (ClientData) iodev->
fd,
2728 int result = TCL_OK;
2734 Tcl_AppendResult(
interp,
"unable to read from ", iodev->
typeName,
2744 if ( Tcl_Eval(
interp, plFramePtr->
bopCmd ) != TCL_OK )
2745 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2754 if ( Tcl_Eval(
interp, plFramePtr->
eopCmd ) != TCL_OK )
2755 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
2778 int result = TCL_OK;
2780 if ( mask & TCL_READABLE )
2787 Tcl_AppendResult(
interp,
"Packet receive failed:\n\t %s\n",
2796 if ( pdfs->
bp == 0 )
2818 int result = TCL_OK;
2827 char result_str[128];
2829 sprintf( result_str,
"%f", rot );
2830 Tcl_SetResult(
interp, result_str, TCL_VOLATILE );
2862 int result = TCL_OK;
2871 Tcl_AppendResult(
interp,
"Error -- widget not plotted to yet",
2881 Tcl_AppendResult(
interp,
"Error -- cannot create stream",
2892 Tcl_AppendResult(
interp,
2893 "Error -- cannot open plot file for writing",
2896 if ( sfnam != NULL )
2918 if ( plFramePtr->
plpr_cmd == NULL )
2921#if !defined ( _WIN32 )
2922 if ( ( plFramePtr->
plpr_cmd == NULL ) || ( pid = fork() ) < 0 )
2927 Tcl_AppendResult(
interp,
2928 "Error -- cannot fork print process",
2932 else if ( pid == 0 )
2934#if !defined ( _WIN32 )
2941 fprintf( stderr,
"Unable to exec print command.\n" );
2970 PLFLT mar, aspect, jx, jy;
2971 char result_str[128];
2973 plgdidev( &mar, &aspect, &jx, &jy );
2974 sprintf( result_str,
"%g %g %g %g", mar, aspect, jx, jy );
2975 Tcl_SetResult(
interp, result_str, TCL_VOLATILE );
2983 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
2984 " page mar aspect jx jy\"", (
char *) NULL );
3007 if ( ( plFramePtr->
tkwin != NULL ) &&
3036 Tcl_AppendResult(
interp,
"Error -- widget not plotted to yet",
3047 Tcl_AppendResult(
interp,
"Error -- no current save file",
3063 length = (int) strlen(
argv[0] );
3067 if ( ( c ==
'a' ) && ( strncmp(
argv[0],
"as", (
size_t) length ) == 0 ) )
3071 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
3072 " save as device file\"", (
char *) NULL );
3089 Tcl_AppendResult(
interp,
"Error -- cannot create stream",
3097 if ( ( sfile = fopen(
argv[2],
"wb+" ) ) == NULL )
3099 Tcl_AppendResult(
interp,
"Error -- cannot open file ",
argv[2],
3100 " for writing", (
char *) NULL );
3124 else if ( ( c ==
'c' ) && ( strncmp(
argv[0],
"close", (
size_t) length ) == 0 ) )
3128 Tcl_AppendResult(
interp,
"Error -- no current save file",
3145 Tcl_AppendResult(
interp,
"bad option to \"save\": must be ",
3146 "as or close", (
char *) NULL );
3167 PLFLT xl, xr, yl, yr;
3175 char result_str[128];
3177 sprintf( result_str,
"%g %g %g %g", xl, yl, xr, yr );
3178 Tcl_SetResult(
interp, result_str, TCL_VOLATILE );
3183 length = (int) strlen(
argv[0] );
3188 if ( ( c ==
'b' ) && ( strncmp(
argv[0],
"bounds", (
size_t) length ) == 0 ) )
3190 char result_str[128];
3194 sprintf( result_str,
"%g %g %g %g", xl, yl, xr, yr );
3195 Tcl_SetResult(
interp, result_str, TCL_VOLATILE );
3201 if ( ( c ==
'r' ) && ( strncmp(
argv[0],
"reset", (
size_t) length ) == 0 ) )
3211 else if ( ( c ==
's' ) && ( strncmp(
argv[0],
"select", (
size_t) length ) == 0 ) )
3215 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
3216 " view select xmin ymin xmax ymax\"",
3222 gbox( &xl, &yl, &xr, &yr,
argv + 1 );
3230 else if ( ( c ==
'z' ) && ( strncmp(
argv[0],
"zoom", (
size_t) length ) == 0 ) )
3234 Tcl_AppendResult(
interp,
"wrong # args: should be \"",
3235 " view zoom xmin ymin xmax ymax\"",
3241 gbox( &xl, &yl, &xr, &yr,
argv + 1 );
3251 Tcl_AppendResult(
interp,
"bad option \"",
argv[1],
3252 "\": options to \"view\" are: bounds, reset, select, or zoom",
3261 plFramePtr->
xl = xl;
3262 plFramePtr->
yl = yl;
3263 plFramePtr->
xr = xr;
3264 plFramePtr->
yr = yr;
3281 int x0, width = Tk_Width( plFramePtr->
tkwin );
3282 PLFLT xl, xr, yl, yr, xlen;
3286 xlen = plFramePtr->
xr - plFramePtr->
xl;
3287 x0 = atoi(
argv[0] );
3288 xl = x0 / (double) width;
3289 xl =
MAX( 0.,
MIN( ( 1. - xlen ), xl ) );
3292 yl = plFramePtr->
yl;
3293 yr = plFramePtr->
yr;
3295 plFramePtr->
xl = xl;
3296 plFramePtr->
xr = xr;
3315 int y0, height = Tk_Height( plFramePtr->
tkwin );
3316 PLFLT xl, xr, yl, yr, ylen;
3320 ylen = plFramePtr->
yr - plFramePtr->
yl;
3321 y0 = atoi(
argv[0] );
3322 yr = 1. - y0 / (double) height;
3323 yr =
MAX( 0. + ylen,
MIN( 1., yr ) );
3326 xl = plFramePtr->
xl;
3327 xr = plFramePtr->
xr;
3329 plFramePtr->
yl = yl;
3330 plFramePtr->
yr = yr;
3355 Tcl_SetResult(
interp,
"report what?", TCL_STATIC );
3359 if ( !strcmp(
argv[0],
"wc" ) )
3366 Tcl_SetResult(
interp,
"Wrong # of args: report wc x y", TCL_STATIC );
3370 x = atof(
argv[1] );
3371 y = atof(
argv[2] );
3380 snprintf( tmpstring, 50,
"%f %f", gin->
wX, gin->
wY );
3381 Tcl_SetResult(
interp, tmpstring, TCL_VOLATILE );
3385 Tcl_SetResult(
interp,
"Cannot locate", TCL_STATIC );
3389 Tcl_SetResult(
interp,
"nonsensical request.", TCL_STATIC );
3403 if ( Tcl_Eval( plFramePtr->
interp, plFramePtr->
bopCmd ) != TCL_OK )
3404 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
3405 plFramePtr->
bopCmd, Tcl_GetStringResult( plFramePtr->
interp ) );
3418 if ( Tcl_Eval( plFramePtr->
interp, plFramePtr->
eopCmd ) != TCL_OK )
3419 fprintf( stderr,
"Command \"%s\" failed:\n\t %s\n",
3420 plFramePtr->
eopCmd, Tcl_GetStringResult( plFramePtr->
interp ) );
3436 int height = Tk_Height( plFramePtr->
tkwin );
3438 int totalUnits, windowUnits, firstUnit, lastUnit, result;
3443 totalUnits = height;
3444 firstUnit = (int) ( 0.5 + (
PLFLT) height * ( 1. - plFramePtr->
yr ) );
3445 lastUnit = (int) ( 0.5 + (
PLFLT) height * ( 1. - plFramePtr->
yl ) );
3446 windowUnits = lastUnit - firstUnit;
3447 sprintf(
string,
" %d %d %d %d",
3448 totalUnits, windowUnits, firstUnit, lastUnit );
3453 if ( result != TCL_OK )
3455 Tcl_BackgroundError( plFramePtr->
interp );
3468 int width = Tk_Width( plFramePtr->
tkwin );
3470 int totalUnits, windowUnits, firstUnit, lastUnit, result;
3476 firstUnit = (int) ( 0.5 + (
PLFLT) width * plFramePtr->
xl );
3477 lastUnit = (int) ( 0.5 + (
PLFLT) width * plFramePtr->
xr );
3478 windowUnits = lastUnit - firstUnit;
3479 sprintf(
string,
" %d %d %d %d",
3480 totalUnits, windowUnits, firstUnit, lastUnit );
3485 if ( result != TCL_OK )
3487 Tcl_BackgroundError( plFramePtr->
interp );
3501 PLFLT x0, y0, x1, y1;
3503 x0 = atof(
argv[0] );
3504 y0 = atof(
argv[1] );
3505 x1 = atof(
argv[2] );
3506 y1 = atof(
argv[3] );
3508 x0 =
MAX( 0.,
MIN( 1., x0 ) );
3509 y0 =
MAX( 0.,
MIN( 1., y0 ) );
3510 x1 =
MAX( 0.,
MIN( 1., x1 ) );
3511 y1 =
MAX( 0.,
MIN( 1., y1 ) );
3515 *xl =
MIN( x0, x1 );
3516 *yl =
MIN( y0, y1 );
3517 *xr =
MAX( x0, x1 );
3518 *yr =
MAX( y0, y1 );
int pdf_close(PDFstrm *pdfs)
PDFstrm * pdf_bopen(U_CHAR *buffer, size_t bufmax)
void pldip2dc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax)
void plgpls(PLStream **p_pls)
void pl_cpcolor(PLColor *to, PLColor *from)
void plsxwin(PLINT window_id)
void plsbopH(void(*handler)(void *, int *), void *handler_data)
void pldid2pc(PLFLT *xmin, PLFLT *ymin, PLFLT *xmax, PLFLT *ymax)
void plseopH(void(*handler)(void *, int *), void *handler_data)
void plP_esc(PLINT op, void *ptr)
void plgFileDevs(const char ***p_menustr, const char ***p_devname, int *p_ndev)
static PLStream * pls[PL_NSTREAMS]
void plcmap1_calc(void)
Bin up cmap 1 space and assign colors to make inverse mapping easy.
char * plFindCommand(PLCHAR_VECTOR fn)
void pl_cmd(PLINT op, void *ptr)
static int Save(Tcl_Interp *, PlFrame *, int, const char **)
static void DrawRband(PlFrame *, int, int)
static int Page(Tcl_Interp *, PlFrame *, int, const char **)
static int ConfigureWidgetCompat(Tcl_Interp *interp, Tk_Window tkwin, const Tk_ConfigSpec *configSpecs, int argc, const char **argv, char *widgRec, int flags)
static void PlFrameEnterEH(ClientData, register XEvent *)
static void UpdateXhairs(PlFrame *)
static void DisplayPlFrame(ClientData)
static int Orient(Tcl_Interp *, PlFrame *, int, const char **)
static void CreateXhairs(PlFrame *)
static int ConfigurePlFrame(Tcl_Interp *, PlFrame *, int, const char **, int)
static int Print(Tcl_Interp *, PlFrame *, int, const char **)
int plFrameCmd(ClientData, Tcl_Interp *, int, const char **)
static int xScroll(Tcl_Interp *, PlFrame *, int, const char **)
static void PlFrameInit(ClientData)
static void CreateRband(PlFrame *)
static int Info(Tcl_Interp *, PlFrame *, int, const char **)
static void UpdateHScrollbar(register PlFrame *)
static int report(Tcl_Interp *, PlFrame *, int, const char **)
static int View(Tcl_Interp *, PlFrame *, int, const char **)
static void UpdateRband(PlFrame *)
static void Install_cmap(PlFrame *plFramePtr)
static int ColorManip(Tcl_Interp *, PlFrame *, int, const char **)
static void DestroyXhairs(PlFrame *)
static int process_data(Tcl_Interp *interp, register PlFrame *plFramePtr)
static void PlFrameConfigureEH(ClientData, XEvent *)
static int Draw(Tcl_Interp *, PlFrame *, int, const char **)
static int Cmd(Tcl_Interp *, PlFrame *, int, const char **)
static int scol1(Tcl_Interp *interp, register PlFrame *plFramePtr, int i, const char *col, const char *pos, const char *rev, int *p_changed)
static void PlFrameLeaveEH(ClientData, register XEvent *)
static int Closelink(Tcl_Interp *, PlFrame *, int, const char **)
static void gbox(PLFLT *, PLFLT *, PLFLT *, PLFLT *, const char **)
static int scol0(Tcl_Interp *interp, register PlFrame *plFramePtr, int i, const char *col, int *p_changed)
static void DestroyRband(PlFrame *)
static int Redraw(Tcl_Interp *, PlFrame *, int, const char **)
static void process_eop(void *, int *)
static void DestroyPlFrame(FreeProcArg)
static int ReadData(ClientData, int)
static int yScroll(Tcl_Interp *, PlFrame *, int, const char **)
static void UpdateVScrollbar(register PlFrame *)
static void PlFrameKeyEH(ClientData, register XEvent *)
static void PlFrameExposeEH(ClientData, XEvent *)
static void DrawXhairs(PlFrame *, int, int)
static void PlFrameMotionEH(ClientData, register XEvent *)
static int PlFrameWidgetCmd(ClientData, Tcl_Interp *, int, const char **)
static int Openlink(Tcl_Interp *, PlFrame *, int, const char **)
static void process_bop(void *, int *)
PLINT plTranslateCursor(PLGraphicsIn *plg)
#define PLESC_DOUBLEBUFFERING_QUERY
#define PLESC_DOUBLEBUFFERING_DISABLE
#define PLESC_DOUBLEBUFFERING
#define PLESC_DOUBLEBUFFERING_ENABLE
#define DEF_PLFRAME_CURSOR
#define UPDATE_H_SCROLLBAR
static Tk_ConfigSpec configSpecs[]
#define DEF_PLFRAME_HEIGHT
#define UPDATE_V_SCROLLBAR
#define DEF_PLFRAME_BORDER_WIDTH
#define DEF_PLFRAME_RELIEF
#define DEF_PLFRAME_BG_COLOR
static int ReadData(ClientData, int)
#define DEF_PLFRAME_BG_MONO
#define DEF_PLFRAME_WIDTH
int plr_process(PLRDev *plr)
void plr_start(PLRDev *plr)
FILE * pl_create_tempfile(char **fname)
PLDLLIMPEXP_TCLTK int plTclCmd(char *cmdlist, Tcl_Interp *interp, int argc, const char **argv)
char * strcpy(char *dst, const char *src)
PLDLLIMPEXP_TCLTK int pl_PacketReceive(Tcl_Interp *interp, PLiodev *iodev, PDFstrm *pdfs)
static Tcl_Interp * interp