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 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 5160 5161 5162 5163 5164 5165 5166 5167 5168 5169 5170 5171 5172 5173 5174 5175 5176 5177 5178 5179 5180 5181 5182 5183 5184 5185 5186 5187 5188 5189 5190 5191 5192 5193 5194 5195 5196 5197 5198 5199 5200 5201 5202 5203 5204 5205 5206 5207 5208 5209 5210 5211 5212 5213 5214 5215 5216 5217 5218 5219 5220 5221 5222 5223 5224 5225 5226 5227 5228 5229 5230 5231 5232 5233 5234 5235 5236 5237 5238 5239 5240 5241 5242 5243 5244 5245 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 5273 5274 5275 5276 5277 5278 5279 5280 5281 5282 5283 5284 5285 5286 5287 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 5301 5302 5303 5304 5305 5306 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 5318 5319 5320 5321 5322 5323 5324 5325 5326 5327 5328 5329 5330 5331 5332 5333 5334 5335 5336 5337 5338 5339 5340 5341 5342 5343 5344 5345 5346 5347 5348 5349 5350 5351 5352 5353 5354 5355 5356 5357 5358 5359 5360 5361 5362 5363 5364 5365 5366 5367 5368 5369 5370 5371 5372 5373 5374 5375 5376 5377 5378 5379 5380 5381 5382 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 5398 5399 5400 5401 5402 5403 5404 5405 5406 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 5465 5466 5467 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 5522 5523 5524 5525 5526 5527 5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 5552 5553 5554 5555 5556 5557 5558 5559 5560 5561 5562 5563 5564 5565 5566 5567 5568 5569 5570 5571 5572 5573 5574 5575 5576 5577 5578 5579 5580 5581 5582 5583 5584 5585 5586 5587 5588 5589 5590 5591 5592 5593 5594 5595 5596 5597 5598 5599 5600 5601 5602 5603 5604 5605 5606 5607 5608 5609 5610 5611 5612 5613 5614 5615 5616 5617 5618 5619 5620 5621 5622 5623 5624 5625 5626 5627 5628 5629 5630 5631 5632 5633 5634 5635 5636 5637 5638 5639 5640 5641 5642 5643 5644 5645 5646 5647 5648 5649 5650 5651 5652 5653 5654 5655 5656 5657 5658 5659 5660 5661 5662 5663 5664 5665 5666 5667 5668 5669 5670 5671 5672 5673 5674 5675 5676 5677 5678 5679 5680 5681 5682 5683 5684 5685 5686 5687 5688 5689 5690 5691 5692 5693 5694 5695 5696 5697 5698 5699 5700 5701 5702 5703 5704 5705 5706 5707 5708 5709 5710 5711 5712 5713 5714 5715 5716 5717 5718 5719 5720 5721 5722 5723 5724 5725 5726 5727 5728 5729 5730 5731 5732 5733 5734 5735 5736 5737 5738 5739 5740 5741 5742 5743 5744 5745 5746 5747 5748 5749 5750 5751 5752 5753 5754 5755 5756 5757 5758 5759 5760 5761 5762 5763 5764 5765 5766 5767 5768 5769 5770 5771 5772 5773 5774 5775 5776 5777 5778 5779 5780 5781 5782 5783 5784 5785 5786 5787 5788 5789 5790 5791 5792 5793 5794 5795 5796 5797 5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 5821 5822 5823 5824 5825 5826 5827 5828 5829 5830 5831 5832 5833 5834 5835 5836 5837 5838 5839 5840 5841 5842 5843 5844 5845 5846 5847 5848 5849 5850 5851 5852 5853 5854 5855 5856 5857 5858 5859 5860 5861 5862 5863 5864 5865 5866 5867 5868 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 5910 5911 5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 5929 5930 5931 5932 5933 5934 5935 5936 5937 5938 5939 5940 5941 5942 5943 5944 5945 5946 5947 5948 5949 5950 5951 5952 5953 5954 5955 5956 5957 5958 5959 5960 5961 5962 5963 5964 5965 5966 5967 5968 5969 5970 5971 5972 5973 5974 5975 5976 5977 5978 5979 5980 5981 5982 5983 5984 5985 5986 5987 5988 5989 5990 5991 5992 5993 5994 5995 5996 5997 5998 5999 6000 6001 6002 6003 6004 6005 6006 6007 6008 6009 6010 6011 6012 6013 6014 6015 6016 6017 6018 6019 6020 6021 6022 6023 6024 6025 6026 6027 6028 6029 6030 6031 6032 6033 6034 6035 6036 6037 6038 6039 6040 6041 6042 6043 6044 6045 6046 6047 6048 6049 6050 6051 6052 6053 6054 6055 6056 6057 6058 6059 6060
|
/* DO NOT EDIT!
** This file has been automatically generated from "ts.et" */
#ifdef __cplusplus
# define EXTERN extern "C"
#else
# define EXTERN extern
#endif
EXTERN int Et_Eval(const char *,int,const char*,...);
EXTERN int Et_EvalInt(const char *,int,const char*,...);
EXTERN char *Et_EvalString(const char *,int,const char*,...);
EXTERN double Et_EvalDouble(const char *,int,const char*,...);
EXTERN void Et_EvalInclude(const char *,char *);
EXTERN void Et_Init(int *, char **);
EXTERN void Et_MainLoop(void);
EXTERN void Et_ReadStdin(void);
EXTERN struct Tcl_Interp *Et_Interp;
EXTERN struct Tk_Window_ *Et_MainWindow;
EXTERN struct _XDisplay *Et_Display;
#define ET_OK 0
#define ET_ERROR 1
#undef EXTERN
#define UNIX 1
#define WIN32 0
#line 1 "ts.et"
/* ts.c - Mainmodul ts */
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <tk.h>
#define TS_VERSION "1998/02"
/* Prototypes of functions defined in exec.et */
extern int StartTty();
extern int InstallCommandsExec();
extern int CreateTerm();
extern void KillAllProcesses();
int main(int argc, char **argv)
{
Et_Init(&argc, argv);
{void Et_Init_ts_et(void); Et_Init_ts_et();};
InstallCommandsExec();
Tcl_SetVar(Et_Interp, "TS_BASE", TS_BASE, 0);
Tcl_SetVar(Et_Interp, "TS_VERSION", TS_VERSION, 0);
#ifdef DEBUG
Tcl_SetVar2(Et_Interp, "params", "debug", "1", 0);
#else
Tcl_SetVar2(Et_Interp, "params", "debug", "0", 0);
#endif
{ static char _ET_script_[] =
"proc Dialog {w geometry title text bitmap default cancel args} {\n"
"global button\n"
"\n"
"toplevel $w -class Dialog\n"
"wm title $w $title\n"
"wm iconname $w Dialog\n"
"wm geometry $w $geometry\n"
"wm transient $w .\n"
"\n"
"frame $w.top -relief raised -bd 1\n"
"pack $w.top -side top -fill both\n"
"frame $w.bot -relief raised -bd 1\n"
"pack $w.bot -side bottom -fill both\n"
"\n"
"message $w.top.msg -width 250 -text $text \\\n"
"-font -Adobe-Times-Medium-R-Normal-*-180-*\n"
"pack $w.top.msg -side right -expand 1 -fill both \\\n"
"-padx 5 -pady 5\n"
"if {$bitmap != \"\"} {\n"
"label $w.top.bitmap -bitmap $bitmap\n"
"pack $w.top.bitmap -side left -padx 5 -pady 5\n"
"}\n"
"\n"
"set i 0\n"
"foreach but $args {\n"
"set text [lindex $but 0]\n"
"if [llength $but]>1 {\n"
"bind $w [lindex $but 1] \"set button $i\"\n"
"}\n"
"if {$i == $default} {\n"
"frame $w.bot.default -relief sunken -bd 1\n"
"button $w.bot.button$i -text $text -command \\\n"
"\"set button $i\"\n"
"pack $w.bot.button$i -in $w.bot.default -side left \\\n"
"-padx 5 -pady 3\n"
"pack $w.bot.default -side left -expand 1 \\\n"
"-padx 5 -pady 3\n"
"} else {\n"
"button $w.bot.button$i -text $text -command \\\n"
"\"set button $i\"\n"
"pack $w.bot.button$i -side left -expand 1 \\\n"
"-padx 10 -pady 10 -ipadx 2 -ipady 1\n"
"}\n"
"incr i\n"
"}\n"
"if {$default >= 0} {\n"
"bind $w <Control-Return> \"$w.bot.button$default flash; \\\n"
"set button $default\"\n"
"}\n"
"if {$cancel >= 0} {\n"
"bind $w <Escape> \"set button $cancel\"\n"
"}\n"
"set oldfocus [focus]\n"
"focus $w\n"
"grab $w\n"
"tkwait variable button\n"
"grab release $w\n"
"focus $oldfocus\n"
"destroy $w\n"
"return $button\n"
"}\n"
"\n"
"proc Warning {geometry text} {\n"
"Dialog .warn $geometry Warning $text warning 0 0 {OK <Return>} \n"
"}\n"
"\n"
"proc InpDlg {result w title geometry lab fields values} {\n"
"upvar $result r\n"
"upvar $values v\n"
"\n"
"global inpdlg_var\n"
"global inpdlg_type\n"
"global inpdlg_ok\n"
"\n"
"proc InpDlgOk {} {\n"
"global inpdlg_ok\n"
"\n"
"set inpdlg_ok 1\n"
"}\n"
"\n"
"proc InpDlgCancel {} {\n"
"global inpdlg_ok\n"
"\n"
"set inpdlg_ok 0\n"
"}\n"
"\n"
"proc InpDlgTest {i} {\n"
"global inpdlg_var\n"
"global inpdlg_type\n"
"\n"
"switch -exact $inpdlg_type($i) {\n"
"year {\n"
"return 1\n"
"}\n"
"int {\n"
"if {[catch {expr int($inpdlg_var($i)) == $inpdlg_var($i)} r] == 0} {\n"
"if $r {return 1} else {return 0}\n"
"} else {return 0}\n"
"}\n"
"default {return 1}\n"
"}\n"
"return 0\n"
"}\n"
"\n"
"proc InpDlgNext {w i count} {\n"
"\n"
"if ![InpDlgTest $i] {\n"
"puts \\a\n"
"return\n"
"}\n"
"incr i\n"
"if $i>=$count {set i 0}\n"
"focus $w.f$i.e\n"
"}\n"
"\n"
"proc InpDlgPrev {w i count} {\n"
"\n"
"if ![InpDlgTest $i] {\n"
"puts \\a\n"
"return\n"
"}\n"
"incr i -1\n"
"if $i<0 {set i [expr $count-1]}\n"
"focus $w.f$i.e\n"
"}\n"
"\n"
"proc ViewCursor {w} {\n"
"set l [lindex [$w config -width] 4]\n"
"set i [$w index insert]\n"
"if {$i < $l} {\n"
"$w xview 0\n"
"} else {\n"
"$w xview [expr $i - $l + 1]\n"
"}\n"
"}\n"
"\n"
"toplevel $w\n"
"wm geometry $w $geometry\n"
"\n"
"wm title $w $title\n"
"\n"
"label $w.label -text $lab -relief groove -bd 1\n"
"pack $w.label -fill x\n"
"frame $w.fdata -bd 1 -relief groove\n"
"pack $w.fdata -fill x\n"
"set count [llength $fields]\n"
"set i 0\n"
"foreach f $fields {\n"
"frame $w.f$i\n"
"pack $w.f$i -fill x -in $w.fdata\n"
"label $w.f$i.l -width 20 -font fixed -text [lindex $f 0] -anchor w\n"
"entry $w.f$i.e -textvariable inpdlg_var($i) -width [lindex $f 2] \\\n"
"-relief sunken -font fixed\n"
"bind $w.f$i.e <Return> \"%W xview 0 ; InpDlgNext $w $i $count\"\n"
"bind $w.f$i.e <Down> \"%W xview 0 ; InpDlgNext $w $i $count\"\n"
"bind $w.f$i.e <Tab> \"%W xview 0 ; InpDlgNext $w $i $count\"\n"
"bind $w.f$i.e <Shift-Tab> \"%W xview 0 ; InpDlgPrev $w $i $count\"\n"
"bind $w.f$i.e <Up> \"%W xview 0 ; InpDlgPrev $w $i $count\"\n"
"bind $w.f$i.e <Control-Return> \"InpDlgOk\"\n"
"bind $w.f$i.e <Escape> \"InpDlgCancel\"\n"
"pack $w.f$i.l $w.f$i.e -side left\n"
"set inpdlg_type($i) [lindex $f 1]\n"
"set inpdlg_var($i) \"\"\n"
"incr i\n"
"}\n"
"\n"
"set i 0\n"
"foreach l $fields {\n"
"set ri [lindex $l 3]\n"
"switch $inpdlg_type($i) {\n"
"money {\n"
"set sig [sign $v($ri)]\n"
"if ![catch {expr abs($v($ri))/100} mark] {\n"
"set inpdlg_var($i) [format \"%4d,%02d\" \\\n"
"[expr $sig * $mark] [expr abs($v($ri))%100]]\n"
"} else {\n"
"puts $mark\n"
"set inpdlg_var($i) \"\"\n"
"}\n"
"}\n"
"mnr6 {\n"
"if [string match $v($ri) \"\"] {\n"
"set inpdlg_var($i) \"\"\n"
"} else {\n"
"set inpdlg_var($i) \"$v($ri)00\"\n"
"}\n"
"}\n"
"default {set inpdlg_var($i) $v($ri)}\n"
"}\n"
"incr i\n"
"}\n"
"\n"
"frame $w.fbuttons -bd 1 -relief groove\n"
"pack $w.fbuttons -fill x\n"
"frame $w.fok -relief sunken -bd 2\n"
"button $w.ok -text \"OK\" -command InpDlgOk\n"
"button $w.cancel -text \"Cancel\" -command InpDlgCancel\n"
"\n"
"pack $w.fok $w.cancel -side left -padx 10 -pady 3 -in $w.fbuttons\n"
"pack $w.ok -padx 3 -pady 3 -in $w.fok\n"
"\n"
"set oldfocus [focus]\n"
"focus $w.f0.e\n"
"grab $w\n"
"tkwait variable inpdlg_ok\n"
"grab release $w\n"
"if $inpdlg_ok {\n"
"set i 0\n"
"foreach l $fields {\n"
"set ri [lindex $l 3]\n"
"switch $inpdlg_type($i) {\n"
"money {\n"
"set val $inpdlg_var($i)\n"
"set m [string first \",\" $val]\n"
"if $m!=-1 {\n"
"set val [string range $val 0 [expr $m-1]].[string range $val \\\n"
"[expr $m+1] end]\n"
"}\n"
"if [catch {expr round($val*100)} r($ri)] {set r($ri) 0}\n"
"}\n"
"mnr6 {\n"
"if [catch \\\n"
"{format \"%6d\" [expr $inpdlg_var($i) / 100]} r($ri)] {\n"
"set r($ri) 0\n"
"}\n"
"}\n"
"default {set r($ri) $inpdlg_var($i)}\n"
"}\n"
"incr i\n"
"}\n"
"}\n"
"focus $oldfocus\n"
"destroy $w\n"
"return $inpdlg_ok\n"
"}\n"
"\n"
"\n"
"\n"
"proc lstdlg_sel {{i 0}} {\n"
"global dlg\n"
"\n"
"$dlg(win).l activate $i\n"
"$dlg(win).l select anchor $i\n"
"$dlg(win).l select set anchor $i\n"
"$dlg(win).l see $i\n"
"}\n"
"\n"
"proc lstdlg_selnext {} {\n"
"global dlg\n"
"\n"
"set i [lindex [$dlg(win).l curselection] 0]\n"
"set l [llength $dlg(list)]\n"
"incr i\n"
"if {$i >= $l} {set i [expr $l - 1]}\n"
"lstdlg_sel $i\n"
"}\n"
"\n"
"proc lstdlg_selprev {} {\n"
"global dlg\n"
"\n"
"set i [lindex [$dlg(win).l curselection] 0]\n"
"set l [llength $dlg(list)]\n"
"incr i -1\n"
"if {$i < 0} {set i 0}\n"
"lstdlg_sel $i\n"
"}\n"
"\n"
"proc ListDlg {w geometry text list {default 0}} {\n"
"global dlg\n"
"\n"
"toplevel $w\n"
"wm geometry $w $geometry\n"
"wm transient $w .\n"
"\n"
"frame $w.t -bd 1 -relief raised\n"
"pack $w.t -fill x\n"
"label $w.t.l -text $text\n"
"pack $w.t.l -fill both -expand 1\n"
"frame $w.b -bd 1 -relief raised\n"
"pack $w.b -fill x -side bottom\n"
"frame $w.b.fok -relief sunken -bd 2\n"
"button $w.b.ok -text OK -command \"set dlg(ok) 1\"\n"
"button $w.b.cancel -text Cancel -command \"set dlg(ok) 0\"\n"
"pack $w.b.fok -padx 10 -pady 10 -side left\n"
"pack $w.b.ok -padx 5 -pady 5 -in $w.b.fok \n"
"pack $w.b.cancel -padx 10 -pady 10 -side left\n"
"\n"
"scrollbar $w.s -command \"$w.l yview\"\n"
"pack $w.s -side right -fill y\n"
"listbox $w.l -relief sunken -bd 2 -yscrollcommand \"$w.s set\" -font fixed\n"
"pack $w.l -side left -fill both -expand true\n"
"\n"
"\n"
"\n"
"bind $w.l <Any-Return> \"set dlg(ok) 1\"\n"
"bind $w.l <Escape> \"set dlg(ok) 0\"\n"
"\n"
"set dlg(win) $w\n"
"set dlg(list) $list\n"
"eval $w.l insert end $list\n"
"set old_focus [focus]\n"
"focus $w.l\n"
"grab $w\n"
"update\n"
"lstdlg_sel $default \n"
"tkwait variable dlg(ok)\n"
"grab release $w\n"
"set i [lindex [$w.l curselection] 0]\n"
"focus $old_focus\n"
"destroy $w\n"
"if $dlg(ok) {\n"
"return $i \n"
"} else {\n"
"return -1\n"
"}\n"
"}\n"
"";
#line 29 "ts.et"
Et_EvalInclude("ts_dlg.tcl",_ET_script_); };
{ static char _ET_script_[] =
"proc EditOptReconfig {} {\n"
"global gparams\n"
"\n"
".term config -font \\\n"
"[list $gparams(font) $gparams(fontsize) $gparams(fontstyle)]\n"
"for {set i 0} {$i < 10} {incr i} {\n"
"if [winfo exists .t$i] {\n"
".t$i.text config -bg $gparams(bgnormal) -fg $gparams(fgnormal) \\\n"
"-insertbackground $gparams(fgnormal) \\\n"
"-font [list $gparams(font) $gparams(fontsize) $gparams(fontstyle)]\n"
".t$i.text tag configure comment -foreground $gparams(fgcomment)\n"
".t$i.text tag configure env -foreground $gparams(fgenv)\n"
".t$i.text tag configure repl -background $gparams(bgsearch) \\\n"
"-foreground $gparams(fgsearch)\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc EditOptSelFont {dummy} {\n"
"global editopt\n"
"\n"
"foreach l {normal comment search env} {\n"
".editopt.ls$l configure -font \\\n"
"[list $editopt(font) $editopt(fontsize) $editopt(fontstyle)]\n"
"}\n"
"}\n"
"\n"
"proc EditOptSelColor {par value} {\n"
"global editopt\n"
"\n"
"set editopt($par$editopt(seltxt)) $value\n"
"switch $editopt(seltxt) {\n"
"comment -\n"
"env {\n"
"if {$par == \"fg\"} {\n"
".editopt.ls$editopt(seltxt) configure -$par $value\n"
"}\n"
"}\n"
"search {\n"
".editopt.ls$editopt(seltxt) configure -$par $value\n"
"}\n"
"normal {\n"
".editopt.ls$editopt(seltxt) configure -$par $value\n"
"if {$par == \"bg\"} {\n"
"foreach l {comment env} {\n"
".editopt.ls$l configure -bg $value\n"
"}\n"
"}\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc EditOpt {} {\n"
"global editopt gparams params\n"
"\n"
"set editopt(seltxt) normal\n"
"set editopt(font) fixed\n"
"set editopt(fontsize) 12\n"
"set editopt(fontstyle) normal\n"
"set editopt(wrap) 1\n"
"set editopt(interval) 30\n"
"set editopt(bak) 0\n"
"set editopt(save) 1\n"
"set editopt(fgnormal) #000000\n"
"set editopt(bgnormal) #ffffff\n"
"set editopt(fgcomment) #000000\n"
"set editopt(bgcomment) #ffffff\n"
"set editopt(fgenv) #000000\n"
"set editopt(bgenv) #ffffff\n"
"set editopt(fgsearch) #ffffff\n"
"set editopt(bgsearch) #000000\n"
"foreach p [array names gparams] {\n"
"set editopt($p) $gparams($p)\n"
"}\n"
"\n"
"toplevel .editopt\n"
"wm title .editopt {Editor settings}\n"
"wm geometry .editopt $params(dlg_geom)\n"
"\n"
"frame .editopt.fmisc -bd 1 -relief raised\n"
"frame .editopt.ffont -bd 1 -relief raised\n"
"frame .editopt.fcolor -bd 1 -relief raised\n"
"frame .editopt.fsample -bd 1 -relief raised\n"
"frame .editopt.fbuttons -bd 1 -relief raised\n"
"pack .editopt.fmisc .editopt.ffont .editopt.fcolor .editopt.fsample \\\n"
".editopt.fbuttons -side top -fill x -ipady 5\n"
"\n"
"\n"
"\n"
"checkbutton .editopt.bwrap -text \"Auto Wrap\" -anchor w \\\n"
"-variable editopt(wrap)\n"
"checkbutton .editopt.bext -text \"Auto \\\\end{..}\" -anchor w \\\n"
"-variable editopt(autoext)\n"
"checkbutton .editopt.bbak -text \"BAK File\" -anchor w \\\n"
"-variable editopt(bak)\n"
"checkbutton .editopt.bsave -text \"Autosave\" -anchor w \\\n"
"-variable editopt(save)\n"
"label .editopt.linterval -text \"Autosave Interval \\[s\\]:\"\n"
"entry .editopt.einterval -width 4 -textvariable editopt(interval)\n"
"grid configure .editopt.bwrap -in .editopt.fmisc -row 0 -column 0 -sticky w\n"
"grid configure .editopt.bext -in .editopt.fmisc -row 0 -column 1 -sticky w\n"
"grid configure .editopt.bbak -in .editopt.fmisc -row 1 -column 0 -sticky w\n"
"grid configure .editopt.bsave -in .editopt.fmisc -row 2 -column 0 -sticky w\n"
"grid configure .editopt.linterval -in .editopt.fmisc -row 1 -column 1 \\\n"
"-sticky w\n"
"grid configure .editopt.einterval -in .editopt.fmisc -row 2 -column 1 \\\n"
"-sticky w\n"
"\n"
"\n"
"label .editopt.lfont -text \"Font:\"\n"
"ts_optionMenu .editopt.bfont editopt(font) EditOptSelFont fixed courier\n"
"grid .editopt.lfont -in .editopt.ffont -row 0 -column 0\n"
"grid .editopt.bfont -in .editopt.ffont -row 1 -column 0\n"
"label .editopt.lfsize -text \"Size:\"\n"
"ts_optionMenu .editopt.bfsize editopt(fontsize) EditOptSelFont 10 12 14 16 18\n"
"grid .editopt.lfsize -in .editopt.ffont -row 0 -column 1\n"
"grid .editopt.bfsize -in .editopt.ffont -row 1 -column 1\n"
"label .editopt.lfstyle -text \"Style:\"\n"
"ts_optionMenu .editopt.bfstyle editopt(fontstyle) EditOptSelFont normal italic bold\n"
"grid .editopt.lfstyle -in .editopt.ffont -row 0 -column 2\n"
"grid .editopt.bfstyle -in .editopt.ffont -row 1 -column 2\n"
"\n"
"\n"
"set i 0\n"
"for {set row 0} {$row < 8} {incr row} {\n"
"for {set col 0} {$col < 8} {incr col} {\n"
"set b [expr ($row/2)*85]\n"
"set g [expr ($col%4)*85]\n"
"set r [expr (($row%2)*2+$col/4)*85]\n"
"frame .editopt.ffg$i -width 10 -height 10 \\\n"
"-background [format {#%02x%02x%02x} \\\n"
"$r $g $b] -bd 1 -relief raised\n"
"bind .editopt.ffg$i <1> {EditOptSelColor fg [%W cget -bg]}\n"
"grid configure .editopt.ffg$i -column $col -row $row \\\n"
"-in .editopt.fcolor\n"
"frame .editopt.fbg$i -width 10 -height 10 \\\n"
"-background [format {#%02x%02x%02x} \\\n"
"$r $g $b] -bd 1 -relief raised\n"
"bind .editopt.fbg$i <1> {EditOptSelColor bg [%W cget -bg]}\n"
"grid configure .editopt.fbg$i -column [expr $col+9] -row $row \\\n"
"-in .editopt.fcolor\n"
"incr i\n"
"}\n"
"}\n"
"label .editopt.lfg -text \"Foreground\"\n"
"label .editopt.lbg -text \"Background\"\n"
"grid configure .editopt.lfg -in .editopt.fcolor -row 8 -col 0 -columnspan 8 \\\n"
"-sticky w\n"
"grid configure .editopt.lbg -in .editopt.fcolor -row 8 -col 9 -columnspan 8 \\\n"
"-sticky w\n"
"frame .editopt.fcdummy -width 20\n"
"grid configure .editopt.fcdummy -row 0 -col 8 -in .editopt.fcolor -sticky we\n"
"grid columnconfigure .editopt.fcolor 8 -weight 1\n"
"\n"
"\n"
"radiobutton .editopt.bsnormal -text Normal -variable editopt(seltxt) \\\n"
"-value normal\n"
"label .editopt.lsnormal -text \"Normal text line\" -anchor w \\\n"
"-bg $editopt(bgnormal) -fg $editopt(fgnormal)\n"
"radiobutton .editopt.bscomment -text Comment -variable editopt(seltxt) \\\n"
"-value comment\n"
"label .editopt.lscomment -text \"% A Comment line\" -anchor w \\\n"
"-bg $editopt(bgnormal) -fg $editopt(fgcomment)\n"
"radiobutton .editopt.bsenv -text \"\\\\begin/end\" -variable editopt(seltxt) \\\n"
"-value env\n"
"label .editopt.lsenv -text \"\\\\begin\\{...\\}\" -anchor w \\\n"
"-bg $editopt(bgnormal) -fg $editopt(fgenv)\n"
"radiobutton .editopt.bssearch -text Search -variable editopt(seltxt) \\\n"
"-value search\n"
"label .editopt.lssearch -text \"Search text\" -anchor w \\\n"
"-bg $editopt(bgsearch) -fg $editopt(fgsearch)\n"
"grid configure .editopt.bsnormal -in .editopt.fsample -row 0 -column 0 \\\n"
"-sticky w\n"
"grid configure .editopt.lsnormal -in .editopt.fsample -row 0 -column 1 \\\n"
"-sticky we\n"
"grid configure .editopt.bscomment -in .editopt.fsample -row 1 -column 0 \\\n"
"-sticky w\n"
"grid configure .editopt.lscomment -in .editopt.fsample -row 1 -column 1 \\\n"
"-sticky we\n"
"grid configure .editopt.bsenv -in .editopt.fsample -row 2 -column 0 \\\n"
"-sticky w\n"
"grid configure .editopt.lsenv -in .editopt.fsample -row 2 -column 1 \\\n"
"-sticky we\n"
"grid configure .editopt.bssearch -in .editopt.fsample -row 3 -column 0 \\\n"
"-sticky w\n"
"grid configure .editopt.lssearch -in .editopt.fsample -row 3 -column 1 \\\n"
"-sticky we\n"
"grid columnconfigure .editopt.fsample 1 -weight 1\n"
"\n"
"\n"
"button .editopt.bok -text OK -command {set editopt(ok) 1}\n"
"pack .editopt.bok -in .editopt.fbuttons -side left -padx 10 -pady 5\n"
"button .editopt.bcancel -text Cancel -command {set editopt(ok) 0}\n"
"pack .editopt.bcancel -in .editopt.fbuttons -side left -padx 10 -pady 5\n"
"\n"
"EditOptSelFont dummy\n"
"set editopt(oldfocus) [focus]\n"
"focus .editopt\n"
"grab .editopt\n"
"tkwait variable editopt(ok)\n"
"if {$editopt(ok)} {\n"
"foreach p {wrap autoext bak save interval font fontsize fontstyle\n"
"fgnormal bgnormal fgcomment bgcomment fgsearch bgsearch fgenv bgenv} {\n"
"set gparams($p) $editopt($p)\n"
"}\n"
"EditOptReconfig\n"
"}\n"
"grab release .editopt\n"
"focus $editopt(oldfocus)\n"
"destroy .editopt\n"
"}\n"
"";
#line 30 "ts.et"
Et_EvalInclude("ts_editopt.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"proc FDreadfiles {} {\n"
"global fd\n"
"\n"
".td.mid.file delete 0 end\n"
".td.mid.files delete 0 end\n"
".td.mid.dirs delete 0 end\n"
"set fd(lfiles) {}\n"
"set fd(ldirs) {}\n"
"foreach i [lsort [glob -nocomplain *$fd(ext)]] {\n"
"catch {\n"
"if [file isfile ./$i] {\n"
".td.mid.files insert end $i\n"
"lappend fd(lfiles) $i\n"
"}\n"
"}\n"
"} \n"
"foreach i [lsort [glob .* *]] {\n"
"catch {\n"
"if [file isdir ./$i] {\n"
".td.mid.dirs insert end $i\n"
"lappend fd(ldirs) $i\n"
"}\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc FDChangeDir {i} {\n"
"global fd env\n"
"\n"
"cd ./[.td.mid.dirs get $i]\n"
"set fd(pwd) [pwd]\n"
"if {[string first $env(HOME) $fd(pwd)] == 0} {\n"
"set fd(pwd) \"~[string range $fd(pwd) [string length $env(HOME)] end]\"\n"
"}\n"
"FDreadfiles \n"
"set fd(selfile) 0\n"
"FDSelect .td.mid.dirs 0\n"
"}\n"
"\n"
"proc FDSetFile {i} {\n"
"global fd\n"
"\n"
".td.mid.file delete 0 end\n"
".td.mid.file insert 0 [.td.mid.files get $i]\n"
"FDSelect .td.mid.files $i\n"
"}\n"
"\n"
"proc FDSelect {w i} {\n"
"global fd\n"
"\n"
"$w selection clear 0 end\n"
"\n"
"$w selection set $i $i\n"
"$w activate $i\n"
"if {$w == \".td.mid.files\"} {\n"
"\n"
"set fd(selfile) $i\n"
"set l [.td.mid.files get $i]\n"
"set fd(fn) $l\n"
"} else {\n"
"\n"
"set fd(seldir) $i\n"
"}\n"
"$w see $i\n"
"}\n"
"\n"
"proc FDLetter {w a} {\n"
"global fd\n"
"\n"
"if {$a < \" \" || $a > \"z\"} {return}\n"
"if {$w == \".td.mid.files\"} {\n"
"set l $fd(lfiles)\n"
"} else {\n"
"set l $fd(ldirs)\n"
"}\n"
"set i [lsearch -glob $l ${a}*]\n"
"if {$i > -1} {\n"
"FDSelect $w $i\n"
"} else {\n"
"puts -nonewline \\a\n"
"}\n"
"}\n"
"\n"
"proc FDFocusFiles {} {\n"
"global fd\n"
"\n"
"focus .td.mid.files\n"
".td.mid.dirs select clear 0 end\n"
"FDSelect .td.mid.files $fd(selfile)\n"
"}\n"
"\n"
"proc FDFocusDirs {} {\n"
"global fd\n"
"\n"
"focus .td.mid.dirs\n"
".td.mid.files select clear 0 end\n"
"FDSelect .td.mid.dirs $fd(seldir)\n"
"}\n"
"\n"
"proc FDFocusFile {} {\n"
"focus .td.mid.file\n"
".td.mid.files select clear 0 end\n"
".td.mid.dirs select clear 0 end\n"
"}\n"
"\n"
"proc FDOK {} {\n"
"global fd\n"
"\n"
"set f [.td.mid.file get]\n"
"if {$f != \"\"} {\n"
"set fd(return) 1\n"
"} else {\n"
"FDFocusFiles\n"
"}\n"
"}\n"
"\n"
"proc FDCancel {} {\n"
"global fd\n"
"set fd(return) 0\n"
"}\n"
"\n"
"proc FDSelectBox {w} {\n"
"FDSelect $w [$w index active]\n"
"}\n"
"\n"
"proc FileDialog {geom atitle {ext \"\"} filename} {\n"
"global fd env\n"
"upvar $filename fn\n"
"\n"
"toplevel .td \n"
"wm transient .td .\n"
"wm geometry .td $geom \n"
"wm title .td \"Select File\"\n"
"frame .td.top -relief raised -bd 1\n"
"frame .td.mid -relief raised -bd 1\n"
"frame .td.ext -relief raised -bd 1\n"
"frame .td.bot -relief raised -bd 1\n"
"pack .td.top .td.mid .td.ext .td.bot -fill x\n"
"\n"
"label .td.top.title -text $atitle\n"
"pack .td.top.title\n"
"\n"
"label .td.mid.lf -text \"File:\"\n"
"entry .td.mid.file -relief sunken -textvariable fd(fn)\n"
"listbox .td.mid.files -yscroll \".td.mid.sbf set\" -relief sunken \\\n"
"-exportselection no\n"
"scrollbar .td.mid.sbf -command \".td.mid.files yview\" -takefocus 0\n"
"grid .td.mid.lf -row 0 -column 0\n"
"grid .td.mid.file -row 1 -column 0 -columnspan 2 -sticky ew\n"
"grid .td.mid.files -row 2 -column 0 -sticky nsew\n"
"grid .td.mid.sbf -row 2 -column 1 -sticky ns\n"
"\n"
"label .td.mid.ld -text \"Directory:\"\n"
"entry .td.mid.dir -relief sunken -textvariable fd(pwd) -width 30\n"
"listbox .td.mid.dirs -yscroll \".td.mid.sbd set\" -relief sunken \\\n"
"-exportselection no\n"
"scrollbar .td.mid.sbd -command \".td.mid.dirs yview\" -takefocus 0\n"
"grid .td.mid.ld -row 0 -column 2\n"
"grid .td.mid.dir -row 1 -column 2 -columnspan 2 -sticky ew\n"
"grid .td.mid.dirs -row 2 -column 2 -sticky nsew\n"
"grid .td.mid.sbd -row 2 -column 3 -sticky ns\n"
"grid columnconfigure .td.mid 0 -weight 1\n"
"grid columnconfigure .td.mid 2 -weight 1\n"
"grid rowconfigure .td.mid 2 -weight 1\n"
"\n"
"label .td.ext.lm -text \"\\[E\\]xtension:\"\n"
"entry .td.ext.ext -relief sunken -textvariable fd(ext)\n"
"pack .td.ext.lm .td.ext.ext -side left\n"
"\n"
"frame .td.bot.fok -bd 1 -relief sunken\n"
"button .td.bot.ok -text \"OK\" -command \"FDOK\"\n"
"button .td.bot.cancel -text \"Cancel\" -command \"FDCancel\"\n"
"pack .td.bot.fok .td.bot.cancel -side left -padx 5 -pady 5\n"
"pack .td.bot.ok -padx 5 -pady 5 -in .td.bot.fok\n"
"\n"
"foreach w {.td.mid.files .td.mid.dirs .td.mid.sbf .td.mid.sbd \\\n"
".td.mid.lf .td.mid.file .td.mid.ld .td.mid.dir .td.ext.ext} {\n"
"bindtags $w [list .td [winfo class $w] $w]\n"
"}\n"
"foreach w {.td.mid.files .td.mid.dirs} {\n"
"bind $w <Up> {FDSelectBox %W}\n"
"bind $w <Down> {FDSelectBox %W}\n"
"bind $w <Prior> {FDSelectBox %W}\n"
"bind $w <Next> {FDSelectBox %W}\n"
"bind $w <Any-Key> {FDLetter %W %A}\n"
"}\n"
"bind .td.mid.dirs <1> {FDSelect %W [%W nearest %y]; FDFocusDirs}\n"
"bind .td.mid.dirs <Double-1> {FDChangeDir [.td.mid.dirs nearest %y]}\n"
"bind .td.mid.dirs <Return> {FDChangeDir $fd(seldir)}\n"
"bind .td.mid.files <1> {\n"
"FDSetFile [.td.mid.files nearest %y] \n"
"FDFocusFiles\n"
"}\n"
"bind .td.mid.files <Double-1> {\n"
"FDSetFile [.td.mid.files nearest %y] \n"
"FDFocusFiles\n"
"FDOK\n"
"}\n"
"bind .td.mid.files <Return> {FDSetFile $fd(selfile); FDOK}\n"
"bind .td.mid.file <Return> {FDOK}\n"
"\n"
"bind .td.mid.file <Tab> {FDFocusFiles}\n"
"bind .td.mid.files <Tab> {FDFocusDirs}\n"
"bind .td.mid.dirs <Tab> {FDFocusFile}\n"
"bind .td.mid.file <Shift-Tab> {FDFocusDirs}\n"
"bind .td.mid.files <Shift-Tab> {FDFocusFile}\n"
"bind .td.mid.dirs <Shift-Tab> {FDFocusFiles}\n"
"\n"
"bind .td.ext.ext <Return> \"FDreadfiles ; FDFocusFile\"\n"
"foreach w \\\n"
"{.td.ext.ext .td.mid.dirs .td.mid.dir .td.mid.files .td.mid.file} {\n"
"bind $w <Control-Return> {set fd(return) 1}\n"
"bind $w <Escape> FDCancel\n"
"bind $w <Alt-Any-e> \"focus .td.ext.ext\"\n"
"}\n"
"set fd(ext) $ext\n"
"set old_wd [pwd]\n"
"set fd(pwd) [file dirname $fn]\n"
"if {$fd(pwd) == \".\"} {set fd(pwd) $old_wd}\n"
"if {[string first $env(HOME) $fd(pwd)] == 0} {\n"
"set fd(pwd) \"~[string range $fd(pwd) [string length $env(HOME)] end]\"\n"
"}\n"
"cd $fd(pwd)\n"
"FDreadfiles\n"
"set fd(fn) [file tail $fn]\n"
"set fd(selfile) 0\n"
"set fd(seldir) 0\n"
"set fd(return) \"\"\n"
"set oldfocus [focus]\n"
"FDFocusFile\n"
"grab .td\n"
"tkwait variable fd(return)\n"
"grab release .td\n"
"focus $oldfocus\n"
"if $fd(return) {\n"
"if {$fd(fn) != \"\" && [file extension $fd(fn)] == \"\"} {\n"
"set fd(fn) $fd(fn)$fd(ext)\n"
"}\n"
"set fn [pwd]/$fd(fn)\n"
"}\n"
"cd $old_wd\n"
"destroy .td\n"
"return $fd(return)\n"
"}\n"
"";
#line 31 "ts.et"
Et_EvalInclude("ts_filedlg.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"array set HMtag_map {\n"
"b {weight bold}\n"
"blockquote {style i indent 1 Trindent rindent}\n"
"bq {style i indent 1 Trindent rindent}\n"
"cite {style i}\n"
"code {family courier}\n"
"dfn {style i} \n"
"dir {indent 1}\n"
"dl {indent 1}\n"
"em {style i}\n"
"h1 {size 24 weight bold}\n"
"h2 {size 22} \n"
"h3 {size 20} \n"
"h4 {size 18}\n"
"h5 {size 16}\n"
"h6 {style i}\n"
"i {style i}\n"
"kbd {family courier weight bold}\n"
"menu {indent 1}\n"
"ol {indent 1}\n"
"pre {fill 0 family courier Tnowrap nowrap}\n"
"samp {family courier} \n"
"strong {weight bold} \n"
"tt {family courier}\n"
"u {Tunderline underline}\n"
"ul {indent 1}\n"
"var {style i} \n"
"}\n"
"\n"
"\n"
"\n"
"array set HMtag_map {\n"
"center {Tcenter center}\n"
"strike {Tstrike strike}\n"
"u {Tunderline underline}\n"
"}\n"
"\n"
"\n"
"\n"
"set HMtag_map(hmstart) {\n"
"family times weight medium style r size 14\n"
"Tcenter \"\" Tlink \"\" Tnowrap \"\" Tunderline \"\" list list\n"
"fill 1 indent \"\" counter 0 adjust 0\n"
"}\n"
"\n"
"\n"
"\n"
"array set HMinsert_map {\n"
"blockquote \"\\n\\n\" /blockquote \"\\n\"\n"
"br \"\\n\"\n"
"dd \"\\n\" /dd \"\\n\"\n"
"dl \"\\n\" /dl \"\\n\"\n"
"dt \"\\n\"\n"
"form \"\\n\" /form \"\\n\"\n"
"h1 \"\\n\\n\" /h1 \"\\n\"\n"
"h2 \"\\n\\n\" /h2 \"\\n\"\n"
"h3 \"\\n\\n\" /h3 \"\\n\"\n"
"h4 \"\\n\" /h4 \"\\n\"\n"
"h5 \"\\n\" /h5 \"\\n\"\n"
"h6 \"\\n\" /h6 \"\\n\"\n"
"li \"\\n\"\n"
"/dir \"\\n\"\n"
"/ul \"\\n\"\n"
"/ol \"\\n\"\n"
"/menu \"\\n\"\n"
"p \"\\n\\n\"\n"
"pre \"\\n\" /pre \"\\n\"\n"
"}\n"
"\n"
"\n"
"\n"
"array set HMlist_elements {\n"
"ol 1 ul 1 menu 1 dl 1 dir 1\n"
"}\n"
"\n"
"\n"
"\n"
"proc HMinit_win {win} {\n"
"upvar #0 HM$win var\n"
"\n"
"HMinit_state $win\n"
"$win tag configure underline -underline 1\n"
"$win tag configure center -justify center\n"
"$win tag configure nowrap -wrap none\n"
"$win tag configure rindent -rmargin $var(S_tab)c\n"
"$win tag configure strike -overstrike 1\n"
"$win tag configure mark -foreground red ;# list markers\n"
"$win tag configure list -spacing1 3p -spacing3 3p ;# regular lists\n"
"$win tag configure compact -spacing1 0p ;# compact lists\n"
"$win tag configure link -borderwidth 2 -foreground blue ;# hypertext links\n"
"HMset_indent $win $var(S_tab)\n"
"$win configure -wrap word\n"
"\n"
"\n"
"$win mark set $var(S_insert) 1.0\n"
"\n"
"\n"
"$win tag configure thin -font [HMx_font times 2 medium r]\n"
"$win tag configure hr -relief sunken -borderwidth 2 -wrap none \\\n"
"-tabs [winfo width $win]\n"
"bind $win <Configure> {\n"
"%W tag configure hr -tabs %w\n"
"%W tag configure last -spacing3 %h\n"
"}\n"
"\n"
"\n"
"\n"
"$win tag bind link <1> \"HMlink_hit $win %x %y\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMset_indent {win cm} {\n"
"set tabs [expr $cm / 2.0]\n"
"$win configure -tabs ${tabs}c\n"
"foreach i {1 2 3 4 5 6 7 8 9} {\n"
"set tab [expr $i * $cm]\n"
"$win tag configure indent$i -lmargin1 ${tab}c -lmargin2 ${tab}c \\\n"
"-tabs \"[expr $tab + $tabs]c [expr $tab + 2*$tabs]c\"\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMreset_win {win} {\n"
"upvar #0 HM$win var\n"
"regsub -all { +[^L ][^ ]*} \" [$win tag names] \" {} tags\n"
"catch \"$win tag delete $tags\"\n"
"eval $win mark unset [$win mark names]\n"
"$win delete 0.0 end\n"
"$win tag configure hr -tabs [winfo width $win]\n"
"\n"
"\n"
"$win mark set $var(S_insert) 1.0\n"
"\n"
"\n"
"\n"
"\n"
"catch unset [info globals HM$win.form*]\n"
"\n"
"HMinit_state $win\n"
"return HM$win\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinit_state {win} {\n"
"upvar #0 HM$win var\n"
"array set tmp [array get var S_*]\n"
"catch {unset var}\n"
"array set var {\n"
"stop 0\n"
"tags 0\n"
"fill 0\n"
"list list\n"
"S_adjust_size 0\n"
"S_tab 1.0\n"
"S_unknown \\xb7\n"
"S_update 10\n"
"S_symbols O*=+-o\\xd7\\xb0>:\\xb7\n"
"S_insert Insert\n"
"}\n"
"array set var [array get tmp]\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"array set HMparam_map {\n"
"-update S_update\n"
"-tab S_tab\n"
"-unknown S_unknown\n"
"-stop S_stop\n"
"-size S_adjust_size\n"
"-symbols S_symbols\n"
"-insert S_insert\n"
"}\n"
"\n"
"proc HMset_state {win args} {\n"
"upvar #0 HM$win var\n"
"global HMparam_map\n"
"set bad 0\n"
"if {[catch {array set params $args}]} {return 0}\n"
"foreach i [array names params] {\n"
"incr bad [catch {set var($HMparam_map($i)) $params($i)}]\n"
"}\n"
"return [expr $bad == 0]\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMrender {win tag not param text} {\n"
"upvar #0 HM$win var\n"
"if {$var(stop)} return\n"
"global HMtag_map HMinsert_map HMlist_elements\n"
"set tag [string tolower $tag]\n"
"set text [HMmap_esc $text]\n"
"\n"
"\n"
"if {[info exists HMlist_elements($tag)]} {\n"
"set list \"list [expr {[HMextract_param $param compact] ? \"compact\" : \"list\"}]\"\n"
"} else {\n"
"set list \"\"\n"
"}\n"
"\n"
"\n"
"\n"
"if {[info exists var(divert)]} {\n"
"set win $var(divert)\n"
"upvar #0 HM$win var\n"
"}\n"
"\n"
"\n"
"catch {HMstack $win $not \"$HMtag_map($tag) $list\"}\n"
"\n"
"\n"
"\n"
"set bad [catch {$win insert $var(S_insert) $HMinsert_map($not$tag) \"space $var(font)\"}]\n"
"if {!$bad && [lindex $var(fill) end]} {\n"
"set text [string trimleft $text]\n"
"}\n"
"\n"
"\n"
"if {[lindex $var(fill) end]} {\n"
"set text [HMzap_white $text]\n"
"}\n"
"\n"
"\n"
"catch {HMmark $not$tag $win $param text} err\n"
"\n"
"\n"
"catch {HMtag_$not$tag $win $param text} msg\n"
"\n"
"\n"
"\n"
"\n"
"set tags [HMcurrent_tags $win]\n"
"$win insert $var(S_insert) $text $tags\n"
"\n"
"\n"
"\n"
"\n"
"if {!([incr var(tags)] % $var(S_update))} {\n"
"update\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_hmstart {win param text} {\n"
"upvar #0 HM$win var\n"
"$win mark gravity $var(S_insert) left\n"
"$win insert end \"\\n \" last\n"
"$win mark gravity $var(S_insert) right\n"
"}\n"
"\n"
"proc HMtag_/hmstart {win param text} {\n"
"$win delete last.first end\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_title {win param text} {\n"
"upvar $text data\n"
"wm title [winfo toplevel $win] $data\n"
"set data \"\"\n"
"}\n"
"\n"
"proc HMtag_hr {win param text} {\n"
"upvar #0 HM$win var\n"
"$win insert $var(S_insert) \"\\n\" space \"\\n\" thin \"\\t\" \"thin hr\" \"\\n\" thin\n"
"}\n"
"\n"
"\n"
"\n"
"proc HMtag_ol {win param text} {\n"
"upvar #0 HM$win var\n"
"set var(count$var(level)) 0\n"
"}\n"
"\n"
"proc HMtag_ul {win param text} {\n"
"upvar #0 HM$win var\n"
"catch {unset var(count$var(level))}\n"
"}\n"
"\n"
"proc HMtag_menu {win param text} {\n"
"upvar #0 HM$win var\n"
"set var(menu) ->\n"
"set var(compact) 1\n"
"}\n"
"\n"
"proc HMtag_/menu {win param text} {\n"
"upvar #0 HM$win var\n"
"catch {unset var(menu)}\n"
"catch {unset var(compact)}\n"
"}\n"
"\n"
"proc HMtag_dt {win param text} {\n"
"upvar #0 HM$win var\n"
"upvar $text data\n"
"set level $var(level)\n"
"incr level -1\n"
"$win insert $var(S_insert) \"$data\" \\\n"
"\"hi [lindex $var(list) end] indent$level $var(font)\"\n"
"set data {}\n"
"}\n"
"\n"
"proc HMtag_li {win param text} {\n"
"upvar #0 HM$win var\n"
"set level $var(level)\n"
"incr level -1\n"
"set x [string index $var(S_symbols)+-+-+-+-\" $level]\n"
"catch {set x [incr var(count$level)]}\n"
"catch {set x $var(menu)}\n"
"$win insert $var(S_insert) \\t$x\\t \"mark [lindex $var(list) end] indent$level $var(font)\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_a {win param text} {\n"
"upvar #0 HM$win var\n"
"\n"
"\n"
"\n"
"if {[HMextract_param $param href]} {\n"
"set var(Tref) [list L:$href]\n"
"HMstack $win \"\" \"Tlink link\"\n"
"HMlink_setup $win $href\n"
"}\n"
"\n"
"\n"
"\n"
"if {[HMextract_param $param name]} {\n"
"set var(Tname) [list N:$name]\n"
"HMstack $win \"\" \"Tanchor anchor\"\n"
"$win mark set N:$name \"$var(S_insert) - 1 chars\"\n"
"$win mark gravity N:$name left\n"
"if {[info exists var(goto)] && $var(goto) == $name} {\n"
"unset var(goto)\n"
"set var(going) $name\n"
"}\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMgoto {win where {callback HMwent_to}} {\n"
"upvar #0 HM$win var\n"
"if {[regexp N:$where [$win mark names]]} {\n"
"$win see N:$where\n"
"update\n"
"eval $callback $win [list $where]\n"
"return 1\n"
"} else {\n"
"set var(goto) $where\n"
"return 0\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMwent_to {win where {count 0} {color orange}} {\n"
"upvar #0 HM$win var\n"
"if {$count > 5} return\n"
"catch {$win tag configure N:$where -foreground $color}\n"
"update\n"
"after 200 [list HMwent_to $win $where [incr count] \\\n"
"[expr {$color==\"orange\" ? \"\" : \"orange\"}]]\n"
"}\n"
"\n"
"proc HMtag_/a {win param text} {\n"
"upvar #0 HM$win var\n"
"if {[info exists var(Tref)]} {\n"
"unset var(Tref)\n"
"HMstack $win / \"Tlink link\"\n"
"}\n"
"\n"
"\n"
"\n"
"if {[info exists var(going)]} {\n"
"$win yview N:$var(going)\n"
"update\n"
"HMwent_to $win $var(going)\n"
"unset var(going)\n"
"}\n"
"\n"
"if {[info exists var(Tname)]} {\n"
"unset var(Tname)\n"
"HMstack $win / \"Tanchor anchor\"\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_img {win param text} {\n"
"upvar #0 HM$win var\n"
"\n"
"\n"
"array set align_map {top top middle center bottom bottom}\n"
"set align bottom ;# The spec isn't clear what the default should be\n"
"HMextract_param $param align\n"
"catch {set align $align_map([string tolower $align])}\n"
"\n"
"\n"
"set alt \"<image>\"\n"
"HMextract_param $param alt\n"
"set alt [HMmap_esc $alt]\n"
"\n"
"\n"
"set border 1\n"
"HMextract_param $param border\n"
"\n"
"\n"
"\n"
"\n"
"set item $win.$var(tags)\n"
"\n"
"if {[HMextract_param $param width] && [HMextract_param $param height]} {\n"
"frame $item -width $width -height $height\n"
"pack propagate $item 0\n"
"set label $item.label\n"
"label $label\n"
"pack $label -expand 1 -fill both\n"
"} else {\n"
"set label $item\n"
"label $label \n"
"}\n"
"\n"
"$label configure -relief ridge -fg orange -text $alt\n"
"catch {$label configure -bd $border}\n"
"$win window create $var(S_insert) -align $align -window $item -pady 2 -padx 2\n"
"\n"
"\n"
"set tags [HMcurrent_tags $win]\n"
"foreach tag $tags {\n"
"$win tag add $tag $item\n"
"}\n"
"\n"
"\n"
"if {[HMextract_param $param ismap]} {\n"
"\n"
"set link [lindex $tags [lsearch -glob $tags L:*]]\n"
"regsub L: $link {} link\n"
"global HMevents\n"
"regsub -all {%} $link {%%} link2\n"
"foreach i [array names HMevents] {\n"
"bind $label <$i> \"catch \\{%W configure $HMevents($i)\\}\"\n"
"}\n"
"bind $label <1> \"+HMlink_callback $win $link2?%x,%y\"\n"
"} \n"
"\n"
"\n"
"set src \"\"\n"
"HMextract_param $param src\n"
"HMset_image $win $label $src\n"
"return $label ;# used by the forms package for input_image types\n"
"}\n"
"\n"
"\n"
"proc HMset_image {win handle src} {\n"
"HMgot_image $handle \"can't get\\n$src\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMgot_image {win image_error} {\n"
"\n"
"if {[winfo name $win] == \"label\"} {\n"
"pack propagate [winfo parent $win] 1\n"
"}\n"
"if {[catch {$win configure -image $image_error}]} {\n"
"$win configure -image {}\n"
"$win configure -text $image_error\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"array set HMevents {\n"
"Enter {-borderwidth 2 -relief raised }\n"
"Leave {-borderwidth 2 -relief flat }\n"
"1 {-borderwidth 2 -relief sunken}\n"
"ButtonRelease-1 {-borderwidth 2 -relief raised}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMlink_setup {win href} {\n"
"global HMevents\n"
"regsub -all {%} $href {%%} href2\n"
"foreach i [array names HMevents] {\n"
"eval {$win tag bind L:$href <$i>} \\\n"
"\\{$win tag configure \\{L:$href2\\} $HMevents($i)\\}\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMlink_hit {win x y} {\n"
"set tags [$win tag names @$x,$y]\n"
"set link [lindex $tags [lsearch -glob $tags L:*]]\n"
"\n"
"regsub L: $link {} link\n"
"HMlink_callback $win $link\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMlink_callback {win href} {\n"
"puts \"Got hit on $win, link $href\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMextract_param {param key {val \"\"}} {\n"
"\n"
"if {$val == \"\"} {\n"
"upvar $key result\n"
"} else {\n"
"upvar $val result\n"
"}\n"
"set ws \" \\n\\r\"\n"
"\n"
"\n"
"if {\n"
"[regsub -nocase [format {.*%s[%s]*=[%s]*\"([^\"]*).*} $key $ws $ws] $param {\\1} value] ||\n"
"[regsub -nocase [format {.*%s[%s]*=[%s]*'([^']*).*} $key $ws $ws] $param {\\1} value] ||\n"
"[regsub -nocase [format {.*%s[%s]*=[%s]*([^%s]+).*} $key $ws $ws $ws] $param {\\1} value] } {\n"
"set result $value\n"
"return 1\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"set bad \\[^a-zA-Z\\]+\n"
"if {[regexp -nocase \"$bad$key$bad\" -$param-]} {\n"
"return 1\n"
"} else {\n"
"return 0\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMstack {win push list} {\n"
"upvar #0 HM$win var\n"
"array set tags $list\n"
"if {$push == \"\"} {\n"
"foreach tag [array names tags] {\n"
"lappend var($tag) $tags($tag)\n"
"}\n"
"} else {\n"
"foreach tag [array names tags] {\n"
"\n"
"set var($tag) [lreplace $var($tag) end end]\n"
"}\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMcurrent_tags {win} {\n"
"upvar #0 HM$win var\n"
"set font font\n"
"foreach i {family size weight style} {\n"
"set $i [lindex $var($i) end]\n"
"append font :[set $i]\n"
"}\n"
"set xfont [HMx_font $family $size $weight $style $var(S_adjust_size)]\n"
"HMset_font $win $font $xfont\n"
"set indent [llength $var(indent)]\n"
"incr indent -1\n"
"lappend tags $font indent$indent\n"
"foreach tag [array names var T*] {\n"
"lappend tags [lindex $var($tag) end] ;# test\n"
"}\n"
"set var(font) $font\n"
"set var(xfont) [$win tag cget $font -font]\n"
"set var(level) $indent\n"
"return $tags\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMset_font {win tag font} {\n"
"catch {$win tag configure $tag -font $font} msg\n"
"}\n"
"\n"
"\n"
"proc HMx_font {family size weight style {adjust_size 0}} {\n"
"catch {incr size $adjust_size}\n"
"return \"-*-$family-$weight-$style-normal-*-*-${size}0-*-*-*-*-*-*\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMoptimize {} {\n"
"regsub -all \"\\n\\[ \\]*#\\[^\\n\\]*\" [info body HMrender] {} body\n"
"regsub -all \";\\[ \\]*#\\[^\\n]*\" $body {} body\n"
"regsub -all \"\\n\\n+\" $body \\n body\n"
"proc HMrender {win tag not param text} $body\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMparse_html {html {cmd HMtest_parse} {start hmstart}} {\n"
"regsub -all \\{ $html {\\&ob;} html\n"
"regsub -all \\} $html {\\&cb;} html\n"
"set w \" \\t\\r\\n\" ;# white space\n"
"proc HMcl x {return \"\\[$x\\]\"}\n"
"set exp <(/?)([HMcl ^$w>]+)[HMcl $w]*([HMcl ^>]*)>\n"
"set sub \"\\}\\n$cmd {\\\\2} {\\\\1} {\\\\3} \\{\"\n"
"regsub -all $exp $html $sub html\n"
"eval \"$cmd {$start} {} {} \\{ $html \\}\"\n"
"eval \"$cmd {$start} / {} {}\"\n"
"}\n"
"\n"
"proc HMtest_parse {command tag slash text_after_tag} {\n"
"puts \"==> $command $tag $slash $text_after_tag\"\n"
"}\n"
"\n"
"\n"
"\n"
"proc HMzap_white {data} {\n"
"regsub -all \"\\[ \\t\\r\\n\\]+\" $data \" \" data\n"
"return $data\n"
"}\n"
"\n"
"\n"
"\n"
"proc HMmap_esc {text} {\n"
"if {![regexp & $text]} {return $text}\n"
"regsub -all {([][$\\\\])} $text {\\\\\\1} new\n"
"regsub -all {&#([0-9][0-9]?[0-9]?);?} \\\n"
"$new {[format %c [scan \\1 %d tmp;set tmp]]} new\n"
"regsub -all {&([a-zA-Z]+);?} $new {[HMdo_map \\1]} new\n"
"return [subst $new]\n"
"}\n"
"\n"
"\n"
"\n"
"proc HMdo_map {text {unknown ?}} {\n"
"global HMesc_map\n"
"set result $unknown\n"
"catch {set result $HMesc_map($text)}\n"
"return $result\n"
"}\n"
"\n"
"\n"
"\n"
"array set HMesc_map {\n"
"lt < gt > amp & quot \\\" copy \\xa9\n"
"reg \\xae ob \\x7b cb \\x7d nbsp \\xa0\n"
"}\n"
"\n"
"\n"
"\n"
"array set HMesc_map {\n"
"nbsp \\xa0 iexcl \\xa1 cent \\xa2 pound \\xa3 curren \\xa4\n"
"yen \\xa5 brvbar \\xa6 sect \\xa7 uml \\xa8 copy \\xa9\n"
"ordf \\xaa laquo \\xab not \\xac shy \\xad reg \\xae\n"
"hibar \\xaf deg \\xb0 plusmn \\xb1 sup2 \\xb2 sup3 \\xb3\n"
"acute \\xb4 micro \\xb5 para \\xb6 middot \\xb7 cedil \\xb8\n"
"sup1 \\xb9 ordm \\xba raquo \\xbb frac14 \\xbc frac12 \\xbd\n"
"frac34 \\xbe iquest \\xbf Agrave \\xc0 Aacute \\xc1 Acirc \\xc2\n"
"Atilde \\xc3 Auml \\xc4 Aring \\xc5 AElig \\xc6 Ccedil \\xc7\n"
"Egrave \\xc8 Eacute \\xc9 Ecirc \\xca Euml \\xcb Igrave \\xcc\n"
"Iacute \\xcd Icirc \\xce Iuml \\xcf ETH \\xd0 Ntilde \\xd1\n"
"Ograve \\xd2 Oacute \\xd3 Ocirc \\xd4 Otilde \\xd5 Ouml \\xd6\n"
"times \\xd7 Oslash \\xd8 Ugrave \\xd9 Uacute \\xda Ucirc \\xdb\n"
"Uuml \\xdc Yacute \\xdd THORN \\xde szlig \\xdf agrave \\xe0\n"
"aacute \\xe1 acirc \\xe2 atilde \\xe3 auml \\xe4 aring \\xe5\n"
"aelig \\xe6 ccedil \\xe7 egrave \\xe8 eacute \\xe9 ecirc \\xea\n"
"euml \\xeb igrave \\xec iacute \\xed icirc \\xee iuml \\xef\n"
"eth \\xf0 ntilde \\xf1 ograve \\xf2 oacute \\xf3 ocirc \\xf4\n"
"otilde \\xf5 ouml \\xf6 divide \\xf7 oslash \\xf8 ugrave \\xf9\n"
"uacute \\xfa ucirc \\xfb uuml \\xfc yacute \\xfd thorn \\xfe\n"
"yuml \\xff\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"array set HMtag_map {\n"
"textarea {fill 0}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_isindex {win param text} {\n"
"upvar #0 HM$win var\n"
"\n"
"set item $win.$var(tags)\n"
"if {[winfo exists $item]} {\n"
"destroy $item\n"
"}\n"
"frame $item -relief ridge -bd 3\n"
"set prompt \"Enter search keywords here\"\n"
"HMextract_param $param prompt\n"
"label $item.label -text [HMmap_esc $prompt] -font $var(xfont)\n"
"entry $item.entry\n"
"bind $item.entry <Return> \"$item.submit invoke\"\n"
"button $item.submit -text search -font $var(xfont) -command \\\n"
"[format {HMsubmit_index %s {%s} [HMmap_reply [%s get]]} \\\n"
"$win $param $item.entry]\n"
"pack $item.label -side top\n"
"pack $item.entry $item.submit -side left\n"
"\n"
"\n"
"\n"
"$win insert $var(S_insert) \\n isindex\n"
"HMwin_install $win $item\n"
"$win insert $var(S_insert) \\n isindex\n"
"bind $item <Visibility> {focus %W.entry}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMsubmit_index {win param text} {\n"
"HMlink_callback $win ?$text\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_form {win param text} {\n"
"upvar #0 HM$win var\n"
"\n"
"\n"
"set id HM$win.form$var(tags)\n"
"upvar #0 $id form\n"
"\n"
"\n"
"if {[info exists var(form_id)]} {\n"
"puts \"Missing end-form tag !!!! $var(form_id)\"\n"
"HMtag_/form $win {} {}\n"
"}\n"
"catch {unset form}\n"
"set var(form_id) $id\n"
"\n"
"set form(param) $param ;# form initial parameter list\n"
"set form(reset) \"\" ;# command to reset the form\n"
"set form(reset_button) \"\" ;# list of all reset buttons\n"
"set form(submit) \"\" ;# command to submit the form\n"
"set form(submit_button) \"\" ;# list of all submit buttons\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_/form {win param text} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"\n"
"\n"
"foreach name [array names form radio_*] {\n"
"regsub radio_ $name {} name\n"
"lappend form(submit) [list $name \\$form(radio_$name)]\n"
"}\n"
"\n"
"\n"
"\n"
"foreach item $form(reset_button) {\n"
"$item configure -command $form(reset)\n"
"}\n"
"\n"
"\n"
"if {$form(submit_button) == \"\"} {\n"
"HMinput_submit $win {}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"foreach item $form(submit_button) {\n"
"set submit $form(submit)\n"
"catch {lappend submit $form(submit_$item)}\n"
"$item configure -command \\\n"
"[list HMsubmit_button $win $var(form_id) $form(param) \\\n"
"$submit]\n"
"}\n"
"\n"
"\n"
"unset form(reset) form(submit) form(reset_button) form(submit_button)\n"
"unset var(form_id)\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_input {win param text} {\n"
"upvar #0 HM$win var\n"
"\n"
"set type text ;# the default\n"
"HMextract_param $param type\n"
"set type [string tolower $type]\n"
"if {[catch {HMinput_$type $win $param} err]} {\n"
"puts stderr $err\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinput_text {win param {show {}}} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"\n"
"\n"
"HMextract_param $param name ;# required\n"
"set item $win.input_text,$var(tags)\n"
"set size 20; HMextract_param $param size\n"
"set maxlength 0; HMextract_param $param maxlength\n"
"entry $item -width $size -show $show\n"
"\n"
"\n"
"set value \"\"; HMextract_param $param value\n"
"$item insert 0 $value\n"
"\n"
"\n"
"HMwin_install $win $item\n"
"\n"
"\n"
"append form(reset) \";$item delete 0 end;$item insert 0 [list $value]\"\n"
"lappend form(submit) [list $name \"\\[$item get]\"]\n"
"\n"
"\n"
"if {$maxlength} {\n"
"bindtags $item \"[bindtags $item] max$maxlength\"\n"
"bind max$maxlength <KeyPress> \"%W delete $maxlength end\"\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinput_password {win param} {\n"
"HMinput_text $win $param *\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinput_checkbox {win param} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"\n"
"HMextract_param $param name\n"
"HMextract_param $param value\n"
"\n"
"\n"
"\n"
"set variable $var(form_id)(check_$var(tags)) \n"
"set item $win.input_checkbutton,$var(tags)\n"
"checkbutton $item -variable $variable -off {} -on $value -text \" \"\n"
"if {[HMextract_param $param checked]} {\n"
"$item select\n"
"append form(reset) \";$item select\"\n"
"} else {\n"
"append form(reset) \";$item deselect\"\n"
"}\n"
"\n"
"HMwin_install $win $item\n"
"lappend form(submit) [list $name \\$form(check_$var(tags))]\n"
"}\n"
"\n"
"\n"
"\n"
"proc HMinput_radio {win param} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"\n"
"HMextract_param $param name\n"
"HMextract_param $param value\n"
"\n"
"set first [expr ![info exists form(radio_$name)]]\n"
"set variable $var(form_id)(radio_$name)\n"
"set variable $var(form_id)(radio_$name)\n"
"set item $win.input_radiobutton,$var(tags)\n"
"radiobutton $item -variable $variable -value $value -text \" \"\n"
"\n"
"HMwin_install $win $item\n"
"\n"
"if {$first || [HMextract_param $param checked]} {\n"
"$item select\n"
"append form(reset) \";$item select\"\n"
"} else {\n"
"append form(reset) \";$item deselect\"\n"
"}\n"
"\n"
"\n"
"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinput_hidden {win param} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"HMextract_param $param name\n"
"HMextract_param $param value\n"
"lappend form(submit) [list $name $value]\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinput_image {win param} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"HMextract_param $param name\n"
"set name ;# barf if no name is specified\n"
"set item [HMtag_img $win $param {}]\n"
"$item configure -relief raised -bd 2 -bg blue\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"set submit $win.dummy_submit,$var(tags)\n"
"if {[winfo exists $submit]} {\n"
"destroy $submit\n"
"}\n"
"button $submit -takefocus 0;# this never gets mapped!\n"
"lappend form(submit_button) $submit\n"
"set form(submit_$submit) [list $name $name.\\$form(X).\\$form(Y)]\n"
"\n"
"$item configure -takefocus 1\n"
"bind $item <FocusIn> \"catch \\{$win see $item\\}\"\n"
"bind $item <1> \"$item configure -relief sunken\"\n"
"bind $item <Return> \"\n"
"set $var(form_id)(X) 0\n"
"set $var(form_id)(Y) 0\n"
"$submit invoke \n"
"\"\n"
"bind $item <ButtonRelease-1> \"\n"
"set $var(form_id)(X) %x\n"
"set $var(form_id)(Y) %y\n"
"$item configure -relief raised\n"
"$submit invoke \n"
"\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinput_reset {win param} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"\n"
"set value reset\n"
"HMextract_param $param value\n"
"\n"
"set item $win.input_reset,$var(tags)\n"
"button $item -text [HMmap_esc $value]\n"
"HMwin_install $win $item\n"
"lappend form(reset_button) $item\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMinput_submit {win param} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"\n"
"HMextract_param $param name\n"
"set value submit\n"
"HMextract_param $param value\n"
"set item $win.input_submit,$var(tags)\n"
"button $item -text [HMmap_esc $value] -fg blue\n"
"HMwin_install $win $item\n"
"lappend form(submit_button) $item\n"
"\n"
"\n"
"catch {set form(submit_$item) [list $name $value]}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_select {win param text} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"\n"
"HMextract_param $param name\n"
"set size 5; HMextract_param $param size\n"
"set form(select_size) $size\n"
"set form(select_name) $name\n"
"set form(select_values) \"\" ;# list of values to submit\n"
"if {[HMextract_param $param multiple]} {\n"
"set mode multiple\n"
"} else {\n"
"set mode single\n"
"}\n"
"set item $win.select,$var(tags)\n"
"frame $item\n"
"set form(select_frame) $item\n"
"listbox $item.list -selectmode $mode -width 0 -exportselection 0\n"
"HMwin_install $win $item\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_option {win param text} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"upvar $text data\n"
"set frame $form(select_frame)\n"
"\n"
"\n"
"if {[HMextract_param $param selected]} {\n"
"lappend form(select_default) [$form(select_frame).list size]\n"
"}\n"
"set value [string trimright $data \" \\n\"]\n"
"$frame.list insert end $value\n"
"HMextract_param $param value\n"
"lappend form(select_values) $value\n"
"set data \"\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_/select {win param text} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"set frame $form(select_frame)\n"
"set size $form(select_size)\n"
"set items [$frame.list size]\n"
"\n"
"\n"
"append form(reset) \";$frame.list selection clear 0 $items\"\n"
"if {[info exists form(select_default)]} {\n"
"foreach i $form(select_default) {\n"
"$frame.list selection set $i\n"
"append form(reset) \";$frame.list selection set $i\"\n"
"}\n"
"} else {\n"
"$frame.list selection set 0\n"
"append form(reset) \";$frame.list selection set 0\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"for {set i 0} {$i < $size} {incr i} {\n"
"set value [format {[expr {[%s selection includes %s] ? {%s} : {}}]} \\\n"
"$frame.list $i [lindex $form(select_values) $i]]\n"
"lappend form(submit) [list $form(select_name) $value]\n"
"}\n"
"\n"
"\n"
"\n"
"if {$size > 1 && $items <= $size} {\n"
"$frame.list configure -height $items\n"
"pack $frame.list\n"
"\n"
"\n"
"\n"
"} elseif {$size > 1} {\n"
"scrollbar $frame.scroll -command \"$frame.list yview\" \\\n"
"-orient v -takefocus 0\n"
"$frame.list configure -height $size \\\n"
"-yscrollcommand \"$frame.scroll set\"\n"
"pack $frame.list $frame.scroll -side right -fill y\n"
"\n"
"\n"
"\n"
"} else {\n"
"scrollbar $frame.scroll -command \"$frame.list yview\" \\\n"
"-orient h -takefocus 0\n"
"$frame.list configure -height 1 \\\n"
"-yscrollcommand \"$frame.scroll set\"\n"
"pack $frame.list $frame.scroll -side top -fill x\n"
"}\n"
"\n"
"\n"
"\n"
"foreach i [array names form select_*] {\n"
"unset form($i)\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc HMtag_textarea {win param text} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $var(form_id) form\n"
"upvar $text data\n"
"\n"
"set rows 5; HMextract_param $param rows\n"
"set cols 30; HMextract_param $param cols\n"
"HMextract_param $param name\n"
"set item $win.textarea,$var(tags)\n"
"frame $item\n"
"text $item.text -width $cols -height $rows -wrap none \\\n"
"-yscrollcommand \"$item.scroll set\" -padx 3 -pady 3\n"
"scrollbar $item.scroll -command \"$item.text yview\" -orient v\n"
"$item.text insert 1.0 $data\n"
"HMwin_install $win $item\n"
"pack $item.text $item.scroll -side right -fill y\n"
"lappend form(submit) [list $name \"\\[$item.text get 0.0 end]\"]\n"
"append form(reset) \";$item.text delete 1.0 end; \\\n"
"$item.text insert 1.0 [list $data]\"\n"
"set data \"\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMwin_install {win item} {\n"
"upvar #0 HM$win var\n"
"$win window create $var(S_insert) -window $item -align bottom\n"
"$win tag add indent$var(level) $item\n"
"set focus [expr {[winfo class $item] != \"Frame\"}]\n"
"$item configure -takefocus $focus\n"
"bind $item <FocusIn> \"$win see $item\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMsubmit_button {win form_id param stuff} {\n"
"upvar #0 HM$win var\n"
"upvar #0 $form_id form\n"
"set query \"\"\n"
"foreach pair $stuff {\n"
"set value [subst [lindex $pair 1]]\n"
"if {$value != \"\"} {\n"
"set item [lindex $pair 0]\n"
"lappend query $item $value\n"
"}\n"
"}\n"
"\n"
"HMsubmit_form $win $param $query\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMsubmit_form {win param query} {\n"
"set result \"\"\n"
"set sep \"\"\n"
"foreach i $query {\n"
"append result $sep [HMmap_reply $i]\n"
"if {$sep != \"=\"} {set sep =} {set sep &}\n"
"}\n"
"puts $result\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"set HMalphanumeric a-zA-Z0-9 ;# definition of alphanumeric character class\n"
"for {set i 1} {$i <= 256} {incr i} {\n"
"set c [format %c $i]\n"
"if {![string match \\[$HMalphanumeric\\] $c]} {\n"
"set HMform_map($c) %[format %.2x $i]\n"
"}\n"
"}\n"
"\n"
"\n"
"array set HMform_map {\n"
"\" \" + \\n %0d%0a\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMmap_reply {string} {\n"
"global HMform_map HMalphanumeric\n"
"regsub -all \\[^$HMalphanumeric\\] $string {$HMform_map(&)} string\n"
"regsub -all \\n $string {\\\\n} string\n"
"regsub -all \\t $string {\\\\t} string\n"
"regsub -all {[][{})\\\\]\\)} $string {\\\\&} string\n"
"return [subst $string]\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc HMcgiDecode {data} {\n"
"set data [split $data \"&=\"]\n"
"foreach i $data {\n"
"lappend result [cgiMap $i]\n"
"}\n"
"return $result\n"
"}\n"
"\n"
"proc HMcgiMap {data} {\n"
"regsub -all {\\+} $data \" \" data\n"
"\n"
"if {[regexp % $data]} {\n"
"regsub -all {([][$\\\\])} $data {\\\\\\1} data\n"
"regsub -all {%([0-9a-fA-F][0-9a-fA-F])} $data {[format %c 0x\\1]} data\n"
"return [subst $data]\n"
"} else {\n"
"return $data\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"auto_load tkFocusOK\n"
"proc tkFocusOK w {\n"
"set code [catch {$w cget -takefocus} value]\n"
"if {($code == 0) && ($value != \"\")} {\n"
"if {$value == 0} {\n"
"return 0\n"
"} elseif {$value == 1} {\n"
"return 1\n"
"} else {\n"
"set value [uplevel #0 $value $w]\n"
"if {$value != \"\"} {\n"
"return $value\n"
"}\n"
"}\n"
"}\n"
"set code [catch {$w cget -state} value]\n"
"if {($code == 0) && ($value == \"disabled\")} {\n"
"return 0\n"
"}\n"
"regexp Key|Focus \"[bind $w] [bind [winfo class $w]]\"\n"
"}\n"
"";
#line 32 "ts.et"
Et_EvalInclude("html_library.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"\n"
"\n"
"\n"
"proc hlp_taglink {} {\n"
"global hlp\n"
"\n"
"if {$hlp(tag) == {}} {return}\n"
".help.t tag configure $hlp(tag) -borderwidth 0 -relief flat\n"
"regsub L: $hlp(tag) {} link\n"
"HMlink_callback .help.t $link\n"
"}\n"
"\n"
"proc hlp_Next {{delta 1}} {\n"
"global hlp\n"
"\n"
"if {$hlp(tag) != {}} {\n"
".help.t tag configure $hlp(tag) -borderwidth 0 -relief flat\n"
"set hlp(tag) {}\n"
"}\n"
"set pos [.help.t index insert]\n"
"set l [llength $hlp(links)]\n"
"if {$delta > 0} {\n"
"for {set i 0} {$i < $l} {incr i} {\n"
"if {[.help.t compare $pos < [lindex [lindex $hlp(links) $i] 0]]} {break}\n"
"}\n"
"if {$i == $l} {return}\n"
"} else {\n"
"for {set i [expr $l-1]} {$i >= 0} {incr i -1} {\n"
"if {[.help.t compare $pos > [lindex [lindex $hlp(links) $i] 0]]} {break}\n"
"}\n"
"if {$i == 0} {return}\n"
"}\n"
"set entry [lindex $hlp(links) $i]\n"
"set pos [lindex $entry 0]\n"
"set hlp(tag) [lindex $entry 1]\n"
".help.t tag configure $hlp(tag) -borderwidth 2 -relief raised\n"
".help.t mark set insert $pos\n"
".help.t see $pos\n"
"}\n"
"\n"
"\n"
"\n"
"proc hlp_Copy {} {\n"
"global hlp ted_buf\n"
"\n"
"set ted_buf [selection get]\n"
"}\n"
"\n"
"proc ReadHtml {win file {pos \"\"}} {\n"
"\n"
"set fd [open $file r]\n"
"set text [read $fd]\n"
"close $fd\n"
"HMparse_html $text \"HMrender $win\"\n"
"if {$pos != \"\"} {\n"
"HMgoto $win $pos\n"
"}\n"
"}\n"
"\n"
"proc HMlink_callback {win file {his 0}} {\n"
"global hlp\n"
"\n"
"if {$hlp(locked)} {return}\n"
"set pos \"\"\n"
"if {$his < 0} {\n"
"set l [expr [llength $hlp(history)]-2]\n"
"if {$l >= 0} {\n"
"set file [lindex $hlp(history) $l]\n"
"set hlp(history) [lreplace $hlp(history) $l end]\n"
"} else {\n"
"return\n"
"}\n"
"}\n"
"set hlp(locked) 1\n"
"regexp {([^#]*)#(.*)} $file dummy file pos\n"
"debug $pos\n"
"if {$file == \"\" && $pos != \"\"} {\n"
"HMgoto $win $pos\n"
".help.t mark set insert N:$pos\n"
"set hlp(locked) 0\n"
"return\n"
"}\n"
"WaitHint $win \"Please be patient\"\n"
"HMreset_win $win\n"
"cd [file dirname $file]\n"
"set file [file tail $file]\n"
"lappend hlp(history) [pwd]/$file#$pos\n"
"ReadHtml $win $file $pos\n"
".help.t mark set insert 1.0\n"
"set hlp(links) {}\n"
"foreach tag [.help.t tag names] {\n"
"if [regexp {^L:.*} $tag] {\n"
"set r [.help.t tag ranges $tag]\n"
"set l [llength $r]\n"
"for {set i 0} {$i < $l} {incr i 2} {\n"
"debug \"[lindex $r $i] $tag]\"\n"
"lappend hlp(links) [list [lindex $r $i] $tag]\n"
"}\n"
"}\n"
"}\n"
"if {$pos != {}} {\n"
".help.t mark set insert N:$pos\n"
"}\n"
"DelWaitHint\n"
"set hlp(locked) 0\n"
"}\n"
"\n"
"proc hlpcmp {a b} {\n"
"set x [lindex $a 0]\n"
"set y [lindex $b 0]\n"
"if {$x < $y} {return -1}\n"
"if {$x > $y} {return 1}\n"
"return 0\n"
"}\n"
"\n"
"proc Help {win} {\n"
"global hlp params gparams\n"
"\n"
"if [winfo exists .help] {return}\n"
"set hlp(dir) $params(hlpdir)/$gparams(hlplan)\n"
"\n"
"toplevel .help\n"
"wm geometry .help +0+100\n"
"wm title .help Help\n"
"\n"
"frame .help.m -relief raised -bd 1\n"
"pack .help.m -fill x\n"
"\n"
"menu .help.menubar\n"
".help config -menu .help.menubar\n"
"foreach m {File Topics} {\n"
"set $m [menu .help.menubar.m$m -tearoff 0]\n"
".help.menubar add cascade -label $m -underline 0 -menu .help.menubar.m$m\n"
"}\n"
"$File add command -label Exit -accelerator Esc \\\n"
"-command {set hlp(ok) 1}\n"
"\n"
"$Topics add command -label Main -accelerator M \\\n"
"-command \"HMlink_callback .help.t $hlp(dir)/main.html#main\"\n"
"\n"
"\n"
"$Topics add command -label LaTeX \\\n"
"-command \"HMlink_callback .help.t $hlp(dir)/latex/index.html\"\n"
"\n"
"frame .help.b\n"
"pack .help.b -fill x\n"
"\n"
"button .help.b.home -bitmap @$params(icon_dir)/home.ico \\\n"
"-command \"HMlink_callback .help.t $hlp(dir)/main.html#main\"\n"
"button .help.b.latex -bitmap @$params(icon_dir)/tex1.ico \\\n"
"-command \"HMlink_callback .help.t $hlp(dir)/latex/index.html\"\n"
"button .help.b.ref -bitmap @$params(icon_dir)/man1.ico \\\n"
"-command \"HMlink_callback .help.t $hlp(dir)/latex/sec184.html\"\n"
"button .help.b.left -bitmap @$params(icon_dir)/left.ico \\\n"
"-command \"HMlink_callback .help.t dummy -1\"\n"
"button .help.b.exit -bitmap @$params(icon_dir)/door1.ico \\\n"
"-command {set hlp(ok) 1}\n"
"pack .help.b.home .help.b.latex .help.b.ref .help.b.left -side left\n"
"pack .help.b.exit -side right\n"
"\n"
"scrollbar .help.sb -command {.help.t yview}\n"
"pack .help.sb -side right -fill y\n"
"text .help.t -yscroll {.help.sb set}\n"
"catch {\n"
".help.t configure -font \\\n"
"[list $gparams(font) $gparams(fontsize) $gparams(fontstyle)]\n"
"}\n"
"pack .help.t -fill both -expand true \n"
"HMinit_win .help.t\n"
"set hlp(history) {}\n"
"set hlp(history_pos) 0\n"
"\n"
"bindtags .help.t {.help.t}\n"
"bind .help.t <Tab> {hlp_Next}\n"
"bind .help.t <Shift-Tab> {hlp_Next -1}\n"
"bind .help.t <Any-i> \"HMlink_callback .help.t $hlp(dir)/latex/sec184.html\"\n"
"bind .help.t <Any-m> \"HMlink_callback .help.t $hlp(dir)/main.html#main\"\n"
"bind .help.t <Control-c> {hlp_Copy}\n"
"bind .help.t <Return> {hlp_taglink} \n"
"bind .help.t <Escape> {set hlp(ok) 1}\n"
"bind .help.t <Prior> [bind Text <Prior>]\n"
"bind .help.t <Next> [bind Text <Next>]\n"
"bind .help.t <Up> [bind Text <Up>]\n"
"bind .help.t <Down> [bind Text <Down>]\n"
"bind .help.t <Alt-Key> [bind all <Alt-Key>]\n"
"bind .help.t <Any-Key> { }\n"
"\n"
"bind .help.b.home <Enter> {ButtonHint %W \"Main Help\"}\n"
"bind .help.b.home <Leave> {DelButtonHint}\n"
"bind .help.b.latex <Enter> {ButtonHint %W \"LaTeX Help\"}\n"
"bind .help.b.latex <Leave> {DelButtonHint}\n"
"bind .help.b.ref <Enter> {ButtonHint %W \"LaTeX Index\"}\n"
"bind .help.b.ref <Leave> {DelButtonHint}\n"
"bind .help.b.left <Enter> {ButtonHint %W \"Back\"}\n"
"bind .help.b.left <Leave> {DelButtonHint}\n"
"bind .help.b.exit <Enter> {ButtonHint %W \"Exit Help\"}\n"
"bind .help.b.exit <Leave> {DelButtonHint}\n"
"\n"
"set hlp(old_focus) [focus]\n"
"xfocus .help.t\n"
"grab .help\n"
"update\n"
"set x [winfo rootx .help.t]\n"
"set y [winfo rooty .help.t]\n"
"set hlp(dlg_geom) 300x200+$x+$y\n"
"\n"
"switch $win {\n"
"\".\" {set item \"main.html#main\"}\n"
"default {set item \"tedit.html#main\"}\n"
"}\n"
"cd $hlp(dir)\n"
"set hlp(locked) 0\n"
"HMlink_callback .help.t $item\n"
"set hlp(tag) {}\n"
"set hlp(links) [lsort -command hlpcmp $hlp(links)]\n"
"debug $hlp(links)\n"
"set hlp(pos) -1\n"
"tkwait variable hlp(ok)\n"
"grab release .help\n"
"xfocus $hlp(old_focus)\n"
"catch {destroy .hint}\n"
"destroy .help\n"
"cd $params(Primary_dir)\n"
"}\n"
"";
#line 33 "ts.et"
Et_EvalInclude("ts_help.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"set gparams(showicons) 1\n"
"\n"
"set gparams(showprimary) 1\n"
"\n"
"set gparams(showout) 1\n"
"\n"
"\n"
"\n"
"\n"
"set gparams(foreground) blue\n"
"set gparams(font) courier\n"
"set gparams(fontsize) 12\n"
"set gparams(fontstyle) normal\n"
"\n"
"set params(icon_dir) $TS_BASE/bitmaps\n"
"set params(global_paramfile) /etc/ts.cfg\n"
"set params(template_dir) $TS_BASE/templates\n"
"set params(hlpdir) $TS_BASE/help\n"
"set params(version) $TS_VERSION\n"
"\n"
"set params(Primary_dir) [pwd]\n"
"set params(Edit_file) \"\"\n"
"set params(pid) 1\n"
"set params(local_paramfile) $env(HOME)/.ts/ts.cfg\n"
"set params(template_index) $env(HOME)/.ts/templates.idx\n"
"\n"
"set params(pr_first) \"\"\n"
"set params(pr_last) \"\"\n"
"set params(pr_copies) \"\"\n"
"set params(pr_xopt) \"\"\n"
"set params(pr_orientation) \"\"\n"
"set params(pr_pages) \"\"\n"
"";
#line 34 "ts.et"
Et_EvalInclude("ts_opt.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"\n"
"\n"
"\n"
"proc ts_optionMenu {w varName callback firstValue args} {\n"
"upvar #0 $varName var\n"
"upvar #0 $callback funct\n"
"\n"
"if ![info exists var] {\n"
"set var $firstValue\n"
"}\n"
"menubutton $w -textvariable $varName -indicatoron 1 -menu $w.menu \\\n"
"-relief raised -bd 1\n"
"menu $w.menu -tearoff 0\n"
"$w.menu add radiobutton -label $firstValue -variable $varName -command \\\n"
"\"$callback $firstValue\"\n"
"foreach i $args {\n"
"$w.menu add radiobutton -label $i -variable $varName \\\n"
"-command \"$callback $i\"\n"
"}\n"
"return $w.menu\n"
"}\n"
"";
#line 35 "ts.et"
Et_EvalInclude("ts_optmenu.tcl",_ET_script_); };
{ static char _ET_script_[] =
"proc PrintDlg {geometry file params} {\n"
"global prd\n"
"upvar $params pr\n"
"\n"
"toplevel .prd\n"
"wm geometry .prd $geometry\n"
"wm transient .prd .\n"
"wm title .prd \"Print parameters\"\n"
"\n"
"set prd(first) $pr(pr_first)\n"
"set prd(last) $pr(pr_last)\n"
"set prd(copies) $pr(pr_copies)\n"
"set prd(xopt) $pr(pr_xopt)\n"
"if {$pr(pr_pages) == \"\"} { \n"
"set prd(pages) \"all\" \n"
"} else {\n"
"set prd(pages) $pr(pr_pages) \n"
"} \n"
"if {$pr(pr_orientation) == \"\"} {\n"
"set prd(orientation) \"portrait\" \n"
"} else { \n"
"set prd(orientation) $pr(pr_orientation)\n"
"}\n"
"frame .prd.ft -relief raised -bd 1\n"
"pack .prd.ft -fill x\n"
"label .prd.ft.lt -text \"Print parameters for $file\" \\\n"
"-width 35 -anchor w\n"
"pack .prd.ft.lt -side left -pady 5 -padx 5\n"
"\n"
"frame .prd.ff -relief raised -bd 1\n"
"pack .prd.ff -fill x\n"
"label .prd.ff.lf -text \"First page:\" -width 15 -anchor w\n"
"entry .prd.ff.ef -relief sunken -font fixed -width 4 \\\n"
"-textvariable prd(first)\n"
"pack .prd.ff.lf -side left -padx 5\n"
"pack .prd.ff.ef -side right -padx 5\n"
"\n"
"frame .prd.fl -relief raised -bd 1\n"
"pack .prd.fl -fill x\n"
"label .prd.fl.ll -text \"Last page:\" -width 15 -anchor w\n"
"entry .prd.fl.el -relief sunken -font fixed -width 4 \\\n"
"-textvariable prd(last)\n"
"pack .prd.fl.ll -side left -padx 5\n"
"pack .prd.fl.el -side right -padx 5\n"
"\n"
"frame .prd.fc -relief raised -bd 1\n"
"pack .prd.fc -fill x\n"
"label .prd.fc.lc -text \"Number of copies:\" -width 15 -anchor w\n"
"entry .prd.fc.ec -relief sunken -font fixed -width 4 \\\n"
"-textvariable prd(copies) \n"
"pack .prd.fc.lc -side left -padx 5\n"
"pack .prd.fc.ec -side right -padx 5\n"
"\n"
"frame .prd.fx -relief raised -bd 1\n"
"pack .prd.fx -fill x\n"
"label .prd.fx.lx -text \"Extra Options:\" -width 15 -anchor w\n"
"entry .prd.fx.ex -relief sunken -font fixed -width 20 \\\n"
"-textvariable prd(xopt) \n"
"pack .prd.fx.lx -side left -padx 5\n"
"pack .prd.fx.ex -side right -padx 5\n"
"\n"
"frame .prd.fpo -relief raised -bd 1\n"
"pack .prd.fpo -fill x\n"
"\n"
"frame .prd.fp\n"
"pack .prd.fp -side left -padx 5 -pady 5 -in .prd.fpo\n"
"label .prd.fp.lp -text \"Page selection\" -anchor w \n"
"radiobutton .prd.fp.rall -text \"All pages\" -underline 0 -anchor w \\\n"
"-font fixed -variable prd(pages) -value \"all\"\n"
"radiobutton .prd.fp.rodd -text \"Odd pages\" -underline 0 -anchor w \\\n"
"-font fixed -variable prd(pages) -value odd\n"
"radiobutton .prd.fp.reven -text \"Even pages\" -underline 0 -anchor w \\\n"
"-font fixed -variable prd(pages) -value even\n"
"pack .prd.fp.lp .prd.fp.rall .prd.fp.rodd .prd.fp.reven -fill x\n"
"\n"
"frame .prd.fo\n"
"pack .prd.fo -side right -padx 5 -pady 5 -fill y -in .prd.fpo\n"
"label .prd.fo.lo -text \"Orientation\" -anchor w \n"
"radiobutton .prd.fo.rp -text \"Portrait\" -underline 0 -anchor w -font fixed \\\n"
"-variable prd(orientation) -value \"portrait\"\n"
"radiobutton .prd.fo.rl -text \"Landscape\" -underline 0 -anchor w -font fixed \\\n"
"-variable prd(orientation) -value landscape\n"
"pack .prd.fo.lo .prd.fo.rp .prd.fo.rl -fill x\n"
"\n"
"frame .prd.fb -relief raised -bd 1\n"
"pack .prd.fb -fill x\n"
"frame .prd.fb.fok -relief sunken -bd 2\n"
"button .prd.fb.ok -text OK -command {set prd(ok) 1}\n"
"button .prd.fb.cancel -text Cancel \\\n"
"-command {set prd(ok) 0}\n"
"pack .prd.fb.fok -side left -padx 5 -pady 5\n"
"pack .prd.fb.ok -padx 5 -pady 5 -in .prd.fb.fok\n"
"pack .prd.fb.cancel -padx 10 -pady 5 -side left\n"
"\n"
"set elist [list .prd.ff.ef .prd.fl.el .prd.fc.ec .prd.fx.ex]\n"
"for {set i 0} {$i < 4} {incr i} {\n"
"set w [lindex $elist $i]\n"
"if {$i > 0} {\n"
"set wp [lindex $elist [expr $i - 1]]\n"
"} else {set wp .prd.fc.ec}\n"
"if {$i < 3} {\n"
"set wn [lindex $elist [expr $i + 1]]\n"
"} else {set wn .prd.ff.ef}\n"
"bind $w <Return> \"focus $wn\"\n"
"bind $w <Tab> \"focus $wn\"\n"
"bind $w <Shift-Tab> \"focus $wp\"\n"
"bind $w <Control-Return> \"set prd(ok) 1\"\n"
"bind $w <Escape> \"set prd(ok) 0\" \n"
"bind $w <Alt-Any-a> \"set prd(pages) all\"\n"
"bind $w <Alt-Any-o> \"set prd(pages) odd\"\n"
"bind $w <Alt-Any-e> \"set prd(pages) even\"\n"
"bind $w <Alt-Any-p> \"set prd(orientation) portrait\"\n"
"bind $w <Alt-Any-l> \"set prd(orientation) landscape\"\n"
"}\n"
"set old_focus [focus]\n"
"focus .prd.ff.ef\n"
"tkwait variable prd(ok)\n"
"if {$prd(ok)} {\n"
"set pr(pr_first) $prd(first)\n"
"set pr(pr_last) $prd(last)\n"
"set pr(pr_copies) $prd(copies)\n"
"set pr(pr_xopt) $prd(xopt)\n"
"if {$prd(pages) == \"all\"} { \n"
"set pr(pr_pages) \"\" \n"
"} else {\n"
"set pr(pr_pages) $prd(pages) \n"
"} \n"
"if {$prd(orientation) == \"portrait\"} {\n"
"set pr(pr_orientation) \"\" \n"
"} else { \n"
"set pr(pr_orientation) $prd(orientation)\n"
"}\n"
"}\n"
"focus $old_focus\n"
"destroy .prd\n"
"return $prd(ok)\n"
"}\n"
"";
#line 36 "ts.et"
Et_EvalInclude("ts_prtdlg.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"proc utilmenu {name} {\n"
"global params\n"
"\n"
"\n"
"$name add separator\n"
"$name delete 1 last\n"
"if {$params(Util) != {}} {\n"
"$name add separator\n"
"set i 1\n"
"foreach l $params(Util) {\n"
"$name add command -label \"$i [lindex $l 0]\" -underline 0 \\\n"
"-command \"Util [expr $i -1]\"\n"
"incr i\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc SetPos {} {\n"
"global params\n"
"\n"
"\n"
"\n"
"set x [expr [winfo rootx .]+10]\n"
"set y [winfo rooty .]\n"
"set params(dlg_geom) +$x+$y\n"
"set params(x0) $x\n"
"set params(y0) $y\n"
"set params(default_geom) +$params(x0)+0\n"
"debug $params(dlg_geom)\n"
"}\n"
"\n"
"proc ButtonHint {w s} {\n"
"set x [winfo rootx $w]\n"
"set y [expr [winfo rooty $w]+[winfo height $w]]\n"
"catch {destroy .hint}\n"
"menu .hint -tearoff 0 -bg yellow -bd 1 -relief flat\n"
".hint add command -label $s\n"
".hint post $x $y\n"
"}\n"
"\n"
"proc DelButtonHint {} {\n"
"catch {destroy .hint}\n"
"}\n"
"\n"
"proc WaitHint {w s} {\n"
"set x [expr round([winfo rootx $w]+[winfo width $w]*0.4)]\n"
"set y [expr round([winfo rooty $w]+[winfo height $w]*0.4)]\n"
"menu .wait -tearoff 0 -bg red -font 10x20 -fg white -bd 2 -relief raised\n"
".wait add command -label $s\n"
".wait post $x $y\n"
"}\n"
"\n"
"proc DelWaitHint {} {\n"
"catch {destroy .wait}\n"
"}\n"
"\n"
"proc showbuttons {} {\n"
"global gparams\n"
"\n"
"if {$gparams(showicons)} {\n"
"catch {\n"
"grid .h -row 0 -column 0 -sticky ew\n"
"}\n"
"} else {\n"
"catch {\n"
"grid forget .h\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc showprimary {} {\n"
"global gparams\n"
"\n"
"if {$gparams(showprimary)} {\n"
"catch {\n"
"grid .p -row 1 -column 0 -sticky ew\n"
"}\n"
"} else {\n"
"catch {\n"
"grid forget .p\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc showterm {} {\n"
"global gparams\n"
"\n"
"if {$gparams(showout)} {\n"
"catch {\n"
"grid .term -row 2 -column 0 -sticky ew\n"
"}\n"
"} else {\n"
"catch {\n"
"grid forget .term\n"
"}\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc ide {} {\n"
"global params gparams\n"
"\n"
"update idletasks\n"
"if [info exists gparams(pos)] {\n"
"set pos $gparams(pos)\n"
"} else {\n"
"set pos +10+25\n"
"}\n"
"catch {wm geometry . $pos} \n"
"wm title . TeXShell\n"
"wm iconbitmap . @$params(icon_dir)/tex.ico\n"
"\n"
"\n"
"frame .p -bd 1 -relief groove\n"
"frame .h -bd 1 -relief groove\n"
"text .term -width 80 -height 25 -font fixed\n"
"grid .term -row 2 -column 0 -sticky nsew\n"
"\n"
"\n"
"menu .menubar -bd 1\n"
". config -menu .menubar\n"
"foreach m {File Action Util Options} {\n"
"set $m [menu .menubar.m$m -tearoff 0]\n"
".menubar add cascade -label $m -underline 0 -menu .menubar.m$m\n"
"}\n"
"set Help [menu .menubar.help -tearoff 0]\n"
".menubar add cascade -label Help -underline 0 -menu .menubar.help\n"
"\n"
"$File add command -label \"Primary File...\" -underline 0 \\\n"
"-accelerator {Shift-F3} -command Primary\n"
"$File add command -label \"Edit Primary\" -underline 1 \\\n"
"-accelerator {Alt-0} -command EditPrim\n"
"$File add command -label \"Edit...\" -underline 0 -accelerator {F3} \\\n"
"-command Edit\n"
"$File add command -label \"Structure...\" -underline 0 -accelerator \\\n"
"F4 -command Project\n"
"$File add separator\n"
"$File add command -label Exit -underline 1 -accelerator {Alt-X} \\\n"
"-command {Exit}\n"
"\n"
"$Action add command -label \"Graphics\" -accelerator F5 -command Graphic\n"
"$Action add command -label \"Compose\" -accelerator F6 -command Compose\n"
"$Action add command -label \"References\" -accelerator F7 -command Reference\n"
"$Action add command -label \"View\" -accelerator F8 -command View\n"
"$Action add command -label \"Print\" -accelerator F9 -command Print\n"
"$Action add command -label \"User\" -accelerator F11 -command User\n"
"\n"
"$Util add command -label \"Kill Process\" -underline 0 -command Kill \n"
"utilmenu $Util\n"
"\n"
"$Options add checkbutton -label \"Show Toolbar\" \\\n"
"-variable gparams(showicons) -command showbuttons -underline 5\n"
"$Options add checkbutton -label \"Show Primary\" \\\n"
"-variable gparams(showprimary) -command showprimary -underline 5\n"
"$Options add checkbutton -label \"Show Output\" -underline 0 \\\n"
"-variable gparams(showout) -command showterm\n"
"$Options add separator\n"
"$Options add command -label \"Global Settings...\" \\\n"
"-underline 0 -command Options\n"
"$Options add command -label \"Editor Settings...\" \\\n"
"-underline 0 -command EditOpt\n"
"$Options add separator\n"
"$Options add command -label \"Editor...\" -accelerator {^F3} \\\n"
"-underline 0 -command {selectparams Edit}\n"
"$Options add command -label \"Graphics...\" -accelerator {^F5} \\\n"
"-underline 0 -command {selectparams Graphic}\n"
"$Options add command -label \"Compose...\" -accelerator {^F6} \\\n"
"-underline 0 -command {selectparams Compose}\n"
"$Options add command -label \"References...\" -accelerator {^F7} \\\n"
"-underline 0 -command {selectparams Reference}\n"
"$Options add command -label \"View...\" -accelerator {^F8} \\\n"
"-underline 0 -command {selectparams View}\n"
"$Options add command -label \"Print...\" -accelerator {^F9} \\\n"
"-underline 0 -command {selectparams Print}\n"
"$Options add command -label \"Utils...\" -accelerator {^F11} \\\n"
"-underline 0 -command {selectparams Util}\n"
"\n"
"$Help add command -label \"TeXShell...\" -accelerator F1 -command {Help .}\n"
"\n"
"\n"
"\n"
"frame .h.fedit -bd 1 -relief groove\n"
"button .h.bedit -bitmap @$params(icon_dir)/edit2.ico -command Edit -bd 1\n"
"button .h.sedit -bitmap @$params(icon_dir)/down2.ico -bd 1 \\\n"
"-command {SelectAction .h.bedit Edit}\n"
"label .h.ledit -textvariable params(Edit_name) -font fixed -anchor w -width 7\n"
"pack .h.ledit -in .h.fedit -side bottom\n"
"pack .h.bedit .h.sedit -in .h.fedit -side left\n"
"\n"
"frame .h.fgraph -bd 1 -relief groove\n"
"button .h.bgraph -bitmap @$params(icon_dir)/graphic2.ico -command Graphic \\\n"
"-bd 1\n"
"button .h.sgraph -bitmap @$params(icon_dir)/down2.ico -bd 1 \\\n"
"-command {SelectAction .h.bgraph Graphic}\n"
"label .h.lgraph -textvariable params(Graphic_name) -font fixed -anchor w \\\n"
"-width 7\n"
"pack .h.lgraph -in .h.fgraph -side bottom\n"
"pack .h.bgraph .h.sgraph -in .h.fgraph -side left\n"
"\n"
"frame .h.fcompose -bd 1 -relief groove\n"
"button .h.bcompose -bitmap @$params(icon_dir)/tex2.ico -command Compose -bd 1\n"
"button .h.scompose -bitmap @$params(icon_dir)/down2.ico -bd 1 \\\n"
"-command {SelectAction .h.bcompose Compose}\n"
"label .h.lcompose -textvariable params(Compose_name) -font fixed -anchor w \\\n"
"-width 7\n"
"pack .h.lcompose -in .h.fcompose -side bottom\n"
"pack .h.bcompose .h.scompose -in .h.fcompose -side left\n"
"\n"
"frame .h.fref -bd 1 -relief groove\n"
"button .h.bref -bitmap @$params(icon_dir)/ref2.ico -command Reference -bd 1\n"
"button .h.sref -bitmap @$params(icon_dir)/down2.ico -bd 1 \\\n"
"-command {SelectAction .h.bref Reference}\n"
"label .h.lref -textvariable params(Reference_name) -font fixed -anchor w \\\n"
"-width 7\n"
"pack .h.lref -in .h.fref -side bottom\n"
"pack .h.bref .h.sref -in .h.fref -side left\n"
"\n"
"frame .h.fview -bd 1 -relief groove\n"
"button .h.bview -bitmap @$params(icon_dir)/xdvi2.ico -command View -bd 1\n"
"button .h.sview -bitmap @$params(icon_dir)/down2.ico -bd 1 \\\n"
"-command {SelectAction .h.bview View}\n"
"label .h.lview -textvariable params(View_name) -font fixed -anchor w \\\n"
"-width 7\n"
"pack .h.lview -in .h.fview -side bottom\n"
"pack .h.bview .h.sview -in .h.fview -side left\n"
"\n"
"frame .h.fprint -bd 1 -relief groove\n"
"button .h.bprint -bitmap @$params(icon_dir)/printer2.ico -command Print -bd 1\n"
"button .h.sprint -bitmap @$params(icon_dir)/down2.ico -bd 1 \\\n"
"-command {SelectAction .h.bprint Print}\n"
"label .h.lprint -textvariable params(Print_name) -font fixed -anchor w \\\n"
"-width 7\n"
"pack .h.lprint -in .h.fprint -side bottom\n"
"pack .h.bprint .h.sprint -in .h.fprint -side left\n"
"\n"
"frame .h.futil -bd 1 -relief groove\n"
"button .h.butil -bitmap @$params(icon_dir)/cat2.ico -command Util -bd 1\n"
"button .h.sutil -bitmap @$params(icon_dir)/down2.ico -bd 1 \\\n"
"-command {SelectAction .h.butil Util}\n"
"label .h.lutil -textvariable params(Util_name) -font fixed -anchor w \\\n"
"-width 7\n"
"pack .h.lutil -in .h.futil -side bottom\n"
"pack .h.butil .h.sutil -in .h.futil -side left\n"
"\n"
"frame .h.fhelp -bd 1 -relief groove\n"
"button .h.bhelp -bitmap @$params(icon_dir)/help2.ico -command {Help .} -bd 1\n"
"label .h.lhelp -text \"\" -font fixed -anchor w \\\n"
"-width 3\n"
"pack .h.lhelp -in .h.fhelp -side bottom\n"
"pack .h.bhelp -in .h.fhelp -side left\n"
"\n"
"button .h.fexit -bitmap @$params(icon_dir)/door2.ico -command Exit -bd 1\n"
"pack .h.fedit .h.sedit .h.fgraph .h.sgraph \\\n"
".h.fcompose .h.scompose .h.fref .h.sref .h.fview .h.sview \\\n"
".h.fprint .h.sprint .h.futil .h.sutil .h.fhelp -side left\n"
"pack .h.fexit -side right -anchor n\n"
"showbuttons\n"
"showprimary\n"
"\n"
"\n"
"button .p.bprimary -bitmap @$params(icon_dir)/primary.ico -command Primary \\\n"
"-bd 1\n"
"\n"
"label .p.d -textvariable params(Short_dir) -font fixed -bd 2 -relief sunken\n"
"label .p.ls -text \" / \"\n"
"label .p.f -textvariable params(Primary_file) -font fixed -bd 2 \\\n"
"-relief sunken\n"
"button .p.bstruct -bitmap @$params(icon_dir)/struct.ico -command Project \\\n"
"-bd 1\n"
"pack .p.bprimary .p.bstruct .p.d .p.ls .p.f -side left -pady 1\n"
"\n"
"\n"
"bind .p.bprimary <Enter> {ButtonHint %W \"Primary File\"}\n"
"bind .p.bprimary <Leave> {DelButtonHint}\n"
"bind .p.bstruct <Enter> {ButtonHint %W Structure}\n"
"bind .p.bstruct <Leave> {DelButtonHint}\n"
"bind .h.bedit <Enter> {ButtonHint %W Edit}\n"
"bind .h.bedit <Leave> {DelButtonHint}\n"
"bind .h.bgraph <Enter> {ButtonHint %W Graphics}\n"
"bind .h.bgraph <Leave> {DelButtonHint}\n"
"bind .h.bcompose <Enter> {ButtonHint %W Compose}\n"
"bind .h.bcompose <Leave> {DelButtonHint}\n"
"bind .h.bref <Enter> {ButtonHint %W References}\n"
"bind .h.bref <Leave> {DelButtonHint}\n"
"bind .h.bview <Enter> {ButtonHint %W View}\n"
"bind .h.bview <Leave> {DelButtonHint}\n"
"bind .h.bprint <Enter> {ButtonHint %W Print}\n"
"bind .h.bprint <Leave> {DelButtonHint}\n"
"bind .h.butil <Enter> {ButtonHint %W Utils}\n"
"bind .h.butil <Leave> {DelButtonHint}\n"
"bind .h.bhelp <Enter> {ButtonHint %W Help}\n"
"bind .h.bhelp <Leave> {DelButtonHint}\n"
"bind .h.fexit <Enter> {ButtonHint %W Exit}\n"
"bind .h.fexit <Leave> {DelButtonHint}\n"
"bind .h.bedit <Button-3> \"selectparams Edit\"\n"
"bind .h.bcompose <Button-3> \"selectparams Compose\"\n"
"bind .h.bref <Button-3> \"selectparams Reference\"\n"
"bind .h.bview <Button-3> \"selectparams View\"\n"
"bind .h.bprint <Button-3> \"selectparams Print\"\n"
"bind .h.bgraph <Button-3> \"selectparams Graphic\"\n"
"bind .h.butil <Button-3> \"selectparams Util\"\n"
"GlobalBind\n"
"bind .term <Button-1> \"xfocus .\"\n"
"update\n"
"\n"
"\n"
"CreateTerm\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"SetPos\n"
"debug $params(dlg_geom)\n"
"showterm\n"
"xfocus .\n"
"\n"
"}\n"
"\n"
"proc GlobalBind {} {\n"
"\n"
"bind all <F1> {Help %W}\n"
"bind . <Alt-Any-x> {Exit}\n"
"bind . <F3> {Edit}\n"
"bind . <Alt-Any-0> {EditPrim}\n"
"bind . <F13> {Primary}\n"
"bind . <Shift-F3> {Primary}\n"
"bind . <Alt-F3> { }\n"
"bind . <F4> {Project}\n"
"bind . <F5> {Graphic}\n"
"bind . <F6> {Compose}\n"
"bind . <F7> {Reference}\n"
"bind . <F8> {View}\n"
"bind . <F9> {Print}\n"
"bind . <F11> {Util}\n"
"bind . <Control-F3> \"selectparams Edit\"\n"
"bind . <Control-F5> \"selectparams Graphic\"\n"
"bind . <Control-F6> \"selectparams Compose\"\n"
"bind . <Control-F7> \"selectparams Reference\"\n"
"bind . <Control-F8> \"selectparams View\"\n"
"bind . <Control-F9> \"selectparams Print\"\n"
"bind . <Control-F11> \"selectparams Util\"\n"
"bind . <Alt-Any-F5> \"xfocus .\"\n"
"\n"
"for {set i 1} {$i < 10} {incr i} {\n"
"bind . <Alt-Any-Key-$i> \"Edit $i\"\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"}\n"
"";
#line 37 "ts.et"
Et_EvalInclude("ts_ide.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"\n"
"\n"
"\n"
"proc TedNextWordOrChar {str start} {\n"
"set str [string range $str $start end]\n"
"regsub -all -- {\\\\} $str # str\n"
"if [regexp -indices {.[a-zA-Z0-9]*[ \\n\\t]*[^ \\t\\n]} $str result] {\n"
"return [expr [lindex $result 1] + $start]\n"
"}\n"
"}\n"
"\n"
"proc TedReadFile {w} {\n"
"global ted params\n"
"\n"
"if {$ted($w,file) == \"\" || [file isdir $ted($w,file)]} {\n"
"append ted($w,file) \"##noname##\"\n"
"wm title $w \"$ted($w,title) [cutdir $ted($w,file)]\"\n"
"}\n"
"if [file exists $ted($w,file)] {\n"
"$w.text delete 1.0 end\n"
"set id [open $ted($w,file) r]\n"
"$w.text insert end [read -nonewline $id]\n"
"\n"
"\n"
"\n"
"close $id\n"
"if [info exists gparams(bak)] {\n"
"if {$gparams(bak)} {\n"
"TedSave $w [file rootname $ted($w,file)].bak\n"
"}\n"
"}\n"
"}\n"
"for {set i 1} {[$w.text compare $i.0 < end]} {incr i} {\n"
"TedHandleTags $w [$w.text index $i.0]\n"
"}\n"
"}\n"
"\n"
"proc TedNew {w} {\n"
"global ted\n"
"\n"
"$w.text delete 0.1 end\n"
"set ted($w,file) \"\"\n"
"TedReadFile $w\n"
"}\n"
"\n"
"proc TedSave {w filename} {\n"
"global ted\n"
"\n"
"if {$filename != \"\"} {\n"
"set color [lindex [$w.save configure -foreground] 4]\n"
"$w.save configure -foreground Red\n"
"update idletasks\n"
"debug \"TedSave: $filename :\"\n"
"set id [open $filename w]\n"
"for {set i 1} {[$w.text compare $i.0 < end]} {incr i} {\n"
"set s [$w.text get $i.0 \"$i.0 lineend\"]\n"
"puts $id $s\n"
"}\n"
"close $id\n"
"set ted($w,stsave) 0\n"
"$w.save configure -foreground $color\n"
"}\n"
"}\n"
"\n"
"proc TedSaveAs {w question} {\n"
"global ted params \n"
"\n"
"if {$question || [file tail $ted($w,file)] == \"##noname##\"} {\n"
"set x [winfo rootx $w]\n"
"set y [winfo rooty $w]\n"
"if {![FileDialog +$x+$y \"Save File\" $ted($w,ext) ted($w,file)]} {\n"
"return\n"
"}\n"
"debug \"TedSaveAs: $ted($w,file)\"\n"
"wm title $w \"$ted($w,title) [cutdir $ted($w,file)]\"\n"
"\n"
"set params(Edit_file) $ted($w,file)\n"
"}\n"
"TedSave $w $ted($w,file)\n"
"}\n"
"\n"
"proc TedAskSave {w} {\n"
"global ted \n"
"\n"
"if $ted($w,stsave) {\n"
"set x [winfo rootx $w]\n"
"set y [winfo rooty $w]\n"
"switch [Dialog .dlg +$x+$y Save \\\n"
"\"Edit file $ted($w,file) has been changed. Save?\" \\\n"
"warning 0 2 {Yes <Any-y>} {No <Any-n>} {Cancel}] {\n"
"0 {TedSaveAs $w 0}\n"
"1 {}\n"
"2 {return 0}\n"
"}\n"
"}\n"
"return 1\n"
"}\n"
"\n"
"proc TedAutoSave {w} {\n"
"global ted\n"
"\n"
"if {![winfo exists $w]} {return}\n"
"if {$ted($w,autosave)} {\n"
"debug \"AutoSave\"\n"
"if {$ted($w,stsave)} {\n"
"TedSaveAs $w 0\n"
"sync\n"
"}\n"
"after $ted($w,autos_interval) [list TedAutoSave $w]\n"
"}\n"
"}\n"
"\n"
"proc TedExit {w} {\n"
"global ted \n"
"\n"
"if {![TedAskSave $w]} {return 0}\n"
"unset ted($w,file)\n"
"unset ted($w,ext)\n"
"xfocus .\n"
"catch {destroy .hint}\n"
"destroy $w\n"
"return 1\n"
"}\n"
"\n"
"proc TedCut {w} {\n"
"global ted\n"
"\n"
"clipboard clear\n"
"set idx [$w.text index sel.first]\n"
"catch {\n"
"clipboard append [$w.text get sel.first sel.last]\n"
"set s [$w.text get sel.first sel.last]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \\\n"
"\"$w.text insert [$w.text index sel.first] \\$ted($w,undobuf)\"\n"
"$w.text delete sel.first sel.last\n"
"}\n"
"TedHandleTags $w $idx\n"
"TedHandleTags $w [$w.text index insert]\n"
"set ted($w,stsave) 1\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"proc TedCopy {w} {\n"
"global ted\n"
"\n"
"clipboard clear\n"
"catch {\n"
"clipboard append [$w.text get sel.first sel.last]\n"
"$w.text tag remove sel sel.first sel.last\n"
"}\n"
"}\n"
"\n"
"proc TedPaste {w} {\n"
"global ted ted_buf \n"
"\n"
"set idx [$w.text index insert]\n"
"catch {\n"
"$w.text insert insert [selection get -selection CLIPBOARD]\n"
"}\n"
"for {} {[$w.text compare $idx <= insert]} {set idx [$w.text index $idx+1l]} {\n"
"TedHandleTags $w $idx\n"
"}\n"
"set ted($w,pos) [$w.text index insert] \n"
"$w.text see insert\n"
"set ted($w,stsave) 1\n"
"}\n"
"\n"
"proc TedDelMark {w} {\n"
"global ted\n"
"\n"
"set l [$w.text tag ranges sel]\n"
"if {[llength $l] != 2} {return} \n"
"eval $w.text delete $l\n"
"set ted($w,stsave) 1\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text yview -pickplace insert\n"
"}\n"
"\n"
"proc TedInsSel {w} {\n"
"global ted\n"
"\n"
"set s [selection get STRING]\n"
"$w.text insert insert $s\n"
"$w.text yview -pickplace insert\n"
"}\n"
"\n"
"proc TedSearchDlg {w geom replace} {\n"
"global ted_sdlg\n"
"\n"
"toplevel $w\n"
"wm geometry $w $geom\n"
"wm transient $w . \n"
"\n"
"if $replace {\n"
"set title \"Search and Replace expression\"\n"
"} else {\n"
"set title \"Search expression\"\n"
"}\n"
"wm title $w $title\n"
"\n"
"label $w.title -text $title\n"
"pack $w.title -fill x\n"
"\n"
"frame $w.s\n"
"pack $w.s -fill x\n"
"label $w.s.l -text \"Text to find\" -underline 0 -width 15 -anchor w\n"
"entry $w.s.e -textvariable ted_sdlg(search) -width 15 \\\n"
"-relief sunken -bd 1\n"
"pack $w.s.l -side left -fill x\n"
"pack $w.s.e -side left -fill x -expand true -padx 5\n"
"\n"
"frame $w.r\n"
"if $replace {pack $w.r -fill x}\n"
"label $w.r.l -text \"New text\" -underline 0 -width 15 -anchor w\n"
"entry $w.r.e -textvariable ted_sdlg(replace) -width 15 \\\n"
"-relief sunken -bd 1\n"
"pack $w.r.l -side left -fill x\n"
"pack $w.r.e -side left -fill x -expand true -padx 5\n"
"\n"
"frame $w.b\n"
"pack $w.b -side bottom -fill x\n"
"\n"
"frame $w.ex1 -bd 1 \n"
"pack $w.ex1 -side left -fill both -expand true -pady 5\n"
"\n"
"checkbutton $w.ex1.c -text \"Case sensitive\" -underline 0 -anchor w \\\n"
"-variable ted_sdlg(case)\n"
"pack $w.ex1.c -fill x -expand true\n"
"if $replace {\n"
"checkbutton $w.ex1.a -text \"Replace all\" -underline 0 -anchor w \\\n"
"-variable ted_sdlg(all)\n"
"checkbutton $w.ex1.q -text \"Prompt on replace\" -underline 0 -anchor w \\\n"
"-variable ted_sdlg(prompt)\n"
"pack $w.ex1.a $w.ex1.q -fill x\n"
"}\n"
"\n"
"frame $w.b.fok -relief sunken -bd 1\n"
"pack $w.b.fok -side left -padx 5 -pady 5\n"
"button $w.b.ok -text OK -command {set ted_sdlg(ok) 1}\n"
"button $w.b.cancel -text Cancel -command {set ted_sdlg(ok) 0}\n"
"pack $w.b.ok -padx 5 -pady 5 -in $w.b.fok\n"
"pack $w.b.cancel -padx 5 -pady 5 -side left\n"
"\n"
"if $replace {\n"
"set el [list $w.s.e $w.r.e]\n"
"bind $w.s.e <Return> \"focus $w.r.e\"\n"
"bind $w.s.e <Any-Tab> \"focus $w.r.e\"\n"
"bind $w.r.e <Return> \"focus $w.s.e\"\n"
"bind $w.r.e <Any-Tab> \"focus $w.s.e\"\n"
"} else {\n"
"set el [list $w.s.e]\n"
"bind $w.s.e <Return> { }\n"
"bind $w.s.e <Tab> { }\n"
"}\n"
"foreach e $el {\n"
"bind $e <Control-Return> {set ted_sdlg(ok) 1}\n"
"bind $e <Escape> {set ted_sdlg(ok) 0}\n"
"bind $e <Alt-Any-c> {\n"
"set ted_sdlg(case) [expr ! $ted_sdlg(case)]\n"
"}\n"
"bind $e <Alt-Any-r> {\n"
"set ted_sdlg(all) [expr ! $ted_sdlg(all)]\n"
"}\n"
"bind $e <Alt-Any-p> {\n"
"set ted_sdlg(prompt) [expr ! $ted_sdlg(prompt)]\n"
"}\n"
"bind $e <Left> {\n"
"set i [%W index insert]\n"
"if {$i > 0} {incr i -1}\n"
"%W icursor $i\n"
"}\n"
"bind $e <Right> {\n"
"set i [%W index insert]\n"
"set l [string length [%W get]]\n"
"if {$i < $l} {incr i}\n"
"%W icursor $i\n"
"}\n"
"}\n"
"set old_focus [focus]\n"
"focus $w.s.e\n"
"grab $w\n"
"tkwait variable ted_sdlg(ok)\n"
"grab release $w\n"
"focus $old_focus\n"
"destroy $w\n"
"return $ted_sdlg(ok)\n"
"} \n"
"\n"
"proc TedSearch {w} {\n"
"global ted ted_sdlg\n"
"\n"
"set ted_sdlg(search) \"\"\n"
"set ted_sdlg(case) 0\n"
"catch {\n"
"set ted_sdlg(search) $ted($w,s_search)\n"
"set ted_sdlg(case) $ted($w,s_case)\n"
"}\n"
"set x [winfo rootx $w.text]\n"
"set y [winfo rooty $w.text]\n"
"if [TedSearchDlg .tedsd +$x+$y 0] {\n"
"set ted($w,s_case) $ted_sdlg(case)\n"
"if $ted($w,s_case) {\n"
"set ted($w,s_search) $ted_sdlg(search)\n"
"} else {\n"
"set ted($w,s_search) [string tolower $ted_sdlg(search)]\n"
"}\n"
"set ted($w,replace) 0\n"
"TedReplaceNext $w\n"
"}\n"
"}\n"
"\n"
"\n"
"proc TedReplace {w} {\n"
"global ted ted_sdlg\n"
"\n"
"set ted_sdlg(search) \"\"\n"
"set ted_sdlg(case) 0\n"
"set ted_sdlg(prompt) 1\n"
"set ted_sdlg(all) 0\n"
"catch {\n"
"set ted_sdlg(search) $ted($w,r_search)\n"
"set ted_sdlg(replace) $ted($w,r_replace)\n"
"set ted_sdlg(case) $ted($w,r_case)\n"
"set ted_sdlg(prompt) $ted($w,r_prompt)\n"
"set ted_sdlg(all) $ted($w,r_all)\n"
"}\n"
"set x [winfo rootx $w.text]\n"
"set y [winfo rooty $w.text]\n"
"if [TedSearchDlg .tedsd +$x+$y 1] {\n"
"set ted($w,r_case) $ted_sdlg(case)\n"
"if $ted($w,r_case) {\n"
"set ted($w,r_search) $ted_sdlg(search)\n"
"} else {\n"
"set ted($w,r_search) [string tolower $ted_sdlg(search)]\n"
"}\n"
"set ted($w,r_replace) $ted_sdlg(replace)\n"
"set ted($w,r_prompt) $ted_sdlg(prompt)\n"
"set ted($w,r_all) $ted_sdlg(all)\n"
"set ted($w,replace) 1\n"
"if $ted($w,r_all) {\n"
"$w.text mark set insert 1.0\n"
"while {[TedReplaceNext $w]} { }\n"
"} else {\n"
"TedReplaceNext $w\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc TedReplaceNext {w} {\n"
"global ted\n"
"\n"
"if ![info exists ted($w,replace)] return\n"
"if $ted($w,replace) {\n"
"\n"
"if {$ted($w,r_search) == \"\"} return\n"
"set search $ted($w,r_search)\n"
"if $ted($w,r_case) {\n"
"set case 1\n"
"} else {\n"
"set case 0\n"
"}\n"
"$w.text mark set pos [$w.text index insert]\n"
"scan [$w.text index insert] %d i\n"
"scan [$w.text index end] %d numLines\n"
"while {$i < $numLines} {\n"
"set s [$w.text get pos \"pos lineend\"]\n"
"if {! $case} {\n"
"set s [string tolower $s]\n"
"}\n"
"set res [string first $ted($w,r_search) $s]\n"
"if {$res >= 0} {\n"
"set l [string length $ted($w,r_search)]\n"
"$w.text tag add repl \"pos + $res c\" \\\n"
"\"pos + $res c + $l c\"\n"
"set repl 0\n"
"if $ted($w,r_prompt) { \n"
"$w.text see repl.first\n"
"$w.question configure -text \"Replace this occurance (y/n/esc)?\" \\\n"
"-fg red\n"
"bind $w.question <Any-y> \"set ted($w,dlg_ok) 0\"\n"
"bind $w.question <Any-n> \"set ted($w,dlg_ok) 1\"\n"
"bind $w.question <Escape> \"set ted($w,dlg_ok) 2\"\n"
"set old_focus [focus]\n"
"focus $w.question\n"
"update idletasks\n"
"grab $w.question\n"
"tkwait variable ted($w,dlg_ok)\n"
"grab release $w.question\n"
"focus $old_focus\n"
"$w.question configure -text \"\"\n"
"bind $w.question <Any-y> {# none}\n"
"bind $w.question <Any-n> {# none}\n"
"bind $w.question <Escape> {# none}\n"
"set repl $ted($w,dlg_ok)\n"
"}\n"
"$w.text tag remove repl \"pos + $res c\" \\\n"
"\"pos + $res c + $l c\"\n"
"if {$repl == 2} {return 0} ; # Interrupt search\n"
"$w.text mark set insert \\\n"
"\"pos + $res c + $l c\"\n"
"if {$repl == 0} {\n"
"$w.text delete \"pos + $res c\" \\\n"
"\"pos + $res c + $l c\"\n"
"$w.text insert \"pos + $res c\" $ted($w,r_replace)\n"
"$w.text see insert\n"
"set ted($w,stsave) 1\n"
"} \n"
"return 1\n"
"}\n"
"incr i\n"
"$w.text mark set pos $i.0\n"
"}\n"
"return 0\n"
"} else {\n"
"\n"
"if {$ted($w,s_search) == \"\"} return\n"
"set search $ted($w,s_search)\n"
"if $ted($w,s_case) {\n"
"set case 1\n"
"} else {\n"
"set case 0\n"
"}\n"
"$w.text mark set pos [$w.text index insert]\n"
"scan [$w.text index insert] %d i\n"
"scan [$w.text index end] %d numLines\n"
"while {$i < $numLines} {\n"
"set s [$w.text get pos \"pos lineend\"]\n"
"if {! $case} {\n"
"set s [string tolower $s]\n"
"}\n"
"set res [string first $ted($w,s_search) $s]\n"
"if {$res >= 0} {\n"
"$w.text mark set insert \\\n"
"\"pos + $res c + [string length $ted($w,s_search)] c\"\n"
"$w.text yview -pickplace insert\n"
"return 1\n"
"}\n"
"incr i\n"
"$w.text mark set pos $i.0\n"
"}\n"
"return 0\n"
"}\n"
"}\n"
"\n"
"proc TedGoto {w} {\n"
"global ted\n"
"\n"
"set r(goto) \"\"\n"
"set x [winfo rootx $w.text]\n"
"set y [winfo rooty $w.text]\n"
"if [InpDlg r .dlg \"Goto Line\" +$x+$y \"Goto Line\" {\n"
"{\"Line:\" int 4 goto}\n"
"} r] {\n"
"$w.text mark set insert $r(goto).0\n"
"$w.text yview -pickplace insert\n"
"set ted($w,pos) [$w.text index insert]\n"
"}\n"
"}\n"
"\n"
"proc TedContextHelp {w} {\n"
"global ted hlp\n"
"\n"
"set s [$w.text get \"insert wordstart\" \"insert wordend\"]\n"
"puts $s\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"}\n"
"\n"
"\n"
"\n"
"proc TedChkComment {w} {\n"
"global ted\n"
"\n"
"}\n"
"\n"
"proc TedHasTag {w idx tag} {\n"
"debug \"TedHasTag $idx $tag\"\n"
"set range [$w.text tag prevrange $tag $idx]\n"
"set end [lindex $range 1]\n"
"debug \"prevrange: $range\"\n"
"if {[llength $range] == 0 || [$w.text compare $end < $idx]} {\n"
"set range [$w.text tag nextrange $tag $idx]\n"
"if {[llength $range] == 0 || [$w.text compare $idx < [lindex $range 0]]} {\n"
"return 0\n"
"}\n"
"}\n"
"return 1\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc TedHandleTags {w idx} {\n"
"global ted\n"
"\n"
"$w.text tag remove comment \"$idx linestart\" \"$idx lineend\"\n"
"set s [$w.text get \"$idx linestart\" \"$idx lineend\"]\n"
"if {[set i [chkcode $s %]] >= 0} {\n"
"$w.text tag add comment \"$idx linestart + $i c\" \"$idx lineend\"\n"
"}\n"
"if [regexp -indices {\\\\(begin|end)(\\[[^]]*\\])?\\{([^\\}]*)\\}} \\\n"
"$s pos x opt env] {\n"
"$w.text tag add env \"$idx linestart + [lindex $pos 0] c\" \\\n"
"\"$idx linestart+[lindex $pos 1]c+1c\"\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"proc TedHandleWrap {w {del \"\"}} {\n"
"global ted\n"
"\n"
"if {!$ted($w,wrap)} return\n"
"set line [$w.text get \"insert linestart\" \"insert lineend\"]\n"
"debug $line\n"
"set width [$w.text cget -width]\n"
"set l [string length $line]\n"
"if {$l >= $width} {\n"
"set l1 [string length [$w.text get \"insert + 1 l linestart\" \\\n"
"\"insert + 1 l lineend\"]]\n"
"debug $l1\n"
"if {[set i [string last \" \" [string range $line 0 $width]]] > 0} {\n"
"$w.text mark set ml \"insert linestart\"\n"
"\n"
"\n"
"$w.text insert \"insert linestart + $i c + 1 c\" \\n\n"
"set deb [$w.text get \"insert linestart\" \"insert lineend\"]\n"
"debug \"insert in line: $deb\"\n"
"set deb [$w.text get \"ml linestart + $i c\"]\n"
"debug \"del ml linestart + $i c: [$w.text index ml] $deb\"\n"
"$w.text delete \"ml + $i c\"\n"
"TedHandleTags $w [$w.text index ml]\n"
"TedHandleTags $w [$w.text index \"ml+1l\"]\n"
"if {$del == \"\" && $l1 + $l - $i < $width && $l1 > 0} {\n"
"set cur [$w.text index insert]\n"
"$w.text insert \"ml + 1 l lineend\" \" \"\n"
"set deb [$w.text get \"ml + 1 l lineend\"]\n"
"debug \"del ml: [$w.text index ml] $deb\"\n"
"$w.text delete \"ml + 1 l lineend\"\n"
"$w.text mark set insert $cur\n"
"}\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc TedInsert {w c} {\n"
"global ted\n"
"\n"
"switch -- $c {\n"
"\\r {$w.text insert insert \\n}\n"
"\\b {$w.text delete \"insert - 1 c\"}\n"
"\\t {$w.text insert insert $c}\n"
"default {\n"
"if {$c < \" \"} {\n"
"set ted($w,pos) [$w.text index insert]\n"
"return\n"
"}\n"
"$w.text insert insert $c\n"
"}\n"
"}\n"
"set line [$w.text get \"insert linestart\" \"insert lineend\"]\n"
"\n"
"switch -- $c {\n"
"\\r {\n"
"TedHandleTags $w [$w.text index \"insert - 1 l\"]\n"
"TedHandleTags $w [$w.text index insert]\n"
"}\n"
"\\} {\n"
"\n"
"set hastag [TedHasTag $w [$w.text index insert-1c] env]\n"
"TedHandleTags $w [$w.text index insert]\n"
"if {$ted($w,autoext) && [string compare $c \\}] == 0 && \\\n"
"[$w.text compare insert == \"insert lineend\"]} {\n"
"if {[regexp {\\\\begin(\\[[^]]*\\])?\\{([^\\}]*)\\}$} $line pos opt env] \\\n"
"&& !$hastag} {\n"
"$w.text insert insert \"\\n\\n\\\\end\\{$env\\}\"\n"
"TedHandleTags $w [$w.text index insert]\n"
"$w.text mark set insert \"insert - 1 l\"\n"
"}\n"
"}\n"
"}\n"
"default {\n"
"TedHandleTags $w [$w.text index insert]\n"
"}\n"
"}\n"
"TedHandleWrap $w\n"
"if {$c != \"\\000\"} {\n"
"set ted($w,stsave) 1\n"
"}\n"
"TedHandleTags $w [$w.text index insert]\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text yview -pickplace insert\n"
"}\n"
"\n"
"\n"
"\n"
"proc TedBackSpace {w} {\n"
"global ted\n"
"\n"
"if {[$w.text tag nextrange sel 1.0 end] != \"\"} {\n"
"set s [$w.text get sel.first sel.last]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \\\n"
"\"$w.text insert [$w.text index sel.first] \\$ted($w,undobuf)\"\n"
"set idx [$w.text index sel.first]\n"
"$w.text delete sel.first sel.last\n"
"TedHandleWrap $w del\n"
"TedHandleTags $w $idx\n"
"} else {\n"
"set s [$w.text get insert-1c]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \"$w.text insert [$w.text index insert] \\$ted($w,undobuf)\"\n"
"$w.text delete insert-1c\n"
"TedHandleWrap $w del\n"
"TedHandleTags $w [$w.text index insert]\n"
"}\n"
"set ted($w,stsave) 1\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"proc TedDelete {w} {\n"
"global ted\n"
"\n"
"if {[$w.text tag nextrange sel 1.0 end] != \"\"} {\n"
"set s [$w.text get sel.first sel.last]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \\\n"
"\"$w.text insert [$w.text index sel.first] \\$ted($w,undobuf)\"\n"
"set idx [$w.text index sel.first]\n"
"$w.text delete sel.first sel.last\n"
"TedHandleWrap $w del\n"
"TedHandleTags $w $idx\n"
"} else {\n"
"set s [$w.text get insert]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \"$w.text insert [$w.text index insert] \\$ted($w,undobuf)\"\n"
"$w.text delete insert\n"
"TedHandleWrap $w del\n"
"TedHandleTags $w [$w.text index insert]\n"
"}\n"
"set ted($w,stsave) 1\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"proc TedDelLineEnd {w} {\n"
"global ted\n"
"\n"
"set s [$w.text get insert {insert lineend}]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \"$w.text insert [$w.text index insert] \\$ted($w,undobuf)\"\n"
"$w.text delete insert {insert lineend}\n"
"TedHandleTags $w [$w.text index insert]\n"
"set ted($w,stsave) 1\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"proc TedDelLine {w} {\n"
"global ted\n"
"\n"
"set s [$w.text get {insert linestart} {insert linestart+1l}]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \\\n"
"\"$w.text insert [$w.text index \"insert linestart\"] \\$ted($w,undobuf)\"\n"
"$w.text delete {insert linestart} {insert linestart+1l}\n"
"set ted($w,stsave) 1\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"proc TedDelWord {w} {\n"
"global ted\n"
"\n"
"set pos [tkTextNextPos $w.text insert TedNextWordOrChar]\n"
"puts $pos\n"
"set s [$w.text get insert $pos]\n"
"set ted($w,undobuf) $s\n"
"set ted($w,undo) \"$w.text insert [$w.text index insert] \\$ted($w,undobuf)\"\n"
"$w.text delete insert $pos\n"
"TedHandleTags $w [$w.text index insert]\n"
"set ted($w,stsave) 1\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"proc TedUndo {w} {\n"
"global ted\n"
"\n"
"set idx [lindex $ted($w,undo) 2]\n"
"eval $ted($w,undo)\n"
"set ted($w,undo) {}\n"
"TedHandleTags $w $idx\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"\n"
"\n"
"proc TedUpDownLine {w n} {\n"
"global ted\n"
"\n"
"set i [$w.text index insert]\n"
"scan $i \"%d.%d\" line char\n"
"if {[string compare $ted($w,prevPos) $i] != 0} {\n"
"set ted($w,charPos) $char\n"
"}\n"
"set new [$w.text index [expr $line + $n].$ted($w,charPos)]\n"
"if {[$w.text compare $new == end] || \n"
"[$w.text compare $new == \"insert linestart\"]} {\n"
"set new $i\n"
"}\n"
"set ted($w,prevPos) $new\n"
"return $new\n"
"}\n"
"\n"
"\n"
"proc TedSetCursor {w pos} {\n"
"global ted\n"
"\n"
"if [$w.text compare $pos == end] {\n"
"set pos {end - 1 chars}\n"
"}\n"
"$w.text mark set insert $pos\n"
"$w.text tag remove sel 1.0 end\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"}\n"
"\n"
"\n"
"\n"
"proc TedButton1 {w x y} {\n"
"global ted\n"
"\n"
"set ted($w,selectMode) char\n"
"tkTextButton1 $w.text $x $y\n"
"set ted($w,pos) [$w.text index insert]\n"
"}\n"
"\n"
"\n"
"\n"
"proc TedKeySelect {w new} {\n"
"global ted\n"
"\n"
"if {[$w.text tag nextrange sel 1.0 end] == \"\"} {\n"
"if [$w.text compare $new < insert] {\n"
"$w.text tag add sel $new insert\n"
"} else {\n"
"$w.text tag add sel insert $new\n"
"}\n"
"$w.text mark set anchor insert\n"
"} else {\n"
"if [$w.text compare $new < anchor] {\n"
"set first $new\n"
"set last anchor\n"
"} else {\n"
"set first anchor\n"
"set last $new\n"
"}\n"
"$w.text tag remove sel 1.0 $first\n"
"$w.text tag add sel $first $last\n"
"$w.text tag remove sel $last end\n"
"}\n"
"$w.text mark set insert $new\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"update idletasks\n"
"}\n"
"\n"
"proc TedMouseSelect {w x y} {\n"
"global ted\n"
"\n"
"set ted($w,x) %x\n"
"set ted($w,y) %y\n"
"set ted($w,selectMode) char\n"
"TedSelectTo $w $x $y\n"
"}\n"
"\n"
"proc TedSelectTo {w x y} {\n"
"global ted tkPriv\n"
"\n"
"set cur [tkTextClosestGap $w.text $x $y]\n"
"if [catch {$w.text index anchor}] {\n"
"$w.text mark set anchor $cur\n"
"}\n"
"set anchor [$w.text index anchor]\n"
"if {[$w.text compare $cur != $anchor] || (abs($tkPriv(pressX) - $x) >= 3)} {\n"
"set tkPriv(mouseMoved) 1\n"
"}\n"
"switch $ted($w,selectMode) {\n"
"char {\n"
"if [$w.text compare $cur < anchor] {\n"
"set first $cur\n"
"set last anchor\n"
"} else {\n"
"set first anchor\n"
"set last $cur\n"
"}\n"
"}\n"
"word {\n"
"if [$w.text compare $cur < anchor] {\n"
"set first [tkTextPrevPos $w.text \"$cur + 1c\" tcl_wordBreakBefore]\n"
"set last [tkTextNextPos $w.text \"anchor\" tcl_wordBreakAfter]\n"
"} else {\n"
"set first [tkTextPrevPos $w.text anchor tcl_wordBreakBefore]\n"
"set last [tkTextNextPos $w.text \"$cur - 1c\" tcl_wordBreakAfter]\n"
"}\n"
"}\n"
"line {\n"
"if [$w.text compare $cur < anchor] {\n"
"set first [$w.text index \"$cur linestart\"]\n"
"set last [$w.text index \"anchor - 1c lineend + 1c\"]\n"
"} else {\n"
"set first [$w.text index \"anchor linestart\"]\n"
"set last [$w.text index \"$cur lineend + 1c\"]\n"
"}\n"
"}\n"
"}\n"
"if {$tkPriv(mouseMoved) || ($ted($w,selectMode) != \"char\")} {\n"
"$w.text mark set insert $last\n"
"$w.text tag remove sel 0.0 $first\n"
"$w.text tag add sel $first $last\n"
"$w.text tag remove sel $last end\n"
"update idletasks\n"
"}\n"
"set ted($w,pos) [$w.text index insert]\n"
"}\n"
"\n"
"proc TextBind {w} {\n"
"bind $w.text <1> \"TedButton1 $w %x %y\"\n"
"bind $w.text <B1-Motion> \"TedMouseSelect $w %x %y\"\n"
"bind $w.text <Up> \"TedSetCursor $w \\[TedUpDownLine $w -1\\]\"\n"
"bind $w.text <Down> \"TedSetCursor $w \\[TedUpDownLine $w 1\\]\"\n"
"bind $w.text <Left> \"TedSetCursor $w insert-1c\"\n"
"bind $w.text <Right> \"TedSetCursor $w insert+1c\"\n"
"bind $w.text <Prior> \"TedSetCursor $w \\[tkTextScrollPages $w.text -1\\]\"\n"
"bind $w.text <Next> \"TedSetCursor $w \\[tkTextScrollPages $w.text 1\\]\"\n"
"bind $w.text <Home> \"TedSetCursor $w {insert linestart}\"\n"
"bind $w.text <End> \"TedSetCursor $w {insert lineend}\"\n"
"bind $w.text <Control-Home> \"TedSetCursor $w 1.0\"\n"
"bind $w.text <Control-End> \"TedSetCursor $w end-1c\"\n"
"\n"
"bind $w.text <Shift-Left> \"TedKeySelect $w \\[$w.text index insert-1c\\]\"\n"
"bind $w.text <Shift-Right> \"TedKeySelect $w \\[$w.text index insert+1c\\]\"\n"
"bind $w.text <Shift-Up> \"TedKeySelect $w \\[TedUpDownLine $w -1]\"\n"
"bind $w.text <Shift-Down> \"TedKeySelect $w \\[TedUpDownLine $w 1]\"\n"
"bind $w.text <Shift-Prior> \"TedKeySelect $w \\[tkTextScrollPages $w.text -1]\"\n"
"bind $w.text <Shift-Next> \"TedKeySelect $w \\[tkTextScrollPages $w.text 1]\"\n"
"bind $w.text <Shift-Home> \"TedKeySelect $w {insert linestart}\"\n"
"bind $w.text <Shift-End> \"TedKeySelect $w {insert lineend}\"\n"
"bind $w.text <Control-Left> \\\n"
"\"TedSetCursor $w \\[tkTextPrevPos $w.text insert tcl_startOfPreviousWord\\]\"\n"
"bind $w.text <Control-Right> \\\n"
"\"TedSetCursor $w \\[tkTextNextPos $w.text insert TedNextWordOrChar\\]\"\n"
"bind $w.text <Control-Up> \\\n"
"\"TedSetCursor $w \\[tkTextPrevPara $w.text insert\\]\"\n"
"bind $w.text <Control-Down> \\\n"
"\"TedSetCursor $w \\[tkTextNextPara $w.text insert\\]\"\n"
"bind $w.text <Delete> \"TedDelete $w\"\n"
"bind $w.text <BackSpace> \"TedBackSpace $w\"\n"
"bind $w.text <Control-k> \"TedDelLineEnd $w\"\n"
"bind $w.text <Control-t> \"TedDelWord $w\"\n"
"bind $w.text <Control-y> \"TedDelLine $w\"\n"
"bind $w.text <Control-u> \"TedUndo $w\"\n"
"bind $w.text <<Cut>> \"TedCut $w\"\n"
"bind $w.text <<Copy>> \"TedCopy $w\"\n"
"bind $w.text <<Paste>> \"TedPaste $w\"\n"
"bind $w.text <Key-F2> \"TedSaveAs $w 0\"\n"
"bind $w.text <Control-F2> \"TedSaveAs $w 1\"\n"
"bind $w.text <Alt-F3> \"TedExit $w\"\n"
"bind $w.text <Meta-F3> \"TedExit $w\"\n"
"bind $w.text <Any-Key> \"TedInsert $w %A\"\n"
"bind $w.text <Control-q><Any-a> \"TedReplace $w\"\n"
"bind $w.text <Control-q><Any-f> \"TedSearch $w\"\n"
"bind $w.text <Control-q><Any-l> \"TedGoto $w\"\n"
"bind $w.text <Control-l> \"TedReplaceNext $w\"\n"
"bind $w.text <Control-e> \"set ted($w,autoext) \\[expr !\\$ted($w,autoext)\\]\"\n"
"bind $w.text <Control-w> \"set ted($w,wrap) \\[expr !\\$ted($w,wrap)\\]\"\n"
"bind $w.text <Alt-KeyPress> {# nothing}\n"
"bind $w.text <Meta-KeyPress> {# nothing}\n"
"bind $w.text <Control-KeyPress> {# nothing}\n"
"bind $w.text <Escape> {# nothing}\n"
"}\n"
"\n"
"\n"
"\n"
"proc tedit {w geometry title {filename \"\"} {line 1}} {\n"
"global params ted ted_buf gparams\n"
"\n"
"debug \"line: $line\"\n"
"toplevel $w\n"
"wm group . $w\n"
"set ted($w,file) $filename\n"
"set ted($w,ext) .tex\n"
"set ted($w,stsave) 0\n"
"set ted($w,wrap) 0\n"
"set ted($w,font) fixed\n"
"set ted($w,autosave) 0\n"
"set ted($w,autoext) 0\n"
"set ted($w,autos_interval) 60000\n"
"if [info exists gparams(save)] {\n"
"set ted($w,autosave) $gparams(save)\n"
"}\n"
"if [info exists gparams(interval)] {\n"
"set ted($w,autos_interval) [expr $gparams(interval)*1000]\n"
"}\n"
"if [info exists gparams(wrap)] {\n"
"set ted($w,wrap) $gparams(wrap)\n"
"}\n"
"if [info exists gparams(font)] {\n"
"set ted($w,font) $gparams(font)\n"
"}\n"
"if [info exists gparams(autoext)] {\n"
"set ted($w,autoext) $gparams(autoext)\n"
"}\n"
"set ted($w,prevPos) {}\n"
"set ted($w,block) 0\n"
"set ted($w,title) $title\n"
"wm geometry $w $geometry\n"
"wm title $w \"$title [cutdir $filename]\"\n"
"\n"
"\n"
"menu $w.menubar\n"
"$w config -menu $w.menubar\n"
"foreach m {File Edit Option} {\n"
"set $m [menu $w.menubar.m$m -tearoff 0]\n"
"$w.menubar add cascade -label $m -underline 0 -menu $w.menubar.m$m\n"
"}\n"
"menu $w.menubar.help -tearoff 0\n"
"$w.menubar add cascade -label Help -underline 0 -menu $w.menubar.help\n"
"\n"
"$File add command -label \"New\" -underline 0 -command \"TedNew $w\"\n"
"$File add command -label \"Save\" -accelerator F2 \\\n"
"-command \"TedSaveAs $w 0\"\n"
"$File add command -label \"Save as...\" -accelerator Ctrl-F2 \\\n"
"-command \"TedSaveAs $w 1\"\n"
"$File add separator\n"
"$File add command -label \"Close\" -underline 1 -accelerator Alt-F3 \\\n"
"-command \"TedExit $w\"\n"
"\n"
"$Edit add command -label \"Undo\" -accelerator ^u \\\n"
"-command \"TedPaste $w\"\n"
"$Edit add command -label \"Cut\" -accelerator ^x \\\n"
"-command \"TedCut $w\"\n"
"$Edit add command -label \"Copy\" -accelerator ^c \\\n"
"-command \"TedCopy $w\"\n"
"$Edit add command -label \"Paste\" -accelerator ^v \\\n"
"-command \"TedPaste $w\"\n"
"$Edit add separator\n"
"$Edit add command -label \"Go to...\" -accelerator \"^Q l\" \\\n"
"-command \"TedGoto $w\"\n"
"$Edit add command -label \"Search...\" -accelerator \"^Q f\" \\\n"
"-command \"TedSearch $w\"\n"
"$Edit add command -label \"Replace...\" -accelerator \"^Q a\" \\\n"
"-command \"TedReplace $w\"\n"
"$Edit add command -label \"Next occurance\" -accelerator \"^L\" \\\n"
"-command \"TedReplaceNext $w\"\n"
"\n"
"$Option add checkbutton -label \"Wrap\" -accelerator \"^W\" \\\n"
"-variable ted($w,wrap)\n"
"$Option add checkbutton -label \"Autosave\" \\\n"
"-variable ted($w,autosave) -command \"TedAutoSave $w\"\n"
"$Option add separator\n"
"$Option add command -label \"Editor settings...\" \\\n"
"-command EditOpt\n"
"\n"
"frame $w.buttons\n"
"button $w.bnew -bitmap @$params(icon_dir)/new.ico -command \"TedNew $w\"\n"
"button $w.bopen -bitmap @$params(icon_dir)/edit1.ico -command \"Edit\"\n"
"button $w.bsave -bitmap @$params(icon_dir)/save2.ico \\\n"
"-command \"TedSaveAs $w 0\"\n"
"button $w.bfind -bitmap @$params(icon_dir)/find.ico -command \"TedSearch $w\"\n"
"button $w.bclose -bitmap @$params(icon_dir)/door1.ico -command \"TedExit $w\"\n"
"pack $w.bnew $w.bopen $w.bsave $w.bfind -in $w.buttons -side left\n"
"pack $w.bclose -in $w.buttons -side right\n"
"bind $w.bnew <Enter> {ButtonHint %W \"New Document\"}\n"
"bind $w.bnew <Leave> {DelButtonHint}\n"
"bind $w.bopen <Enter> {ButtonHint %W \"New Editor\"}\n"
"bind $w.bopen <Leave> {DelButtonHint}\n"
"bind $w.bsave <Enter> {ButtonHint %W \"Save\"}\n"
"bind $w.bsave <Leave> {DelButtonHint}\n"
"bind $w.bfind <Enter> {ButtonHint %W \"Search\"}\n"
"bind $w.bfind <Leave> {DelButtonHint}\n"
"bind $w.bclose <Enter> {ButtonHint %W \"Close\"}\n"
"bind $w.bclose <Leave> {DelButtonHint}\n"
"\n"
"text $w.text -yscrollcommand \"$w.textsb set\" -wrap char \\\n"
"-font [list $gparams(font) $gparams(fontsize) $gparams(fontstyle)]\n"
"if [info exists gparams(bgnormal)] {\n"
"$w.text config -bg $gparams(bgnormal)\n"
"}\n"
"if [info exists gparams(fgnormal)] {\n"
"$w.text config -insertbackground $gparams(fgnormal)\n"
"$w.text config -fg $gparams(fgnormal)\n"
"}\n"
"if [info exists gparams(fgcomment)] {\n"
"$w.text tag configure comment -foreground $gparams(fgcomment)\n"
"}\n"
"if {[info exists gparams(fgsearch)] && [info exists gparams(bgsearch)]} {\n"
"$w.text tag configure repl -background $gparams(bgsearch) \\\n"
"-foreground $gparams(fgsearch)\n"
"} else {\n"
"$w.text tag configure repl -background [$w.text cget -foreground] \\\n"
"-foreground [$w.text cget -background]\n"
"}\n"
"if {[info exists gparams(fgenv)]} {\n"
"$w.text tag configure env -foreground $gparams(fgenv)\n"
"}\n"
"scrollbar $w.textsb -command \"$w.text yview\"\n"
"label $w.pos -textvariable ted($w,pos) -relief sunken -bd 1 -width 7 \\\n"
"-anchor e -font fixed\n"
"checkbutton $w.save -text \"Changed (F2)\" -variable ted($w,stsave) \\\n"
"-relief sunken -bd 1 -font fixed\n"
"checkbutton $w.wrap -text \"Wrap (^w)\" -variable ted($w,wrap) \\\n"
"-relief sunken -bd 1 -font fixed\n"
"checkbutton $w.autoext -text \"Auto \\\\end (^e)\" -variable ted($w,autoext) \\\n"
"-relief sunken -bd 1 -font fixed\n"
"label $w.question -text \" \" -relief sunken -bd 1 -takefocus 1\n"
"grid configure $w.buttons -row 0 -column 0 -columnspan 6 -sticky ew\n"
"grid configure $w.text -row 1 -column 0 -columnspan 5 -sticky nsew\n"
"grid configure $w.textsb -row 1 -column 5 -sticky ns\n"
"grid configure $w.pos -row 2 -column 0\n"
"grid configure $w.save -row 2 -column 1\n"
"grid configure $w.wrap -row 2 -column 2\n"
"grid configure $w.autoext -row 2 -column 3\n"
"grid configure $w.question -row 2 -column 4 -columnspan 2 -sticky ew\n"
"grid rowconfigure $w 0 -weight 1\n"
"foreach i {4} {\n"
"grid columnconfigure $w $i -weight 1\n"
"}\n"
"\n"
"\n"
"\n"
"TextBind $w\n"
"bindtags $w.text [list $w.text . all]\n"
"\n"
"update idletasks\n"
"foreach l $ted(global_params) {\n"
"set flag [lindex $l 0]\n"
"set value [lindex $l 1]\n"
"set ted($w,$flag) $value\n"
"}\n"
"TedReadFile $w\n"
"debug \"line: $line\"\n"
"$w.text mark set insert $line.0\n"
"set ted($w,pos) [$w.text index insert]\n"
"$w.text see insert\n"
"TedAutoSave $w\n"
"xfocus $w.text\n"
"}\n"
"";
#line 38 "ts.et"
Et_EvalInclude("ts_edit.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"\n"
"\n"
"proc AboutMessage {} {\n"
"catch {destroy .about}\n"
"toplevel .about\n"
"wm title .about \"About TkTerm\"\n"
"wm iconname .about \"AboutTkTerm\"\n"
"label .about.title -text {TkTerm}\\\n"
"-font -adobe-times-bold-i-normal--24-240-75-75-p-128-iso8859-1\n"
"pack .about.title -side top -pady 15\n"
"message .about.subtitle -width 10c -justify center \\\n"
"-font -adobe-times-bold-i-normal-*-14-140-75-75-p-77-iso8859-1 \\\n"
"-text \"A VT100 terminal emulator based\\non the Tcl/Tk Text widget\"\n"
"pack .about.subtitle -side top -pady 10 -padx 15\n"
"message .about.msg -width 10c -text \"\n"
"By D. Richard Hipp\n"
"Hipp, Wyrick & Company, Inc.\n"
"6200 Maple Cove Lane\n"
"Charlotte, NC 28269\n"
"704-948-4565\n"
"drh@vnet.net\" \\\n"
"-font -adobe-times-medium-r-normal-*-12-120-75-75-p-64-iso8859-1\n"
"pack .about.msg -padx 15 -anchor w\n"
"button .about.dismiss -text {Dismiss} -command {destroy .about}\n"
"pack .about.dismiss -pady 8\n"
"wm withdraw .about\n"
"update idletasks\n"
"set x [expr [winfo rootx .] + ([winfo width .]-[winfo reqwidth .about])/2]\n"
"set y [expr [winfo rooty .] + ([winfo height .]-[winfo reqheight .about])/2]\n"
"wm geometry .about +$x+$y\n"
"wm deiconify .about\n"
"}\n"
"\n"
"\n"
"\n"
"proc EditFunctionKeys {} {\n"
"catch {destroy .keyedit}\n"
"toplevel .keyedit\n"
"wm title .keyedit \"TkTerm Function Key Bindings\"\n"
"wm iconname .keyedit \"TkTerm Bindings\"\n"
"set f [frame .keyedit.f1 -bd 1 -relief raised]\n"
"pack $f -side bottom -fill x -expand 1\n"
"button $f.b1 -text OK -highlightthickness 0 -command {\n"
"foreach i $MacroNames {\n"
"set Macros($i) [.keyedit.f2.f.e$i.e get]\n"
"}\n"
"SaveMacros\n"
"destroy .keyedit\n"
"}\n"
"button $f.b2 -text Cancel -highlightthickness 0 -command {destroy .keyedit}\n"
"pack $f.b1 $f.b2 -side right -pady 5 -padx 10 -expand 1\n"
"set f [frame .keyedit.f2 -bd 1 -relief raised]\n"
"pack $f -side bottom -fill both -expand 1\n"
"global Macros MacroNames\n"
"CheckMacros\n"
"set f [frame $f.f]\n"
"pack $f -padx 10 -pady 10\n"
"foreach i $MacroNames {\n"
"set e [frame $f.e$i]\n"
"pack $e -side top -fill x -anchor c\n"
"label $e.l -text $i -width 3 -anchor w\n"
"pack $e.l -side left\n"
"entry $e.e -width 30 -bd 2 -relief sunken\n"
"$e.e insert end $Macros($i)\n"
"pack $e.e -side left\n"
"bind $e.e <Return> {tkEntryInsert %W %A}\n"
"bind $e.e <Tab> {tkEntryInsert %W %A; break}\n"
"}\n"
"wm withdraw .keyedit\n"
"update idletasks\n"
"set x [expr [winfo rootx .] + ([winfo width .]-[winfo reqwidth .keyedit])/2]\n"
"set y [expr [winfo rooty .] + ([winfo height .]-[winfo reqheight .keyedit])/2]\n"
"wm geometry .keyedit +$x+$y\n"
"wm deiconify .keyedit\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc LoadMacros {} {\n"
"global Macros MacroNames MacroFile MacroModTime\n"
"if [info exists Macros] {unset Macros}\n"
"if {[file readable $MacroFile]} {\n"
"foreach i [exec cat $MacroFile] {\n"
"set tag [lindex $i 0]\n"
"set value [lindex $i 1]\n"
"if {[regexp {F1?[0-9]} $tag]} {\n"
"set Macros($tag) $value\n"
"}\n"
"}\n"
"set MacroModTime [file mtime $MacroFile]\n"
"}\n"
"foreach i $MacroNames {\n"
"if {![info exists Macros($i)]} {set Macros($i) $i}\n"
"}\n"
"}\n"
"proc SaveMacros {} {\n"
"global Macros MacroNames MacroFile\n"
"set out {}\n"
"foreach i $MacroNames {\n"
"lappend out [list $i $Macros($i)]\n"
"}\n"
"catch {exec echo $out >$MacroFile 2>/dev/null}\n"
"}\n"
"proc CheckMacros {} {\n"
"global MacroModTime MacroFile\n"
"if {[file readable $MacroFile] && [file mtime $MacroFile]>$MacroModTime} {\n"
"LoadMacros\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc ChangeWidth {newWidth} {\n"
".term config -width $newWidth\n"
"WindowSizeChangeNotify\n"
"}\n"
"\n"
"proc ChangeHeight {newHeight} {\n"
".term config -height $newHeight\n"
"WindowSizeChangeNotify\n"
"}\n"
"\n"
"proc ChangeFont {newFont} {\n"
"global F FB\n"
".term config -font $F($newFont)\n"
"if {[info exists FB($newFont)]} {\n"
".term tag config bd -font $FB($newFont) -foreground Black\n"
"} else {\n"
".term tag config bd -font $F($newFont) -foreground Blue\n"
"}\n"
"}\n"
"\n"
"proc RetrieveSelection {offset max} {\n"
"global Selection\n"
"return [string range $Selection $offset [expr {$offset+$max}]]\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc LoseSelection {} {\n"
"global Selection\n"
"set Selection {}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc EditCopy {} {\n"
"global Selection\n"
"catch {\n"
"set Selection [.term get sel.first sel.last]\n"
"selection own . LoseSelection\n"
"}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"proc Dump {} {\n"
"global Btm CurX CurY ScrollTop ScrollBtm\n"
"\n"
"return \"iBtm=$Btm iCur=$CurY.$CurX iScroll=$ScrollTop-$ScrollBtm end=[.term index end] insert=[.term index insert]\"\n"
"}\n"
"\n"
"\n"
"proc CreateTermWin {} {\n"
"global params gparams\n"
"global cmd_dir cmd_name\n"
"global Width Height Font\n"
"global F\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"set Width 80\n"
"set Height 25\n"
"set Font Normal\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"set F(Tiny) -schumacher-clean-medium-r-normal-*-6-60-75-75-c-40-iso8859-1\n"
"set F(Small) -schumacher-clean-medium-r-normal-*-8-80-75-75-c-50-iso8859-1\n"
"set F(Short) -schumacher-clean-medium-r-normal-*-10-100-75-75-c-60-iso8859-1\n"
"set FB(Short) -schumacher-clean-bold-r-normal-*-10-100-75-75-c-60-iso8859-1\n"
"set F(Normal) -misc-fixed-medium-r-semicondensed-*-13-120-75-75-c-60-iso8859-1\n"
"set FB(Normal) -misc-fixed-bold-r-semicondensed-*-13-120-75-75-c-60-iso8859-1\n"
"set F(Large) -misc-fixed-medium-r-normal-*-14-130-75-75-c-70-iso8859-1\n"
"set FB(Large) -misc-fixed-bold-r-normal-*-14-130-75-75-c-70-iso8859-1\n"
"set F(Very\\ Large) -misc-fixed-medium-r-normal-*-15-140-75-75-c-90-iso8859-1\n"
"set FB(Very\\ Large) -misc-fixed-bold-r-normal-*-15-140-75-75-c-90-iso8859-1\n"
"set F(Huge) -misc-fixed-medium-r-normal-*-20-200-75-75-c-100-iso8859-1\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"catch {\n"
".term config -font \\\n"
"[list $gparams(font) $gparams(fontsize) $gparams(fontstyle)]\n"
"}\n"
".term tag config ul -underline 1\n"
".term tag config iv -foreground [.term cget -background]\n"
".term tag config iv -background [.term cget -foreground]\n"
"if {[info exists FB($Font)]} {\n"
".term tag config bd -font $FB($Font)\n"
"} else {\n"
".term tag config bd -font $F($Font)\n"
"}\n"
"\n"
"\n"
"bindtags .term {.term}\n"
"bind .term <Alt-F5> {set params(log_end) end}\n"
"\n"
"\n"
"bind .term <Prior> {.term yview scroll -1 units}\n"
"bind .term <Next> {.term yview scroll +1 units}\n"
"bind .term <Home> {.term yview moveto 0}\n"
"bind .term <End> {.term yview moveto 1}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"}\n"
"\n"
"\n"
"proc TermBind {} {\n"
"bind .term <KeyPress> {SendToTTY %N}\n"
"bind .term <Control-KeyPress> {SendToTTY [expr %N&0x1f]}\n"
"bind .term <Control-space> {SendZeroToTTY}\n"
"bind .term <Return> {SendToTTY 10}\n"
"bind .term <Escape> {SendToTTY 033}\n"
"bind .term <BackSpace> {SendToTTY 8}\n"
"bind .term <Delete> {SendToTTY 0177}\n"
"bind .term <Up> {SendToTTY 033;SendToTTY 91;SendToTTY 65}\n"
"bind .term <Down> {SendToTTY 033;SendToTTY 91;SendToTTY 66}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"}\n"
"\n"
"proc TermUnbind {} {\n"
"bind .term <KeyPress> {}\n"
"bind .term <Control-KeyPress> {}\n"
"bind .term <Control-space> {}\n"
"bind .term <Return> {}\n"
"bind .term <Escape> {}\n"
"bind .term <BackSpace> {}\n"
"bind .term <Delete> {}\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"";
#line 39 "ts.et"
Et_EvalInclude("ts_term.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc debug {s} {\n"
"global params\n"
"\n"
"if $params(debug) { puts $s }\n"
"}\n"
"\n"
"proc shortdir {path} {\n"
"global env\n"
"\n"
"if {[string first $env(HOME) $path] == 0} {\n"
"return \"~[string range $path [string length $env(HOME)] end]\"\n"
"}\n"
"}\n"
"\n"
"proc FirstCall {} {\n"
"global env TS_BASE\n"
"\n"
"if {[file exists $env(HOME)/.ts]} {\n"
"if {![file isdir $env(HOME)/.ts]} {\n"
"puts \"Error: found file '~/.ts'. Please rename it and restart ts.\"\n"
"exit 1\n"
"}\n"
"} else {\n"
"exec mkdir $env(HOME)/.ts\n"
"if {[file exists $env(HOME)/.texshell]} {\n"
"puts \"Copying ~/.texshell to ~/.ts/ts.cfg.\"\n"
"puts \"You can delete ~/.texshell now.\"\n"
"exec cp $env(HOME)/.texshell $env(HOME)/.ts/ts.cfg\n"
"}\n"
"}\n"
"foreach f {\"includes.cfg\" \"apps.cfg\"} {\n"
"if {![file exists $env(HOME)/.ts/$f]} {\n"
"file copy \"$TS_BASE/$f\" \"$env(HOME)/.ts\"\n"
"}\n"
"}\n"
"scan_templates\n"
"}\n"
"\n"
"proc filetest {f1 {f2 \"\"}} {\n"
"if ![file exist $f1] {\n"
"return 1\n"
"}\n"
"if {$f2 == \"\"} {return 0}\n"
"if ![file exist $f2] {\n"
"return 2\n"
"}\n"
"if {[file mtime $f1] > [file mtime $f2]} {\n"
"return 3\n"
"}\n"
"return 0\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc scanopt {s {geom \"\"}} {\n"
"global params prd\n"
"\n"
"debug \"scanopt: $s\"\n"
"set t \"\"\n"
"if [regexp -- {%p} $s] {\n"
"if {$params(Primary_file) != \"\"} { \n"
"set t $params(Primary_file)\n"
"} elseif {$params(Edit_file) != \"\"} {\n"
"set t [cutdir $params(Edit_file)]\n"
"} else {\n"
"Warning $params(dlg_geom) \\\n"
"\"No Primary file is specified.\\nNo Edit file was found.\"\n"
"return \"\"\n"
"}\n"
"regsub -all -- {%p} $s $t s\n"
"debug $s\n"
"}\n"
"if [regexp -- {%r} $s] {\n"
"if {$params(Primary_file) != \"\"} { \n"
"set t [file rootname $params(Primary_file)]\n"
"} elseif {$params(Edit_file) != \"\"} {\n"
"set t [file rootname [cutdir $params(Edit_file)]]\n"
"} else {\n"
"Warning $params(dlg_geom) \\\n"
"\"No Primary file is specified.\\nNo Edit file was found.\"\n"
"return \"\"\n"
"}\n"
"regsub -all -- {%r} $s $t s\n"
"debug $s\n"
"}\n"
"regsub -all -- {%e} $s $params(Edit_file) s\n"
"debug $s\n"
"if [regexp -- {%o([^ ]*)} $s sub ext] {\n"
"set f \"\"\n"
"if {![FileDialog $params(dlg_geom) \"Select File\" $ext f]} {\n"
"return \"\"\n"
"}\n"
"if {[file tail $f] != \"\"} {\n"
"set t [cutdir $f]\n"
"}\n"
"regsub -all -- {%o[^ ]*} $s $t s\n"
"debug $s\n"
"}\n"
"if [regexp -- {%g([^ ]*)} $s sub sgeo] {\n"
"if {$sgeo != \"\"} {\n"
"set geom $sgeo\n"
"}\n"
"if {$geom == \"\"} {\n"
"set geom $params(default_geom)\n"
"}\n"
"regsub -all -- {%g[^ ]*} $s $geom s\n"
"debug $s\n"
"}\n"
"regsub -all -- {![^!]*!} $s {} s\n"
"debug \"scanopt ready: $s\"\n"
"return $s\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc setprintopt {str opt {value \"\"}} {\n"
"upvar $str s\n"
"\n"
"debug \"Setprintopt ($opt $value): $s\"\n"
"switch $opt {\n"
"landscape {\n"
"regsub {!l([^!%]*)!} $s \"\\\\1\" s\n"
"}\n"
"first {\n"
"regsub {!0([^!%]*)%([^!]*)!} $s \"\\\\1$value\\\\2\" s\n"
"}\n"
"last {\n"
"regsub {!9([^!%]*)%([^!]*)!} $s \"\\\\1$value\\\\2\" s\n"
"}\n"
"copies {\n"
"regsub {!c([^!%]*)%([^!]*)!} $s \"\\\\1$value\\\\2\" s\n"
"}\n"
"odd {\n"
"regsub {!o([^!%]*)!} $s \"\\\\1\" s\n"
"}\n"
"even {\n"
"regsub {!e([^!%]*)!} $s \"\\\\1\" s\n"
"}\n"
"xopt {\n"
"regsub {!x([^!%]*)%([^!]*)!} $s \"\\\\1$value\\\\2\" s\n"
"}\n"
"default {return 0}\n"
"}\n"
"debug \"Setprintopt ready: $s\"\n"
"return 1\n"
"}\n"
"\n"
"proc EvalCmd {cmdline {geom \"\"}} {\n"
"global params sigchld\n"
"\n"
"debug \"EvalCmd: $cmdline\"\n"
"set cmd [lindex $cmdline 1]\n"
"set opt [lindex $cmdline 2]\n"
"if {[set opt [scanopt $opt $geom]] == \"\"} {\n"
"return\n"
"}\n"
"debug \"Work directory: $params(Primary_dir)\"\n"
"debug \"Cmd: $cmd Opt: $opt\"\n"
"switch $cmd {\n"
"exwin {\n"
"OutMsg \"$opt\\n\"\n"
"eval ExecCmd $opt\n"
"set oldfocus [focus]\n"
"debug \"exwin: oldfocus = $oldfocus\"\n"
"xfocus .term\n"
"tkwait variable sigchld\n"
"debug \"exwin: process died\"\n"
"xfocus $oldfocus\n"
"update idletasks\n"
"}\n"
"exbg {\n"
"eval ExecBg $opt\n"
"}\n"
"exec {\n"
"OutMsg $opt\n"
"catch {eval exec $opt} out\n"
"OutMsg $out\n"
"}\n"
"default {\n"
"OutMsg \"$cmd $opt\"\n"
"eval $cmd $opt\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc OutMsg {s} {\n"
"\n"
"Out .term \"* $s\"\n"
"}\n"
"\n"
"proc OutErr {s} {\n"
"Out .t.text \"??? $s ???\\n\"\n"
"}\n"
"\n"
"proc OutClr {} {\n"
"Out .t.text \\012\n"
"}\n"
"\n"
"proc xfocus {w} {\n"
"global params ted\n"
"\n"
"set old_focus [focus]\n"
"if {$old_focus == \".term\"} {\n"
"catch {$old_focus configure -foreground #000000}\n"
"}\n"
"if {[string compare $w \"\"] == 0} {set w .}\n"
"focus $w\n"
"raise [set wt [winfo toplevel $w]]\n"
"if {$w == \".term\"} {\n"
"catch {$w configure -foreground #0000ff}\n"
"}\n"
"catch {set params(Edit_file) $ted($wt,file)}\n"
"}\n"
"\n"
"proc Exit {} {\n"
"global params env\n"
"\n"
"set ex_ok 1\n"
"for {set i 0} {$i < 10} {incr i} {\n"
"if [winfo exists .t$i] {\n"
"if ![TedExit .t$i] {set ex_ok 0}\n"
"}\n"
"}\n"
"if {!$ex_ok} {\n"
"return\n"
"}\n"
"writeparams\n"
"\n"
"\n"
"CleanShutdown\n"
"destroy .\n"
"\n"
"}\n"
"\n"
"proc Primary {} {\n"
"global params\n"
"\n"
"if {$params(Primary_file) != \"\"} {\n"
"set f $params(Primary_file)\n"
"} else {\n"
"set f \"\"\n"
"}\n"
"if {![FileDialog $params(dlg_geom) \"Primary File\" .tex f]} {return 0}\n"
"set params(Primary_dir) [file dirname $f]\n"
"set params(Short_dir) [shortdir $params(Primary_dir)]\n"
"cd $params(Primary_dir)\n"
"set f [file tail $f]\n"
"\n"
"set params(Primary_file) $f\n"
"OutMsg \"Primary file was changed to $params(Primary_file)\"\n"
"OutMsg \"Working directory is now $params(Primary_dir)\"\n"
"return 1\n"
"}\n"
"\n"
"proc EditFile {file {line 1}} {\n"
"global params ted\n"
"\n"
"set lcmd [lindex $params(Edit) $params(Edit_default)]\n"
"set cmd [lindex $lcmd 1]\n"
"if {$cmd == \"tedit\"} {\n"
"for {set i 0} {$i < 10} {incr i} {\n"
"if [winfo exists .t$i] {\n"
"if {$ted(.t$i,file) == $file} {\n"
"raise .t$i\n"
"xfocus .t$i.text\n"
".t$i.text mark set insert $line.0\n"
".t$i.text yview -pickplace insert\n"
"return\n"
"}\n"
"}\n"
"}\n"
"set i 1\n"
"while {[winfo exists .t$i]} {incr i}\n"
"if {$i >= 10} {\n"
"Warning $params(dlg_default) \"Too many editors (max. 9).\"\n"
"return\n"
"}\n"
"set geom +[expr $params(x0)+50+30*$i]+[expr $params(y0)+50+30*$i]\n"
"tedit .t$i $geom \"Edit - $i\" $file $line\n"
"} else {\n"
"set opt [lindex $lcmd 2]\n"
"regsub -- {!i([^!%]*)%([^!]*)!} $opt \"\\\\1$line\\\\2\" opt\n"
"debug \"Insert line: $opt\"\n"
"set params(Edit_file) $file\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"EvalCmd [list Edit $cmd $opt]\n"
"} \n"
"}\n"
"\n"
"proc Edit {{i \"\"}} {\n"
"global params\n"
"\n"
"set lcmd [lindex $params(Edit) $params(Edit_default)]\n"
"set cmd [lindex $lcmd 1]\n"
"\n"
"if {$cmd != \"tedit\"} {\n"
"set ext [file extension $params(Edit_file)]\n"
"if {$ext == \"\"} {set ext .tex}\n"
"if {![FileDialog $params(dlg_geom) \"Select File\" $ext \\\n"
"params(Edit_file)]} {return \"\"}\n"
"set params(Edit_file) [cutdir $params(Edit_file)]\n"
"EvalCmd $lcmd\n"
"return\n"
"}\n"
"if {$i != \"\"} {\n"
"if {[winfo exists .t$i]} {\n"
"raise .t$i\n"
"xfocus .t${i}.text\n"
"return\n"
"}\n"
"} else {\n"
"set i 1\n"
"while {[winfo exists .t$i]} {incr i}\n"
"if {$i >= 10} {\n"
"Warning $params(dlg_default) \"Too many editors (max. 9).\"\n"
"return\n"
"}\n"
"}\n"
"set geom +[expr $params(x0)+50+30*$i]+[expr $params(y0)+50+30*$i]\n"
"if {![FileDialog $params(dlg_geom) \"Select File\" .tex \\\n"
"params(Edit_file)]} {return \"\"}\n"
"set opt \".t$i $geom \\\"Edit - $i\\\" $params(Edit_file)\"\n"
"if {$opt != \"\"} {eval tedit $opt} \n"
"}\n"
"\n"
"proc NewPrim {} {\n"
"global params\n"
"\n"
"set templatefile [templatedlg]\n"
"if {$templatefile != \"\"} {\n"
"set fd [open $templatefile r]\n"
"set fprim [open $params(Primary_file) w]\n"
"gets $fd cont\n"
"gets $fd sline\n"
"debug \"sline: $sline\"\n"
"set line 1\n"
"regexp {%! *([0-9]+)} $sline dummy line\n"
"while {![eof $fd]} {\n"
"gets $fd s\n"
"puts $fprim $s\n"
"}\n"
"close $fd\n"
"close $fprim\n"
"if {$line < 1} {set line 1}\n"
"debug \"$line\"\n"
"return $line\n"
"}\n"
"return 1\n"
"}\n"
"\n"
"proc EditPrim {} {\n"
"global params\n"
"\n"
"set lcmd [lindex $params(Edit) $params(Edit_default)]\n"
"set cmd [lindex $lcmd 1]\n"
"if {$params(Primary_file) == \"\"} {\n"
"if {![Primary]} return\n"
"if {$params(Primary_file) == \"\"} {\n"
"Warning $params(dlg_geom) \"No primary file is specified.\"\n"
"return\n"
"}\n"
"}\n"
"if {[file extension $params(Primary_file)] != \"\"} {\n"
"set params(Edit_File) $params(Primary_file)\n"
"} else {\n"
"set params(Edit_File) $params(Primary_file).tex\n"
"}\n"
"if {![file exists $params(Primary_file)]} {\n"
"set line [NewPrim]\n"
"} else {\n"
"set line 1\n"
"}\n"
"if {$cmd == \"tedit\"} {\n"
"if {[winfo exists .t0]} {\n"
"raise .t0\n"
"xfocus .t0.text\n"
"} else {\n"
"set x [expr $params(x0)+50]\n"
"set y [expr $params(y0)+30]\n"
"tedit .t0 +$x+$y \"Edit - 0\" \\\n"
"$params(Primary_dir)/$params(Primary_file) $line\n"
"}\n"
"} else {\n"
"EditFile $params(Primary_file) $line\n"
"}\n"
"}\n"
"\n"
"proc Compose {} {\n"
"global params\n"
"\n"
"\n"
"set edfile $params(Edit_file)\n"
"for {set i 0} {$i < 10} {incr i} {\n"
"if [winfo exists .t$i] {\n"
"if {![TedAskSave .t$i]} {return}\n"
"}\n"
"}\n"
"set params(Edit_file) $edfile\n"
"set l [lindex $params(Compose) $params(Compose_default)]\n"
"file delete compose.err\n"
"EvalCmd $l\n"
"if {[file exists compose.err]} { ;# Error occured, Edit was called\n"
"set fd [open compose.err r]\n"
"gets $fd s\n"
"close $fd\n"
"regexp -- {([^ ]*)[ ]*([^ ]*)} $s sub line file\n"
"file delete compose.err\n"
"if {[string first \"/\" $file] != 0} {\n"
"set file $params(Primary_dir)/$file\n"
"}\n"
"debug \"Compose: $file $line\"\n"
"EditFile $file $line\n"
"}\n"
"}\n"
"\n"
"proc Reference {} {\n"
"global params\n"
"\n"
"set l [lindex $params(Reference) $params(Reference_default)]\n"
"EvalCmd $l\n"
"}\n"
"\n"
"proc View {} {\n"
"Output View\n"
"}\n"
"\n"
"proc Print {} {\n"
"Output Print\n"
"}\n"
"\n"
"proc Output {{device View}} {\n"
"global params prd\n"
"\n"
"if {$params(Primary_file) != \"\"} {\n"
"set f [file rootname $params(Primary_file)]\n"
"} elseif {$params(Edit_file) != \"\"} {\n"
"set f [file rootname $params(Edit_file)]\n"
"} else {\n"
"Warning $params(dlg_geom) \"No Primary file is specified.\"\n"
"return\n"
"}\n"
"\n"
"switch [filetest ${f}.tex ${f}.dvi] {\n"
"1 {\n"
"Warning $params(dlg_geom) \"TeX file ${f}.tex not found\"\n"
"return\n"
"}\n"
"2 {\n"
"if {[Dialog .dlg $params(dlg_geom) \"\" \\\n"
"\"DVI file $f.dvi not found.\\n Run compose?\" question \\\n"
"0 1 {Yes <Any-y>} {No <Any-n>}] == 0} {\n"
"Compose\n"
"} else {\n"
"return\n"
"}\n"
"}\n"
"3 {\n"
"if {[Dialog .dlg $params(dlg_geom) \"\" \\\n"
"\"Primary file $f has been changed.\\nRun compose?\" question \\\n"
"0 1 {Yes <Any-y>} {No <Any-n>}] == 0} {\n"
"Compose\n"
"debug \"View weiter\"\n"
"}\n"
"}\n"
"}\n"
"set l [lindex $params($device) $params(${device}_default)]\n"
"\n"
"set cmd [lindex $l 1]\n"
"set opt [lindex $l 2]\n"
"if {[string first \"%r.ps\" $opt] != -1} {\n"
"switch [filetest ${f}.dvi ${f}.ps] {\n"
"1 {\n"
"Warning $params(dlg_geom) \"Could not compose DVI file ${f}.dvi.\"\n"
"return\n"
"}\n"
"default {\n"
"OutMsg \"Generate new PostScript file.\"\n"
"EvalCmd [list MakePS exwin \"dvips -o%r.ps %r\"]\n"
"}\n"
"}\n"
"} \n"
"if {$device == \"View\"} {\n"
"update idletasks\n"
"update idletasks\n"
"EvalCmd $l\n"
"return\n"
"}\n"
"\n"
"if {![PrintDlg $params(dlg_geom) [cutdir \"${f}.dvi\"] params]} {\n"
"return\n"
"}\n"
"if {$params(pr_first) != \"\" && $params(pr_first) > 1} {\n"
"setprintopt opt first $params(pr_first)\n"
"}\n"
"if {$params(pr_last) != \"\" && $params(pr_last) < 9999} {\n"
"setprintopt opt last $params(pr_last)\n"
"}\n"
"if {$params(pr_copies) != \"\" && $params(pr_copies) > 1} {\n"
"setprintopt opt copies $params(pr_copies)\n"
"}\n"
"if {$params(pr_xopt) != \"\"} {\n"
"setprintopt opt xopt $params(pr_xopt)\n"
"}\n"
"if {$params(pr_orientation) == \"landscape\"} {\n"
"if {![setprintopt opt landscape]} {\n"
"Warning $params(dlg_geom) \\\n"
"\"DVI Driver can't print in landscape mode.\\nAbort.\"\n"
"return\n"
"}\n"
"}\n"
"switch $params(pr_pages) {\n"
"all { }\n"
"odd {setprintopt opt odd}\n"
"even {setprintopt opt even}\n"
"}\n"
"set l [list Print $cmd $opt]\n"
"EvalCmd $l\n"
"}\n"
"\n"
"proc Graphic {} {\n"
"global params\n"
"\n"
"set l [lindex $params(Graphic) $params(Graphic_default)]\n"
"EvalCmd $l\n"
"}\n"
"\n"
"proc Util {{i -1}} {\n"
"global params\n"
"\n"
"if {$i == -1} {\n"
"set i $params(Util_default)\n"
"}\n"
"set l [lindex $params(Util) $i]\n"
"EvalCmd $l\n"
"}\n"
"\n"
"proc setparam {cmd entry} {\n"
"global params\n"
"\n"
"set params(${cmd}_cmd) [lindex $entry 1]\n"
"}\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"\n"
"proc main {} {\n"
"global params pid argc argv env hlp\n"
"\n"
"FirstCall\n"
"readparams\n"
"read_templatelist\n"
"ide \n"
"\n"
"set textbind \"[bind Text <1>]\\nxfocus %W\"\n"
"bind Text <1> $textbind\n"
"debug [bind Text <1>]\n"
"\n"
"\n"
"if $argc>0 {\n"
"set f [lindex $argv end]\n"
"set params(Primary_dir) [file dirname $f]\n"
"cd $params(Primary_dir)\n"
"set f [file tail $f]\n"
"\n"
"if {[file extension $f] == \"\"} {\n"
"set params(Primary_file) ${f}.tex\n"
"} else {\n"
"set params(Primary_file) $f\n"
"}\n"
"}\n"
"if {$params(Primary_dir) == \".\"} {\n"
"set params(Primary_dir) [pwd]\n"
"}\n"
"set env(TEXEDIT) \"ts_err %d %s\"\n"
"foreach P {Edit Compose View Print Util Graphic} {\n"
"set params(${P}_pid) 1\n"
"}\n"
"set params(Short_dir) [shortdir $params(Primary_dir)]\n"
"prjreadpatterns\n"
"debug \"Start Help\"\n"
"\n"
"\n"
"debug \"Help Ready\"\n"
"exec xlsfonts *Courier* >$env(HOME)/.ts_fontlist\n"
"update\n"
"OutMsg \"TeXShell by Jens Poenisch\" \n"
"OutMsg \"(poenisch@wirtschaft.tu-chemnitz.de)\"\n"
"OutMsg \"Version $params(version)\"\n"
"OutMsg \" Primary file:\"\n"
"OutMsg \" $params(Primary_file)\"\n"
"OutMsg \" Working directory:\"\n"
"OutMsg \" $params(Primary_dir)\"\n"
"OutMsg \"\"\n"
"OutMsg \" Help: Press F1\"\n"
"update idletasks\n"
"focus .\n"
"update\n"
"} \n"
"";
#line 40 "ts.et"
Et_EvalInclude("ts.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"proc initparams {} {\n"
"\n"
"set s {\n"
"{ Edit 0 {\n"
"{\"Intern\" \"tedit\" \"%e\"}\n"
"{\"vi &\" \"exbg\" \"xterm -geometry %g -e vi !i+%! %e\"}\n"
"} }\n"
"{ Compose 0 {\n"
"{\"LaTeX\" \"exwin\" \"latex %p\"}\n"
"{\"TeX\" \"exwin\" \"tex %p\"}\n"
"} }\n"
"{ Reference 0 {\n"
"{\"Makeindex\" \"exwin\" \"makeindex %r.idx\"}\n"
"} }\n"
"{ View 0 {\n"
"{\"Xdvi\" \"exwin\" \"xdvi -geometry %g %r\" }\n"
"{\"Xdvi &\" \"exbg\" \"xdvi -geometry %g %r\"}\n"
"{\"Ghostview\" \"exwin\" \"ghostview %r.ps\"}\n"
"} }\n"
"{ Print 0 {\n"
"{\"DVIPS\" exwin \"dvips -t a4 !l-t landscape! !0-p %! !9-l %! !c-c %! !o-A! !e-B! !x%! %r\"}\n"
"} }\n"
"{ Graphic 0 {\n"
"{\"XFig &\" \"exbg\" \"xfig -geometry %g -but_ 3 -me %o.fig\"}\n"
"} }\n"
"{ Util 0 {\n"
"{\"View Logfile\" exwin \"less %r.log\"}\n"
"{\"Delete Waste\" exwin \"rm *.aux *.log *.toc *.ind *.ilg *.bak\"}\n"
"{\"Shell\" exwin \"/bin/sh\"}\n"
"} }\n"
"}\n"
"return $s\n"
"}\n"
"\n"
"proc readparams {} {\n"
"global params ted gparams\n"
"\n"
"if [catch {set fd [open $params(local_paramfile) r]}] {\n"
"\n"
"if [catch {set fd [open $params(global_paramfile) r]}] {\n"
"\n"
"set s [initparams]\n"
"} else {\n"
"set s [read $fd]\n"
"close $fd\n"
"}\n"
"} else {\n"
"set s [read $fd]\n"
"close $fd\n"
"}\n"
"set ted(global_params) {}\n"
"foreach l $s {\n"
"set cmd [lindex $l 0]\n"
"if {[lsearch {Edit Compose View Print Reference Graphic Util} $cmd] \\\n"
">= 0} {\n"
"set default [lindex $l 1]\n"
"set params($cmd) [lindex $l 2]\n"
"set params(${cmd}_name) [lindex [lindex $params($cmd) $default] 0]\n"
"set params(${cmd}_default) $default\n"
"} elseif {$cmd == \"Options\"} {\n"
"\n"
"set gparams(hlplan) \"eng\"\n"
"set gparams(showicons) 1\n"
"set lopt [lindex $l 1]\n"
"foreach par $lopt {\n"
"set p0 [lindex $par 0]\n"
"set p1 [lindex $par 1]\n"
"set gparams($p0) $p1\n"
"}\n"
"}\n"
"}\n"
"}\n"
"\n"
"proc writeparams {} {\n"
"global params ted gparams\n"
"\n"
"set fd [open $params(local_paramfile) w]\n"
"foreach cmd {Edit Compose Reference View Print Util Graphic} {\n"
"puts $fd \"\\{ $cmd $params(${cmd}_default) \\{\"\n"
"foreach l $params($cmd) {\n"
"puts $fd \"\\{$l\\}\"\n"
"}\n"
"puts $fd \"\\} \\}\"\n"
"}\n"
"puts $fd \"\\{ Options \\{\"\n"
"foreach l [array names gparams] {\n"
"puts $fd \"\\{[list $l $gparams($l)]\\}\"\n"
"}\n"
"puts $fd \"\\} \\}\"\n"
"close $fd\n"
"}\n"
"\n"
"proc selectparams {cmd} {\n"
"global params pdlg\n"
"\n"
"proc PSetFields {i} {\n"
"global pdlg\n"
"\n"
"set pdlg(sel) $i\n"
"set l [lindex $pdlg(cmds) $i] \n"
"if {[llength $l] > 0} {set pdlg(name) [lindex $l 0]}\n"
"if {[llength $l] > 1} {set pdlg(cmd) [lindex $l 1]}\n"
"if {[llength $l] > 2} {set pdlg(opt) [lindex $l 2]}\n"
"}\n"
"\n"
"proc PSelect {i} {\n"
"global pdlg\n"
"\n"
".pdlg.lb.b activate $i\n"
".pdlg.lb.b select anchor $i\n"
".pdlg.lb.b select set anchor $i\n"
".pdlg.lb.b see $i\n"
"PSetFields $i\n"
"}\n"
"\n"
"proc PNext {} {\n"
"global pdlg\n"
"\n"
"incr pdlg(sel)\n"
"if {$pdlg(sel) >= [.pdlg.lb.b size]} {\n"
"set pdlg(sel) [expr [.pdlg.lb.b size] - 1]\n"
"}\n"
"PSelect $pdlg(sel)\n"
"}\n"
"proc PPrev {} {\n"
"global pdlg\n"
"\n"
"incr pdlg(sel) -1\n"
"if {$pdlg(sel) < 0} {set pdlg(sel) 0}\n"
"PSelect $pdlg(sel)\n"
"}\n"
"\n"
"proc PAdd {{app ins}} {\n"
"global pdlg params\n"
"\n"
"foreach f [array names pdlg] {\n"
"set p($f) \"\"\n"
"}\n"
"if {[InpDlg pdlg .idlg \"Parameter\" $params(dlg_geom) \"Add Parameter\" {\n"
"{Name char 15 name}\n"
"{\"Exec Proc\" char 15 cmd}\n"
"{\"Options\" char 45 opt}\n"
"} p]} {\n"
"set l [list $pdlg(name) $pdlg(cmd) $pdlg(opt)]\n"
"if {$app == \"ins\"} {\n"
"set i $pdlg(sel)\n"
"} else {\n"
"set i [llength $pdlg(cmds)]\n"
"}\n"
"set pdlg(cmds) \\\n"
"[linsert $pdlg(cmds) $i $l]\n"
".pdlg.lb.b insert $i $pdlg(name)\n"
"update idletasks\n"
"PSelect $i\n"
"}\n"
"}\n"
"\n"
"proc PEdit {} {\n"
"global pdlg\n"
"\n"
"debug \"Dialog geometry: $pdlg(geom)\"\n"
"if {[InpDlg pdlg .idlg \"Parameter\" $pdlg(geom) \"Edit Parameter\" {\n"
"{Name char 15 name}\n"
"{\"Exec Proc\" char 15 cmd}\n"
"{\"Options\" char 45 opt}\n"
"} pdlg]} {\n"
"set l [list $pdlg(name) $pdlg(cmd) $pdlg(opt)]\n"
"set pdlg(cmds) \\\n"
"[lreplace $pdlg(cmds) $pdlg(sel) $pdlg(sel) $l]\n"
".pdlg.lb.b delete $pdlg(sel)\n"
".pdlg.lb.b insert $pdlg(sel) $pdlg(name)\n"
"PSelect $pdlg(sel)\n"
"}\n"
"}\n"
"proc PDel {} {\n"
"global pdlg\n"
"\n"
"if {[Dialog .ddlg $pdlg(geom) \"\" \"Delete entry $pdlg(name)\" \\\n"
"question 0 1 {Yes <Any-y>} {No <Any-n>}] == 0} {\n"
"debug \"PDel\"\n"
"set pdlg(cmds) \\\n"
"[lreplace $pdlg(cmds) $pdlg(sel) $pdlg(sel)]\n"
".pdlg.lb.b delete $pdlg(sel)\n"
"PSelect 0\n"
"}\n"
"}\n"
"\n"
"toplevel .pdlg\n"
"wm transient .pdlg .\n"
"\n"
"wm geometry .pdlg $params(dlg_geom)\n"
"wm title .pdlg \"Select Parameter\"\n"
"\n"
"frame .pdlg.b\n"
"pack .pdlg.b -side right\n"
"button .pdlg.b.ok -text \"OK\" -font 6x13bold -anchor w \\\n"
"-command {set pdlg(ok) 1}\n"
"pack .pdlg.b.ok -side top -padx 5 -pady 5 -fill x\n"
"button .pdlg.b.cancel -text \"Cancel\" -font 6x13bold -anchor w \\\n"
"-command {set pdlg(ok) 0}\n"
"pack .pdlg.b.cancel -side top -padx 5 -pady 5 -fill x\n"
"button .pdlg.b.edit -text \"Edit\" -underline 0 -font 6x13bold -anchor w \\\n"
"-command PEdit\n"
"pack .pdlg.b.edit -side top -padx 5 -pady 5 -fill x\n"
"button .pdlg.b.insert -text \"Insert\" -underline 0 -font 6x13bold \\\n"
"-anchor w -command {PAdd ins}\n"
"pack .pdlg.b.insert -side top -padx 5 -pady 5 -fill x\n"
"button .pdlg.b.append -text \"Append\" -underline 0 -font 6x13bold -anchor w \\\n"
"-command {PAdd app}\n"
"pack .pdlg.b.append -side top -padx 5 -pady 5 -fill x\n"
"button .pdlg.b.delete -text \"Delete\" -underline 0 -font 6x13bold -anchor w \\\n"
"-command {PDel}\n"
"pack .pdlg.b.delete -side top -padx 5 -pady 5 -fill x\n"
"\n"
"label .pdlg.lsel -text \"Select $cmd action\" -font fixed\n"
"pack .pdlg.lsel -anchor w\n"
"frame .pdlg.lb \n"
"pack .pdlg.lb\n"
"scrollbar .pdlg.lb.s -command \".pdlg.lb.b yview\"\n"
"listbox .pdlg.lb.b -yscroll \".pdlg.lb.s set\" -relief sunken -bd 1\n"
"pack .pdlg.lb.b -side left \n"
"pack .pdlg.lb.s -side right -fill y\n"
"frame .pdlg.name\n"
"pack .pdlg.name -side bottom -before .pdlg.b\n"
"label .pdlg.name.l -text \"Name\" -width 10\n"
"entry .pdlg.name.e -textvariable pdlg(name) -width 25 -state disabled\n"
"pack .pdlg.name.l .pdlg.name.e -side left -anchor w\n"
"frame .pdlg.cmd\n"
"pack .pdlg.cmd -side bottom -before .pdlg.name\n"
"label .pdlg.cmd.l -text \"Exec proc\" -width 10\n"
"entry .pdlg.cmd.e -textvariable pdlg(cmd) -width 25 -state disabled\n"
"pack .pdlg.cmd.l .pdlg.cmd.e -side left\n"
"frame .pdlg.opt\n"
"pack .pdlg.opt -side bottom -before .pdlg.cmd\n"
"label .pdlg.opt.l -text \"Call options\" -width 10\n"
"entry .pdlg.opt.e -textvariable pdlg(opt) -width 25 -state disabled\n"
"pack .pdlg.opt.l .pdlg.opt.e -side left\n"
"\n"
"set pdlg(cmds) $params($cmd)\n"
"foreach l $pdlg(cmds) {\n"
".pdlg.lb.b insert end [lindex $l 0]\n"
"}\n"
"set pdlg(sel) $params(${cmd}_default)\n"
"set pdlg(name) $params(${cmd}_name)\n"
"PSetFields $pdlg(sel)\n"
"\n"
"bindtags .pdlg.lb.b [list Listbox .pdlg.lb.b]\n"
"bind .pdlg.lb.b <Any-Return> {set pdlg(ok) 1}\n"
"bind .pdlg.lb.b <Escape> {set pdlg(ok) 0}\n"
"bind .pdlg.lb.b <Any-a> {PAdd app}\n"
"bind .pdlg.lb.b <Any-i> {PAdd ins}\n"
"bind .pdlg.lb.b <Any-e> {PEdit}\n"
"bind .pdlg.lb.b <Any-d> {PDel}\n"
"bind .pdlg.lb.b <Delete> {PDel}\n"
"bind .pdlg.lb.b <Down> {PSetFields [%W index active]}\n"
"bind .pdlg.lb.b <Up> {PSetFields [%W index active]}\n"
"bind .pdlg.lb.b <1> {PSetFields [%W nearest %y]}\n"
"update\n"
"\n"
"set x [expr [winfo rootx .pdlg]]\n"
"set y [expr [winfo rooty .pdlg] + [winfo height .pdlg] + 5]\n"
"set pdlg(geom) +$x+$y\n"
"debug \"Dialog geometry: $pdlg(geom)\"\n"
"PSelect $pdlg(sel)\n"
"set old_focus [focus]\n"
"focus .pdlg.lb.b\n"
"grab .pdlg\n"
"tkwait var pdlg(ok)\n"
"grab release .pdlg\n"
"focus $old_focus\n"
"destroy .pdlg\n"
"if {$pdlg(ok)} {\n"
"set params($cmd) $pdlg(cmds)\n"
"set l [lindex $params($cmd) $pdlg(sel)]\n"
"set params(${cmd}_name) [lindex $l 0]\n"
"set params(${cmd}_default) $pdlg(sel)\n"
"if {$cmd == \"Util\"} {\n"
"utilmenu .menubar.mUtil\n"
"}\n"
"}\n"
"return\n"
"}\n"
"\n"
"proc SaCmd {} {\n"
"global adlg params\n"
"\n"
"set params($adlg(cmd)_default) [.selact index active]\n"
"set l [lindex $params($adlg(cmd)) $params($adlg(cmd)_default)]\n"
"set params($adlg(cmd)_name) [lindex $l 0]\n"
"\n"
"grab release .selact\n"
"focus $adlg(focus)\n"
".selact unpost\n"
"destroy .selact\n"
"}\n"
"\n"
"proc SelectAction {w cmd} {\n"
"global adlg params\n"
"\n"
"\n"
"set adlg(list) {}\n"
"set adlg(cmd) $cmd\n"
"catch {menu .selact -tearoff 0}\n"
".selact delete 0 end\n"
"foreach e $params($cmd) {\n"
"lappend adlg(list) [lindex $e 0]\n"
".selact add command -label [lindex $e 0] -command {SaCmd}\n"
"}\n"
"set x [winfo rootx $w]\n"
"set y [expr [winfo rooty $w] + [winfo height $w]]\n"
".selact post $x $y\n"
".selact activate $params(${cmd}_default)\n"
"set adlg(focus) [focus]\n"
"focus .selact\n"
"grab -global .selact\n"
"}\n"
"\n"
"proc Options {} {\n"
"global params odlg gparams\n"
"\n"
"\n"
"set odlg(font) fixed\n"
"set odlg(background) #d9d9d9\n"
"set odlg(foreground) #000000\n"
"set odlg(hlplan) \"eng\"\n"
"foreach l [array names gparams] {\n"
"set odlg($l) $gparams($l)\n"
"}\n"
"set odlg(pos) \"+[winfo rootx .]+[winfo rooty .]\"\n"
"\n"
"\n"
"set hlplan {}\n"
"foreach l [glob $params(hlpdir)/*] {\n"
"lappend hlplan [file tail $l]\n"
"}\n"
"toplevel .odlg\n"
"wm transient .odlg .\n"
"wm geometry .odlg $params(dlg_geom)\n"
"wm title .odlg \"Options\"\n"
"\n"
"frame .odlg.l -relief raised -bd 1\n"
"pack .odlg.l -fill x -expand 1\n"
"label .odlg.l.title -text \"Global settings\"\n"
"pack .odlg.l.title\n"
"\n"
"frame .odlg.t -relief raised -bd 1\n"
"pack .odlg.t -fill x\n"
"label .odlg.t.l -text \"TeXShell:\" -anchor w\n"
"frame .odlg.t.fpos\n"
"label .odlg.t.lpos -text \"Window Position:\" -underline 7\n"
"entry .odlg.t.epos -textvariable odlg(pos) -relief sunken -bd 2 \\\n"
"-width 10\n"
"pack .odlg.t.lpos .odlg.t.epos -in .odlg.t.fpos -side left\n"
"\n"
"\n"
"pack .odlg.t.l -padx 10 -pady 5 -fill x\n"
"pack .odlg.t.fpos -fill x\n"
"\n"
"\n"
"frame .odlg.h -relief raised -bd 1\n"
"pack .odlg.h -fill x\n"
"label .odlg.h.l -text \"Help:\" -anchor w\n"
"label .odlg.h.lh -text \"Language:\" -underline 0 -anchor w\n"
"listbox .odlg.h.lb -height 2\n"
"set i 0\n"
"set k 0\n"
"foreach l $hlplan {\n"
".odlg.h.lb insert end $l\n"
"if {$l == $odlg(hlplan)} {set k $i}\n"
"incr i\n"
"}\n"
".odlg.h.lb activate $k\n"
".odlg.h.lb select anchor $k\n"
".odlg.h.lb select set anchor $k\n"
"pack .odlg.h.l -padx 10 -pady 5 -fill x -expand 1\n"
"pack .odlg.h.lh -side left -fill x\n"
"pack .odlg.h.lb -fill x\n"
"\n"
"frame .odlg.b -relief raised -bd 1\n"
"pack .odlg.b -fill x -expand 1\n"
"\n"
"frame .odlg.b.fok -relief sunken -bd 1\n"
"button .odlg.b.ok -text \"OK\" -command {set odlg(ok) 1}\n"
"button .odlg.b.cancel -text \"Cancel\" -command {set odlg(ok) 0}\n"
"pack .odlg.b.fok .odlg.b.cancel -side left -padx 10 -pady 5\n"
"pack .odlg.b.ok -padx 5 -pady 5 -in .odlg.b.fok\n"
"\n"
"foreach w {.odlg.h.lb .odlg.t.epos} {\n"
"\n"
"bind $w <Alt-Any-w> {set odlg(wrap) [expr ! $odlg(wrap)]}\n"
"bind $w <Alt-Any-s> {set odlg(save) [expr ! $odlg(save)]}\n"
"bind $w <Alt-Any-b> {set odlg(bak) [expr ! $odlg(bak)]}\n"
"bind $w <Alt-Any-f> {OptionsSelFont}\n"
"bind $w <Alt-Any-p> {focus .odlg.t.epos}\n"
"bind $w <Alt-Any-l> {focus .odlg.h.lb}\n"
"bind $w <Alt-Any-g> {OptionsSelColor background}\n"
"bind $w <Alt-Any-r> {OptionsSelColor foreground}\n"
"bind $w <Control-Return> {set odlg(ok) 1}\n"
"bind $w <Escape> {set odlg(ok) 0}\n"
"}\n"
"\n"
"\n"
"set old_focus [focus]\n"
"focus .odlg\n"
"grab .odlg\n"
"tkwait variable odlg(ok)\n"
"grab release .odlg\n"
"if $odlg(ok) {\n"
"foreach l [array names odlg] {\n"
"set gparams($l) $odlg($l)\n"
"}\n"
"if {$odlg(pos) != \"\"} {\n"
"set gparams(pos) $odlg(pos)\n"
"wm geometry . $odlg(pos)\n"
"SetPos \n"
"} else {\n"
"set pos [winfo geometry .]\n"
"if {[regexp {\\+[0-9]+\\+[0-9]+} $pos pos]} {\n"
"set gparams(pos) $pos\n"
"}\n"
"}\n"
"set gparams(hplan) [lindex $hlplan [.odlg.h.lb index active]]\n"
".term config -font $odlg(font)\n"
"for {set i 0} {$i < 10} {incr i} {\n"
"if [winfo exists .t$i] {\n"
".t$i.text config -bg $odlg(background) -fg $odlg(foreground) \\\n"
"-font $odlg(font)\n"
"}\n"
"}\n"
"}\n"
"focus $old_focus\n"
"destroy .odlg\n"
"}\n"
"";
#line 41 "ts.et"
Et_EvalInclude("ts_param.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"proc prjreadpatterns {} {\n"
"global env params\n"
"\n"
"set fd [open \"$env(HOME)/.ts/includes.cfg\" r]\n"
"set params(prjinclpatterns) {}\n"
"while {![eof $fd]} {\n"
"gets $fd s\n"
"set sc [string range $s 0 0]\n"
"set pt [string range $s 2 end]\n"
"if {$s != \"\"} {lappend params(prjinclpatterns) [list $sc $pt]}\n"
"}\n"
"close $fd\n"
"}\n"
"\n"
"proc prjscanfile {f} {\n"
"global params\n"
"\n"
"set fd [open $f r]\n"
"set prjfiles {}\n"
"while {![eof $fd]} {\n"
"gets $fd s\n"
"if {$s == \"\"} continue\n"
"foreach p $params(prjinclpatterns) {\n"
"foreach {sc pt} $p {break}\n"
"while {[regexp \"${pt}(.*)\" $s dummy cmd file s]} {\n"
"lappend prjfiles [list $cmd $file $sc]\n"
"}\n"
"}\n"
"}\n"
"close $fd\n"
"return $prjfiles\n"
"}\n"
"\n"
"proc prjscan {file {dep 0} {sc 1}} {\n"
"incr dep\n"
"set exist 1\n"
"if {![file isfile $file]} {\n"
"if {[file isfile \"$file.tex\"]} {\n"
"set file \"$file.tex\"\n"
"} elseif {[file isfile \"$file.sty\"]} {\n"
"set file \"$file.sty\"\n"
"} else {\n"
"set exist 0\n"
"}\n"
"}\n"
"if {!$exist || $dep > 10} {\n"
"return [list $file 0 {}]\n"
"}\n"
"if {!$sc} {\n"
"return [list $file 1 {}]\n"
"}\n"
"set prjlist [prjscanfile $file]\n"
"debug $prjlist\n"
"set filelist {}\n"
"foreach p $prjlist {\n"
"set f [lindex $p 1]\n"
"set sc [lindex $p 2]\n"
"lappend filelist [prjscan $f $dep $sc]\n"
"}\n"
"return [list $file 1 $filelist]\n"
"}\n"
"\n"
"proc prjdrawentry {w d l lold bool text} {\n"
"set x0 [expr $d*10-10]\n"
"set x [expr $d*10]\n"
"set y0 [expr $lold*15+14]\n"
"set y [expr $l*15+10]\n"
"set scrreg [$w cget -scrollregion]\n"
"foreach {xx yy width height} $scrreg { break }\n"
"if {$height < $y+10} {\n"
"$w config -scrollregion [list 0 0 $width [expr $y+10]]\n"
"}\n"
"if $bool {\n"
"set col green\n"
"} else {\n"
"set col red\n"
"}\n"
"$w create oval [expr $x-4] [expr $y-4] [expr $x+4] [expr $y+4] \\\n"
"-fill $col -outline black\n"
"$w create text [expr $x+10] $y -text $text -anchor w\n"
"if {$l > 0} {\n"
"$w create line $x0 $y0 $x0 $y [expr $x-4] $y\n"
"}\n"
"}\n"
"\n"
"proc prjsel {w i} {\n"
"global params\n"
"\n"
"if {$i >= [llength $params(prj_filelist)]} {\n"
"set i [expr [llength $params(prj_filelist)] - 1]\n"
"} elseif {$i < 0} {\n"
"set i 0\n"
"}\n"
"set y0 [expr $i*15+1]\n"
"set y [expr $i*15+15]\n"
"set params(prj_selidx) $i\n"
"$w coords selframe 0 $y0 200 $y\n"
"foreach {xa ya xb yb} [$w cget -scrollregion] {break}\n"
"set d0 [expr (1.0*$y0)/$yb]\n"
"set d1 [expr (1.0*$y)/$yb]\n"
"foreach {da db} [$w yview] {break}\n"
"if {$d1 > $db} {\n"
"$w yview moveto [expr $da+$d1-$db]\n"
"} elseif {$d0 < $da} {\n"
"$w yview moveto $d0\n"
"}\n"
"}\n"
"\n"
"\n"
"proc prjdraw {w prjlist {line 0} {dep 0} {oldline 0}} {\n"
"global params\n"
"\n"
"incr dep\n"
"set file [lindex $prjlist 0]\n"
"set exist [lindex $prjlist 1]\n"
"set filelist [lindex $prjlist 2]\n"
"prjdrawentry $w $dep $line $oldline $exist $file\n"
"lappend params(prj_filelist) [list $file $exist]\n"
"set oldline $line\n"
"foreach fl $filelist {\n"
"debug $fl\n"
"incr line\n"
"set line [prjdraw $w $fl $line $dep $oldline]\n"
"}\n"
"return $line\n"
"}\n"
"\n"
"proc prjclose {} {\n"
"focus .\n"
"destroy .prj\n"
"return\n"
"}\n"
"\n"
"proc prjrescan {} {\n"
"global params\n"
"\n"
"set prjlist [prjscan $params(Primary_file)]\n"
".prj.c delete all\n"
"set params(prj_filelist) {}\n"
"prjdraw .prj.c $prjlist\n"
".prj.c create rectangle 1 1 200 15 -tag selframe\n"
"update idletasks\n"
"prjsel .prj.c 0\n"
"}\n"
"\n"
"proc prjedit {} {\n"
"global params\n"
"\n"
"foreach {file exist} [lindex $params(prj_filelist) $params(prj_selidx)] {\n"
"break\n"
"}\n"
"if {!$exist} {\n"
"Warning $params(dlg_geom) \"File doesn't exist.\\nCreate it with Edit.\"\n"
"return\n"
"}\n"
"EditFile $file\n"
"}\n"
"\n"
"\n"
"proc Project {} {\n"
"global params prj\n"
"\n"
"if {$params(Primary_file) == \"\"} {\n"
"if {![Primary]} return\n"
"if {$params(Primary_file) == \"\"} {\n"
"Warning $params(dlg_geom) \"No primary file is specified\"\n"
"return\n"
"}\n"
"}\n"
"\n"
"if {[winfo exists .prj]} {\n"
"prjrescan\n"
"xfocus .prj.c\n"
"return\n"
"}\n"
"\n"
"set x [winfo rootx .term]\n"
"set y [winfo rooty .term]\n"
"toplevel .prj\n"
"wm geometry .prj +$x+$y\n"
"wm title .prj \"Project\"\n"
"canvas .prj.c -width 200 -height 200 -scrollregion {0 0 200 200} \\\n"
"-yscrollcommand \".prj.sb set\" -relief sunken\n"
"scrollbar .prj.sb -command \".prj.c yview\"\n"
"grid .prj.c -row 0 -column 0 -columnspan 4 -sticky nsew\n"
"grid .prj.sb -row 0 -column 4 -sticky ns\n"
"grid columnconfigure .prj 2 -weight 1\n"
"grid rowconfigure .prj 0 -weight 1\n"
"frame .prj.fedit -bd 1 -relief sunken\n"
"button .prj.bedit -text \"Edit\" -command prjedit\n"
"pack .prj.bedit -in .prj.fedit -padx 5 -pady 3\n"
"button .prj.rescan -text \"Rescan\" -underline 0 -command prjrescan\n"
"button .prj.cancel -text \"Cancel\" -command prjclose\n"
"grid .prj.fedit -row 1 -column 0 -padx 5 -pady 3\n"
"grid .prj.rescan -row 1 -column 1 -padx 5 -pady 3\n"
"grid .prj.cancel -row 1 -column 2 -padx 5 -pady 3\n"
"bindtags .prj.c {.prj.c all .}\n"
"bind .prj.c <Down> {prjsel .prj.c [expr $params(prj_selidx)+1]}\n"
"bind .prj.c <Up> {prjsel .prj.c [expr $params(prj_selidx)-1]}\n"
"bind .prj.c <1> {prjsel .prj.c [expr int([%W canvasy %y])/15]}\n"
"bind .prj.c <Double-1> {prjedit}\n"
"bind .prj.c <Return> {prjedit}\n"
"bind .prj.c <Escape> {prjclose}\n"
"bind .prj.c <Alt-R> {prjrescan}\n"
"prjrescan\n"
"xfocus .prj.c\n"
"}\n"
"";
#line 42 "ts.et"
Et_EvalInclude("ts_prj.tcl",_ET_script_); };
{ static char _ET_script_[] =
"\n"
"\n"
"\n"
"proc scan_templates {} {\n"
"global params env\n"
"\n"
"set fdidx [open $env(HOME)/.ts/templates.idx w]\n"
"set filelist \\\n"
"[concat [glob -nocomplain $params(template_dir)/*.tpl] \\\n"
"[glob -nocomplain $env(HOME)/.ts/*.tpl]]\n"
"foreach f $filelist {\n"
"set fd [open $f r]\n"
"gets $fd desc\n"
"regexp {%! *(.*)} $desc dummy desc\n"
"puts $fdidx [list $desc $f]\n"
"close $fd\n"
"}\n"
"close $fdidx\n"
"}\n"
"\n"
"proc read_templatelist {} {\n"
"global params env\n"
"\n"
"if {![file exists $params(template_index)]} {\n"
"scan_templates\n"
"}\n"
"set fdidx [open $env(HOME)/.ts/templates.idx r]\n"
"set params(template_list) [list [list {## blank ##} {}]]\n"
"while {![eof $fdidx]} {\n"
"gets $fdidx s\n"
"if {$s != {}} {\n"
"lappend params(template_list) $s\n"
"}\n"
"}\n"
"close $fdidx\n"
"}\n"
"\n"
"proc tpldlg_readlist {} {\n"
"global params\n"
"\n"
".tpldlg.lb delete 0 end\n"
"foreach l $params(template_list) {\n"
"debug $l\n"
".tpldlg.lb insert end [lindex $l 0]\n"
"}\n"
".tpldlg.lb activate 0\n"
".tpldlg.lb select anchor 0\n"
".tpldlg.lb select set anchor 0\n"
"}\n"
"\n"
"proc tpldlg_rescan {} {\n"
"\n"
"scan_templates\n"
"read_templatelist\n"
"tpldlg_readlist\n"
"}\n"
"\n"
"proc templatedlg {} {\n"
"global params tpldlg\n"
"\n"
"toplevel .tpldlg\n"
"wm geometry .tpldlg $params(dlg_geom)\n"
"wm title .tpldlg \"Select template\"\n"
"\n"
"label .tpldlg.l -text \"template:\" -anchor w\n"
"frame .tpldlg.flist\n"
"listbox .tpldlg.lb -width 50 -yscrollcommand {.tpldlg.sb set}\n"
"scrollbar .tpldlg.sb -command {.tpldlg.lb yview}\n"
"pack .tpldlg.sb -in .tpldlg.flist -side right -fill y\n"
"pack .tpldlg.lb -in .tpldlg.flist -side left -fill both\n"
"\n"
"frame .tpldlg.fbot\n"
"button .tpldlg.bok -text OK -command {set tpldlg(ok) 1}\n"
"button .tpldlg.bcancel -text Cancel -command {set tpldlg(ok) 0}\n"
"button .tpldlg.bscan -text \"Rescan templates\" -underline 2 \\\n"
"-command {tpldlg_rescan}\n"
"pack .tpldlg.bok .tpldlg.bcancel .tpldlg.bscan -in .tpldlg.fbot -side left\n"
"pack .tpldlg.l .tpldlg.flist .tpldlg.fbot -fill x\n"
"bind .tpldlg.lb <Return> {set tpldlg(ok) 1}\n"
"bind .tpldlg.lb <Escape> {set tpldlg(ok) 0}\n"
"bind .tpldlg.lb <Alt-s> {tpldlg_rescan}\n"
"tpldlg_readlist\n"
"set tpldlg(ok) \"\"\n"
"set old_focus [focus]\n"
"focus .tpldlg.lb\n"
"grab .tpldlg\n"
"tkwait variable tpldlg(ok)\n"
"grab release .tpldlg\n"
"if {$tpldlg(ok)} {\n"
"set i [.tpldlg.lb index active]\n"
"set file [lindex [lindex $params(template_list) $i] 1]\n"
"} else {\n"
"set file \"\"\n"
"}\n"
"focus $old_focus\n"
"destroy .tpldlg\n"
"return $file\n"
"}\n"
"";
#line 43 "ts.et"
Et_EvalInclude("ts_template.tcl",_ET_script_); };
StartTty();
Et_Eval(__FILE__,__LINE__,"s","main");
#ifdef DEBUG
Et_ReadStdin();
#endif
Et_MainLoop();
KillAllProcesses();
return 0;
}
static int Et_Proc_createterm(void *clientData,struct Tcl_Interp *interp,int argc,char **argv)
{
CreateTerm();
return ET_OK;
}
static int Et_Proc_cutdir(void *clientData,struct Tcl_Interp *interp,int argc,char **argv)
{
char *prim_dir, *dir;
if (argc != 2) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " path\"", 0);
return ET_ERROR;
}
prim_dir = Tcl_GetVar2(interp, "params", "Primary_dir", TCL_GLOBAL_ONLY);
if (strncmp(prim_dir, argv[1], strlen(prim_dir)) == 0) {
dir = argv[1]+strlen(prim_dir);
if (*dir == '/') dir++;
} else
dir = argv[1];
Tcl_AppendResult(interp, dir, 0);
return ET_OK;
}
static int Et_Proc_sync(void *clientData,struct Tcl_Interp *interp,int argc,char **argv)
{
sync();
return ET_OK;
}
static int Et_Proc_chkcode(void *clientData,struct Tcl_Interp *interp,int argc,char **argv)
{
char c;
int i, esc;
if (argc != 3) {
Tcl_AppendResult(interp, "wrong # args: should be \"",
argv[0], " string codechar\"", 0);
return ET_ERROR;
}
c = argv[2][0];
for (i = 0,esc = 0; argv[1][i]; i++) {
if (argv[1][i] == '\\') esc = !esc;
else {
if (!esc && argv[1][i] == c) {
sprintf(interp->result, "%d", i);
return ET_OK;
}
esc = 0;
}
}
Tcl_SetResult(interp, "-1",0);
return ET_OK;
}
/******* Automatically generated code follows ********/
#ifdef __cplusplus
# define EXTERN extern "C"
#else
# define EXTERN extern
#endif
EXTERN void Et_InstallCommand(char *,int (*)(void*,struct Tcl_Interp*,int,char**));
void Et_Init_ts_et(void){
Et_InstallCommand("CreateTerm",Et_Proc_createterm);
Et_InstallCommand("cutdir",Et_Proc_cutdir);
Et_InstallCommand("sync",Et_Proc_sync);
Et_InstallCommand("chkcode",Et_Proc_chkcode);
}
|