/usr/bin/tknamazu is in namazu2 2.0.21-9.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 | #! /usr/bin/wish
#
# tknamazu.tcl - Tcl/Tk front-end for Namazu.
#
# $Id: tknamazu.tcl.in,v 1.15 2000-02-29 19:45:06 kenzo- Exp $
#
# Copyright (C) 1998-2000 Ken-ichi Hirose. All rights reserved.
# This is free software with ABSOLUTELY NO WARRANTY.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either versions 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA
#
global version; set version "1.90"
global conf
global inside
global siteurl
regsub -all {\\} $argv0 {/} conf(argv0)
regsub {^(.*)/.*$} $conf(argv0) {\1} conf(basedir)
################ Evaluation and Initialize items
proc SetDefaultResources {} {
global conf
set conf(NAMAZU) {/build/buildd/namazu2-2.0.21/src/namazu}
set conf(BROWSER) {/usr/bin/lynx}
set conf(EXTBROWSER) {no}
set conf(UNCOMPRESS) {/bin/zcat}
set conf(MANPAGE) {/usr/bin/groff}
set conf(MANPAGEFILTER) {}
set conf(MANPATH) {/usr/local/man /usr/share/man /usr/bin/man /usr/man /usr/X11R6/man /usr/openwin/man}
set conf(GNUINFO) {no}
set conf(GNUINFOFILTER) {}
set conf(GNUINFOTMP) {/tmp/.gnuinfotmp}
set conf(WIDTH) {80}
set conf(HEIGHT) {20}
set conf(LANG) {}
set conf(WIDGETFONT) {-misc-Fixed-Medium-R-Normal-*-*-120-*-*-*-*-*-*}
set conf(TEXTFONT) {-misc-Fixed-Medium-R-Normal-*-*-120-*-*-*-*-*-*}
set conf(WIDGETCOLOR) {gray90}
# set conf(SELECTCOLOR) {blue60}
# set conf(TROUGHTCOLOR) {gray30}
# set conf(FONTCOLOR) {black}
# set conf(MARKCOLOR) {red}
# set conf(LINKCOLOR) {blue}
# set conf(REFERENCECOLOR) {green3}
set conf(OPTIONS) {}
set conf(NAMAZURC) {}
set conf(INDEXES) {/usr/local/share/namazu/index}
set conf(MKNMZ) {/build/buildd/namazu2-2.0.21/scripts/mknmz}
set conf(INDEXOUTPUTDIR) {/usr/local/share/namazu/index}
set conf(TARGETDIR) {./}
set conf(MKOPTIONS) {}
set conf(SMARTBROWSE) {1}
set conf(HEADERWIPE) {ON}
set conf(LOCALSITES) {}
set conf(THOUGHTFULFIND) {0}
set conf(tknmzhome) {/usr/share/tknamazu}
set conf(wishpath) {/usr/bin/wish}
set conf(viewer) {}
set conf(manpagedir) {}
set conf(gnuinfofile) {}
set conf(commandline) {}
}
proc LoadResources {} {
global conf env
if {[catch {open "$conf(tknmzhome)/tknamazurc"} input] \
&& [catch {open "$conf(tknmzhome)/tknmzrc"} input] \
&& [catch {open "$conf(basedir)/tknamazurc"} input] \
&& [catch {open "$conf(basedir)/tknmzrc"} input]} {
catch {close $input}
puts "I can not read resource file ... (T_T)\n"
} else {
foreach line [split [read $input] \n] {
if [regexp {^([^#][0-9A-Z]*)( | )+(.*)$} $line match item dummy value] {
set conf($item) "$value"
}
}
catch {close $input}
if {$conf(LANG) == ""} {
if [info exists env(LANG)] {
set conf(LANG) "$env(LANG)"
} else {
if [info exists env(LC_CTYPE)] {
set conf(LANG) "$env(LC_CTYPE)"
} else {
set conf(LANG) {C}
}
}
}
}
if { [catch {open "$env(TKNAMAZURC)"} input] \
&& [catch {open "$env(TKNMZRC)"} input] \
&& [catch {open "$env(TKNMZRC)/.tknmzrc"} input] \
&& [catch {open "$env(HOME)/.tknamazurc"} input] \
&& [catch {open "$env(HOME)/.tknmzrc"} input]} {
catch {close $input}
} else {
foreach line [split [read $input] \n] {
if [regexp {^([^#][0-9A-Z]*)( | )+(.*)$} $line match item dummy value] {
set conf($item) "$value"
}
}
catch {close $input}
}
}
proc Initialization {} {
global conf inside env tcl_version tk_version tcl_patchLevel tk_patchLevel tcl_platform
set conf(tclversion) "$tcl_version"
set conf(tkversion) "$tk_version"
set conf(tclpatchlevel) "$tcl_patchLevel"
set conf(tkpatchlevel) "$tk_patchLevel"
if [info exists tcl_platform(os)] {
set conf(os) "$tcl_platform(os)"
} else {
set conf(os) {unknown}
}
if [info exists tcl_platform(osVersion)] {
set conf(osversion) "$tcl_platform(osVersion)"
} else {
set conf(osversion) {unknown}
}
if [info exists tcl_platform(machine)] {
set conf(machine) "$tcl_platform(machine)"
} else {
set conf(machine) {unknown}
}
if [info exists tcl_platform(platform)] {
set conf(platform) "$tcl_platform(platform)"
} else {
set conf(platform) {unknown}
}
if [info exists env(HOME)] {
set conf(userhome) "$env(HOME)"
} else {
set conf(userhome) {~}
}
if {[info commands kanji] == "kanji"} {
set conf(kanjimode) 1
if ![regexp -nocase {unix} $conf(platform)] {
kanji internalCode SJIS
}
} else {
set conf(kanjimode) 0
}
if {$conf(LANG) == "C"} {
set conf(language) {en}
} else {
regsub {^(..).*} $conf(LANG) {\1} conf(language)
}
if [regexp -nocase {^windows|^os2|^mac|^beos} $conf(os)] {
set conf(argv0) "conf(wishpath) conf(argv0)"
}
set inside(keyword) {}
set inside(history) {}
set inside(lynxauth) {}
set inside(clippedurl) {}
}
################ proc routine
proc Browse { url } {
global conf inside log but
$log config -cursor watch
update idletasks
if {![string compare $url ""]} {
regexp {(kicker[0-9]+)} [$log tag names [$log index current]] \
match urltag
set url [$log get $urltag.first $urltag.last]
}
$but config -text {Back to result} -command {Exec $inside(keyword)}
switch -regexp $url {
{(\.(htm|HTM).*$)|(^http://)|(^ftp://)|(^file://)} {
set conf(viewer) {lynx}
set inside(history) "URLViewer $url"
URLViewer $url
}
{(\*.*::)|(^\*.*:.*\.)|((Next|Prev|Up): [^,]*,)|((Next|Prev|Up): [^,]*$)} {
regsub -all {\* *(.*)::} $url {\1} url
regsub -all {^\*.*:(.*)\.} $url {\1} url
regsub -all -nocase {^(Note|Next|Prev|Up):* (.*)} $url {\2} url
regsub -all {(.*)\. +([0-9]+$)|,$} $url {\1} url
regsub -all {^ *(.*) *$} $url {\1} url
if [regexp {\((.+)\).*} $url match file] {
regexp {(.*/info/)[^/]*$} $conf(gnuinfofile) match infobasedir
regsub {^DIR$} $file {dir} file
set url {}
set conf(gnuinfofile) "$infobasedir$file"
if {($file != "dir") && ![regexp {\.info$} $file]} {
append conf(gnuinfofile) ".info"
}
}
set conf(viewer) {gnuinfo}
set inside(history) "InfoViewer $url"
InfoViewer $conf(gnuinfofile) $url
}
{^[^/][A-Za-z0-9_\-\.]+\([1-9][A-Za-z0-9]*\)} {
set conf(viewer) {manpage}
regexp {([A-Za-z0-9_\-\.]+)\(([1-9lno])([A-Za-z0-9]*)\)} $url \
match manual section subsection
regexp {(.*)/(man|cat)[1-9lno]/[^/]*$} $conf(manpagedir) \
match manbasedir
if {$conf(MANPATH) == ""} {
set url "$manbasedir/man$section/$manual.$section"
set inside(history) "ManViewer $url"
ManViewer $url
}
foreach manpath [split $conf(MANPATH)] {
if {[file exists $manpath/$conf(LANG)/cat$section/$manual.$section] \
|| [file exists $manpath/$conf(LANG)/cat$section/$manual.$section.gz]} {
set url "$manpath/$conf(LANG)/cat$section/$manual.$section"
set inside(history) "Viewer $url"
Viewer $url {}
break
} elseif {[file exists $manpath/$conf(LANG)/man$section/$manual.$section] \
|| [file exists $manpath/$conf(LANG)/man$section/$manual.$section.gz]} {
set url "$manpath/$conf(LANG)/man$section/$manual.$section"
set inside(history) "ManViewer $url"
ManViewer $url
break
} elseif {[file exists $manpath/$conf(language)/cat$section/$manual.$section] \
|| [file exists $manpath/$conf(language)/cat$section/$manual.$section.gz]} {
set url "$manpath/$conf(language)/cat$section/$manual.$section"
set inside(history) "Viewer $url"
Viewer $url {}
break
} elseif {[file exists $manpath/$conf(language)/man$section/$manual.$section] \
|| [file exists $manpath/$conf(language)/man$section/$manual.$section.gz]} {
set url "$manpath/$conf(language)/man$section/$manual.$section"
set inside(history) "ManViewer $url"
ManViewer $url
break
} elseif {[file exists $manpath/cat$section/$manual.$section] \
|| [file exists $manpath/cat$section/$manual.$section.gz]} {
set url "$manpath/cat$section/$manual.$section"
set inside(history) "Viewer $url"
Viewer $url {}
break
} elseif {[file exists $manpath/man$section/$manual.$section] \
|| [file exists $manpath/man$section/$manual.$section.gz]} {
set url "$manpath/man$section/$manual.$section"
set inside(history) "ManViewer $url"
ManViewer $url
break
} else {
set url "$manbasedir/man$section/$manual.$section"
}
}
}
{.*/info/[^/]*$} {
set conf(viewer) {gnuinfo}
regsub {^/([A-Za-z])\|(/.*)} $url {\1:\2} url
regsub -nocase {(,*)(-[1-9]+)(.*)} $url {\1\3} url
set inside(history) "InfoViewer $url"
InfoViewer $url {}
}
{.*/man[1-9lno][A-Za-z]*/[^/]*$} {
set conf(viewer) {manpage}
regsub {^/([A-Za-z])\|(/.*)} $url {\1:\2} url
ManViewer $url
}
{.*/cat[1-9lno][A-Za-z]*/[^/]*$} {
set conf(viewer) {manpage}
regsub {^/([A-Za-z])\|(/.*)} $url {\1:\2} url
Viewer $url {}
}
default {
set conf(viewer) {}
regsub {^/([A-Za-z])\|(/.*)} $url {\1:\2} url
Viewer $url {}
}
}
focus .tknmz.result.scroll
$log config -cursor {}
update
}
proc Kick { url x y } {
global log conf
if {$url == ""} {
if {($x != "") && ($y != "")} {
PopupMenu2 $x $y
}
return
}
if [regexp {(kicker[0-9]+)} \
[$log tag names [$log index current]] match urltag] {
set url [$log get $urltag.first $urltag.last]
} else {
return
}
after 100
if [regexp {(\.(htm|HTM).*$)|(^http://)|(^ftp://)|(^file://)} $url] {
if {![catch {file readlink $conf(userhome)/.netscape/lock}]} {
catch {open "|$conf(EXTBROWSER) -remote openURL($url)"}
} else {
catch {open "|$conf(EXTBROWSER) $url"}
}
} else {
regsub {^/([A-z])\|(/.*)} $url {\1:\2} url
catch {open "|$conf(argv0) $url"}
}
}
proc Exec { searchword } {
global log but conf inside siteurl
$log config -cursor watch
update idletasks
if {![string compare $conf(nmzsite) "commandline"]} {
set conf(viewer) {}
MakeOptions
regsub -all {\"([^\"]+)\"} $searchword {{\1}} searchword
set conf(commandline) "$conf(NAMAZU) $conf(OPTIONS) \"$searchword\" $conf(INDEXES)"
set exec "$conf(NAMAZU) $conf(OPTIONS) \"$searchword\" $conf(INDEXES)"
} else {
set conf(viewer) {lynx}
MakeFormOptions
regsub -all { } $searchword {+} searchword
regsub -all {[^a-zA-Z0-9~\-\_\.\/\:\%\+]} $searchword \
{[scan \\& %c x ; format "%%%02X" $x]} conf(searchword)
set conf(searchword) "query=[subst $conf(searchword)]"
set url $siteurl($conf(nmzsite))
if [regexp {\?} $url] {
append url "&"
} else {
append url "?"
}
set gm [split [wm geometry .tknmz] x+]
set conf(WIDTH) [lindex $gm 0]
set conf(HIGTH) [lindex $gm 1]
set conf(commandline) "$conf(BROWSER) -dump -width=$conf(WIDTH) $url$conf(searchword)$conf(optionsurl)$conf(indexesurl)"
if {![string compare $inside(lynxauth) ""]} {
set exec "$conf(BROWSER) -dump -width=$conf(WIDTH) $url$conf(searchword)$conf(optionsurl)$conf(indexesurl)"
} else {
set exec "$conf(BROWSER) -dump -width=$conf(WIDTH) -auth=$inside(lynxauth) $url$conf(searchword)$conf(optionsurl)$conf(indexesurl)"
}
}
if [catch {open "|$exec"} input] {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n\n"
$log insert end $input
catch {close $input}
$log see 1.0
$log config -relief raised -state disabled
$log config -cursor {}
update
} else {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n\n"
set i 0
foreach line [split [read $input] \n] {
if [regexp {^(/.*|[A-Za-z]:/.*|http://.*|file://.*|ftp://.*) ((size )*\([0-9\,]+ bytes\))$} \
$line match url tail ] {
incr i
$log insert end "$url" kicker$i
$log insert end " $tail\n"
$log tag configure kicker$i -underline true -foreground blue
$log tag bind kicker$i <Enter> {$log config -cursor hand2}
$log tag bind kicker$i <Leave> {$log config -cursor {} }
$log tag bind kicker$i <Button-1> {Browse {}}
} else {
$log insert end "$line\n"
}
}
catch {close $input}
$log see 1.0
$log config -relief raised -state disabled
}
if {($conf(viewer) == "lynx")} {
RichEditControl
}
Mark $searchword
set inside(keyword) "$searchword"
$but config -text {Search} -command {Exec $inside(keyword)}
focus .tknmz.result.scroll
if {($conf(viewer) == "lynx")} {
bind .tknmz.result.scroll <Key-1> {ShortCutJump 1}
bind .tknmz.result.scroll <Key-2> {ShortCutJump 2}
bind .tknmz.result.scroll <Key-3> {ShortCutJump 3}
bind .tknmz.result.scroll <Key-4> {ShortCutJump 4}
bind .tknmz.result.scroll <Key-5> {ShortCutJump 5}
bind .tknmz.result.scroll <Key-6> {ShortCutJump 6}
bind .tknmz.result.scroll <Key-7> {ShortCutJump 7}
bind .tknmz.result.scroll <Key-8> {ShortCutJump 8}
bind .tknmz.result.scroll <Key-9> {ShortCutJump 9}
} else {
bind .tknmz.result.scroll <Key-1> {ShortCutReference 1}
bind .tknmz.result.scroll <Key-2> {ShortCutReference 2}
bind .tknmz.result.scroll <Key-3> {ShortCutReference 3}
bind .tknmz.result.scroll <Key-4> {ShortCutReference 4}
bind .tknmz.result.scroll <Key-5> {ShortCutReference 5}
bind .tknmz.result.scroll <Key-6> {ShortCutReference 6}
bind .tknmz.result.scroll <Key-7> {ShortCutReference 7}
bind .tknmz.result.scroll <Key-8> {ShortCutReference 8}
bind .tknmz.result.scroll <Key-9> {ShortCutReference 9}
}
$log config -cursor {}
update
}
proc Viewer { url offset } {
global conf inside log
if {![file exists $url]} {
if {![file exists $url.gz]} {
MessageBox info ok "Error occurred" "$url: File not found."
return
} else {
append url ".gz"
}
}
if [regexp {.*\.gz$} $url ] {
set conf(commandline) "$conf(UNCOMPRESS) $url"
set url "| $conf(UNCOMPRESS) $url"
} else {
set conf(commandline) "$url"
}
if {$offset == ""} {
set offset 1
}
if [catch {open "$url"} input] {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n"
$log insert end $input
catch {close $input}
$log insert end "\n$url: File not found."
$log see 1.0
$log config -relief raised -state disabled
$log config -cursor {}
update
} else {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n"
regsub -all {_|..|.} [read $input] {} line
catch {close $input}
if {[regexp {^[A-Z][A-Za-z\-]+: } $line]} {
foreach headers [split $line \n] {
if [regexp {^$} $headers] {
incr offset
break
} else {
incr offset
}
}
}
$log insert end $line
$log see 1.0
$log config -relief raised -state disabled
}
RichEditControl
Mark $inside(keyword)
if {($offset != 1) && ($conf(HEADERWIPE) == "ON")} {
set lastline [lindex [split [$log index end] .] 0]
set fraction [expr $offset.0 / $lastline.0]
if {$fraction > 0.3} {
set pading [expr $conf(HEIGHT) - ($lastline - $offset)]
$log config -state normal
for {set i 0} {$i <= $pading} {incr i} {$log insert end "\n"}
$log config -relief raised -state disabled
set pading [expr $lastline + $pading]
$log yview moveto [expr $offset.0 / $pading.0]
} else {
$log yview moveto $fraction
}
}
bind .tknmz.result.scroll <Key-1> {ShortCutReference 1}
bind .tknmz.result.scroll <Key-2> {ShortCutReference 2}
bind .tknmz.result.scroll <Key-3> {ShortCutReference 3}
bind .tknmz.result.scroll <Key-4> {ShortCutReference 4}
bind .tknmz.result.scroll <Key-5> {ShortCutReference 5}
bind .tknmz.result.scroll <Key-6> {ShortCutReference 6}
bind .tknmz.result.scroll <Key-7> {ShortCutReference 7}
bind .tknmz.result.scroll <Key-8> {ShortCutReference 8}
bind .tknmz.result.scroll <Key-9> {ShortCutReference 9}
}
proc URLViewer { url } {
global conf inside log
set gm [split [wm geometry .tknmz] x+]
set conf(WIDTH) [lindex $gm 0]
set conf(HIGTH) [lindex $gm 1]
set conf(commandline) "$conf(BROWSER) -dump -width=$conf(WIDTH) $url"
if {![string compare $inside(lynxauth) ""]} {
set urlviewer "$conf(BROWSER) -dump -width=$conf(WIDTH) $url"
} else {
set urlviewer "$conf(BROWSER) -dump -width=$conf(WIDTH) -auth=$inside(lynxauth) $url"
}
if [catch {open "|$urlviewer"} input] {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n"
$log insert end $input
catch {close $input}
$log see 1.0
$log config -relief raised -state disabled
$log config -cursor {}
update
} else {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n"
$log insert end [read $input]
catch {close $input}
$log see 1.0
$log config -relief raised -state disabled
}
RichEditControl
Mark $inside(keyword)
bind .tknmz.result.scroll <Key-1> {ShortCutJump 1}
bind .tknmz.result.scroll <Key-2> {ShortCutJump 2}
bind .tknmz.result.scroll <Key-3> {ShortCutJump 3}
bind .tknmz.result.scroll <Key-4> {ShortCutJump 4}
bind .tknmz.result.scroll <Key-5> {ShortCutJump 5}
bind .tknmz.result.scroll <Key-6> {ShortCutJump 6}
bind .tknmz.result.scroll <Key-7> {ShortCutJump 7}
bind .tknmz.result.scroll <Key-8> {ShortCutJump 8}
bind .tknmz.result.scroll <Key-9> {ShortCutJump 9}
}
proc InfoViewer { url node } {
global conf inside log but
if {![string compare $node ""]} {
set node {Top}
}
if {![file exists $url]} {
if {![file exists $url.gz]} {
MessageBox info ok "Error occurred" "$url: File not found."
return
} else {
append url ".gz"
}
}
set conf(gnuinfofile) "$url"
set conf(gnuinfotmp) "$conf(GNUINFOTMP).[pid]"
set conf(commandline) "$conf(GNUINFO) -f $url -o $conf(gnuinfotmp) -n \"$node\""
set infoviewer "$conf(GNUINFO) -f $url -o $conf(gnuinfotmp) -n \"$node\""
if {$conf(kanjimode)} {
set incode [kanji code $node]
if {[string compare $incode "ANY"]} {
set node [kanji conversion $incode JIS $node]
}
}
catch {exec $conf(GNUINFO) -f $url -o $conf(gnuinfotmp) -n "$node"} input
if {![file exists $conf(gnuinfotmp)]} {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n"
$log see 1.0
$log config -relief raised -state disabled
$log config -cursor {}
update
return
} else {
$log config -state normal
$log delete 1.0 end
catch {open "$conf(gnuinfotmp)"} input
$log insert end "%$conf(commandline)\n"
$log insert end [read $input]
catch {close $input}
$log see 1.0
$log config -relief raised -state disabled
}
file delete -force -- $conf(gnuinfotmp)
RichEditControl
Mark $inside(keyword)
bind .tknmz.result.scroll <Key-1> {ShortCutReference 1}
bind .tknmz.result.scroll <Key-2> {ShortCutReference 2}
bind .tknmz.result.scroll <Key-3> {ShortCutReference 3}
bind .tknmz.result.scroll <Key-4> {ShortCutReference 4}
bind .tknmz.result.scroll <Key-5> {ShortCutReference 5}
bind .tknmz.result.scroll <Key-6> {ShortCutReference 6}
bind .tknmz.result.scroll <Key-7> {ShortCutReference 7}
bind .tknmz.result.scroll <Key-8> {ShortCutReference 8}
bind .tknmz.result.scroll <Key-9> {ShortCutReference 9}
}
proc ManViewer { url } {
global conf inside log but
if {![file exists $url]} {
if {![file exists $url.gz]} {
MessageBox info ok "Error occurred" "$url: File not found."
return
} else {
append url ".gz"
}
}
set conf(manpagedir) "$url"
switch $conf(language) {
{ja} {
set conf(manpage) "$conf(MANPAGE) -man -Tnippon"
}
default {
set conf(manpage) "$conf(MANPAGE) -man -Tascii"
}
}
switch -regexp $url {
{.*\.gz$} {
set conf(commandline) "$conf(UNCOMPRESS) $url | $conf(manpage) $conf(MANPAGEFILTER)"
set manviewer "$conf(UNCOMPRESS) $url | $conf(manpage) $conf(MANPAGEFILTER)"
}
default {
set conf(commandline) "$conf(manpage) $url $conf(MANPAGEFILTER)"
set manviewer "$conf(manpage) $url $conf(MANPAGEFILTER)"
}
}
if [catch {open "|$manviewer"} input] {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n"
$log insert end $input
catch {close $input}
$log see 1.0
$log config -relief raised -state disabled
$log config -cursor {}
update
} else {
$log config -state normal
$log delete 1.0 end
$log insert end "%$conf(commandline)\n"
regsub -all {_|..|.} [read $input] {} line
catch {close $input}
$log insert end $line
$log see 1.0
$log config -relief raised -state disabled
}
RichEditControl
Mark $inside(keyword)
bind .tknmz.result.scroll <Key-1> {ShortCutReference 1}
bind .tknmz.result.scroll <Key-2> {ShortCutReference 2}
bind .tknmz.result.scroll <Key-3> {ShortCutReference 3}
bind .tknmz.result.scroll <Key-4> {ShortCutReference 4}
bind .tknmz.result.scroll <Key-5> {ShortCutReference 5}
bind .tknmz.result.scroll <Key-6> {ShortCutReference 6}
bind .tknmz.result.scroll <Key-7> {ShortCutReference 7}
bind .tknmz.result.scroll <Key-8> {ShortCutReference 8}
bind .tknmz.result.scroll <Key-9> {ShortCutReference 9}
}
proc RichEditControl {} {
global conf log
switch $conf(viewer) {
{gnuinfo} {
set pattern {http://[^ >)"`']*|file://[^ >)"`']*|ftp://[^ >)"`']*|\*.*::|^\*.*:.*\.|(Next|Prev|Up): [^,]*,|(Next|Prev|Up): [^,]*$}
}
{manpage} {
set pattern {http://[^ >)"`']*|file://[^ >)"`']*|ftp://[^ >)"`']*|[A-Za-z0-9_\-\.]+\([1-9lno][A-Za-z0-9]*\)}
}
{lynx} {
set pattern {http://[^ >)"`']*|file://[^ >)"`']*|ftp://[^ >)"`']*|\[[0-9]+\]}
}
default {
set pattern {http://[^ >)"`']*|file://[^ >)"`']*|ftp://[^ >)"`']*}
}
}
set cur 1.0
set i 1
set j 1
$log config -state normal
while 1 {
set cur [$log search -regexp -count length -- "$pattern" $cur end]
if {$cur == ""} {
break
}
set link [$log get $cur "$cur + $length char"]
if {($conf(viewer) == "lynx") \
&& [regexp {^\[} $link]} {
$log tag add jumper$j $cur "$cur + $length char"
$log tag configure jumper$j -underline true -foreground green3
$log tag bind jumper$j <Enter> {$log config -cursor hand2}
$log tag bind jumper$j <Leave> {$log config -cursor {} }
$log tag bind jumper$j <Button-1> {Jump {}}
incr j
}
if {($conf(viewer) == "gnuinfo") \
&& [regexp {^\*|^Next|^Prev|^Up} $link]} {
$log tag add kicker$i $cur "$cur + $length char"
$log tag configure kicker$i -underline true -foreground blue
$log tag bind kicker$i <Enter> {$log config -cursor hand2}
$log tag bind kicker$i <Leave> {$log config -cursor {} }
$log tag bind kicker$i <Button-1> {Browse {}}
incr i
}
if {($conf(viewer) == "manpage") \
&& [regexp {^[A-Za-z0-9_\-\.]+\(} $link]} {
$log tag add kicker$i $cur "$cur + $length char"
$log tag configure kicker$i -underline true -foreground blue
$log tag bind kicker$i <Enter> {$log config -cursor hand2}
$log tag bind kicker$i <Leave> {$log config -cursor {} }
$log tag bind kicker$i <Button-1> {Browse {}}
incr i
}
if {[regexp {^http:|^ftp:|^file:} $link]} {
$log tag add kicker$i $cur "$cur + $length char"
$log tag configure kicker$i -underline true -foreground blue
$log tag bind kicker$i <Enter> {$log config -cursor hand2}
$log tag bind kicker$i <Leave> {$log config -cursor {} }
$log tag bind kicker$i <Button-1> {Browse {}}
incr i
}
set cur [$log index "$cur + $length char"]
}
$log see 1.0
$log config -relief raised -state disabled
}
proc Mark { markwords } {
global conf log
if {$markwords == ""} {
return
}
regsub -nocase -all { \& | \| | \! |\( | \)| and | or | not } $markwords { } markwords
regsub -all { \+[a-z\-]+\:} $markwords { } markwords
regsub -all { \"|\" | \/|\/ | \{|\} |^\"|\"$|^\/|\/$|^\{|\}$} $markwords { } markwords
regsub -all {^ +| +$} $markwords {} markwords
regsub -all { +} $markwords { } markwords
$log config -state normal
foreach markword [split $markwords] {
set cur 1.0
while 1 {
set cur [$log search -nocase -count length -- "$markword" $cur end]
if {$cur == ""} {
break
}
$log tag add markit $cur "$cur + $length char"
set cur [$log index "$cur + $length char"]
}
}
$log tag configure markit -foreground red
$log config -relief raised -state disabled
}
proc Jump { ref } {
global conf log
$log config -cursor watch
update idletasks
if {![string compare $ref ""]} {
regexp {(jumper[0-9]+)} [$log tag names [$log index current]] match reftag
set ref [$log get $reftag.first $reftag.last]
regsub {\[([0-9]+)\]} $ref {\1} ref
}
$log tag remove references 0.0 end
set cur [$log search -regexp -- "^References$" 1.0 end]
if {$cur == ""} {
MessageBox info ok "Error occurred" "Referenses not found. ;-("
focus .tknmz.result.scroll
return
}
set cur [$log search -regexp -count length -- "^ *$ref\. .*" $cur end]
$log tag add references $cur "$cur + $length char"
set cur [$log index "$cur + $length char"]
$log tag configure references -foreground green3
$log tag raise references
$log see $cur
if {$conf(SMARTBROWSE) != 0} {
regsub {^([0-9]+)\.[0-9]+} $cur {\1} refx
set localsite {}
if {$conf(LOCALSITES) != ""} {
foreach sites [split $conf(LOCALSITES)] {
append localsite "|$sites"
}
}
switch $conf(SMARTBROWSE) {
{1} {
set cur [$log search -regexp -- \
"file://|http://localhost|http://127.0.0.1$localsite" $refx.0 end]
}
default {
set cur [$log search -regexp -- "file://|http://|ftp://|mailto:" \
$refx.0 end]
}
}
regsub {^([0-9]+)\.[0-9]+} $cur {\1} urltagx
if {$refx == $urltagx} {
regexp {(kicker[0-9]+)} [$log tag names [$log index $cur]] \
match urltag
set url [$log get $urltag.first $urltag.last]
if {$url != ""} {
Browse $url
}
}
}
$log config -cursor {}
update
}
proc ShortCutReference { i } {
global log
if {[$log tag ranges kicker$i] != ""} {
set url [$log get kicker$i.first kicker$i.last]
Browse $url
}
}
proc ShortCutJump { i } {
global log
if {[$log tag ranges jumper$i] != ""} {
set url [$log get jumper$i.first jumper$i.last]
Jump $url
}
}
proc MakeOptions {} {
global conf selnmzidx opt
regsub -all { \-\-all| \-\-max\=[0-9]+| \-\-short| \-\-late| \-\-early| \-\-sort\=[a-z\:]+| \-\-ascending} $conf(OPTIONS) {} conf(OPTIONS)
if {$opt(n) == "ALL"} {
append conf(OPTIONS) " --all"
} else {
append conf(OPTIONS) " --max=$opt(n)"
}
if {$opt(s) == "ON"} {
append conf(OPTIONS) ""
} else {
append conf(OPTIONS) " --short"
}
switch $opt(l) {
{late} {
append conf(OPTIONS) " --late"
}
{early} {
append conf(OPTIONS) " --early"
}
{subject:ascending} {
append conf(OPTIONS) " --sort=field:subject --ascending"
}
{subject:descending} {
append conf(OPTIONS) " --sort=field:subject"
}
{from:ascending} {
append conf(OPTIONS) " --sort=field:from --ascending"
}
{from:descending} {
append conf(OPTIONS) " --sort=field:from"
}
{size:ascending} {
append conf(OPTIONS) " --sort=field:size --ascending"
}
{size:descending} {
append conf(OPTIONS) " --sort=field:size"
}
{uri:ascending} {
append conf(OPTIONS) " --sort=field:uri --ascending"
}
{uri:descending} {
append conf(OPTIONS) " --sort=field:uri"
}
default {
append conf(OPTIONS) ""
}
}
if {$conf(NAMAZURC) != ""} {
regsub -all { \-\-config\=[^ ]+} $conf(OPTIONS) {} conf(OPTIONS)
append conf(OPTIONS) " --config=$conf(NAMAZURC)"
}
if {$conf(INDEXOUTPUTDIR) != ""} {
regsub -all { \-O [^ ]+} $conf(MKOPTIONS) {} conf(MKOPTIONS)
append conf(MKOPTIONS) " -O $conf(INDEXOUTPUTDIR)"
}
set conf(initflag) 1
foreach nmzidx [array names selnmzidx] {
if {$selnmzidx($nmzidx)} {
if {$conf(initflag)} {
set conf(INDEXES) {}
set conf(initflag) 0
}
regexp {^([^ ]+) +(.*)$} $conf($nmzidx) match title value
append conf(INDEXES) " $value"
}
}
}
proc MakeFormOptions {} {
global conf opt selnmzidx
set conf(optionsurl) {}
set conf(indexesurl) {}
if {$opt(n) == "ALL"} {
append conf(optionsurl) "&max=100"
} else {
append conf(optionsurl) "&max=$opt(n)"
}
if {$opt(s) == "ON"} {
append conf(optionsurl) "&result=normal"
} else {
append conf(optionsurl) "&result=short"
}
switch $opt(l) {
{late} {
append conf(optionsurl) "&sort=date%3Alate"
}
{early} {
append conf(optionsurl) "&sort=date%3Aearly"
}
{subject:ascending} {
append conf(optionsurl) "&sort=field%3Asubject%3Aascending"
}
{subject:descending} {
append conf(optionsurl) "&sort=field%3Asubject%3Adescending"
}
{from:ascending} {
append conf(optionsurl) "&sort=field%3Afrom%3Aascending"
}
{from:descending} {
append conf(optionsurl) "&sort=field%3Afrom%3Adescending"
}
{size:ascending} {
append conf(optionsurl) "&sort=field%3Asize%3Aascending"
}
{size:descending} {
append conf(optionsurl) "&sort=field%3Asize%3Adescending"
}
{uri:ascending} {
append conf(optionsurl) "&sort=field%3Auri%3Aascending"
}
{uri:descending} {
append conf(optionsurl) "&sort=field%3Auri%3Adescending"
}
default {
append conf(optionsurl) "&sort=score"
}
}
set conf(initflag) 1
foreach nmzidx [array names selnmzidx] {
if {$selnmzidx($nmzidx)} {
if {$conf(initflag)} {
set conf(indexesurl) {}
set conf(initflag) 0
}
regexp {^([^ ]+) +(.*)$} $conf($nmzidx) match title value
append conf(indexesurl) "&$value"
}
}
append conf(optionsurl) {&mode=tknamazu&whence=0}
}
proc OpenViewer {} {
global conf
set openlocation [tk_getOpenFile -filetypes {{ALL {*}}}]
if {$openlocation == ""} {
return
}
Browse $openlocation
}
proc OpenURL {} {
global conf openurl urllocation
if [winfo exists .openurl] {
raise .openurl
focus .openurl.entry
return
} else {
toplevel .openurl -borderwidth 10
wm title .openurl "TkNamazu open URL dialog"
wm iconname .openurl "tknamazu"
wm transient .openurl [winfo toplevel [winfo parent .openurl]]
set x [expr [winfo screenwidth .openurl]/2 - [winfo reqwidth .openurl]/2]
set y [expr [winfo screenheight .openurl]/2 - [winfo reqheight .openurl]/2]
wm geom .openurl +$x+$y
}
frame .openurl.entry
label .openurl.entry.ulabel -text {URL:}
entry .openurl.entry.entry -textvariable urllocation -width 70 \
-font $conf(WIDGETFONT)
pack .openurl.entry.ulabel .openurl.entry.entry -side left
frame .openurl.buttons
pack .openurl.entry .openurl.buttons -side top -fill x
button .openurl.buttons.ok -text OK -command {set openurl(ok) 1} \
-underline 0
button .openurl.buttons.cancel -text Cancel -command {set openurl(ok) 0} \
-underline 0
pack .openurl.buttons.cancel .openurl.buttons.ok -side right
bind .openurl <Alt-o> "focus .openurl.buttons.ok ; break"
bind .openurl <Alt-c> "focus .openurl.buttons.cancel ; break"
bind .openurl <Alt-Key> break
bind .openurl <Return> {set openurl(ok) 1}
bind .openurl <Escape> {set openurl(ok) 0}
bind .openurl <Button-3> {PopupMenu %X %Y}
SetColor {.openurl}
while 1 {
focus .openurl.entry.entry
tkwait variable openurl(ok)
if {$openurl(ok)} {
Browse $urllocation
} else {
break
}
}
focus .tknmz.result.scroll
catch {destroy .openurl}
}
proc SaveFile {} {
global conf log
set openlocation [tk_getSaveFile -filetypes {{ALL {*}}}]
if {![string compare $openlocation ""]} {
return
}
set savefile [open $openlocation "w"]
puts $savefile [$log get 2.0 end]
catch {close $savefile}
}
proc MakeNamazuIndexLuncher {} {
global conf selnmzidx
menu .tknmz.file.menu.selnmzidx
wm title .tknmz.file.menu ""
foreach nmzidx [lsort [array names conf]] {
if [regexp {^INDEXES([0-9]+)$|^DATABASES([0-9]+)$} $nmzidx ] {
regexp {^([^ ]+) +(.*)$} $conf($nmzidx) match title value
.tknmz.file.menu.selnmzidx add check -label $title \
-font $conf(WIDGETFONT) -variable selnmzidx($nmzidx) -selectcolor blue
}
}
.tknmz.file.menu.selnmzidx add separator
.tknmz.file.menu.selnmzidx add command -label {Select All} -underline 0 \
-font $conf(WIDGETFONT) -command {SelectAll}
.tknmz.file.menu.selnmzidx add command -label {Clear All} -underline 0 \
-font $conf(WIDGETFONT) -command {ClearAll}
.tknmz.file.menu.selnmzidx add command -label {Add Index} -underline 0 \
-font $conf(WIDGETFONT) -command {AddNamazuIndex}
.tknmz.file.menu.selnmzidx add command -label {Delete Index} -underline 0 \
-font $conf(WIDGETFONT) -command {DelNamazuIndex}
SetColor {.tknmz.file.menu.selnmzidx}
}
proc MakeBookMarkLuncher {} {
global conf bookmark
menu .tknmz.go.menu.selbookmark
wm title .tknmz.go.menu ""
foreach bookmark [lsort [array names conf]] {
if [regexp {^BOOKMARKS([0-9]+)$} $bookmark ] {
regexp {^([^ ]+) +(.*)$} $conf($bookmark) match title value
.tknmz.go.menu.selbookmark add command -label $title \
-command [list Browse $value]
}
}
.tknmz.go.menu.selbookmark add separator
.tknmz.go.menu.selbookmark add command -label {Add BookMark} -underline 0 \
-font $conf(WIDGETFONT) -command {AddBookMark}
.tknmz.go.menu.selbookmark add command -label {Delete BookMark} -underline 0 \
-font $conf(WIDGETFONT) -command {DelBookMark}
.tknmz.go.menu.selbookmark add command -label {Inport BookMark} -underline 0 \
-font $conf(WIDGETFONT) -command {InportBookMark}
SetColor {.tknmz.go.menu.selbookmark}
}
proc MakeNamazuSiteSelector {} {
global conf siteurl nmzsite nmzsites
set nmzsites {commandline}
foreach nmzsite [lsort [array names conf]] {
if [regexp {^NAMAZUSITES([0-9]+)$} $nmzsite ] {
regexp {^([^ ]+) +(.*)$} $conf($nmzsite) match title value
lappend nmzsites $title
set siteurl($title) $value
}
}
eval tk_optionMenu .tknmz.optionbar.options.opt2.siteselector conf(nmzsite) $nmzsites
SetColor {.tknmz.optionbar.options.opt2.siteselector}
}
proc SelectAll {} {
global selnmzidx
foreach nmzidx [array names selnmzidx] {
set selnmzidx($nmzidx) 1
}
}
proc ClearAll {} {
global selnmzidx
foreach nmzidx [array names selnmzidx] {
set selnmzidx($nmzidx) 0
}
}
proc AddNamazuIndex {} {
global conf selnmzidx
set openlocation [tk_getOpenFile -filetypes {{NMZ.i} {ALL {*}}}]
if {$openlocation == ""} {
return
}
regsub {^(.*)/NMZ.i} $openlocation {\1} openlocation
regexp {^.*/([^/]+)$} $openlocation match opentitle
set max 1
foreach nmzidx [array names selnmzidx] {
regexp {^INDEXES([0-9]+)$} $nmzidx match i
if {$i > $max} {
set max $i
}
}
incr max
set conf(INDEXES$max) "$opentitle $openlocation"
catch {destroy .tknmz.file.menu.selnmzidx}
MakeNamazuIndexLuncher
}
proc LoadConf {} {
global conf
set conf(NAMAZURC) [tk_getOpenFile -filetypes {{ALL {*}}}]
}
proc SetAuthorization {} {
global conf auth login password
if [winfo exists .auth] {
raise .auth
focus .auth.login.entry
return
} else {
toplevel .auth -borderwidth 10
wm title .auth "TkNamazu authorization dialog"
wm iconname .auth "tknamazu"
wm transient .auth [winfo toplevel [winfo parent .auth]]
set x [expr [winfo screenwidth .auth]/2 - [winfo reqwidth .auth]/2]
set y [expr [winfo screenheight .auth]/2 - [winfo reqheight .auth]/2]
wm geom .auth +$x+$y
}
frame .auth.login
label .auth.login.msg -borderwidth 10 -text {Login:} -width 10
entry .auth.login.entry -textvariable login -width 17 \
-font $conf(WIDGETFONT)
pack .auth.login.msg .auth.login.entry -side left -fill x
frame .auth.password
label .auth.password.msg -borderwidth 10 -text {Password:} -width 10
entry .auth.password.entry -textvariable password -width 17 \
-font $conf(WIDGETFONT)
pack .auth.password.msg .auth.password.entry -side left -fill x
frame .auth.buttons -bd 10
pack .auth.login .auth.password .auth.buttons -side top -fill x
button .auth.buttons.ok -text OK -command {set auth(ok) 1} -underline 0
button .auth.buttons.cancel -text Cancel -command {set auth(ok) 0} \
-underline 0
pack .auth.buttons.cancel .auth.buttons.ok -side right
bind .auth <Alt-o> "focus .auth.buttons.ok ; break"
bind .auth <Alt-c> "focus .auth.buttons.cancel ; break"
bind .auth <Alt-Key> break
bind .auth <Return> {set auth(ok) 1}
bind .auth <Escape> {set auth(ok) 0}
bind .auth <Button-3> {PopupMenu %X %Y}
SetColor {.auth}
while 1 {
focus .auth.login.entry
tkwait variable auth(ok)
if {($auth(ok)) && ($login != "")} {
set inside(lynxauth) "$login:$password"
break
} else {
set inside(lynxauth) {}
MessageBox info ok "Clear" "Clear input authorization."
break
}
}
focus .tknmz.result.scroll
catch {destroy .auth}
}
proc RegexpKeywords { regexpkeywords } {
regsub -nocase -all { \& | \| | \! |\( | \)| and | or | not } $regexpkeywords { } regexpkeywords
regsub -all { \+[a-z\-]+\:} $regexpkeywords { } regexpkeywords
regsub -all { \"|\" | \/|\/ | \{|\} |^\"|\"$|^\/|\/$|^\{|\}$} $regexpkeywords { } regexpkeywords
regsub -all {^ +| +$} $regexpkeywords {} regexpkeywords
regsub -all { +} $regexpkeywords {|} regexpkeywords
return $regexpkeywords
}
proc FindWord {} {
global conf inside log prompt findword
if [winfo exists .prompt] {
raise .prompt
focus .prompt.entry.entry
return
} else {
toplevel .prompt
wm title .prompt "TkNamazu find dialog"
wm iconname .prompt "tknamazu"
set x [expr [winfo screenwidth .prompt]/2 - [winfo reqwidth .prompt]/2]
set y [expr [winfo screenheight .prompt]/2 - [winfo reqheight .prompt]/2]
wm geom .prompt +$x+$y
}
set prompt(aspect) 1
label .prompt.msg -borderwidth 10 -text {Please input pattern.}
frame .prompt.entry
entry .prompt.entry.entry -textvariable findword -width 32 \
-font $conf(WIDGETFONT)
button .prompt.entry.clear -text Clear -command {set findword {}} \
-underline 1
pack .prompt.entry.entry .prompt.entry.clear -side left -fill x
frame .prompt.buttons -bd 10
button .prompt.buttons.ok -text OK -command {set prompt(ok) 1} \
-underline 0
button .prompt.buttons.cancel -text Cancel -command {set prompt(ok) 0} \
-underline 0
pack .prompt.buttons.cancel .prompt.buttons.ok -side right
button .prompt.buttons.thoughtful -text toRegexp -underline 0 \
-command {set findword [RegexpKeywords $findword]; set prompt(regexp) 1} \
pack .prompt.buttons.thoughtful -side left
frame .prompt.options
checkbutton .prompt.options.nocase -text nocase -variable prompt(nocase) \
-font $conf(WIDGETFONT) -selectcolor blue -underline 0
checkbutton .prompt.options.regexp -text regexp -variable prompt(regexp) \
-font $conf(WIDGETFONT) -selectcolor blue -underline 0
radiobutton .prompt.options.forward -text forward -variable prompt(aspect) \
-font $conf(WIDGETFONT) -selectcolor blue -underline 0 -value 1
radiobutton .prompt.options.backward -text backward -variable prompt(aspect) \
-font $conf(WIDGETFONT) -selectcolor blue -underline 0 -value 0
pack .prompt.options.nocase .prompt.options.regexp \
.prompt.options.forward .prompt.options.backward -side left
pack .prompt.msg .prompt.entry .prompt.options .prompt.buttons -side top -fill x
if {![catch {selection get} sel]} {
.prompt.entry.entry delete 0 end
.prompt.entry.entry insert insert [selection get -selection PRIMARY]
} else {
.prompt.entry.entry delete 0 end
switch $conf(THOUGHTFULFIND) {
{1} {
set findword $inside(keyword)
}
{2} {
set prompt(regexp) 1
set findword [RegexpKeywords $inside(keyword)]
}
{3} {
set prompt(regexp) 1
set prompt(nocase) 1
set findword [RegexpKeywords $inside(keyword)]
}
}
}
bind .prompt <Alt-l> "focus .prompt.entry.clear ; break"
bind .prompt <Alt-r> "focus .prompt.options.regexp ; break"
bind .prompt <Alt-n> "focus .prompt.options.nocase ; break"
bind .prompt <Alt-f> "focus .prompt.options.forward ; break"
bind .prompt <Alt-b> "focus .prompt.options.backward ; break"
bind .prompt <Alt-t> "focus .prompt.buttons.thoughtful ; break"
bind .prompt <Alt-o> "focus .prompt.buttons.ok ; break"
bind .prompt <Alt-c> "focus .prompt.buttons.cancel ; break"
bind .prompt <Alt-Key> break
bind .prompt <Return> {set prompt(ok) 1}
bind .prompt <Escape> {set prompt(ok) 0}
bind .prompt <Button-3> {PopupMenu %X %Y}
SetColor {.prompt}
set cur 1.0
while 1 {
focus .prompt.entry.entry
tkwait variable prompt(ok)
set options {}
if {$prompt(ok)} {
if {$prompt(nocase)} {
append options { -nocase}
}
if {$prompt(regexp)} {
if {$conf(kanjimode)} {
if {[string compare [kanji code $findword] "ANY"]} {
MessageBox info ok "Error occurred" \
"regexp no support in japanes"
set prompt(regexp) 0
} else {
append options { -regexp}
}
} else {
append options { -regexp}
}
}
if {[eval "$log search $options -forwards -- {$findword} 1.0 end"] == ""} {
MessageBox info ok "Error occurred" "Pattern not found. ;-("
} else {
$log tag remove find 0.0 end
if {$prompt(aspect)} {
set cur [eval "$log search $options -forwards -count length \
-- {$findword} $cur end"]
if {$cur == ""} {
set cur 1.0
set cur [eval "$log search $options -forwards -count length \
-- {$findword} $cur end"]
MessageBox info ok "Last line" "I scanned all text."
}
$log tag add find $cur "$cur + $length char"
set cur [$log index "$cur + $length char"]
$log tag configure find -foreground red -background blue
$log tag raise find
$log see $cur
} else {
set cur [eval "$log search $options -backwards -count length \
-- {$findword} $cur 1.0"]
if {$cur == ""} {
set cur end
set cur [eval "$log search $options -backwards -count length \
-- {$findword} $cur 1.0"]
MessageBox info ok "Last line" "I scanned all text."
}
$log tag add find $cur "$cur + $length char"
set cur [$log index "$cur - $length char"]
$log tag configure find -foreground red -background blue
$log tag raise find
$log see $cur
}
}
} else {
$log tag remove find 0.0 end
break
}
}
focus .tknmz.result.scroll
catch {destroy .prompt}
Mark $inside(keyword)
}
proc LoadTknmzrc {} {
global log conf selnmzidx
set tknamazurc [tk_getOpenFile -filetypes {{ALL {*}}}]
if [catch {open "$tknamazurc"} input] {
catch {close($input)}
return
} else {
$log config -state normal
$log delete 1.0 end
foreach line [split [read $input] \n] {
if [regexp {^([^#][0-9A-Z]*)( | )+(.*)$} $line match item dummy value] {
$log insert end "$item : $value\n"
}
}
catch {close $input}
$log config -relief raised -state disabled
update
}
set answer [DialogBox .loadtknamazurc {Make sure} \
"Are you load this parameters? " question 1 {Yes} {No} ]
if {$answer == 1} {
return
}
if [catch {open "$tknamazurc"} input] {
$log insert end $input
catch {close $input}
return
} else {
set answer [DialogBox .eraseenv {Make sure} \
"Are you erase old parameters? " question 1 {Yes} {No} ]
if {$answer == 0} {
unset conf
unset selnmzidx
}
foreach line [split [read $input] \n] {
if [regexp {^([^#][0-9A-Z]*)( | )+(.*)$} $line match item dummy value] {
set conf($item) "$value"
}
}
catch {close $input}
catch {destroy .tknmz.file.menu.selnmzidx}
MakeNamazuIndexLuncher
catch {destroy .tknmz.go.menu.selbookmark}
MakeBookMarkLuncher
}
}
proc DisplayConfiguration {} {
global log conf version env
$log config -state normal
$log delete 1.0 end
$log insert end "# TkNamazu version $version\n"
$log insert end "# Date : [clock format [clock seconds]]\n"
foreach item [lsort [array names conf]] {
$log insert end "$item: $conf($item)\n"
}
$log config -relief raised -state disabled
update
if [catch {open "|$conf(BROWSER) -version"} input] {
catch {close $input}
$log config -state normal
$log insert end "#$conf(BROWSER):Command not found.\n"
$log config -relief raised -state disabled
update
} else {
$log config -state normal
foreach line [split [read $input] \n] {
$log insert end "#$line\n"
}
catch {close($input)}
$log config -relief raised -state disabled
update
}
if [catch {open "|$conf(GNUINFO) --version"} input] {
catch {close $input}
$log config -state normal
$log insert end "#$conf(GNUINFO):Command not found.\n"
$log config -relief raised -state disabled
update
} else {
$log config -state normal
foreach line [split [read $input] \n] {
$log insert end "#$line\n"
}
catch {close $input}
$log config -relief raised -state disabled
update
}
if [catch {open "|$conf(NAMAZU) -v"} input] {
catch {close $input}
$log config -state normal
$log insert end "#$conf(NAMAZU):Command not found.\n"
$log config -relief raised -state disabled
update
} else {
$log config -state normal
foreach line [split [read $input] \n] {
$log insert end "#$line\n"
}
catch {close $input}
$log config -relief raised -state disabled
update
}
}
proc CopyString {} {
if [catch {selection get} sel] {
return
}
if {[selection own] != ""} {
clipboard clear
clipboard append [selection get]
}
}
proc CopyURL {} {
global inside
if {$inside(clippedurl) != ""} {
clipboard clear
clipboard append $inside(clippedurl)
}
}
proc CutString {} {
set widget [focus]
if {[catch {selection get} sel] || ![regexp {\.tknmz\.result\.log|\.tknmz\.keyword} $widget]} {
return
}
if {[selection own] != ""} {
clipboard clear
clipboard append [selection get]
$widget delete sel.first sel.last
}
}
proc PasteString { widget } {
if {![string compare $widget ""]} {
set widget [focus]
}
if {![winfo exists $widget] || \
![regexp {\.tknmz\.result\.log|\.tknmz\.keyword|\.prompt\.entry\.entry|\.openurl\.entry\.entry|\.auth\.entry} $widget]} {
return
}
if [catch {selection get} sel] {
if [catch {selection get -selection CLIPBOARD} sel] {
return
}
}
if {[regexp {\.tknmz\.keyword|\.prompt\.entry\.entry} $widget]} {
$widget insert insert " $sel "
} else {
$widget insert insert "$sel"
}
}
proc FastExec {} {
global inside
if [catch {selection get} sel] {
return
}
set inside(keyword) [selection get]
Exec [selection get]
}
proc SetColor { w } {
global conf
catch {$w config -background $conf(WIDGETCOLOR)}
catch {$w config -troughcolor $conf(WIDGETCOLOR)}
catch {$w config -highlightbackground $conf(WIDGETCOLOR)}
foreach child [winfo children $w] {
SetColor $child
}
}
proc MessageBox { icon type title message } {
tk_messageBox -icon $icon -type $type -title $title -message $message
}
proc DialogBox {w title text bitmap default args} {
global tkPriv conf
catch {destroy $w}
toplevel $w -class Dialog
wm title $w $title
wm iconname $w Dialog
wm protocol $w WM_DELETE_WINDOW { }
wm transient $w [winfo toplevel [winfo parent $w]]
frame $w.bot -relief raised -bd 1 -background $conf(WIDGETCOLOR)
pack $w.bot -side bottom -fill both
frame $w.top -relief raised -bd 1 -background $conf(WIDGETCOLOR)
pack $w.top -side top -fill both -expand 1
option add *Dialog.msg.wrapLength 3i widgetDefault
label $w.msg -justify left -text $text -bg $conf(WIDGETCOLOR)
catch {$w.msg configure -font \
-Adobe-Times-Medium-R-Normal--*-180-*-*-*-*-*-*
}
pack $w.msg -in $w.top -side right -expand 1 -fill both -padx 3m -pady 3m
if {$bitmap != ""} {
label $w.bitmap -bitmap $bitmap -bg $conf(WIDGETCOLOR)
pack $w.bitmap -in $w.top -side left -padx 3m -pady 3m
}
set i 0
foreach but $args {
button $w.button$i -text $but -command "set tkPriv(button) $i" -bg $conf(WIDGETCOLOR)
if {$i == $default} {
frame $w.default -relief sunken -bd 1 -background $conf(WIDGETCOLOR)
raise $w.button$i $w.default
pack $w.default -in $w.bot -side left -expand 1 -padx 3m -pady 2m
pack $w.button$i -in $w.default -padx 2m -pady 2m
} else {
pack $w.button$i -in $w.bot -side left -expand 1 \
-padx 3m -pady 2m
}
incr i
}
if {$default >= 0} {
bind $w <Return> "
$w.button$default configure -state active -relief sunken
update idletasks
after 100
set tkPriv(button) $default
"
}
bind $w <Destroy> {set tkPriv(button) -1}
wm withdraw $w
update idletasks
set x [expr [winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
- [winfo vrootx [winfo parent $w]]]
set y [expr [winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
- [winfo vrooty [winfo parent $w]]]
wm geom $w +$x+$y
wm deiconify $w
# 7. Set a grab and claim the focus too.
set oldFocus [focus]
set oldGrab [grab current $w]
if {$oldGrab != ""} {
set grabStatus [grab status $oldGrab]
}
grab $w
if {$default >= 0} {
focus $w.button$default
} else {
focus $w
}
tkwait variable tkPriv(button)
catch {focus $oldFocus}
catch {
bind $w <Destroy> {}
destroy $w
}
if {$oldGrab != ""} {
if {$grabStatus == "global"} {
grab -global $oldGrab
} else {
grab $oldGrab
}
}
return $tkPriv(button)
}
proc PopupMenu { x y } {
global log conf inside
if [winfo exists .popupmenu] {
catch {destroy .popupmenu}
} else {
after 100 {grab .popupmenu}
}
set inside(clippedurl) {}
if [regexp {(kicker[0-9]+)} [$log tag names [$log index current]] match urltag] {
set inside(clippedurl) [$log get $urltag.first $urltag.last]
}
menu .popupmenu -tearoff no
.popupmenu add command -label {Search this} -underline 0 \
-command {FastExec} -font $conf(WIDGETFONT)
.popupmenu add separator
.popupmenu add command -label {Copy and Paste to Keyword} -underline 18 \
-command {CopyString ; PasteString {.tknmz.keyword}} -font $conf(WIDGETFONT)
.popupmenu add command -label {Copy and Paste to Findword} -underline 18 \
-command {FindWord ; CopyString ; PasteString {.prompt.entry.entry}} -font $conf(WIDGETFONT)
.popupmenu add command -label {Copy this URL} -underline 11 \
-command {CopyURL} -font $conf(WIDGETFONT)
.popupmenu add separator
.popupmenu add command -label {Copy} -underline 0 \
-command {CopyString} -font $conf(WIDGETFONT)
.popupmenu add command -label {Paste} -underline 0 \
-command {PasteString {}} -font $conf(WIDGETFONT)
.popupmenu add command -label {Cut} -underline 1 \
-command {CutString} -font $conf(WIDGETFONT)
.popupmenu add command -label {Editable} -underline 0 \
-command {$log config -state normal -relief sunken } -font $conf(WIDGETFONT)
.popupmenu add separator
.popupmenu add command -label {External Browser or Viewer} -underline 1 \
-command {Kick $inside(clippedurl) {} {}} -font $conf(WIDGETFONT)
.popupmenu add command -label {Other TkNamazu} -underline 1 \
-command {catch {open "|$conf(argv0) $inside(clippedurl)"}} \
-font $conf(WIDGETFONT)
.popupmenu add separator
.popupmenu add command -label {Quit} -underline 0 \
-command {Quit} -font $conf(WIDGETFONT)
SetColor {.popupmenu}
update
tk_popup .popupmenu $x $y
}
proc PopupMenu2 { x y } {
global conf inside log
if [winfo exists .popupmenu2] {
catch {destroy .popupmenu2}
} else {
after 100 {grab .popupmenu2}
}
menu .popupmenu2 -tearoff no
.popupmenu2 add command -label {0} -underline 0 \
-command {Exec $inside(keyword)} -font $conf(WIDGETFONT)
if {($conf(viewer) == "lynx")} {
.popupmenu2 add command -label {1} -underline 0 \
-command {ShortCutJump 1} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {2} -underline 0 \
-command {ShortCutJump 2} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {3} -underline 0 \
-command {ShortCutJump 3} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {4} -underline 0 \
-command {ShortCutJump 4} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {5} -underline 0 \
-command {ShortCutJump 5} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {6} -underline 0 \
-command {ShortCutJump 6} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {7} -underline 0 \
-command {ShortCutJump 7} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {8} -underline 0 \
-command {ShortCutJump 8} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {9} -underline 0 \
-command {ShortCutJump 9} -font $conf(WIDGETFONT)
} else {
.popupmenu2 add command -label {1} -underline 0 \
-command {ShortCutReference 1} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {2} -underline 0 \
-command {ShortCutReference 2} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {3} -underline 0 \
-command {ShortCutReference 3} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {4} -underline 0 \
-command {ShortCutReference 4} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {5} -underline 0 \
-command {ShortCutReference 5} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {6} -underline 0 \
-command {ShortCutReference 6} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {7} -underline 0 \
-command {ShortCutReference 7} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {8} -underline 0 \
-command {ShortCutReference 8} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {9} -underline 0 \
-command {ShortCutReference 9} -font $conf(WIDGETFONT)
}
.popupmenu2 add separator
.popupmenu2 add command -label {To Top} -underline 3 \
-command {$log see 1.0} -font $conf(WIDGETFONT)
.popupmenu2 add command -label {To Bottom} -underline 3 \
-command {$log see end} -font $conf(WIDGETFONT)
.popupmenu2 add separator
.popupmenu2 add command -label {Help} -underline 0 \
-command {HelpView} -font $conf(WIDGETFONT)
.popupmenu2 add separator
.popupmenu2 add cascade -label {Bookmark} -underline 4 \
-menu .popupmenu2.selbookmark -font $conf(WIDGETFONT)
menu .popupmenu2.selbookmark -tearoff no
foreach bookmark [array names conf] {
if [regexp {^BOOKMARKS([0-9]+)$} $bookmark ] {
regexp {^([^ ]+) +(.*)$} $conf($bookmark) match title value
.popupmenu2.selbookmark add command -label $title \
-command [list Browse $value]
}
}
SetColor {.popupmenu2}
update
tk_popup .popupmenu2 $x $y
}
proc Quit {} {
global conf inside answer
if [winfo exists .quit] {
raise .quit
return
} else {
toplevel .quit
wm title .quit "TkNamazu Quit dialog"
wm iconname .quit "tknamazu"
wm protocol .quit WM_DELETE_WINDOW { }
set x [expr [winfo screenwidth .quit]/2 - [winfo reqwidth .quit]/2]
set y [expr [winfo screenheight .quit]/2 - [winfo reqheight .quit]/2]
wm geom .quit +$x+$y
after 100 {grab .quit}
}
label .quit.msg -borderwidth 10 -text {Really? ;-(}
frame .quit.buttons -bd 10
button .quit.buttons.yes -text Yes -command {set answer 1} \
-underline 0
button .quit.buttons.no -text No -command {set answer 0} \
-underline 0
pack .quit.buttons.no .quit.buttons.yes -side right
pack .quit.msg .quit.buttons -side top -fill x
SetColor {.quit}
while 1 {
focus .quit.buttons.no
tkwait variable answer
if {$answer == 1} {
grab release .quit
destroy .tknmz
focus $inside(oldfocus)
exit
} else {
break
}
}
focus .tknmz.result.scroll
catch {destroy .quit}
Mark $inside(keyword)
}
proc HelpView {} {
global conf inside log
$log config -cursor watch
update idletasks
set conf(viewer) {lynx}
if {[file exists $conf(tknmzhome)/tknamazu.hlp.$conf(LANG)]} {
Viewer "$conf(tknmzhome)/tknamazu.hlp.$conf(LANG)" {}
} elseif {[file exists $conf(tknmzhome)/tknamazu.hlp.$conf(language)]} {
Viewer "$conf(tknmzhome)/tknamazu.hlp.$conf(language)" {}
} elseif {[file exists $conf(tknmzhome)/tknamazu.hlp.en]} {
Viewer "$conf(tknmzhome)/tknamazu.hlp.en" {}
}
Mark {TKNAMAZU ^^}
$log config -cursor {}
update
bind .tknmz.result.scroll <Key-1> {ShortCutJump 1}
bind .tknmz.result.scroll <Key-2> {ShortCutJump 2}
bind .tknmz.result.scroll <Key-3> {ShortCutJump 3}
bind .tknmz.result.scroll <Key-4> {ShortCutJump 4}
bind .tknmz.result.scroll <Key-5> {ShortCutJump 5}
bind .tknmz.result.scroll <Key-6> {ShortCutJump 6}
bind .tknmz.result.scroll <Key-7> {ShortCutJump 7}
bind .tknmz.result.scroll <Key-8> {ShortCutJump 8}
bind .tknmz.result.scroll <Key-9> {ShortCutJump 9}
}
proc AboutTknamazu {} {
global version conf
if [winfo exists .about] {
raise .about
focus .about.ok.b
return
} else {
toplevel .about
wm title .about "TkNamazu about"
wm iconname .about "tknamazu"
set x [expr [winfo screenwidth .about]/2 - [winfo reqwidth .about]/2]
set y [expr [winfo screenheight .about]/2 - [winfo reqheight .about]/2]
wm geom .about +$x+$y
after 100 {grab .about}
}
frame .about.msg1 -relief flat -borderwidth 2 -bg white
image create photo tknmzlogo -file "$conf(tknmzhome)/tknamazu_logo.ppm"
pack .about.msg1 -fill both
label .about.msg1.title1 -text {Tcl/Tk Namazu client} \
-font $conf(WIDGETFONT) -background white
label .about.msg1.title2 -text "version $version" \
-font $conf(WIDGETFONT) -background white
button .about.msg1.title3 -image tknmzlogo -background white \
-highlightbackground white -command {HelpView ; Jump {0}}
label .about.msg1.title4 -text {- GPL2 software -} \
-font $conf(WIDGETFONT) -background white
label .about.msg1.title5 -text {Copyright (C) 1998} \
-font $conf(WIDGETFONT) -background white
label .about.msg1.title6 -text {Ken-ichi Hirose.} \
-font $conf(WIDGETFONT) -background white
label .about.msg1.title7 -text {All rights reserved.} \
-font $conf(WIDGETFONT) -background white
pack .about.msg1.title1 .about.msg1.title2
pack .about.msg1.title3
pack .about.msg1.title4 .about.msg1.title5 .about.msg1.title6 .about.msg1.title7
frame .about.info -bg white
pack .about.info -fill both
set m1 {.about.info.list1}
set m2 {.about.info.list2}
listbox $m1 -bg white -height 7 -width 12 -font $conf(WIDGETFONT) -borderwidth 0
$m1 insert end "TKNMZPATH"
$m1 insert end "HOME"
$m1 insert end "Tcl/Tk"
$m1 insert end "PatchLevel"
$m1 insert end "OS"
$m1 insert end "Machine"
$m1 insert end "Platform"
listbox $m2 -bg white -height 7 -width 28 -font $conf(WIDGETFONT) -borderwidth 0
$m2 insert end $conf(tknmzhome)
$m2 insert end $conf(userhome)
$m2 insert end "$conf(tclversion) / $conf(tkversion)"
$m2 insert end "$conf(tclpatchlevel) / $conf(tkpatchlevel)"
$m2 insert end "$conf(os) $conf(osversion)"
$m2 insert end $conf(machine)
$m2 insert end $conf(platform)
pack $m1 $m2 -side left -expand yes -fill both
frame .about.ok -bg white
pack .about.ok -fill both
button .about.ok.b -text { OK } -font $conf(WIDGETFONT) -background gray \
-highlightbackground gray -command { grab release .about ; destroy .about }
pack .about.ok.b -expand yes
focus .about.ok.b
}
proc SetResources {} {
global conf resources
if [winfo exists .resources] {
raise .resources
focus .options.ok.b
return
} else {
toplevel .resources
wm title .resources "TkNamazu resources"
wm iconname .resources "tknamazu"
wm transient .resources [winfo toplevel [winfo parent .resources]]
set x [expr [winfo screenwidth .resources]/2 - [winfo reqwidth .resources]/2]
set y [expr [winfo screenheight .resources]/2 - [winfo reqheight .resources]/2]
wm geom .resources +$x+$y
}
# set initialColor [$button cget -$name]
# set color [tk_chooseColor -title "Choose a $name color" -parent $w -initialcolor $initialColor]
frame .resources.namazu
label .resources.namazu.label -borderwidth 10 -text {NAMAZU path: }
entry .resources.namazu.entry -textvariable conf(NAMAZU) -width 32 \
-font $conf(WIDGETFONT)
button .resources.namazu.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(NAMAZU) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.namazu.label .resources.namazu.entry \
.resources.namazu.browse -side left -fill both -expand true
frame .resources.browser
label .resources.browser.label -borderwidth 10 -text {BROWSER path: }
entry .resources.browser.entry -textvariable conf(BROWSER) -width 32 \
-font $conf(WIDGETFONT)
button .resources.browser.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(BROWSER) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.browser.label .resources.browser.entry \
.resources.browser.browse -side left -fill both -expand true
frame .resources.extbrowser
label .resources.extbrowser.label -borderwidth 10 -text {EXTBROWSER path:}
entry .resources.extbrowser.entry -textvariable conf(EXTBROWSER) -width 32 \
-font $conf(WIDGETFONT)
button .resources.extbrowser.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(EXTBROWSER) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.extbrowser.label .resources.extbrowser.entry \
.resources.extbrowser.browse -side left -fill both -expand true
frame .resources.extviewer
label .resources.extviewer.label -borderwidth 10 -text {EXTVIEWER path: }
entry .resources.extviewer.entry -textvariable conf(EXTVIEWER) -width 32 \
-font $conf(WIDGETFONT)
button .resources.extviewer.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(EXTVIEWER) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.extviewer.label .resources.extviewer.entry \
.resources.extviewer.browse -side left -fill both -expand true
frame .resources.uncompress
label .resources.uncompress.label -borderwidth 10 -text {UNCOMPRESS path:}
entry .resources.uncompress.entry -textvariable conf(UNCOMPRESS) -width 32 \
-font $conf(WIDGETFONT)
button .resources.uncompress.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(UNCOMPRESS) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.uncompress.label .resources.uncompress.entry \
.resources.uncompress.browse -side left -fill both -expand true
frame .resources.manpage
label .resources.manpage.label -borderwidth 10 -text {MANPAGE path: }
entry .resources.manpage.entry -textvariable conf(MANPAGE) -width 32 \
-font $conf(WIDGETFONT)
button .resources.manpage.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(MANPAGE) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.manpage.label .resources.manpage.entry \
.resources.manpage.browse -side left -fill both -expand true
frame .resources.gnuinfo
label .resources.gnuinfo.label -borderwidth 10 -text {GNUINFO path: }
entry .resources.gnuinfo.entry -textvariable conf(GNUINFO) -width 32 \
-font $conf(WIDGETFONT)
button .resources.gnuinfo.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(GNUINFO) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.gnuinfo.label .resources.gnuinfo.entry \
.resources.gnuinfo.browse -side left -fill both -expand true
frame .resources.mknmz
label .resources.mknmz.label -borderwidth 10 -text {MKNMZ path: }
entry .resources.mknmz.entry -textvariable conf(MKNMZ) -width 32 \
-font $conf(WIDGETFONT)
button .resources.mknmz.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(MKNMZ) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.mknmz.label .resources.mknmz.entry \
.resources.mknmz.browse -side left -fill both -expand true
frame .resources.wdnmz
label .resources.wdnmz.label -borderwidth 10 -text {WDNMZ path: }
entry .resources.wdnmz.entry -textvariable conf(WDNMZ) -width 32 \
-font $conf(WIDGETFONT)
button .resources.wdnmz.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {set conf(WDNMZ) [tk_getOpenFile \
-filetypes {{ALL {*}}}]}
pack .resources.wdnmz.label .resources.wdnmz.entry \
.resources.wdnmz.browse -side left -fill both -expand true
frame .resources.buttons
button .resources.buttons.ok -text OK -command {set resources(ok) 1} \
-underline 0
button .resources.buttons.cancel -text Cancel -command {set resources(ok) 0} \
-underline 0
button .resources.buttons.apply -text Apply -command {set resources(ok) 2} \
-underline 0
pack .resources.buttons.apply .resources.buttons.cancel \
.resources.buttons.ok -side right
pack .resources.namazu .resources.browser .resources.extbrowser \
.resources.extviewer .resources.uncompress .resources.manpage \
.resources.gnuinfo .resources.mknmz .resources.mknmz \
.resources.mknmz .resources.buttons -side top -fill x
bind .resources <Return> {set resources(ok) 1}
bind .resources <Escape> {set resources(ok) 0}
bind .resources <Button-3> {PopupMenu %X %Y}
SetColor {.resources}
while 1 {
focus .resources.buttons.cancel
tkwait variable resources(ok)
if {$resources(ok)} {
break
} else {
break
}
}
focus .tknmz.result.scroll
catch {destroy .resources}
}
################ replace proc routine
proc bgerror {devnull} {}
################ helper proc routine
proc MknmzHelper {} {
global mklog mkbut conf
if [winfo exists .tkmknmz] {
raise .tkmknmz
focus .tkmknmz.input.location
return
} else {
toplevel .tkmknmz
wm title .tkmknmz "TkNamazu mknmz"
wm iconname .tkmknmz "tknamazu"
}
frame .tkmknmz.input -borderwidth 1
pack .tkmknmz.input -side top -fill x
label .tkmknmz.input.l -text {Location:} -padx 0 -font $conf(WIDGETFONT)
entry .tkmknmz.input.location -width 20 -font $conf(WIDGETFONT) \
-relief sunken -textvariable conf(TARGETDIR)
pack .tkmknmz.input.l -side left
pack .tkmknmz.input.location -side left -fill x -expand true
set mkbut [button .tkmknmz.input.execute -text {Execute} -font $conf(WIDGETFONT) \
-underline 1 -command {ExecMknmz}]
button .tkmknmz.input.browse -text {Browse} -font $conf(WIDGETFONT) \
-underline 0 -command {DirectoryExplorer}
pack .tkmknmz.input.browse .tkmknmz.input.execute -side right
bind .tkmknmz.input.location <Return> {ExecMknmz}
bind .tkmknmz.input.location <Control-c> {Break}
bind .tkmknmz <Alt-x> {focus .tkmknmz.input.execute ; break}
bind .tkmknmz <Alt-b> {focus .tkmknmz.input.browse ; break}
bind .tkmknmz <Button-3> {PopupMenu %X %Y}
frame .tkmknmz.result
pack .tkmknmz.result -side top -fill both -expand true
set mklog [text .tkmknmz.result.log \
-width $conf(WIDTH) -height [expr $conf(HEIGHT) / 2] -font $conf(WIDGETFONT) \
-borderwidth 2 -relief sunken -setgrid true -state normal \
-yscrollcommand {.tkmknmz.result.scroll set}]
scrollbar .tkmknmz.result.scroll -command {.tkmknmz.result.log yview}
pack .tkmknmz.result.scroll -side right -fill y
pack .tkmknmz.result.log -side left -fill both -expand true
focus .tkmknmz.input.location
SetColor {.tkmknmz}
}
proc ExecMknmz {} {
global mklog mkinput mkbut conf
MakeOptions
$mklog delete 1.0 end
if [catch {open "|$conf(MKNMZ) $conf(MKOPTIONS) \"$conf(TARGETDIR)\""} mkinput] {
$mklog insert end "$mkinput\n"
} else {
fileevent $mkinput readable {
if [eof $mkinput] {
BreakMknmz
} else {
gets $mkinput mkline
$mklog insert end "$mkline\n"
$mklog see end
update
}
}
set conf(commandline) "$conf(MKNMZ) $conf(MKOPTIONS) $conf(TARGETDIR)"
$mklog insert end "%$conf(commandline)\n"
$mkbut config -text {Stop} -command {BreakMknmz}
}
}
proc BreakMknmz {} {
global mkinput mkbut
catch {close $mkinput}
$mkbut config -text {Execute} -command {ExecMknmz}
}
proc DirectoryExplorer {} {
global conf
set conf(TARGETDIR) [tk_getOpenFile -filetypes {{ALL {*}}}]
regsub {^(.*/).*} $conf(TARGETDIR) {\1} conf(TARGETDIR)
}
proc MainWidget {} {
global conf inside version log but
set inside(oldfocus) [focus]
wm withdraw .
toplevel .tknmz -class TkNamazu
wm minsize .tknmz 40 5
wm title .tknmz "TkNamazu version $version"
wm iconname .tknmz "tknamazu"
wm protocol .tknmz WM_DELETE_WINDOW {exit}
frame .tknmz.menubar
pack .tknmz.menubar -side top -fill x
menubutton .tknmz.file -text {File} -menu .tknmz.file.menu -underline 0 \
-font $conf(WIDGETFONT)
menu .tknmz.file.menu -tearoff no
.tknmz.file.menu add command -label {Open} -underline 0 \
-font $conf(WIDGETFONT) -command {OpenViewer}
.tknmz.file.menu add command -label {Open URL} -underline 5 \
-font $conf(WIDGETFONT) -command {OpenURL}
.tknmz.file.menu add command -label {Save As} -underline 2 \
-font $conf(WIDGETFONT) -command {SaveFile}
.tknmz.file.menu add separator
.tknmz.file.menu add command -label {Load namazurc} -underline 0 \
-font $conf(WIDGETFONT) -command {LoadConf}
.tknmz.file.menu add separator
.tknmz.file.menu add cascade -label {Select Indexes} -underline 0 \
-menu .tknmz.file.menu.selnmzidx -font $conf(WIDGETFONT)
MakeNamazuIndexLuncher
.tknmz.file.menu add separator
.tknmz.file.menu add command -label {Quit} -underline 0 \
-font $conf(WIDGETFONT) -command {Quit}
menubutton .tknmz.edit -text {Edit} -menu .tknmz.edit.menu -underline 0 \
-font $conf(WIDGETFONT)
menu .tknmz.edit.menu -tearoff no
.tknmz.edit.menu add command -label {Editable} -underline 0 \
-font $conf(WIDGETFONT) -command {$log config -state normal -relief sunken }
.tknmz.edit.menu add command -label {Copy} -underline 0 \
-font $conf(WIDGETFONT) -command {CopyString}
.tknmz.edit.menu add command -label {Cut} -underline 1 \
-font $conf(WIDGETFONT) -command {CutString}
.tknmz.edit.menu add command -label {Paste} -underline 0 \
-font $conf(WIDGETFONT) -command {PasteString {}}
.tknmz.edit.menu add separator
.tknmz.edit.menu add command -label {Find} -underline 0 \
-font $conf(WIDGETFONT) -command {FindWord}
.tknmz.edit.menu add separator
.tknmz.edit.menu add command -label {Set authorization} -underline 4 \
-font $conf(WIDGETFONT) -command {SetAuthorization}
.tknmz.edit.menu add separator
.tknmz.edit.menu add command -label {Display configuration} -underline 0 \
-font $conf(WIDGETFONT) -command {DisplayConfiguration}
.tknmz.edit.menu add command -label {Load tknamazurc} -underline 0 \
-font $conf(WIDGETFONT) -command {LoadTknmzrc}
# .tknmz.edit.menu add command -label {Option} -underline 0 \
# -font $conf(WIDGETFONT) -command {SetResources}
menubutton .tknmz.go -text {Go} -menu .tknmz.go.menu -underline 0 \
-font $conf(WIDGETFONT)
menu .tknmz.go.menu -tearoff no
.tknmz.go.menu add command -label {To Top} -underline 3 \
-font $conf(WIDGETFONT) -command {$log see 1.0}
.tknmz.go.menu add command -label {To Bottom} -underline 3 \
-font $conf(WIDGETFONT) -command {$log see end}
.tknmz.go.menu add separator
.tknmz.go.menu add cascade -label {Bookmark} -underline 4 \
-menu .tknmz.go.menu.selbookmark -font $conf(WIDGETFONT)
MakeBookMarkLuncher
# .tknmz.go.menu add separator
# .tknmz.go.menu add cascade -label {History} -underline 1 \
# -font $conf(WIDGETFONT) -command {}
menubutton .tknmz.mknmz -text {Mknmz} -menu .tknmz.mknmz.menu -underline 0 \
-font $conf(WIDGETFONT)
menu .tknmz.mknmz.menu -tearoff no
.tknmz.mknmz.menu add command -label {Execute mknmz} -underline 0 \
-font $conf(WIDGETFONT) -command {MknmzHelper}
# menubutton .tknmz.utilities -text {Utilities} -menu .tknmz.utilities.menu -underline 1 \
# -font $conf(WIDGETFONT)
# menu .tknmz.utilities.menu -tearoff no
# .tknmz.utilities.menu add command -label {Execute clnmz} -underline 8 \
# -font $conf(WIDGETFONT) -command {ClnmzHelper}
# .tknmz.utilities.menu add command -label {Execute gcnmz} -underline 8 \
# -font $conf(WIDGETFONT) -command {GcnmzHelper}
# .tknmz.utilities.menu add command -label {Execute mailutime} -underline 8 \
# -font $conf(WIDGETFONT) -command {MailutimeHelper}
# .tknmz.utilities.menu add command -label {Execute rvnmz} -underline 8 \
# -font $conf(WIDGETFONT) -command {RvnmzHelper}
# .tknmz.utilities.menu add command -label {Execute vfnmz} -underline 8 \
# -font $conf(WIDGETFONT) -command {VfnmzHelper}
# .tknmz.utilities.menu add command -label {Execute wdnmz} -underline 8 \
# -font $conf(WIDGETFONT) -command {WdnmzHelper}
pack .tknmz.file .tknmz.edit .tknmz.go .tknmz.mknmz \
-side left -in .tknmz.menubar
menubutton .tknmz.help -text {Help} -menu .tknmz.help.menu -underline 0 \
-font $conf(WIDGETFONT)
menu .tknmz.help.menu -tearoff no
.tknmz.help.menu add command -label {Help} -underline 0 \
-font $conf(WIDGETFONT) -command {HelpView}
.tknmz.help.menu add command -label {Version} -underline 0 \
-font $conf(WIDGETFONT) -command {AboutTknamazu}
pack .tknmz.help -side right -in .tknmz.menubar
frame .tknmz.input
pack .tknmz.input -side top -fill x
label .tknmz.input.l -text {Keyword:} -padx 0 -font $conf(WIDGETFONT) -underline 0
entry .tknmz.keyword -width 20 -relief sunken -font $conf(WIDGETFONT) -textvariable inside(keyword)
pack .tknmz.input.l -side left
pack .tknmz.keyword -side left -fill x -expand true -in .tknmz.input
set but [button .tknmz.input.search -text {Search} -font $conf(WIDGETFONT) \
-underline 0 -command {Exec $inside(keyword)}]
button .tknmz.input.quit -text {Quit} -font $conf(WIDGETFONT) \
-underline 0 -command {Quit}
pack .tknmz.input.quit .tknmz.input.search -side right
frame .tknmz.optionbar
pack .tknmz.optionbar -side top -fill x
image create photo tknmzicon -file "$conf(tknmzhome)/tknamazu_icon.ppm"
button .tknmz.optionbar.icon -image tknmzicon -command {AboutTknamazu}
pack .tknmz.optionbar.icon -side right
frame .tknmz.optionbar.options
pack .tknmz.optionbar.options -side top -fill x
pack .tknmz.optionbar.options -side left
frame .tknmz.optionbar.options.opt1
pack .tknmz.optionbar.options.opt1 -side top -fill x
label .tknmz.optionbar.options.opt1.displaylabel -text {DisplayCount:} \
-font $conf(WIDGETFONT) -underline 7
tk_optionMenu .tknmz.optionbar.options.opt1.display opt(n) 9 10 20 30 50 100 ALL
.tknmz.optionbar.options.opt1.display configure -width 3
pack .tknmz.optionbar.options.opt1.displaylabel .tknmz.optionbar.options.opt1.display \
-side left -fill x
label .tknmz.optionbar.options.opt1.summarylabel -text {Summary:} \
-font $conf(WIDGETFONT) -underline 1
tk_optionMenu .tknmz.optionbar.options.opt1.summary opt(s) ON OFF
.tknmz.optionbar.options.opt1.summary configure -width 3
pack .tknmz.optionbar.options.opt1.summarylabel .tknmz.optionbar.options.opt1.summary \
-side left -fill x
label .tknmz.optionbar.options.opt1.sortlabel -text {Sort:} -font $conf(WIDGETFONT) -underline 1
tk_optionMenu .tknmz.optionbar.options.opt1.sort opt(l) score \
late early subject:ascending subject:descending from:ascending from:descending \
size:ascending size:descending uri:ascending uri:descending
.tknmz.optionbar.options.opt1.sort configure -width 7
pack .tknmz.optionbar.options.opt1.sortlabel .tknmz.optionbar.options.opt1.sort \
-side left -fill x
frame .tknmz.optionbar.options.opt2
pack .tknmz.optionbar.options.opt2 -side bottom -fill x
# button .tknmz.optionbar.options.opt2.backward -text {<} -font $conf(WIDGETFONT) -command {BackHistory}
# button .tknmz.optionbar.options.opt2.forward -text {>} -font $conf(WIDGETFONT) -command {ForwardHistory}
# pack .tknmz.optionbar.options.opt2.backward .tknmz.optionbar.options.opt2.forward -side left -fill x
label .tknmz.optionbar.options.opt2.smartbrowselabel -text {SmartBrowse:} \
-font $conf(WIDGETFONT) -underline 1
tk_optionMenu .tknmz.optionbar.options.opt2.smartbrowse conf(SMARTBROWSE) 0 1 2
pack .tknmz.optionbar.options.opt2.smartbrowselabel .tknmz.optionbar.options.opt2.smartbrowse \
-side left -fill x
label .tknmz.optionbar.options.opt2.headerwarplabel -text {HeaderWipe:} \
-font $conf(WIDGETFONT) -underline 6
tk_optionMenu .tknmz.optionbar.options.opt2.headerwarp conf(HEADERWIPE) ON OFF
.tknmz.optionbar.options.opt2.headerwarp configure -width 3
pack .tknmz.optionbar.options.opt2.headerwarplabel .tknmz.optionbar.options.opt2.headerwarp \
-side left -fill x
label .tknmz.optionbar.options.opt2.siteselectorlabel -text {Site:} \
-font $conf(WIDGETFONT) -underline 1
MakeNamazuSiteSelector
pack .tknmz.optionbar.options.opt2.siteselectorlabel .tknmz.optionbar.options.opt2.siteselector \
-side left -fill x
frame .tknmz.result
pack .tknmz.result -side top -fill both -expand true
set log [text .tknmz.result.log -width $conf(WIDTH) -height $conf(HEIGHT) \
-borderwidth 1 -relief raised -setgrid true -font $conf(TEXTFONT) \
-state disabled -yscrollcommand {.tknmz.result.scroll set}]
scrollbar .tknmz.result.scroll -command {.tknmz.result.log yview}
pack .tknmz.result.scroll -side right -fill y
pack .tknmz.result.log -side left -fill both -expand true
}
proc MainKeyBind {} {
global conf inside
bind .tknmz <Control-f> {FindWord}
bind .tknmz <Control-q> {destroy .tknmz ; exit}
bind .tknmz <Alt-k> {focus .tknmz.keyword ; break}
bind .tknmz <Alt-s> {focus .tknmz.input.search ; break}
bind .tknmz <Alt-b> {focus .tknmz.input.search ; break}
bind .tknmz <Alt-q> {focus .tknmz.input.quit ; break}
bind .tknmz <Alt-c> {focus .tknmz.optionbar.options.opt1.display ; break}
bind .tknmz <Alt-u> {focus .tknmz.optionbar.options.opt1.summary ; break}
bind .tknmz <Alt-o> {focus .tknmz.optionbar.options.opt1.sort ; break}
bind .tknmz <Alt-m> {focus .tknmz.optionbar.options.opt2.smartbrowse ; break}
bind .tknmz <Alt-w> {focus .tknmz.optionbar.options.opt2.headerwarp ; break}
bind .tknmz <Alt-i> {focus .tknmz.optionbar.options.opt2.siteselector ; break}
bind .tknmz <Control-u> {PopupMenu %X %Y}
bind .tknmz <Control-n> {.tknmz.result.log yview scroll 1 unit}
bind .tknmz <Control-p> {.tknmz.result.log yview scroll -1 unit}
bind .tknmz <Control-v> {.tknmz.result.log yview scroll 1 page}
bind .tknmz <Control-z> {.tknmz.result.log yview scroll -1 page}
if {$conf(kanjimode) && [regexp -nocase {unix} $conf(platform)] \
&& ($conf(tkversion) < 8.1)} {
bind Entry <Control-o> {kinput_start %W over}
bind Entry <Shift-space> {kinput_start %W over}
}
bind .tknmz.keyword <Return> {Exec $inside(keyword)}
bind .tknmz.keyword <Button-3> {PopupMenu %X %Y}
bind .tknmz.result.log <Button-1> {focus .tknmz.result.scroll}
bind .tknmz.result.log <Button-2> {Kick {} %X %Y}
bind .tknmz.result.log <Button-3> {PopupMenu %X %Y}
bind .tknmz.result.log <Control-Button-3> {Kick {} %X %Y}
bind .tknmz.result.log <Button-4> [list %W yview scroll -5 units]
bind .tknmz.result.log <Button-5> [list %W yview scroll 5 units]
bind .tknmz.result.log <Shift-Button-4> [list %W yview scroll -1 units]
bind .tknmz.result.log <Shift-Button-5> [list %W yview scroll 1 units]
bind .tknmz.result.log <Control-Button-4> [list %W yview scroll -1 pages]
bind .tknmz.result.log <Control-Button-5> [list %W yview scroll 1 pages]
bind .tknmz.result.scroll <Button-1> {focus .tknmz.result.scroll}
bind .tknmz.result.scroll <space> {.tknmz.result.log yview scroll 1 page}
bind .tknmz.result.scroll <BackSpace> {.tknmz.result.log yview scroll -1 page}
bind .tknmz.result.scroll <Return> {.tknmz.result.log yview scroll 1 unit}
bind .tknmz.result.scroll <Key-0> {Exec $inside(keyword)}
}
################ main routine and .tknmz widget
SetDefaultResources
LoadResources
Initialization
MainWidget
MainKeyBind
SetColor {.tknmz}
if {$argc > 0} {
Browse [lindex $argv 0]
} else {
HelpView
}
catch {selection clear}
focus .tknmz.keyword
if {$tk_version < 4.0} {
puts \
"Warning: the script are based on Tk 8.1a2. You have
Tk $tk_version, so script may not work.
Please see <URL:http://www.scriptics.com/>
"
}
|