1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519
|
/* Hello, Emacs, this is -*-C-*- */
/* GNUPLOT - win.trm */
/*[
* Copyright 1992 - 1993, 1998, 2004
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose with or without fee is hereby granted,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
*
* Permission to modify the software is granted, but not the right to
* distribute the complete modified source code. Modifications are to
* be distributed as patches to the released version. Permission to
* distribute binaries produced by compiling modified sources is granted,
* provided you
* 1. distribute the corresponding source modifications from the
* released version in the form of a patch file along with the binaries,
* 2. add special version identification to distinguish your version
* in addition to the base release version number,
* 3. provide your name and address as the primary contact for the
* support of your modified version, and
* 4. retain our contact information in regard to use of the base
* software.
* Permission to distribute the released version of the source code along
* with corresponding source modifications in the form of a patch file is
* granted with same provisions 2 through 4 for binary distributions.
*
* This software is provided "as is" without express or implied warranty
* to the extent permitted by applicable law.
]*/
/*
*
* AUTHORS
*
* Gnuplot for Windows:
* Maurice Castro, Russell Lang
*
* Current maintainer:
* Bastian Maerkisch
*
*/
/* This file implements the terminal and printer display for gnuplot */
/* under Microsoft Windows. */
/* */
/* The modifications to allow Gnuplot to run under Windows were made */
/* by Maurice Castro (maurice@bruce.cs.monash.edu.au) */
/* and Russell Lang (rjl@monu1.cc.monash.edu.au) 19 Nov 1992 */
/* */
/* Edit this file with tabstop=4 (vi :se ts=4) */
/*
* adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
*/
#include "driver.h"
#ifdef TERM_REGISTER
register_term(windows)
#endif
#ifdef TERM_PROTO
TERM_PUBLIC void WIN_options(void);
TERM_PUBLIC void WIN_init(void);
TERM_PUBLIC void WIN_reset(void);
TERM_PUBLIC void WIN_text(void);
TERM_PUBLIC void WIN_graphics(void);
TERM_PUBLIC void WIN_move(unsigned int x, unsigned int y);
TERM_PUBLIC void WIN_vector(unsigned int x, unsigned int y);
TERM_PUBLIC void WIN_linetype(int lt);
TERM_PUBLIC void WIN_dashtype(int type, t_dashtype *custom_dash_pattern);
TERM_PUBLIC void WIN_put_text(unsigned int x, unsigned int y, const char *str);
TERM_PUBLIC int WIN_justify_text(enum JUSTIFY mode);
TERM_PUBLIC int WIN_text_angle(float ang);
TERM_PUBLIC void WIN_point(unsigned int x, unsigned int y, int number);
TERM_PUBLIC void WIN_resume(void);
TERM_PUBLIC void WIN_set_pointsize(double);
TERM_PUBLIC void WIN_linewidth(double linewidth);
#ifdef USE_MOUSE
TERM_PUBLIC void WIN_set_ruler(int, int);
TERM_PUBLIC void WIN_set_cursor(int, int, int);
TERM_PUBLIC void WIN_put_tmptext(int, const char str[]);
TERM_PUBLIC void WIN_set_clipboard(const char[]);
# ifdef WGP_CONSOLE
TERM_PUBLIC int WIN_waitforinput(int);
# endif
#endif
TERM_PUBLIC int WIN_make_palette(t_sm_palette *palette);
TERM_PUBLIC void WIN_set_color(t_colorspec *);
TERM_PUBLIC void WIN_filled_polygon(int points, gpiPoint *corners);
TERM_PUBLIC void WIN_boxfill(int, unsigned int, unsigned int, unsigned int, unsigned int);
TERM_PUBLIC int WIN_set_font(const char *font);
TERM_PUBLIC void WIN_enhanced_open(char * fontname, double fontsize,
double base, TBOOLEAN widthflag, TBOOLEAN showflag, int overprint);
TERM_PUBLIC void WIN_enhanced_flush(void);
TERM_PUBLIC void WIN_image(unsigned int, unsigned int, coordval *, gpiPoint *, t_imagecolor);
TERM_PUBLIC void WIN_layer(t_termlayer syncpoint);
TERM_PUBLIC void WIN_hypertext(int type, const char * text);
TERM_PUBLIC void WIN_modify_plots(unsigned int operations, int plotno);
/* Initialization values - guess now, scale later */
#define WIN_XMAX (24000)
#define WIN_YMAX (18000)
#define WIN_HCHAR (WIN_XMAX/75)
#define WIN_VCHAR (WIN_YMAX/25)
#define WIN_HTIC (WIN_XMAX/160)
#define WIN_VTIC WIN_HTIC
#endif /* TERM_PROTO */
#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
#include <windows.h>
#include <tchar.h>
#include <wchar.h>
#include "win/winmain.h"
/* Interface routines - create list of actions for Windows */
enum WIN_id { WIN_DEFAULT, WIN_MONOCHROME, WIN_COLOR, WIN_GTITLE,
WIN_ENHANCED, WIN_NOENHANCED, WIN_FONT, WIN_SIZE, WIN_WSIZE,
WIN_POSITION, WIN_CLOSE, WIN_BACKGROUND,
WIN_FONTSCALE, WIN_LINEWIDTH, WIN_POINTSCALE,
WIN_SOLID, WIN_DASHED, WIN_ROUND, WIN_BUTT,
WIN_DOCKED, WIN_STANDALONE, WIN_LAYOUT,
WIN_OTHER };
static struct gen_table WIN_opts[] =
{
{ "d$efault", WIN_DEFAULT },
{ "c$olor", WIN_COLOR },
{ "c$olour", WIN_COLOR },
{ "m$onochrome", WIN_MONOCHROME },
{ "backg$round", WIN_BACKGROUND },
{ "solid", WIN_SOLID },
{ "dash$ed", WIN_DASHED },
{ "round$ed", WIN_ROUND },
{ "butt", WIN_BUTT },
{ "enh$anced", WIN_ENHANCED },
{ "noenh$anced", WIN_NOENHANCED },
{ "font", WIN_FONT },
{ "fonts$cale", WIN_FONTSCALE },
{ "linewidth", WIN_LINEWIDTH },
{ "lw", WIN_LINEWIDTH },
{ "pointscale", WIN_POINTSCALE},
{ "ps", WIN_POINTSCALE},
{ "ti$tle", WIN_GTITLE },
{ "siz$e", WIN_SIZE },
{ "ws$ize", WIN_WSIZE },
{ "pos$ition", WIN_POSITION },
{ "cl$ose", WIN_CLOSE },
{ "dock$ed", WIN_DOCKED },
{ "standalone", WIN_STANDALONE },
{ "lay$out", WIN_LAYOUT },
{ NULL, WIN_OTHER }
};
typedef struct {
unsigned n;
unsigned max;
POINT * point;
} path_points;
static int WIN_last_linetype = LT_NODRAW; /* HBB 20000813: linetype caching */
termentry * WIN_term = NULL;
TCHAR WIN_inifontname[MAXFONTNAME] = TEXT(WINFONT);
int WIN_inifontsize = WINFONTSIZE;
static path_points WIN_poly = {0, 0, NULL};
static void WIN_add_path_point(path_points * poly, int x, int y);
static void WIN_flush_line(path_points * poly);
static TBOOLEAN WIN_docked = FALSE; /* docked window option is "sticky" */
static void
WIN_add_path_point(path_points * poly, int x, int y)
{
/* Enlarge size of array of polygon points */
if (poly->n >= poly->max) {
poly->max += 10;
poly->point = (POINT *) gp_realloc(poly->point, poly->max * sizeof(POINT), "points");
}
/* Store point */
poly->point[poly->n].x = x;
poly->point[poly->n].y = y;
poly->n++;
FPRINTF((stderr, "new polygon/polyline point: %i %i\n", x, y));
}
static void
WIN_flush_line(path_points * poly)
{
if (poly) {
if (poly->n > 1)
GraphOpSize(graphwin, W_polyline, poly->n, 0, (void *) poly->point, poly->n * sizeof(POINT));
if (poly->n > 0) {
/* Save last path point in case there's a vector command without preceding move. */
poly->point[0].x = poly->point[poly->n - 1].x;
poly->point[0].y = poly->point[poly->n - 1].y;
/* Reset counter */
poly->n = 0;
}
}
}
TERM_PUBLIC void
WIN_options()
{
char *s;
TBOOLEAN set_font = FALSE, set_fontsize = FALSE;
TBOOLEAN set_title = FALSE, set_close = FALSE;
TBOOLEAN set_dashed = FALSE, set_color = FALSE;
TBOOLEAN set_background = FALSE, set_fontscale = FALSE;
TBOOLEAN set_linewidth = FALSE, set_size = FALSE;
TBOOLEAN set_position = FALSE, set_number = FALSE;
TBOOLEAN set_wsize = FALSE, set_rounded = FALSE;
TBOOLEAN set_docked = FALSE;
#ifndef WGP_CONSOLE
TBOOLEAN set_layout = FALSE;
#endif
TBOOLEAN set_pointscale = FALSE;
TBOOLEAN color, dashed, rounded;
COLORREF background;
double fontscale, linewidth;
double pointscale;
int win_x = 0;
int win_y = 0;
int win_width = 0;
int win_height = 0;
char * title = NULL;
int fontsize;
char fontname[MAXFONTNAME];
int window_number;
unsigned dock_cols, dock_rows;
while (!END_OF_COMMAND) {
switch (lookup_table(&WIN_opts[0], c_token)) {
case WIN_DEFAULT:
color = TRUE;
dashed = FALSE;
rounded = FALSE;
#ifdef UNICODE
WideCharToMultiByte(CP_ACP, 0, WIN_inifontname, -1, fontname, MAXFONTNAME, 0, 0);
#else
strcpy(fontname, WIN_inifontname);
#endif
fontsize = WIN_inifontsize;
fontscale = linewidth = pointscale = 1;
set_color = set_dashed = TRUE;
set_font = set_fontsize = TRUE;
set_fontscale = set_linewidth = set_pointscale = TRUE;
set_rounded = TRUE;
c_token++;
break;
case WIN_COLOR:
c_token++;
color = TRUE;
set_color = TRUE;
break;
case WIN_MONOCHROME:
c_token++;
color = FALSE;
set_color = TRUE;
break;
case WIN_BACKGROUND: {
int color;
c_token++;
color = parse_color_name();
/* TODO: save original background color and color string,
add background color to status string
*/
background =
RGB(((color >> 16) & 0xff), ((color >> 8) & 0xff), (color & 0xff));
set_background = TRUE;
break;
}
case WIN_ENHANCED:
c_token++;
term->flags |= TERM_ENHANCED_TEXT;
break;
case WIN_NOENHANCED:
c_token++;
term->flags &= ~TERM_ENHANCED_TEXT;
break;
case WIN_FONTSCALE: {
c_token++;
fontscale = real_expression();
if (fontscale <= 0) fontscale = 1.;
set_fontscale = TRUE;
break;
}
case WIN_LINEWIDTH: {
c_token++;
linewidth = real_expression();
if (linewidth <= 0) linewidth = 1.;
set_linewidth = TRUE;
break;
}
case WIN_POINTSCALE:
c_token++;
pointscale = real_expression();
if (pointscale <= 0.0) pointscale = 1.;
set_pointscale = TRUE;
break;
case WIN_SOLID:
c_token++;
dashed = FALSE;
set_dashed = TRUE;
break;
case WIN_DASHED:
c_token++;
dashed = TRUE;
set_dashed = TRUE;
break;
case WIN_BUTT:
c_token++;
rounded = FALSE;
set_rounded = TRUE;
break;
case WIN_ROUND:
c_token++;
rounded = TRUE;
set_rounded = TRUE;
break;
case WIN_SIZE: {
double insize; /* shige 2019-02-27 for size 0 */
c_token++;
if (set_wsize)
int_error(c_token, "conflicting size options");
if (END_OF_COMMAND)
int_error(c_token,"size requires 'width,heigth'");
if ((insize = real_expression()) >= 1)
win_width = insize;
else
int_error(c_token, "size is out of range");
if (!equals(c_token++,","))
int_error(c_token,"size requires 'width,heigth'");
if ((insize = real_expression()) >= 1)
win_height = insize;
else
int_error(c_token, "size is out of range");
set_size = TRUE;
break;
}
case WIN_WSIZE: {
c_token++;
if (set_size)
int_error(c_token, "conflicting size options");
if (END_OF_COMMAND)
int_error(c_token,"windowsize requires 'width,heigth'");
win_width = real_expression();
if (!equals(c_token++,","))
int_error(c_token,"windowsize requires 'width,heigth'");
win_height = real_expression();
if (win_width < 1 || win_height < 1)
int_error(c_token, "windowsize canvas size is out of range");
set_wsize = TRUE;
break;
}
case WIN_POSITION: {
c_token++;
if (END_OF_COMMAND)
int_error(c_token,"position requires 'x,y'");
win_x = real_expression();
if (!equals(c_token++,","))
int_error(c_token,"position requires 'x,y'");
win_y = real_expression();
if (win_x < 1 || win_y < 1)
int_error(c_token, "position is out of range");
set_position = TRUE;
break;
}
case WIN_GTITLE:
c_token++;
title = try_to_get_string();
if (title == NULL)
int_error(c_token, "expecting string argument");
if (strcmp(title, "") == 0)
title = NULL;
set_title = TRUE;
break;
case WIN_CLOSE:
c_token++;
set_close = TRUE;
break;
case WIN_FONT:
c_token++;
/* Code copied from ps.trm and modified for windows terminal */
if ((s = try_to_get_string())) {
char *comma;
if (set_font)
int_error(c_token,
"extraneous argument in set terminal %s",
term->name);
comma = strrchr(s,',');
if (comma && (1 == sscanf(comma + 1, "%i", &fontsize))) {
set_fontsize = TRUE;
*comma = '\0';
}
if (*s) {
set_font = TRUE;
safe_strncpy(fontname, s, MAXFONTNAME);
free(s);
}
} else {
if (set_fontsize)
int_error(c_token,
"extraneous argument in set terminal %s",
term->name);
set_fontsize = TRUE;
fontsize = int_expression();
}
break;
case WIN_DOCKED:
c_token++;
if (!graphwin->bDocked && GraphHasWindow(graphwin))
int_error(c_token, "Cannot change the mode of an open window.");
if (persist_cl) {
fprintf(stderr, "Warning: cannot use docked graphs in persist mode\n");
} else {
set_docked = TRUE;
WIN_docked = TRUE;
}
break;
case WIN_STANDALONE:
c_token++;
if (graphwin->bDocked && GraphHasWindow(graphwin))
int_error(c_token, "Cannot change the mode of an open window.");
set_docked = TRUE;
WIN_docked = FALSE;
break;
case WIN_LAYOUT:
c_token++;
dock_rows = int_expression();
if (END_OF_COMMAND || !equals(c_token, ","))
int_error(c_token, "expecting ', <num_cols>'");
if (dock_rows == 0) {
dock_rows = 1;
fprintf(stderr, "Warning: layout requires at least one row.\n");
}
c_token++;
if (END_OF_COMMAND)
int_error(c_token, "expecting <num_cols>");
dock_cols = int_expression();
if (dock_cols == 0) {
dock_cols = 1;
fprintf(stderr, "Warning: layout requires at least one column.\n");
}
#ifndef WGP_CONSOLE
set_layout = TRUE;
#endif
break;
case WIN_OTHER:
default:
window_number = int_expression();
set_number = TRUE;
break;
}
}
/* change window? */
if (set_number) {
char status[100];
LPGW lpgw = listgraphs;
while ((lpgw->Id != window_number) && (lpgw->next))
lpgw = lpgw->next;
if (lpgw->Id != window_number) {
/* create new window */
lpgw->next = calloc(1, sizeof(GW));
lpgw = lpgw->next;
lpgw->Id = window_number;
lpgw->bDocked = WIN_docked; /* "sticky" default */
}
#ifdef USE_MOUSE
/* set status line of previous graph window */
sprintf(status, "(inactive, window number %i)", graphwin->Id);
Graph_put_tmptext(graphwin, 0, status);
/* reset status text */
Graph_put_tmptext(lpgw, 0, "");
#endif
graphwin = lpgw;
}
/* apply settings */
GraphInitStruct(graphwin);
if (set_color) {
graphwin->color = color;
/* Note: We no longer set TERM_MONOCHROME here, since colors
and grayscale conversion are fully handled by drawgraph() */
if (!set_dashed)
graphwin->dashed = !color;
}
if (set_dashed)
graphwin->dashed = dashed;
if (set_rounded)
graphwin->rounded = rounded;
if (set_background)
graphwin->background = background;
if (set_fontscale)
graphwin->fontscale = fontscale;
if (set_linewidth)
graphwin->linewidth = linewidth;
if (set_pointscale)
graphwin->pointscale = pointscale;
if (set_size || set_wsize) {
graphwin->Size.x = win_width;
graphwin->Size.y = win_height;
}
#ifdef WGP_CONSOLE
if (set_docked && WIN_docked)
WIN_docked = FALSE; /* silently ignore docked option for console mode gnuplot */
#endif
if (!WIN_docked) {
if (set_docked)
graphwin->bDocked = WIN_docked;
if (set_size) {
graphwin->Canvas.x = win_width;
graphwin->Canvas.y = win_height;
}
if (set_wsize) {
graphwin->Canvas.x = 0;
graphwin->Canvas.y = 0;
}
if (set_position) {
graphwin->Origin.x = win_x;
graphwin->Origin.y = win_y;
}
} else {
if (set_docked)
graphwin->bDocked = WIN_docked;
}
#ifndef WGP_CONSOLE
if (set_layout) {
textwin.nDockRows = dock_rows;
textwin.nDockCols = dock_cols;
}
#endif
if (set_title) {
free (graphwin->Title);
#ifdef UNICODE
graphwin->Title = (title != NULL) ? UnicodeText(title, encoding) : _tcsdup(WINGRAPHTITLE);
#else
graphwin->Title = (title != NULL) ? title : strdup(WINGRAPHTITLE);
#endif
GraphChangeTitle(graphwin);
}
if (set_fontsize)
graphwin->deffontsize = graphwin->fontsize = fontsize;
if (set_font) {
#ifdef UNICODE
LPWSTR wfontname = UnicodeText(fontname, encoding);
wcscpy(graphwin->fontname, wfontname);
wcscpy(graphwin->deffontname, wfontname);
free(wfontname);
#else
strcpy(graphwin->fontname, fontname);
strcpy(graphwin->deffontname, fontname);
#endif
}
/* font initialization */
WIN_set_font(NULL);
WIN_update_options();
if (set_close) {
win_close_terminal_window(graphwin);
return;
}
#ifndef WGP_CONSOLE
/* update text window */
if (set_layout) {
DockedUpdateLayout(&textwin);
}
#endif
/* update graph window */
if ((set_position || set_size || set_wsize) && GraphHasWindow(graphwin))
GraphUpdateWindowPosSize(graphwin);
if (GraphHasWindow(graphwin) && IsIconic(graphwin->hWndGraph))
ShowWindow(graphwin->hWndGraph, SW_SHOWNORMAL);
GraphRedraw(graphwin);
}
void
WIN_update_options()
{
TBOOLEAN set_font = FALSE, set_fontsize = FALSE;
/* update term_options */
sprintf(term_options, "%i %s %s %s %s %s",
graphwin->Id,
graphwin->color ? "color" : "monochrome",
graphwin->dashed ? "dashed" : "solid",
graphwin->rounded ? "rounded" : "butt",
term->flags & TERM_ENHANCED_TEXT ? "enhanced" : "noenhanced",
graphwin->bDocked ? "docked" : "standalone");
#ifndef WGP_CONSOLE
if (graphwin->bDocked) {
char buf[128];
sprintf(buf, " layout %i,%i", textwin.nDockRows, textwin.nDockCols);
strcat(term_options, buf);
}
#endif
set_fontsize = (graphwin->deffontsize != WIN_inifontsize);
set_font = (_tcscmp(graphwin->deffontname, WIN_inifontname) != 0);
if (set_font || set_fontsize) {
char * fontstring = (char *) gp_alloc(_tcslen(graphwin->deffontname) + 24, "win font");
if (!set_fontsize) {
sprintf(fontstring, " font \"" TCHARFMT "\"", graphwin->deffontname);
} else {
sprintf(fontstring, " font \"" TCHARFMT ", %d\"",
set_font ? graphwin->deffontname : TEXT(""), graphwin->deffontsize);
}
strcat(term_options, fontstring);
free(fontstring);
}
if (graphwin->background != RGB(255, 255, 255))
sprintf(&(term_options[strlen(term_options)]),
" background \"#%0x%0x%0x\"", GetRValue(graphwin->background),
GetGValue(graphwin->background), GetBValue(graphwin->background));
if (graphwin->fontscale != 1)
sprintf(&(term_options[strlen(term_options)]),
" fontscale %.1f", graphwin->fontscale);
if (graphwin->linewidth != 1)
sprintf(&(term_options[strlen(term_options)]),
" linewidth %.1f", graphwin->linewidth);
if (graphwin->pointscale != 1)
sprintf(&(term_options[strlen(term_options)]),
" pointscale %.1f", graphwin->pointscale);
if (!graphwin->bDocked) {
if (graphwin->Canvas.x != 0)
sprintf(&(term_options[strlen(term_options)]),
" size %li,%li", graphwin->Canvas.x, graphwin->Canvas.y);
else if (graphwin->Size.x != CW_USEDEFAULT)
sprintf(&(term_options[strlen(term_options)]),
" wsize %li,%li", graphwin->Size.x, graphwin->Size.y);
}
}
TERM_PUBLIC void
WIN_init()
{
if (!graphwin->hWndGraph) {
graphwin->xmax = WIN_XMAX;
graphwin->ymax = WIN_YMAX;
graphwin->htic = WIN_HTIC;
graphwin->vtic = WIN_VTIC;
GraphInit(graphwin);
}
WIN_last_linetype = LT_NODRAW; /* HBB 20000813: linetype caching */
WIN_term = term;
}
TERM_PUBLIC void
WIN_reset()
{
}
TERM_PUBLIC void
WIN_text()
{
WIN_flush_line(&WIN_poly);
GraphEnd(graphwin);
}
TERM_PUBLIC void
WIN_graphics()
{
GraphStart(graphwin, pointsize);
/* Fix up the text size if the user has resized the window. */
term->h_char = graphwin->hchar;
term->v_char = graphwin->vchar;
term->h_tic = graphwin->htic;
term->v_tic = graphwin->vtic;
WIN_last_linetype = LT_NODRAW; /* HBB 20000813: linetype caching */
/* Save current text encoding */
GraphOp(graphwin, W_text_encoding, encoding, 0, NULL);
}
TERM_PUBLIC void
WIN_move(unsigned int x, unsigned int y)
{
/* terminate current path only if we move to a disconnected position */
if ((WIN_poly.n > 0) &&
((WIN_poly.point[WIN_poly.n - 1].x != x) ||
(WIN_poly.point[WIN_poly.n - 1].y != y))) {
WIN_flush_line(&WIN_poly);
}
WIN_add_path_point(&WIN_poly, x, y);
}
TERM_PUBLIC void
WIN_vector(unsigned int x, unsigned int y)
{
if ((WIN_poly.n == 0) ||
(WIN_poly.point[WIN_poly.n - 1].x != x) ||
(WIN_poly.point[WIN_poly.n - 1].y != y)) {
if (WIN_poly.n == 0) {
/* vector command without preceding move: e.g. in "with line lc variable" */
/* Coordinates were saved with last flush already. */
WIN_poly.n++;
}
WIN_add_path_point(&WIN_poly, x, y);
}
}
TERM_PUBLIC void
WIN_linetype(int lt)
{
if (lt != WIN_last_linetype) {
WIN_flush_line(&WIN_poly);
GraphOp(graphwin, W_line_type, lt, 0, NULL);
WIN_last_linetype = lt;
}
}
TERM_PUBLIC void
WIN_dashtype(int dt, t_dashtype *custom_dash_pattern)
{
WIN_flush_line(&WIN_poly);
GraphOpSize(graphwin, W_dash_type, dt, 0, (char *) custom_dash_pattern, sizeof(t_dashtype));
}
TERM_PUBLIC void
WIN_put_text(unsigned int x, unsigned int y, const char *str)
{
WIN_flush_line(&WIN_poly);
if ((str == NULL) || !strlen(str))
return;
/* If no enhanced text processing is needed, we can use the plain */
/* vanilla put_text() routine instead of this fancy recursive one. */
if (!(term->flags & TERM_ENHANCED_TEXT) || ignore_enhanced_text || (!strpbrk(str, "{}^_@&~") && !contains_unicode(str)))
GraphOp(graphwin, W_put_text, x, y, str);
else
GraphOp(graphwin, W_enhanced_text, x, y, str);
}
TERM_PUBLIC int
WIN_justify_text(enum JUSTIFY mode)
{
GraphOp(graphwin, W_justify, mode, 0, NULL);
return (TRUE);
}
TERM_PUBLIC int
WIN_text_angle(float dang)
{
int ang = dang;
if (graphwin->rotate)
GraphOp(graphwin, W_text_angle, ang, 0, NULL);
return graphwin->rotate;
}
TERM_PUBLIC void
WIN_point(unsigned int x, unsigned int y, int number)
{
WIN_flush_line(&WIN_poly);
/* draw point shapes later to save memory */
/* HBB 20010411: secure against pointtype -1 or lower */
if (number < -1)
number = -1; /* refuse nonsense values */
if (number >= 0)
number %= WIN_POINT_TYPES;
number += 1;
GraphOp(graphwin, W_dot + number, x, y, NULL);
}
TERM_PUBLIC void
WIN_resume()
{
GraphResume(graphwin);
}
TERM_PUBLIC void
WIN_set_pointsize(double s)
{
if (s < 0) s = 1;
/* Pass the scale as a scaled-up integer. */
GraphOp(graphwin, W_pointsize, (int) 100 * s, 0, NULL);
}
TERM_PUBLIC void
WIN_linewidth(double linewidth)
{
// TODO: line width caching
WIN_flush_line(&WIN_poly);
WIN_last_linetype = LT_NODRAW; /* invalidate cached linetype */
GraphOp(graphwin, W_line_width, (int) 100 * linewidth, 0, NULL);
}
#ifdef USE_MOUSE
/* Implemented by Petr Mikulik, February 2001 --- the best Windows solutions
* come from OS/2 :-))
*/
TERM_PUBLIC void
WIN_put_tmptext(int i, const char str[])
{
Graph_put_tmptext(graphwin, i, str);
}
TERM_PUBLIC void
WIN_set_ruler(int x, int y)
{
Graph_set_ruler(graphwin, x, y);
}
TERM_PUBLIC void
WIN_set_cursor(int c, int x, int y)
{
Graph_set_cursor(graphwin, c, x, y);
}
TERM_PUBLIC void
WIN_set_clipboard(const char s[])
{
Graph_set_clipboard(graphwin, s);
}
#ifdef WGP_CONSOLE
TERM_PUBLIC int
WIN_waitforinput(int options)
{
/* Not required: message handling already done elsewhere. */
if (options == TERM_ONLY_CHECK_MOUSING)
return NUL;
return ConsoleGetch();
}
#endif /* WGP_CONSOLE */
#endif /* USE_MOUSE */
/* Note: this used to be a verbatim copy of PM_image (pm.trm) with only minor changes */
TERM_PUBLIC void
WIN_image(unsigned int M, unsigned int N, coordval *image,
gpiPoint *corner, t_imagecolor color_mode)
{
PBYTE rgb_image;
unsigned int image_size;
unsigned int pad_bytes;
WIN_flush_line(&WIN_poly);
/* BM: IC_PALETTE, IC_RGB and IC_RGBA images are converted to a format
suitable for Windows:
- sequence of lines is reversed
- each line starts at a 4 byte boundary
- 24bits RGB for IC_PALETTE and IC_RGB
- 32bits RGBA for IC_RGBA
*/
if ((color_mode == IC_PALETTE) || (color_mode == IC_RGB)) {
pad_bytes = (4 - (3 * M) % 4) % 4; /* scan lines start on ULONG boundaries */
image_size = (3 * M + pad_bytes) * N;
} else if (color_mode == IC_RGBA) {
pad_bytes = 0;
image_size = M * N * 4;
} else {
int_warn(NO_CARET, "Unknown color mode in WIN_image");
return;
}
rgb_image = (PBYTE) gp_alloc(image_size, "WIN RGB image");
if (color_mode == IC_PALETTE) {
unsigned int x, y;
rgb_image += N * (3 * M + pad_bytes);
for (y=0; y<N; y++) {
rgb_image -= 3 * M + pad_bytes;
for (x=0; x<M; x++) {
rgb255_color rgb255;
rgb255maxcolors_from_gray(*image++, &rgb255);
*(rgb_image++) = rgb255.b;
*(rgb_image++) = rgb255.g;
*(rgb_image++) = rgb255.r;
}
rgb_image -= 3 * M;
}
} else if (color_mode == IC_RGB) {
unsigned int x, y;
rgb_image += N * (3 * M + pad_bytes);
for (y=0; y<N; y++) {
rgb_image -= 3 * M + pad_bytes;
for (x=0; x<M; x++) {
rgb255_color rgb255;
rgb255.r = (BYTE) (*image++ * 255 + 0.5);
rgb255.g = (BYTE) (*image++ * 255 + 0.5);
rgb255.b = (BYTE) (*image++ * 255 + 0.5);
*(rgb_image++) = rgb255.b;
*(rgb_image++) = rgb255.g;
*(rgb_image++) = rgb255.r;
}
rgb_image -= 3 * M;
}
} else if (color_mode == IC_RGBA) {
unsigned int x, y;
rgb_image += M * N * 4;
for (y=0; y<N; y++) {
rgb_image -= 4 * M;
for (x=0; x<M; x++) {
coordval red, green ,blue, alpha;
red = *image++; /* RGB is [0:1] */
green = *image++;
blue = *image++;
alpha = *image++; /* BUT alpha is [0:255] */
*(rgb_image++) = (BYTE)(blue * alpha);
*(rgb_image++) = (BYTE)(green * alpha);
*(rgb_image++) = (BYTE)(red * alpha);
*(rgb_image++) = (BYTE)(alpha);
}
rgb_image -= 4 * M;
}
}
/* squeeze all the information into the buffer */
if ((color_mode == IC_PALETTE) || (color_mode == IC_RGB) || (color_mode == IC_RGBA)) {
GraphOp(graphwin, W_image, color_mode, 0, NULL);
GraphOp(graphwin, W_image, corner[0].x, corner[0].y, NULL);
GraphOp(graphwin, W_image, corner[1].x, corner[1].y, NULL);
GraphOp(graphwin, W_image, corner[2].x, corner[2].y, NULL);
GraphOp(graphwin, W_image, corner[3].x, corner[3].y, NULL);
/* GraphOp() cannot be used here since the image might
contain char(0), so use GraphOpSize() instead */
GraphOpSize(graphwin, W_image, M, N, (LPCSTR)rgb_image, image_size);
}
free(rgb_image);
}
TERM_PUBLIC int
WIN_make_palette(t_sm_palette *palette)
{
/* Win can do continuous colors. However, we round them only to WIN_PAL_COLORS levels
* in order to pass an integer to GraphOp; it also reasonably limits
* the number of colors if "copy to clipboard" is used.
* EAM: Would it be better to use the approximate_palette() mechanism instead,
* like the x11 terminal?
*/
return WIN_PAL_COLORS;
}
TERM_PUBLIC void
WIN_set_color(t_colorspec *colorspec)
{
// TODO: color caching
WIN_flush_line(&WIN_poly);
switch (colorspec->type ) {
case TC_FRAC: {
/* Immediately translate palette index to RGB colour */
rgb255_color rgb255;
rgb255maxcolors_from_gray(colorspec->value, &rgb255);
GraphOp(graphwin, W_setcolorrgb, (rgb255.g << 8) | rgb255.b, (rgb255.r), NULL);
break;
}
case TC_RGB:
/* highest byte of colorspec->lt contains alpha */
GraphOp(graphwin, W_setcolorrgb, (colorspec->lt) & 0xffff, (colorspec->lt >> 16) & 0xffff, NULL);
break;
case TC_LT:
GraphOp(graphwin, W_setcolor, colorspec->lt, 0, NULL);
break;
default:
break;
}
WIN_last_linetype = LT_NODRAW;
}
TERM_PUBLIC void
WIN_filled_polygon(int points, gpiPoint *corners)
{
int i;
GraphOp(graphwin, W_fillstyle, corners->style, 0, NULL);
/* Eliminate duplicate polygon points. */
if ((corners[0].x == corners[points - 1].x) &&
(corners[0].y == corners[points - 1].y))
points--;
for (i = 0; i < points; i++)
GraphOp(graphwin, W_filled_polygon_pt, corners[i].x, corners[i].y, NULL);
GraphOp(graphwin, W_filled_polygon_draw, points, 0, NULL);
}
TERM_PUBLIC void
WIN_boxfill(
int style,
unsigned int xleft, unsigned int ybottom,
unsigned int width, unsigned int height)
{
WIN_flush_line(&WIN_poly);
/* split into multiple commands to squeeze through all the necessary info */
GraphOp(graphwin, W_fillstyle, style, 0, NULL);
GraphOp(graphwin, W_move, xleft, ybottom, NULL);
GraphOp(graphwin, W_boxfill, xleft + width, ybottom + height, NULL);
}
TERM_PUBLIC int
WIN_set_font(const char *font)
{
/* Note: defer the determination of default font name and default
font size until drawgraph() is executed. */
if ((font == NULL) || (font[0] == '\0')) {
/* select default font */
GraphOp(graphwin, W_font, 0, 0, NULL);
} else {
int fontsize;
char * size;
size = strrchr(font, ',');
if (size == NULL) {
/* only font name given */
GraphOp(graphwin, W_font, 0, 0, font);
} else if (size == font) {
/* only font size given */
sscanf(size + 1, "%i", &fontsize);
GraphOp(graphwin, W_font, fontsize, 0, NULL);
} else {
/* full font information supplied */
char fontname[MAXFONTNAME];
memcpy(fontname, font, size - font);
fontname[size-font] = '\0';
sscanf(size + 1, "%i", &fontsize);
GraphOp(graphwin, W_font, fontsize, 0, fontname);
}
}
return TRUE;
}
/* BM: new callback functions for enhanced text
These are only stubs that call functions in wgraph.c.
*/
TERM_PUBLIC void
WIN_enhanced_open(
char *fontname,
double fontsize, double base,
TBOOLEAN widthflag, TBOOLEAN showflag,
int overprint)
{
GraphEnhancedOpen(fontname, fontsize, base, widthflag, showflag, overprint);
}
TERM_PUBLIC void
WIN_enhanced_flush()
{
GraphEnhancedFlush();
}
TERM_PUBLIC void
WIN_layer(t_termlayer syncpoint)
{
WIN_flush_line(&WIN_poly);
/* ignore LAYER_RESET in multiplot mode */
if (((syncpoint == TERM_LAYER_RESET) ||
(syncpoint == TERM_LAYER_RESET_PLOTNO)) &&
multiplot)
return;
GraphOp(graphwin, W_layer, syncpoint, 0, NULL);
}
TERM_PUBLIC void
WIN_hypertext(int type, const char * text)
{
WIN_flush_line(&WIN_poly);
GraphOp(graphwin, W_hypertext, type, 0, text);
}
TERM_PUBLIC void
WIN_boxed_text(unsigned int x, unsigned int y, int option)
{
GraphOp(graphwin, W_boxedtext, option, 0, NULL);
GraphOp(graphwin, W_boxedtext, x, y, NULL);
}
TERM_PUBLIC void
WIN_modify_plots(unsigned int operations, int plotno)
{
GraphModifyPlots(graphwin, operations, plotno);
}
#endif /* TERM_BODY */
#ifdef TERM_TABLE
TERM_TABLE_START(win_driver)
"windows", "Microsoft Windows",
WIN_XMAX, WIN_YMAX, WIN_VCHAR, WIN_HCHAR,
WIN_VTIC, WIN_HTIC, WIN_options, WIN_init, WIN_reset,
WIN_text, null_scale, WIN_graphics, WIN_move, WIN_vector,
WIN_linetype, WIN_put_text, WIN_text_angle,
WIN_justify_text, WIN_point, do_arrow, WIN_set_font,
WIN_set_pointsize,
TERM_CAN_MULTIPLOT|TERM_NO_OUTPUTFILE|TERM_ALPHA_CHANNEL|TERM_CAN_DASH
|TERM_LINEWIDTH|TERM_FONTSCALE|TERM_POINTSCALE|TERM_ENHANCED_TEXT,
WIN_text /* suspend */ , WIN_resume,
WIN_boxfill, WIN_linewidth,
#ifdef USE_MOUSE
# ifdef WGP_CONSOLE
WIN_waitforinput ,
# else
0 /* WIN_waitforinput */,
# endif /* WGP_CONSOLE */
WIN_put_tmptext, WIN_set_ruler, WIN_set_cursor, WIN_set_clipboard,
#endif
WIN_make_palette, 0 /* previous_palette */,
WIN_set_color, WIN_filled_polygon,
WIN_image,
WIN_enhanced_open, WIN_enhanced_flush, do_enh_writec,
WIN_layer,
0, /* no term->path */
0.0, /* Scale (unused) */
WIN_hypertext,
WIN_boxed_text,
WIN_modify_plots, WIN_dashtype
TERM_TABLE_END(win_driver)
#undef LAST_TERM
#define LAST_TERM win_driver
#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */
#ifdef TERM_HELP
START_HELP(windows)
"1 windows",
"?commands set terminal windows",
"?set terminal windows",
"?set term windows",
"?terminal windows",
"?term windows",
"?windows",
" The `windows` terminal is a fast interactive terminal driver that uses the",
" Windows GDI to draw and write text. The cross-platform `terminal wxt` and",
" `terminal qt` are also supported on Windows.",
"",
" Syntax:",
" set terminal windows {<n>}",
" {color | monochrome}",
" {solid | dashed}",
" {rounded | butt}",
" {enhanced | noenhanced}",
" {font <fontspec>}",
" {fontscale <scale>}",
" {linewidth <scale>}",
" {pointscale <scale>}",
" {background <rgb color>}",
" {title \"Plot Window Title\"}",
" {{size | wsize} <width>,<height>}",
" {position <x>,<y>}",
" {docked {layout <rows>,<cols>} | standalone}",
" {close}",
"",
" Multiple plot windows are supported: `set terminal win <n>` directs the",
" output to plot window number n.",
"",
" `color` and `monochrome` select colored or mono output,",
" `dashed` and `solid` select dashed or solid lines. Note that `color`",
" defaults to `solid`, whereas `monochrome` defaults to `dashed`.",
" `rounded` sets line caps and line joins to be rounded; `butt` is the",
" default, butt caps and mitered joins.",
" `enhanced` enables enhanced text mode features (subscripts,",
" superscripts and mixed fonts, see `enhanced text` for more information).",
" `<fontspec>` is in the format \"<fontface>,<fontsize>\", where \"<fontface>\"",
" is the name of a valid Windows font, and <fontsize> is the size of the font",
" in points and both components are optional.",
" Note that in previous versions of gnuplot the `font` statement could be left",
" out and <fontsize> could be given as a number without double quotes. This is",
" no longer supported.",
" `linewidth`, `fontscale`, `pointscale` can be used to scale the width of",
" lines, the size of text, or the size of the point symbols.",
" `title` changes the title of the graph window.",
" `size` defines the width and height of the window's drawing area in pixels,",
" `wsize` defines the actual size of the window itself and `position` defines",
" the origin of the window i.e. the position of the top left corner on the",
" screen (again in pixel). These options override any default settings",
" from the `wgnuplot.ini` file.",
"",
" `docked` embeds the graph window in the wgnuplot text window and the `size`",
" and `position` options are ignored. Note that `docked` is not available for",
" console-mode gnuplot. Setting this option changes the default for new"
" windows. The initial default is `standalone`. The `layout` option allows to",
" reserve a minimal number of columns and rows for graphs in docked mode. If",
" there are more graphs than fit the given layout, additional rows will be added.",
" Graphs are sorted by the numerical id, filling rows first.",
"",
" Other options may be changed using the `graph-menu` or the initialization file",
" `wgnuplot.ini`.",
"",
/* FIXME: Move to persist section */
" The Windows version normally terminates immediately as soon as the end of",
" any files given as command line arguments is reached (i.e. in non-interactive",
" mode), unless you specify `-` as the last command line option.",
" It will also not show the text-window at all, in this mode, only the plot.",
" By giving the optional argument `-persist` (same as for gnuplot under x11;",
" former Windows-only options `/noend` or `-noend` are still accepted as well),",
" will not close gnuplot. Contrary to gnuplot on other operating systems,",
" gnuplot's interactive command line is accessible after the -persist option.",
"",
" The plot window remains open when the gnuplot terminal is changed with a",
" `set term` command. The plot window can be closed with `set term windows close`.",
"",
" `gnuplot` supports different methods to create printed output on Windows,",
" see `windows printing`. The windows terminal supports data exchange with ",
" other programs via clipboard and EMF files, see `graph-menu`. You can also",
" use the `terminal emf` to create EMF files.",
"2 graph-menu",
"?commands set terminal windows graph-menu",
"?set terminal windows graph-menu",
"?set term windows graph-menu",
"?windows graph-menu",
"?graph-menu",
" The `gnuplot graph` window has the following options on a pop-up menu",
" accessed by pressing the right mouse button(*) or selecting `Options` from the",
" system menu or the toolbar:",
"",
" `Copy to Clipboard` copies a bitmap and an enhanced metafile picture.",
"",
" `Save as EMF...` allows the user to save the current graph window as",
" enhanced metafile (EMF or EMF+).",
"",
" `Save as Bitmap...` allows the user to save a copy of the graph as bitmap",
" file.",
"",
" `Print...` prints the graphics windows using a Windows printer driver and",
" allows selection of the printer and scaling of the output."
" See also `windows printing`.",
"",
" `Bring to Top` when checked raises the graph window to the top after every",
" plot.",
"",
" `Color` when checked enables color output. When unchecked it forces",
" all grayscale output. This is e.g. useful to test appearance of monochrome",
" printouts.",
"",
#ifdef USE_WINGDI
" `GDI backend` draws to the screen using Windows GDI. This is the classical",
" windows terminal, which is fast, but lacks many features such as",
" anti-aliasing, oversampling and full transparency support. It is now",
" deprecated.",
#else
" The `GDI backend` which uses the classic GDI API is deprecated and has been",
" disabled in this version.",
#endif
"",
" `GDI+ backend` draws to the screen using the GDI+ Windows API. It supports",
" full antialiasing, oversampling, transparency and custom dash patterns.",
" This was the default in versions 5.0 and 5.2.",
"",
" `Direct2D backend` uses Direct2D & DirectWrite APIs to draw. It uses graphic",
" card acceleration and is hence typically much faster. Since Direct2D can"
" not create EMF data, saving and copying to clipboard of EMF data fall back"
" to GDI+ while bitmap data is generated by D2d.",
" This is the recommended and default backend since version 5.3.",
"",
" `Oversampling` draws diagonal lines at fractional pixel positions to avoid",
" \"wobbling\" effects. Vertical or horizontal lines are still snapped",
" to integer pixel positions to avoid blurry lines.",
"",
" `Antialiasing` enables smoothing of lines and edges. Note that this slows",
" down drawing. `Antialiasing of polygons` is enabled by default but might",
" slow down drawing with the GDI+ backend.",
"",
" `Fast rotation` switches antialiasing temporarily off while rotating the",
" graph with the mouse. This speeds up drawing considerably at the expense",
" of an additional redraw after releasing the mouse button.",
"",
" `Background...` sets the window background color.",
"",
" `Choose Font...` selects the font used in the graphics window.",
"",
#ifdef WIN_CUSTOM_PENS
" `Line Styles...` allows customization of the line colors and styles.",
"",
#endif
" `Update wgnuplot.ini` saves the current window locations, window sizes, text",
" window font, text window font size, graph window font, graph window font",
" size, background color to the initialization file `wgnuplot.ini`.",
"",
"^<HR align=\"left\" width=\"100\">",
" (*) Note that this menu is only available by pressing the right mouse button",
" with `unset mouse`.",
"2 printing",
"?commands set terminal windows printing",
"?set terminal windows printing",
"?set term windows printing",
"?windows printing",
"?printing",
"?screendump",
" In order of preference, graphs may be printed in the following ways:",
"",
" `1.` Use the `gnuplot` command `set terminal` to select a printer and `set",
" output` to redirect output to a file.",
"",
" `2.` Select the `Print...` command from the `gnuplot graph` window. An extra",
" command `screendump` does this from the text window.",
"",
" `3.` If `set output \"PRN\"` is used, output will go to a temporary file. When",
" you exit from `gnuplot` or when you change the output with another `set",
" output` command, a dialog box will appear for you to select a printer port.",
" If you choose OK, the output will be printed on the selected port, passing",
" unmodified through the print manager. It is possible to accidentally (or",
" deliberately) send printer output meant for one printer to an incompatible",
" printer.",
"",
"2 text-menu", /* FIXME: this is not really related to the windows driver, but the windows platform */
"?commands set terminal windows text-menu",
"?set terminal windows text-menu",
"?set term windows text-menu",
"?windows text-menu",
"?text-menu",
" The `gnuplot text` window has the following options on a pop-up menu accessed",
" by pressing the right mouse button or selecting `Options` from the system",
" menu:",
"",
" `Copy to Clipboard` copies marked text to the clipboard.",
"",
" `Paste` copies text from the clipboard as if typed by the user.",
"",
" `Choose Font...` selects the font used in the text window.",
"",
" `System Colors` when selected makes the text window honor the System Colors",
" set using the Control Panel. When unselected, text is black or blue on a",
" white background.",
"",
" `Wrap long lines` when selected lines longer than the current window width",
" are wrapped.",
"",
" `Update wgnuplot.ini` saves the current settings to the initialisation file",
" `wgnuplot.ini`, which is located in the user's application data directory.",
"",
"2 wgnuplot.mnu", /* FIXME: this is not really related to the windows driver, but the windows platform */
"?windows wgnuplot.mnu",
"?wgnuplot.mnu",
" If the menu file `wgnuplot.mnu` is found in the same directory as",
" `gnuplot`, then the menu specified in `wgnuplot.mnu` will be loaded.",
" Menu commands:",
"",
" [Menu] starts a new menu with the name on the following line.",
" [EndMenu] ends the current menu.",
" [--] inserts a horizontal menu separator.",
" [|] inserts a vertical menu separator.",
" [Button] puts the next macro on a push button instead of a menu.",
"",
" Macros take two lines with the macro name (menu entry) on the first line and",
" the macro on the second line. Leading spaces are ignored. Macro commands:",
"",
" [INPUT] Input string with prompt terminated by [EOS] or {ENTER}",
" [EOS] End Of String terminator. Generates no output.",
" [OPEN] Get name of a file to open, with the title of the dialog",
" terminated by [EOS], followed by a default filename terminated",
" by [EOS] or {ENTER}.",
" [SAVE] Get name of a file to save. Parameters like [OPEN]",
" [DIRECTORY] Get name of a directory, with the title of the dialog",
" terminated by [EOS] or {ENTER}",
"",
" Macro character substitutions:",
"",
" {ENTER} Carriage Return '\\r'",
" {TAB} Tab '\\011'",
" {ESC} Escape '\\033'",
" {^A} '\\001'",
" ...",
" {^_} '\\031'",
"",
" Macros are limited to 256 characters after expansion.",
"",
"2 wgnuplot.ini",
"?commands set terminal windows wgnuplot.ini",
"?set terminal windows wgnuplot.ini",
"?set term windows wgnuplot.ini",
"?windows wgnuplot.ini",
"?wgnuplot.ini",
" The Windows text window and the `windows` terminal will read some of their options from",
" the `[WGNUPLOT]` section of `wgnuplot.ini`.",
" This file is located in the user's application data directory. Here's a sample",
" `wgnuplot.ini` file:",
"",
" [WGNUPLOT]",
" TextOrigin=0 0",
" TextSize=640 150",
" TextFont=Consolas,9",
" TextWrap=1",
" TextLines=400",
" TextMaximized=0",
" SysColors=0",
" GraphOrigin=0 150",
" GraphSize=640 330",
" GraphFont=Tahoma,10",
" GraphColor=1",
" GraphToTop=1",
" GraphGDI+=1",
" GraphD2D=0",
" GraphGDI+Oversampling=1",
" GraphAntialiasing=1",
" GraphPolygonAA=1",
" GraphFastRotation=1",
" GraphBackground=255 255 255",
" DockVerticalTextFrac=350",
" DockHorizontalTextFrac=400",
#ifdef WIN_CUSTOM_PENS
" Border=0 0 0 0 0",
" Axis=192 192 192 2 2",
" Line1=0 0 255 0 0",
" Line2=0 255 0 0 1",
" Line3=255 0 0 0 2",
" Line4=255 0 255 0 3",
" Line5=0 0 128 0 4",
#endif
"",
"^ <h3>Text window options</h3> ",
"",
" These settings apply to the wgnuplot text-window only."
"",
" The `TextOrigin` and `TextSize` entries specify the location and size of the",
" text window. If `TextMaximized` is non-zero, the window will be maximized.",
"",
" The `TextFont` entry specifies the text window font and size.",
"",
" The `TextWrap` entry selects wrapping of long text lines.",
"",
" The `TextLines` entry specifies the number of (unwrapped) lines the internal",
" buffer of the text window can hold. This value currently cannot be changed",
" from within wgnuplot.",
"",
" See `text-menu`.",
"",
"^ <h3>Docked graph options</h3>",
"",
" `DockVerticalTextFrac` and `DockHorizontalTextFrac` set the fraction of the",
" window reserved for the text window in permille of the vertical or horizontal",
" layout.",
"",
"^ <h3>Graph window options</h3>",
"",
" The `GraphFont` entry specifies the font name and size in points.",
#ifdef WIN_CUSTOM_PENS
"",
" The five",
" numbers given in the `Border`, `Axis` and `Line` entries are the `Red`",
" intensity (0--255), `Green` intensity, `Blue` intensity, `Color Linestyle`",
" and `Mono Linestyle`. `Linestyles` are 0=SOLID, 1=DASH, 2=DOT, 3=DASHDOT,",
" 4=DASHDOTDOT. In the sample `wgnuplot.ini` file above, Line 2 is a green",
" solid line in color mode, or a dashed line in monochrome mode. The default",
" line width is 1 pixel. If `Linestyle` is negative, it specifies the width of",
" a SOLID line in pixels. Line1 and any linestyle used with the `points` style",
" must be SOLID with unit width.",
#endif
"",
" See `graph-menu`."
END_HELP(windows)
#endif /* TERM_HELP */
|